@prefecthq/graphs 2.2.3 → 2.2.4
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/dist/graphs.mjs +954 -920
- package/dist/graphs.mjs.map +1 -1
- package/dist/graphs.umd.js +59 -59
- package/dist/graphs.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/src/models/RunGraph.d.ts +2 -1
- package/dist/types/src/models/index.d.ts +1 -0
- package/dist/types/src/models/selection.d.ts +7 -2
- package/dist/types/src/models/states.d.ts +2 -1
- package/package.json +1 -1
package/dist/graphs.umd.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
(function(Vt,z){typeof exports=="object"&&typeof module<"u"?z(exports,require("vue"),require("@prefecthq/vue-compositions"),require("@prefecthq/prefect-design")):typeof define=="function"&&define.amd?define(["exports","vue","@prefecthq/vue-compositions","@prefecthq/prefect-design"],z):(Vt=typeof globalThis<"u"?globalThis:Vt||self,z(Vt["prefect-graphs"]={},Vt.Vue,Vt.vueCompositions,Vt.prefectDesign))})(this,function(Vt,z,mr,Ki){"use strict";var hM=Object.defineProperty;var lM=(Vt,z,mr)=>z in Vt?hM(Vt,z,{enumerable:!0,configurable:!0,writable:!0,value:mr}):Vt[z]=mr;var yf=(Vt,z,mr)=>(lM(Vt,typeof z!="symbol"?z+"":z,mr),mr);const Cf="nodes-container",kb="node-container",Ob="edge-container";function bl(r){const t=Object.prototype.toString.call(r);return r instanceof Date||typeof r=="object"&&t==="[object Date]"?new r.constructor(+r):typeof r=="number"||t==="[object Number]"||typeof r=="string"||t==="[object String]"?new Date(r):new Date(NaN)}function Bb(r,t){return r instanceof Date?new r.constructor(t):new Date(t)}function Wb(r,t){const e=+bl(r);return Bb(r,e+t)}const ta=1e3;function Ub(r,t){return Wb(r,t*1e3)}function Xb(r){return t=>{const i=(r?Math[r]:Math.trunc)(t);return i===0?0:i}}function Ef(r,t){return+bl(r)-+bl(t)}function Zb(r,t,e){const i=Ef(r,t)/1e3;return Xb(e==null?void 0:e.roundingMethod)(i)}var Zr=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(Zr||{}),If=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(If||{}),xl=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(xl||{}),ft=(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))(ft||{}),xi=(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))(xi||{}),K=(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))(K||{}),Fs=(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))(Fs||{}),ht=(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))(ht||{}),Q=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(Q||{}),Yi=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(Yi||{}),_i=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(_i||{}),vi=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(vi||{}),Se=(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))(Se||{}),Ti=(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))(Ti||{}),_l=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(_l||{}),Ke=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(Ke||{}),$t=(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))($t||{}),jt=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(jt||{}),wi=(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))(wi||{});const q={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 vl=/iPhone/i,Af=/iPod/i,Rf=/iPad/i,Mf=/\biOS-universal(?:.+)Mac\b/i,Tl=/\bAndroid(?:.+)Mobile\b/i,Lf=/Android/i,Ns=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,ea=/Silk/i,zi=/Windows Phone/i,Pf=/\bWindows(?:.+)ARM\b/i,Gf=/BlackBerry/i,Ff=/BB10/i,Nf=/Opera Mini/i,Df=/\b(CriOS|Chrome)(?:.+)Mobile/i,kf=/Mobile(?:.+)Firefox\b/i,Of=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"};function Vb(r){return function(t){return t.test(r)}}function Bf(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=Vb(e),n={apple:{phone:s(vl)&&!s(zi),ipod:s(Af),tablet:!s(vl)&&(s(Rf)||Of(t))&&!s(zi),universal:s(Mf),device:(s(vl)||s(Af)||s(Rf)||s(Mf)||Of(t))&&!s(zi)},amazon:{phone:s(Ns),tablet:!s(Ns)&&s(ea),device:s(Ns)||s(ea)},android:{phone:!s(zi)&&s(Ns)||!s(zi)&&s(Tl),tablet:!s(zi)&&!s(Ns)&&!s(Tl)&&(s(ea)||s(Lf)),device:!s(zi)&&(s(Ns)||s(ea)||s(Tl)||s(Lf))||s(/\bokhttp\b/i)},windows:{phone:s(zi),tablet:s(Pf),device:s(zi)||s(Pf)},other:{blackberry:s(Gf),blackberry10:s(Ff),opera:s(Nf),firefox:s(kf),chrome:s(Df),device:s(Gf)||s(Ff)||s(Nf)||s(kf)||s(Df)},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 Hb=Bf.default??Bf,ji=Hb(globalThis.navigator);q.RETINA_PREFIX=/@([0-9\.]+)x/,q.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var xe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ds(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function Kb(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 Wf={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,u,d){if(typeof c!="function")throw new TypeError("The listener must be a function");var f=new s(c,u||h,d),m=e?e+l:l;return h._events[m]?h._events[m].fn?h._events[m]=[h._events[m],f]:h._events[m].push(f):(h._events[m]=f,h._eventsCount++),h}function o(h,l){--h._eventsCount===0?h._events=new i:delete h._events[l]}function a(){this._events=new i,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],c,u;if(this._eventsCount===0)return l;for(u in c=this._events)t.call(c,u)&&l.push(e?u.slice(1):u);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(c)):l},a.prototype.listeners=function(l){var c=e?e+l:l,u=this._events[c];if(!u)return[];if(u.fn)return[u.fn];for(var d=0,f=u.length,m=new Array(f);d<f;d++)m[d]=u[d].fn;return m},a.prototype.listenerCount=function(l){var c=e?e+l:l,u=this._events[c];return u?u.fn?1:u.length:0},a.prototype.emit=function(l,c,u,d,f,m){var p=e?e+l:l;if(!this._events[p])return!1;var g=this._events[p],y=arguments.length,_,b;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,u),!0;case 4:return g.fn.call(g.context,c,u,d),!0;case 5:return g.fn.call(g.context,c,u,d,f),!0;case 6:return g.fn.call(g.context,c,u,d,f,m),!0}for(b=1,_=new Array(y-1);b<y;b++)_[b-1]=arguments[b];g.fn.apply(g.context,_)}else{var v=g.length,w;for(b=0;b<v;b++)switch(g[b].once&&this.removeListener(l,g[b].fn,void 0,!0),y){case 1:g[b].fn.call(g[b].context);break;case 2:g[b].fn.call(g[b].context,c);break;case 3:g[b].fn.call(g[b].context,c,u);break;case 4:g[b].fn.call(g[b].context,c,u,d);break;default:if(!_)for(w=1,_=new Array(y-1);w<y;w++)_[w-1]=arguments[w];g[b].fn.apply(g[b].context,_)}}return!0},a.prototype.on=function(l,c,u){return n(this,l,c,u,!1)},a.prototype.once=function(l,c,u){return n(this,l,c,u,!0)},a.prototype.removeListener=function(l,c,u,d){var f=e?e+l:l;if(!this._events[f])return this;if(!c)return o(this,f),this;var m=this._events[f];if(m.fn)m.fn===c&&(!d||m.once)&&(!u||m.context===u)&&o(this,f);else{for(var p=0,g=[],y=m.length;p<y;p++)(m[p].fn!==c||d&&!m[p].once||u&&m[p].context!==u)&&g.push(m[p]);g.length?this._events[f]=g.length===1?g[0]:g:o(this,f)}return this},a.prototype.removeAllListeners=function(l){var c;return l?(c=e?e+l:l,this._events[c]&&o(this,c)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=e,a.EventEmitter=a,r.exports=a})(Wf);var Yb=Wf.exports;const kn=Ds(Yb);var wl={exports:{}};wl.exports=ia,wl.exports.default=ia;function ia(r,t,e){e=e||2;var i=t&&t.length,s=i?t[0]*e:r.length,n=Uf(r,0,s,e,!0),o=[];if(!n||n.next===n.prev)return o;var a,h,l,c,u,d,f;if(i&&(n=Qb(r,t,n,e)),r.length>80*e){a=l=r[0],h=c=r[1];for(var m=e;m<s;m+=e)u=r[m],d=r[m+1],u<a&&(a=u),d<h&&(h=d),u>l&&(l=u),d>c&&(c=d);f=Math.max(l-a,c-h),f=f!==0?32767/f:0}return On(n,o,e,a,h,f,0),o}function Uf(r,t,e,i,s){var n,o;if(s===El(r,t,e,i)>0)for(n=t;n<e;n+=i)o=Vf(n,r[n],r[n+1],o);else for(n=e-i;n>=t;n-=i)o=Vf(n,r[n],r[n+1],o);return o&&ra(o,o.next)&&(Wn(o),o=o.next),o}function Vr(r,t){if(!r)return r;t||(t=r);var e=r,i;do if(i=!1,!e.steiner&&(ra(e,e.next)||Ot(e.prev,e,e.next)===0)){if(Wn(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function On(r,t,e,i,s,n,o){if(r){!o&&n&&rx(r,i,s,n);for(var a=r,h,l;r.prev!==r.next;){if(h=r.prev,l=r.next,n?jb(r,i,s,n):zb(r)){t.push(h.i/e|0),t.push(r.i/e|0),t.push(l.i/e|0),Wn(r),r=l.next,a=l.next;continue}if(r=l,r===a){o?o===1?(r=Jb(Vr(r),t,e),On(r,t,e,i,s,n,2)):o===2&&$b(r,t,e,i,s,n):On(Vr(r),t,e,i,s,n,1);break}}}}function zb(r){var t=r.prev,e=r,i=r.next;if(Ot(t,e,i)>=0)return!1;for(var s=t.x,n=e.x,o=i.x,a=t.y,h=e.y,l=i.y,c=s<n?s<o?s:o:n<o?n:o,u=a<h?a<l?a:l:h<l?h:l,d=s>n?s>o?s:o:n>o?n:o,f=a>h?a>l?a:l:h>l?h:l,m=i.next;m!==t;){if(m.x>=c&&m.x<=d&&m.y>=u&&m.y<=f&&ks(s,a,n,h,o,l,m.x,m.y)&&Ot(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function jb(r,t,e,i){var s=r.prev,n=r,o=r.next;if(Ot(s,n,o)>=0)return!1;for(var a=s.x,h=n.x,l=o.x,c=s.y,u=n.y,d=o.y,f=a<h?a<l?a:l:h<l?h:l,m=c<u?c<d?c:d:u<d?u:d,p=a>h?a>l?a:l:h>l?h:l,g=c>u?c>d?c:d:u>d?u:d,y=Sl(f,m,t,e,i),_=Sl(p,g,t,e,i),b=r.prevZ,v=r.nextZ;b&&b.z>=y&&v&&v.z<=_;){if(b.x>=f&&b.x<=p&&b.y>=m&&b.y<=g&&b!==s&&b!==o&&ks(a,c,h,u,l,d,b.x,b.y)&&Ot(b.prev,b,b.next)>=0||(b=b.prevZ,v.x>=f&&v.x<=p&&v.y>=m&&v.y<=g&&v!==s&&v!==o&&ks(a,c,h,u,l,d,v.x,v.y)&&Ot(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;b&&b.z>=y;){if(b.x>=f&&b.x<=p&&b.y>=m&&b.y<=g&&b!==s&&b!==o&&ks(a,c,h,u,l,d,b.x,b.y)&&Ot(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;v&&v.z<=_;){if(v.x>=f&&v.x<=p&&v.y>=m&&v.y<=g&&v!==s&&v!==o&&ks(a,c,h,u,l,d,v.x,v.y)&&Ot(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function Jb(r,t,e){var i=r;do{var s=i.prev,n=i.next.next;!ra(s,n)&&Xf(s,i,i.next,n)&&Bn(s,n)&&Bn(n,s)&&(t.push(s.i/e|0),t.push(i.i/e|0),t.push(n.i/e|0),Wn(i),Wn(i.next),i=r=n),i=i.next}while(i!==r);return Vr(i)}function $b(r,t,e,i,s,n){var o=r;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&ox(o,a)){var h=Zf(o,a);o=Vr(o,o.next),h=Vr(h,h.next),On(o,t,e,i,s,n,0),On(h,t,e,i,s,n,0);return}a=a.next}o=o.next}while(o!==r)}function Qb(r,t,e,i){var s=[],n,o,a,h,l;for(n=0,o=t.length;n<o;n++)a=t[n]*i,h=n<o-1?t[n+1]*i:r.length,l=Uf(r,a,h,i,!1),l===l.next&&(l.steiner=!0),s.push(nx(l));for(s.sort(qb),n=0;n<s.length;n++)e=tx(s[n],e);return e}function qb(r,t){return r.x-t.x}function tx(r,t){var e=ex(r,t);if(!e)return t;var i=Zf(e,r);return Vr(i,i.next),Vr(e,e.next)}function ex(r,t){var e=t,i=r.x,s=r.y,n=-1/0,o;do{if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){var a=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(a<=i&&a>n&&(n=a,o=e.x<e.next.x?e:e.next,a===i))return o}e=e.next}while(e!==t);if(!o)return null;var h=o,l=o.x,c=o.y,u=1/0,d;e=o;do i>=e.x&&e.x>=l&&i!==e.x&&ks(s<c?i:n,s,l,c,s<c?n:i,s,e.x,e.y)&&(d=Math.abs(s-e.y)/(i-e.x),Bn(e,r)&&(d<u||d===u&&(e.x>o.x||e.x===o.x&&ix(o,e)))&&(o=e,u=d)),e=e.next;while(e!==h);return o}function ix(r,t){return Ot(r.prev,r,t.prev)<0&&Ot(t.next,r,r.next)<0}function rx(r,t,e,i){var s=r;do s.z===0&&(s.z=Sl(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,sx(s)}function sx(r){var t,e,i,s,n,o,a,h,l=1;do{for(e=r,r=null,n=null,o=0;e;){for(o++,i=e,a=0,t=0;t<l&&(a++,i=i.nextZ,!!i);t++);for(h=l;a>0||h>0&&i;)a!==0&&(h===0||!i||e.z<=i.z)?(s=e,e=e.nextZ,a--):(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(o>1);return r}function Sl(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 nx(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 ks(r,t,e,i,s,n,o,a){return(s-o)*(t-a)>=(r-o)*(n-a)&&(r-o)*(i-a)>=(e-o)*(t-a)&&(e-o)*(n-a)>=(s-o)*(i-a)}function ox(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!ax(r,t)&&(Bn(r,t)&&Bn(t,r)&&hx(r,t)&&(Ot(r.prev,r,t.prev)||Ot(r,t.prev,t))||ra(r,t)&&Ot(r.prev,r,r.next)>0&&Ot(t.prev,t,t.next)>0)}function Ot(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function ra(r,t){return r.x===t.x&&r.y===t.y}function Xf(r,t,e,i){var s=na(Ot(r,t,e)),n=na(Ot(r,t,i)),o=na(Ot(e,i,r)),a=na(Ot(e,i,t));return!!(s!==n&&o!==a||s===0&&sa(r,e,t)||n===0&&sa(r,i,t)||o===0&&sa(e,r,i)||a===0&&sa(e,t,i))}function sa(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 na(r){return r>0?1:r<0?-1:0}function ax(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&&Xf(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Bn(r,t){return Ot(r.prev,r,r.next)<0?Ot(r,t,r.next)>=0&&Ot(r,r.prev,t)>=0:Ot(r,t,r.prev)<0||Ot(r,r.next,t)<0}function hx(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 Zf(r,t){var e=new Cl(r.i,r.x,r.y),i=new Cl(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 Vf(r,t,e,i){var s=new Cl(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 Wn(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 Cl(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}ia.deviation=function(r,t,e,i){var s=t&&t.length,n=s?t[0]*e:r.length,o=Math.abs(El(r,0,n,e));if(s)for(var a=0,h=t.length;a<h;a++){var l=t[a]*e,c=a<h-1?t[a+1]*e:r.length;o-=Math.abs(El(r,l,c,e))}var u=0;for(a=0;a<i.length;a+=3){var d=i[a]*e,f=i[a+1]*e,m=i[a+2]*e;u+=Math.abs((r[d]-r[m])*(r[f+1]-r[d+1])-(r[d]-r[f])*(r[m+1]-r[d+1]))}return o===0&&u===0?0:Math.abs((u-o)/o)};function El(r,t,e,i){for(var s=0,n=t,o=e-i;n<e;n+=i)s+=(r[o]-r[n])*(r[n+1]+r[o+1]),o=n;return s}ia.flatten=function(r){for(var t=r[0][0].length,e={vertices:[],holes:[],dimensions:t},i=0,s=0;s<r.length;s++){for(var n=0;n<r[s].length;n++)for(var o=0;o<t;o++)e.vertices.push(r[s][n][o]);s>0&&(i+=r[s-1].length,e.holes.push(i))}return e};var lx=wl.exports;const cx=Ds(lx);var oa={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */oa.exports,function(r,t){(function(e){var i=t&&!t.nodeType&&t,s=r&&!r.nodeType&&r,n=typeof xe=="object"&&xe;(n.global===n||n.window===n||n.self===n)&&(e=n);var o,a=2147483647,h=36,l=1,c=26,u=38,d=700,f=72,m=128,p="-",g=/^xn--/,y=/[^\x20-\x7E]/,_=/[\x2E\u3002\uFF0E\uFF61]/g,b={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},v=h-l,w=Math.floor,C=String.fromCharCode,E;function A(k){throw new RangeError(b[k])}function R(k,F){for(var V=k.length,$=[];V--;)$[V]=F(k[V]);return $}function G(k,F){var V=k.split("@"),$="";V.length>1&&($=V[0]+"@",k=V[1]),k=k.replace(_,".");var dt=k.split("."),ot=R(dt,F).join(".");return $+ot}function N(k){for(var F=[],V=0,$=k.length,dt,ot;V<$;)dt=k.charCodeAt(V++),dt>=55296&&dt<=56319&&V<$?(ot=k.charCodeAt(V++),(ot&64512)==56320?F.push(((dt&1023)<<10)+(ot&1023)+65536):(F.push(dt),V--)):F.push(dt);return F}function P(k){return R(k,function(F){var V="";return F>65535&&(F-=65536,V+=C(F>>>10&1023|55296),F=56320|F&1023),V+=C(F),V}).join("")}function I(k){return k-48<10?k-22:k-65<26?k-65:k-97<26?k-97:h}function D(k,F){return k+22+75*(k<26)-((F!=0)<<5)}function X(k,F,V){var $=0;for(k=V?w(k/d):k>>1,k+=w(k/F);k>v*c>>1;$+=h)k=w(k/v);return w($+(v+1)*k/(k+u))}function H(k){var F=[],V=k.length,$,dt=0,ot=m,Et=f,Mt,_t,Y,tt,et,B,xt,yt,Lt;for(Mt=k.lastIndexOf(p),Mt<0&&(Mt=0),_t=0;_t<Mt;++_t)k.charCodeAt(_t)>=128&&A("not-basic"),F.push(k.charCodeAt(_t));for(Y=Mt>0?Mt+1:0;Y<V;){for(tt=dt,et=1,B=h;Y>=V&&A("invalid-input"),xt=I(k.charCodeAt(Y++)),(xt>=h||xt>w((a-dt)/et))&&A("overflow"),dt+=xt*et,yt=B<=Et?l:B>=Et+c?c:B-Et,!(xt<yt);B+=h)Lt=h-yt,et>w(a/Lt)&&A("overflow"),et*=Lt;$=F.length+1,Et=X(dt-tt,$,tt==0),w(dt/$)>a-ot&&A("overflow"),ot+=w(dt/$),dt%=$,F.splice(dt++,0,ot)}return P(F)}function Z(k){var F,V,$,dt,ot,Et,Mt,_t,Y,tt,et,B=[],xt,yt,Lt,Zt;for(k=N(k),xt=k.length,F=m,V=0,ot=f,Et=0;Et<xt;++Et)et=k[Et],et<128&&B.push(C(et));for($=dt=B.length,dt&&B.push(p);$<xt;){for(Mt=a,Et=0;Et<xt;++Et)et=k[Et],et>=F&&et<Mt&&(Mt=et);for(yt=$+1,Mt-F>w((a-V)/yt)&&A("overflow"),V+=(Mt-F)*yt,F=Mt,Et=0;Et<xt;++Et)if(et=k[Et],et<F&&++V>a&&A("overflow"),et==F){for(_t=V,Y=h;tt=Y<=ot?l:Y>=ot+c?c:Y-ot,!(_t<tt);Y+=h)Zt=_t-tt,Lt=h-tt,B.push(C(D(tt+Zt%Lt,0))),_t=w(Zt/Lt);B.push(C(D(_t,0))),ot=X(V,yt,$==dt),V=0,++$}++V,++F}return B.join("")}function j(k){return G(k,function(F){return g.test(F)?H(F.slice(4).toLowerCase()):F})}function O(k){return G(k,function(F){return y.test(F)?"xn--"+Z(F):F})}if(o={version:"1.4.1",ucs2:{decode:N,encode:P},decode:H,encode:Z,toASCII:O,toUnicode:j},i&&s)if(r.exports==i)s.exports=o;else for(E in o)o.hasOwnProperty(E)&&(i[E]=o[E]);else e.punycode=o})(xe)}(oa,oa.exports);var ux=oa.exports,dx=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(e 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 n=Object.getOwnPropertySymbols(t);if(n.length!==1||n[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},Hf=typeof Symbol<"u"&&Symbol,fx=dx,px=function(){return typeof Hf!="function"||typeof Symbol!="function"||typeof Hf("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:fx()},Kf={foo:{}},mx=Object,gx=function(){return{__proto__:Kf}.foo===Kf.foo&&!({__proto__:null}instanceof mx)},yx="Function.prototype.bind called on incompatible ",Il=Array.prototype.slice,bx=Object.prototype.toString,xx="[object Function]",_x=function(t){var e=this;if(typeof e!="function"||bx.call(e)!==xx)throw new TypeError(yx+e);for(var i=Il.call(arguments,1),s,n=function(){if(this instanceof s){var c=e.apply(this,i.concat(Il.call(arguments)));return Object(c)===c?c:this}else return e.apply(t,i.concat(Il.call(arguments)))},o=Math.max(0,e.length-i.length),a=[],h=0;h<o;h++)a.push("$"+h);if(s=Function("binder","return function ("+a.join(",")+"){ return binder.apply(this,arguments); }")(n),e.prototype){var l=function(){};l.prototype=e.prototype,s.prototype=new l,l.prototype=null}return s},vx=_x,Al=Function.prototype.bind||vx,Tx=Al,wx=Tx.call(Function.call,Object.prototype.hasOwnProperty),wt,Os=SyntaxError,Yf=Function,Bs=TypeError,Rl=function(r){try{return Yf('"use strict"; return ('+r+").constructor;")()}catch{}},Hr=Object.getOwnPropertyDescriptor;if(Hr)try{Hr({},"")}catch{Hr=null}var Ml=function(){throw new Bs},Sx=Hr?function(){try{return arguments.callee,Ml}catch{try{return Hr(arguments,"callee").get}catch{return Ml}}}():Ml,Ws=px(),Cx=gx(),ie=Object.getPrototypeOf||(Cx?function(r){return r.__proto__}:null),Us={},Ex=typeof Uint8Array>"u"||!ie?wt:ie(Uint8Array),Kr={"%AggregateError%":typeof AggregateError>"u"?wt:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?wt:ArrayBuffer,"%ArrayIteratorPrototype%":Ws&&ie?ie([][Symbol.iterator]()):wt,"%AsyncFromSyncIteratorPrototype%":wt,"%AsyncFunction%":Us,"%AsyncGenerator%":Us,"%AsyncGeneratorFunction%":Us,"%AsyncIteratorPrototype%":Us,"%Atomics%":typeof Atomics>"u"?wt:Atomics,"%BigInt%":typeof BigInt>"u"?wt:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?wt:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?wt:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?wt:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?wt:Float32Array,"%Float64Array%":typeof Float64Array>"u"?wt:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?wt:FinalizationRegistry,"%Function%":Yf,"%GeneratorFunction%":Us,"%Int8Array%":typeof Int8Array>"u"?wt:Int8Array,"%Int16Array%":typeof Int16Array>"u"?wt:Int16Array,"%Int32Array%":typeof Int32Array>"u"?wt:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ws&&ie?ie(ie([][Symbol.iterator]())):wt,"%JSON%":typeof JSON=="object"?JSON:wt,"%Map%":typeof Map>"u"?wt:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Ws||!ie?wt:ie(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?wt:Promise,"%Proxy%":typeof Proxy>"u"?wt:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?wt:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?wt:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Ws||!ie?wt:ie(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?wt:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ws&&ie?ie(""[Symbol.iterator]()):wt,"%Symbol%":Ws?Symbol:wt,"%SyntaxError%":Os,"%ThrowTypeError%":Sx,"%TypedArray%":Ex,"%TypeError%":Bs,"%Uint8Array%":typeof Uint8Array>"u"?wt:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?wt:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?wt:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?wt:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?wt:WeakMap,"%WeakRef%":typeof WeakRef>"u"?wt:WeakRef,"%WeakSet%":typeof WeakSet>"u"?wt:WeakSet};if(ie)try{null.error}catch(r){var Ix=ie(ie(r));Kr["%Error.prototype%"]=Ix}var Ax=function r(t){var e;if(t==="%AsyncFunction%")e=Rl("async function () {}");else if(t==="%GeneratorFunction%")e=Rl("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=Rl("async function* () {}");else if(t==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(e=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=r("%AsyncGenerator%");s&&ie&&(e=ie(s.prototype))}return Kr[t]=e,e},zf={"%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"]},Un=Al,aa=wx,Rx=Un.call(Function.call,Array.prototype.concat),Mx=Un.call(Function.apply,Array.prototype.splice),jf=Un.call(Function.call,String.prototype.replace),ha=Un.call(Function.call,String.prototype.slice),Lx=Un.call(Function.call,RegExp.prototype.exec),Px=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Gx=/\\(\\)?/g,Fx=function(t){var e=ha(t,0,1),i=ha(t,-1);if(e==="%"&&i!=="%")throw new Os("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&e!=="%")throw new Os("invalid intrinsic syntax, expected opening `%`");var s=[];return jf(t,Px,function(n,o,a,h){s[s.length]=a?jf(h,Gx,"$1"):o||n}),s},Nx=function(t,e){var i=t,s;if(aa(zf,i)&&(s=zf[i],i="%"+s[0]+"%"),aa(Kr,i)){var n=Kr[i];if(n===Us&&(n=Ax(i)),typeof n>"u"&&!e)throw new Bs("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:n}}throw new Os("intrinsic "+t+" does not exist!")},Ll=function(t,e){if(typeof t!="string"||t.length===0)throw new Bs("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Bs('"allowMissing" argument must be a boolean');if(Lx(/^%?[^%]*%?$/,t)===null)throw new Os("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=Fx(t),s=i.length>0?i[0]:"",n=Nx("%"+s+"%",e),o=n.name,a=n.value,h=!1,l=n.alias;l&&(s=l[0],Mx(i,Rx([0,1],l)));for(var c=1,u=!0;c<i.length;c+=1){var d=i[c],f=ha(d,0,1),m=ha(d,-1);if((f==='"'||f==="'"||f==="`"||m==='"'||m==="'"||m==="`")&&f!==m)throw new Os("property names with quotes must have matching quotes");if((d==="constructor"||!u)&&(h=!0),s+="."+d,o="%"+s+"%",aa(Kr,o))a=Kr[o];else if(a!=null){if(!(d in a)){if(!e)throw new Bs("base intrinsic for "+t+" exists, but the property is not available.");return}if(Hr&&c+1>=i.length){var p=Hr(a,d);u=!!p,u&&"get"in p&&!("originalValue"in p.get)?a=p.get:a=a[d]}else u=aa(a,d),a=a[d];u&&!h&&(Kr[o]=a)}}return a},Jf={exports:{}};(function(r){var t=Al,e=Ll,i=e("%Function.prototype.apply%"),s=e("%Function.prototype.call%"),n=e("%Reflect.apply%",!0)||t.call(s,i),o=e("%Object.getOwnPropertyDescriptor%",!0),a=e("%Object.defineProperty%",!0),h=e("%Math.max%");if(a)try{a({},"a",{value:1})}catch{a=null}r.exports=function(u){var d=n(t,s,arguments);if(o&&a){var f=o(d,"length");f.configurable&&a(d,"length",{value:1+h(0,u.length-(arguments.length-1))})}return d};var l=function(){return n(t,i,arguments)};a?a(r.exports,"apply",{value:l}):r.exports.apply=l})(Jf);var Dx=Jf.exports,$f=Ll,Qf=Dx,kx=Qf($f("String.prototype.indexOf")),Ox=function(t,e){var i=$f(t,!!e);return typeof i=="function"&&kx(t,".prototype.")>-1?Qf(i):i};const Bx=Kb(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Pl=typeof Map=="function"&&Map.prototype,Gl=Object.getOwnPropertyDescriptor&&Pl?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,la=Pl&&Gl&&typeof Gl.get=="function"?Gl.get:null,qf=Pl&&Map.prototype.forEach,Fl=typeof Set=="function"&&Set.prototype,Nl=Object.getOwnPropertyDescriptor&&Fl?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,ca=Fl&&Nl&&typeof Nl.get=="function"?Nl.get:null,tp=Fl&&Set.prototype.forEach,Wx=typeof WeakMap=="function"&&WeakMap.prototype,Xn=Wx?WeakMap.prototype.has:null,Ux=typeof WeakSet=="function"&&WeakSet.prototype,Zn=Ux?WeakSet.prototype.has:null,Xx=typeof WeakRef=="function"&&WeakRef.prototype,ep=Xx?WeakRef.prototype.deref:null,Zx=Boolean.prototype.valueOf,Vx=Object.prototype.toString,Hx=Function.prototype.toString,Kx=String.prototype.match,Dl=String.prototype.slice,gr=String.prototype.replace,Yx=String.prototype.toUpperCase,ip=String.prototype.toLowerCase,rp=RegExp.prototype.test,sp=Array.prototype.concat,Si=Array.prototype.join,zx=Array.prototype.slice,np=Math.floor,kl=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Ol=Object.getOwnPropertySymbols,Bl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Xs=typeof Symbol=="function"&&typeof Symbol.iterator=="object",ce=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Xs||!0)?Symbol.toStringTag:null,op=Object.prototype.propertyIsEnumerable,ap=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function hp(r,t){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||rp.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-np(-r):np(r);if(i!==r){var s=String(i),n=Dl.call(t,s.length+1);return gr.call(s,e,"$&_")+"."+gr.call(gr.call(n,/([0-9]{3})/g,"$&_"),/_$/,"")}}return gr.call(t,e,"$&_")}var Wl=Bx,lp=Wl.custom,cp=fp(lp)?lp:null,jx=function r(t,e,i,s){var n=e||{};if(yr(n,"quoteStyle")&&n.quoteStyle!=="single"&&n.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(yr(n,"maxStringLength")&&(typeof n.maxStringLength=="number"?n.maxStringLength<0&&n.maxStringLength!==1/0:n.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var o=yr(n,"customInspect")?n.customInspect:!0;if(typeof o!="boolean"&&o!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(yr(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(yr(n,"numericSeparator")&&typeof n.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=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 mp(t,n);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var h=String(t);return a?hp(t,h):h}if(typeof t=="bigint"){var l=String(t)+"n";return a?hp(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 Ul(t)?"[Array]":"[Object]";var u=f_(n,i);if(typeof s>"u")s=[];else if(pp(s,t)>=0)return"[Circular]";function d(I,D,X){if(D&&(s=zx.call(s),s.push(D)),X){var H={depth:n.depth};return yr(n,"quoteStyle")&&(H.quoteStyle=n.quoteStyle),r(I,H,i+1,s)}return r(I,n,i+1,s)}if(typeof t=="function"&&!dp(t)){var f=s_(t),m=ua(t,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(m.length>0?" { "+Si.call(m,", ")+" }":"")}if(fp(t)){var p=Xs?gr.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Bl.call(t);return typeof t=="object"&&!Xs?Vn(p):p}if(c_(t)){for(var g="<"+ip.call(String(t.nodeName)),y=t.attributes||[],_=0;_<y.length;_++)g+=" "+y[_].name+"="+up(Jx(y[_].value),"double",n);return g+=">",t.childNodes&&t.childNodes.length&&(g+="..."),g+="</"+ip.call(String(t.nodeName))+">",g}if(Ul(t)){if(t.length===0)return"[]";var b=ua(t,d);return u&&!d_(b)?"["+Zl(b,u)+"]":"[ "+Si.call(b,", ")+" ]"}if(Qx(t)){var v=ua(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!op.call(t,"cause")?"{ ["+String(t)+"] "+Si.call(sp.call("[cause]: "+d(t.cause),v),", ")+" }":v.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+Si.call(v,", ")+" }"}if(typeof t=="object"&&o){if(cp&&typeof t[cp]=="function"&&Wl)return Wl(t,{depth:c-i});if(o!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(n_(t)){var w=[];return qf&&qf.call(t,function(I,D){w.push(d(D,t,!0)+" => "+d(I,t))}),gp("Map",la.call(t),w,u)}if(h_(t)){var C=[];return tp&&tp.call(t,function(I){C.push(d(I,t))}),gp("Set",ca.call(t),C,u)}if(o_(t))return Xl("WeakMap");if(l_(t))return Xl("WeakSet");if(a_(t))return Xl("WeakRef");if(t_(t))return Vn(d(Number(t)));if(i_(t))return Vn(d(kl.call(t)));if(e_(t))return Vn(Zx.call(t));if(qx(t))return Vn(d(String(t)));if(!$x(t)&&!dp(t)){var E=ua(t,d),A=ap?ap(t)===Object.prototype:t instanceof Object||t.constructor===Object,R=t instanceof Object?"":"null prototype",G=!A&&ce&&Object(t)===t&&ce in t?Dl.call(br(t),8,-1):R?"Object":"",N=A||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",P=N+(G||R?"["+Si.call(sp.call([],G||[],R||[]),": ")+"] ":"");return E.length===0?P+"{}":u?P+"{"+Zl(E,u)+"}":P+"{ "+Si.call(E,", ")+" }"}return String(t)};function up(r,t,e){var i=(e.quoteStyle||t)==="double"?'"':"'";return i+r+i}function Jx(r){return gr.call(String(r),/"/g,""")}function Ul(r){return br(r)==="[object Array]"&&(!ce||!(typeof r=="object"&&ce in r))}function $x(r){return br(r)==="[object Date]"&&(!ce||!(typeof r=="object"&&ce in r))}function dp(r){return br(r)==="[object RegExp]"&&(!ce||!(typeof r=="object"&&ce in r))}function Qx(r){return br(r)==="[object Error]"&&(!ce||!(typeof r=="object"&&ce in r))}function qx(r){return br(r)==="[object String]"&&(!ce||!(typeof r=="object"&&ce in r))}function t_(r){return br(r)==="[object Number]"&&(!ce||!(typeof r=="object"&&ce in r))}function e_(r){return br(r)==="[object Boolean]"&&(!ce||!(typeof r=="object"&&ce in r))}function fp(r){if(Xs)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!Bl)return!1;try{return Bl.call(r),!0}catch{}return!1}function i_(r){if(!r||typeof r!="object"||!kl)return!1;try{return kl.call(r),!0}catch{}return!1}var r_=Object.prototype.hasOwnProperty||function(r){return r in this};function yr(r,t){return r_.call(r,t)}function br(r){return Vx.call(r)}function s_(r){if(r.name)return r.name;var t=Kx.call(Hx.call(r),/^function\s*([\w$]+)/);return t?t[1]:null}function pp(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 n_(r){if(!la||!r||typeof r!="object")return!1;try{la.call(r);try{ca.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function o_(r){if(!Xn||!r||typeof r!="object")return!1;try{Xn.call(r,Xn);try{Zn.call(r,Zn)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function a_(r){if(!ep||!r||typeof r!="object")return!1;try{return ep.call(r),!0}catch{}return!1}function h_(r){if(!ca||!r||typeof r!="object")return!1;try{ca.call(r);try{la.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function l_(r){if(!Zn||!r||typeof r!="object")return!1;try{Zn.call(r,Zn);try{Xn.call(r,Xn)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function c_(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function mp(r,t){if(r.length>t.maxStringLength){var e=r.length-t.maxStringLength,i="... "+e+" more character"+(e>1?"s":"");return mp(Dl.call(r,0,t.maxStringLength),t)+i}var s=gr.call(gr.call(r,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,u_);return up(s,"single",t)}function u_(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":"")+Yx.call(t.toString(16))}function Vn(r){return"Object("+r+")"}function Xl(r){return r+" { ? }"}function gp(r,t,e,i){var s=i?Zl(e,i):Si.call(e,", ");return r+" ("+t+") {"+s+"}"}function d_(r){for(var t=0;t<r.length;t++)if(pp(r[t],`
|
|
2
|
-
`)>=0)return!1;return!0}function
|
|
1
|
+
(function(Dt,z){typeof exports=="object"&&typeof module<"u"?z(exports,require("vue"),require("@prefecthq/vue-compositions"),require("@prefecthq/prefect-design")):typeof define=="function"&&define.amd?define(["exports","vue","@prefecthq/vue-compositions","@prefecthq/prefect-design"],z):(Dt=typeof globalThis<"u"?globalThis:Dt||self,z(Dt["prefect-graphs"]={},Dt.Vue,Dt.vueCompositions,Dt.prefectDesign))})(this,function(Dt,z,mr,Ki){"use strict";var cM=Object.defineProperty;var uM=(Dt,z,mr)=>z in Dt?cM(Dt,z,{enumerable:!0,configurable:!0,writable:!0,value:mr}):Dt[z]=mr;var yf=(Dt,z,mr)=>(uM(Dt,typeof z!="symbol"?z+"":z,mr),mr);const Ef="nodes-container",Ob="node-container",Bb="edge-container";function bl(r){const t=Object.prototype.toString.call(r);return r instanceof Date||typeof r=="object"&&t==="[object Date]"?new r.constructor(+r):typeof r=="number"||t==="[object Number]"||typeof r=="string"||t==="[object String]"?new Date(r):new Date(NaN)}function Wb(r,t){return r instanceof Date?new r.constructor(t):new Date(t)}function Ub(r,t){const e=+bl(r);return Wb(r,e+t)}const ta=1e3;function Xb(r,t){return Ub(r,t*1e3)}function Zb(r){return t=>{const i=(r?Math[r]:Math.trunc)(t);return i===0?0:i}}function Cf(r,t){return+bl(r)-+bl(t)}function Vb(r,t,e){const i=Cf(r,t)/1e3;return Zb(e==null?void 0:e.roundingMethod)(i)}var Zr=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(Zr||{}),If=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(If||{}),xl=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(xl||{}),ft=(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))(ft||{}),xi=(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))(xi||{}),K=(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))(K||{}),Fs=(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))(Fs||{}),ht=(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))(ht||{}),Q=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(Q||{}),Yi=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(Yi||{}),_i=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(_i||{}),vi=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(vi||{}),Se=(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))(Se||{}),Ti=(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))(Ti||{}),_l=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(_l||{}),Ke=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(Ke||{}),$t=(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))($t||{}),jt=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(jt||{}),wi=(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))(wi||{});const q={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 vl=/iPhone/i,Af=/iPod/i,Rf=/iPad/i,Mf=/\biOS-universal(?:.+)Mac\b/i,Tl=/\bAndroid(?:.+)Mobile\b/i,Lf=/Android/i,Ns=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,ea=/Silk/i,zi=/Windows Phone/i,Pf=/\bWindows(?:.+)ARM\b/i,Gf=/BlackBerry/i,Ff=/BB10/i,Nf=/Opera Mini/i,Df=/\b(CriOS|Chrome)(?:.+)Mobile/i,kf=/Mobile(?:.+)Firefox\b/i,Of=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"};function Hb(r){return function(t){return t.test(r)}}function Bf(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=Hb(e),n={apple:{phone:s(vl)&&!s(zi),ipod:s(Af),tablet:!s(vl)&&(s(Rf)||Of(t))&&!s(zi),universal:s(Mf),device:(s(vl)||s(Af)||s(Rf)||s(Mf)||Of(t))&&!s(zi)},amazon:{phone:s(Ns),tablet:!s(Ns)&&s(ea),device:s(Ns)||s(ea)},android:{phone:!s(zi)&&s(Ns)||!s(zi)&&s(Tl),tablet:!s(zi)&&!s(Ns)&&!s(Tl)&&(s(ea)||s(Lf)),device:!s(zi)&&(s(Ns)||s(ea)||s(Tl)||s(Lf))||s(/\bokhttp\b/i)},windows:{phone:s(zi),tablet:s(Pf),device:s(zi)||s(Pf)},other:{blackberry:s(Gf),blackberry10:s(Ff),opera:s(Nf),firefox:s(kf),chrome:s(Df),device:s(Gf)||s(Ff)||s(Nf)||s(kf)||s(Df)},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 Kb=Bf.default??Bf,ji=Kb(globalThis.navigator);q.RETINA_PREFIX=/@([0-9\.]+)x/,q.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var xe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ds(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function Yb(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 Wf={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,u,d){if(typeof c!="function")throw new TypeError("The listener must be a function");var f=new s(c,u||h,d),m=e?e+l:l;return h._events[m]?h._events[m].fn?h._events[m]=[h._events[m],f]:h._events[m].push(f):(h._events[m]=f,h._eventsCount++),h}function o(h,l){--h._eventsCount===0?h._events=new i:delete h._events[l]}function a(){this._events=new i,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],c,u;if(this._eventsCount===0)return l;for(u in c=this._events)t.call(c,u)&&l.push(e?u.slice(1):u);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(c)):l},a.prototype.listeners=function(l){var c=e?e+l:l,u=this._events[c];if(!u)return[];if(u.fn)return[u.fn];for(var d=0,f=u.length,m=new Array(f);d<f;d++)m[d]=u[d].fn;return m},a.prototype.listenerCount=function(l){var c=e?e+l:l,u=this._events[c];return u?u.fn?1:u.length:0},a.prototype.emit=function(l,c,u,d,f,m){var p=e?e+l:l;if(!this._events[p])return!1;var g=this._events[p],y=arguments.length,_,b;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,u),!0;case 4:return g.fn.call(g.context,c,u,d),!0;case 5:return g.fn.call(g.context,c,u,d,f),!0;case 6:return g.fn.call(g.context,c,u,d,f,m),!0}for(b=1,_=new Array(y-1);b<y;b++)_[b-1]=arguments[b];g.fn.apply(g.context,_)}else{var v=g.length,w;for(b=0;b<v;b++)switch(g[b].once&&this.removeListener(l,g[b].fn,void 0,!0),y){case 1:g[b].fn.call(g[b].context);break;case 2:g[b].fn.call(g[b].context,c);break;case 3:g[b].fn.call(g[b].context,c,u);break;case 4:g[b].fn.call(g[b].context,c,u,d);break;default:if(!_)for(w=1,_=new Array(y-1);w<y;w++)_[w-1]=arguments[w];g[b].fn.apply(g[b].context,_)}}return!0},a.prototype.on=function(l,c,u){return n(this,l,c,u,!1)},a.prototype.once=function(l,c,u){return n(this,l,c,u,!0)},a.prototype.removeListener=function(l,c,u,d){var f=e?e+l:l;if(!this._events[f])return this;if(!c)return o(this,f),this;var m=this._events[f];if(m.fn)m.fn===c&&(!d||m.once)&&(!u||m.context===u)&&o(this,f);else{for(var p=0,g=[],y=m.length;p<y;p++)(m[p].fn!==c||d&&!m[p].once||u&&m[p].context!==u)&&g.push(m[p]);g.length?this._events[f]=g.length===1?g[0]:g:o(this,f)}return this},a.prototype.removeAllListeners=function(l){var c;return l?(c=e?e+l:l,this._events[c]&&o(this,c)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=e,a.EventEmitter=a,r.exports=a})(Wf);var zb=Wf.exports;const Bn=Ds(zb);var wl={exports:{}};wl.exports=ia,wl.exports.default=ia;function ia(r,t,e){e=e||2;var i=t&&t.length,s=i?t[0]*e:r.length,n=Uf(r,0,s,e,!0),o=[];if(!n||n.next===n.prev)return o;var a,h,l,c,u,d,f;if(i&&(n=qb(r,t,n,e)),r.length>80*e){a=l=r[0],h=c=r[1];for(var m=e;m<s;m+=e)u=r[m],d=r[m+1],u<a&&(a=u),d<h&&(h=d),u>l&&(l=u),d>c&&(c=d);f=Math.max(l-a,c-h),f=f!==0?32767/f:0}return Wn(n,o,e,a,h,f,0),o}function Uf(r,t,e,i,s){var n,o;if(s===Cl(r,t,e,i)>0)for(n=t;n<e;n+=i)o=Vf(n,r[n],r[n+1],o);else for(n=e-i;n>=t;n-=i)o=Vf(n,r[n],r[n+1],o);return o&&ra(o,o.next)&&(Xn(o),o=o.next),o}function Vr(r,t){if(!r)return r;t||(t=r);var e=r,i;do if(i=!1,!e.steiner&&(ra(e,e.next)||Bt(e.prev,e,e.next)===0)){if(Xn(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function Wn(r,t,e,i,s,n,o){if(r){!o&&n&&sx(r,i,s,n);for(var a=r,h,l;r.prev!==r.next;){if(h=r.prev,l=r.next,n?Jb(r,i,s,n):jb(r)){t.push(h.i/e|0),t.push(r.i/e|0),t.push(l.i/e|0),Xn(r),r=l.next,a=l.next;continue}if(r=l,r===a){o?o===1?(r=$b(Vr(r),t,e),Wn(r,t,e,i,s,n,2)):o===2&&Qb(r,t,e,i,s,n):Wn(Vr(r),t,e,i,s,n,1);break}}}}function jb(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,o=i.x,a=t.y,h=e.y,l=i.y,c=s<n?s<o?s:o:n<o?n:o,u=a<h?a<l?a:l:h<l?h:l,d=s>n?s>o?s:o:n>o?n:o,f=a>h?a>l?a:l:h>l?h:l,m=i.next;m!==t;){if(m.x>=c&&m.x<=d&&m.y>=u&&m.y<=f&&ks(s,a,n,h,o,l,m.x,m.y)&&Bt(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Jb(r,t,e,i){var s=r.prev,n=r,o=r.next;if(Bt(s,n,o)>=0)return!1;for(var a=s.x,h=n.x,l=o.x,c=s.y,u=n.y,d=o.y,f=a<h?a<l?a:l:h<l?h:l,m=c<u?c<d?c:d:u<d?u:d,p=a>h?a>l?a:l:h>l?h:l,g=c>u?c>d?c:d:u>d?u:d,y=Sl(f,m,t,e,i),_=Sl(p,g,t,e,i),b=r.prevZ,v=r.nextZ;b&&b.z>=y&&v&&v.z<=_;){if(b.x>=f&&b.x<=p&&b.y>=m&&b.y<=g&&b!==s&&b!==o&&ks(a,c,h,u,l,d,b.x,b.y)&&Bt(b.prev,b,b.next)>=0||(b=b.prevZ,v.x>=f&&v.x<=p&&v.y>=m&&v.y<=g&&v!==s&&v!==o&&ks(a,c,h,u,l,d,v.x,v.y)&&Bt(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;b&&b.z>=y;){if(b.x>=f&&b.x<=p&&b.y>=m&&b.y<=g&&b!==s&&b!==o&&ks(a,c,h,u,l,d,b.x,b.y)&&Bt(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;v&&v.z<=_;){if(v.x>=f&&v.x<=p&&v.y>=m&&v.y<=g&&v!==s&&v!==o&&ks(a,c,h,u,l,d,v.x,v.y)&&Bt(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function $b(r,t,e){var i=r;do{var s=i.prev,n=i.next.next;!ra(s,n)&&Xf(s,i,i.next,n)&&Un(s,n)&&Un(n,s)&&(t.push(s.i/e|0),t.push(i.i/e|0),t.push(n.i/e|0),Xn(i),Xn(i.next),i=r=n),i=i.next}while(i!==r);return Vr(i)}function Qb(r,t,e,i,s,n){var o=r;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&ax(o,a)){var h=Zf(o,a);o=Vr(o,o.next),h=Vr(h,h.next),Wn(o,t,e,i,s,n,0),Wn(h,t,e,i,s,n,0);return}a=a.next}o=o.next}while(o!==r)}function qb(r,t,e,i){var s=[],n,o,a,h,l;for(n=0,o=t.length;n<o;n++)a=t[n]*i,h=n<o-1?t[n+1]*i:r.length,l=Uf(r,a,h,i,!1),l===l.next&&(l.steiner=!0),s.push(ox(l));for(s.sort(tx),n=0;n<s.length;n++)e=ex(s[n],e);return e}function tx(r,t){return r.x-t.x}function ex(r,t){var e=ix(r,t);if(!e)return t;var i=Zf(e,r);return Vr(i,i.next),Vr(e,e.next)}function ix(r,t){var e=t,i=r.x,s=r.y,n=-1/0,o;do{if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){var a=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(a<=i&&a>n&&(n=a,o=e.x<e.next.x?e:e.next,a===i))return o}e=e.next}while(e!==t);if(!o)return null;var h=o,l=o.x,c=o.y,u=1/0,d;e=o;do i>=e.x&&e.x>=l&&i!==e.x&&ks(s<c?i:n,s,l,c,s<c?n:i,s,e.x,e.y)&&(d=Math.abs(s-e.y)/(i-e.x),Un(e,r)&&(d<u||d===u&&(e.x>o.x||e.x===o.x&&rx(o,e)))&&(o=e,u=d)),e=e.next;while(e!==h);return o}function rx(r,t){return Bt(r.prev,r,t.prev)<0&&Bt(t.next,r,r.next)<0}function sx(r,t,e,i){var s=r;do s.z===0&&(s.z=Sl(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,nx(s)}function nx(r){var t,e,i,s,n,o,a,h,l=1;do{for(e=r,r=null,n=null,o=0;e;){for(o++,i=e,a=0,t=0;t<l&&(a++,i=i.nextZ,!!i);t++);for(h=l;a>0||h>0&&i;)a!==0&&(h===0||!i||e.z<=i.z)?(s=e,e=e.nextZ,a--):(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(o>1);return r}function Sl(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 ox(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 ks(r,t,e,i,s,n,o,a){return(s-o)*(t-a)>=(r-o)*(n-a)&&(r-o)*(i-a)>=(e-o)*(t-a)&&(e-o)*(n-a)>=(s-o)*(i-a)}function ax(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!hx(r,t)&&(Un(r,t)&&Un(t,r)&&lx(r,t)&&(Bt(r.prev,r,t.prev)||Bt(r,t.prev,t))||ra(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 ra(r,t){return r.x===t.x&&r.y===t.y}function Xf(r,t,e,i){var s=na(Bt(r,t,e)),n=na(Bt(r,t,i)),o=na(Bt(e,i,r)),a=na(Bt(e,i,t));return!!(s!==n&&o!==a||s===0&&sa(r,e,t)||n===0&&sa(r,i,t)||o===0&&sa(e,r,i)||a===0&&sa(e,t,i))}function sa(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 na(r){return r>0?1:r<0?-1:0}function hx(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&&Xf(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Un(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 lx(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 Zf(r,t){var e=new El(r.i,r.x,r.y),i=new El(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 Vf(r,t,e,i){var s=new El(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 Xn(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 El(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}ia.deviation=function(r,t,e,i){var s=t&&t.length,n=s?t[0]*e:r.length,o=Math.abs(Cl(r,0,n,e));if(s)for(var a=0,h=t.length;a<h;a++){var l=t[a]*e,c=a<h-1?t[a+1]*e:r.length;o-=Math.abs(Cl(r,l,c,e))}var u=0;for(a=0;a<i.length;a+=3){var d=i[a]*e,f=i[a+1]*e,m=i[a+2]*e;u+=Math.abs((r[d]-r[m])*(r[f+1]-r[d+1])-(r[d]-r[f])*(r[m+1]-r[d+1]))}return o===0&&u===0?0:Math.abs((u-o)/o)};function Cl(r,t,e,i){for(var s=0,n=t,o=e-i;n<e;n+=i)s+=(r[o]-r[n])*(r[n+1]+r[o+1]),o=n;return s}ia.flatten=function(r){for(var t=r[0][0].length,e={vertices:[],holes:[],dimensions:t},i=0,s=0;s<r.length;s++){for(var n=0;n<r[s].length;n++)for(var o=0;o<t;o++)e.vertices.push(r[s][n][o]);s>0&&(i+=r[s-1].length,e.holes.push(i))}return e};var cx=wl.exports;const ux=Ds(cx);var oa={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */oa.exports,function(r,t){(function(e){var i=t&&!t.nodeType&&t,s=r&&!r.nodeType&&r,n=typeof xe=="object"&&xe;(n.global===n||n.window===n||n.self===n)&&(e=n);var o,a=2147483647,h=36,l=1,c=26,u=38,d=700,f=72,m=128,p="-",g=/^xn--/,y=/[^\x20-\x7E]/,_=/[\x2E\u3002\uFF0E\uFF61]/g,b={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},v=h-l,w=Math.floor,E=String.fromCharCode,C;function A(k){throw new RangeError(b[k])}function R(k,F){for(var V=k.length,$=[];V--;)$[V]=F(k[V]);return $}function G(k,F){var V=k.split("@"),$="";V.length>1&&($=V[0]+"@",k=V[1]),k=k.replace(_,".");var dt=k.split("."),ot=R(dt,F).join(".");return $+ot}function N(k){for(var F=[],V=0,$=k.length,dt,ot;V<$;)dt=k.charCodeAt(V++),dt>=55296&&dt<=56319&&V<$?(ot=k.charCodeAt(V++),(ot&64512)==56320?F.push(((dt&1023)<<10)+(ot&1023)+65536):(F.push(dt),V--)):F.push(dt);return F}function P(k){return R(k,function(F){var V="";return F>65535&&(F-=65536,V+=E(F>>>10&1023|55296),F=56320|F&1023),V+=E(F),V}).join("")}function I(k){return k-48<10?k-22:k-65<26?k-65:k-97<26?k-97:h}function D(k,F){return k+22+75*(k<26)-((F!=0)<<5)}function X(k,F,V){var $=0;for(k=V?w(k/d):k>>1,k+=w(k/F);k>v*c>>1;$+=h)k=w(k/v);return w($+(v+1)*k/(k+u))}function H(k){var F=[],V=k.length,$,dt=0,ot=m,Ct=f,Mt,_t,Y,tt,et,B,xt,yt,Lt;for(Mt=k.lastIndexOf(p),Mt<0&&(Mt=0),_t=0;_t<Mt;++_t)k.charCodeAt(_t)>=128&&A("not-basic"),F.push(k.charCodeAt(_t));for(Y=Mt>0?Mt+1:0;Y<V;){for(tt=dt,et=1,B=h;Y>=V&&A("invalid-input"),xt=I(k.charCodeAt(Y++)),(xt>=h||xt>w((a-dt)/et))&&A("overflow"),dt+=xt*et,yt=B<=Ct?l:B>=Ct+c?c:B-Ct,!(xt<yt);B+=h)Lt=h-yt,et>w(a/Lt)&&A("overflow"),et*=Lt;$=F.length+1,Ct=X(dt-tt,$,tt==0),w(dt/$)>a-ot&&A("overflow"),ot+=w(dt/$),dt%=$,F.splice(dt++,0,ot)}return P(F)}function Z(k){var F,V,$,dt,ot,Ct,Mt,_t,Y,tt,et,B=[],xt,yt,Lt,Vt;for(k=N(k),xt=k.length,F=m,V=0,ot=f,Ct=0;Ct<xt;++Ct)et=k[Ct],et<128&&B.push(E(et));for($=dt=B.length,dt&&B.push(p);$<xt;){for(Mt=a,Ct=0;Ct<xt;++Ct)et=k[Ct],et>=F&&et<Mt&&(Mt=et);for(yt=$+1,Mt-F>w((a-V)/yt)&&A("overflow"),V+=(Mt-F)*yt,F=Mt,Ct=0;Ct<xt;++Ct)if(et=k[Ct],et<F&&++V>a&&A("overflow"),et==F){for(_t=V,Y=h;tt=Y<=ot?l:Y>=ot+c?c:Y-ot,!(_t<tt);Y+=h)Vt=_t-tt,Lt=h-tt,B.push(E(D(tt+Vt%Lt,0))),_t=w(Vt/Lt);B.push(E(D(_t,0))),ot=X(V,yt,$==dt),V=0,++$}++V,++F}return B.join("")}function j(k){return G(k,function(F){return g.test(F)?H(F.slice(4).toLowerCase()):F})}function O(k){return G(k,function(F){return y.test(F)?"xn--"+Z(F):F})}if(o={version:"1.4.1",ucs2:{decode:N,encode:P},decode:H,encode:Z,toASCII:O,toUnicode:j},i&&s)if(r.exports==i)s.exports=o;else for(C in o)o.hasOwnProperty(C)&&(i[C]=o[C]);else e.punycode=o})(xe)}(oa,oa.exports);var dx=oa.exports,fx=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(e 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 n=Object.getOwnPropertySymbols(t);if(n.length!==1||n[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},Hf=typeof Symbol<"u"&&Symbol,px=fx,mx=function(){return typeof Hf!="function"||typeof Symbol!="function"||typeof Hf("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:px()},Kf={foo:{}},gx=Object,yx=function(){return{__proto__:Kf}.foo===Kf.foo&&!({__proto__:null}instanceof gx)},bx="Function.prototype.bind called on incompatible ",Il=Array.prototype.slice,xx=Object.prototype.toString,_x="[object Function]",vx=function(t){var e=this;if(typeof e!="function"||xx.call(e)!==_x)throw new TypeError(bx+e);for(var i=Il.call(arguments,1),s,n=function(){if(this instanceof s){var c=e.apply(this,i.concat(Il.call(arguments)));return Object(c)===c?c:this}else return e.apply(t,i.concat(Il.call(arguments)))},o=Math.max(0,e.length-i.length),a=[],h=0;h<o;h++)a.push("$"+h);if(s=Function("binder","return function ("+a.join(",")+"){ return binder.apply(this,arguments); }")(n),e.prototype){var l=function(){};l.prototype=e.prototype,s.prototype=new l,l.prototype=null}return s},Tx=vx,Al=Function.prototype.bind||Tx,wx=Al,Sx=wx.call(Function.call,Object.prototype.hasOwnProperty),wt,Os=SyntaxError,Yf=Function,Bs=TypeError,Rl=function(r){try{return Yf('"use strict"; return ('+r+").constructor;")()}catch{}},Hr=Object.getOwnPropertyDescriptor;if(Hr)try{Hr({},"")}catch{Hr=null}var Ml=function(){throw new Bs},Ex=Hr?function(){try{return arguments.callee,Ml}catch{try{return Hr(arguments,"callee").get}catch{return Ml}}}():Ml,Ws=mx(),Cx=yx(),ie=Object.getPrototypeOf||(Cx?function(r){return r.__proto__}:null),Us={},Ix=typeof Uint8Array>"u"||!ie?wt:ie(Uint8Array),Kr={"%AggregateError%":typeof AggregateError>"u"?wt:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?wt:ArrayBuffer,"%ArrayIteratorPrototype%":Ws&&ie?ie([][Symbol.iterator]()):wt,"%AsyncFromSyncIteratorPrototype%":wt,"%AsyncFunction%":Us,"%AsyncGenerator%":Us,"%AsyncGeneratorFunction%":Us,"%AsyncIteratorPrototype%":Us,"%Atomics%":typeof Atomics>"u"?wt:Atomics,"%BigInt%":typeof BigInt>"u"?wt:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?wt:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?wt:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?wt:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?wt:Float32Array,"%Float64Array%":typeof Float64Array>"u"?wt:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?wt:FinalizationRegistry,"%Function%":Yf,"%GeneratorFunction%":Us,"%Int8Array%":typeof Int8Array>"u"?wt:Int8Array,"%Int16Array%":typeof Int16Array>"u"?wt:Int16Array,"%Int32Array%":typeof Int32Array>"u"?wt:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ws&&ie?ie(ie([][Symbol.iterator]())):wt,"%JSON%":typeof JSON=="object"?JSON:wt,"%Map%":typeof Map>"u"?wt:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Ws||!ie?wt:ie(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?wt:Promise,"%Proxy%":typeof Proxy>"u"?wt:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?wt:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?wt:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Ws||!ie?wt:ie(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?wt:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ws&&ie?ie(""[Symbol.iterator]()):wt,"%Symbol%":Ws?Symbol:wt,"%SyntaxError%":Os,"%ThrowTypeError%":Ex,"%TypedArray%":Ix,"%TypeError%":Bs,"%Uint8Array%":typeof Uint8Array>"u"?wt:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?wt:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?wt:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?wt:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?wt:WeakMap,"%WeakRef%":typeof WeakRef>"u"?wt:WeakRef,"%WeakSet%":typeof WeakSet>"u"?wt:WeakSet};if(ie)try{null.error}catch(r){var Ax=ie(ie(r));Kr["%Error.prototype%"]=Ax}var Rx=function r(t){var e;if(t==="%AsyncFunction%")e=Rl("async function () {}");else if(t==="%GeneratorFunction%")e=Rl("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=Rl("async function* () {}");else if(t==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(e=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=r("%AsyncGenerator%");s&&ie&&(e=ie(s.prototype))}return Kr[t]=e,e},zf={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Zn=Al,aa=Sx,Mx=Zn.call(Function.call,Array.prototype.concat),Lx=Zn.call(Function.apply,Array.prototype.splice),jf=Zn.call(Function.call,String.prototype.replace),ha=Zn.call(Function.call,String.prototype.slice),Px=Zn.call(Function.call,RegExp.prototype.exec),Gx=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Fx=/\\(\\)?/g,Nx=function(t){var e=ha(t,0,1),i=ha(t,-1);if(e==="%"&&i!=="%")throw new Os("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&e!=="%")throw new Os("invalid intrinsic syntax, expected opening `%`");var s=[];return jf(t,Gx,function(n,o,a,h){s[s.length]=a?jf(h,Fx,"$1"):o||n}),s},Dx=function(t,e){var i=t,s;if(aa(zf,i)&&(s=zf[i],i="%"+s[0]+"%"),aa(Kr,i)){var n=Kr[i];if(n===Us&&(n=Rx(i)),typeof n>"u"&&!e)throw new Bs("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:n}}throw new Os("intrinsic "+t+" does not exist!")},Ll=function(t,e){if(typeof t!="string"||t.length===0)throw new Bs("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Bs('"allowMissing" argument must be a boolean');if(Px(/^%?[^%]*%?$/,t)===null)throw new Os("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=Nx(t),s=i.length>0?i[0]:"",n=Dx("%"+s+"%",e),o=n.name,a=n.value,h=!1,l=n.alias;l&&(s=l[0],Lx(i,Mx([0,1],l)));for(var c=1,u=!0;c<i.length;c+=1){var d=i[c],f=ha(d,0,1),m=ha(d,-1);if((f==='"'||f==="'"||f==="`"||m==='"'||m==="'"||m==="`")&&f!==m)throw new Os("property names with quotes must have matching quotes");if((d==="constructor"||!u)&&(h=!0),s+="."+d,o="%"+s+"%",aa(Kr,o))a=Kr[o];else if(a!=null){if(!(d in a)){if(!e)throw new Bs("base intrinsic for "+t+" exists, but the property is not available.");return}if(Hr&&c+1>=i.length){var p=Hr(a,d);u=!!p,u&&"get"in p&&!("originalValue"in p.get)?a=p.get:a=a[d]}else u=aa(a,d),a=a[d];u&&!h&&(Kr[o]=a)}}return a},Jf={exports:{}};(function(r){var t=Al,e=Ll,i=e("%Function.prototype.apply%"),s=e("%Function.prototype.call%"),n=e("%Reflect.apply%",!0)||t.call(s,i),o=e("%Object.getOwnPropertyDescriptor%",!0),a=e("%Object.defineProperty%",!0),h=e("%Math.max%");if(a)try{a({},"a",{value:1})}catch{a=null}r.exports=function(u){var d=n(t,s,arguments);if(o&&a){var f=o(d,"length");f.configurable&&a(d,"length",{value:1+h(0,u.length-(arguments.length-1))})}return d};var l=function(){return n(t,i,arguments)};a?a(r.exports,"apply",{value:l}):r.exports.apply=l})(Jf);var kx=Jf.exports,$f=Ll,Qf=kx,Ox=Qf($f("String.prototype.indexOf")),Bx=function(t,e){var i=$f(t,!!e);return typeof i=="function"&&Ox(t,".prototype.")>-1?Qf(i):i};const Wx=Yb(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Pl=typeof Map=="function"&&Map.prototype,Gl=Object.getOwnPropertyDescriptor&&Pl?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,la=Pl&&Gl&&typeof Gl.get=="function"?Gl.get:null,qf=Pl&&Map.prototype.forEach,Fl=typeof Set=="function"&&Set.prototype,Nl=Object.getOwnPropertyDescriptor&&Fl?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,ca=Fl&&Nl&&typeof Nl.get=="function"?Nl.get:null,tp=Fl&&Set.prototype.forEach,Ux=typeof WeakMap=="function"&&WeakMap.prototype,Vn=Ux?WeakMap.prototype.has:null,Xx=typeof WeakSet=="function"&&WeakSet.prototype,Hn=Xx?WeakSet.prototype.has:null,Zx=typeof WeakRef=="function"&&WeakRef.prototype,ep=Zx?WeakRef.prototype.deref:null,Vx=Boolean.prototype.valueOf,Hx=Object.prototype.toString,Kx=Function.prototype.toString,Yx=String.prototype.match,Dl=String.prototype.slice,gr=String.prototype.replace,zx=String.prototype.toUpperCase,ip=String.prototype.toLowerCase,rp=RegExp.prototype.test,sp=Array.prototype.concat,Si=Array.prototype.join,jx=Array.prototype.slice,np=Math.floor,kl=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Ol=Object.getOwnPropertySymbols,Bl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Xs=typeof Symbol=="function"&&typeof Symbol.iterator=="object",ue=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Xs||!0)?Symbol.toStringTag:null,op=Object.prototype.propertyIsEnumerable,ap=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function hp(r,t){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||rp.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-np(-r):np(r);if(i!==r){var s=String(i),n=Dl.call(t,s.length+1);return gr.call(s,e,"$&_")+"."+gr.call(gr.call(n,/([0-9]{3})/g,"$&_"),/_$/,"")}}return gr.call(t,e,"$&_")}var Wl=Wx,lp=Wl.custom,cp=fp(lp)?lp:null,Jx=function r(t,e,i,s){var n=e||{};if(yr(n,"quoteStyle")&&n.quoteStyle!=="single"&&n.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(yr(n,"maxStringLength")&&(typeof n.maxStringLength=="number"?n.maxStringLength<0&&n.maxStringLength!==1/0:n.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var o=yr(n,"customInspect")?n.customInspect:!0;if(typeof o!="boolean"&&o!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(yr(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(yr(n,"numericSeparator")&&typeof n.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=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 mp(t,n);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var h=String(t);return a?hp(t,h):h}if(typeof t=="bigint"){var l=String(t)+"n";return a?hp(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 Ul(t)?"[Array]":"[Object]";var u=p_(n,i);if(typeof s>"u")s=[];else if(pp(s,t)>=0)return"[Circular]";function d(I,D,X){if(D&&(s=jx.call(s),s.push(D)),X){var H={depth:n.depth};return yr(n,"quoteStyle")&&(H.quoteStyle=n.quoteStyle),r(I,H,i+1,s)}return r(I,n,i+1,s)}if(typeof t=="function"&&!dp(t)){var f=n_(t),m=ua(t,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(m.length>0?" { "+Si.call(m,", ")+" }":"")}if(fp(t)){var p=Xs?gr.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Bl.call(t);return typeof t=="object"&&!Xs?Kn(p):p}if(u_(t)){for(var g="<"+ip.call(String(t.nodeName)),y=t.attributes||[],_=0;_<y.length;_++)g+=" "+y[_].name+"="+up($x(y[_].value),"double",n);return g+=">",t.childNodes&&t.childNodes.length&&(g+="..."),g+="</"+ip.call(String(t.nodeName))+">",g}if(Ul(t)){if(t.length===0)return"[]";var b=ua(t,d);return u&&!f_(b)?"["+Zl(b,u)+"]":"[ "+Si.call(b,", ")+" ]"}if(qx(t)){var v=ua(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!op.call(t,"cause")?"{ ["+String(t)+"] "+Si.call(sp.call("[cause]: "+d(t.cause),v),", ")+" }":v.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+Si.call(v,", ")+" }"}if(typeof t=="object"&&o){if(cp&&typeof t[cp]=="function"&&Wl)return Wl(t,{depth:c-i});if(o!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(o_(t)){var w=[];return qf&&qf.call(t,function(I,D){w.push(d(D,t,!0)+" => "+d(I,t))}),gp("Map",la.call(t),w,u)}if(l_(t)){var E=[];return tp&&tp.call(t,function(I){E.push(d(I,t))}),gp("Set",ca.call(t),E,u)}if(a_(t))return Xl("WeakMap");if(c_(t))return Xl("WeakSet");if(h_(t))return Xl("WeakRef");if(e_(t))return Kn(d(Number(t)));if(r_(t))return Kn(d(kl.call(t)));if(i_(t))return Kn(Vx.call(t));if(t_(t))return Kn(d(String(t)));if(!Qx(t)&&!dp(t)){var C=ua(t,d),A=ap?ap(t)===Object.prototype:t instanceof Object||t.constructor===Object,R=t instanceof Object?"":"null prototype",G=!A&&ue&&Object(t)===t&&ue in t?Dl.call(br(t),8,-1):R?"Object":"",N=A||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",P=N+(G||R?"["+Si.call(sp.call([],G||[],R||[]),": ")+"] ":"");return C.length===0?P+"{}":u?P+"{"+Zl(C,u)+"}":P+"{ "+Si.call(C,", ")+" }"}return String(t)};function up(r,t,e){var i=(e.quoteStyle||t)==="double"?'"':"'";return i+r+i}function $x(r){return gr.call(String(r),/"/g,""")}function Ul(r){return br(r)==="[object Array]"&&(!ue||!(typeof r=="object"&&ue in r))}function Qx(r){return br(r)==="[object Date]"&&(!ue||!(typeof r=="object"&&ue in r))}function dp(r){return br(r)==="[object RegExp]"&&(!ue||!(typeof r=="object"&&ue in r))}function qx(r){return br(r)==="[object Error]"&&(!ue||!(typeof r=="object"&&ue in r))}function t_(r){return br(r)==="[object String]"&&(!ue||!(typeof r=="object"&&ue in r))}function e_(r){return br(r)==="[object Number]"&&(!ue||!(typeof r=="object"&&ue in r))}function i_(r){return br(r)==="[object Boolean]"&&(!ue||!(typeof r=="object"&&ue in r))}function fp(r){if(Xs)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!Bl)return!1;try{return Bl.call(r),!0}catch{}return!1}function r_(r){if(!r||typeof r!="object"||!kl)return!1;try{return kl.call(r),!0}catch{}return!1}var s_=Object.prototype.hasOwnProperty||function(r){return r in this};function yr(r,t){return s_.call(r,t)}function br(r){return Hx.call(r)}function n_(r){if(r.name)return r.name;var t=Yx.call(Kx.call(r),/^function\s*([\w$]+)/);return t?t[1]:null}function pp(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 o_(r){if(!la||!r||typeof r!="object")return!1;try{la.call(r);try{ca.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function a_(r){if(!Vn||!r||typeof r!="object")return!1;try{Vn.call(r,Vn);try{Hn.call(r,Hn)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function h_(r){if(!ep||!r||typeof r!="object")return!1;try{return ep.call(r),!0}catch{}return!1}function l_(r){if(!ca||!r||typeof r!="object")return!1;try{ca.call(r);try{la.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function c_(r){if(!Hn||!r||typeof r!="object")return!1;try{Hn.call(r,Hn);try{Vn.call(r,Vn)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function u_(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function mp(r,t){if(r.length>t.maxStringLength){var e=r.length-t.maxStringLength,i="... "+e+" more character"+(e>1?"s":"");return mp(Dl.call(r,0,t.maxStringLength),t)+i}var s=gr.call(gr.call(r,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,d_);return up(s,"single",t)}function d_(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":"")+zx.call(t.toString(16))}function Kn(r){return"Object("+r+")"}function Xl(r){return r+" { ? }"}function gp(r,t,e,i){var s=i?Zl(e,i):Si.call(e,", ");return r+" ("+t+") {"+s+"}"}function f_(r){for(var t=0;t<r.length;t++)if(pp(r[t],`
|
|
2
|
+
`)>=0)return!1;return!0}function p_(r,t){var e;if(r.indent===" ")e=" ";else if(typeof r.indent=="number"&&r.indent>0)e=Si.call(Array(r.indent+1)," ");else return null;return{base:e,prev:Si.call(Array(t+1),e)}}function Zl(r,t){if(r.length===0)return"";var e=`
|
|
3
3
|
`+t.prev+t.base;return e+Si.call(r,","+e)+`
|
|
4
|
-
`+t.prev}function ua(r,t){var e=Ul(r),i=[];if(e){i.length=r.length;for(var s=0;s<r.length;s++)i[s]=yr(r,s)?t(r[s],r):""}var n=typeof Ol=="function"?Ol(r):[],o;if(Xs){o={};for(var a=0;a<n.length;a++)o["$"+n[a]]=n[a]}for(var h in r)yr(r,h)&&(e&&String(Number(h))===h&&h<r.length||Xs&&o["$"+h]instanceof Symbol||(rp.call(/[^\w$]/,h)?i.push(t(h,r)+": "+t(r[h],r)):i.push(h+": "+t(r[h],r))));if(typeof Ol=="function")for(var l=0;l<n.length;l++)op.call(r,n[l])&&i.push("["+t(n[l])+"]: "+t(r[n[l]],r));return i}var Vl=Ll,Zs=Ox,p_=jx,m_=Vl("%TypeError%"),da=Vl("%WeakMap%",!0),fa=Vl("%Map%",!0),g_=Zs("WeakMap.prototype.get",!0),y_=Zs("WeakMap.prototype.set",!0),b_=Zs("WeakMap.prototype.has",!0),x_=Zs("Map.prototype.get",!0),__=Zs("Map.prototype.set",!0),v_=Zs("Map.prototype.has",!0),Hl=function(r,t){for(var e=r,i;(i=e.next)!==null;e=i)if(i.key===t)return e.next=i.next,i.next=r.next,r.next=i,i},T_=function(r,t){var e=Hl(r,t);return e&&e.value},w_=function(r,t,e){var i=Hl(r,t);i?i.value=e:r.next={key:t,next:r.next,value:e}},S_=function(r,t){return!!Hl(r,t)},C_=function(){var t,e,i,s={assert:function(n){if(!s.has(n))throw new m_("Side channel does not contain "+p_(n))},get:function(n){if(da&&n&&(typeof n=="object"||typeof n=="function")){if(t)return g_(t,n)}else if(fa){if(e)return x_(e,n)}else if(i)return T_(i,n)},has:function(n){if(da&&n&&(typeof n=="object"||typeof n=="function")){if(t)return b_(t,n)}else if(fa){if(e)return v_(e,n)}else if(i)return S_(i,n);return!1},set:function(n,o){da&&n&&(typeof n=="object"||typeof n=="function")?(t||(t=new da),y_(t,n,o)):fa?(e||(e=new fa),__(e,n,o)):(i||(i={key:{},next:null}),w_(i,n,o))}};return s},E_=String.prototype.replace,I_=/%20/g,Kl={RFC1738:"RFC1738",RFC3986:"RFC3986"},Yl={default:Kl.RFC3986,formatters:{RFC1738:function(r){return E_.call(r,I_,"+")},RFC3986:function(r){return String(r)}},RFC1738:Kl.RFC1738,RFC3986:Kl.RFC3986},A_=Yl,zl=Object.prototype.hasOwnProperty,Yr=Array.isArray,Ci=function(){for(var r=[],t=0;t<256;++t)r.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return r}(),R_=function(t){for(;t.length>1;){var e=t.pop(),i=e.obj[e.prop];if(Yr(i)){for(var s=[],n=0;n<i.length;++n)typeof i[n]<"u"&&s.push(i[n]);e.obj[e.prop]=s}}},yp=function(t,e){for(var i=e&&e.plainObjects?Object.create(null):{},s=0;s<t.length;++s)typeof t[s]<"u"&&(i[s]=t[s]);return i},M_=function r(t,e,i){if(!e)return t;if(typeof e!="object"){if(Yr(t))t.push(e);else if(t&&typeof t=="object")(i&&(i.plainObjects||i.allowPrototypes)||!zl.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 Yr(t)&&!Yr(e)&&(s=yp(t,i)),Yr(t)&&Yr(e)?(e.forEach(function(n,o){if(zl.call(t,o)){var a=t[o];a&&typeof a=="object"&&n&&typeof n=="object"?t[o]=r(a,n,i):t.push(n)}else t[o]=n}),t):Object.keys(e).reduce(function(n,o){var a=e[o];return zl.call(n,o)?n[o]=r(n[o],a,i):n[o]=a,n},s)},L_=function(t,e){return Object.keys(e).reduce(function(i,s){return i[s]=e[s],i},t)},P_=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}},G_=function(t,e,i,s,n){if(t.length===0)return t;var o=t;if(typeof t=="symbol"?o=Symbol.prototype.toString.call(t):typeof t!="string"&&(o=String(t)),i==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(c){return"%26%23"+parseInt(c.slice(2),16)+"%3B"});for(var a="",h=0;h<o.length;++h){var l=o.charCodeAt(h);if(l===45||l===46||l===95||l===126||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||n===A_.RFC1738&&(l===40||l===41)){a+=o.charAt(h);continue}if(l<128){a=a+Ci[l];continue}if(l<2048){a=a+(Ci[192|l>>6]+Ci[128|l&63]);continue}if(l<55296||l>=57344){a=a+(Ci[224|l>>12]+Ci[128|l>>6&63]+Ci[128|l&63]);continue}h+=1,l=65536+((l&1023)<<10|o.charCodeAt(h)&1023),a+=Ci[240|l>>18]+Ci[128|l>>12&63]+Ci[128|l>>6&63]+Ci[128|l&63]}return a},F_=function(t){for(var e=[{obj:{o:t},prop:"o"}],i=[],s=0;s<e.length;++s)for(var n=e[s],o=n.obj[n.prop],a=Object.keys(o),h=0;h<a.length;++h){var l=a[h],c=o[l];typeof c=="object"&&c!==null&&i.indexOf(c)===-1&&(e.push({obj:o,prop:l}),i.push(c))}return R_(e),t},N_=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},D_=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},k_=function(t,e){return[].concat(t,e)},O_=function(t,e){if(Yr(t)){for(var i=[],s=0;s<t.length;s+=1)i.push(e(t[s]));return i}return e(t)},bp={arrayToObject:yp,assign:L_,combine:k_,compact:F_,decode:P_,encode:G_,isBuffer:D_,isRegExp:N_,maybeMap:O_,merge:M_},xp=C_,pa=bp,Hn=Yl,B_=Object.prototype.hasOwnProperty,_p={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},Ji=Array.isArray,W_=Array.prototype.push,vp=function(r,t){W_.apply(r,Ji(t)?t:[t])},U_=Date.prototype.toISOString,Tp=Hn.default,ue={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:pa.encode,encodeValuesOnly:!1,format:Tp,formatter:Hn.formatters[Tp],indices:!1,serializeDate:function(t){return U_.call(t)},skipNulls:!1,strictNullHandling:!1},X_=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},jl={},Z_=function r(t,e,i,s,n,o,a,h,l,c,u,d,f,m,p,g){for(var y=t,_=g,b=0,v=!1;(_=_.get(jl))!==void 0&&!v;){var w=_.get(t);if(b+=1,typeof w<"u"){if(w===b)throw new RangeError("Cyclic object value");v=!0}typeof _.get(jl)>"u"&&(b=0)}if(typeof h=="function"?y=h(e,y):y instanceof Date?y=u(y):i==="comma"&&Ji(y)&&(y=pa.maybeMap(y,function(H){return H instanceof Date?u(H):H})),y===null){if(n)return a&&!m?a(e,ue.encoder,p,"key",d):e;y=""}if(X_(y)||pa.isBuffer(y)){if(a){var C=m?e:a(e,ue.encoder,p,"key",d);return[f(C)+"="+f(a(y,ue.encoder,p,"value",d))]}return[f(e)+"="+f(String(y))]}var E=[];if(typeof y>"u")return E;var A;if(i==="comma"&&Ji(y))m&&a&&(y=pa.maybeMap(y,a)),A=[{value:y.length>0?y.join(",")||null:void 0}];else if(Ji(h))A=h;else{var R=Object.keys(y);A=l?R.sort(l):R}for(var G=s&&Ji(y)&&y.length===1?e+"[]":e,N=0;N<A.length;++N){var P=A[N],I=typeof P=="object"&&typeof P.value<"u"?P.value:y[P];if(!(o&&I===null)){var D=Ji(y)?typeof i=="function"?i(G,P):G:G+(c?"."+P:"["+P+"]");g.set(t,b);var X=xp();X.set(jl,g),vp(E,r(I,D,i,s,n,o,i==="comma"&&m&&Ji(y)?null:a,h,l,c,u,d,f,m,p,X))}}return E},V_=function(t){if(!t)return ue;if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");var e=t.charset||ue.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var i=Hn.default;if(typeof t.format<"u"){if(!B_.call(Hn.formatters,t.format))throw new TypeError("Unknown format option provided.");i=t.format}var s=Hn.formatters[i],n=ue.filter;return(typeof t.filter=="function"||Ji(t.filter))&&(n=t.filter),{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:ue.addQueryPrefix,allowDots:typeof t.allowDots>"u"?ue.allowDots:!!t.allowDots,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:ue.charsetSentinel,delimiter:typeof t.delimiter>"u"?ue.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:ue.encode,encoder:typeof t.encoder=="function"?t.encoder:ue.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:ue.encodeValuesOnly,filter:n,format:i,formatter:s,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:ue.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:ue.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:ue.strictNullHandling}},H_=function(r,t){var e=r,i=V_(t),s,n;typeof i.filter=="function"?(n=i.filter,e=n("",e)):Ji(i.filter)&&(n=i.filter,s=n);var o=[];if(typeof e!="object"||e===null)return"";var a;t&&t.arrayFormat in _p?a=t.arrayFormat:t&&"indices"in t?a=t.indices?"indices":"repeat":a="indices";var h=_p[a];if(t&&"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var l=h==="comma"&&t&&t.commaRoundTrip;s||(s=Object.keys(e)),i.sort&&s.sort(i.sort);for(var c=xp(),u=0;u<s.length;++u){var d=s[u];i.skipNulls&&e[d]===null||vp(o,Z_(e[d],d,h,l,i.strictNullHandling,i.skipNulls,i.encode?i.encoder:null,i.filter,i.sort,i.allowDots,i.serializeDate,i.format,i.formatter,i.encodeValuesOnly,i.charset,c))}var f=o.join(i.delimiter),m=i.addQueryPrefix===!0?"?":"";return i.charsetSentinel&&(i.charset==="iso-8859-1"?m+="utf8=%26%2310003%3B&":m+="utf8=%E2%9C%93&"),f.length>0?m+f:""},Vs=bp,Jl=Object.prototype.hasOwnProperty,K_=Array.isArray,re={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:Vs.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},Y_=function(r){return r.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},wp=function(r,t){return r&&typeof r=="string"&&t.comma&&r.indexOf(",")>-1?r.split(","):r},z_="utf8=%26%2310003%3B",j_="utf8=%E2%9C%93",J_=function(t,e){var i={__proto__:null},s=e.ignoreQueryPrefix?t.replace(/^\?/,""):t,n=e.parameterLimit===1/0?void 0:e.parameterLimit,o=s.split(e.delimiter,n),a=-1,h,l=e.charset;if(e.charsetSentinel)for(h=0;h<o.length;++h)o[h].indexOf("utf8=")===0&&(o[h]===j_?l="utf-8":o[h]===z_&&(l="iso-8859-1"),a=h,h=o.length);for(h=0;h<o.length;++h)if(h!==a){var c=o[h],u=c.indexOf("]="),d=u===-1?c.indexOf("="):u+1,f,m;d===-1?(f=e.decoder(c,re.decoder,l,"key"),m=e.strictNullHandling?null:""):(f=e.decoder(c.slice(0,d),re.decoder,l,"key"),m=Vs.maybeMap(wp(c.slice(d+1),e),function(p){return e.decoder(p,re.decoder,l,"value")})),m&&e.interpretNumericEntities&&l==="iso-8859-1"&&(m=Y_(m)),c.indexOf("[]=")>-1&&(m=K_(m)?[m]:m),Jl.call(i,f)?i[f]=Vs.combine(i[f],m):i[f]=m}return i},$_=function(r,t,e,i){for(var s=i?t:wp(t,e),n=r.length-1;n>=0;--n){var o,a=r[n];if(a==="[]"&&e.parseArrays)o=[].concat(s);else{o=e.plainObjects?Object.create(null):{};var h=a.charAt(0)==="["&&a.charAt(a.length-1)==="]"?a.slice(1,-1):a,l=parseInt(h,10);!e.parseArrays&&h===""?o={0:s}:!isNaN(l)&&a!==h&&String(l)===h&&l>=0&&e.parseArrays&&l<=e.arrayLimit?(o=[],o[l]=s):h!=="__proto__"&&(o[h]=s)}s=o}return s},Q_=function(t,e,i,s){if(t){var n=i.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,o=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,h=i.depth>0&&o.exec(n),l=h?n.slice(0,h.index):n,c=[];if(l){if(!i.plainObjects&&Jl.call(Object.prototype,l)&&!i.allowPrototypes)return;c.push(l)}for(var u=0;i.depth>0&&(h=a.exec(n))!==null&&u<i.depth;){if(u+=1,!i.plainObjects&&Jl.call(Object.prototype,h[1].slice(1,-1))&&!i.allowPrototypes)return;c.push(h[1])}return h&&c.push("["+n.slice(h.index)+"]"),$_(c,e,i,s)}},q_=function(t){if(!t)return re;if(t.decoder!==null&&t.decoder!==void 0&&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"?re.charset:t.charset;return{allowDots:typeof t.allowDots>"u"?re.allowDots:!!t.allowDots,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:re.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:re.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:re.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:re.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:re.comma,decoder:typeof t.decoder=="function"?t.decoder:re.decoder,delimiter:typeof t.delimiter=="string"||Vs.isRegExp(t.delimiter)?t.delimiter:re.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:re.depth,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:re.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:re.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:re.plainObjects,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:re.strictNullHandling}},t1=function(r,t){var e=q_(t);if(r===""||r===null||typeof r>"u")return e.plainObjects?Object.create(null):{};for(var i=typeof r=="string"?J_(r,e):r,s=e.plainObjects?Object.create(null):{},n=Object.keys(i),o=0;o<n.length;++o){var a=n[o],h=Q_(a,i[a],e,typeof r=="string");s=Vs.merge(s,h,e)}return e.allowSparse===!0?s:Vs.compact(s)},e1=H_,i1=t1,r1=Yl,s1={formats:r1,parse:i1,stringify:e1},n1=ux;function $i(){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 o1=/^([a-z0-9.+-]+:)/i,a1=/:[0-9]*$/,h1=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,l1=["<",">",'"',"`"," ","\r",`
|
|
5
|
-
`," "],
|
|
4
|
+
`+t.prev}function ua(r,t){var e=Ul(r),i=[];if(e){i.length=r.length;for(var s=0;s<r.length;s++)i[s]=yr(r,s)?t(r[s],r):""}var n=typeof Ol=="function"?Ol(r):[],o;if(Xs){o={};for(var a=0;a<n.length;a++)o["$"+n[a]]=n[a]}for(var h in r)yr(r,h)&&(e&&String(Number(h))===h&&h<r.length||Xs&&o["$"+h]instanceof Symbol||(rp.call(/[^\w$]/,h)?i.push(t(h,r)+": "+t(r[h],r)):i.push(h+": "+t(r[h],r))));if(typeof Ol=="function")for(var l=0;l<n.length;l++)op.call(r,n[l])&&i.push("["+t(n[l])+"]: "+t(r[n[l]],r));return i}var Vl=Ll,Zs=Bx,m_=Jx,g_=Vl("%TypeError%"),da=Vl("%WeakMap%",!0),fa=Vl("%Map%",!0),y_=Zs("WeakMap.prototype.get",!0),b_=Zs("WeakMap.prototype.set",!0),x_=Zs("WeakMap.prototype.has",!0),__=Zs("Map.prototype.get",!0),v_=Zs("Map.prototype.set",!0),T_=Zs("Map.prototype.has",!0),Hl=function(r,t){for(var e=r,i;(i=e.next)!==null;e=i)if(i.key===t)return e.next=i.next,i.next=r.next,r.next=i,i},w_=function(r,t){var e=Hl(r,t);return e&&e.value},S_=function(r,t,e){var i=Hl(r,t);i?i.value=e:r.next={key:t,next:r.next,value:e}},E_=function(r,t){return!!Hl(r,t)},C_=function(){var t,e,i,s={assert:function(n){if(!s.has(n))throw new g_("Side channel does not contain "+m_(n))},get:function(n){if(da&&n&&(typeof n=="object"||typeof n=="function")){if(t)return y_(t,n)}else if(fa){if(e)return __(e,n)}else if(i)return w_(i,n)},has:function(n){if(da&&n&&(typeof n=="object"||typeof n=="function")){if(t)return x_(t,n)}else if(fa){if(e)return T_(e,n)}else if(i)return E_(i,n);return!1},set:function(n,o){da&&n&&(typeof n=="object"||typeof n=="function")?(t||(t=new da),b_(t,n,o)):fa?(e||(e=new fa),v_(e,n,o)):(i||(i={key:{},next:null}),S_(i,n,o))}};return s},I_=String.prototype.replace,A_=/%20/g,Kl={RFC1738:"RFC1738",RFC3986:"RFC3986"},Yl={default:Kl.RFC3986,formatters:{RFC1738:function(r){return I_.call(r,A_,"+")},RFC3986:function(r){return String(r)}},RFC1738:Kl.RFC1738,RFC3986:Kl.RFC3986},R_=Yl,zl=Object.prototype.hasOwnProperty,Yr=Array.isArray,Ei=function(){for(var r=[],t=0;t<256;++t)r.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return r}(),M_=function(t){for(;t.length>1;){var e=t.pop(),i=e.obj[e.prop];if(Yr(i)){for(var s=[],n=0;n<i.length;++n)typeof i[n]<"u"&&s.push(i[n]);e.obj[e.prop]=s}}},yp=function(t,e){for(var i=e&&e.plainObjects?Object.create(null):{},s=0;s<t.length;++s)typeof t[s]<"u"&&(i[s]=t[s]);return i},L_=function r(t,e,i){if(!e)return t;if(typeof e!="object"){if(Yr(t))t.push(e);else if(t&&typeof t=="object")(i&&(i.plainObjects||i.allowPrototypes)||!zl.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 Yr(t)&&!Yr(e)&&(s=yp(t,i)),Yr(t)&&Yr(e)?(e.forEach(function(n,o){if(zl.call(t,o)){var a=t[o];a&&typeof a=="object"&&n&&typeof n=="object"?t[o]=r(a,n,i):t.push(n)}else t[o]=n}),t):Object.keys(e).reduce(function(n,o){var a=e[o];return zl.call(n,o)?n[o]=r(n[o],a,i):n[o]=a,n},s)},P_=function(t,e){return Object.keys(e).reduce(function(i,s){return i[s]=e[s],i},t)},G_=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}},F_=function(t,e,i,s,n){if(t.length===0)return t;var o=t;if(typeof t=="symbol"?o=Symbol.prototype.toString.call(t):typeof t!="string"&&(o=String(t)),i==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(c){return"%26%23"+parseInt(c.slice(2),16)+"%3B"});for(var a="",h=0;h<o.length;++h){var l=o.charCodeAt(h);if(l===45||l===46||l===95||l===126||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||n===R_.RFC1738&&(l===40||l===41)){a+=o.charAt(h);continue}if(l<128){a=a+Ei[l];continue}if(l<2048){a=a+(Ei[192|l>>6]+Ei[128|l&63]);continue}if(l<55296||l>=57344){a=a+(Ei[224|l>>12]+Ei[128|l>>6&63]+Ei[128|l&63]);continue}h+=1,l=65536+((l&1023)<<10|o.charCodeAt(h)&1023),a+=Ei[240|l>>18]+Ei[128|l>>12&63]+Ei[128|l>>6&63]+Ei[128|l&63]}return a},N_=function(t){for(var e=[{obj:{o:t},prop:"o"}],i=[],s=0;s<e.length;++s)for(var n=e[s],o=n.obj[n.prop],a=Object.keys(o),h=0;h<a.length;++h){var l=a[h],c=o[l];typeof c=="object"&&c!==null&&i.indexOf(c)===-1&&(e.push({obj:o,prop:l}),i.push(c))}return M_(e),t},D_=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},k_=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},O_=function(t,e){return[].concat(t,e)},B_=function(t,e){if(Yr(t)){for(var i=[],s=0;s<t.length;s+=1)i.push(e(t[s]));return i}return e(t)},bp={arrayToObject:yp,assign:P_,combine:O_,compact:N_,decode:G_,encode:F_,isBuffer:k_,isRegExp:D_,maybeMap:B_,merge:L_},xp=C_,pa=bp,Yn=Yl,W_=Object.prototype.hasOwnProperty,_p={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},Ji=Array.isArray,U_=Array.prototype.push,vp=function(r,t){U_.apply(r,Ji(t)?t:[t])},X_=Date.prototype.toISOString,Tp=Yn.default,de={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:pa.encode,encodeValuesOnly:!1,format:Tp,formatter:Yn.formatters[Tp],indices:!1,serializeDate:function(t){return X_.call(t)},skipNulls:!1,strictNullHandling:!1},Z_=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},jl={},V_=function r(t,e,i,s,n,o,a,h,l,c,u,d,f,m,p,g){for(var y=t,_=g,b=0,v=!1;(_=_.get(jl))!==void 0&&!v;){var w=_.get(t);if(b+=1,typeof w<"u"){if(w===b)throw new RangeError("Cyclic object value");v=!0}typeof _.get(jl)>"u"&&(b=0)}if(typeof h=="function"?y=h(e,y):y instanceof Date?y=u(y):i==="comma"&&Ji(y)&&(y=pa.maybeMap(y,function(H){return H instanceof Date?u(H):H})),y===null){if(n)return a&&!m?a(e,de.encoder,p,"key",d):e;y=""}if(Z_(y)||pa.isBuffer(y)){if(a){var E=m?e:a(e,de.encoder,p,"key",d);return[f(E)+"="+f(a(y,de.encoder,p,"value",d))]}return[f(e)+"="+f(String(y))]}var C=[];if(typeof y>"u")return C;var A;if(i==="comma"&&Ji(y))m&&a&&(y=pa.maybeMap(y,a)),A=[{value:y.length>0?y.join(",")||null:void 0}];else if(Ji(h))A=h;else{var R=Object.keys(y);A=l?R.sort(l):R}for(var G=s&&Ji(y)&&y.length===1?e+"[]":e,N=0;N<A.length;++N){var P=A[N],I=typeof P=="object"&&typeof P.value<"u"?P.value:y[P];if(!(o&&I===null)){var D=Ji(y)?typeof i=="function"?i(G,P):G:G+(c?"."+P:"["+P+"]");g.set(t,b);var X=xp();X.set(jl,g),vp(C,r(I,D,i,s,n,o,i==="comma"&&m&&Ji(y)?null:a,h,l,c,u,d,f,m,p,X))}}return C},H_=function(t){if(!t)return de;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||de.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=Yn.default;if(typeof t.format<"u"){if(!W_.call(Yn.formatters,t.format))throw new TypeError("Unknown format option provided.");i=t.format}var s=Yn.formatters[i],n=de.filter;return(typeof t.filter=="function"||Ji(t.filter))&&(n=t.filter),{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:de.addQueryPrefix,allowDots:typeof t.allowDots>"u"?de.allowDots:!!t.allowDots,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:de.charsetSentinel,delimiter:typeof t.delimiter>"u"?de.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:de.encode,encoder:typeof t.encoder=="function"?t.encoder:de.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:de.encodeValuesOnly,filter:n,format:i,formatter:s,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:de.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:de.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:de.strictNullHandling}},K_=function(r,t){var e=r,i=H_(t),s,n;typeof i.filter=="function"?(n=i.filter,e=n("",e)):Ji(i.filter)&&(n=i.filter,s=n);var o=[];if(typeof e!="object"||e===null)return"";var a;t&&t.arrayFormat in _p?a=t.arrayFormat:t&&"indices"in t?a=t.indices?"indices":"repeat":a="indices";var h=_p[a];if(t&&"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var l=h==="comma"&&t&&t.commaRoundTrip;s||(s=Object.keys(e)),i.sort&&s.sort(i.sort);for(var c=xp(),u=0;u<s.length;++u){var d=s[u];i.skipNulls&&e[d]===null||vp(o,V_(e[d],d,h,l,i.strictNullHandling,i.skipNulls,i.encode?i.encoder:null,i.filter,i.sort,i.allowDots,i.serializeDate,i.format,i.formatter,i.encodeValuesOnly,i.charset,c))}var f=o.join(i.delimiter),m=i.addQueryPrefix===!0?"?":"";return i.charsetSentinel&&(i.charset==="iso-8859-1"?m+="utf8=%26%2310003%3B&":m+="utf8=%E2%9C%93&"),f.length>0?m+f:""},Vs=bp,Jl=Object.prototype.hasOwnProperty,Y_=Array.isArray,re={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:Vs.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},z_=function(r){return r.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},wp=function(r,t){return r&&typeof r=="string"&&t.comma&&r.indexOf(",")>-1?r.split(","):r},j_="utf8=%26%2310003%3B",J_="utf8=%E2%9C%93",$_=function(t,e){var i={__proto__:null},s=e.ignoreQueryPrefix?t.replace(/^\?/,""):t,n=e.parameterLimit===1/0?void 0:e.parameterLimit,o=s.split(e.delimiter,n),a=-1,h,l=e.charset;if(e.charsetSentinel)for(h=0;h<o.length;++h)o[h].indexOf("utf8=")===0&&(o[h]===J_?l="utf-8":o[h]===j_&&(l="iso-8859-1"),a=h,h=o.length);for(h=0;h<o.length;++h)if(h!==a){var c=o[h],u=c.indexOf("]="),d=u===-1?c.indexOf("="):u+1,f,m;d===-1?(f=e.decoder(c,re.decoder,l,"key"),m=e.strictNullHandling?null:""):(f=e.decoder(c.slice(0,d),re.decoder,l,"key"),m=Vs.maybeMap(wp(c.slice(d+1),e),function(p){return e.decoder(p,re.decoder,l,"value")})),m&&e.interpretNumericEntities&&l==="iso-8859-1"&&(m=z_(m)),c.indexOf("[]=")>-1&&(m=Y_(m)?[m]:m),Jl.call(i,f)?i[f]=Vs.combine(i[f],m):i[f]=m}return i},Q_=function(r,t,e,i){for(var s=i?t:wp(t,e),n=r.length-1;n>=0;--n){var o,a=r[n];if(a==="[]"&&e.parseArrays)o=[].concat(s);else{o=e.plainObjects?Object.create(null):{};var h=a.charAt(0)==="["&&a.charAt(a.length-1)==="]"?a.slice(1,-1):a,l=parseInt(h,10);!e.parseArrays&&h===""?o={0:s}:!isNaN(l)&&a!==h&&String(l)===h&&l>=0&&e.parseArrays&&l<=e.arrayLimit?(o=[],o[l]=s):h!=="__proto__"&&(o[h]=s)}s=o}return s},q_=function(t,e,i,s){if(t){var n=i.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,o=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,h=i.depth>0&&o.exec(n),l=h?n.slice(0,h.index):n,c=[];if(l){if(!i.plainObjects&&Jl.call(Object.prototype,l)&&!i.allowPrototypes)return;c.push(l)}for(var u=0;i.depth>0&&(h=a.exec(n))!==null&&u<i.depth;){if(u+=1,!i.plainObjects&&Jl.call(Object.prototype,h[1].slice(1,-1))&&!i.allowPrototypes)return;c.push(h[1])}return h&&c.push("["+n.slice(h.index)+"]"),Q_(c,e,i,s)}},t1=function(t){if(!t)return re;if(t.decoder!==null&&t.decoder!==void 0&&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"?re.charset:t.charset;return{allowDots:typeof t.allowDots>"u"?re.allowDots:!!t.allowDots,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:re.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:re.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:re.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:re.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:re.comma,decoder:typeof t.decoder=="function"?t.decoder:re.decoder,delimiter:typeof t.delimiter=="string"||Vs.isRegExp(t.delimiter)?t.delimiter:re.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:re.depth,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:re.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:re.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:re.plainObjects,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:re.strictNullHandling}},e1=function(r,t){var e=t1(t);if(r===""||r===null||typeof r>"u")return e.plainObjects?Object.create(null):{};for(var i=typeof r=="string"?$_(r,e):r,s=e.plainObjects?Object.create(null):{},n=Object.keys(i),o=0;o<n.length;++o){var a=n[o],h=q_(a,i[a],e,typeof r=="string");s=Vs.merge(s,h,e)}return e.allowSparse===!0?s:Vs.compact(s)},i1=K_,r1=e1,s1=Yl,n1={formats:s1,parse:r1,stringify:i1},o1=dx;function $i(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var a1=/^([a-z0-9.+-]+:)/i,h1=/:[0-9]*$/,l1=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,c1=["<",">",'"',"`"," ","\r",`
|
|
5
|
+
`," "],u1=["{","}","|","\\","^","`"].concat(c1),$l=["'"].concat(u1),Sp=["%","/","?",";","#"].concat($l),Ep=["/","?","#"],d1=255,Cp=/^[+a-z0-9A-Z_-]{0,63}$/,f1=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,p1={javascript:!0,"javascript:":!0},Ql={javascript:!0,"javascript:":!0},Hs={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},ql=n1;function m1(r,t,e){if(r&&typeof r=="object"&&r instanceof $i)return r;var i=new $i;return i.parse(r,t,e),i}$i.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),o=/\\/g;n[0]=n[0].replace(o,"/"),r=n.join(s);var a=r;if(a=a.trim(),!e&&r.split("#").length===1){var h=l1.exec(a);if(h)return this.path=a,this.href=a,this.pathname=h[1],h[2]?(this.search=h[2],t?this.query=ql.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var l=a1.exec(a);if(l){l=l[0];var c=l.toLowerCase();this.protocol=c,a=a.substr(l.length)}if(e||l||a.match(/^\/\/[^@/]+@[^@/]+/)){var u=a.substr(0,2)==="//";u&&!(l&&Ql[l])&&(a=a.substr(2),this.slashes=!0)}if(!Ql[l]&&(u||l&&!Hs[l])){for(var d=-1,f=0;f<Ep.length;f++){var m=a.indexOf(Ep[f]);m!==-1&&(d===-1||m<d)&&(d=m)}var p,g;d===-1?g=a.lastIndexOf("@"):g=a.lastIndexOf("@",d),g!==-1&&(p=a.slice(0,g),a=a.slice(g+1),this.auth=decodeURIComponent(p)),d=-1;for(var f=0;f<Sp.length;f++){var m=a.indexOf(Sp[f]);m!==-1&&(d===-1||m<d)&&(d=m)}d===-1&&(d=a.length),this.host=a.slice(0,d),a=a.slice(d),this.parseHost(),this.hostname=this.hostname||"";var y=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!y)for(var _=this.hostname.split(/\./),f=0,b=_.length;f<b;f++){var v=_[f];if(v&&!v.match(Cp)){for(var w="",E=0,C=v.length;E<C;E++)v.charCodeAt(E)>127?w+="x":w+=v[E];if(!w.match(Cp)){var A=_.slice(0,f),R=_.slice(f+1),G=v.match(f1);G&&(A.push(G[1]),R.unshift(G[2])),R.length&&(a="/"+R.join(".")+a),this.hostname=A.join(".");break}}}this.hostname.length>d1?this.hostname="":this.hostname=this.hostname.toLowerCase(),y||(this.hostname=o1.toASCII(this.hostname));var N=this.port?":"+this.port:"",P=this.hostname||"";this.host=P+N,this.href+=this.host,y&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!p1[c])for(var f=0,b=$l.length;f<b;f++){var I=$l[f];if(a.indexOf(I)!==-1){var D=encodeURIComponent(I);D===I&&(D=escape(I)),a=a.split(I).join(D)}}var X=a.indexOf("#");X!==-1&&(this.hash=a.substr(X),a=a.slice(0,X));var H=a.indexOf("?");if(H!==-1?(this.search=a.substr(H),this.query=a.substr(H+1),t&&(this.query=ql.parse(this.query)),a=a.slice(0,H)):t&&(this.search="",this.query={}),a&&(this.pathname=a),Hs[c]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var N=this.pathname||"",Z=this.search||"";this.path=N+Z}return this.href=this.format(),this},$i.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=ql.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var o=this.search||n&&"?"+n||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||Hs[t])&&s!==!1?(s="//"+(s||""),e&&e.charAt(0)!=="/"&&(e="/"+e)):s||(s=""),i&&i.charAt(0)!=="#"&&(i="#"+i),o&&o.charAt(0)!=="?"&&(o="?"+o),e=e.replace(/[?#]/g,function(a){return encodeURIComponent(a)}),o=o.replace("#","%23"),t+s+e+o+i},$i.prototype.resolve=function(r){return this.resolveObject(m1(r,!1,!0)).format()},$i.prototype.resolveObject=function(r){if(typeof r=="string"){var t=new $i;t.parse(r,!1,!0),r=t}for(var e=new $i,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 o=Object.keys(r),a=0;a<o.length;a++){var h=o[a];h!=="protocol"&&(e[h]=r[h])}return Hs[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(!Hs[r.protocol]){for(var l=Object.keys(r),c=0;c<l.length;c++){var u=l[c];e[u]=r[u]}return e.href=e.format(),e}if(e.protocol=r.protocol,!r.host&&!Ql[r.protocol]){for(var b=(r.pathname||"").split("/");b.length&&!(r.host=b.shift()););r.host||(r.host=""),r.hostname||(r.hostname=""),b[0]!==""&&b.unshift(""),b.length<2&&b.unshift(""),e.pathname=b.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 d=e.pathname||"",f=e.search||"";e.path=d+f}return e.slashes=e.slashes||r.slashes,e.href=e.format(),e}var m=e.pathname&&e.pathname.charAt(0)==="/",p=r.host||r.pathname&&r.pathname.charAt(0)==="/",g=p||m||e.host&&r.pathname,y=g,_=e.pathname&&e.pathname.split("/")||[],b=r.pathname&&r.pathname.split("/")||[],v=e.protocol&&!Hs[e.protocol];if(v&&(e.hostname="",e.port=null,e.host&&(_[0]===""?_[0]=e.host:_.unshift(e.host)),e.host="",r.protocol&&(r.hostname=null,r.port=null,r.host&&(b[0]===""?b[0]=r.host:b.unshift(r.host)),r.host=null),g=g&&(b[0]===""||_[0]==="")),p)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,_=b;else if(b.length)_||(_=[]),_.pop(),_=_.concat(b),e.search=r.search,e.query=r.query;else if(r.search!=null){if(v){e.host=_.shift(),e.hostname=e.host;var w=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;w&&(e.auth=w.shift(),e.hostname=w.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(!_.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var E=_.slice(-1)[0],C=(e.host||r.host||_.length>1)&&(E==="."||E==="..")||E==="",A=0,R=_.length;R>=0;R--)E=_[R],E==="."?_.splice(R,1):E===".."?(_.splice(R,1),A++):A&&(_.splice(R,1),A--);if(!g&&!y)for(;A--;A)_.unshift("..");g&&_[0]!==""&&(!_[0]||_[0].charAt(0)!=="/")&&_.unshift(""),C&&_.join("/").substr(-1)!=="/"&&_.push("");var G=_[0]===""||_[0]&&_[0].charAt(0)==="/";if(v){e.hostname=G?"":_.length?_.shift():"",e.host=e.hostname;var w=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;w&&(e.auth=w.shift(),e.hostname=w.shift(),e.host=e.hostname)}return g=g||e.host&&_.length,g&&!G&&_.unshift(""),_.length>0?e.pathname=_.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},$i.prototype.parseHost=function(){var r=this.host,t=h1.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 Ip={};function Tt(r,t,e=3){if(Ip[t])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
6
6
|
Deprecated since v${r}`):(i=i.split(`
|
|
7
7
|
`).splice(e).join(`
|
|
8
8
|
`),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t}
|
|
9
9
|
Deprecated since v${r}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
10
|
-
Deprecated since v${r}`),console.warn(i))),Ip[t]=!0}function si(r){if(typeof r!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(r)}`)}function Kn(r){return r.split("?")[0].split("#")[0]}function m1(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function g1(r,t,e){return r.replace(new RegExp(m1(t),"g"),e)}function y1(r,t){let e="",i=0,s=-1,n=0,o=-1;for(let a=0;a<=r.length;++a){if(a<r.length)o=r.charCodeAt(a);else{if(o===47)break;o=47}if(o===47){if(!(s===a-1||n===1))if(s!==a-1&&n===2){if(e.length<2||i!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){const 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=a,n=0;continue}}else if(e.length===2||e.length===1){e="",i=0,s=a,n=0;continue}}t&&(e.length>0?e+="/..":e="..",i=2)}else e.length>0?e+=`/${r.slice(s+1,a)}`:e=r.slice(s+1,a),i=a-s-1;s=a,n=0}else o===46&&n!==-1?++n:n=-1}return e}const Qt={toPosix(r){return g1(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){si(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(si(r),this.isDataUrl(r)||this.isBlobUrl(r))return r;const i=Kn(this.toPosix(t??q.ADAPTER.getBaseUrl())),s=Kn(this.toPosix(e??this.rootname(i)));return r=this.toPosix(r),r.startsWith("/")?Qt.join(s,r.slice(1)):this.isAbsolute(r)?r:this.join(i,r)},normalize(r){if(si(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=y1(r,!1),r.length>0&&i&&(r+="/"),e?`/${r}`:t+r},isAbsolute(r){return si(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(si(i),i.length>0)if(t===void 0)t=i;else{const s=r[e-1]??"";this.extname(s)?t+=`/../${i}`:t+=`/${i}`}}return t===void 0?".":this.normalize(t)},dirname(r){if(si(r),r.length===0)return".";r=this.toPosix(r);let t=r.charCodeAt(0);const e=t===47;let i=-1,s=!0;const n=this.getProtocol(r),o=r;r=r.slice(n.length);for(let a=r.length-1;a>=1;--a)if(t=r.charCodeAt(a),t===47){if(!s){i=a;break}}else s=!1;return i===-1?e?"/":this.isUrl(o)?n+r:n:e&&i===1?"//":n+r.slice(0,i)},rootname(r){si(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){si(r),t&&si(t),r=Kn(this.toPosix(r));let e=0,i=-1,s=!0,n;if(t!==void 0&&t.length>0&&t.length<=r.length){if(t.length===r.length&&t===r)return"";let o=t.length-1,a=-1;for(n=r.length-1;n>=0;--n){const h=r.charCodeAt(n);if(h===47){if(!s){e=n+1;break}}else a===-1&&(s=!1,a=n+1),o>=0&&(h===t.charCodeAt(o)?--o===-1&&(i=n):(o=-1,i=a))}return e===i?i=a:i===-1&&(i=r.length),r.slice(e,i)}for(n=r.length-1;n>=0;--n)if(r.charCodeAt(n)===47){if(!s){e=n+1;break}}else i===-1&&(s=!1,i=n+1);return i===-1?"":r.slice(e,i)},extname(r){si(r),r=Kn(this.toPosix(r));let t=-1,e=0,i=-1,s=!0,n=0;for(let o=r.length-1;o>=0;--o){const a=r.charCodeAt(o);if(a===47){if(!s){e=o+1;break}continue}i===-1&&(s=!1,i=o+1),a===46?t===-1?t=o:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||i===-1||n===0||n===1&&t===i-1&&t===e+1?"":r.slice(t,i)},parse(r){si(r);const t={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return t;r=Kn(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,o=0,a=-1,h=!0,l=r.length-1,c=0;for(;l>=s;--l){if(e=r.charCodeAt(l),e===47){if(!h){o=l+1;break}continue}a===-1&&(h=!1,a=l+1),e===46?n===-1?n=l:c!==1&&(c=1):n!==-1&&(c=-1)}return n===-1||a===-1||c===0||c===1&&n===a-1&&n===o+1?a!==-1&&(o===0&&i?t.base=t.name=r.slice(1,a):t.base=t.name=r.slice(o,a)):(o===0&&i?(t.name=r.slice(1,n),t.base=r.slice(1,a)):(t.name=r.slice(o,n),t.base=r.slice(o,a)),t.ext=r.slice(n,a)),t.dir=this.dirname(r),t},sep:"/",delimiter:":"};let tc;async function b1(){return tc??(tc=(async()=>{var n;const r=document.createElement("canvas").getContext("webgl");if(!r)return Se.UNPACK;const t=await new Promise(o=>{const a=document.createElement("video");a.onloadeddata=()=>o(a),a.onerror=()=>o(null),a.autoplay=!1,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load()});if(!t)return Se.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]?Se.PMA:Se.UNPACK})()),tc}let ec;function x1(){return typeof ec>"u"&&(ec=function(){var t;const r={stencil:!0,failIfMajorPerformanceCaveat:q.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!q.ADAPTER.getWebGLRenderingContext())return!1;const e=q.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}}()),ec}var _1={grad:.9,turn:360,rad:360/(2*Math.PI)},Qi=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},se=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*r)/e+0},Ye=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),r>e?e:r>t?r:t},Ap=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},Rp=function(r){return{r:Ye(r.r,0,255),g:Ye(r.g,0,255),b:Ye(r.b,0,255),a:Ye(r.a)}},ic=function(r){return{r:se(r.r),g:se(r.g),b:se(r.b),a:se(r.a,3)}},v1=/^#([0-9a-f]{3,8})$/i,ma=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},Mp=function(r){var t=r.r,e=r.g,i=r.b,s=r.a,n=Math.max(t,e,i),o=n-Math.min(t,e,i),a=o?n===t?(e-i)/o:n===e?2+(i-t)/o:4+(t-e)/o:0;return{h:60*(a<0?a+6:a),s:n?o/n*100:0,v:n/255*100,a:s}},Lp=function(r){var t=r.h,e=r.s,i=r.v,s=r.a;t=t/360*6,e/=100,i/=100;var n=Math.floor(t),o=i*(1-e),a=i*(1-(t-n)*e),h=i*(1-(1-t+n)*e),l=n%6;return{r:255*[i,a,o,o,h,i][l],g:255*[h,i,i,a,o,o][l],b:255*[o,o,h,i,i,a][l],a:s}},Pp=function(r){return{h:Ap(r.h),s:Ye(r.s,0,100),l:Ye(r.l,0,100),a:Ye(r.a)}},Gp=function(r){return{h:se(r.h),s:se(r.s),l:se(r.l),a:se(r.a,3)}},Fp=function(r){return Lp((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},Yn=function(r){return{h:(t=Mp(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},T1=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,w1=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,S1=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,C1=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,rc={string:[[function(r){var t=v1.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:r.length===4?se(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?se(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=S1.exec(r)||C1.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:Rp({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=T1.exec(r)||w1.exec(r);if(!t)return null;var e,i,s=Pp({h:(e=t[1],i=t[2],i===void 0&&(i="deg"),Number(e)*(_1[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Fp(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 Qi(t)&&Qi(e)&&Qi(i)?Rp({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(!Qi(t)||!Qi(e)||!Qi(i))return null;var o=Pp({h:Number(t),s:Number(e),l:Number(i),a:Number(n)});return Fp(o)},"hsl"],[function(r){var t=r.h,e=r.s,i=r.v,s=r.a,n=s===void 0?1:s;if(!Qi(t)||!Qi(e)||!Qi(i))return null;var o=function(a){return{h:Ap(a.h),s:Ye(a.s,0,100),v:Ye(a.v,0,100),a:Ye(a.a)}}({h:Number(t),s:Number(e),v:Number(i),a:Number(n)});return Lp(o)},"hsv"]]},Np=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]},E1=function(r){return typeof r=="string"?Np(r.trim(),rc.string):typeof r=="object"&&r!==null?Np(r,rc.object):[null,void 0]},sc=function(r,t){var e=Yn(r);return{h:e.h,s:Ye(e.s+100*t,0,100),l:e.l,a:e.a}},nc=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},Dp=function(r,t){var e=Yn(r);return{h:e.h,s:e.s,l:Ye(e.l+100*t,0,100),a:e.a}},oc=function(){function r(t){this.parsed=E1(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 se(nc(this.rgba),2)},r.prototype.isDark=function(){return nc(this.rgba)<.5},r.prototype.isLight=function(){return nc(this.rgba)>=.5},r.prototype.toHex=function(){return t=ic(this.rgba),e=t.r,i=t.g,s=t.b,o=(n=t.a)<1?ma(se(255*n)):"","#"+ma(e)+ma(i)+ma(s)+o;var t,e,i,s,n,o},r.prototype.toRgb=function(){return ic(this.rgba)},r.prototype.toRgbString=function(){return t=ic(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 Gp(Yn(this.rgba))},r.prototype.toHslString=function(){return t=Gp(Yn(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=Mp(this.rgba),{h:se(t.h),s:se(t.s),v:se(t.v),a:se(t.a,3)};var t},r.prototype.invert=function(){return Ei({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),Ei(sc(this.rgba,t))},r.prototype.desaturate=function(t){return t===void 0&&(t=.1),Ei(sc(this.rgba,-t))},r.prototype.grayscale=function(){return Ei(sc(this.rgba,-1))},r.prototype.lighten=function(t){return t===void 0&&(t=.1),Ei(Dp(this.rgba,t))},r.prototype.darken=function(t){return t===void 0&&(t=.1),Ei(Dp(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"?Ei({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):se(this.rgba.a,3);var e},r.prototype.hue=function(t){var e=Yn(this.rgba);return typeof t=="number"?Ei({h:t,s:e.s,l:e.l,a:e.a}):se(e.h)},r.prototype.isEqual=function(t){return this.toHex()===Ei(t).toHex()},r}(),Ei=function(r){return r instanceof oc?r:new oc(r)},kp=[],I1=function(r){r.forEach(function(t){kp.indexOf(t)<0&&(t(oc,rc),kp.push(t))})};function A1(r,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},i={};for(var s in e)i[e[s]]=s;var n={};r.prototype.toName=function(o){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,h,l=i[this.toHex()];if(l)return l;if(o!=null&&o.closest){var c=this.toRgb(),u=1/0,d="black";if(!n.length)for(var f in e)n[f]=new r(e[f]).toRgb();for(var m in e){var p=(a=c,h=n[m],Math.pow(a.r-h.r,2)+Math.pow(a.g-h.g,2)+Math.pow(a.b-h.b,2));p<u&&(u=p,d=m)}return d}},t.string.push([function(o){var a=o.toLowerCase(),h=a==="transparent"?"#0000":e[a];return h?new r(h).toRgb():null},"name"])}I1([A1]);const Ks=class fl{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 fl)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(o=>t[o]===e[o])}return t===e}toRgba(){const[t,e,i,s]=this._components;return{r:t,g:e,b:i,a:s}}toRgb(){const[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){const[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){const[e,i,s]=this._components;return 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]=fl.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 o=t;e=(o>>16&255)/255,i=(o>>8&255)/255,s=(o&255)/255,n=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,i,s,n=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,i,s,n=255]=t,e/=255,i/=255,s/=255,n/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const a=fl.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}const o=Ei(t);o.isValid()&&({r:e,g:i,b:s,a:n}=o.rgba,e/=255,i/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,this._components[2]=s,this._components[3]=n,this.refreshInt();else throw new Error(`Unable to convert color ${t}`)}refreshInt(){this._clamp(this._components);const[t,e,i]=this._components;this._int=(t*255<<16)+(e*255<<8)+(i*255|0)}_clamp(t,e=0,i=1){return typeof t=="number"?Math.min(Math.max(t,e),i):(t.forEach((s,n)=>{t[n]=Math.min(Math.max(s,e),i)}),t)}};Ks.shared=new Ks,Ks.temp=new Ks,Ks.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let Ft=Ks;function R1(r){return Tt("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),Ft.shared.setValue(r).toHex()}function M1(r){return Tt("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),Ft.shared.setValue(r).toNumber()}function L1(){const r=[],t=[];for(let i=0;i<32;i++)r[i]=i,t[i]=i;r[ft.NORMAL_NPM]=ft.NORMAL,r[ft.ADD_NPM]=ft.ADD,r[ft.SCREEN_NPM]=ft.SCREEN,t[ft.NORMAL]=ft.NORMAL_NPM,t[ft.ADD]=ft.ADD_NPM,t[ft.SCREEN]=ft.SCREEN_NPM;const e=[];return e.push(t),e.push(r),e}const Op=L1();function Bp(r,t){return Op[t?1:0][r]}function P1(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 Wp(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 ga(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 Up(r){return!(r&r-1)&&!!r}function Xp(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 Ys(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 xr(r){return r===0?0:r<0?-1:1}let G1=0;function zr(){return++G1}const ac=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}};ac.EMPTY=new ac(0,0,0,0);let Zp=ac;const Vp={},Ii=Object.create(null),_r=Object.create(null);class F1{constructor(t,e,i){this._canvas=q.ADAPTER.createCanvas(),this._context=this._canvas.getContext("2d"),this.resolution=i||q.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 Hp(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 Kp(r,t,e,i,s){const n=4*t;for(let o=i,a=i*n+4*e;o<=s;++o,a+=n)if(r[a+3]!==0)return!1;return!0}function N1(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,o=0,a=t-1,h=e-1;for(;o<e&&Hp(s,t,o);)++o;if(o===e)return Zp.EMPTY;for(;Hp(s,t,h);)--h;for(;Kp(s,t,n,o,h);)++n;for(;Kp(s,t,a,o,h);)--a;return++a,++h,new Zp(n,o,a,h)}function D1(r){const t=N1(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 k1(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 qi(r,t=1){var i;const e=(i=q.RETINA_PREFIX)==null?void 0:i.exec(r);return e?parseFloat(e[1]):t}var J=(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))(J||{});const hc=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},Yp=(r,t)=>hc(r).priority??t,it={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(hc).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(hc).forEach(t=>{t.type.forEach(e=>{const i=this._addHandlers,s=this._queue;i[e]?i[e](t):(s[e]=s[e]||[],s[e].push(t))})}),this},handle(r,t,e){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]&&(n[r].forEach(o=>t(o)),delete n[r]),this},handleByMap(r,t){return this.handle(r,e=>{t[e.name]=e.ref},e=>{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)=>Yp(n,e)-Yp(s,e)))},i=>{const s=t.indexOf(i.ref);s!==-1&&t.splice(s,1)})}};class lc{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 O1=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
11
|
-
`);function
|
|
12
|
-
else `),e<r-1&&(t+=`if(test == ${e}.0){}`);return t}function W1(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=O1.replace(/%forloop%/gi,B1(r));if(t.shaderSource(e,i),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))r=r/2|0;else break}return r}const cc=0,uc=1,dc=2,fc=3,pc=4,mc=5;class Ai{constructor(){this.data=0,this.blendMode=ft.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<cc)}set blend(t){!!(this.data&1<<cc)!==t&&(this.data^=1<<cc)}get offsets(){return!!(this.data&1<<uc)}set offsets(t){!!(this.data&1<<uc)!==t&&(this.data^=1<<uc)}get culling(){return!!(this.data&1<<dc)}set culling(t){!!(this.data&1<<dc)!==t&&(this.data^=1<<dc)}get depthTest(){return!!(this.data&1<<fc)}set depthTest(t){!!(this.data&1<<fc)!==t&&(this.data^=1<<fc)}get depthMask(){return!!(this.data&1<<mc)}set depthMask(t){!!(this.data&1<<mc)!==t&&(this.data^=1<<mc)}get clockwiseFrontFace(){return!!(this.data&1<<pc)}set clockwiseFrontFace(t){!!(this.data&1<<pc)!==t&&(this.data^=1<<pc)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==ft.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){const t=new Ai;return t.depthTest=!1,t.blend=!0,t}}Ai.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};const gc=[];function zp(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=gc.length-1;i>=0;--i){const s=gc[i];if(s.test&&s.test(r,e))return new s(r,t)}throw new Error("Unrecognized source type to auto-detect Resource")}class ni{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,i,s,n,o,a,h){if(arguments.length>8)throw new Error("max arguments reached");const{name:l,items:c}=this;this._aliasCount++;for(let u=0,d=c.length;u<d;u++)c[u][l](t,e,i,s,n,o,a,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=null,this._name=null}get empty(){return this.items.length===0}get name(){return this._name}}Object.defineProperties(ni.prototype,{dispatch:{value:ni.prototype.emit},run:{value:ni.prototype.emit}});class zn{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new ni("setRealSize"),this.onUpdate=new ni("update"),this.onError=new ni("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 ya extends zn{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===Se.UNPACK);const n=e.realWidth,o=e.realHeight;return i.width===n&&i.height===o?s.texSubImage2D(e.target,0,0,0,n,o,e.format,i.type,this.data):(i.width=n,i.height=o,s.texImage2D(e.target,0,i.internalFormat,n,o,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 U1={scaleMode:Yi.NEAREST,alphaMode:Se.NPM},yc=class Gn extends kn{constructor(t=null,e=null){super(),e=Object.assign({},Gn.defaultOptions,e);const{alphaMode:i,mipmap:s,anisotropicLevel:n,scaleMode:o,width:a,height:h,wrapMode:l,format:c,type:u,target:d,resolution:f,resourceOptions:m}=e;t&&!(t instanceof zn)&&(t=zp(t,m),t.internal=!0),this.resolution=f||q.RESOLUTION,this.width=Math.round((a||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=o,this.format=c,this.type=u,this.target=d,this.alphaMode=i,this.uid=zr(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=a>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=Up(this.realWidth)&&Up(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 _r[this.cacheId],delete Ii[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),Gn.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=q.STRICT_TEXTURE_CACHE){const s=typeof t=="string";let n=null;if(s)n=t;else{if(!t._pixiId){const a=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${a}_${zr()}`}n=t._pixiId}let o=_r[n];if(s&&i&&!o)throw new Error(`The cacheId "${n}" does not exist in BaseTextureCache.`);return o||(o=new Gn(t,e),o.cacheId=n,Gn.addToCache(o,n)),o}static fromBuffer(t,e,i,s){t=t||new Float32Array(e*i*4);const n=new ya(t,{width:e,height:i,...s==null?void 0:s.resourceOptions});let o,a;return t instanceof Float32Array?(o=K.RGBA,a=ht.FLOAT):t instanceof Int32Array?(o=K.RGBA_INTEGER,a=ht.INT):t instanceof Uint32Array?(o=K.RGBA_INTEGER,a=ht.UNSIGNED_INT):t instanceof Int16Array?(o=K.RGBA_INTEGER,a=ht.SHORT):t instanceof Uint16Array?(o=K.RGBA_INTEGER,a=ht.UNSIGNED_SHORT):t instanceof Int8Array?(o=K.RGBA,a=ht.BYTE):(o=K.RGBA,a=ht.UNSIGNED_BYTE),n.internal=!0,new Gn(n,Object.assign({},U1,{type:a,format:o},s))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),_r[e]&&_r[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),_r[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=_r[t];if(e){const i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete _r[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete _r[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};yc.defaultOptions={mipmap:vi.POW2,anisotropicLevel:0,scaleMode:Yi.LINEAR,wrapMode:_i.CLAMP,alphaMode:Se.UNPACK,target:Fs.TEXTURE_2D,format:K.RGBA,type:ht.UNSIGNED_BYTE},yc._globalBatch=0;let gt=yc;class bc{constructor(){this.texArray=null,this.blend=0,this.type=xi.TRIANGLES,this.start=0,this.size=0,this.data=null}}let X1=0;class Kt{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=X1++,this.disposeRunner=new ni("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?wi.ELEMENT_ARRAY_BUFFER:wi.ARRAY_BUFFER}get index(){return this.type===wi.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new Kt(t)}}class ba{constructor(t,e=0,i=!1,s=ht.FLOAT,n,o,a,h=1){this.buffer=t,this.size=e,this.normalized=i,this.type=s,this.stride=n,this.start=o,this.instance=a,this.divisor=h}destroy(){this.buffer=null}static from(t,e,i,s,n){return new ba(t,e,i,s,n)}}const Z1={Float32Array,Uint32Array,Int32Array,Uint8Array};function V1(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 o=null,a=0;for(let h=0;h<r.length;h++){const l=t[h],c=r[h],u=Wp(c);s[u]||(s[u]=new Z1[u](n)),o=s[u];for(let d=0;d<c.length;d++){const f=(d/l|0)*i+a,m=d%l;o[f+m]=c[d]}a+=l}return new Float32Array(n)}const jp={5126:4,5123:2,5121:1};let H1=0;const K1={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array};class vr{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=H1++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new ni("disposeGeometry"),this.refCount=0}addAttribute(t,e,i=0,s=!1,n,o,a,h=!1){if(!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof Kt||(e instanceof Array&&(e=new Float32Array(e)),e=new Kt(e));const l=t.split("|");if(l.length>1){for(let u=0;u<l.length;u++)this.addAttribute(l[u],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 ba(c,i,s,n,o,a,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 Kt||(t instanceof Array&&(t=new Uint16Array(t)),t=new Kt(t)),t.type=wi.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 Kt;let s;for(s in this.attributes){const n=this.attributes[s],o=this.buffers[n.buffer];t.push(o.data),e.push(n.size*jp[n.type]/4),n.buffer=0}for(i.data=V1(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 vr;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new Kt(this.buffers[e].data.slice(0));for(const e in this.attributes){const i=this.attributes[e];t.attributes[e]=new ba(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=wi.ELEMENT_ARRAY_BUFFER),t}static merge(t){const e=new vr,i=[],s=[],n=[];let o;for(let a=0;a<t.length;a++){o=t[a];for(let h=0;h<o.buffers.length;h++)s[h]=s[h]||0,s[h]+=o.buffers[h].data.length,n[h]=0}for(let a=0;a<o.buffers.length;a++)i[a]=new K1[Wp(o.buffers[a].data)](s[a]),e.buffers[a]=new Kt(i[a]);for(let a=0;a<t.length;a++){o=t[a];for(let h=0;h<o.buffers.length;h++)i[h].set(o.buffers[h].data,n[h]),n[h]+=o.buffers[h].data.length}if(e.attributes=o.attributes,o.indexBuffer){e.indexBuffer=e.buffers[o.buffers.indexOf(o.indexBuffer)],e.indexBuffer.type=wi.ELEMENT_ARRAY_BUFFER;let a=0,h=0,l=0,c=0;for(let u=0;u<o.buffers.length;u++)if(o.buffers[u]!==o.indexBuffer){c=u;break}for(const u in o.attributes){const d=o.attributes[u];(d.buffer|0)===c&&(h+=d.size*jp[d.type]/4)}for(let u=0;u<t.length;u++){const d=t[u].indexBuffer.data;for(let f=0;f<d.length;f++)e.indexBuffer.data[f+l]+=a;a+=t[u].buffers[c].data.length/h,l+=d.length}}return e}}class Jp extends vr{constructor(t=!1){super(),this._buffer=new Kt(null,t,!1),this._indexBuffer=new Kt(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,ht.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,ht.FLOAT).addAttribute("aColor",this._buffer,4,!0,ht.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,ht.FLOAT).addIndex(this._indexBuffer)}}const xa=Math.PI*2,Y1=180/Math.PI,z1=Math.PI/180;var le=(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))(le||{});class ut{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new ut(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}}ut.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};const _a=[new ut,new ut,new ut,new ut];class pt{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=le.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 pt(0,0,0,0)}clone(){return new pt(this.x,this.y,this.width,this.height)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}intersects(t,e){if(!e){const A=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=A)return!1;const R=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>R}const i=this.left,s=this.right,n=this.top,o=this.bottom;if(s<=i||o<=n)return!1;const a=_a[0].set(t.left,t.top),h=_a[1].set(t.left,t.bottom),l=_a[2].set(t.right,t.top),c=_a[3].set(t.right,t.bottom);if(l.x<=a.x||h.y<=a.y)return!1;const u=Math.sign(e.a*e.d-e.b*e.c);if(u===0||(e.apply(a,a),e.apply(h,h),e.apply(l,l),e.apply(c,c),Math.max(a.x,h.x,l.x,c.x)<=i||Math.min(a.x,h.x,l.x,c.x)>=s||Math.max(a.y,h.y,l.y,c.y)<=n||Math.min(a.y,h.y,l.y,c.y)>=o))return!1;const d=u*(h.y-a.y),f=u*(a.x-h.x),m=d*i+f*n,p=d*s+f*n,g=d*i+f*o,y=d*s+f*o;if(Math.max(m,p,g,y)<=d*a.x+f*a.y||Math.min(m,p,g,y)>=d*c.x+f*c.y)return!1;const _=u*(a.y-l.y),b=u*(l.x-a.x),v=_*i+b*n,w=_*s+b*n,C=_*i+b*o,E=_*s+b*o;return!(Math.max(v,w,C,E)<=_*a.x+b*a.y||Math.min(v,w,C,E)>=_*c.x+b*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}}pt.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class va{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.radius=i,this.type=le.CIRC}clone(){return new va(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 pt(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}va.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=le.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 pt(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 jr{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=le.POLY,this.closeStroke=!0}clone(){const t=this.points.slice(),e=new jr(t);return e.closeStroke=this.closeStroke,e}contains(t,e){let i=!1;const s=this.points.length/2;for(let n=0,o=s-1;n<s;o=n++){const a=this.points[n*2],h=this.points[n*2+1],l=this.points[o*2],c=this.points[o*2+1];h>e!=c>e&&t<(l-a)*((e-h)/(c-h))+a&&(i=!i)}return i}}jr.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((r,t)=>`${r}, ${t}`,"")}]`};class wa{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=le.RREC}clone(){return new wa(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 o=i*i;if(s*s+n*n<=o||(s=t-(this.x+this.width-i),s*s+n*n<=o)||(n=e-(this.y+this.height-i),s*s+n*n<=o)||(s=t-(this.x+i),s*s+n*n<=o))return!0}return!1}}wa.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};class Nt{constructor(t=1,e=0,i=0,s=1,n=0,o=0){this.array=null,this.a=t,this.b=e,this.c=i,this.d=s,this.tx=n,this.ty=o}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,i,s,n,o){return this.a=t,this.b=e,this.c=i,this.d=s,this.tx=n,this.ty=o,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,e){e=e||new ut;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 ut;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,o=this.tx;return this.a=s*e-this.b*i,this.b=s*i+this.b*e,this.c=n*e-this.d*i,this.d=n*i+this.d*e,this.tx=o*e-this.ty*i,this.ty=o*i+this.ty*e,this}append(t){const e=this.a,i=this.b,s=this.c,n=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*i+t.b*n,this.c=t.c*e+t.d*s,this.d=t.c*i+t.d*n,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*i+t.ty*n+this.ty,this}setTransform(t,e,i,s,n,o,a,h,l){return this.a=Math.cos(a+l)*n,this.b=Math.sin(a+l)*n,this.c=-Math.sin(a-h)*o,this.d=Math.cos(a-h)*o,this.tx=t-(i*this.a+s*this.c),this.ty=e-(i*this.b+s*this.d),this}prepend(t){const e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){const i=this.a,s=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){const e=this.a,i=this.b,s=this.c,n=this.d,o=t.pivot,a=-Math.atan2(-s,n),h=Math.atan2(i,e),l=Math.abs(a+h);return l<1e-5||Math.abs(xa-l)<1e-5?(t.rotation=h,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,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+(o.x*e+o.y*s),t.position.y=this.ty+(o.x*i+o.y*n),t}invert(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.tx,o=t*s-e*i;return this.a=s/o,this.b=-e/o,this.c=-i/o,this.d=t/o,this.tx=(i*this.ty-s*n)/o,this.ty=-(t*this.ty-e*n)/o,this}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 Nt;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 Nt}static get TEMP_MATRIX(){return new Nt}}Nt.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 Jr=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],$r=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Qr=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],qr=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],xc=[],$p=[],Sa=Math.sign;function j1(){for(let r=0;r<16;r++){const t=[];xc.push(t);for(let e=0;e<16;e++){const i=Sa(Jr[r]*Jr[e]+Qr[r]*$r[e]),s=Sa($r[r]*Jr[e]+qr[r]*$r[e]),n=Sa(Jr[r]*Qr[e]+Qr[r]*qr[e]),o=Sa($r[r]*Qr[e]+qr[r]*qr[e]);for(let a=0;a<16;a++)if(Jr[a]===i&&$r[a]===s&&Qr[a]===n&&qr[a]===o){t.push(a);break}}}for(let r=0;r<16;r++){const t=new Nt;t.set(Jr[r],$r[r],Qr[r],qr[r],0,0),$p.push(t)}}j1();const Bt={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=>Jr[r],uY:r=>$r[r],vX:r=>Qr[r],vY:r=>qr[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>xc[r][t],sub:(r,t)=>xc[r][Bt.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?Bt.S:Bt.N:Math.abs(t)*2<=Math.abs(r)?r>0?Bt.E:Bt.W:t>0?r>0?Bt.SE:Bt.SW:r>0?Bt.NE:Bt.NW,matrixAppendRotationInv:(r,t,e=0,i=0)=>{const s=$p[Bt.inv(t)];s.tx=e,s.ty=i,r.append(s)}};class tr{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 tr(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))}}tr.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};const _c=class{constructor(){this.worldTransform=new Nt,this.localTransform=new Nt,this.position=new tr(this.onChange,this,0,0),this.scale=new tr(this.onChange,this,1,1),this.pivot=new tr(this.onChange,this,0,0),this.skew=new tr(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())}};_c.IDENTITY=new _c;let vc=_c;vc.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 J1=`varying vec2 vTextureCoord;
|
|
10
|
+
Deprecated since v${r}`),console.warn(i))),Ip[t]=!0}function si(r){if(typeof r!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(r)}`)}function zn(r){return r.split("?")[0].split("#")[0]}function g1(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function y1(r,t,e){return r.replace(new RegExp(g1(t),"g"),e)}function b1(r,t){let e="",i=0,s=-1,n=0,o=-1;for(let a=0;a<=r.length;++a){if(a<r.length)o=r.charCodeAt(a);else{if(o===47)break;o=47}if(o===47){if(!(s===a-1||n===1))if(s!==a-1&&n===2){if(e.length<2||i!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){const 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=a,n=0;continue}}else if(e.length===2||e.length===1){e="",i=0,s=a,n=0;continue}}t&&(e.length>0?e+="/..":e="..",i=2)}else e.length>0?e+=`/${r.slice(s+1,a)}`:e=r.slice(s+1,a),i=a-s-1;s=a,n=0}else o===46&&n!==-1?++n:n=-1}return e}const Qt={toPosix(r){return y1(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){si(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(si(r),this.isDataUrl(r)||this.isBlobUrl(r))return r;const i=zn(this.toPosix(t??q.ADAPTER.getBaseUrl())),s=zn(this.toPosix(e??this.rootname(i)));return r=this.toPosix(r),r.startsWith("/")?Qt.join(s,r.slice(1)):this.isAbsolute(r)?r:this.join(i,r)},normalize(r){if(si(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=b1(r,!1),r.length>0&&i&&(r+="/"),e?`/${r}`:t+r},isAbsolute(r){return si(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(si(i),i.length>0)if(t===void 0)t=i;else{const s=r[e-1]??"";this.extname(s)?t+=`/../${i}`:t+=`/${i}`}}return t===void 0?".":this.normalize(t)},dirname(r){if(si(r),r.length===0)return".";r=this.toPosix(r);let t=r.charCodeAt(0);const e=t===47;let i=-1,s=!0;const n=this.getProtocol(r),o=r;r=r.slice(n.length);for(let a=r.length-1;a>=1;--a)if(t=r.charCodeAt(a),t===47){if(!s){i=a;break}}else s=!1;return i===-1?e?"/":this.isUrl(o)?n+r:n:e&&i===1?"//":n+r.slice(0,i)},rootname(r){si(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){si(r),t&&si(t),r=zn(this.toPosix(r));let e=0,i=-1,s=!0,n;if(t!==void 0&&t.length>0&&t.length<=r.length){if(t.length===r.length&&t===r)return"";let o=t.length-1,a=-1;for(n=r.length-1;n>=0;--n){const h=r.charCodeAt(n);if(h===47){if(!s){e=n+1;break}}else a===-1&&(s=!1,a=n+1),o>=0&&(h===t.charCodeAt(o)?--o===-1&&(i=n):(o=-1,i=a))}return e===i?i=a:i===-1&&(i=r.length),r.slice(e,i)}for(n=r.length-1;n>=0;--n)if(r.charCodeAt(n)===47){if(!s){e=n+1;break}}else i===-1&&(s=!1,i=n+1);return i===-1?"":r.slice(e,i)},extname(r){si(r),r=zn(this.toPosix(r));let t=-1,e=0,i=-1,s=!0,n=0;for(let o=r.length-1;o>=0;--o){const a=r.charCodeAt(o);if(a===47){if(!s){e=o+1;break}continue}i===-1&&(s=!1,i=o+1),a===46?t===-1?t=o:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||i===-1||n===0||n===1&&t===i-1&&t===e+1?"":r.slice(t,i)},parse(r){si(r);const t={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return t;r=zn(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,o=0,a=-1,h=!0,l=r.length-1,c=0;for(;l>=s;--l){if(e=r.charCodeAt(l),e===47){if(!h){o=l+1;break}continue}a===-1&&(h=!1,a=l+1),e===46?n===-1?n=l:c!==1&&(c=1):n!==-1&&(c=-1)}return n===-1||a===-1||c===0||c===1&&n===a-1&&n===o+1?a!==-1&&(o===0&&i?t.base=t.name=r.slice(1,a):t.base=t.name=r.slice(o,a)):(o===0&&i?(t.name=r.slice(1,n),t.base=r.slice(1,a)):(t.name=r.slice(o,n),t.base=r.slice(o,a)),t.ext=r.slice(n,a)),t.dir=this.dirname(r),t},sep:"/",delimiter:":"};let tc;async function x1(){return tc??(tc=(async()=>{var n;const r=document.createElement("canvas").getContext("webgl");if(!r)return Se.UNPACK;const t=await new Promise(o=>{const a=document.createElement("video");a.onloadeddata=()=>o(a),a.onerror=()=>o(null),a.autoplay=!1,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load()});if(!t)return Se.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]?Se.PMA:Se.UNPACK})()),tc}let ec;function _1(){return typeof ec>"u"&&(ec=function(){var t;const r={stencil:!0,failIfMajorPerformanceCaveat:q.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!q.ADAPTER.getWebGLRenderingContext())return!1;const e=q.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}}()),ec}var v1={grad:.9,turn:360,rad:360/(2*Math.PI)},Qi=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},se=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*r)/e+0},Ye=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),r>e?e:r>t?r:t},Ap=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},Rp=function(r){return{r:Ye(r.r,0,255),g:Ye(r.g,0,255),b:Ye(r.b,0,255),a:Ye(r.a)}},ic=function(r){return{r:se(r.r),g:se(r.g),b:se(r.b),a:se(r.a,3)}},T1=/^#([0-9a-f]{3,8})$/i,ma=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},Mp=function(r){var t=r.r,e=r.g,i=r.b,s=r.a,n=Math.max(t,e,i),o=n-Math.min(t,e,i),a=o?n===t?(e-i)/o:n===e?2+(i-t)/o:4+(t-e)/o:0;return{h:60*(a<0?a+6:a),s:n?o/n*100:0,v:n/255*100,a:s}},Lp=function(r){var t=r.h,e=r.s,i=r.v,s=r.a;t=t/360*6,e/=100,i/=100;var n=Math.floor(t),o=i*(1-e),a=i*(1-(t-n)*e),h=i*(1-(1-t+n)*e),l=n%6;return{r:255*[i,a,o,o,h,i][l],g:255*[h,i,i,a,o,o][l],b:255*[o,o,h,i,i,a][l],a:s}},Pp=function(r){return{h:Ap(r.h),s:Ye(r.s,0,100),l:Ye(r.l,0,100),a:Ye(r.a)}},Gp=function(r){return{h:se(r.h),s:se(r.s),l:se(r.l),a:se(r.a,3)}},Fp=function(r){return Lp((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},jn=function(r){return{h:(t=Mp(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},w1=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,S1=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,E1=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,C1=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,rc={string:[[function(r){var t=T1.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?se(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?se(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=E1.exec(r)||C1.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:Rp({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=w1.exec(r)||S1.exec(r);if(!t)return null;var e,i,s=Pp({h:(e=t[1],i=t[2],i===void 0&&(i="deg"),Number(e)*(v1[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Fp(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 Qi(t)&&Qi(e)&&Qi(i)?Rp({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(!Qi(t)||!Qi(e)||!Qi(i))return null;var o=Pp({h:Number(t),s:Number(e),l:Number(i),a:Number(n)});return Fp(o)},"hsl"],[function(r){var t=r.h,e=r.s,i=r.v,s=r.a,n=s===void 0?1:s;if(!Qi(t)||!Qi(e)||!Qi(i))return null;var o=function(a){return{h:Ap(a.h),s:Ye(a.s,0,100),v:Ye(a.v,0,100),a:Ye(a.a)}}({h:Number(t),s:Number(e),v:Number(i),a:Number(n)});return Lp(o)},"hsv"]]},Np=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]},I1=function(r){return typeof r=="string"?Np(r.trim(),rc.string):typeof r=="object"&&r!==null?Np(r,rc.object):[null,void 0]},sc=function(r,t){var e=jn(r);return{h:e.h,s:Ye(e.s+100*t,0,100),l:e.l,a:e.a}},nc=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},Dp=function(r,t){var e=jn(r);return{h:e.h,s:e.s,l:Ye(e.l+100*t,0,100),a:e.a}},oc=function(){function r(t){this.parsed=I1(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 se(nc(this.rgba),2)},r.prototype.isDark=function(){return nc(this.rgba)<.5},r.prototype.isLight=function(){return nc(this.rgba)>=.5},r.prototype.toHex=function(){return t=ic(this.rgba),e=t.r,i=t.g,s=t.b,o=(n=t.a)<1?ma(se(255*n)):"","#"+ma(e)+ma(i)+ma(s)+o;var t,e,i,s,n,o},r.prototype.toRgb=function(){return ic(this.rgba)},r.prototype.toRgbString=function(){return t=ic(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 Gp(jn(this.rgba))},r.prototype.toHslString=function(){return t=Gp(jn(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=Mp(this.rgba),{h:se(t.h),s:se(t.s),v:se(t.v),a:se(t.a,3)};var t},r.prototype.invert=function(){return Ci({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),Ci(sc(this.rgba,t))},r.prototype.desaturate=function(t){return t===void 0&&(t=.1),Ci(sc(this.rgba,-t))},r.prototype.grayscale=function(){return Ci(sc(this.rgba,-1))},r.prototype.lighten=function(t){return t===void 0&&(t=.1),Ci(Dp(this.rgba,t))},r.prototype.darken=function(t){return t===void 0&&(t=.1),Ci(Dp(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"?Ci({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):se(this.rgba.a,3);var e},r.prototype.hue=function(t){var e=jn(this.rgba);return typeof t=="number"?Ci({h:t,s:e.s,l:e.l,a:e.a}):se(e.h)},r.prototype.isEqual=function(t){return this.toHex()===Ci(t).toHex()},r}(),Ci=function(r){return r instanceof oc?r:new oc(r)},kp=[],A1=function(r){r.forEach(function(t){kp.indexOf(t)<0&&(t(oc,rc),kp.push(t))})};function R1(r,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},i={};for(var s in e)i[e[s]]=s;var n={};r.prototype.toName=function(o){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,h,l=i[this.toHex()];if(l)return l;if(o!=null&&o.closest){var c=this.toRgb(),u=1/0,d="black";if(!n.length)for(var f in e)n[f]=new r(e[f]).toRgb();for(var m in e){var p=(a=c,h=n[m],Math.pow(a.r-h.r,2)+Math.pow(a.g-h.g,2)+Math.pow(a.b-h.b,2));p<u&&(u=p,d=m)}return d}},t.string.push([function(o){var a=o.toLowerCase(),h=a==="transparent"?"#0000":e[a];return h?new r(h).toRgb():null},"name"])}A1([R1]);const Ks=class fl{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 fl)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(o=>t[o]===e[o])}return t===e}toRgba(){const[t,e,i,s]=this._components;return{r:t,g:e,b:i,a:s}}toRgb(){const[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){const[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){const[e,i,s]=this._components;return 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]=fl.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 o=t;e=(o>>16&255)/255,i=(o>>8&255)/255,s=(o&255)/255,n=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,i,s,n=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,i,s,n=255]=t,e/=255,i/=255,s/=255,n/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const a=fl.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}const o=Ci(t);o.isValid()&&({r:e,g:i,b:s,a:n}=o.rgba,e/=255,i/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,this._components[2]=s,this._components[3]=n,this.refreshInt();else throw new Error(`Unable to convert color ${t}`)}refreshInt(){this._clamp(this._components);const[t,e,i]=this._components;this._int=(t*255<<16)+(e*255<<8)+(i*255|0)}_clamp(t,e=0,i=1){return typeof t=="number"?Math.min(Math.max(t,e),i):(t.forEach((s,n)=>{t[n]=Math.min(Math.max(s,e),i)}),t)}};Ks.shared=new Ks,Ks.temp=new Ks,Ks.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let Ft=Ks;function M1(r){return Tt("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),Ft.shared.setValue(r).toHex()}function L1(r){return Tt("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),Ft.shared.setValue(r).toNumber()}function P1(){const r=[],t=[];for(let i=0;i<32;i++)r[i]=i,t[i]=i;r[ft.NORMAL_NPM]=ft.NORMAL,r[ft.ADD_NPM]=ft.ADD,r[ft.SCREEN_NPM]=ft.SCREEN,t[ft.NORMAL]=ft.NORMAL_NPM,t[ft.ADD]=ft.ADD_NPM,t[ft.SCREEN]=ft.SCREEN_NPM;const e=[];return e.push(t),e.push(r),e}const Op=P1();function Bp(r,t){return Op[t?1:0][r]}function G1(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 Wp(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 ga(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 Up(r){return!(r&r-1)&&!!r}function Xp(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 Ys(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 xr(r){return r===0?0:r<0?-1:1}let F1=0;function zr(){return++F1}const ac=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}};ac.EMPTY=new ac(0,0,0,0);let Zp=ac;const Vp={},Ii=Object.create(null),_r=Object.create(null);class N1{constructor(t,e,i){this._canvas=q.ADAPTER.createCanvas(),this._context=this._canvas.getContext("2d"),this.resolution=i||q.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 Hp(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 Kp(r,t,e,i,s){const n=4*t;for(let o=i,a=i*n+4*e;o<=s;++o,a+=n)if(r[a+3]!==0)return!1;return!0}function D1(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,o=0,a=t-1,h=e-1;for(;o<e&&Hp(s,t,o);)++o;if(o===e)return Zp.EMPTY;for(;Hp(s,t,h);)--h;for(;Kp(s,t,n,o,h);)++n;for(;Kp(s,t,a,o,h);)--a;return++a,++h,new Zp(n,o,a,h)}function k1(r){const t=D1(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 O1(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 qi(r,t=1){var i;const e=(i=q.RETINA_PREFIX)==null?void 0:i.exec(r);return e?parseFloat(e[1]):t}var J=(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))(J||{});const hc=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},Yp=(r,t)=>hc(r).priority??t,it={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(hc).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(hc).forEach(t=>{t.type.forEach(e=>{const i=this._addHandlers,s=this._queue;i[e]?i[e](t):(s[e]=s[e]||[],s[e].push(t))})}),this},handle(r,t,e){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]&&(n[r].forEach(o=>t(o)),delete n[r]),this},handleByMap(r,t){return this.handle(r,e=>{t[e.name]=e.ref},e=>{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)=>Yp(n,e)-Yp(s,e)))},i=>{const s=t.indexOf(i.ref);s!==-1&&t.splice(s,1)})}};class lc{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 B1=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
11
|
+
`);function W1(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 U1(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=B1.replace(/%forloop%/gi,W1(r));if(t.shaderSource(e,i),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))r=r/2|0;else break}return r}const cc=0,uc=1,dc=2,fc=3,pc=4,mc=5;class Ai{constructor(){this.data=0,this.blendMode=ft.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<cc)}set blend(t){!!(this.data&1<<cc)!==t&&(this.data^=1<<cc)}get offsets(){return!!(this.data&1<<uc)}set offsets(t){!!(this.data&1<<uc)!==t&&(this.data^=1<<uc)}get culling(){return!!(this.data&1<<dc)}set culling(t){!!(this.data&1<<dc)!==t&&(this.data^=1<<dc)}get depthTest(){return!!(this.data&1<<fc)}set depthTest(t){!!(this.data&1<<fc)!==t&&(this.data^=1<<fc)}get depthMask(){return!!(this.data&1<<mc)}set depthMask(t){!!(this.data&1<<mc)!==t&&(this.data^=1<<mc)}get clockwiseFrontFace(){return!!(this.data&1<<pc)}set clockwiseFrontFace(t){!!(this.data&1<<pc)!==t&&(this.data^=1<<pc)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==ft.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){const t=new Ai;return t.depthTest=!1,t.blend=!0,t}}Ai.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};const gc=[];function zp(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=gc.length-1;i>=0;--i){const s=gc[i];if(s.test&&s.test(r,e))return new s(r,t)}throw new Error("Unrecognized source type to auto-detect Resource")}class ni{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,i,s,n,o,a,h){if(arguments.length>8)throw new Error("max arguments reached");const{name:l,items:c}=this;this._aliasCount++;for(let u=0,d=c.length;u<d;u++)c[u][l](t,e,i,s,n,o,a,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=null,this._name=null}get empty(){return this.items.length===0}get name(){return this._name}}Object.defineProperties(ni.prototype,{dispatch:{value:ni.prototype.emit},run:{value:ni.prototype.emit}});class Jn{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new ni("setRealSize"),this.onUpdate=new ni("update"),this.onError=new ni("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 ya extends Jn{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===Se.UNPACK);const n=e.realWidth,o=e.realHeight;return i.width===n&&i.height===o?s.texSubImage2D(e.target,0,0,0,n,o,e.format,i.type,this.data):(i.width=n,i.height=o,s.texImage2D(e.target,0,i.internalFormat,n,o,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 X1={scaleMode:Yi.NEAREST,alphaMode:Se.NPM},yc=class Nn extends Bn{constructor(t=null,e=null){super(),e=Object.assign({},Nn.defaultOptions,e);const{alphaMode:i,mipmap:s,anisotropicLevel:n,scaleMode:o,width:a,height:h,wrapMode:l,format:c,type:u,target:d,resolution:f,resourceOptions:m}=e;t&&!(t instanceof Jn)&&(t=zp(t,m),t.internal=!0),this.resolution=f||q.RESOLUTION,this.width=Math.round((a||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=o,this.format=c,this.type=u,this.target=d,this.alphaMode=i,this.uid=zr(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=a>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=Up(this.realWidth)&&Up(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 _r[this.cacheId],delete Ii[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),Nn.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=q.STRICT_TEXTURE_CACHE){const s=typeof t=="string";let n=null;if(s)n=t;else{if(!t._pixiId){const a=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${a}_${zr()}`}n=t._pixiId}let o=_r[n];if(s&&i&&!o)throw new Error(`The cacheId "${n}" does not exist in BaseTextureCache.`);return o||(o=new Nn(t,e),o.cacheId=n,Nn.addToCache(o,n)),o}static fromBuffer(t,e,i,s){t=t||new Float32Array(e*i*4);const n=new ya(t,{width:e,height:i,...s==null?void 0:s.resourceOptions});let o,a;return t instanceof Float32Array?(o=K.RGBA,a=ht.FLOAT):t instanceof Int32Array?(o=K.RGBA_INTEGER,a=ht.INT):t instanceof Uint32Array?(o=K.RGBA_INTEGER,a=ht.UNSIGNED_INT):t instanceof Int16Array?(o=K.RGBA_INTEGER,a=ht.SHORT):t instanceof Uint16Array?(o=K.RGBA_INTEGER,a=ht.UNSIGNED_SHORT):t instanceof Int8Array?(o=K.RGBA,a=ht.BYTE):(o=K.RGBA,a=ht.UNSIGNED_BYTE),n.internal=!0,new Nn(n,Object.assign({},X1,{type:a,format:o},s))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),_r[e]&&_r[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),_r[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=_r[t];if(e){const i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete _r[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete _r[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};yc.defaultOptions={mipmap:vi.POW2,anisotropicLevel:0,scaleMode:Yi.LINEAR,wrapMode:_i.CLAMP,alphaMode:Se.UNPACK,target:Fs.TEXTURE_2D,format:K.RGBA,type:ht.UNSIGNED_BYTE},yc._globalBatch=0;let gt=yc;class bc{constructor(){this.texArray=null,this.blend=0,this.type=xi.TRIANGLES,this.start=0,this.size=0,this.data=null}}let Z1=0;class Kt{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=Z1++,this.disposeRunner=new ni("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?wi.ELEMENT_ARRAY_BUFFER:wi.ARRAY_BUFFER}get index(){return this.type===wi.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new Kt(t)}}class ba{constructor(t,e=0,i=!1,s=ht.FLOAT,n,o,a,h=1){this.buffer=t,this.size=e,this.normalized=i,this.type=s,this.stride=n,this.start=o,this.instance=a,this.divisor=h}destroy(){this.buffer=null}static from(t,e,i,s,n){return new ba(t,e,i,s,n)}}const V1={Float32Array,Uint32Array,Int32Array,Uint8Array};function H1(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 o=null,a=0;for(let h=0;h<r.length;h++){const l=t[h],c=r[h],u=Wp(c);s[u]||(s[u]=new V1[u](n)),o=s[u];for(let d=0;d<c.length;d++){const f=(d/l|0)*i+a,m=d%l;o[f+m]=c[d]}a+=l}return new Float32Array(n)}const jp={5126:4,5123:2,5121:1};let K1=0;const Y1={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array};class vr{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=K1++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new ni("disposeGeometry"),this.refCount=0}addAttribute(t,e,i=0,s=!1,n,o,a,h=!1){if(!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof Kt||(e instanceof Array&&(e=new Float32Array(e)),e=new Kt(e));const l=t.split("|");if(l.length>1){for(let u=0;u<l.length;u++)this.addAttribute(l[u],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 ba(c,i,s,n,o,a,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 Kt||(t instanceof Array&&(t=new Uint16Array(t)),t=new Kt(t)),t.type=wi.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 Kt;let s;for(s in this.attributes){const n=this.attributes[s],o=this.buffers[n.buffer];t.push(o.data),e.push(n.size*jp[n.type]/4),n.buffer=0}for(i.data=H1(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 vr;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new Kt(this.buffers[e].data.slice(0));for(const e in this.attributes){const i=this.attributes[e];t.attributes[e]=new ba(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=wi.ELEMENT_ARRAY_BUFFER),t}static merge(t){const e=new vr,i=[],s=[],n=[];let o;for(let a=0;a<t.length;a++){o=t[a];for(let h=0;h<o.buffers.length;h++)s[h]=s[h]||0,s[h]+=o.buffers[h].data.length,n[h]=0}for(let a=0;a<o.buffers.length;a++)i[a]=new Y1[Wp(o.buffers[a].data)](s[a]),e.buffers[a]=new Kt(i[a]);for(let a=0;a<t.length;a++){o=t[a];for(let h=0;h<o.buffers.length;h++)i[h].set(o.buffers[h].data,n[h]),n[h]+=o.buffers[h].data.length}if(e.attributes=o.attributes,o.indexBuffer){e.indexBuffer=e.buffers[o.buffers.indexOf(o.indexBuffer)],e.indexBuffer.type=wi.ELEMENT_ARRAY_BUFFER;let a=0,h=0,l=0,c=0;for(let u=0;u<o.buffers.length;u++)if(o.buffers[u]!==o.indexBuffer){c=u;break}for(const u in o.attributes){const d=o.attributes[u];(d.buffer|0)===c&&(h+=d.size*jp[d.type]/4)}for(let u=0;u<t.length;u++){const d=t[u].indexBuffer.data;for(let f=0;f<d.length;f++)e.indexBuffer.data[f+l]+=a;a+=t[u].buffers[c].data.length/h,l+=d.length}}return e}}class Jp extends vr{constructor(t=!1){super(),this._buffer=new Kt(null,t,!1),this._indexBuffer=new Kt(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,ht.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,ht.FLOAT).addAttribute("aColor",this._buffer,4,!0,ht.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,ht.FLOAT).addIndex(this._indexBuffer)}}const xa=Math.PI*2,z1=180/Math.PI,j1=Math.PI/180;var ce=(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))(ce||{});class ut{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new ut(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}}ut.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};const _a=[new ut,new ut,new ut,new ut];class pt{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=ce.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 pt(0,0,0,0)}clone(){return new pt(this.x,this.y,this.width,this.height)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}intersects(t,e){if(!e){const A=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=A)return!1;const R=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>R}const i=this.left,s=this.right,n=this.top,o=this.bottom;if(s<=i||o<=n)return!1;const a=_a[0].set(t.left,t.top),h=_a[1].set(t.left,t.bottom),l=_a[2].set(t.right,t.top),c=_a[3].set(t.right,t.bottom);if(l.x<=a.x||h.y<=a.y)return!1;const u=Math.sign(e.a*e.d-e.b*e.c);if(u===0||(e.apply(a,a),e.apply(h,h),e.apply(l,l),e.apply(c,c),Math.max(a.x,h.x,l.x,c.x)<=i||Math.min(a.x,h.x,l.x,c.x)>=s||Math.max(a.y,h.y,l.y,c.y)<=n||Math.min(a.y,h.y,l.y,c.y)>=o))return!1;const d=u*(h.y-a.y),f=u*(a.x-h.x),m=d*i+f*n,p=d*s+f*n,g=d*i+f*o,y=d*s+f*o;if(Math.max(m,p,g,y)<=d*a.x+f*a.y||Math.min(m,p,g,y)>=d*c.x+f*c.y)return!1;const _=u*(a.y-l.y),b=u*(l.x-a.x),v=_*i+b*n,w=_*s+b*n,E=_*i+b*o,C=_*s+b*o;return!(Math.max(v,w,E,C)<=_*a.x+b*a.y||Math.min(v,w,E,C)>=_*c.x+b*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}}pt.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class va{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.radius=i,this.type=ce.CIRC}clone(){return new va(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 pt(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}va.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=ce.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 pt(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 jr{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=ce.POLY,this.closeStroke=!0}clone(){const t=this.points.slice(),e=new jr(t);return e.closeStroke=this.closeStroke,e}contains(t,e){let i=!1;const s=this.points.length/2;for(let n=0,o=s-1;n<s;o=n++){const a=this.points[n*2],h=this.points[n*2+1],l=this.points[o*2],c=this.points[o*2+1];h>e!=c>e&&t<(l-a)*((e-h)/(c-h))+a&&(i=!i)}return i}}jr.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((r,t)=>`${r}, ${t}`,"")}]`};class wa{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=ce.RREC}clone(){return new wa(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 o=i*i;if(s*s+n*n<=o||(s=t-(this.x+this.width-i),s*s+n*n<=o)||(n=e-(this.y+this.height-i),s*s+n*n<=o)||(s=t-(this.x+i),s*s+n*n<=o))return!0}return!1}}wa.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};class Nt{constructor(t=1,e=0,i=0,s=1,n=0,o=0){this.array=null,this.a=t,this.b=e,this.c=i,this.d=s,this.tx=n,this.ty=o}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,i,s,n,o){return this.a=t,this.b=e,this.c=i,this.d=s,this.tx=n,this.ty=o,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,e){e=e||new ut;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 ut;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,o=this.tx;return this.a=s*e-this.b*i,this.b=s*i+this.b*e,this.c=n*e-this.d*i,this.d=n*i+this.d*e,this.tx=o*e-this.ty*i,this.ty=o*i+this.ty*e,this}append(t){const e=this.a,i=this.b,s=this.c,n=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*i+t.b*n,this.c=t.c*e+t.d*s,this.d=t.c*i+t.d*n,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*i+t.ty*n+this.ty,this}setTransform(t,e,i,s,n,o,a,h,l){return this.a=Math.cos(a+l)*n,this.b=Math.sin(a+l)*n,this.c=-Math.sin(a-h)*o,this.d=Math.cos(a-h)*o,this.tx=t-(i*this.a+s*this.c),this.ty=e-(i*this.b+s*this.d),this}prepend(t){const e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){const i=this.a,s=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){const e=this.a,i=this.b,s=this.c,n=this.d,o=t.pivot,a=-Math.atan2(-s,n),h=Math.atan2(i,e),l=Math.abs(a+h);return l<1e-5||Math.abs(xa-l)<1e-5?(t.rotation=h,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,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+(o.x*e+o.y*s),t.position.y=this.ty+(o.x*i+o.y*n),t}invert(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.tx,o=t*s-e*i;return this.a=s/o,this.b=-e/o,this.c=-i/o,this.d=t/o,this.tx=(i*this.ty-s*n)/o,this.ty=-(t*this.ty-e*n)/o,this}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 Nt;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 Nt}static get TEMP_MATRIX(){return new Nt}}Nt.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 Jr=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],$r=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Qr=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],qr=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],xc=[],$p=[],Sa=Math.sign;function J1(){for(let r=0;r<16;r++){const t=[];xc.push(t);for(let e=0;e<16;e++){const i=Sa(Jr[r]*Jr[e]+Qr[r]*$r[e]),s=Sa($r[r]*Jr[e]+qr[r]*$r[e]),n=Sa(Jr[r]*Qr[e]+Qr[r]*qr[e]),o=Sa($r[r]*Qr[e]+qr[r]*qr[e]);for(let a=0;a<16;a++)if(Jr[a]===i&&$r[a]===s&&Qr[a]===n&&qr[a]===o){t.push(a);break}}}for(let r=0;r<16;r++){const t=new Nt;t.set(Jr[r],$r[r],Qr[r],qr[r],0,0),$p.push(t)}}J1();const Wt={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=>Jr[r],uY:r=>$r[r],vX:r=>Qr[r],vY:r=>qr[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>xc[r][t],sub:(r,t)=>xc[r][Wt.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?Wt.S:Wt.N:Math.abs(t)*2<=Math.abs(r)?r>0?Wt.E:Wt.W:t>0?r>0?Wt.SE:Wt.SW:r>0?Wt.NE:Wt.NW,matrixAppendRotationInv:(r,t,e=0,i=0)=>{const s=$p[Wt.inv(t)];s.tx=e,s.ty=i,r.append(s)}};class tr{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 tr(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))}}tr.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};const _c=class{constructor(){this.worldTransform=new Nt,this.localTransform=new Nt,this.position=new tr(this.onChange,this,0,0),this.scale=new tr(this.onChange,this,1,1),this.pivot=new tr(this.onChange,this,0,0),this.skew=new tr(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())}};_c.IDENTITY=new _c;let vc=_c;vc.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 $1=`varying vec2 vTextureCoord;
|
|
13
13
|
|
|
14
14
|
uniform sampler2D uSampler;
|
|
15
15
|
|
|
16
16
|
void main(void){
|
|
17
17
|
gl_FragColor *= texture2D(uSampler, vTextureCoord);
|
|
18
|
-
}
|
|
18
|
+
}`,Q1=`attribute vec2 aVertexPosition;
|
|
19
19
|
attribute vec2 aTextureCoord;
|
|
20
20
|
|
|
21
21
|
uniform mat3 projectionMatrix;
|
|
@@ -146,7 +146,7 @@ void main(void){
|
|
|
146
146
|
cv[3] = v[3];
|
|
147
147
|
|
|
148
148
|
gl.uniform4f(ud["${r}"].location, v[0], v[1], v[2], v[3])
|
|
149
|
-
}`}],
|
|
149
|
+
}`}],q1={float:`
|
|
150
150
|
if (cv !== v)
|
|
151
151
|
{
|
|
152
152
|
cu.value = v;
|
|
@@ -282,7 +282,7 @@ void main(void){
|
|
|
282
282
|
cu.value = v;
|
|
283
283
|
|
|
284
284
|
gl.uniform1i(location, v);
|
|
285
|
-
}`},
|
|
285
|
+
}`},tv={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 ev(r,t){var i;const e=[`
|
|
286
286
|
var v = null;
|
|
287
287
|
var cv = null;
|
|
288
288
|
var cu = null;
|
|
@@ -292,18 +292,18 @@ void main(void){
|
|
|
292
292
|
renderer.shader.syncUniformBufferGroup(uv.${s}, '${s}');
|
|
293
293
|
`):e.push(`
|
|
294
294
|
renderer.shader.syncUniformGroup(uv.${s}, syncData);
|
|
295
|
-
`));continue}const o=r.uniforms[s];let a=!1;for(let h=0;h<zs.length;h++)if(zs[h].test(n,o)){e.push(zs[h].code(s,o)),a=!0;break}if(!a){const h=(n.size===1&&!n.isArray?
|
|
295
|
+
`));continue}const o=r.uniforms[s];let a=!1;for(let h=0;h<zs.length;h++)if(zs[h].test(n,o)){e.push(zs[h].code(s,o)),a=!0;break}if(!a){const h=(n.size===1&&!n.isArray?q1:tv)[n.type].replace("location",`ud["${s}"].location`);e.push(`
|
|
296
296
|
cu = ud["${s}"];
|
|
297
297
|
cv = cu.value;
|
|
298
298
|
v = uv["${s}"];
|
|
299
299
|
${h};`)}}return new Function("ud","uv","renderer","syncData",e.join(`
|
|
300
|
-
`))}const tm={};let js=tm;function
|
|
300
|
+
`))}const tm={};let js=tm;function iv(){if(js===tm||js!=null&&js.isContextLost()){const r=q.ADAPTER.createCanvas();let t;q.PREFER_ENV>=Zr.WEBGL2&&(t=r.getContext("webgl2",{})),t||(t=r.getContext("webgl",{})||r.getContext("experimental-webgl",{}),t?t.getExtension("WEBGL_draw_buffers"):t=null),js=t}return js}let Ea;function rv(){if(!Ea){Ea=Ke.MEDIUM;const r=iv();if(r&&r.getShaderPrecisionFormat){const t=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);t&&(Ea=t.precision?Ke.HIGH:Ke.MEDIUM)}}return Ea}function em(r,t){const e=r.getShaderSource(t).split(`
|
|
301
301
|
`).map((l,c)=>`${c}: ${l}`),i=r.getShaderInfoLog(t),s=i.split(`
|
|
302
302
|
`),n={},o=s.map(l=>parseFloat(l.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(l=>l&&!n[l]?(n[l]=!0,!0):!1),a=[""];o.forEach(l=>{e[l-1]=`%c${e[l-1]}%c`,a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});const h=e.join(`
|
|
303
|
-
`);a[0]=h,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function
|
|
304
|
-
${r}`}else if(e!==Ke.HIGH&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}let
|
|
303
|
+
`);a[0]=h,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function sv(r,t,e,i){r.getProgramParameter(t,r.LINK_STATUS)||(r.getShaderParameter(e,r.COMPILE_STATUS)||em(r,e),r.getShaderParameter(i,r.COMPILE_STATUS)||em(r,i),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(t)))}const nv={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 im(r){return nv[r]}let Ca=null;const rm={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 sm(r,t){if(!Ca){const e=Object.keys(rm);Ca={};for(let i=0;i<e.length;++i){const s=e[i];Ca[r[s]]=rm[s]}}return Ca[t]}function nm(r,t,e){if(r.substring(0,9)!=="precision"){let i=t;return t===Ke.HIGH&&e!==Ke.HIGH&&(i=Ke.MEDIUM),`precision ${i} float;
|
|
304
|
+
${r}`}else if(e!==Ke.HIGH&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}let $n;function ov(){if(typeof $n=="boolean")return $n;try{$n=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{$n=!1}return $n}let av=0;const Ia={},wc=class Dn{constructor(t,e,i="pixi-shader",s={}){this.extra={},this.id=av++,this.vertexSrc=t||Dn.defaultVertexSrc,this.fragmentSrc=e||Dn.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,"-"),Ia[i]?(Ia[i]++,i+=`-${Ia[i]}`):Ia[i]=1,this.vertexSrc=`#define SHADER_NAME ${i}
|
|
305
305
|
${this.vertexSrc}`,this.fragmentSrc=`#define SHADER_NAME ${i}
|
|
306
|
-
${this.fragmentSrc}`,this.vertexSrc=nm(this.vertexSrc,
|
|
306
|
+
${this.fragmentSrc}`,this.vertexSrc=nm(this.vertexSrc,Dn.defaultVertexPrecision,Ke.HIGH),this.fragmentSrc=nm(this.fragmentSrc,Dn.defaultFragmentPrecision,rv())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return Q1}static get defaultFragmentSrc(){return $1}static from(t,e,i){const s=t+e;let n=Vp[s];return n||(Vp[s]=n=new Dn(t,e,i)),n}};wc.defaultVertexPrecision=Ke.HIGH,wc.defaultFragmentPrecision=ji.apple.device?Ke.HIGH:Ke.MEDIUM;let er=wc,hv=0;class oi{constructor(t,e,i){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=hv++,this.static=!!e,this.ubo=!!i,t instanceof Kt?(this.buffer=t,this.buffer.type=wi.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=t,this.ubo&&(this.buffer=new Kt(new Float32Array(1)),this.buffer.type=wi.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 oi(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 oi(t,e,i)}static uboFrom(t,e){return new oi(t,e??!0,!0)}}class Ri{constructor(t,e){this.uniformBindCount=0,this.program=t,e?e instanceof oi?this.uniformGroup=e:this.uniformGroup=new oi(e):this.uniformGroup=new oi({}),this.disposeRunner=new ni("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=er.from(t,e);return new Ri(s,i)}}class lv{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]=oi.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 er(this.vertexSrc,s)}const e={tint:new Float32Array([1,1,1,1]),translationMatrix:new Nt,default:this.defaultGroupCache[t]};return new Ri(this.programCache[t],e)}generateSampleSrc(t){let e="";e+=`
|
|
307
307
|
`,e+=`
|
|
308
308
|
`;for(let i=0;i<t;i++)i>0&&(e+=`
|
|
309
309
|
else `),i<t-1&&(e+=`if(vTextureId < ${i}.5)`),e+=`
|
|
@@ -311,7 +311,7 @@ else `),i<t-1&&(e+=`if(vTextureId < ${i}.5)`),e+=`
|
|
|
311
311
|
color = texture2D(uSamplers[${i}], vTextureCoord);`,e+=`
|
|
312
312
|
}`;return e+=`
|
|
313
313
|
`,e+=`
|
|
314
|
-
`,e}}class Sc{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
|
|
314
|
+
`,e}}class Sc{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 cv(){return!ji.apple.device}function uv(r){let t=!0;const e=q.ADAPTER.getNavigator();if(ji.tablet||ji.phone){if(ji.apple.device){const i=e.userAgent.match(/OS (\d+)_(\d+)?/);i&&parseInt(i[1],10)<11&&(t=!1)}if(ji.android.device){const i=e.userAgent.match(/Android\s([0-9.]*)/);i&&parseInt(i[1],10)<7&&(t=!1)}}return t?r:4}class Aa{constructor(t){this.renderer=t}flush(){}destroy(){this.renderer=null}start(){}stop(){this.flush()}render(t){}}var dv=`varying vec2 vTextureCoord;
|
|
315
315
|
varying vec4 vColor;
|
|
316
316
|
varying float vTextureId;
|
|
317
317
|
uniform sampler2D uSamplers[%count%];
|
|
@@ -321,7 +321,7 @@ void main(void){
|
|
|
321
321
|
%forloop%
|
|
322
322
|
gl_FragColor = color * vColor;
|
|
323
323
|
}
|
|
324
|
-
`,
|
|
324
|
+
`,fv=`precision highp float;
|
|
325
325
|
attribute vec2 aVertexPosition;
|
|
326
326
|
attribute vec2 aTextureCoord;
|
|
327
327
|
attribute vec4 aColor;
|
|
@@ -342,14 +342,14 @@ void main(void){
|
|
|
342
342
|
vTextureId = aTextureId;
|
|
343
343
|
vColor = aColor * tint;
|
|
344
344
|
}
|
|
345
|
-
`;const
|
|
345
|
+
`;const Qn=class bi extends Aa{constructor(t){super(t),this.setShaderGenerator(),this.geometryClass=Jp,this.vertexSize=6,this.state=Ai.for2d(),this.size=bi.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??uv(32),this._defaultMaxTextures}static set defaultMaxTextures(t){this._defaultMaxTextures=t}static get canUploadSameBuffer(){return this._canUploadSameBuffer=this._canUploadSameBuffer??cv(),this._canUploadSameBuffer}static set canUploadSameBuffer(t){this._canUploadSameBuffer=t}get MAX_TEXTURES(){return Tt("7.1.0","BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures"),this.maxTextures}static get defaultVertexSrc(){return fv}static get defaultFragmentTemplate(){return dv}setShaderGenerator({vertex:t=bi.defaultVertexSrc,fragment:e=bi.defaultFragmentTemplate}={}){this.shaderGenerator=new lv(t,e)}contextChange(){const t=this.renderer.gl;q.PREFER_ENV===Zr.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),bi.defaultMaxTextures),this.maxTextures=U1(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}=bi,i=this.size/4,s=Math.floor(i/this.maxTextures)+1;for(;t.length<i;)t.push(new bc);for(;e.length<s;)e.push(new Sc);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=bi._textureArrayPool,s=this.renderer.batch,n=this._tempBoundTextures,o=this.renderer.textureGC.count;let a=++gt._globalBatch,h=0,l=i[0],c=0;s.copyBoundTextures(n,e);for(let u=0;u<this._bufferSize;++u){const d=t[u];t[u]=null,d._batchEnabled!==a&&(l.count>=e&&(s.boundArray(l,n,a,e),this.buildDrawCalls(l,c,u),c=u,l=i[++h],++a),d._batchEnabled=a,d.touched=o,l.elements[l.count++]=d)}l.count>0&&(s.boundArray(l,n,a,e),this.buildDrawCalls(l,c,this._bufferSize),++h,++a);for(let u=0;u<n.length;u++)n[u]=null;gt._globalBatch=a}buildDrawCalls(t,e,i){const{_bufferedElements:s,_attributeBuffer:n,_indexBuffer:o,vertexSize:a}=this,h=bi._drawCallPool;let l=this._dcIndex,c=this._aIndex,u=this._iIndex,d=h[l];d.start=this._iIndex,d.texArray=t;for(let f=e;f<i;++f){const m=s[f],p=m._texture.baseTexture,g=Op[p.alphaMode?1:0][m.blendMode];s[f]=null,e<f&&d.blend!==g&&(d.size=u-d.start,e=f,d=h[++l],d.texArray=t,d.start=u),this.packInterleavedGeometry(m,n,o,c,u),c+=m.vertexData.length/2*a,u+=m.indices.length,d.blend=g}e<i&&(d.size=u-d.start,++l),this._dcIndex=l,this._aIndex=c,this._iIndex=u}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;bi.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=bi._drawCallPool;let n=null;for(let o=0;o<t;o++){const{texArray:a,type:h,size:l,start:c,blend:u}=s[o];n!==a&&(n=a,this.bindAndClearTexArray(a)),this.state.blendMode=u,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),bi.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=ga(Math.ceil(t/8)),i=Xp(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 lc(s*this.vertexSize*4)),n}getIndexBuffer(t){const e=ga(Math.ceil(t/12)),i=Xp(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:o,float32View:a}=e,h=s/this.vertexSize,l=t.uvs,c=t.indices,u=t.vertexData,d=t._texture.baseTexture._batchLocation,f=Math.min(t.worldAlpha,1),m=Ft.shared.setValue(t._tintRGB).toPremultiplied(f,t._texture.baseTexture.alphaMode>0);for(let p=0;p<u.length;p+=2)a[s++]=u[p],a[s++]=u[p+1],a[s++]=l[p],a[s++]=l[p+1],o[s++]=m,a[s++]=d;for(let p=0;p<c.length;p++)i[n++]=h+c[p]}};Qn.defaultBatchSize=4096,Qn.extension={name:"batch",type:J.RendererPlugin},Qn._drawCallPool=[],Qn._textureArrayPool=[];let ts=Qn;it.add(ts);var pv=`varying vec2 vTextureCoord;
|
|
346
346
|
|
|
347
347
|
uniform sampler2D uSampler;
|
|
348
348
|
|
|
349
349
|
void main(void){
|
|
350
350
|
gl_FragColor = texture2D(uSampler, vTextureCoord);
|
|
351
351
|
}
|
|
352
|
-
`,
|
|
352
|
+
`,mv=`attribute vec2 aVertexPosition;
|
|
353
353
|
|
|
354
354
|
uniform mat3 projectionMatrix;
|
|
355
355
|
|
|
@@ -375,7 +375,7 @@ void main(void)
|
|
|
375
375
|
gl_Position = filterVertexPosition();
|
|
376
376
|
vTextureCoord = filterTextureCoord();
|
|
377
377
|
}
|
|
378
|
-
`;const Cc=class jo extends Ri{constructor(t,e,i){const s=er.from(t||jo.defaultVertexSrc,e||jo.defaultFragmentSrc);super(s,i),this.padding=0,this.resolution=jo.defaultResolution,this.multisample=jo.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new Ai}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 pv}static get defaultFragmentSrc(){return fv}};Cc.defaultResolution=1,Cc.defaultMultisample=jt.NONE;let _e=Cc;class Ra{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new Ft(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(){}}Ra.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},Ra.extension={type:[J.RendererSystem,J.CanvasRendererSystem],name:"background"},it.add(Ra);class om{constructor(t){this.renderer=t,this.emptyRenderer=new Aa(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:o,count:a}=t;let h=0;for(let l=0;l<a;l++){const c=n[l],u=c._batchLocation;if(u>=0&&u<s&&e[u]===c){o[l]=u;continue}for(;h<s;){const d=e[h];if(d&&d._batchEnabled===i&&d._batchLocation===h){h++;continue}o[l]=h,c._batchLocation=h,e[h]=c;break}}}destroy(){this.renderer=null}}om.extension={type:J.RendererSystem,name:"batch"},it.add(om);let am=0;class Ma{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=am++}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=am++,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(q.PREFER_ENV>=Zr.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")};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")}}Ma.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},Ma.extension={type:J.RendererSystem,name:"context"},it.add(Ma);class Ec{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 ni("disposeFramebuffer"),this.multisample=jt.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new gt(null,{scaleMode:Yi.NEAREST,resolution:1,mipmap:vi.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new gt(null,{scaleMode:Yi.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:vi.OFF,format:K.DEPTH_COMPONENT,type:ht.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 hm extends gt{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=jt.NONE),super(null,t),this.mipmap=vi.OFF,this.valid=!0,this._clear=new Ft([0,0,0,0]),this.framebuffer=new Ec(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 Tr extends zn{constructor(t){const e=t,i=e.naturalWidth||e.videoWidth||e.width,s=e.naturalHeight||e.videoHeight||e.height;super(i,s),this.source=t,this.noSubImage=!1}static crossOrigin(t,e,i){i===void 0&&!e.startsWith("data:")?t.crossOrigin=k1(e):i!==!1&&(t.crossOrigin=typeof i=="string"?i:"anonymous")}upload(t,e,i,s){const n=t.gl,o=e.realWidth,a=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===Se.UNPACK),!this.noSubImage&&e.target===n.TEXTURE_2D&&i.width===o&&i.height===a?n.texSubImage2D(n.TEXTURE_2D,0,0,0,e.format,i.type,s):(i.width=o,i.height=a,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 lm extends Tr{constructor(t,e){if(e=e||{},typeof t=="string"){const i=new Image;Tr.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??q.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=o=>{i(o),this.onError.emit(o)})}),this._load)}process(){const t=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);const e=globalThis.createImageBitmap,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===Se.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 o in n){const a=n[o];if(a!==i&&a.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 Ic{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(t,e,i){const s=e.width,n=e.height;if(i){const o=t.width/2/s,a=t.height/2/n,h=t.x/s+o,l=t.y/n+a;i=Bt.add(i,Bt.NW),this.x0=h+o*Bt.uX(i),this.y0=l+a*Bt.uY(i),i=Bt.add(i,2),this.x1=h+o*Bt.uX(i),this.y1=l+a*Bt.uY(i),i=Bt.add(i,2),this.x2=h+o*Bt.uX(i),this.y2=l+a*Bt.uY(i),i=Bt.add(i,2),this.x3=h+o*Bt.uX(i),this.y3=l+a*Bt.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}}Ic.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 cm=new Ic;function La(r){r.destroy=function(){},r.on=function(){},r.once=function(){},r.emit=function(){}}class rt extends kn{constructor(t,e,i,s,n,o,a){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new pt(0,0,1,1)),t instanceof rt&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=s,this.valid=!1,this.destroyed=!1,this._uvs=cm,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=o?new ut(o.x,o.y):new ut(0,0),this.defaultBorders=a,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&&Ii[e.url]&&rt.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,rt.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 rt(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===cm&&(this._uvs=new Ic),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},i=q.STRICT_TEXTURE_CACHE){const s=typeof t=="string";let n=null;if(s)n=t;else if(t instanceof gt){if(!t.cacheId){const a=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t.cacheId=`${a}-${zr()}`,gt.addToCache(t,t.cacheId)}n=t.cacheId}else{if(!t._pixiId){const a=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${a}_${zr()}`}n=t._pixiId}let o=Ii[n];if(s&&i&&!o)throw new Error(`The cacheId "${n}" does not exist in TextureCache.`);return!o&&!(t instanceof gt)?(e.resolution||(e.resolution=qi(t)),o=new rt(new gt(t,e)),o.baseTexture.cacheId=n,gt.addToCache(o.baseTexture,n),rt.addToCache(o,n)):!o&&t instanceof gt&&(o=new rt(t),rt.addToCache(o,n)),o}static fromURL(t,e){const i=Object.assign({autoLoad:!1},e==null?void 0:e.resourceOptions),s=rt.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 rt(gt.fromBuffer(t,e,i,s))}static fromLoader(t,e,i,s){const n=new gt(t,Object.assign({scaleMode:gt.defaultOptions.scaleMode,resolution:qi(e)},s)),{resource:o}=n;o instanceof lm&&(o.url=e);const a=new rt(n);return i||(i=e),gt.addToCache(a.baseTexture,i),rt.addToCache(a,i),i!==e&&(gt.addToCache(a.baseTexture,e),rt.addToCache(a,e)),a.baseTexture.valid?Promise.resolve(a):new Promise(h=>{a.baseTexture.once("loaded",()=>h(a))})}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),Ii[e]&&Ii[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),Ii[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=Ii[t];if(e){const i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete Ii[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)Ii[t.textureCacheIds[e]]===t&&delete Ii[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,o=e+s>this.baseTexture.width,a=i+n>this.baseTexture.height;if(o||a){const h=o&&a?"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 rt._EMPTY||(rt._EMPTY=new rt(new gt),La(rt._EMPTY),La(rt._EMPTY.baseTexture)),rt._EMPTY}static get WHITE(){if(!rt._WHITE){const t=q.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),rt._WHITE=new rt(gt.from(t)),La(rt._WHITE),La(rt._WHITE.baseTexture)}return rt._WHITE}}class es extends rt{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,o=Math.round(e*s)/s;this.valid=n>0&&o>0,this._frame.width=this.orig.width=n,this._frame.height=this.orig.height=o,i&&this.baseTexture.resize(n,o),this.updateUvs()}setResolution(t){const{baseTexture:e}=this;e.resolution!==t&&(e.setResolution(t),this.resize(e.width,e.height,!1))}static create(t){return new es(new hm(t))}}class um{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,i=jt.NONE){const s=new hm(Object.assign({width:t,height:e,resolution:1,multisample:i},this.textureOptions));return new es(s)}getOptimalTexture(t,e,i=1,s=jt.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=ga(t),e=ga(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 o=this.texturePool[n].pop();return o||(o=this.createTexture(t,e,s)),o.filterPoolKey=n,o.setResolution(i),o}getFilterTexture(t,e,i){const s=this.getOptimalTexture(t.width,t.height,e||t.resolution,i||jt.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}}}um.SCREEN_KEY=-1;class mv extends vr{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}}class dm extends vr{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 Kt(this.vertices),this.uvBuffer=new Kt(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 gv{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=jt.NONE,this.sourceFrame=new pt,this.destinationFrame=new pt,this.bindingSourceFrame=new pt,this.bindingDestinationFrame=new pt,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}}const Pa=[new ut,new ut,new ut,new ut],Ac=new Nt;class fm{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new um,this.statePool=[],this.quad=new mv,this.quadUv=new dm,this.tempRect=new pt,this.activeState={},this.globalUniforms=new oi({outputFrame:new pt,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 gv,o=i.renderTexture;let a,h;if(o.current){const g=o.current;a=g.resolution,h=g.multisample}else a=i.resolution,h=i.multisample;let l=e[0].resolution||a,c=e[0].multisample??h,u=e[0].padding,d=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||a),c=Math.min(c,y.multisample??h),u=this.useMaxPadding?Math.max(u,y.padding):u+y.padding,d=d&&y.autoFit,f=f||(y.legacy??!0)}s.length===1&&(this.defaultFilterStack[0].renderTexture=o.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(u);const m=this.tempRect.copyFrom(o.sourceFrame);i.projection.transform&&this.transformAABB(Ac.copyFrom(i.projection.transform).invert(),m),d?(n.sourceFrame.fit(m),(n.sourceFrame.width<=0||n.sourceFrame.height<=0)&&(n.sourceFrame.width=0,n.sourceFrame.height=0)):n.sourceFrame.intersects(m)||(n.sourceFrame.width=0,n.sourceFrame.height=0),this.roundFrame(n.sourceFrame,o.current?o.current.resolution:i.resolution,o.sourceFrame,o.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 p=this.tempRect;p.x=0,p.y=0,p.width=n.sourceFrame.width,p.height=n.sourceFrame.height,n.renderTexture.filterFrame=n.sourceFrame,n.bindingSourceFrame.copyFrom(o.sourceFrame),n.bindingDestinationFrame.copyFrom(o.destinationFrame),n.transform=i.projection.transform,i.projection.transform=null,o.bind(n.renderTexture,n.sourceFrame,p),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,o=s.inputPixel,a=s.inputClamp;if(n[0]=e.destinationFrame.width,n[1]=e.destinationFrame.height,n[2]=1/n[0],n[3]=1/n[1],o[0]=Math.round(n[0]*e.resolution),o[1]=Math.round(n[1]*e.resolution),o[2]=1/o[0],o[3]=1/o[1],a[0]=.5*o[2],a[1]=.5*o[3],a[2]=e.sourceFrame.width*n[2]-.5*o[2],a[3]=e.sourceFrame.height*n[3]-.5*o[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,Ti.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 u=0;for(u=0;u<i.length-1;++u){u===1&&e.multisample>1&&(c=this.getOptimalFilterTexture(l.width,l.height,e.resolution),c.filterFrame=l.filterFrame),i[u].apply(this,l,c,Ti.CLEAR,e);const d=l;l=c,c=d}i[u].apply(this,l,h.renderTexture,Ti.BLEND,e),u>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(l),this.returnFilterTexture(c)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=Ti.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 o=this.tempRect;o.x=0,o.y=0,o.width=t.filterFrame.width,o.height=t.filterFrame.height,i.bind(t,t.filterFrame,o)}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===Ti.CLEAR||e===Ti.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(xi.TRIANGLES)):(n.geometry.bind(this.quad),n.geometry.draw(xi.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){const{sourceFrame:i,destinationFrame:s}=this.activeState,{orig:n}=e._texture,o=t.set(s.width,0,0,s.height,i.x,i.y),a=e.worldTransform.copyTo(Nt.TEMP_MATRIX);return a.invert(),o.prepend(a),o.scale(1/n.width,1/n.height),o.translate(e.anchor.x,e.anchor.y),o}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(t,e,i=1,s=jt.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||jt.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=Pa[0],s=Pa[1],n=Pa[2],o=Pa[3];i.set(e.left,e.top),s.set(e.left,e.bottom),n.set(e.right,e.top),o.set(e.right,e.bottom),t.apply(i,i),t.apply(s,s),t.apply(n,n),t.apply(o,o);const a=Math.min(i.x,s.x,n.x,o.x),h=Math.min(i.y,s.y,n.y,o.y),l=Math.max(i.x,s.x,n.x,o.x),c=Math.max(i.y,s.y,n.y,o.y);e.x=a,e.y=h,e.width=l-a,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:o,b:a,c:h,d:l}=n;if((Math.abs(a)>1e-4||Math.abs(h)>1e-4)&&(Math.abs(o)>1e-4||Math.abs(l)>1e-4))return}n=n?Ac.copyFrom(n):Ac.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)}}}fm.extension={type:J.RendererSystem,name:"filter"},it.add(fm);class yv{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=jt.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const bv=new pt;class pm{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Ec(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 pt,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;q.PREFER_ENV===Zr.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 o=0;o<t.colorTextures.length;o++){const a=t.colorTextures[o];this.renderer.texture.unbind(a.parentTextureArray||a)}if(t.depthTexture&&this.renderer.texture.unbind(t.depthTexture),e){const o=e.width>>i,a=e.height>>i,h=o/e.width;this.setViewport(e.x*h,e.y*h,o,a)}else{const o=t.width>>i,a=t.height>>i;this.setViewport(0,0,o,a)}}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=xl.COLOR|xl.DEPTH){const{gl:o}=this;o.clearColor(t,e,i,s),o.clear(n)}initFramebuffer(t){const{gl:e}=this,i=new yv(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 o;this.renderer.context.webGLVersion===1?o=e.DEPTH_STENCIL:t.depth&&t.stencil?o=e.DEPTH24_STENCIL8:t.depth?o=e.DEPTH_COMPONENT24:o=e.STENCIL_INDEX8,i.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,o,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,o,t.width,t.height)}const s=t.colorTextures;let n=s.length;e.drawBuffers||(n=Math.min(n,1));for(let o=0;o<n;o++){const a=s[o],h=a.parentTextureArray||a;this.renderer.texture.bind(h,0),o===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 o=n.length;i.drawBuffers||(o=Math.min(o,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 a=[];for(let h=0;h<o;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),a.push(i.COLOR_ATTACHMENT0+h))}if(a.length>1&&i.drawBuffers(a),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=jt.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=jt.NONE),i}blit(t,e,i){const{current:s,renderer:n,gl:o,CONTEXT_UID:a}=this;if(n.context.webGLVersion!==2||!s)return;const h=s.glFramebuffers[a];if(!h)return;if(!t){if(!h.msaaBuffer)return;const c=s.colorTextures[0];if(!c)return;h.blitFramebuffer||(h.blitFramebuffer=new Ec(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=bv,e.width=s.width,e.height=s.height),i||(i=e);const l=e.width===i.width&&e.height===i.height;this.bind(t),o.bindFramebuffer(o.READ_FRAMEBUFFER,h.framebuffer),o.blitFramebuffer(e.left,e.top,e.right,e.bottom,i.left,i.top,i.right,i.bottom,o.COLOR_BUFFER_BIT,l?o.NEAREST:o.LINEAR),o.bindFramebuffer(o.READ_FRAMEBUFFER,t.glFramebuffers[this.CONTEXT_UID].framebuffer)}disposeFramebuffer(t,e){const 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,o=e.stencil=n.createRenderbuffer();n.bindRenderbuffer(n.RENDERBUFFER,o);let a,h;this.renderer.context.webGLVersion===1?(a=n.DEPTH_STENCIL_ATTACHMENT,h=n.DEPTH_STENCIL):t.depth?(a=n.DEPTH_STENCIL_ATTACHMENT,h=n.DEPTH24_STENCIL8):(a=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,a,n.RENDERBUFFER,o)}reset(){this.current=this.unknownFramebuffer,this.viewport=new pt}destroy(){this.renderer=null}}pm.extension={type:J.RendererSystem,name:"framebuffer"},it.add(pm);const Rc={5126:4,5123:2,5121:1};class mm{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;q.PREFER_ENV===Zr.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,o,a,h)=>i.drawElementsInstancedANGLE(s,n,o,a,h),t.drawArraysInstanced=(s,n,o,a)=>i.drawArraysInstancedANGLE(s,n,o,a)):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 o=s[e.program.id]||this.initGeometryVao(t,e,n);this._activeGeometry=t,this._activeVao!==o&&(this._activeVao=o,this.hasVao?i.bindVertexArray(o):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 o in i)s[o]&&n.push(o,s[o].location);return n.join("-")}initGeometryVao(t,e,i=!0){const s=this.gl,n=this.CONTEXT_UID,o=this.renderer.buffer,a=e.program;a.glPrograms[n]||this.renderer.shader.generateProgram(e),this.checkCompatibility(t,a);const h=this.getSignature(t,a),l=t.glVertexArrayObjects[this.CONTEXT_UID];let c=l[h];if(c)return l[a.id]=c,c;const u=t.buffers,d=t.attributes,f={},m={};for(const p in u)f[p]=0,m[p]=0;for(const p in d)!d[p].size&&a.attributeData[p]?d[p].size=a.attributeData[p].size:d[p].size||console.warn(`PIXI Geometry attribute '${p}' size cannot be determined (likely the bound shader does not have the attribute)`),f[d[p].buffer]+=d[p].size*Rc[d[p].type];for(const p in d){const g=d[p],y=g.size;g.stride===void 0&&(f[g.buffer]===y*Rc[g.type]?g.stride=0:g.stride=f[g.buffer]),g.start===void 0&&(g.start=m[g.buffer],m[g.buffer]+=y*Rc[g.type])}c=s.createVertexArray(),s.bindVertexArray(c);for(let p=0;p<u.length;p++){const g=u[p];o.bind(g),i&&g._glBuffers[n].refCount++}return this.activateVao(t,a),l[a.id]=c,l[h]=c,s.bindVertexArray(null),o.unbind(wi.ARRAY_BUFFER),c}disposeGeometry(t,e){var a;if(!this.managedGeometries[t.id])return;delete this.managedGeometries[t.id];const i=t.glVertexArrayObjects[this.CONTEXT_UID],s=this.gl,n=t.buffers,o=(a=this.renderer)==null?void 0:a.buffer;if(t.disposeRunner.remove(this),!!i){if(o)for(let h=0;h<n.length;h++){const l=n[h]._glBuffers[this.CONTEXT_UID];l&&(l.refCount--,l.refCount===0&&!e&&o.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,o=t.buffers,a=t.attributes;t.indexBuffer&&n.bind(t.indexBuffer);let h=null;for(const l in a){const c=a[l],u=o[c.buffer],d=u._glBuffers[s];if(e.attributeData[l]){h!==d&&(n.bind(u),h=d);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,o=this._activeGeometry;if(o.indexBuffer){const a=o.indexBuffer.data.BYTES_PER_ELEMENT,h=a===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;a===2||a===4&&this.canUseUInt32ElementIndex?o.instanced?n.drawElementsInstanced(t,e||o.indexBuffer.data.length,h,(i||0)*a,s||1):n.drawElements(t,e||o.indexBuffer.data.length,h,(i||0)*a):console.warn("unsupported index buffer type: uint32")}else o.instanced?n.drawArraysInstanced(t,i,e||o.getSize(),s||1):n.drawArrays(t,i,e||o.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}}mm.extension={type:J.RendererSystem,name:"geometry"},it.add(mm);const gm=new Nt;class ym{constructor(t,e){this._texture=t,this.mapCoord=new Nt,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],o=t[s+1];e[s]=n*i.a+o*i.c+i.tx,e[s+1]=n*i.b+o*i.d+i.ty}return e}update(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&&(gm.set(s.width/n.width,0,0,s.height/n.height,-n.x/n.width,-n.y/n.height),this.mapCoord.append(gm));const o=e.baseTexture,a=this.uClampFrame,h=this.clampMargin/o.resolution,l=this.clampOffset;return a[0]=(e._frame.x+h+l)/o.width,a[1]=(e._frame.y+h+l)/o.height,a[2]=(e._frame.x+e._frame.width-h+l)/o.width,a[3]=(e._frame.y+e._frame.height-h+l)/o.height,this.uClampOffset[0]=l/o.realWidth,this.uClampOffset[1]=l/o.realHeight,this.isSimple=e._frame.width===o.width&&e._frame.height===o.height&&e.rotate===0,!0}}var xv=`varying vec2 vMaskCoord;
|
|
378
|
+
`;const Ec=class jo extends Ri{constructor(t,e,i){const s=er.from(t||jo.defaultVertexSrc,e||jo.defaultFragmentSrc);super(s,i),this.padding=0,this.resolution=jo.defaultResolution,this.multisample=jo.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new Ai}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 mv}static get defaultFragmentSrc(){return pv}};Ec.defaultResolution=1,Ec.defaultMultisample=jt.NONE;let _e=Ec;class Ra{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new Ft(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(){}}Ra.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},Ra.extension={type:[J.RendererSystem,J.CanvasRendererSystem],name:"background"},it.add(Ra);class om{constructor(t){this.renderer=t,this.emptyRenderer=new Aa(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:o,count:a}=t;let h=0;for(let l=0;l<a;l++){const c=n[l],u=c._batchLocation;if(u>=0&&u<s&&e[u]===c){o[l]=u;continue}for(;h<s;){const d=e[h];if(d&&d._batchEnabled===i&&d._batchLocation===h){h++;continue}o[l]=h,c._batchLocation=h,e[h]=c;break}}}destroy(){this.renderer=null}}om.extension={type:J.RendererSystem,name:"batch"},it.add(om);let am=0;class Ma{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=am++}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=am++,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(q.PREFER_ENV>=Zr.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")};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")}}Ma.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},Ma.extension={type:J.RendererSystem,name:"context"},it.add(Ma);class Cc{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 ni("disposeFramebuffer"),this.multisample=jt.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new gt(null,{scaleMode:Yi.NEAREST,resolution:1,mipmap:vi.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new gt(null,{scaleMode:Yi.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:vi.OFF,format:K.DEPTH_COMPONENT,type:ht.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 hm extends gt{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=jt.NONE),super(null,t),this.mipmap=vi.OFF,this.valid=!0,this._clear=new Ft([0,0,0,0]),this.framebuffer=new Cc(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 Tr extends Jn{constructor(t){const e=t,i=e.naturalWidth||e.videoWidth||e.width,s=e.naturalHeight||e.videoHeight||e.height;super(i,s),this.source=t,this.noSubImage=!1}static crossOrigin(t,e,i){i===void 0&&!e.startsWith("data:")?t.crossOrigin=O1(e):i!==!1&&(t.crossOrigin=typeof i=="string"?i:"anonymous")}upload(t,e,i,s){const n=t.gl,o=e.realWidth,a=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===Se.UNPACK),!this.noSubImage&&e.target===n.TEXTURE_2D&&i.width===o&&i.height===a?n.texSubImage2D(n.TEXTURE_2D,0,0,0,e.format,i.type,s):(i.width=o,i.height=a,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 lm extends Tr{constructor(t,e){if(e=e||{},typeof t=="string"){const i=new Image;Tr.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??q.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=o=>{i(o),this.onError.emit(o)})}),this._load)}process(){const t=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);const e=globalThis.createImageBitmap,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===Se.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 o in n){const a=n[o];if(a!==i&&a.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 Ic{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(t,e,i){const s=e.width,n=e.height;if(i){const o=t.width/2/s,a=t.height/2/n,h=t.x/s+o,l=t.y/n+a;i=Wt.add(i,Wt.NW),this.x0=h+o*Wt.uX(i),this.y0=l+a*Wt.uY(i),i=Wt.add(i,2),this.x1=h+o*Wt.uX(i),this.y1=l+a*Wt.uY(i),i=Wt.add(i,2),this.x2=h+o*Wt.uX(i),this.y2=l+a*Wt.uY(i),i=Wt.add(i,2),this.x3=h+o*Wt.uX(i),this.y3=l+a*Wt.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}}Ic.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 cm=new Ic;function La(r){r.destroy=function(){},r.on=function(){},r.once=function(){},r.emit=function(){}}class rt extends Bn{constructor(t,e,i,s,n,o,a){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new pt(0,0,1,1)),t instanceof rt&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=s,this.valid=!1,this.destroyed=!1,this._uvs=cm,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=o?new ut(o.x,o.y):new ut(0,0),this.defaultBorders=a,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&&Ii[e.url]&&rt.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,rt.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 rt(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===cm&&(this._uvs=new Ic),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},i=q.STRICT_TEXTURE_CACHE){const s=typeof t=="string";let n=null;if(s)n=t;else if(t instanceof gt){if(!t.cacheId){const a=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t.cacheId=`${a}-${zr()}`,gt.addToCache(t,t.cacheId)}n=t.cacheId}else{if(!t._pixiId){const a=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${a}_${zr()}`}n=t._pixiId}let o=Ii[n];if(s&&i&&!o)throw new Error(`The cacheId "${n}" does not exist in TextureCache.`);return!o&&!(t instanceof gt)?(e.resolution||(e.resolution=qi(t)),o=new rt(new gt(t,e)),o.baseTexture.cacheId=n,gt.addToCache(o.baseTexture,n),rt.addToCache(o,n)):!o&&t instanceof gt&&(o=new rt(t),rt.addToCache(o,n)),o}static fromURL(t,e){const i=Object.assign({autoLoad:!1},e==null?void 0:e.resourceOptions),s=rt.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 rt(gt.fromBuffer(t,e,i,s))}static fromLoader(t,e,i,s){const n=new gt(t,Object.assign({scaleMode:gt.defaultOptions.scaleMode,resolution:qi(e)},s)),{resource:o}=n;o instanceof lm&&(o.url=e);const a=new rt(n);return i||(i=e),gt.addToCache(a.baseTexture,i),rt.addToCache(a,i),i!==e&&(gt.addToCache(a.baseTexture,e),rt.addToCache(a,e)),a.baseTexture.valid?Promise.resolve(a):new Promise(h=>{a.baseTexture.once("loaded",()=>h(a))})}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),Ii[e]&&Ii[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),Ii[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=Ii[t];if(e){const i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete Ii[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)Ii[t.textureCacheIds[e]]===t&&delete Ii[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,o=e+s>this.baseTexture.width,a=i+n>this.baseTexture.height;if(o||a){const h=o&&a?"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 rt._EMPTY||(rt._EMPTY=new rt(new gt),La(rt._EMPTY),La(rt._EMPTY.baseTexture)),rt._EMPTY}static get WHITE(){if(!rt._WHITE){const t=q.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),rt._WHITE=new rt(gt.from(t)),La(rt._WHITE),La(rt._WHITE.baseTexture)}return rt._WHITE}}class es extends rt{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,o=Math.round(e*s)/s;this.valid=n>0&&o>0,this._frame.width=this.orig.width=n,this._frame.height=this.orig.height=o,i&&this.baseTexture.resize(n,o),this.updateUvs()}setResolution(t){const{baseTexture:e}=this;e.resolution!==t&&(e.setResolution(t),this.resize(e.width,e.height,!1))}static create(t){return new es(new hm(t))}}class um{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,i=jt.NONE){const s=new hm(Object.assign({width:t,height:e,resolution:1,multisample:i},this.textureOptions));return new es(s)}getOptimalTexture(t,e,i=1,s=jt.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=ga(t),e=ga(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 o=this.texturePool[n].pop();return o||(o=this.createTexture(t,e,s)),o.filterPoolKey=n,o.setResolution(i),o}getFilterTexture(t,e,i){const s=this.getOptimalTexture(t.width,t.height,e||t.resolution,i||jt.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}}}um.SCREEN_KEY=-1;class gv extends vr{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}}class dm extends vr{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 Kt(this.vertices),this.uvBuffer=new Kt(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 yv{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=jt.NONE,this.sourceFrame=new pt,this.destinationFrame=new pt,this.bindingSourceFrame=new pt,this.bindingDestinationFrame=new pt,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}}const Pa=[new ut,new ut,new ut,new ut],Ac=new Nt;class fm{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new um,this.statePool=[],this.quad=new gv,this.quadUv=new dm,this.tempRect=new pt,this.activeState={},this.globalUniforms=new oi({outputFrame:new pt,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 yv,o=i.renderTexture;let a,h;if(o.current){const g=o.current;a=g.resolution,h=g.multisample}else a=i.resolution,h=i.multisample;let l=e[0].resolution||a,c=e[0].multisample??h,u=e[0].padding,d=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||a),c=Math.min(c,y.multisample??h),u=this.useMaxPadding?Math.max(u,y.padding):u+y.padding,d=d&&y.autoFit,f=f||(y.legacy??!0)}s.length===1&&(this.defaultFilterStack[0].renderTexture=o.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(u);const m=this.tempRect.copyFrom(o.sourceFrame);i.projection.transform&&this.transformAABB(Ac.copyFrom(i.projection.transform).invert(),m),d?(n.sourceFrame.fit(m),(n.sourceFrame.width<=0||n.sourceFrame.height<=0)&&(n.sourceFrame.width=0,n.sourceFrame.height=0)):n.sourceFrame.intersects(m)||(n.sourceFrame.width=0,n.sourceFrame.height=0),this.roundFrame(n.sourceFrame,o.current?o.current.resolution:i.resolution,o.sourceFrame,o.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 p=this.tempRect;p.x=0,p.y=0,p.width=n.sourceFrame.width,p.height=n.sourceFrame.height,n.renderTexture.filterFrame=n.sourceFrame,n.bindingSourceFrame.copyFrom(o.sourceFrame),n.bindingDestinationFrame.copyFrom(o.destinationFrame),n.transform=i.projection.transform,i.projection.transform=null,o.bind(n.renderTexture,n.sourceFrame,p),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,o=s.inputPixel,a=s.inputClamp;if(n[0]=e.destinationFrame.width,n[1]=e.destinationFrame.height,n[2]=1/n[0],n[3]=1/n[1],o[0]=Math.round(n[0]*e.resolution),o[1]=Math.round(n[1]*e.resolution),o[2]=1/o[0],o[3]=1/o[1],a[0]=.5*o[2],a[1]=.5*o[3],a[2]=e.sourceFrame.width*n[2]-.5*o[2],a[3]=e.sourceFrame.height*n[3]-.5*o[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,Ti.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 u=0;for(u=0;u<i.length-1;++u){u===1&&e.multisample>1&&(c=this.getOptimalFilterTexture(l.width,l.height,e.resolution),c.filterFrame=l.filterFrame),i[u].apply(this,l,c,Ti.CLEAR,e);const d=l;l=c,c=d}i[u].apply(this,l,h.renderTexture,Ti.BLEND,e),u>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(l),this.returnFilterTexture(c)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=Ti.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 o=this.tempRect;o.x=0,o.y=0,o.width=t.filterFrame.width,o.height=t.filterFrame.height,i.bind(t,t.filterFrame,o)}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===Ti.CLEAR||e===Ti.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(xi.TRIANGLES)):(n.geometry.bind(this.quad),n.geometry.draw(xi.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){const{sourceFrame:i,destinationFrame:s}=this.activeState,{orig:n}=e._texture,o=t.set(s.width,0,0,s.height,i.x,i.y),a=e.worldTransform.copyTo(Nt.TEMP_MATRIX);return a.invert(),o.prepend(a),o.scale(1/n.width,1/n.height),o.translate(e.anchor.x,e.anchor.y),o}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(t,e,i=1,s=jt.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||jt.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=Pa[0],s=Pa[1],n=Pa[2],o=Pa[3];i.set(e.left,e.top),s.set(e.left,e.bottom),n.set(e.right,e.top),o.set(e.right,e.bottom),t.apply(i,i),t.apply(s,s),t.apply(n,n),t.apply(o,o);const a=Math.min(i.x,s.x,n.x,o.x),h=Math.min(i.y,s.y,n.y,o.y),l=Math.max(i.x,s.x,n.x,o.x),c=Math.max(i.y,s.y,n.y,o.y);e.x=a,e.y=h,e.width=l-a,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:o,b:a,c:h,d:l}=n;if((Math.abs(a)>1e-4||Math.abs(h)>1e-4)&&(Math.abs(o)>1e-4||Math.abs(l)>1e-4))return}n=n?Ac.copyFrom(n):Ac.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)}}}fm.extension={type:J.RendererSystem,name:"filter"},it.add(fm);class bv{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=jt.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const xv=new pt;class pm{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Cc(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 pt,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;q.PREFER_ENV===Zr.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 o=0;o<t.colorTextures.length;o++){const a=t.colorTextures[o];this.renderer.texture.unbind(a.parentTextureArray||a)}if(t.depthTexture&&this.renderer.texture.unbind(t.depthTexture),e){const o=e.width>>i,a=e.height>>i,h=o/e.width;this.setViewport(e.x*h,e.y*h,o,a)}else{const o=t.width>>i,a=t.height>>i;this.setViewport(0,0,o,a)}}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=xl.COLOR|xl.DEPTH){const{gl:o}=this;o.clearColor(t,e,i,s),o.clear(n)}initFramebuffer(t){const{gl:e}=this,i=new bv(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 o;this.renderer.context.webGLVersion===1?o=e.DEPTH_STENCIL:t.depth&&t.stencil?o=e.DEPTH24_STENCIL8:t.depth?o=e.DEPTH_COMPONENT24:o=e.STENCIL_INDEX8,i.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,o,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,o,t.width,t.height)}const s=t.colorTextures;let n=s.length;e.drawBuffers||(n=Math.min(n,1));for(let o=0;o<n;o++){const a=s[o],h=a.parentTextureArray||a;this.renderer.texture.bind(h,0),o===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 o=n.length;i.drawBuffers||(o=Math.min(o,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 a=[];for(let h=0;h<o;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),a.push(i.COLOR_ATTACHMENT0+h))}if(a.length>1&&i.drawBuffers(a),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=jt.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=jt.NONE),i}blit(t,e,i){const{current:s,renderer:n,gl:o,CONTEXT_UID:a}=this;if(n.context.webGLVersion!==2||!s)return;const h=s.glFramebuffers[a];if(!h)return;if(!t){if(!h.msaaBuffer)return;const c=s.colorTextures[0];if(!c)return;h.blitFramebuffer||(h.blitFramebuffer=new Cc(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=xv,e.width=s.width,e.height=s.height),i||(i=e);const l=e.width===i.width&&e.height===i.height;this.bind(t),o.bindFramebuffer(o.READ_FRAMEBUFFER,h.framebuffer),o.blitFramebuffer(e.left,e.top,e.right,e.bottom,i.left,i.top,i.right,i.bottom,o.COLOR_BUFFER_BIT,l?o.NEAREST:o.LINEAR),o.bindFramebuffer(o.READ_FRAMEBUFFER,t.glFramebuffers[this.CONTEXT_UID].framebuffer)}disposeFramebuffer(t,e){const 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,o=e.stencil=n.createRenderbuffer();n.bindRenderbuffer(n.RENDERBUFFER,o);let a,h;this.renderer.context.webGLVersion===1?(a=n.DEPTH_STENCIL_ATTACHMENT,h=n.DEPTH_STENCIL):t.depth?(a=n.DEPTH_STENCIL_ATTACHMENT,h=n.DEPTH24_STENCIL8):(a=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,a,n.RENDERBUFFER,o)}reset(){this.current=this.unknownFramebuffer,this.viewport=new pt}destroy(){this.renderer=null}}pm.extension={type:J.RendererSystem,name:"framebuffer"},it.add(pm);const Rc={5126:4,5123:2,5121:1};class mm{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;q.PREFER_ENV===Zr.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,o,a,h)=>i.drawElementsInstancedANGLE(s,n,o,a,h),t.drawArraysInstanced=(s,n,o,a)=>i.drawArraysInstancedANGLE(s,n,o,a)):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 o=s[e.program.id]||this.initGeometryVao(t,e,n);this._activeGeometry=t,this._activeVao!==o&&(this._activeVao=o,this.hasVao?i.bindVertexArray(o):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 o in i)s[o]&&n.push(o,s[o].location);return n.join("-")}initGeometryVao(t,e,i=!0){const s=this.gl,n=this.CONTEXT_UID,o=this.renderer.buffer,a=e.program;a.glPrograms[n]||this.renderer.shader.generateProgram(e),this.checkCompatibility(t,a);const h=this.getSignature(t,a),l=t.glVertexArrayObjects[this.CONTEXT_UID];let c=l[h];if(c)return l[a.id]=c,c;const u=t.buffers,d=t.attributes,f={},m={};for(const p in u)f[p]=0,m[p]=0;for(const p in d)!d[p].size&&a.attributeData[p]?d[p].size=a.attributeData[p].size:d[p].size||console.warn(`PIXI Geometry attribute '${p}' size cannot be determined (likely the bound shader does not have the attribute)`),f[d[p].buffer]+=d[p].size*Rc[d[p].type];for(const p in d){const g=d[p],y=g.size;g.stride===void 0&&(f[g.buffer]===y*Rc[g.type]?g.stride=0:g.stride=f[g.buffer]),g.start===void 0&&(g.start=m[g.buffer],m[g.buffer]+=y*Rc[g.type])}c=s.createVertexArray(),s.bindVertexArray(c);for(let p=0;p<u.length;p++){const g=u[p];o.bind(g),i&&g._glBuffers[n].refCount++}return this.activateVao(t,a),l[a.id]=c,l[h]=c,s.bindVertexArray(null),o.unbind(wi.ARRAY_BUFFER),c}disposeGeometry(t,e){var a;if(!this.managedGeometries[t.id])return;delete this.managedGeometries[t.id];const i=t.glVertexArrayObjects[this.CONTEXT_UID],s=this.gl,n=t.buffers,o=(a=this.renderer)==null?void 0:a.buffer;if(t.disposeRunner.remove(this),!!i){if(o)for(let h=0;h<n.length;h++){const l=n[h]._glBuffers[this.CONTEXT_UID];l&&(l.refCount--,l.refCount===0&&!e&&o.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,o=t.buffers,a=t.attributes;t.indexBuffer&&n.bind(t.indexBuffer);let h=null;for(const l in a){const c=a[l],u=o[c.buffer],d=u._glBuffers[s];if(e.attributeData[l]){h!==d&&(n.bind(u),h=d);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,o=this._activeGeometry;if(o.indexBuffer){const a=o.indexBuffer.data.BYTES_PER_ELEMENT,h=a===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;a===2||a===4&&this.canUseUInt32ElementIndex?o.instanced?n.drawElementsInstanced(t,e||o.indexBuffer.data.length,h,(i||0)*a,s||1):n.drawElements(t,e||o.indexBuffer.data.length,h,(i||0)*a):console.warn("unsupported index buffer type: uint32")}else o.instanced?n.drawArraysInstanced(t,i,e||o.getSize(),s||1):n.drawArrays(t,i,e||o.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}}mm.extension={type:J.RendererSystem,name:"geometry"},it.add(mm);const gm=new Nt;class ym{constructor(t,e){this._texture=t,this.mapCoord=new Nt,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],o=t[s+1];e[s]=n*i.a+o*i.c+i.tx,e[s+1]=n*i.b+o*i.d+i.ty}return e}update(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&&(gm.set(s.width/n.width,0,0,s.height/n.height,-n.x/n.width,-n.y/n.height),this.mapCoord.append(gm));const o=e.baseTexture,a=this.uClampFrame,h=this.clampMargin/o.resolution,l=this.clampOffset;return a[0]=(e._frame.x+h+l)/o.width,a[1]=(e._frame.y+h+l)/o.height,a[2]=(e._frame.x+e._frame.width-h+l)/o.width,a[3]=(e._frame.y+e._frame.height-h+l)/o.height,this.uClampOffset[0]=l/o.realWidth,this.uClampOffset[1]=l/o.realHeight,this.isSimple=e._frame.width===o.width&&e._frame.height===o.height&&e.rotate===0,!0}}var _v=`varying vec2 vMaskCoord;
|
|
379
379
|
varying vec2 vTextureCoord;
|
|
380
380
|
|
|
381
381
|
uniform sampler2D uSampler;
|
|
@@ -400,7 +400,7 @@ void main(void)
|
|
|
400
400
|
|
|
401
401
|
gl_FragColor = original;
|
|
402
402
|
}
|
|
403
|
-
`,
|
|
403
|
+
`,vv=`attribute vec2 aVertexPosition;
|
|
404
404
|
attribute vec2 aTextureCoord;
|
|
405
405
|
|
|
406
406
|
uniform mat3 projectionMatrix;
|
|
@@ -416,7 +416,7 @@ void main(void)
|
|
|
416
416
|
vTextureCoord = aTextureCoord;
|
|
417
417
|
vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;
|
|
418
418
|
}
|
|
419
|
-
`;class vv extends _e{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||_v,e||xv,i),this.maskSprite=s,this.maskMatrix=new Nt}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,o=n._texture;o.valid&&(o.uvMatrix||(o.uvMatrix=new ym(o,0)),o.uvMatrix.update(),this.uniforms.npmAlpha=o.baseTexture.alphaMode?0:1,this.uniforms.mask=o,this.uniforms.otherMatrix=t.calculateSpriteMatrix(this.maskMatrix,n).prepend(o.uvMatrix.mapCoord),this.uniforms.alpha=n.worldAlpha,this.uniforms.maskClamp=o.uvMatrix.uClampFrame,t.applyFilter(this,e,i,s))}}class Tv{constructor(t=null){this.type=$t.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=_e.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=$t.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 bm{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 Tv;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!==$t.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case $t.SCISSOR:this.renderer.scissor.push(i);break;case $t.STENCIL:this.renderer.stencil.push(i);break;case $t.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case $t.COLOR:this.pushColorMask(i);break}i.type===$t.SPRITE&&this.maskStack.push(i)}pop(t){const e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case $t.SCISSOR:this.renderer.scissor.pop(e);break;case $t.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case $t.SPRITE:this.popSpriteMask(e);break;case $t.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===$t.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}}detect(t){const e=t.maskObject;e?e.isSprite?t.type=$t.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=$t.SCISSOR:t.type=$t.STENCIL:t.type=$t.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 vv])),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}}bm.extension={type:J.RendererSystem,name:"mask"},it.add(bm);class xm{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 _m=new Nt,vm=[],Tm=class pl extends xm{constructor(t){super(t),this.glConst=q.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,o=i.getBounds(!0,vm.pop()??new pt);this.roundFrameToPixels(o,n.current?n.current.resolution:s.resolution,n.sourceFrame,n.destinationFrame,s.projection.transform),e&&o.fit(e),t._scissorRectLocal=o}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()||pl.isMatrixRotated(e.worldTransform)||pl.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){pl.isMatrixRotated(n)||(n=n?_m.copyFrom(n):_m.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&&vm.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)}};Tm.extension={type:J.RendererSystem,name:"scissor"};let wv=Tm;it.add(wv);class wm extends xm{constructor(t){super(t),this.glConst=q.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)}}wm.extension={type:J.RendererSystem,name:"stencil"},it.add(wm);class Sm{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return Tt("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract}},prepare:{enumerable:!1,get(){return Tt("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare}},interaction:{enumerable:!1,get(){return Tt("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}}Sm.extension={type:[J.RendererSystem,J.CanvasRendererSystem],name:"_plugin"},it.add(Sm);class Cm{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new Nt,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,o=s?-1:1;n.identity(),n.a=1/e.width*2,n.d=o*(1/e.height*2),n.tx=-1-e.x*n.a,n.ty=-o-e.y*n.d}setTransform(t){}destroy(){this.renderer=null}}Cm.extension={type:J.RendererSystem,name:"projection"},it.add(Cm);const Sv=new vc,Em=new pt;class Im{constructor(t){this.renderer=t,this._tempMatrix=new Nt}generateTexture(t,e){const{region:i,...s}=e||{},n=(i==null?void 0:i.copyTo(Em))||t.getLocalBounds(Em,!0),o=s.resolution||this.renderer.resolution;n.width=Math.max(n.width,1/o),n.height=Math.max(n.height,1/o),s.width=n.width,s.height=n.height,s.resolution=o,s.multisample??(s.multisample=this.renderer.multisample);const a=es.create(s);this._tempMatrix.tx=-n.x,this._tempMatrix.ty=-n.y;const h=t.transform;return t.transform=Sv,this.renderer.render(t,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=h,a}destroy(){}}Im.extension={type:[J.RendererSystem,J.CanvasRendererSystem],name:"textureGenerator"},it.add(Im);const is=new pt,$n=new pt;class Am{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new pt,this.destinationFrame=new pt,this.viewportFrame=new pt}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,o,a;t?(n=t.baseTexture,a=n.resolution,e||(is.width=t.frame.width,is.height=t.frame.height,e=is),i||($n.x=t.frame.x,$n.y=t.frame.y,$n.width=e.width,$n.height=e.height,i=$n),o=n.framebuffer):(a=s.resolution,e||(is.width=s._view.screen.width,is.height=s._view.screen.height,e=is),i||(i=is,i.width=e.width,i.height=e.height));const h=this.viewportFrame;h.x=i.x*a,h.y=i.y*a,h.width=i.width*a,h.height=i.height*a,t||(h.y=s.view.height-(h.y+h.height)),h.ceil(),this.renderer.framebuffer.bind(o,h),this.renderer.projection.update(i,e,a,!o),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=Ft.shared.setValue(t||i);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&s.premultiply(s.alpha);const n=this.destinationFrame,o=this.current?this.current.baseTexture:this.renderer._view.screen,a=n.width!==o.width||n.height!==o.height;if(a){let{x:h,y:l,width:c,height:u}=this.viewportFrame;h=Math.round(h),l=Math.round(l),c=Math.round(c),u=Math.round(u),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(h,l,c,u)}this.renderer.framebuffer.clear(s.red,s.green,s.blue,s.alpha,e),a&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}Am.extension={type:J.RendererSystem,name:"renderTexture"},it.add(Am);class Cv{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 Ev(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 o=sm(t,n.type),a={type:o,name:n.name,size:im(o),location:t.getAttribLocation(r,n.name)};e[n.name]=a}return e}function Iv(r,t){const e={},i=t.getProgramParameter(r,t.ACTIVE_UNIFORMS);for(let s=0;s<i;s++){const n=t.getActiveUniform(r,s),o=n.name.replace(/\[.*?\]$/,""),a=!!n.name.match(/\[.*?\]$/),h=sm(t,n.type);e[o]={name:o,index:s,type:h,size:n.size,isArray:a,value:qp(h,n.size)}}return e}function Av(r,t){var a;const e=Qp(r,r.VERTEX_SHADER,t.vertexSrc),i=Qp(r,r.FRAGMENT_SHADER,t.fragmentSrc),s=r.createProgram();r.attachShader(s,e),r.attachShader(s,i);const n=(a=t.extra)==null?void 0:a.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)||rv(r,s,e,i),t.attributeData=Ev(s,r),t.uniformData=Iv(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 o={};for(const h in t.uniformData){const l=t.uniformData[h];o[h]={location:r.getUniformLocation(s,h),value:qp(l.type,l.size)}}return new Cv(s,o)}function Rv(r,t,e,i,s){e.buffer.update(s)}const Mv={float:`
|
|
419
|
+
`;class Tv extends _e{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||vv,e||_v,i),this.maskSprite=s,this.maskMatrix=new Nt}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,o=n._texture;o.valid&&(o.uvMatrix||(o.uvMatrix=new ym(o,0)),o.uvMatrix.update(),this.uniforms.npmAlpha=o.baseTexture.alphaMode?0:1,this.uniforms.mask=o,this.uniforms.otherMatrix=t.calculateSpriteMatrix(this.maskMatrix,n).prepend(o.uvMatrix.mapCoord),this.uniforms.alpha=n.worldAlpha,this.uniforms.maskClamp=o.uvMatrix.uClampFrame,t.applyFilter(this,e,i,s))}}class wv{constructor(t=null){this.type=$t.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=_e.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=$t.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 bm{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 wv;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!==$t.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case $t.SCISSOR:this.renderer.scissor.push(i);break;case $t.STENCIL:this.renderer.stencil.push(i);break;case $t.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case $t.COLOR:this.pushColorMask(i);break}i.type===$t.SPRITE&&this.maskStack.push(i)}pop(t){const e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case $t.SCISSOR:this.renderer.scissor.pop(e);break;case $t.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case $t.SPRITE:this.popSpriteMask(e);break;case $t.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===$t.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}}detect(t){const e=t.maskObject;e?e.isSprite?t.type=$t.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=$t.SCISSOR:t.type=$t.STENCIL:t.type=$t.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 Tv])),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}}bm.extension={type:J.RendererSystem,name:"mask"},it.add(bm);class xm{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 _m=new Nt,vm=[],Tm=class pl extends xm{constructor(t){super(t),this.glConst=q.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,o=i.getBounds(!0,vm.pop()??new pt);this.roundFrameToPixels(o,n.current?n.current.resolution:s.resolution,n.sourceFrame,n.destinationFrame,s.projection.transform),e&&o.fit(e),t._scissorRectLocal=o}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()||pl.isMatrixRotated(e.worldTransform)||pl.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){pl.isMatrixRotated(n)||(n=n?_m.copyFrom(n):_m.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&&vm.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)}};Tm.extension={type:J.RendererSystem,name:"scissor"};let Sv=Tm;it.add(Sv);class wm extends xm{constructor(t){super(t),this.glConst=q.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)}}wm.extension={type:J.RendererSystem,name:"stencil"},it.add(wm);class Sm{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return Tt("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract}},prepare:{enumerable:!1,get(){return Tt("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare}},interaction:{enumerable:!1,get(){return Tt("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}}Sm.extension={type:[J.RendererSystem,J.CanvasRendererSystem],name:"_plugin"},it.add(Sm);class Em{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new Nt,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,o=s?-1:1;n.identity(),n.a=1/e.width*2,n.d=o*(1/e.height*2),n.tx=-1-e.x*n.a,n.ty=-o-e.y*n.d}setTransform(t){}destroy(){this.renderer=null}}Em.extension={type:J.RendererSystem,name:"projection"},it.add(Em);const Ev=new vc,Cm=new pt;class Im{constructor(t){this.renderer=t,this._tempMatrix=new Nt}generateTexture(t,e){const{region:i,...s}=e||{},n=(i==null?void 0:i.copyTo(Cm))||t.getLocalBounds(Cm,!0),o=s.resolution||this.renderer.resolution;n.width=Math.max(n.width,1/o),n.height=Math.max(n.height,1/o),s.width=n.width,s.height=n.height,s.resolution=o,s.multisample??(s.multisample=this.renderer.multisample);const a=es.create(s);this._tempMatrix.tx=-n.x,this._tempMatrix.ty=-n.y;const h=t.transform;return t.transform=Ev,this.renderer.render(t,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=h,a}destroy(){}}Im.extension={type:[J.RendererSystem,J.CanvasRendererSystem],name:"textureGenerator"},it.add(Im);const is=new pt,qn=new pt;class Am{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new pt,this.destinationFrame=new pt,this.viewportFrame=new pt}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,o,a;t?(n=t.baseTexture,a=n.resolution,e||(is.width=t.frame.width,is.height=t.frame.height,e=is),i||(qn.x=t.frame.x,qn.y=t.frame.y,qn.width=e.width,qn.height=e.height,i=qn),o=n.framebuffer):(a=s.resolution,e||(is.width=s._view.screen.width,is.height=s._view.screen.height,e=is),i||(i=is,i.width=e.width,i.height=e.height));const h=this.viewportFrame;h.x=i.x*a,h.y=i.y*a,h.width=i.width*a,h.height=i.height*a,t||(h.y=s.view.height-(h.y+h.height)),h.ceil(),this.renderer.framebuffer.bind(o,h),this.renderer.projection.update(i,e,a,!o),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=Ft.shared.setValue(t||i);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&s.premultiply(s.alpha);const n=this.destinationFrame,o=this.current?this.current.baseTexture:this.renderer._view.screen,a=n.width!==o.width||n.height!==o.height;if(a){let{x:h,y:l,width:c,height:u}=this.viewportFrame;h=Math.round(h),l=Math.round(l),c=Math.round(c),u=Math.round(u),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(h,l,c,u)}this.renderer.framebuffer.clear(s.red,s.green,s.blue,s.alpha,e),a&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}Am.extension={type:J.RendererSystem,name:"renderTexture"},it.add(Am);class Cv{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 Iv(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 o=sm(t,n.type),a={type:o,name:n.name,size:im(o),location:t.getAttribLocation(r,n.name)};e[n.name]=a}return e}function Av(r,t){const e={},i=t.getProgramParameter(r,t.ACTIVE_UNIFORMS);for(let s=0;s<i;s++){const n=t.getActiveUniform(r,s),o=n.name.replace(/\[.*?\]$/,""),a=!!n.name.match(/\[.*?\]$/),h=sm(t,n.type);e[o]={name:o,index:s,type:h,size:n.size,isArray:a,value:qp(h,n.size)}}return e}function Rv(r,t){var a;const e=Qp(r,r.VERTEX_SHADER,t.vertexSrc),i=Qp(r,r.FRAGMENT_SHADER,t.fragmentSrc),s=r.createProgram();r.attachShader(s,e),r.attachShader(s,i);const n=(a=t.extra)==null?void 0:a.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)||sv(r,s,e,i),t.attributeData=Iv(s,r),t.uniformData=Av(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 o={};for(const h in t.uniformData){const l=t.uniformData[h];o[h]={location:r.getUniformLocation(s,h),value:qp(l.type,l.size)}}return new Cv(s,o)}function Mv(r,t,e,i,s){e.buffer.update(s)}const Lv={float:`
|
|
420
420
|
data[offset] = v;
|
|
421
421
|
`,vec2:`
|
|
422
422
|
data[offset] = v[0];
|
|
@@ -454,7 +454,7 @@ void main(void)
|
|
|
454
454
|
{
|
|
455
455
|
data[offset + i] = v[i];
|
|
456
456
|
}
|
|
457
|
-
`},Rm={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
|
|
457
|
+
`},Rm={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 Pv(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 o=t[n];if(e=Rm[o.data.type],o.data.size>1&&(e=Math.max(e,16)*o.data.size),o.dataLen=e,i%e!==0&&i<16){const a=i%e%16;i+=a,s+=a}i+e>16?(s=Math.ceil(s/16)*16,o.offset=s,s+=e,i=e):(o.offset=s,i+=e,s+=e)}return s=Math.ceil(s/16)*16,{uboElements:t,size:s}}function Gv(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 Fv(r,t){if(!r.autoManage)return{size:0,syncFunc:Mv};const e=Gv(r.uniforms,t),{uboElements:i,size:s}=Pv(e),n=[`
|
|
458
458
|
var v = null;
|
|
459
459
|
var v2 = null;
|
|
460
460
|
var cv = null;
|
|
@@ -478,7 +478,7 @@ void main(void)
|
|
|
478
478
|
offset += ${m};
|
|
479
479
|
}
|
|
480
480
|
|
|
481
|
-
`)}else{const u=
|
|
481
|
+
`)}else{const u=Lv[a.data.type];n.push(`
|
|
482
482
|
cv = ud.${l}.value;
|
|
483
483
|
v = uv.${l};
|
|
484
484
|
offset = ${a.offset/4};
|
|
@@ -486,7 +486,7 @@ void main(void)
|
|
|
486
486
|
`)}}return n.push(`
|
|
487
487
|
renderer.buffer.update(buffer);
|
|
488
488
|
`),{size:s,syncFunc:new Function("ud","uv","renderer","syncData","buffer",n.join(`
|
|
489
|
-
`))}}let Fv=0;const Ga={textureCount:0,uboCount:0};class Mm{constructor(t){this.destroyed=!1,this.renderer=t,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=Fv++}systemCheck(){if(!nv())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||(Ga.textureCount=0,Ga.uboCount=0,this.syncUniformGroup(t.uniformGroup,Ga)),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]=tv(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,Ga,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 o=this.getSignature(t,this.shader.program.uniformData,"ubo");let a=this._uboCache[o];if(a||(a=this._uboCache[o]=Gv(t,this.shader.program.uniformData)),t.autoManage){const h=new Float32Array(a.size/4);t.buffer.update(h)}return e.uniformGroups[t.id]=a.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,i){const s=t.uniforms,n=[`${i}-`];for(const o in s)n.push(o),e[o]&&n.push(e[o].type);return n.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){const e=this.gl,i=t.program,s=Av(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}}Mm.extension={type:J.RendererSystem,name:"shader"},it.add(Mm);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.3.2 - ${e.rendererLogId} - https://pixijs.com`),e.resize(e.screen.width,e.screen.height)}destroy(){}}Fa.defaultOptions={hello:!1},Fa.extension={type:[J.RendererSystem,J.CanvasRendererSystem],name:"startup"},it.add(Fa);function Nv(r,t=[]){return t[ft.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ft.ADD]=[r.ONE,r.ONE],t[ft.MULTIPLY]=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ft.SCREEN]=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ft.OVERLAY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ft.DARKEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ft.LIGHTEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ft.COLOR_DODGE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ft.COLOR_BURN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ft.HARD_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ft.SOFT_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ft.DIFFERENCE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ft.EXCLUSION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ft.HUE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ft.SATURATION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ft.COLOR]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ft.LUMINOSITY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ft.NONE]=[0,0],t[ft.NORMAL_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ft.ADD_NPM]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t[ft.SCREEN_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ft.SRC_IN]=[r.DST_ALPHA,r.ZERO],t[ft.SRC_OUT]=[r.ONE_MINUS_DST_ALPHA,r.ZERO],t[ft.SRC_ATOP]=[r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[ft.DST_OVER]=[r.ONE_MINUS_DST_ALPHA,r.ONE],t[ft.DST_IN]=[r.ZERO,r.SRC_ALPHA],t[ft.DST_OUT]=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],t[ft.DST_ATOP]=[r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA],t[ft.XOR]=[r.ONE_MINUS_DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[ft.SUBTRACT]=[r.ONE,r.ONE,r.ONE,r.ONE,r.FUNC_REVERSE_SUBTRACT,r.FUNC_ADD],t}const Dv=0,kv=1,Ov=2,Bv=3,Wv=4,Uv=5,Lm=class bf{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=ft.NONE,this._blendEq=!1,this.map=[],this.map[Dv]=this.setBlend,this.map[kv]=this.setOffset,this.map[Ov]=this.setCullFace,this.map[Bv]=this.setDepthTest,this.map[Wv]=this.setFrontFace,this.map[Uv]=this.setDepthMask,this.checks=[],this.defaultState=new Ai,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=Nv(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(bf.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(bf.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}};Lm.extension={type:J.RendererSystem,name:"state"};let Xv=Lm;it.add(Xv);class Zv extends kn{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 ni(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(o=>this._systemsHash[o]===s);s[t.name](e[n])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}}const Qn=class ml{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=ml.defaultMaxIdle,this.checkCountMax=ml.defaultCheckCountMax,this.mode=ml.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==_l.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}};Qn.defaultMode=_l.AUTO,Qn.defaultMaxIdle=60*60,Qn.defaultCheckCountMax=60*10,Qn.extension={type:J.RendererSystem,name:"textureGC"};let rs=Qn;it.add(rs);class Mc{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=ht.UNSIGNED_BYTE,this.internalFormat=K.RGBA,this.samplerType=0}}function Vv(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[r.RGB]:Q.FLOAT,[r.RGBA]:Q.FLOA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EPTH_COMPONENT32F]:Q.FLOAT,[r.DEPTH_STENCIL]:Q.FLOAT,[r.DEPTH24_STENCIL8]:Q.FLOAT,[r.DEPTH32F_STENCIL8]:Q.FLOAT}:t={[r.RGB]:Q.FLOAT,[r.RGBA]:Q.FLOAT,[r.ALPHA]:Q.FLOAT,[r.LUMINANCE]:Q.FLOAT,[r.LUMINANCE_ALPHA]:Q.FLOAT,[r.DEPTH_STENCIL]:Q.FLOAT},t}function Hv(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[ht.UNSIGNED_BYTE]:{[K.RGBA]:r.RGBA8,[K.RGB]:r.RGB8,[K.RG]:r.RG8,[K.RED]:r.R8,[K.RGBA_INTEGER]:r.RGBA8UI,[K.RGB_INTEGER]:r.RGB8UI,[K.RG_INTEGER]:r.RG8UI,[K.RED_INTEGER]:r.R8UI,[K.ALPHA]:r.ALPHA,[K.LUMINANCE]:r.LUMINANCE,[K.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[ht.BYTE]:{[K.RGBA]:r.RGBA8_SNORM,[K.RGB]:r.RGB8_SNORM,[K.RG]:r.RG8_SNORM,[K.RED]:r.R8_SNORM,[K.RGBA_INTEGER]:r.RGBA8I,[K.RGB_INTEGER]:r.RGB8I,[K.RG_INTEGER]:r.RG8I,[K.RED_INTEGER]:r.R8I},[ht.UNSIGNED_SHORT]:{[K.RGBA_INTEGER]:r.RGBA16UI,[K.RGB_INTEGER]:r.RGB16UI,[K.RG_INTEGER]:r.RG16UI,[K.RED_INTEGER]:r.R16UI,[K.DEPTH_COMPONENT]:r.DEPTH_COMPONENT16},[ht.SHORT]:{[K.RGBA_INTEGER]:r.RGBA16I,[K.RGB_INTEGER]:r.RGB16I,[K.RG_INTEGER]:r.RG16I,[K.RED_INTEGER]:r.R16I},[ht.UNSIGNED_INT]:{[K.RGBA_INTEGER]:r.RGBA32UI,[K.RGB_INTEGER]:r.RGB32UI,[K.RG_INTEGER]:r.RG32UI,[K.RED_INTEGER]:r.R32UI,[K.DEPTH_COMPONENT]:r.DEPTH_COMPONENT24},[ht.INT]:{[K.RGBA_INTEGER]:r.RGBA32I,[K.RGB_INTEGER]:r.RGB32I,[K.RG_INTEGER]:r.RG32I,[K.RED_INTEGER]:r.R32I},[ht.FLOAT]:{[K.RGBA]:r.RGBA32F,[K.RGB]:r.RGB32F,[K.RG]:r.RG32F,[K.RED]:r.R32F,[K.DEPTH_COMPONENT]:r.DEPTH_COMPONENT32F},[ht.HALF_FLOAT]:{[K.RGBA]:r.RGBA16F,[K.RGB]:r.RGB16F,[K.RG]:r.RG16F,[K.RED]:r.R16F},[ht.UNSIGNED_SHORT_5_6_5]:{[K.RGB]:r.RGB565},[ht.UNSIGNED_SHORT_4_4_4_4]:{[K.RGBA]:r.RGBA4},[ht.UNSIGNED_SHORT_5_5_5_1]:{[K.RGBA]:r.RGB5_A1},[ht.UNSIGNED_INT_2_10_10_10_REV]:{[K.RGBA]:r.RGB10_A2,[K.RGBA_INTEGER]:r.RGB10_A2UI},[ht.UNSIGNED_INT_10F_11F_11F_REV]:{[K.RGB]:r.R11F_G11F_B10F},[ht.UNSIGNED_INT_5_9_9_9_REV]:{[K.RGB]:r.RGB9_E5},[ht.UNSIGNED_INT_24_8]:{[K.DEPTH_STENCIL]:r.DEPTH24_STENCIL8},[ht.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[K.DEPTH_STENCIL]:r.DEPTH32F_STENCIL8}}:t={[ht.UNSIGNED_BYTE]:{[K.RGBA]:r.RGBA,[K.RGB]:r.RGB,[K.ALPHA]:r.ALPHA,[K.LUMINANCE]:r.LUMINANCE,[K.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[ht.UNSIGNED_SHORT_5_6_5]:{[K.RGB]:r.RGB},[ht.UNSIGNED_SHORT_4_4_4_4]:{[K.RGBA]:r.RGBA},[ht.UNSIGNED_SHORT_5_5_5_1]:{[K.RGBA]:r.RGBA}},t}class Pm{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new gt,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=Hv(t),this.samplerTypes=Vv(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 Mc(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 Mc(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 o=e[n];o&&o._glTextures[s].samplerType!==Q.FLOAT&&this.renderer.texture.unbind(o)}}initTexture(t){const e=new Mc(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]??Q.FLOAT,this.webGLVersion===2&&t.type===ht.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!==Q.FLOAT&&(this.hasIntegerTextures=!0);else{const n=t.realWidth,o=t.realHeight,a=i.gl;(e.width!==n||e.height!==o||e.dirtyId<0)&&(e.width=n,e.height=o,a.texImage2D(t.target,0,e.internalFormat,n,o,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.dirtyId=t.dirtyId}destroyTexture(t,e){const{gl: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&&Ys(this.managedTextures,s,1)}}updateTextureStyle(t){var i;const e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===vi.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=_i.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!==vi.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===Yi.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);const s=this.renderer.context.extensions.anisotropicFiltering;if(s&&t.anisotropicLevel>0&&t.scaleMode===Yi.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===Yi.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(t.target,i.TEXTURE_MAG_FILTER,t.scaleMode===Yi.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}}Pm.extension={type:J.RendererSystem,name:"texture"},it.add(Pm);class Gm{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 o=0;o<t.buffers.length;o++){const a=t.buffers[o];a&&(i.buffer.update(a),a._glBuffers[s].refCount++,e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,o,a._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 o=0;o<t.buffers.length;o++){const a=t.buffers[o];if(!a)continue;const h=a._glBuffers[this.CONTEXT_UID];h&&(h.refCount--,h.refCount===0&&!e&&n.dispose(a,e))}i&&(e||s.deleteTransformFeedback(i),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}}Gm.extension={type:J.RendererSystem,name:"transformFeedback"},it.add(Gm);class Na{constructor(t){this.renderer=t}init(t){this.screen=new pt(0,0,t.width,t.height),this.element=t.view||q.ADAPTER.createCanvas(),this.resolution=t.resolution||q.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}}Na.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},Na.extension={type:[J.RendererSystem,J.CanvasRendererSystem],name:"_view"},it.add(Na),q.PREFER_ENV=Zr.WEBGL2,q.STRICT_TEXTURE_CACHE=!1,q.RENDER_OPTIONS={...Ma.defaultOptions,...Ra.defaultOptions,...Na.defaultOptions,...Fa.defaultOptions},Object.defineProperties(q,{WRAP_MODE:{get(){return gt.defaultOptions.wrapMode},set(r){Tt("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),gt.defaultOptions.wrapMode=r}},SCALE_MODE:{get(){return gt.defaultOptions.scaleMode},set(r){Tt("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),gt.defaultOptions.scaleMode=r}},MIPMAP_TEXTURES:{get(){return gt.defaultOptions.mipmap},set(r){Tt("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),gt.defaultOptions.mipmap=r}},ANISOTROPIC_LEVEL:{get(){return gt.defaultOptions.anisotropicLevel},set(r){Tt("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),gt.defaultOptions.anisotropicLevel=r}},FILTER_RESOLUTION:{get(){return Tt("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),_e.defaultResolution},set(r){_e.defaultResolution=r}},FILTER_MULTISAMPLE:{get(){return Tt("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),_e.defaultMultisample},set(r){_e.defaultMultisample=r}},SPRITE_MAX_TEXTURES:{get(){return ts.defaultMaxTextures},set(r){Tt("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),ts.defaultMaxTextures=r}},SPRITE_BATCH_SIZE:{get(){return ts.defaultBatchSize},set(r){Tt("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),ts.defaultBatchSize=r}},CAN_UPLOAD_SAME_BUFFER:{get(){return ts.canUploadSameBuffer},set(r){Tt("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),ts.canUploadSameBuffer=r}},GC_MODE:{get(){return rs.defaultMode},set(r){Tt("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),rs.defaultMode=r}},GC_MAX_IDLE:{get(){return rs.defaultMaxIdle},set(r){Tt("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),rs.defaultMaxIdle=r}},GC_MAX_CHECK_COUNT:{get(){return rs.defaultCheckCountMax},set(r){Tt("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),rs.defaultCheckCountMax=r}},PRECISION_VERTEX:{get(){return er.defaultVertexPrecision},set(r){Tt("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),er.defaultVertexPrecision=r}},PRECISION_FRAGMENT:{get(){return er.defaultFragmentPrecision},set(r){Tt("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),er.defaultFragmentPrecision=r}}});var ss=(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))(ss||{});class Lc{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 Fm=class He{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 Lc(null,null,1/0),this.deltaMS=1/He.targetFPMS,this.elapsedMS=1/He.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=ss.NORMAL){return this._addListener(new Lc(t,e,i))}addOnce(t,e,i=ss.NORMAL){return this._addListener(new Lc(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*He.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,He.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(!He._shared){const t=He._shared=new He;t.autoStart=!0,t._protected=!0}return He._shared}static get system(){if(!He._system){const t=He._system=new He;t.autoStart=!0,t._protected=!0}return He._system}};Fm.targetFPMS=.06;let ve=Fm;Object.defineProperties(q,{TARGET_FPMS:{get(){return ve.targetFPMS},set(r){Tt("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),ve.targetFPMS=r}}});class Nm{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,ss.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?ve.shared:new ve,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}Nm.extension=J.Application,it.add(Nm);const Dm=[];it.handleByList(J.Renderer,Dm);function Kv(r){for(const t of Dm)if(t.test(r))return new t(r);throw new Error("Unable to auto-detect a suitable renderer.")}var Yv=`attribute vec2 aVertexPosition;
|
|
489
|
+
`))}}let Nv=0;const Ga={textureCount:0,uboCount:0};class Mm{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=Nv++}systemCheck(){if(!ov())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||(Ga.textureCount=0,Ga.uboCount=0,this.syncUniformGroup(t.uniformGroup,Ga)),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]=ev(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,Ga,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 o=this.getSignature(t,this.shader.program.uniformData,"ubo");let a=this._uboCache[o];if(a||(a=this._uboCache[o]=Fv(t,this.shader.program.uniformData)),t.autoManage){const h=new Float32Array(a.size/4);t.buffer.update(h)}return e.uniformGroups[t.id]=a.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,i){const s=t.uniforms,n=[`${i}-`];for(const o in s)n.push(o),e[o]&&n.push(e[o].type);return n.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){const e=this.gl,i=t.program,s=Rv(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}}Mm.extension={type:J.RendererSystem,name:"shader"},it.add(Mm);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.3.2 - ${e.rendererLogId} - https://pixijs.com`),e.resize(e.screen.width,e.screen.height)}destroy(){}}Fa.defaultOptions={hello:!1},Fa.extension={type:[J.RendererSystem,J.CanvasRendererSystem],name:"startup"},it.add(Fa);function Dv(r,t=[]){return t[ft.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ft.ADD]=[r.ONE,r.ONE],t[ft.MULTIPLY]=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ft.SCREEN]=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ft.OVERLAY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ft.DARKEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ft.LIGHTEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ft.COLOR_DODGE]=[r.ONE,r.ONE_MINUS_SRC_ALPH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Uv=4,Xv=5,Lm=class bf{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=ft.NONE,this._blendEq=!1,this.map=[],this.map[kv]=this.setBlend,this.map[Ov]=this.setOffset,this.map[Bv]=this.setCullFace,this.map[Wv]=this.setDepthTest,this.map[Uv]=this.setFrontFace,this.map[Xv]=this.setDepthMask,this.checks=[],this.defaultState=new Ai,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=Dv(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(bf.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(bf.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}};Lm.extension={type:J.RendererSystem,name:"state"};let Zv=Lm;it.add(Zv);class Vv extends Bn{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 ni(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(o=>this._systemsHash[o]===s);s[t.name](e[n])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}}const to=class ml{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=ml.defaultMaxIdle,this.checkCountMax=ml.defaultCheckCountMax,this.mode=ml.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==_l.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}};to.defaultMode=_l.AUTO,to.defaultMaxIdle=60*60,to.defaultCheckCountMax=60*10,to.extension={type:J.RendererSystem,name:"textureGC"};let rs=to;it.add(rs);class Mc{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=ht.UNSIGNED_BYTE,this.internalFormat=K.RGBA,this.samplerType=0}}function Hv(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[r.RGB]:Q.FLOAT,[r.RGBA]:Q.FLOAT,[r.ALPHA]:Q.FLOAT,[r.LUMINANCE]:Q.FLOAT,[r.LUMINANCE_ALPHA]:Q.FLOAT,[r.R8]:Q.FLOAT,[r.R8_SNORM]:Q.FLOAT,[r.RG8]:Q.FLOAT,[r.RG8_SNORM]:Q.FLOAT,[r.RGB8]:Q.FLOAT,[r.RGB8_SNORM]:Q.FLOAT,[r.RGB565]:Q.FLOAT,[r.RGBA4]:Q.FLOAT,[r.RGB5_A1]:Q.FLOAT,[r.RGBA8]:Q.FLOAT,[r.RGBA8_SNORM]:Q.FLOAT,[r.RGB10_A2]:Q.FLOAT,[r.RGB10_A2UI]:Q.FLOAT,[r.SRGB8]:Q.FLOAT,[r.SRGB8_ALPHA8]:Q.FLOAT,[r.R16F]:Q.FLOAT,[r.RG16F]:Q.FLOAT,[r.RGB16F]:Q.FLOAT,[r.RGBA16F]:Q.FLOAT,[r.R32F]:Q.FLOAT,[r.RG32F]:Q.FLOAT,[r.RGB32F]:Q.FLOAT,[r.RGBA32F]:Q.FLOAT,[r.R11F_G11F_B10F]:Q.FLOAT,[r.RGB9_E5]:Q.FLOAT,[r.R8I]:Q.INT,[r.R8UI]:Q.UINT,[r.R16I]:Q.INT,[r.R16UI]:Q.UINT,[r.R32I]:Q.INT,[r.R32UI]:Q.UINT,[r.RG8I]:Q.INT,[r.RG8UI]:Q.UINT,[r.RG16I]:Q.INT,[r.RG16UI]:Q.UINT,[r.RG32I]:Q.INT,[r.RG32UI]:Q.UINT,[r.RGB8I]:Q.INT,[r.RGB8UI]:Q.UINT,[r.RGB16I]:Q.INT,[r.RGB16UI]:Q.UINT,[r.RGB32I]:Q.INT,[r.RGB32UI]:Q.UINT,[r.RGBA8I]:Q.INT,[r.RGBA8UI]:Q.UINT,[r.RGBA16I]:Q.INT,[r.RGBA16UI]:Q.UINT,[r.RGBA32I]:Q.INT,[r.RGBA32UI]:Q.UINT,[r.DEPTH_COMPONENT16]:Q.FLOAT,[r.DEPTH_COMPONENT24]:Q.FLOAT,[r.DEPTH_COMPONENT32F]:Q.FLOAT,[r.DEPTH_STENCIL]:Q.FLOAT,[r.DEPTH24_STENCIL8]:Q.FLOAT,[r.DEPTH32F_STENCIL8]:Q.FLOAT}:t={[r.RGB]:Q.FLOAT,[r.RGBA]:Q.FLOAT,[r.ALPHA]:Q.FLOAT,[r.LUMINANCE]:Q.FLOAT,[r.LUMINANCE_ALPHA]:Q.FLOAT,[r.DEPTH_STENCIL]:Q.FLOAT},t}function Kv(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[ht.UNSIGNED_BYTE]:{[K.RGBA]:r.RGBA8,[K.RGB]:r.RGB8,[K.RG]:r.RG8,[K.RED]:r.R8,[K.RGBA_INTEGER]:r.RGBA8UI,[K.RGB_INTEGER]:r.RGB8UI,[K.RG_INTEGER]:r.RG8UI,[K.RED_INTEGER]:r.R8UI,[K.ALPHA]:r.ALPHA,[K.LUMINANCE]:r.LUMINANCE,[K.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[ht.BYTE]:{[K.RGBA]:r.RGBA8_SNORM,[K.RGB]:r.RGB8_SNORM,[K.RG]:r.RG8_SNORM,[K.RED]:r.R8_SNORM,[K.RGBA_INTEGER]:r.RGBA8I,[K.RGB_INTEGER]:r.RGB8I,[K.RG_INTEGER]:r.RG8I,[K.RED_INTEGER]:r.R8I},[ht.UNSIGNED_SHORT]:{[K.RGBA_INTEGER]:r.RGBA16UI,[K.RGB_INTEGER]:r.RGB16UI,[K.RG_INTEGER]:r.RG16UI,[K.RED_INTEGER]:r.R16UI,[K.DEPTH_COMPONENT]:r.DEPTH_COMPONENT16},[ht.SHORT]:{[K.RGBA_INTEGER]:r.RGBA16I,[K.RGB_INTEGER]:r.RGB16I,[K.RG_INTEGER]:r.RG16I,[K.RED_INTEGER]:r.R16I},[ht.UNSIGNED_INT]:{[K.RGBA_INTEGER]:r.RGBA32UI,[K.RGB_INTEGER]:r.RGB32UI,[K.RG_INTEGER]:r.RG32UI,[K.RED_INTEGER]:r.R32UI,[K.DEPTH_COMPONENT]:r.DEPTH_COMPONENT24},[ht.INT]:{[K.RGBA_INTEGER]:r.RGBA32I,[K.RGB_INTEGER]:r.RGB32I,[K.RG_INTEGER]:r.RG32I,[K.RED_INTEGER]:r.R32I},[ht.FLOAT]:{[K.RGBA]:r.RGBA32F,[K.RGB]:r.RGB32F,[K.RG]:r.RG32F,[K.RED]:r.R32F,[K.DEPTH_COMPONENT]:r.DEPTH_COMPONENT32F},[ht.HALF_FLOAT]:{[K.RGBA]:r.RGBA16F,[K.RGB]:r.RGB16F,[K.RG]:r.RG16F,[K.RED]:r.R16F},[ht.UNSIGNED_SHORT_5_6_5]:{[K.RGB]:r.RGB565},[ht.UNSIGNED_SHORT_4_4_4_4]:{[K.RGBA]:r.RGBA4},[ht.UNSIGNED_SHORT_5_5_5_1]:{[K.RGBA]:r.RGB5_A1},[ht.UNSIGNED_INT_2_10_10_10_REV]:{[K.RGBA]:r.RGB10_A2,[K.RGBA_INTEGER]:r.RGB10_A2UI},[ht.UNSIGNED_INT_10F_11F_11F_REV]:{[K.RGB]:r.R11F_G11F_B10F},[ht.UNSIGNED_INT_5_9_9_9_REV]:{[K.RGB]:r.RGB9_E5},[ht.UNSIGNED_INT_24_8]:{[K.DEPTH_STENCIL]:r.DEPTH24_STENCIL8},[ht.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[K.DEPTH_STENCIL]:r.DEPTH32F_STENCIL8}}:t={[ht.UNSIGNED_BYTE]:{[K.RGBA]:r.RGBA,[K.RGB]:r.RGB,[K.ALPHA]:r.ALPHA,[K.LUMINANCE]:r.LUMINANCE,[K.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[ht.UNSIGNED_SHORT_5_6_5]:{[K.RGB]:r.RGB},[ht.UNSIGNED_SHORT_4_4_4_4]:{[K.RGBA]:r.RGBA},[ht.UNSIGNED_SHORT_5_5_5_1]:{[K.RGBA]:r.RGBA}},t}class Pm{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new gt,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=Kv(t),this.samplerTypes=Hv(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 Mc(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 Mc(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 o=e[n];o&&o._glTextures[s].samplerType!==Q.FLOAT&&this.renderer.texture.unbind(o)}}initTexture(t){const e=new Mc(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]??Q.FLOAT,this.webGLVersion===2&&t.type===ht.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!==Q.FLOAT&&(this.hasIntegerTextures=!0);else{const n=t.realWidth,o=t.realHeight,a=i.gl;(e.width!==n||e.height!==o||e.dirtyId<0)&&(e.width=n,e.height=o,a.texImage2D(t.target,0,e.internalFormat,n,o,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.dirtyId=t.dirtyId}destroyTexture(t,e){const{gl: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&&Ys(this.managedTextures,s,1)}}updateTextureStyle(t){var i;const e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===vi.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=_i.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!==vi.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===Yi.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);const s=this.renderer.context.extensions.anisotropicFiltering;if(s&&t.anisotropicLevel>0&&t.scaleMode===Yi.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===Yi.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(t.target,i.TEXTURE_MAG_FILTER,t.scaleMode===Yi.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}}Pm.extension={type:J.RendererSystem,name:"texture"},it.add(Pm);class Gm{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 o=0;o<t.buffers.length;o++){const a=t.buffers[o];a&&(i.buffer.update(a),a._glBuffers[s].refCount++,e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,o,a._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 o=0;o<t.buffers.length;o++){const a=t.buffers[o];if(!a)continue;const h=a._glBuffers[this.CONTEXT_UID];h&&(h.refCount--,h.refCount===0&&!e&&n.dispose(a,e))}i&&(e||s.deleteTransformFeedback(i),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}}Gm.extension={type:J.RendererSystem,name:"transformFeedback"},it.add(Gm);class Na{constructor(t){this.renderer=t}init(t){this.screen=new pt(0,0,t.width,t.height),this.element=t.view||q.ADAPTER.createCanvas(),this.resolution=t.resolution||q.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}}Na.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},Na.extension={type:[J.RendererSystem,J.CanvasRendererSystem],name:"_view"},it.add(Na),q.PREFER_ENV=Zr.WEBGL2,q.STRICT_TEXTURE_CACHE=!1,q.RENDER_OPTIONS={...Ma.defaultOptions,...Ra.defaultOptions,...Na.defaultOptions,...Fa.defaultOptions},Object.defineProperties(q,{WRAP_MODE:{get(){return gt.defaultOptions.wrapMode},set(r){Tt("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),gt.defaultOptions.wrapMode=r}},SCALE_MODE:{get(){return gt.defaultOptions.scaleMode},set(r){Tt("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),gt.defaultOptions.scaleMode=r}},MIPMAP_TEXTURES:{get(){return gt.defaultOptions.mipmap},set(r){Tt("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),gt.defaultOptions.mipmap=r}},ANISOTROPIC_LEVEL:{get(){return gt.defaultOptions.anisotropicLevel},set(r){Tt("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),gt.defaultOptions.anisotropicLevel=r}},FILTER_RESOLUTION:{get(){return Tt("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),_e.defaultResolution},set(r){_e.defaultResolution=r}},FILTER_MULTISAMPLE:{get(){return Tt("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),_e.defaultMultisample},set(r){_e.defaultMultisample=r}},SPRITE_MAX_TEXTURES:{get(){return ts.defaultMaxTextures},set(r){Tt("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),ts.defaultMaxTextures=r}},SPRITE_BATCH_SIZE:{get(){return ts.defaultBatchSize},set(r){Tt("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),ts.defaultBatchSize=r}},CAN_UPLOAD_SAME_BUFFER:{get(){return ts.canUploadSameBuffer},set(r){Tt("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),ts.canUploadSameBuffer=r}},GC_MODE:{get(){return rs.defaultMode},set(r){Tt("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),rs.defaultMode=r}},GC_MAX_IDLE:{get(){return rs.defaultMaxIdle},set(r){Tt("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),rs.defaultMaxIdle=r}},GC_MAX_CHECK_COUNT:{get(){return rs.defaultCheckCountMax},set(r){Tt("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),rs.defaultCheckCountMax=r}},PRECISION_VERTEX:{get(){return er.defaultVertexPrecision},set(r){Tt("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),er.defaultVertexPrecision=r}},PRECISION_FRAGMENT:{get(){return er.defaultFragmentPrecision},set(r){Tt("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),er.defaultFragmentPrecision=r}}});var ss=(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))(ss||{});class Lc{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 Fm=class He{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 Lc(null,null,1/0),this.deltaMS=1/He.targetFPMS,this.elapsedMS=1/He.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=ss.NORMAL){return this._addListener(new Lc(t,e,i))}addOnce(t,e,i=ss.NORMAL){return this._addListener(new Lc(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*He.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,He.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(!He._shared){const t=He._shared=new He;t.autoStart=!0,t._protected=!0}return He._shared}static get system(){if(!He._system){const t=He._system=new He;t.autoStart=!0,t._protected=!0}return He._system}};Fm.targetFPMS=.06;let ve=Fm;Object.defineProperties(q,{TARGET_FPMS:{get(){return ve.targetFPMS},set(r){Tt("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),ve.targetFPMS=r}}});class Nm{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,ss.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?ve.shared:new ve,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}Nm.extension=J.Application,it.add(Nm);const Dm=[];it.handleByList(J.Renderer,Dm);function Yv(r){for(const t of Dm)if(t.test(r))return new t(r);throw new Error("Unable to auto-detect a suitable renderer.")}var zv=`attribute vec2 aVertexPosition;
|
|
490
490
|
attribute vec2 aTextureCoord;
|
|
491
491
|
|
|
492
492
|
uniform mat3 projectionMatrix;
|
|
@@ -497,7 +497,7 @@ void main(void)
|
|
|
497
497
|
{
|
|
498
498
|
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
499
499
|
vTextureCoord = aTextureCoord;
|
|
500
|
-
}`,
|
|
500
|
+
}`,jv=`attribute vec2 aVertexPosition;
|
|
501
501
|
|
|
502
502
|
uniform mat3 projectionMatrix;
|
|
503
503
|
|
|
@@ -523,7 +523,7 @@ void main(void)
|
|
|
523
523
|
gl_Position = filterVertexPosition();
|
|
524
524
|
vTextureCoord = filterTextureCoord();
|
|
525
525
|
}
|
|
526
|
-
`;const jv=Yv,km=zv;class Om{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>=jt.HIGH?this.multisample=jt.HIGH:e>=jt.MEDIUM?this.multisample=jt.MEDIUM:e>=jt.LOW?this.multisample=jt.LOW:this.multisample=jt.NONE}destroy(){}}Om.extension={type:J.RendererSystem,name:"_multisample"},it.add(Om);class Jv{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class Bm{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 o=t._glBuffers[n]||this.createGLBuffer(t);s.bindBufferRange(s.UNIFORM_BUFFER,e||0,o.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 Jv(i.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}}Bm.extension={type:J.RendererSystem,name:"buffer"},it.add(Bm);class Wm{constructor(t){this.renderer=t}render(t,e){const i=this.renderer;let s,n,o,a;if(e&&(s=e.renderTexture,n=e.clear,o=e.transform,a=e.skipUpdateTransform),this.renderingToScreen=!s,i.runners.prerender.emit(),i.emit("prerender"),i.projection.transform=o,!i.context.isLost){if(s||(this.lastObjectRendered=t),!a){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}}Wm.extension={type:J.RendererSystem,name:"objectRenderer"},it.add(Wm);const Da=class xf extends Zv{constructor(t){super(),this.type=If.WEBGL,t=Object.assign({},q.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new oi({projectionMatrix:new Nt},!0);const e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:xf.__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&&(Tt("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=xf.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t!=null&&t.forceCanvas?!1:x1()}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 Tt("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return Tt("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return Tt("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return Tt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){Tt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return Tt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){Tt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return Tt("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)}};Da.extension={type:J.Renderer,priority:1},Da.__plugins={},Da.__systems={};let Pc=Da;it.handleByMap(J.RendererPlugin,Pc.__plugins),it.handleByMap(J.RendererSystem,Pc.__systems),it.add(Pc);class Um extends zn{constructor(t,e){const{width:i,height:s}=e||{};super(i,s),this.items=[],this.itemDirtyIds=[];for(let n=0;n<t;n++){const o=new gt;this.items.push(o),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 zn?this.addResourceAt(t[i],i):this.addResourceAt(zp(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 $v extends Um{constructor(t,e){const{width:i,height:s}=e||{};let n,o;Array.isArray(t)?(n=t,o=t.length):o=t,super(o,{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=Fs.TEXTURE_2D_ARRAY}upload(t,e,i){const{length:s,itemDirtyIds:n,items:o}=this,{gl:a}=t;i.dirtyId<0&&a.texImage3D(a.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=o[h];n[h]<l.dirtyId&&(n[h]=l.dirtyId,l.valid&&a.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,h,l.resource.width,l.resource.height,1,e.format,i.type,l.resource.source))}return!0}}class Qv extends Tr{constructor(t){super(t)}static test(t){const{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}}const Xm=class Jo extends Um{constructor(t,e){const{width:i,height:s,autoLoad:n,linkBaseTexture:o}=e||{};if(t&&t.length!==Jo.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:i,height:s});for(let a=0;a<Jo.SIDES;a++)this.items[a].target=Fs.TEXTURE_CUBE_MAP_POSITIVE_X+a;this.linkBaseTexture=o!==!1,t&&this.initFromArray(t,e),n!==!1&&this.load()}bind(t){super.bind(t),t.target=Fs.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=Fs.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<Jo.SIDES;n++){const o=this.items[n];(s[n]<o.dirtyId||i.dirtyId<e.dirtyId)&&(o.valid&&o.resource?(o.resource.upload(t,o,i),s[n]=o.dirtyId):s[n]<-1&&(t.gl.texImage2D(o.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===Jo.SIDES}};Xm.SIDES=6;let qv=Xm;class Js extends Tr{constructor(t,e){e=e||{};let i,s,n;typeof t=="string"?(i=Js.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 q.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===Se.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 Js._EMPTY=Js._EMPTY??q.ADAPTER.createCanvas(0,0),Js._EMPTY}}const Gc=class gl extends Tr{constructor(t,e){e=e||{},super(q.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)},gl.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;Tr.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 o=this.source;o.width=s,o.height=n,o._pixiId=`canvas_${zr()}`,o.getContext("2d").drawImage(t,0,0,e,i,0,0,s,n),this._resolve(),this._resolve=null}}static getSize(t){const e=gl.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"&&gl.SVG_XML.test(t)}};Gc.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,Gc.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let Fc=Gc;const Nc=class _f extends Tr{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];Tr.crossOrigin(i,s,e.crossorigin);for(let n=0;n<t.length;++n){const o=document.createElement("source");let{src:a,mime:h}=t[n];if(a=a||t[n],a.startsWith("data:"))h=a.slice(5,a.indexOf(";"));else if(!a.startsWith("blob:")){const l=a.split("?").shift().toLowerCase(),c=l.slice(l.lastIndexOf(".")+1);h=h||_f.MIME_TYPES[c]||`video/${c}`}o.src=a,h&&(o.type=h),i.appendChild(o)}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=ve.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&&(ve.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||(ve.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(ve.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||_f.TYPES.includes(e)}};Nc.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Nc.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let Zm=Nc;gc.push(Js,lm,Qv,Zm,Fc,ya,qv,$v);class ka{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?pt.EMPTY:(t=t||new pt(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:o,tx:a,ty:h}=t,l=i*e.x+n*e.y+a,c=s*e.x+o*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,o=t[0],a=t[1];e=o<e?o:e,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,o=t[2],a=t[3],e=o<e?o:e,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,o=t[4],a=t[5],e=o<e?o:e,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,o=t[6],a=t[7],e=o<e?o:e,i=a<i?a:i,s=o>s?o:s,n=a>n?a: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 o=t.a,a=t.b,h=t.c,l=t.d,c=t.tx,u=t.ty;let d=this.minX,f=this.minY,m=this.maxX,p=this.maxY,g=o*e+h*i+c,y=a*e+l*i+u;d=g<d?g:d,f=y<f?y:f,m=g>m?g:m,p=y>p?y:p,g=o*s+h*i+c,y=a*s+l*i+u,d=g<d?g:d,f=y<f?y:f,m=g>m?g:m,p=y>p?y:p,g=o*e+h*n+c,y=a*e+l*n+u,d=g<d?g:d,f=y<f?y:f,m=g>m?g:m,p=y>p?y:p,g=o*s+h*n+c,y=a*s+l*n+u,d=g<d?g:d,f=y<f?y:f,m=g>m?g:m,p=y>p?y:p,this.minX=d,this.minY=f,this.maxX=m,this.maxY=p}addVertexData(t,e,i){let s=this.minX,n=this.minY,o=this.maxX,a=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,o=l>o?l:o,a=c>a?c:a}this.minX=s,this.minY=n,this.maxX=o,this.maxY=a}addVertices(t,e,i,s){this.addVerticesMatrix(t.worldTransform,e,i,s)}addVerticesMatrix(t,e,i,s,n=0,o=n){const a=t.a,h=t.b,l=t.c,c=t.d,u=t.tx,d=t.ty;let f=this.minX,m=this.minY,p=this.maxX,g=this.maxY;for(let y=i;y<s;y+=2){const _=e[y],b=e[y+1],v=a*_+l*b+u,w=c*b+h*_+d;f=Math.min(f,v-n),p=Math.max(p,v+n),m=Math.min(m,w-o),g=Math.max(g,w+o)}this.minX=f,this.minY=m,this.maxX=p,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,o=t.maxY<e.maxY?t.maxY:e.maxY;if(i<=n&&s<=o){const a=this.minX,h=this.minY,l=this.maxX,c=this.maxY;this.minX=i<a?i:a,this.minY=s<h?s:h,this.maxX=n>l?n:l,this.maxY=o>c?o:c}}addBoundsMatrix(t,e){this.addFrameMatrix(e,t.minX,t.minY,t.maxX,t.maxY)}addBoundsArea(t,e){const 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,o=t.maxY<e.y+e.height?t.maxY:e.y+e.height;if(i<=n&&s<=o){const a=this.minX,h=this.minY,l=this.maxX,c=this.maxY;this.minX=i<a?i:a,this.minY=s<h?s:h,this.maxX=n>l?n:l,this.maxY=o>c?o:c}}pad(t=0,e=t){this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e)}addFramePad(t,e,i,s,n,o){t-=n,e-=o,i+=n,s+=o,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 Wt extends kn{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new vc,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 ka,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(Wt.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 pt),e=this._boundsRect),this._bounds.getRectangle(e)}getLocalBounds(t){t||(this._localBoundsRect||(this._localBoundsRect=new pt),t=this._localBoundsRect),this._localBounds||(this._localBounds=new ka);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 o=this.getBounds(!1,t);return this.parent=i,this.transform=e,this._bounds=s,this._bounds.updateID+=this._boundsID-n,o}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,o=0,a=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=o,this.skew.y=a,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 tT),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*Y1}set angle(t){this.transform.rotation=t*z1}get zIndex(){return this._zIndex}set zIndex(t){this._zIndex=t,this.parent&&(this.parent.sortDirty=!0)}get worldVisible(){let t=this;do{if(!t.visible)return!1;t=t.parent}while(t);return!0}get mask(){return this._mask}set mask(t){if(this._mask!==t){if(this._mask){const e=this._mask.isMaskData?this._mask.maskObject:this._mask;e&&(e._maskRefCount--,e._maskRefCount===0&&(e.renderable=!0,e.isMask=!1))}if(this._mask=t,this._mask){const e=this._mask.isMaskData?this._mask.maskObject:this._mask;e&&(e._maskRefCount===0&&(e.renderable=!1,e.isMask=!0),e._maskRefCount++)}}}}class tT extends Wt{constructor(){super(...arguments),this.sortDirty=null}}Wt.prototype.displayObjectUpdateTransform=Wt.prototype.updateTransform;const eT=new Nt;function iT(r,t){return r.zIndex===t.zIndex?r._lastSortedIndex-t._lastSortedIndex:r.zIndex-t.zIndex}const Vm=class vf extends Wt{constructor(){super(),this.children=[],this.sortableChildren=vf.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);Ys(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,Ys(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,Ys(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 o;if(n>0&&n<=s){o=this.children.splice(i,n);for(let a=0;a<o.length;++a)o[a].parent=null,o[a].transform&&(o[a].transform._parentID=-1);this._boundsID++,this.onChildrenChange(t);for(let a=0;a<o.length;++a)o[a].emit("removed",this),this.emit("childRemoved",o[a],this,a);return o}else if(n===0&&this.children.length===0)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")}sortChildren(){let t=!1;for(let e=0,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(iT),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 o=this.children[s];o.visible&&o.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!==vf.prototype._render&&(i=this.getBounds(!0));const n=t.projection.transform;if(n&&(s?(s=eT.copyFrom(s),s.prepend(n)):s=n),i&&e.intersects(i,s))this._render(t);else if(this.cullArea)return;for(let o=0,a=this.children.length;o<a;++o){const h=this.children[o],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,o,a;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!==$t.NONE));if(s&&t.batch.flush(),e&&((o=this._enabledFilters)!=null&&o.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&&((a=this._enabledFilters)!=null&&a.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}};Vm.defaultSortableChildren=!1;let At=Vm;At.prototype.containerUpdateTransform=At.prototype.updateTransform,Object.defineProperties(q,{SORTABLE_CHILDREN:{get(){return At.defaultSortableChildren},set(r){Tt("7.1.0","settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),At.defaultSortableChildren=r}}});const qn=new ut,rT=new Uint16Array([0,1,2,0,2,3]);class qt extends At{constructor(t){super(),this._anchor=new tr(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 Ft(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=ft.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=t||rt.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=rT,this.pluginName="batch",this.isSprite=!0,this._roundPixels=q.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=xr(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=xr(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,o=e.d,a=e.tx,h=e.ty,l=this.vertexData,c=t.trim,u=t.orig,d=this._anchor;let f=0,m=0,p=0,g=0;if(c?(m=c.x-d._x*u.width,f=m+c.width,g=c.y-d._y*u.height,p=g+c.height):(m=-d._x*u.width,f=m+u.width,g=-d._y*u.height,p=g+u.height),l[0]=i*m+n*g+a,l[1]=o*g+s*m+h,l[2]=i*f+n*g+a,l[3]=o*g+s*f+h,l[4]=i*f+n*p+a,l[5]=o*p+s*f+h,l[6]=i*m+n*p+a,l[7]=o*p+s*m+h,this._roundPixels){const y=q.RESOLUTION;for(let _=0;_<l.length;++_)l[_]=Math.round(l[_]*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,o=n.a,a=n.b,h=n.c,l=n.d,c=n.tx,u=n.ty,d=-s._x*i.width,f=d+i.width,m=-s._y*i.height,p=m+i.height;if(e[0]=o*d+h*m+c,e[1]=l*m+a*d+u,e[2]=o*f+h*m+c,e[3]=l*m+a*f+u,e[4]=o*f+h*p+c,e[5]=l*p+a*f+u,e[6]=o*d+h*p+c,e[7]=l*p+a*d+u,this._roundPixels){const g=q.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 ka),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 pt),t=this._localBoundsRect),this._localBounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,qn);const e=this._texture.orig.width,i=this._texture.orig.height,s=-e*this.anchor.x;let n=0;return qn.x>=s&&qn.x<s+e&&(n=-i*this.anchor.y,qn.y>=n&&qn.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 rt?t:rt.from(t,e);return new qt(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=xr(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=xr(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||rt.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))}}const Hm=new Nt;Wt.prototype._cacheAsBitmap=!1,Wt.prototype._cacheData=null,Wt.prototype._cacheAsBitmapResolution=null,Wt.prototype._cacheAsBitmapMultisample=null;class sT{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(Wt.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 sT),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)}}}),Wt.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))},Wt.prototype._initCachedDisplayObject=function(r){var d,f;if((d=this._cacheData)!=null&&d.sprite)return;const t=this.alpha;this.alpha=1,r.batch.flush();const e=this.getLocalBounds(new pt,!0);if((f=this.filters)!=null&&f.length){const m=this.filters[0].padding;e.pad(m)}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(),o=r.renderTexture.destinationFrame.clone(),a=r.projection.transform,h=es.create({width:e.width,height:e.height,resolution:i,multisample:this.cacheAsBitmapMultisample??r.multisample}),l=`cacheAsBitmap_${zr()}`;this._cacheData.textureCacheId=l,gt.addToCache(h.baseTexture,l),rt.addToCache(h,l);const c=this.transform.localTransform.copyTo(Hm).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=a,r.renderTexture.bind(s,n,o),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=t;const u=new qt(h);u.transform.worldTransform=this.transform.worldTransform,u.anchor.x=-(e.x/e.width),u.anchor.y=-(e.y/e.height),u.alpha=t,u._bounds=this._bounds,this._cacheData.sprite=u,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=u.containsPoint.bind(u)},Wt.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))},Wt.prototype._initCachedDisplayObjectCanvas=function(r){var c;if((c=this._cacheData)!=null&&c.sprite)return;const t=this.getLocalBounds(new pt,!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 o=es.create({width:t.width,height:t.height,resolution:n}),a=`cacheAsBitmap_${zr()}`;this._cacheData.textureCacheId=a,gt.addToCache(o.baseTexture,a),rt.addToCache(o,a);const h=Hm;this.transform.localTransform.copyTo(h),h.invert(),h.tx-=t.x,h.ty-=t.y,this.renderCanvas=this._cacheData.originalRenderCanvas,r.render(this,{renderTexture:o,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 qt(o);l.transform.worldTransform=this.transform.worldTransform,l.anchor.x=-(t.x/t.width),l.anchor.y=-(t.y/t.height),l.alpha=e,l._bounds=this._bounds,this._cacheData.sprite=l,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=r._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=l.containsPoint.bind(l)},Wt.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},Wt.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},Wt.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,gt.removeFromCache(this._cacheData.textureCacheId),rt.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},Wt.prototype._cacheAsBitmapDestroy=function(r){this.cacheAsBitmap=!1,this.destroy(r)},Wt.prototype.name=null,At.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},Wt.prototype.getGlobalPosition=function(r=new ut,t=!1){return this.parent?this.parent.toGlobal(this.position,r,t):(r.x=this.position.x,r.y=this.position.y),r};var nT=`varying vec2 vTextureCoord;
|
|
526
|
+
`;const Jv=zv,km=jv;class Om{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>=jt.HIGH?this.multisample=jt.HIGH:e>=jt.MEDIUM?this.multisample=jt.MEDIUM:e>=jt.LOW?this.multisample=jt.LOW:this.multisample=jt.NONE}destroy(){}}Om.extension={type:J.RendererSystem,name:"_multisample"},it.add(Om);class $v{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class Bm{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 o=t._glBuffers[n]||this.createGLBuffer(t);s.bindBufferRange(s.UNIFORM_BUFFER,e||0,o.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 $v(i.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}}Bm.extension={type:J.RendererSystem,name:"buffer"},it.add(Bm);class Wm{constructor(t){this.renderer=t}render(t,e){const i=this.renderer;let s,n,o,a;if(e&&(s=e.renderTexture,n=e.clear,o=e.transform,a=e.skipUpdateTransform),this.renderingToScreen=!s,i.runners.prerender.emit(),i.emit("prerender"),i.projection.transform=o,!i.context.isLost){if(s||(this.lastObjectRendered=t),!a){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}}Wm.extension={type:J.RendererSystem,name:"objectRenderer"},it.add(Wm);const Da=class xf extends Vv{constructor(t){super(),this.type=If.WEBGL,t=Object.assign({},q.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new oi({projectionMatrix:new Nt},!0);const e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:xf.__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&&(Tt("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=xf.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t!=null&&t.forceCanvas?!1:_1()}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 Tt("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return Tt("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return Tt("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return Tt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){Tt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return Tt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){Tt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return Tt("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)}};Da.extension={type:J.Renderer,priority:1},Da.__plugins={},Da.__systems={};let Pc=Da;it.handleByMap(J.RendererPlugin,Pc.__plugins),it.handleByMap(J.RendererSystem,Pc.__systems),it.add(Pc);class Um extends Jn{constructor(t,e){const{width:i,height:s}=e||{};super(i,s),this.items=[],this.itemDirtyIds=[];for(let n=0;n<t;n++){const o=new gt;this.items.push(o),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 Jn?this.addResourceAt(t[i],i):this.addResourceAt(zp(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 Qv extends Um{constructor(t,e){const{width:i,height:s}=e||{};let n,o;Array.isArray(t)?(n=t,o=t.length):o=t,super(o,{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=Fs.TEXTURE_2D_ARRAY}upload(t,e,i){const{length:s,itemDirtyIds:n,items:o}=this,{gl:a}=t;i.dirtyId<0&&a.texImage3D(a.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=o[h];n[h]<l.dirtyId&&(n[h]=l.dirtyId,l.valid&&a.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,h,l.resource.width,l.resource.height,1,e.format,i.type,l.resource.source))}return!0}}class qv extends Tr{constructor(t){super(t)}static test(t){const{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}}const Xm=class Jo extends Um{constructor(t,e){const{width:i,height:s,autoLoad:n,linkBaseTexture:o}=e||{};if(t&&t.length!==Jo.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:i,height:s});for(let a=0;a<Jo.SIDES;a++)this.items[a].target=Fs.TEXTURE_CUBE_MAP_POSITIVE_X+a;this.linkBaseTexture=o!==!1,t&&this.initFromArray(t,e),n!==!1&&this.load()}bind(t){super.bind(t),t.target=Fs.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=Fs.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<Jo.SIDES;n++){const o=this.items[n];(s[n]<o.dirtyId||i.dirtyId<e.dirtyId)&&(o.valid&&o.resource?(o.resource.upload(t,o,i),s[n]=o.dirtyId):s[n]<-1&&(t.gl.texImage2D(o.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===Jo.SIDES}};Xm.SIDES=6;let tT=Xm;class Js extends Tr{constructor(t,e){e=e||{};let i,s,n;typeof t=="string"?(i=Js.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 q.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===Se.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 Js._EMPTY=Js._EMPTY??q.ADAPTER.createCanvas(0,0),Js._EMPTY}}const Gc=class gl extends Tr{constructor(t,e){e=e||{},super(q.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)},gl.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;Tr.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 o=this.source;o.width=s,o.height=n,o._pixiId=`canvas_${zr()}`,o.getContext("2d").drawImage(t,0,0,e,i,0,0,s,n),this._resolve(),this._resolve=null}}static getSize(t){const e=gl.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"&&gl.SVG_XML.test(t)}};Gc.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,Gc.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let Fc=Gc;const Nc=class _f extends Tr{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];Tr.crossOrigin(i,s,e.crossorigin);for(let n=0;n<t.length;++n){const o=document.createElement("source");let{src:a,mime:h}=t[n];if(a=a||t[n],a.startsWith("data:"))h=a.slice(5,a.indexOf(";"));else if(!a.startsWith("blob:")){const l=a.split("?").shift().toLowerCase(),c=l.slice(l.lastIndexOf(".")+1);h=h||_f.MIME_TYPES[c]||`video/${c}`}o.src=a,h&&(o.type=h),i.appendChild(o)}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=ve.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&&(ve.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||(ve.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(ve.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||_f.TYPES.includes(e)}};Nc.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Nc.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let Zm=Nc;gc.push(Js,lm,qv,Zm,Fc,ya,tT,Qv);class ka{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?pt.EMPTY:(t=t||new pt(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:o,tx:a,ty:h}=t,l=i*e.x+n*e.y+a,c=s*e.x+o*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,o=t[0],a=t[1];e=o<e?o:e,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,o=t[2],a=t[3],e=o<e?o:e,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,o=t[4],a=t[5],e=o<e?o:e,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,o=t[6],a=t[7],e=o<e?o:e,i=a<i?a:i,s=o>s?o:s,n=a>n?a: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 o=t.a,a=t.b,h=t.c,l=t.d,c=t.tx,u=t.ty;let d=this.minX,f=this.minY,m=this.maxX,p=this.maxY,g=o*e+h*i+c,y=a*e+l*i+u;d=g<d?g:d,f=y<f?y:f,m=g>m?g:m,p=y>p?y:p,g=o*s+h*i+c,y=a*s+l*i+u,d=g<d?g:d,f=y<f?y:f,m=g>m?g:m,p=y>p?y:p,g=o*e+h*n+c,y=a*e+l*n+u,d=g<d?g:d,f=y<f?y:f,m=g>m?g:m,p=y>p?y:p,g=o*s+h*n+c,y=a*s+l*n+u,d=g<d?g:d,f=y<f?y:f,m=g>m?g:m,p=y>p?y:p,this.minX=d,this.minY=f,this.maxX=m,this.maxY=p}addVertexData(t,e,i){let s=this.minX,n=this.minY,o=this.maxX,a=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,o=l>o?l:o,a=c>a?c:a}this.minX=s,this.minY=n,this.maxX=o,this.maxY=a}addVertices(t,e,i,s){this.addVerticesMatrix(t.worldTransform,e,i,s)}addVerticesMatrix(t,e,i,s,n=0,o=n){const a=t.a,h=t.b,l=t.c,c=t.d,u=t.tx,d=t.ty;let f=this.minX,m=this.minY,p=this.maxX,g=this.maxY;for(let y=i;y<s;y+=2){const _=e[y],b=e[y+1],v=a*_+l*b+u,w=c*b+h*_+d;f=Math.min(f,v-n),p=Math.max(p,v+n),m=Math.min(m,w-o),g=Math.max(g,w+o)}this.minX=f,this.minY=m,this.maxX=p,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,o=t.maxY<e.maxY?t.maxY:e.maxY;if(i<=n&&s<=o){const a=this.minX,h=this.minY,l=this.maxX,c=this.maxY;this.minX=i<a?i:a,this.minY=s<h?s:h,this.maxX=n>l?n:l,this.maxY=o>c?o:c}}addBoundsMatrix(t,e){this.addFrameMatrix(e,t.minX,t.minY,t.maxX,t.maxY)}addBoundsArea(t,e){const 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,o=t.maxY<e.y+e.height?t.maxY:e.y+e.height;if(i<=n&&s<=o){const a=this.minX,h=this.minY,l=this.maxX,c=this.maxY;this.minX=i<a?i:a,this.minY=s<h?s:h,this.maxX=n>l?n:l,this.maxY=o>c?o:c}}pad(t=0,e=t){this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e)}addFramePad(t,e,i,s,n,o){t-=n,e-=o,i+=n,s+=o,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 Ut extends Bn{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new vc,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 ka,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(Ut.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 pt),e=this._boundsRect),this._bounds.getRectangle(e)}getLocalBounds(t){t||(this._localBoundsRect||(this._localBoundsRect=new pt),t=this._localBoundsRect),this._localBounds||(this._localBounds=new ka);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 o=this.getBounds(!1,t);return this.parent=i,this.transform=e,this._bounds=s,this._bounds.updateID+=this._boundsID-n,o}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,o=0,a=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=o,this.skew.y=a,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 eT),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*z1}set angle(t){this.transform.rotation=t*j1}get zIndex(){return this._zIndex}set zIndex(t){this._zIndex=t,this.parent&&(this.parent.sortDirty=!0)}get worldVisible(){let t=this;do{if(!t.visible)return!1;t=t.parent}while(t);return!0}get mask(){return this._mask}set mask(t){if(this._mask!==t){if(this._mask){const e=this._mask.isMaskData?this._mask.maskObject:this._mask;e&&(e._maskRefCount--,e._maskRefCount===0&&(e.renderable=!0,e.isMask=!1))}if(this._mask=t,this._mask){const e=this._mask.isMaskData?this._mask.maskObject:this._mask;e&&(e._maskRefCount===0&&(e.renderable=!1,e.isMask=!0),e._maskRefCount++)}}}}class eT extends Ut{constructor(){super(...arguments),this.sortDirty=null}}Ut.prototype.displayObjectUpdateTransform=Ut.prototype.updateTransform;const iT=new Nt;function rT(r,t){return r.zIndex===t.zIndex?r._lastSortedIndex-t._lastSortedIndex:r.zIndex-t.zIndex}const Vm=class vf extends Ut{constructor(){super(),this.children=[],this.sortableChildren=vf.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);Ys(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,Ys(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,Ys(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 o;if(n>0&&n<=s){o=this.children.splice(i,n);for(let a=0;a<o.length;++a)o[a].parent=null,o[a].transform&&(o[a].transform._parentID=-1);this._boundsID++,this.onChildrenChange(t);for(let a=0;a<o.length;++a)o[a].emit("removed",this),this.emit("childRemoved",o[a],this,a);return o}else if(n===0&&this.children.length===0)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")}sortChildren(){let t=!1;for(let e=0,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(rT),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 o=this.children[s];o.visible&&o.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!==vf.prototype._render&&(i=this.getBounds(!0));const n=t.projection.transform;if(n&&(s?(s=iT.copyFrom(s),s.prepend(n)):s=n),i&&e.intersects(i,s))this._render(t);else if(this.cullArea)return;for(let o=0,a=this.children.length;o<a;++o){const h=this.children[o],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,o,a;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!==$t.NONE));if(s&&t.batch.flush(),e&&((o=this._enabledFilters)!=null&&o.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&&((a=this._enabledFilters)!=null&&a.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}};Vm.defaultSortableChildren=!1;let At=Vm;At.prototype.containerUpdateTransform=At.prototype.updateTransform,Object.defineProperties(q,{SORTABLE_CHILDREN:{get(){return At.defaultSortableChildren},set(r){Tt("7.1.0","settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),At.defaultSortableChildren=r}}});const eo=new ut,sT=new Uint16Array([0,1,2,0,2,3]);class qt extends At{constructor(t){super(),this._anchor=new tr(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 Ft(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=ft.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=t||rt.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=sT,this.pluginName="batch",this.isSprite=!0,this._roundPixels=q.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=xr(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=xr(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,o=e.d,a=e.tx,h=e.ty,l=this.vertexData,c=t.trim,u=t.orig,d=this._anchor;let f=0,m=0,p=0,g=0;if(c?(m=c.x-d._x*u.width,f=m+c.width,g=c.y-d._y*u.height,p=g+c.height):(m=-d._x*u.width,f=m+u.width,g=-d._y*u.height,p=g+u.height),l[0]=i*m+n*g+a,l[1]=o*g+s*m+h,l[2]=i*f+n*g+a,l[3]=o*g+s*f+h,l[4]=i*f+n*p+a,l[5]=o*p+s*f+h,l[6]=i*m+n*p+a,l[7]=o*p+s*m+h,this._roundPixels){const y=q.RESOLUTION;for(let _=0;_<l.length;++_)l[_]=Math.round(l[_]*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,o=n.a,a=n.b,h=n.c,l=n.d,c=n.tx,u=n.ty,d=-s._x*i.width,f=d+i.width,m=-s._y*i.height,p=m+i.height;if(e[0]=o*d+h*m+c,e[1]=l*m+a*d+u,e[2]=o*f+h*m+c,e[3]=l*m+a*f+u,e[4]=o*f+h*p+c,e[5]=l*p+a*f+u,e[6]=o*d+h*p+c,e[7]=l*p+a*d+u,this._roundPixels){const g=q.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 ka),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 pt),t=this._localBoundsRect),this._localBounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,eo);const e=this._texture.orig.width,i=this._texture.orig.height,s=-e*this.anchor.x;let n=0;return eo.x>=s&&eo.x<s+e&&(n=-i*this.anchor.y,eo.y>=n&&eo.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 rt?t:rt.from(t,e);return new qt(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=xr(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=xr(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||rt.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))}}const Hm=new Nt;Ut.prototype._cacheAsBitmap=!1,Ut.prototype._cacheData=null,Ut.prototype._cacheAsBitmapResolution=null,Ut.prototype._cacheAsBitmapMultisample=null;class nT{constructor(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null}}Object.defineProperties(Ut.prototype,{cacheAsBitmapResolution:{get(){return this._cacheAsBitmapResolution},set(r){r!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=r,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get(){return this._cacheAsBitmapMultisample},set(r){r!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=r,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get(){return this._cacheAsBitmap},set(r){if(this._cacheAsBitmap===r)return;this._cacheAsBitmap=r;let t;r?(this._cacheData||(this._cacheData=new nT),t=this._cacheData,t.originalRender=this.render,t.originalRenderCanvas=this.renderCanvas,t.originalUpdateTransform=this.updateTransform,t.originalCalculateBounds=this.calculateBounds,t.originalGetLocalBounds=this.getLocalBounds,t.originalDestroy=this.destroy,t.originalContainsPoint=this.containsPoint,t.originalMask=this._mask,t.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):(t=this._cacheData,t.sprite&&this._destroyCachedDisplayObject(),this.render=t.originalRender,this.renderCanvas=t.originalRenderCanvas,this.calculateBounds=t.originalCalculateBounds,this.getLocalBounds=t.originalGetLocalBounds,this.destroy=t.originalDestroy,this.updateTransform=t.originalUpdateTransform,this.containsPoint=t.originalContainsPoint,this._mask=t.originalMask,this.filterArea=t.originalFilterArea)}}}),Ut.prototype._renderCached=function(r){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(r),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(r))},Ut.prototype._initCachedDisplayObject=function(r){var d,f;if((d=this._cacheData)!=null&&d.sprite)return;const t=this.alpha;this.alpha=1,r.batch.flush();const e=this.getLocalBounds(new pt,!0);if((f=this.filters)!=null&&f.length){const m=this.filters[0].padding;e.pad(m)}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(),o=r.renderTexture.destinationFrame.clone(),a=r.projection.transform,h=es.create({width:e.width,height:e.height,resolution:i,multisample:this.cacheAsBitmapMultisample??r.multisample}),l=`cacheAsBitmap_${zr()}`;this._cacheData.textureCacheId=l,gt.addToCache(h.baseTexture,l),rt.addToCache(h,l);const c=this.transform.localTransform.copyTo(Hm).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=a,r.renderTexture.bind(s,n,o),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=t;const u=new qt(h);u.transform.worldTransform=this.transform.worldTransform,u.anchor.x=-(e.x/e.width),u.anchor.y=-(e.y/e.height),u.alpha=t,u._bounds=this._bounds,this._cacheData.sprite=u,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=u.containsPoint.bind(u)},Ut.prototype._renderCachedCanvas=function(r){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(r),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(r))},Ut.prototype._initCachedDisplayObjectCanvas=function(r){var c;if((c=this._cacheData)!=null&&c.sprite)return;const t=this.getLocalBounds(new pt,!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 o=es.create({width:t.width,height:t.height,resolution:n}),a=`cacheAsBitmap_${zr()}`;this._cacheData.textureCacheId=a,gt.addToCache(o.baseTexture,a),rt.addToCache(o,a);const h=Hm;this.transform.localTransform.copyTo(h),h.invert(),h.tx-=t.x,h.ty-=t.y,this.renderCanvas=this._cacheData.originalRenderCanvas,r.render(this,{renderTexture:o,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 qt(o);l.transform.worldTransform=this.transform.worldTransform,l.anchor.x=-(t.x/t.width),l.anchor.y=-(t.y/t.height),l.alpha=e,l._bounds=this._bounds,this._cacheData.sprite=l,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=r._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=l.containsPoint.bind(l)},Ut.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},Ut.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},Ut.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,gt.removeFromCache(this._cacheData.textureCacheId),rt.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},Ut.prototype._cacheAsBitmapDestroy=function(r){this.cacheAsBitmap=!1,this.destroy(r)},Ut.prototype.name=null,At.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},Ut.prototype.getGlobalPosition=function(r=new ut,t=!1){return this.parent?this.parent.toGlobal(this.position,r,t):(r.x=this.position.x,r.y=this.position.y),r};var oT=`varying vec2 vTextureCoord;
|
|
527
527
|
|
|
528
528
|
uniform sampler2D uSampler;
|
|
529
529
|
uniform float uAlpha;
|
|
@@ -532,9 +532,9 @@ void main(void)
|
|
|
532
532
|
{
|
|
533
533
|
gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;
|
|
534
534
|
}
|
|
535
|
-
`;class
|
|
536
|
-
`);function
|
|
537
|
-
`}return i=i.replace("%blur%",s),i=i.replace("%size%",r.toString()),i}const
|
|
535
|
+
`;class aT extends _e{constructor(t=1){super(Jv,oT,{uAlpha:1}),this.alpha=t}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}}const hT={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]},lT=["varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{"," gl_FragColor = vec4(0.0);"," %blur%","}"].join(`
|
|
536
|
+
`);function cT(r){const t=hT[r],e=t.length;let i=lT,s="";const n="gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;";let o;for(let a=0;a<r;a++){let h=n.replace("%index%",a.toString());o=a,a>=e&&(o=r-a-1),h=h.replace("%value%",t[o].toString()),s+=h,s+=`
|
|
537
|
+
`}return i=i.replace("%blur%",s),i=i.replace("%size%",r.toString()),i}const uT=`
|
|
538
538
|
attribute vec2 aVertexPosition;
|
|
539
539
|
|
|
540
540
|
uniform mat3 projectionMatrix;
|
|
@@ -564,8 +564,8 @@ void main(void)
|
|
|
564
564
|
|
|
565
565
|
vec2 textureCoord = filterTextureCoord();
|
|
566
566
|
%blur%
|
|
567
|
-
}`;function
|
|
568
|
-
`}return i=i.replace("%blur%",s),i=i.replace("%size%",r.toString()),i}class Dc extends _e{constructor(t,e=8,i=4,s=_e.defaultResolution,n=5){const o=
|
|
567
|
+
}`;function dT(r,t){const e=Math.ceil(r/2);let i=uT,s="",n;t?n="vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);":n="vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);";for(let o=0;o<r;o++){let a=n.replace("%index%",o.toString());a=a.replace("%sampleIndex%",`${o-(e-1)}.0`),s+=a,s+=`
|
|
568
|
+
`}return i=i.replace("%blur%",s),i=i.replace("%size%",r.toString()),i}class Dc extends _e{constructor(t,e=8,i=4,s=_e.defaultResolution,n=5){const o=dT(n,t),a=cT(n);super(o,a),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(),o=t.renderer;let a=e,h=n;this.state.blend=!1,t.applyFilter(this,a,h,Ti.CLEAR);for(let l=1;l<this.passes-1;l++){t.bindAndClear(a,Ti.BLIT),this.uniforms.uSampler=h;const c=h;h=a,a=c,o.shader.bind(this),o.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 fT extends _e{constructor(t=8,e=4,i=_e.defaultResolution,s=5){super(),this._repeatEdgePixels=!1,this.blurXFilter=new Dc(!0,t,e,i,s),this.blurYFilter=new Dc(!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),o=Math.abs(this.blurYFilter.strength);if(n&&o){const a=t.getFilterTexture();this.blurXFilter.apply(t,e,a,Ti.CLEAR),this.blurYFilter.apply(t,a,i,s),t.returnFilterTexture(a)}else o?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 pT=`varying vec2 vTextureCoord;
|
|
569
569
|
uniform sampler2D uSampler;
|
|
570
570
|
uniform float m[20];
|
|
571
571
|
uniform float uAlpha;
|
|
@@ -617,7 +617,7 @@ void main(void)
|
|
|
617
617
|
|
|
618
618
|
gl_FragColor = vec4(rgb, result.a);
|
|
619
619
|
}
|
|
620
|
-
`;class kc extends _e{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(km,
|
|
620
|
+
`;class kc extends _e{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(km,pT,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]=Ft.shared.setValue(t).toArray(),o=[i,0,0,0,0,0,s,0,0,0,0,0,n,0,0,0,0,0,1,0];this._loadMatrix(o,e)}greyscale(t,e){const i=[t,t,t,0,0,t,t,t,0,0,t,t,t,0,0,0,0,0,1,0];this._loadMatrix(i,e)}blackAndWhite(t){const e=[.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0];this._loadMatrix(e,t)}hue(t,e){t=(t||0)/180*Math.PI;const i=Math.cos(t),s=Math.sin(t),n=Math.sqrt,o=1/3,a=n(o),h=i+(1-i)*o,l=o*(1-i)-a*s,c=o*(1-i)+a*s,u=o*(1-i)+a*s,d=i+o*(1-i),f=o*(1-i)-a*s,m=o*(1-i)-a*s,p=o*(1-i)+a*s,g=i+o*(1-i),y=[h,l,c,0,0,u,d,f,0,0,m,p,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 o=Ft.shared,[a,h,l]=o.setValue(i).toArray(),[c,u,d]=o.setValue(s).toArray(),f=[.3,.59,.11,0,0,a,h,l,t,0,c,u,d,e,0,a-c,h-u,l-d,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}}kc.prototype.grayscale=kc.prototype.greyscale;var mT=`varying vec2 vFilterCoord;
|
|
621
621
|
varying vec2 vTextureCoord;
|
|
622
622
|
|
|
623
623
|
uniform vec2 scale;
|
|
@@ -637,7 +637,7 @@ void main(void)
|
|
|
637
637
|
|
|
638
638
|
gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));
|
|
639
639
|
}
|
|
640
|
-
`,
|
|
640
|
+
`,gT=`attribute vec2 aVertexPosition;
|
|
641
641
|
|
|
642
642
|
uniform mat3 projectionMatrix;
|
|
643
643
|
uniform mat3 filterMatrix;
|
|
@@ -666,7 +666,7 @@ void main(void)
|
|
|
666
666
|
vTextureCoord = filterTextureCoord();
|
|
667
667
|
vFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy;
|
|
668
668
|
}
|
|
669
|
-
`;class
|
|
669
|
+
`;class yT extends _e{constructor(t,e){const i=new Nt;t.renderable=!1,super(gT,mT,{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 ut(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,o=Math.sqrt(n.a*n.a+n.b*n.b),a=Math.sqrt(n.c*n.c+n.d*n.d);o!==0&&a!==0&&(this.uniforms.rotation[0]=n.a/o,this.uniforms.rotation[1]=n.b/o,this.uniforms.rotation[2]=n.c/a,this.uniforms.rotation[3]=n.d/a),t.applyFilter(this,e,i,s)}get map(){return this.uniforms.mapSampler}set map(t){this.uniforms.mapSampler=t}}var bT=`varying vec2 v_rgbNW;
|
|
670
670
|
varying vec2 v_rgbNE;
|
|
671
671
|
varying vec2 v_rgbSW;
|
|
672
672
|
varying vec2 v_rgbSE;
|
|
@@ -787,7 +787,7 @@ void main() {
|
|
|
787
787
|
|
|
788
788
|
gl_FragColor = color;
|
|
789
789
|
}
|
|
790
|
-
`,
|
|
790
|
+
`,xT=`
|
|
791
791
|
attribute vec2 aVertexPosition;
|
|
792
792
|
|
|
793
793
|
uniform mat3 projectionMatrix;
|
|
@@ -829,7 +829,7 @@ void main(void) {
|
|
|
829
829
|
|
|
830
830
|
texcoords(vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);
|
|
831
831
|
}
|
|
832
|
-
`;class
|
|
832
|
+
`;class _T extends _e{constructor(){super(xT,bT)}}var vT=`precision highp float;
|
|
833
833
|
|
|
834
834
|
varying vec2 vTextureCoord;
|
|
835
835
|
varying vec4 vColor;
|
|
@@ -863,15 +863,15 @@ void main()
|
|
|
863
863
|
|
|
864
864
|
gl_FragColor = color;
|
|
865
865
|
}
|
|
866
|
-
`;class vT extends _e{constructor(t=.5,e=Math.random()){super(km,_T,{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 Km={AlphaFilter:oT,BlurFilter:dT,BlurFilterPass:Dc,ColorMatrixFilter:kc,DisplacementFilter:gT,FXAAFilter:xT,NoiseFilter:vT};Object.entries(Km).forEach(([r,t])=>{Object.defineProperty(Km,r,{get(){return Tt("7.1.0",`filters.${r} has moved to ${r}`),t}})});class TT{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||(ve.system.add(this.tickerUpdate,this,ss.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(ve.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 wr=new TT;class to{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=to.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new ut,this.page=new ut,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 Oa extends to{constructor(){super(...arguments),this.client=new ut,this.movement=new ut,this.offset=new ut,this.global=new ut,this.screen=new ut}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(t,e,i){return t.worldTransform.applyInverse(i||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,i,s,n,o,a,h,l,c,u,d,f,m,p){throw new Error("Method not implemented.")}}class ai extends Oa{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 $s extends Oa{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}$s.DOM_DELTA_PIXEL=0,$s.DOM_DELTA_LINE=1,$s.DOM_DELTA_PAGE=2;const wT=2048,ST=new ut,Oc=new ut;class CT{constructor(t){this.dispatch=new kn,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){wr.pauseUpdate=!0;const i=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",s=this[i](this.rootTarget,this.rootTarget.eventMode,ST.set(t,e),this.hitTestFn,this.hitPruneFn);return s&&s[0]}propagate(t,e){if(!t.target)return;const i=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let s=0,n=i.length-1;s<n;s++)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!(t.propagationStopped||t.propagationImmediatelyStopped)){t.eventPhase=t.BUBBLING_PHASE;for(let s=i.length-2;s>=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,i=this._allInteractiveElements){if(i.length===0)return;t.eventPhase=t.BUBBLING_PHASE;const s=Array.isArray(e)?e:[e];for(let n=i.length-1;n>=0;n--)s.forEach(o=>{t.currentTarget=i[n],this.notifyTarget(t,o)})}propagationPath(t){const e=[t];for(let i=0;i<wT&&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,o=!1){let a=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(wr.pauseUpdate=!1),t.interactiveChildren&&t.children){const c=t.children;for(let u=c.length-1;u>=0;u--){const d=c[u],f=this.hitTestMoveRecursive(d,this._isInteractive(e)?e:d.eventMode,i,s,n,o||n(t,i));if(f){if(f.length>0&&!f[f.length-1].parent)continue;const m=t.isInteractive();(f.length>0||m)&&(m&&this._allInteractiveElements.push(t),f.push(t)),this._hitElements.length===0&&(this._hitElements=f),a=!0}}}const h=this._isInteractive(e),l=t.isInteractive();return h&&l&&this._allInteractiveElements.push(t),o||this._hitElements.length>0?null:a?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")&&(wr.pauseUpdate=!1),t.interactiveChildren&&t.children){const h=t.children;for(let l=h.length-1;l>=0;l--){const c=h[l],u=this.hitTestRecursive(c,this._isInteractive(e)?e:c.eventMode,i,s,n);if(u){if(u.length>0&&!u[u.length-1].parent)continue;const d=t.isInteractive();return(u.length>0||d)&&u.push(t),u}}}const o=this._isInteractive(e),a=t.isInteractive();return o&&s(t,i)?a?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return!!(!t||t.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,Oc),!t.hitArea.contains(Oc.x,Oc.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,o;e=e??t.type;const i=`on${e}`;(o=(n=t.currentTarget)[i])==null||o.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 ai)){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 ai)){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",u=this.createPointerEvent(t,c,n);if(this.dispatchEvent(u,"pointerout"),i&&this.dispatchEvent(u,"mouseout"),!e.composedPath().includes(n)){const d=this.createPointerEvent(t,"pointerleave",n);for(d.eventPhase=d.AT_TARGET;d.target&&!e.composedPath().includes(d.target);)d.currentTarget=d.target,this.notifyTarget(d),i&&this.notifyTarget(d,"mouseleave"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(u)}if(n!==e.target){const c=t.type==="mousemove"?"mouseover":"pointerover",u=this.clonePointerEvent(e,c);this.dispatchEvent(u,"pointerover"),i&&this.dispatchEvent(u,"mouseover");let d=n==null?void 0:n.parent;for(;d&&d!==this.rootTarget.parent&&d!==e.target;)d=d.parent;if(!d||d===this.rootTarget.parent){const f=this.clonePointerEvent(e,"pointerenter");for(f.eventPhase=f.AT_TARGET;f.target&&f.target!==n&&f.target!==this.rootTarget.parent;)f.currentTarget=f.target,this.notifyTarget(f),i&&this.notifyTarget(f,"mouseenter"),f.target=f.target.parent;this.freeEvent(f)}this.freeEvent(u)}const o=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?o.push("pointermove"):this.dispatchEvent(e,"pointermove"),a&&o.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?o.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),a&&o.push("globaltouchmove")),i&&(this.moveOnAll?o.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),a&&o.push("globalmousemove"),this.cursor=(l=e.target)==null?void 0:l.cursor),o.length>0&&this.all(e,o),this._allInteractiveElements.length=0,this._hitElements.length=0,s.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){var o;if(!(t instanceof ai)){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=(o=i.target)==null?void 0:o.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 ai)){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 o=this.createPointerEvent(t,"pointerleave",s);for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),i&&this.notifyTarget(o,"mouseleave"),o.target=o.target.parent;e.overTargets=null,this.freeEvent(n),this.freeEvent(o)}this.cursor=null}mapPointerUp(t){if(!(t instanceof ai)){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 a=i.button===2;this.dispatchEvent(i,a?"rightup":"mouseup")}const s=this.trackingData(t.pointerId),n=this.findMountedTarget(s.pressTargetsByButton[t.button]);let o=n;if(n&&!i.composedPath().includes(n)){let a=n;for(;a&&!i.composedPath().includes(a);){if(i.currentTarget=a,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch")this.notifyTarget(i,"touchendoutside");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const h=i.button===2;this.notifyTarget(i,h?"rightupoutside":"mouseupoutside")}a=a.parent}delete s.pressTargetsByButton[t.button],o=a}if(o){const a=this.clonePointerEvent(i,"click");a.target=o,a.path=null,s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:a.target,timeStamp:e});const h=s.clicksByButton[t.button];if(h.target===a.target&&e-h.timeStamp<200?++h.clickCount:h.clickCount=1,h.target=a.target,h.timeStamp=e,a.detail=h.clickCount,a.pointerType==="mouse"){const l=a.button===2;this.dispatchEvent(a,l?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(i)}mapPointerUpOutside(t){if(!(t instanceof ai)){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 $s)){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(ai);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($s);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(ai);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 ai&&e instanceof ai&&(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 Oa&&e instanceof Oa&&(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 ET=1,IT={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Bc=class Tf{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new CT(null),wr.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new ai(null),this.rootWheelEvent=new $s(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...Tf.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,Tf._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],o=this.bootstrapEvent(this.rootPointerEvent,n);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,wr.pointerMoved();const e=this.normalizeToPointerData(t);for(let i=0,s=e.length;i<s;i++){const n=this.bootstrapEvent(this.rootPointerEvent,e[i]);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}onPointerUp(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=t.target;t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]);const i=e!==this.domElement?"outside":"",s=this.normalizeToPointerData(t);for(let n=0,o=s.length;n<o;n++){const a=this.bootstrapEvent(this.rootPointerEvent,s[n]);a.type+=i,this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}onPointerOverOut(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const e=this.normalizeToPointerData(t);for(let i=0,s=e.length;i<s;i++){const n=this.bootstrapEvent(this.rootPointerEvent,e[i]);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}onWheel(t){if(!this.features.wheel)return;const e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(e)}setTargetElement(t){this.removeEvents(),this.domElement=t,wr.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;wr.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;wr.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=ET),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=IT[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}};Bc.extension={name:"events",type:[J.RendererSystem,J.CanvasRendererSystem]},Bc.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let Wc=Bc;it.add(Wc);function Ym(r){return r==="dynamic"||r==="static"}const AT={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??Ym(Wc.defaultEventMode)},set interactive(r){Tt("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??Wc.defaultEventMode},set eventMode(r){this._internalInteractive=Ym(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 t=="function"?void 0:t;r=i?`${r}capture`:r,t=typeof t=="function"?t:t.handleEvent,this.on(r,t,s)},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 to))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}};Wt.mixin(AT);const RT={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};Wt.mixin(RT);const MT=9,Ba=100,LT=0,PT=0,zm=2,jm=1,GT=-1e3,FT=-1e3,NT=2;class Jm{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,(ji.tablet||ji.phone)&&this.createTouchHook();const e=document.createElement("div");e.style.width=`${Ba}px`,e.style.height=`${Ba}px`,e.style.position="absolute",e.style.top=`${LT}px`,e.style.left=`${PT}px`,e.style.zIndex=zm.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=`${jm}px`,t.style.height=`${jm}px`,t.style.position="absolute",t.style.top=`${GT}px`,t.style.left=`${FT}px`,t.style.zIndex=NT.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(ji.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:o,height:a,resolution:h}=this.renderer,l=s/o*h,c=n/a*h;let u=this.div;u.style.left=`${e}px`,u.style.top=`${i}px`,u.style.width=`${o}px`,u.style.height=`${a}px`;for(let d=0;d<this.children.length;d++){const f=this.children[d];if(f.renderId!==this.renderId)f._accessibleActive=!1,Ys(this.children,d,1),this.div.removeChild(f._accessibleDiv),this.pool.push(f._accessibleDiv),f._accessibleDiv=null,d--;else{u=f._accessibleDiv;let m=f.hitArea;const p=f.worldTransform;f.hitArea?(u.style.left=`${(p.tx+m.x*p.a)*l}px`,u.style.top=`${(p.ty+m.y*p.d)*c}px`,u.style.width=`${m.width*p.a*l}px`,u.style.height=`${m.height*p.d*c}px`):(m=f.getBounds(),this.capHitArea(m),u.style.left=`${m.x*l}px`,u.style.top=`${m.y*c}px`,u.style.width=`${m.width*l}px`,u.style.height=`${m.height*c}px`,u.title!==f.accessibleTitle&&f.accessibleTitle!==null&&(u.title=f.accessibleTitle),u.getAttribute("aria-label")!==f.accessibleHint&&f.accessibleHint!==null&&u.setAttribute("aria-label",f.accessibleHint)),(f.accessibleTitle!==u.title||f.tabIndex!==u.tabIndex)&&(u.title=f.accessibleTitle,u.tabIndex=f.tabIndex,this.debug&&this.updateDebugHTML(u))}}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=`${Ba}px`,e.style.height=`${Ba}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=zm.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 to(s),{target:i});s.rootTarget=this.renderer.lastObjectRendered,e.forEach(o=>s.dispatchEvent(n,o))}_onClick(t){this._dispatchEvent(t,["click","pointertap","tap"])}_onFocus(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive"),this._dispatchEvent(t,["mouseover"])}_onFocusOut(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite"),this._dispatchEvent(t,["mouseout"])}_onKeyDown(t){t.keyCode===MT&&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}}Jm.extension={name:"accessibility",type:[J.RendererPlugin,J.CanvasRendererPlugin]},it.add(Jm);const $m=class wf{constructor(t){this.stage=new At,t=Object.assign({forceCanvas:!1},t),this.renderer=Kv(t),wf._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=wf._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}};$m._plugins=[];let Qm=$m;it.handleByList(J.Application,Qm._plugins);class qm{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}}qm.extension=J.Application,it.add(qm);const t0={loader:J.LoadParser,resolver:J.ResolveParser,cache:J.CacheParser,detection:J.DetectionParser};it.handle(J.Asset,r=>{const t=r.ref;Object.entries(t0).filter(([e])=>!!t[e]).forEach(([e,i])=>it.add(Object.assign(t[e],{extension:t[e].extension??i})))},r=>{const t=r.ref;Object.keys(t0).filter(e=>!!t[e]).forEach(e=>it.remove(t[e]))});class DT{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 Qs(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 Sr(r,t){const e=r.split("?")[0],i=Qt.extname(e).toLowerCase();return Array.isArray(t)?t.includes(i):i===t}const hi=(r,t,e=!1)=>(Array.isArray(r)||(r=[r]),t?r.map(i=>typeof i=="string"||e?t(i):i):r),Uc=(r,t)=>{const e=t.split("?")[1];return e&&(r+=`?${e}`),r};function e0(r,t,e,i,s){const n=t[e];for(let o=0;o<n.length;o++){const a=n[o];e<t.length-1?e0(r.replace(i[e],a),t,e+1,i,s):s.push(r.replace(i[e],a))}}function kT(r){const t=/\{(.*?)\}/g,e=r.match(t),i=[];if(e){const s=[];e.forEach(n=>{const o=n.substring(1,n.length-1).split(",");s.push(o)}),e0(r,s,0,e,i)}else i.push(r);return i}const Wa=r=>!Array.isArray(r);class OT{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=hi(t);let s;for(let a=0;a<this.parsers.length;a++){const h=this.parsers[a];if(h.test(e)){s=h.getCacheableAssets(i,e);break}}s||(s={},i.forEach(a=>{s[a]=e}));const n=Object.keys(s),o={cacheKeys:n,keys:i};if(i.forEach(a=>{this._cacheMap.set(a,o)}),n.forEach(a=>{this._cache.has(a)&&this._cache.get(a)!==e&&console.warn("[Cache] already has key:",a),this._cache.set(a,s[a])}),e instanceof rt){const a=e;i.forEach(h=>{a.baseTexture!==rt.EMPTY.baseTexture&>.addToCache(a.baseTexture,h),rt.addToCache(a,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 ns=new OT;class BT{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 o,a;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&&((o=l.test)!=null&&o.call(l,t,e,this))){n=l;break}}if(!n)return console.warn(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}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((a=l.testParse)==null?void 0:a.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=Wa(t),o=hi(t,l=>({alias:[l],src:l})),a=o.length,h=o.map(async l=>{const c=Qt.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/a)}catch(u){throw delete this.promiseCache[c],delete s[l.src],new Error(`[Loader.load] Failed to load ${c}.
|
|
867
|
-
${u}`)}});return await Promise.all(h),n?s[o[0].src]:s}async unload(t){const e=hi(t,i=>({alias:[i],src:i})).map(async i=>{var o,a;const s=Qt.toAbsolute(i.src),n=this.promiseCache[s];if(n){const h=await n.promise;delete this.promiseCache[s],(a=(o=n.parser)==null?void 0:o.unload)==null||a.call(o,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 li=(r=>(r[r.Low=0]="Low",r[r.Normal=1]="Normal",r[r.High=2]="High",r))(li||{});const
|
|
866
|
+
`;class TT extends _e{constructor(t=.5,e=Math.random()){super(km,vT,{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 Km={AlphaFilter:aT,BlurFilter:fT,BlurFilterPass:Dc,ColorMatrixFilter:kc,DisplacementFilter:yT,FXAAFilter:_T,NoiseFilter:TT};Object.entries(Km).forEach(([r,t])=>{Object.defineProperty(Km,r,{get(){return Tt("7.1.0",`filters.${r} has moved to ${r}`),t}})});class wT{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||(ve.system.add(this.tickerUpdate,this,ss.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(ve.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 wr=new wT;class io{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=io.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new ut,this.page=new ut,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 Oa extends io{constructor(){super(...arguments),this.client=new ut,this.movement=new ut,this.offset=new ut,this.global=new ut,this.screen=new ut}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(t,e,i){return t.worldTransform.applyInverse(i||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,i,s,n,o,a,h,l,c,u,d,f,m,p){throw new Error("Method not implemented.")}}class ai extends Oa{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 $s extends Oa{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}$s.DOM_DELTA_PIXEL=0,$s.DOM_DELTA_LINE=1,$s.DOM_DELTA_PAGE=2;const ST=2048,ET=new ut,Oc=new ut;class CT{constructor(t){this.dispatch=new Bn,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){wr.pauseUpdate=!0;const i=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",s=this[i](this.rootTarget,this.rootTarget.eventMode,ET.set(t,e),this.hitTestFn,this.hitPruneFn);return s&&s[0]}propagate(t,e){if(!t.target)return;const i=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let s=0,n=i.length-1;s<n;s++)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!(t.propagationStopped||t.propagationImmediatelyStopped)){t.eventPhase=t.BUBBLING_PHASE;for(let s=i.length-2;s>=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,i=this._allInteractiveElements){if(i.length===0)return;t.eventPhase=t.BUBBLING_PHASE;const s=Array.isArray(e)?e:[e];for(let n=i.length-1;n>=0;n--)s.forEach(o=>{t.currentTarget=i[n],this.notifyTarget(t,o)})}propagationPath(t){const e=[t];for(let i=0;i<ST&&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,o=!1){let a=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(wr.pauseUpdate=!1),t.interactiveChildren&&t.children){const c=t.children;for(let u=c.length-1;u>=0;u--){const d=c[u],f=this.hitTestMoveRecursive(d,this._isInteractive(e)?e:d.eventMode,i,s,n,o||n(t,i));if(f){if(f.length>0&&!f[f.length-1].parent)continue;const m=t.isInteractive();(f.length>0||m)&&(m&&this._allInteractiveElements.push(t),f.push(t)),this._hitElements.length===0&&(this._hitElements=f),a=!0}}}const h=this._isInteractive(e),l=t.isInteractive();return h&&l&&this._allInteractiveElements.push(t),o||this._hitElements.length>0?null:a?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")&&(wr.pauseUpdate=!1),t.interactiveChildren&&t.children){const h=t.children;for(let l=h.length-1;l>=0;l--){const c=h[l],u=this.hitTestRecursive(c,this._isInteractive(e)?e:c.eventMode,i,s,n);if(u){if(u.length>0&&!u[u.length-1].parent)continue;const d=t.isInteractive();return(u.length>0||d)&&u.push(t),u}}}const o=this._isInteractive(e),a=t.isInteractive();return o&&s(t,i)?a?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return!!(!t||t.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,Oc),!t.hitArea.contains(Oc.x,Oc.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,o;e=e??t.type;const i=`on${e}`;(o=(n=t.currentTarget)[i])==null||o.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 ai)){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 ai)){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",u=this.createPointerEvent(t,c,n);if(this.dispatchEvent(u,"pointerout"),i&&this.dispatchEvent(u,"mouseout"),!e.composedPath().includes(n)){const d=this.createPointerEvent(t,"pointerleave",n);for(d.eventPhase=d.AT_TARGET;d.target&&!e.composedPath().includes(d.target);)d.currentTarget=d.target,this.notifyTarget(d),i&&this.notifyTarget(d,"mouseleave"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(u)}if(n!==e.target){const c=t.type==="mousemove"?"mouseover":"pointerover",u=this.clonePointerEvent(e,c);this.dispatchEvent(u,"pointerover"),i&&this.dispatchEvent(u,"mouseover");let d=n==null?void 0:n.parent;for(;d&&d!==this.rootTarget.parent&&d!==e.target;)d=d.parent;if(!d||d===this.rootTarget.parent){const f=this.clonePointerEvent(e,"pointerenter");for(f.eventPhase=f.AT_TARGET;f.target&&f.target!==n&&f.target!==this.rootTarget.parent;)f.currentTarget=f.target,this.notifyTarget(f),i&&this.notifyTarget(f,"mouseenter"),f.target=f.target.parent;this.freeEvent(f)}this.freeEvent(u)}const o=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?o.push("pointermove"):this.dispatchEvent(e,"pointermove"),a&&o.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?o.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),a&&o.push("globaltouchmove")),i&&(this.moveOnAll?o.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),a&&o.push("globalmousemove"),this.cursor=(l=e.target)==null?void 0:l.cursor),o.length>0&&this.all(e,o),this._allInteractiveElements.length=0,this._hitElements.length=0,s.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){var o;if(!(t instanceof ai)){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=(o=i.target)==null?void 0:o.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 ai)){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 o=this.createPointerEvent(t,"pointerleave",s);for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),i&&this.notifyTarget(o,"mouseleave"),o.target=o.target.parent;e.overTargets=null,this.freeEvent(n),this.freeEvent(o)}this.cursor=null}mapPointerUp(t){if(!(t instanceof ai)){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 a=i.button===2;this.dispatchEvent(i,a?"rightup":"mouseup")}const s=this.trackingData(t.pointerId),n=this.findMountedTarget(s.pressTargetsByButton[t.button]);let o=n;if(n&&!i.composedPath().includes(n)){let a=n;for(;a&&!i.composedPath().includes(a);){if(i.currentTarget=a,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch")this.notifyTarget(i,"touchendoutside");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const h=i.button===2;this.notifyTarget(i,h?"rightupoutside":"mouseupoutside")}a=a.parent}delete s.pressTargetsByButton[t.button],o=a}if(o){const a=this.clonePointerEvent(i,"click");a.target=o,a.path=null,s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:a.target,timeStamp:e});const h=s.clicksByButton[t.button];if(h.target===a.target&&e-h.timeStamp<200?++h.clickCount:h.clickCount=1,h.target=a.target,h.timeStamp=e,a.detail=h.clickCount,a.pointerType==="mouse"){const l=a.button===2;this.dispatchEvent(a,l?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(i)}mapPointerUpOutside(t){if(!(t instanceof ai)){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 $s)){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(ai);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($s);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(ai);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 ai&&e instanceof ai&&(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 Oa&&e instanceof Oa&&(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 IT=1,AT={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Bc=class Tf{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new CT(null),wr.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new ai(null),this.rootWheelEvent=new $s(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...Tf.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,Tf._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],o=this.bootstrapEvent(this.rootPointerEvent,n);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,wr.pointerMoved();const e=this.normalizeToPointerData(t);for(let i=0,s=e.length;i<s;i++){const n=this.bootstrapEvent(this.rootPointerEvent,e[i]);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}onPointerUp(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=t.target;t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]);const i=e!==this.domElement?"outside":"",s=this.normalizeToPointerData(t);for(let n=0,o=s.length;n<o;n++){const a=this.bootstrapEvent(this.rootPointerEvent,s[n]);a.type+=i,this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}onPointerOverOut(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const e=this.normalizeToPointerData(t);for(let i=0,s=e.length;i<s;i++){const n=this.bootstrapEvent(this.rootPointerEvent,e[i]);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}onWheel(t){if(!this.features.wheel)return;const e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(e)}setTargetElement(t){this.removeEvents(),this.domElement=t,wr.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;wr.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;wr.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=IT),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=AT[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}};Bc.extension={name:"events",type:[J.RendererSystem,J.CanvasRendererSystem]},Bc.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let Wc=Bc;it.add(Wc);function Ym(r){return r==="dynamic"||r==="static"}const RT={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??Ym(Wc.defaultEventMode)},set interactive(r){Tt("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??Wc.defaultEventMode},set eventMode(r){this._internalInteractive=Ym(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 t=="function"?void 0:t;r=i?`${r}capture`:r,t=typeof t=="function"?t:t.handleEvent,this.on(r,t,s)},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 io))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return r.defaultPrevented=!1,r.path=null,r.target=this,r.manager.dispatchEvent(r),!r.defaultPrevented}};Ut.mixin(RT);const MT={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};Ut.mixin(MT);const LT=9,Ba=100,PT=0,GT=0,zm=2,jm=1,FT=-1e3,NT=-1e3,DT=2;class Jm{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,(ji.tablet||ji.phone)&&this.createTouchHook();const e=document.createElement("div");e.style.width=`${Ba}px`,e.style.height=`${Ba}px`,e.style.position="absolute",e.style.top=`${PT}px`,e.style.left=`${GT}px`,e.style.zIndex=zm.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=`${jm}px`,t.style.height=`${jm}px`,t.style.position="absolute",t.style.top=`${FT}px`,t.style.left=`${NT}px`,t.style.zIndex=DT.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(ji.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:o,height:a,resolution:h}=this.renderer,l=s/o*h,c=n/a*h;let u=this.div;u.style.left=`${e}px`,u.style.top=`${i}px`,u.style.width=`${o}px`,u.style.height=`${a}px`;for(let d=0;d<this.children.length;d++){const f=this.children[d];if(f.renderId!==this.renderId)f._accessibleActive=!1,Ys(this.children,d,1),this.div.removeChild(f._accessibleDiv),this.pool.push(f._accessibleDiv),f._accessibleDiv=null,d--;else{u=f._accessibleDiv;let m=f.hitArea;const p=f.worldTransform;f.hitArea?(u.style.left=`${(p.tx+m.x*p.a)*l}px`,u.style.top=`${(p.ty+m.y*p.d)*c}px`,u.style.width=`${m.width*p.a*l}px`,u.style.height=`${m.height*p.d*c}px`):(m=f.getBounds(),this.capHitArea(m),u.style.left=`${m.x*l}px`,u.style.top=`${m.y*c}px`,u.style.width=`${m.width*l}px`,u.style.height=`${m.height*c}px`,u.title!==f.accessibleTitle&&f.accessibleTitle!==null&&(u.title=f.accessibleTitle),u.getAttribute("aria-label")!==f.accessibleHint&&f.accessibleHint!==null&&u.setAttribute("aria-label",f.accessibleHint)),(f.accessibleTitle!==u.title||f.tabIndex!==u.tabIndex)&&(u.title=f.accessibleTitle,u.tabIndex=f.tabIndex,this.debug&&this.updateDebugHTML(u))}}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=`${Ba}px`,e.style.height=`${Ba}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=zm.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 io(s),{target:i});s.rootTarget=this.renderer.lastObjectRendered,e.forEach(o=>s.dispatchEvent(n,o))}_onClick(t){this._dispatchEvent(t,["click","pointertap","tap"])}_onFocus(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive"),this._dispatchEvent(t,["mouseover"])}_onFocusOut(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite"),this._dispatchEvent(t,["mouseout"])}_onKeyDown(t){t.keyCode===LT&&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}}Jm.extension={name:"accessibility",type:[J.RendererPlugin,J.CanvasRendererPlugin]},it.add(Jm);const $m=class wf{constructor(t){this.stage=new At,t=Object.assign({forceCanvas:!1},t),this.renderer=Yv(t),wf._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=wf._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}};$m._plugins=[];let Qm=$m;it.handleByList(J.Application,Qm._plugins);class qm{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}}qm.extension=J.Application,it.add(qm);const t0={loader:J.LoadParser,resolver:J.ResolveParser,cache:J.CacheParser,detection:J.DetectionParser};it.handle(J.Asset,r=>{const t=r.ref;Object.entries(t0).filter(([e])=>!!t[e]).forEach(([e,i])=>it.add(Object.assign(t[e],{extension:t[e].extension??i})))},r=>{const t=r.ref;Object.keys(t0).filter(e=>!!t[e]).forEach(e=>it.remove(t[e]))});class kT{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 Qs(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 Sr(r,t){const e=r.split("?")[0],i=Qt.extname(e).toLowerCase();return Array.isArray(t)?t.includes(i):i===t}const hi=(r,t,e=!1)=>(Array.isArray(r)||(r=[r]),t?r.map(i=>typeof i=="string"||e?t(i):i):r),Uc=(r,t)=>{const e=t.split("?")[1];return e&&(r+=`?${e}`),r};function e0(r,t,e,i,s){const n=t[e];for(let o=0;o<n.length;o++){const a=n[o];e<t.length-1?e0(r.replace(i[e],a),t,e+1,i,s):s.push(r.replace(i[e],a))}}function OT(r){const t=/\{(.*?)\}/g,e=r.match(t),i=[];if(e){const s=[];e.forEach(n=>{const o=n.substring(1,n.length-1).split(",");s.push(o)}),e0(r,s,0,e,i)}else i.push(r);return i}const Wa=r=>!Array.isArray(r);class BT{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=hi(t);let s;for(let a=0;a<this.parsers.length;a++){const h=this.parsers[a];if(h.test(e)){s=h.getCacheableAssets(i,e);break}}s||(s={},i.forEach(a=>{s[a]=e}));const n=Object.keys(s),o={cacheKeys:n,keys:i};if(i.forEach(a=>{this._cacheMap.set(a,o)}),n.forEach(a=>{this._cache.has(a)&&this._cache.get(a)!==e&&console.warn("[Cache] already has key:",a),this._cache.set(a,s[a])}),e instanceof rt){const a=e;i.forEach(h=>{a.baseTexture!==rt.EMPTY.baseTexture&>.addToCache(a.baseTexture,h),rt.addToCache(a,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 ns=new BT;class WT{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 o,a;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&&((o=l.test)!=null&&o.call(l,t,e,this))){n=l;break}}if(!n)return console.warn(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}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((a=l.testParse)==null?void 0:a.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=Wa(t),o=hi(t,l=>({alias:[l],src:l})),a=o.length,h=o.map(async l=>{const c=Qt.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/a)}catch(u){throw delete this.promiseCache[c],delete s[l.src],new Error(`[Loader.load] Failed to load ${c}.
|
|
867
|
+
${u}`)}});return await Promise.all(h),n?s[o[0].src]:s}async unload(t){const e=hi(t,i=>({alias:[i],src:i})).map(async i=>{var o,a;const s=Qt.toAbsolute(i.src),n=this.promiseCache[s];if(n){const h=await n.promise;delete this.promiseCache[s],(a=(o=n.parser)==null?void 0:o.unload)==null||a.call(o,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 li=(r=>(r[r.Low=0]="Low",r[r.Normal=1]="Normal",r[r.High=2]="High",r))(li||{});const UT=".json",XT="application/json",ZT={extension:{type:J.LoadParser,priority:li.Low},name:"loadJson",test(r){return Qs(r,XT)||Sr(r,UT)},async load(r){return await(await q.ADAPTER.fetch(r)).json()}};it.add(ZT);const VT=".txt",HT="text/plain",KT={name:"loadTxt",extension:{type:J.LoadParser,priority:li.Low},test(r){return Qs(r,HT)||Sr(r,VT)},async load(r){return await(await q.ADAPTER.fetch(r)).text()}};it.add(KT);const YT=["normal","bold","100","200","300","400","500","600","700","800","900"],zT=[".ttf",".otf",".woff",".woff2"],jT=["font/ttf","font/otf","font/woff","font/woff2"],JT=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function $T(r){const t=Qt.extname(r),e=Qt.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(JT)){i=!1;break}let s=e.join(" ");return i||(s=`"${s.replace(/[\\"]/g,"\\$&")}"`),s}const QT=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function qT(r){return QT.test(r)?r:encodeURI(r)}const tw={extension:{type:J.LoadParser,priority:li.Low},name:"loadWebFont",test(r){return Qs(r,jT)||Sr(r,zT)},async load(r,t){var i,s,n;const e=q.ADAPTER.getFontFaceSet();if(e){const o=[],a=((i=t.data)==null?void 0:i.family)??$T(r),h=((n=(s=t.data)==null?void 0:s.weights)==null?void 0:n.filter(c=>YT.includes(c)))??["normal"],l=t.data??{};for(let c=0;c<h.length;c++){const u=h[c],d=new FontFace(a,`url(${qT(r)})`,{...l,weight:u});await d.load(),e.add(d),o.push(d)}return o.length===1?o[0]:o}return console.warn("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(r){(Array.isArray(r)?r:[r]).forEach(t=>q.ADAPTER.getFontFaceSet().delete(t))}};it.add(tw);let i0=0,Xc;const ew="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=",iw={id:"checkImageBitmap",code:`
|
|
868
868
|
async function checkImageBitmap()
|
|
869
869
|
{
|
|
870
870
|
try
|
|
871
871
|
{
|
|
872
872
|
if (typeof createImageBitmap !== 'function') return false;
|
|
873
873
|
|
|
874
|
-
const response = await fetch('${
|
|
874
|
+
const response = await fetch('${ew}');
|
|
875
875
|
const imageBlob = await response.blob();
|
|
876
876
|
const imageBitmap = await createImageBitmap(imageBlob);
|
|
877
877
|
|
|
@@ -883,7 +883,7 @@ ${u}`)}});return await Promise.all(h),n?s[o[0].src]:s}async unload(t){const e=hi
|
|
|
883
883
|
}
|
|
884
884
|
}
|
|
885
885
|
checkImageBitmap().then((result) => { self.postMessage(result); });
|
|
886
|
-
`},
|
|
886
|
+
`},rw={id:"loadImageBitmap",code:`
|
|
887
887
|
async function loadImageBitmap(url)
|
|
888
888
|
{
|
|
889
889
|
const response = await fetch(url);
|
|
@@ -919,8 +919,8 @@ ${u}`)}});return await Promise.all(h),n?s[o[0].src]:s}async unload(t){const e=hi
|
|
|
919
919
|
id: event.data.id,
|
|
920
920
|
});
|
|
921
921
|
}
|
|
922
|
-
};`};let Zc;class
|
|
923
|
-
Please use Assets.add({ alias, src, data, format, loadParser }) instead.`),o.push({alias:t,src:e,data:i,format:s,loadParser:n})):Array.isArray(t)?o.push(...t):o.push(t);let a;a=h=>{this.hasKey(h)&&console.warn(`[Resolver] already has key: ${h} overwriting`)},hi(o).forEach(h=>{const{src:l,srcs:c}=h;let{data:u,format:d,loadParser:f}=h;const m=hi(l||c).map(y=>typeof y=="string"?kT(y):Array.isArray(y)?y:[y]),p=this.getAlias(h);Array.isArray(p)?p.forEach(a):a(p);const g=[];m.forEach(y=>{y.forEach(_=>{let b={};if(typeof _!="object"){b.src=_;for(let v=0;v<this._parsers.length;v++){const w=this._parsers[v];if(w.test(_)){b=w.parse(_);break}}}else u=_.data??u,d=_.format??d,f=_.loadParser??f,b={...b,..._};if(!p)throw new Error(`[Resolver] alias is undefined for this asset: ${b.src}`);b=this.buildResolvedAsset(b,{aliases:p,data:u,format:d,loadParser:f}),g.push(b)})}),p.forEach(y=>{this._assetMap[y]=g})})}resolveBundle(t){const e=Wa(t);t=hi(t);const i={};return t.forEach(s=>{const n=this._bundles[s];if(n){const o=this.resolve(n),a={};for(const h in o){const l=o[h];a[this._extractAssetIdFromBundle(s,h)]=l}i[s]=a}}),e?i[t[0]]:i}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const i={};for(const s in e)i[s]=e[s].src;return i}return e.src}resolve(t){const e=Wa(t);t=hi(t);const i={};return t.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let n=this._assetMap[s];const o=n[0],a=this._getPreferredOrder(n);a==null||a.priority.forEach(h=>{a.params[h].forEach(l=>{const c=n.filter(u=>u[h]?u[h]===l:!1);c.length&&(n=c)})}),this._resolverHash[s]=n[0]??o}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:o}=e;return(this._basePath||this._rootPath)&&(t.src=Qt.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=o??Qt.extname(t.src).slice(1),t.srcs=t.src,t.name=t.alias,t}}class pw{constructor(){this._detections=[],this._initialized=!1,this.resolver=new fw,this.loader=new BT,this.cache=ns,this._backgroundLoader=new DT(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){var n,o;if(this._initialized){console.warn("[Assets]AssetManager already initialized, did you load before calling this Asset.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 a=t.manifest;typeof a=="string"&&(a=await this.load(a)),this.resolver.addManifest(a)}const e=((n=t.texturePreference)==null?void 0:n.resolution)??1,i=typeof e=="number"?[e]:e,s=await this._detectFormats({preferredFormats:(o=t.texturePreference)==null?void 0:o.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=Wa(t),s=hi(t).map(a=>{if(typeof a!="string"){const h=this.resolver.getAlias(a);return h.some(l=>!this.resolver.hasKey(l))&&this.add(a),Array.isArray(h)?h[0]:h}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),n=this.resolver.resolve(s),o=await this._mapLoadToResolve(n,e);return i?o[s[0]]:o}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let i=!1;typeof t=="string"&&(i=!0,t=[t]);const s=this.resolver.resolveBundle(t),n={},o=Object.keys(s);let a=0,h=0;const l=()=>{e==null||e(++a/h)},c=o.map(u=>{const d=s[u];return h+=Object.keys(d).length,this._mapLoadToResolve(d,l).then(f=>{n[u]=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 ns.get(t);const e={};for(let i=0;i<t.length;i++)e[i]=ns.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 o={};return i.forEach((a,h)=>{const l=n[a.src],c=[a.src];a.alias&&c.push(...a.alias),o[s[h]]=l,ns.set(c,l)}),o}async unload(t){this._initialized||await this.init();const e=hi(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=hi(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=>{ns.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 Ua.config.preferWorkers}set preferWorkers(t){Tt("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 Xa=new pw;it.handleByList(J.LoadParser,Xa.loader.parsers).handleByList(J.ResolveParser,Xa.resolver.parsers).handleByList(J.CacheParser,Xa.cache.parsers).handleByList(J.DetectionParser,Xa.detections);const mw={extension:J.CacheParser,test:r=>Array.isArray(r)&&r.every(t=>t instanceof rt),getCacheableAssets:(r,t)=>{const e={};return r.forEach(i=>{t.forEach((s,n)=>{e[i+(n===0?"":n+1)]=s})}),e}};it.add(mw);async function s0(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 gw={extension:{type:J.DetectionParser,priority:1},test:async()=>s0("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(t=>t!=="avif")};it.add(gw);const yw={extension:{type:J.DetectionParser,priority:0},test:async()=>s0("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(t=>t!=="webp")};it.add(yw);const n0=["png","jpg","jpeg"],bw={extension:{type:J.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...n0],remove:async r=>r.filter(t=>!n0.includes(t))};it.add(bw);const xw="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function Vc(r){return xw?!1:document.createElement("video").canPlayType(r)!==""}const _w={extension:{type:J.DetectionParser,priority:0},test:async()=>Vc("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(t=>t!=="webm")};it.add(_w);const vw={extension:{type:J.DetectionParser,priority:0},test:async()=>Vc("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(t=>t!=="mp4"&&t!=="m4v")};it.add(vw);const Tw={extension:{type:J.DetectionParser,priority:0},test:async()=>Vc("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(t=>t!=="ogv")};it.add(Tw);const ww={extension:J.ResolveParser,test:Ua.test,parse:r=>{var t;return{resolution:parseFloat(((t=q.RETINA_PREFIX.exec(r))==null?void 0:t[1])??"1"),format:Qt.extname(r).slice(1),src:r}}};it.add(ww);var Ge=(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=35986]="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))(Ge||{});const Za={33776:.5,33777:.5,33778:1,33779:1,35916:.5,35917:.5,35918:1,35919:1,37488:.5,37489:.5,37490:1,37491:1,37492:.5,37496:1,37493:.5,37497:1,37494:.5,37495:.5,35840:.5,35842:.5,35841:.25,35843:.25,36196:.5,35986:.5,35986:1,34798:1,37808:1};let ir,qs;function o0(){qs={s3tc:ir.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:ir.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:ir.getExtension("WEBGL_compressed_texture_etc"),etc1:ir.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:ir.getExtension("WEBGL_compressed_texture_pvrtc")||ir.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:ir.getExtension("WEBGL_compressed_texture_atc"),astc:ir.getExtension("WEBGL_compressed_texture_astc")}}const Sw={extension:{type:J.DetectionParser,priority:2},test:async()=>{const r=q.ADAPTER.createCanvas().getContext("webgl");return r?(ir=r,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async r=>{qs||o0();const t=[];for(const e in qs)qs[e]&&t.push(e);return[...t,...r]},remove:async r=>(qs||o0(),r.filter(t=>!(t in qs)))};it.add(Sw);class Cw extends ya{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 lc(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 lc(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this)),this._load)}}class os extends Cw{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=os._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||os._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,o=this.levels;n<o;n++){const{levelID:a,levelWidth:h,levelHeight:l,levelBuffer:c}=this._levelBuffers[n];s.compressedTexImage2D(s.TEXTURE_2D,a,this.format,h,l,0,c)}return!0}onBlobLoaded(){this._levelBuffers=os._createLevelBuffers(this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height)}static _formatToExtension(t){if(t>=33776&&t<=33779)return"s3tc";if(t>=37488&&t<=37497)return"etc";if(t>=35840&&t<=35843)return"pvrtc";if(t>=36196)return"etc1";if(t>=35986&&t<=34798)return"atc";throw new Error("Invalid (compressed) texture format given!")}static _createLevelBuffers(t,e,i,s,n,o,a){const h=new Array(i);let l=t.byteOffset,c=o,u=a,d=c+s-1&~(s-1),f=u+n-1&~(n-1),m=d*f*Za[e];for(let p=0;p<i;p++)h[p]={levelID:p,levelWidth:i>1?c:d,levelHeight:i>1?u:f,levelBuffer:new Uint8Array(t.buffer,l,m)},l+=m,c=c>>1||1,u=u>>1||1,d=c+s-1&~(s-1),f=u+n-1&~(n-1),m=d*f*Za[e];return h}}const Hc=4,Va=124,Ew=32,a0=20,Iw=542327876,Ha={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},Aw={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},Ka={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},Rw=1,Mw=2,Lw=4,Pw=64,Gw=512,Fw=131072,Nw=827611204,Dw=861165636,kw=894720068,Ow=808540228,Bw=4,Ww={[Nw]:Ge.COMPRESSED_RGBA_S3TC_DXT1_EXT,[Dw]:Ge.COMPRESSED_RGBA_S3TC_DXT3_EXT,[kw]:Ge.COMPRESSED_RGBA_S3TC_DXT5_EXT},Uw={70:Ge.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:Ge.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:Ge.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:Ge.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:Ge.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:Ge.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:Ge.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:Ge.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:Ge.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT};function Xw(r){const t=new Uint32Array(r);if(t[0]!==Iw)throw new Error("Invalid DDS file magic word");const e=new Uint32Array(r,0,Va/Uint32Array.BYTES_PER_ELEMENT),i=e[Ha.HEIGHT],s=e[Ha.WIDTH],n=e[Ha.MIPMAP_COUNT],o=new Uint32Array(r,Ha.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,Ew/Uint32Array.BYTES_PER_ELEMENT),a=o[Rw];if(a&Lw){const h=o[Aw.FOURCC];if(h!==Ow){const _=Ww[h],b=Hc+Va,v=new Uint8Array(r,b);return[new os(v,{format:_,width:s,height:i,levels:n})]}const l=Hc+Va,c=new Uint32Array(t.buffer,l,a0/Uint32Array.BYTES_PER_ELEMENT),u=c[Ka.DXGI_FORMAT],d=c[Ka.RESOURCE_DIMENSION],f=c[Ka.MISC_FLAG],m=c[Ka.ARRAY_SIZE],p=Uw[u];if(p===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${u}`);if(f===Bw)throw new Error("DDSParser does not support cubemap textures");if(d===6)throw new Error("DDSParser does not supported 3D texture data");const g=new Array,y=Hc+Va+a0;if(m===1)g.push(new Uint8Array(r,y));else{const _=Za[p];let b=0,v=s,w=i;for(let E=0;E<n;E++){const A=Math.max(1,v+3&-4),R=Math.max(1,w+3&-4),G=A*R*_;b+=G,v=v>>>1,w=w>>>1}let C=y;for(let E=0;E<m;E++)g.push(new Uint8Array(r,C,b)),C+=b}return g.map(_=>new os(_,{format:p,width:s,height:i,levels:n}))}throw a&Pw?new Error("DDSParser does not support uncompressed texture data."):a&Gw?new Error("DDSParser does not supported YUV uncompressed texture data."):a&Fw?new Error("DDSParser does not support single-channel (lumninance) texture data!"):a&Mw?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 h0=[171,75,84,88,32,49,49,187,13,10,26,10],Zw=67305985,ci={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},Kc=64,l0={[ht.UNSIGNED_BYTE]:1,[ht.UNSIGNED_SHORT]:2,[ht.INT]:4,[ht.UNSIGNED_INT]:4,[ht.FLOAT]:4,[ht.HALF_FLOAT]:8},Vw={[K.RGBA]:4,[K.RGB]:3,[K.RG]:2,[K.RED]:1,[K.LUMINANCE]:1,[K.LUMINANCE_ALPHA]:2,[K.ALPHA]:1},Hw={[ht.UNSIGNED_SHORT_4_4_4_4]:2,[ht.UNSIGNED_SHORT_5_5_5_1]:2,[ht.UNSIGNED_SHORT_5_6_5]:2};function Kw(r,t,e=!1){const i=new DataView(t);if(!Yw(r,i))return null;const s=i.getUint32(ci.ENDIANNESS,!0)===Zw,n=i.getUint32(ci.GL_TYPE,s),o=i.getUint32(ci.GL_FORMAT,s),a=i.getUint32(ci.GL_INTERNAL_FORMAT,s),h=i.getUint32(ci.PIXEL_WIDTH,s),l=i.getUint32(ci.PIXEL_HEIGHT,s)||1,c=i.getUint32(ci.PIXEL_DEPTH,s)||1,u=i.getUint32(ci.NUMBER_OF_ARRAY_ELEMENTS,s)||1,d=i.getUint32(ci.NUMBER_OF_FACES,s),f=i.getUint32(ci.NUMBER_OF_MIPMAP_LEVELS,s),m=i.getUint32(ci.BYTES_OF_KEY_VALUE_DATA,s);if(l===0||c!==1)throw new Error("Only 2D textures are supported");if(d!==1)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(u!==1)throw new Error("WebGL does not support array textures");const p=4,g=4,y=h+3&-4,_=l+3&-4,b=new Array(u);let v=h*l;n===0&&(v=y*_);let w;if(n!==0?l0[n]?w=l0[n]*Vw[o]:w=Hw[n]:w=Za[a],w===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const C=e?jw(i,m,s):null;let E=v*w,A=h,R=l,G=y,N=_,P=Kc+m;for(let I=0;I<f;I++){const D=i.getUint32(P,s);let X=P+4;for(let H=0;H<u;H++){let Z=b[H];Z||(Z=b[H]=new Array(f)),Z[I]={levelID:I,levelWidth:f>1||n!==0?A:G,levelHeight:f>1||n!==0?R:N,levelBuffer:new Uint8Array(t,X,E)},X+=E}P+=D+4,P=P%4!==0?P+4-P%4:P,A=A>>1||1,R=R>>1||1,G=A+p-1&~(p-1),N=R+g-1&~(g-1),E=G*N*w}return n!==0?{uncompressed:b.map(I=>{let D=I[0].levelBuffer,X=!1;return n===ht.FLOAT?D=new Float32Array(I[0].levelBuffer.buffer,I[0].levelBuffer.byteOffset,I[0].levelBuffer.byteLength/4):n===ht.UNSIGNED_INT?(X=!0,D=new Uint32Array(I[0].levelBuffer.buffer,I[0].levelBuffer.byteOffset,I[0].levelBuffer.byteLength/4)):n===ht.INT&&(X=!0,D=new Int32Array(I[0].levelBuffer.buffer,I[0].levelBuffer.byteOffset,I[0].levelBuffer.byteLength/4)),{resource:new ya(D,{width:I[0].levelWidth,height:I[0].levelHeight}),type:n,format:X?zw(o):o}}),kvData:C}:{compressed:b.map(I=>new os(null,{format:a,width:h,height:l,levels:f,levelBuffers:I})),kvData:C}}function Yw(r,t){for(let e=0;e<h0.length;e++)if(t.getUint8(e)!==h0[e])return console.error(`${r} is not a valid *.ktx file!`),!1;return!0}function zw(r){switch(r){case K.RGBA:return K.RGBA_INTEGER;case K.RGB:return K.RGB_INTEGER;case K.RG:return K.RG_INTEGER;case K.RED:return K.RED_INTEGER;default:return r}}function jw(r,t,e){const i=new Map;let s=0;for(;s<t;){const n=r.getUint32(Kc+s,e),o=Kc+s+4,a=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(o+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,o,h)),c=new DataView(r.buffer,o+h+1,n-h-1);i.set(l,c),s+=4+n+a}return i}const Jw={extension:{type:J.LoadParser,priority:li.High},name:"loadDDS",test(r){return Sr(r,".dds")},async load(r,t,e){const i=await(await q.ADAPTER.fetch(r)).arrayBuffer(),s=Xw(i).map(n=>{const o=new gt(n,{mipmap:vi.OFF,alphaMode:Se.NO_PREMULTIPLIED_ALPHA,resolution:qi(r),...t.data});return eo(o,e,r)});return s.length===1?s[0]:s},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};it.add(Jw);const $w={extension:{type:J.LoadParser,priority:li.High},name:"loadKTX",test(r){return Sr(r,".ktx")},async load(r,t,e){const i=await(await q.ADAPTER.fetch(r)).arrayBuffer(),{compressed:s,uncompressed:n,kvData:o}=Kw(r,i),a=s??n,h={mipmap:vi.OFF,alphaMode:Se.NO_PREMULTIPLIED_ALPHA,resolution:qi(r),...t.data},l=a.map(c=>{a===n&&Object.assign(h,{type:c.type,format:c.format});const u=c.resource??c,d=new gt(u,h);return d.ktxKeyValueData=o,eo(d,e,r)});return l.length===1?l[0]:l},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};it.add($w);const Qw={extension:J.ResolveParser,test:r=>{const t=Qt.extname(r).slice(1);return["basis","ktx","dds"].includes(t)},parse:r=>{var e,i;const t=Qt.extname(r).slice(1);if(t==="ktx"){const s=[".s3tc.ktx",".s3tc_sRGB.ktx",".etc.ktx",".etc1.ktx",".pvrt.ktx",".atc.ktx",".astc.ktx"];if(s.some(n=>r.endsWith(n)))return{resolution:parseFloat(((e=q.RETINA_PREFIX.exec(r))==null?void 0:e[1])??"1"),format:s.find(n=>r.endsWith(n)),src:r}}return{resolution:parseFloat(((i=q.RETINA_PREFIX.exec(r))==null?void 0:i[1])??"1"),format:t,src:r}}};it.add(Qw);const Ya=new pt,qw=4,c0=class $o{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((o,a)=>{n.toBlob(h=>{if(!h){a(new Error("ICanvas.toBlob failed!"));return}const l=new FileReader;l.onload=()=>o(l.result),l.onerror=a,l.readAsDataURL(h)},e,i)});if(n.toDataURL!==void 0)return n.toDataURL(e,i);if(n.convertToBlob!==void 0){const o=await n.convertToBlob({type:e,quality:i});return new Promise((a,h)=>{const l=new FileReader;l.onload=()=>a(l.result),l.onerror=h,l.readAsDataURL(o)})}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:o,premultipliedAlpha:a}=this._rawPixels(t,e);o&&$o._flipY(i,s,n),a&&$o._unpremultiplyAlpha(i);const h=new F1(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:o,premultipliedAlpha:a}=this._rawPixels(t,e);return o&&$o._flipY(i,s,n),a&&$o._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,o=!1,a,h=!1;t&&(t instanceof es?a=t:(a=i.generateTexture(t,{region:e,resolution:i.resolution,multisample:i.multisample}),h=!0,e&&(Ya.width=e.width,Ya.height=e.height,e=Ya)));const l=i.gl;if(a){if(s=a.baseTexture.resolution,e=e??a.frame,n=!1,o=a.baseTexture.alphaMode>0&&a.baseTexture.format===K.RGBA,!h){i.renderTexture.bind(a);const f=a.framebuffer.glFramebuffers[i.CONTEXT_UID];f.blitFramebuffer&&i.framebuffer.bind(f.blitFramebuffer)}}else s=i.resolution,e||(e=Ya,e.width=i.width/s,e.height=i.height/s),n=!0,o=this._rendererPremultipliedAlpha,i.renderTexture.bind();const c=Math.max(Math.round(e.width*s),1),u=Math.max(Math.round(e.height*s),1),d=new Uint8Array(qw*c*u);return l.readPixels(Math.round(e.x*s),Math.round(e.y*s),c,u,l.RGBA,l.UNSIGNED_BYTE,d),h&&(a==null||a.destroy(!0)),{pixels:d,width:c,height:u,flipY:n,premultipliedAlpha:o}}destroy(){this.renderer=null}static _flipY(t,e,i){const s=e<<2,n=i>>1,o=new Uint8Array(s);for(let a=0;a<n;a++){const h=a*s,l=(i-a-1)*s;o.set(t.subarray(h,h+s)),t.copyWithin(h,l,l+s),t.set(o,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}}}};c0.extension={name:"extract",type:J.RendererSystem};let tS=c0;it.add(tS);const za={build(r){const t=r.points;let e,i,s,n,o,a;if(r.type===le.CIRC){const m=r.shape;e=m.x,i=m.y,o=a=m.radius,s=n=0}else if(r.type===le.ELIP){const m=r.shape;e=m.x,i=m.y,o=m.width,a=m.height,s=n=0}else{const m=r.shape,p=m.width/2,g=m.height/2;e=m.x+p,i=m.y+g,o=a=Math.max(0,Math.min(m.radius,Math.min(p,g))),s=p-o,n=g-a}if(!(o>=0&&a>=0&&s>=0&&n>=0)){t.length=0;return}const h=Math.ceil(2.3*Math.sqrt(o+a)),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,u=h*4+(s?2:0)+2,d=u,f=l;{const m=s+o,p=n,g=e+m,y=e-m,_=i+p;if(t[c++]=g,t[c++]=_,t[--u]=_,t[--u]=y,n){const b=i-p;t[d++]=y,t[d++]=b,t[--f]=b,t[--f]=g}}for(let m=1;m<h;m++){const p=Math.PI/2*(m/h),g=s+Math.cos(p)*o,y=n+Math.sin(p)*a,_=e+g,b=e-g,v=i+y,w=i-y;t[c++]=_,t[c++]=v,t[--u]=v,t[--u]=b,t[d++]=b,t[d++]=w,t[--f]=w,t[--f]=_}{const m=s,p=n+a,g=e+m,y=e-m,_=i+p,b=i-p;t[c++]=g,t[c++]=_,t[--f]=b,t[--f]=g,s&&(t[c++]=y,t[c++]=_,t[--f]=b,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 o=n;let a,h;if(r.type!==le.RREC){const c=r.shape;a=c.x,h=c.y}else{const c=r.shape;a=c.x+c.width/2,h=c.y+c.height/2}const l=r.matrix;i.push(r.matrix?l.a*a+l.c*h+l.tx:a,r.matrix?l.b*a+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++,o,n);s.push(o+1,o,n)}};function u0(r,t=!1){const e=r.length;if(e<6)return;let i=0;for(let s=0,n=r[e-2],o=r[e-1];s<e;s+=2){const a=r[s],h=r[s+1];i+=(a-n)*(h+o),n=a,o=h}if(!t&&i>0||t&&i<=0){const s=e/2;for(let n=s+s%2;n<e;n+=2){const o=e-n-2,a=e-n-1,h=n,l=n+1;[r[o],r[h]]=[r[h],r[o]],[r[a],r[l]]=[r[l],r[a]]}}}const d0={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){u0(e,!1);const o=[];for(let l=0;l<i.length;l++){const c=i[l];u0(c.points,!0),o.push(e.length/2),e=e.concat(c.points)}const a=cx(e,o,2);if(!a)return;const h=s.length/2;for(let l=0;l<a.length;l+=3)n.push(a[l]+h),n.push(a[l+1]+h),n.push(a[l+2]+h);for(let l=0;l<e.length;l++)s.push(e[l])}}},eS={build(r){const t=r.shape,e=t.x,i=t.y,s=t.width,n=t.height,o=r.points;o.length=0,s>=0&&n>=0&&o.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)}},iS={build(r){za.build(r)},triangulate(r,t){za.triangulate(r,t)}};var ze=(r=>(r.MITER="miter",r.BEVEL="bevel",r.ROUND="round",r))(ze||{}),Cr=(r=>(r.BUTT="butt",r.ROUND="round",r.SQUARE="square",r))(Cr||{});const tn={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 f0{static curveTo(t,e,i,s,n,o){const a=o[o.length-2],h=o[o.length-1]-e,l=a-t,c=s-e,u=i-t,d=Math.abs(h*u-l*c);if(d<1e-8||n===0)return(o[o.length-2]!==t||o[o.length-1]!==e)&&o.push(t,e),null;const f=h*h+l*l,m=c*c+u*u,p=h*c+l*u,g=n*Math.sqrt(f)/d,y=n*Math.sqrt(m)/d,_=g*p/f,b=y*p/m,v=g*u+y*l,w=g*c+y*h,C=l*(y+_),E=h*(y+_),A=u*(g+b),R=c*(g+b),G=Math.atan2(E-w,C-v),N=Math.atan2(R-w,A-v);return{cx:v+t,cy:w+e,radius:n,startAngle:G,endAngle:N,anticlockwise:l*c>u*h}}static arc(t,e,i,s,n,o,a,h,l){const c=a-o,u=tn._segmentsCount(Math.abs(c)*n,Math.ceil(Math.abs(c)/xa)*40),d=c/(u*2),f=d*2,m=Math.cos(d),p=Math.sin(d),g=u-1,y=g%1/g;for(let _=0;_<=g;++_){const b=_+y*_,v=d+o+f*b,w=Math.cos(v),C=-Math.sin(v);l.push((m*w+p*C)*n+i,(m*-C+p*w)*n+s)}}}class rS{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 Yc{static curveLength(t,e,i,s,n,o,a,h){let l=0,c=0,u=0,d=0,f=0,m=0,p=0,g=0,y=0,_=0,b=0,v=t,w=e;for(let C=1;C<=10;++C)c=C/10,u=c*c,d=u*c,f=1-c,m=f*f,p=m*f,g=p*t+3*m*c*i+3*f*u*n+d*a,y=p*e+3*m*c*s+3*f*u*o+d*h,_=v-g,b=w-y,v=g,w=y,l+=Math.sqrt(_*_+b*b);return l}static curveTo(t,e,i,s,n,o,a){const h=a[a.length-2],l=a[a.length-1];a.length-=2;const c=tn._segmentsCount(Yc.curveLength(h,l,t,e,i,s,n,o));let u=0,d=0,f=0,m=0,p=0;a.push(h,l);for(let g=1,y=0;g<=c;++g)y=g/c,u=1-y,d=u*u,f=d*u,m=y*y,p=m*y,a.push(f*h+3*d*y*t+3*u*m*i+p*n,f*l+3*d*y*e+3*u*m*s+p*o)}}function p0(r,t,e,i,s,n,o,a){const h=r-e*s,l=t-i*s,c=r+e*n,u=t+i*n;let d,f;o?(d=i,f=-e):(d=-i,f=e);const m=h+d,p=l+f,g=c+d,y=u+f;return a.push(m,p,g,y),2}function as(r,t,e,i,s,n,o,a){const h=e-r,l=i-t;let c=Math.atan2(h,l),u=Math.atan2(s-r,n-t);a&&c<u?c+=Math.PI*2:!a&&c>u&&(u+=Math.PI*2);let d=c;const f=u-c,m=Math.abs(f),p=Math.sqrt(h*h+l*l),g=(15*m*Math.sqrt(p)/Math.PI>>0)+1,y=f/g;if(d+=y,a){o.push(r,t,e,i);for(let _=1,b=d;_<g;_++,b+=y)o.push(r,t,r+Math.sin(b)*p,t+Math.cos(b)*p);o.push(r,t,s,n)}else{o.push(e,i,r,t);for(let _=1,b=d;_<g;_++,b+=y)o.push(r+Math.sin(b)*p,t+Math.cos(b)*p,r,t);o.push(s,n,r,t)}return g*2}function sS(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,o=new ut(i[0],i[1]),a=new ut(i[i.length-2],i[i.length-1]),h=e.type!==le.POLY||e.closeStroke,l=Math.abs(o.x-a.x)<s&&Math.abs(o.y-a.y)<s;if(h){i=i.slice(),l&&(i.pop(),i.pop(),a.set(i[i.length-2],i[i.length-1]));const Z=(o.x+a.x)*.5,j=(a.y+o.y)*.5;i.unshift(Z,j),i.push(Z,j)}const c=t.points,u=i.length/2;let d=i.length;const f=c.length/2,m=n.width/2,p=m*m,g=n.miterLimit*n.miterLimit;let y=i[0],_=i[1],b=i[2],v=i[3],w=0,C=0,E=-(_-v),A=y-b,R=0,G=0,N=Math.sqrt(E*E+A*A);E/=N,A/=N,E*=m,A*=m;const P=n.alignment,I=(1-P)*2,D=P*2;h||(n.cap===Cr.ROUND?d+=as(y-E*(I-D)*.5,_-A*(I-D)*.5,y-E*I,_-A*I,y+E*D,_+A*D,c,!0)+2:n.cap===Cr.SQUARE&&(d+=p0(y,_,E,A,I,D,!0,c))),c.push(y-E*I,_-A*I,y+E*D,_+A*D);for(let Z=1;Z<u-1;++Z){y=i[(Z-1)*2],_=i[(Z-1)*2+1],b=i[Z*2],v=i[Z*2+1],w=i[(Z+1)*2],C=i[(Z+1)*2+1],E=-(_-v),A=y-b,N=Math.sqrt(E*E+A*A),E/=N,A/=N,E*=m,A*=m,R=-(v-C),G=b-w,N=Math.sqrt(R*R+G*G),R/=N,G/=N,R*=m,G*=m;const j=b-y,O=_-v,k=b-w,F=C-v,V=j*k+O*F,$=O*k-F*j,dt=$<0;if(Math.abs($)<.001*Math.abs(V)){c.push(b-E*I,v-A*I,b+E*D,v+A*D),V>=0&&(n.join===ze.ROUND?d+=as(b,v,b-E*I,v-A*I,b-R*I,v-G*I,c,!1)+4:d+=2,c.push(b-R*D,v-G*D,b+R*I,v+G*I));continue}const ot=(-E+y)*(-A+v)-(-E+b)*(-A+_),Et=(-R+w)*(-G+v)-(-R+b)*(-G+C),Mt=(j*Et-k*ot)/$,_t=(F*ot-O*Et)/$,Y=(Mt-b)*(Mt-b)+(_t-v)*(_t-v),tt=b+(Mt-b)*I,et=v+(_t-v)*I,B=b-(Mt-b)*D,xt=v-(_t-v)*D,yt=Math.min(j*j+O*O,k*k+F*F),Lt=dt?I:D,Zt=yt+Lt*Lt*p,Xe=Y<=Zt;let pi=n.join;if(pi===ze.MITER&&Y/p>g&&(pi=ze.BEVEL),Xe)switch(pi){case ze.MITER:{c.push(tt,et,B,xt);break}case ze.BEVEL:{dt?c.push(tt,et,b+E*D,v+A*D,tt,et,b+R*D,v+G*D):c.push(b-E*I,v-A*I,B,xt,b-R*I,v-G*I,B,xt),d+=2;break}case ze.ROUND:{dt?(c.push(tt,et,b+E*D,v+A*D),d+=as(b,v,b+E*D,v+A*D,b+R*D,v+G*D,c,!0)+4,c.push(tt,et,b+R*D,v+G*D)):(c.push(b-E*I,v-A*I,B,xt),d+=as(b,v,b-E*I,v-A*I,b-R*I,v-G*I,c,!1)+4,c.push(b-R*I,v-G*I,B,xt));break}}else{switch(c.push(b-E*I,v-A*I,b+E*D,v+A*D),pi){case ze.MITER:{dt?c.push(B,xt,B,xt):c.push(tt,et,tt,et),d+=2;break}case ze.ROUND:{dt?d+=as(b,v,b+E*D,v+A*D,b+R*D,v+G*D,c,!0)+2:d+=as(b,v,b-E*I,v-A*I,b-R*I,v-G*I,c,!1)+2;break}}c.push(b-R*I,v-G*I,b+R*D,v+G*D),d+=2}}y=i[(u-2)*2],_=i[(u-2)*2+1],b=i[(u-1)*2],v=i[(u-1)*2+1],E=-(_-v),A=y-b,N=Math.sqrt(E*E+A*A),E/=N,A/=N,E*=m,A*=m,c.push(b-E*I,v-A*I,b+E*D,v+A*D),h||(n.cap===Cr.ROUND?d+=as(b-E*(I-D)*.5,v-A*(I-D)*.5,b-E*I,v-A*I,b+E*D,v+A*D,c,!1)+2:n.cap===Cr.SQUARE&&(d+=p0(b,v,E,A,I,D,!1,c)));const X=t.indices,H=tn.epsilon*tn.epsilon;for(let Z=f;Z<d+f-2;++Z)y=c[Z*2],_=c[Z*2+1],b=c[(Z+1)*2],v=c[(Z+1)*2+1],w=c[(Z+2)*2],C=c[(Z+2)*2+1],!(Math.abs(y*(v-C)+b*(C-_)+w*(_-v))<H)&&X.push(Z,Z+1,Z+2)}function nS(r,t){let e=0;const i=r.shape,s=r.points||i.points,n=i.type!==le.POLY||i.closeStroke;if(s.length===0)return;const o=t.points,a=t.indices,h=s.length/2,l=o.length/2;let c=l;for(o.push(s[0],s[1]),e=1;e<h;e++)o.push(s[e*2],s[e*2+1]),a.push(c,c+1),c++;n&&a.push(c,l)}function m0(r,t){r.lineStyle.native?nS(r,t):sS(r,t)}class zc{static curveLength(t,e,i,s,n,o){const a=t-2*i+n,h=e-2*s+o,l=2*i-2*t,c=2*s-2*e,u=4*(a*a+h*h),d=4*(a*l+h*c),f=l*l+c*c,m=2*Math.sqrt(u+d+f),p=Math.sqrt(u),g=2*u*p,y=2*Math.sqrt(f),_=d/p;return(g*m+p*d*(m-y)+(4*f*u-d*d)*Math.log((2*p+_+m)/(_+y)))/(4*g)}static curveTo(t,e,i,s,n){const o=n[n.length-2],a=n[n.length-1],h=tn._segmentsCount(zc.curveLength(o,a,t,e,i,s));let l=0,c=0;for(let u=1;u<=h;++u){const d=u/h;l=o+(t-o)*d,c=a+(e-a)*d,n.push(l+(t+(i-t)*d-l)*d,c+(e+(s-e)*d-c)*d)}}}const jc={[le.POLY]:d0,[le.CIRC]:za,[le.ELIP]:za,[le.RECT]:eS,[le.RREC]:iS},g0=[],ja=[];class Ja{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 Ja(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 en=new ut,y0=class Gb extends Jp{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 ka,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(),ja.push(this.drawCalls[t]);this.drawCalls.length=0;for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e.reset(),g0.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 Ja(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 Ja(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,en):en.copyFrom(t),s.shape.contains(en.x,en.y))){let n=!1;if(s.holes){for(let o=0;o<s.holes.length;o++)if(s.holes[o].shape.contains(en.x,en.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,u=l.lineStyle;jc[l.type].build(l),l.matrix&&this.transformPoints(l.points,l.matrix),(c.visible||u.visible)&&this.processHoles(l.holes);for(let d=0;d<2;d++){const f=d===0?c:u;if(!f.visible)continue;const m=f.texture.baseTexture,p=this.indices.length,g=this.points.length/2;m.wrapMode=_i.REPEAT,d===0?this.processFill(l):this.processLine(l);const y=this.points.length/2-g;y!==0&&(i&&!this._compareStyles(s,f)&&(i.end(p,g),i=null),i||(i=g0.pop()||new rS,i.begin(f,p,g),this.batches.push(i),s=f),this.addUvs(this.points,t,f.texture,g,y,f.matrix))}}const n=this.indices.length,o=this.points.length/2;if(i&&i.end(n,o),this.batches.length===0){this.batchable=!0;return}const a=o>65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&a===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=a?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 o=s.start+n;this.indicesUint16[o]=this.indicesUint16[o]-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<Gb.BATCHABLE_SIZE*2}buildDrawCalls(){let t=++gt._globalBatch;for(let u=0;u<this.drawCalls.length;u++)this.drawCalls[u].texArray.clear(),ja.push(this.drawCalls[u]);this.drawCalls.length=0;const e=this.colors,i=this.textureIds;let s=ja.pop();s||(s=new bc,s.texArray=new Sc),s.texArray.count=0,s.start=0,s.size=0,s.type=xi.TRIANGLES;let n=0,o=null,a=0,h=!1,l=xi.TRIANGLES,c=0;this.drawCalls.push(s);for(let u=0;u<this.batches.length;u++){const d=this.batches[u],f=8,m=d.style,p=m.texture.baseTexture;h!==!!m.native&&(h=!!m.native,l=h?xi.LINES:xi.TRIANGLES,o=null,n=f,t++),o!==p&&(o=p,p._batchEnabled!==t&&(n===f&&(t++,n=0,s.size>0&&(s=ja.pop(),s||(s=new bc,s.texArray=new Sc),this.drawCalls.push(s)),s.start=c,s.size=0,s.texArray.count=0,s.type=l),p.touched=1,p._batchEnabled=t,p._batchLocation=n,p.wrapMode=_i.REPEAT,s.texArray.elements[s.texArray.count++]=p,n++)),s.size+=d.size,c+=d.size,a=p._batchLocation,this.addColors(e,m.color,m.alpha,d.attribSize,d.attribStart),this.addTextureIds(i,a,d.attribSize,d.attribStart)}gt._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),o=new Float32Array(n),a=new Uint32Array(n);let h=0;for(let l=0;l<t.length/2;l++)o[h++]=t[l*2],o[h++]=t[l*2+1],o[h++]=e[l*2],o[h++]=e[l*2+1],a[h++]=i[l],o[h++]=s[l];this._buffer.update(n),this._indexBuffer.update(this.indicesUint16)}processFill(t){t.holes.length?d0.triangulate(t,this):jc[t.type].triangulate(t,this)}processLine(t){m0(t,this);for(let e=0;e<t.holes.length;e++)m0(t.holes[e],this)}processHoles(t){for(let e=0;e<t.length;e++){const i=t[e];jc[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 o=Ft.shared.setValue(e).toLittleEndianNumber(),a=Ft.shared.setValue(o).toPremultiplied(i);t.length=Math.max(t.length,n+s);for(let h=0;h<s;h++)t[n+h]=a}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,o=null){let a=0;const h=e.length,l=i.frame;for(;a<n;){let u=t[(s+a)*2],d=t[(s+a)*2+1];if(o){const f=o.a*u+o.c*d+o.tx;d=o.b*u+o.d*d+o.ty,u=f}a++,e.push(u/l.width,d/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,o=1e-6,a=i+s*2,h=e.frame,l=h.width/n.width,c=h.height/n.height;let u=h.x/h.width,d=h.y/h.height,f=Math.floor(t[i]+o),m=Math.floor(t[i+1]+o);for(let p=i+2;p<a;p+=2)f=Math.min(f,Math.floor(t[p]+o)),m=Math.min(m,Math.floor(t[p+1]+o));u-=f,d-=m;for(let p=i;p<a;p+=2)t[p]=(t[p]+u)*l,t[p+1]=(t[p+1]+d)*c}};y0.BATCHABLE_SIZE=100;let oS=y0;class $a{constructor(){this.color=16777215,this.alpha=1,this.texture=rt.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){const t=new $a;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=rt.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}class Jc extends $a{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=Cr.BUTT,this.join=ze.MITER,this.miterLimit=10}clone(){const t=new Jc;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=Cr.BUTT,this.join=ze.MITER,this.miterLimit=10}}const $c={},Qc=class yl extends At{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 $a,this._lineStyle=new Jc,this._matrix=null,this._holeMode=!1,this.state=Ai.for2d(),this._geometry=t||new oS,this._geometry.refCount++,this._transformID=-1,this._tintColor=new Ft(16777215),this.blendMode=ft.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new yl(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:rt.WHITE,color:t!=null&&t.texture?16777215:0,matrix:null,alignment:.5,native:!1,cap:Cr.BUTT,join:ze.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 jr,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new jr,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),zc.curveTo(t,e,i,s,n),this}bezierCurveTo(t,e,i,s,n,o){return this._initCurve(),Yc.curveTo(t,e,i,s,n,o,this.currentPath.points),this}arcTo(t,e,i,s,n){this._initCurve(t,e);const o=this.currentPath.points,a=f0.curveTo(t,e,i,s,n,o);if(a){const{cx:h,cy:l,radius:c,startAngle:u,endAngle:d,anticlockwise:f}=a;this.arc(h,l,c,u,d,f)}return this}arc(t,e,i,s,n,o=!1){if(s===n)return this;if(!o&&n<=s?n+=xa:o&&s<=n&&(s+=xa),n-s===0)return this;const a=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 u=Math.abs(c[c.length-2]-a),d=Math.abs(c[c.length-1]-h);u<l&&d<l||c.push(a,h)}else this.moveTo(a,h),c=this.currentPath.points;return f0.arc(a,h,t,e,i,s,n,o,c),this}beginFill(t=0,e){return this.beginTextureFill({texture:rt.WHITE,color:t,alpha:e})}normalizeColor(t){const e=Ft.shared.setValue(t.color??0);t.color=e.toNumber(),t.alpha??(t.alpha=e.alpha)}beginTextureFill(t){const e={texture:rt.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 pt(t,e,i,s))}drawRoundedRect(t,e,i,s,n){return this.drawShape(new wa(t,e,i,s,n))}drawCircle(t,e,i){return this.drawShape(new va(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 jr(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===le.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],o=n.style.color,a=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:a,blendMode:e,indices:l,uvs:h,_batchRGB:Ft.shared.setValue(o).toRgbArray(),_tintRGB:o,_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,o=i.drawCalls;n.translationMatrix=this.transform.worldTransform,Ft.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 a=0,h=o.length;a<h;a++)this._renderDrawCallDirect(t,i.drawCalls[a])}_renderDrawCallDirect(t,e){const{texArray:i,type:s,size:n,start:o}=e,a=i.count;for(let h=0;h<a;h++)t.texture.bind(i.elements[h],h);t.geometry.draw(s,n,o)}_resolveDirectShader(t){let e=this.shader;const i=this.pluginName;if(!e){if(!$c[i]){const{maxTextures:s}=t.plugins[i],n=new Int32Array(s);for(let h=0;h<s;h++)n[h]=h;const o={tint:new Float32Array([1,1,1,1]),translationMatrix:new Nt,default:oi.from({uSamplers:n},!0)},a=t.plugins[i]._shader.program;$c[i]=new Ri(a,o)}e=$c[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,yl._TEMP_POINT),this._geometry.containsPoint(yl._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=Ft.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,o=e.d,a=e.tx,h=e.ty,l=this._geometry.points,c=this.vertexData;let u=0;for(let d=0;d<l.length;d+=2){const f=l[d],m=l[d+1];c[u++]=i*f+n*m+a,c[u++]=o*m+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)}};Qc.curves=tn,Qc._TEMP_POINT=new ut;let io=Qc;class aS{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 qc=new ut,b0=new jr,x0=class Fb extends At{constructor(t,e,i,s=xi.TRIANGLES){super(),this.geometry=t,this.shader=e,this.state=i||Ai.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=q.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===xi.TRIANGLES&&e.length<Fb.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,o=s.b,a=s.c,h=s.d,l=s.tx,c=s.ty,u=this.vertexData;for(let d=0;d<u.length/2;d++){const f=e[d*2],m=e[d*2+1];u[d*2]=n*f+a*m+l,u[d*2+1]=o*f+h*m+c}if(this._roundPixels){const d=q.RESOLUTION;for(let f=0;f<u.length;++f)u[f]=Math.round(u[f]*d)/d}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 aS(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,qc);const e=this.geometry.getBuffer("aVertexPosition").data,i=b0.points,s=this.geometry.getIndex().data,n=s.length,o=this.drawMode===4?3:1;for(let a=0;a+2<n;a+=o){const h=s[a]*2,l=s[a+1]*2,c=s[a+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],b0.contains(qc.x,qc.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}};x0.BATCHABLE_SIZE=100;let tu=x0;class _0 extends vr{constructor(t,e,i){super();const s=new Kt(t),n=new Kt(e,!0),o=new Kt(i,!0,!0);this.addAttribute("aVertexPosition",s,2,!1,ht.FLOAT).addAttribute("aTextureCoord",n,2,!1,ht.FLOAT).addIndex(o),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}var hS=`varying vec2 vTextureCoord;
|
|
922
|
+
};`};let Zc;class sw{constructor(){this._initialized=!1,this._createdWorkers=0,this.workerPool=[],this.queue=[],this.resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{const e=URL.createObjectURL(new Blob([iw.code],{type:"application/javascript"})),i=new Worker(e);i.addEventListener("message",s=>{i.terminate(),URL.revokeObjectURL(e),t(s.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t){return this._run("loadImageBitmap",[t])}async _initWorkers(){this._initialized||(this._initialized=!0)}getWorker(){Xc===void 0&&(Xc=navigator.hardwareConcurrency||4);let t=this.workerPool.pop();return!t&&this._createdWorkers<Xc&&(Zc||(Zc=URL.createObjectURL(new Blob([rw.code],{type:"application/javascript"}))),this._createdWorkers++,t=new Worker(Zc),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[i0]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:i0++,id:i})}}const r0=new sw;function ro(r,t,e){r.resource.internal=!0;const i=new rt(r),s=()=>{delete t.promiseCache[e],ns.has(e)&&ns.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 nw=[".jpeg",".jpg",".png",".webp",".avif"],ow=["image/jpeg","image/png","image/webp","image/avif"];async function aw(r){const t=await q.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 Ua={name:"loadTextures",extension:{type:J.LoadParser,priority:li.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return Qs(r,ow)||Sr(r,nw)},async load(r,t,e){var a;const i=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;let s;i?this.config.preferWorkers&&await r0.isImageBitmapSupported()?s=await r0.loadImageBitmap(r):s=await aw(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=u=>l(u))});const n={...t.data};n.resolution??(n.resolution=qi(r)),i&&((a=n.resourceOptions)==null?void 0:a.ownsImageBitmap)===void 0&&(n.resourceOptions={...n.resourceOptions},n.resourceOptions.ownsImageBitmap=!0);const o=new gt(s,n);return o.resource.src=r,ro(o,e,r)},unload(r){r.destroy(!0)}};it.add(Ua);const hw=".svg",lw="image/svg+xml",cw={extension:{type:J.LoadParser,priority:li.High},name:"loadSVG",test(r){return Qs(r,lw)||Sr(r,hw)},async testParse(r){return Fc.test(r)},async parse(r,t,e){var n;const i=new Fc(r,(n=t==null?void 0:t.data)==null?void 0:n.resourceOptions);await i.load();const s=new gt(i,{resolution:qi(r),...t==null?void 0:t.data});return s.resource.src=t.src,ro(s,e,t.src)},async load(r,t){return(await q.ADAPTER.fetch(r)).text()},unload:Ua.unload};it.add(cw);const uw=[".mp4",".m4v",".webm",".ogv"],dw=["video/mp4","video/webm","video/ogg"],fw={name:"loadVideo",extension:{type:J.LoadParser,priority:li.High},config:{defaultAutoPlay:!0},test(r){return Qs(r,dw)||Sr(r,uw)},async load(r,t,e){var o;let i;const s=await(await q.ADAPTER.fetch(r)).blob(),n=URL.createObjectURL(s);try{const a={autoPlay:this.config.defaultAutoPlay,...(o=t==null?void 0:t.data)==null?void 0:o.resourceOptions},h=new Zm(n,a);await h.load();const l=new gt(h,{alphaMode:await x1(),resolution:qi(r),...t==null?void 0:t.data});l.resource.src=r,i=ro(l,e,r),i.baseTexture.once("destroyed",()=>{URL.revokeObjectURL(n)})}catch(a){throw URL.revokeObjectURL(n),a}return i},unload(r){r.destroy(!0)}};it.add(fw);class pw{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 hi(e||i||s||n,o=>typeof o=="string"?o:Array.isArray(o)?o.map(a=>(a==null?void 0:a.src)??(a==null?void 0:a.srcs)??a):o!=null&&o.src||o!=null&&o.srcs?o.src??o.srcs:o,!0)}addManifest(t){this._manifest&&console.warn("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){const i=[];Array.isArray(e)?e.forEach(s=>{const n=s.src??s.srcs,o=s.alias??s.name;let a;if(typeof o=="string"){const h=this._createBundleAssetId(t,o);i.push(h),a=[o,h]}else{const h=o.map(l=>this._createBundleAssetId(t,l));i.push(...h),a=[...o,...h]}this.add({...s,alias:a,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 o=e[s],a=o.src??o.srcs;this.add({...o,alias:n,src:Array.isArray(a)?a:[a]})}i.push(...n)}),this._bundles[t]=i}add(t,e,i,s,n){const o=[];typeof t=="string"||Array.isArray(t)&&typeof t[0]=="string"?(Tt("7.2.0",`Assets.add now uses an object instead of individual parameters.
|
|
923
|
+
Please use Assets.add({ alias, src, data, format, loadParser }) instead.`),o.push({alias:t,src:e,data:i,format:s,loadParser:n})):Array.isArray(t)?o.push(...t):o.push(t);let a;a=h=>{this.hasKey(h)&&console.warn(`[Resolver] already has key: ${h} overwriting`)},hi(o).forEach(h=>{const{src:l,srcs:c}=h;let{data:u,format:d,loadParser:f}=h;const m=hi(l||c).map(y=>typeof y=="string"?OT(y):Array.isArray(y)?y:[y]),p=this.getAlias(h);Array.isArray(p)?p.forEach(a):a(p);const g=[];m.forEach(y=>{y.forEach(_=>{let b={};if(typeof _!="object"){b.src=_;for(let v=0;v<this._parsers.length;v++){const w=this._parsers[v];if(w.test(_)){b=w.parse(_);break}}}else u=_.data??u,d=_.format??d,f=_.loadParser??f,b={...b,..._};if(!p)throw new Error(`[Resolver] alias is undefined for this asset: ${b.src}`);b=this.buildResolvedAsset(b,{aliases:p,data:u,format:d,loadParser:f}),g.push(b)})}),p.forEach(y=>{this._assetMap[y]=g})})}resolveBundle(t){const e=Wa(t);t=hi(t);const i={};return t.forEach(s=>{const n=this._bundles[s];if(n){const o=this.resolve(n),a={};for(const h in o){const l=o[h];a[this._extractAssetIdFromBundle(s,h)]=l}i[s]=a}}),e?i[t[0]]:i}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const i={};for(const s in e)i[s]=e[s].src;return i}return e.src}resolve(t){const e=Wa(t);t=hi(t);const i={};return t.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let n=this._assetMap[s];const o=n[0],a=this._getPreferredOrder(n);a==null||a.priority.forEach(h=>{a.params[h].forEach(l=>{const c=n.filter(u=>u[h]?u[h]===l:!1);c.length&&(n=c)})}),this._resolverHash[s]=n[0]??o}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:o}=e;return(this._basePath||this._rootPath)&&(t.src=Qt.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=o??Qt.extname(t.src).slice(1),t.srcs=t.src,t.name=t.alias,t}}class mw{constructor(){this._detections=[],this._initialized=!1,this.resolver=new pw,this.loader=new WT,this.cache=ns,this._backgroundLoader=new kT(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){var n,o;if(this._initialized){console.warn("[Assets]AssetManager already initialized, did you load before calling this Asset.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 a=t.manifest;typeof a=="string"&&(a=await this.load(a)),this.resolver.addManifest(a)}const e=((n=t.texturePreference)==null?void 0:n.resolution)??1,i=typeof e=="number"?[e]:e,s=await this._detectFormats({preferredFormats:(o=t.texturePreference)==null?void 0:o.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=Wa(t),s=hi(t).map(a=>{if(typeof a!="string"){const h=this.resolver.getAlias(a);return h.some(l=>!this.resolver.hasKey(l))&&this.add(a),Array.isArray(h)?h[0]:h}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),n=this.resolver.resolve(s),o=await this._mapLoadToResolve(n,e);return i?o[s[0]]:o}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let i=!1;typeof t=="string"&&(i=!0,t=[t]);const s=this.resolver.resolveBundle(t),n={},o=Object.keys(s);let a=0,h=0;const l=()=>{e==null||e(++a/h)},c=o.map(u=>{const d=s[u];return h+=Object.keys(d).length,this._mapLoadToResolve(d,l).then(f=>{n[u]=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 ns.get(t);const e={};for(let i=0;i<t.length;i++)e[i]=ns.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 o={};return i.forEach((a,h)=>{const l=n[a.src],c=[a.src];a.alias&&c.push(...a.alias),o[s[h]]=l,ns.set(c,l)}),o}async unload(t){this._initialized||await this.init();const e=hi(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=hi(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=>{ns.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 Ua.config.preferWorkers}set preferWorkers(t){Tt("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 Xa=new mw;it.handleByList(J.LoadParser,Xa.loader.parsers).handleByList(J.ResolveParser,Xa.resolver.parsers).handleByList(J.CacheParser,Xa.cache.parsers).handleByList(J.DetectionParser,Xa.detections);const gw={extension:J.CacheParser,test:r=>Array.isArray(r)&&r.every(t=>t instanceof rt),getCacheableAssets:(r,t)=>{const e={};return r.forEach(i=>{t.forEach((s,n)=>{e[i+(n===0?"":n+1)]=s})}),e}};it.add(gw);async function s0(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 yw={extension:{type:J.DetectionParser,priority:1},test:async()=>s0("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(t=>t!=="avif")};it.add(yw);const bw={extension:{type:J.DetectionParser,priority:0},test:async()=>s0("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(t=>t!=="webp")};it.add(bw);const n0=["png","jpg","jpeg"],xw={extension:{type:J.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...n0],remove:async r=>r.filter(t=>!n0.includes(t))};it.add(xw);const _w="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function Vc(r){return _w?!1:document.createElement("video").canPlayType(r)!==""}const vw={extension:{type:J.DetectionParser,priority:0},test:async()=>Vc("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(t=>t!=="webm")};it.add(vw);const Tw={extension:{type:J.DetectionParser,priority:0},test:async()=>Vc("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(t=>t!=="mp4"&&t!=="m4v")};it.add(Tw);const ww={extension:{type:J.DetectionParser,priority:0},test:async()=>Vc("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(t=>t!=="ogv")};it.add(ww);const Sw={extension:J.ResolveParser,test:Ua.test,parse:r=>{var t;return{resolution:parseFloat(((t=q.RETINA_PREFIX.exec(r))==null?void 0:t[1])??"1"),format:Qt.extname(r).slice(1),src:r}}};it.add(Sw);var Ge=(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=35986]="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))(Ge||{});const Za={33776:.5,33777:.5,33778:1,33779:1,35916:.5,35917:.5,35918:1,35919:1,37488:.5,37489:.5,37490:1,37491:1,37492:.5,37496:1,37493:.5,37497:1,37494:.5,37495:.5,35840:.5,35842:.5,35841:.25,35843:.25,36196:.5,35986:.5,35986:1,34798:1,37808:1};let ir,qs;function o0(){qs={s3tc:ir.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:ir.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:ir.getExtension("WEBGL_compressed_texture_etc"),etc1:ir.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:ir.getExtension("WEBGL_compressed_texture_pvrtc")||ir.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:ir.getExtension("WEBGL_compressed_texture_atc"),astc:ir.getExtension("WEBGL_compressed_texture_astc")}}const Ew={extension:{type:J.DetectionParser,priority:2},test:async()=>{const r=q.ADAPTER.createCanvas().getContext("webgl");return r?(ir=r,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async r=>{qs||o0();const t=[];for(const e in qs)qs[e]&&t.push(e);return[...t,...r]},remove:async r=>(qs||o0(),r.filter(t=>!(t in qs)))};it.add(Ew);class Cw extends ya{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 lc(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 lc(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this)),this._load)}}class os extends Cw{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=os._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||os._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,o=this.levels;n<o;n++){const{levelID:a,levelWidth:h,levelHeight:l,levelBuffer:c}=this._levelBuffers[n];s.compressedTexImage2D(s.TEXTURE_2D,a,this.format,h,l,0,c)}return!0}onBlobLoaded(){this._levelBuffers=os._createLevelBuffers(this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height)}static _formatToExtension(t){if(t>=33776&&t<=33779)return"s3tc";if(t>=37488&&t<=37497)return"etc";if(t>=35840&&t<=35843)return"pvrtc";if(t>=36196)return"etc1";if(t>=35986&&t<=34798)return"atc";throw new Error("Invalid (compressed) texture format given!")}static _createLevelBuffers(t,e,i,s,n,o,a){const h=new Array(i);let l=t.byteOffset,c=o,u=a,d=c+s-1&~(s-1),f=u+n-1&~(n-1),m=d*f*Za[e];for(let p=0;p<i;p++)h[p]={levelID:p,levelWidth:i>1?c:d,levelHeight:i>1?u:f,levelBuffer:new Uint8Array(t.buffer,l,m)},l+=m,c=c>>1||1,u=u>>1||1,d=c+s-1&~(s-1),f=u+n-1&~(n-1),m=d*f*Za[e];return h}}const Hc=4,Va=124,Iw=32,a0=20,Aw=542327876,Ha={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},Rw={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},Ka={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},Mw=1,Lw=2,Pw=4,Gw=64,Fw=512,Nw=131072,Dw=827611204,kw=861165636,Ow=894720068,Bw=808540228,Ww=4,Uw={[Dw]:Ge.COMPRESSED_RGBA_S3TC_DXT1_EXT,[kw]:Ge.COMPRESSED_RGBA_S3TC_DXT3_EXT,[Ow]:Ge.COMPRESSED_RGBA_S3TC_DXT5_EXT},Xw={70:Ge.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:Ge.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:Ge.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:Ge.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:Ge.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:Ge.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:Ge.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:Ge.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:Ge.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT};function Zw(r){const t=new Uint32Array(r);if(t[0]!==Aw)throw new Error("Invalid DDS file magic word");const e=new Uint32Array(r,0,Va/Uint32Array.BYTES_PER_ELEMENT),i=e[Ha.HEIGHT],s=e[Ha.WIDTH],n=e[Ha.MIPMAP_COUNT],o=new Uint32Array(r,Ha.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,Iw/Uint32Array.BYTES_PER_ELEMENT),a=o[Mw];if(a&Pw){const h=o[Rw.FOURCC];if(h!==Bw){const _=Uw[h],b=Hc+Va,v=new Uint8Array(r,b);return[new os(v,{format:_,width:s,height:i,levels:n})]}const l=Hc+Va,c=new Uint32Array(t.buffer,l,a0/Uint32Array.BYTES_PER_ELEMENT),u=c[Ka.DXGI_FORMAT],d=c[Ka.RESOURCE_DIMENSION],f=c[Ka.MISC_FLAG],m=c[Ka.ARRAY_SIZE],p=Xw[u];if(p===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${u}`);if(f===Ww)throw new Error("DDSParser does not support cubemap textures");if(d===6)throw new Error("DDSParser does not supported 3D texture data");const g=new Array,y=Hc+Va+a0;if(m===1)g.push(new Uint8Array(r,y));else{const _=Za[p];let b=0,v=s,w=i;for(let C=0;C<n;C++){const A=Math.max(1,v+3&-4),R=Math.max(1,w+3&-4),G=A*R*_;b+=G,v=v>>>1,w=w>>>1}let E=y;for(let C=0;C<m;C++)g.push(new Uint8Array(r,E,b)),E+=b}return g.map(_=>new os(_,{format:p,width:s,height:i,levels:n}))}throw a&Gw?new Error("DDSParser does not support uncompressed texture data."):a&Fw?new Error("DDSParser does not supported YUV uncompressed texture data."):a&Nw?new Error("DDSParser does not support single-channel (lumninance) texture data!"):a&Lw?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 h0=[171,75,84,88,32,49,49,187,13,10,26,10],Vw=67305985,ci={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},Kc=64,l0={[ht.UNSIGNED_BYTE]:1,[ht.UNSIGNED_SHORT]:2,[ht.INT]:4,[ht.UNSIGNED_INT]:4,[ht.FLOAT]:4,[ht.HALF_FLOAT]:8},Hw={[K.RGBA]:4,[K.RGB]:3,[K.RG]:2,[K.RED]:1,[K.LUMINANCE]:1,[K.LUMINANCE_ALPHA]:2,[K.ALPHA]:1},Kw={[ht.UNSIGNED_SHORT_4_4_4_4]:2,[ht.UNSIGNED_SHORT_5_5_5_1]:2,[ht.UNSIGNED_SHORT_5_6_5]:2};function Yw(r,t,e=!1){const i=new DataView(t);if(!zw(r,i))return null;const s=i.getUint32(ci.ENDIANNESS,!0)===Vw,n=i.getUint32(ci.GL_TYPE,s),o=i.getUint32(ci.GL_FORMAT,s),a=i.getUint32(ci.GL_INTERNAL_FORMAT,s),h=i.getUint32(ci.PIXEL_WIDTH,s),l=i.getUint32(ci.PIXEL_HEIGHT,s)||1,c=i.getUint32(ci.PIXEL_DEPTH,s)||1,u=i.getUint32(ci.NUMBER_OF_ARRAY_ELEMENTS,s)||1,d=i.getUint32(ci.NUMBER_OF_FACES,s),f=i.getUint32(ci.NUMBER_OF_MIPMAP_LEVELS,s),m=i.getUint32(ci.BYTES_OF_KEY_VALUE_DATA,s);if(l===0||c!==1)throw new Error("Only 2D textures are supported");if(d!==1)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(u!==1)throw new Error("WebGL does not support array textures");const p=4,g=4,y=h+3&-4,_=l+3&-4,b=new Array(u);let v=h*l;n===0&&(v=y*_);let w;if(n!==0?l0[n]?w=l0[n]*Hw[o]:w=Kw[n]:w=Za[a],w===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const E=e?Jw(i,m,s):null;let C=v*w,A=h,R=l,G=y,N=_,P=Kc+m;for(let I=0;I<f;I++){const D=i.getUint32(P,s);let X=P+4;for(let H=0;H<u;H++){let Z=b[H];Z||(Z=b[H]=new Array(f)),Z[I]={levelID:I,levelWidth:f>1||n!==0?A:G,levelHeight:f>1||n!==0?R:N,levelBuffer:new Uint8Array(t,X,C)},X+=C}P+=D+4,P=P%4!==0?P+4-P%4:P,A=A>>1||1,R=R>>1||1,G=A+p-1&~(p-1),N=R+g-1&~(g-1),C=G*N*w}return n!==0?{uncompressed:b.map(I=>{let D=I[0].levelBuffer,X=!1;return n===ht.FLOAT?D=new Float32Array(I[0].levelBuffer.buffer,I[0].levelBuffer.byteOffset,I[0].levelBuffer.byteLength/4):n===ht.UNSIGNED_INT?(X=!0,D=new Uint32Array(I[0].levelBuffer.buffer,I[0].levelBuffer.byteOffset,I[0].levelBuffer.byteLength/4)):n===ht.INT&&(X=!0,D=new Int32Array(I[0].levelBuffer.buffer,I[0].levelBuffer.byteOffset,I[0].levelBuffer.byteLength/4)),{resource:new ya(D,{width:I[0].levelWidth,height:I[0].levelHeight}),type:n,format:X?jw(o):o}}),kvData:E}:{compressed:b.map(I=>new os(null,{format:a,width:h,height:l,levels:f,levelBuffers:I})),kvData:E}}function zw(r,t){for(let e=0;e<h0.length;e++)if(t.getUint8(e)!==h0[e])return console.error(`${r} is not a valid *.ktx file!`),!1;return!0}function jw(r){switch(r){case K.RGBA:return K.RGBA_INTEGER;case K.RGB:return K.RGB_INTEGER;case K.RG:return K.RG_INTEGER;case K.RED:return K.RED_INTEGER;default:return r}}function Jw(r,t,e){const i=new Map;let s=0;for(;s<t;){const n=r.getUint32(Kc+s,e),o=Kc+s+4,a=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(o+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,o,h)),c=new DataView(r.buffer,o+h+1,n-h-1);i.set(l,c),s+=4+n+a}return i}const $w={extension:{type:J.LoadParser,priority:li.High},name:"loadDDS",test(r){return Sr(r,".dds")},async load(r,t,e){const i=await(await q.ADAPTER.fetch(r)).arrayBuffer(),s=Zw(i).map(n=>{const o=new gt(n,{mipmap:vi.OFF,alphaMode:Se.NO_PREMULTIPLIED_ALPHA,resolution:qi(r),...t.data});return ro(o,e,r)});return s.length===1?s[0]:s},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};it.add($w);const Qw={extension:{type:J.LoadParser,priority:li.High},name:"loadKTX",test(r){return Sr(r,".ktx")},async load(r,t,e){const i=await(await q.ADAPTER.fetch(r)).arrayBuffer(),{compressed:s,uncompressed:n,kvData:o}=Yw(r,i),a=s??n,h={mipmap:vi.OFF,alphaMode:Se.NO_PREMULTIPLIED_ALPHA,resolution:qi(r),...t.data},l=a.map(c=>{a===n&&Object.assign(h,{type:c.type,format:c.format});const u=c.resource??c,d=new gt(u,h);return d.ktxKeyValueData=o,ro(d,e,r)});return l.length===1?l[0]:l},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};it.add(Qw);const qw={extension:J.ResolveParser,test:r=>{const t=Qt.extname(r).slice(1);return["basis","ktx","dds"].includes(t)},parse:r=>{var e,i;const t=Qt.extname(r).slice(1);if(t==="ktx"){const s=[".s3tc.ktx",".s3tc_sRGB.ktx",".etc.ktx",".etc1.ktx",".pvrt.ktx",".atc.ktx",".astc.ktx"];if(s.some(n=>r.endsWith(n)))return{resolution:parseFloat(((e=q.RETINA_PREFIX.exec(r))==null?void 0:e[1])??"1"),format:s.find(n=>r.endsWith(n)),src:r}}return{resolution:parseFloat(((i=q.RETINA_PREFIX.exec(r))==null?void 0:i[1])??"1"),format:t,src:r}}};it.add(qw);const Ya=new pt,tS=4,c0=class $o{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((o,a)=>{n.toBlob(h=>{if(!h){a(new Error("ICanvas.toBlob failed!"));return}const l=new FileReader;l.onload=()=>o(l.result),l.onerror=a,l.readAsDataURL(h)},e,i)});if(n.toDataURL!==void 0)return n.toDataURL(e,i);if(n.convertToBlob!==void 0){const o=await n.convertToBlob({type:e,quality:i});return new Promise((a,h)=>{const l=new FileReader;l.onload=()=>a(l.result),l.onerror=h,l.readAsDataURL(o)})}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:o,premultipliedAlpha:a}=this._rawPixels(t,e);o&&$o._flipY(i,s,n),a&&$o._unpremultiplyAlpha(i);const h=new N1(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:o,premultipliedAlpha:a}=this._rawPixels(t,e);return o&&$o._flipY(i,s,n),a&&$o._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,o=!1,a,h=!1;t&&(t instanceof es?a=t:(a=i.generateTexture(t,{region:e,resolution:i.resolution,multisample:i.multisample}),h=!0,e&&(Ya.width=e.width,Ya.height=e.height,e=Ya)));const l=i.gl;if(a){if(s=a.baseTexture.resolution,e=e??a.frame,n=!1,o=a.baseTexture.alphaMode>0&&a.baseTexture.format===K.RGBA,!h){i.renderTexture.bind(a);const f=a.framebuffer.glFramebuffers[i.CONTEXT_UID];f.blitFramebuffer&&i.framebuffer.bind(f.blitFramebuffer)}}else s=i.resolution,e||(e=Ya,e.width=i.width/s,e.height=i.height/s),n=!0,o=this._rendererPremultipliedAlpha,i.renderTexture.bind();const c=Math.max(Math.round(e.width*s),1),u=Math.max(Math.round(e.height*s),1),d=new Uint8Array(tS*c*u);return l.readPixels(Math.round(e.x*s),Math.round(e.y*s),c,u,l.RGBA,l.UNSIGNED_BYTE,d),h&&(a==null||a.destroy(!0)),{pixels:d,width:c,height:u,flipY:n,premultipliedAlpha:o}}destroy(){this.renderer=null}static _flipY(t,e,i){const s=e<<2,n=i>>1,o=new Uint8Array(s);for(let a=0;a<n;a++){const h=a*s,l=(i-a-1)*s;o.set(t.subarray(h,h+s)),t.copyWithin(h,l,l+s),t.set(o,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}}}};c0.extension={name:"extract",type:J.RendererSystem};let eS=c0;it.add(eS);const za={build(r){const t=r.points;let e,i,s,n,o,a;if(r.type===ce.CIRC){const m=r.shape;e=m.x,i=m.y,o=a=m.radius,s=n=0}else if(r.type===ce.ELIP){const m=r.shape;e=m.x,i=m.y,o=m.width,a=m.height,s=n=0}else{const m=r.shape,p=m.width/2,g=m.height/2;e=m.x+p,i=m.y+g,o=a=Math.max(0,Math.min(m.radius,Math.min(p,g))),s=p-o,n=g-a}if(!(o>=0&&a>=0&&s>=0&&n>=0)){t.length=0;return}const h=Math.ceil(2.3*Math.sqrt(o+a)),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,u=h*4+(s?2:0)+2,d=u,f=l;{const m=s+o,p=n,g=e+m,y=e-m,_=i+p;if(t[c++]=g,t[c++]=_,t[--u]=_,t[--u]=y,n){const b=i-p;t[d++]=y,t[d++]=b,t[--f]=b,t[--f]=g}}for(let m=1;m<h;m++){const p=Math.PI/2*(m/h),g=s+Math.cos(p)*o,y=n+Math.sin(p)*a,_=e+g,b=e-g,v=i+y,w=i-y;t[c++]=_,t[c++]=v,t[--u]=v,t[--u]=b,t[d++]=b,t[d++]=w,t[--f]=w,t[--f]=_}{const m=s,p=n+a,g=e+m,y=e-m,_=i+p,b=i-p;t[c++]=g,t[c++]=_,t[--f]=b,t[--f]=g,s&&(t[c++]=y,t[c++]=_,t[--f]=b,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 o=n;let a,h;if(r.type!==ce.RREC){const c=r.shape;a=c.x,h=c.y}else{const c=r.shape;a=c.x+c.width/2,h=c.y+c.height/2}const l=r.matrix;i.push(r.matrix?l.a*a+l.c*h+l.tx:a,r.matrix?l.b*a+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++,o,n);s.push(o+1,o,n)}};function u0(r,t=!1){const e=r.length;if(e<6)return;let i=0;for(let s=0,n=r[e-2],o=r[e-1];s<e;s+=2){const a=r[s],h=r[s+1];i+=(a-n)*(h+o),n=a,o=h}if(!t&&i>0||t&&i<=0){const s=e/2;for(let n=s+s%2;n<e;n+=2){const o=e-n-2,a=e-n-1,h=n,l=n+1;[r[o],r[h]]=[r[h],r[o]],[r[a],r[l]]=[r[l],r[a]]}}}const d0={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){u0(e,!1);const o=[];for(let l=0;l<i.length;l++){const c=i[l];u0(c.points,!0),o.push(e.length/2),e=e.concat(c.points)}const a=ux(e,o,2);if(!a)return;const h=s.length/2;for(let l=0;l<a.length;l+=3)n.push(a[l]+h),n.push(a[l+1]+h),n.push(a[l+2]+h);for(let l=0;l<e.length;l++)s.push(e[l])}}},iS={build(r){const t=r.shape,e=t.x,i=t.y,s=t.width,n=t.height,o=r.points;o.length=0,s>=0&&n>=0&&o.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)}},rS={build(r){za.build(r)},triangulate(r,t){za.triangulate(r,t)}};var ze=(r=>(r.MITER="miter",r.BEVEL="bevel",r.ROUND="round",r))(ze||{}),Er=(r=>(r.BUTT="butt",r.ROUND="round",r.SQUARE="square",r))(Er||{});const tn={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 f0{static curveTo(t,e,i,s,n,o){const a=o[o.length-2],h=o[o.length-1]-e,l=a-t,c=s-e,u=i-t,d=Math.abs(h*u-l*c);if(d<1e-8||n===0)return(o[o.length-2]!==t||o[o.length-1]!==e)&&o.push(t,e),null;const f=h*h+l*l,m=c*c+u*u,p=h*c+l*u,g=n*Math.sqrt(f)/d,y=n*Math.sqrt(m)/d,_=g*p/f,b=y*p/m,v=g*u+y*l,w=g*c+y*h,E=l*(y+_),C=h*(y+_),A=u*(g+b),R=c*(g+b),G=Math.atan2(C-w,E-v),N=Math.atan2(R-w,A-v);return{cx:v+t,cy:w+e,radius:n,startAngle:G,endAngle:N,anticlockwise:l*c>u*h}}static arc(t,e,i,s,n,o,a,h,l){const c=a-o,u=tn._segmentsCount(Math.abs(c)*n,Math.ceil(Math.abs(c)/xa)*40),d=c/(u*2),f=d*2,m=Math.cos(d),p=Math.sin(d),g=u-1,y=g%1/g;for(let _=0;_<=g;++_){const b=_+y*_,v=d+o+f*b,w=Math.cos(v),E=-Math.sin(v);l.push((m*w+p*E)*n+i,(m*-E+p*w)*n+s)}}}class sS{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 Yc{static curveLength(t,e,i,s,n,o,a,h){let l=0,c=0,u=0,d=0,f=0,m=0,p=0,g=0,y=0,_=0,b=0,v=t,w=e;for(let E=1;E<=10;++E)c=E/10,u=c*c,d=u*c,f=1-c,m=f*f,p=m*f,g=p*t+3*m*c*i+3*f*u*n+d*a,y=p*e+3*m*c*s+3*f*u*o+d*h,_=v-g,b=w-y,v=g,w=y,l+=Math.sqrt(_*_+b*b);return l}static curveTo(t,e,i,s,n,o,a){const h=a[a.length-2],l=a[a.length-1];a.length-=2;const c=tn._segmentsCount(Yc.curveLength(h,l,t,e,i,s,n,o));let u=0,d=0,f=0,m=0,p=0;a.push(h,l);for(let g=1,y=0;g<=c;++g)y=g/c,u=1-y,d=u*u,f=d*u,m=y*y,p=m*y,a.push(f*h+3*d*y*t+3*u*m*i+p*n,f*l+3*d*y*e+3*u*m*s+p*o)}}function p0(r,t,e,i,s,n,o,a){const h=r-e*s,l=t-i*s,c=r+e*n,u=t+i*n;let d,f;o?(d=i,f=-e):(d=-i,f=e);const m=h+d,p=l+f,g=c+d,y=u+f;return a.push(m,p,g,y),2}function as(r,t,e,i,s,n,o,a){const h=e-r,l=i-t;let c=Math.atan2(h,l),u=Math.atan2(s-r,n-t);a&&c<u?c+=Math.PI*2:!a&&c>u&&(u+=Math.PI*2);let d=c;const f=u-c,m=Math.abs(f),p=Math.sqrt(h*h+l*l),g=(15*m*Math.sqrt(p)/Math.PI>>0)+1,y=f/g;if(d+=y,a){o.push(r,t,e,i);for(let _=1,b=d;_<g;_++,b+=y)o.push(r,t,r+Math.sin(b)*p,t+Math.cos(b)*p);o.push(r,t,s,n)}else{o.push(e,i,r,t);for(let _=1,b=d;_<g;_++,b+=y)o.push(r+Math.sin(b)*p,t+Math.cos(b)*p,r,t);o.push(s,n,r,t)}return g*2}function nS(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,o=new ut(i[0],i[1]),a=new ut(i[i.length-2],i[i.length-1]),h=e.type!==ce.POLY||e.closeStroke,l=Math.abs(o.x-a.x)<s&&Math.abs(o.y-a.y)<s;if(h){i=i.slice(),l&&(i.pop(),i.pop(),a.set(i[i.length-2],i[i.length-1]));const Z=(o.x+a.x)*.5,j=(a.y+o.y)*.5;i.unshift(Z,j),i.push(Z,j)}const c=t.points,u=i.length/2;let d=i.length;const f=c.length/2,m=n.width/2,p=m*m,g=n.miterLimit*n.miterLimit;let y=i[0],_=i[1],b=i[2],v=i[3],w=0,E=0,C=-(_-v),A=y-b,R=0,G=0,N=Math.sqrt(C*C+A*A);C/=N,A/=N,C*=m,A*=m;const P=n.alignment,I=(1-P)*2,D=P*2;h||(n.cap===Er.ROUND?d+=as(y-C*(I-D)*.5,_-A*(I-D)*.5,y-C*I,_-A*I,y+C*D,_+A*D,c,!0)+2:n.cap===Er.SQUARE&&(d+=p0(y,_,C,A,I,D,!0,c))),c.push(y-C*I,_-A*I,y+C*D,_+A*D);for(let Z=1;Z<u-1;++Z){y=i[(Z-1)*2],_=i[(Z-1)*2+1],b=i[Z*2],v=i[Z*2+1],w=i[(Z+1)*2],E=i[(Z+1)*2+1],C=-(_-v),A=y-b,N=Math.sqrt(C*C+A*A),C/=N,A/=N,C*=m,A*=m,R=-(v-E),G=b-w,N=Math.sqrt(R*R+G*G),R/=N,G/=N,R*=m,G*=m;const j=b-y,O=_-v,k=b-w,F=E-v,V=j*k+O*F,$=O*k-F*j,dt=$<0;if(Math.abs($)<.001*Math.abs(V)){c.push(b-C*I,v-A*I,b+C*D,v+A*D),V>=0&&(n.join===ze.ROUND?d+=as(b,v,b-C*I,v-A*I,b-R*I,v-G*I,c,!1)+4:d+=2,c.push(b-R*D,v-G*D,b+R*I,v+G*I));continue}const ot=(-C+y)*(-A+v)-(-C+b)*(-A+_),Ct=(-R+w)*(-G+v)-(-R+b)*(-G+E),Mt=(j*Ct-k*ot)/$,_t=(F*ot-O*Ct)/$,Y=(Mt-b)*(Mt-b)+(_t-v)*(_t-v),tt=b+(Mt-b)*I,et=v+(_t-v)*I,B=b-(Mt-b)*D,xt=v-(_t-v)*D,yt=Math.min(j*j+O*O,k*k+F*F),Lt=dt?I:D,Vt=yt+Lt*Lt*p,Xe=Y<=Vt;let pi=n.join;if(pi===ze.MITER&&Y/p>g&&(pi=ze.BEVEL),Xe)switch(pi){case ze.MITER:{c.push(tt,et,B,xt);break}case ze.BEVEL:{dt?c.push(tt,et,b+C*D,v+A*D,tt,et,b+R*D,v+G*D):c.push(b-C*I,v-A*I,B,xt,b-R*I,v-G*I,B,xt),d+=2;break}case ze.ROUND:{dt?(c.push(tt,et,b+C*D,v+A*D),d+=as(b,v,b+C*D,v+A*D,b+R*D,v+G*D,c,!0)+4,c.push(tt,et,b+R*D,v+G*D)):(c.push(b-C*I,v-A*I,B,xt),d+=as(b,v,b-C*I,v-A*I,b-R*I,v-G*I,c,!1)+4,c.push(b-R*I,v-G*I,B,xt));break}}else{switch(c.push(b-C*I,v-A*I,b+C*D,v+A*D),pi){case ze.MITER:{dt?c.push(B,xt,B,xt):c.push(tt,et,tt,et),d+=2;break}case ze.ROUND:{dt?d+=as(b,v,b+C*D,v+A*D,b+R*D,v+G*D,c,!0)+2:d+=as(b,v,b-C*I,v-A*I,b-R*I,v-G*I,c,!1)+2;break}}c.push(b-R*I,v-G*I,b+R*D,v+G*D),d+=2}}y=i[(u-2)*2],_=i[(u-2)*2+1],b=i[(u-1)*2],v=i[(u-1)*2+1],C=-(_-v),A=y-b,N=Math.sqrt(C*C+A*A),C/=N,A/=N,C*=m,A*=m,c.push(b-C*I,v-A*I,b+C*D,v+A*D),h||(n.cap===Er.ROUND?d+=as(b-C*(I-D)*.5,v-A*(I-D)*.5,b-C*I,v-A*I,b+C*D,v+A*D,c,!1)+2:n.cap===Er.SQUARE&&(d+=p0(b,v,C,A,I,D,!1,c)));const X=t.indices,H=tn.epsilon*tn.epsilon;for(let Z=f;Z<d+f-2;++Z)y=c[Z*2],_=c[Z*2+1],b=c[(Z+1)*2],v=c[(Z+1)*2+1],w=c[(Z+2)*2],E=c[(Z+2)*2+1],!(Math.abs(y*(v-E)+b*(E-_)+w*(_-v))<H)&&X.push(Z,Z+1,Z+2)}function oS(r,t){let e=0;const i=r.shape,s=r.points||i.points,n=i.type!==ce.POLY||i.closeStroke;if(s.length===0)return;const o=t.points,a=t.indices,h=s.length/2,l=o.length/2;let c=l;for(o.push(s[0],s[1]),e=1;e<h;e++)o.push(s[e*2],s[e*2+1]),a.push(c,c+1),c++;n&&a.push(c,l)}function m0(r,t){r.lineStyle.native?oS(r,t):nS(r,t)}class zc{static curveLength(t,e,i,s,n,o){const a=t-2*i+n,h=e-2*s+o,l=2*i-2*t,c=2*s-2*e,u=4*(a*a+h*h),d=4*(a*l+h*c),f=l*l+c*c,m=2*Math.sqrt(u+d+f),p=Math.sqrt(u),g=2*u*p,y=2*Math.sqrt(f),_=d/p;return(g*m+p*d*(m-y)+(4*f*u-d*d)*Math.log((2*p+_+m)/(_+y)))/(4*g)}static curveTo(t,e,i,s,n){const o=n[n.length-2],a=n[n.length-1],h=tn._segmentsCount(zc.curveLength(o,a,t,e,i,s));let l=0,c=0;for(let u=1;u<=h;++u){const d=u/h;l=o+(t-o)*d,c=a+(e-a)*d,n.push(l+(t+(i-t)*d-l)*d,c+(e+(s-e)*d-c)*d)}}}const jc={[ce.POLY]:d0,[ce.CIRC]:za,[ce.ELIP]:za,[ce.RECT]:iS,[ce.RREC]:rS},g0=[],ja=[];class Ja{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 Ja(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 en=new ut,y0=class Fb extends Jp{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 ka,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(),ja.push(this.drawCalls[t]);this.drawCalls.length=0;for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e.reset(),g0.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 Ja(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 Ja(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,en):en.copyFrom(t),s.shape.contains(en.x,en.y))){let n=!1;if(s.holes){for(let o=0;o<s.holes.length;o++)if(s.holes[o].shape.contains(en.x,en.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,u=l.lineStyle;jc[l.type].build(l),l.matrix&&this.transformPoints(l.points,l.matrix),(c.visible||u.visible)&&this.processHoles(l.holes);for(let d=0;d<2;d++){const f=d===0?c:u;if(!f.visible)continue;const m=f.texture.baseTexture,p=this.indices.length,g=this.points.length/2;m.wrapMode=_i.REPEAT,d===0?this.processFill(l):this.processLine(l);const y=this.points.length/2-g;y!==0&&(i&&!this._compareStyles(s,f)&&(i.end(p,g),i=null),i||(i=g0.pop()||new sS,i.begin(f,p,g),this.batches.push(i),s=f),this.addUvs(this.points,t,f.texture,g,y,f.matrix))}}const n=this.indices.length,o=this.points.length/2;if(i&&i.end(n,o),this.batches.length===0){this.batchable=!0;return}const a=o>65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&a===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=a?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 o=s.start+n;this.indicesUint16[o]=this.indicesUint16[o]-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<Fb.BATCHABLE_SIZE*2}buildDrawCalls(){let t=++gt._globalBatch;for(let u=0;u<this.drawCalls.length;u++)this.drawCalls[u].texArray.clear(),ja.push(this.drawCalls[u]);this.drawCalls.length=0;const e=this.colors,i=this.textureIds;let s=ja.pop();s||(s=new bc,s.texArray=new Sc),s.texArray.count=0,s.start=0,s.size=0,s.type=xi.TRIANGLES;let n=0,o=null,a=0,h=!1,l=xi.TRIANGLES,c=0;this.drawCalls.push(s);for(let u=0;u<this.batches.length;u++){const d=this.batches[u],f=8,m=d.style,p=m.texture.baseTexture;h!==!!m.native&&(h=!!m.native,l=h?xi.LINES:xi.TRIANGLES,o=null,n=f,t++),o!==p&&(o=p,p._batchEnabled!==t&&(n===f&&(t++,n=0,s.size>0&&(s=ja.pop(),s||(s=new bc,s.texArray=new Sc),this.drawCalls.push(s)),s.start=c,s.size=0,s.texArray.count=0,s.type=l),p.touched=1,p._batchEnabled=t,p._batchLocation=n,p.wrapMode=_i.REPEAT,s.texArray.elements[s.texArray.count++]=p,n++)),s.size+=d.size,c+=d.size,a=p._batchLocation,this.addColors(e,m.color,m.alpha,d.attribSize,d.attribStart),this.addTextureIds(i,a,d.attribSize,d.attribStart)}gt._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),o=new Float32Array(n),a=new Uint32Array(n);let h=0;for(let l=0;l<t.length/2;l++)o[h++]=t[l*2],o[h++]=t[l*2+1],o[h++]=e[l*2],o[h++]=e[l*2+1],a[h++]=i[l],o[h++]=s[l];this._buffer.update(n),this._indexBuffer.update(this.indicesUint16)}processFill(t){t.holes.length?d0.triangulate(t,this):jc[t.type].triangulate(t,this)}processLine(t){m0(t,this);for(let e=0;e<t.holes.length;e++)m0(t.holes[e],this)}processHoles(t){for(let e=0;e<t.length;e++){const i=t[e];jc[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 o=Ft.shared.setValue(e).toLittleEndianNumber(),a=Ft.shared.setValue(o).toPremultiplied(i);t.length=Math.max(t.length,n+s);for(let h=0;h<s;h++)t[n+h]=a}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,o=null){let a=0;const h=e.length,l=i.frame;for(;a<n;){let u=t[(s+a)*2],d=t[(s+a)*2+1];if(o){const f=o.a*u+o.c*d+o.tx;d=o.b*u+o.d*d+o.ty,u=f}a++,e.push(u/l.width,d/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,o=1e-6,a=i+s*2,h=e.frame,l=h.width/n.width,c=h.height/n.height;let u=h.x/h.width,d=h.y/h.height,f=Math.floor(t[i]+o),m=Math.floor(t[i+1]+o);for(let p=i+2;p<a;p+=2)f=Math.min(f,Math.floor(t[p]+o)),m=Math.min(m,Math.floor(t[p+1]+o));u-=f,d-=m;for(let p=i;p<a;p+=2)t[p]=(t[p]+u)*l,t[p+1]=(t[p+1]+d)*c}};y0.BATCHABLE_SIZE=100;let aS=y0;class $a{constructor(){this.color=16777215,this.alpha=1,this.texture=rt.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){const t=new $a;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=rt.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}class Jc extends $a{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=Er.BUTT,this.join=ze.MITER,this.miterLimit=10}clone(){const t=new Jc;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=Er.BUTT,this.join=ze.MITER,this.miterLimit=10}}const $c={},Qc=class yl extends At{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 $a,this._lineStyle=new Jc,this._matrix=null,this._holeMode=!1,this.state=Ai.for2d(),this._geometry=t||new aS,this._geometry.refCount++,this._transformID=-1,this._tintColor=new Ft(16777215),this.blendMode=ft.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new yl(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:rt.WHITE,color:t!=null&&t.texture?16777215:0,matrix:null,alignment:.5,native:!1,cap:Er.BUTT,join:ze.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 jr,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new jr,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),zc.curveTo(t,e,i,s,n),this}bezierCurveTo(t,e,i,s,n,o){return this._initCurve(),Yc.curveTo(t,e,i,s,n,o,this.currentPath.points),this}arcTo(t,e,i,s,n){this._initCurve(t,e);const o=this.currentPath.points,a=f0.curveTo(t,e,i,s,n,o);if(a){const{cx:h,cy:l,radius:c,startAngle:u,endAngle:d,anticlockwise:f}=a;this.arc(h,l,c,u,d,f)}return this}arc(t,e,i,s,n,o=!1){if(s===n)return this;if(!o&&n<=s?n+=xa:o&&s<=n&&(s+=xa),n-s===0)return this;const a=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 u=Math.abs(c[c.length-2]-a),d=Math.abs(c[c.length-1]-h);u<l&&d<l||c.push(a,h)}else this.moveTo(a,h),c=this.currentPath.points;return f0.arc(a,h,t,e,i,s,n,o,c),this}beginFill(t=0,e){return this.beginTextureFill({texture:rt.WHITE,color:t,alpha:e})}normalizeColor(t){const e=Ft.shared.setValue(t.color??0);t.color=e.toNumber(),t.alpha??(t.alpha=e.alpha)}beginTextureFill(t){const e={texture:rt.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 pt(t,e,i,s))}drawRoundedRect(t,e,i,s,n){return this.drawShape(new wa(t,e,i,s,n))}drawCircle(t,e,i){return this.drawShape(new va(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 jr(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===ce.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],o=n.style.color,a=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:a,blendMode:e,indices:l,uvs:h,_batchRGB:Ft.shared.setValue(o).toRgbArray(),_tintRGB:o,_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,o=i.drawCalls;n.translationMatrix=this.transform.worldTransform,Ft.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 a=0,h=o.length;a<h;a++)this._renderDrawCallDirect(t,i.drawCalls[a])}_renderDrawCallDirect(t,e){const{texArray:i,type:s,size:n,start:o}=e,a=i.count;for(let h=0;h<a;h++)t.texture.bind(i.elements[h],h);t.geometry.draw(s,n,o)}_resolveDirectShader(t){let e=this.shader;const i=this.pluginName;if(!e){if(!$c[i]){const{maxTextures:s}=t.plugins[i],n=new Int32Array(s);for(let h=0;h<s;h++)n[h]=h;const o={tint:new Float32Array([1,1,1,1]),translationMatrix:new Nt,default:oi.from({uSamplers:n},!0)},a=t.plugins[i]._shader.program;$c[i]=new Ri(a,o)}e=$c[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,yl._TEMP_POINT),this._geometry.containsPoint(yl._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=Ft.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,o=e.d,a=e.tx,h=e.ty,l=this._geometry.points,c=this.vertexData;let u=0;for(let d=0;d<l.length;d+=2){const f=l[d],m=l[d+1];c[u++]=i*f+n*m+a,c[u++]=o*m+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)}};Qc.curves=tn,Qc._TEMP_POINT=new ut;let so=Qc;class hS{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 qc=new ut,b0=new jr,x0=class Nb extends At{constructor(t,e,i,s=xi.TRIANGLES){super(),this.geometry=t,this.shader=e,this.state=i||Ai.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=q.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===xi.TRIANGLES&&e.length<Nb.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,o=s.b,a=s.c,h=s.d,l=s.tx,c=s.ty,u=this.vertexData;for(let d=0;d<u.length/2;d++){const f=e[d*2],m=e[d*2+1];u[d*2]=n*f+a*m+l,u[d*2+1]=o*f+h*m+c}if(this._roundPixels){const d=q.RESOLUTION;for(let f=0;f<u.length;++f)u[f]=Math.round(u[f]*d)/d}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 hS(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,qc);const e=this.geometry.getBuffer("aVertexPosition").data,i=b0.points,s=this.geometry.getIndex().data,n=s.length,o=this.drawMode===4?3:1;for(let a=0;a+2<n;a+=o){const h=s[a]*2,l=s[a+1]*2,c=s[a+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],b0.contains(qc.x,qc.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}};x0.BATCHABLE_SIZE=100;let tu=x0;class _0 extends vr{constructor(t,e,i){super();const s=new Kt(t),n=new Kt(e,!0),o=new Kt(i,!0,!0);this.addAttribute("aVertexPosition",s,2,!1,ht.FLOAT).addAttribute("aTextureCoord",n,2,!1,ht.FLOAT).addIndex(o),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}var lS=`varying vec2 vTextureCoord;
|
|
924
924
|
uniform vec4 uColor;
|
|
925
925
|
|
|
926
926
|
uniform sampler2D uSampler;
|
|
@@ -929,7 +929,7 @@ void main(void)
|
|
|
929
929
|
{
|
|
930
930
|
gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;
|
|
931
931
|
}
|
|
932
|
-
`,
|
|
932
|
+
`,cS=`attribute vec2 aVertexPosition;
|
|
933
933
|
attribute vec2 aTextureCoord;
|
|
934
934
|
|
|
935
935
|
uniform mat3 projectionMatrix;
|
|
@@ -944,7 +944,7 @@ void main(void)
|
|
|
944
944
|
|
|
945
945
|
vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;
|
|
946
946
|
}
|
|
947
|
-
`;class eu extends Ri{constructor(t,e){const i={uSampler:t,alpha:1,uTextureMatrix:Nt.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||er.from(lS
|
|
947
|
+
`;class eu extends Ri{constructor(t,e){const i={uSampler:t,alpha:1,uTextureMatrix:Nt.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||er.from(cS,lS),i),this._colorDirty=!1,this.uvMatrix=new ym(t),this.batchable=e.program===void 0,this.pluginName=e.pluginName,this._tintColor=new Ft(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;Ft.shared.setValue(this._tintColor).premultiply(this._alpha,t).toArray(this.uniforms.uColor)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}}class uS extends _0{constructor(t=200,e,i=0){super(new Float32Array(e.length*4),new Float32Array(e.length*4),new Uint16Array((e.length-1)*6)),this.points=e,this._width=t,this.textureScale=i,this.build()}get width(){return this._width}build(){const t=this.points;if(!t)return;const e=this.getBuffer("aVertexPosition"),i=this.getBuffer("aTextureCoord"),s=this.getIndex();if(t.length<1)return;e.data.length/4!==t.length&&(e.data=new Float32Array(t.length*4),i.data=new Float32Array(t.length*4),s.data=new Uint16Array((t.length-1)*6));const n=i.data,o=s.data;n[0]=0,n[1]=0,n[2]=0,n[3]=1;let a=0,h=t[0];const l=this._width*this.textureScale,c=t.length;for(let d=0;d<c;d++){const f=d*4;if(this.textureScale>0){const m=h.x-t[d].x,p=h.y-t[d].y,g=Math.sqrt(m*m+p*p);h=t[d],a+=g/l}else a=d/(c-1);n[f]=a,n[f+1]=0,n[f+2]=a,n[f+3]=1}let u=0;for(let d=0;d<c-1;d++){const f=d*2;o[u++]=f,o[u++]=f+1,o[u++]=f+2,o[u++]=f+2,o[u++]=f+1,o[u++]=f+3}i.update(),s.update(),this.updateVertices()}updateVertices(){const t=this.points;if(t.length<1)return;let e=t[0],i,s=0,n=0;const o=this.buffers[0].data,a=t.length,h=this.textureScale>0?this.textureScale*this._width/2:this._width/2;for(let l=0;l<a;l++){const c=t[l],u=l*4;l<t.length-1?i=t[l+1]:i=c,n=-(i.x-e.x),s=i.y-e.y;const d=Math.sqrt(s*s+n*n);d<1e-6?(s=0,n=0):(s/=d,n/=d,s*=h,n*=h),o[u]=c.x+s,o[u+1]=c.y+n,o[u+2]=c.x-s,o[u+3]=c.y-n,e=c}this.buffers[0].update()}update(){this.textureScale>0?this.build():this.updateVertices()}}class dS extends tu{constructor(t,e,i=0){const s=new uS(t.height,e,i),n=new eu(t);i>0&&(t.baseTexture.wrapMode=_i.REPEAT),super(s,n),this.autoUpdate=!0}_render(t){const e=this.geometry;(this.autoUpdate||e._width!==this.shader.texture.height)&&(e._width=this.shader.texture.height,e.update()),super._render(t)}}class v0{constructor(t,e,i){this.geometry=new vr,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||ht.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 Kt(G1(this.size),!0,!0),t.addIndex(this.indexBuffer),this.dynamicStride=0;for(let o=0;o<this.dynamicProperties.length;++o){const a=this.dynamicProperties[o];a.offset=e,e+=a.size,this.dynamicStride+=a.size}const i=new ArrayBuffer(this.size*this.dynamicStride*4*4);this.dynamicData=new Float32Array(i),this.dynamicDataUint32=new Uint32Array(i),this.dynamicBuffer=new Kt(this.dynamicData,!1,!1);let s=0;this.staticStride=0;for(let o=0;o<this.staticProperties.length;++o){const a=this.staticProperties[o];a.offset=s,s+=a.size,this.staticStride+=a.size}const n=new ArrayBuffer(this.size*this.staticStride*4*4);this.staticData=new Float32Array(n),this.staticDataUint32=new Uint32Array(n),this.staticBuffer=new Kt(this.staticData,!0,!1);for(let o=0;o<this.dynamicProperties.length;++o){const a=this.dynamicProperties[o];t.addAttribute(a.attributeName,this.dynamicBuffer,0,a.type===ht.UNSIGNED_BYTE,a.type,this.dynamicStride*4,a.offset*4)}for(let o=0;o<this.staticProperties.length;++o){const a=this.staticProperties[o];t.addAttribute(a.attributeName,this.staticBuffer,0,a.type===ht.UNSIGNED_BYTE,a.type,this.staticStride*4,a.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===ht.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===ht.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 fS=`varying vec2 vTextureCoord;
|
|
948
948
|
varying vec4 vColor;
|
|
949
949
|
|
|
950
950
|
uniform sampler2D uSampler;
|
|
@@ -952,7 +952,7 @@ uniform sampler2D uSampler;
|
|
|
952
952
|
void main(void){
|
|
953
953
|
vec4 color = texture2D(uSampler, vTextureCoord) * vColor;
|
|
954
954
|
gl_FragColor = color;
|
|
955
|
-
}`,
|
|
955
|
+
}`,pS=`attribute vec2 aVertexPosition;
|
|
956
956
|
attribute vec2 aTextureCoord;
|
|
957
957
|
attribute vec4 aColor;
|
|
958
958
|
|
|
@@ -977,8 +977,8 @@ void main(void){
|
|
|
977
977
|
vTextureCoord = aTextureCoord;
|
|
978
978
|
vColor = aColor * uColor;
|
|
979
979
|
}
|
|
980
|
-
`;class T0 extends Aa{constructor(t){super(t),this.shader=null,this.properties=null,this.tempMatrix=new Nt,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:ht.UNSIGNED_BYTE,uploadFunction:this.uploadTint,offset:0}],this.shader=Ri.from(fS,
|
|
981
|
-
`:t,t}static getFromCache(t,e,i,s){let n=i[t];return typeof n!="number"&&(n=st._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(!st.isBreakingSpace(i))break;t=t.slice(0,-1)}return t}static isNewline(t){return typeof t!="string"?!1:st._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:st._breakingSpaces.includes(t.charCodeAt(0))}static tokenize(t){const e=[];let i="";if(typeof t!="string")return e;for(let s=0;s<t.length;s++){const n=t[s],o=t[s+1];if(st.isBreakingSpace(n,o)||st.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 st.graphemeSegmenter(t)}static measureFont(t){if(st._fonts[t])return st._fonts[t];const e={ascent:0,descent:0,fontSize:0},i=st._canvas,s=st._context;s.font=t;const n=st.METRICS_STRING+st.BASELINE_SYMBOL,o=Math.ceil(s.measureText(n).width);let a=Math.ceil(s.measureText(st.BASELINE_SYMBOL).width);const h=Math.ceil(st.HEIGHT_MULTIPLIER*a);if(a=a*st.BASELINE_MULTIPLIER|0,o===0||h===0)return st._fonts[t]=e,e;i.width=o,i.height=h,s.fillStyle="#f00",s.fillRect(0,0,o,h),s.font=t,s.textBaseline="alphabetic",s.fillStyle="#000",s.fillText(n,0,a);const l=s.getImageData(0,0,o,h).data,c=l.length,u=o*4;let d=0,f=0,m=!1;for(d=0;d<a;++d){for(let p=0;p<u;p+=4)if(l[f+p]!==255){m=!0;break}if(!m)f+=u;else break}for(e.ascent=a-d,f=c-u,m=!1,d=h;d>a;--d){for(let p=0;p<u;p+=4)if(l[f+p]!==255){m=!0;break}if(!m)f-=u;else break}return e.descent=d-a,e.fontSize=e.ascent+e.descent,st._fonts[t]=e,e}static clearMetrics(t=""){t?delete st._fonts[t]:st._fonts={}}static get _canvas(){var t;if(!st.__canvas){let e;try{const i=new OffscreenCanvas(0,0);if((t=i.getContext("2d",qa))!=null&&t.measureText)return st.__canvas=i,i;e=q.ADAPTER.createCanvas()}catch{e=q.ADAPTER.createCanvas()}e.width=e.height=10,st.__canvas=e}return st.__canvas}static get _context(){return st.__context||(st.__context=st._canvas.getContext("2d",qa)),st.__context}};Mi.METRICS_STRING="|ÉqÅ",Mi.BASELINE_SYMBOL="M",Mi.BASELINE_MULTIPLIER=1.4,Mi.HEIGHT_MULTIPLIER=2,Mi.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]})(),Mi.experimentalLetterSpacing=!1,Mi._fonts={},Mi._newlines=[10,13],Mi._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let Er=Mi;const pS=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],w0=class Qo{constructor(t){this.styleID=0,this.reset(),ru(this,t,t)}clone(){const t={};return ru(t,this,Qo.defaultStyle),new Qo(t)}reset(){ru(this,Qo.defaultStyle,Qo.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=iu(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=iu(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){mS(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=iu(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)&&!pS.includes(s)&&(s=`"${s}"`),e[i]=s}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${t} ${e.join(",")}`}};w0.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:Qa.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 Ir=w0;function iu(r){const t=Ft.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 mS(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 ru(r,t,e){for(const i in e)Array.isArray(t[i])?r[i]=t[i].slice():r[i]=t[i]}const gS={texture:!0,children:!1,baseTexture:!0},S0=class Sf extends qt{constructor(t,e,i){let s=!1;i||(i=q.ADAPTER.createCanvas(),s=!0),i.width=3,i.height=3;const n=rt.from(i);n.orig=new pt,n.trim=new pt,super(n),this._ownCanvas=s,this.canvas=i,this.context=i.getContext("2d",{willReadFrequently:!0}),this._resolution=Sf.defaultResolution??q.RESOLUTION,this._autoResolution=Sf.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 Er.experimentalLetterSpacing}static set experimentalLetterSpacing(t){Tt("7.1.0","Text.experimentalLetterSpacing is deprecated, use TextMetrics.experimentalLetterSpacing"),Er.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=Er.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),n=s.width,o=s.height,a=s.lines,h=s.lineHeight,l=s.lineWidths,c=s.maxLineWidth,u=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,o)+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 d,f;const m=e.dropShadow?2:1;for(let p=0;p<m;++p){const g=e.dropShadow&&p===0,y=g?Math.ceil(Math.max(1,o)+e.padding*2):0,_=y*this._resolution;if(g){i.fillStyle="black",i.strokeStyle="black";const v=e.dropShadowColor,w=e.dropShadowBlur*this._resolution,C=e.dropShadowDistance*this._resolution;i.shadowColor=Ft.shared.setValue(v).setAlpha(e.dropShadowAlpha).toRgbaString(),i.shadowBlur=w,i.shadowOffsetX=Math.cos(e.dropShadowAngle)*C,i.shadowOffsetY=Math.sin(e.dropShadowAngle)*C+_}else i.fillStyle=this._generateFillStyle(e,a,s),i.strokeStyle=e.stroke,i.shadowColor="black",i.shadowBlur=0,i.shadowOffsetX=0,i.shadowOffsetY=0;let b=(h-u.fontSize)/2;h-u.fontSize<0&&(b=0);for(let v=0;v<a.length;v++)d=e.strokeThickness/2,f=e.strokeThickness/2+v*h+u.ascent+b,e.align==="right"?d+=c-l[v]:e.align==="center"&&(d+=(c-l[v])/2),e.stroke&&e.strokeThickness&&this.drawLetterSpacing(a[v],d+e.padding,f+e.padding-y,!0),e.fill&&this.drawLetterSpacing(a[v],d+e.padding,f+e.padding-y)}this.updateTexture()}drawLetterSpacing(t,e,i,s=!1){const n=this._style.letterSpacing;let o=!1;if(Er.experimentalLetterSpacingSupported&&(Er.experimentalLetterSpacing?(this.context.letterSpacing=`${n}px`,this.context.textLetterSpacing=`${n}px`,o=!0):(this.context.letterSpacing="0px",this.context.textLetterSpacing="0px")),n===0||o){s?this.context.strokeText(t,e,i):this.context.fillText(t,e,i);return}let a=e;const h=Er.graphemeSegmenter(t);let l=this.context.measureText(t).width,c=0;for(let u=0;u<h.length;++u){const d=h[u];s?this.context.strokeText(d,a,i):this.context.fillText(d,a,i);let f="";for(let m=u+1;m<h.length;++m)f+=h[m];c=this.context.measureText(f).width,a+=l-c+n,l=c}}updateTexture(){const t=this.canvas;if(this._style.trim){const o=D1(t);o.data&&(t.width=o.width,t.height=o.height,this.context.putImageData(o.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 o=t.dropShadow?t.dropShadowDistance:0,a=t.padding||0,h=this.canvas.width/this._resolution-o-a*2,l=this.canvas.height/this._resolution-o-a*2,c=s.slice(),u=t.fillGradientStops.slice();if(!u.length){const d=c.length+1;for(let f=1;f<d;++f)u.push(f/d)}if(c.unshift(s[0]),u.unshift(0),c.push(s[s.length-1]),u.push(1),t.fillGradientType===Qa.LINEAR_VERTICAL){n=this.context.createLinearGradient(h/2,a,h/2,l+a);const d=i.fontProperties.fontSize+t.strokeThickness;for(let f=0;f<e.length;f++){const m=i.lineHeight*(f-1)+d,p=i.lineHeight*f;let g=p;f>0&&m>p&&(g=(p+m)/2);const y=p+d,_=i.lineHeight*(f+1);let b=y;f+1<e.length&&_<y&&(b=(y+_)/2);const v=(b-g)/l;for(let w=0;w<c.length;w++){let C=0;typeof u[w]=="number"?C=u[w]:C=w/c.length;let E=Math.min(1,Math.max(0,g/l+C*v));E=Number(E.toFixed(5)),n.addColorStop(E,c[w])}}}else{n=this.context.createLinearGradient(a,l/2,h+a,l/2);const d=c.length+1;let f=1;for(let m=0;m<c.length;m++){let p;typeof u[m]=="number"?p=u[m]:p=f/d,n.addColorStop(p,c[m]),f++}}return n}destroy(t){typeof t=="boolean"&&(t={children:t}),t=Object.assign({},gS,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=xr(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=xr(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 Ir?this._style=t:this._style=new Ir(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)}};S0.defaultAutoResolution=!0;let C0=S0;class yS{constructor(t){this.maxItemsPerFrame=t,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function bS(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 rt){const n=r._textures[s].baseTexture;t.includes(n)||(t.push(n),e=!0)}}return e}function xS(r,t){if(r.baseTexture instanceof gt){const e=r.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function _S(r,t){if(r._texture&&r._texture instanceof rt){const e=r._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function vS(r,t){return t instanceof C0?(t.updateText(!0),!0):!1}function TS(r,t){if(t instanceof Ir){const e=t.toFontString();return Er.measureFont(e),!0}return!1}function wS(r,t){if(r instanceof C0){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 SS(r,t){return r instanceof Ir?(t.includes(r)||t.push(r),!0):!1}const E0=class Nb{constructor(t){this.limiter=new yS(Nb.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(wS),this.registerFindHook(SS),this.registerFindHook(bS),this.registerFindHook(xS),this.registerFindHook(_S),this.registerUploadHook(vS),this.registerUploadHook(TS)}upload(t){return new Promise(e=>{t&&this.add(t),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,ve.system.addOnce(this.tick,this,ss.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)ve.system.addOnce(this.tick,this,ss.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 At)for(let e=t.children.length-1;e>=0;e--)this.add(t.children[e]);return this}destroy(){this.ticking&&ve.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}};E0.uploadsPerFrame=4;let su=E0;Object.defineProperties(q,{UPLOADS_PER_FRAME:{get(){return su.uploadsPerFrame},set(r){Tt("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),su.uploadsPerFrame=r}}});function I0(r,t){return t instanceof gt?(t._glTextures[r.CONTEXT_UID]||r.texture.bind(t),!0):!1}function CS(r,t){if(!(t instanceof io))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&&I0(r,n.baseTexture)}return e.batchable||r.geometry.bind(e,t._resolveDirectShader(r)),!0}function ES(r,t){return r instanceof io?(t.push(r),!0):!1}class A0 extends su{constructor(t){super(t),this.uploadHookHelper=this.renderer,this.registerFindHook(ES),this.registerUploadHook(I0),this.registerUploadHook(CS)}}A0.extension={name:"prepare",type:J.RendererSystem},it.add(A0);var IS=`#version 300 es
|
|
980
|
+
`;class T0 extends Aa{constructor(t){super(t),this.shader=null,this.properties=null,this.tempMatrix=new Nt,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:ht.UNSIGNED_BYTE,uploadFunction:this.uploadTint,offset:0}],this.shader=Ri.from(pS,fS,{}),this.state=Ai.for2d()}render(t){const e=t.children,i=t._maxSize,s=t._batchSize,n=this.renderer;let o=e.length;if(o===0)return;o>i&&!t.autoResize&&(o=i);let a=t._buffers;a||(a=t._buffers=this.generateBuffers(t));const h=e[0]._texture.baseTexture,l=h.alphaMode>0;this.state.blendMode=Bp(t.blendMode,l),n.state.set(this.state);const c=n.gl,u=t.worldTransform.copyTo(this.tempMatrix);u.prepend(n.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=u.toArray(!0),this.shader.uniforms.uColor=Ft.shared.setValue(t.tintRgb).premultiply(t.worldAlpha,l).toArray(this.shader.uniforms.uColor),this.shader.uniforms.uSampler=h,this.renderer.shader.bind(this.shader);let d=!1;for(let f=0,m=0;f<o;f+=s,m+=1){let p=o-f;p>s&&(p=s),m>=a.length&&a.push(this._generateOneMoreBuffer(t));const g=a[m];g.uploadDynamic(e,f,p);const y=t._bufferUpdateIDs[m]||0;d=d||g._updateID<y,d&&(g._updateID=t._updateID,g.uploadStatic(e,f,p)),n.geometry.bind(g.geometry),c.drawElements(c.TRIANGLES,p*6,c.UNSIGNED_SHORT,0)}}generateBuffers(t){const e=[],i=t._maxSize,s=t._batchSize,n=t._properties;for(let o=0;o<i;o+=s)e.push(new v0(this.properties,n,s));return e}_generateOneMoreBuffer(t){const e=t._batchSize,i=t._properties;return new v0(this.properties,i,e)}uploadVertices(t,e,i,s,n,o){let a=0,h=0,l=0,c=0;for(let u=0;u<i;++u){const d=t[e+u],f=d._texture,m=d.scale.x,p=d.scale.y,g=f.trim,y=f.orig;g?(h=g.x-d.anchor.x*y.width,a=h+g.width,c=g.y-d.anchor.y*y.height,l=c+g.height):(a=y.width*(1-d.anchor.x),h=y.width*-d.anchor.x,l=y.height*(1-d.anchor.y),c=y.height*-d.anchor.y),s[o]=h*m,s[o+1]=c*p,s[o+n]=a*m,s[o+n+1]=c*p,s[o+n*2]=a*m,s[o+n*2+1]=l*p,s[o+n*3]=h*m,s[o+n*3+1]=l*p,o+=n*4}}uploadPosition(t,e,i,s,n,o){for(let a=0;a<i;a++){const h=t[e+a].position;s[o]=h.x,s[o+1]=h.y,s[o+n]=h.x,s[o+n+1]=h.y,s[o+n*2]=h.x,s[o+n*2+1]=h.y,s[o+n*3]=h.x,s[o+n*3+1]=h.y,o+=n*4}}uploadRotation(t,e,i,s,n,o){for(let a=0;a<i;a++){const h=t[e+a].rotation;s[o]=h,s[o+n]=h,s[o+n*2]=h,s[o+n*3]=h,o+=n*4}}uploadUvs(t,e,i,s,n,o){for(let a=0;a<i;++a){const h=t[e+a]._texture._uvs;h?(s[o]=h.x0,s[o+1]=h.y0,s[o+n]=h.x1,s[o+n+1]=h.y1,s[o+n*2]=h.x2,s[o+n*2+1]=h.y2,s[o+n*3]=h.x3,s[o+n*3+1]=h.y3,o+=n*4):(s[o]=0,s[o+1]=0,s[o+n]=0,s[o+n+1]=0,s[o+n*2]=0,s[o+n*2+1]=0,s[o+n*3]=0,s[o+n*3+1]=0,o+=n*4)}}uploadTint(t,e,i,s,n,o){for(let a=0;a<i;++a){const h=t[e+a],l=Ft.shared.setValue(h._tintRGB).toPremultiplied(h.alpha,h.texture.baseTexture.alphaMode>0);s[o]=l,s[o+n]=l,s[o+n*2]=l,s[o+n*3]=l,o+=n*4}}destroy(){super.destroy(),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null}}T0.extension={name:"particle",type:J.RendererPlugin},it.add(T0);var Qa=(r=>(r[r.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",r[r.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",r))(Qa||{});const qa={willReadFrequently:!0},Mi=class nt{static get experimentalLetterSpacingSupported(){let t=nt._experimentalLetterSpacingSupported;if(t!==void 0){const e=q.ADAPTER.getCanvasRenderingContext2D().prototype;t=nt._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,i,s,n,o,a,h,l){this.text=t,this.style=e,this.width=i,this.height=s,this.lines=n,this.lineWidths=o,this.lineHeight=a,this.maxLineWidth=h,this.fontProperties=l}static measureText(t,e,i,s=nt._canvas){i=i??e.wordWrap;const n=e.toFontString(),o=nt.measureFont(n);o.fontSize===0&&(o.fontSize=e.fontSize,o.ascent=e.fontSize);const a=s.getContext("2d",qa);a.font=n;const h=(i?nt.wordWrap(t,e,s):t).split(/(?:\r\n|\r|\n)/),l=new Array(h.length);let c=0;for(let m=0;m<h.length;m++){const p=nt._measureText(h[m],e.letterSpacing,a);l[m]=p,c=Math.max(c,p)}let u=c+e.strokeThickness;e.dropShadow&&(u+=e.dropShadowDistance);const d=e.lineHeight||o.fontSize+e.strokeThickness;let f=Math.max(d,o.fontSize+e.strokeThickness*2)+e.leading+(h.length-1)*(d+e.leading);return e.dropShadow&&(f+=e.dropShadowDistance),new nt(t,e,u,f,h,l,d+e.leading,c,o)}static _measureText(t,e,i){let s=!1;nt.experimentalLetterSpacingSupported&&(nt.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+=(nt.graphemeSegmenter(t).length-1)*e),n}static wordWrap(t,e,i=nt._canvas){const s=i.getContext("2d",qa);let n=0,o="",a="";const h=Object.create(null),{letterSpacing:l,whiteSpace:c}=e,u=nt.collapseSpaces(c),d=nt.collapseNewlines(c);let f=!u;const m=e.wordWrapWidth+l,p=nt.tokenize(t);for(let g=0;g<p.length;g++){let y=p[g];if(nt.isNewline(y)){if(!d){a+=nt.addLine(o),f=!u,o="",n=0;continue}y=" "}if(u){const b=nt.isBreakingSpace(y),v=nt.isBreakingSpace(o[o.length-1]);if(b&&v)continue}const _=nt.getFromCache(y,l,h,s);if(_>m)if(o!==""&&(a+=nt.addLine(o),o="",n=0),nt.canBreakWords(y,e.breakWords)){const b=nt.wordWrapSplit(y);for(let v=0;v<b.length;v++){let w=b[v],E=w,C=1;for(;b[v+C];){const R=b[v+C];if(!nt.canBreakChars(E,R,y,v,e.breakWords))w+=R;else break;E=R,C++}v+=C-1;const A=nt.getFromCache(w,l,h,s);A+n>m&&(a+=nt.addLine(o),f=!1,o="",n=0),o+=w,n+=A}}else{o.length>0&&(a+=nt.addLine(o),o="",n=0);const b=g===p.length-1;a+=nt.addLine(y,!b),f=!1,o="",n=0}else _+n>m&&(f=!1,a+=nt.addLine(o),o="",n=0),(o.length>0||!nt.isBreakingSpace(y)||f)&&(o+=y,n+=_)}return a+=nt.addLine(o,!1),a}static addLine(t,e=!0){return t=nt.trimRight(t),t=e?`${t}
|
|
981
|
+
`:t,t}static getFromCache(t,e,i,s){let n=i[t];return typeof n!="number"&&(n=nt._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(!nt.isBreakingSpace(i))break;t=t.slice(0,-1)}return t}static isNewline(t){return typeof t!="string"?!1:nt._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:nt._breakingSpaces.includes(t.charCodeAt(0))}static tokenize(t){const e=[];let i="";if(typeof t!="string")return e;for(let s=0;s<t.length;s++){const n=t[s],o=t[s+1];if(nt.isBreakingSpace(n,o)||nt.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 nt.graphemeSegmenter(t)}static measureFont(t){if(nt._fonts[t])return nt._fonts[t];const e={ascent:0,descent:0,fontSize:0},i=nt._canvas,s=nt._context;s.font=t;const n=nt.METRICS_STRING+nt.BASELINE_SYMBOL,o=Math.ceil(s.measureText(n).width);let a=Math.ceil(s.measureText(nt.BASELINE_SYMBOL).width);const h=Math.ceil(nt.HEIGHT_MULTIPLIER*a);if(a=a*nt.BASELINE_MULTIPLIER|0,o===0||h===0)return nt._fonts[t]=e,e;i.width=o,i.height=h,s.fillStyle="#f00",s.fillRect(0,0,o,h),s.font=t,s.textBaseline="alphabetic",s.fillStyle="#000",s.fillText(n,0,a);const l=s.getImageData(0,0,o,h).data,c=l.length,u=o*4;let d=0,f=0,m=!1;for(d=0;d<a;++d){for(let p=0;p<u;p+=4)if(l[f+p]!==255){m=!0;break}if(!m)f+=u;else break}for(e.ascent=a-d,f=c-u,m=!1,d=h;d>a;--d){for(let p=0;p<u;p+=4)if(l[f+p]!==255){m=!0;break}if(!m)f-=u;else break}return e.descent=d-a,e.fontSize=e.ascent+e.descent,nt._fonts[t]=e,e}static clearMetrics(t=""){t?delete nt._fonts[t]:nt._fonts={}}static get _canvas(){var t;if(!nt.__canvas){let e;try{const i=new OffscreenCanvas(0,0);if((t=i.getContext("2d",qa))!=null&&t.measureText)return nt.__canvas=i,i;e=q.ADAPTER.createCanvas()}catch{e=q.ADAPTER.createCanvas()}e.width=e.height=10,nt.__canvas=e}return nt.__canvas}static get _context(){return nt.__context||(nt.__context=nt._canvas.getContext("2d",qa)),nt.__context}};Mi.METRICS_STRING="|ÉqÅ",Mi.BASELINE_SYMBOL="M",Mi.BASELINE_MULTIPLIER=1.4,Mi.HEIGHT_MULTIPLIER=2,Mi.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]})(),Mi.experimentalLetterSpacing=!1,Mi._fonts={},Mi._newlines=[10,13],Mi._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let Cr=Mi;const mS=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],w0=class Qo{constructor(t){this.styleID=0,this.reset(),ru(this,t,t)}clone(){const t={};return ru(t,this,Qo.defaultStyle),new Qo(t)}reset(){ru(this,Qo.defaultStyle,Qo.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=iu(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=iu(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){gS(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=iu(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)&&!mS.includes(s)&&(s=`"${s}"`),e[i]=s}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${t} ${e.join(",")}`}};w0.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:Qa.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 Ir=w0;function iu(r){const t=Ft.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 gS(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 ru(r,t,e){for(const i in e)Array.isArray(t[i])?r[i]=t[i].slice():r[i]=t[i]}const yS={texture:!0,children:!1,baseTexture:!0},S0=class Sf extends qt{constructor(t,e,i){let s=!1;i||(i=q.ADAPTER.createCanvas(),s=!0),i.width=3,i.height=3;const n=rt.from(i);n.orig=new pt,n.trim=new pt,super(n),this._ownCanvas=s,this.canvas=i,this.context=i.getContext("2d",{willReadFrequently:!0}),this._resolution=Sf.defaultResolution??q.RESOLUTION,this._autoResolution=Sf.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 Cr.experimentalLetterSpacing}static set experimentalLetterSpacing(t){Tt("7.1.0","Text.experimentalLetterSpacing is deprecated, use TextMetrics.experimentalLetterSpacing"),Cr.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=Cr.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),n=s.width,o=s.height,a=s.lines,h=s.lineHeight,l=s.lineWidths,c=s.maxLineWidth,u=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,o)+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 d,f;const m=e.dropShadow?2:1;for(let p=0;p<m;++p){const g=e.dropShadow&&p===0,y=g?Math.ceil(Math.max(1,o)+e.padding*2):0,_=y*this._resolution;if(g){i.fillStyle="black",i.strokeStyle="black";const v=e.dropShadowColor,w=e.dropShadowBlur*this._resolution,E=e.dropShadowDistance*this._resolution;i.shadowColor=Ft.shared.setValue(v).setAlpha(e.dropShadowAlpha).toRgbaString(),i.shadowBlur=w,i.shadowOffsetX=Math.cos(e.dropShadowAngle)*E,i.shadowOffsetY=Math.sin(e.dropShadowAngle)*E+_}else i.fillStyle=this._generateFillStyle(e,a,s),i.strokeStyle=e.stroke,i.shadowColor="black",i.shadowBlur=0,i.shadowOffsetX=0,i.shadowOffsetY=0;let b=(h-u.fontSize)/2;h-u.fontSize<0&&(b=0);for(let v=0;v<a.length;v++)d=e.strokeThickness/2,f=e.strokeThickness/2+v*h+u.ascent+b,e.align==="right"?d+=c-l[v]:e.align==="center"&&(d+=(c-l[v])/2),e.stroke&&e.strokeThickness&&this.drawLetterSpacing(a[v],d+e.padding,f+e.padding-y,!0),e.fill&&this.drawLetterSpacing(a[v],d+e.padding,f+e.padding-y)}this.updateTexture()}drawLetterSpacing(t,e,i,s=!1){const n=this._style.letterSpacing;let o=!1;if(Cr.experimentalLetterSpacingSupported&&(Cr.experimentalLetterSpacing?(this.context.letterSpacing=`${n}px`,this.context.textLetterSpacing=`${n}px`,o=!0):(this.context.letterSpacing="0px",this.context.textLetterSpacing="0px")),n===0||o){s?this.context.strokeText(t,e,i):this.context.fillText(t,e,i);return}let a=e;const h=Cr.graphemeSegmenter(t);let l=this.context.measureText(t).width,c=0;for(let u=0;u<h.length;++u){const d=h[u];s?this.context.strokeText(d,a,i):this.context.fillText(d,a,i);let f="";for(let m=u+1;m<h.length;++m)f+=h[m];c=this.context.measureText(f).width,a+=l-c+n,l=c}}updateTexture(){const t=this.canvas;if(this._style.trim){const o=k1(t);o.data&&(t.width=o.width,t.height=o.height,this.context.putImageData(o.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 o=t.dropShadow?t.dropShadowDistance:0,a=t.padding||0,h=this.canvas.width/this._resolution-o-a*2,l=this.canvas.height/this._resolution-o-a*2,c=s.slice(),u=t.fillGradientStops.slice();if(!u.length){const d=c.length+1;for(let f=1;f<d;++f)u.push(f/d)}if(c.unshift(s[0]),u.unshift(0),c.push(s[s.length-1]),u.push(1),t.fillGradientType===Qa.LINEAR_VERTICAL){n=this.context.createLinearGradient(h/2,a,h/2,l+a);const d=i.fontProperties.fontSize+t.strokeThickness;for(let f=0;f<e.length;f++){const m=i.lineHeight*(f-1)+d,p=i.lineHeight*f;let g=p;f>0&&m>p&&(g=(p+m)/2);const y=p+d,_=i.lineHeight*(f+1);let b=y;f+1<e.length&&_<y&&(b=(y+_)/2);const v=(b-g)/l;for(let w=0;w<c.length;w++){let E=0;typeof u[w]=="number"?E=u[w]:E=w/c.length;let C=Math.min(1,Math.max(0,g/l+E*v));C=Number(C.toFixed(5)),n.addColorStop(C,c[w])}}}else{n=this.context.createLinearGradient(a,l/2,h+a,l/2);const d=c.length+1;let f=1;for(let m=0;m<c.length;m++){let p;typeof u[m]=="number"?p=u[m]:p=f/d,n.addColorStop(p,c[m]),f++}}return n}destroy(t){typeof t=="boolean"&&(t={children:t}),t=Object.assign({},yS,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=xr(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=xr(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 Ir?this._style=t:this._style=new Ir(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)}};S0.defaultAutoResolution=!0;let E0=S0;class bS{constructor(t){this.maxItemsPerFrame=t,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function xS(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 rt){const n=r._textures[s].baseTexture;t.includes(n)||(t.push(n),e=!0)}}return e}function _S(r,t){if(r.baseTexture instanceof gt){const e=r.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function vS(r,t){if(r._texture&&r._texture instanceof rt){const e=r._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function TS(r,t){return t instanceof E0?(t.updateText(!0),!0):!1}function wS(r,t){if(t instanceof Ir){const e=t.toFontString();return Cr.measureFont(e),!0}return!1}function SS(r,t){if(r instanceof E0){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 ES(r,t){return r instanceof Ir?(t.includes(r)||t.push(r),!0):!1}const C0=class Db{constructor(t){this.limiter=new bS(Db.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(SS),this.registerFindHook(ES),this.registerFindHook(xS),this.registerFindHook(_S),this.registerFindHook(vS),this.registerUploadHook(TS),this.registerUploadHook(wS)}upload(t){return new Promise(e=>{t&&this.add(t),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,ve.system.addOnce(this.tick,this,ss.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)ve.system.addOnce(this.tick,this,ss.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 At)for(let e=t.children.length-1;e>=0;e--)this.add(t.children[e]);return this}destroy(){this.ticking&&ve.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}};C0.uploadsPerFrame=4;let su=C0;Object.defineProperties(q,{UPLOADS_PER_FRAME:{get(){return su.uploadsPerFrame},set(r){Tt("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),su.uploadsPerFrame=r}}});function I0(r,t){return t instanceof gt?(t._glTextures[r.CONTEXT_UID]||r.texture.bind(t),!0):!1}function CS(r,t){if(!(t instanceof so))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&&I0(r,n.baseTexture)}return e.batchable||r.geometry.bind(e,t._resolveDirectShader(r)),!0}function IS(r,t){return r instanceof so?(t.push(r),!0):!1}class A0 extends su{constructor(t){super(t),this.uploadHookHelper=this.renderer,this.registerFindHook(IS),this.registerUploadHook(I0),this.registerUploadHook(CS)}}A0.extension={name:"prepare",type:J.RendererSystem},it.add(A0);var AS=`#version 300 es
|
|
982
982
|
#define SHADER_NAME Tiling-Sprite-100
|
|
983
983
|
|
|
984
984
|
precision lowp float;
|
|
@@ -1004,7 +1004,7 @@ void main(void)
|
|
|
1004
1004
|
|
|
1005
1005
|
fragmentColor = texSample * uColor;
|
|
1006
1006
|
}
|
|
1007
|
-
`,
|
|
1007
|
+
`,RS=`#version 300 es
|
|
1008
1008
|
#define SHADER_NAME Tiling-Sprite-300
|
|
1009
1009
|
|
|
1010
1010
|
precision lowp float;
|
|
@@ -1024,7 +1024,7 @@ void main(void)
|
|
|
1024
1024
|
|
|
1025
1025
|
vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;
|
|
1026
1026
|
}
|
|
1027
|
-
`,
|
|
1027
|
+
`,MS=`#version 100
|
|
1028
1028
|
#ifdef GL_EXT_shader_texture_lod
|
|
1029
1029
|
#extension GL_EXT_shader_texture_lod : enable
|
|
1030
1030
|
#endif
|
|
@@ -1077,7 +1077,7 @@ void main(void)
|
|
|
1077
1077
|
|
|
1078
1078
|
vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;
|
|
1079
1079
|
}
|
|
1080
|
-
`,
|
|
1080
|
+
`,LS=`#version 100
|
|
1081
1081
|
#define SHADER_NAME Tiling-Sprite-Simple-100
|
|
1082
1082
|
|
|
1083
1083
|
precision lowp float;
|
|
@@ -1092,7 +1092,7 @@ void main(void)
|
|
|
1092
1092
|
vec4 texSample = texture2D(uSampler, vTextureCoord);
|
|
1093
1093
|
gl_FragColor = texSample * uColor;
|
|
1094
1094
|
}
|
|
1095
|
-
`;const th=new Nt;class M0 extends Aa{constructor(t){super(t),t.runners.contextChange.add(this),this.quad=new dm,this.state=Ai.for2d()}contextChange(){const t=this.renderer,e={globals:t.globalUniforms};this.simpleShader=Ri.from(R0,MS,e),this.shader=t.context.webGLVersion>1?Ri.from(AS,IS,e):Ri.from(R0,RS,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,o=t.uvRespectAnchor?t.anchor.y:0;s=i.uvs,s[0]=s[6]=-n,s[1]=s[3]=-o,s[2]=s[4]=1-n,s[5]=s[7]=1-o,i.invalidate();const a=t._texture,h=a.baseTexture,l=h.alphaMode>0,c=t.tileTransform.localTransform,u=t.uvMatrix;let d=h.isPowerOfTwo&&a.frame.width===h.width&&a.frame.height===h.height;d&&(h._glTextures[e.CONTEXT_UID]?d=h.wrapMode!==_i.CLAMP:h.wrapMode===_i.CLAMP&&(h.wrapMode=_i.REPEAT));const f=d?this.simpleShader:this.shader,m=a.width,p=a.height,g=t._width,y=t._height;th.set(c.a*m/g,c.b*m/y,c.c*p/g,c.d*p/y,c.tx/g,c.ty/y),th.invert(),d?th.prepend(u.mapCoord):(f.uniforms.uMapCoord=u.mapCoord.toArray(!0),f.uniforms.uClampFrame=u.uClampFrame,f.uniforms.uClampOffset=u.uClampOffset),f.uniforms.uTransform=th.toArray(!0),f.uniforms.uColor=Ft.shared.setValue(t.tint).premultiply(t.worldAlpha,l).toArray(f.uniforms.uColor),f.uniforms.translationMatrix=t.transform.worldTransform.toArray(!0),f.uniforms.uSampler=a,e.shader.bind(f),e.geometry.bind(i),this.state.blendMode=Bp(t.blendMode,l),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}M0.extension={name:"tilingSprite",type:J.RendererPlugin},it.add(M0);const L0=class qo{constructor(t,e,i=null){this.linkedSheets=[],this._texture=t instanceof rt?t:null,this.baseTexture=t instanceof gt?t:this._texture.baseTexture,this.textures={},this.animations={},this.data=e;const s=this.baseTexture.resource;this.resolution=this._updateResolution(i||(s?s.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=qi(t,null);return i===null&&(i=parseFloat(e??"1")),i!==1&&this.baseTexture.setResolution(i),i}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=qo.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const i=qo.BATCH_SIZE;for(;e-t<i&&e<this._frameKeys.length;){const s=this._frameKeys[e],n=this._frames[s],o=n.frame;if(o){let a=null,h=null;const l=n.trimmed!==!1&&n.sourceSize?n.sourceSize:n.frame,c=new pt(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);n.rotated?a=new pt(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.h)/this.resolution,Math.floor(o.w)/this.resolution):a=new pt(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution),n.trimmed!==!1&&n.spriteSourceSize&&(h=new pt(Math.floor(n.spriteSourceSize.x)/this.resolution,Math.floor(n.spriteSourceSize.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution)),this.textures[s]=new rt(this.baseTexture,a,c,h,n.rotated?2:0,n.anchor,n.borders),rt.addToCache(this.textures[s],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*qo.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*qo.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=[]}};L0.BATCH_SIZE=1e3;let P0=L0;const LS=["jpg","png","jpeg","avif","webp"];function G0(r,t,e){const i={};if(r.forEach(s=>{i[s]=t}),Object.keys(t.textures).forEach(s=>{i[s]=t.textures[s]}),!e){const s=Qt.dirname(r[0]);t.linkedSheets.forEach((n,o)=>{const a=G0([`${s}/${t.data.meta.related_multi_packs[o]}`],n,!0);Object.assign(i,a)})}return i}const PS={extension:J.Asset,cache:{test:r=>r instanceof P0,getCacheableAssets:(r,t)=>G0(r,t,!1)},resolver:{test:r=>{const t=r.split("?")[0].split("."),e=t.pop(),i=t.pop();return e==="json"&&LS.includes(i)},parse:r=>{var e;const t=r.split(".");return{resolution:parseFloat(((e=q.RETINA_PREFIX.exec(r))==null?void 0:e[1])??"1"),format:t[t.length-2],src:r}}},loader:{name:"spritesheetLoader",extension:{type:J.LoadParser,priority:li.Normal},async testParse(r,t){return Qt.extname(t.src).toLowerCase()===".json"&&!!r.frames},async parse(r,t,e){var h,l;let i=Qt.dirname(t.src);i&&i.lastIndexOf("/")!==i.length-1&&(i+="/");let s=i+r.meta.image;s=Uc(s,t.src);const n=(await e.load([s]))[s],o=new P0(n.baseTexture,r,t.src);await o.parse();const a=(h=r==null?void 0:r.meta)==null?void 0:h.related_multi_packs;if(Array.isArray(a)){const c=[];for(const d of a){if(typeof d!="string")continue;let f=i+d;(l=t.data)!=null&&l.ignoreMultiPack||(f=Uc(f,t.src),c.push(e.load({src:f,data:{ignoreMultiPack:!0}})))}const u=await Promise.all(c);o.linkedSheets=u,u.forEach(d=>{d.linkedSheets=[o].concat(o.linkedSheets.filter(f=>f!==d))})}return o},unload(r){r.destroy(!0)}}};it.add(PS);class eh{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class ih{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 o=e[n].match(/^[a-z]+/gm)[0],a=e[n].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),h={};for(const l in a){const c=a[l].split("="),u=c[0],d=c[1].replace(/"/gm,""),f=parseFloat(d),m=isNaN(f)?d:f;h[u]=m}i[o].push(h)}const s=new eh;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 nu{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 eh,i=t.getElementsByTagName("info"),s=t.getElementsByTagName("common"),n=t.getElementsByTagName("page"),o=t.getElementsByTagName("char"),a=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<o.length;l++){const c=o[l];e.char.push({id:parseInt(c.getAttribute("id"),10),page:parseInt(c.getAttribute("page"),10)||0,x:parseInt(c.getAttribute("x"),10),y:parseInt(c.getAttribute("y"),10),width:parseInt(c.getAttribute("width"),10),height:parseInt(c.getAttribute("height"),10),xoffset:parseInt(c.getAttribute("xoffset"),10),yoffset:parseInt(c.getAttribute("yoffset"),10),xadvance:parseInt(c.getAttribute("xadvance"),10)})}for(let l=0;l<a.length;l++)e.kerning.push({first:parseInt(a[l].getAttribute("first"),10),second:parseInt(a[l].getAttribute("second"),10),amount:parseInt(a[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 ou{static test(t){return typeof t=="string"&&t.includes("<font>")?nu.test(q.ADAPTER.parseXML(t)):!1}static parse(t){return nu.parse(q.ADAPTER.parseXML(t))}}const au=[ih,nu,ou];function GS(r){for(let t=0;t<au.length;t++)if(au[t].test(r))return au[t];return null}function FS(r,t,e,i,s,n){const o=e.fill;if(Array.isArray(o)){if(o.length===1)return o[0]}else return o;let a;const h=e.dropShadow?e.dropShadowDistance:0,l=e.padding||0,c=r.width/i-h-l*2,u=r.height/i-h-l*2,d=o.slice(),f=e.fillGradientStops.slice();if(!f.length){const m=d.length+1;for(let p=1;p<m;++p)f.push(p/m)}if(d.unshift(o[0]),f.unshift(0),d.push(o[o.length-1]),f.push(1),e.fillGradientType===Qa.LINEAR_VERTICAL){a=t.createLinearGradient(c/2,l,c/2,u+l);let m=0;const p=(n.fontProperties.fontSize+e.strokeThickness)/u;for(let g=0;g<s.length;g++){const y=n.lineHeight*g;for(let _=0;_<d.length;_++){let b=0;typeof f[_]=="number"?b=f[_]:b=_/d.length;const v=y/u+b*p;let w=Math.max(m,v);w=Math.min(w,1),a.addColorStop(w,d[_]),m=w}}}else{a=t.createLinearGradient(l,u/2,c+l,u/2);const m=d.length+1;let p=1;for(let g=0;g<d.length;g++){let y;typeof f[g]=="number"?y=f[g]:y=p/m,a.addColorStop(y,d[g]),p++}}return a}function NS(r,t,e,i,s,n,o){const a=e.text,h=e.fontProperties;t.translate(i,s),t.scale(n,n);const l=o.strokeThickness/2,c=-(o.strokeThickness/2);if(t.font=o.toFontString(),t.lineWidth=o.strokeThickness,t.textBaseline=o.textBaseline,t.lineJoin=o.lineJoin,t.miterLimit=o.miterLimit,t.fillStyle=FS(r,t,o,n,[a],e),t.strokeStyle=o.stroke,o.dropShadow){const u=o.dropShadowColor,d=o.dropShadowBlur*n,f=o.dropShadowDistance*n;t.shadowColor=Ft.shared.setValue(u).setAlpha(o.dropShadowAlpha).toRgbaString(),t.shadowBlur=d,t.shadowOffsetX=Math.cos(o.dropShadowAngle)*f,t.shadowOffsetY=Math.sin(o.dropShadowAngle)*f}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0;o.stroke&&o.strokeThickness&&t.strokeText(a,l,c+e.lineHeight-h.descent),o.fill&&t.fillText(a,l,c+e.lineHeight-h.descent),t.setTransform(1,0,0,1,0,0),t.fillStyle="rgba(0, 0, 0, 0)"}function rh(r){return r.codePointAt?r.codePointAt(0):r.charCodeAt(0)}function F0(r){return Array.from?Array.from(r):r.split("")}function DS(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),o=s[1].charCodeAt(0);if(o<n)throw new Error("[BitmapFont]: Invalid character range.");for(let a=n,h=o;a<=h;a++)t.push(String.fromCharCode(a))}else t.push(...F0(s))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}const Ar=class Hi{constructor(t,e,i){var c;const[s]=t.info,[n]=t.common,[o]=t.page,[a]=t.distanceField,h=qi(o.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 u=0;u<t.page.length;u++){const{id:d,file:f}=t.page[u];l[d]=e instanceof Array?e[u]:e[f],a!=null&&a.fieldType&&a.fieldType!=="none"&&(l[d].baseTexture.alphaMode=Se.NO_PREMULTIPLIED_ALPHA,l[d].baseTexture.mipmap=vi.OFF)}for(let u=0;u<t.char.length;u++){const{id:d,page:f}=t.char[u];let{x:m,y:p,width:g,height:y,xoffset:_,yoffset:b,xadvance:v}=t.char[u];m/=h,p/=h,g/=h,y/=h,_/=h,b/=h,v/=h;const w=new pt(m+l[f].frame.x/h,p+l[f].frame.y/h,g,y);this.chars[d]={xOffset:_,yOffset:b,xAdvance:v,kerning:{},texture:new rt(l[f].baseTexture,w),page:f}}for(let u=0;u<t.kerning.length;u++){let{first:d,second:f,amount:m}=t.kerning[u];d/=h,f/=h,m/=h,this.chars[f]&&(this.chars[f].kerning[d]=m)}this.distanceFieldRange=a==null?void 0:a.distanceRange,this.distanceFieldType=((c=a==null?void 0:a.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 eh)s=t;else{const o=GS(t);if(!o)throw new Error("Unrecognized data format for font.");s=o.parse(t)}e instanceof rt&&(e=[e]);const n=new Hi(s,e,i);return Hi.available[n.font]=n,n}static uninstall(t){const e=Hi.available[t];if(!e)throw new Error(`No font found named '${t}'`);e.destroy(),delete Hi.available[t]}static from(t,e,i){if(!t)throw new Error("[BitmapFont] Property `name` is required.");const{chars:s,padding:n,resolution:o,textureWidth:a,textureHeight:h,...l}=Object.assign({},Hi.defaultOptions,i),c=DS(s),u=e instanceof Ir?e:new Ir(e),d=a,f=new eh;f.info[0]={face:u.fontFamily,size:u.fontSize},f.common[0]={lineHeight:u.fontSize};let m=0,p=0,g,y,_,b=0;const v=[];for(let C=0;C<c.length;C++){g||(g=q.ADAPTER.createCanvas(),g.width=a,g.height=h,y=g.getContext("2d"),_=new gt(g,{resolution:o,...l}),v.push(new rt(_)),f.page.push({id:v.length-1,file:""}));const E=c[C],A=Er.measureText(E,u,!1,g),R=A.width,G=Math.ceil(A.height),N=Math.ceil((u.fontStyle==="italic"?2:1)*R);if(p>=h-G*o){if(p===0)throw new Error(`[BitmapFont] textureHeight ${h}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${E}')`);--C,g=null,y=null,_=null,p=0,m=0,b=0;continue}if(b=Math.max(G+A.fontProperties.descent,b),N*o+m>=d){if(m===0)throw new Error(`[BitmapFont] textureWidth ${a}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${E}')`);--C,p+=b*o,p=Math.ceil(p),m=0,b=0;continue}NS(g,y,A,m,p,o,u);const P=rh(A.text);f.char.push({id:P,page:v.length-1,x:m/o,y:p/o,width:N,height:G,xoffset:0,yoffset:0,xadvance:R-(u.dropShadow?u.dropShadowDistance:0)-(u.stroke?u.strokeThickness:0)}),m+=(N+2*n)*o,m=Math.ceil(m)}if(!(i!=null&&i.skipKerning))for(let C=0,E=c.length;C<E;C++){const A=c[C];for(let R=0;R<E;R++){const G=c[R],N=y.measureText(A).width,P=y.measureText(G).width,I=y.measureText(A+G).width-(N+P);I&&f.kerning.push({first:rh(A),second:rh(G),amount:I})}}const w=new Hi(f,v,!0);return Hi.available[t]!==void 0&&Hi.uninstall(t),Hi.available[t]=w,w}};Ar.ALPHA=[["a","z"],["A","Z"]," "],Ar.NUMERIC=[["0","9"]],Ar.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],Ar.ASCII=[[" ","~"]],Ar.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:Ar.ALPHANUMERIC},Ar.available={};let ui=Ar;var kS=`// Pixi texture info\r
|
|
1095
|
+
`;const th=new Nt;class M0 extends Aa{constructor(t){super(t),t.runners.contextChange.add(this),this.quad=new dm,this.state=Ai.for2d()}contextChange(){const t=this.renderer,e={globals:t.globalUniforms};this.simpleShader=Ri.from(R0,LS,e),this.shader=t.context.webGLVersion>1?Ri.from(RS,AS,e):Ri.from(R0,MS,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,o=t.uvRespectAnchor?t.anchor.y:0;s=i.uvs,s[0]=s[6]=-n,s[1]=s[3]=-o,s[2]=s[4]=1-n,s[5]=s[7]=1-o,i.invalidate();const a=t._texture,h=a.baseTexture,l=h.alphaMode>0,c=t.tileTransform.localTransform,u=t.uvMatrix;let d=h.isPowerOfTwo&&a.frame.width===h.width&&a.frame.height===h.height;d&&(h._glTextures[e.CONTEXT_UID]?d=h.wrapMode!==_i.CLAMP:h.wrapMode===_i.CLAMP&&(h.wrapMode=_i.REPEAT));const f=d?this.simpleShader:this.shader,m=a.width,p=a.height,g=t._width,y=t._height;th.set(c.a*m/g,c.b*m/y,c.c*p/g,c.d*p/y,c.tx/g,c.ty/y),th.invert(),d?th.prepend(u.mapCoord):(f.uniforms.uMapCoord=u.mapCoord.toArray(!0),f.uniforms.uClampFrame=u.uClampFrame,f.uniforms.uClampOffset=u.uClampOffset),f.uniforms.uTransform=th.toArray(!0),f.uniforms.uColor=Ft.shared.setValue(t.tint).premultiply(t.worldAlpha,l).toArray(f.uniforms.uColor),f.uniforms.translationMatrix=t.transform.worldTransform.toArray(!0),f.uniforms.uSampler=a,e.shader.bind(f),e.geometry.bind(i),this.state.blendMode=Bp(t.blendMode,l),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}M0.extension={name:"tilingSprite",type:J.RendererPlugin},it.add(M0);const L0=class qo{constructor(t,e,i=null){this.linkedSheets=[],this._texture=t instanceof rt?t:null,this.baseTexture=t instanceof gt?t:this._texture.baseTexture,this.textures={},this.animations={},this.data=e;const s=this.baseTexture.resource;this.resolution=this._updateResolution(i||(s?s.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=qi(t,null);return i===null&&(i=parseFloat(e??"1")),i!==1&&this.baseTexture.setResolution(i),i}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=qo.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const i=qo.BATCH_SIZE;for(;e-t<i&&e<this._frameKeys.length;){const s=this._frameKeys[e],n=this._frames[s],o=n.frame;if(o){let a=null,h=null;const l=n.trimmed!==!1&&n.sourceSize?n.sourceSize:n.frame,c=new pt(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);n.rotated?a=new pt(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.h)/this.resolution,Math.floor(o.w)/this.resolution):a=new pt(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution),n.trimmed!==!1&&n.spriteSourceSize&&(h=new pt(Math.floor(n.spriteSourceSize.x)/this.resolution,Math.floor(n.spriteSourceSize.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution)),this.textures[s]=new rt(this.baseTexture,a,c,h,n.rotated?2:0,n.anchor,n.borders),rt.addToCache(this.textures[s],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*qo.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*qo.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=[]}};L0.BATCH_SIZE=1e3;let P0=L0;const PS=["jpg","png","jpeg","avif","webp"];function G0(r,t,e){const i={};if(r.forEach(s=>{i[s]=t}),Object.keys(t.textures).forEach(s=>{i[s]=t.textures[s]}),!e){const s=Qt.dirname(r[0]);t.linkedSheets.forEach((n,o)=>{const a=G0([`${s}/${t.data.meta.related_multi_packs[o]}`],n,!0);Object.assign(i,a)})}return i}const GS={extension:J.Asset,cache:{test:r=>r instanceof P0,getCacheableAssets:(r,t)=>G0(r,t,!1)},resolver:{test:r=>{const t=r.split("?")[0].split("."),e=t.pop(),i=t.pop();return e==="json"&&PS.includes(i)},parse:r=>{var e;const t=r.split(".");return{resolution:parseFloat(((e=q.RETINA_PREFIX.exec(r))==null?void 0:e[1])??"1"),format:t[t.length-2],src:r}}},loader:{name:"spritesheetLoader",extension:{type:J.LoadParser,priority:li.Normal},async testParse(r,t){return Qt.extname(t.src).toLowerCase()===".json"&&!!r.frames},async parse(r,t,e){var h,l;let i=Qt.dirname(t.src);i&&i.lastIndexOf("/")!==i.length-1&&(i+="/");let s=i+r.meta.image;s=Uc(s,t.src);const n=(await e.load([s]))[s],o=new P0(n.baseTexture,r,t.src);await o.parse();const a=(h=r==null?void 0:r.meta)==null?void 0:h.related_multi_packs;if(Array.isArray(a)){const c=[];for(const d of a){if(typeof d!="string")continue;let f=i+d;(l=t.data)!=null&&l.ignoreMultiPack||(f=Uc(f,t.src),c.push(e.load({src:f,data:{ignoreMultiPack:!0}})))}const u=await Promise.all(c);o.linkedSheets=u,u.forEach(d=>{d.linkedSheets=[o].concat(o.linkedSheets.filter(f=>f!==d))})}return o},unload(r){r.destroy(!0)}}};it.add(GS);class eh{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class ih{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 o=e[n].match(/^[a-z]+/gm)[0],a=e[n].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),h={};for(const l in a){const c=a[l].split("="),u=c[0],d=c[1].replace(/"/gm,""),f=parseFloat(d),m=isNaN(f)?d:f;h[u]=m}i[o].push(h)}const s=new eh;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 nu{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 eh,i=t.getElementsByTagName("info"),s=t.getElementsByTagName("common"),n=t.getElementsByTagName("page"),o=t.getElementsByTagName("char"),a=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<o.length;l++){const c=o[l];e.char.push({id:parseInt(c.getAttribute("id"),10),page:parseInt(c.getAttribute("page"),10)||0,x:parseInt(c.getAttribute("x"),10),y:parseInt(c.getAttribute("y"),10),width:parseInt(c.getAttribute("width"),10),height:parseInt(c.getAttribute("height"),10),xoffset:parseInt(c.getAttribute("xoffset"),10),yoffset:parseInt(c.getAttribute("yoffset"),10),xadvance:parseInt(c.getAttribute("xadvance"),10)})}for(let l=0;l<a.length;l++)e.kerning.push({first:parseInt(a[l].getAttribute("first"),10),second:parseInt(a[l].getAttribute("second"),10),amount:parseInt(a[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 ou{static test(t){return typeof t=="string"&&t.includes("<font>")?nu.test(q.ADAPTER.parseXML(t)):!1}static parse(t){return nu.parse(q.ADAPTER.parseXML(t))}}const au=[ih,nu,ou];function FS(r){for(let t=0;t<au.length;t++)if(au[t].test(r))return au[t];return null}function NS(r,t,e,i,s,n){const o=e.fill;if(Array.isArray(o)){if(o.length===1)return o[0]}else return o;let a;const h=e.dropShadow?e.dropShadowDistance:0,l=e.padding||0,c=r.width/i-h-l*2,u=r.height/i-h-l*2,d=o.slice(),f=e.fillGradientStops.slice();if(!f.length){const m=d.length+1;for(let p=1;p<m;++p)f.push(p/m)}if(d.unshift(o[0]),f.unshift(0),d.push(o[o.length-1]),f.push(1),e.fillGradientType===Qa.LINEAR_VERTICAL){a=t.createLinearGradient(c/2,l,c/2,u+l);let m=0;const p=(n.fontProperties.fontSize+e.strokeThickness)/u;for(let g=0;g<s.length;g++){const y=n.lineHeight*g;for(let _=0;_<d.length;_++){let b=0;typeof f[_]=="number"?b=f[_]:b=_/d.length;const v=y/u+b*p;let w=Math.max(m,v);w=Math.min(w,1),a.addColorStop(w,d[_]),m=w}}}else{a=t.createLinearGradient(l,u/2,c+l,u/2);const m=d.length+1;let p=1;for(let g=0;g<d.length;g++){let y;typeof f[g]=="number"?y=f[g]:y=p/m,a.addColorStop(y,d[g]),p++}}return a}function DS(r,t,e,i,s,n,o){const a=e.text,h=e.fontProperties;t.translate(i,s),t.scale(n,n);const l=o.strokeThickness/2,c=-(o.strokeThickness/2);if(t.font=o.toFontString(),t.lineWidth=o.strokeThickness,t.textBaseline=o.textBaseline,t.lineJoin=o.lineJoin,t.miterLimit=o.miterLimit,t.fillStyle=NS(r,t,o,n,[a],e),t.strokeStyle=o.stroke,o.dropShadow){const u=o.dropShadowColor,d=o.dropShadowBlur*n,f=o.dropShadowDistance*n;t.shadowColor=Ft.shared.setValue(u).setAlpha(o.dropShadowAlpha).toRgbaString(),t.shadowBlur=d,t.shadowOffsetX=Math.cos(o.dropShadowAngle)*f,t.shadowOffsetY=Math.sin(o.dropShadowAngle)*f}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0;o.stroke&&o.strokeThickness&&t.strokeText(a,l,c+e.lineHeight-h.descent),o.fill&&t.fillText(a,l,c+e.lineHeight-h.descent),t.setTransform(1,0,0,1,0,0),t.fillStyle="rgba(0, 0, 0, 0)"}function rh(r){return r.codePointAt?r.codePointAt(0):r.charCodeAt(0)}function F0(r){return Array.from?Array.from(r):r.split("")}function kS(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),o=s[1].charCodeAt(0);if(o<n)throw new Error("[BitmapFont]: Invalid character range.");for(let a=n,h=o;a<=h;a++)t.push(String.fromCharCode(a))}else t.push(...F0(s))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}const Ar=class Hi{constructor(t,e,i){var c;const[s]=t.info,[n]=t.common,[o]=t.page,[a]=t.distanceField,h=qi(o.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 u=0;u<t.page.length;u++){const{id:d,file:f}=t.page[u];l[d]=e instanceof Array?e[u]:e[f],a!=null&&a.fieldType&&a.fieldType!=="none"&&(l[d].baseTexture.alphaMode=Se.NO_PREMULTIPLIED_ALPHA,l[d].baseTexture.mipmap=vi.OFF)}for(let u=0;u<t.char.length;u++){const{id:d,page:f}=t.char[u];let{x:m,y:p,width:g,height:y,xoffset:_,yoffset:b,xadvance:v}=t.char[u];m/=h,p/=h,g/=h,y/=h,_/=h,b/=h,v/=h;const w=new pt(m+l[f].frame.x/h,p+l[f].frame.y/h,g,y);this.chars[d]={xOffset:_,yOffset:b,xAdvance:v,kerning:{},texture:new rt(l[f].baseTexture,w),page:f}}for(let u=0;u<t.kerning.length;u++){let{first:d,second:f,amount:m}=t.kerning[u];d/=h,f/=h,m/=h,this.chars[f]&&(this.chars[f].kerning[d]=m)}this.distanceFieldRange=a==null?void 0:a.distanceRange,this.distanceFieldType=((c=a==null?void 0:a.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 eh)s=t;else{const o=FS(t);if(!o)throw new Error("Unrecognized data format for font.");s=o.parse(t)}e instanceof rt&&(e=[e]);const n=new Hi(s,e,i);return Hi.available[n.font]=n,n}static uninstall(t){const e=Hi.available[t];if(!e)throw new Error(`No font found named '${t}'`);e.destroy(),delete Hi.available[t]}static from(t,e,i){if(!t)throw new Error("[BitmapFont] Property `name` is required.");const{chars:s,padding:n,resolution:o,textureWidth:a,textureHeight:h,...l}=Object.assign({},Hi.defaultOptions,i),c=kS(s),u=e instanceof Ir?e:new Ir(e),d=a,f=new eh;f.info[0]={face:u.fontFamily,size:u.fontSize},f.common[0]={lineHeight:u.fontSize};let m=0,p=0,g,y,_,b=0;const v=[];for(let E=0;E<c.length;E++){g||(g=q.ADAPTER.createCanvas(),g.width=a,g.height=h,y=g.getContext("2d"),_=new gt(g,{resolution:o,...l}),v.push(new rt(_)),f.page.push({id:v.length-1,file:""}));const C=c[E],A=Cr.measureText(C,u,!1,g),R=A.width,G=Math.ceil(A.height),N=Math.ceil((u.fontStyle==="italic"?2:1)*R);if(p>=h-G*o){if(p===0)throw new Error(`[BitmapFont] textureHeight ${h}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${C}')`);--E,g=null,y=null,_=null,p=0,m=0,b=0;continue}if(b=Math.max(G+A.fontProperties.descent,b),N*o+m>=d){if(m===0)throw new Error(`[BitmapFont] textureWidth ${a}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${C}')`);--E,p+=b*o,p=Math.ceil(p),m=0,b=0;continue}DS(g,y,A,m,p,o,u);const P=rh(A.text);f.char.push({id:P,page:v.length-1,x:m/o,y:p/o,width:N,height:G,xoffset:0,yoffset:0,xadvance:R-(u.dropShadow?u.dropShadowDistance:0)-(u.stroke?u.strokeThickness:0)}),m+=(N+2*n)*o,m=Math.ceil(m)}if(!(i!=null&&i.skipKerning))for(let E=0,C=c.length;E<C;E++){const A=c[E];for(let R=0;R<C;R++){const G=c[R],N=y.measureText(A).width,P=y.measureText(G).width,I=y.measureText(A+G).width-(N+P);I&&f.kerning.push({first:rh(A),second:rh(G),amount:I})}}const w=new Hi(f,v,!0);return Hi.available[t]!==void 0&&Hi.uninstall(t),Hi.available[t]=w,w}};Ar.ALPHA=[["a","z"],["A","Z"]," "],Ar.NUMERIC=[["0","9"]],Ar.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],Ar.ASCII=[[" ","~"]],Ar.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:Ar.ALPHANUMERIC},Ar.available={};let ui=Ar;var OS=`// Pixi texture info\r
|
|
1096
1096
|
varying vec2 vTextureCoord;\r
|
|
1097
1097
|
uniform sampler2D uSampler;\r
|
|
1098
1098
|
\r
|
|
@@ -1130,7 +1130,7 @@ void main(void) {\r
|
|
|
1130
1130
|
// NPM Textures, NPM outputs\r
|
|
1131
1131
|
gl_FragColor = vec4(uColor.rgb, coverage);\r
|
|
1132
1132
|
}\r
|
|
1133
|
-
`,
|
|
1133
|
+
`,BS=`// Mesh material default fragment\r
|
|
1134
1134
|
attribute vec2 aVertexPosition;\r
|
|
1135
1135
|
attribute vec2 aTextureCoord;\r
|
|
1136
1136
|
\r
|
|
@@ -1146,17 +1146,17 @@ void main(void)\r
|
|
|
1146
1146
|
\r
|
|
1147
1147
|
vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\r
|
|
1148
1148
|
}\r
|
|
1149
|
-
`;const N0=[],D0=[],k0=[],O0=class
|
|
1149
|
+
`;const N0=[],D0=[],k0=[],O0=class kb extends At{constructor(t,e={}){super();const{align:i,tint:s,maxWidth:n,letterSpacing:o,fontName:a,fontSize:h}=Object.assign({},kb.styleDefaults,e);if(!ui.available[a])throw new Error(`Missing BitmapFont "${a}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=i,this._tintColor=new Ft(s),this._font=void 0,this._fontName=a,this._fontSize=h,this.text=t,this._maxWidth=n,this._maxLineHeight=0,this._letterSpacing=o,this._anchor=new tr(()=>{this.dirty=!0},this,0,0),this._roundPixels=q.ROUND_PIXELS,this.dirty=!0,this._resolution=q.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){var N;const t=ui.available[this._fontName],e=this.fontSize,i=e/t.size,s=new ut,n=[],o=[],a=[],h=this._text.replace(/(?:\r\n|\r)/g,`
|
|
1150
1150
|
`)||" ",l=F0(h),c=this._maxWidth*t.size/e,u=t.distanceFieldType==="none"?N0:D0;let d=null,f=0,m=0,p=0,g=-1,y=0,_=0,b=0,v=0;for(let P=0;P<l.length;P++){const I=l[P],D=rh(I);if(/(?:\s)/.test(I)&&(g=P,y=f,v++),I==="\r"||I===`
|
|
1151
1151
|
`){o.push(f),a.push(-1),m=Math.max(m,f),++p,++_,s.x=0,s.y+=t.lineHeight,d=null,v=0;continue}const X=t.chars[D];if(!X)continue;d&&X.kerning[d]&&(s.x+=X.kerning[d]);const H=k0.pop()||{texture:rt.EMPTY,line:0,charCode:0,prevSpaces:0,position:new ut};H.texture=X.texture,H.line=p,H.charCode=D,H.position.x=Math.round(s.x+X.xOffset+this._letterSpacing/2),H.position.y=Math.round(s.y+X.yOffset),H.prevSpaces=v,n.push(H),f=H.position.x+Math.max(X.xAdvance-X.xOffset,X.texture.orig.width),s.x+=X.xAdvance+this._letterSpacing,b=Math.max(b,X.yOffset+X.texture.height),d=D,g!==-1&&c>0&&s.x>c&&(++_,Ys(n,1+g-_,1+P-g),P=g,g=-1,o.push(y),a.push(n.length>0?n[n.length-1].prevSpaces:0),m=Math.max(m,y),p++,s.x=0,s.y+=t.lineHeight,d=null,v=0)}const w=l[l.length-1];w!=="\r"&&w!==`
|
|
1152
|
-
`&&(/(?:\s)/.test(w)&&(f=y),o.push(f),m=Math.max(m,f),a.push(-1));const
|
|
1152
|
+
`&&(/(?:\s)/.test(w)&&(f=y),o.push(f),m=Math.max(m,f),a.push(-1));const E=[];for(let P=0;P<=p;P++){let I=0;this._align==="right"?I=m-o[P]:this._align==="center"?I=(m-o[P])/2:this._align==="justify"&&(I=a[P]<0?0:(m-o[P])/a[P]),E.push(I)}const C=n.length,A={},R=[],G=this._activePagesMeshData;u.push(...G);for(let P=0;P<C;P++){const I=n[P].texture,D=I.baseTexture.uid;if(!A[D]){let X=u.pop();if(!X){const Z=new _0;let j,O;t.distanceFieldType==="none"?(j=new eu(rt.EMPTY),O=ft.NORMAL):(j=new eu(rt.EMPTY,{program:er.from(BS,OS),uniforms:{uFWidth:0}}),O=ft.NORMAL_NPM);const k=new tu(Z,j);k.blendMode=O,X={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:k,vertices:null,uvs:null,indices:null}}X.index=0,X.indexCount=0,X.vertexCount=0,X.uvsCount=0,X.total=0;const{_textureCache:H}=this;H[D]=H[D]||new rt(I.baseTexture),X.mesh.texture=H[D],X.mesh.tint=this._tintColor.value,R.push(X),A[D]=X}A[D].total++}for(let P=0;P<G.length;P++)R.includes(G[P])||this.removeChild(G[P].mesh);for(let P=0;P<R.length;P++)R[P].mesh.parent!==this&&this.addChild(R[P].mesh);this._activePagesMeshData=R;for(const P in A){const I=A[P],D=I.total;if(!(((N=I.indices)==null?void 0:N.length)>6*D)||I.vertices.length<tu.BATCHABLE_SIZE*2)I.vertices=new Float32Array(4*2*D),I.uvs=new Float32Array(4*2*D),I.indices=new Uint16Array(6*D);else{const X=I.total,H=I.vertices;for(let Z=X*4*2;Z<H.length;Z++)H[Z]=0}I.mesh.size=6*D}for(let P=0;P<C;P++){const I=n[P];let D=I.position.x+E[I.line]*(this._align==="justify"?I.prevSpaces:1);this._roundPixels&&(D=Math.round(D));const X=D*i,H=I.position.y*i,Z=I.texture,j=A[Z.baseTexture.uid],O=Z.frame,k=Z._uvs,F=j.index++;j.indices[F*6+0]=0+F*4,j.indices[F*6+1]=1+F*4,j.indices[F*6+2]=2+F*4,j.indices[F*6+3]=0+F*4,j.indices[F*6+4]=2+F*4,j.indices[F*6+5]=3+F*4,j.vertices[F*8+0]=X,j.vertices[F*8+1]=H,j.vertices[F*8+2]=X+O.width*i,j.vertices[F*8+3]=H,j.vertices[F*8+4]=X+O.width*i,j.vertices[F*8+5]=H+O.height*i,j.vertices[F*8+6]=X,j.vertices[F*8+7]=H+O.height*i,j.uvs[F*8+0]=k.x0,j.uvs[F*8+1]=k.y0,j.uvs[F*8+2]=k.x1,j.uvs[F*8+3]=k.y1,j.uvs[F*8+4]=k.x2,j.uvs[F*8+5]=k.y2,j.uvs[F*8+6]=k.x3,j.uvs[F*8+7]=k.y3}this._textWidth=m*i,this._textHeight=(s.y+t.lineHeight)*i;for(const P in A){const I=A[P];if(this.anchor.x!==0||this.anchor.y!==0){let Z=0;const j=this._textWidth*this.anchor.x,O=this._textHeight*this.anchor.y;for(let k=0;k<I.total;k++)I.vertices[Z++]-=j,I.vertices[Z++]-=O,I.vertices[Z++]-=j,I.vertices[Z++]-=O,I.vertices[Z++]-=j,I.vertices[Z++]-=O,I.vertices[Z++]-=j,I.vertices[Z++]-=O}this._maxLineHeight=b*i;const D=I.mesh.geometry.getBuffer("aVertexPosition"),X=I.mesh.geometry.getBuffer("aTextureCoord"),H=I.mesh.geometry.getIndex();D.data=I.vertices,X.data=I.uvs,H.data=I.indices,D.update(),X.update(),H.update()}for(let P=0;P<n.length;P++)k0.push(n[P]);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}=ui.available[this._fontName];if(i!=="none"){const{a:n,b:o,c:a,d:h}=this.worldTransform,l=Math.sqrt(n*n+o*o),c=Math.sqrt(a*a+h*h),u=(Math.abs(l)+Math.abs(c))/2,d=this.fontSize/s,f=t._view.resolution;for(const m of this._activePagesMeshData)m.mesh.shader.uniforms.uFWidth=u*e*d*f}super._render(t)}getLocalBounds(){return this.validate(),super.getLocalBounds()}validate(){const t=ui.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(!ui.available[t])throw new Error(`Missing BitmapFont "${t}"`);this._fontName!==t&&(this._fontName=t,this.dirty=!0)}get fontSize(){return this._fontSize??ui.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=ui.available[this._fontName].distanceFieldType==="none"?N0:D0;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=rt.EMPTY});for(const s in e)e[s].destroy(),delete e[s];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(t)}};O0.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};let WS=O0;const US=[".xml",".fnt"],XS={extension:{type:J.LoadParser,priority:li.Normal},name:"loadBitmapFont",test(r){return US.includes(Qt.extname(r).toLowerCase())},async testParse(r){return ih.test(r)||ou.test(r)},async parse(r,t,e){const i=ih.test(r)?ih.parse(r):ou.parse(r),{src:s}=t,{page:n}=i,o=[];for(let l=0;l<n.length;++l){const c=n[l].file;let u=Qt.join(Qt.dirname(s),c);u=Uc(u,s),o.push(u)}const a=await e.load(o),h=o.map(l=>a[l]);return ui.install(i,h,!0)},async load(r,t){return(await q.ADAPTER.fetch(r)).text()},unload(r){r.destroy()}};it.add(XS);const hu=class kn extends Ir{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(t){return new kn(Object.keys(kn.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 kn.availableFonts[t.originalUrl])}),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(t,e={}){const{availableFonts:i}=kn;if(i[t]){const s=i[t];return this._fonts.push(s),s.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return q.ADAPTER.fetch(t).then(s=>s.blob()).then(async s=>new Promise((n,o)=>{const a=URL.createObjectURL(s),h=new FileReader;h.onload=()=>n([a,h.result]),h.onerror=o,h.readAsDataURL(s)})).then(async([s,n])=>{const o=Object.assign({family:Qt.basename(t,Qt.extname(t)),weight:"normal",style:"normal",display:"auto",src:s,dataSrc:n,refs:1,originalUrl:t,fontFace:null},e);i[t]=o,this._fonts.push(o),this.styleID++;const a=new FontFace(o.family,`url(${o.src})`,{weight:o.weight,style:o.style,display:o.display});o.fontFace=a,await a.load(),document.fonts.add(a),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}
|
|
1153
1153
|
@font-face {
|
|
1154
1154
|
font-family: "${e.family}";
|
|
1155
1155
|
src: url('${e.dataSrc}');
|
|
1156
1156
|
font-weight: ${e.weight};
|
|
1157
1157
|
font-style: ${e.style};
|
|
1158
1158
|
font-display: ${e.display};
|
|
1159
|
-
}`,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=M1(t)),typeof t=="number"?R1(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,Nn.defaultOptions)}onBeforeDraw(){const{fontsDirty:t}=this;return this.fontsDirty=!1,this.isSafari&&this._fonts.length>0&&t?new Promise(e=>setTimeout(e,100)):Promise.resolve()}get isSafari(){const{userAgent:t}=q.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}};hu.availableFonts={},hu.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 lu=hu;const sh=class Dn extends qt{constructor(t="",e={}){super(rt.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=rt.from(i,{scaleMode:q.SCALE_MODE,resourceOptions:{autoLoad:!1}});s.orig=new pt,s.trim=new pt,this.texture=s;const n="http://www.w3.org/2000/svg",o="http://www.w3.org/1999/xhtml",a=document.createElementNS(n,"svg"),h=document.createElementNS(n,"foreignObject"),l=document.createElementNS(o,"div"),c=document.createElementNS(o,"style");h.setAttribute("width","10000"),h.setAttribute("height","10000"),h.style.overflow="hidden",a.appendChild(h),this.maxWidth=Dn.defaultMaxWidth,this.maxHeight=Dn.defaultMaxHeight,this._domElement=l,this._styleElement=c,this._svgRoot=a,this._foreignObject=h,this._foreignObject.appendChild(c),this._foreignObject.appendChild(l),this._image=i,this._loadImage=new Image,this._autoResolution=Dn.defaultAutoResolution,this._resolution=Dn.defaultResolution??q.RESOLUTION,this.text=t,this.style=e}measureText(t){var c,u;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:o,height:a}=n;(o>this.maxWidth||a>this.maxHeight)&&console.warn("[HTMLText] Large expanse of text, increase HTMLText.maxWidth or HTMLText.maxHeight property.");const h=Math.min(this.maxWidth,Math.ceil(o)),l=Math.min(this.maxHeight,Math.ceil(a));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=(u=this._style)==null?void 0:u.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:o}=this.measureText();i.width=s.width=Math.ceil(Math.max(1,n)),i.height=s.height=Math.ceil(Math.max(1,o)),this._updateID++;const a=this._updateID;await new Promise(h=>{s.onload=async()=>{if(a<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:o}=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(),o.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,o,a;typeof t=="boolean"&&(t={children:t}),t=Object.assign({},Dn.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,(o=this._foreignObject)==null||o.remove(),this._foreignObject=e,(a=this._styleElement)==null||a.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=xr(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=xr(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 lu?(this.ownsStyle=!1,this._style=t):t instanceof Ir?(console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle"),this.ownsStyle=!0,this._style=lu.from(t)):(this.ownsStyle=!0,this._style=new lu(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," ")}};sh.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},sh.defaultMaxWidth=2024,sh.defaultMaxHeight=2024,sh.defaultAutoResolution=!0;function XS(){const r=new Map;function t(o,a){const h=r.get(o);return h?h.add(a):r.set(o,new Set([a])),()=>i(o,a)}function e(o,a){const h=l=>{i(o,h),a(l)};t(o,h)}function i(o,a){var h;(h=r.get(o))==null||h.delete(a)}function s(o,a){var h;(h=r.get(o))==null||h.forEach(l=>l(a))}function n(){r.clear()}return{on:t,off:i,once:e,emit:s,clear:n}}const nt=XS();function Fe(r){let t;return new Promise(e=>{t=e,nt.on(r,t)}).then(e=>(nt.off(r,t),e))}let Li=null;const B0=new ResizeObserver(()=>{Li&&nt.emit("stageUpdated",Li)});function ZS(r){Li=r,B0.observe(Li),nt.emit("stageCreated",Li)}function VS(){Li&&B0.unobserve(Li),Li=null}async function cu(){return Li||await Fe("stageCreated")}let Ne=null;async function HS(){const r=await cu();YS(r),nt.on("stageUpdated",zS)}function KS(){Ne&&(Ne.destroy(!0,{children:!0}),Ne=null)}function YS(r){Ne=new Qm({backgroundAlpha:0,resizeTo:r,antialias:!0,resolution:window.devicePixelRatio}),Ne.stage.sortableChildren=!0,r.appendChild(Ne.view),nt.emit("applicationCreated",Ne),process.env.NODE_ENV==="development"&&(globalThis.__PIXI_APP__=Ne)}async function de(){return Ne||await Fe("applicationCreated")}function zS(r){Ne&&(Ne.resizeTo=r,nt.emit("applicationResized",Ne))}var nh={exports:{}};nh.exports,function(r,t){var e=200,i="__lodash_hash_undefined__",s=800,n=16,o=9007199254740991,a="[object Arguments]",h="[object Array]",l="[object AsyncFunction]",c="[object Boolean]",u="[object Date]",d="[object Error]",f="[object Function]",m="[object GeneratorFunction]",p="[object Map]",g="[object Number]",y="[object Null]",_="[object Object]",b="[object Proxy]",v="[object RegExp]",w="[object Set]",C="[object String]",E="[object Undefined]",A="[object WeakMap]",R="[object ArrayBuffer]",G="[object DataView]",N="[object Float32Array]",P="[object Float64Array]",I="[object Int8Array]",D="[object Int16Array]",X="[object Int32Array]",H="[object Uint8Array]",Z="[object Uint8ClampedArray]",j="[object Uint16Array]",O="[object Uint32Array]",k=/[\\^$.*+?()[\]{}|]/g,F=/^\[object .+?Constructor\]$/,V=/^(?:0|[1-9]\d*)$/,$={};$[N]=$[P]=$[I]=$[D]=$[X]=$[H]=$[Z]=$[j]=$[O]=!0,$[a]=$[h]=$[R]=$[c]=$[G]=$[u]=$[d]=$[f]=$[p]=$[g]=$[_]=$[v]=$[w]=$[C]=$[A]=!1;var dt=typeof xe=="object"&&xe&&xe.Object===Object&&xe,ot=typeof self=="object"&&self&&self.Object===Object&&self,Et=dt||ot||Function("return this")(),Mt=t&&!t.nodeType&&t,_t=Mt&&!0&&r&&!r.nodeType&&r,Y=_t&&_t.exports===Mt,tt=Y&&dt.process,et=function(){try{var x=_t&&_t.require&&_t.require("util").types;return x||tt&&tt.binding&&tt.binding("util")}catch{}}(),B=et&&et.isTypedArray;function xt(x,S,L){switch(L.length){case 0:return x.call(S);case 1:return x.call(S,L[0]);case 2:return x.call(S,L[0],L[1]);case 3:return x.call(S,L[0],L[1],L[2])}return x.apply(S,L)}function yt(x,S){for(var L=-1,U=Array(x);++L<x;)U[L]=S(L);return U}function Lt(x){return function(S){return x(S)}}function Zt(x,S){return x==null?void 0:x[S]}function Xe(x,S){return function(L){return x(S(L))}}var pi=Array.prototype,Fd=Function.prototype,Tn=Object.prototype,No=Et["__core-js_shared__"],wn=Fd.toString,mi=Tn.hasOwnProperty,Kh=function(){var x=/[^.]+$/.exec(No&&No.keys&&No.keys.IE_PROTO||"");return x?"Symbol(src)_1."+x:""}(),Yh=Tn.toString,Nd=wn.call(Object),Sn=RegExp("^"+wn.call(mi).replace(k,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Wr=Y?Et.Buffer:void 0,Do=Et.Symbol,Ze=Et.Uint8Array,ko=Wr?Wr.allocUnsafe:void 0,Oo=Xe(Object.getPrototypeOf,Object),zh=Object.create,jh=Tn.propertyIsEnumerable,Cn=pi.splice,Wi=Do?Do.toStringTag:void 0,As=function(){try{var x=Ko(Object,"defineProperty");return x({},"",{}),x}catch{}}(),Dd=Wr?Wr.isBuffer:void 0,Ui=Math.max,Jh=Date.now,$h=Ko(Et,"Map"),Rs=Ko(Object,"create"),Bo=function(){function x(){}return function(S){if(!Vi(S))return{};if(zh)return zh(S);x.prototype=S;var L=new x;return x.prototype=void 0,L}}();function Ve(x){var S=-1,L=x==null?0:x.length;for(this.clear();++S<L;){var U=x[S];this.set(U[0],U[1])}}function Wo(){this.__data__=Rs?Rs(null):{},this.size=0}function Uo(x){var S=this.has(x)&&delete this.__data__[x];return this.size-=S?1:0,S}function Xo(x){var S=this.__data__;if(Rs){var L=S[x];return L===i?void 0:L}return mi.call(S,x)?S[x]:void 0}function Ms(x){var S=this.__data__;return Rs?S[x]!==void 0:mi.call(S,x)}function kd(x,S){var L=this.__data__;return this.size+=this.has(x)?0:1,L[x]=Rs&&S===void 0?i:S,this}Ve.prototype.clear=Wo,Ve.prototype.delete=Uo,Ve.prototype.get=Xo,Ve.prototype.has=Ms,Ve.prototype.set=kd;function gi(x){var S=-1,L=x==null?0:x.length;for(this.clear();++S<L;){var U=x[S];this.set(U[0],U[1])}}function Od(){this.__data__=[],this.size=0}function Bd(x){var S=this.__data__,L=En(S,x);if(L<0)return!1;var U=S.length-1;return L==U?S.pop():Cn.call(S,L,1),--this.size,!0}function Wd(x){var S=this.__data__,L=En(S,x);return L<0?void 0:S[L][1]}function Qh(x){return En(this.__data__,x)>-1}function Zo(x,S){var L=this.__data__,U=En(L,x);return U<0?(++this.size,L.push([x,S])):L[U][1]=S,this}gi.prototype.clear=Od,gi.prototype.delete=Bd,gi.prototype.get=Wd,gi.prototype.has=Qh,gi.prototype.set=Zo;function Pe(x){var S=-1,L=x==null?0:x.length;for(this.clear();++S<L;){var U=x[S];this.set(U[0],U[1])}}function Ud(){this.size=0,this.__data__={hash:new Ve,map:new($h||gi),string:new Ve}}function Xd(x){var S=An(this,x).delete(x);return this.size-=S?1:0,S}function Zd(x){return An(this,x).get(x)}function Vd(x){return An(this,x).has(x)}function Hd(x,S){var L=An(this,x),U=L.size;return L.set(x,S),this.size+=L.size==U?0:1,this}Pe.prototype.clear=Ud,Pe.prototype.delete=Xd,Pe.prototype.get=Zd,Pe.prototype.has=Vd,Pe.prototype.set=Hd;function ye(x){var S=this.__data__=new gi(x);this.size=S.size}function Kd(){this.__data__=new gi,this.size=0}function Yd(x){var S=this.__data__,L=S.delete(x);return this.size=S.size,L}function zd(x){return this.__data__.get(x)}function jd(x){return this.__data__.has(x)}function Jd(x,S){var L=this.__data__;if(L instanceof gi){var U=L.__data__;if(!$h||U.length<e-1)return U.push([x,S]),this.size=++L.size,this;L=this.__data__=new Pe(U)}return L.set(x,S),this.size=L.size,this}ye.prototype.clear=Kd,ye.prototype.delete=Yd,ye.prototype.get=zd,ye.prototype.has=jd,ye.prototype.set=Jd;function dr(x,S){var L=Ln(x),U=!L&&yi(x),lt=!L&&!U&&ol(x),mt=!L&&!U&&!lt&&Xr(x),bt=L||U||lt||mt,at=bt?yt(x.length,String):[],vt=at.length;for(var kt in x)(S||mi.call(x,kt))&&!(bt&&(kt=="length"||lt&&(kt=="offset"||kt=="parent")||mt&&(kt=="buffer"||kt=="byteLength"||kt=="byteOffset")||sl(kt,vt)))&&at.push(kt);return at}function Vo(x,S,L){(L!==void 0&&!Mn(x[S],L)||L===void 0&&!(S in x))&&Ho(x,S,L)}function $d(x,S,L){var U=x[S];(!(mi.call(x,S)&&Mn(U,L))||L===void 0&&!(S in x))&&Ho(x,S,L)}function En(x,S){for(var L=x.length;L--;)if(Mn(x[L][0],S))return L;return-1}function Ho(x,S,L){S=="__proto__"&&As?As(x,S,{configurable:!0,enumerable:!0,value:L,writable:!0}):x[S]=L}var Qd=af();function fr(x){return x==null?x===void 0?E:y:Wi&&Wi in Object(x)?hf(x):uf(x)}function qh(x){return Ur(x)&&fr(x)==a}function qd(x){if(!Vi(x)||Rn(x))return!1;var S=Ps(x)?Sn:F;return S.test(pf(x))}function Xi(x){return Ur(x)&&al(x.length)&&!!$[fr(x)]}function tf(x){if(!Vi(x))return cf(x);var S=pr(x),L=[];for(var U in x)U=="constructor"&&(S||!mi.call(x,U))||L.push(U);return L}function tl(x,S,L,U,lt){x!==S&&Qd(S,function(mt,bt){if(lt||(lt=new ye),Vi(mt))ef(x,S,bt,L,tl,U,lt);else{var at=U?U(Yo(x,bt),mt,bt+"",x,S,lt):void 0;at===void 0&&(at=mt),Vo(x,bt,at)}},cl)}function ef(x,S,L,U,lt,mt,bt){var at=Yo(x,L),vt=Yo(S,L),kt=bt.get(vt);if(kt){Vo(x,L,kt);return}var Rt=mt?mt(at,vt,L+"",x,S,bt):void 0,he=Rt===void 0;if(he){var be=Ln(vt),ii=!be&&ol(vt),ri=!be&&!ii&&Xr(vt);Rt=vt,be||ii||ri?Ln(at)?Rt=at:Pn(at)?Rt=Ls(at):ii?(he=!1,Rt=nf(vt,!0)):ri?(he=!1,Rt=of(vt,!0)):Rt=[]:hl(vt)||yi(vt)?(Rt=at,yi(at)?Rt=ll(at):(!Vi(at)||Ps(at))&&(Rt=rl(vt))):he=!1}he&&(bt.set(vt,Rt),lt(Rt,vt,U,mt,bt),bt.delete(vt)),Vo(x,L,Rt)}function rf(x,S){return df(Zi(x,S,T),x+"")}var sf=As?function(x,S){return As(x,"toString",{configurable:!0,enumerable:!1,value:gf(S),writable:!0})}:T;function nf(x,S){if(S)return x.slice();var L=x.length,U=ko?ko(L):new x.constructor(L);return x.copy(U),U}function In(x){var S=new x.constructor(x.byteLength);return new Ze(S).set(new Ze(x)),S}function of(x,S){var L=S?In(x.buffer):x.buffer;return new x.constructor(L,x.byteOffset,x.length)}function Ls(x,S){var L=-1,U=x.length;for(S||(S=Array(U));++L<U;)S[L]=x[L];return S}function el(x,S,L,U){var lt=!L;L||(L={});for(var mt=-1,bt=S.length;++mt<bt;){var at=S[mt],vt=U?U(L[at],x[at],at,L,x):void 0;vt===void 0&&(vt=x[at]),lt?Ho(L,at,vt):$d(L,at,vt)}return L}function il(x){return rf(function(S,L){var U=-1,lt=L.length,mt=lt>1?L[lt-1]:void 0,bt=lt>2?L[2]:void 0;for(mt=x.length>3&&typeof mt=="function"?(lt--,mt):void 0,bt&&lf(L[0],L[1],bt)&&(mt=lt<3?void 0:mt,lt=1),S=Object(S);++U<lt;){var at=L[U];at&&x(S,at,U,mt)}return S})}function af(x){return function(S,L,U){for(var lt=-1,mt=Object(S),bt=U(S),at=bt.length;at--;){var vt=bt[x?at:++lt];if(L(mt[vt],vt,mt)===!1)break}return S}}function An(x,S){var L=x.__data__;return nl(S)?L[typeof S=="string"?"string":"hash"]:L.map}function Ko(x,S){var L=Zt(x,S);return qd(L)?L:void 0}function hf(x){var S=mi.call(x,Wi),L=x[Wi];try{x[Wi]=void 0;var U=!0}catch{}var lt=Yh.call(x);return U&&(S?x[Wi]=L:delete x[Wi]),lt}function rl(x){return typeof x.constructor=="function"&&!pr(x)?Bo(Oo(x)):{}}function sl(x,S){var L=typeof x;return S=S??o,!!S&&(L=="number"||L!="symbol"&&V.test(x))&&x>-1&&x%1==0&&x<S}function lf(x,S,L){if(!Vi(L))return!1;var U=typeof S;return(U=="number"?zo(L)&&sl(S,L.length):U=="string"&&S in L)?Mn(L[S],x):!1}function nl(x){var S=typeof x;return S=="string"||S=="number"||S=="symbol"||S=="boolean"?x!=="__proto__":x===null}function Rn(x){return!!Kh&&Kh in x}function pr(x){var S=x&&x.constructor,L=typeof S=="function"&&S.prototype||Tn;return x===L}function cf(x){var S=[];if(x!=null)for(var L in Object(x))S.push(L);return S}function uf(x){return Yh.call(x)}function Zi(x,S,L){return S=Ui(S===void 0?x.length-1:S,0),function(){for(var U=arguments,lt=-1,mt=Ui(U.length-S,0),bt=Array(mt);++lt<mt;)bt[lt]=U[S+lt];lt=-1;for(var at=Array(S+1);++lt<S;)at[lt]=U[lt];return at[S]=L(bt),xt(x,this,at)}}function Yo(x,S){if(!(S==="constructor"&&typeof x[S]=="function")&&S!="__proto__")return x[S]}var df=ff(sf);function ff(x){var S=0,L=0;return function(){var U=Jh(),lt=n-(U-L);if(L=U,lt>0){if(++S>=s)return arguments[0]}else S=0;return x.apply(void 0,arguments)}}function pf(x){if(x!=null){try{return wn.call(x)}catch{}try{return x+""}catch{}}return""}function Mn(x,S){return x===S||x!==x&&S!==S}var yi=qh(function(){return arguments}())?qh:function(x){return Ur(x)&&mi.call(x,"callee")&&!jh.call(x,"callee")},Ln=Array.isArray;function zo(x){return x!=null&&al(x.length)&&!Ps(x)}function Pn(x){return Ur(x)&&zo(x)}var ol=Dd||M;function Ps(x){if(!Vi(x))return!1;var S=fr(x);return S==f||S==m||S==l||S==b}function al(x){return typeof x=="number"&&x>-1&&x%1==0&&x<=o}function Vi(x){var S=typeof x;return x!=null&&(S=="object"||S=="function")}function Ur(x){return x!=null&&typeof x=="object"}function hl(x){if(!Ur(x)||fr(x)!=_)return!1;var S=Oo(x);if(S===null)return!0;var L=mi.call(S,"constructor")&&S.constructor;return typeof L=="function"&&L instanceof L&&wn.call(L)==Nd}var Xr=B?Lt(B):Xi;function ll(x){return el(x,cl(x))}function cl(x){return zo(x)?dr(x,!0):tf(x)}var mf=il(function(x,S,L){tl(x,S,L)});function gf(x){return function(){return x}}function T(x){return x}function M(){return!1}r.exports=mf}(nh,nh.exports);var jS=nh.exports;const JS=Ds(jS);let hs=null;function $S(){hs=z.effectScope()}function QS(){hs==null||hs.stop(),hs=null}async function qS(){return hs||await Fe("scopeCreated")}let Rr=null;const W0={animationDuration:500,disableAnimationsThreshold:500,disableEdgesThreshold:500,styles:{colorMode:"dark",rowGap:24,columnGap:32,textDefault:"#ffffff",textInverse:"#000000",selectedBorderColor:"#3fa2c3",selectedBorderWidth:2,selectedBorderOffset:4,selectedBorderRadius:9,nodesPadding:16,nodeHeight:32,nodePadding:4,nodeRadius:6,nodeBorderRadius:9,nodeToggleSize:28,nodeToggleBgColor:"#35363C",nodeToggleBorderRadius:6,nodeToggleBorderColor:"#51525C",nodeUnselectedAlpha:.2,artifactsGap:4,artifactsNodeOverlap:4,artifactPaddingLeft:2,artifactPaddingRight:4,artifactPaddingY:2,artifactTextColor:"#ffffff",artifactBgColor:"#35363b",artifactBorderRadius:4,artifactContentGap:4,artifactIconSize:16,artifactIconColor:"#ffffff",flowStateBarHeight:6,flowStateAreaAlpha:.1,edgeColor:"#51525C",guideLineWidth:1,guideLineColor:"#51525C",guideTextTopPadding:8,guideTextLeftPadding:8,guideTextSize:12,guideTextColor:"#ADADAD",playheadWidth:2,playheadColor:"#6272FF",node:()=>({background:"#ffffff"}),state:()=>({background:"#ffffff"})}};function tC(r){const t=JS({},W0,r);return t.styles.node=e=>{var i,s;return{...W0.styles.node(e),...(s=(i=r.styles)==null?void 0:i.node)==null?void 0:s.call(i,e)}},t}async function eC(r){(await qS()).run(()=>{z.watch(()=>r.config,e=>{const i=tC(e);if(!Rr){Rr=i,nt.emit("configCreated",Rr);return}Object.assign(Rr,i),nt.emit("configUpdated",Rr)},{immediate:!0})})}function iC(){Rr=null}async function Yt(){return Rr||await Fe("configCreated")}async function U0(r,t){const e=await Yt();let i,s=null;async function n(){try{s=await e.fetch(r),t(s)}catch(a){console.error(a)}s&&!s.end_time&&(i=setTimeout(()=>n(),rC(s)))}function o(){clearInterval(i)}return{start:n,stop:o}}function rC(r){const t=Math.floor(r.nodes.size/ta)*ta;return Math.max(ta,t)}function rr(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function X0(r,t){r.prototype=Object.create(t.prototype),r.prototype.constructor=r,r.__proto__=t}/*!
|
|
1159
|
+
}`,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=L1(t)),typeof t=="number"?M1(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,kn.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}=q.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}};hu.availableFonts={},hu.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 lu=hu;const sh=class On extends qt{constructor(t="",e={}){super(rt.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=rt.from(i,{scaleMode:q.SCALE_MODE,resourceOptions:{autoLoad:!1}});s.orig=new pt,s.trim=new pt,this.texture=s;const n="http://www.w3.org/2000/svg",o="http://www.w3.org/1999/xhtml",a=document.createElementNS(n,"svg"),h=document.createElementNS(n,"foreignObject"),l=document.createElementNS(o,"div"),c=document.createElementNS(o,"style");h.setAttribute("width","10000"),h.setAttribute("height","10000"),h.style.overflow="hidden",a.appendChild(h),this.maxWidth=On.defaultMaxWidth,this.maxHeight=On.defaultMaxHeight,this._domElement=l,this._styleElement=c,this._svgRoot=a,this._foreignObject=h,this._foreignObject.appendChild(c),this._foreignObject.appendChild(l),this._image=i,this._loadImage=new Image,this._autoResolution=On.defaultAutoResolution,this._resolution=On.defaultResolution??q.RESOLUTION,this.text=t,this.style=e}measureText(t){var c,u;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:o,height:a}=n;(o>this.maxWidth||a>this.maxHeight)&&console.warn("[HTMLText] Large expanse of text, increase HTMLText.maxWidth or HTMLText.maxHeight property.");const h=Math.min(this.maxWidth,Math.ceil(o)),l=Math.min(this.maxHeight,Math.ceil(a));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=(u=this._style)==null?void 0:u.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:o}=this.measureText();i.width=s.width=Math.ceil(Math.max(1,n)),i.height=s.height=Math.ceil(Math.max(1,o)),this._updateID++;const a=this._updateID;await new Promise(h=>{s.onload=async()=>{if(a<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:o}=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(),o.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,o,a;typeof t=="boolean"&&(t={children:t}),t=Object.assign({},On.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,(o=this._foreignObject)==null||o.remove(),this._foreignObject=e,(a=this._styleElement)==null||a.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=xr(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=xr(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 lu?(this.ownsStyle=!1,this._style=t):t instanceof Ir?(console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle"),this.ownsStyle=!0,this._style=lu.from(t)):(this.ownsStyle=!0,this._style=new lu(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," ")}};sh.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},sh.defaultMaxWidth=2024,sh.defaultMaxHeight=2024,sh.defaultAutoResolution=!0;function ZS(){const r=new Map;function t(o,a){const h=r.get(o);return h?h.add(a):r.set(o,new Set([a])),()=>i(o,a)}function e(o,a){const h=l=>{i(o,h),a(l)};t(o,h)}function i(o,a){var h;(h=r.get(o))==null||h.delete(a)}function s(o,a){var h;(h=r.get(o))==null||h.forEach(l=>l(a))}function n(){r.clear()}return{on:t,off:i,once:e,emit:s,clear:n}}const st=ZS();function Fe(r){let t;return new Promise(e=>{t=e,st.on(r,t)}).then(e=>(st.off(r,t),e))}let Li=null;const B0=new ResizeObserver(()=>{Li&&st.emit("stageUpdated",Li)});function VS(r){Li=r,B0.observe(Li),st.emit("stageCreated",Li)}function HS(){Li&&B0.unobserve(Li),Li=null}async function cu(){return Li||await Fe("stageCreated")}let Ne=null;async function KS(){const r=await cu();zS(r),st.on("stageUpdated",jS)}function YS(){Ne&&(Ne.destroy(!0,{children:!0}),Ne=null)}function zS(r){Ne=new Qm({backgroundAlpha:0,resizeTo:r,antialias:!0,resolution:window.devicePixelRatio}),Ne.stage.sortableChildren=!0,r.appendChild(Ne.view),st.emit("applicationCreated",Ne),process.env.NODE_ENV==="development"&&(globalThis.__PIXI_APP__=Ne)}async function fe(){return Ne||await Fe("applicationCreated")}function jS(r){Ne&&(Ne.resizeTo=r,st.emit("applicationResized",Ne))}var nh={exports:{}};nh.exports,function(r,t){var e=200,i="__lodash_hash_undefined__",s=800,n=16,o=9007199254740991,a="[object Arguments]",h="[object Array]",l="[object AsyncFunction]",c="[object Boolean]",u="[object Date]",d="[object Error]",f="[object Function]",m="[object GeneratorFunction]",p="[object Map]",g="[object Number]",y="[object Null]",_="[object Object]",b="[object Proxy]",v="[object RegExp]",w="[object Set]",E="[object String]",C="[object Undefined]",A="[object WeakMap]",R="[object ArrayBuffer]",G="[object DataView]",N="[object Float32Array]",P="[object Float64Array]",I="[object Int8Array]",D="[object Int16Array]",X="[object Int32Array]",H="[object Uint8Array]",Z="[object Uint8ClampedArray]",j="[object Uint16Array]",O="[object Uint32Array]",k=/[\\^$.*+?()[\]{}|]/g,F=/^\[object .+?Constructor\]$/,V=/^(?:0|[1-9]\d*)$/,$={};$[N]=$[P]=$[I]=$[D]=$[X]=$[H]=$[Z]=$[j]=$[O]=!0,$[a]=$[h]=$[R]=$[c]=$[G]=$[u]=$[d]=$[f]=$[p]=$[g]=$[_]=$[v]=$[w]=$[E]=$[A]=!1;var dt=typeof xe=="object"&&xe&&xe.Object===Object&&xe,ot=typeof self=="object"&&self&&self.Object===Object&&self,Ct=dt||ot||Function("return this")(),Mt=t&&!t.nodeType&&t,_t=Mt&&!0&&r&&!r.nodeType&&r,Y=_t&&_t.exports===Mt,tt=Y&&dt.process,et=function(){try{var x=_t&&_t.require&&_t.require("util").types;return x||tt&&tt.binding&&tt.binding("util")}catch{}}(),B=et&&et.isTypedArray;function xt(x,S,L){switch(L.length){case 0:return x.call(S);case 1:return x.call(S,L[0]);case 2:return x.call(S,L[0],L[1]);case 3:return x.call(S,L[0],L[1],L[2])}return x.apply(S,L)}function yt(x,S){for(var L=-1,U=Array(x);++L<x;)U[L]=S(L);return U}function Lt(x){return function(S){return x(S)}}function Vt(x,S){return x==null?void 0:x[S]}function Xe(x,S){return function(L){return x(S(L))}}var pi=Array.prototype,Fd=Function.prototype,Sn=Object.prototype,No=Ct["__core-js_shared__"],En=Fd.toString,mi=Sn.hasOwnProperty,Kh=function(){var x=/[^.]+$/.exec(No&&No.keys&&No.keys.IE_PROTO||"");return x?"Symbol(src)_1."+x:""}(),Yh=Sn.toString,Nd=En.call(Object),Cn=RegExp("^"+En.call(mi).replace(k,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Wr=Y?Ct.Buffer:void 0,Do=Ct.Symbol,Ze=Ct.Uint8Array,ko=Wr?Wr.allocUnsafe:void 0,Oo=Xe(Object.getPrototypeOf,Object),zh=Object.create,jh=Sn.propertyIsEnumerable,In=pi.splice,Wi=Do?Do.toStringTag:void 0,As=function(){try{var x=Ko(Object,"defineProperty");return x({},"",{}),x}catch{}}(),Dd=Wr?Wr.isBuffer:void 0,Ui=Math.max,Jh=Date.now,$h=Ko(Ct,"Map"),Rs=Ko(Object,"create"),Bo=function(){function x(){}return function(S){if(!Vi(S))return{};if(zh)return zh(S);x.prototype=S;var L=new x;return x.prototype=void 0,L}}();function Ve(x){var S=-1,L=x==null?0:x.length;for(this.clear();++S<L;){var U=x[S];this.set(U[0],U[1])}}function Wo(){this.__data__=Rs?Rs(null):{},this.size=0}function Uo(x){var S=this.has(x)&&delete this.__data__[x];return this.size-=S?1:0,S}function Xo(x){var S=this.__data__;if(Rs){var L=S[x];return L===i?void 0:L}return mi.call(S,x)?S[x]:void 0}function Ms(x){var S=this.__data__;return Rs?S[x]!==void 0:mi.call(S,x)}function kd(x,S){var L=this.__data__;return this.size+=this.has(x)?0:1,L[x]=Rs&&S===void 0?i:S,this}Ve.prototype.clear=Wo,Ve.prototype.delete=Uo,Ve.prototype.get=Xo,Ve.prototype.has=Ms,Ve.prototype.set=kd;function gi(x){var S=-1,L=x==null?0:x.length;for(this.clear();++S<L;){var U=x[S];this.set(U[0],U[1])}}function Od(){this.__data__=[],this.size=0}function Bd(x){var S=this.__data__,L=An(S,x);if(L<0)return!1;var U=S.length-1;return L==U?S.pop():In.call(S,L,1),--this.size,!0}function Wd(x){var S=this.__data__,L=An(S,x);return L<0?void 0:S[L][1]}function Qh(x){return An(this.__data__,x)>-1}function Zo(x,S){var L=this.__data__,U=An(L,x);return U<0?(++this.size,L.push([x,S])):L[U][1]=S,this}gi.prototype.clear=Od,gi.prototype.delete=Bd,gi.prototype.get=Wd,gi.prototype.has=Qh,gi.prototype.set=Zo;function Pe(x){var S=-1,L=x==null?0:x.length;for(this.clear();++S<L;){var U=x[S];this.set(U[0],U[1])}}function Ud(){this.size=0,this.__data__={hash:new Ve,map:new($h||gi),string:new Ve}}function Xd(x){var S=Mn(this,x).delete(x);return this.size-=S?1:0,S}function Zd(x){return Mn(this,x).get(x)}function Vd(x){return Mn(this,x).has(x)}function Hd(x,S){var L=Mn(this,x),U=L.size;return L.set(x,S),this.size+=L.size==U?0:1,this}Pe.prototype.clear=Ud,Pe.prototype.delete=Xd,Pe.prototype.get=Zd,Pe.prototype.has=Vd,Pe.prototype.set=Hd;function ye(x){var S=this.__data__=new gi(x);this.size=S.size}function Kd(){this.__data__=new gi,this.size=0}function Yd(x){var S=this.__data__,L=S.delete(x);return this.size=S.size,L}function zd(x){return this.__data__.get(x)}function jd(x){return this.__data__.has(x)}function Jd(x,S){var L=this.__data__;if(L instanceof gi){var U=L.__data__;if(!$h||U.length<e-1)return U.push([x,S]),this.size=++L.size,this;L=this.__data__=new Pe(U)}return L.set(x,S),this.size=L.size,this}ye.prototype.clear=Kd,ye.prototype.delete=Yd,ye.prototype.get=zd,ye.prototype.has=jd,ye.prototype.set=Jd;function dr(x,S){var L=Gn(x),U=!L&&yi(x),lt=!L&&!U&&ol(x),mt=!L&&!U&&!lt&&Xr(x),bt=L||U||lt||mt,at=bt?yt(x.length,String):[],vt=at.length;for(var Ot in x)(S||mi.call(x,Ot))&&!(bt&&(Ot=="length"||lt&&(Ot=="offset"||Ot=="parent")||mt&&(Ot=="buffer"||Ot=="byteLength"||Ot=="byteOffset")||sl(Ot,vt)))&&at.push(Ot);return at}function Vo(x,S,L){(L!==void 0&&!Pn(x[S],L)||L===void 0&&!(S in x))&&Ho(x,S,L)}function $d(x,S,L){var U=x[S];(!(mi.call(x,S)&&Pn(U,L))||L===void 0&&!(S in x))&&Ho(x,S,L)}function An(x,S){for(var L=x.length;L--;)if(Pn(x[L][0],S))return L;return-1}function Ho(x,S,L){S=="__proto__"&&As?As(x,S,{configurable:!0,enumerable:!0,value:L,writable:!0}):x[S]=L}var Qd=af();function fr(x){return x==null?x===void 0?C:y:Wi&&Wi in Object(x)?hf(x):uf(x)}function qh(x){return Ur(x)&&fr(x)==a}function qd(x){if(!Vi(x)||Ln(x))return!1;var S=Ps(x)?Cn:F;return S.test(pf(x))}function Xi(x){return Ur(x)&&al(x.length)&&!!$[fr(x)]}function tf(x){if(!Vi(x))return cf(x);var S=pr(x),L=[];for(var U in x)U=="constructor"&&(S||!mi.call(x,U))||L.push(U);return L}function tl(x,S,L,U,lt){x!==S&&Qd(S,function(mt,bt){if(lt||(lt=new ye),Vi(mt))ef(x,S,bt,L,tl,U,lt);else{var at=U?U(Yo(x,bt),mt,bt+"",x,S,lt):void 0;at===void 0&&(at=mt),Vo(x,bt,at)}},cl)}function ef(x,S,L,U,lt,mt,bt){var at=Yo(x,L),vt=Yo(S,L),Ot=bt.get(vt);if(Ot){Vo(x,L,Ot);return}var Rt=mt?mt(at,vt,L+"",x,S,bt):void 0,le=Rt===void 0;if(le){var be=Gn(vt),ii=!be&&ol(vt),ri=!be&&!ii&&Xr(vt);Rt=vt,be||ii||ri?Gn(at)?Rt=at:Fn(at)?Rt=Ls(at):ii?(le=!1,Rt=nf(vt,!0)):ri?(le=!1,Rt=of(vt,!0)):Rt=[]:hl(vt)||yi(vt)?(Rt=at,yi(at)?Rt=ll(at):(!Vi(at)||Ps(at))&&(Rt=rl(vt))):le=!1}le&&(bt.set(vt,Rt),lt(Rt,vt,U,mt,bt),bt.delete(vt)),Vo(x,L,Rt)}function rf(x,S){return df(Zi(x,S,T),x+"")}var sf=As?function(x,S){return As(x,"toString",{configurable:!0,enumerable:!1,value:gf(S),writable:!0})}:T;function nf(x,S){if(S)return x.slice();var L=x.length,U=ko?ko(L):new x.constructor(L);return x.copy(U),U}function Rn(x){var S=new x.constructor(x.byteLength);return new Ze(S).set(new Ze(x)),S}function of(x,S){var L=S?Rn(x.buffer):x.buffer;return new x.constructor(L,x.byteOffset,x.length)}function Ls(x,S){var L=-1,U=x.length;for(S||(S=Array(U));++L<U;)S[L]=x[L];return S}function el(x,S,L,U){var lt=!L;L||(L={});for(var mt=-1,bt=S.length;++mt<bt;){var at=S[mt],vt=U?U(L[at],x[at],at,L,x):void 0;vt===void 0&&(vt=x[at]),lt?Ho(L,at,vt):$d(L,at,vt)}return L}function il(x){return rf(function(S,L){var U=-1,lt=L.length,mt=lt>1?L[lt-1]:void 0,bt=lt>2?L[2]:void 0;for(mt=x.length>3&&typeof mt=="function"?(lt--,mt):void 0,bt&&lf(L[0],L[1],bt)&&(mt=lt<3?void 0:mt,lt=1),S=Object(S);++U<lt;){var at=L[U];at&&x(S,at,U,mt)}return S})}function af(x){return function(S,L,U){for(var lt=-1,mt=Object(S),bt=U(S),at=bt.length;at--;){var vt=bt[x?at:++lt];if(L(mt[vt],vt,mt)===!1)break}return S}}function Mn(x,S){var L=x.__data__;return nl(S)?L[typeof S=="string"?"string":"hash"]:L.map}function Ko(x,S){var L=Vt(x,S);return qd(L)?L:void 0}function hf(x){var S=mi.call(x,Wi),L=x[Wi];try{x[Wi]=void 0;var U=!0}catch{}var lt=Yh.call(x);return U&&(S?x[Wi]=L:delete x[Wi]),lt}function rl(x){return typeof x.constructor=="function"&&!pr(x)?Bo(Oo(x)):{}}function sl(x,S){var L=typeof x;return S=S??o,!!S&&(L=="number"||L!="symbol"&&V.test(x))&&x>-1&&x%1==0&&x<S}function lf(x,S,L){if(!Vi(L))return!1;var U=typeof S;return(U=="number"?zo(L)&&sl(S,L.length):U=="string"&&S in L)?Pn(L[S],x):!1}function nl(x){var S=typeof x;return S=="string"||S=="number"||S=="symbol"||S=="boolean"?x!=="__proto__":x===null}function Ln(x){return!!Kh&&Kh in x}function pr(x){var S=x&&x.constructor,L=typeof S=="function"&&S.prototype||Sn;return x===L}function cf(x){var S=[];if(x!=null)for(var L in Object(x))S.push(L);return S}function uf(x){return Yh.call(x)}function Zi(x,S,L){return S=Ui(S===void 0?x.length-1:S,0),function(){for(var U=arguments,lt=-1,mt=Ui(U.length-S,0),bt=Array(mt);++lt<mt;)bt[lt]=U[S+lt];lt=-1;for(var at=Array(S+1);++lt<S;)at[lt]=U[lt];return at[S]=L(bt),xt(x,this,at)}}function Yo(x,S){if(!(S==="constructor"&&typeof x[S]=="function")&&S!="__proto__")return x[S]}var df=ff(sf);function ff(x){var S=0,L=0;return function(){var U=Jh(),lt=n-(U-L);if(L=U,lt>0){if(++S>=s)return arguments[0]}else S=0;return x.apply(void 0,arguments)}}function pf(x){if(x!=null){try{return En.call(x)}catch{}try{return x+""}catch{}}return""}function Pn(x,S){return x===S||x!==x&&S!==S}var yi=qh(function(){return arguments}())?qh:function(x){return Ur(x)&&mi.call(x,"callee")&&!jh.call(x,"callee")},Gn=Array.isArray;function zo(x){return x!=null&&al(x.length)&&!Ps(x)}function Fn(x){return Ur(x)&&zo(x)}var ol=Dd||M;function Ps(x){if(!Vi(x))return!1;var S=fr(x);return S==f||S==m||S==l||S==b}function al(x){return typeof x=="number"&&x>-1&&x%1==0&&x<=o}function Vi(x){var S=typeof x;return x!=null&&(S=="object"||S=="function")}function Ur(x){return x!=null&&typeof x=="object"}function hl(x){if(!Ur(x)||fr(x)!=_)return!1;var S=Oo(x);if(S===null)return!0;var L=mi.call(S,"constructor")&&S.constructor;return typeof L=="function"&&L instanceof L&&En.call(L)==Nd}var Xr=B?Lt(B):Xi;function ll(x){return el(x,cl(x))}function cl(x){return zo(x)?dr(x,!0):tf(x)}var mf=il(function(x,S,L){tl(x,S,L)});function gf(x){return function(){return x}}function T(x){return x}function M(){return!1}r.exports=mf}(nh,nh.exports);var JS=nh.exports;const $S=Ds(JS);let hs=null;function QS(){hs=z.effectScope()}function qS(){hs==null||hs.stop(),hs=null}async function tE(){return hs||await Fe("scopeCreated")}let Rr=null;const W0={animationDuration:500,disableAnimationsThreshold:500,disableEdgesThreshold:500,styles:{colorMode:"dark",rowGap:24,columnGap:32,textDefault:"#ffffff",textInverse:"#000000",selectedBorderColor:"#3fa2c3",selectedBorderWidth:2,selectedBorderOffset:4,selectedBorderRadius:9,nodesPadding:16,nodeHeight:32,nodePadding:4,nodeRadius:6,nodeBorderRadius:9,nodeToggleSize:28,nodeToggleBgColor:"#35363C",nodeToggleBorderRadius:6,nodeToggleBorderColor:"#51525C",nodeUnselectedAlpha:.2,artifactsGap:4,artifactsNodeOverlap:4,artifactPaddingLeft:2,artifactPaddingRight:4,artifactPaddingY:2,artifactTextColor:"#ffffff",artifactBgColor:"#35363b",artifactBorderRadius:4,artifactContentGap:4,artifactIconSize:16,artifactIconColor:"#ffffff",flowStateBarHeight:6,flowStateSelectedBarHeight:8,flowStateAreaAlpha:.1,edgeColor:"#51525C",guideLineWidth:1,guideLineColor:"#51525C",guideTextTopPadding:8,guideTextLeftPadding:8,guideTextSize:12,guideTextColor:"#ADADAD",playheadWidth:2,playheadColor:"#6272FF",node:()=>({background:"#ffffff"}),state:()=>({background:"#ffffff"})}};function eE(r){const t=$S({},W0,r);return t.styles.node=e=>{var i,s;return{...W0.styles.node(e),...(s=(i=r.styles)==null?void 0:i.node)==null?void 0:s.call(i,e)}},t}async function iE(r){(await tE()).run(()=>{z.watch(()=>r.config,e=>{const i=eE(e);if(!Rr){Rr=i,st.emit("configCreated",Rr);return}Object.assign(Rr,i),st.emit("configUpdated",Rr)},{immediate:!0})})}function rE(){Rr=null}async function Yt(){return Rr||await Fe("configCreated")}async function U0(r,t){const e=await Yt();let i,s=null;async function n(){try{s=await e.fetch(r),t(s)}catch(a){console.error(a)}s&&!s.end_time&&(i=setTimeout(()=>n(),sE(s)))}function o(){clearInterval(i)}return{start:n,stop:o}}function sE(r){const t=Math.floor(r.nodes.size/ta)*ta;return Math.max(ta,t)}function rr(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function X0(r,t){r.prototype=Object.create(t.prototype),r.prototype.constructor=r,r.__proto__=t}/*!
|
|
1160
1160
|
* GSAP 3.12.5
|
|
1161
1161
|
* https://gsap.com
|
|
1162
1162
|
*
|
|
@@ -1164,7 +1164,7 @@ void main(void)\r
|
|
|
1164
1164
|
* Subject to the terms at https://gsap.com/standard-license or for
|
|
1165
1165
|
* Club GSAP members, the agreement issued with that membership.
|
|
1166
1166
|
* @author: Jack Doyle, jack@greensock.com
|
|
1167
|
-
*/var De={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},rn={duration:.5,overwrite:!1,delay:0},uu,fe,Dt,je=1e8,Gt=1/je,du=Math.PI*2,sC=du/4,nC=0,Z0=Math.sqrt,oC=Math.cos,aC=Math.sin,ne=function(t){return typeof t=="string"},Ht=function(t){return typeof t=="function"},sr=function(t){return typeof t=="number"},fu=function(t){return typeof t>"u"},Pi=function(t){return typeof t=="object"},Ce=function(t){return t!==!1},pu=function(){return typeof window<"u"},oh=function(t){return Ht(t)||ne(t)},V0=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},pe=Array.isArray,mu=/(?:-?\.?\d|\.)+/gi,H0=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,sn=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,gu=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,K0=/[+-]=-?[.\d]+/,Y0=/[^,'"\[\]\s]+/gi,hC=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,Ut,Gi,yu,bu,ke={},ah={},z0,j0=function(t){return(ah=cs(t,ke))&&Ae},xu=function(t,e){return console.warn("Invalid property",t,"set to",e,"Missing plugin? gsap.registerPlugin()")},ro=function(t,e){return!e&&console.warn(t)},J0=function(t,e){return t&&(ke[t]=e)&&ah&&(ah[t]=e)||ke},so=function(){return 0},lC={suppressEvents:!0,isStart:!0,kill:!1},hh={suppressEvents:!0,kill:!1},cC={suppressEvents:!0},_u={},Mr=[],vu={},$0,Oe={},Tu={},Q0=30,lh=[],wu="",Su=function(t){var e=t[0],i,s;if(Pi(e)||Ht(e)||(t=[t]),!(i=(e._gsap||{}).harness)){for(s=lh.length;s--&&!lh[s].targetTest(e););i=lh[s]}for(s=t.length;s--;)t[s]&&(t[s]._gsap||(t[s]._gsap=new Ig(t[s],i)))||t.splice(s,1);return t},ls=function(t){return t._gsap||Su(Qe(t))[0]._gsap},q0=function(t,e,i){return(i=t[e])&&Ht(i)?t[e]():fu(i)&&t.getAttribute&&t.getAttribute(e)||i},Ee=function(t,e){return(t=t.split(",")).forEach(e)||t},zt=function(t){return Math.round(t*1e5)/1e5||0},oe=function(t){return Math.round(t*1e7)/1e7||0},nn=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},uC=function(t,e){for(var i=e.length,s=0;t.indexOf(e[s])<0&&++s<i;);return s<i},ch=function(){var t=Mr.length,e=Mr.slice(0),i,s;for(vu={},Mr.length=0,i=0;i<t;i++)s=e[i],s&&s._lazy&&(s.render(s._lazy[0],s._lazy[1],!0)._lazy=0)},tg=function(t,e,i,s){Mr.length&&!fe&&ch(),t.render(e,i,s||fe&&e<0&&(t._initted||t._startAt)),Mr.length&&!fe&&ch()},eg=function(t){var e=parseFloat(t);return(e||e===0)&&(t+"").match(Y0).length<2?e:ne(t)?t.trim():t},ig=function(t){return t},Je=function(t,e){for(var i in e)i in t||(t[i]=e[i]);return t},dC=function(t){return function(e,i){for(var s in i)s in e||s==="duration"&&t||s==="ease"||(e[s]=i[s])}},cs=function(t,e){for(var i in e)t[i]=e[i];return t},rg=function r(t,e){for(var i in e)i!=="__proto__"&&i!=="constructor"&&i!=="prototype"&&(t[i]=Pi(e[i])?r(t[i]||(t[i]={}),e[i]):e[i]);return t},uh=function(t,e){var i={},s;for(s in t)s in e||(i[s]=t[s]);return i},no=function(t){var e=t.parent||Ut,i=t.keyframes?dC(pe(t.keyframes)):Je;if(Ce(t.inherit))for(;e;)i(t,e.vars.defaults),e=e.parent||e._dp;return t},fC=function(t,e){for(var i=t.length,s=i===e.length;s&&i--&&t[i]===e[i];);return i<0},sg=function(t,e,i,s,n){i===void 0&&(i="_first"),s===void 0&&(s="_last");var o=t[s],a;if(n)for(a=e[n];o&&o[n]>a;)o=o._prev;return o?(e._next=o._next,o._next=e):(e._next=t[i],t[i]=e),e._next?e._next._prev=e:t[s]=e,e._prev=o,e.parent=e._dp=t,e},dh=function(t,e,i,s){i===void 0&&(i="_first"),s===void 0&&(s="_last");var n=e._prev,o=e._next;n?n._next=o:t[i]===e&&(t[i]=o),o?o._prev=n:t[s]===e&&(t[s]=n),e._next=e._prev=e.parent=null},Lr=function(t,e){t.parent&&(!e||t.parent.autoRemoveChildren)&&t.parent.remove&&t.parent.remove(t),t._act=0},us=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},pC=function(t){for(var e=t.parent;e&&e.parent;)e._dirty=1,e.totalDuration(),e=e.parent;return t},Cu=function(t,e,i,s){return t._startAt&&(fe?t._startAt.revert(hh):t.vars.immediateRender&&!t.vars.autoRevert||t._startAt.render(e,!0,s))},mC=function r(t){return!t||t._ts&&r(t.parent)},ng=function(t){return t._repeat?on(t._tTime,t=t.duration()+t._rDelay)*t:0},on=function(t,e){var i=Math.floor(t/=e);return t&&i===t?i-1:i},fh=function(t,e){return(t-e._start)*e._ts+(e._ts>=0?0:e._dirty?e.totalDuration():e._tDur)},ph=function(t){return t._end=oe(t._start+(t._tDur/Math.abs(t._ts||t._rts||Gt)||0))},mh=function(t,e){var i=t._dp;return i&&i.smoothChildTiming&&t._ts&&(t._start=oe(i._time-(t._ts>0?e/t._ts:((t._dirty?t.totalDuration():t._tDur)-e)/-t._ts)),ph(t),i._dirty||us(i,t)),t},og=function(t,e){var i;if((e._time||!e._dur&&e._initted||e._start<t._time&&(e._dur||!e.add))&&(i=fh(t.rawTime(),e),(!e._dur||ao(0,e.totalDuration(),i)-e._tTime>Gt)&&e.render(i,!0)),us(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}},Fi=function(t,e,i,s){return e.parent&&Lr(e),e._start=oe((sr(i)?i:i||t!==Ut?$e(t,i,e):t._time)+e._delay),e._end=oe(e._start+(e.totalDuration()/Math.abs(e.timeScale())||0)),sg(t,e,"_first","_last",t._sort?"_start":0),Eu(e)||(t._recent=e),s||og(t,e),t._ts<0&&mh(t,t._tTime),t},ag=function(t,e){return(ke.ScrollTrigger||xu("scrollTrigger",e))&&ke.ScrollTrigger.create(e,t)},hg=function(t,e,i,s,n){if(Nu(t,e,n),!t._initted)return 1;if(!i&&t._pt&&!fe&&(t._dur&&t.vars.lazy!==!1||!t._dur&&t.vars.lazy)&&$0!==We.frame)return Mr.push(t),t._lazy=[n,s],1},gC=function r(t){var e=t.parent;return e&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||r(e))},Eu=function(t){var e=t.data;return e==="isFromStart"||e==="isStart"},yC=function(t,e,i,s){var n=t.ratio,o=e<0||!e&&(!t._start&&gC(t)&&!(!t._initted&&Eu(t))||(t._ts<0||t._dp._ts<0)&&!Eu(t))?0:1,a=t._rDelay,h=0,l,c,u;if(a&&t._repeat&&(h=ao(0,t._tDur,e),c=on(h,a),t._yoyo&&c&1&&(o=1-o),c!==on(t._tTime,a)&&(n=1-o,t.vars.repeatRefresh&&t._initted&&t.invalidate())),o!==n||fe||s||t._zTime===Gt||!e&&t._zTime){if(!t._initted&&hg(t,e,s,i,h))return;for(u=t._zTime,t._zTime=e||(i?Gt:0),i||(i=e&&!u),t.ratio=o,t._from&&(o=1-o),t._time=0,t._tTime=h,l=t._pt;l;)l.r(o,l.d),l=l._next;e<0&&Cu(t,e,i,!0),t._onUpdate&&!i&&Be(t,"onUpdate"),h&&t._repeat&&!i&&t.parent&&Be(t,"onRepeat"),(e>=t._tDur||e<0)&&t.ratio===o&&(o&&Lr(t,1),!i&&!fe&&(Be(t,o?"onComplete":"onReverseComplete",!0),t._prom&&t._prom()))}else t._zTime||(t._zTime=e)},bC=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}},an=function(t,e,i,s){var n=t._repeat,o=oe(e)||0,a=t._tTime/t._tDur;return a&&!s&&(t._time*=o/t._dur),t._dur=o,t._tDur=n?n<0?1e10:oe(o*(n+1)+t._rDelay*n):o,a>0&&!s&&mh(t,t._tTime=t._tDur*a),t.parent&&ph(t),i||us(t.parent,t),t},lg=function(t){return t instanceof Te?us(t):an(t,t._dur)},xC={_start:0,endTime:so,totalDuration:so},$e=function r(t,e,i){var s=t.labels,n=t._recent||xC,o=t.duration()>=je?n.endTime(!1):t._dur,a,h,l;return ne(e)&&(isNaN(e)||e in s)?(h=e.charAt(0),l=e.substr(-1)==="%",a=e.indexOf("="),h==="<"||h===">"?(a>=0&&(e=e.replace(/=/,"")),(h==="<"?n._start:n.endTime(n._repeat>=0))+(parseFloat(e.substr(1))||0)*(l?(a<0?n:i).totalDuration()/100:1)):a<0?(e in s||(s[e]=o),s[e]):(h=parseFloat(e.charAt(a-1)+e.substr(a+1)),l&&i&&(h=h/100*(pe(i)?i[0]:i).totalDuration()),a>1?r(t,e.substr(0,a-1),i)+h:o+h)):e==null?o:+e},oo=function(t,e,i){var s=sr(e[1]),n=(s?2:1)+(t<2?0:1),o=e[n],a,h;if(s&&(o.duration=e[1]),o.parent=i,t){for(a=o,h=i;h&&!("immediateRender"in a);)a=h.vars.defaults||{},h=Ce(h.vars.inherit)&&h.parent;o.immediateRender=Ce(a.immediateRender),t<2?o.runBackwards=1:o.startAt=e[n-1]}return new Jt(e[0],o,e[n+1])},Pr=function(t,e){return t||t===0?e(t):e},ao=function(t,e,i){return i<t?t:i>e?e:i},me=function(t,e){return!ne(t)||!(e=hC.exec(t))?"":e[1]},_C=function(t,e,i){return Pr(i,function(s){return ao(t,e,s)})},Iu=[].slice,cg=function(t,e){return t&&Pi(t)&&"length"in t&&(!e&&!t.length||t.length-1 in t&&Pi(t[0]))&&!t.nodeType&&t!==Gi},vC=function(t,e,i){return i===void 0&&(i=[]),t.forEach(function(s){var n;return ne(s)&&!e||cg(s,1)?(n=i).push.apply(n,Qe(s)):i.push(s)})||i},Qe=function(t,e,i){return Dt&&!e&&Dt.selector?Dt.selector(t):ne(t)&&!i&&(yu||!ln())?Iu.call((e||bu).querySelectorAll(t),0):pe(t)?vC(t,i):cg(t)?Iu.call(t,0):t?[t]:[]},Au=function(t){return t=Qe(t)[0]||ro("Invalid scope")||{},function(e){var i=t.current||t.nativeElement||t;return Qe(e,i.querySelectorAll?i:i===t?ro("Invalid scope")||bu.createElement("div"):t)}},ug=function(t){return t.sort(function(){return .5-Math.random()})},dg=function(t){if(Ht(t))return t;var e=Pi(t)?t:{each:t},i=ds(e.ease),s=e.from||0,n=parseFloat(e.base)||0,o={},a=s>0&&s<1,h=isNaN(s)||a,l=e.axis,c=s,u=s;return ne(s)?c=u={center:.5,edges:.5,end:1}[s]||0:!a&&h&&(c=s[0],u=s[1]),function(d,f,m){var p=(m||e).length,g=o[p],y,_,b,v,w,C,E,A,R;if(!g){if(R=e.grid==="auto"?0:(e.grid||[1,je])[1],!R){for(E=-je;E<(E=m[R++].getBoundingClientRect().left)&&R<p;);R<p&&R--}for(g=o[p]=[],y=h?Math.min(R,p)*c-.5:s%R,_=R===je?0:h?p*u/R-.5:s/R|0,E=0,A=je,C=0;C<p;C++)b=C%R-y,v=_-(C/R|0),g[C]=w=l?Math.abs(l==="y"?v:b):Z0(b*b+v*v),w>E&&(E=w),w<A&&(A=w);s==="random"&&ug(g),g.max=E-A,g.min=A,g.v=p=(parseFloat(e.amount)||parseFloat(e.each)*(R>p?p-1:l?l==="y"?p/R:R:Math.max(R,p/R))||0)*(s==="edges"?-1:1),g.b=p<0?n-p:n,g.u=me(e.amount||e.each)||0,i=i&&p<0?Sg(i):i}return p=(g[d]-g.min)/g.max||0,oe(g.b+(i?i(p):p)*g.v)+g.u}},Ru=function(t){var e=Math.pow(10,((t+"").split(".")[1]||"").length);return function(i){var s=oe(Math.round(parseFloat(i)/t)*t*e);return(s-s%1)/e+(sr(i)?0:me(i))}},fg=function(t,e){var i=pe(t),s,n;return!i&&Pi(t)&&(s=i=t.radius||je,t.values?(t=Qe(t.values),(n=!sr(t[0]))&&(s*=s)):t=Ru(t.increment)),Pr(e,i?Ht(t)?function(o){return n=t(o),Math.abs(n-o)<=s?n:o}:function(o){for(var a=parseFloat(n?o.x:o),h=parseFloat(n?o.y:0),l=je,c=0,u=t.length,d,f;u--;)n?(d=t[u].x-a,f=t[u].y-h,d=d*d+f*f):d=Math.abs(t[u]-a),d<l&&(l=d,c=u);return c=!s||l<=s?t[c]:o,n||c===o||sr(o)?c:c+me(o)}:Ru(t))},pg=function(t,e,i,s){return Pr(pe(t)?!e:i===!0?!!(i=0):!s,function(){return pe(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})},TC=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,o){return o(n)},s)}},wC=function(t,e){return function(i){return t(parseFloat(i))+(e||me(i))}},SC=function(t,e,i){return gg(t,e,0,1,i)},mg=function(t,e,i){return Pr(i,function(s){return t[~~e(s)]})},CC=function r(t,e,i){var s=e-t;return pe(t)?mg(t,r(0,t.length),e):Pr(i,function(n){return(s+(n-t)%s)%s+t})},EC=function r(t,e,i){var s=e-t,n=s*2;return pe(t)?mg(t,r(0,t.length-1),e):Pr(i,function(o){return o=(n+(o-t)%n)%n||0,t+(o>s?n-o:o)})},ho=function(t){for(var e=0,i="",s,n,o,a;~(s=t.indexOf("random(",e));)o=t.indexOf(")",s),a=t.charAt(s+7)==="[",n=t.substr(s+7,o-s-7).match(a?Y0:mu),i+=t.substr(e,s-e)+pg(a?n:+n[0],a?0:+n[1],+n[2]||1e-5),e=o+1;return i+t.substr(e,t.length-e)},gg=function(t,e,i,s,n){var o=e-t,a=s-i;return Pr(n,function(h){return i+((h-t)/o*a||0)})},IC=function r(t,e,i,s){var n=isNaN(t+e)?0:function(f){return(1-f)*t+f*e};if(!n){var o=ne(t),a={},h,l,c,u,d;if(i===!0&&(s=1)&&(i=null),o)t={p:t},e={p:e};else if(pe(t)&&!pe(e)){for(c=[],u=t.length,d=u-2,l=1;l<u;l++)c.push(r(t[l-1],t[l]));u--,n=function(m){m*=u;var p=Math.min(d,~~m);return c[p](m-p)},i=e}else s||(t=cs(pe(t)?[]:{},t));if(!c){for(h in e)Gu.call(a,t,h,"get",e[h]);n=function(m){return Ou(m,a)||(o?t.p:t)}}}return Pr(i,n)},yg=function(t,e,i){var s=t.labels,n=je,o,a,h;for(o in s)a=s[o]-e,a<0==!!i&&a&&n>(a=Math.abs(a))&&(h=o,n=a);return h},Be=function(t,e,i){var s=t.vars,n=s[e],o=Dt,a=t._ctx,h,l,c;if(n)return h=s[e+"Params"],l=s.callbackScope||t,i&&Mr.length&&ch(),a&&(Dt=a),c=h?n.apply(l,h):n.call(l),Dt=o,c},lo=function(t){return Lr(t),t.scrollTrigger&&t.scrollTrigger.kill(!!fe),t.progress()<1&&Be(t,"onInterrupt"),t},hn,bg=[],xg=function(t){if(t)if(t=!t.name&&t.default||t,pu()||t.headless){var e=t.name,i=Ht(t),s=e&&!i&&t.init?function(){this._props=[]}:t,n={init:so,render:Ou,add:Gu,kill:ZC,modifier:XC,rawVars:0},o={targetTest:0,get:0,getSetter:ku,aliases:{},register:0};if(ln(),t!==s){if(Oe[e])return;Je(s,Je(uh(t,n),o)),cs(s.prototype,cs(n,uh(t,o))),Oe[s.prop=e]=s,t.targetTest&&(lh.push(s),_u[e]=1),e=(e==="css"?"CSS":e.charAt(0).toUpperCase()+e.substr(1))+"Plugin"}J0(e,s),t.register&&t.register(Ae,s,Ie)}else bg.push(t)},Pt=255,co={aqua:[0,Pt,Pt],lime:[0,Pt,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,Pt],navy:[0,0,128],white:[Pt,Pt,Pt],olive:[128,128,0],yellow:[Pt,Pt,0],orange:[Pt,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[Pt,0,0],pink:[Pt,192,203],cyan:[0,Pt,Pt],transparent:[Pt,Pt,Pt,0]},Mu=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)*Pt+.5|0},_g=function(t,e,i){var s=t?sr(t)?[t>>16,t>>8&Pt,t&Pt]:0:co.black,n,o,a,h,l,c,u,d,f,m;if(!s){if(t.substr(-1)===","&&(t=t.substr(0,t.length-1)),co[t])s=co[t];else if(t.charAt(0)==="#"){if(t.length<6&&(n=t.charAt(1),o=t.charAt(2),a=t.charAt(3),t="#"+n+n+o+o+a+a+(t.length===5?t.charAt(4)+t.charAt(4):"")),t.length===9)return s=parseInt(t.substr(1,6),16),[s>>16,s>>8&Pt,s&Pt,parseInt(t.substr(7),16)/255];t=parseInt(t.substr(1),16),s=[t>>16,t>>8&Pt,t&Pt]}else if(t.substr(0,3)==="hsl"){if(s=m=t.match(mu),!e)h=+s[0]%360/360,l=+s[1]/100,c=+s[2]/100,o=c<=.5?c*(l+1):c+l-c*l,n=c*2-o,s.length>3&&(s[3]*=1),s[0]=Mu(h+1/3,n,o),s[1]=Mu(h,n,o),s[2]=Mu(h-1/3,n,o);else if(~t.indexOf("="))return s=t.match(H0),i&&s.length<4&&(s[3]=1),s}else s=t.match(mu)||co.transparent;s=s.map(Number)}return e&&!m&&(n=s[0]/Pt,o=s[1]/Pt,a=s[2]/Pt,u=Math.max(n,o,a),d=Math.min(n,o,a),c=(u+d)/2,u===d?h=l=0:(f=u-d,l=c>.5?f/(2-u-d):f/(u+d),h=u===n?(o-a)/f+(o<a?6:0):u===o?(a-n)/f+2:(n-o)/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},vg=function(t){var e=[],i=[],s=-1;return t.split(Gr).forEach(function(n){var o=n.match(sn)||[];e.push.apply(e,o),i.push(s+=o.length+1)}),e.c=i,e},Tg=function(t,e,i){var s="",n=(t+s).match(Gr),o=e?"hsla(":"rgba(",a=0,h,l,c,u;if(!n)return t;if(n=n.map(function(d){return(d=_g(d,e,1))&&o+(e?d[0]+","+d[1]+"%,"+d[2]+"%,"+d[3]:d.join(","))+")"}),i&&(c=vg(t),h=i.c,h.join(s)!==c.c.join(s)))for(l=t.replace(Gr,"1").split(sn),u=l.length-1;a<u;a++)s+=l[a]+(~h.indexOf(a)?n.shift()||o+"0,0,0,0)":(c.length?c:n.length?n:i).shift());if(!l)for(l=t.split(Gr),u=l.length-1;a<u;a++)s+=l[a]+n[a];return s+l[u]},Gr=function(){var r="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b",t;for(t in co)r+="|"+t+"\\b";return new RegExp(r+")","gi")}(),AC=/hsl[a]?\(/,wg=function(t){var e=t.join(" "),i;if(Gr.lastIndex=0,Gr.test(e))return i=AC.test(e),t[1]=Tg(t[1],i),t[0]=Tg(t[0],i,vg(t[1])),!0},uo,We=function(){var r=Date.now,t=500,e=33,i=r(),s=i,n=1e3/240,o=n,a=[],h,l,c,u,d,f,m=function p(g){var y=r()-s,_=g===!0,b,v,w,C;if((y>t||y<0)&&(i+=y-e),s+=y,w=s-i,b=w-o,(b>0||_)&&(C=++u.frame,d=w-u.time*1e3,u.time=w=w/1e3,o+=b+(b>=n?4:n-b),v=1),_||(h=l(p)),v)for(f=0;f<a.length;f++)a[f](w,d,C,g)};return u={time:0,frame:0,tick:function(){m(!0)},deltaRatio:function(g){return d/(1e3/(g||60))},wake:function(){z0&&(!yu&&pu()&&(Gi=yu=window,bu=Gi.document||{},ke.gsap=Ae,(Gi.gsapVersions||(Gi.gsapVersions=[])).push(Ae.version),j0(ah||Gi.GreenSockGlobals||!Gi.gsap&&Gi||{}),bg.forEach(xg)),c=typeof requestAnimationFrame<"u"&&requestAnimationFrame,h&&u.sleep(),l=c||function(g){return setTimeout(g,o-u.time*1e3+1|0)},uo=1,m(2))},sleep:function(){(c?cancelAnimationFrame:clearTimeout)(h),uo=0,l=so},lagSmoothing:function(g,y){t=g||1/0,e=Math.min(y||33,t)},fps:function(g){n=1e3/(g||240),o=u.time*1e3+n},add:function(g,y,_){var b=y?function(v,w,C,E){g(v,w,C,E),u.remove(b)}:g;return u.remove(g),a[_?"unshift":"push"](b),ln(),b},remove:function(g,y){~(y=a.indexOf(g))&&a.splice(y,1)&&f>=y&&f--},_listeners:a},u}(),ln=function(){return!uo&&We.wake()},St={},RC=/^[\d.\-M][\d.\-,\s]/,MC=/["']/g,LC=function(t){for(var e={},i=t.substr(1,t.length-3).split(":"),s=i[0],n=1,o=i.length,a,h,l;n<o;n++)h=i[n],a=n!==o-1?h.lastIndexOf(","):h.length,l=h.substr(0,a),e[s]=isNaN(l)?l.replace(MC,"").trim():+l,s=h.substr(a+1).trim();return e},PC=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)},GC=function(t){var e=(t+"").split("("),i=St[e[0]];return i&&e.length>1&&i.config?i.config.apply(null,~t.indexOf("{")?[LC(e[1])]:PC(t).split(",").map(eg)):St._CE&&RC.test(t)?St._CE("",t):i},Sg=function(t){return function(e){return 1-t(1-e)}},Cg=function r(t,e){for(var i=t._first,s;i;)i instanceof Te?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},ds=function(t,e){return t&&(Ht(t)?t:St[t]||GC(t))||e},fs=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},o;return Ee(t,function(a){St[a]=ke[a]=n,St[o=a.toLowerCase()]=i;for(var h in n)St[o+(h==="easeIn"?".in":h==="easeOut"?".out":".inOut")]=St[a+"."+h]=n[h]}),n},Eg=function(t){return function(e){return e<.5?(1-t(1-e*2))/2:.5+t((e-.5)*2)/2}},Lu=function r(t,e,i){var s=e>=1?e:1,n=(i||(t?.3:.45))/(e<1?e:1),o=n/du*(Math.asin(1/s)||0),a=function(c){return c===1?1:s*Math.pow(2,-10*c)*aC((c-o)*n)+1},h=t==="out"?a:t==="in"?function(l){return 1-a(1-l)}:Eg(a);return n=du/n,h.config=function(l,c){return r(t,l,c)},h},Pu=function r(t,e){e===void 0&&(e=1.70158);var i=function(o){return o?--o*o*((e+1)*o+e)+1:0},s=t==="out"?i:t==="in"?function(n){return 1-i(1-n)}:Eg(i);return s.config=function(n){return r(t,n)},s};Ee("Linear,Quad,Cubic,Quart,Quint,Strong",function(r,t){var e=t<5?t+1:t;fs(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})}),St.Linear.easeNone=St.none=St.Linear.easeIn,fs("Elastic",Lu("in"),Lu("out"),Lu()),function(r,t){var e=1/t,i=2*e,s=2.5*e,n=function(a){return a<e?r*a*a:a<i?r*Math.pow(a-1.5/t,2)+.75:a<s?r*(a-=2.25/t)*a+.9375:r*Math.pow(a-2.625/t,2)+.984375};fs("Bounce",function(o){return 1-n(1-o)},n)}(7.5625,2.75),fs("Expo",function(r){return r?Math.pow(2,10*(r-1)):0}),fs("Circ",function(r){return-(Z0(1-r*r)-1)}),fs("Sine",function(r){return r===1?1:-oC(r*sC)+1}),fs("Back",Pu("in"),Pu("out"),Pu()),St.SteppedEase=St.steps=ke.SteppedEase={config:function(t,e){t===void 0&&(t=1);var i=1/t,s=t+(e?0:1),n=e?1:0,o=1-Gt;return function(a){return((s*ao(0,o,a)|0)+n)*i}}},rn.ease=St["quad.out"],Ee("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",function(r){return wu+=r+","+r+"Params,"});var Ig=function(t,e){this.id=nC++,t._gsap=this,this.target=t,this.harness=e,this.get=e?e.get:q0,this.set=e?e.getSetter:ku},fo=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,an(this,+e.duration,1,1),this.data=e.data,Dt&&(this._ctx=Dt,Dt.data.push(this)),uo||We.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,an(this,this._repeat<0?i:(i-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},t.totalTime=function(i,s){if(ln(),!arguments.length)return this._tTime;var n=this._dp;if(n&&n.smoothChildTiming&&this._ts){for(mh(this,i),!n._dp||n.parent||og(n,this);n&&n.parent;)n.parent._time!==n._start+(n._ts>=0?n._tTime/n._ts:(n.totalDuration()-n._tTime)/-n._ts)&&n.totalTime(n._tTime,!0),n=n.parent;!this.parent&&this._dp.autoRemoveChildren&&(this._ts>0&&i<this._tDur||this._ts<0&&i>0||!this._tDur&&!i)&&Fi(this._dp,this,this._start-this._delay)}return(this._tTime!==i||!this._dur&&!s||this._initted&&Math.abs(this._zTime)===Gt||!i&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=i),tg(this,i,s)),this},t.time=function(i,s){return arguments.length?this.totalTime(Math.min(this.totalDuration(),i+ng(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)+ng(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?on(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?fh(this.parent._time,this):this._tTime;return this._rts=+i||0,this._ts=this._ps||i===-Gt?0:this._rts,this.totalTime(ao(-Math.abs(this._delay),this._tDur,n),s!==!1),ph(this),pC(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):(ln(),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)&&Fi(s,this,i-this._delay),this}return this._start},t.endTime=function(i){return this._start+(Ce(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?fh(s.rawTime(i),this):this._tTime:this._tTime},t.revert=function(i){i===void 0&&(i=cC);var s=fe;return fe=i,(this._initted||this._startAt)&&(this.timeline&&this.timeline.revert(i),this.totalTime(-.01,i.suppressEvents)),this.data!=="nested"&&i.kill!==!1&&this.kill(),fe=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,lg(this)):this._repeat===-2?1/0:this._repeat},t.repeatDelay=function(i){if(arguments.length){var s=this._time;return this._rDelay=i,lg(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($e(this,i),Ce(s))},t.restart=function(i,s){return this.play().totalTime(i?-this._delay:0,Ce(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 o=this.vars;return arguments.length>1?(s?(o[i]=s,n&&(o[i+"Params"]=n),i==="onUpdate"&&(this._onUpdate=s)):delete o[i],this):o[i]},t.then=function(i){var s=this;return new Promise(function(n){var o=Ht(i)?i:ig,a=function(){var l=s.then;s.then=null,Ht(o)&&(o=o(s))&&(o.then||o===s)&&(s.then=l),n(o),s.then=l};s._initted&&s.totalProgress()===1&&s._ts>=0||!s._tTime&&s._ts<0?a():s._prom=a})},t.kill=function(){lo(this)},r}();Je(fo.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 Te=function(r){X0(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=Ce(i.sortChildren),Ut&&Fi(i.parent||Ut,rr(n),s),i.reversed&&n.reverse(),i.paused&&n.paused(!0),i.scrollTrigger&&ag(rr(n),i.scrollTrigger),n}var e=t.prototype;return e.to=function(s,n,o){return oo(0,arguments,this),this},e.from=function(s,n,o){return oo(1,arguments,this),this},e.fromTo=function(s,n,o,a){return oo(2,arguments,this),this},e.set=function(s,n,o){return n.duration=0,n.parent=this,no(n).repeatDelay||(n.repeat=0),n.immediateRender=!!n.immediateRender,new Jt(s,n,$e(this,o),1),this},e.call=function(s,n,o){return Fi(this,Jt.delayedCall(0,s,n),o)},e.staggerTo=function(s,n,o,a,h,l,c){return o.duration=n,o.stagger=o.stagger||a,o.onComplete=l,o.onCompleteParams=c,o.parent=this,new Jt(s,o,$e(this,h)),this},e.staggerFrom=function(s,n,o,a,h,l,c){return o.runBackwards=1,no(o).immediateRender=Ce(o.immediateRender),this.staggerTo(s,n,o,a,h,l,c)},e.staggerFromTo=function(s,n,o,a,h,l,c,u){return a.startAt=o,no(a).immediateRender=Ce(a.immediateRender),this.staggerTo(s,n,a,h,l,c,u)},e.render=function(s,n,o){var a=this._time,h=this._dirty?this.totalDuration():this._tDur,l=this._dur,c=s<=0?0:oe(s),u=this._zTime<0!=s<0&&(this._initted||!l),d,f,m,p,g,y,_,b,v,w,C,E;if(this!==Ut&&c>h&&s>=0&&(c=h),c!==this._tTime||o||u){if(a!==this._time&&l&&(c+=this._time-a,s+=this._time-a),d=c,v=this._start,b=this._ts,y=!b,u&&(l||(a=this._zTime),(s||!n)&&(this._zTime=s)),this._repeat){if(C=this._yoyo,g=l+this._rDelay,this._repeat<-1&&s<0)return this.totalTime(g*100+s,n,o);if(d=oe(c%g),c===h?(p=this._repeat,d=l):(p=~~(c/g),p&&p===c/g&&(d=l,p--),d>l&&(d=l)),w=on(this._tTime,g),!a&&this._tTime&&w!==p&&this._tTime-w*g-this._dur<=0&&(w=p),C&&p&1&&(d=l-d,E=1),p!==w&&!this._lock){var A=C&&w&1,R=A===(C&&p&1);if(p<w&&(A=!A),a=A?0:c%l?l:c,this._lock=1,this.render(a||(E?0:oe(p*g)),n,!l)._lock=0,this._tTime=c,!n&&this.parent&&Be(this,"onRepeat"),this.vars.repeatRefresh&&!E&&(this.invalidate()._lock=1),a&&a!==this._time||y!==!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(l=this._dur,h=this._tDur,R&&(this._lock=2,a=A?l:-1e-4,this.render(a,!0),this.vars.repeatRefresh&&!E&&this.invalidate()),this._lock=0,!this._ts&&!y)return this;Cg(this,E)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(_=bC(this,oe(a),oe(d)),_&&(c-=d-(d=_._start))),this._tTime=c,this._time=d,this._act=!b,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=s,a=0),!a&&d&&!n&&!p&&(Be(this,"onStart"),this._tTime!==c))return this;if(d>=a&&s>=0)for(f=this._first;f;){if(m=f._next,(f._act||d>=f._start)&&f._ts&&_!==f){if(f.parent!==this)return this.render(s,n,o);if(f.render(f._ts>0?(d-f._start)*f._ts:(f._dirty?f.totalDuration():f._tDur)+(d-f._start)*f._ts,n,o),d!==this._time||!this._ts&&!y){_=0,m&&(c+=this._zTime=-Gt);break}}f=m}else{f=this._last;for(var G=s<0?s:d;f;){if(m=f._prev,(f._act||G<=f._end)&&f._ts&&_!==f){if(f.parent!==this)return this.render(s,n,o);if(f.render(f._ts>0?(G-f._start)*f._ts:(f._dirty?f.totalDuration():f._tDur)+(G-f._start)*f._ts,n,o||fe&&(f._initted||f._startAt)),d!==this._time||!this._ts&&!y){_=0,m&&(c+=this._zTime=G?-Gt:Gt);break}}f=m}}if(_&&!n&&(this.pause(),_.render(d>=a?0:-Gt)._zTime=d>=a?1:-1,this._ts))return this._start=v,ph(this),this.render(s,n,o);this._onUpdate&&!n&&Be(this,"onUpdate",!0),(c===h&&this._tTime>=this.totalDuration()||!c&&a)&&(v===this._start||Math.abs(b)!==Math.abs(this._ts))&&(this._lock||((s||!l)&&(c===h&&this._ts>0||!c&&this._ts<0)&&Lr(this,1),!n&&!(s<0&&!a)&&(c||a||!h)&&(Be(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 o=this;if(sr(n)||(n=$e(this,n,s)),!(s instanceof fo)){if(pe(s))return s.forEach(function(a){return o.add(a,n)}),this;if(ne(s))return this.addLabel(s,n);if(Ht(s))s=Jt.delayedCall(0,s);else return this}return this!==s?Fi(this,s,n):this},e.getChildren=function(s,n,o,a){s===void 0&&(s=!0),n===void 0&&(n=!0),o===void 0&&(o=!0),a===void 0&&(a=-je);for(var h=[],l=this._first;l;)l._start>=a&&(l instanceof Jt?n&&h.push(l):(o&&h.push(l),s&&h.push.apply(h,l.getChildren(!0,n,o)))),l=l._next;return h},e.getById=function(s){for(var n=this.getChildren(1,1,1),o=n.length;o--;)if(n[o].vars.id===s)return n[o]},e.remove=function(s){return ne(s)?this.removeLabel(s):Ht(s)?this.killTweensOf(s):(dh(this,s),s===this._recent&&(this._recent=this._last),us(this))},e.totalTime=function(s,n){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=oe(We.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]=$e(this,n),this},e.removeLabel=function(s){return delete this.labels[s],this},e.addPause=function(s,n,o){var a=Jt.delayedCall(0,n||so,o);return a.data="isPause",this._hasPause=1,Fi(this,a,$e(this,s))},e.removePause=function(s){var n=this._first;for(s=$e(this,s);n;)n._start===s&&n.data==="isPause"&&Lr(n),n=n._next},e.killTweensOf=function(s,n,o){for(var a=this.getTweensOf(s,o),h=a.length;h--;)Fr!==a[h]&&a[h].kill(s,n);return this},e.getTweensOf=function(s,n){for(var o=[],a=Qe(s),h=this._first,l=sr(n),c;h;)h instanceof Jt?uC(h._targets,a)&&(l?(!Fr||h._initted&&h._ts)&&h.globalTime(0)<=n&&h.globalTime(h.totalDuration())>n:!n||h.isActive())&&o.push(h):(c=h.getTweensOf(a,n)).length&&o.push.apply(o,c),h=h._next;return o},e.tweenTo=function(s,n){n=n||{};var o=this,a=$e(o,s),h=n,l=h.startAt,c=h.onStart,u=h.onStartParams,d=h.immediateRender,f,m=Jt.to(o,Je({ease:n.ease||"none",lazy:!1,immediateRender:!1,time:a,overwrite:"auto",duration:n.duration||Math.abs((a-(l&&"time"in l?l.time:o._time))/o.timeScale())||Gt,onStart:function(){if(o.pause(),!f){var g=n.duration||Math.abs((a-(l&&"time"in l?l.time:o._time))/o.timeScale());m._dur!==g&&an(m,g,0,1).render(m._time,!0,!0),f=1}c&&c.apply(m,u||[])}},n));return d?m.render(0):m},e.tweenFromTo=function(s,n,o){return this.tweenTo(n,Je({startAt:{time:$e(this,s)}},o))},e.recent=function(){return this._recent},e.nextLabel=function(s){return s===void 0&&(s=this._time),yg(this,$e(this,s))},e.previousLabel=function(s){return s===void 0&&(s=this._time),yg(this,$e(this,s),1)},e.currentLabel=function(s){return arguments.length?this.seek(s,!0):this.previousLabel(this._time+Gt)},e.shiftChildren=function(s,n,o){o===void 0&&(o=0);for(var a=this._first,h=this.labels,l;a;)a._start>=o&&(a._start+=s,a._end+=s),a=a._next;if(n)for(l in h)h[l]>=o&&(h[l]+=s);return us(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,o;n;)o=n._next,this.remove(n),n=o;return this._dp&&(this._time=this._tTime=this._pTime=0),s&&(this.labels={}),us(this)},e.totalDuration=function(s){var n=0,o=this,a=o._last,h=je,l,c,u;if(arguments.length)return o.timeScale((o._repeat<0?o.duration():o.totalDuration())/(o.reversed()?-s:s));if(o._dirty){for(u=o.parent;a;)l=a._prev,a._dirty&&a.totalDuration(),c=a._start,c>h&&o._sort&&a._ts&&!o._lock?(o._lock=1,Fi(o,a,c-a._delay,1)._lock=0):h=c,c<0&&a._ts&&(n-=c,(!u&&!o._dp||u&&u.smoothChildTiming)&&(o._start+=c/o._ts,o._time-=c,o._tTime-=c),o.shiftChildren(-c,!1,-1/0),h=0),a._end>n&&a._ts&&(n=a._end),a=l;an(o,o===Ut&&o._time>n?o._time:n,1,1),o._dirty=0}return o._tDur},t.updateRoot=function(s){if(Ut._ts&&(tg(Ut,fh(s,Ut)),$0=We.frame),We.frame>=Q0){Q0+=De.autoSleep||120;var n=Ut._first;if((!n||!n._ts)&&De.autoSleep&&We._listeners.length<2){for(;n&&!n._ts;)n=n._next;n||We.sleep()}}},t}(fo);Je(Te.prototype,{_lock:0,_hasPause:0,_forcing:0});var FC=function(t,e,i,s,n,o,a){var h=new Ie(this._pt,t,e,0,1,Gg,null,n),l=0,c=0,u,d,f,m,p,g,y,_;for(h.b=i,h.e=s,i+="",s+="",(y=~s.indexOf("random("))&&(s=ho(s)),o&&(_=[i,s],o(_,t,e),i=_[0],s=_[1]),d=i.match(gu)||[];u=gu.exec(s);)m=u[0],p=s.substring(l,u.index),f?f=(f+1)%5:p.substr(-5)==="rgba("&&(f=1),m!==d[c++]&&(g=parseFloat(d[c-1])||0,h._pt={_next:h._pt,p:p||c===1?p:",",s:g,c:m.charAt(1)==="="?nn(g,m)-g:parseFloat(m)-g,m:f&&f<4?Math.round:0},l=gu.lastIndex);return h.c=l<s.length?s.substring(l,s.length):"",h.fp=a,(K0.test(s)||y)&&(h.e=0),this._pt=h,h},Gu=function(t,e,i,s,n,o,a,h,l,c){Ht(s)&&(s=s(n||0,t,o));var u=t[e],d=i!=="get"?i:Ht(u)?l?t[e.indexOf("set")||!Ht(t["get"+e.substr(3)])?e:"get"+e.substr(3)](l):t[e]():u,f=Ht(u)?l?BC:Lg:Du,m;if(ne(s)&&(~s.indexOf("random(")&&(s=ho(s)),s.charAt(1)==="="&&(m=nn(d,s)+(me(d)||0),(m||m===0)&&(s=m))),!c||d!==s||Fu)return!isNaN(d*s)&&s!==""?(m=new Ie(this._pt,t,e,+d||0,s-(d||0),typeof u=="boolean"?UC:Pg,0,f),l&&(m.fp=l),a&&m.modifier(a,this,t),this._pt=m):(!u&&!(e in t)&&xu(e,s),FC.call(this,t,e,d,s,f,h||De.stringFilter,l))},NC=function(t,e,i,s,n){if(Ht(t)&&(t=po(t,n,e,i,s)),!Pi(t)||t.style&&t.nodeType||pe(t)||V0(t))return ne(t)?po(t,n,e,i,s):t;var o={},a;for(a in t)o[a]=po(t[a],n,e,i,s);return o},Ag=function(t,e,i,s,n,o){var a,h,l,c;if(Oe[t]&&(a=new Oe[t]).init(n,a.rawVars?e[t]:NC(e[t],s,n,o,i),i,s,o)!==!1&&(i._pt=h=new Ie(i._pt,n,t,0,1,a.render,a,0,a.priority),i!==hn))for(l=i._ptLookup[i._targets.indexOf(n)],c=a._props.length;c--;)l[a._props[c]]=h;return a},Fr,Fu,Nu=function r(t,e,i){var s=t.vars,n=s.ease,o=s.startAt,a=s.immediateRender,h=s.lazy,l=s.onUpdate,c=s.runBackwards,u=s.yoyoEase,d=s.keyframes,f=s.autoRevert,m=t._dur,p=t._startAt,g=t._targets,y=t.parent,_=y&&y.data==="nested"?y.vars.targets:g,b=t._overwrite==="auto"&&!uu,v=t.timeline,w,C,E,A,R,G,N,P,I,D,X,H,Z;if(v&&(!d||!n)&&(n="none"),t._ease=ds(n,rn.ease),t._yEase=u?Sg(ds(u===!0?n:u,rn.ease)):0,u&&t._yoyo&&!t._repeat&&(u=t._yEase,t._yEase=t._ease,t._ease=u),t._from=!v&&!!s.runBackwards,!v||d&&!s.stagger){if(P=g[0]?ls(g[0]).harness:0,H=P&&s[P.prop],w=uh(s,_u),p&&(p._zTime<0&&p.progress(1),e<0&&c&&a&&!f?p.render(-1,!0):p.revert(c&&m?hh:lC),p._lazy=0),o){if(Lr(t._startAt=Jt.set(g,Je({data:"isStart",overwrite:!1,parent:y,immediateRender:!0,lazy:!p&&Ce(h),startAt:null,delay:0,onUpdate:l&&function(){return Be(t,"onUpdate")},stagger:0},o))),t._startAt._dp=0,t._startAt._sat=t,e<0&&(fe||!a&&!f)&&t._startAt.revert(hh),a&&m&&e<=0&&i<=0){e&&(t._zTime=e);return}}else if(c&&m&&!p){if(e&&(a=!1),E=Je({overwrite:!1,data:"isFromStart",lazy:a&&!p&&Ce(h),immediateRender:a,stagger:0,parent:y},w),H&&(E[P.prop]=H),Lr(t._startAt=Jt.set(g,E)),t._startAt._dp=0,t._startAt._sat=t,e<0&&(fe?t._startAt.revert(hh):t._startAt.render(-1,!0)),t._zTime=e,!a)r(t._startAt,Gt,Gt);else if(!e)return}for(t._pt=t._ptCache=0,h=m&&Ce(h)||h&&!m,C=0;C<g.length;C++){if(R=g[C],N=R._gsap||Su(g)[C]._gsap,t._ptLookup[C]=D={},vu[N.id]&&Mr.length&&ch(),X=_===g?C:_.indexOf(R),P&&(I=new P).init(R,H||w,t,X,_)!==!1&&(t._pt=A=new Ie(t._pt,R,I.name,0,1,I.render,I,0,I.priority),I._props.forEach(function(j){D[j]=A}),I.priority&&(G=1)),!P||H)for(E in w)Oe[E]&&(I=Ag(E,w,t,X,R,_))?I.priority&&(G=1):D[E]=A=Gu.call(t,R,E,"get",w[E],X,_,0,s.stringFilter);t._op&&t._op[C]&&t.kill(R,t._op[C]),b&&t._pt&&(Fr=t,Ut.killTweensOf(R,D,t.globalTime(e)),Z=!t.parent,Fr=0),t._pt&&h&&(vu[N.id]=1)}G&&Fg(t),t._onInit&&t._onInit(t)}t._onUpdate=l,t._initted=(!t._op||t._pt)&&!Z,d&&e<=0&&v.render(je,!0,!0)},DC=function(t,e,i,s,n,o,a,h){var l=(t._pt&&t._ptCache||(t._ptCache={}))[e],c,u,d,f;if(!l)for(l=t._ptCache[e]=[],d=t._ptLookup,f=t._targets.length;f--;){if(c=d[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 Fu=1,t.vars[e]="+=0",Nu(t,a),Fu=0,h?ro(e+" not eligible for reset"):1;l.push(c)}for(f=l.length;f--;)u=l[f],c=u._pt||u,c.s=(s||s===0)&&!n?s:c.s+(s||0)+o*c.c,c.c=i-c.s,u.e&&(u.e=zt(i)+me(u.e)),u.b&&(u.b=c.s+me(u.b))},kC=function(t,e){var i=t[0]?ls(t[0]).harness:0,s=i&&i.aliases,n,o,a,h;if(!s)return e;n=cs({},e);for(o in s)if(o in n)for(h=s[o].split(","),a=h.length;a--;)n[h[a]]=n[o];return n},OC=function(t,e,i,s){var n=e.ease||s||"power1.inOut",o,a;if(pe(e))a=i[t]||(i[t]=[]),e.forEach(function(h,l){return a.push({t:l/(e.length-1)*100,v:h,e:n})});else for(o in e)a=i[o]||(i[o]=[]),o==="ease"||a.push({t:parseFloat(t),v:e[o],e:n})},po=function(t,e,i,s,n){return Ht(t)?t.call(e,i,s,n):ne(t)&&~t.indexOf("random(")?ho(t):t},Rg=wu+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert",Mg={};Ee(Rg+",id,stagger,delay,duration,paused,scrollTrigger",function(r){return Mg[r]=1});var Jt=function(r){X0(t,r);function t(i,s,n,o){var a;typeof s=="number"&&(n.duration=s,s=n,n=null),a=r.call(this,o?s:no(s))||this;var h=a.vars,l=h.duration,c=h.delay,u=h.immediateRender,d=h.stagger,f=h.overwrite,m=h.keyframes,p=h.defaults,g=h.scrollTrigger,y=h.yoyoEase,_=s.parent||Ut,b=(pe(i)||V0(i)?sr(i[0]):"length"in s)?[i]:Qe(i),v,w,C,E,A,R,G,N;if(a._targets=b.length?Su(b):ro("GSAP target "+i+" not found. https://gsap.com",!De.nullTargetWarn)||[],a._ptLookup=[],a._overwrite=f,m||d||oh(l)||oh(c)){if(s=a.vars,v=a.timeline=new Te({data:"nested",defaults:p||{},targets:_&&_.data==="nested"?_.vars.targets:b}),v.kill(),v.parent=v._dp=rr(a),v._start=0,d||oh(l)||oh(c)){if(E=b.length,G=d&&dg(d),Pi(d))for(A in d)~Rg.indexOf(A)&&(N||(N={}),N[A]=d[A]);for(w=0;w<E;w++)C=uh(s,Mg),C.stagger=0,y&&(C.yoyoEase=y),N&&cs(C,N),R=b[w],C.duration=+po(l,rr(a),w,R,b),C.delay=(+po(c,rr(a),w,R,b)||0)-a._delay,!d&&E===1&&C.delay&&(a._delay=c=C.delay,a._start+=c,C.delay=0),v.to(R,C,G?G(w,R,b):0),v._ease=St.none;v.duration()?l=c=0:a.timeline=0}else if(m){no(Je(v.vars.defaults,{ease:"none"})),v._ease=ds(m.ease||s.ease||"none");var P=0,I,D,X;if(pe(m))m.forEach(function(H){return v.to(b,H,">")}),v.duration();else{C={};for(A in m)A==="ease"||A==="easeEach"||OC(A,m[A],C,m.easeEach);for(A in C)for(I=C[A].sort(function(H,Z){return H.t-Z.t}),P=0,w=0;w<I.length;w++)D=I[w],X={ease:D.e,duration:(D.t-(w?I[w-1].t:0))/100*l},X[A]=D.v,v.to(b,X,P),P+=X.duration;v.duration()<l&&v.to({},{duration:l-v.duration()})}}l||a.duration(l=v.duration())}else a.timeline=0;return f===!0&&!uu&&(Fr=rr(a),Ut.killTweensOf(b),Fr=0),Fi(_,rr(a),n),s.reversed&&a.reverse(),s.paused&&a.paused(!0),(u||!l&&!m&&a._start===oe(_._time)&&Ce(u)&&mC(rr(a))&&_.data!=="nested")&&(a._tTime=-Gt,a.render(Math.max(0,-c)||0)),g&&ag(rr(a),g),a}var e=t.prototype;return e.render=function(s,n,o){var a=this._time,h=this._tDur,l=this._dur,c=s<0,u=s>h-Gt&&!c?h:s<Gt?0:s,d,f,m,p,g,y,_,b,v;if(!l)yC(this,s,n,o);else if(u!==this._tTime||!s||o||!this._initted&&this._tTime||this._startAt&&this._zTime<0!==c){if(d=u,b=this.timeline,this._repeat){if(p=l+this._rDelay,this._repeat<-1&&c)return this.totalTime(p*100+s,n,o);if(d=oe(u%p),u===h?(m=this._repeat,d=l):(m=~~(u/p),m&&m===oe(u/p)&&(d=l,m--),d>l&&(d=l)),y=this._yoyo&&m&1,y&&(v=this._yEase,d=l-d),g=on(this._tTime,p),d===a&&!o&&this._initted&&m===g)return this._tTime=u,this;m!==g&&(b&&this._yEase&&Cg(b,y),this.vars.repeatRefresh&&!y&&!this._lock&&this._time!==p&&this._initted&&(this._lock=o=1,this.render(oe(p*m),!0).invalidate()._lock=0))}if(!this._initted){if(hg(this,c?s:d,o,n,u))return this._tTime=0,this;if(a!==this._time&&!(o&&this.vars.repeatRefresh&&m!==g))return this;if(l!==this._dur)return this.render(s,n,o)}if(this._tTime=u,this._time=d,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=_=(v||this._ease)(d/l),this._from&&(this.ratio=_=1-_),d&&!a&&!n&&!m&&(Be(this,"onStart"),this._tTime!==u))return this;for(f=this._pt;f;)f.r(_,f.d),f=f._next;b&&b.render(s<0?s:b._dur*b._ease(d/this._dur),n,o)||this._startAt&&(this._zTime=s),this._onUpdate&&!n&&(c&&Cu(this,s,n,o),Be(this,"onUpdate")),this._repeat&&m!==g&&this.vars.onRepeat&&!n&&this.parent&&Be(this,"onRepeat"),(u===this._tDur||!u)&&this._tTime===u&&(c&&!this._onUpdate&&Cu(this,s,!0,!0),(s||!l)&&(u===this._tDur&&this._ts>0||!u&&this._ts<0)&&Lr(this,1),!n&&!(c&&!a)&&(u||a||y)&&(Be(this,u===h?"onComplete":"onReverseComplete",!0),this._prom&&!(u<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,o,a,h){uo||We.wake(),this._ts||this.play();var l=Math.min(this._dur,(this._dp._time-this._start)*this._ts),c;return this._initted||Nu(this,l),c=this._ease(l/this._dur),DC(this,s,n,o,a,c,l,h)?this.resetTo(s,n,o,a,1):(mh(this,0),this.parent||sg(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?lo(this):this;if(this.timeline){var o=this.timeline.totalDuration();return this.timeline.killTweensOf(s,n,Fr&&Fr.vars.overwrite!==!0)._first||lo(this),this.parent&&o!==this.timeline.totalDuration()&&an(this,this._dur*this.timeline._tDur/o,0,1),this}var a=this._targets,h=s?Qe(s):a,l=this._ptLookup,c=this._pt,u,d,f,m,p,g,y;if((!n||n==="all")&&fC(a,h))return n==="all"&&(this._pt=0),lo(this);for(u=this._op=this._op||[],n!=="all"&&(ne(n)&&(p={},Ee(n,function(_){return p[_]=1}),n=p),n=kC(a,n)),y=a.length;y--;)if(~h.indexOf(a[y])){d=l[y],n==="all"?(u[y]=n,m=d,f={}):(f=u[y]=u[y]||{},m=n);for(p in m)g=d&&d[p],g&&((!("kill"in g.d)||g.d.kill(p)===!0)&&dh(this,g,"_pt"),delete d[p]),f!=="all"&&(f[p]=1)}return this._initted&&!this._pt&&c&&lo(this),this},t.to=function(s,n){return new t(s,n,arguments[2])},t.from=function(s,n){return oo(1,arguments)},t.delayedCall=function(s,n,o,a){return new t(n,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:s,onComplete:n,onReverseComplete:n,onCompleteParams:o,onReverseCompleteParams:o,callbackScope:a})},t.fromTo=function(s,n,o){return oo(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,o){return Ut.killTweensOf(s,n,o)},t}(fo);Je(Jt.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),Ee("staggerTo,staggerFrom,staggerFromTo",function(r){Jt[r]=function(){var t=new Te,e=Iu.call(arguments,0);return e.splice(r==="staggerFromTo"?5:4,0,0),t[r].apply(t,e)}});var Du=function(t,e,i){return t[e]=i},Lg=function(t,e,i){return t[e](i)},BC=function(t,e,i,s){return t[e](s.fp,i)},WC=function(t,e,i){return t.setAttribute(e,i)},ku=function(t,e){return Ht(t[e])?Lg:fu(t[e])&&t.setAttribute?WC:Du},Pg=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e6)/1e6,e)},UC=function(t,e){return e.set(e.t,e.p,!!(e.s+e.c*t),e)},Gg=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)},Ou=function(t,e){for(var i=e._pt;i;)i.r(t,i.d),i=i._next},XC=function(t,e,i,s){for(var n=this._pt,o;n;)o=n._next,n.p===s&&n.modifier(t,e,i),n=o},ZC=function(t){for(var e=this._pt,i,s;e;)s=e._next,e.p===t&&!e.op||e.op===t?dh(this,e,"_pt"):e.dep||(i=1),e=s;return!i},VC=function(t,e,i,s){s.mSet(t,e,s.m.call(s.tween,i,s.mt),s)},Fg=function(t){for(var e=t._pt,i,s,n,o;e;){for(i=e._next,s=n;s&&s.pr>e.pr;)s=s._next;(e._prev=s?s._prev:o)?e._prev._next=e:n=e,(e._next=s)?s._prev=e:o=e,e=i}t._pt=n},Ie=function(){function r(e,i,s,n,o,a,h,l,c){this.t=i,this.s=n,this.c=o,this.p=s,this.r=a||Pg,this.d=h||this,this.set=l||Du,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=VC,this.m=i,this.mt=n,this.tween=s},r}();Ee(wu+"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 _u[r]=1}),ke.TweenMax=ke.TweenLite=Jt,ke.TimelineLite=ke.TimelineMax=Te,Ut=new Te({sortChildren:!1,defaults:rn,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),De.stringFilter=wg;var ps=[],gh={},HC=[],Ng=0,KC=0,Bu=function(t){return(gh[t]||HC).map(function(e){return e()})},Wu=function(){var t=Date.now(),e=[];t-Ng>2&&(Bu("matchMediaInit"),ps.forEach(function(i){var s=i.queries,n=i.conditions,o,a,h,l;for(a in s)o=Gi.matchMedia(s[a]).matches,o&&(h=1),o!==n[a]&&(n[a]=o,l=1);l&&(i.revert(),h&&e.push(i))}),Bu("matchMediaRevert"),e.forEach(function(i){return i.onMatch(i,function(s){return i.add(null,s)})}),Ng=t,Bu("matchMedia"))},Dg=function(){function r(e,i){this.selector=i&&Au(i),this.data=[],this._r=[],this.isReverted=!1,this.id=KC++,e&&this.add(e)}var t=r.prototype;return t.add=function(i,s,n){Ht(i)&&(n=s,s=i,i=Ht);var o=this,a=function(){var l=Dt,c=o.selector,u;return l&&l!==o&&l.data.push(o),n&&(o.selector=Au(n)),Dt=o,u=s.apply(o,arguments),Ht(u)&&o._r.push(u),Dt=l,o.selector=c,o.isReverted=!1,u};return o.last=a,i===Ht?a(o,function(h){return o.add(null,h)}):i?o[i]=a:a},t.ignore=function(i){var s=Dt;Dt=null,i(this),Dt=s},t.getTweens=function(){var i=[];return this.data.forEach(function(s){return s instanceof r?i.push.apply(i,s.getTweens()):s instanceof Jt&&!(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 a=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 a.splice(a.indexOf(c),1)}));for(a.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,u){return u.g-c.g||-1/0}).forEach(function(c){return c.t.revert(i)}),h=n.data.length;h--;)l=n.data[h],l instanceof Te?l.data!=="nested"&&(l.scrollTrigger&&l.scrollTrigger.revert(),l.kill()):!(l instanceof Jt)&&l.revert&&l.revert(i);n._r.forEach(function(c){return c(i,n)}),n.isReverted=!0}():this.data.forEach(function(a){return a.kill&&a.kill()}),this.clear(),s)for(var o=ps.length;o--;)ps[o].id===this.id&&ps.splice(o,1)},t.revert=function(i){this.kill(i||{})},r}(),YC=function(){function r(e){this.contexts=[],this.scope=e,Dt&&Dt.data.push(this)}var t=r.prototype;return t.add=function(i,s,n){Pi(i)||(i={matches:i});var o=new Dg(0,n||this.scope),a=o.conditions={},h,l,c;Dt&&!o.selector&&(o.selector=Dt.selector),this.contexts.push(o),s=o.add("onMatch",s),o.queries=i;for(l in i)l==="all"?c=1:(h=Gi.matchMedia(i[l]),h&&(ps.indexOf(o)<0&&ps.push(o),(a[l]=h.matches)&&(c=1),h.addListener?h.addListener(Wu):h.addEventListener("change",Wu)));return c&&s(o,function(u){return o.add(null,u)}),this},t.revert=function(i){this.kill(i||{})},t.kill=function(i){this.contexts.forEach(function(s){return s.kill(i,!0)})},r}(),yh={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 xg(s)})},timeline:function(t){return new Te(t)},getTweensOf:function(t,e){return Ut.getTweensOf(t,e)},getProperty:function(t,e,i,s){ne(t)&&(t=Qe(t)[0]);var n=ls(t||{}).get,o=i?ig:eg;return i==="native"&&(i=""),t&&(e?o((Oe[e]&&Oe[e].get||n)(t,e,i,s)):function(a,h,l){return o((Oe[a]&&Oe[a].get||n)(t,a,h,l))})},quickSetter:function(t,e,i){if(t=Qe(t),t.length>1){var s=t.map(function(c){return Ae.quickSetter(c,e,i)}),n=s.length;return function(c){for(var u=n;u--;)s[u](c)}}t=t[0]||{};var o=Oe[e],a=ls(t),h=a.harness&&(a.harness.aliases||{})[e]||e,l=o?function(c){var u=new o;hn._pt=0,u.init(t,i?c+i:c,hn,0,[t]),u.render(1,u),hn._pt&&Ou(1,hn)}:a.set(t,h);return o?l:function(c){return l(t,h,i?c+i:c,a,1)}},quickTo:function(t,e,i){var s,n=Ae.to(t,cs((s={},s[e]="+=0.1",s.paused=!0,s),i||{})),o=function(h,l,c){return n.resetTo(e,h,l,c)};return o.tween=n,o},isTweening:function(t){return Ut.getTweensOf(t,!0).length>0},defaults:function(t){return t&&t.ease&&(t.ease=ds(t.ease,rn.ease)),rg(rn,t||{})},config:function(t){return rg(De,t||{})},registerEffect:function(t){var e=t.name,i=t.effect,s=t.plugins,n=t.defaults,o=t.extendTimeline;(s||"").split(",").forEach(function(a){return a&&!Oe[a]&&!ke[a]&&ro(e+" effect requires "+a+" plugin.")}),Tu[e]=function(a,h,l){return i(Qe(a),Je(h||{},n),l)},o&&(Te.prototype[e]=function(a,h,l){return this.add(Tu[e](a,Pi(h)?h:(l=h)&&{},this),l)})},registerEase:function(t,e){St[t]=ds(e)},parseEase:function(t,e){return arguments.length?ds(t,e):St},getById:function(t){return Ut.getById(t)},exportRoot:function(t,e){t===void 0&&(t={});var i=new Te(t),s,n;for(i.smoothChildTiming=Ce(t.smoothChildTiming),Ut.remove(i),i._dp=0,i._time=i._tTime=Ut._time,s=Ut._first;s;)n=s._next,(e||!(!s._dur&&s instanceof Jt&&s.vars.onComplete===s._targets[0]))&&Fi(i,s,s._start-s._delay),s=n;return Fi(Ut,i,0),i},context:function(t,e){return t?new Dg(t,e):Dt},matchMedia:function(t){return new YC(t)},matchMediaRefresh:function(){return ps.forEach(function(t){var e=t.conditions,i,s;for(s in e)e[s]&&(e[s]=!1,i=1);i&&t.revert()})||Wu()},addEventListener:function(t,e){var i=gh[t]||(gh[t]=[]);~i.indexOf(e)||i.push(e)},removeEventListener:function(t,e){var i=gh[t],s=i&&i.indexOf(e);s>=0&&i.splice(s,1)},utils:{wrap:CC,wrapYoyo:EC,distribute:dg,random:pg,snap:fg,normalize:SC,getUnit:me,clamp:_C,splitColor:_g,toArray:Qe,selector:Au,mapRange:gg,pipe:TC,unitize:wC,interpolate:IC,shuffle:ug},install:j0,effects:Tu,ticker:We,updateRoot:Te.updateRoot,plugins:Oe,globalTimeline:Ut,core:{PropTween:Ie,globals:J0,Tween:Jt,Timeline:Te,Animation:fo,getCache:ls,_removeLinkedListItem:dh,reverting:function(){return fe},context:function(t){return t&&Dt&&(Dt.data.push(t),t._ctx=Dt),Dt},suppressOverwrites:function(t){return uu=t}}};Ee("to,from,fromTo,delayedCall,set,killTweensOf",function(r){return yh[r]=Jt[r]}),We.add(Te.updateRoot),hn=yh.to({},{duration:0});var zC=function(t,e){for(var i=t._pt;i&&i.p!==e&&i.op!==e&&i.fp!==e;)i=i._next;return i},jC=function(t,e){var i=t._targets,s,n,o;for(s in e)for(n=i.length;n--;)o=t._ptLookup[n][s],o&&(o=o.d)&&(o._pt&&(o=zC(o,s)),o&&o.modifier&&o.modifier(e[s],t,i[n],s))},Uu=function(t,e){return{name:t,rawVars:1,init:function(s,n,o){o._onInit=function(a){var h,l;if(ne(n)&&(h={},Ee(n,function(c){return h[c]=1}),n=h),e){h={};for(l in n)h[l]=e(n[l]);n=h}jC(a,n)}}}},Ae=yh.registerPlugin({name:"attr",init:function(t,e,i,s,n){var o,a,h;this.tween=i;for(o in e)h=t.getAttribute(o)||"",a=this.add(t,"setAttribute",(h||0)+"",e[o],s,n,0,0,o),a.op=o,a.b=h,this._props.push(o)},render:function(t,e){for(var i=e._pt;i;)fe?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)}},Uu("roundProps",Ru),Uu("modifiers"),Uu("snap",fg))||yh;Jt.version=Te.version=Ae.version="3.12.5",z0=1,pu()&&ln(),St.Power0,St.Power1,St.Power2,St.Power3,St.Power4,St.Linear,St.Quad,St.Cubic,St.Quart,St.Quint,St.Strong,St.Elastic,St.Back,St.SteppedEase,St.Bounce,St.Sine,St.Expo,St.Circ;/*!
|
|
1167
|
+
*/var De={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},rn={duration:.5,overwrite:!1,delay:0},uu,pe,kt,je=1e8,Gt=1/je,du=Math.PI*2,nE=du/4,oE=0,Z0=Math.sqrt,aE=Math.cos,hE=Math.sin,ne=function(t){return typeof t=="string"},Ht=function(t){return typeof t=="function"},sr=function(t){return typeof t=="number"},fu=function(t){return typeof t>"u"},Pi=function(t){return typeof t=="object"},Ee=function(t){return t!==!1},pu=function(){return typeof window<"u"},oh=function(t){return Ht(t)||ne(t)},V0=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},me=Array.isArray,mu=/(?:-?\.?\d|\.)+/gi,H0=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,sn=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,gu=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,K0=/[+-]=-?[.\d]+/,Y0=/[^,'"\[\]\s]+/gi,lE=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,Xt,Gi,yu,bu,ke={},ah={},z0,j0=function(t){return(ah=cs(t,ke))&&Ae},xu=function(t,e){return console.warn("Invalid property",t,"set to",e,"Missing plugin? gsap.registerPlugin()")},no=function(t,e){return!e&&console.warn(t)},J0=function(t,e){return t&&(ke[t]=e)&&ah&&(ah[t]=e)||ke},oo=function(){return 0},cE={suppressEvents:!0,isStart:!0,kill:!1},hh={suppressEvents:!0,kill:!1},uE={suppressEvents:!0},_u={},Mr=[],vu={},$0,Oe={},Tu={},Q0=30,lh=[],wu="",Su=function(t){var e=t[0],i,s;if(Pi(e)||Ht(e)||(t=[t]),!(i=(e._gsap||{}).harness)){for(s=lh.length;s--&&!lh[s].targetTest(e););i=lh[s]}for(s=t.length;s--;)t[s]&&(t[s]._gsap||(t[s]._gsap=new Ig(t[s],i)))||t.splice(s,1);return t},ls=function(t){return t._gsap||Su(Qe(t))[0]._gsap},q0=function(t,e,i){return(i=t[e])&&Ht(i)?t[e]():fu(i)&&t.getAttribute&&t.getAttribute(e)||i},Ce=function(t,e){return(t=t.split(",")).forEach(e)||t},zt=function(t){return Math.round(t*1e5)/1e5||0},oe=function(t){return Math.round(t*1e7)/1e7||0},nn=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},dE=function(t,e){for(var i=e.length,s=0;t.indexOf(e[s])<0&&++s<i;);return s<i},ch=function(){var t=Mr.length,e=Mr.slice(0),i,s;for(vu={},Mr.length=0,i=0;i<t;i++)s=e[i],s&&s._lazy&&(s.render(s._lazy[0],s._lazy[1],!0)._lazy=0)},tg=function(t,e,i,s){Mr.length&&!pe&&ch(),t.render(e,i,s||pe&&e<0&&(t._initted||t._startAt)),Mr.length&&!pe&&ch()},eg=function(t){var e=parseFloat(t);return(e||e===0)&&(t+"").match(Y0).length<2?e:ne(t)?t.trim():t},ig=function(t){return t},Je=function(t,e){for(var i in e)i in t||(t[i]=e[i]);return t},fE=function(t){return function(e,i){for(var s in i)s in e||s==="duration"&&t||s==="ease"||(e[s]=i[s])}},cs=function(t,e){for(var i in e)t[i]=e[i];return t},rg=function r(t,e){for(var i in e)i!=="__proto__"&&i!=="constructor"&&i!=="prototype"&&(t[i]=Pi(e[i])?r(t[i]||(t[i]={}),e[i]):e[i]);return t},uh=function(t,e){var i={},s;for(s in t)s in e||(i[s]=t[s]);return i},ao=function(t){var e=t.parent||Xt,i=t.keyframes?fE(me(t.keyframes)):Je;if(Ee(t.inherit))for(;e;)i(t,e.vars.defaults),e=e.parent||e._dp;return t},pE=function(t,e){for(var i=t.length,s=i===e.length;s&&i--&&t[i]===e[i];);return i<0},sg=function(t,e,i,s,n){i===void 0&&(i="_first"),s===void 0&&(s="_last");var o=t[s],a;if(n)for(a=e[n];o&&o[n]>a;)o=o._prev;return o?(e._next=o._next,o._next=e):(e._next=t[i],t[i]=e),e._next?e._next._prev=e:t[s]=e,e._prev=o,e.parent=e._dp=t,e},dh=function(t,e,i,s){i===void 0&&(i="_first"),s===void 0&&(s="_last");var n=e._prev,o=e._next;n?n._next=o:t[i]===e&&(t[i]=o),o?o._prev=n:t[s]===e&&(t[s]=n),e._next=e._prev=e.parent=null},Lr=function(t,e){t.parent&&(!e||t.parent.autoRemoveChildren)&&t.parent.remove&&t.parent.remove(t),t._act=0},us=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},mE=function(t){for(var e=t.parent;e&&e.parent;)e._dirty=1,e.totalDuration(),e=e.parent;return t},Eu=function(t,e,i,s){return t._startAt&&(pe?t._startAt.revert(hh):t.vars.immediateRender&&!t.vars.autoRevert||t._startAt.render(e,!0,s))},gE=function r(t){return!t||t._ts&&r(t.parent)},ng=function(t){return t._repeat?on(t._tTime,t=t.duration()+t._rDelay)*t:0},on=function(t,e){var i=Math.floor(t/=e);return t&&i===t?i-1:i},fh=function(t,e){return(t-e._start)*e._ts+(e._ts>=0?0:e._dirty?e.totalDuration():e._tDur)},ph=function(t){return t._end=oe(t._start+(t._tDur/Math.abs(t._ts||t._rts||Gt)||0))},mh=function(t,e){var i=t._dp;return i&&i.smoothChildTiming&&t._ts&&(t._start=oe(i._time-(t._ts>0?e/t._ts:((t._dirty?t.totalDuration():t._tDur)-e)/-t._ts)),ph(t),i._dirty||us(i,t)),t},og=function(t,e){var i;if((e._time||!e._dur&&e._initted||e._start<t._time&&(e._dur||!e.add))&&(i=fh(t.rawTime(),e),(!e._dur||lo(0,e.totalDuration(),i)-e._tTime>Gt)&&e.render(i,!0)),us(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}},Fi=function(t,e,i,s){return e.parent&&Lr(e),e._start=oe((sr(i)?i:i||t!==Xt?$e(t,i,e):t._time)+e._delay),e._end=oe(e._start+(e.totalDuration()/Math.abs(e.timeScale())||0)),sg(t,e,"_first","_last",t._sort?"_start":0),Cu(e)||(t._recent=e),s||og(t,e),t._ts<0&&mh(t,t._tTime),t},ag=function(t,e){return(ke.ScrollTrigger||xu("scrollTrigger",e))&&ke.ScrollTrigger.create(e,t)},hg=function(t,e,i,s,n){if(Nu(t,e,n),!t._initted)return 1;if(!i&&t._pt&&!pe&&(t._dur&&t.vars.lazy!==!1||!t._dur&&t.vars.lazy)&&$0!==We.frame)return Mr.push(t),t._lazy=[n,s],1},yE=function r(t){var e=t.parent;return e&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||r(e))},Cu=function(t){var e=t.data;return e==="isFromStart"||e==="isStart"},bE=function(t,e,i,s){var n=t.ratio,o=e<0||!e&&(!t._start&&yE(t)&&!(!t._initted&&Cu(t))||(t._ts<0||t._dp._ts<0)&&!Cu(t))?0:1,a=t._rDelay,h=0,l,c,u;if(a&&t._repeat&&(h=lo(0,t._tDur,e),c=on(h,a),t._yoyo&&c&1&&(o=1-o),c!==on(t._tTime,a)&&(n=1-o,t.vars.repeatRefresh&&t._initted&&t.invalidate())),o!==n||pe||s||t._zTime===Gt||!e&&t._zTime){if(!t._initted&&hg(t,e,s,i,h))return;for(u=t._zTime,t._zTime=e||(i?Gt:0),i||(i=e&&!u),t.ratio=o,t._from&&(o=1-o),t._time=0,t._tTime=h,l=t._pt;l;)l.r(o,l.d),l=l._next;e<0&&Eu(t,e,i,!0),t._onUpdate&&!i&&Be(t,"onUpdate"),h&&t._repeat&&!i&&t.parent&&Be(t,"onRepeat"),(e>=t._tDur||e<0)&&t.ratio===o&&(o&&Lr(t,1),!i&&!pe&&(Be(t,o?"onComplete":"onReverseComplete",!0),t._prom&&t._prom()))}else t._zTime||(t._zTime=e)},xE=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}},an=function(t,e,i,s){var n=t._repeat,o=oe(e)||0,a=t._tTime/t._tDur;return a&&!s&&(t._time*=o/t._dur),t._dur=o,t._tDur=n?n<0?1e10:oe(o*(n+1)+t._rDelay*n):o,a>0&&!s&&mh(t,t._tTime=t._tDur*a),t.parent&&ph(t),i||us(t.parent,t),t},lg=function(t){return t instanceof Te?us(t):an(t,t._dur)},_E={_start:0,endTime:oo,totalDuration:oo},$e=function r(t,e,i){var s=t.labels,n=t._recent||_E,o=t.duration()>=je?n.endTime(!1):t._dur,a,h,l;return ne(e)&&(isNaN(e)||e in s)?(h=e.charAt(0),l=e.substr(-1)==="%",a=e.indexOf("="),h==="<"||h===">"?(a>=0&&(e=e.replace(/=/,"")),(h==="<"?n._start:n.endTime(n._repeat>=0))+(parseFloat(e.substr(1))||0)*(l?(a<0?n:i).totalDuration()/100:1)):a<0?(e in s||(s[e]=o),s[e]):(h=parseFloat(e.charAt(a-1)+e.substr(a+1)),l&&i&&(h=h/100*(me(i)?i[0]:i).totalDuration()),a>1?r(t,e.substr(0,a-1),i)+h:o+h)):e==null?o:+e},ho=function(t,e,i){var s=sr(e[1]),n=(s?2:1)+(t<2?0:1),o=e[n],a,h;if(s&&(o.duration=e[1]),o.parent=i,t){for(a=o,h=i;h&&!("immediateRender"in a);)a=h.vars.defaults||{},h=Ee(h.vars.inherit)&&h.parent;o.immediateRender=Ee(a.immediateRender),t<2?o.runBackwards=1:o.startAt=e[n-1]}return new Jt(e[0],o,e[n+1])},Pr=function(t,e){return t||t===0?e(t):e},lo=function(t,e,i){return i<t?t:i>e?e:i},ge=function(t,e){return!ne(t)||!(e=lE.exec(t))?"":e[1]},vE=function(t,e,i){return Pr(i,function(s){return lo(t,e,s)})},Iu=[].slice,cg=function(t,e){return t&&Pi(t)&&"length"in t&&(!e&&!t.length||t.length-1 in t&&Pi(t[0]))&&!t.nodeType&&t!==Gi},TE=function(t,e,i){return i===void 0&&(i=[]),t.forEach(function(s){var n;return ne(s)&&!e||cg(s,1)?(n=i).push.apply(n,Qe(s)):i.push(s)})||i},Qe=function(t,e,i){return kt&&!e&&kt.selector?kt.selector(t):ne(t)&&!i&&(yu||!ln())?Iu.call((e||bu).querySelectorAll(t),0):me(t)?TE(t,i):cg(t)?Iu.call(t,0):t?[t]:[]},Au=function(t){return t=Qe(t)[0]||no("Invalid scope")||{},function(e){var i=t.current||t.nativeElement||t;return Qe(e,i.querySelectorAll?i:i===t?no("Invalid scope")||bu.createElement("div"):t)}},ug=function(t){return t.sort(function(){return .5-Math.random()})},dg=function(t){if(Ht(t))return t;var e=Pi(t)?t:{each:t},i=ds(e.ease),s=e.from||0,n=parseFloat(e.base)||0,o={},a=s>0&&s<1,h=isNaN(s)||a,l=e.axis,c=s,u=s;return ne(s)?c=u={center:.5,edges:.5,end:1}[s]||0:!a&&h&&(c=s[0],u=s[1]),function(d,f,m){var p=(m||e).length,g=o[p],y,_,b,v,w,E,C,A,R;if(!g){if(R=e.grid==="auto"?0:(e.grid||[1,je])[1],!R){for(C=-je;C<(C=m[R++].getBoundingClientRect().left)&&R<p;);R<p&&R--}for(g=o[p]=[],y=h?Math.min(R,p)*c-.5:s%R,_=R===je?0:h?p*u/R-.5:s/R|0,C=0,A=je,E=0;E<p;E++)b=E%R-y,v=_-(E/R|0),g[E]=w=l?Math.abs(l==="y"?v:b):Z0(b*b+v*v),w>C&&(C=w),w<A&&(A=w);s==="random"&&ug(g),g.max=C-A,g.min=A,g.v=p=(parseFloat(e.amount)||parseFloat(e.each)*(R>p?p-1:l?l==="y"?p/R:R:Math.max(R,p/R))||0)*(s==="edges"?-1:1),g.b=p<0?n-p:n,g.u=ge(e.amount||e.each)||0,i=i&&p<0?Sg(i):i}return p=(g[d]-g.min)/g.max||0,oe(g.b+(i?i(p):p)*g.v)+g.u}},Ru=function(t){var e=Math.pow(10,((t+"").split(".")[1]||"").length);return function(i){var s=oe(Math.round(parseFloat(i)/t)*t*e);return(s-s%1)/e+(sr(i)?0:ge(i))}},fg=function(t,e){var i=me(t),s,n;return!i&&Pi(t)&&(s=i=t.radius||je,t.values?(t=Qe(t.values),(n=!sr(t[0]))&&(s*=s)):t=Ru(t.increment)),Pr(e,i?Ht(t)?function(o){return n=t(o),Math.abs(n-o)<=s?n:o}:function(o){for(var a=parseFloat(n?o.x:o),h=parseFloat(n?o.y:0),l=je,c=0,u=t.length,d,f;u--;)n?(d=t[u].x-a,f=t[u].y-h,d=d*d+f*f):d=Math.abs(t[u]-a),d<l&&(l=d,c=u);return c=!s||l<=s?t[c]:o,n||c===o||sr(o)?c:c+ge(o)}:Ru(t))},pg=function(t,e,i,s){return Pr(me(t)?!e:i===!0?!!(i=0):!s,function(){return me(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})},wE=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,o){return o(n)},s)}},SE=function(t,e){return function(i){return t(parseFloat(i))+(e||ge(i))}},EE=function(t,e,i){return gg(t,e,0,1,i)},mg=function(t,e,i){return Pr(i,function(s){return t[~~e(s)]})},CE=function r(t,e,i){var s=e-t;return me(t)?mg(t,r(0,t.length),e):Pr(i,function(n){return(s+(n-t)%s)%s+t})},IE=function r(t,e,i){var s=e-t,n=s*2;return me(t)?mg(t,r(0,t.length-1),e):Pr(i,function(o){return o=(n+(o-t)%n)%n||0,t+(o>s?n-o:o)})},co=function(t){for(var e=0,i="",s,n,o,a;~(s=t.indexOf("random(",e));)o=t.indexOf(")",s),a=t.charAt(s+7)==="[",n=t.substr(s+7,o-s-7).match(a?Y0:mu),i+=t.substr(e,s-e)+pg(a?n:+n[0],a?0:+n[1],+n[2]||1e-5),e=o+1;return i+t.substr(e,t.length-e)},gg=function(t,e,i,s,n){var o=e-t,a=s-i;return Pr(n,function(h){return i+((h-t)/o*a||0)})},AE=function r(t,e,i,s){var n=isNaN(t+e)?0:function(f){return(1-f)*t+f*e};if(!n){var o=ne(t),a={},h,l,c,u,d;if(i===!0&&(s=1)&&(i=null),o)t={p:t},e={p:e};else if(me(t)&&!me(e)){for(c=[],u=t.length,d=u-2,l=1;l<u;l++)c.push(r(t[l-1],t[l]));u--,n=function(m){m*=u;var p=Math.min(d,~~m);return c[p](m-p)},i=e}else s||(t=cs(me(t)?[]:{},t));if(!c){for(h in e)Gu.call(a,t,h,"get",e[h]);n=function(m){return Ou(m,a)||(o?t.p:t)}}}return Pr(i,n)},yg=function(t,e,i){var s=t.labels,n=je,o,a,h;for(o in s)a=s[o]-e,a<0==!!i&&a&&n>(a=Math.abs(a))&&(h=o,n=a);return h},Be=function(t,e,i){var s=t.vars,n=s[e],o=kt,a=t._ctx,h,l,c;if(n)return h=s[e+"Params"],l=s.callbackScope||t,i&&Mr.length&&ch(),a&&(kt=a),c=h?n.apply(l,h):n.call(l),kt=o,c},uo=function(t){return Lr(t),t.scrollTrigger&&t.scrollTrigger.kill(!!pe),t.progress()<1&&Be(t,"onInterrupt"),t},hn,bg=[],xg=function(t){if(t)if(t=!t.name&&t.default||t,pu()||t.headless){var e=t.name,i=Ht(t),s=e&&!i&&t.init?function(){this._props=[]}:t,n={init:oo,render:Ou,add:Gu,kill:VE,modifier:ZE,rawVars:0},o={targetTest:0,get:0,getSetter:ku,aliases:{},register:0};if(ln(),t!==s){if(Oe[e])return;Je(s,Je(uh(t,n),o)),cs(s.prototype,cs(n,uh(t,o))),Oe[s.prop=e]=s,t.targetTest&&(lh.push(s),_u[e]=1),e=(e==="css"?"CSS":e.charAt(0).toUpperCase()+e.substr(1))+"Plugin"}J0(e,s),t.register&&t.register(Ae,s,Ie)}else bg.push(t)},Pt=255,fo={aqua:[0,Pt,Pt],lime:[0,Pt,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,Pt],navy:[0,0,128],white:[Pt,Pt,Pt],olive:[128,128,0],yellow:[Pt,Pt,0],orange:[Pt,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[Pt,0,0],pink:[Pt,192,203],cyan:[0,Pt,Pt],transparent:[Pt,Pt,Pt,0]},Mu=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)*Pt+.5|0},_g=function(t,e,i){var s=t?sr(t)?[t>>16,t>>8&Pt,t&Pt]:0:fo.black,n,o,a,h,l,c,u,d,f,m;if(!s){if(t.substr(-1)===","&&(t=t.substr(0,t.length-1)),fo[t])s=fo[t];else if(t.charAt(0)==="#"){if(t.length<6&&(n=t.charAt(1),o=t.charAt(2),a=t.charAt(3),t="#"+n+n+o+o+a+a+(t.length===5?t.charAt(4)+t.charAt(4):"")),t.length===9)return s=parseInt(t.substr(1,6),16),[s>>16,s>>8&Pt,s&Pt,parseInt(t.substr(7),16)/255];t=parseInt(t.substr(1),16),s=[t>>16,t>>8&Pt,t&Pt]}else if(t.substr(0,3)==="hsl"){if(s=m=t.match(mu),!e)h=+s[0]%360/360,l=+s[1]/100,c=+s[2]/100,o=c<=.5?c*(l+1):c+l-c*l,n=c*2-o,s.length>3&&(s[3]*=1),s[0]=Mu(h+1/3,n,o),s[1]=Mu(h,n,o),s[2]=Mu(h-1/3,n,o);else if(~t.indexOf("="))return s=t.match(H0),i&&s.length<4&&(s[3]=1),s}else s=t.match(mu)||fo.transparent;s=s.map(Number)}return e&&!m&&(n=s[0]/Pt,o=s[1]/Pt,a=s[2]/Pt,u=Math.max(n,o,a),d=Math.min(n,o,a),c=(u+d)/2,u===d?h=l=0:(f=u-d,l=c>.5?f/(2-u-d):f/(u+d),h=u===n?(o-a)/f+(o<a?6:0):u===o?(a-n)/f+2:(n-o)/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},vg=function(t){var e=[],i=[],s=-1;return t.split(Gr).forEach(function(n){var o=n.match(sn)||[];e.push.apply(e,o),i.push(s+=o.length+1)}),e.c=i,e},Tg=function(t,e,i){var s="",n=(t+s).match(Gr),o=e?"hsla(":"rgba(",a=0,h,l,c,u;if(!n)return t;if(n=n.map(function(d){return(d=_g(d,e,1))&&o+(e?d[0]+","+d[1]+"%,"+d[2]+"%,"+d[3]:d.join(","))+")"}),i&&(c=vg(t),h=i.c,h.join(s)!==c.c.join(s)))for(l=t.replace(Gr,"1").split(sn),u=l.length-1;a<u;a++)s+=l[a]+(~h.indexOf(a)?n.shift()||o+"0,0,0,0)":(c.length?c:n.length?n:i).shift());if(!l)for(l=t.split(Gr),u=l.length-1;a<u;a++)s+=l[a]+n[a];return s+l[u]},Gr=function(){var r="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b",t;for(t in fo)r+="|"+t+"\\b";return new RegExp(r+")","gi")}(),RE=/hsl[a]?\(/,wg=function(t){var e=t.join(" "),i;if(Gr.lastIndex=0,Gr.test(e))return i=RE.test(e),t[1]=Tg(t[1],i),t[0]=Tg(t[0],i,vg(t[1])),!0},po,We=function(){var r=Date.now,t=500,e=33,i=r(),s=i,n=1e3/240,o=n,a=[],h,l,c,u,d,f,m=function p(g){var y=r()-s,_=g===!0,b,v,w,E;if((y>t||y<0)&&(i+=y-e),s+=y,w=s-i,b=w-o,(b>0||_)&&(E=++u.frame,d=w-u.time*1e3,u.time=w=w/1e3,o+=b+(b>=n?4:n-b),v=1),_||(h=l(p)),v)for(f=0;f<a.length;f++)a[f](w,d,E,g)};return u={time:0,frame:0,tick:function(){m(!0)},deltaRatio:function(g){return d/(1e3/(g||60))},wake:function(){z0&&(!yu&&pu()&&(Gi=yu=window,bu=Gi.document||{},ke.gsap=Ae,(Gi.gsapVersions||(Gi.gsapVersions=[])).push(Ae.version),j0(ah||Gi.GreenSockGlobals||!Gi.gsap&&Gi||{}),bg.forEach(xg)),c=typeof requestAnimationFrame<"u"&&requestAnimationFrame,h&&u.sleep(),l=c||function(g){return setTimeout(g,o-u.time*1e3+1|0)},po=1,m(2))},sleep:function(){(c?cancelAnimationFrame:clearTimeout)(h),po=0,l=oo},lagSmoothing:function(g,y){t=g||1/0,e=Math.min(y||33,t)},fps:function(g){n=1e3/(g||240),o=u.time*1e3+n},add:function(g,y,_){var b=y?function(v,w,E,C){g(v,w,E,C),u.remove(b)}:g;return u.remove(g),a[_?"unshift":"push"](b),ln(),b},remove:function(g,y){~(y=a.indexOf(g))&&a.splice(y,1)&&f>=y&&f--},_listeners:a},u}(),ln=function(){return!po&&We.wake()},St={},ME=/^[\d.\-M][\d.\-,\s]/,LE=/["']/g,PE=function(t){for(var e={},i=t.substr(1,t.length-3).split(":"),s=i[0],n=1,o=i.length,a,h,l;n<o;n++)h=i[n],a=n!==o-1?h.lastIndexOf(","):h.length,l=h.substr(0,a),e[s]=isNaN(l)?l.replace(LE,"").trim():+l,s=h.substr(a+1).trim();return e},GE=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)},FE=function(t){var e=(t+"").split("("),i=St[e[0]];return i&&e.length>1&&i.config?i.config.apply(null,~t.indexOf("{")?[PE(e[1])]:GE(t).split(",").map(eg)):St._CE&&ME.test(t)?St._CE("",t):i},Sg=function(t){return function(e){return 1-t(1-e)}},Eg=function r(t,e){for(var i=t._first,s;i;)i instanceof Te?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},ds=function(t,e){return t&&(Ht(t)?t:St[t]||FE(t))||e},fs=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},o;return Ce(t,function(a){St[a]=ke[a]=n,St[o=a.toLowerCase()]=i;for(var h in n)St[o+(h==="easeIn"?".in":h==="easeOut"?".out":".inOut")]=St[a+"."+h]=n[h]}),n},Cg=function(t){return function(e){return e<.5?(1-t(1-e*2))/2:.5+t((e-.5)*2)/2}},Lu=function r(t,e,i){var s=e>=1?e:1,n=(i||(t?.3:.45))/(e<1?e:1),o=n/du*(Math.asin(1/s)||0),a=function(c){return c===1?1:s*Math.pow(2,-10*c)*hE((c-o)*n)+1},h=t==="out"?a:t==="in"?function(l){return 1-a(1-l)}:Cg(a);return n=du/n,h.config=function(l,c){return r(t,l,c)},h},Pu=function r(t,e){e===void 0&&(e=1.70158);var i=function(o){return o?--o*o*((e+1)*o+e)+1:0},s=t==="out"?i:t==="in"?function(n){return 1-i(1-n)}:Cg(i);return s.config=function(n){return r(t,n)},s};Ce("Linear,Quad,Cubic,Quart,Quint,Strong",function(r,t){var e=t<5?t+1:t;fs(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})}),St.Linear.easeNone=St.none=St.Linear.easeIn,fs("Elastic",Lu("in"),Lu("out"),Lu()),function(r,t){var e=1/t,i=2*e,s=2.5*e,n=function(a){return a<e?r*a*a:a<i?r*Math.pow(a-1.5/t,2)+.75:a<s?r*(a-=2.25/t)*a+.9375:r*Math.pow(a-2.625/t,2)+.984375};fs("Bounce",function(o){return 1-n(1-o)},n)}(7.5625,2.75),fs("Expo",function(r){return r?Math.pow(2,10*(r-1)):0}),fs("Circ",function(r){return-(Z0(1-r*r)-1)}),fs("Sine",function(r){return r===1?1:-aE(r*nE)+1}),fs("Back",Pu("in"),Pu("out"),Pu()),St.SteppedEase=St.steps=ke.SteppedEase={config:function(t,e){t===void 0&&(t=1);var i=1/t,s=t+(e?0:1),n=e?1:0,o=1-Gt;return function(a){return((s*lo(0,o,a)|0)+n)*i}}},rn.ease=St["quad.out"],Ce("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",function(r){return wu+=r+","+r+"Params,"});var Ig=function(t,e){this.id=oE++,t._gsap=this,this.target=t,this.harness=e,this.get=e?e.get:q0,this.set=e?e.getSetter:ku},mo=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,an(this,+e.duration,1,1),this.data=e.data,kt&&(this._ctx=kt,kt.data.push(this)),po||We.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,an(this,this._repeat<0?i:(i-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},t.totalTime=function(i,s){if(ln(),!arguments.length)return this._tTime;var n=this._dp;if(n&&n.smoothChildTiming&&this._ts){for(mh(this,i),!n._dp||n.parent||og(n,this);n&&n.parent;)n.parent._time!==n._start+(n._ts>=0?n._tTime/n._ts:(n.totalDuration()-n._tTime)/-n._ts)&&n.totalTime(n._tTime,!0),n=n.parent;!this.parent&&this._dp.autoRemoveChildren&&(this._ts>0&&i<this._tDur||this._ts<0&&i>0||!this._tDur&&!i)&&Fi(this._dp,this,this._start-this._delay)}return(this._tTime!==i||!this._dur&&!s||this._initted&&Math.abs(this._zTime)===Gt||!i&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=i),tg(this,i,s)),this},t.time=function(i,s){return arguments.length?this.totalTime(Math.min(this.totalDuration(),i+ng(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)+ng(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?on(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?fh(this.parent._time,this):this._tTime;return this._rts=+i||0,this._ts=this._ps||i===-Gt?0:this._rts,this.totalTime(lo(-Math.abs(this._delay),this._tDur,n),s!==!1),ph(this),mE(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):(ln(),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)&&Fi(s,this,i-this._delay),this}return this._start},t.endTime=function(i){return this._start+(Ee(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?fh(s.rawTime(i),this):this._tTime:this._tTime},t.revert=function(i){i===void 0&&(i=uE);var s=pe;return pe=i,(this._initted||this._startAt)&&(this.timeline&&this.timeline.revert(i),this.totalTime(-.01,i.suppressEvents)),this.data!=="nested"&&i.kill!==!1&&this.kill(),pe=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,lg(this)):this._repeat===-2?1/0:this._repeat},t.repeatDelay=function(i){if(arguments.length){var s=this._time;return this._rDelay=i,lg(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($e(this,i),Ee(s))},t.restart=function(i,s){return this.play().totalTime(i?-this._delay:0,Ee(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 o=this.vars;return arguments.length>1?(s?(o[i]=s,n&&(o[i+"Params"]=n),i==="onUpdate"&&(this._onUpdate=s)):delete o[i],this):o[i]},t.then=function(i){var s=this;return new Promise(function(n){var o=Ht(i)?i:ig,a=function(){var l=s.then;s.then=null,Ht(o)&&(o=o(s))&&(o.then||o===s)&&(s.then=l),n(o),s.then=l};s._initted&&s.totalProgress()===1&&s._ts>=0||!s._tTime&&s._ts<0?a():s._prom=a})},t.kill=function(){uo(this)},r}();Je(mo.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 Te=function(r){X0(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=Ee(i.sortChildren),Xt&&Fi(i.parent||Xt,rr(n),s),i.reversed&&n.reverse(),i.paused&&n.paused(!0),i.scrollTrigger&&ag(rr(n),i.scrollTrigger),n}var e=t.prototype;return e.to=function(s,n,o){return ho(0,arguments,this),this},e.from=function(s,n,o){return ho(1,arguments,this),this},e.fromTo=function(s,n,o,a){return ho(2,arguments,this),this},e.set=function(s,n,o){return n.duration=0,n.parent=this,ao(n).repeatDelay||(n.repeat=0),n.immediateRender=!!n.immediateRender,new Jt(s,n,$e(this,o),1),this},e.call=function(s,n,o){return Fi(this,Jt.delayedCall(0,s,n),o)},e.staggerTo=function(s,n,o,a,h,l,c){return o.duration=n,o.stagger=o.stagger||a,o.onComplete=l,o.onCompleteParams=c,o.parent=this,new Jt(s,o,$e(this,h)),this},e.staggerFrom=function(s,n,o,a,h,l,c){return o.runBackwards=1,ao(o).immediateRender=Ee(o.immediateRender),this.staggerTo(s,n,o,a,h,l,c)},e.staggerFromTo=function(s,n,o,a,h,l,c,u){return a.startAt=o,ao(a).immediateRender=Ee(a.immediateRender),this.staggerTo(s,n,a,h,l,c,u)},e.render=function(s,n,o){var a=this._time,h=this._dirty?this.totalDuration():this._tDur,l=this._dur,c=s<=0?0:oe(s),u=this._zTime<0!=s<0&&(this._initted||!l),d,f,m,p,g,y,_,b,v,w,E,C;if(this!==Xt&&c>h&&s>=0&&(c=h),c!==this._tTime||o||u){if(a!==this._time&&l&&(c+=this._time-a,s+=this._time-a),d=c,v=this._start,b=this._ts,y=!b,u&&(l||(a=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,o);if(d=oe(c%g),c===h?(p=this._repeat,d=l):(p=~~(c/g),p&&p===c/g&&(d=l,p--),d>l&&(d=l)),w=on(this._tTime,g),!a&&this._tTime&&w!==p&&this._tTime-w*g-this._dur<=0&&(w=p),E&&p&1&&(d=l-d,C=1),p!==w&&!this._lock){var A=E&&w&1,R=A===(E&&p&1);if(p<w&&(A=!A),a=A?0:c%l?l:c,this._lock=1,this.render(a||(C?0:oe(p*g)),n,!l)._lock=0,this._tTime=c,!n&&this.parent&&Be(this,"onRepeat"),this.vars.repeatRefresh&&!C&&(this.invalidate()._lock=1),a&&a!==this._time||y!==!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(l=this._dur,h=this._tDur,R&&(this._lock=2,a=A?l:-1e-4,this.render(a,!0),this.vars.repeatRefresh&&!C&&this.invalidate()),this._lock=0,!this._ts&&!y)return this;Eg(this,C)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(_=xE(this,oe(a),oe(d)),_&&(c-=d-(d=_._start))),this._tTime=c,this._time=d,this._act=!b,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=s,a=0),!a&&d&&!n&&!p&&(Be(this,"onStart"),this._tTime!==c))return this;if(d>=a&&s>=0)for(f=this._first;f;){if(m=f._next,(f._act||d>=f._start)&&f._ts&&_!==f){if(f.parent!==this)return this.render(s,n,o);if(f.render(f._ts>0?(d-f._start)*f._ts:(f._dirty?f.totalDuration():f._tDur)+(d-f._start)*f._ts,n,o),d!==this._time||!this._ts&&!y){_=0,m&&(c+=this._zTime=-Gt);break}}f=m}else{f=this._last;for(var G=s<0?s:d;f;){if(m=f._prev,(f._act||G<=f._end)&&f._ts&&_!==f){if(f.parent!==this)return this.render(s,n,o);if(f.render(f._ts>0?(G-f._start)*f._ts:(f._dirty?f.totalDuration():f._tDur)+(G-f._start)*f._ts,n,o||pe&&(f._initted||f._startAt)),d!==this._time||!this._ts&&!y){_=0,m&&(c+=this._zTime=G?-Gt:Gt);break}}f=m}}if(_&&!n&&(this.pause(),_.render(d>=a?0:-Gt)._zTime=d>=a?1:-1,this._ts))return this._start=v,ph(this),this.render(s,n,o);this._onUpdate&&!n&&Be(this,"onUpdate",!0),(c===h&&this._tTime>=this.totalDuration()||!c&&a)&&(v===this._start||Math.abs(b)!==Math.abs(this._ts))&&(this._lock||((s||!l)&&(c===h&&this._ts>0||!c&&this._ts<0)&&Lr(this,1),!n&&!(s<0&&!a)&&(c||a||!h)&&(Be(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 o=this;if(sr(n)||(n=$e(this,n,s)),!(s instanceof mo)){if(me(s))return s.forEach(function(a){return o.add(a,n)}),this;if(ne(s))return this.addLabel(s,n);if(Ht(s))s=Jt.delayedCall(0,s);else return this}return this!==s?Fi(this,s,n):this},e.getChildren=function(s,n,o,a){s===void 0&&(s=!0),n===void 0&&(n=!0),o===void 0&&(o=!0),a===void 0&&(a=-je);for(var h=[],l=this._first;l;)l._start>=a&&(l instanceof Jt?n&&h.push(l):(o&&h.push(l),s&&h.push.apply(h,l.getChildren(!0,n,o)))),l=l._next;return h},e.getById=function(s){for(var n=this.getChildren(1,1,1),o=n.length;o--;)if(n[o].vars.id===s)return n[o]},e.remove=function(s){return ne(s)?this.removeLabel(s):Ht(s)?this.killTweensOf(s):(dh(this,s),s===this._recent&&(this._recent=this._last),us(this))},e.totalTime=function(s,n){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=oe(We.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]=$e(this,n),this},e.removeLabel=function(s){return delete this.labels[s],this},e.addPause=function(s,n,o){var a=Jt.delayedCall(0,n||oo,o);return a.data="isPause",this._hasPause=1,Fi(this,a,$e(this,s))},e.removePause=function(s){var n=this._first;for(s=$e(this,s);n;)n._start===s&&n.data==="isPause"&&Lr(n),n=n._next},e.killTweensOf=function(s,n,o){for(var a=this.getTweensOf(s,o),h=a.length;h--;)Fr!==a[h]&&a[h].kill(s,n);return this},e.getTweensOf=function(s,n){for(var o=[],a=Qe(s),h=this._first,l=sr(n),c;h;)h instanceof Jt?dE(h._targets,a)&&(l?(!Fr||h._initted&&h._ts)&&h.globalTime(0)<=n&&h.globalTime(h.totalDuration())>n:!n||h.isActive())&&o.push(h):(c=h.getTweensOf(a,n)).length&&o.push.apply(o,c),h=h._next;return o},e.tweenTo=function(s,n){n=n||{};var o=this,a=$e(o,s),h=n,l=h.startAt,c=h.onStart,u=h.onStartParams,d=h.immediateRender,f,m=Jt.to(o,Je({ease:n.ease||"none",lazy:!1,immediateRender:!1,time:a,overwrite:"auto",duration:n.duration||Math.abs((a-(l&&"time"in l?l.time:o._time))/o.timeScale())||Gt,onStart:function(){if(o.pause(),!f){var g=n.duration||Math.abs((a-(l&&"time"in l?l.time:o._time))/o.timeScale());m._dur!==g&&an(m,g,0,1).render(m._time,!0,!0),f=1}c&&c.apply(m,u||[])}},n));return d?m.render(0):m},e.tweenFromTo=function(s,n,o){return this.tweenTo(n,Je({startAt:{time:$e(this,s)}},o))},e.recent=function(){return this._recent},e.nextLabel=function(s){return s===void 0&&(s=this._time),yg(this,$e(this,s))},e.previousLabel=function(s){return s===void 0&&(s=this._time),yg(this,$e(this,s),1)},e.currentLabel=function(s){return arguments.length?this.seek(s,!0):this.previousLabel(this._time+Gt)},e.shiftChildren=function(s,n,o){o===void 0&&(o=0);for(var a=this._first,h=this.labels,l;a;)a._start>=o&&(a._start+=s,a._end+=s),a=a._next;if(n)for(l in h)h[l]>=o&&(h[l]+=s);return us(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,o;n;)o=n._next,this.remove(n),n=o;return this._dp&&(this._time=this._tTime=this._pTime=0),s&&(this.labels={}),us(this)},e.totalDuration=function(s){var n=0,o=this,a=o._last,h=je,l,c,u;if(arguments.length)return o.timeScale((o._repeat<0?o.duration():o.totalDuration())/(o.reversed()?-s:s));if(o._dirty){for(u=o.parent;a;)l=a._prev,a._dirty&&a.totalDuration(),c=a._start,c>h&&o._sort&&a._ts&&!o._lock?(o._lock=1,Fi(o,a,c-a._delay,1)._lock=0):h=c,c<0&&a._ts&&(n-=c,(!u&&!o._dp||u&&u.smoothChildTiming)&&(o._start+=c/o._ts,o._time-=c,o._tTime-=c),o.shiftChildren(-c,!1,-1/0),h=0),a._end>n&&a._ts&&(n=a._end),a=l;an(o,o===Xt&&o._time>n?o._time:n,1,1),o._dirty=0}return o._tDur},t.updateRoot=function(s){if(Xt._ts&&(tg(Xt,fh(s,Xt)),$0=We.frame),We.frame>=Q0){Q0+=De.autoSleep||120;var n=Xt._first;if((!n||!n._ts)&&De.autoSleep&&We._listeners.length<2){for(;n&&!n._ts;)n=n._next;n||We.sleep()}}},t}(mo);Je(Te.prototype,{_lock:0,_hasPause:0,_forcing:0});var NE=function(t,e,i,s,n,o,a){var h=new Ie(this._pt,t,e,0,1,Gg,null,n),l=0,c=0,u,d,f,m,p,g,y,_;for(h.b=i,h.e=s,i+="",s+="",(y=~s.indexOf("random("))&&(s=co(s)),o&&(_=[i,s],o(_,t,e),i=_[0],s=_[1]),d=i.match(gu)||[];u=gu.exec(s);)m=u[0],p=s.substring(l,u.index),f?f=(f+1)%5:p.substr(-5)==="rgba("&&(f=1),m!==d[c++]&&(g=parseFloat(d[c-1])||0,h._pt={_next:h._pt,p:p||c===1?p:",",s:g,c:m.charAt(1)==="="?nn(g,m)-g:parseFloat(m)-g,m:f&&f<4?Math.round:0},l=gu.lastIndex);return h.c=l<s.length?s.substring(l,s.length):"",h.fp=a,(K0.test(s)||y)&&(h.e=0),this._pt=h,h},Gu=function(t,e,i,s,n,o,a,h,l,c){Ht(s)&&(s=s(n||0,t,o));var u=t[e],d=i!=="get"?i:Ht(u)?l?t[e.indexOf("set")||!Ht(t["get"+e.substr(3)])?e:"get"+e.substr(3)](l):t[e]():u,f=Ht(u)?l?WE:Lg:Du,m;if(ne(s)&&(~s.indexOf("random(")&&(s=co(s)),s.charAt(1)==="="&&(m=nn(d,s)+(ge(d)||0),(m||m===0)&&(s=m))),!c||d!==s||Fu)return!isNaN(d*s)&&s!==""?(m=new Ie(this._pt,t,e,+d||0,s-(d||0),typeof u=="boolean"?XE:Pg,0,f),l&&(m.fp=l),a&&m.modifier(a,this,t),this._pt=m):(!u&&!(e in t)&&xu(e,s),NE.call(this,t,e,d,s,f,h||De.stringFilter,l))},DE=function(t,e,i,s,n){if(Ht(t)&&(t=go(t,n,e,i,s)),!Pi(t)||t.style&&t.nodeType||me(t)||V0(t))return ne(t)?go(t,n,e,i,s):t;var o={},a;for(a in t)o[a]=go(t[a],n,e,i,s);return o},Ag=function(t,e,i,s,n,o){var a,h,l,c;if(Oe[t]&&(a=new Oe[t]).init(n,a.rawVars?e[t]:DE(e[t],s,n,o,i),i,s,o)!==!1&&(i._pt=h=new Ie(i._pt,n,t,0,1,a.render,a,0,a.priority),i!==hn))for(l=i._ptLookup[i._targets.indexOf(n)],c=a._props.length;c--;)l[a._props[c]]=h;return a},Fr,Fu,Nu=function r(t,e,i){var s=t.vars,n=s.ease,o=s.startAt,a=s.immediateRender,h=s.lazy,l=s.onUpdate,c=s.runBackwards,u=s.yoyoEase,d=s.keyframes,f=s.autoRevert,m=t._dur,p=t._startAt,g=t._targets,y=t.parent,_=y&&y.data==="nested"?y.vars.targets:g,b=t._overwrite==="auto"&&!uu,v=t.timeline,w,E,C,A,R,G,N,P,I,D,X,H,Z;if(v&&(!d||!n)&&(n="none"),t._ease=ds(n,rn.ease),t._yEase=u?Sg(ds(u===!0?n:u,rn.ease)):0,u&&t._yoyo&&!t._repeat&&(u=t._yEase,t._yEase=t._ease,t._ease=u),t._from=!v&&!!s.runBackwards,!v||d&&!s.stagger){if(P=g[0]?ls(g[0]).harness:0,H=P&&s[P.prop],w=uh(s,_u),p&&(p._zTime<0&&p.progress(1),e<0&&c&&a&&!f?p.render(-1,!0):p.revert(c&&m?hh:cE),p._lazy=0),o){if(Lr(t._startAt=Jt.set(g,Je({data:"isStart",overwrite:!1,parent:y,immediateRender:!0,lazy:!p&&Ee(h),startAt:null,delay:0,onUpdate:l&&function(){return Be(t,"onUpdate")},stagger:0},o))),t._startAt._dp=0,t._startAt._sat=t,e<0&&(pe||!a&&!f)&&t._startAt.revert(hh),a&&m&&e<=0&&i<=0){e&&(t._zTime=e);return}}else if(c&&m&&!p){if(e&&(a=!1),C=Je({overwrite:!1,data:"isFromStart",lazy:a&&!p&&Ee(h),immediateRender:a,stagger:0,parent:y},w),H&&(C[P.prop]=H),Lr(t._startAt=Jt.set(g,C)),t._startAt._dp=0,t._startAt._sat=t,e<0&&(pe?t._startAt.revert(hh):t._startAt.render(-1,!0)),t._zTime=e,!a)r(t._startAt,Gt,Gt);else if(!e)return}for(t._pt=t._ptCache=0,h=m&&Ee(h)||h&&!m,E=0;E<g.length;E++){if(R=g[E],N=R._gsap||Su(g)[E]._gsap,t._ptLookup[E]=D={},vu[N.id]&&Mr.length&&ch(),X=_===g?E:_.indexOf(R),P&&(I=new P).init(R,H||w,t,X,_)!==!1&&(t._pt=A=new Ie(t._pt,R,I.name,0,1,I.render,I,0,I.priority),I._props.forEach(function(j){D[j]=A}),I.priority&&(G=1)),!P||H)for(C in w)Oe[C]&&(I=Ag(C,w,t,X,R,_))?I.priority&&(G=1):D[C]=A=Gu.call(t,R,C,"get",w[C],X,_,0,s.stringFilter);t._op&&t._op[E]&&t.kill(R,t._op[E]),b&&t._pt&&(Fr=t,Xt.killTweensOf(R,D,t.globalTime(e)),Z=!t.parent,Fr=0),t._pt&&h&&(vu[N.id]=1)}G&&Fg(t),t._onInit&&t._onInit(t)}t._onUpdate=l,t._initted=(!t._op||t._pt)&&!Z,d&&e<=0&&v.render(je,!0,!0)},kE=function(t,e,i,s,n,o,a,h){var l=(t._pt&&t._ptCache||(t._ptCache={}))[e],c,u,d,f;if(!l)for(l=t._ptCache[e]=[],d=t._ptLookup,f=t._targets.length;f--;){if(c=d[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 Fu=1,t.vars[e]="+=0",Nu(t,a),Fu=0,h?no(e+" not eligible for reset"):1;l.push(c)}for(f=l.length;f--;)u=l[f],c=u._pt||u,c.s=(s||s===0)&&!n?s:c.s+(s||0)+o*c.c,c.c=i-c.s,u.e&&(u.e=zt(i)+ge(u.e)),u.b&&(u.b=c.s+ge(u.b))},OE=function(t,e){var i=t[0]?ls(t[0]).harness:0,s=i&&i.aliases,n,o,a,h;if(!s)return e;n=cs({},e);for(o in s)if(o in n)for(h=s[o].split(","),a=h.length;a--;)n[h[a]]=n[o];return n},BE=function(t,e,i,s){var n=e.ease||s||"power1.inOut",o,a;if(me(e))a=i[t]||(i[t]=[]),e.forEach(function(h,l){return a.push({t:l/(e.length-1)*100,v:h,e:n})});else for(o in e)a=i[o]||(i[o]=[]),o==="ease"||a.push({t:parseFloat(t),v:e[o],e:n})},go=function(t,e,i,s,n){return Ht(t)?t.call(e,i,s,n):ne(t)&&~t.indexOf("random(")?co(t):t},Rg=wu+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert",Mg={};Ce(Rg+",id,stagger,delay,duration,paused,scrollTrigger",function(r){return Mg[r]=1});var Jt=function(r){X0(t,r);function t(i,s,n,o){var a;typeof s=="number"&&(n.duration=s,s=n,n=null),a=r.call(this,o?s:ao(s))||this;var h=a.vars,l=h.duration,c=h.delay,u=h.immediateRender,d=h.stagger,f=h.overwrite,m=h.keyframes,p=h.defaults,g=h.scrollTrigger,y=h.yoyoEase,_=s.parent||Xt,b=(me(i)||V0(i)?sr(i[0]):"length"in s)?[i]:Qe(i),v,w,E,C,A,R,G,N;if(a._targets=b.length?Su(b):no("GSAP target "+i+" not found. https://gsap.com",!De.nullTargetWarn)||[],a._ptLookup=[],a._overwrite=f,m||d||oh(l)||oh(c)){if(s=a.vars,v=a.timeline=new Te({data:"nested",defaults:p||{},targets:_&&_.data==="nested"?_.vars.targets:b}),v.kill(),v.parent=v._dp=rr(a),v._start=0,d||oh(l)||oh(c)){if(C=b.length,G=d&&dg(d),Pi(d))for(A in d)~Rg.indexOf(A)&&(N||(N={}),N[A]=d[A]);for(w=0;w<C;w++)E=uh(s,Mg),E.stagger=0,y&&(E.yoyoEase=y),N&&cs(E,N),R=b[w],E.duration=+go(l,rr(a),w,R,b),E.delay=(+go(c,rr(a),w,R,b)||0)-a._delay,!d&&C===1&&E.delay&&(a._delay=c=E.delay,a._start+=c,E.delay=0),v.to(R,E,G?G(w,R,b):0),v._ease=St.none;v.duration()?l=c=0:a.timeline=0}else if(m){ao(Je(v.vars.defaults,{ease:"none"})),v._ease=ds(m.ease||s.ease||"none");var P=0,I,D,X;if(me(m))m.forEach(function(H){return v.to(b,H,">")}),v.duration();else{E={};for(A in m)A==="ease"||A==="easeEach"||BE(A,m[A],E,m.easeEach);for(A in E)for(I=E[A].sort(function(H,Z){return H.t-Z.t}),P=0,w=0;w<I.length;w++)D=I[w],X={ease:D.e,duration:(D.t-(w?I[w-1].t:0))/100*l},X[A]=D.v,v.to(b,X,P),P+=X.duration;v.duration()<l&&v.to({},{duration:l-v.duration()})}}l||a.duration(l=v.duration())}else a.timeline=0;return f===!0&&!uu&&(Fr=rr(a),Xt.killTweensOf(b),Fr=0),Fi(_,rr(a),n),s.reversed&&a.reverse(),s.paused&&a.paused(!0),(u||!l&&!m&&a._start===oe(_._time)&&Ee(u)&&gE(rr(a))&&_.data!=="nested")&&(a._tTime=-Gt,a.render(Math.max(0,-c)||0)),g&&ag(rr(a),g),a}var e=t.prototype;return e.render=function(s,n,o){var a=this._time,h=this._tDur,l=this._dur,c=s<0,u=s>h-Gt&&!c?h:s<Gt?0:s,d,f,m,p,g,y,_,b,v;if(!l)bE(this,s,n,o);else if(u!==this._tTime||!s||o||!this._initted&&this._tTime||this._startAt&&this._zTime<0!==c){if(d=u,b=this.timeline,this._repeat){if(p=l+this._rDelay,this._repeat<-1&&c)return this.totalTime(p*100+s,n,o);if(d=oe(u%p),u===h?(m=this._repeat,d=l):(m=~~(u/p),m&&m===oe(u/p)&&(d=l,m--),d>l&&(d=l)),y=this._yoyo&&m&1,y&&(v=this._yEase,d=l-d),g=on(this._tTime,p),d===a&&!o&&this._initted&&m===g)return this._tTime=u,this;m!==g&&(b&&this._yEase&&Eg(b,y),this.vars.repeatRefresh&&!y&&!this._lock&&this._time!==p&&this._initted&&(this._lock=o=1,this.render(oe(p*m),!0).invalidate()._lock=0))}if(!this._initted){if(hg(this,c?s:d,o,n,u))return this._tTime=0,this;if(a!==this._time&&!(o&&this.vars.repeatRefresh&&m!==g))return this;if(l!==this._dur)return this.render(s,n,o)}if(this._tTime=u,this._time=d,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=_=(v||this._ease)(d/l),this._from&&(this.ratio=_=1-_),d&&!a&&!n&&!m&&(Be(this,"onStart"),this._tTime!==u))return this;for(f=this._pt;f;)f.r(_,f.d),f=f._next;b&&b.render(s<0?s:b._dur*b._ease(d/this._dur),n,o)||this._startAt&&(this._zTime=s),this._onUpdate&&!n&&(c&&Eu(this,s,n,o),Be(this,"onUpdate")),this._repeat&&m!==g&&this.vars.onRepeat&&!n&&this.parent&&Be(this,"onRepeat"),(u===this._tDur||!u)&&this._tTime===u&&(c&&!this._onUpdate&&Eu(this,s,!0,!0),(s||!l)&&(u===this._tDur&&this._ts>0||!u&&this._ts<0)&&Lr(this,1),!n&&!(c&&!a)&&(u||a||y)&&(Be(this,u===h?"onComplete":"onReverseComplete",!0),this._prom&&!(u<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,o,a,h){po||We.wake(),this._ts||this.play();var l=Math.min(this._dur,(this._dp._time-this._start)*this._ts),c;return this._initted||Nu(this,l),c=this._ease(l/this._dur),kE(this,s,n,o,a,c,l,h)?this.resetTo(s,n,o,a,1):(mh(this,0),this.parent||sg(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?uo(this):this;if(this.timeline){var o=this.timeline.totalDuration();return this.timeline.killTweensOf(s,n,Fr&&Fr.vars.overwrite!==!0)._first||uo(this),this.parent&&o!==this.timeline.totalDuration()&&an(this,this._dur*this.timeline._tDur/o,0,1),this}var a=this._targets,h=s?Qe(s):a,l=this._ptLookup,c=this._pt,u,d,f,m,p,g,y;if((!n||n==="all")&&pE(a,h))return n==="all"&&(this._pt=0),uo(this);for(u=this._op=this._op||[],n!=="all"&&(ne(n)&&(p={},Ce(n,function(_){return p[_]=1}),n=p),n=OE(a,n)),y=a.length;y--;)if(~h.indexOf(a[y])){d=l[y],n==="all"?(u[y]=n,m=d,f={}):(f=u[y]=u[y]||{},m=n);for(p in m)g=d&&d[p],g&&((!("kill"in g.d)||g.d.kill(p)===!0)&&dh(this,g,"_pt"),delete d[p]),f!=="all"&&(f[p]=1)}return this._initted&&!this._pt&&c&&uo(this),this},t.to=function(s,n){return new t(s,n,arguments[2])},t.from=function(s,n){return ho(1,arguments)},t.delayedCall=function(s,n,o,a){return new t(n,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:s,onComplete:n,onReverseComplete:n,onCompleteParams:o,onReverseCompleteParams:o,callbackScope:a})},t.fromTo=function(s,n,o){return ho(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,o){return Xt.killTweensOf(s,n,o)},t}(mo);Je(Jt.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),Ce("staggerTo,staggerFrom,staggerFromTo",function(r){Jt[r]=function(){var t=new Te,e=Iu.call(arguments,0);return e.splice(r==="staggerFromTo"?5:4,0,0),t[r].apply(t,e)}});var Du=function(t,e,i){return t[e]=i},Lg=function(t,e,i){return t[e](i)},WE=function(t,e,i,s){return t[e](s.fp,i)},UE=function(t,e,i){return t.setAttribute(e,i)},ku=function(t,e){return Ht(t[e])?Lg:fu(t[e])&&t.setAttribute?UE:Du},Pg=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e6)/1e6,e)},XE=function(t,e){return e.set(e.t,e.p,!!(e.s+e.c*t),e)},Gg=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)},Ou=function(t,e){for(var i=e._pt;i;)i.r(t,i.d),i=i._next},ZE=function(t,e,i,s){for(var n=this._pt,o;n;)o=n._next,n.p===s&&n.modifier(t,e,i),n=o},VE=function(t){for(var e=this._pt,i,s;e;)s=e._next,e.p===t&&!e.op||e.op===t?dh(this,e,"_pt"):e.dep||(i=1),e=s;return!i},HE=function(t,e,i,s){s.mSet(t,e,s.m.call(s.tween,i,s.mt),s)},Fg=function(t){for(var e=t._pt,i,s,n,o;e;){for(i=e._next,s=n;s&&s.pr>e.pr;)s=s._next;(e._prev=s?s._prev:o)?e._prev._next=e:n=e,(e._next=s)?s._prev=e:o=e,e=i}t._pt=n},Ie=function(){function r(e,i,s,n,o,a,h,l,c){this.t=i,this.s=n,this.c=o,this.p=s,this.r=a||Pg,this.d=h||this,this.set=l||Du,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=HE,this.m=i,this.mt=n,this.tween=s},r}();Ce(wu+"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 _u[r]=1}),ke.TweenMax=ke.TweenLite=Jt,ke.TimelineLite=ke.TimelineMax=Te,Xt=new Te({sortChildren:!1,defaults:rn,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),De.stringFilter=wg;var ps=[],gh={},KE=[],Ng=0,YE=0,Bu=function(t){return(gh[t]||KE).map(function(e){return e()})},Wu=function(){var t=Date.now(),e=[];t-Ng>2&&(Bu("matchMediaInit"),ps.forEach(function(i){var s=i.queries,n=i.conditions,o,a,h,l;for(a in s)o=Gi.matchMedia(s[a]).matches,o&&(h=1),o!==n[a]&&(n[a]=o,l=1);l&&(i.revert(),h&&e.push(i))}),Bu("matchMediaRevert"),e.forEach(function(i){return i.onMatch(i,function(s){return i.add(null,s)})}),Ng=t,Bu("matchMedia"))},Dg=function(){function r(e,i){this.selector=i&&Au(i),this.data=[],this._r=[],this.isReverted=!1,this.id=YE++,e&&this.add(e)}var t=r.prototype;return t.add=function(i,s,n){Ht(i)&&(n=s,s=i,i=Ht);var o=this,a=function(){var l=kt,c=o.selector,u;return l&&l!==o&&l.data.push(o),n&&(o.selector=Au(n)),kt=o,u=s.apply(o,arguments),Ht(u)&&o._r.push(u),kt=l,o.selector=c,o.isReverted=!1,u};return o.last=a,i===Ht?a(o,function(h){return o.add(null,h)}):i?o[i]=a:a},t.ignore=function(i){var s=kt;kt=null,i(this),kt=s},t.getTweens=function(){var i=[];return this.data.forEach(function(s){return s instanceof r?i.push.apply(i,s.getTweens()):s instanceof Jt&&!(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 a=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 a.splice(a.indexOf(c),1)}));for(a.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,u){return u.g-c.g||-1/0}).forEach(function(c){return c.t.revert(i)}),h=n.data.length;h--;)l=n.data[h],l instanceof Te?l.data!=="nested"&&(l.scrollTrigger&&l.scrollTrigger.revert(),l.kill()):!(l instanceof Jt)&&l.revert&&l.revert(i);n._r.forEach(function(c){return c(i,n)}),n.isReverted=!0}():this.data.forEach(function(a){return a.kill&&a.kill()}),this.clear(),s)for(var o=ps.length;o--;)ps[o].id===this.id&&ps.splice(o,1)},t.revert=function(i){this.kill(i||{})},r}(),zE=function(){function r(e){this.contexts=[],this.scope=e,kt&&kt.data.push(this)}var t=r.prototype;return t.add=function(i,s,n){Pi(i)||(i={matches:i});var o=new Dg(0,n||this.scope),a=o.conditions={},h,l,c;kt&&!o.selector&&(o.selector=kt.selector),this.contexts.push(o),s=o.add("onMatch",s),o.queries=i;for(l in i)l==="all"?c=1:(h=Gi.matchMedia(i[l]),h&&(ps.indexOf(o)<0&&ps.push(o),(a[l]=h.matches)&&(c=1),h.addListener?h.addListener(Wu):h.addEventListener("change",Wu)));return c&&s(o,function(u){return o.add(null,u)}),this},t.revert=function(i){this.kill(i||{})},t.kill=function(i){this.contexts.forEach(function(s){return s.kill(i,!0)})},r}(),yh={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 xg(s)})},timeline:function(t){return new Te(t)},getTweensOf:function(t,e){return Xt.getTweensOf(t,e)},getProperty:function(t,e,i,s){ne(t)&&(t=Qe(t)[0]);var n=ls(t||{}).get,o=i?ig:eg;return i==="native"&&(i=""),t&&(e?o((Oe[e]&&Oe[e].get||n)(t,e,i,s)):function(a,h,l){return o((Oe[a]&&Oe[a].get||n)(t,a,h,l))})},quickSetter:function(t,e,i){if(t=Qe(t),t.length>1){var s=t.map(function(c){return Ae.quickSetter(c,e,i)}),n=s.length;return function(c){for(var u=n;u--;)s[u](c)}}t=t[0]||{};var o=Oe[e],a=ls(t),h=a.harness&&(a.harness.aliases||{})[e]||e,l=o?function(c){var u=new o;hn._pt=0,u.init(t,i?c+i:c,hn,0,[t]),u.render(1,u),hn._pt&&Ou(1,hn)}:a.set(t,h);return o?l:function(c){return l(t,h,i?c+i:c,a,1)}},quickTo:function(t,e,i){var s,n=Ae.to(t,cs((s={},s[e]="+=0.1",s.paused=!0,s),i||{})),o=function(h,l,c){return n.resetTo(e,h,l,c)};return o.tween=n,o},isTweening:function(t){return Xt.getTweensOf(t,!0).length>0},defaults:function(t){return t&&t.ease&&(t.ease=ds(t.ease,rn.ease)),rg(rn,t||{})},config:function(t){return rg(De,t||{})},registerEffect:function(t){var e=t.name,i=t.effect,s=t.plugins,n=t.defaults,o=t.extendTimeline;(s||"").split(",").forEach(function(a){return a&&!Oe[a]&&!ke[a]&&no(e+" effect requires "+a+" plugin.")}),Tu[e]=function(a,h,l){return i(Qe(a),Je(h||{},n),l)},o&&(Te.prototype[e]=function(a,h,l){return this.add(Tu[e](a,Pi(h)?h:(l=h)&&{},this),l)})},registerEase:function(t,e){St[t]=ds(e)},parseEase:function(t,e){return arguments.length?ds(t,e):St},getById:function(t){return Xt.getById(t)},exportRoot:function(t,e){t===void 0&&(t={});var i=new Te(t),s,n;for(i.smoothChildTiming=Ee(t.smoothChildTiming),Xt.remove(i),i._dp=0,i._time=i._tTime=Xt._time,s=Xt._first;s;)n=s._next,(e||!(!s._dur&&s instanceof Jt&&s.vars.onComplete===s._targets[0]))&&Fi(i,s,s._start-s._delay),s=n;return Fi(Xt,i,0),i},context:function(t,e){return t?new Dg(t,e):kt},matchMedia:function(t){return new zE(t)},matchMediaRefresh:function(){return ps.forEach(function(t){var e=t.conditions,i,s;for(s in e)e[s]&&(e[s]=!1,i=1);i&&t.revert()})||Wu()},addEventListener:function(t,e){var i=gh[t]||(gh[t]=[]);~i.indexOf(e)||i.push(e)},removeEventListener:function(t,e){var i=gh[t],s=i&&i.indexOf(e);s>=0&&i.splice(s,1)},utils:{wrap:CE,wrapYoyo:IE,distribute:dg,random:pg,snap:fg,normalize:EE,getUnit:ge,clamp:vE,splitColor:_g,toArray:Qe,selector:Au,mapRange:gg,pipe:wE,unitize:SE,interpolate:AE,shuffle:ug},install:j0,effects:Tu,ticker:We,updateRoot:Te.updateRoot,plugins:Oe,globalTimeline:Xt,core:{PropTween:Ie,globals:J0,Tween:Jt,Timeline:Te,Animation:mo,getCache:ls,_removeLinkedListItem:dh,reverting:function(){return pe},context:function(t){return t&&kt&&(kt.data.push(t),t._ctx=kt),kt},suppressOverwrites:function(t){return uu=t}}};Ce("to,from,fromTo,delayedCall,set,killTweensOf",function(r){return yh[r]=Jt[r]}),We.add(Te.updateRoot),hn=yh.to({},{duration:0});var jE=function(t,e){for(var i=t._pt;i&&i.p!==e&&i.op!==e&&i.fp!==e;)i=i._next;return i},JE=function(t,e){var i=t._targets,s,n,o;for(s in e)for(n=i.length;n--;)o=t._ptLookup[n][s],o&&(o=o.d)&&(o._pt&&(o=jE(o,s)),o&&o.modifier&&o.modifier(e[s],t,i[n],s))},Uu=function(t,e){return{name:t,rawVars:1,init:function(s,n,o){o._onInit=function(a){var h,l;if(ne(n)&&(h={},Ce(n,function(c){return h[c]=1}),n=h),e){h={};for(l in n)h[l]=e(n[l]);n=h}JE(a,n)}}}},Ae=yh.registerPlugin({name:"attr",init:function(t,e,i,s,n){var o,a,h;this.tween=i;for(o in e)h=t.getAttribute(o)||"",a=this.add(t,"setAttribute",(h||0)+"",e[o],s,n,0,0,o),a.op=o,a.b=h,this._props.push(o)},render:function(t,e){for(var i=e._pt;i;)pe?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)}},Uu("roundProps",Ru),Uu("modifiers"),Uu("snap",fg))||yh;Jt.version=Te.version=Ae.version="3.12.5",z0=1,pu()&&ln(),St.Power0,St.Power1,St.Power2,St.Power3,St.Power4,St.Linear,St.Quad,St.Cubic,St.Quart,St.Quint,St.Strong,St.Elastic,St.Back,St.SteppedEase,St.Bounce,St.Sine,St.Expo,St.Circ;/*!
|
|
1168
1168
|
* CSSPlugin 3.12.5
|
|
1169
1169
|
* https://gsap.com
|
|
1170
1170
|
*
|
|
@@ -1172,6 +1172,6 @@ void main(void)\r
|
|
|
1172
1172
|
* Subject to the terms at https://gsap.com/standard-license or for
|
|
1173
1173
|
* Club GSAP members, the agreement issued with that membership.
|
|
1174
1174
|
* @author: Jack Doyle, jack@greensock.com
|
|
1175
|
-
*/var kg,Nr,cn,Xu,ms,Og,Zu,JC=function(){return typeof window<"u"},nr={},gs=180/Math.PI,un=Math.PI/180,dn=Math.atan2,Bg=1e8,Vu=/([A-Z])/g,$C=/(left|right|width|margin|padding|x)/i,QC=/[\s,\(]\S/,Ni={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},Hu=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},qC=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)},tE=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)},eE=function(t,e){var i=e.s+e.c*t;e.set(e.t,e.p,~~(i+(i<0?-.5:.5))+e.u,e)},Wg=function(t,e){return e.set(e.t,e.p,t?e.e:e.b,e)},Ug=function(t,e){return e.set(e.t,e.p,t!==1?e.b:e.e,e)},iE=function(t,e,i){return t.style[e]=i},rE=function(t,e,i){return t.style.setProperty(e,i)},sE=function(t,e,i){return t._gsap[e]=i},nE=function(t,e,i){return t._gsap.scaleX=t._gsap.scaleY=i},oE=function(t,e,i,s,n){var o=t._gsap;o.scaleX=o.scaleY=i,o.renderTransform(n,o)},aE=function(t,e,i,s,n){var o=t._gsap;o[e]=i,o.renderTransform(n,o)},Xt="transform",Re=Xt+"Origin",hE=function r(t,e){var i=this,s=this.target,n=s.style,o=s._gsap;if(t in nr&&n){if(this.tfm=this.tfm||{},t!=="transform")t=Ni[t]||t,~t.indexOf(",")?t.split(",").forEach(function(a){return i.tfm[a]=or(s,a)}):this.tfm[t]=o.x?o[t]:or(s,t),t===Re&&(this.tfm.zOrigin=o.zOrigin);else return Ni.transform.split(",").forEach(function(a){return r.call(i,a,e)});if(this.props.indexOf(Xt)>=0)return;o.svg&&(this.svgo=s.getAttribute("data-svg-origin"),this.props.push(Re,e,"")),t=Xt}(n||e)&&this.props.push(t,e,n[t])},Xg=function(t){t.translate&&(t.removeProperty("translate"),t.removeProperty("scale"),t.removeProperty("rotate"))},lE=function(){var t=this.props,e=this.target,i=e.style,s=e._gsap,n,o;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(Vu,"-$1").toLowerCase());if(this.tfm){for(o in this.tfm)s[o]=this.tfm[o];s.svg&&(s.renderTransform(),e.setAttribute("data-svg-origin",this.svgo||"")),n=Zu(),(!n||!n.isStart)&&!i[Xt]&&(Xg(i),s.zOrigin&&i[Re]&&(i[Re]+=" "+s.zOrigin+"px",s.zOrigin=0,s.renderTransform()),s.uncache=1)}},Zg=function(t,e){var i={target:t,props:[],revert:lE,save:hE};return t._gsap||Ae.core.getCache(t),e&&e.split(",").forEach(function(s){return i.save(s)}),i},Vg,Ku=function(t,e){var i=Nr.createElementNS?Nr.createElementNS((e||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),t):Nr.createElement(t);return i&&i.style?i:Nr.createElement(t)},Di=function r(t,e,i){var s=getComputedStyle(t);return s[e]||s.getPropertyValue(e.replace(Vu,"-$1").toLowerCase())||s.getPropertyValue(e)||!i&&r(t,fn(e)||e,1)||""},Hg="O,Moz,ms,Ms,Webkit".split(","),fn=function(t,e,i){var s=e||ms,n=s.style,o=5;if(t in n&&!i)return t;for(t=t.charAt(0).toUpperCase()+t.substr(1);o--&&!(Hg[o]+t in n););return o<0?null:(o===3?"ms":o>=0?Hg[o]:"")+t},Yu=function(){JC()&&window.document&&(kg=window,Nr=kg.document,cn=Nr.documentElement,ms=Ku("div")||{style:{}},Ku("div"),Xt=fn(Xt),Re=Xt+"Origin",ms.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",Vg=!!fn("perspective"),Zu=Ae.core.reverting,Xu=1)},zu=function r(t){var e=Ku("svg",this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),i=this.parentNode,s=this.nextSibling,n=this.style.cssText,o;if(cn.appendChild(e),e.appendChild(this),this.style.display="block",t)try{o=this.getBBox(),this._gsapBBox=this.getBBox,this.getBBox=r}catch{}else this._gsapBBox&&(o=this._gsapBBox());return i&&(s?i.insertBefore(this,s):i.appendChild(this)),cn.removeChild(e),this.style.cssText=n,o},Kg=function(t,e){for(var i=e.length;i--;)if(t.hasAttribute(e[i]))return t.getAttribute(e[i])},Yg=function(t){var e;try{e=t.getBBox()}catch{e=zu.call(t,!0)}return e&&(e.width||e.height)||t.getBBox===zu||(e=zu.call(t,!0)),e&&!e.width&&!e.x&&!e.y?{x:+Kg(t,["x","cx","x1"])||0,y:+Kg(t,["y","cy","y1"])||0,width:0,height:0}:e},zg=function(t){return!!(t.getCTM&&(!t.parentNode||t.ownerSVGElement)&&Yg(t))},ys=function(t,e){if(e){var i=t.style,s;e in nr&&e!==Re&&(e=Xt),i.removeProperty?(s=e.substr(0,2),(s==="ms"||e.substr(0,6)==="webkit")&&(e="-"+e),i.removeProperty(s==="--"?e:e.replace(Vu,"-$1").toLowerCase())):i.removeAttribute(e)}},Dr=function(t,e,i,s,n,o){var a=new Ie(t._pt,e,i,0,1,o?Ug:Wg);return t._pt=a,a.b=s,a.e=n,t._props.push(i),a},jg={deg:1,rad:1,turn:1},cE={grid:1,flex:1},kr=function r(t,e,i,s){var n=parseFloat(i)||0,o=(i+"").trim().substr((n+"").length)||"px",a=ms.style,h=$C.test(e),l=t.tagName.toLowerCase()==="svg",c=(l?"client":"offset")+(h?"Width":"Height"),u=100,d=s==="px",f=s==="%",m,p,g,y;if(s===o||!n||jg[s]||jg[o])return n;if(o!=="px"&&!d&&(n=r(t,e,i,"px")),y=t.getCTM&&zg(t),(f||o==="%")&&(nr[e]||~e.indexOf("adius")))return m=y?t.getBBox()[h?"width":"height"]:t[c],zt(f?n/m*u:n/100*m);if(a[h?"width":"height"]=u+(d?o:s),p=~e.indexOf("adius")||s==="em"&&t.appendChild&&!l?t:t.parentNode,y&&(p=(t.ownerSVGElement||{}).parentNode),(!p||p===Nr||!p.appendChild)&&(p=Nr.body),g=p._gsap,g&&f&&g.width&&h&&g.time===We.time&&!g.uncache)return zt(n/g.width*u);if(f&&(e==="height"||e==="width")){var _=t.style[e];t.style[e]=u+s,m=t[c],_?t.style[e]=_:ys(t,e)}else(f||o==="%")&&!cE[Di(p,"display")]&&(a.position=Di(t,"position")),p===t&&(a.position="static"),p.appendChild(ms),m=ms[c],p.removeChild(ms),a.position="absolute";return h&&f&&(g=ls(p),g.time=We.time,g.width=p[c]),zt(d?m*n/u:m&&n?u/m*n:0)},or=function(t,e,i,s){var n;return Xu||Yu(),e in Ni&&e!=="transform"&&(e=Ni[e],~e.indexOf(",")&&(e=e.split(",")[0])),nr[e]&&e!=="transform"?(n=go(t,s),n=e!=="transformOrigin"?n[e]:n.svg?n.origin:xh(Di(t,Re))+" "+n.zOrigin+"px"):(n=t.style[e],(!n||n==="auto"||s||~(n+"").indexOf("calc("))&&(n=bh[e]&&bh[e](t,e,i)||Di(t,e)||q0(t,e)||(e==="opacity"?1:0))),i&&!~(n+"").trim().indexOf(" ")?kr(t,e,n,i)+i:n},uE=function(t,e,i,s){if(!i||i==="none"){var n=fn(e,t,1),o=n&&Di(t,n,1);o&&o!==i?(e=n,i=o):e==="borderColor"&&(i=Di(t,"borderTopColor"))}var a=new Ie(this._pt,t.style,e,0,1,Gg),h=0,l=0,c,u,d,f,m,p,g,y,_,b,v,w;if(a.b=i,a.e=s,i+="",s+="",s==="auto"&&(p=t.style[e],t.style[e]=s,s=Di(t,e)||s,p?t.style[e]=p:ys(t,e)),c=[i,s],wg(c),i=c[0],s=c[1],d=i.match(sn)||[],w=s.match(sn)||[],w.length){for(;u=sn.exec(s);)g=u[0],_=s.substring(h,u.index),m?m=(m+1)%5:(_.substr(-5)==="rgba("||_.substr(-5)==="hsla(")&&(m=1),g!==(p=d[l++]||"")&&(f=parseFloat(p)||0,v=p.substr((f+"").length),g.charAt(1)==="="&&(g=nn(f,g)+v),y=parseFloat(g),b=g.substr((y+"").length),h=sn.lastIndex-b.length,b||(b=b||De.units[e]||v,h===s.length&&(s+=b,a.e+=b)),v!==b&&(f=kr(t,e,p,b)||0),a._pt={_next:a._pt,p:_||l===1?_:",",s:f,c:y-f,m:m&&m<4||e==="zIndex"?Math.round:0});a.c=h<s.length?s.substring(h,s.length):""}else a.r=e==="display"&&s==="none"?Ug:Wg;return K0.test(s)&&(a.e=0),this._pt=a,a},Jg={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},dE=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]=Jg[i]||i,e[1]=Jg[s]||s,e.join(" ")},fE=function(t,e){if(e.tween&&e.tween._time===e.tween._dur){var i=e.t,s=i.style,n=e.u,o=i._gsap,a,h,l;if(n==="all"||n===!0)s.cssText="",h=1;else for(n=n.split(","),l=n.length;--l>-1;)a=n[l],nr[a]&&(h=1,a=a==="transformOrigin"?Re:Xt),ys(i,a);h&&(ys(i,Xt),o&&(o.svg&&i.removeAttribute("transform"),go(i,1),o.uncache=1,Xg(s)))}},bh={clearProps:function(t,e,i,s,n){if(n.data!=="isFromStart"){var o=t._pt=new Ie(t._pt,e,i,0,0,fE);return o.u=s,o.pr=-10,o.tween=n,t._props.push(i),1}}},mo=[1,0,0,1,0,0],$g={},Qg=function(t){return t==="matrix(1, 0, 0, 1, 0, 0)"||t==="none"||!t},qg=function(t){var e=Di(t,Xt);return Qg(e)?mo:e.substr(7).match(H0).map(zt)},ju=function(t,e){var i=t._gsap||ls(t),s=t.style,n=qg(t),o,a,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"?mo:n):(n===mo&&!t.offsetParent&&t!==cn&&!i.svg&&(h=s.display,s.display="block",o=t.parentNode,(!o||!t.offsetParent)&&(l=1,a=t.nextElementSibling,cn.appendChild(t)),n=qg(t),h?s.display=h:ys(t,"display"),l&&(a?o.insertBefore(t,a):o?o.appendChild(t):cn.removeChild(t))),e&&n.length>6?[n[0],n[1],n[4],n[5],n[12],n[13]]:n)},Ju=function(t,e,i,s,n,o){var a=t._gsap,h=n||ju(t,!0),l=a.xOrigin||0,c=a.yOrigin||0,u=a.xOffset||0,d=a.yOffset||0,f=h[0],m=h[1],p=h[2],g=h[3],y=h[4],_=h[5],b=e.split(" "),v=parseFloat(b[0])||0,w=parseFloat(b[1])||0,C,E,A,R;i?h!==mo&&(E=f*g-m*p)&&(A=v*(g/E)+w*(-p/E)+(p*_-g*y)/E,R=v*(-m/E)+w*(f/E)-(f*_-m*y)/E,v=A,w=R):(C=Yg(t),v=C.x+(~b[0].indexOf("%")?v/100*C.width:v),w=C.y+(~(b[1]||b[0]).indexOf("%")?w/100*C.height:w)),s||s!==!1&&a.smooth?(y=v-l,_=w-c,a.xOffset=u+(y*f+_*p)-y,a.yOffset=d+(y*m+_*g)-_):a.xOffset=a.yOffset=0,a.xOrigin=v,a.yOrigin=w,a.smooth=!!s,a.origin=e,a.originIsAbsolute=!!i,t.style[Re]="0px 0px",o&&(Dr(o,a,"xOrigin",l,v),Dr(o,a,"yOrigin",c,w),Dr(o,a,"xOffset",u,a.xOffset),Dr(o,a,"yOffset",d,a.yOffset)),t.setAttribute("data-svg-origin",v+" "+w)},go=function(t,e){var i=t._gsap||new Ig(t);if("x"in i&&!e&&!i.uncache)return i;var s=t.style,n=i.scaleX<0,o="px",a="deg",h=getComputedStyle(t),l=Di(t,Re)||"0",c,u,d,f,m,p,g,y,_,b,v,w,C,E,A,R,G,N,P,I,D,X,H,Z,j,O,k,F,V,$,dt,ot;return c=u=d=p=g=y=_=b=v=0,f=m=1,i.svg=!!(t.getCTM&&zg(t)),h.translate&&((h.translate!=="none"||h.scale!=="none"||h.rotate!=="none")&&(s[Xt]=(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[Xt]!=="none"?h[Xt]:"")),s.scale=s.rotate=s.translate="none"),E=ju(t,i.svg),i.svg&&(i.uncache?(j=t.getBBox(),l=i.xOrigin-j.x+"px "+(i.yOrigin-j.y)+"px",Z=""):Z=!e&&t.getAttribute("data-svg-origin"),Ju(t,Z||l,!!Z||i.originIsAbsolute,i.smooth!==!1,E)),w=i.xOrigin||0,C=i.yOrigin||0,E!==mo&&(N=E[0],P=E[1],I=E[2],D=E[3],c=X=E[4],u=H=E[5],E.length===6?(f=Math.sqrt(N*N+P*P),m=Math.sqrt(D*D+I*I),p=N||P?dn(P,N)*gs:0,_=I||D?dn(I,D)*gs+p:0,_&&(m*=Math.abs(Math.cos(_*un))),i.svg&&(c-=w-(w*N+C*I),u-=C-(w*P+C*D))):(ot=E[6],$=E[7],k=E[8],F=E[9],V=E[10],dt=E[11],c=E[12],u=E[13],d=E[14],A=dn(ot,V),g=A*gs,A&&(R=Math.cos(-A),G=Math.sin(-A),Z=X*R+k*G,j=H*R+F*G,O=ot*R+V*G,k=X*-G+k*R,F=H*-G+F*R,V=ot*-G+V*R,dt=$*-G+dt*R,X=Z,H=j,ot=O),A=dn(-I,V),y=A*gs,A&&(R=Math.cos(-A),G=Math.sin(-A),Z=N*R-k*G,j=P*R-F*G,O=I*R-V*G,dt=D*G+dt*R,N=Z,P=j,I=O),A=dn(P,N),p=A*gs,A&&(R=Math.cos(A),G=Math.sin(A),Z=N*R+P*G,j=X*R+H*G,P=P*R-N*G,H=H*R-X*G,N=Z,X=j),g&&Math.abs(g)+Math.abs(p)>359.9&&(g=p=0,y=180-y),f=zt(Math.sqrt(N*N+P*P+I*I)),m=zt(Math.sqrt(H*H+ot*ot)),A=dn(X,H),_=Math.abs(A)>2e-4?A*gs:0,v=dt?1/(dt<0?-dt:dt):0),i.svg&&(Z=t.getAttribute("transform"),i.forceCSS=t.setAttribute("transform","")||!Qg(Di(t,Xt)),Z&&t.setAttribute("transform",Z))),Math.abs(_)>90&&Math.abs(_)<270&&(n?(f*=-1,_+=p<=0?180:-180,p+=p<=0?180:-180):(m*=-1,_+=_<=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)+o,i.y=u-((i.yPercent=u&&(!e&&i.yPercent||(Math.round(t.offsetHeight/2)===Math.round(-u)?-50:0)))?t.offsetHeight*i.yPercent/100:0)+o,i.z=d+o,i.scaleX=zt(f),i.scaleY=zt(m),i.rotation=zt(p)+a,i.rotationX=zt(g)+a,i.rotationY=zt(y)+a,i.skewX=_+a,i.skewY=b+a,i.transformPerspective=v+o,(i.zOrigin=parseFloat(l.split(" ")[2])||!e&&i.zOrigin||0)&&(s[Re]=xh(l)),i.xOffset=i.yOffset=0,i.force3D=De.force3D,i.renderTransform=i.svg?mE:Vg?ty:pE,i.uncache=0,i},xh=function(t){return(t=t.split(" "))[0]+" "+t[1]},$u=function(t,e,i){var s=me(e);return zt(parseFloat(e)+parseFloat(kr(t,"x",i+"px",s)))+s},pE=function(t,e){e.z="0px",e.rotationY=e.rotationX="0deg",e.force3D=0,ty(t,e)},bs="0deg",yo="0px",xs=") ",ty=function(t,e){var i=e||this,s=i.xPercent,n=i.yPercent,o=i.x,a=i.y,h=i.z,l=i.rotation,c=i.rotationY,u=i.rotationX,d=i.skewX,f=i.skewY,m=i.scaleX,p=i.scaleY,g=i.transformPerspective,y=i.force3D,_=i.target,b=i.zOrigin,v="",w=y==="auto"&&t&&t!==1||y===!0;if(b&&(u!==bs||c!==bs)){var C=parseFloat(c)*un,E=Math.sin(C),A=Math.cos(C),R;C=parseFloat(u)*un,R=Math.cos(C),o=$u(_,o,E*R*-b),a=$u(_,a,-Math.sin(C)*-b),h=$u(_,h,A*R*-b+b)}g!==yo&&(v+="perspective("+g+xs),(s||n)&&(v+="translate("+s+"%, "+n+"%) "),(w||o!==yo||a!==yo||h!==yo)&&(v+=h!==yo||w?"translate3d("+o+", "+a+", "+h+") ":"translate("+o+", "+a+xs),l!==bs&&(v+="rotate("+l+xs),c!==bs&&(v+="rotateY("+c+xs),u!==bs&&(v+="rotateX("+u+xs),(d!==bs||f!==bs)&&(v+="skew("+d+", "+f+xs),(m!==1||p!==1)&&(v+="scale("+m+", "+p+xs),_.style[Xt]=v||"translate(0, 0)"},mE=function(t,e){var i=e||this,s=i.xPercent,n=i.yPercent,o=i.x,a=i.y,h=i.rotation,l=i.skewX,c=i.skewY,u=i.scaleX,d=i.scaleY,f=i.target,m=i.xOrigin,p=i.yOrigin,g=i.xOffset,y=i.yOffset,_=i.forceCSS,b=parseFloat(o),v=parseFloat(a),w,C,E,A,R;h=parseFloat(h),l=parseFloat(l),c=parseFloat(c),c&&(c=parseFloat(c),l+=c,h+=c),h||l?(h*=un,l*=un,w=Math.cos(h)*u,C=Math.sin(h)*u,E=Math.sin(h-l)*-d,A=Math.cos(h-l)*d,l&&(c*=un,R=Math.tan(l-c),R=Math.sqrt(1+R*R),E*=R,A*=R,c&&(R=Math.tan(c),R=Math.sqrt(1+R*R),w*=R,C*=R)),w=zt(w),C=zt(C),E=zt(E),A=zt(A)):(w=u,A=d,C=E=0),(b&&!~(o+"").indexOf("px")||v&&!~(a+"").indexOf("px"))&&(b=kr(f,"x",o,"px"),v=kr(f,"y",a,"px")),(m||p||g||y)&&(b=zt(b+m-(m*w+p*E)+g),v=zt(v+p-(m*C+p*A)+y)),(s||n)&&(R=f.getBBox(),b=zt(b+s/100*R.width),v=zt(v+n/100*R.height)),R="matrix("+w+","+C+","+E+","+A+","+b+","+v+")",f.setAttribute("transform",R),_&&(f.style[Xt]=R)},gE=function(t,e,i,s,n){var o=360,a=ne(n),h=parseFloat(n)*(a&&~n.indexOf("rad")?gs:1),l=h-s,c=s+l+"deg",u,d;return a&&(u=n.split("_")[1],u==="short"&&(l%=o,l!==l%(o/2)&&(l+=l<0?o:-o)),u==="cw"&&l<0?l=(l+o*Bg)%o-~~(l/o)*o:u==="ccw"&&l>0&&(l=(l-o*Bg)%o-~~(l/o)*o)),t._pt=d=new Ie(t._pt,e,i,s,l,qC),d.e=c,d.u="deg",t._props.push(i),d},ey=function(t,e){for(var i in e)t[i]=e[i];return t},yE=function(t,e,i){var s=ey({},i._gsap),n="perspective,force3D,transformOrigin,svgOrigin",o=i.style,a,h,l,c,u,d,f,m;s.svg?(l=i.getAttribute("transform"),i.setAttribute("transform",""),o[Xt]=e,a=go(i,1),ys(i,Xt),i.setAttribute("transform",l)):(l=getComputedStyle(i)[Xt],o[Xt]=e,a=go(i,1),o[Xt]=l);for(h in nr)l=s[h],c=a[h],l!==c&&n.indexOf(h)<0&&(f=me(l),m=me(c),u=f!==m?kr(i,h,l,m):parseFloat(l),d=parseFloat(c),t._pt=new Ie(t._pt,a,h,u,d-u,Hu),t._pt.u=m||0,t._props.push(h));ey(a,s)};Ee("padding,margin,Width,Radius",function(r,t){var e="Top",i="Right",s="Bottom",n="Left",o=(t<3?[e,i,s,n]:[e+n,e+i,s+i,s+n]).map(function(a){return t<2?r+a:"border"+a+r});bh[t>1?"border"+r:r]=function(a,h,l,c,u){var d,f;if(arguments.length<4)return d=o.map(function(m){return or(a,m,l)}),f=d.join(" "),f.split(d[0]).length===5?d[0]:f;d=(c+"").split(" "),f={},o.forEach(function(m,p){return f[m]=d[p]=d[p]||d[(p-1)/2|0]}),a.init(h,f,u)}});var iy={name:"css",register:Yu,targetTest:function(t){return t.style&&t.nodeType},init:function(t,e,i,s,n){var o=this._props,a=t.style,h=i.vars.startAt,l,c,u,d,f,m,p,g,y,_,b,v,w,C,E,A;Xu||Yu(),this.styles=this.styles||Zg(t),A=this.styles.props,this.tween=i;for(p in e)if(p!=="autoRound"&&(c=e[p],!(Oe[p]&&Ag(p,e,i,s,t,n)))){if(f=typeof c,m=bh[p],f==="function"&&(c=c.call(i,s,t,n),f=typeof c),f==="string"&&~c.indexOf("random(")&&(c=ho(c)),m)m(this,t,p,c,i)&&(E=1);else if(p.substr(0,2)==="--")l=(getComputedStyle(t).getPropertyValue(p)+"").trim(),c+="",Gr.lastIndex=0,Gr.test(l)||(g=me(l),y=me(c)),y?g!==y&&(l=kr(t,p,l,y)+y):g&&(c+=g),this.add(a,"setProperty",l,c,s,n,0,0,p),o.push(p),A.push(p,0,a[p]);else if(f!=="undefined"){if(h&&p in h?(l=typeof h[p]=="function"?h[p].call(i,s,t,n):h[p],ne(l)&&~l.indexOf("random(")&&(l=ho(l)),me(l+"")||l==="auto"||(l+=De.units[p]||me(or(t,p))||""),(l+"").charAt(1)==="="&&(l=or(t,p))):l=or(t,p),d=parseFloat(l),_=f==="string"&&c.charAt(1)==="="&&c.substr(0,2),_&&(c=c.substr(2)),u=parseFloat(c),p in Ni&&(p==="autoAlpha"&&(d===1&&or(t,"visibility")==="hidden"&&u&&(d=0),A.push("visibility",0,a.visibility),Dr(this,a,"visibility",d?"inherit":"hidden",u?"inherit":"hidden",!u)),p!=="scale"&&p!=="transform"&&(p=Ni[p],~p.indexOf(",")&&(p=p.split(",")[0]))),b=p in nr,b){if(this.styles.save(p),v||(w=t._gsap,w.renderTransform&&!e.parseTransform||go(t,e.parseTransform),C=e.smoothOrigin!==!1&&w.smooth,v=this._pt=new Ie(this._pt,a,Xt,0,1,w.renderTransform,w,0,-1),v.dep=1),p==="scale")this._pt=new Ie(this._pt,w,"scaleY",w.scaleY,(_?nn(w.scaleY,_+u):u)-w.scaleY||0,Hu),this._pt.u=0,o.push("scaleY",p),p+="X";else if(p==="transformOrigin"){A.push(Re,0,a[Re]),c=dE(c),w.svg?Ju(t,c,0,C,0,this):(y=parseFloat(c.split(" ")[2])||0,y!==w.zOrigin&&Dr(this,w,"zOrigin",w.zOrigin,y),Dr(this,a,p,xh(l),xh(c)));continue}else if(p==="svgOrigin"){Ju(t,c,1,C,0,this);continue}else if(p in $g){gE(this,w,p,d,_?nn(d,_+c):c);continue}else if(p==="smoothOrigin"){Dr(this,w,"smooth",w.smooth,c);continue}else if(p==="force3D"){w[p]=c;continue}else if(p==="transform"){yE(this,c,t);continue}}else p in a||(p=fn(p)||p);if(b||(u||u===0)&&(d||d===0)&&!QC.test(c)&&p in a)g=(l+"").substr((d+"").length),u||(u=0),y=me(c)||(p in De.units?De.units[p]:g),g!==y&&(d=kr(t,p,l,y)),this._pt=new Ie(this._pt,b?w:a,p,d,(_?nn(d,_+u):u)-d,!b&&(y==="px"||p==="zIndex")&&e.autoRound!==!1?eE:Hu),this._pt.u=y||0,g!==y&&y!=="%"&&(this._pt.b=l,this._pt.r=tE);else if(p in a)uE.call(this,t,p,l,_?_+c:c);else if(p in t)this.add(t,p,l||t[p],_?_+c:c,s,n);else if(p!=="parseTransform"){xu(p,c);continue}b||(p in a?A.push(p,0,a[p]):A.push(p,1,l||t[p])),o.push(p)}}E&&Fg(this)},render:function(t,e){if(e.tween._time||!Zu())for(var i=e._pt;i;)i.r(t,i.d),i=i._next;else e.styles.revert()},get:or,aliases:Ni,getSetter:function(t,e,i){var s=Ni[e];return s&&s.indexOf(",")<0&&(e=s),e in nr&&e!==Re&&(t._gsap.x||or(t,"x"))?i&&Og===i?e==="scale"?nE:sE:(Og=i||{})&&(e==="scale"?oE:aE):t.style&&!fu(t.style[e])?iE:~e.indexOf("-")?rE:ku(t,e)},core:{_removeProperty:ys,_getMatrix:ju}};Ae.utils.checkPrefix=fn,Ae.core.getStyleSaver=Zg,function(r,t,e,i){var s=Ee(r+","+t+","+e,function(n){nr[n]=1});Ee(t,function(n){De.units[n]="deg",$g[n]=1}),Ni[s[13]]=r+","+t,Ee(i,function(n){var o=n.split(":");Ni[o[1]]=s[o[0]]})}("x,y,z,scale,scaleX,scaleY,xPercent,yPercent","rotation,rotationX,rotationY,skewX,skewY","transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective","0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY"),Ee("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(r){De.units[r]="px"}),Ae.registerPlugin(iy);var ry=Ae.registerPlugin(iy)||Ae;ry.core.Tween;const _s=new pt;class bE{constructor(t={}){this._recursive=typeof t.recursive=="boolean"?t.recursive:!0,this._toggle=t.toggle||"visible",this._targetList=new Set}add(t){return this._targetList.add(t),this}addAll(t){for(let e=0,i=t.length;e<i;e++)this._targetList.add(t[e]);return this}remove(t){return this._targetList.delete(t),this}removeAll(t){for(let e=0,i=t.length;e<i;e++)this._targetList.delete(t[e]);return this}clear(){return this._targetList.clear(),this}cull(t,e=!1){return e||this.uncull(),this._targetList.forEach(i=>{e||i.getBounds(!1,_s),this._recursive?this.cullRecursive(t,i,e):(e&&i._bounds.getRectangle(t),i[this._toggle]=_s.right>t.left&&_s.left<t.right&&_s.bottom>t.top&&_s.top<t.bottom)}),this}uncull(){return this._targetList.forEach(t=>{this._recursive?this.uncullRecursive(t):t[this._toggle]=!1}),this}cullRecursive(t,e,i){const s=i?e._bounds.getRectangle(_s):e.getBounds(!0,_s);if(e[this._toggle]=s.right>t.left&&s.left<t.right&&s.bottom>t.top&&s.top<t.bottom,!(s.left>=t.left&&s.top>=t.top&&s.right<=t.right&&s.bottom<=t.bottom)&&e[this._toggle]&&e.children&&e.children.length){const o=e.children;for(let a=0,h=o.length;a<h;a++)this.cullRecursive(t,o[a])}}uncullRecursive(t){if(t[this._toggle]=!0,t.children&&t.children.length){const e=t.children;for(let i=0,s=e.length;i<s;i++)this.uncullRecursive(e[i])}}}var _h={exports:{}};_h.exports,function(r,t){var e=200,i="__lodash_hash_undefined__",s=1,n=2,o=9007199254740991,a="[object Arguments]",h="[object Array]",l="[object AsyncFunction]",c="[object Boolean]",u="[object Date]",d="[object Error]",f="[object Function]",m="[object GeneratorFunction]",p="[object Map]",g="[object Number]",y="[object Null]",_="[object Object]",b="[object Promise]",v="[object Proxy]",w="[object RegExp]",C="[object Set]",E="[object String]",A="[object Symbol]",R="[object Undefined]",G="[object WeakMap]",N="[object ArrayBuffer]",P="[object DataView]",I="[object Float32Array]",D="[object Float64Array]",X="[object Int8Array]",H="[object Int16Array]",Z="[object Int32Array]",j="[object Uint8Array]",O="[object Uint8ClampedArray]",k="[object Uint16Array]",F="[object Uint32Array]",V=/[\\^$.*+?()[\]{}|]/g,$=/^\[object .+?Constructor\]$/,dt=/^(?:0|[1-9]\d*)$/,ot={};ot[I]=ot[D]=ot[X]=ot[H]=ot[Z]=ot[j]=ot[O]=ot[k]=ot[F]=!0,ot[a]=ot[h]=ot[N]=ot[c]=ot[P]=ot[u]=ot[d]=ot[f]=ot[p]=ot[g]=ot[_]=ot[w]=ot[C]=ot[E]=ot[G]=!1;var Et=typeof xe=="object"&&xe&&xe.Object===Object&&xe,Mt=typeof self=="object"&&self&&self.Object===Object&&self,_t=Et||Mt||Function("return this")(),Y=t&&!t.nodeType&&t,tt=Y&&!0&&r&&!r.nodeType&&r,et=tt&&tt.exports===Y,B=et&&Et.process,xt=function(){try{return B&&B.binding&&B.binding("util")}catch{}}(),yt=xt&&xt.isTypedArray;function Lt(T,M){for(var x=-1,S=T==null?0:T.length,L=0,U=[];++x<S;){var lt=T[x];M(lt,x,T)&&(U[L++]=lt)}return U}function Zt(T,M){for(var x=-1,S=M.length,L=T.length;++x<S;)T[L+x]=M[x];return T}function Xe(T,M){for(var x=-1,S=T==null?0:T.length;++x<S;)if(M(T[x],x,T))return!0;return!1}function pi(T,M){for(var x=-1,S=Array(T);++x<T;)S[x]=M(x);return S}function Fd(T){return function(M){return T(M)}}function Tn(T,M){return T.has(M)}function No(T,M){return T==null?void 0:T[M]}function wn(T){var M=-1,x=Array(T.size);return T.forEach(function(S,L){x[++M]=[L,S]}),x}function mi(T,M){return function(x){return T(M(x))}}function Kh(T){var M=-1,x=Array(T.size);return T.forEach(function(S){x[++M]=S}),x}var Yh=Array.prototype,Nd=Function.prototype,Sn=Object.prototype,Wr=_t["__core-js_shared__"],Do=Nd.toString,Ze=Sn.hasOwnProperty,ko=function(){var T=/[^.]+$/.exec(Wr&&Wr.keys&&Wr.keys.IE_PROTO||"");return T?"Symbol(src)_1."+T:""}(),Oo=Sn.toString,zh=RegExp("^"+Do.call(Ze).replace(V,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),jh=et?_t.Buffer:void 0,Cn=_t.Symbol,Wi=_t.Uint8Array,As=Sn.propertyIsEnumerable,Dd=Yh.splice,Ui=Cn?Cn.toStringTag:void 0,Jh=Object.getOwnPropertySymbols,$h=jh?jh.isBuffer:void 0,Rs=mi(Object.keys,Object),Bo=pr(_t,"DataView"),Ve=pr(_t,"Map"),Wo=pr(_t,"Promise"),Uo=pr(_t,"Set"),Xo=pr(_t,"WeakMap"),Ms=pr(Object,"create"),kd=yi(Bo),gi=yi(Ve),Od=yi(Wo),Bd=yi(Uo),Wd=yi(Xo),Qh=Cn?Cn.prototype:void 0,Zo=Qh?Qh.valueOf:void 0;function Pe(T){var M=-1,x=T==null?0:T.length;for(this.clear();++M<x;){var S=T[M];this.set(S[0],S[1])}}function Ud(){this.__data__=Ms?Ms(null):{},this.size=0}function Xd(T){var M=this.has(T)&&delete this.__data__[T];return this.size-=M?1:0,M}function Zd(T){var M=this.__data__;if(Ms){var x=M[T];return x===i?void 0:x}return Ze.call(M,T)?M[T]:void 0}function Vd(T){var M=this.__data__;return Ms?M[T]!==void 0:Ze.call(M,T)}function Hd(T,M){var x=this.__data__;return this.size+=this.has(T)?0:1,x[T]=Ms&&M===void 0?i:M,this}Pe.prototype.clear=Ud,Pe.prototype.delete=Xd,Pe.prototype.get=Zd,Pe.prototype.has=Vd,Pe.prototype.set=Hd;function ye(T){var M=-1,x=T==null?0:T.length;for(this.clear();++M<x;){var S=T[M];this.set(S[0],S[1])}}function Kd(){this.__data__=[],this.size=0}function Yd(T){var M=this.__data__,x=In(M,T);if(x<0)return!1;var S=M.length-1;return x==S?M.pop():Dd.call(M,x,1),--this.size,!0}function zd(T){var M=this.__data__,x=In(M,T);return x<0?void 0:M[x][1]}function jd(T){return In(this.__data__,T)>-1}function Jd(T,M){var x=this.__data__,S=In(x,T);return S<0?(++this.size,x.push([T,M])):x[S][1]=M,this}ye.prototype.clear=Kd,ye.prototype.delete=Yd,ye.prototype.get=zd,ye.prototype.has=jd,ye.prototype.set=Jd;function dr(T){var M=-1,x=T==null?0:T.length;for(this.clear();++M<x;){var S=T[M];this.set(S[0],S[1])}}function Vo(){this.size=0,this.__data__={hash:new Pe,map:new(Ve||ye),string:new Pe}}function $d(T){var M=Rn(this,T).delete(T);return this.size-=M?1:0,M}function En(T){return Rn(this,T).get(T)}function Ho(T){return Rn(this,T).has(T)}function Qd(T,M){var x=Rn(this,T),S=x.size;return x.set(T,M),this.size+=x.size==S?0:1,this}dr.prototype.clear=Vo,dr.prototype.delete=$d,dr.prototype.get=En,dr.prototype.has=Ho,dr.prototype.set=Qd;function fr(T){var M=-1,x=T==null?0:T.length;for(this.__data__=new dr;++M<x;)this.add(T[M])}function qh(T){return this.__data__.set(T,i),this}function qd(T){return this.__data__.has(T)}fr.prototype.add=fr.prototype.push=qh,fr.prototype.has=qd;function Xi(T){var M=this.__data__=new ye(T);this.size=M.size}function tf(){this.__data__=new ye,this.size=0}function tl(T){var M=this.__data__,x=M.delete(T);return this.size=M.size,x}function ef(T){return this.__data__.get(T)}function rf(T){return this.__data__.has(T)}function sf(T,M){var x=this.__data__;if(x instanceof ye){var S=x.__data__;if(!Ve||S.length<e-1)return S.push([T,M]),this.size=++x.size,this;x=this.__data__=new dr(S)}return x.set(T,M),this.size=x.size,this}Xi.prototype.clear=tf,Xi.prototype.delete=tl,Xi.prototype.get=ef,Xi.prototype.has=rf,Xi.prototype.set=sf;function nf(T,M){var x=Pn(T),S=!x&&zo(T),L=!x&&!S&&Ps(T),U=!x&&!S&&!L&&ll(T),lt=x||S||L||U,mt=lt?pi(T.length,String):[],bt=mt.length;for(var at in T)(M||Ze.call(T,at))&&!(lt&&(at=="length"||L&&(at=="offset"||at=="parent")||U&&(at=="buffer"||at=="byteLength"||at=="byteOffset")||Yo(at,bt)))&&mt.push(at);return mt}function In(T,M){for(var x=T.length;x--;)if(Ln(T[x][0],M))return x;return-1}function of(T,M,x){var S=M(T);return Pn(T)?S:Zt(S,x(T))}function Ls(T){return T==null?T===void 0?R:y:Ui&&Ui in Object(T)?cf(T):Mn(T)}function el(T){return Xr(T)&&Ls(T)==a}function il(T,M,x,S,L){return T===M?!0:T==null||M==null||!Xr(T)&&!Xr(M)?T!==T&&M!==M:af(T,M,x,S,il,L)}function af(T,M,x,S,L,U){var lt=Pn(T),mt=Pn(M),bt=lt?h:Zi(T),at=mt?h:Zi(M);bt=bt==a?_:bt,at=at==a?_:at;var vt=bt==_,kt=at==_,Rt=bt==at;if(Rt&&Ps(T)){if(!Ps(M))return!1;lt=!0,vt=!1}if(Rt&&!vt)return U||(U=new Xi),lt||ll(T)?rl(T,M,x,S,L,U):sl(T,M,bt,x,S,L,U);if(!(x&s)){var he=vt&&Ze.call(T,"__wrapped__"),be=kt&&Ze.call(M,"__wrapped__");if(he||be){var ii=he?T.value():T,ri=be?M.value():M;return U||(U=new Xi),L(ii,ri,x,S,U)}}return Rt?(U||(U=new Xi),lf(T,M,x,S,L,U)):!1}function An(T){if(!hl(T)||ff(T))return!1;var M=Vi(T)?zh:$;return M.test(yi(T))}function Ko(T){return Xr(T)&&Ur(T.length)&&!!ot[Ls(T)]}function hf(T){if(!pf(T))return Rs(T);var M=[];for(var x in Object(T))Ze.call(T,x)&&x!="constructor"&&M.push(x);return M}function rl(T,M,x,S,L,U){var lt=x&s,mt=T.length,bt=M.length;if(mt!=bt&&!(lt&&bt>mt))return!1;var at=U.get(T);if(at&&U.get(M))return at==M;var vt=-1,kt=!0,Rt=x&n?new fr:void 0;for(U.set(T,M),U.set(M,T);++vt<mt;){var he=T[vt],be=M[vt];if(S)var ii=lt?S(be,he,vt,M,T,U):S(he,be,vt,T,M,U);if(ii!==void 0){if(ii)continue;kt=!1;break}if(Rt){if(!Xe(M,function(ri,Gs){if(!Tn(Rt,Gs)&&(he===ri||L(he,ri,x,S,U)))return Rt.push(Gs)})){kt=!1;break}}else if(!(he===be||L(he,be,x,S,U))){kt=!1;break}}return U.delete(T),U.delete(M),kt}function sl(T,M,x,S,L,U,lt){switch(x){case P:if(T.byteLength!=M.byteLength||T.byteOffset!=M.byteOffset)return!1;T=T.buffer,M=M.buffer;case N:return!(T.byteLength!=M.byteLength||!U(new Wi(T),new Wi(M)));case c:case u:case g:return Ln(+T,+M);case d:return T.name==M.name&&T.message==M.message;case w:case E:return T==M+"";case p:var mt=wn;case C:var bt=S&s;if(mt||(mt=Kh),T.size!=M.size&&!bt)return!1;var at=lt.get(T);if(at)return at==M;S|=n,lt.set(T,M);var vt=rl(mt(T),mt(M),S,L,U,lt);return lt.delete(T),vt;case A:if(Zo)return Zo.call(T)==Zo.call(M)}return!1}function lf(T,M,x,S,L,U){var lt=x&s,mt=nl(T),bt=mt.length,at=nl(M),vt=at.length;if(bt!=vt&&!lt)return!1;for(var kt=bt;kt--;){var Rt=mt[kt];if(!(lt?Rt in M:Ze.call(M,Rt)))return!1}var he=U.get(T);if(he&&U.get(M))return he==M;var be=!0;U.set(T,M),U.set(M,T);for(var ii=lt;++kt<bt;){Rt=mt[kt];var ri=T[Rt],Gs=M[Rt];if(S)var Pb=lt?S(Gs,ri,Rt,M,T,U):S(ri,Gs,Rt,T,M,U);if(!(Pb===void 0?ri===Gs||L(ri,Gs,x,S,U):Pb)){be=!1;break}ii||(ii=Rt=="constructor")}if(be&&!ii){var ul=T.constructor,dl=M.constructor;ul!=dl&&"constructor"in T&&"constructor"in M&&!(typeof ul=="function"&&ul instanceof ul&&typeof dl=="function"&&dl instanceof dl)&&(be=!1)}return U.delete(T),U.delete(M),be}function nl(T){return of(T,cl,uf)}function Rn(T,M){var x=T.__data__;return df(M)?x[typeof M=="string"?"string":"hash"]:x.map}function pr(T,M){var x=No(T,M);return An(x)?x:void 0}function cf(T){var M=Ze.call(T,Ui),x=T[Ui];try{T[Ui]=void 0;var S=!0}catch{}var L=Oo.call(T);return S&&(M?T[Ui]=x:delete T[Ui]),L}var uf=Jh?function(T){return T==null?[]:(T=Object(T),Lt(Jh(T),function(M){return As.call(T,M)}))}:mf,Zi=Ls;(Bo&&Zi(new Bo(new ArrayBuffer(1)))!=P||Ve&&Zi(new Ve)!=p||Wo&&Zi(Wo.resolve())!=b||Uo&&Zi(new Uo)!=C||Xo&&Zi(new Xo)!=G)&&(Zi=function(T){var M=Ls(T),x=M==_?T.constructor:void 0,S=x?yi(x):"";if(S)switch(S){case kd:return P;case gi:return p;case Od:return b;case Bd:return C;case Wd:return G}return M});function Yo(T,M){return M=M??o,!!M&&(typeof T=="number"||dt.test(T))&&T>-1&&T%1==0&&T<M}function df(T){var M=typeof T;return M=="string"||M=="number"||M=="symbol"||M=="boolean"?T!=="__proto__":T===null}function ff(T){return!!ko&&ko in T}function pf(T){var M=T&&T.constructor,x=typeof M=="function"&&M.prototype||Sn;return T===x}function Mn(T){return Oo.call(T)}function yi(T){if(T!=null){try{return Do.call(T)}catch{}try{return T+""}catch{}}return""}function Ln(T,M){return T===M||T!==T&&M!==M}var zo=el(function(){return arguments}())?el:function(T){return Xr(T)&&Ze.call(T,"callee")&&!As.call(T,"callee")},Pn=Array.isArray;function ol(T){return T!=null&&Ur(T.length)&&!Vi(T)}var Ps=$h||gf;function al(T,M){return il(T,M)}function Vi(T){if(!hl(T))return!1;var M=Ls(T);return M==f||M==m||M==l||M==v}function Ur(T){return typeof T=="number"&&T>-1&&T%1==0&&T<=o}function hl(T){var M=typeof T;return T!=null&&(M=="object"||M=="function")}function Xr(T){return T!=null&&typeof T=="object"}var ll=yt?Fd(yt):Ko;function cl(T){return ol(T)?nf(T):hf(T)}function mf(){return[]}function gf(){return!1}r.exports=al}(_h,_h.exports);var xE=_h.exports;const sy=Ds(xE);var _E=Object.defineProperty,vE=(r,t,e)=>t in r?_E(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,W=(r,t,e)=>(vE(r,typeof t!="symbol"?t+"":t,e),e);class qe{constructor(t){W(this,"parent"),W(this,"paused"),this.parent=t,this.paused=!1}destroy(){}down(t){return!1}move(t){return!1}up(t){return!1}wheel(t){return!1}update(t){}resize(){}reset(){}pause(){this.paused=!0}resume(){this.paused=!1}}var TE=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ny={exports:{}};(function(r,t){(function(){var e,i;i=function(s){return r.exports=s},e={linear:function(s,n,o,a){return o*s/a+n},easeInQuad:function(s,n,o,a){return o*(s/=a)*s+n},easeOutQuad:function(s,n,o,a){return-o*(s/=a)*(s-2)+n},easeInOutQuad:function(s,n,o,a){return(s/=a/2)<1?o/2*s*s+n:-o/2*(--s*(s-2)-1)+n},easeInCubic:function(s,n,o,a){return o*(s/=a)*s*s+n},easeOutCubic:function(s,n,o,a){return o*((s=s/a-1)*s*s+1)+n},easeInOutCubic:function(s,n,o,a){return(s/=a/2)<1?o/2*s*s*s+n:o/2*((s-=2)*s*s+2)+n},easeInQuart:function(s,n,o,a){return o*(s/=a)*s*s*s+n},easeOutQuart:function(s,n,o,a){return-o*((s=s/a-1)*s*s*s-1)+n},easeInOutQuart:function(s,n,o,a){return(s/=a/2)<1?o/2*s*s*s*s+n:-o/2*((s-=2)*s*s*s-2)+n},easeInQuint:function(s,n,o,a){return o*(s/=a)*s*s*s*s+n},easeOutQuint:function(s,n,o,a){return o*((s=s/a-1)*s*s*s*s+1)+n},easeInOutQuint:function(s,n,o,a){return(s/=a/2)<1?o/2*s*s*s*s*s+n:o/2*((s-=2)*s*s*s*s+2)+n},easeInSine:function(s,n,o,a){return-o*Math.cos(s/a*(Math.PI/2))+o+n},easeOutSine:function(s,n,o,a){return o*Math.sin(s/a*(Math.PI/2))+n},easeInOutSine:function(s,n,o,a){return-o/2*(Math.cos(Math.PI*s/a)-1)+n},easeInExpo:function(s,n,o,a){return s===0?n:o*Math.pow(2,10*(s/a-1))+n},easeOutExpo:function(s,n,o,a){return s===a?n+o:o*(-Math.pow(2,-10*s/a)+1)+n},easeInOutExpo:function(s,n,o,a){return(s/=a/2)<1?o/2*Math.pow(2,10*(s-1))+n:o/2*(-Math.pow(2,-10*--s)+2)+n},easeInCirc:function(s,n,o,a){return-o*(Math.sqrt(1-(s/=a)*s)-1)+n},easeOutCirc:function(s,n,o,a){return o*Math.sqrt(1-(s=s/a-1)*s)+n},easeInOutCirc:function(s,n,o,a){return(s/=a/2)<1?-o/2*(Math.sqrt(1-s*s)-1)+n:o/2*(Math.sqrt(1-(s-=2)*s)+1)+n},easeInElastic:function(s,n,o,a){var h,l,c;return c=1.70158,l=0,h=o,s===0||(s/=a),l||(l=a*.3),h<Math.abs(o)?(h=o,c=l/4):c=l/(2*Math.PI)*Math.asin(o/h),-(h*Math.pow(2,10*(s-=1))*Math.sin((s*a-c)*(2*Math.PI)/l))+n},easeOutElastic:function(s,n,o,a){var h,l,c;return c=1.70158,l=0,h=o,s===0||(s/=a),l||(l=a*.3),h<Math.abs(o)?(h=o,c=l/4):c=l/(2*Math.PI)*Math.asin(o/h),h*Math.pow(2,-10*s)*Math.sin((s*a-c)*(2*Math.PI)/l)+o+n},easeInOutElastic:function(s,n,o,a){var h,l,c;return c=1.70158,l=0,h=o,s===0||(s/=a/2),l||(l=a*(.3*1.5)),h<Math.abs(o)?(h=o,c=l/4):c=l/(2*Math.PI)*Math.asin(o/h),s<1?-.5*(h*Math.pow(2,10*(s-=1))*Math.sin((s*a-c)*(2*Math.PI)/l))+n:h*Math.pow(2,-10*(s-=1))*Math.sin((s*a-c)*(2*Math.PI)/l)*.5+o+n},easeInBack:function(s,n,o,a,h){return h===void 0&&(h=1.70158),o*(s/=a)*s*((h+1)*s-h)+n},easeOutBack:function(s,n,o,a,h){return h===void 0&&(h=1.70158),o*((s=s/a-1)*s*((h+1)*s+h)+1)+n},easeInOutBack:function(s,n,o,a,h){return h===void 0&&(h=1.70158),(s/=a/2)<1?o/2*(s*s*(((h*=1.525)+1)*s-h))+n:o/2*((s-=2)*s*(((h*=1.525)+1)*s+h)+2)+n},easeInBounce:function(s,n,o,a){var h;return h=e.easeOutBounce(a-s,0,o,a),o-h+n},easeOutBounce:function(s,n,o,a){return(s/=a)<1/2.75?o*(7.5625*s*s)+n:s<2/2.75?o*(7.5625*(s-=1.5/2.75)*s+.75)+n:s<2.5/2.75?o*(7.5625*(s-=2.25/2.75)*s+.9375)+n:o*(7.5625*(s-=2.625/2.75)*s+.984375)+n},easeInOutBounce:function(s,n,o,a){var h;return s<a/2?(h=e.easeInBounce(s*2,0,o,a),h*.5+n):(h=e.easeOutBounce(s*2-a,0,o,a),h*.5+o*.5+n)}},i(e)}).call(TE)})(ny);const oy=ny.exports;function vh(r,t){if(r){if(typeof r=="function")return r;if(typeof r=="string")return oy[r]}else return oy[t]}const wE={removeOnInterrupt:!1,ease:"linear",time:1e3};class SE extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"startX"),W(this,"startY"),W(this,"deltaX"),W(this,"deltaY"),W(this,"keepCenter"),W(this,"startWidth",null),W(this,"startHeight",null),W(this,"deltaWidth",null),W(this,"deltaHeight",null),W(this,"width",null),W(this,"height",null),W(this,"time",0),this.options=Object.assign({},wE,e),this.options.ease=vh(this.options.ease),this.setupPosition(),this.setupZoom(),this.time=0}setupPosition(){typeof this.options.position<"u"?(this.startX=this.parent.center.x,this.startY=this.parent.center.y,this.deltaX=this.options.position.x-this.parent.center.x,this.deltaY=this.options.position.y-this.parent.center.y,this.keepCenter=!1):this.keepCenter=!0}setupZoom(){this.width=null,this.height=null,typeof this.options.scale<"u"?this.width=this.parent.screenWidth/this.options.scale:typeof this.options.scaleX<"u"||typeof this.options.scaleY<"u"?(typeof this.options.scaleX<"u"&&(this.width=this.parent.screenWidth/this.options.scaleX),typeof this.options.scaleY<"u"&&(this.height=this.parent.screenHeight/this.options.scaleY)):(typeof this.options.width<"u"&&(this.width=this.options.width),typeof this.options.height<"u"&&(this.height=this.options.height)),this.width!==null&&(this.startWidth=this.parent.screenWidthInWorldPixels,this.deltaWidth=this.width-this.startWidth),this.height!==null&&(this.startHeight=this.parent.screenHeightInWorldPixels,this.deltaHeight=this.height-this.startHeight)}down(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("animate"),!1}complete(){this.parent.plugins.remove("animate"),this.width!==null&&this.parent.fitWidth(this.width,this.keepCenter,this.height===null),this.height!==null&&this.parent.fitHeight(this.height,this.keepCenter,this.width===null),!this.keepCenter&&this.options.position&&this.parent.moveCenter(this.options.position),this.parent.emit("animate-end",this.parent),this.options.callbackOnComplete&&this.options.callbackOnComplete(this.parent)}update(t){if(this.paused)return;this.time+=t;const e=new ut(this.parent.scale.x,this.parent.scale.y);if(this.time>=this.options.time){const i=this.parent.width,s=this.parent.height;this.complete(),(i!==this.parent.width||s!==this.parent.height)&&this.parent.emit("zoomed",{viewport:this.parent,original:e,type:"animate"})}else{const i=this.options.ease(this.time,0,1,this.options.time);if(this.width!==null){const s=this.startWidth,n=this.deltaWidth;this.parent.fitWidth(s+n*i,this.keepCenter,this.height===null)}if(this.height!==null){const s=this.startHeight,n=this.deltaHeight;this.parent.fitHeight(s+n*i,this.keepCenter,this.width===null)}if(this.width===null?this.parent.scale.x=this.parent.scale.y:this.height===null&&(this.parent.scale.y=this.parent.scale.x),!this.keepCenter){const s=this.startX,n=this.startY,o=this.deltaX,a=this.deltaY,h=new ut(this.parent.x,this.parent.y);this.parent.moveCenter(s+o*i,n+a*i),this.parent.emit("moved",{viewport:this.parent,original:h,type:"animate"})}(this.width||this.height)&&this.parent.emit("zoomed",{viewport:this.parent,original:e,type:"animate"})}}}const CE={sides:"all",friction:.5,time:150,ease:"easeInOutSine",underflow:"center",bounceBox:null};class EE extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"left"),W(this,"top"),W(this,"right"),W(this,"bottom"),W(this,"underflowX"),W(this,"underflowY"),W(this,"ease"),W(this,"toX"),W(this,"toY"),this.options=Object.assign({},CE,e),this.ease=vh(this.options.ease,"easeInOutSine"),this.options.sides?this.options.sides==="all"?this.top=this.bottom=this.left=this.right=!0:this.options.sides==="horizontal"?(this.right=this.left=!0,this.top=this.bottom=!1):this.options.sides==="vertical"?(this.left=this.right=!1,this.top=this.bottom=!0):(this.top=this.options.sides.indexOf("top")!==-1,this.bottom=this.options.sides.indexOf("bottom")!==-1,this.left=this.options.sides.indexOf("left")!==-1,this.right=this.options.sides.indexOf("right")!==-1):this.left=this.top=this.right=this.bottom=!1;const i=this.options.underflow.toLowerCase();i==="center"?(this.underflowX=0,this.underflowY=0):(this.underflowX=i.indexOf("left")!==-1?-1:i.indexOf("right")!==-1?1:0,this.underflowY=i.indexOf("top")!==-1?-1:i.indexOf("bottom")!==-1?1:0),this.reset()}isActive(){return this.toX!==null||this.toY!==null}down(){return this.toX=this.toY=null,!1}up(){return this.bounce(),!1}update(t){if(!this.paused){if(this.bounce(),this.toX){const e=this.toX;e.time+=t,this.parent.emit("moved",{viewport:this.parent,type:"bounce-x"}),e.time>=this.options.time?(this.parent.x=e.end,this.toX=null,this.parent.emit("bounce-x-end",this.parent)):this.parent.x=this.ease(e.time,e.start,e.delta,this.options.time)}if(this.toY){const e=this.toY;e.time+=t,this.parent.emit("moved",{viewport:this.parent,type:"bounce-y"}),e.time>=this.options.time?(this.parent.y=e.end,this.toY=null,this.parent.emit("bounce-y-end",this.parent)):this.parent.y=this.ease(e.time,e.start,e.delta,this.options.time)}}}calcUnderflowX(){let t;switch(this.underflowX){case-1:t=0;break;case 1:t=this.parent.screenWidth-this.parent.screenWorldWidth;break;default:t=(this.parent.screenWidth-this.parent.screenWorldWidth)/2}return t}calcUnderflowY(){let t;switch(this.underflowY){case-1:t=0;break;case 1:t=this.parent.screenHeight-this.parent.screenWorldHeight;break;default:t=(this.parent.screenHeight-this.parent.screenWorldHeight)/2}return t}oob(){const t=this.options.bounceBox;if(t){const e=typeof t.x>"u"?0:t.x,i=typeof t.y>"u"?0:t.y,s=typeof t.width>"u"?this.parent.worldWidth:t.width,n=typeof t.height>"u"?this.parent.worldHeight:t.height;return{left:this.parent.left<e,right:this.parent.right>s,top:this.parent.top<i,bottom:this.parent.bottom>n,topLeft:new ut(e*this.parent.scale.x,i*this.parent.scale.y),bottomRight:new ut(s*this.parent.scale.x-this.parent.screenWidth,n*this.parent.scale.y-this.parent.screenHeight)}}return{left:this.parent.left<0,right:this.parent.right>this.parent.worldWidth,top:this.parent.top<0,bottom:this.parent.bottom>this.parent.worldHeight,topLeft:new ut(0,0),bottomRight:new ut(this.parent.worldWidth*this.parent.scale.x-this.parent.screenWidth,this.parent.worldHeight*this.parent.scale.y-this.parent.screenHeight)}}bounce(){var t,e;if(this.paused)return;let i,s=this.parent.plugins.get("decelerate",!0);s&&(s.x||s.y)&&(s.x&&s.percentChangeX===((t=s.options)==null?void 0:t.friction)||s.y&&s.percentChangeY===((e=s.options)==null?void 0:e.friction))&&(i=this.oob(),(i.left&&this.left||i.right&&this.right)&&(s.percentChangeX=this.options.friction),(i.top&&this.top||i.bottom&&this.bottom)&&(s.percentChangeY=this.options.friction));const n=this.parent.plugins.get("drag",!0)||{},o=this.parent.plugins.get("pinch",!0)||{};if(s=s||{},!(n!=null&&n.active)&&!(o!=null&&o.active)&&(!this.toX||!this.toY)&&(!s.x||!s.y)){i=i||this.oob();const a=i.topLeft,h=i.bottomRight;if(!this.toX&&!s.x){let l=null;i.left&&this.left?l=this.parent.screenWorldWidth<this.parent.screenWidth?this.calcUnderflowX():-a.x:i.right&&this.right&&(l=this.parent.screenWorldWidth<this.parent.screenWidth?this.calcUnderflowX():-h.x),l!==null&&this.parent.x!==l&&(this.toX={time:0,start:this.parent.x,delta:l-this.parent.x,end:l},this.parent.emit("bounce-x-start",this.parent))}if(!this.toY&&!s.y){let l=null;i.top&&this.top?l=this.parent.screenWorldHeight<this.parent.screenHeight?this.calcUnderflowY():-a.y:i.bottom&&this.bottom&&(l=this.parent.screenWorldHeight<this.parent.screenHeight?this.calcUnderflowY():-h.y),l!==null&&this.parent.y!==l&&(this.toY={time:0,start:this.parent.y,delta:l-this.parent.y,end:l},this.parent.emit("bounce-y-start",this.parent))}}}reset(){this.toX=this.toY=null,this.bounce()}}const IE={left:!1,right:!1,top:!1,bottom:!1,direction:null,underflow:"center"};class AE extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"last"),W(this,"noUnderflow"),W(this,"underflowX"),W(this,"underflowY"),this.options=Object.assign({},IE,e),this.options.direction&&(this.options.left=this.options.direction==="x"||this.options.direction==="all"?!0:null,this.options.right=this.options.direction==="x"||this.options.direction==="all"?!0:null,this.options.top=this.options.direction==="y"||this.options.direction==="all"?!0:null,this.options.bottom=this.options.direction==="y"||this.options.direction==="all"?!0:null),this.parseUnderflow(),this.last={x:null,y:null,scaleX:null,scaleY:null},this.update()}parseUnderflow(){const t=this.options.underflow.toLowerCase();t==="none"?this.noUnderflow=!0:t==="center"?(this.underflowX=this.underflowY=0,this.noUnderflow=!1):(this.underflowX=t.indexOf("left")!==-1?-1:t.indexOf("right")!==-1?1:0,this.underflowY=t.indexOf("top")!==-1?-1:t.indexOf("bottom")!==-1?1:0,this.noUnderflow=!1)}move(){return this.update(),!1}update(){if(this.paused||this.parent.x===this.last.x&&this.parent.y===this.last.y&&this.parent.scale.x===this.last.scaleX&&this.parent.scale.y===this.last.scaleY)return;const t=new ut(this.parent.x,this.parent.y),e=this.parent.plugins.decelerate||{};if(this.options.left!==null||this.options.right!==null){let i=!1;if(!this.noUnderflow&&this.parent.screenWorldWidth<this.parent.screenWidth)switch(this.underflowX){case-1:this.parent.x!==0&&(this.parent.x=0,i=!0);break;case 1:this.parent.x!==this.parent.screenWidth-this.parent.screenWorldWidth&&(this.parent.x=this.parent.screenWidth-this.parent.screenWorldWidth,i=!0);break;default:this.parent.x!==(this.parent.screenWidth-this.parent.screenWorldWidth)/2&&(this.parent.x=(this.parent.screenWidth-this.parent.screenWorldWidth)/2,i=!0)}else this.options.left!==null&&this.parent.left<(this.options.left===!0?0:this.options.left)&&(this.parent.x=-(this.options.left===!0?0:this.options.left)*this.parent.scale.x,e.x=0,i=!0),this.options.right!==null&&this.parent.right>(this.options.right===!0?this.parent.worldWidth:this.options.right)&&(this.parent.x=-(this.options.right===!0?this.parent.worldWidth:this.options.right)*this.parent.scale.x+this.parent.screenWidth,e.x=0,i=!0);i&&this.parent.emit("moved",{viewport:this.parent,original:t,type:"clamp-x"})}if(this.options.top!==null||this.options.bottom!==null){let i=!1;if(!this.noUnderflow&&this.parent.screenWorldHeight<this.parent.screenHeight)switch(this.underflowY){case-1:this.parent.y!==0&&(this.parent.y=0,i=!0);break;case 1:this.parent.y!==this.parent.screenHeight-this.parent.screenWorldHeight&&(this.parent.y=this.parent.screenHeight-this.parent.screenWorldHeight,i=!0);break;default:this.parent.y!==(this.parent.screenHeight-this.parent.screenWorldHeight)/2&&(this.parent.y=(this.parent.screenHeight-this.parent.screenWorldHeight)/2,i=!0)}else this.options.top!==null&&this.parent.top<(this.options.top===!0?0:this.options.top)&&(this.parent.y=-(this.options.top===!0?0:this.options.top)*this.parent.scale.y,e.y=0,i=!0),this.options.bottom!==null&&this.parent.bottom>(this.options.bottom===!0?this.parent.worldHeight:this.options.bottom)&&(this.parent.y=-(this.options.bottom===!0?this.parent.worldHeight:this.options.bottom)*this.parent.scale.y+this.parent.screenHeight,e.y=0,i=!0);i&&this.parent.emit("moved",{viewport:this.parent,original:t,type:"clamp-y"})}this.last.x=this.parent.x,this.last.y=this.parent.y,this.last.scaleX=this.parent.scale.x,this.last.scaleY=this.parent.scale.y}reset(){this.update()}}const RE={minWidth:null,minHeight:null,maxWidth:null,maxHeight:null,minScale:null,maxScale:null};class ME extends qe{constructor(t,e={}){super(t),W(this,"options"),this.options=Object.assign({},RE,e),this.clamp()}resize(){this.clamp()}clamp(){if(!this.paused){if(this.options.minWidth||this.options.minHeight||this.options.maxWidth||this.options.maxHeight){let t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight;if(this.options.minWidth!==null&&t<this.options.minWidth){const i=this.parent.scale.x;this.parent.fitWidth(this.options.minWidth,!1,!1,!0),this.parent.scale.y*=this.parent.scale.x/i,t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.maxWidth!==null&&t>this.options.maxWidth){const i=this.parent.scale.x;this.parent.fitWidth(this.options.maxWidth,!1,!1,!0),this.parent.scale.y*=this.parent.scale.x/i,t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.minHeight!==null&&e<this.options.minHeight){const i=this.parent.scale.y;this.parent.fitHeight(this.options.minHeight,!1,!1,!0),this.parent.scale.x*=this.parent.scale.y/i,t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.maxHeight!==null&&e>this.options.maxHeight){const i=this.parent.scale.y;this.parent.fitHeight(this.options.maxHeight,!1,!1,!0),this.parent.scale.x*=this.parent.scale.y/i,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}}else if(this.options.minScale||this.options.maxScale){const t={x:null,y:null},e={x:null,y:null};if(typeof this.options.minScale=="number")t.x=this.options.minScale,t.y=this.options.minScale;else if(this.options.minScale!==null){const n=this.options.minScale;t.x=typeof n.x>"u"?null:n.x,t.y=typeof n.y>"u"?null:n.y}if(typeof this.options.maxScale=="number")e.x=this.options.maxScale,e.y=this.options.maxScale;else if(this.options.maxScale!==null){const n=this.options.maxScale;e.x=typeof n.x>"u"?null:n.x,e.y=typeof n.y>"u"?null:n.y}let i=this.parent.scale.x,s=this.parent.scale.y;t.x!==null&&i<t.x&&(i=t.x),e.x!==null&&i>e.x&&(i=e.x),t.y!==null&&s<t.y&&(s=t.y),e.y!==null&&s>e.y&&(s=e.y),(i!==this.parent.scale.x||s!==this.parent.scale.y)&&(this.parent.scale.set(i,s),this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"}))}}}reset(){this.clamp()}}const LE={friction:.98,bounce:.8,minSpeed:.01},Or=16;class PE extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"x"),W(this,"y"),W(this,"percentChangeX"),W(this,"percentChangeY"),W(this,"saved"),W(this,"timeSinceRelease"),this.options=Object.assign({},LE,e),this.saved=[],this.timeSinceRelease=0,this.reset(),this.parent.on("moved",i=>this.handleMoved(i))}down(){return this.saved=[],this.x=this.y=null,!1}isActive(){return!!(this.x||this.y)}move(){if(this.paused)return!1;const t=this.parent.input.count();return(t===1||t>1&&!this.parent.plugins.get("pinch",!0))&&(this.saved.push({x:this.parent.x,y:this.parent.y,time:performance.now()}),this.saved.length>60&&this.saved.splice(0,30)),!1}handleMoved(t){if(this.saved.length){const e=this.saved[this.saved.length-1];t.type==="clamp-x"&&t.original?e.x===t.original.x&&(e.x=this.parent.x):t.type==="clamp-y"&&t.original&&e.y===t.original.y&&(e.y=this.parent.y)}}up(){if(this.parent.input.count()===0&&this.saved.length){const t=performance.now();for(const e of this.saved)if(e.time>=t-100){const i=t-e.time;this.x=(this.parent.x-e.x)/i,this.y=(this.parent.y-e.y)/i,this.percentChangeX=this.percentChangeY=this.options.friction,this.timeSinceRelease=0;break}}return!1}activate(t){t=t||{},typeof t.x<"u"&&(this.x=t.x,this.percentChangeX=this.options.friction),typeof t.y<"u"&&(this.y=t.y,this.percentChangeY=this.options.friction)}update(t){if(this.paused)return;const e=this.x||this.y,i=this.timeSinceRelease,s=this.timeSinceRelease+t;if(this.x){const n=this.percentChangeX,o=Math.log(n);this.parent.x+=this.x*Or/o*(Math.pow(n,s/Or)-Math.pow(n,i/Or)),this.x*=Math.pow(this.percentChangeX,t/Or)}if(this.y){const n=this.percentChangeY,o=Math.log(n);this.parent.y+=this.y*Or/o*(Math.pow(n,s/Or)-Math.pow(n,i/Or)),this.y*=Math.pow(this.percentChangeY,t/Or)}this.timeSinceRelease+=t,this.x&&this.y?Math.abs(this.x)<this.options.minSpeed&&Math.abs(this.y)<this.options.minSpeed&&(this.x=0,this.y=0):(Math.abs(this.x||0)<this.options.minSpeed&&(this.x=0),Math.abs(this.y||0)<this.options.minSpeed&&(this.y=0)),e&&this.parent.emit("moved",{viewport:this.parent,type:"decelerate"})}reset(){this.x=this.y=null}}const GE={direction:"all",pressDrag:!0,wheel:!0,wheelScroll:1,reverse:!1,clampWheel:!1,underflow:"center",factor:1,mouseButtons:"all",keyToPress:null,ignoreKeyToPressOnTouch:!1,lineHeight:20,wheelSwapAxes:!1};class FE extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"moved"),W(this,"reverse"),W(this,"xDirection"),W(this,"yDirection"),W(this,"keyIsPressed"),W(this,"mouse"),W(this,"underflowX"),W(this,"underflowY"),W(this,"last"),W(this,"current"),W(this,"windowEventHandlers",[]),this.options=Object.assign({},GE,e),this.moved=!1,this.reverse=this.options.reverse?1:-1,this.xDirection=!this.options.direction||this.options.direction==="all"||this.options.direction==="x",this.yDirection=!this.options.direction||this.options.direction==="all"||this.options.direction==="y",this.keyIsPressed=!1,this.parseUnderflow(),this.mouseButtons(this.options.mouseButtons),this.options.keyToPress&&this.handleKeyPresses(this.options.keyToPress)}handleKeyPresses(t){const e=s=>{t.includes(s.code)&&(this.keyIsPressed=!0)},i=s=>{t.includes(s.code)&&(this.keyIsPressed=!1)};this.addWindowEventHandler("keyup",i),this.addWindowEventHandler("keydown",e)}addWindowEventHandler(t,e){window.addEventListener(t,e),this.windowEventHandlers.push({event:t,handler:e})}destroy(){this.windowEventHandlers.forEach(({event:t,handler:e})=>{window.removeEventListener(t,e)})}mouseButtons(t){!t||t==="all"?this.mouse=[!0,!0,!0]:this.mouse=[t.indexOf("left")!==-1,t.indexOf("middle")!==-1,t.indexOf("right")!==-1]}parseUnderflow(){const t=this.options.underflow.toLowerCase();t==="center"?(this.underflowX=0,this.underflowY=0):(t.includes("left")?this.underflowX=-1:t.includes("right")?this.underflowX=1:this.underflowX=0,t.includes("top")?this.underflowY=-1:t.includes("bottom")?this.underflowY=1:this.underflowY=0)}checkButtons(t){const e=t.pointerType==="mouse",i=this.parent.input.count();return!!((i===1||i>1&&!this.parent.plugins.get("pinch",!0))&&(!e||this.mouse[t.button]))}checkKeyPress(t){return!this.options.keyToPress||this.keyIsPressed||this.options.ignoreKeyToPressOnTouch&&t.data.pointerType==="touch"}down(t){return this.paused||!this.options.pressDrag?!1:this.checkButtons(t)&&this.checkKeyPress(t)?(this.last={x:t.global.x,y:t.global.y},this.current=t.pointerId,!0):(this.last=null,!1)}get active(){return this.moved}move(t){if(this.paused||!this.options.pressDrag)return!1;if(this.last&&this.current===t.data.pointerId){const e=t.global.x,i=t.global.y,s=this.parent.input.count();if(s===1||s>1&&!this.parent.plugins.get("pinch",!0)){const n=e-this.last.x,o=i-this.last.y;if(this.moved||this.xDirection&&this.parent.input.checkThreshold(n)||this.yDirection&&this.parent.input.checkThreshold(o)){const a={x:e,y:i};return this.xDirection&&(this.parent.x+=(a.x-this.last.x)*this.options.factor),this.yDirection&&(this.parent.y+=(a.y-this.last.y)*this.options.factor),this.last=a,this.moved||this.parent.emit("drag-start",{event:t,screen:new ut(this.last.x,this.last.y),world:this.parent.toWorld(new ut(this.last.x,this.last.y)),viewport:this.parent}),this.moved=!0,this.parent.emit("moved",{viewport:this.parent,type:"drag"}),!0}}else this.moved=!1}return!1}up(t){if(this.paused)return!1;const e=this.parent.input.touches;if(e.length===1){const i=e[0];return i.last&&(this.last={x:i.last.x,y:i.last.y},this.current=i.id),this.moved=!1,!0}else if(this.last&&this.moved){const i=new ut(this.last.x,this.last.y);return this.parent.emit("drag-end",{event:t,screen:i,world:this.parent.toWorld(i),viewport:this.parent}),this.last=null,this.moved=!1,!0}return!1}wheel(t){if(this.paused)return!1;if(this.options.wheel){const e=this.parent.plugins.get("wheel",!0);if(!e||!e.options.wheelZoom&&!t.ctrlKey){const i=t.deltaMode?this.options.lineHeight:1,s=[t.deltaX,t.deltaY],[n,o]=this.options.wheelSwapAxes?s.reverse():s;return this.xDirection&&(this.parent.x+=n*i*this.options.wheelScroll*this.reverse),this.yDirection&&(this.parent.y+=o*i*this.options.wheelScroll*this.reverse),this.options.clampWheel&&this.clamp(),this.parent.emit("wheel-scroll",this.parent),this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.options.passiveWheel||t.preventDefault(),this.parent.options.stopPropagation&&t.stopPropagation(),!0}}return!1}resume(){this.last=null,this.paused=!1}clamp(){const t=this.parent.plugins.get("decelerate",!0)||{};if(this.options.clampWheel!=="y")if(this.parent.screenWorldWidth<this.parent.screenWidth)switch(this.underflowX){case-1:this.parent.x=0;break;case 1:this.parent.x=this.parent.screenWidth-this.parent.screenWorldWidth;break;default:this.parent.x=(this.parent.screenWidth-this.parent.screenWorldWidth)/2}else this.parent.left<0?(this.parent.x=0,t.x=0):this.parent.right>this.parent.worldWidth&&(this.parent.x=-this.parent.worldWidth*this.parent.scale.x+this.parent.screenWidth,t.x=0);if(this.options.clampWheel!=="x")if(this.parent.screenWorldHeight<this.parent.screenHeight)switch(this.underflowY){case-1:this.parent.y=0;break;case 1:this.parent.y=this.parent.screenHeight-this.parent.screenWorldHeight;break;default:this.parent.y=(this.parent.screenHeight-this.parent.screenWorldHeight)/2}else this.parent.top<0&&(this.parent.y=0,t.y=0),this.parent.bottom>this.parent.worldHeight&&(this.parent.y=-this.parent.worldHeight*this.parent.scale.y+this.parent.screenHeight,t.y=0)}}const NE={speed:0,acceleration:null,radius:null};class DE extends qe{constructor(t,e,i={}){super(t),W(this,"options"),W(this,"target"),W(this,"velocity"),this.target=e,this.options=Object.assign({},NE,i),this.velocity={x:0,y:0}}update(t){if(this.paused)return;const e=this.parent.center;let i=this.target.x,s=this.target.y;if(this.options.radius)if(Math.sqrt(Math.pow(this.target.y-e.y,2)+Math.pow(this.target.x-e.x,2))>this.options.radius){const a=Math.atan2(this.target.y-e.y,this.target.x-e.x);i=this.target.x-Math.cos(a)*this.options.radius,s=this.target.y-Math.sin(a)*this.options.radius}else return;const n=i-e.x,o=s-e.y;if(n||o)if(this.options.speed)if(this.options.acceleration){const a=Math.atan2(s-e.y,i-e.x),h=Math.sqrt(Math.pow(n,2)+Math.pow(o,2));if(h){const l=(Math.pow(this.velocity.x,2)+Math.pow(this.velocity.y,2))/(2*this.options.acceleration);h>l?this.velocity={x:Math.min(this.velocity.x+(this.options.acceleration*t,this.options.speed)),y:Math.min(this.velocity.y+(this.options.acceleration*t,this.options.speed))}:this.velocity={x:Math.max(this.velocity.x-this.options.acceleration*this.options.speed,0),y:Math.max(this.velocity.y-this.options.acceleration*this.options.speed,0)};const c=Math.cos(a)*this.velocity.x,u=Math.sin(a)*this.velocity.y,d=Math.abs(c)>Math.abs(n)?i:e.x+c,f=Math.abs(u)>Math.abs(o)?s:e.y+u;this.parent.moveCenter(d,f),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}else{const a=Math.atan2(s-e.y,i-e.x),h=Math.cos(a)*this.options.speed,l=Math.sin(a)*this.options.speed,c=Math.abs(h)>Math.abs(n)?i:e.x+h,u=Math.abs(l)>Math.abs(o)?s:e.y+l;this.parent.moveCenter(c,u),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}else this.parent.moveCenter(i,s),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}const kE={radius:null,distance:null,top:null,bottom:null,left:null,right:null,speed:8,reverse:!1,noDecelerate:!1,linear:!1,allowButtons:!1};class OE extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"reverse"),W(this,"radiusSquared"),W(this,"left"),W(this,"top"),W(this,"right"),W(this,"bottom"),W(this,"horizontal"),W(this,"vertical"),this.options=Object.assign({},kE,e),this.reverse=this.options.reverse?1:-1,this.radiusSquared=typeof this.options.radius=="number"?Math.pow(this.options.radius,2):null,this.resize()}resize(){const t=this.options.distance;t!==null?(this.left=t,this.top=t,this.right=this.parent.screenWidth-t,this.bottom=this.parent.screenHeight-t):this.options.radius||(this.left=this.options.left,this.top=this.options.top,this.right=this.options.right===null?null:this.parent.screenWidth-this.options.right,this.bottom=this.options.bottom===null?null:this.parent.screenHeight-this.options.bottom)}down(){return this.paused||this.options.allowButtons||(this.horizontal=this.vertical=null),!1}move(t){if(this.paused||t.pointerType!=="mouse"&&t.pointerId!==1||!this.options.allowButtons&&t.buttons!==0)return!1;const e=t.global.x,i=t.global.y;if(this.radiusSquared){const s=this.parent.toScreen(this.parent.center);if(Math.pow(s.x-e,2)+Math.pow(s.y-i,2)>=this.radiusSquared){const n=Math.atan2(s.y-i,s.x-e);this.options.linear?(this.horizontal=Math.round(Math.cos(n))*this.options.speed*this.reverse*(60/1e3),this.vertical=Math.round(Math.sin(n))*this.options.speed*this.reverse*(60/1e3)):(this.horizontal=Math.cos(n)*this.options.speed*this.reverse*(60/1e3),this.vertical=Math.sin(n)*this.options.speed*this.reverse*(60/1e3))}else this.horizontal&&this.decelerateHorizontal(),this.vertical&&this.decelerateVertical(),this.horizontal=this.vertical=0}else this.left!==null&&e<this.left?this.horizontal=Number(this.reverse)*this.options.speed*(60/1e3):this.right!==null&&e>this.right?this.horizontal=-1*this.reverse*this.options.speed*(60/1e3):(this.decelerateHorizontal(),this.horizontal=0),this.top!==null&&i<this.top?this.vertical=Number(this.reverse)*this.options.speed*(60/1e3):this.bottom!==null&&i>this.bottom?this.vertical=-1*this.reverse*this.options.speed*(60/1e3):(this.decelerateVertical(),this.vertical=0);return!1}decelerateHorizontal(){const t=this.parent.plugins.get("decelerate",!0);this.horizontal&&t&&!this.options.noDecelerate&&t.activate({x:this.horizontal*this.options.speed*this.reverse/(1e3/60)})}decelerateVertical(){const t=this.parent.plugins.get("decelerate",!0);this.vertical&&t&&!this.options.noDecelerate&&t.activate({y:this.vertical*this.options.speed*this.reverse/(1e3/60)})}up(){return this.paused||(this.horizontal&&this.decelerateHorizontal(),this.vertical&&this.decelerateVertical(),this.horizontal=this.vertical=null),!1}update(){if(!this.paused&&(this.horizontal||this.vertical)){const t=this.parent.center;this.horizontal&&(t.x+=this.horizontal*this.options.speed),this.vertical&&(t.y+=this.vertical*this.options.speed),this.parent.moveCenter(t),this.parent.emit("moved",{viewport:this.parent,type:"mouse-edges"})}}}const BE={noDrag:!1,percent:1,center:null,factor:1,axis:"all"};class WE extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"active",!1),W(this,"pinching",!1),W(this,"moved",!1),W(this,"lastCenter"),this.options=Object.assign({},BE,e)}down(){return this.parent.input.count()>=2?(this.active=!0,!0):!1}isAxisX(){return["all","x"].includes(this.options.axis)}isAxisY(){return["all","y"].includes(this.options.axis)}move(t){if(this.paused||!this.active)return!1;const e=t.global.x,i=t.global.y,s=this.parent.input.touches;if(s.length>=2){const n=s[0],o=s[1],a=n.last&&o.last?Math.sqrt(Math.pow(o.last.x-n.last.x,2)+Math.pow(o.last.y-n.last.y,2)):null;if(n.id===t.pointerId?n.last={x:e,y:i,data:t}:o.id===t.pointerId&&(o.last={x:e,y:i,data:t}),a){let h;const l=new ut(n.last.x+(o.last.x-n.last.x)/2,n.last.y+(o.last.y-n.last.y)/2);this.options.center||(h=this.parent.toLocal(l));let c=Math.sqrt(Math.pow(o.last.x-n.last.x,2)+Math.pow(o.last.y-n.last.y,2));c=c===0?c=1e-10:c;const u=(1-a/c)*this.options.percent*(this.isAxisX()?this.parent.scale.x:this.parent.scale.y);this.isAxisX()&&(this.parent.scale.x+=u),this.isAxisY()&&(this.parent.scale.y+=u),this.parent.emit("zoomed",{viewport:this.parent,type:"pinch",center:l});const d=this.parent.plugins.get("clamp-zoom",!0);if(d&&d.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const f=this.parent.toGlobal(h);this.parent.x+=(l.x-f.x)*this.options.factor,this.parent.y+=(l.y-f.y)*this.options.factor,this.parent.emit("moved",{viewport:this.parent,type:"pinch"})}!this.options.noDrag&&this.lastCenter&&(this.parent.x+=(l.x-this.lastCenter.x)*this.options.factor,this.parent.y+=(l.y-this.lastCenter.y)*this.options.factor,this.parent.emit("moved",{viewport:this.parent,type:"pinch"})),this.lastCenter=l,this.moved=!0}else this.pinching||(this.parent.emit("pinch-start",this.parent),this.pinching=!0);return!0}return!1}up(){return this.pinching&&this.parent.input.touches.length<=1?(this.active=!1,this.lastCenter=null,this.pinching=!1,this.moved=!1,this.parent.emit("pinch-end",this.parent),!0):!1}}const UE={topLeft:!1,friction:.8,time:1e3,ease:"easeInOutSine",interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1};class XE extends qe{constructor(t,e,i,s={}){super(t),W(this,"options"),W(this,"ease"),W(this,"x"),W(this,"y"),W(this,"percent"),W(this,"snapping"),W(this,"deltaX"),W(this,"deltaY"),W(this,"startX"),W(this,"startY"),this.options=Object.assign({},UE,s),this.ease=vh(s.ease,"easeInOutSine"),this.x=e,this.y=i,this.options.forceStart&&this.snapStart()}snapStart(){this.percent=0,this.snapping={time:0};const t=this.options.topLeft?this.parent.corner:this.parent.center;this.deltaX=this.x-t.x,this.deltaY=this.y-t.y,this.startX=t.x,this.startY=t.y,this.parent.emit("snap-start",this.parent)}wheel(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("snap"),!1}down(){return this.options.removeOnInterrupt?this.parent.plugins.remove("snap"):this.options.interrupt&&(this.snapping=null),!1}up(){if(this.parent.input.count()===0){const t=this.parent.plugins.get("decelerate",!0);t&&(t.x||t.y)&&(t.percentChangeX=t.percentChangeY=this.options.friction)}return!1}update(t){if(!this.paused&&!(this.options.interrupt&&this.parent.input.count()!==0))if(this.snapping){const e=this.snapping;e.time+=t;let i,s,n;const o=this.startX,a=this.startY,h=this.deltaX,l=this.deltaY;if(e.time>this.options.time)i=!0,s=o+h,n=a+l;else{const c=this.ease(e.time,0,1,this.options.time);s=o+h*c,n=a+l*c}this.options.topLeft?this.parent.moveCorner(s,n):this.parent.moveCenter(s,n),this.parent.emit("moved",{viewport:this.parent,type:"snap"}),i&&(this.options.removeOnComplete&&this.parent.plugins.remove("snap"),this.parent.emit("snap-end",this.parent),this.snapping=null)}else{const e=this.options.topLeft?this.parent.corner:this.parent.center;(e.x!==this.x||e.y!==this.y)&&this.snapStart()}}}const ZE={width:0,height:0,time:1e3,ease:"easeInOutSine",center:null,interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1,noMove:!1};class VE extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"ease"),W(this,"xScale"),W(this,"yScale"),W(this,"xIndependent"),W(this,"yIndependent"),W(this,"snapping"),this.options=Object.assign({},ZE,e),this.ease=vh(this.options.ease),this.xIndependent=!1,this.yIndependent=!1,this.xScale=0,this.yScale=0,this.options.width>0&&(this.xScale=t.screenWidth/this.options.width,this.xIndependent=!0),this.options.height>0&&(this.yScale=t.screenHeight/this.options.height,this.yIndependent=!0),this.xScale=this.xIndependent?this.xScale:this.yScale,this.yScale=this.yIndependent?this.yScale:this.xScale,this.options.time===0?(t.container.scale.x=this.xScale,t.container.scale.y=this.yScale,this.options.removeOnComplete&&this.parent.plugins.remove("snap-zoom")):e.forceStart&&this.createSnapping()}createSnapping(){const t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,i=this.parent.screenWidth/this.xScale,s=this.parent.screenHeight/this.yScale;this.snapping={time:0,startX:t,startY:e,deltaX:i-t,deltaY:s-e},this.parent.emit("snap-zoom-start",this.parent)}resize(){this.snapping=null,this.options.width>0&&(this.xScale=this.parent.screenWidth/this.options.width),this.options.height>0&&(this.yScale=this.parent.screenHeight/this.options.height),this.xScale=this.xIndependent?this.xScale:this.yScale,this.yScale=this.yIndependent?this.yScale:this.xScale}wheel(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("snap-zoom"),!1}down(){return this.options.removeOnInterrupt?this.parent.plugins.remove("snap-zoom"):this.options.interrupt&&(this.snapping=null),!1}update(t){if(this.paused||this.options.interrupt&&this.parent.input.count()!==0)return;let e;if(!this.options.center&&!this.options.noMove&&(e=this.parent.center),!this.snapping)(this.parent.scale.x!==this.xScale||this.parent.scale.y!==this.yScale)&&this.createSnapping();else if(this.snapping){const i=this.snapping;if(i.time+=t,i.time>=this.options.time)this.parent.scale.set(this.xScale,this.yScale),this.options.removeOnComplete&&this.parent.plugins.remove("snap-zoom"),this.parent.emit("snap-zoom-end",this.parent),this.snapping=null;else{const n=this.snapping,o=this.ease(n.time,n.startX,n.deltaX,this.options.time),a=this.ease(n.time,n.startY,n.deltaY,this.options.time);this.parent.scale.x=this.parent.screenWidth/o,this.parent.scale.y=this.parent.screenHeight/a}const s=this.parent.plugins.get("clamp-zoom",!0);s&&s.clamp(),this.options.noMove||(this.options.center?this.parent.moveCenter(this.options.center):this.parent.moveCenter(e))}}resume(){this.snapping=null,super.resume()}}const HE={percent:.1,smooth:!1,interrupt:!0,reverse:!1,center:null,lineHeight:20,axis:"all",keyToPress:null,trackpadPinch:!1,wheelZoom:!0};class KE extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"smoothing"),W(this,"smoothingCenter"),W(this,"smoothingCount"),W(this,"keyIsPressed"),this.options=Object.assign({},HE,e),this.keyIsPressed=!1,this.options.keyToPress&&this.handleKeyPresses(this.options.keyToPress)}handleKeyPresses(t){window.addEventListener("keydown",e=>{t.includes(e.code)&&(this.keyIsPressed=!0)}),window.addEventListener("keyup",e=>{t.includes(e.code)&&(this.keyIsPressed=!1)})}checkKeyPress(){return!this.options.keyToPress||this.keyIsPressed}down(){return this.options.interrupt&&(this.smoothing=null),!1}isAxisX(){return["all","x"].includes(this.options.axis)}isAxisY(){return["all","y"].includes(this.options.axis)}update(){if(this.smoothing){const t=this.smoothingCenter,e=this.smoothing;let i;this.options.center||(i=this.parent.toLocal(t)),this.isAxisX()&&(this.parent.scale.x+=e.x),this.isAxisY()&&(this.parent.scale.y+=e.y),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const s=this.parent.plugins.get("clamp-zoom",!0);if(s&&s.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const n=this.parent.toGlobal(i);this.parent.x+=t.x-n.x,this.parent.y+=t.y-n.y}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.smoothingCount++,this.smoothingCount>=this.options.smooth&&(this.smoothing=null)}}pinch(t){if(this.paused)return;const e=this.parent.input.getPointerPosition(t),i=-t.deltaY*(t.deltaMode?this.options.lineHeight:1)/200,s=Math.pow(2,(1+this.options.percent)*i);let n;this.options.center||(n=this.parent.toLocal(e)),this.isAxisX()&&(this.parent.scale.x*=s),this.isAxisY()&&(this.parent.scale.y*=s),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const o=this.parent.plugins.get("clamp-zoom",!0);if(o&&o.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const a=this.parent.toGlobal(n);this.parent.x+=e.x-a.x,this.parent.y+=e.y-a.y}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.emit("wheel-start",{event:t,viewport:this.parent})}wheel(t){if(this.paused||!this.checkKeyPress())return!1;if(t.ctrlKey&&this.options.trackpadPinch)this.pinch(t);else if(this.options.wheelZoom){const e=this.parent.input.getPointerPosition(t),i=(this.options.reverse?-1:1)*-t.deltaY*(t.deltaMode?this.options.lineHeight:1)/500,s=Math.pow(2,(1+this.options.percent)*i);if(this.options.smooth){const n={x:this.smoothing?this.smoothing.x*(this.options.smooth-this.smoothingCount):0,y:this.smoothing?this.smoothing.y*(this.options.smooth-this.smoothingCount):0};this.smoothing={x:((this.parent.scale.x+n.x)*s-this.parent.scale.x)/this.options.smooth,y:((this.parent.scale.y+n.y)*s-this.parent.scale.y)/this.options.smooth},this.smoothingCount=0,this.smoothingCenter=e}else{let n;this.options.center||(n=this.parent.toLocal(e)),this.isAxisX()&&(this.parent.scale.x*=s),this.isAxisY()&&(this.parent.scale.y*=s),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const o=this.parent.plugins.get("clamp-zoom",!0);if(o&&o.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const a=this.parent.toGlobal(n);this.parent.x+=e.x-a.x,this.parent.y+=e.y-a.y}}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.emit("wheel-start",{event:t,viewport:this.parent})}return!this.parent.options.passiveWheel}}class YE{constructor(t){W(this,"viewport"),W(this,"clickedAvailable"),W(this,"isMouseDown"),W(this,"last"),W(this,"wheelFunction"),W(this,"touches"),this.viewport=t,this.touches=[],this.addListeners()}addListeners(){this.viewport.interactive=!0,this.viewport.forceHitArea||(this.viewport.hitArea=new pt(0,0,this.viewport.worldWidth,this.viewport.worldHeight)),this.viewport.on("pointerdown",this.down,this),this.viewport.options.allowPreserveDragOutside?this.viewport.on("globalpointermove",this.move,this):this.viewport.on("pointermove",this.move,this),this.viewport.on("pointerup",this.up,this),this.viewport.on("pointerupoutside",this.up,this),this.viewport.on("pointercancel",this.up,this),this.viewport.options.allowPreserveDragOutside||this.viewport.on("pointerleave",this.up,this),this.wheelFunction=t=>this.handleWheel(t),this.viewport.options.events.domElement.addEventListener("wheel",this.wheelFunction,{passive:this.viewport.options.passiveWheel}),this.isMouseDown=!1}destroy(){this.viewport.options.events.domElement.removeEventListener("wheel",this.wheelFunction)}down(t){if(!(this.viewport.pause||!this.viewport.worldVisible)){if(t.pointerType==="mouse"?this.isMouseDown=!0:this.get(t.pointerId)||this.touches.push({id:t.pointerId,last:null}),this.count()===1){this.last=t.global.clone();const e=this.viewport.plugins.get("decelerate",!0),i=this.viewport.plugins.get("bounce",!0);(!e||!e.isActive())&&(!i||!i.isActive())?this.clickedAvailable=!0:this.clickedAvailable=!1}else this.clickedAvailable=!1;this.viewport.plugins.down(t)&&this.viewport.options.stopPropagation&&t.stopPropagation()}}clear(){this.isMouseDown=!1,this.touches=[],this.last=null}checkThreshold(t){return Math.abs(t)>=this.viewport.threshold}move(t){if(this.viewport.pause||!this.viewport.worldVisible)return;const e=this.viewport.plugins.move(t);if(this.clickedAvailable&&this.last){const i=t.global.x-this.last.x,s=t.global.y-this.last.y;(this.checkThreshold(i)||this.checkThreshold(s))&&(this.clickedAvailable=!1)}e&&this.viewport.options.stopPropagation&&t.stopPropagation()}up(t){if(this.viewport.pause||!this.viewport.worldVisible)return;t.pointerType==="mouse"&&(this.isMouseDown=!1),t.pointerType!=="mouse"&&this.remove(t.pointerId);const e=this.viewport.plugins.up(t);this.clickedAvailable&&this.count()===0&&this.last&&(this.viewport.emit("clicked",{event:t,screen:this.last,world:this.viewport.toWorld(this.last),viewport:this.viewport}),this.clickedAvailable=!1),e&&this.viewport.options.stopPropagation&&t.stopPropagation()}getPointerPosition(t){const e=new ut;return this.viewport.options.events.mapPositionToPoint(e,t.clientX,t.clientY),e}handleWheel(t){if(this.viewport.pause||!this.viewport.worldVisible)return;const e=this.viewport.toLocal(this.getPointerPosition(t));this.viewport.left<=e.x&&e.x<=this.viewport.right&&this.viewport.top<=e.y&&e.y<=this.viewport.bottom&&this.viewport.plugins.wheel(t)&&!this.viewport.options.passiveWheel&&t.preventDefault()}pause(){this.touches=[],this.isMouseDown=!1}get(t){for(const e of this.touches)if(e.id===t)return e;return null}remove(t){for(let e=0;e<this.touches.length;e++)if(this.touches[e].id===t){this.touches.splice(e,1);return}}count(){return(this.isMouseDown?1:0)+this.touches.length}}const bo=["drag","pinch","wheel","follow","mouse-edges","decelerate","animate","bounce","snap-zoom","clamp-zoom","snap","clamp"];class zE{constructor(t){W(this,"plugins"),W(this,"list"),W(this,"viewport"),this.viewport=t,this.list=[],this.plugins={}}add(t,e,i=bo.length){const s=this.plugins[t];s&&s.destroy(),this.plugins[t]=e;const n=bo.indexOf(t);n!==-1&&bo.splice(n,1),bo.splice(i,0,t),this.sort()}get(t,e){var i;return e&&(i=this.plugins[t])!=null&&i.paused?null:this.plugins[t]}update(t){for(const e of this.list)e.update(t)}resize(){for(const t of this.list)t.resize()}reset(){for(const t of this.list)t.reset()}removeAll(){this.list.forEach(t=>{t.destroy()}),this.plugins={},this.sort()}remove(t){var e;this.plugins[t]&&((e=this.plugins[t])==null||e.destroy(),delete this.plugins[t],this.viewport.emit("plugin-remove",t),this.sort())}pause(t){var e;(e=this.plugins[t])==null||e.pause()}resume(t){var e;(e=this.plugins[t])==null||e.resume()}sort(){this.list=[];for(const t of bo)this.plugins[t]&&this.list.push(this.plugins[t])}down(t){let e=!1;for(const i of this.list)i.down(t)&&(e=!0);return e}move(t){let e=!1;for(const i of this.viewport.plugins.list)i.move(t)&&(e=!0);return e}up(t){let e=!1;for(const i of this.list)i.up(t)&&(e=!0);return e}wheel(t){let e=!1;for(const i of this.list)i.wheel(t)&&(e=!0);return e}}const jE={screenWidth:window.innerWidth,screenHeight:window.innerHeight,worldWidth:null,worldHeight:null,threshold:5,passiveWheel:!0,stopPropagation:!1,forceHitArea:null,noTicker:!1,disableOnContextMenu:!1,ticker:ve.shared,allowPreserveDragOutside:!1};class JE extends At{constructor(t){super(),W(this,"moving"),W(this,"screenWidth"),W(this,"screenHeight"),W(this,"threshold"),W(this,"input"),W(this,"plugins"),W(this,"zooming"),W(this,"lastViewport"),W(this,"options"),W(this,"_dirty"),W(this,"_forceHitArea"),W(this,"_hitAreaDefault"),W(this,"_pause"),W(this,"tickerFunction"),W(this,"_worldWidth"),W(this,"_worldHeight"),W(this,"_disableOnContextMenu",e=>e.preventDefault()),this.options={...jE,...t},this.screenWidth=this.options.screenWidth,this.screenHeight=this.options.screenHeight,this._worldWidth=this.options.worldWidth,this._worldHeight=this.options.worldHeight,this.forceHitArea=this.options.forceHitArea,this.threshold=this.options.threshold,this.options.disableOnContextMenu&&this.options.events.domElement.addEventListener("contextmenu",this._disableOnContextMenu),this.options.noTicker||(this.tickerFunction=()=>this.update(this.options.ticker.elapsedMS),this.options.ticker.add(this.tickerFunction)),this.input=new YE(this),this.plugins=new zE(this)}destroy(t){!this.options.noTicker&&this.tickerFunction&&this.options.ticker.remove(this.tickerFunction),this.options.disableOnContextMenu&&this.options.events.domElement.removeEventListener("contextmenu",this._disableOnContextMenu),this.input.destroy(),super.destroy(t)}update(t){this.pause||(this.plugins.update(t),this.lastViewport&&(this.lastViewport.x!==this.x||this.lastViewport.y!==this.y?this.moving=!0:this.moving&&(this.emit("moved-end",this),this.moving=!1),this.lastViewport.scaleX!==this.scale.x||this.lastViewport.scaleY!==this.scale.y?this.zooming=!0:this.zooming&&(this.emit("zoomed-end",this),this.zooming=!1)),this.forceHitArea||(this._hitAreaDefault=new pt(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight),this.hitArea=this._hitAreaDefault),this._dirty=this._dirty||!this.lastViewport||this.lastViewport.x!==this.x||this.lastViewport.y!==this.y||this.lastViewport.scaleX!==this.scale.x||this.lastViewport.scaleY!==this.scale.y,this.lastViewport={x:this.x,y:this.y,scaleX:this.scale.x,scaleY:this.scale.y},this.emit("frame-end",this))}resize(t=window.innerWidth,e=window.innerHeight,i,s){this.screenWidth=t,this.screenHeight=e,typeof i<"u"&&(this._worldWidth=i),typeof s<"u"&&(this._worldHeight=s),this.plugins.resize(),this.dirty=!0}get worldWidth(){return this._worldWidth?this._worldWidth:this.width/this.scale.x}set worldWidth(t){this._worldWidth=t,this.plugins.resize()}get worldHeight(){return this._worldHeight?this._worldHeight:this.height/this.scale.y}set worldHeight(t){this._worldHeight=t,this.plugins.resize()}getVisibleBounds(){return new pt(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight)}toWorld(t,e){return arguments.length===2?this.toLocal(new ut(t,e)):this.toLocal(t)}toScreen(t,e){return arguments.length===2?this.toGlobal(new ut(t,e)):this.toGlobal(t)}get worldScreenWidth(){return this.screenWidth/this.scale.x}get worldScreenHeight(){return this.screenHeight/this.scale.y}get screenWorldWidth(){return this.worldWidth*this.scale.x}get screenWorldHeight(){return this.worldHeight*this.scale.y}get center(){return new ut(this.worldScreenWidth/2-this.x/this.scale.x,this.worldScreenHeight/2-this.y/this.scale.y)}set center(t){this.moveCenter(t)}moveCenter(...t){let e,i;typeof t[0]=="number"?(e=t[0],i=t[1]):(e=t[0].x,i=t[0].y);const s=(this.worldScreenWidth/2-e)*this.scale.x,n=(this.worldScreenHeight/2-i)*this.scale.y;return(this.x!==s||this.y!==n)&&(this.position.set(s,n),this.plugins.reset(),this.dirty=!0),this}get corner(){return new ut(-this.x/this.scale.x,-this.y/this.scale.y)}set corner(t){this.moveCorner(t)}moveCorner(...t){let e,i;return t.length===1?(e=-t[0].x*this.scale.x,i=-t[0].y*this.scale.y):(e=-t[0]*this.scale.x,i=-t[1]*this.scale.y),(e!==this.x||i!==this.y)&&(this.position.set(e,i),this.plugins.reset(),this.dirty=!0),this}get screenWidthInWorldPixels(){return this.screenWidth/this.scale.x}get screenHeightInWorldPixels(){return this.screenHeight/this.scale.y}findFitWidth(t){return this.screenWidth/t}findFitHeight(t){return this.screenHeight/t}findFit(t,e){const i=this.screenWidth/t,s=this.screenHeight/e;return Math.min(i,s)}findCover(t,e){const i=this.screenWidth/t,s=this.screenHeight/e;return Math.max(i,s)}fitWidth(t=this.worldWidth,e,i=!0,s){let n;e&&(n=this.center),this.scale.x=this.screenWidth/t,i&&(this.scale.y=this.scale.x);const o=this.plugins.get("clamp-zoom",!0);return!s&&o&&o.clamp(),e&&n&&this.moveCenter(n),this}fitHeight(t=this.worldHeight,e,i=!0,s){let n;e&&(n=this.center),this.scale.y=this.screenHeight/t,i&&(this.scale.x=this.scale.y);const o=this.plugins.get("clamp-zoom",!0);return!s&&o&&o.clamp(),e&&n&&this.moveCenter(n),this}fitWorld(t){let e;t&&(e=this.center),this.scale.x=this.screenWidth/this.worldWidth,this.scale.y=this.screenHeight/this.worldHeight,this.scale.x<this.scale.y?this.scale.y=this.scale.x:this.scale.x=this.scale.y;const i=this.plugins.get("clamp-zoom",!0);return i&&i.clamp(),t&&e&&this.moveCenter(e),this}fit(t,e=this.worldWidth,i=this.worldHeight){let s;t&&(s=this.center),this.scale.x=this.screenWidth/e,this.scale.y=this.screenHeight/i,this.scale.x<this.scale.y?this.scale.y=this.scale.x:this.scale.x=this.scale.y;const n=this.plugins.get("clamp-zoom",!0);return n&&n.clamp(),t&&s&&this.moveCenter(s),this}setZoom(t,e){let i;e&&(i=this.center),this.scale.set(t);const s=this.plugins.get("clamp-zoom",!0);return s&&s.clamp(),e&&i&&this.moveCenter(i),this}zoomPercent(t,e){return this.setZoom(this.scale.x+this.scale.x*t,e)}zoom(t,e){return this.fitWidth(t+this.worldScreenWidth,e),this}get scaled(){return this.scale.x}set scaled(t){this.setZoom(t,!0)}snapZoom(t){return this.plugins.add("snap-zoom",new VE(this,t)),this}OOB(){return{left:this.left<0,right:this.right>this.worldWidth,top:this.top<0,bottom:this.bottom>this.worldHeight,cornerPoint:new ut(this.worldWidth*this.scale.x-this.screenWidth,this.worldHeight*this.scale.y-this.screenHeight)}}get right(){return-this.x/this.scale.x+this.worldScreenWidth}set right(t){this.x=-t*this.scale.x+this.screenWidth,this.plugins.reset()}get left(){return-this.x/this.scale.x}set left(t){this.x=-t*this.scale.x,this.plugins.reset()}get top(){return-this.y/this.scale.y}set top(t){this.y=-t*this.scale.y,this.plugins.reset()}get bottom(){return-this.y/this.scale.y+this.worldScreenHeight}set bottom(t){this.y=-t*this.scale.y+this.screenHeight,this.plugins.reset()}get dirty(){return!!this._dirty}set dirty(t){this._dirty=t}get forceHitArea(){return this._forceHitArea}set forceHitArea(t){t?(this._forceHitArea=t,this.hitArea=t):(this._forceHitArea=null,this.hitArea=new pt(0,0,this.worldWidth,this.worldHeight))}drag(t){return this.plugins.add("drag",new FE(this,t)),this}clamp(t){return this.plugins.add("clamp",new AE(this,t)),this}decelerate(t){return this.plugins.add("decelerate",new PE(this,t)),this}bounce(t){return this.plugins.add("bounce",new EE(this,t)),this}pinch(t){return this.plugins.add("pinch",new WE(this,t)),this}snap(t,e,i){return this.plugins.add("snap",new XE(this,t,e,i)),this}follow(t,e){return this.plugins.add("follow",new DE(this,t,e)),this}wheel(t){return this.plugins.add("wheel",new KE(this,t)),this}animate(t){return this.plugins.add("animate",new SE(this,t)),this}clampZoom(t){return this.plugins.add("clamp-zoom",new ME(this,t)),this}mouseEdges(t){return this.plugins.add("mouse-edges",new OE(this,t)),this}get pause(){return!!this._pause}set pause(t){this._pause=t,this.lastViewport=null,this.moving=!1,this.zooming=!1,t&&this.input.pause()}ensureVisible(t,e,i,s,n){n&&(i>this.worldScreenWidth||s>this.worldScreenHeight)&&(this.fit(!0,i,s),this.emit("zoomed",{viewport:this,type:"ensureVisible"}));let o=!1;t<this.left?(this.left=t,o=!0):t+i>this.right&&(this.right=t+i,o=!0),e<this.top?(this.top=e,o=!0):e+s>this.bottom&&(this.bottom=e+s,o=!0),o&&this.emit("moved",{viewport:this,type:"ensureVisible"})}}function Th(r,t){return r==null||t==null?NaN:r<t?-1:r>t?1:r>=t?0:NaN}function $E(r,t){return r==null||t==null?NaN:t<r?-1:t>r?1:t>=r?0:NaN}function Qu(r){let t,e,i;r.length!==2?(t=Th,e=(a,h)=>Th(r(a),h),i=(a,h)=>r(a)-h):(t=r===Th||r===$E?r:QE,e=r,i=r);function s(a,h,l=0,c=a.length){if(l<c){if(t(h,h)!==0)return c;do{const u=l+c>>>1;e(a[u],h)<0?l=u+1:c=u}while(l<c)}return l}function n(a,h,l=0,c=a.length){if(l<c){if(t(h,h)!==0)return c;do{const u=l+c>>>1;e(a[u],h)<=0?l=u+1:c=u}while(l<c)}return l}function o(a,h,l=0,c=a.length){const u=s(a,h,l,c-1);return u>l&&i(a[u-1],h)>-i(a[u],h)?u-1:u}return{left:s,center:o,right:n}}function QE(){return 0}function qE(r){return r===null?NaN:+r}const tI=Qu(Th).right;Qu(qE).center;const eI=tI,iI=Math.sqrt(50),rI=Math.sqrt(10),sI=Math.sqrt(2);function wh(r,t,e){const i=(t-r)/Math.max(0,e),s=Math.floor(Math.log10(i)),n=i/Math.pow(10,s),o=n>=iI?10:n>=rI?5:n>=sI?2:1;let a,h,l;return s<0?(l=Math.pow(10,-s)/o,a=Math.round(r*l),h=Math.round(t*l),a/l<r&&++a,h/l>t&&--h,l=-l):(l=Math.pow(10,s)*o,a=Math.round(r/l),h=Math.round(t/l),a*l<r&&++a,h*l>t&&--h),h<a&&.5<=e&&e<2?wh(r,t,e*2):[a,h,l]}function nI(r,t,e){if(t=+t,r=+r,e=+e,!(e>0))return[];if(r===t)return[r];const i=t<r,[s,n,o]=i?wh(t,r,e):wh(r,t,e);if(!(n>=s))return[];const a=n-s+1,h=new Array(a);if(i)if(o<0)for(let l=0;l<a;++l)h[l]=(n-l)/-o;else for(let l=0;l<a;++l)h[l]=(n-l)*o;else if(o<0)for(let l=0;l<a;++l)h[l]=(s+l)/-o;else for(let l=0;l<a;++l)h[l]=(s+l)*o;return h}function qu(r,t,e){return t=+t,r=+r,e=+e,wh(r,t,e)[2]}function td(r,t,e){t=+t,r=+r,e=+e;const i=t<r,s=i?qu(t,r,e):qu(r,t,e);return(i?-1:1)*(s<0?1/-s:s)}function ed(r,t,e){r.prototype=t.prototype=e,e.constructor=r}function ay(r,t){var e=Object.create(r.prototype);for(var i in t)e[i]=t[i];return e}function xo(){}var _o=.7,Sh=1/_o,pn="\\s*([+-]?\\d+)\\s*",vo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ki="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",oI=/^#([0-9a-f]{3,8})$/,aI=new RegExp(`^rgb\\(${pn},${pn},${pn}\\)$`),hI=new RegExp(`^rgb\\(${ki},${ki},${ki}\\)$`),lI=new RegExp(`^rgba\\(${pn},${pn},${pn},${vo}\\)$`),cI=new RegExp(`^rgba\\(${ki},${ki},${ki},${vo}\\)$`),uI=new RegExp(`^hsl\\(${vo},${ki},${ki}\\)$`),dI=new RegExp(`^hsla\\(${vo},${ki},${ki},${vo}\\)$`),hy={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};ed(xo,To,{copy(r){return Object.assign(new this.constructor,this,r)},displayable(){return this.rgb().displayable()},hex:ly,formatHex:ly,formatHex8:fI,formatHsl:pI,formatRgb:cy,toString:cy});function ly(){return this.rgb().formatHex()}function fI(){return this.rgb().formatHex8()}function pI(){return my(this).formatHsl()}function cy(){return this.rgb().formatRgb()}function To(r){var t,e;return r=(r+"").trim().toLowerCase(),(t=oI.exec(r))?(e=t[1].length,t=parseInt(t[1],16),e===6?uy(t):e===3?new Me(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):e===8?Ch(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):e===4?Ch(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=aI.exec(r))?new Me(t[1],t[2],t[3],1):(t=hI.exec(r))?new Me(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=lI.exec(r))?Ch(t[1],t[2],t[3],t[4]):(t=cI.exec(r))?Ch(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=uI.exec(r))?py(t[1],t[2]/100,t[3]/100,1):(t=dI.exec(r))?py(t[1],t[2]/100,t[3]/100,t[4]):hy.hasOwnProperty(r)?uy(hy[r]):r==="transparent"?new Me(NaN,NaN,NaN,0):null}function uy(r){return new Me(r>>16&255,r>>8&255,r&255,1)}function Ch(r,t,e,i){return i<=0&&(r=t=e=NaN),new Me(r,t,e,i)}function mI(r){return r instanceof xo||(r=To(r)),r?(r=r.rgb(),new Me(r.r,r.g,r.b,r.opacity)):new Me}function id(r,t,e,i){return arguments.length===1?mI(r):new Me(r,t,e,i??1)}function Me(r,t,e,i){this.r=+r,this.g=+t,this.b=+e,this.opacity=+i}ed(Me,id,ay(xo,{brighter(r){return r=r==null?Sh:Math.pow(Sh,r),new Me(this.r*r,this.g*r,this.b*r,this.opacity)},darker(r){return r=r==null?_o:Math.pow(_o,r),new Me(this.r*r,this.g*r,this.b*r,this.opacity)},rgb(){return this},clamp(){return new Me(vs(this.r),vs(this.g),vs(this.b),Eh(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:dy,formatHex:dy,formatHex8:gI,formatRgb:fy,toString:fy}));function dy(){return`#${Ts(this.r)}${Ts(this.g)}${Ts(this.b)}`}function gI(){return`#${Ts(this.r)}${Ts(this.g)}${Ts(this.b)}${Ts((isNaN(this.opacity)?1:this.opacity)*255)}`}function fy(){const r=Eh(this.opacity);return`${r===1?"rgb(":"rgba("}${vs(this.r)}, ${vs(this.g)}, ${vs(this.b)}${r===1?")":`, ${r})`}`}function Eh(r){return isNaN(r)?1:Math.max(0,Math.min(1,r))}function vs(r){return Math.max(0,Math.min(255,Math.round(r)||0))}function Ts(r){return r=vs(r),(r<16?"0":"")+r.toString(16)}function py(r,t,e,i){return i<=0?r=t=e=NaN:e<=0||e>=1?r=t=NaN:t<=0&&(r=NaN),new di(r,t,e,i)}function my(r){if(r instanceof di)return new di(r.h,r.s,r.l,r.opacity);if(r instanceof xo||(r=To(r)),!r)return new di;if(r instanceof di)return r;r=r.rgb();var t=r.r/255,e=r.g/255,i=r.b/255,s=Math.min(t,e,i),n=Math.max(t,e,i),o=NaN,a=n-s,h=(n+s)/2;return a?(t===n?o=(e-i)/a+(e<i)*6:e===n?o=(i-t)/a+2:o=(t-e)/a+4,a/=h<.5?n+s:2-n-s,o*=60):a=h>0&&h<1?0:o,new di(o,a,h,r.opacity)}function yI(r,t,e,i){return arguments.length===1?my(r):new di(r,t,e,i??1)}function di(r,t,e,i){this.h=+r,this.s=+t,this.l=+e,this.opacity=+i}ed(di,yI,ay(xo,{brighter(r){return r=r==null?Sh:Math.pow(Sh,r),new di(this.h,this.s,this.l*r,this.opacity)},darker(r){return r=r==null?_o:Math.pow(_o,r),new di(this.h,this.s,this.l*r,this.opacity)},rgb(){var r=this.h%360+(this.h<0)*360,t=isNaN(r)||isNaN(this.s)?0:this.s,e=this.l,i=e+(e<.5?e:1-e)*t,s=2*e-i;return new Me(rd(r>=240?r-240:r+120,s,i),rd(r,s,i),rd(r<120?r+240:r-120,s,i),this.opacity)},clamp(){return new di(gy(this.h),Ih(this.s),Ih(this.l),Eh(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const r=Eh(this.opacity);return`${r===1?"hsl(":"hsla("}${gy(this.h)}, ${Ih(this.s)*100}%, ${Ih(this.l)*100}%${r===1?")":`, ${r})`}`}}));function gy(r){return r=(r||0)%360,r<0?r+360:r}function Ih(r){return Math.max(0,Math.min(1,r||0))}function rd(r,t,e){return(r<60?t+(e-t)*r/60:r<180?e:r<240?t+(e-t)*(240-r)/60:t)*255}const sd=r=>()=>r;function bI(r,t){return function(e){return r+e*t}}function xI(r,t,e){return r=Math.pow(r,e),t=Math.pow(t,e)-r,e=1/e,function(i){return Math.pow(r+i*t,e)}}function _I(r){return(r=+r)==1?yy:function(t,e){return e-t?xI(t,e,r):sd(isNaN(t)?e:t)}}function yy(r,t){var e=t-r;return e?bI(r,e):sd(isNaN(r)?t:r)}const by=function r(t){var e=_I(t);function i(s,n){var o=e((s=id(s)).r,(n=id(n)).r),a=e(s.g,n.g),h=e(s.b,n.b),l=yy(s.opacity,n.opacity);return function(c){return s.r=o(c),s.g=a(c),s.b=h(c),s.opacity=l(c),s+""}}return i.gamma=r,i}(1);function vI(r,t){t||(t=[]);var e=r?Math.min(t.length,r.length):0,i=t.slice(),s;return function(n){for(s=0;s<e;++s)i[s]=r[s]*(1-n)+t[s]*n;return i}}function TI(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function wI(r,t){var e=t?t.length:0,i=r?Math.min(e,r.length):0,s=new Array(i),n=new Array(e),o;for(o=0;o<i;++o)s[o]=ad(r[o],t[o]);for(;o<e;++o)n[o]=t[o];return function(a){for(o=0;o<i;++o)n[o]=s[o](a);return n}}function SI(r,t){var e=new Date;return r=+r,t=+t,function(i){return e.setTime(r*(1-i)+t*i),e}}function Ah(r,t){return r=+r,t=+t,function(e){return r*(1-e)+t*e}}function CI(r,t){var e={},i={},s;(r===null||typeof r!="object")&&(r={}),(t===null||typeof t!="object")&&(t={});for(s in t)s in r?e[s]=ad(r[s],t[s]):i[s]=t[s];return function(n){for(s in e)i[s]=e[s](n);return i}}var nd=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,od=new RegExp(nd.source,"g");function EI(r){return function(){return r}}function II(r){return function(t){return r(t)+""}}function AI(r,t){var e=nd.lastIndex=od.lastIndex=0,i,s,n,o=-1,a=[],h=[];for(r=r+"",t=t+"";(i=nd.exec(r))&&(s=od.exec(t));)(n=s.index)>e&&(n=t.slice(e,n),a[o]?a[o]+=n:a[++o]=n),(i=i[0])===(s=s[0])?a[o]?a[o]+=s:a[++o]=s:(a[++o]=null,h.push({i:o,x:Ah(i,s)})),e=od.lastIndex;return e<t.length&&(n=t.slice(e),a[o]?a[o]+=n:a[++o]=n),a.length<2?h[0]?II(h[0].x):EI(t):(t=h.length,function(l){for(var c=0,u;c<t;++c)a[(u=h[c]).i]=u.x(l);return a.join("")})}function ad(r,t){var e=typeof t,i;return t==null||e==="boolean"?sd(t):(e==="number"?Ah:e==="string"?(i=To(t))?(t=i,by):AI:t instanceof To?by:t instanceof Date?SI:TI(t)?vI:Array.isArray(t)?wI:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?CI:Ah)(r,t)}function RI(r,t){return r=+r,t=+t,function(e){return Math.round(r*(1-e)+t*e)}}function MI(r){return Math.abs(r=Math.round(r))>=1e21?r.toLocaleString("en").replace(/,/g,""):r.toString(10)}function Rh(r,t){if((e=(r=t?r.toExponential(t-1):r.toExponential()).indexOf("e"))<0)return null;var e,i=r.slice(0,e);return[i.length>1?i[0]+i.slice(2):i,+r.slice(e+1)]}function mn(r){return r=Rh(Math.abs(r)),r?r[1]:NaN}function LI(r,t){return function(e,i){for(var s=e.length,n=[],o=0,a=r[0],h=0;s>0&&a>0&&(h+a+1>i&&(a=Math.max(1,i-h)),n.push(e.substring(s-=a,s+a)),!((h+=a+1)>i));)a=r[o=(o+1)%r.length];return n.reverse().join(t)}}function PI(r){return function(t){return t.replace(/[0-9]/g,function(e){return r[+e]})}}var GI=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Mh(r){if(!(t=GI.exec(r)))throw new Error("invalid format: "+r);var t;return new hd({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Mh.prototype=hd.prototype;function hd(r){this.fill=r.fill===void 0?" ":r.fill+"",this.align=r.align===void 0?">":r.align+"",this.sign=r.sign===void 0?"-":r.sign+"",this.symbol=r.symbol===void 0?"":r.symbol+"",this.zero=!!r.zero,this.width=r.width===void 0?void 0:+r.width,this.comma=!!r.comma,this.precision=r.precision===void 0?void 0:+r.precision,this.trim=!!r.trim,this.type=r.type===void 0?"":r.type+""}hd.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function FI(r){t:for(var t=r.length,e=1,i=-1,s;e<t;++e)switch(r[e]){case".":i=s=e;break;case"0":i===0&&(i=e),s=e;break;default:if(!+r[e])break t;i>0&&(i=0);break}return i>0?r.slice(0,i)+r.slice(s+1):r}var xy;function NI(r,t){var e=Rh(r,t);if(!e)return r+"";var i=e[0],s=e[1],n=s-(xy=Math.max(-8,Math.min(8,Math.floor(s/3)))*3)+1,o=i.length;return n===o?i:n>o?i+new Array(n-o+1).join("0"):n>0?i.slice(0,n)+"."+i.slice(n):"0."+new Array(1-n).join("0")+Rh(r,Math.max(0,t+n-1))[0]}function _y(r,t){var e=Rh(r,t);if(!e)return r+"";var i=e[0],s=e[1];return s<0?"0."+new Array(-s).join("0")+i:i.length>s+1?i.slice(0,s+1)+"."+i.slice(s+1):i+new Array(s-i.length+2).join("0")}const vy={"%":(r,t)=>(r*100).toFixed(t),b:r=>Math.round(r).toString(2),c:r=>r+"",d:MI,e:(r,t)=>r.toExponential(t),f:(r,t)=>r.toFixed(t),g:(r,t)=>r.toPrecision(t),o:r=>Math.round(r).toString(8),p:(r,t)=>_y(r*100,t),r:_y,s:NI,X:r=>Math.round(r).toString(16).toUpperCase(),x:r=>Math.round(r).toString(16)};function Ty(r){return r}var wy=Array.prototype.map,Sy=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function DI(r){var t=r.grouping===void 0||r.thousands===void 0?Ty:LI(wy.call(r.grouping,Number),r.thousands+""),e=r.currency===void 0?"":r.currency[0]+"",i=r.currency===void 0?"":r.currency[1]+"",s=r.decimal===void 0?".":r.decimal+"",n=r.numerals===void 0?Ty:PI(wy.call(r.numerals,String)),o=r.percent===void 0?"%":r.percent+"",a=r.minus===void 0?"−":r.minus+"",h=r.nan===void 0?"NaN":r.nan+"";function l(u){u=Mh(u);var d=u.fill,f=u.align,m=u.sign,p=u.symbol,g=u.zero,y=u.width,_=u.comma,b=u.precision,v=u.trim,w=u.type;w==="n"?(_=!0,w="g"):vy[w]||(b===void 0&&(b=12),v=!0,w="g"),(g||d==="0"&&f==="=")&&(g=!0,d="0",f="=");var C=p==="$"?e:p==="#"&&/[boxX]/.test(w)?"0"+w.toLowerCase():"",E=p==="$"?i:/[%p]/.test(w)?o:"",A=vy[w],R=/[defgprs%]/.test(w);b=b===void 0?6:/[gprs]/.test(w)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b));function G(N){var P=C,I=E,D,X,H;if(w==="c")I=A(N)+I,N="";else{N=+N;var Z=N<0||1/N<0;if(N=isNaN(N)?h:A(Math.abs(N),b),v&&(N=FI(N)),Z&&+N==0&&m!=="+"&&(Z=!1),P=(Z?m==="("?m:a:m==="-"||m==="("?"":m)+P,I=(w==="s"?Sy[8+xy/3]:"")+I+(Z&&m==="("?")":""),R){for(D=-1,X=N.length;++D<X;)if(H=N.charCodeAt(D),48>H||H>57){I=(H===46?s+N.slice(D+1):N.slice(D))+I,N=N.slice(0,D);break}}}_&&!g&&(N=t(N,1/0));var j=P.length+N.length+I.length,O=j<y?new Array(y-j+1).join(d):"";switch(_&&g&&(N=t(O+N,O.length?y-I.length:1/0),O=""),f){case"<":N=P+N+I+O;break;case"=":N=P+O+N+I;break;case"^":N=O.slice(0,j=O.length>>1)+P+N+I+O.slice(j);break;default:N=O+P+N+I;break}return n(N)}return G.toString=function(){return u+""},G}function c(u,d){var f=l((u=Mh(u),u.type="f",u)),m=Math.max(-8,Math.min(8,Math.floor(mn(d)/3)))*3,p=Math.pow(10,-m),g=Sy[8+m/3];return function(y){return f(p*y)+g}}return{format:l,formatPrefix:c}}var Lh,Cy,Ey;kI({thousands:",",grouping:[3],currency:["$",""]});function kI(r){return Lh=DI(r),Cy=Lh.format,Ey=Lh.formatPrefix,Lh}function OI(r){return Math.max(0,-mn(Math.abs(r)))}function BI(r,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(mn(t)/3)))*3-mn(Math.abs(r)))}function WI(r,t){return r=Math.abs(r),t=Math.abs(t)-r,Math.max(0,mn(t)-mn(r))+1}function Iy(r,t){switch(arguments.length){case 0:break;case 1:this.range(r);break;default:this.range(t).domain(r);break}return this}function UI(r){return function(){return r}}function XI(r){return+r}var Ay=[0,1];function gn(r){return r}function ld(r,t){return(t-=r=+r)?function(e){return(e-r)/t}:UI(isNaN(t)?NaN:.5)}function ZI(r,t){var e;return r>t&&(e=r,r=t,t=e),function(i){return Math.max(r,Math.min(t,i))}}function VI(r,t,e){var i=r[0],s=r[1],n=t[0],o=t[1];return s<i?(i=ld(s,i),n=e(o,n)):(i=ld(i,s),n=e(n,o)),function(a){return n(i(a))}}function HI(r,t,e){var i=Math.min(r.length,t.length)-1,s=new Array(i),n=new Array(i),o=-1;for(r[i]<r[0]&&(r=r.slice().reverse(),t=t.slice().reverse());++o<i;)s[o]=ld(r[o],r[o+1]),n[o]=e(t[o],t[o+1]);return function(a){var h=eI(r,a,1,i)-1;return n[h](s[h](a))}}function Ry(r,t){return t.domain(r.domain()).range(r.range()).interpolate(r.interpolate()).clamp(r.clamp()).unknown(r.unknown())}function KI(){var r=Ay,t=Ay,e=ad,i,s,n,o=gn,a,h,l;function c(){var d=Math.min(r.length,t.length);return o!==gn&&(o=ZI(r[0],r[d-1])),a=d>2?HI:VI,h=l=null,u}function u(d){return d==null||isNaN(d=+d)?n:(h||(h=a(r.map(i),t,e)))(i(o(d)))}return u.invert=function(d){return o(s((l||(l=a(t,r.map(i),Ah)))(d)))},u.domain=function(d){return arguments.length?(r=Array.from(d,XI),c()):r.slice()},u.range=function(d){return arguments.length?(t=Array.from(d),c()):t.slice()},u.rangeRound=function(d){return t=Array.from(d),e=RI,c()},u.clamp=function(d){return arguments.length?(o=d?!0:gn,c()):o!==gn},u.interpolate=function(d){return arguments.length?(e=d,c()):e},u.unknown=function(d){return arguments.length?(n=d,u):n},function(d,f){return i=d,s=f,c()}}function My(){return KI()(gn,gn)}function YI(r,t,e,i){var s=td(r,t,e),n;switch(i=Mh(i??",f"),i.type){case"s":{var o=Math.max(Math.abs(r),Math.abs(t));return i.precision==null&&!isNaN(n=BI(s,o))&&(i.precision=n),Ey(i,o)}case"":case"e":case"g":case"p":case"r":{i.precision==null&&!isNaN(n=WI(s,Math.max(Math.abs(r),Math.abs(t))))&&(i.precision=n-(i.type==="e"));break}case"f":case"%":{i.precision==null&&!isNaN(n=OI(s))&&(i.precision=n-(i.type==="%")*2);break}}return Cy(i)}function zI(r){var t=r.domain;return r.ticks=function(e){var i=t();return nI(i[0],i[i.length-1],e??10)},r.tickFormat=function(e,i){var s=t();return YI(s[0],s[s.length-1],e??10,i)},r.nice=function(e){e==null&&(e=10);var i=t(),s=0,n=i.length-1,o=i[s],a=i[n],h,l,c=10;for(a<o&&(l=o,o=a,a=l,l=s,s=n,n=l);c-- >0;){if(l=qu(o,a,e),l===h)return i[s]=o,i[n]=a,t(i);if(l>0)o=Math.floor(o/l)*l,a=Math.ceil(a/l)*l;else if(l<0)o=Math.ceil(o*l)/l,a=Math.floor(a*l)/l;else break;h=l}return r},r}function Ly(){var r=My();return r.copy=function(){return Ry(r,Ly())},Iy.apply(r,arguments),zI(r)}function jI(r,t){r=r.slice();var e=0,i=r.length-1,s=r[e],n=r[i],o;return n<s&&(o=e,e=i,i=o,o=s,s=n,n=o),r[e]=t.floor(s),r[i]=t.ceil(n),r}const cd=new Date,ud=new Date;function te(r,t,e,i){function s(n){return r(n=arguments.length===0?new Date:new Date(+n)),n}return s.floor=n=>(r(n=new Date(+n)),n),s.ceil=n=>(r(n=new Date(n-1)),t(n,1),r(n),n),s.round=n=>{const o=s(n),a=s.ceil(n);return n-o<a-n?o:a},s.offset=(n,o)=>(t(n=new Date(+n),o==null?1:Math.floor(o)),n),s.range=(n,o,a)=>{const h=[];if(n=s.ceil(n),a=a==null?1:Math.floor(a),!(n<o)||!(a>0))return h;let l;do h.push(l=new Date(+n)),t(n,a),r(n);while(l<n&&n<o);return h},s.filter=n=>te(o=>{if(o>=o)for(;r(o),!n(o);)o.setTime(o-1)},(o,a)=>{if(o>=o)if(a<0)for(;++a<=0;)for(;t(o,-1),!n(o););else for(;--a>=0;)for(;t(o,1),!n(o););}),e&&(s.count=(n,o)=>(cd.setTime(+n),ud.setTime(+o),r(cd),r(ud),Math.floor(e(cd,ud))),s.every=n=>(n=Math.floor(n),!isFinite(n)||!(n>0)?null:n>1?s.filter(i?o=>i(o)%n===0:o=>s.count(0,o)%n===0):s)),s}const Ph=te(()=>{},(r,t)=>{r.setTime(+r+t)},(r,t)=>t-r);Ph.every=r=>(r=Math.floor(r),!isFinite(r)||!(r>0)?null:r>1?te(t=>{t.setTime(Math.floor(t/r)*r)},(t,e)=>{t.setTime(+t+e*r)},(t,e)=>(e-t)/r):Ph),Ph.range;const ar=1e3,ti=ar*60,hr=ti*60,lr=hr*24,dd=lr*7,Py=lr*30,fd=lr*365,yn=te(r=>{r.setTime(r-r.getMilliseconds())},(r,t)=>{r.setTime(+r+t*ar)},(r,t)=>(t-r)/ar,r=>r.getUTCSeconds());yn.range;const pd=te(r=>{r.setTime(r-r.getMilliseconds()-r.getSeconds()*ar)},(r,t)=>{r.setTime(+r+t*ti)},(r,t)=>(t-r)/ti,r=>r.getMinutes());pd.range,te(r=>{r.setUTCSeconds(0,0)},(r,t)=>{r.setTime(+r+t*ti)},(r,t)=>(t-r)/ti,r=>r.getUTCMinutes()).range;const md=te(r=>{r.setTime(r-r.getMilliseconds()-r.getSeconds()*ar-r.getMinutes()*ti)},(r,t)=>{r.setTime(+r+t*hr)},(r,t)=>(t-r)/hr,r=>r.getHours());md.range,te(r=>{r.setUTCMinutes(0,0,0)},(r,t)=>{r.setTime(+r+t*hr)},(r,t)=>(t-r)/hr,r=>r.getUTCHours()).range;const wo=te(r=>r.setHours(0,0,0,0),(r,t)=>r.setDate(r.getDate()+t),(r,t)=>(t-r-(t.getTimezoneOffset()-r.getTimezoneOffset())*ti)/lr,r=>r.getDate()-1);wo.range;const gd=te(r=>{r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCDate(r.getUTCDate()+t)},(r,t)=>(t-r)/lr,r=>r.getUTCDate()-1);gd.range,te(r=>{r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCDate(r.getUTCDate()+t)},(r,t)=>(t-r)/lr,r=>Math.floor(r/lr)).range;function ws(r){return te(t=>{t.setDate(t.getDate()-(t.getDay()+7-r)%7),t.setHours(0,0,0,0)},(t,e)=>{t.setDate(t.getDate()+e*7)},(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*ti)/dd)}const Gh=ws(0),Fh=ws(1),JI=ws(2),$I=ws(3),bn=ws(4),QI=ws(5),qI=ws(6);Gh.range,Fh.range,JI.range,$I.range,bn.range,QI.range,qI.range;function Ss(r){return te(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-r)%7),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e*7)},(t,e)=>(e-t)/dd)}const Gy=Ss(0),Nh=Ss(1),t2=Ss(2),e2=Ss(3),xn=Ss(4),i2=Ss(5),r2=Ss(6);Gy.range,Nh.range,t2.range,e2.range,xn.range,i2.range,r2.range;const yd=te(r=>{r.setDate(1),r.setHours(0,0,0,0)},(r,t)=>{r.setMonth(r.getMonth()+t)},(r,t)=>t.getMonth()-r.getMonth()+(t.getFullYear()-r.getFullYear())*12,r=>r.getMonth());yd.range,te(r=>{r.setUTCDate(1),r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCMonth(r.getUTCMonth()+t)},(r,t)=>t.getUTCMonth()-r.getUTCMonth()+(t.getUTCFullYear()-r.getUTCFullYear())*12,r=>r.getUTCMonth()).range;const cr=te(r=>{r.setMonth(0,1),r.setHours(0,0,0,0)},(r,t)=>{r.setFullYear(r.getFullYear()+t)},(r,t)=>t.getFullYear()-r.getFullYear(),r=>r.getFullYear());cr.every=r=>!isFinite(r=Math.floor(r))||!(r>0)?null:te(t=>{t.setFullYear(Math.floor(t.getFullYear()/r)*r),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e*r)}),cr.range;const Cs=te(r=>{r.setUTCMonth(0,1),r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCFullYear(r.getUTCFullYear()+t)},(r,t)=>t.getUTCFullYear()-r.getUTCFullYear(),r=>r.getUTCFullYear());Cs.every=r=>!isFinite(r=Math.floor(r))||!(r>0)?null:te(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/r)*r),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e*r)}),Cs.range;function s2(r,t,e,i,s,n){const o=[[yn,1,ar],[yn,5,5*ar],[yn,15,15*ar],[yn,30,30*ar],[n,1,ti],[n,5,5*ti],[n,15,15*ti],[n,30,30*ti],[s,1,hr],[s,3,3*hr],[s,6,6*hr],[s,12,12*hr],[i,1,lr],[i,2,2*lr],[e,1,dd],[t,1,Py],[t,3,3*Py],[r,1,fd]];function a(l,c,u){const d=c<l;d&&([l,c]=[c,l]);const f=u&&typeof u.range=="function"?u:h(l,c,u),m=f?f.range(l,+c+1):[];return d?m.reverse():m}function h(l,c,u){const d=Math.abs(c-l)/u,f=Qu(([,,g])=>g).right(o,d);if(f===o.length)return r.every(td(l/fd,c/fd,u));if(f===0)return Ph.every(Math.max(td(l,c,u),1));const[m,p]=o[d/o[f-1][2]<o[f][2]/d?f-1:f];return m.every(p)}return[a,h]}const[n2,o2]=s2(cr,yd,Gh,wo,md,pd);function bd(r){if(0<=r.y&&r.y<100){var t=new Date(-1,r.m,r.d,r.H,r.M,r.S,r.L);return t.setFullYear(r.y),t}return new Date(r.y,r.m,r.d,r.H,r.M,r.S,r.L)}function xd(r){if(0<=r.y&&r.y<100){var t=new Date(Date.UTC(-1,r.m,r.d,r.H,r.M,r.S,r.L));return t.setUTCFullYear(r.y),t}return new Date(Date.UTC(r.y,r.m,r.d,r.H,r.M,r.S,r.L))}function So(r,t,e){return{y:r,m:t,d:e,H:0,M:0,S:0,L:0}}function a2(r){var t=r.dateTime,e=r.date,i=r.time,s=r.periods,n=r.days,o=r.shortDays,a=r.months,h=r.shortMonths,l=Co(s),c=Eo(s),u=Co(n),d=Eo(n),f=Co(o),m=Eo(o),p=Co(a),g=Eo(a),y=Co(h),_=Eo(h),b={a:Z,A:j,b:O,B:k,c:null,d:By,e:By,f:M2,g:W2,G:X2,H:I2,I:A2,j:R2,L:Wy,m:L2,M:P2,p:F,q:V,Q:Ky,s:Yy,S:G2,u:F2,U:N2,V:D2,w:k2,W:O2,x:null,X:null,y:B2,Y:U2,Z:Z2,"%":Hy},v={a:$,A:dt,b:ot,B:Et,c:null,d:Xy,e:Xy,f:Y2,g:rA,G:nA,H:V2,I:H2,j:K2,L:Zy,m:z2,M:j2,p:Mt,q:_t,Q:Ky,s:Yy,S:J2,u:$2,U:Q2,V:q2,w:tA,W:eA,x:null,X:null,y:iA,Y:sA,Z:oA,"%":Hy},w={a:G,A:N,b:P,B:I,c:D,d:ky,e:ky,f:w2,g:Dy,G:Ny,H:Oy,I:Oy,j:x2,L:T2,m:b2,M:_2,p:R,q:y2,Q:C2,s:E2,S:v2,u:d2,U:f2,V:p2,w:u2,W:m2,x:X,X:H,y:Dy,Y:Ny,Z:g2,"%":S2};b.x=C(e,b),b.X=C(i,b),b.c=C(t,b),v.x=C(e,v),v.X=C(i,v),v.c=C(t,v);function C(Y,tt){return function(et){var B=[],xt=-1,yt=0,Lt=Y.length,Zt,Xe,pi;for(et instanceof Date||(et=new Date(+et));++xt<Lt;)Y.charCodeAt(xt)===37&&(B.push(Y.slice(yt,xt)),(Xe=Fy[Zt=Y.charAt(++xt)])!=null?Zt=Y.charAt(++xt):Xe=Zt==="e"?" ":"0",(pi=tt[Zt])&&(Zt=pi(et,Xe)),B.push(Zt),yt=xt+1);return B.push(Y.slice(yt,xt)),B.join("")}}function E(Y,tt){return function(et){var B=So(1900,void 0,1),xt=A(B,Y,et+="",0),yt,Lt;if(xt!=et.length)return null;if("Q"in B)return new Date(B.Q);if("s"in B)return new Date(B.s*1e3+("L"in B?B.L:0));if(tt&&!("Z"in B)&&(B.Z=0),"p"in B&&(B.H=B.H%12+B.p*12),B.m===void 0&&(B.m="q"in B?B.q:0),"V"in B){if(B.V<1||B.V>53)return null;"w"in B||(B.w=1),"Z"in B?(yt=xd(So(B.y,0,1)),Lt=yt.getUTCDay(),yt=Lt>4||Lt===0?Nh.ceil(yt):Nh(yt),yt=gd.offset(yt,(B.V-1)*7),B.y=yt.getUTCFullYear(),B.m=yt.getUTCMonth(),B.d=yt.getUTCDate()+(B.w+6)%7):(yt=bd(So(B.y,0,1)),Lt=yt.getDay(),yt=Lt>4||Lt===0?Fh.ceil(yt):Fh(yt),yt=wo.offset(yt,(B.V-1)*7),B.y=yt.getFullYear(),B.m=yt.getMonth(),B.d=yt.getDate()+(B.w+6)%7)}else("W"in B||"U"in B)&&("w"in B||(B.w="u"in B?B.u%7:"W"in B?1:0),Lt="Z"in B?xd(So(B.y,0,1)).getUTCDay():bd(So(B.y,0,1)).getDay(),B.m=0,B.d="W"in B?(B.w+6)%7+B.W*7-(Lt+5)%7:B.w+B.U*7-(Lt+6)%7);return"Z"in B?(B.H+=B.Z/100|0,B.M+=B.Z%100,xd(B)):bd(B)}}function A(Y,tt,et,B){for(var xt=0,yt=tt.length,Lt=et.length,Zt,Xe;xt<yt;){if(B>=Lt)return-1;if(Zt=tt.charCodeAt(xt++),Zt===37){if(Zt=tt.charAt(xt++),Xe=w[Zt in Fy?tt.charAt(xt++):Zt],!Xe||(B=Xe(Y,et,B))<0)return-1}else if(Zt!=et.charCodeAt(B++))return-1}return B}function R(Y,tt,et){var B=l.exec(tt.slice(et));return B?(Y.p=c.get(B[0].toLowerCase()),et+B[0].length):-1}function G(Y,tt,et){var B=f.exec(tt.slice(et));return B?(Y.w=m.get(B[0].toLowerCase()),et+B[0].length):-1}function N(Y,tt,et){var B=u.exec(tt.slice(et));return B?(Y.w=d.get(B[0].toLowerCase()),et+B[0].length):-1}function P(Y,tt,et){var B=y.exec(tt.slice(et));return B?(Y.m=_.get(B[0].toLowerCase()),et+B[0].length):-1}function I(Y,tt,et){var B=p.exec(tt.slice(et));return B?(Y.m=g.get(B[0].toLowerCase()),et+B[0].length):-1}function D(Y,tt,et){return A(Y,t,tt,et)}function X(Y,tt,et){return A(Y,e,tt,et)}function H(Y,tt,et){return A(Y,i,tt,et)}function Z(Y){return o[Y.getDay()]}function j(Y){return n[Y.getDay()]}function O(Y){return h[Y.getMonth()]}function k(Y){return a[Y.getMonth()]}function F(Y){return s[+(Y.getHours()>=12)]}function V(Y){return 1+~~(Y.getMonth()/3)}function $(Y){return o[Y.getUTCDay()]}function dt(Y){return n[Y.getUTCDay()]}function ot(Y){return h[Y.getUTCMonth()]}function Et(Y){return a[Y.getUTCMonth()]}function Mt(Y){return s[+(Y.getUTCHours()>=12)]}function _t(Y){return 1+~~(Y.getUTCMonth()/3)}return{format:function(Y){var tt=C(Y+="",b);return tt.toString=function(){return Y},tt},parse:function(Y){var tt=E(Y+="",!1);return tt.toString=function(){return Y},tt},utcFormat:function(Y){var tt=C(Y+="",v);return tt.toString=function(){return Y},tt},utcParse:function(Y){var tt=E(Y+="",!0);return tt.toString=function(){return Y},tt}}}var Fy={"-":"",_:" ",0:"0"},ae=/^\s*\d+/,h2=/^%/,l2=/[\\^$*+?|[\]().{}]/g;function It(r,t,e){var i=r<0?"-":"",s=(i?-r:r)+"",n=s.length;return i+(n<e?new Array(e-n+1).join(t)+s:s)}function c2(r){return r.replace(l2,"\\$&")}function Co(r){return new RegExp("^(?:"+r.map(c2).join("|")+")","i")}function Eo(r){return new Map(r.map((t,e)=>[t.toLowerCase(),e]))}function u2(r,t,e){var i=ae.exec(t.slice(e,e+1));return i?(r.w=+i[0],e+i[0].length):-1}function d2(r,t,e){var i=ae.exec(t.slice(e,e+1));return i?(r.u=+i[0],e+i[0].length):-1}function f2(r,t,e){var i=ae.exec(t.slice(e,e+2));return i?(r.U=+i[0],e+i[0].length):-1}function p2(r,t,e){var i=ae.exec(t.slice(e,e+2));return i?(r.V=+i[0],e+i[0].length):-1}function m2(r,t,e){var i=ae.exec(t.slice(e,e+2));return i?(r.W=+i[0],e+i[0].length):-1}function Ny(r,t,e){var i=ae.exec(t.slice(e,e+4));return i?(r.y=+i[0],e+i[0].length):-1}function Dy(r,t,e){var i=ae.exec(t.slice(e,e+2));return i?(r.y=+i[0]+(+i[0]>68?1900:2e3),e+i[0].length):-1}function g2(r,t,e){var i=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(e,e+6));return i?(r.Z=i[1]?0:-(i[2]+(i[3]||"00")),e+i[0].length):-1}function y2(r,t,e){var i=ae.exec(t.slice(e,e+1));return i?(r.q=i[0]*3-3,e+i[0].length):-1}function b2(r,t,e){var i=ae.exec(t.slice(e,e+2));return i?(r.m=i[0]-1,e+i[0].length):-1}function ky(r,t,e){var i=ae.exec(t.slice(e,e+2));return i?(r.d=+i[0],e+i[0].length):-1}function x2(r,t,e){var i=ae.exec(t.slice(e,e+3));return i?(r.m=0,r.d=+i[0],e+i[0].length):-1}function Oy(r,t,e){var i=ae.exec(t.slice(e,e+2));return i?(r.H=+i[0],e+i[0].length):-1}function _2(r,t,e){var i=ae.exec(t.slice(e,e+2));return i?(r.M=+i[0],e+i[0].length):-1}function v2(r,t,e){var i=ae.exec(t.slice(e,e+2));return i?(r.S=+i[0],e+i[0].length):-1}function T2(r,t,e){var i=ae.exec(t.slice(e,e+3));return i?(r.L=+i[0],e+i[0].length):-1}function w2(r,t,e){var i=ae.exec(t.slice(e,e+6));return i?(r.L=Math.floor(i[0]/1e3),e+i[0].length):-1}function S2(r,t,e){var i=h2.exec(t.slice(e,e+1));return i?e+i[0].length:-1}function C2(r,t,e){var i=ae.exec(t.slice(e));return i?(r.Q=+i[0],e+i[0].length):-1}function E2(r,t,e){var i=ae.exec(t.slice(e));return i?(r.s=+i[0],e+i[0].length):-1}function By(r,t){return It(r.getDate(),t,2)}function I2(r,t){return It(r.getHours(),t,2)}function A2(r,t){return It(r.getHours()%12||12,t,2)}function R2(r,t){return It(1+wo.count(cr(r),r),t,3)}function Wy(r,t){return It(r.getMilliseconds(),t,3)}function M2(r,t){return Wy(r,t)+"000"}function L2(r,t){return It(r.getMonth()+1,t,2)}function P2(r,t){return It(r.getMinutes(),t,2)}function G2(r,t){return It(r.getSeconds(),t,2)}function F2(r){var t=r.getDay();return t===0?7:t}function N2(r,t){return It(Gh.count(cr(r)-1,r),t,2)}function Uy(r){var t=r.getDay();return t>=4||t===0?bn(r):bn.ceil(r)}function D2(r,t){return r=Uy(r),It(bn.count(cr(r),r)+(cr(r).getDay()===4),t,2)}function k2(r){return r.getDay()}function O2(r,t){return It(Fh.count(cr(r)-1,r),t,2)}function B2(r,t){return It(r.getFullYear()%100,t,2)}function W2(r,t){return r=Uy(r),It(r.getFullYear()%100,t,2)}function U2(r,t){return It(r.getFullYear()%1e4,t,4)}function X2(r,t){var e=r.getDay();return r=e>=4||e===0?bn(r):bn.ceil(r),It(r.getFullYear()%1e4,t,4)}function Z2(r){var t=r.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+It(t/60|0,"0",2)+It(t%60,"0",2)}function Xy(r,t){return It(r.getUTCDate(),t,2)}function V2(r,t){return It(r.getUTCHours(),t,2)}function H2(r,t){return It(r.getUTCHours()%12||12,t,2)}function K2(r,t){return It(1+gd.count(Cs(r),r),t,3)}function Zy(r,t){return It(r.getUTCMilliseconds(),t,3)}function Y2(r,t){return Zy(r,t)+"000"}function z2(r,t){return It(r.getUTCMonth()+1,t,2)}function j2(r,t){return It(r.getUTCMinutes(),t,2)}function J2(r,t){return It(r.getUTCSeconds(),t,2)}function $2(r){var t=r.getUTCDay();return t===0?7:t}function Q2(r,t){return It(Gy.count(Cs(r)-1,r),t,2)}function Vy(r){var t=r.getUTCDay();return t>=4||t===0?xn(r):xn.ceil(r)}function q2(r,t){return r=Vy(r),It(xn.count(Cs(r),r)+(Cs(r).getUTCDay()===4),t,2)}function tA(r){return r.getUTCDay()}function eA(r,t){return It(Nh.count(Cs(r)-1,r),t,2)}function iA(r,t){return It(r.getUTCFullYear()%100,t,2)}function rA(r,t){return r=Vy(r),It(r.getUTCFullYear()%100,t,2)}function sA(r,t){return It(r.getUTCFullYear()%1e4,t,4)}function nA(r,t){var e=r.getUTCDay();return r=e>=4||e===0?xn(r):xn.ceil(r),It(r.getUTCFullYear()%1e4,t,4)}function oA(){return"+0000"}function Hy(){return"%"}function Ky(r){return+r}function Yy(r){return Math.floor(+r/1e3)}var _n,zy;aA({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function aA(r){return _n=a2(r),zy=_n.format,_n.parse,_n.utcFormat,_n.utcParse,_n}function hA(r){return new Date(r)}function lA(r){return r instanceof Date?+r:+new Date(+r)}function jy(r,t,e,i,s,n,o,a,h,l){var c=My(),u=c.invert,d=c.domain,f=l(".%L"),m=l(":%S"),p=l("%I:%M"),g=l("%I %p"),y=l("%a %d"),_=l("%b %d"),b=l("%B"),v=l("%Y");function w(C){return(h(C)<C?f:a(C)<C?m:o(C)<C?p:n(C)<C?g:i(C)<C?s(C)<C?y:_:e(C)<C?b:v)(C)}return c.invert=function(C){return new Date(u(C))},c.domain=function(C){return arguments.length?d(Array.from(C,lA)):d().map(hA)},c.ticks=function(C){var E=d();return r(E[0],E[E.length-1],C??10)},c.tickFormat=function(C,E){return E==null?w:l(E)},c.nice=function(C){var E=d();return(!C||typeof C.range!="function")&&(C=t(E[0],E[E.length-1],C??10)),C?d(jI(E,C)):c},c.copy=function(){return Ry(c,jy(r,t,e,i,s,n,o,a,h,l))},c}function cA(){return Iy.apply(jy(n2,o2,cr,yd,Gh,wo,md,pd,yn,zy).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function Io(r,t,e){this.k=r,this.x=t,this.y=e}Io.prototype={constructor:Io,scale:function(r){return r===1?this:new Io(this.k*r,this.x,this.y)},translate:function(r,t){return r===0&t===0?this:new Io(this.k,this.x+this.k*r,this.y+this.k*t)},apply:function(r){return[r[0]*this.k+this.x,r[1]*this.k+this.y]},applyX:function(r){return r*this.k+this.x},applyY:function(r){return r*this.k+this.y},invert:function(r){return[(r[0]-this.x)/this.k,(r[1]-this.y)/this.k]},invertX:function(r){return(r-this.x)/this.k},invertY:function(r){return(r-this.y)/this.k},rescaleX:function(r){return r.copy().domain(r.range().map(this.invertX,this).map(r.invert,r))},rescaleY:function(r){return r.copy().domain(r.range().map(this.invertY,this).map(r.invert,r))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}},Io.prototype;function Jy(r){return r.mode==="temporal"||r.mode==="left-aligned"?uA(r):dA(r)}function uA({domain:r,range:t}){return cA().domain(r).range(t)}function dA({domain:r,range:t}){return Ly().domain(r).range(t)}function _d(r){return{mode:ct.horizontal,range:$R(),domain:QR(r)}}function fA(){return{mode:ct.vertical}}let vn=null;async function pA(){const r=await Go();$y(r.start_time),nt.on("layoutSettingsUpdated",()=>$y(r.start_time))}function mA(){vn=null}async function Es(){return vn||await Fe("scaleCreated")}async function $y(r){await Ue();const t=vn?"scaleUpdated":"scaleCreated",e=_d(r);vn=Jy(e),nt.emit(t,vn)}let Le=null,vd=null;async function gA(){const r=await de(),t=await cu();Le=new JE({screenHeight:t.clientHeight,screenWidth:t.clientWidth,events:r.renderer.events,passiveWheel:!1}),Le.zIndex=1,Le.drag().pinch().wheel({trackpadPinch:!0}).decelerate({friction:.9}).clampZoom({minWidth:t.clientWidth/2}),Le.on("moved",()=>{nt.emit("viewportMoved",null)}).on("moved-end",()=>{nt.emit("viewportMoved",null)}),r.stage.addChild(Le),nt.emit("viewportCreated",Le),nt.on("applicationResized",vA),nt.on("scaleUpdated",()=>Dh()),xA()}function yA(){Le=null,vd=null}async function Td({animate:r}={}){const t=await we(),e=await Yt(),i=t.getChildByName(Cf);if(!i)throw new Error("Nodes container not found");const s=e.styles.guideTextSize+e.styles.guideTextTopPadding;SA();const{x:n,y:o,width:a,height:h}=i.getLocalBounds(),l=a+e.styles.columnGap*2,c=h+e.styles.rowGap*2+s*2,u=t.findFit(l,c);!a||!h||t.animate({position:{x:n+a/2,y:o+h/2-s},scale:Math.min(u,1),time:r?e.animationDuration:0,ease:"easeInOutQuad",removeOnInterrupt:!0,callbackOnComplete:()=>{wd(),Dh()}})}async function we(){return Le||await Fe("viewportCreated")}function Qy(r){sy(vd,r)||(vd=r,nt.emit("viewportDateRangeUpdated",r))}function bA({xOffset:r,yOffset:t}){if(!Le)return;const{x:e,y:i}=Le.transform.position;Le.setTransform(e+r,i+t,Le.transform.scale.x,Le.transform.scale.y)}async function xA(){const r=await we();Dh(),r.on("moved",()=>Dh())}async function Dh(){const r=await qy();r&&Qy(r)}async function qy(){const r=await we(),t=await Es(),e=t.invert(r.left),i=t.invert(r.right);return e instanceof Date&&i instanceof Date?[e,i]:null}async function _A(r){const t=await qy(),e=await Ue();if(r===void 0||e.isDependency()||sy(r,t))return;const i=await we(),s=await Es(),[n,o]=r,a=s(n),h=s(o),l=a+(h-a)/2;Qy(r),i.fitWidth(h-a,!0),i.moveCenter(l,i.center.y)}async function vA(){const r=await de(),t=await we(),e=await cu(),i=t.screenWidth,s=t.screenHeight,n=e.clientWidth,o=e.clientHeight,a=(n-i)/2,h=(o-s)/2;t.resize(r.screen.width,r.screen.height),bA({xOffset:a,yOffset:h})}class kh{constructor(){yf(this,"status","visible");yf(this,"labels",new Set)}get visible(){return this.status==="visible"}get hidden(){return this.status==="hidden"}show(){if(this.status!=="visible"){for(const t of this.labels)t.visible=!0;this.status="visible"}}hide(){if(this.status!=="hidden"){for(const t of this.labels)t.visible=!1;this.status="hidden"}}toggle(t){t?this.show():this.hide()}add(t){this.labels.add(t),t.visible=this.visible}clear(){this.labels.clear()}}let Oi=null,ei=null,Bi=null,ur=null,fi=null;async function TA(){const r=await we(),t=await de();Oi=new bE({toggle:"renderable"}),ei=new kh,Bi=new kh,fi=new kh,ur=new kh,t.ticker.add(()=>{if(r.dirty){const e=r.scale.x>.1,i=r.scale.x>.2,s=r.scale.x>.2,n=r.scale.x>.2;fi==null||fi.toggle(e),ei==null||ei.toggle(i),Bi==null||Bi.toggle(s),ur==null||ur.toggle(n),Oi==null||Oi.cull(t.renderer.screen),r.dirty=!1}}),nt.emit("cullCreated",Oi),nt.emit("labelCullCreated",ei),nt.emit("iconCullCreated",ei),nt.emit("edgeCullCreated",fi),nt.emit("toggleCullCreated",ur)}function wA(){Oi=null,ei==null||ei.clear(),ei=null,Bi==null||Bi.clear(),Bi=null,fi==null||fi.clear(),fi=null,ur==null||ur.clear(),ur=null}async function wd(){const r=await we();r.dirty=!0}function SA(){Oi&&Oi.uncull()}async function tb(){return Oi||await Fe("cullCreated")}async function CA(){return fi||await Fe("edgeCullCreated")}async function eb(){return ei||await Fe("labelCullCreated")}async function EA(){return Bi||await Fe("iconCullCreated")}async function ib(){const r=await Ue(),t=await Yt();function e(i,s,n){const a=r.disableAnimations||n?0:t.animationDuration/1e3;return ry.to(i,{...s,duration:a,ease:"power1.out",onUpdate:()=>{wd()}})}return{animate:e}}let Oh=new Map;function IA(){Oh=new Map}async function Bh(r,t){const e=`${r.toString()}-${JSON.stringify(t)}`;if(Oh.has(e))return Oh.get(e);const i=await r(...t);return Oh.set(e,i),i}async function AA({size:r,stroke:t=1,radius:e=0}){const i=await de(),s=new io;return s.lineStyle(t,"#fff",1,0),s.drawRoundedRect(0,0,r*2,r*2,e),i.renderer.generateTexture(s,{region:new pt(0,0,r,r),resolution:10})}async function rb(r){return await Bh(AA,[r])}var Wh=(r=>(r[r.Up=0]="Up",r[r.Down=180]="Down",r[r.Left=270]="Left",r[r.Right=90]="Right",r))(Wh||{});function sb(){const r=new qt;async function t(e){const{rotate:i=0}=e,s={size:e.size,radius:e.radius,stroke:e.stroke},n=await rb(s);return r.texture=n,r.anchor.set(.5,.5),r.angle=45+i,r}return{element:r,render:t}}async function RA(){const r=await de(),t=new io;return t.beginFill("#fff"),t.drawRect(0,0,1,1),t.endFill(),r.renderer.generateTexture(t,{wrapMode:_i.REPEAT})}async function Sd(){return await Bh(RA,[])}function Cd(r,t){return Array.from({length:r},(e,i)=>t(i))}const MA=8,LA=2;async function PA(){const r=await Yt(),t=await tb(),e=await CA(),{animate:i}=await ib(),s=new At,{element:n,render:o}=await sb(),a=await Sd(),h=Cd(20,()=>new ut),l=new uS(a,h);let c=!1;s.name=Ob,s.addChild(n),s.addChild(l),t.addAll([n,l]),e.add(s);async function u(){return await o({size:10,rotate:Wh.Right}),n.tint=r.styles.edgeColor,l.tint=r.styles.edgeColor,s}async function d(m,p){const g=f(p);c||await u();for(const[y,_]of h.entries()){const{x:b,y:v}=g[y];i(_,{x:b,y:v},!c)}i(s,{x:m.x,y:m.y},!c),i(n,{x:p.x-MA,y:p.y},!c),c=!0}function f({x:m,y:p}){const g=[],y={x:0,y:0},_={x:m-LA,y:p},b={x:nb(y.x,{source:y,target:_}),y:y.y},v={x:nb(_.x,{source:y,target:_},!0),y:_.y};for(const[w]of h.entries()){if(w===h.length-1){g[w]=_;continue}const C=GA(w,{source:y,target:_,sourceBezier:b,targetBezier:v});g[w]=C}return g}return{element:s,render:u,setPosition:d}}function nb(r,{source:t,target:e},i){const s=(e.x-t.x)/2;return r+(s>64?s:64)*(i?-1:1)}function GA(r,t){const e=r/20,{source:i,target:s,sourceBezier:n,targetBezier:o}=t,a=i.x+(n.x-i.x)*e,h=i.y+(n.y-i.y)*e,l=n.x+(o.x-n.x)*e,c=n.y+(o.y-n.y)*e,u=o.x+(s.x-o.x)*e,d=o.y+(s.y-o.y)*e,f=a+(l-a)*e,m=h+(c-h)*e,p=l+(u-l)*e,g=c+(d-c)*e,y=f+(p-f)*e,_=m+(g-m)*e;return{x:y,y:_}}async function FA({height:r,radius:t}){const e=await de(),i=new io;return i.beginFill("#fff"),i.drawRoundedRect(0,0,t*2,r,t),i.endFill(),e.renderer.generateTexture(i,{region:new pt(0,0,t,r),resolution:10})}async function NA(r){return await Bh(FA,[r])}function DA(){const r=new qt,t=new qt;async function e(i){const s=await NA(i);return r.texture=s,t.texture=s,t.anchor.x=1,t.scale.x=-1,{left:r,right:t}}return{left:r,right:t,render:e}}async function Ao(){const r=await Sd();return new qt(r)}async function Ed(){const r=new At,t=await Ao(),{left:e,right:i,render:s}=await DA();r.addChild(t),r.addChild(e),r.addChild(i);async function n(h){const{width:l,x:c,visible:u}=a(h);return await s({height:h.height,radius:h.radius}),t.visible=u,t.width=l,t.height=h.height,t.x=c,e.visible=o(h.capLeft,h.radius),i.visible=o(h.capRight,h.radius),i.x=h.radius+l,t.tint=h.background,e.tint=h.background,i.tint=h.background,r}function o(h,l){return l===0?!1:h??!0}function a(h){const l=o(h.capLeft,h.radius),c=o(h.capRight,h.radius);let u=0;l&&(u+=h.radius),c&&(u+=h.radius);const d=Math.max(h.width-u,0),f=d>0,m=l?h.radius:0;return{width:d,visible:f,x:m}}return{element:r,render:n}}function Id(){const r=new At,t=new qt,e=new qt,i=new qt,s=new qt,n=new qt,o=new qt,a=new qt,h=new qt;t.name="border-corner-top-left",e.name="border-corner-top-right",i.name="border-corner-bottom-left",s.name="border-corner-bottom-right",n.name="border-corner-left",o.name="border-corner-right",a.name="border-corner-top",h.name="border-corner-bottom",e.anchor.x=1,e.scale.x=-1,i.anchor.y=1,i.scale.y=-1,s.anchor.x=1,s.scale.x=-1,s.anchor.y=1,s.scale.y=-1,r.addChild(t),r.addChild(e),r.addChild(i),r.addChild(s),r.addChild(n),r.addChild(o),r.addChild(a),r.addChild(h);async function l(f){const{radius:m=0,color:p="#fff",stroke:g,width:y,height:_}=f,b=Math.min(y,_),v=m*2>b?b/2:m,C=await rb({size:v,radius:m,stroke:g}),E=await Sd();return c({texture:C,width:y,height:_,size:v}),u({texture:E,width:y,height:_,size:v,stroke:g}),d(p),r}function c({texture:f,width:m,height:p,size:g}){t.texture=f,e.texture=f,i.texture=f,s.texture=f,t.position.set(0,0),e.position.set(m-g,0),i.position.set(0,p-g),s.position.set(m-g,p-g)}function u({texture:f,size:m,width:p,height:g,stroke:y}){const _=Math.max(g-m*2,0),b=Math.max(p-m*2,0);a.texture=f,n.texture=f,o.texture=f,h.texture=f,n.position.set(0,m),n.height=_,n.width=y,o.position.set(p-y,m),o.height=_,o.width=y,a.position.set(m,0),a.width=b,a.height=y,h.position.set(m,g-y),h.width=b,h.height=y}function d(f){t.tint=f,e.tint=f,i.tint=f,s.tint=f,a.tint=f,n.tint=f,o.tint=f,h.tint=f}return{element:r,render:l}}async function ob(){const r=await Yt(),t=new At,{element:e,render:i}=await Id();async function s({selected:n,width:o,height:a}){if(!n)return t.removeChild(e),t;const{selectedBorderColor:h,selectedBorderWidth:l,selectedBorderOffset:c,selectedBorderRadius:u}=r.styles;return e.position.set(-c,-c),t.addChild(e),await i({stroke:l,radius:u,width:o+c*2,height:a+c*2,color:h}),t}return{element:t,render:s}}async function kA(){const r=await Yt(),t=new At,{element:e,render:i}=await Ed(),{element:s,render:n}=await ob();t.addChild(e),t.addChild(s);async function o({selected:a,width:h,height:l}){const{artifactBgColor:c,artifactBorderRadius:u}=r.styles,d={width:h,height:l,background:c,radius:u,capLeft:!0,capRight:!0};return await Promise.all([i(d),n({selected:a,width:h,height:l})]),t}return{element:t,render:o}}const OA=Object.freeze(Object.defineProperty({__proto__:null,Artifact:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.5%203.875C7.5%203.11561%208.11561%202.5%208.875%202.5H16.125C16.8844%202.5%2017.5%203.11561%2017.5%203.875V16.125C17.5%2016.8844%2016.8844%2017.5%2016.125%2017.5H8.875C8.11561%2017.5%207.5%2016.8844%207.5%2016.125V10.9375H6.66449C6.31341%2011.6765%205.56012%2012.1875%204.6875%2012.1875C3.47938%2012.1875%202.5%2011.2081%202.5%2010C2.5%208.79188%203.47938%207.8125%204.6875%207.8125C5.56012%207.8125%206.31341%208.32345%206.66449%209.0625H7.5V3.875ZM15.7984%207.99134L12.7215%2012.9913C12.5599%2013.2539%2012.2797%2013.4202%2011.9718%2013.4362C11.664%2013.4523%2011.3679%2013.3159%2011.18%2013.0716L9.25692%2010.5716L10.7431%209.4284L11.8372%2010.8508L14.2016%207.00866L15.7984%207.99134Z'%20fill='white'/%3e%3c/svg%3e",ArtifactMarkdown:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.5%203.875C7.5%203.11561%208.11561%202.5%208.875%202.5H16.125C16.8844%202.5%2017.5%203.11561%2017.5%203.875V16.125C17.5%2016.8844%2016.8844%2017.5%2016.125%2017.5H8.875C8.11561%2017.5%207.5%2016.8844%207.5%2016.125V10.9375H6.66449C6.31341%2011.6765%205.56012%2012.1875%204.6875%2012.1875C3.47938%2012.1875%202.5%2011.2081%202.5%2010C2.5%208.79188%203.47938%207.8125%204.6875%207.8125C5.56012%207.8125%206.31341%208.32345%206.66449%209.0625H7.5V3.875ZM15%207.1875H10V5.3125H15V7.1875ZM15%2010.9375H10V9.0625H15V10.9375ZM10%2014.6875H12.5V12.8125H10V14.6875Z'%20fill='white'/%3e%3c/svg%3e",ArtifactResult:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.5%203.875C7.5%203.11561%208.11561%202.5%208.875%202.5H16.125C16.8844%202.5%2017.5%203.11561%2017.5%203.875V16.125C17.5%2016.8844%2016.8844%2017.5%2016.125%2017.5H8.875C8.11561%2017.5%207.5%2016.8844%207.5%2016.125V10.9375H6.66449C6.31341%2011.6765%205.56012%2012.1875%204.6875%2012.1875C3.47938%2012.1875%202.5%2011.2081%202.5%2010C2.5%208.79188%203.47938%207.8125%204.6875%207.8125C5.56012%207.8125%206.31341%208.32345%206.66449%209.0625H7.5V3.875ZM9.52483%206.61458C9.7035%205.94774%2010.3889%205.55202%2011.0558%205.73069C11.7226%205.90937%2012.1183%206.59479%2011.9396%207.26162C11.761%207.92846%2011.0755%208.32418%2010.4087%208.14551C9.74188%207.96683%209.34615%207.28141%209.52483%206.61458ZM13.0604%2012.7383C13.239%2012.0715%2013.9245%2011.6757%2014.5913%2011.8544C15.2581%2012.0331%2015.6539%2012.7185%2015.4752%2013.3854C15.2965%2014.0522%2014.6111%2014.4479%2013.9442%2014.2692C13.2774%2014.0906%2012.8817%2013.4051%2013.0604%2012.7383ZM10.78%2014.27L15.78%206.77002L14.2199%205.72996L9.21995%2013.23L10.78%2014.27Z'%20fill='white'/%3e%3c/svg%3e",ArtifactTable:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.5%203.875C7.5%203.11561%208.11561%202.5%208.875%202.5H16.125C16.8844%202.5%2017.5%203.11561%2017.5%203.875V16.125C17.5%2016.8844%2016.8844%2017.5%2016.125%2017.5H8.875C8.11561%2017.5%207.5%2016.8844%207.5%2016.125V10.9375H6.66449C6.31341%2011.6765%205.56012%2012.1875%204.6875%2012.1875C3.47938%2012.1875%202.5%2011.2081%202.5%2010C2.5%208.79188%203.47938%207.8125%204.6875%207.8125C5.56012%207.8125%206.31341%208.32345%206.66449%209.0625H7.5V3.875ZM10%207.1875H11.875V5.3125H10V7.1875ZM10%2010.9375H11.875V9.0625H10V10.9375ZM11.875%2014.6875H10V12.8125H11.875V14.6875ZM13.125%207.1875H15V5.3125H13.125V7.1875ZM15%2010.9375H13.125V9.0625H15V10.9375ZM13.125%2014.6875H15V12.8125H13.125V14.6875Z'%20fill='white'/%3e%3c/svg%3e"},Symbol.toStringTag,{value:"Module"}));function BA(r){const t={resolution:4};return rt.from(OA[r],t)}async function WA(r){return await Bh(BA,[r])}async function UA({cullAtZoomThreshold:r=!0}={}){const t=await EA(),e=new qt;r&&t.add(e);async function i(s){const n=await WA(s);return e.texture=n,e}return{element:e,render:i}}var ab={exports:{}};(function(r){(function(){function t(p,g){document.addEventListener?p.addEventListener("scroll",g,!1):p.attachEvent("scroll",g)}function e(p){document.body?p():document.addEventListener?document.addEventListener("DOMContentLoaded",function g(){document.removeEventListener("DOMContentLoaded",g),p()}):document.attachEvent("onreadystatechange",function g(){(document.readyState=="interactive"||document.readyState=="complete")&&(document.detachEvent("onreadystatechange",g),p())})}function i(p){this.g=document.createElement("div"),this.g.setAttribute("aria-hidden","true"),this.g.appendChild(document.createTextNode(p)),this.h=document.createElement("span"),this.i=document.createElement("span"),this.m=document.createElement("span"),this.j=document.createElement("span"),this.l=-1,this.h.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.i.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.j.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.m.style.cssText="display:inline-block;width:200%;height:200%;font-size:16px;max-width:none;",this.h.appendChild(this.m),this.i.appendChild(this.j),this.g.appendChild(this.h),this.g.appendChild(this.i)}function s(p,g){p.g.style.cssText="max-width:none;min-width:20px;min-height:20px;display:inline-block;overflow:hidden;position:absolute;width:auto;margin:0;padding:0;top:-999px;white-space:nowrap;font-synthesis:none;font:"+g+";"}function n(p){var g=p.g.offsetWidth,y=g+100;return p.j.style.width=y+"px",p.i.scrollLeft=y,p.h.scrollLeft=p.h.scrollWidth+100,p.l!==g?(p.l=g,!0):!1}function o(p,g){function y(){var b=_;n(b)&&b.g.parentNode!==null&&g(b.l)}var _=p;t(p.h,y),t(p.i,y),n(p)}function a(p,g,y){g=g||{},y=y||window,this.family=p,this.style=g.style||"normal",this.weight=g.weight||"normal",this.stretch=g.stretch||"normal",this.context=y}var h=null,l=null,c=null,u=null;function d(p){return l===null&&(f(p)&&/Apple/.test(window.navigator.vendor)?(p=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))(?:\.([0-9]+))/.exec(window.navigator.userAgent),l=!!p&&603>parseInt(p[1],10)):l=!1),l}function f(p){return u===null&&(u=!!p.document.fonts),u}function m(p,g){var y=p.style,_=p.weight;if(c===null){var b=document.createElement("div");try{b.style.font="condensed 100px sans-serif"}catch{}c=b.style.font!==""}return[y,_,c?p.stretch:"","100px",g].join(" ")}a.prototype.load=function(p,g){var y=this,_=p||"BESbswy",b=0,v=g||3e3,w=new Date().getTime();return new Promise(function(C,E){if(f(y.context)&&!d(y.context)){var A=new Promise(function(G,N){function P(){new Date().getTime()-w>=v?N(Error(""+v+"ms timeout exceeded")):y.context.document.fonts.load(m(y,'"'+y.family+'"'),_).then(function(I){1<=I.length?G():setTimeout(P,25)},N)}P()}),R=new Promise(function(G,N){b=setTimeout(function(){N(Error(""+v+"ms timeout exceeded"))},v)});Promise.race([R,A]).then(function(){clearTimeout(b),C(y)},E)}else e(function(){function G(){var V;(V=X!=-1&&H!=-1||X!=-1&&Z!=-1||H!=-1&&Z!=-1)&&((V=X!=H&&X!=Z&&H!=Z)||(h===null&&(V=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),h=!!V&&(536>parseInt(V[1],10)||parseInt(V[1],10)===536&&11>=parseInt(V[2],10))),V=h&&(X==j&&H==j&&Z==j||X==O&&H==O&&Z==O||X==k&&H==k&&Z==k)),V=!V),V&&(F.parentNode!==null&&F.parentNode.removeChild(F),clearTimeout(b),C(y))}function N(){if(new Date().getTime()-w>=v)F.parentNode!==null&&F.parentNode.removeChild(F),E(Error(""+v+"ms timeout exceeded"));else{var V=y.context.document.hidden;(V===!0||V===void 0)&&(X=P.g.offsetWidth,H=I.g.offsetWidth,Z=D.g.offsetWidth,G()),b=setTimeout(N,50)}}var P=new i(_),I=new i(_),D=new i(_),X=-1,H=-1,Z=-1,j=-1,O=-1,k=-1,F=document.createElement("div");F.dir="ltr",s(P,m(y,"sans-serif")),s(I,m(y,"serif")),s(D,m(y,"monospace")),F.appendChild(P.g),F.appendChild(I.g),F.appendChild(D.g),y.context.document.body.appendChild(F),j=P.g.offsetWidth,O=I.g.offsetWidth,k=D.g.offsetWidth,N(),o(P,function(V){X=V,G()}),s(P,m(y,'"'+y.family+'",sans-serif')),o(I,function(V){H=V,G()}),s(I,m(y,'"'+y.family+'",serif')),o(D,function(V){Z=V,G()}),s(D,m(y,'"'+y.family+'",monospace'))})})},r.exports=a})()})(ab);var XA=ab.exports;const ZA=Ds(XA),hb={inter:{fontFamily:"InterVariable",fontSize:16,lineHeight:20,fill:16777215}},lb={resolution:4,chars:ui.ASCII},cb="sans-serif",ub={inter:YA(hb.inter)};let Ad=!1;async function VA(){const r=Object.values(hb);await Promise.all(r.map(t=>HA(t))),Ad=!0,nt.emit("fontsLoaded",ub)}async function HA(r){const{fontFamily:t,...e}=r,i=new ZA(t);try{await i.load()}catch(s){console.error(s),console.warn(`fonts: font ${t} failed to load, falling back to ${cb}`),ui.from(t,{fontFamily:cb,...e},lb);return}ui.from(t,r,lb)}function KA(){Ad=!1}async function db(){return Ad?ub:await Fe("fontsLoaded")}function YA(r){const{fontFamily:t,...e}=r,i={fontName:t,...e};return s=>new BS(s,i)}async function Rd({cullAtZoomThreshold:r=!0}={}){const{inter:t}=await db(),e=await eb(),i=t("");r&&e.add(i);async function s(n){return i.text=n,await i}return{element:i,render:s}}const zA=["result","markdown","table","unknown"],fb={markdown:"ArtifactMarkdown",table:"ArtifactTable",result:"ArtifactResult",unknown:"Artifact"},Uh=["flow-run","task-run"];function jA(r){return Uh.includes(r)}function Md(r){return Uh.includes(r.kind)}function pb(r){return r.kind==="artifact"}function mb(r){return r.kind==="artifacts"}async function gb({cullAtZoomThreshold:r}){const t=await Yt(),e=new At,i=new At,{element:s,render:n}=await UA({cullAtZoomThreshold:r}),{element:o,render:a}=await Rd({cullAtZoomThreshold:r}),{element:h,render:l}=await kA();let c=!1,u=null,d=null;i.addChild(s),i.addChild(o),e.addChild(h),e.addChild(i);async function f(y){if(y){const{selected:_,name:b,type:v}=y;c=_??c,u=b??u,d=v??d}return await Promise.all([m(),p()]),await g(),e}async function m(){if(!d)return s;const y=fb[d],{artifactIconSize:_,artifactIconColor:b,artifactPaddingLeft:v,artifactPaddingY:w}=t.styles,C=await n(y);return C.position={x:v,y:w},C.width=_,C.height=_,C.tint=b,C}async function p(){if(!u)return o.visible=!1,o;await a(u);const{artifactPaddingLeft:y,artifactPaddingY:_,artifactTextColor:b,artifactIconSize:v,artifactContentGap:w}=t.styles,C=y+v+w,E=_;return o.tint=b,o.scale.set(.75),o.position={x:C,y:E},o.visible=!0,o}async function g(){const{artifactPaddingLeft:y,artifactPaddingRight:_,artifactPaddingY:b}=t.styles,v={selected:c,width:i.width+y+_,height:i.height+b*2};return await l(v)}return{element:e,render:f}}let ge=null,Xh=!1;async function JA(){const r=await we();r.on("click",()=>Ro(null)),r.on("drag-start",()=>{Xh=!0}),r.on("drag-end",()=>{setTimeout(()=>{Xh=!1})})}function $A(){ge=null,Xh=!1}function Ro(r){if(!Xh&&!(!r&&!ge||r&&Mo(r))){if(ge=r,r===null){nt.emit("itemSelected",null);return}nt.emit("itemSelected",r)}}function Mo(r){if(ge===null)return!1;const{kind:t}=r;switch(t){case"task-run":return Md(ge)&&ge.id===r.id;case"flow-run":return Md(ge)&&ge.id===r.id;case"artifact":return pb(ge)&&ge.id===r.id;case"artifacts":return mb(ge)&&ge.ids.length===r.ids.length&&ge.ids.every(i=>r.ids.includes(i));default:const e=t;throw new Error(`switch does not have case for value: ${e}`)}}function QA(){return ge&&Uh.includes(ge.kind)?ge:null}async function yb(r,{cullAtZoomThreshold:t=!0}={}){const{element:e,render:i}=await gb({cullAtZoomThreshold:t});let s=!1;e.eventMode="static",e.cursor="pointer",e.on("click",l=>{l.stopPropagation(),Ro({kind:"artifact",id:r.id})}),nt.on("itemSelected",()=>{const l=Mo({kind:"artifact",id:r.id});l!==s&&(s=l,n())});async function n(){await i({selected:s,name:r.key,type:r.type})}function o(){return s}function a(){return r.created}function h(){return r.id}return{element:e,render:n,getSelected:o,getDate:a,getId:h}}async function qA(){const r=await Yt(),t=await eb(),e=new At,{element:i,render:s}=await sb(),{element:n,render:o}=await Ed(),{element:a,render:h}=await Id();t.add(e);let l=!1;e.eventMode="static",e.cursor="pointer",e.addChild(n),e.addChild(i),e.addChild(a),e.on("mouseover",u),e.on("mouseout",d);async function c({inside:f,isOpen:m}){l=f;const p={size:10,stroke:2,rotate:m?Wh.Up:Wh.Down},g=await s(p),y={width:r.styles.nodeToggleSize,height:r.styles.nodeToggleSize,background:r.styles.nodeToggleBgColor,radius:r.styles.nodeToggleBorderRadius},_=await o(y);_.alpha=f?0:.5;const b=await h({width:y.width,height:y.height,radius:y.radius,stroke:1,color:r.styles.nodeToggleBorderColor});b.alpha=f?0:1;const v={y:_.height/2,x:_.width/2},w=p.size/4;return g.x=v.x,g.y=m?v.y+w:v.y-w,e}function u(){n.alpha=l?.5:1}function d(){n.alpha=l?0:.5}return{element:e,render:c}}async function bb(){const r=await Yt(),t=await Ue(),e=new At,{element:i,render:s}=await Ed(),{element:n,render:o}=await ob();e.addChild(i),e.addChild(n);async function a(l){const{background:c="#fff"}=r.styles.node(l),{nodeHeight:u,nodeRadius:d}=r.styles,f=Mo({kind:l.kind,id:l.id}),m=h(l,d),p=l.state_type!=="RUNNING"||t.isDependency();return await Promise.all([s({width:m,height:u,radius:d,background:c,capRight:p}),o({selected:f,width:m,height:u})]),i}function h(l,c){const u=Pd();if(ct.isTemporal()||ct.isLeftAligned()){const d=l.start_time,f=l.end_time??new Date,p=Ef(f,d)/ta*u;return Math.max(p,c*2)}return u}return{element:e,render:a}}class xb extends At{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)this.children[t].updateTransform()}calculateBounds(){this._bounds.clear(),this._calculateBounds();for(const t of this.children)if(t.calculateBounds(),t._mask){const e=t._mask.isMaskData?t._mask.maskObject:t._mask;e?(e.calculateBounds(),this._bounds.addBoundsMask(t._bounds,e._bounds)):this._bounds.addBounds(t._bounds)}else t.filterArea?this._bounds.addBoundsArea(t._bounds,t.filterArea):this._bounds.addBounds(t._bounds);this._bounds.updateID=this._boundsID}}async function tR(r){const t=new xb,e=await Yt(),{element:i,render:s}=await bb(),{element:n,render:o}=await Rd(),{element:a,render:h,getSize:l,stopWorker:c}=await Mb(),{element:u,render:d}=await qA(),{element:f,render:m}=await Id(),{start:p,stop:g}=await U0(r.id,P=>{h(P)});let y=r,_=!1;t.addChild(f),t.addChild(i),t.addChild(n),t.addChild(u),u.on("click",P=>{P.stopPropagation(),v()}),a.position={x:0,y:e.styles.nodeHeight+e.styles.nodesPadding},a.on("rendered",()=>{wd(),G()});async function b(P){return y=P,await s(P),await A(),await R(P),await w(P),t}async function v(){_?await E():await C()}async function w(P){const{background:I="#fff"}=e.styles.node(P),D=4,{width:X,height:H}=l(),Z=H+e.styles.nodeHeight+e.styles.nodesPadding*2+D*2,j=e.styles.nodeHeight,O=_?-D:D,k=Math.max(i.width,X),F=_?k+D*2:i.width-D*2;(await m({width:F,height:_?Z:j,stroke:_?2:1,radius:e.styles.nodeBorderRadius,color:I})).position.set(O,O)}async function C(){_=!0,t.addChild(a),await Promise.all([p(),b(y)]),G()}async function E(){_=!1,t.removeChild(a),c(),await Promise.all([g(),b(y)]),G()}async function A(){const P=e.styles.nodeToggleSize,I=e.styles.nodeHeight-P,D=i.width>P,X=await d({inside:D,isOpen:_});return X.x=D?I/2:i.width+e.styles.nodePadding,X.y=I/2,X}async function R(P){const I=await o(P.label),D=e.styles.colorMode==="dark"?e.styles.textDefault:e.styles.textInverse,X=e.styles.nodePadding,H=u.x+u.width+X,Z=i.width+X,j=i.width>H+I.width+X,O=e.styles.nodeHeight/2-I.height/2,k=j?H:Math.max(Z,H);return I.position={x:k,y:O},I.tint=j?D:e.styles.textDefault,I}function G(){w(y);const P=N();t.emit("resized",P)}function N(){const P=l(),I=_?P.height+e.styles.nodesPadding*2:0,D=_?P.width:0;return{height:e.styles.nodeHeight+I,width:Math.max(D,t.width)}}return{kind:"flow-run",element:t,bar:i,render:b}}async function eR(){const r=await Yt(),t=new xb,{element:e,render:i}=await Rd(),{element:s,render:n}=await bb();t.addChild(s),t.addChild(e);async function o(h){return await Promise.all([n(h),i(h.label)]),a(),t}function a(){const h=r.styles.colorMode==="dark"?r.styles.textDefault:r.styles.textInverse,l=r.styles.nodePadding,c=s.width>l+e.width+l,u=c?l:s.width+l,d=r.styles.nodeHeight/2-e.height/2;e.position={x:u,y:d},e.tint=c?h:r.styles.textDefault}return{kind:"task-run",element:t,render:o,bar:s}}var _b="Expected a function",vb=NaN,iR="[object Symbol]",rR=/^\s+|\s+$/g,sR=/^[-+]0x[0-9a-f]+$/i,nR=/^0b[01]+$/i,oR=/^0o[0-7]+$/i,aR=parseInt,hR=typeof xe=="object"&&xe&&xe.Object===Object&&xe,lR=typeof self=="object"&&self&&self.Object===Object&&self,cR=hR||lR||Function("return this")(),uR=Object.prototype,dR=uR.toString,fR=Math.max,pR=Math.min,Ld=function(){return cR.Date.now()};function mR(r,t,e){var i,s,n,o,a,h,l=0,c=!1,u=!1,d=!0;if(typeof r!="function")throw new TypeError(_b);t=Tb(t)||0,Zh(e)&&(c=!!e.leading,u="maxWait"in e,n=u?fR(Tb(e.maxWait)||0,t):n,d="trailing"in e?!!e.trailing:d);function f(C){var E=i,A=s;return i=s=void 0,l=C,o=r.apply(A,E),o}function m(C){return l=C,a=setTimeout(y,t),c?f(C):o}function p(C){var E=C-h,A=C-l,R=t-E;return u?pR(R,n-A):R}function g(C){var E=C-h,A=C-l;return h===void 0||E>=t||E<0||u&&A>=n}function y(){var C=Ld();if(g(C))return _(C);a=setTimeout(y,p(C))}function _(C){return a=void 0,d&&i?f(C):(i=s=void 0,o)}function b(){a!==void 0&&clearTimeout(a),l=0,i=h=s=a=void 0}function v(){return a===void 0?o:_(Ld())}function w(){var C=Ld(),E=g(C);if(i=arguments,s=this,h=C,E){if(a===void 0)return m(h);if(u)return a=setTimeout(y,t),f(h)}return a===void 0&&(a=setTimeout(y,t)),o}return w.cancel=b,w.flush=v,w}function gR(r,t,e){var i=!0,s=!0;if(typeof r!="function")throw new TypeError(_b);return Zh(e)&&(i="leading"in e?!!e.leading:i,s="trailing"in e?!!e.trailing:s),mR(r,t,{leading:i,maxWait:t,trailing:s})}function Zh(r){var t=typeof r;return!!r&&(t=="object"||t=="function")}function yR(r){return!!r&&typeof r=="object"}function bR(r){return typeof r=="symbol"||yR(r)&&dR.call(r)==iR}function Tb(r){if(typeof r=="number")return r;if(bR(r))return vb;if(Zh(r)){var t=typeof r.valueOf=="function"?r.valueOf():r;r=Zh(t)?t+"":t}if(typeof r!="string")return r===0?r:+r;r=r.replace(rR,"");var e=nR.test(r);return e||oR.test(r)?aR(r.slice(2),e?2:8):sR.test(r)?vb:+r}var xR=gR;const _R=Ds(xR);async function vR(){const{element:r,render:t}=await gb({cullAtZoomThreshold:!1});let e=null,i=[],s=!1;r.eventMode="static",r.cursor="pointer",r.on("click",l=>{l.stopPropagation();const c={x:r.position.x,y:r.position.y,width:r.width,height:r.height};Ro({kind:"artifacts",ids:i,position:c})}),nt.on("itemSelected",()=>{const l=Mo({kind:"artifacts",ids:i});l!==s&&e&&(s=l,n({ids:i,date:e}))});async function n(l){if(!l){e=null,i=[],r.visible=!1;return}const{ids:c,date:u}=l;e=u,i=c,await t({selected:s,type:"unknown",name:c.length.toString()}),r.visible=!0}function o(){return s}function a(){return e}function h(){return i}return{element:r,render:n,getSelected:o,getDate:a,getIds:h,isCluster:!0}}async function wb(r){const t=await de(),e=await we(),i=await Yt(),s=await Ue();let n=await Es();const o=await h();nt.on("scaleUpdated",c=>{n=c,l()}),nt.on("viewportMoved",()=>l());async function a(c){await o.render(c),l()}async function h(){return r.type==="artifact"?await yb(r.artifact,{cullAtZoomThreshold:!1}):await vR()}function l(){const c=o.getDate();if(!c||!ct.isTemporal()||s.disableArtifacts)return;const u=o.getSelected(),{element:d}=o;let f=0;if(u){const{selectedBorderOffset:y,selectedBorderWidth:_}=i.styles;f=y+_*2}const p=n(c)*e.scale._x+e.worldTransform.tx-(d.width-f)/2,g=t.screen.height-(d.height-f)-10;d.position.set(p,g)}return{...o,render:a}}async function TR(){const r=await de(),t=await we(),e=await Yt(),i=await Ue(),s=new Map,n=[];let o=null,a=null,h=!1;nt.on("viewportMoved",()=>d());async function l(b){if(o&&(o.visible=!i.disableArtifacts),i.disableArtifacts||(b&&(a=b),!a))return;o||u();const v=[];for(const w of a)v.push(c(w));await Promise.all(v)}async function c(b){if(s.has(b.id))return s.get(b.id).render();const v=await wb({type:"artifact",artifact:b});return s.set(b.id,v),o.addChild(v.element),v.render()}function u(){o=new At,o.zIndex=3,r.stage.addChild(o)}function d(){if(!(!o||i.disableArtifacts)){if(!ct.isTemporal()){h||(y(),_(),h=!0),o.position.x=t.scale._x+t.worldTransform.tx;return}h=!1,o.position.x=0,f()}}const f=_R(async()=>{const b=[...s.values()],v=[...n];b.sort((w,C)=>w.element.x-C.element.x),await m(b,v);for(const w of v)w.render()},250);async function m(b,v,w){let C,E=null,A=null;for(let R=w??0;R<b.length;R++){const G=b[R],N=G.element.x;if(G.element.visible=!0,E!==null&&C&&N<C){A=R;break}E=R,C=N+G.element.width}if(A!==null&&E!==null){const R=b[E],G=b[A];R.element.visible=!1,G.element.visible=!1;const N=await p(R,G,v);N&&(b.splice(E,1,N),b.splice(A,1)),m(b,v,E)}}async function p(b,v,w){const C=b.getDate(),E=v.getDate(),A="getId"in b?[b.getId()]:b.getIds(),R="getId"in v?[v.getId()]:v.getIds();if(!C||!E)return console.error("flowRunArtifacts: visible item is missing date"),null;let G;if("isCluster"in b)G=b;else if("isCluster"in v)G=v;else if(w.length>0)G=w.pop();else{const I=await wb({type:"cluster"});o.addChild(I.element),n.push(I),G=I}const N=[...A,...R],P=g(N);return G.render({ids:N,date:P}),G}function g(b){const v=b.reduce((E,A)=>{const R=s.get(A);return R&&E.push(R.getDate().getTime()),E},[]),w=Math.min(...v),C=Math.max(...v);return new Date((w+C)/2)}function y(){for(const b of n)b.render();for(const b of s.values())b.element.visible=!0}function _(){const{artifactContentGap:b}=e.styles;let v=0;for(const w of s.values())w.element.x=v,v+=w.element.width+b}return{render:l}}async function wR(){const r=await Go(),{render:t}=await TR();function e(i){t(i==null?void 0:i.artifacts)}r.artifacts&&e(r),nt.on("runDataCreated",i=>e(i)),nt.on("runDataUpdated",i=>e(i)),nt.on("configUpdated",()=>e()),nt.on("layoutSettingsUpdated",()=>e())}function UM(){}async function SR(r,t){const e=await de(),i=await we(),s=await Yt();let n=await Es();const o=new At,a=await Ao(),h=await Ao();let l=(t==null?void 0:t.end)??null;o.addChild(h),o.addChild(a),nt.on("viewportMoved",()=>c()),nt.on("scaleUpdated",m=>{n=m,c()});function c(m){if(m){const{end:g}=m;l=g}if(!ct.isTemporal()){o.visible=!1;return}const p=u();d(p),f(p)}function u(){const{background:m="#fff"}=s.styles.state(r),p=Math.max(n(r.occurred)*i.scale._x+i.worldTransform.tx,0),g=l?n(l)*i.scale._x+i.worldTransform.tx-p:e.screen.width-p;return{x:p,width:Math.max(g,0),background:m}}function d({x:m,width:p,background:g}){const{flowStateBarHeight:y}=s.styles;a.x=m,a.y=e.screen.height-y,a.width=p,a.height=y,a.tint=g}function f({x:m,width:p,background:g}){if(r.type==="RUNNING"){h.visible=!1;return}const{flowStateBarHeight:y,flowStateAreaAlpha:_}=s.styles;h.x=m,h.y=0,h.width=p,h.height=e.screen.height-y,h.tint=g,h.alpha=_}return{element:o,render:c}}function CR(){const r=new At,t=new Map;let e=null;r.zIndex=2;async function i(n){if(n&&(e=n),!e)return;const o=[];for(let a=0;a<e.length;a++)o.push(s(e[a],a));await Promise.all(o)}async function s(n,o){const a=e&&e.length>=o+1&&e[o+1],h=a?{end:a.occurred}:void 0;if(t.has(n.id))return t.get(n.id).render(h);const l=await SR(n,h);return t.set(n.id,l),r.addChild(l.element),l.render()}return{element:r,render:i}}async function ER(){const r=await de(),t=await Go(),{element:e,render:i}=await CR();r.stage.addChild(e);function s(n){i(n==null?void 0:n.state_events)}t.state_events&&s(t),nt.on("runDataUpdated",n=>s(n)),nt.on("configUpdated",()=>s()),nt.on("layoutSettingsUpdated",()=>s())}function XM(){}async function IR(){const r=await de(),t=await we(),e=await Ue(),i=await Yt(),{inter:s}=await db(),n=new At,o=await Ao();n.addChild(o);const a=s("");n.addChild(a);let h=await Es(),l,c;nt.on("scaleUpdated",p=>h=p),nt.on("viewportMoved",()=>{e.disableGuides||(m(),n.height!==r.screen.height&&d())});function u(p,g){l=p,c=g,d(),f(p)}function d(){o.width=i.styles.guideLineWidth,o.height=r.screen.height,o.tint=i.styles.guideLineColor}function f(p){a.text=c(p),a.fontSize=i.styles.guideTextSize,a.tint=i.styles.guideTextColor,a.position.set(i.styles.guideTextLeftPadding,i.styles.guideTextTopPadding)}function m(){l!==void 0&&(n.position.x=h(l)*t.scale._x+t.worldTransform.tx)}return{element:n,render:u}}class Sb extends Error{constructor(){super("Layout is not temporal")}}function AR(r){return r.toLocaleTimeString()}function Cb(r){const t=navigator.language;return new Intl.DateTimeFormat(t,{timeStyle:"short"}).format(r)}function RR(r){const t=navigator.language;return new Intl.DateTimeFormat(t,{dateStyle:"short"}).format(r)}function MR(r){return r.getHours()===0&&r.getMinutes()===0?`${Vh.date(r)}
|
|
1176
|
-
${Cb(r)}`:Cb(r)}const Vh={timeBySeconds:AR,timeByMinutesWithDates:MR,date:RR},ee={seconds:"seconds",minutes:"minutes",date:"date"},Lo={day:r=>{const t=new Date(r.getTime());return t.setHours(0,0,0,0),t.getTime()},week:r=>{const t=new Date(r.getTime());return t.setHours(0,0,0,0),t.setDate(r.getDate()-r.getDay()+1),t.getTime()}},Ct={second:1e3,minute:1e3*60,hour:1e3*60*60,day:1e3*60*60*24,week:1e3*60*60*24*7},Eb=[{ceiling:Ct.second*4,increment:Ct.second,labelFormat:ee.seconds},{ceiling:Ct.second*8,increment:Ct.second*5,labelFormat:ee.seconds},{ceiling:Ct.second*13,increment:Ct.second*10,labelFormat:ee.seconds},{ceiling:Ct.second*20,increment:Ct.second*15,labelFormat:ee.seconds},{ceiling:Ct.second*45,increment:Ct.second*30,labelFormat:ee.seconds},{ceiling:Ct.minute*4,increment:Ct.minute,labelFormat:ee.minutes},{ceiling:Ct.minute*8,increment:Ct.minute*5,labelFormat:ee.minutes},{ceiling:Ct.minute*13,increment:Ct.minute*10,labelFormat:ee.minutes},{ceiling:Ct.minute*28,increment:Ct.minute*15,labelFormat:ee.minutes},{ceiling:Ct.hour*1.24,increment:Ct.minute*30,labelFormat:ee.minutes},{ceiling:Ct.hour*3,increment:Ct.hour,labelFormat:ee.minutes},{ceiling:Ct.hour*8,increment:Ct.hour*2,getAnchor:Lo.day,labelFormat:ee.minutes},{ceiling:Ct.hour*13,increment:Ct.hour*6,getAnchor:Lo.day,labelFormat:ee.minutes},{ceiling:Ct.hour*22,increment:Ct.hour*12,getAnchor:Lo.day,labelFormat:ee.minutes},{ceiling:Ct.day*4,increment:Ct.day,getAnchor:Lo.day,labelFormat:ee.date},{ceiling:Ct.week*2,increment:Ct.week,getAnchor:Lo.week,labelFormat:ee.date},{ceiling:1/0,increment:Ct.week*4,labelFormat:ee.date}],LR=300;async function PR(){const r=await we(),t=await Ue(),e=new At,i=new Map;let s=await Es();nt.on("scaleUpdated",d=>s=d),await o();function n(){if(e.visible=!t.disableGuides,!t.disableGuides)try{const{anchor:d,increment:f,labelFormat:m}=a(),p=u(d,f);c(p,m)}catch(d){if(d instanceof Sb)return;console.error(d)}}async function o(){const d=[];Cd(30,async f=>{const m=IR();d.push(m);const p=await m;e.addChild(p.element),i.set(f,p)}),await Promise.all(d)}function a(){const d=r.left-LR,f=s.invert(d),m=s.invert(d+260/r.scale.x);if(!(f instanceof Date)||!(m instanceof Date))throw new Sb;const p=m.getTime()-f.getTime(),{increment:g,getAnchor:y,labelFormat:_}=h(p);return{anchor:y(f),increment:g,labelFormat:l(_)}}function h(d){const f=Eb.find(m=>m.ceiling>d)??Eb[0];return f.getAnchor||(f.getAnchor=m=>Math.floor(m.getTime()/f.increment)*f.increment),f}function l(d){switch(d){case ee.minutes:return Vh.timeByMinutesWithDates;case ee.date:return Vh.date;default:return Vh.timeBySeconds}}function c(d,f){const m=new Map(i.entries()),p=Array.from(m.keys()).filter(g=>!d.includes(g));i.clear();for(const g of d){if(m.has(g)){const _=m.get(g);i.set(g,_),_.render(new Date(g),f);continue}const y=m.get(p.pop()??-1);if(y===void 0){console.warn("Guides: No unused guides available to render.");continue}y.render(new Date(g),f),i.set(g,y)}}function u(d,f){return Cd(30,m=>d+f*m)}return{element:e,render:n}}async function GR(){const r=await de(),{element:t,render:e}=await PR();r.stage.addChild(t),e(),nt.on("viewportDateRangeUpdated",()=>e()),nt.on("layoutSettingsUpdated",()=>e()),nt.on("configUpdated",()=>e())}function ZM(){}const FR=80;async function NR(){const r=await de(),t=await we(),e=await Ue(),i=await Yt(),s=await Ao();let n=await Es();nt.on("scaleUpdated",h=>n=h);function o(){if(!e.isTemporal()){s.visible=!1;return}s.width=i.styles.playheadWidth,s.height=r.stage.height,s.tint=i.styles.playheadColor,s.position.x=n(new Date)*t.scale.x+t.worldTransform.tx,a()}function a(){if(t.moving||!(s.position.x>0&&s.position.x<r.screen.width)||!(s.position.x>r.screen.width-FR))return;const c=t.left;t.zoomPercent(-.1,!0),t.left=c}return{element:s,render:o}}async function DR(){const r=await de(),t=await Go(),{element:e,render:i}=await NR();t.end_time||(r.stage.addChild(e),r.ticker.add(i)),nt.on("runDataUpdated",({end_time:s})=>{s&&(r.ticker.remove(i),r.stage.removeChild(e))})}function VM(){}function kR({stage:r,props:t}){HS(),gA(),pA(),GR(),ZR(),wR(),ER(),DR(),$S(),VA(),ZS(r),eC(t),TA(),jR(),JA()}function OR(){nt.clear();try{KS(),yA(),mA(),VS(),VR(),iC(),QS(),KA(),wA(),JR(),$A(),IA()}catch(r){console.error(r)}}async function BR(r){const t=await Yt(),e=await de(),i=await tb(),s=await Ue();let n=null;const o=new Map,{animate:a}=await ib(),{element:h,render:l,bar:c}=await E(r);let u=r,d=null,f=!1,m=!1;i.add(h),h.eventMode="static",h.cursor="pointer",h.name=kb,h.on("click",G=>{G.stopPropagation(),Ro({kind:u.kind,id:u.id})}),r.end_time||v(),nt.on("itemSelected",()=>{const G=Mo({kind:u.kind,id:u.id});G!==f&&(f=G,l(u))});async function p(G){u=G;const N=A(G);return N===d||(d=N,await Promise.all([l(G),g(G.artifacts)]),n&&(n.visible=!s.disableArtifacts),G.end_time&&w()),h}async function g(G){if(!G||s.disableArtifacts)return;n||_();const N=[];for(const P of G)N.push(y(P));await Promise.all(N),b()}async function y(G){if(o.has(G.id))return o.get(G.id).render();const N=await yb(G);return o.set(G.id,N),n.addChild(N.element),N.render()}function _(){n=new At,h.addChild(n)}function b(){if(!n)return;const{artifactsGap:G,artifactsNodeOverlap:N}=t.styles;let P=0;for(const I of o.values())I.element.position.x=P,P+=I.element.width+G;n.position.y=-n.height+N,n.width<c.width&&(n.position.x=c.width-n.width)}function v(){e.ticker.add(C)}function w(){e.ticker.remove(C)}function C(){p(r)}async function E(G){const{kind:N}=G;switch(N){case"task-run":return await eR();case"flow-run":return await tR(G);default:const P=N;throw new Error(`switch does not have case for value: ${P}`)}}function A(G){var D;const N=G.end_time??new Date,P=((D=G.artifacts)==null?void 0:D.length)??0;return[G.state_type,N.getTime(),P,ct.horizontal,ct.horizontalScaleMultiplier,t.styles.colorMode].join("-")}function R({x:G,y:N}){a(h,{x:G,y:N},!m),m=!0}return{element:h,render:p,bar:c,setPosition:R}}function Ib({gap:r=0,minimum:t=0}={}){const e=new Map;function i(c){const u=e.get(c)??[];return Math.max(...u.values(),z.toValue(t))+z.toValue(r)}function s(c){let u=0;for(let d=0;d<c;d++)u+=i(d);return u}function n(c){return s(c+1)-z.toValue(r)}function o({axis:c,nodeId:u,offset:d}){const f=e.get(c)??new Map;f.set(u,d),e.set(c,f)}function a({axis:c,nodeId:u}){let d,f;for(const[m,p]of e.entries())if(p.has(u)){d=m,f=p.get(u);break}d===c||d===void 0||f===void 0||(h({axis:d,nodeId:u}),o({axis:c,nodeId:u,offset:f}))}function h({axis:c,nodeId:u}){var d;(d=e.get(c))==null||d.delete(u)}function l(){e.clear()}return{getOffset:i,getTotalOffset:s,getTotalValue:n,setOffset:o,updateNodeAxis:a,removeOffset:h,clear:l}}function WR(r){throw new Error(`switch does not have case for value: ${r}`)}const Ab="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIEtlKG4pe3Rocm93IG5ldyBFcnJvcihgc3dpdGNoIGRvZXMgbm90IGhhdmUgY2FzZSBmb3IgdmFsdWU6ICR7bn1gKX1mdW5jdGlvbiBDbihuLGUpe3JldHVybiBuPT1udWxsfHxlPT1udWxsP05hTjpuPGU/LTE6bj5lPzE6bj49ZT8wOk5hTn1mdW5jdGlvbiBudChuLGUpe3JldHVybiBuPT1udWxsfHxlPT1udWxsP05hTjplPG4/LTE6ZT5uPzE6ZT49bj8wOk5hTn1mdW5jdGlvbiBSbihuKXtsZXQgZSx0LHI7bi5sZW5ndGghPT0yPyhlPUNuLHQ9KHUsbCk9PkNuKG4odSksbCkscj0odSxsKT0+bih1KS1sKTooZT1uPT09Q258fG49PT1udD9uOmV0LHQ9bixyPW4pO2Z1bmN0aW9uIG8odSxsLGY9MCxnPXUubGVuZ3RoKXtpZihmPGcpe2lmKGUobCxsKSE9PTApcmV0dXJuIGc7ZG97Y29uc3QgbT1mK2c+Pj4xO3QodVttXSxsKTwwP2Y9bSsxOmc9bX13aGlsZShmPGcpfXJldHVybiBmfWZ1bmN0aW9uIGkodSxsLGY9MCxnPXUubGVuZ3RoKXtpZihmPGcpe2lmKGUobCxsKSE9PTApcmV0dXJuIGc7ZG97Y29uc3QgbT1mK2c+Pj4xO3QodVttXSxsKTw9MD9mPW0rMTpnPW19d2hpbGUoZjxnKX1yZXR1cm4gZn1mdW5jdGlvbiBhKHUsbCxmP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UoKS1hfSk7bGV0IHI9MDtmb3IoY29uc3QgbyBvZiB0KWUuc2V0KG8uaWQscisrKTtyZXR1cm4gZX1vbm1lc3NhZ2U9RG87ZnVuY3Rpb24gRG8oe2RhdGE6bn0pe2NvbnN0e3R5cGU6ZX09bjtzd2l0Y2goZSl7Y2FzZSJsYXlvdXQiOlNvKG4pO3JldHVybjtkZWZhdWx0OktlKGUpfX1mdW5jdGlvbiBrbyhuKXtwb3N0TWVzc2FnZShuKX1hc3luYyBmdW5jdGlvbiBTbyhuKXtjb25zdHtkYXRhOmV9PW4sdD13byhuKSxyPWF3YWl0IENvKG4sdCksbz1uZXcgTWFwO2xldCBpPTAsYT0wO2Zvcihjb25zdFt1LGxdb2YgZS5ub2Rlcyl7Y29uc3QgZj10LmdldCh1KSxnPXIuZ2V0KHUpO2lmKGY9PT12b2lkIDApe2NvbnNvbGUud2FybihgTm9kZUlkIG5vdCBmb3VuZCBpbiBob3Jpem9udGFsIGxheW91dDogU2tpcHBpbmcgJHtsLmxhYmVsfWApO2NvbnRpbnVlfWlmKGc9PT12b2lkIDApe2NvbnNvbGUud2FybihgTm9kZUlkIG5vdCBmb3VuZCBpbiB2ZXJ0aWNhbCBsYXlvdXQ6IFNraXBwaW5nICR7bC5sYWJlbH1gKTtjb250aW51ZX1pPU1hdGgubWF4KGksZyksYT1NYXRoLm1heChhLGYuY29sdW1uKSxvLnNldCh1LHsuLi5mLHk6Zyxyb3c6Z30pfWtvKHt0eXBlOiJsYXlvdXQiLGxheW91dDp7bWF4Um93OmksbWF4Q29sdW1uOmEscG9zaXRpb25zOm99fSl9fSkoKTsKLy8jIHNvdXJjZU1hcHBpbmdVUkw9cnVuR3JhcGgud29ya2VyLXNkX0hraDUwLmpzLm1hcAo=",Rb=typeof window<"u"&&window.Blob&&new Blob([atob(Ab)],{type:"text/javascript;charset=utf-8"});function UR(r){let t;try{if(t=Rb&&(window.URL||window.webkitURL).createObjectURL(Rb),!t)throw"";const e=new Worker(t,{name:r==null?void 0:r.name});return e.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(t)}),e}catch{return new Worker("data:text/javascript;base64,"+Ab,{name:r==null?void 0:r.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}function XR(r){const t=new UR;return t.onmessage=r,t}async function Mb(){const r=new Map,t=new Map,e=new At,i=new At,s=await Yt();let n=null;const o=Ib({gap:()=>s.styles.rowGap,minimum:()=>s.styles.nodeHeight}),a=Ib({gap:()=>s.styles.columnGap,minimum:()=>Pd()});let h=null,l=null;e.name=Cf,nt.on("layoutUpdated",()=>{o.clear(),a.clear()}),nt.on("layoutSettingsUpdated",()=>{l&&e.parent&&c(l),I()}),nt.on("itemSelected",()=>{I()});async function c(O){u(),l=O,h=null,await Promise.all([f(O),p(O)]),y(O)}function u(){n||(n=XR(N))}function d(){n&&(n.terminate(),n=null)}async function f(O){const k=[];for(const F of O.nodes.values())k.push(m(F));await Promise.all(k)}async function m(O){const{render:k}=await v(O);return await k(O)}async function p(O){if((await Ue()).disableEdges){e.removeChild(i);return}e.addChildAt(i,0);const F=[];for(const[V,{children:$}]of O.nodes)for(const{id:dt}of $)F.push(g(V,dt));await Promise.all(F)}async function g(O,k){const F=`${O}_${k}`;if(t.has(F))return;const V=await PA();t.has(F)||(t.set(F,V),i.addChild(V.element))}function y(O){if(!n)throw new Error("Layout worker not initialized");const k=new Map;for(const[F,{element:V}]of r)k.set(F,V.width);n.postMessage({type:"layout",data:O,widths:k,horizontalSettings:_d(O.start_time),verticalSettings:fA()})}function _(){if(h)for(const[O,k]of t){const[F,V]=O.split("_"),$=h.positions.get(F),dt=h.positions.get(V),ot=r.get(F);if(!$||!dt){console.warn(`Could not find edge in layout: Skipping ${O}`);continue}if(!ot){console.warn(`Could not find parent node in nodes: Skipping ${F}`);continue}const Et=ot.bar.width,Mt=C($),_t={x:Mt.x+Et,y:Mt.y+s.styles.nodeHeight/2},Y=C(dt),tt={x:Y.x-_t.x,y:Y.y-_t.y+s.styles.nodeHeight/2};k.setPosition(_t,tt)}}function b(){if(h){for(const[O,k]of r){const F=h.positions.get(O);if(!F){console.warn(`Could not find node in layout: Skipping ${O}`);continue}const V=C(F);k.setPosition(V),o.updateNodeAxis({nodeId:O,axis:F.y}),a.updateNodeAxis({nodeId:O,axis:F.column})}_(),e.emit("rendered"),e.emit("resized",G())}}async function v(O){const k=r.get(O.id);if(k)return k;const F=await BR(O);return F.element.on("resized",V=>w(O.id,V)),r.set(O.id,F),e.addChild(F.element),F}function w(O,k){if(!h)return;const F=r.get(O),V=h.positions.get(O);!F||!V||(o.setOffset({nodeId:O,axis:V.y,offset:k.height}),a.setOffset({nodeId:O,axis:V.column,offset:k.width}),b())}function C(O){const k=o.getTotalOffset(O.y);return{x:E(O),y:k}}function E(O){return ct.isDependency()?a.getTotalOffset(O.column):O.x}function A(){return h?o.getTotalValue(h.maxRow):0}function R(){if(!h||!l)return 0;if(ct.isDependency())return a.getTotalValue(h.maxColumn);const O=_d(l.start_time),k=Jy(O),F=k(l.end_time??new Date),V=k(l.start_time);return F-V}function G(){return{width:R(),height:A()}}function N({data:O}){const{type:k}=O;switch(k){case"layout":P(O);return;default:WR(k)}}function P(O){h=O.layout,b()}async function I(){const O=await Ue(),k=QA();if(!k||O.disableEdges){D([]);return}const F=Z(k.id);D(F)}function D(O){X(O),H(O)}function X(O){for(const[k,{element:F}]of r){if(O.length===0||O.includes(k)){F.alpha=1;continue}F.alpha=s.styles.nodeUnselectedAlpha}}function H(O){for(const[k,{element:F}]of t){const[V,$]=k.split("_");if(O.length===0||O.includes(V)&&O.includes($)){F.alpha=1;continue}F.alpha=s.styles.nodeUnselectedAlpha}}function Z(O){const k=j(O,"parents"),F=j(O,"children");return[O,...k,...F]}function j(O,k){const F=l==null?void 0:l.nodes.get(O);if(!F)return[];const V=[];for(const{id:$}of F[k])V.push($),V.push(...j($,k));return V}return{element:e,stopWorker:d,getSize:G,render:c}}let Po=null,Br=null,Is=null;async function ZR(){const r=await we(),t=await Yt(),{element:e,render:i}=await Mb();r.addChild(e),e.alpha=0;const s=await U0(t.runId,async n=>{const o=Br?"runDataUpdated":"runDataCreated";Br=n,nt.emit(o,Br),await Ue(),i(n)});nt.on("configUpdated",()=>{Br&&i(Br)}),Is=e,Po=s.stop,Is.once("rendered",()=>HR()),nt.on("layoutUpdated",()=>KR()),s.start()}function VR(){Po==null||Po(),Po=null,Is=null,Br=null}async function Go(){return Br||await Fe("runDataCreated")}function HR(){Td(),ve.shared.addOnce(()=>{Is&&(Is.alpha=1)})}async function KR(){if(!Is)return;const r=await Yt();Is.once("rendered",()=>{setTimeout(()=>{Td({animate:!0})},r.animationDuration)})}function YR(r){let t=0;for(const[,{children:e}]of r)t+=e.length;return t}function zR({start_time:r,end_time:t,nodes:e},i,s){const n=Math.max(Zb(t??new Date,r),1),o=i.styles.nodeHeight+i.styles.rowGap,a=.5;return e.size*o*a*s/(n*20)}async function jR(){const r=await Go(),t=await Yt(),e=await de(),i=e.view.width/e.view.height,s=zR(r,t,i);Hh(s,!0),r.nodes.size>t.disableAnimationsThreshold&&(ct.disableAnimations=!0),YR(r.nodes)>t.disableEdgesThreshold&&(ct.disableEdges=!0)}function JR(){ct.horizontal="temporal",ct.vertical="nearest-parent",ct.horizontalScaleMultiplierDefault=0,ct.horizontalScaleMultiplier=0,ct.disableAnimations=!1,ct.disableGuides=!1,ct.disableEdges=!1,ct.disableArtifacts=!1}const ct=z.reactive({horizontal:"temporal",vertical:"nearest-parent",horizontalScaleMultiplierDefault:0,horizontalScaleMultiplier:0,disableAnimations:!1,disableGuides:!1,disableEdges:!1,disableArtifacts:!1,isTemporal(){return this.horizontal==="temporal"},isDependency(){return this.horizontal==="dependency"},isWaterfall(){return this.vertical==="waterfall"},isNearestParent(){return this.vertical==="nearest-parent"},isLeftAligned(){return this.horizontal==="left-aligned"}});async function Ue(){return Gd()?ct:await Fe("layoutSettingsCreated")}function Pd(){return ct.isDependency()?200:20*ct.horizontalScaleMultiplier}function $R(){return[0,Pd()]}function QR(r){if(ct.isDependency())return[0,1];const t=r,e=Ub(t,1);return[t,e]}function Hh(r,t=!1){if(ct.horizontalScaleMultiplier===r)return;const e=Fo();ct.horizontalScaleMultiplier=r,t&&(ct.horizontalScaleMultiplierDefault=r),e()}function qR(){Hh(ct.horizontalScaleMultiplierDefault)}function tM(r){if(ct.horizontal===r)return;const t=Fo();ct.horizontal=r,ct.disableGuides=ct.isDependency()||ct.isLeftAligned(),t()}function eM(r){if(ct.vertical===r)return;const t=Fo();ct.vertical=r,t()}function iM(r){if(ct.disableEdges===r)return;const t=Fo();ct.disableEdges=r,t()}function rM(r){if(ct.disableArtifacts===r)return;const t=Fo();ct.disableArtifacts=r,t()}function Fo(){const r=Gd()?"layoutSettingsUpdated":"layoutSettingsCreated",{horizontal:t,vertical:e}=ct;return()=>{Gd()&&nt.emit(r,ct),(t!==ct.horizontal||e!==ct.vertical)&&nt.emit("layoutUpdated")}}function Gd(){return ct.horizontalScaleMultiplier!==0}function Lb(r){if(!(r instanceof HTMLElement))return!1;const t=r.tagName.toLowerCase();return["input","textarea"].includes(t)}const sM={class:"flex items-center gap-2"},nM=z.defineComponent({__name:"RunGraphSettings",setup(r){const t=[Ki.positions.topRight,Ki.positions.bottomRight,Ki.positions.topLeft,Ki.positions.bottomLeft],e=[{label:"Temporal dependency",value:"temporal_nearest-parent"},{label:"Temporal sequence",value:"temporal_waterfall"},{label:"Dependency grid",value:"dependency_nearest-parent"},{label:"Sequential grid",value:"dependency_waterfall"},{label:"Comparative duration",value:"left-aligned_duration-sorted"}],i=z.computed({get(){return`${ct.horizontal}_${ct.vertical}`},set(c){const[u,d]=c.split("_");tM(u),eM(d)}}),s=z.computed({get(){return ct.disableEdges},set(c){iM(c)}}),n=z.computed({get(){return ct.disableArtifacts},set(c){rM(c)}});function o(){const u=ct.horizontalScaleMultiplier*1.25;Hh(u)}function a(){const c=Math.abs(-.75),u=ct.horizontalScaleMultiplier*c;Hh(u)}mr.useKeyDown(["-","="],h);function h(c){if(!(Lb(c.target)||c.metaKey||c.ctrlKey))switch(c.key){case"-":a();break;case"=":o();break}}function l(){qR()}return(c,u)=>{const d=z.resolveComponent("p-radio-group"),f=z.resolveComponent("p-label"),m=z.resolveComponent("p-divider"),p=z.resolveComponent("p-checkbox"),g=z.resolveComponent("p-overflow-menu");return z.openBlock(),z.createBlock(z.unref(Ki.PPopOver),{class:"run-graph-settings","auto-close":"",placement:t},{target:z.withCtx(({toggle:y})=>[z.createVNode(z.unref(Ki.PButton),{"aria-label":"Run Graph Options",icon:"CogIcon",flat:"",onClick:y},null,8,["onClick"])]),default:z.withCtx(()=>[z.createVNode(g,{class:"run-graph-settings__menu"},{default:z.withCtx(()=>[z.createVNode(f,{label:"Layout"},{default:z.withCtx(()=>[z.createVNode(d,{modelValue:i.value,"onUpdate:modelValue":u[0]||(u[0]=y=>i.value=y),options:e},{label:z.withCtx(({option:y})=>[z.createTextVNode(z.toDisplayString(y.label),1)]),_:1},8,["modelValue"])]),_:1}),z.unref(ct).isTemporal()||z.unref(ct).isLeftAligned()?(z.openBlock(),z.createElementBlock(z.Fragment,{key:0},[z.createVNode(m),z.createVNode(f,{label:"Scaling"},{default:z.withCtx(()=>[z.createElementVNode("div",sM,[z.createVNode(z.unref(Ki.PButton),{title:"Decrease scale (-)",small:"",icon:"MinusIcon",onClick:a}),z.createVNode(z.unref(Ki.PButton),{title:"Increase scale (+)",small:"",icon:"PlusIcon",onClick:o}),z.createVNode(z.unref(Ki.PButton),{small:"",onClick:l},{default:z.withCtx(()=>[z.createTextVNode(" Reset ")]),_:1})])]),_:1})],64)):z.createCommentVNode("",!0),z.createVNode(m),z.createVNode(p,{modelValue:s.value,"onUpdate:modelValue":u[1]||(u[1]=y=>s.value=y),label:"Hide dependency arrows"},null,8,["modelValue"]),z.createVNode(p,{modelValue:n.value,"onUpdate:modelValue":u[2]||(u[2]=y=>n.value=y),label:"Hide artifacts"},null,8,["modelValue"])]),_:1})]),_:1})}}}),oM={class:"run-graph__actions"},aM=z.defineComponent({__name:"RunGraph",props:{config:{},viewport:{},fullscreen:{type:[Boolean,null],default:null},selected:{default:null}},emits:["update:viewport","update:fullscreen","update:selected"],setup(r,{emit:t}){const e=r,i=z.ref(),s=z.ref(!1),n=z.computed({get(){return e.fullscreen??s.value},set(c){s.value=c,t("update:fullscreen",c)}});z.watch(()=>e.selected,c=>Ro(c)),nt.on("itemSelected",c=>t("update:selected",c)),z.watch(()=>e.viewport,c=>_A(c));const o=z.computed(()=>({root:{"run-graph--fullscreen":n.value}}));nt.on("viewportDateRangeUpdated",c=>t("update:viewport",c));function a(){Td({animate:!0})}function h(){n.value=!n.value}z.onMounted(()=>{if(!i.value)throw new Error("Stage does not exist");kR({stage:i.value,props:e})}),z.onBeforeUnmount(()=>{OR()}),mr.useKeyDown(["c","f","Escape"],l);function l(c){if(!(Lb(c.target)||c.metaKey||c.ctrlKey))switch(c.key){case"c":a();break;case"f":h();break;case"Escape":n.value&&h();break}}return(c,u)=>{const d=z.resolveComponent("p-button");return z.openBlock(),z.createElementBlock("div",{class:z.normalizeClass(["run-graph",o.value.root])},[z.createElementVNode("div",{ref_key:"stage",ref:i,class:"run-graph__stage"},null,512),z.createElementVNode("div",oM,[z.createVNode(d,{title:"Recenter graph (c)",icon:"Target",flat:"",onClick:a}),z.createVNode(d,{title:"Toggle fullscreen (f)",icon:"ArrowsPointingOutIcon",flat:"",onClick:h}),z.createVNode(nM)])],2)}}});Vt.RunGraph=aM,Vt.artifactTypeIconMap=fb,Vt.artifactTypes=zA,Vt.isArtifactSelection=pb,Vt.isArtifactsSelection=mb,Vt.isNodeSelection=Md,Vt.isRunGraphNodeType=jA,Vt.runGraphNodeKinds=Uh,Object.defineProperty(Vt,Symbol.toStringTag,{value:"Module"})});
|
|
1175
|
+
*/var kg,Nr,cn,Xu,ms,Og,Zu,$E=function(){return typeof window<"u"},nr={},gs=180/Math.PI,un=Math.PI/180,dn=Math.atan2,Bg=1e8,Vu=/([A-Z])/g,QE=/(left|right|width|margin|padding|x)/i,qE=/[\s,\(]\S/,Ni={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},Hu=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},tC=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)},eC=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)},iC=function(t,e){var i=e.s+e.c*t;e.set(e.t,e.p,~~(i+(i<0?-.5:.5))+e.u,e)},Wg=function(t,e){return e.set(e.t,e.p,t?e.e:e.b,e)},Ug=function(t,e){return e.set(e.t,e.p,t!==1?e.b:e.e,e)},rC=function(t,e,i){return t.style[e]=i},sC=function(t,e,i){return t.style.setProperty(e,i)},nC=function(t,e,i){return t._gsap[e]=i},oC=function(t,e,i){return t._gsap.scaleX=t._gsap.scaleY=i},aC=function(t,e,i,s,n){var o=t._gsap;o.scaleX=o.scaleY=i,o.renderTransform(n,o)},hC=function(t,e,i,s,n){var o=t._gsap;o[e]=i,o.renderTransform(n,o)},Zt="transform",Re=Zt+"Origin",lC=function r(t,e){var i=this,s=this.target,n=s.style,o=s._gsap;if(t in nr&&n){if(this.tfm=this.tfm||{},t!=="transform")t=Ni[t]||t,~t.indexOf(",")?t.split(",").forEach(function(a){return i.tfm[a]=or(s,a)}):this.tfm[t]=o.x?o[t]:or(s,t),t===Re&&(this.tfm.zOrigin=o.zOrigin);else return Ni.transform.split(",").forEach(function(a){return r.call(i,a,e)});if(this.props.indexOf(Zt)>=0)return;o.svg&&(this.svgo=s.getAttribute("data-svg-origin"),this.props.push(Re,e,"")),t=Zt}(n||e)&&this.props.push(t,e,n[t])},Xg=function(t){t.translate&&(t.removeProperty("translate"),t.removeProperty("scale"),t.removeProperty("rotate"))},cC=function(){var t=this.props,e=this.target,i=e.style,s=e._gsap,n,o;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(Vu,"-$1").toLowerCase());if(this.tfm){for(o in this.tfm)s[o]=this.tfm[o];s.svg&&(s.renderTransform(),e.setAttribute("data-svg-origin",this.svgo||"")),n=Zu(),(!n||!n.isStart)&&!i[Zt]&&(Xg(i),s.zOrigin&&i[Re]&&(i[Re]+=" "+s.zOrigin+"px",s.zOrigin=0,s.renderTransform()),s.uncache=1)}},Zg=function(t,e){var i={target:t,props:[],revert:cC,save:lC};return t._gsap||Ae.core.getCache(t),e&&e.split(",").forEach(function(s){return i.save(s)}),i},Vg,Ku=function(t,e){var i=Nr.createElementNS?Nr.createElementNS((e||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),t):Nr.createElement(t);return i&&i.style?i:Nr.createElement(t)},Di=function r(t,e,i){var s=getComputedStyle(t);return s[e]||s.getPropertyValue(e.replace(Vu,"-$1").toLowerCase())||s.getPropertyValue(e)||!i&&r(t,fn(e)||e,1)||""},Hg="O,Moz,ms,Ms,Webkit".split(","),fn=function(t,e,i){var s=e||ms,n=s.style,o=5;if(t in n&&!i)return t;for(t=t.charAt(0).toUpperCase()+t.substr(1);o--&&!(Hg[o]+t in n););return o<0?null:(o===3?"ms":o>=0?Hg[o]:"")+t},Yu=function(){$E()&&window.document&&(kg=window,Nr=kg.document,cn=Nr.documentElement,ms=Ku("div")||{style:{}},Ku("div"),Zt=fn(Zt),Re=Zt+"Origin",ms.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",Vg=!!fn("perspective"),Zu=Ae.core.reverting,Xu=1)},zu=function r(t){var e=Ku("svg",this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),i=this.parentNode,s=this.nextSibling,n=this.style.cssText,o;if(cn.appendChild(e),e.appendChild(this),this.style.display="block",t)try{o=this.getBBox(),this._gsapBBox=this.getBBox,this.getBBox=r}catch{}else this._gsapBBox&&(o=this._gsapBBox());return i&&(s?i.insertBefore(this,s):i.appendChild(this)),cn.removeChild(e),this.style.cssText=n,o},Kg=function(t,e){for(var i=e.length;i--;)if(t.hasAttribute(e[i]))return t.getAttribute(e[i])},Yg=function(t){var e;try{e=t.getBBox()}catch{e=zu.call(t,!0)}return e&&(e.width||e.height)||t.getBBox===zu||(e=zu.call(t,!0)),e&&!e.width&&!e.x&&!e.y?{x:+Kg(t,["x","cx","x1"])||0,y:+Kg(t,["y","cy","y1"])||0,width:0,height:0}:e},zg=function(t){return!!(t.getCTM&&(!t.parentNode||t.ownerSVGElement)&&Yg(t))},ys=function(t,e){if(e){var i=t.style,s;e in nr&&e!==Re&&(e=Zt),i.removeProperty?(s=e.substr(0,2),(s==="ms"||e.substr(0,6)==="webkit")&&(e="-"+e),i.removeProperty(s==="--"?e:e.replace(Vu,"-$1").toLowerCase())):i.removeAttribute(e)}},Dr=function(t,e,i,s,n,o){var a=new Ie(t._pt,e,i,0,1,o?Ug:Wg);return t._pt=a,a.b=s,a.e=n,t._props.push(i),a},jg={deg:1,rad:1,turn:1},uC={grid:1,flex:1},kr=function r(t,e,i,s){var n=parseFloat(i)||0,o=(i+"").trim().substr((n+"").length)||"px",a=ms.style,h=QE.test(e),l=t.tagName.toLowerCase()==="svg",c=(l?"client":"offset")+(h?"Width":"Height"),u=100,d=s==="px",f=s==="%",m,p,g,y;if(s===o||!n||jg[s]||jg[o])return n;if(o!=="px"&&!d&&(n=r(t,e,i,"px")),y=t.getCTM&&zg(t),(f||o==="%")&&(nr[e]||~e.indexOf("adius")))return m=y?t.getBBox()[h?"width":"height"]:t[c],zt(f?n/m*u:n/100*m);if(a[h?"width":"height"]=u+(d?o:s),p=~e.indexOf("adius")||s==="em"&&t.appendChild&&!l?t:t.parentNode,y&&(p=(t.ownerSVGElement||{}).parentNode),(!p||p===Nr||!p.appendChild)&&(p=Nr.body),g=p._gsap,g&&f&&g.width&&h&&g.time===We.time&&!g.uncache)return zt(n/g.width*u);if(f&&(e==="height"||e==="width")){var _=t.style[e];t.style[e]=u+s,m=t[c],_?t.style[e]=_:ys(t,e)}else(f||o==="%")&&!uC[Di(p,"display")]&&(a.position=Di(t,"position")),p===t&&(a.position="static"),p.appendChild(ms),m=ms[c],p.removeChild(ms),a.position="absolute";return h&&f&&(g=ls(p),g.time=We.time,g.width=p[c]),zt(d?m*n/u:m&&n?u/m*n:0)},or=function(t,e,i,s){var n;return Xu||Yu(),e in Ni&&e!=="transform"&&(e=Ni[e],~e.indexOf(",")&&(e=e.split(",")[0])),nr[e]&&e!=="transform"?(n=bo(t,s),n=e!=="transformOrigin"?n[e]:n.svg?n.origin:xh(Di(t,Re))+" "+n.zOrigin+"px"):(n=t.style[e],(!n||n==="auto"||s||~(n+"").indexOf("calc("))&&(n=bh[e]&&bh[e](t,e,i)||Di(t,e)||q0(t,e)||(e==="opacity"?1:0))),i&&!~(n+"").trim().indexOf(" ")?kr(t,e,n,i)+i:n},dC=function(t,e,i,s){if(!i||i==="none"){var n=fn(e,t,1),o=n&&Di(t,n,1);o&&o!==i?(e=n,i=o):e==="borderColor"&&(i=Di(t,"borderTopColor"))}var a=new Ie(this._pt,t.style,e,0,1,Gg),h=0,l=0,c,u,d,f,m,p,g,y,_,b,v,w;if(a.b=i,a.e=s,i+="",s+="",s==="auto"&&(p=t.style[e],t.style[e]=s,s=Di(t,e)||s,p?t.style[e]=p:ys(t,e)),c=[i,s],wg(c),i=c[0],s=c[1],d=i.match(sn)||[],w=s.match(sn)||[],w.length){for(;u=sn.exec(s);)g=u[0],_=s.substring(h,u.index),m?m=(m+1)%5:(_.substr(-5)==="rgba("||_.substr(-5)==="hsla(")&&(m=1),g!==(p=d[l++]||"")&&(f=parseFloat(p)||0,v=p.substr((f+"").length),g.charAt(1)==="="&&(g=nn(f,g)+v),y=parseFloat(g),b=g.substr((y+"").length),h=sn.lastIndex-b.length,b||(b=b||De.units[e]||v,h===s.length&&(s+=b,a.e+=b)),v!==b&&(f=kr(t,e,p,b)||0),a._pt={_next:a._pt,p:_||l===1?_:",",s:f,c:y-f,m:m&&m<4||e==="zIndex"?Math.round:0});a.c=h<s.length?s.substring(h,s.length):""}else a.r=e==="display"&&s==="none"?Ug:Wg;return K0.test(s)&&(a.e=0),this._pt=a,a},Jg={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},fC=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]=Jg[i]||i,e[1]=Jg[s]||s,e.join(" ")},pC=function(t,e){if(e.tween&&e.tween._time===e.tween._dur){var i=e.t,s=i.style,n=e.u,o=i._gsap,a,h,l;if(n==="all"||n===!0)s.cssText="",h=1;else for(n=n.split(","),l=n.length;--l>-1;)a=n[l],nr[a]&&(h=1,a=a==="transformOrigin"?Re:Zt),ys(i,a);h&&(ys(i,Zt),o&&(o.svg&&i.removeAttribute("transform"),bo(i,1),o.uncache=1,Xg(s)))}},bh={clearProps:function(t,e,i,s,n){if(n.data!=="isFromStart"){var o=t._pt=new Ie(t._pt,e,i,0,0,pC);return o.u=s,o.pr=-10,o.tween=n,t._props.push(i),1}}},yo=[1,0,0,1,0,0],$g={},Qg=function(t){return t==="matrix(1, 0, 0, 1, 0, 0)"||t==="none"||!t},qg=function(t){var e=Di(t,Zt);return Qg(e)?yo:e.substr(7).match(H0).map(zt)},ju=function(t,e){var i=t._gsap||ls(t),s=t.style,n=qg(t),o,a,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"?yo:n):(n===yo&&!t.offsetParent&&t!==cn&&!i.svg&&(h=s.display,s.display="block",o=t.parentNode,(!o||!t.offsetParent)&&(l=1,a=t.nextElementSibling,cn.appendChild(t)),n=qg(t),h?s.display=h:ys(t,"display"),l&&(a?o.insertBefore(t,a):o?o.appendChild(t):cn.removeChild(t))),e&&n.length>6?[n[0],n[1],n[4],n[5],n[12],n[13]]:n)},Ju=function(t,e,i,s,n,o){var a=t._gsap,h=n||ju(t,!0),l=a.xOrigin||0,c=a.yOrigin||0,u=a.xOffset||0,d=a.yOffset||0,f=h[0],m=h[1],p=h[2],g=h[3],y=h[4],_=h[5],b=e.split(" "),v=parseFloat(b[0])||0,w=parseFloat(b[1])||0,E,C,A,R;i?h!==yo&&(C=f*g-m*p)&&(A=v*(g/C)+w*(-p/C)+(p*_-g*y)/C,R=v*(-m/C)+w*(f/C)-(f*_-m*y)/C,v=A,w=R):(E=Yg(t),v=E.x+(~b[0].indexOf("%")?v/100*E.width:v),w=E.y+(~(b[1]||b[0]).indexOf("%")?w/100*E.height:w)),s||s!==!1&&a.smooth?(y=v-l,_=w-c,a.xOffset=u+(y*f+_*p)-y,a.yOffset=d+(y*m+_*g)-_):a.xOffset=a.yOffset=0,a.xOrigin=v,a.yOrigin=w,a.smooth=!!s,a.origin=e,a.originIsAbsolute=!!i,t.style[Re]="0px 0px",o&&(Dr(o,a,"xOrigin",l,v),Dr(o,a,"yOrigin",c,w),Dr(o,a,"xOffset",u,a.xOffset),Dr(o,a,"yOffset",d,a.yOffset)),t.setAttribute("data-svg-origin",v+" "+w)},bo=function(t,e){var i=t._gsap||new Ig(t);if("x"in i&&!e&&!i.uncache)return i;var s=t.style,n=i.scaleX<0,o="px",a="deg",h=getComputedStyle(t),l=Di(t,Re)||"0",c,u,d,f,m,p,g,y,_,b,v,w,E,C,A,R,G,N,P,I,D,X,H,Z,j,O,k,F,V,$,dt,ot;return c=u=d=p=g=y=_=b=v=0,f=m=1,i.svg=!!(t.getCTM&&zg(t)),h.translate&&((h.translate!=="none"||h.scale!=="none"||h.rotate!=="none")&&(s[Zt]=(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[Zt]!=="none"?h[Zt]:"")),s.scale=s.rotate=s.translate="none"),C=ju(t,i.svg),i.svg&&(i.uncache?(j=t.getBBox(),l=i.xOrigin-j.x+"px "+(i.yOrigin-j.y)+"px",Z=""):Z=!e&&t.getAttribute("data-svg-origin"),Ju(t,Z||l,!!Z||i.originIsAbsolute,i.smooth!==!1,C)),w=i.xOrigin||0,E=i.yOrigin||0,C!==yo&&(N=C[0],P=C[1],I=C[2],D=C[3],c=X=C[4],u=H=C[5],C.length===6?(f=Math.sqrt(N*N+P*P),m=Math.sqrt(D*D+I*I),p=N||P?dn(P,N)*gs:0,_=I||D?dn(I,D)*gs+p:0,_&&(m*=Math.abs(Math.cos(_*un))),i.svg&&(c-=w-(w*N+E*I),u-=E-(w*P+E*D))):(ot=C[6],$=C[7],k=C[8],F=C[9],V=C[10],dt=C[11],c=C[12],u=C[13],d=C[14],A=dn(ot,V),g=A*gs,A&&(R=Math.cos(-A),G=Math.sin(-A),Z=X*R+k*G,j=H*R+F*G,O=ot*R+V*G,k=X*-G+k*R,F=H*-G+F*R,V=ot*-G+V*R,dt=$*-G+dt*R,X=Z,H=j,ot=O),A=dn(-I,V),y=A*gs,A&&(R=Math.cos(-A),G=Math.sin(-A),Z=N*R-k*G,j=P*R-F*G,O=I*R-V*G,dt=D*G+dt*R,N=Z,P=j,I=O),A=dn(P,N),p=A*gs,A&&(R=Math.cos(A),G=Math.sin(A),Z=N*R+P*G,j=X*R+H*G,P=P*R-N*G,H=H*R-X*G,N=Z,X=j),g&&Math.abs(g)+Math.abs(p)>359.9&&(g=p=0,y=180-y),f=zt(Math.sqrt(N*N+P*P+I*I)),m=zt(Math.sqrt(H*H+ot*ot)),A=dn(X,H),_=Math.abs(A)>2e-4?A*gs:0,v=dt?1/(dt<0?-dt:dt):0),i.svg&&(Z=t.getAttribute("transform"),i.forceCSS=t.setAttribute("transform","")||!Qg(Di(t,Zt)),Z&&t.setAttribute("transform",Z))),Math.abs(_)>90&&Math.abs(_)<270&&(n?(f*=-1,_+=p<=0?180:-180,p+=p<=0?180:-180):(m*=-1,_+=_<=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)+o,i.y=u-((i.yPercent=u&&(!e&&i.yPercent||(Math.round(t.offsetHeight/2)===Math.round(-u)?-50:0)))?t.offsetHeight*i.yPercent/100:0)+o,i.z=d+o,i.scaleX=zt(f),i.scaleY=zt(m),i.rotation=zt(p)+a,i.rotationX=zt(g)+a,i.rotationY=zt(y)+a,i.skewX=_+a,i.skewY=b+a,i.transformPerspective=v+o,(i.zOrigin=parseFloat(l.split(" ")[2])||!e&&i.zOrigin||0)&&(s[Re]=xh(l)),i.xOffset=i.yOffset=0,i.force3D=De.force3D,i.renderTransform=i.svg?gC:Vg?ty:mC,i.uncache=0,i},xh=function(t){return(t=t.split(" "))[0]+" "+t[1]},$u=function(t,e,i){var s=ge(e);return zt(parseFloat(e)+parseFloat(kr(t,"x",i+"px",s)))+s},mC=function(t,e){e.z="0px",e.rotationY=e.rotationX="0deg",e.force3D=0,ty(t,e)},bs="0deg",xo="0px",xs=") ",ty=function(t,e){var i=e||this,s=i.xPercent,n=i.yPercent,o=i.x,a=i.y,h=i.z,l=i.rotation,c=i.rotationY,u=i.rotationX,d=i.skewX,f=i.skewY,m=i.scaleX,p=i.scaleY,g=i.transformPerspective,y=i.force3D,_=i.target,b=i.zOrigin,v="",w=y==="auto"&&t&&t!==1||y===!0;if(b&&(u!==bs||c!==bs)){var E=parseFloat(c)*un,C=Math.sin(E),A=Math.cos(E),R;E=parseFloat(u)*un,R=Math.cos(E),o=$u(_,o,C*R*-b),a=$u(_,a,-Math.sin(E)*-b),h=$u(_,h,A*R*-b+b)}g!==xo&&(v+="perspective("+g+xs),(s||n)&&(v+="translate("+s+"%, "+n+"%) "),(w||o!==xo||a!==xo||h!==xo)&&(v+=h!==xo||w?"translate3d("+o+", "+a+", "+h+") ":"translate("+o+", "+a+xs),l!==bs&&(v+="rotate("+l+xs),c!==bs&&(v+="rotateY("+c+xs),u!==bs&&(v+="rotateX("+u+xs),(d!==bs||f!==bs)&&(v+="skew("+d+", "+f+xs),(m!==1||p!==1)&&(v+="scale("+m+", "+p+xs),_.style[Zt]=v||"translate(0, 0)"},gC=function(t,e){var i=e||this,s=i.xPercent,n=i.yPercent,o=i.x,a=i.y,h=i.rotation,l=i.skewX,c=i.skewY,u=i.scaleX,d=i.scaleY,f=i.target,m=i.xOrigin,p=i.yOrigin,g=i.xOffset,y=i.yOffset,_=i.forceCSS,b=parseFloat(o),v=parseFloat(a),w,E,C,A,R;h=parseFloat(h),l=parseFloat(l),c=parseFloat(c),c&&(c=parseFloat(c),l+=c,h+=c),h||l?(h*=un,l*=un,w=Math.cos(h)*u,E=Math.sin(h)*u,C=Math.sin(h-l)*-d,A=Math.cos(h-l)*d,l&&(c*=un,R=Math.tan(l-c),R=Math.sqrt(1+R*R),C*=R,A*=R,c&&(R=Math.tan(c),R=Math.sqrt(1+R*R),w*=R,E*=R)),w=zt(w),E=zt(E),C=zt(C),A=zt(A)):(w=u,A=d,E=C=0),(b&&!~(o+"").indexOf("px")||v&&!~(a+"").indexOf("px"))&&(b=kr(f,"x",o,"px"),v=kr(f,"y",a,"px")),(m||p||g||y)&&(b=zt(b+m-(m*w+p*C)+g),v=zt(v+p-(m*E+p*A)+y)),(s||n)&&(R=f.getBBox(),b=zt(b+s/100*R.width),v=zt(v+n/100*R.height)),R="matrix("+w+","+E+","+C+","+A+","+b+","+v+")",f.setAttribute("transform",R),_&&(f.style[Zt]=R)},yC=function(t,e,i,s,n){var o=360,a=ne(n),h=parseFloat(n)*(a&&~n.indexOf("rad")?gs:1),l=h-s,c=s+l+"deg",u,d;return a&&(u=n.split("_")[1],u==="short"&&(l%=o,l!==l%(o/2)&&(l+=l<0?o:-o)),u==="cw"&&l<0?l=(l+o*Bg)%o-~~(l/o)*o:u==="ccw"&&l>0&&(l=(l-o*Bg)%o-~~(l/o)*o)),t._pt=d=new Ie(t._pt,e,i,s,l,tC),d.e=c,d.u="deg",t._props.push(i),d},ey=function(t,e){for(var i in e)t[i]=e[i];return t},bC=function(t,e,i){var s=ey({},i._gsap),n="perspective,force3D,transformOrigin,svgOrigin",o=i.style,a,h,l,c,u,d,f,m;s.svg?(l=i.getAttribute("transform"),i.setAttribute("transform",""),o[Zt]=e,a=bo(i,1),ys(i,Zt),i.setAttribute("transform",l)):(l=getComputedStyle(i)[Zt],o[Zt]=e,a=bo(i,1),o[Zt]=l);for(h in nr)l=s[h],c=a[h],l!==c&&n.indexOf(h)<0&&(f=ge(l),m=ge(c),u=f!==m?kr(i,h,l,m):parseFloat(l),d=parseFloat(c),t._pt=new Ie(t._pt,a,h,u,d-u,Hu),t._pt.u=m||0,t._props.push(h));ey(a,s)};Ce("padding,margin,Width,Radius",function(r,t){var e="Top",i="Right",s="Bottom",n="Left",o=(t<3?[e,i,s,n]:[e+n,e+i,s+i,s+n]).map(function(a){return t<2?r+a:"border"+a+r});bh[t>1?"border"+r:r]=function(a,h,l,c,u){var d,f;if(arguments.length<4)return d=o.map(function(m){return or(a,m,l)}),f=d.join(" "),f.split(d[0]).length===5?d[0]:f;d=(c+"").split(" "),f={},o.forEach(function(m,p){return f[m]=d[p]=d[p]||d[(p-1)/2|0]}),a.init(h,f,u)}});var iy={name:"css",register:Yu,targetTest:function(t){return t.style&&t.nodeType},init:function(t,e,i,s,n){var o=this._props,a=t.style,h=i.vars.startAt,l,c,u,d,f,m,p,g,y,_,b,v,w,E,C,A;Xu||Yu(),this.styles=this.styles||Zg(t),A=this.styles.props,this.tween=i;for(p in e)if(p!=="autoRound"&&(c=e[p],!(Oe[p]&&Ag(p,e,i,s,t,n)))){if(f=typeof c,m=bh[p],f==="function"&&(c=c.call(i,s,t,n),f=typeof c),f==="string"&&~c.indexOf("random(")&&(c=co(c)),m)m(this,t,p,c,i)&&(C=1);else if(p.substr(0,2)==="--")l=(getComputedStyle(t).getPropertyValue(p)+"").trim(),c+="",Gr.lastIndex=0,Gr.test(l)||(g=ge(l),y=ge(c)),y?g!==y&&(l=kr(t,p,l,y)+y):g&&(c+=g),this.add(a,"setProperty",l,c,s,n,0,0,p),o.push(p),A.push(p,0,a[p]);else if(f!=="undefined"){if(h&&p in h?(l=typeof h[p]=="function"?h[p].call(i,s,t,n):h[p],ne(l)&&~l.indexOf("random(")&&(l=co(l)),ge(l+"")||l==="auto"||(l+=De.units[p]||ge(or(t,p))||""),(l+"").charAt(1)==="="&&(l=or(t,p))):l=or(t,p),d=parseFloat(l),_=f==="string"&&c.charAt(1)==="="&&c.substr(0,2),_&&(c=c.substr(2)),u=parseFloat(c),p in Ni&&(p==="autoAlpha"&&(d===1&&or(t,"visibility")==="hidden"&&u&&(d=0),A.push("visibility",0,a.visibility),Dr(this,a,"visibility",d?"inherit":"hidden",u?"inherit":"hidden",!u)),p!=="scale"&&p!=="transform"&&(p=Ni[p],~p.indexOf(",")&&(p=p.split(",")[0]))),b=p in nr,b){if(this.styles.save(p),v||(w=t._gsap,w.renderTransform&&!e.parseTransform||bo(t,e.parseTransform),E=e.smoothOrigin!==!1&&w.smooth,v=this._pt=new Ie(this._pt,a,Zt,0,1,w.renderTransform,w,0,-1),v.dep=1),p==="scale")this._pt=new Ie(this._pt,w,"scaleY",w.scaleY,(_?nn(w.scaleY,_+u):u)-w.scaleY||0,Hu),this._pt.u=0,o.push("scaleY",p),p+="X";else if(p==="transformOrigin"){A.push(Re,0,a[Re]),c=fC(c),w.svg?Ju(t,c,0,E,0,this):(y=parseFloat(c.split(" ")[2])||0,y!==w.zOrigin&&Dr(this,w,"zOrigin",w.zOrigin,y),Dr(this,a,p,xh(l),xh(c)));continue}else if(p==="svgOrigin"){Ju(t,c,1,E,0,this);continue}else if(p in $g){yC(this,w,p,d,_?nn(d,_+c):c);continue}else if(p==="smoothOrigin"){Dr(this,w,"smooth",w.smooth,c);continue}else if(p==="force3D"){w[p]=c;continue}else if(p==="transform"){bC(this,c,t);continue}}else p in a||(p=fn(p)||p);if(b||(u||u===0)&&(d||d===0)&&!qE.test(c)&&p in a)g=(l+"").substr((d+"").length),u||(u=0),y=ge(c)||(p in De.units?De.units[p]:g),g!==y&&(d=kr(t,p,l,y)),this._pt=new Ie(this._pt,b?w:a,p,d,(_?nn(d,_+u):u)-d,!b&&(y==="px"||p==="zIndex")&&e.autoRound!==!1?iC:Hu),this._pt.u=y||0,g!==y&&y!=="%"&&(this._pt.b=l,this._pt.r=eC);else if(p in a)dC.call(this,t,p,l,_?_+c:c);else if(p in t)this.add(t,p,l||t[p],_?_+c:c,s,n);else if(p!=="parseTransform"){xu(p,c);continue}b||(p in a?A.push(p,0,a[p]):A.push(p,1,l||t[p])),o.push(p)}}C&&Fg(this)},render:function(t,e){if(e.tween._time||!Zu())for(var i=e._pt;i;)i.r(t,i.d),i=i._next;else e.styles.revert()},get:or,aliases:Ni,getSetter:function(t,e,i){var s=Ni[e];return s&&s.indexOf(",")<0&&(e=s),e in nr&&e!==Re&&(t._gsap.x||or(t,"x"))?i&&Og===i?e==="scale"?oC:nC:(Og=i||{})&&(e==="scale"?aC:hC):t.style&&!fu(t.style[e])?rC:~e.indexOf("-")?sC:ku(t,e)},core:{_removeProperty:ys,_getMatrix:ju}};Ae.utils.checkPrefix=fn,Ae.core.getStyleSaver=Zg,function(r,t,e,i){var s=Ce(r+","+t+","+e,function(n){nr[n]=1});Ce(t,function(n){De.units[n]="deg",$g[n]=1}),Ni[s[13]]=r+","+t,Ce(i,function(n){var o=n.split(":");Ni[o[1]]=s[o[0]]})}("x,y,z,scale,scaleX,scaleY,xPercent,yPercent","rotation,rotationX,rotationY,skewX,skewY","transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective","0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY"),Ce("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(r){De.units[r]="px"}),Ae.registerPlugin(iy);var ry=Ae.registerPlugin(iy)||Ae;ry.core.Tween;const _s=new pt;class xC{constructor(t={}){this._recursive=typeof t.recursive=="boolean"?t.recursive:!0,this._toggle=t.toggle||"visible",this._targetList=new Set}add(t){return this._targetList.add(t),this}addAll(t){for(let e=0,i=t.length;e<i;e++)this._targetList.add(t[e]);return this}remove(t){return this._targetList.delete(t),this}removeAll(t){for(let e=0,i=t.length;e<i;e++)this._targetList.delete(t[e]);return this}clear(){return this._targetList.clear(),this}cull(t,e=!1){return e||this.uncull(),this._targetList.forEach(i=>{e||i.getBounds(!1,_s),this._recursive?this.cullRecursive(t,i,e):(e&&i._bounds.getRectangle(t),i[this._toggle]=_s.right>t.left&&_s.left<t.right&&_s.bottom>t.top&&_s.top<t.bottom)}),this}uncull(){return this._targetList.forEach(t=>{this._recursive?this.uncullRecursive(t):t[this._toggle]=!1}),this}cullRecursive(t,e,i){const s=i?e._bounds.getRectangle(_s):e.getBounds(!0,_s);if(e[this._toggle]=s.right>t.left&&s.left<t.right&&s.bottom>t.top&&s.top<t.bottom,!(s.left>=t.left&&s.top>=t.top&&s.right<=t.right&&s.bottom<=t.bottom)&&e[this._toggle]&&e.children&&e.children.length){const o=e.children;for(let a=0,h=o.length;a<h;a++)this.cullRecursive(t,o[a])}}uncullRecursive(t){if(t[this._toggle]=!0,t.children&&t.children.length){const e=t.children;for(let i=0,s=e.length;i<s;i++)this.uncullRecursive(e[i])}}}var _h={exports:{}};_h.exports,function(r,t){var e=200,i="__lodash_hash_undefined__",s=1,n=2,o=9007199254740991,a="[object Arguments]",h="[object Array]",l="[object AsyncFunction]",c="[object Boolean]",u="[object Date]",d="[object Error]",f="[object Function]",m="[object GeneratorFunction]",p="[object Map]",g="[object Number]",y="[object Null]",_="[object Object]",b="[object Promise]",v="[object Proxy]",w="[object RegExp]",E="[object Set]",C="[object String]",A="[object Symbol]",R="[object Undefined]",G="[object WeakMap]",N="[object ArrayBuffer]",P="[object DataView]",I="[object Float32Array]",D="[object Float64Array]",X="[object Int8Array]",H="[object Int16Array]",Z="[object Int32Array]",j="[object Uint8Array]",O="[object Uint8ClampedArray]",k="[object Uint16Array]",F="[object Uint32Array]",V=/[\\^$.*+?()[\]{}|]/g,$=/^\[object .+?Constructor\]$/,dt=/^(?:0|[1-9]\d*)$/,ot={};ot[I]=ot[D]=ot[X]=ot[H]=ot[Z]=ot[j]=ot[O]=ot[k]=ot[F]=!0,ot[a]=ot[h]=ot[N]=ot[c]=ot[P]=ot[u]=ot[d]=ot[f]=ot[p]=ot[g]=ot[_]=ot[w]=ot[E]=ot[C]=ot[G]=!1;var Ct=typeof xe=="object"&&xe&&xe.Object===Object&&xe,Mt=typeof self=="object"&&self&&self.Object===Object&&self,_t=Ct||Mt||Function("return this")(),Y=t&&!t.nodeType&&t,tt=Y&&!0&&r&&!r.nodeType&&r,et=tt&&tt.exports===Y,B=et&&Ct.process,xt=function(){try{return B&&B.binding&&B.binding("util")}catch{}}(),yt=xt&&xt.isTypedArray;function Lt(T,M){for(var x=-1,S=T==null?0:T.length,L=0,U=[];++x<S;){var lt=T[x];M(lt,x,T)&&(U[L++]=lt)}return U}function Vt(T,M){for(var x=-1,S=M.length,L=T.length;++x<S;)T[L+x]=M[x];return T}function Xe(T,M){for(var x=-1,S=T==null?0:T.length;++x<S;)if(M(T[x],x,T))return!0;return!1}function pi(T,M){for(var x=-1,S=Array(T);++x<T;)S[x]=M(x);return S}function Fd(T){return function(M){return T(M)}}function Sn(T,M){return T.has(M)}function No(T,M){return T==null?void 0:T[M]}function En(T){var M=-1,x=Array(T.size);return T.forEach(function(S,L){x[++M]=[L,S]}),x}function mi(T,M){return function(x){return T(M(x))}}function Kh(T){var M=-1,x=Array(T.size);return T.forEach(function(S){x[++M]=S}),x}var Yh=Array.prototype,Nd=Function.prototype,Cn=Object.prototype,Wr=_t["__core-js_shared__"],Do=Nd.toString,Ze=Cn.hasOwnProperty,ko=function(){var T=/[^.]+$/.exec(Wr&&Wr.keys&&Wr.keys.IE_PROTO||"");return T?"Symbol(src)_1."+T:""}(),Oo=Cn.toString,zh=RegExp("^"+Do.call(Ze).replace(V,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),jh=et?_t.Buffer:void 0,In=_t.Symbol,Wi=_t.Uint8Array,As=Cn.propertyIsEnumerable,Dd=Yh.splice,Ui=In?In.toStringTag:void 0,Jh=Object.getOwnPropertySymbols,$h=jh?jh.isBuffer:void 0,Rs=mi(Object.keys,Object),Bo=pr(_t,"DataView"),Ve=pr(_t,"Map"),Wo=pr(_t,"Promise"),Uo=pr(_t,"Set"),Xo=pr(_t,"WeakMap"),Ms=pr(Object,"create"),kd=yi(Bo),gi=yi(Ve),Od=yi(Wo),Bd=yi(Uo),Wd=yi(Xo),Qh=In?In.prototype:void 0,Zo=Qh?Qh.valueOf:void 0;function Pe(T){var M=-1,x=T==null?0:T.length;for(this.clear();++M<x;){var S=T[M];this.set(S[0],S[1])}}function Ud(){this.__data__=Ms?Ms(null):{},this.size=0}function Xd(T){var M=this.has(T)&&delete this.__data__[T];return this.size-=M?1:0,M}function Zd(T){var M=this.__data__;if(Ms){var x=M[T];return x===i?void 0:x}return Ze.call(M,T)?M[T]:void 0}function Vd(T){var M=this.__data__;return Ms?M[T]!==void 0:Ze.call(M,T)}function Hd(T,M){var x=this.__data__;return this.size+=this.has(T)?0:1,x[T]=Ms&&M===void 0?i:M,this}Pe.prototype.clear=Ud,Pe.prototype.delete=Xd,Pe.prototype.get=Zd,Pe.prototype.has=Vd,Pe.prototype.set=Hd;function ye(T){var M=-1,x=T==null?0:T.length;for(this.clear();++M<x;){var S=T[M];this.set(S[0],S[1])}}function Kd(){this.__data__=[],this.size=0}function Yd(T){var M=this.__data__,x=Rn(M,T);if(x<0)return!1;var S=M.length-1;return x==S?M.pop():Dd.call(M,x,1),--this.size,!0}function zd(T){var M=this.__data__,x=Rn(M,T);return x<0?void 0:M[x][1]}function jd(T){return Rn(this.__data__,T)>-1}function Jd(T,M){var x=this.__data__,S=Rn(x,T);return S<0?(++this.size,x.push([T,M])):x[S][1]=M,this}ye.prototype.clear=Kd,ye.prototype.delete=Yd,ye.prototype.get=zd,ye.prototype.has=jd,ye.prototype.set=Jd;function dr(T){var M=-1,x=T==null?0:T.length;for(this.clear();++M<x;){var S=T[M];this.set(S[0],S[1])}}function Vo(){this.size=0,this.__data__={hash:new Pe,map:new(Ve||ye),string:new Pe}}function $d(T){var M=Ln(this,T).delete(T);return this.size-=M?1:0,M}function An(T){return Ln(this,T).get(T)}function Ho(T){return Ln(this,T).has(T)}function Qd(T,M){var x=Ln(this,T),S=x.size;return x.set(T,M),this.size+=x.size==S?0:1,this}dr.prototype.clear=Vo,dr.prototype.delete=$d,dr.prototype.get=An,dr.prototype.has=Ho,dr.prototype.set=Qd;function fr(T){var M=-1,x=T==null?0:T.length;for(this.__data__=new dr;++M<x;)this.add(T[M])}function qh(T){return this.__data__.set(T,i),this}function qd(T){return this.__data__.has(T)}fr.prototype.add=fr.prototype.push=qh,fr.prototype.has=qd;function Xi(T){var M=this.__data__=new ye(T);this.size=M.size}function tf(){this.__data__=new ye,this.size=0}function tl(T){var M=this.__data__,x=M.delete(T);return this.size=M.size,x}function ef(T){return this.__data__.get(T)}function rf(T){return this.__data__.has(T)}function sf(T,M){var x=this.__data__;if(x instanceof ye){var S=x.__data__;if(!Ve||S.length<e-1)return S.push([T,M]),this.size=++x.size,this;x=this.__data__=new dr(S)}return x.set(T,M),this.size=x.size,this}Xi.prototype.clear=tf,Xi.prototype.delete=tl,Xi.prototype.get=ef,Xi.prototype.has=rf,Xi.prototype.set=sf;function nf(T,M){var x=Fn(T),S=!x&&zo(T),L=!x&&!S&&Ps(T),U=!x&&!S&&!L&&ll(T),lt=x||S||L||U,mt=lt?pi(T.length,String):[],bt=mt.length;for(var at in T)(M||Ze.call(T,at))&&!(lt&&(at=="length"||L&&(at=="offset"||at=="parent")||U&&(at=="buffer"||at=="byteLength"||at=="byteOffset")||Yo(at,bt)))&&mt.push(at);return mt}function Rn(T,M){for(var x=T.length;x--;)if(Gn(T[x][0],M))return x;return-1}function of(T,M,x){var S=M(T);return Fn(T)?S:Vt(S,x(T))}function Ls(T){return T==null?T===void 0?R:y:Ui&&Ui in Object(T)?cf(T):Pn(T)}function el(T){return Xr(T)&&Ls(T)==a}function il(T,M,x,S,L){return T===M?!0:T==null||M==null||!Xr(T)&&!Xr(M)?T!==T&&M!==M:af(T,M,x,S,il,L)}function af(T,M,x,S,L,U){var lt=Fn(T),mt=Fn(M),bt=lt?h:Zi(T),at=mt?h:Zi(M);bt=bt==a?_:bt,at=at==a?_:at;var vt=bt==_,Ot=at==_,Rt=bt==at;if(Rt&&Ps(T)){if(!Ps(M))return!1;lt=!0,vt=!1}if(Rt&&!vt)return U||(U=new Xi),lt||ll(T)?rl(T,M,x,S,L,U):sl(T,M,bt,x,S,L,U);if(!(x&s)){var le=vt&&Ze.call(T,"__wrapped__"),be=Ot&&Ze.call(M,"__wrapped__");if(le||be){var ii=le?T.value():T,ri=be?M.value():M;return U||(U=new Xi),L(ii,ri,x,S,U)}}return Rt?(U||(U=new Xi),lf(T,M,x,S,L,U)):!1}function Mn(T){if(!hl(T)||ff(T))return!1;var M=Vi(T)?zh:$;return M.test(yi(T))}function Ko(T){return Xr(T)&&Ur(T.length)&&!!ot[Ls(T)]}function hf(T){if(!pf(T))return Rs(T);var M=[];for(var x in Object(T))Ze.call(T,x)&&x!="constructor"&&M.push(x);return M}function rl(T,M,x,S,L,U){var lt=x&s,mt=T.length,bt=M.length;if(mt!=bt&&!(lt&&bt>mt))return!1;var at=U.get(T);if(at&&U.get(M))return at==M;var vt=-1,Ot=!0,Rt=x&n?new fr:void 0;for(U.set(T,M),U.set(M,T);++vt<mt;){var le=T[vt],be=M[vt];if(S)var ii=lt?S(be,le,vt,M,T,U):S(le,be,vt,T,M,U);if(ii!==void 0){if(ii)continue;Ot=!1;break}if(Rt){if(!Xe(M,function(ri,Gs){if(!Sn(Rt,Gs)&&(le===ri||L(le,ri,x,S,U)))return Rt.push(Gs)})){Ot=!1;break}}else if(!(le===be||L(le,be,x,S,U))){Ot=!1;break}}return U.delete(T),U.delete(M),Ot}function sl(T,M,x,S,L,U,lt){switch(x){case P:if(T.byteLength!=M.byteLength||T.byteOffset!=M.byteOffset)return!1;T=T.buffer,M=M.buffer;case N:return!(T.byteLength!=M.byteLength||!U(new Wi(T),new Wi(M)));case c:case u:case g:return Gn(+T,+M);case d:return T.name==M.name&&T.message==M.message;case w:case C:return T==M+"";case p:var mt=En;case E:var bt=S&s;if(mt||(mt=Kh),T.size!=M.size&&!bt)return!1;var at=lt.get(T);if(at)return at==M;S|=n,lt.set(T,M);var vt=rl(mt(T),mt(M),S,L,U,lt);return lt.delete(T),vt;case A:if(Zo)return Zo.call(T)==Zo.call(M)}return!1}function lf(T,M,x,S,L,U){var lt=x&s,mt=nl(T),bt=mt.length,at=nl(M),vt=at.length;if(bt!=vt&&!lt)return!1;for(var Ot=bt;Ot--;){var Rt=mt[Ot];if(!(lt?Rt in M:Ze.call(M,Rt)))return!1}var le=U.get(T);if(le&&U.get(M))return le==M;var be=!0;U.set(T,M),U.set(M,T);for(var ii=lt;++Ot<bt;){Rt=mt[Ot];var ri=T[Rt],Gs=M[Rt];if(S)var Gb=lt?S(Gs,ri,Rt,M,T,U):S(ri,Gs,Rt,T,M,U);if(!(Gb===void 0?ri===Gs||L(ri,Gs,x,S,U):Gb)){be=!1;break}ii||(ii=Rt=="constructor")}if(be&&!ii){var ul=T.constructor,dl=M.constructor;ul!=dl&&"constructor"in T&&"constructor"in M&&!(typeof ul=="function"&&ul instanceof ul&&typeof dl=="function"&&dl instanceof dl)&&(be=!1)}return U.delete(T),U.delete(M),be}function nl(T){return of(T,cl,uf)}function Ln(T,M){var x=T.__data__;return df(M)?x[typeof M=="string"?"string":"hash"]:x.map}function pr(T,M){var x=No(T,M);return Mn(x)?x:void 0}function cf(T){var M=Ze.call(T,Ui),x=T[Ui];try{T[Ui]=void 0;var S=!0}catch{}var L=Oo.call(T);return S&&(M?T[Ui]=x:delete T[Ui]),L}var uf=Jh?function(T){return T==null?[]:(T=Object(T),Lt(Jh(T),function(M){return As.call(T,M)}))}:mf,Zi=Ls;(Bo&&Zi(new Bo(new ArrayBuffer(1)))!=P||Ve&&Zi(new Ve)!=p||Wo&&Zi(Wo.resolve())!=b||Uo&&Zi(new Uo)!=E||Xo&&Zi(new Xo)!=G)&&(Zi=function(T){var M=Ls(T),x=M==_?T.constructor:void 0,S=x?yi(x):"";if(S)switch(S){case kd:return P;case gi:return p;case Od:return b;case Bd:return E;case Wd:return G}return M});function Yo(T,M){return M=M??o,!!M&&(typeof T=="number"||dt.test(T))&&T>-1&&T%1==0&&T<M}function df(T){var M=typeof T;return M=="string"||M=="number"||M=="symbol"||M=="boolean"?T!=="__proto__":T===null}function ff(T){return!!ko&&ko in T}function pf(T){var M=T&&T.constructor,x=typeof M=="function"&&M.prototype||Cn;return T===x}function Pn(T){return Oo.call(T)}function yi(T){if(T!=null){try{return Do.call(T)}catch{}try{return T+""}catch{}}return""}function Gn(T,M){return T===M||T!==T&&M!==M}var zo=el(function(){return arguments}())?el:function(T){return Xr(T)&&Ze.call(T,"callee")&&!As.call(T,"callee")},Fn=Array.isArray;function ol(T){return T!=null&&Ur(T.length)&&!Vi(T)}var Ps=$h||gf;function al(T,M){return il(T,M)}function Vi(T){if(!hl(T))return!1;var M=Ls(T);return M==f||M==m||M==l||M==v}function Ur(T){return typeof T=="number"&&T>-1&&T%1==0&&T<=o}function hl(T){var M=typeof T;return T!=null&&(M=="object"||M=="function")}function Xr(T){return T!=null&&typeof T=="object"}var ll=yt?Fd(yt):Ko;function cl(T){return ol(T)?nf(T):hf(T)}function mf(){return[]}function gf(){return!1}r.exports=al}(_h,_h.exports);var _C=_h.exports;const sy=Ds(_C);var vC=Object.defineProperty,TC=(r,t,e)=>t in r?vC(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,W=(r,t,e)=>(TC(r,typeof t!="symbol"?t+"":t,e),e);class qe{constructor(t){W(this,"parent"),W(this,"paused"),this.parent=t,this.paused=!1}destroy(){}down(t){return!1}move(t){return!1}up(t){return!1}wheel(t){return!1}update(t){}resize(){}reset(){}pause(){this.paused=!0}resume(){this.paused=!1}}var wC=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ny={exports:{}};(function(r,t){(function(){var e,i;i=function(s){return r.exports=s},e={linear:function(s,n,o,a){return o*s/a+n},easeInQuad:function(s,n,o,a){return o*(s/=a)*s+n},easeOutQuad:function(s,n,o,a){return-o*(s/=a)*(s-2)+n},easeInOutQuad:function(s,n,o,a){return(s/=a/2)<1?o/2*s*s+n:-o/2*(--s*(s-2)-1)+n},easeInCubic:function(s,n,o,a){return o*(s/=a)*s*s+n},easeOutCubic:function(s,n,o,a){return o*((s=s/a-1)*s*s+1)+n},easeInOutCubic:function(s,n,o,a){return(s/=a/2)<1?o/2*s*s*s+n:o/2*((s-=2)*s*s+2)+n},easeInQuart:function(s,n,o,a){return o*(s/=a)*s*s*s+n},easeOutQuart:function(s,n,o,a){return-o*((s=s/a-1)*s*s*s-1)+n},easeInOutQuart:function(s,n,o,a){return(s/=a/2)<1?o/2*s*s*s*s+n:-o/2*((s-=2)*s*s*s-2)+n},easeInQuint:function(s,n,o,a){return o*(s/=a)*s*s*s*s+n},easeOutQuint:function(s,n,o,a){return o*((s=s/a-1)*s*s*s*s+1)+n},easeInOutQuint:function(s,n,o,a){return(s/=a/2)<1?o/2*s*s*s*s*s+n:o/2*((s-=2)*s*s*s*s+2)+n},easeInSine:function(s,n,o,a){return-o*Math.cos(s/a*(Math.PI/2))+o+n},easeOutSine:function(s,n,o,a){return o*Math.sin(s/a*(Math.PI/2))+n},easeInOutSine:function(s,n,o,a){return-o/2*(Math.cos(Math.PI*s/a)-1)+n},easeInExpo:function(s,n,o,a){return s===0?n:o*Math.pow(2,10*(s/a-1))+n},easeOutExpo:function(s,n,o,a){return s===a?n+o:o*(-Math.pow(2,-10*s/a)+1)+n},easeInOutExpo:function(s,n,o,a){return(s/=a/2)<1?o/2*Math.pow(2,10*(s-1))+n:o/2*(-Math.pow(2,-10*--s)+2)+n},easeInCirc:function(s,n,o,a){return-o*(Math.sqrt(1-(s/=a)*s)-1)+n},easeOutCirc:function(s,n,o,a){return o*Math.sqrt(1-(s=s/a-1)*s)+n},easeInOutCirc:function(s,n,o,a){return(s/=a/2)<1?-o/2*(Math.sqrt(1-s*s)-1)+n:o/2*(Math.sqrt(1-(s-=2)*s)+1)+n},easeInElastic:function(s,n,o,a){var h,l,c;return c=1.70158,l=0,h=o,s===0||(s/=a),l||(l=a*.3),h<Math.abs(o)?(h=o,c=l/4):c=l/(2*Math.PI)*Math.asin(o/h),-(h*Math.pow(2,10*(s-=1))*Math.sin((s*a-c)*(2*Math.PI)/l))+n},easeOutElastic:function(s,n,o,a){var h,l,c;return c=1.70158,l=0,h=o,s===0||(s/=a),l||(l=a*.3),h<Math.abs(o)?(h=o,c=l/4):c=l/(2*Math.PI)*Math.asin(o/h),h*Math.pow(2,-10*s)*Math.sin((s*a-c)*(2*Math.PI)/l)+o+n},easeInOutElastic:function(s,n,o,a){var h,l,c;return c=1.70158,l=0,h=o,s===0||(s/=a/2),l||(l=a*(.3*1.5)),h<Math.abs(o)?(h=o,c=l/4):c=l/(2*Math.PI)*Math.asin(o/h),s<1?-.5*(h*Math.pow(2,10*(s-=1))*Math.sin((s*a-c)*(2*Math.PI)/l))+n:h*Math.pow(2,-10*(s-=1))*Math.sin((s*a-c)*(2*Math.PI)/l)*.5+o+n},easeInBack:function(s,n,o,a,h){return h===void 0&&(h=1.70158),o*(s/=a)*s*((h+1)*s-h)+n},easeOutBack:function(s,n,o,a,h){return h===void 0&&(h=1.70158),o*((s=s/a-1)*s*((h+1)*s+h)+1)+n},easeInOutBack:function(s,n,o,a,h){return h===void 0&&(h=1.70158),(s/=a/2)<1?o/2*(s*s*(((h*=1.525)+1)*s-h))+n:o/2*((s-=2)*s*(((h*=1.525)+1)*s+h)+2)+n},easeInBounce:function(s,n,o,a){var h;return h=e.easeOutBounce(a-s,0,o,a),o-h+n},easeOutBounce:function(s,n,o,a){return(s/=a)<1/2.75?o*(7.5625*s*s)+n:s<2/2.75?o*(7.5625*(s-=1.5/2.75)*s+.75)+n:s<2.5/2.75?o*(7.5625*(s-=2.25/2.75)*s+.9375)+n:o*(7.5625*(s-=2.625/2.75)*s+.984375)+n},easeInOutBounce:function(s,n,o,a){var h;return s<a/2?(h=e.easeInBounce(s*2,0,o,a),h*.5+n):(h=e.easeOutBounce(s*2-a,0,o,a),h*.5+o*.5+n)}},i(e)}).call(wC)})(ny);const oy=ny.exports;function vh(r,t){if(r){if(typeof r=="function")return r;if(typeof r=="string")return oy[r]}else return oy[t]}const SC={removeOnInterrupt:!1,ease:"linear",time:1e3};class EC extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"startX"),W(this,"startY"),W(this,"deltaX"),W(this,"deltaY"),W(this,"keepCenter"),W(this,"startWidth",null),W(this,"startHeight",null),W(this,"deltaWidth",null),W(this,"deltaHeight",null),W(this,"width",null),W(this,"height",null),W(this,"time",0),this.options=Object.assign({},SC,e),this.options.ease=vh(this.options.ease),this.setupPosition(),this.setupZoom(),this.time=0}setupPosition(){typeof this.options.position<"u"?(this.startX=this.parent.center.x,this.startY=this.parent.center.y,this.deltaX=this.options.position.x-this.parent.center.x,this.deltaY=this.options.position.y-this.parent.center.y,this.keepCenter=!1):this.keepCenter=!0}setupZoom(){this.width=null,this.height=null,typeof this.options.scale<"u"?this.width=this.parent.screenWidth/this.options.scale:typeof this.options.scaleX<"u"||typeof this.options.scaleY<"u"?(typeof this.options.scaleX<"u"&&(this.width=this.parent.screenWidth/this.options.scaleX),typeof this.options.scaleY<"u"&&(this.height=this.parent.screenHeight/this.options.scaleY)):(typeof this.options.width<"u"&&(this.width=this.options.width),typeof this.options.height<"u"&&(this.height=this.options.height)),this.width!==null&&(this.startWidth=this.parent.screenWidthInWorldPixels,this.deltaWidth=this.width-this.startWidth),this.height!==null&&(this.startHeight=this.parent.screenHeightInWorldPixels,this.deltaHeight=this.height-this.startHeight)}down(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("animate"),!1}complete(){this.parent.plugins.remove("animate"),this.width!==null&&this.parent.fitWidth(this.width,this.keepCenter,this.height===null),this.height!==null&&this.parent.fitHeight(this.height,this.keepCenter,this.width===null),!this.keepCenter&&this.options.position&&this.parent.moveCenter(this.options.position),this.parent.emit("animate-end",this.parent),this.options.callbackOnComplete&&this.options.callbackOnComplete(this.parent)}update(t){if(this.paused)return;this.time+=t;const e=new ut(this.parent.scale.x,this.parent.scale.y);if(this.time>=this.options.time){const i=this.parent.width,s=this.parent.height;this.complete(),(i!==this.parent.width||s!==this.parent.height)&&this.parent.emit("zoomed",{viewport:this.parent,original:e,type:"animate"})}else{const i=this.options.ease(this.time,0,1,this.options.time);if(this.width!==null){const s=this.startWidth,n=this.deltaWidth;this.parent.fitWidth(s+n*i,this.keepCenter,this.height===null)}if(this.height!==null){const s=this.startHeight,n=this.deltaHeight;this.parent.fitHeight(s+n*i,this.keepCenter,this.width===null)}if(this.width===null?this.parent.scale.x=this.parent.scale.y:this.height===null&&(this.parent.scale.y=this.parent.scale.x),!this.keepCenter){const s=this.startX,n=this.startY,o=this.deltaX,a=this.deltaY,h=new ut(this.parent.x,this.parent.y);this.parent.moveCenter(s+o*i,n+a*i),this.parent.emit("moved",{viewport:this.parent,original:h,type:"animate"})}(this.width||this.height)&&this.parent.emit("zoomed",{viewport:this.parent,original:e,type:"animate"})}}}const CC={sides:"all",friction:.5,time:150,ease:"easeInOutSine",underflow:"center",bounceBox:null};class IC extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"left"),W(this,"top"),W(this,"right"),W(this,"bottom"),W(this,"underflowX"),W(this,"underflowY"),W(this,"ease"),W(this,"toX"),W(this,"toY"),this.options=Object.assign({},CC,e),this.ease=vh(this.options.ease,"easeInOutSine"),this.options.sides?this.options.sides==="all"?this.top=this.bottom=this.left=this.right=!0:this.options.sides==="horizontal"?(this.right=this.left=!0,this.top=this.bottom=!1):this.options.sides==="vertical"?(this.left=this.right=!1,this.top=this.bottom=!0):(this.top=this.options.sides.indexOf("top")!==-1,this.bottom=this.options.sides.indexOf("bottom")!==-1,this.left=this.options.sides.indexOf("left")!==-1,this.right=this.options.sides.indexOf("right")!==-1):this.left=this.top=this.right=this.bottom=!1;const i=this.options.underflow.toLowerCase();i==="center"?(this.underflowX=0,this.underflowY=0):(this.underflowX=i.indexOf("left")!==-1?-1:i.indexOf("right")!==-1?1:0,this.underflowY=i.indexOf("top")!==-1?-1:i.indexOf("bottom")!==-1?1:0),this.reset()}isActive(){return this.toX!==null||this.toY!==null}down(){return this.toX=this.toY=null,!1}up(){return this.bounce(),!1}update(t){if(!this.paused){if(this.bounce(),this.toX){const e=this.toX;e.time+=t,this.parent.emit("moved",{viewport:this.parent,type:"bounce-x"}),e.time>=this.options.time?(this.parent.x=e.end,this.toX=null,this.parent.emit("bounce-x-end",this.parent)):this.parent.x=this.ease(e.time,e.start,e.delta,this.options.time)}if(this.toY){const e=this.toY;e.time+=t,this.parent.emit("moved",{viewport:this.parent,type:"bounce-y"}),e.time>=this.options.time?(this.parent.y=e.end,this.toY=null,this.parent.emit("bounce-y-end",this.parent)):this.parent.y=this.ease(e.time,e.start,e.delta,this.options.time)}}}calcUnderflowX(){let t;switch(this.underflowX){case-1:t=0;break;case 1:t=this.parent.screenWidth-this.parent.screenWorldWidth;break;default:t=(this.parent.screenWidth-this.parent.screenWorldWidth)/2}return t}calcUnderflowY(){let t;switch(this.underflowY){case-1:t=0;break;case 1:t=this.parent.screenHeight-this.parent.screenWorldHeight;break;default:t=(this.parent.screenHeight-this.parent.screenWorldHeight)/2}return t}oob(){const t=this.options.bounceBox;if(t){const e=typeof t.x>"u"?0:t.x,i=typeof t.y>"u"?0:t.y,s=typeof t.width>"u"?this.parent.worldWidth:t.width,n=typeof t.height>"u"?this.parent.worldHeight:t.height;return{left:this.parent.left<e,right:this.parent.right>s,top:this.parent.top<i,bottom:this.parent.bottom>n,topLeft:new ut(e*this.parent.scale.x,i*this.parent.scale.y),bottomRight:new ut(s*this.parent.scale.x-this.parent.screenWidth,n*this.parent.scale.y-this.parent.screenHeight)}}return{left:this.parent.left<0,right:this.parent.right>this.parent.worldWidth,top:this.parent.top<0,bottom:this.parent.bottom>this.parent.worldHeight,topLeft:new ut(0,0),bottomRight:new ut(this.parent.worldWidth*this.parent.scale.x-this.parent.screenWidth,this.parent.worldHeight*this.parent.scale.y-this.parent.screenHeight)}}bounce(){var t,e;if(this.paused)return;let i,s=this.parent.plugins.get("decelerate",!0);s&&(s.x||s.y)&&(s.x&&s.percentChangeX===((t=s.options)==null?void 0:t.friction)||s.y&&s.percentChangeY===((e=s.options)==null?void 0:e.friction))&&(i=this.oob(),(i.left&&this.left||i.right&&this.right)&&(s.percentChangeX=this.options.friction),(i.top&&this.top||i.bottom&&this.bottom)&&(s.percentChangeY=this.options.friction));const n=this.parent.plugins.get("drag",!0)||{},o=this.parent.plugins.get("pinch",!0)||{};if(s=s||{},!(n!=null&&n.active)&&!(o!=null&&o.active)&&(!this.toX||!this.toY)&&(!s.x||!s.y)){i=i||this.oob();const a=i.topLeft,h=i.bottomRight;if(!this.toX&&!s.x){let l=null;i.left&&this.left?l=this.parent.screenWorldWidth<this.parent.screenWidth?this.calcUnderflowX():-a.x:i.right&&this.right&&(l=this.parent.screenWorldWidth<this.parent.screenWidth?this.calcUnderflowX():-h.x),l!==null&&this.parent.x!==l&&(this.toX={time:0,start:this.parent.x,delta:l-this.parent.x,end:l},this.parent.emit("bounce-x-start",this.parent))}if(!this.toY&&!s.y){let l=null;i.top&&this.top?l=this.parent.screenWorldHeight<this.parent.screenHeight?this.calcUnderflowY():-a.y:i.bottom&&this.bottom&&(l=this.parent.screenWorldHeight<this.parent.screenHeight?this.calcUnderflowY():-h.y),l!==null&&this.parent.y!==l&&(this.toY={time:0,start:this.parent.y,delta:l-this.parent.y,end:l},this.parent.emit("bounce-y-start",this.parent))}}}reset(){this.toX=this.toY=null,this.bounce()}}const AC={left:!1,right:!1,top:!1,bottom:!1,direction:null,underflow:"center"};class RC extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"last"),W(this,"noUnderflow"),W(this,"underflowX"),W(this,"underflowY"),this.options=Object.assign({},AC,e),this.options.direction&&(this.options.left=this.options.direction==="x"||this.options.direction==="all"?!0:null,this.options.right=this.options.direction==="x"||this.options.direction==="all"?!0:null,this.options.top=this.options.direction==="y"||this.options.direction==="all"?!0:null,this.options.bottom=this.options.direction==="y"||this.options.direction==="all"?!0:null),this.parseUnderflow(),this.last={x:null,y:null,scaleX:null,scaleY:null},this.update()}parseUnderflow(){const t=this.options.underflow.toLowerCase();t==="none"?this.noUnderflow=!0:t==="center"?(this.underflowX=this.underflowY=0,this.noUnderflow=!1):(this.underflowX=t.indexOf("left")!==-1?-1:t.indexOf("right")!==-1?1:0,this.underflowY=t.indexOf("top")!==-1?-1:t.indexOf("bottom")!==-1?1:0,this.noUnderflow=!1)}move(){return this.update(),!1}update(){if(this.paused||this.parent.x===this.last.x&&this.parent.y===this.last.y&&this.parent.scale.x===this.last.scaleX&&this.parent.scale.y===this.last.scaleY)return;const t=new ut(this.parent.x,this.parent.y),e=this.parent.plugins.decelerate||{};if(this.options.left!==null||this.options.right!==null){let i=!1;if(!this.noUnderflow&&this.parent.screenWorldWidth<this.parent.screenWidth)switch(this.underflowX){case-1:this.parent.x!==0&&(this.parent.x=0,i=!0);break;case 1:this.parent.x!==this.parent.screenWidth-this.parent.screenWorldWidth&&(this.parent.x=this.parent.screenWidth-this.parent.screenWorldWidth,i=!0);break;default:this.parent.x!==(this.parent.screenWidth-this.parent.screenWorldWidth)/2&&(this.parent.x=(this.parent.screenWidth-this.parent.screenWorldWidth)/2,i=!0)}else this.options.left!==null&&this.parent.left<(this.options.left===!0?0:this.options.left)&&(this.parent.x=-(this.options.left===!0?0:this.options.left)*this.parent.scale.x,e.x=0,i=!0),this.options.right!==null&&this.parent.right>(this.options.right===!0?this.parent.worldWidth:this.options.right)&&(this.parent.x=-(this.options.right===!0?this.parent.worldWidth:this.options.right)*this.parent.scale.x+this.parent.screenWidth,e.x=0,i=!0);i&&this.parent.emit("moved",{viewport:this.parent,original:t,type:"clamp-x"})}if(this.options.top!==null||this.options.bottom!==null){let i=!1;if(!this.noUnderflow&&this.parent.screenWorldHeight<this.parent.screenHeight)switch(this.underflowY){case-1:this.parent.y!==0&&(this.parent.y=0,i=!0);break;case 1:this.parent.y!==this.parent.screenHeight-this.parent.screenWorldHeight&&(this.parent.y=this.parent.screenHeight-this.parent.screenWorldHeight,i=!0);break;default:this.parent.y!==(this.parent.screenHeight-this.parent.screenWorldHeight)/2&&(this.parent.y=(this.parent.screenHeight-this.parent.screenWorldHeight)/2,i=!0)}else this.options.top!==null&&this.parent.top<(this.options.top===!0?0:this.options.top)&&(this.parent.y=-(this.options.top===!0?0:this.options.top)*this.parent.scale.y,e.y=0,i=!0),this.options.bottom!==null&&this.parent.bottom>(this.options.bottom===!0?this.parent.worldHeight:this.options.bottom)&&(this.parent.y=-(this.options.bottom===!0?this.parent.worldHeight:this.options.bottom)*this.parent.scale.y+this.parent.screenHeight,e.y=0,i=!0);i&&this.parent.emit("moved",{viewport:this.parent,original:t,type:"clamp-y"})}this.last.x=this.parent.x,this.last.y=this.parent.y,this.last.scaleX=this.parent.scale.x,this.last.scaleY=this.parent.scale.y}reset(){this.update()}}const MC={minWidth:null,minHeight:null,maxWidth:null,maxHeight:null,minScale:null,maxScale:null};class LC extends qe{constructor(t,e={}){super(t),W(this,"options"),this.options=Object.assign({},MC,e),this.clamp()}resize(){this.clamp()}clamp(){if(!this.paused){if(this.options.minWidth||this.options.minHeight||this.options.maxWidth||this.options.maxHeight){let t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight;if(this.options.minWidth!==null&&t<this.options.minWidth){const i=this.parent.scale.x;this.parent.fitWidth(this.options.minWidth,!1,!1,!0),this.parent.scale.y*=this.parent.scale.x/i,t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.maxWidth!==null&&t>this.options.maxWidth){const i=this.parent.scale.x;this.parent.fitWidth(this.options.maxWidth,!1,!1,!0),this.parent.scale.y*=this.parent.scale.x/i,t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.minHeight!==null&&e<this.options.minHeight){const i=this.parent.scale.y;this.parent.fitHeight(this.options.minHeight,!1,!1,!0),this.parent.scale.x*=this.parent.scale.y/i,t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.maxHeight!==null&&e>this.options.maxHeight){const i=this.parent.scale.y;this.parent.fitHeight(this.options.maxHeight,!1,!1,!0),this.parent.scale.x*=this.parent.scale.y/i,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}}else if(this.options.minScale||this.options.maxScale){const t={x:null,y:null},e={x:null,y:null};if(typeof this.options.minScale=="number")t.x=this.options.minScale,t.y=this.options.minScale;else if(this.options.minScale!==null){const n=this.options.minScale;t.x=typeof n.x>"u"?null:n.x,t.y=typeof n.y>"u"?null:n.y}if(typeof this.options.maxScale=="number")e.x=this.options.maxScale,e.y=this.options.maxScale;else if(this.options.maxScale!==null){const n=this.options.maxScale;e.x=typeof n.x>"u"?null:n.x,e.y=typeof n.y>"u"?null:n.y}let i=this.parent.scale.x,s=this.parent.scale.y;t.x!==null&&i<t.x&&(i=t.x),e.x!==null&&i>e.x&&(i=e.x),t.y!==null&&s<t.y&&(s=t.y),e.y!==null&&s>e.y&&(s=e.y),(i!==this.parent.scale.x||s!==this.parent.scale.y)&&(this.parent.scale.set(i,s),this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"}))}}}reset(){this.clamp()}}const PC={friction:.98,bounce:.8,minSpeed:.01},Or=16;class GC extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"x"),W(this,"y"),W(this,"percentChangeX"),W(this,"percentChangeY"),W(this,"saved"),W(this,"timeSinceRelease"),this.options=Object.assign({},PC,e),this.saved=[],this.timeSinceRelease=0,this.reset(),this.parent.on("moved",i=>this.handleMoved(i))}down(){return this.saved=[],this.x=this.y=null,!1}isActive(){return!!(this.x||this.y)}move(){if(this.paused)return!1;const t=this.parent.input.count();return(t===1||t>1&&!this.parent.plugins.get("pinch",!0))&&(this.saved.push({x:this.parent.x,y:this.parent.y,time:performance.now()}),this.saved.length>60&&this.saved.splice(0,30)),!1}handleMoved(t){if(this.saved.length){const e=this.saved[this.saved.length-1];t.type==="clamp-x"&&t.original?e.x===t.original.x&&(e.x=this.parent.x):t.type==="clamp-y"&&t.original&&e.y===t.original.y&&(e.y=this.parent.y)}}up(){if(this.parent.input.count()===0&&this.saved.length){const t=performance.now();for(const e of this.saved)if(e.time>=t-100){const i=t-e.time;this.x=(this.parent.x-e.x)/i,this.y=(this.parent.y-e.y)/i,this.percentChangeX=this.percentChangeY=this.options.friction,this.timeSinceRelease=0;break}}return!1}activate(t){t=t||{},typeof t.x<"u"&&(this.x=t.x,this.percentChangeX=this.options.friction),typeof t.y<"u"&&(this.y=t.y,this.percentChangeY=this.options.friction)}update(t){if(this.paused)return;const e=this.x||this.y,i=this.timeSinceRelease,s=this.timeSinceRelease+t;if(this.x){const n=this.percentChangeX,o=Math.log(n);this.parent.x+=this.x*Or/o*(Math.pow(n,s/Or)-Math.pow(n,i/Or)),this.x*=Math.pow(this.percentChangeX,t/Or)}if(this.y){const n=this.percentChangeY,o=Math.log(n);this.parent.y+=this.y*Or/o*(Math.pow(n,s/Or)-Math.pow(n,i/Or)),this.y*=Math.pow(this.percentChangeY,t/Or)}this.timeSinceRelease+=t,this.x&&this.y?Math.abs(this.x)<this.options.minSpeed&&Math.abs(this.y)<this.options.minSpeed&&(this.x=0,this.y=0):(Math.abs(this.x||0)<this.options.minSpeed&&(this.x=0),Math.abs(this.y||0)<this.options.minSpeed&&(this.y=0)),e&&this.parent.emit("moved",{viewport:this.parent,type:"decelerate"})}reset(){this.x=this.y=null}}const FC={direction:"all",pressDrag:!0,wheel:!0,wheelScroll:1,reverse:!1,clampWheel:!1,underflow:"center",factor:1,mouseButtons:"all",keyToPress:null,ignoreKeyToPressOnTouch:!1,lineHeight:20,wheelSwapAxes:!1};class NC extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"moved"),W(this,"reverse"),W(this,"xDirection"),W(this,"yDirection"),W(this,"keyIsPressed"),W(this,"mouse"),W(this,"underflowX"),W(this,"underflowY"),W(this,"last"),W(this,"current"),W(this,"windowEventHandlers",[]),this.options=Object.assign({},FC,e),this.moved=!1,this.reverse=this.options.reverse?1:-1,this.xDirection=!this.options.direction||this.options.direction==="all"||this.options.direction==="x",this.yDirection=!this.options.direction||this.options.direction==="all"||this.options.direction==="y",this.keyIsPressed=!1,this.parseUnderflow(),this.mouseButtons(this.options.mouseButtons),this.options.keyToPress&&this.handleKeyPresses(this.options.keyToPress)}handleKeyPresses(t){const e=s=>{t.includes(s.code)&&(this.keyIsPressed=!0)},i=s=>{t.includes(s.code)&&(this.keyIsPressed=!1)};this.addWindowEventHandler("keyup",i),this.addWindowEventHandler("keydown",e)}addWindowEventHandler(t,e){window.addEventListener(t,e),this.windowEventHandlers.push({event:t,handler:e})}destroy(){this.windowEventHandlers.forEach(({event:t,handler:e})=>{window.removeEventListener(t,e)})}mouseButtons(t){!t||t==="all"?this.mouse=[!0,!0,!0]:this.mouse=[t.indexOf("left")!==-1,t.indexOf("middle")!==-1,t.indexOf("right")!==-1]}parseUnderflow(){const t=this.options.underflow.toLowerCase();t==="center"?(this.underflowX=0,this.underflowY=0):(t.includes("left")?this.underflowX=-1:t.includes("right")?this.underflowX=1:this.underflowX=0,t.includes("top")?this.underflowY=-1:t.includes("bottom")?this.underflowY=1:this.underflowY=0)}checkButtons(t){const e=t.pointerType==="mouse",i=this.parent.input.count();return!!((i===1||i>1&&!this.parent.plugins.get("pinch",!0))&&(!e||this.mouse[t.button]))}checkKeyPress(t){return!this.options.keyToPress||this.keyIsPressed||this.options.ignoreKeyToPressOnTouch&&t.data.pointerType==="touch"}down(t){return this.paused||!this.options.pressDrag?!1:this.checkButtons(t)&&this.checkKeyPress(t)?(this.last={x:t.global.x,y:t.global.y},this.current=t.pointerId,!0):(this.last=null,!1)}get active(){return this.moved}move(t){if(this.paused||!this.options.pressDrag)return!1;if(this.last&&this.current===t.data.pointerId){const e=t.global.x,i=t.global.y,s=this.parent.input.count();if(s===1||s>1&&!this.parent.plugins.get("pinch",!0)){const n=e-this.last.x,o=i-this.last.y;if(this.moved||this.xDirection&&this.parent.input.checkThreshold(n)||this.yDirection&&this.parent.input.checkThreshold(o)){const a={x:e,y:i};return this.xDirection&&(this.parent.x+=(a.x-this.last.x)*this.options.factor),this.yDirection&&(this.parent.y+=(a.y-this.last.y)*this.options.factor),this.last=a,this.moved||this.parent.emit("drag-start",{event:t,screen:new ut(this.last.x,this.last.y),world:this.parent.toWorld(new ut(this.last.x,this.last.y)),viewport:this.parent}),this.moved=!0,this.parent.emit("moved",{viewport:this.parent,type:"drag"}),!0}}else this.moved=!1}return!1}up(t){if(this.paused)return!1;const e=this.parent.input.touches;if(e.length===1){const i=e[0];return i.last&&(this.last={x:i.last.x,y:i.last.y},this.current=i.id),this.moved=!1,!0}else if(this.last&&this.moved){const i=new ut(this.last.x,this.last.y);return this.parent.emit("drag-end",{event:t,screen:i,world:this.parent.toWorld(i),viewport:this.parent}),this.last=null,this.moved=!1,!0}return!1}wheel(t){if(this.paused)return!1;if(this.options.wheel){const e=this.parent.plugins.get("wheel",!0);if(!e||!e.options.wheelZoom&&!t.ctrlKey){const i=t.deltaMode?this.options.lineHeight:1,s=[t.deltaX,t.deltaY],[n,o]=this.options.wheelSwapAxes?s.reverse():s;return this.xDirection&&(this.parent.x+=n*i*this.options.wheelScroll*this.reverse),this.yDirection&&(this.parent.y+=o*i*this.options.wheelScroll*this.reverse),this.options.clampWheel&&this.clamp(),this.parent.emit("wheel-scroll",this.parent),this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.options.passiveWheel||t.preventDefault(),this.parent.options.stopPropagation&&t.stopPropagation(),!0}}return!1}resume(){this.last=null,this.paused=!1}clamp(){const t=this.parent.plugins.get("decelerate",!0)||{};if(this.options.clampWheel!=="y")if(this.parent.screenWorldWidth<this.parent.screenWidth)switch(this.underflowX){case-1:this.parent.x=0;break;case 1:this.parent.x=this.parent.screenWidth-this.parent.screenWorldWidth;break;default:this.parent.x=(this.parent.screenWidth-this.parent.screenWorldWidth)/2}else this.parent.left<0?(this.parent.x=0,t.x=0):this.parent.right>this.parent.worldWidth&&(this.parent.x=-this.parent.worldWidth*this.parent.scale.x+this.parent.screenWidth,t.x=0);if(this.options.clampWheel!=="x")if(this.parent.screenWorldHeight<this.parent.screenHeight)switch(this.underflowY){case-1:this.parent.y=0;break;case 1:this.parent.y=this.parent.screenHeight-this.parent.screenWorldHeight;break;default:this.parent.y=(this.parent.screenHeight-this.parent.screenWorldHeight)/2}else this.parent.top<0&&(this.parent.y=0,t.y=0),this.parent.bottom>this.parent.worldHeight&&(this.parent.y=-this.parent.worldHeight*this.parent.scale.y+this.parent.screenHeight,t.y=0)}}const DC={speed:0,acceleration:null,radius:null};class kC extends qe{constructor(t,e,i={}){super(t),W(this,"options"),W(this,"target"),W(this,"velocity"),this.target=e,this.options=Object.assign({},DC,i),this.velocity={x:0,y:0}}update(t){if(this.paused)return;const e=this.parent.center;let i=this.target.x,s=this.target.y;if(this.options.radius)if(Math.sqrt(Math.pow(this.target.y-e.y,2)+Math.pow(this.target.x-e.x,2))>this.options.radius){const a=Math.atan2(this.target.y-e.y,this.target.x-e.x);i=this.target.x-Math.cos(a)*this.options.radius,s=this.target.y-Math.sin(a)*this.options.radius}else return;const n=i-e.x,o=s-e.y;if(n||o)if(this.options.speed)if(this.options.acceleration){const a=Math.atan2(s-e.y,i-e.x),h=Math.sqrt(Math.pow(n,2)+Math.pow(o,2));if(h){const l=(Math.pow(this.velocity.x,2)+Math.pow(this.velocity.y,2))/(2*this.options.acceleration);h>l?this.velocity={x:Math.min(this.velocity.x+(this.options.acceleration*t,this.options.speed)),y:Math.min(this.velocity.y+(this.options.acceleration*t,this.options.speed))}:this.velocity={x:Math.max(this.velocity.x-this.options.acceleration*this.options.speed,0),y:Math.max(this.velocity.y-this.options.acceleration*this.options.speed,0)};const c=Math.cos(a)*this.velocity.x,u=Math.sin(a)*this.velocity.y,d=Math.abs(c)>Math.abs(n)?i:e.x+c,f=Math.abs(u)>Math.abs(o)?s:e.y+u;this.parent.moveCenter(d,f),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}else{const a=Math.atan2(s-e.y,i-e.x),h=Math.cos(a)*this.options.speed,l=Math.sin(a)*this.options.speed,c=Math.abs(h)>Math.abs(n)?i:e.x+h,u=Math.abs(l)>Math.abs(o)?s:e.y+l;this.parent.moveCenter(c,u),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}else this.parent.moveCenter(i,s),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}const OC={radius:null,distance:null,top:null,bottom:null,left:null,right:null,speed:8,reverse:!1,noDecelerate:!1,linear:!1,allowButtons:!1};class BC extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"reverse"),W(this,"radiusSquared"),W(this,"left"),W(this,"top"),W(this,"right"),W(this,"bottom"),W(this,"horizontal"),W(this,"vertical"),this.options=Object.assign({},OC,e),this.reverse=this.options.reverse?1:-1,this.radiusSquared=typeof this.options.radius=="number"?Math.pow(this.options.radius,2):null,this.resize()}resize(){const t=this.options.distance;t!==null?(this.left=t,this.top=t,this.right=this.parent.screenWidth-t,this.bottom=this.parent.screenHeight-t):this.options.radius||(this.left=this.options.left,this.top=this.options.top,this.right=this.options.right===null?null:this.parent.screenWidth-this.options.right,this.bottom=this.options.bottom===null?null:this.parent.screenHeight-this.options.bottom)}down(){return this.paused||this.options.allowButtons||(this.horizontal=this.vertical=null),!1}move(t){if(this.paused||t.pointerType!=="mouse"&&t.pointerId!==1||!this.options.allowButtons&&t.buttons!==0)return!1;const e=t.global.x,i=t.global.y;if(this.radiusSquared){const s=this.parent.toScreen(this.parent.center);if(Math.pow(s.x-e,2)+Math.pow(s.y-i,2)>=this.radiusSquared){const n=Math.atan2(s.y-i,s.x-e);this.options.linear?(this.horizontal=Math.round(Math.cos(n))*this.options.speed*this.reverse*(60/1e3),this.vertical=Math.round(Math.sin(n))*this.options.speed*this.reverse*(60/1e3)):(this.horizontal=Math.cos(n)*this.options.speed*this.reverse*(60/1e3),this.vertical=Math.sin(n)*this.options.speed*this.reverse*(60/1e3))}else this.horizontal&&this.decelerateHorizontal(),this.vertical&&this.decelerateVertical(),this.horizontal=this.vertical=0}else this.left!==null&&e<this.left?this.horizontal=Number(this.reverse)*this.options.speed*(60/1e3):this.right!==null&&e>this.right?this.horizontal=-1*this.reverse*this.options.speed*(60/1e3):(this.decelerateHorizontal(),this.horizontal=0),this.top!==null&&i<this.top?this.vertical=Number(this.reverse)*this.options.speed*(60/1e3):this.bottom!==null&&i>this.bottom?this.vertical=-1*this.reverse*this.options.speed*(60/1e3):(this.decelerateVertical(),this.vertical=0);return!1}decelerateHorizontal(){const t=this.parent.plugins.get("decelerate",!0);this.horizontal&&t&&!this.options.noDecelerate&&t.activate({x:this.horizontal*this.options.speed*this.reverse/(1e3/60)})}decelerateVertical(){const t=this.parent.plugins.get("decelerate",!0);this.vertical&&t&&!this.options.noDecelerate&&t.activate({y:this.vertical*this.options.speed*this.reverse/(1e3/60)})}up(){return this.paused||(this.horizontal&&this.decelerateHorizontal(),this.vertical&&this.decelerateVertical(),this.horizontal=this.vertical=null),!1}update(){if(!this.paused&&(this.horizontal||this.vertical)){const t=this.parent.center;this.horizontal&&(t.x+=this.horizontal*this.options.speed),this.vertical&&(t.y+=this.vertical*this.options.speed),this.parent.moveCenter(t),this.parent.emit("moved",{viewport:this.parent,type:"mouse-edges"})}}}const WC={noDrag:!1,percent:1,center:null,factor:1,axis:"all"};class UC extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"active",!1),W(this,"pinching",!1),W(this,"moved",!1),W(this,"lastCenter"),this.options=Object.assign({},WC,e)}down(){return this.parent.input.count()>=2?(this.active=!0,!0):!1}isAxisX(){return["all","x"].includes(this.options.axis)}isAxisY(){return["all","y"].includes(this.options.axis)}move(t){if(this.paused||!this.active)return!1;const e=t.global.x,i=t.global.y,s=this.parent.input.touches;if(s.length>=2){const n=s[0],o=s[1],a=n.last&&o.last?Math.sqrt(Math.pow(o.last.x-n.last.x,2)+Math.pow(o.last.y-n.last.y,2)):null;if(n.id===t.pointerId?n.last={x:e,y:i,data:t}:o.id===t.pointerId&&(o.last={x:e,y:i,data:t}),a){let h;const l=new ut(n.last.x+(o.last.x-n.last.x)/2,n.last.y+(o.last.y-n.last.y)/2);this.options.center||(h=this.parent.toLocal(l));let c=Math.sqrt(Math.pow(o.last.x-n.last.x,2)+Math.pow(o.last.y-n.last.y,2));c=c===0?c=1e-10:c;const u=(1-a/c)*this.options.percent*(this.isAxisX()?this.parent.scale.x:this.parent.scale.y);this.isAxisX()&&(this.parent.scale.x+=u),this.isAxisY()&&(this.parent.scale.y+=u),this.parent.emit("zoomed",{viewport:this.parent,type:"pinch",center:l});const d=this.parent.plugins.get("clamp-zoom",!0);if(d&&d.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const f=this.parent.toGlobal(h);this.parent.x+=(l.x-f.x)*this.options.factor,this.parent.y+=(l.y-f.y)*this.options.factor,this.parent.emit("moved",{viewport:this.parent,type:"pinch"})}!this.options.noDrag&&this.lastCenter&&(this.parent.x+=(l.x-this.lastCenter.x)*this.options.factor,this.parent.y+=(l.y-this.lastCenter.y)*this.options.factor,this.parent.emit("moved",{viewport:this.parent,type:"pinch"})),this.lastCenter=l,this.moved=!0}else this.pinching||(this.parent.emit("pinch-start",this.parent),this.pinching=!0);return!0}return!1}up(){return this.pinching&&this.parent.input.touches.length<=1?(this.active=!1,this.lastCenter=null,this.pinching=!1,this.moved=!1,this.parent.emit("pinch-end",this.parent),!0):!1}}const XC={topLeft:!1,friction:.8,time:1e3,ease:"easeInOutSine",interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1};class ZC extends qe{constructor(t,e,i,s={}){super(t),W(this,"options"),W(this,"ease"),W(this,"x"),W(this,"y"),W(this,"percent"),W(this,"snapping"),W(this,"deltaX"),W(this,"deltaY"),W(this,"startX"),W(this,"startY"),this.options=Object.assign({},XC,s),this.ease=vh(s.ease,"easeInOutSine"),this.x=e,this.y=i,this.options.forceStart&&this.snapStart()}snapStart(){this.percent=0,this.snapping={time:0};const t=this.options.topLeft?this.parent.corner:this.parent.center;this.deltaX=this.x-t.x,this.deltaY=this.y-t.y,this.startX=t.x,this.startY=t.y,this.parent.emit("snap-start",this.parent)}wheel(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("snap"),!1}down(){return this.options.removeOnInterrupt?this.parent.plugins.remove("snap"):this.options.interrupt&&(this.snapping=null),!1}up(){if(this.parent.input.count()===0){const t=this.parent.plugins.get("decelerate",!0);t&&(t.x||t.y)&&(t.percentChangeX=t.percentChangeY=this.options.friction)}return!1}update(t){if(!this.paused&&!(this.options.interrupt&&this.parent.input.count()!==0))if(this.snapping){const e=this.snapping;e.time+=t;let i,s,n;const o=this.startX,a=this.startY,h=this.deltaX,l=this.deltaY;if(e.time>this.options.time)i=!0,s=o+h,n=a+l;else{const c=this.ease(e.time,0,1,this.options.time);s=o+h*c,n=a+l*c}this.options.topLeft?this.parent.moveCorner(s,n):this.parent.moveCenter(s,n),this.parent.emit("moved",{viewport:this.parent,type:"snap"}),i&&(this.options.removeOnComplete&&this.parent.plugins.remove("snap"),this.parent.emit("snap-end",this.parent),this.snapping=null)}else{const e=this.options.topLeft?this.parent.corner:this.parent.center;(e.x!==this.x||e.y!==this.y)&&this.snapStart()}}}const VC={width:0,height:0,time:1e3,ease:"easeInOutSine",center:null,interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1,noMove:!1};class HC extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"ease"),W(this,"xScale"),W(this,"yScale"),W(this,"xIndependent"),W(this,"yIndependent"),W(this,"snapping"),this.options=Object.assign({},VC,e),this.ease=vh(this.options.ease),this.xIndependent=!1,this.yIndependent=!1,this.xScale=0,this.yScale=0,this.options.width>0&&(this.xScale=t.screenWidth/this.options.width,this.xIndependent=!0),this.options.height>0&&(this.yScale=t.screenHeight/this.options.height,this.yIndependent=!0),this.xScale=this.xIndependent?this.xScale:this.yScale,this.yScale=this.yIndependent?this.yScale:this.xScale,this.options.time===0?(t.container.scale.x=this.xScale,t.container.scale.y=this.yScale,this.options.removeOnComplete&&this.parent.plugins.remove("snap-zoom")):e.forceStart&&this.createSnapping()}createSnapping(){const t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,i=this.parent.screenWidth/this.xScale,s=this.parent.screenHeight/this.yScale;this.snapping={time:0,startX:t,startY:e,deltaX:i-t,deltaY:s-e},this.parent.emit("snap-zoom-start",this.parent)}resize(){this.snapping=null,this.options.width>0&&(this.xScale=this.parent.screenWidth/this.options.width),this.options.height>0&&(this.yScale=this.parent.screenHeight/this.options.height),this.xScale=this.xIndependent?this.xScale:this.yScale,this.yScale=this.yIndependent?this.yScale:this.xScale}wheel(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("snap-zoom"),!1}down(){return this.options.removeOnInterrupt?this.parent.plugins.remove("snap-zoom"):this.options.interrupt&&(this.snapping=null),!1}update(t){if(this.paused||this.options.interrupt&&this.parent.input.count()!==0)return;let e;if(!this.options.center&&!this.options.noMove&&(e=this.parent.center),!this.snapping)(this.parent.scale.x!==this.xScale||this.parent.scale.y!==this.yScale)&&this.createSnapping();else if(this.snapping){const i=this.snapping;if(i.time+=t,i.time>=this.options.time)this.parent.scale.set(this.xScale,this.yScale),this.options.removeOnComplete&&this.parent.plugins.remove("snap-zoom"),this.parent.emit("snap-zoom-end",this.parent),this.snapping=null;else{const n=this.snapping,o=this.ease(n.time,n.startX,n.deltaX,this.options.time),a=this.ease(n.time,n.startY,n.deltaY,this.options.time);this.parent.scale.x=this.parent.screenWidth/o,this.parent.scale.y=this.parent.screenHeight/a}const s=this.parent.plugins.get("clamp-zoom",!0);s&&s.clamp(),this.options.noMove||(this.options.center?this.parent.moveCenter(this.options.center):this.parent.moveCenter(e))}}resume(){this.snapping=null,super.resume()}}const KC={percent:.1,smooth:!1,interrupt:!0,reverse:!1,center:null,lineHeight:20,axis:"all",keyToPress:null,trackpadPinch:!1,wheelZoom:!0};class YC extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"smoothing"),W(this,"smoothingCenter"),W(this,"smoothingCount"),W(this,"keyIsPressed"),this.options=Object.assign({},KC,e),this.keyIsPressed=!1,this.options.keyToPress&&this.handleKeyPresses(this.options.keyToPress)}handleKeyPresses(t){window.addEventListener("keydown",e=>{t.includes(e.code)&&(this.keyIsPressed=!0)}),window.addEventListener("keyup",e=>{t.includes(e.code)&&(this.keyIsPressed=!1)})}checkKeyPress(){return!this.options.keyToPress||this.keyIsPressed}down(){return this.options.interrupt&&(this.smoothing=null),!1}isAxisX(){return["all","x"].includes(this.options.axis)}isAxisY(){return["all","y"].includes(this.options.axis)}update(){if(this.smoothing){const t=this.smoothingCenter,e=this.smoothing;let i;this.options.center||(i=this.parent.toLocal(t)),this.isAxisX()&&(this.parent.scale.x+=e.x),this.isAxisY()&&(this.parent.scale.y+=e.y),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const s=this.parent.plugins.get("clamp-zoom",!0);if(s&&s.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const n=this.parent.toGlobal(i);this.parent.x+=t.x-n.x,this.parent.y+=t.y-n.y}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.smoothingCount++,this.smoothingCount>=this.options.smooth&&(this.smoothing=null)}}pinch(t){if(this.paused)return;const e=this.parent.input.getPointerPosition(t),i=-t.deltaY*(t.deltaMode?this.options.lineHeight:1)/200,s=Math.pow(2,(1+this.options.percent)*i);let n;this.options.center||(n=this.parent.toLocal(e)),this.isAxisX()&&(this.parent.scale.x*=s),this.isAxisY()&&(this.parent.scale.y*=s),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const o=this.parent.plugins.get("clamp-zoom",!0);if(o&&o.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const a=this.parent.toGlobal(n);this.parent.x+=e.x-a.x,this.parent.y+=e.y-a.y}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.emit("wheel-start",{event:t,viewport:this.parent})}wheel(t){if(this.paused||!this.checkKeyPress())return!1;if(t.ctrlKey&&this.options.trackpadPinch)this.pinch(t);else if(this.options.wheelZoom){const e=this.parent.input.getPointerPosition(t),i=(this.options.reverse?-1:1)*-t.deltaY*(t.deltaMode?this.options.lineHeight:1)/500,s=Math.pow(2,(1+this.options.percent)*i);if(this.options.smooth){const n={x:this.smoothing?this.smoothing.x*(this.options.smooth-this.smoothingCount):0,y:this.smoothing?this.smoothing.y*(this.options.smooth-this.smoothingCount):0};this.smoothing={x:((this.parent.scale.x+n.x)*s-this.parent.scale.x)/this.options.smooth,y:((this.parent.scale.y+n.y)*s-this.parent.scale.y)/this.options.smooth},this.smoothingCount=0,this.smoothingCenter=e}else{let n;this.options.center||(n=this.parent.toLocal(e)),this.isAxisX()&&(this.parent.scale.x*=s),this.isAxisY()&&(this.parent.scale.y*=s),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const o=this.parent.plugins.get("clamp-zoom",!0);if(o&&o.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const a=this.parent.toGlobal(n);this.parent.x+=e.x-a.x,this.parent.y+=e.y-a.y}}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.emit("wheel-start",{event:t,viewport:this.parent})}return!this.parent.options.passiveWheel}}class zC{constructor(t){W(this,"viewport"),W(this,"clickedAvailable"),W(this,"isMouseDown"),W(this,"last"),W(this,"wheelFunction"),W(this,"touches"),this.viewport=t,this.touches=[],this.addListeners()}addListeners(){this.viewport.interactive=!0,this.viewport.forceHitArea||(this.viewport.hitArea=new pt(0,0,this.viewport.worldWidth,this.viewport.worldHeight)),this.viewport.on("pointerdown",this.down,this),this.viewport.options.allowPreserveDragOutside?this.viewport.on("globalpointermove",this.move,this):this.viewport.on("pointermove",this.move,this),this.viewport.on("pointerup",this.up,this),this.viewport.on("pointerupoutside",this.up,this),this.viewport.on("pointercancel",this.up,this),this.viewport.options.allowPreserveDragOutside||this.viewport.on("pointerleave",this.up,this),this.wheelFunction=t=>this.handleWheel(t),this.viewport.options.events.domElement.addEventListener("wheel",this.wheelFunction,{passive:this.viewport.options.passiveWheel}),this.isMouseDown=!1}destroy(){this.viewport.options.events.domElement.removeEventListener("wheel",this.wheelFunction)}down(t){if(!(this.viewport.pause||!this.viewport.worldVisible)){if(t.pointerType==="mouse"?this.isMouseDown=!0:this.get(t.pointerId)||this.touches.push({id:t.pointerId,last:null}),this.count()===1){this.last=t.global.clone();const e=this.viewport.plugins.get("decelerate",!0),i=this.viewport.plugins.get("bounce",!0);(!e||!e.isActive())&&(!i||!i.isActive())?this.clickedAvailable=!0:this.clickedAvailable=!1}else this.clickedAvailable=!1;this.viewport.plugins.down(t)&&this.viewport.options.stopPropagation&&t.stopPropagation()}}clear(){this.isMouseDown=!1,this.touches=[],this.last=null}checkThreshold(t){return Math.abs(t)>=this.viewport.threshold}move(t){if(this.viewport.pause||!this.viewport.worldVisible)return;const e=this.viewport.plugins.move(t);if(this.clickedAvailable&&this.last){const i=t.global.x-this.last.x,s=t.global.y-this.last.y;(this.checkThreshold(i)||this.checkThreshold(s))&&(this.clickedAvailable=!1)}e&&this.viewport.options.stopPropagation&&t.stopPropagation()}up(t){if(this.viewport.pause||!this.viewport.worldVisible)return;t.pointerType==="mouse"&&(this.isMouseDown=!1),t.pointerType!=="mouse"&&this.remove(t.pointerId);const e=this.viewport.plugins.up(t);this.clickedAvailable&&this.count()===0&&this.last&&(this.viewport.emit("clicked",{event:t,screen:this.last,world:this.viewport.toWorld(this.last),viewport:this.viewport}),this.clickedAvailable=!1),e&&this.viewport.options.stopPropagation&&t.stopPropagation()}getPointerPosition(t){const e=new ut;return this.viewport.options.events.mapPositionToPoint(e,t.clientX,t.clientY),e}handleWheel(t){if(this.viewport.pause||!this.viewport.worldVisible)return;const e=this.viewport.toLocal(this.getPointerPosition(t));this.viewport.left<=e.x&&e.x<=this.viewport.right&&this.viewport.top<=e.y&&e.y<=this.viewport.bottom&&this.viewport.plugins.wheel(t)&&!this.viewport.options.passiveWheel&&t.preventDefault()}pause(){this.touches=[],this.isMouseDown=!1}get(t){for(const e of this.touches)if(e.id===t)return e;return null}remove(t){for(let e=0;e<this.touches.length;e++)if(this.touches[e].id===t){this.touches.splice(e,1);return}}count(){return(this.isMouseDown?1:0)+this.touches.length}}const _o=["drag","pinch","wheel","follow","mouse-edges","decelerate","animate","bounce","snap-zoom","clamp-zoom","snap","clamp"];class jC{constructor(t){W(this,"plugins"),W(this,"list"),W(this,"viewport"),this.viewport=t,this.list=[],this.plugins={}}add(t,e,i=_o.length){const s=this.plugins[t];s&&s.destroy(),this.plugins[t]=e;const n=_o.indexOf(t);n!==-1&&_o.splice(n,1),_o.splice(i,0,t),this.sort()}get(t,e){var i;return e&&(i=this.plugins[t])!=null&&i.paused?null:this.plugins[t]}update(t){for(const e of this.list)e.update(t)}resize(){for(const t of this.list)t.resize()}reset(){for(const t of this.list)t.reset()}removeAll(){this.list.forEach(t=>{t.destroy()}),this.plugins={},this.sort()}remove(t){var e;this.plugins[t]&&((e=this.plugins[t])==null||e.destroy(),delete this.plugins[t],this.viewport.emit("plugin-remove",t),this.sort())}pause(t){var e;(e=this.plugins[t])==null||e.pause()}resume(t){var e;(e=this.plugins[t])==null||e.resume()}sort(){this.list=[];for(const t of _o)this.plugins[t]&&this.list.push(this.plugins[t])}down(t){let e=!1;for(const i of this.list)i.down(t)&&(e=!0);return e}move(t){let e=!1;for(const i of this.viewport.plugins.list)i.move(t)&&(e=!0);return e}up(t){let e=!1;for(const i of this.list)i.up(t)&&(e=!0);return e}wheel(t){let e=!1;for(const i of this.list)i.wheel(t)&&(e=!0);return e}}const JC={screenWidth:window.innerWidth,screenHeight:window.innerHeight,worldWidth:null,worldHeight:null,threshold:5,passiveWheel:!0,stopPropagation:!1,forceHitArea:null,noTicker:!1,disableOnContextMenu:!1,ticker:ve.shared,allowPreserveDragOutside:!1};class $C extends At{constructor(t){super(),W(this,"moving"),W(this,"screenWidth"),W(this,"screenHeight"),W(this,"threshold"),W(this,"input"),W(this,"plugins"),W(this,"zooming"),W(this,"lastViewport"),W(this,"options"),W(this,"_dirty"),W(this,"_forceHitArea"),W(this,"_hitAreaDefault"),W(this,"_pause"),W(this,"tickerFunction"),W(this,"_worldWidth"),W(this,"_worldHeight"),W(this,"_disableOnContextMenu",e=>e.preventDefault()),this.options={...JC,...t},this.screenWidth=this.options.screenWidth,this.screenHeight=this.options.screenHeight,this._worldWidth=this.options.worldWidth,this._worldHeight=this.options.worldHeight,this.forceHitArea=this.options.forceHitArea,this.threshold=this.options.threshold,this.options.disableOnContextMenu&&this.options.events.domElement.addEventListener("contextmenu",this._disableOnContextMenu),this.options.noTicker||(this.tickerFunction=()=>this.update(this.options.ticker.elapsedMS),this.options.ticker.add(this.tickerFunction)),this.input=new zC(this),this.plugins=new jC(this)}destroy(t){!this.options.noTicker&&this.tickerFunction&&this.options.ticker.remove(this.tickerFunction),this.options.disableOnContextMenu&&this.options.events.domElement.removeEventListener("contextmenu",this._disableOnContextMenu),this.input.destroy(),super.destroy(t)}update(t){this.pause||(this.plugins.update(t),this.lastViewport&&(this.lastViewport.x!==this.x||this.lastViewport.y!==this.y?this.moving=!0:this.moving&&(this.emit("moved-end",this),this.moving=!1),this.lastViewport.scaleX!==this.scale.x||this.lastViewport.scaleY!==this.scale.y?this.zooming=!0:this.zooming&&(this.emit("zoomed-end",this),this.zooming=!1)),this.forceHitArea||(this._hitAreaDefault=new pt(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight),this.hitArea=this._hitAreaDefault),this._dirty=this._dirty||!this.lastViewport||this.lastViewport.x!==this.x||this.lastViewport.y!==this.y||this.lastViewport.scaleX!==this.scale.x||this.lastViewport.scaleY!==this.scale.y,this.lastViewport={x:this.x,y:this.y,scaleX:this.scale.x,scaleY:this.scale.y},this.emit("frame-end",this))}resize(t=window.innerWidth,e=window.innerHeight,i,s){this.screenWidth=t,this.screenHeight=e,typeof i<"u"&&(this._worldWidth=i),typeof s<"u"&&(this._worldHeight=s),this.plugins.resize(),this.dirty=!0}get worldWidth(){return this._worldWidth?this._worldWidth:this.width/this.scale.x}set worldWidth(t){this._worldWidth=t,this.plugins.resize()}get worldHeight(){return this._worldHeight?this._worldHeight:this.height/this.scale.y}set worldHeight(t){this._worldHeight=t,this.plugins.resize()}getVisibleBounds(){return new pt(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight)}toWorld(t,e){return arguments.length===2?this.toLocal(new ut(t,e)):this.toLocal(t)}toScreen(t,e){return arguments.length===2?this.toGlobal(new ut(t,e)):this.toGlobal(t)}get worldScreenWidth(){return this.screenWidth/this.scale.x}get worldScreenHeight(){return this.screenHeight/this.scale.y}get screenWorldWidth(){return this.worldWidth*this.scale.x}get screenWorldHeight(){return this.worldHeight*this.scale.y}get center(){return new ut(this.worldScreenWidth/2-this.x/this.scale.x,this.worldScreenHeight/2-this.y/this.scale.y)}set center(t){this.moveCenter(t)}moveCenter(...t){let e,i;typeof t[0]=="number"?(e=t[0],i=t[1]):(e=t[0].x,i=t[0].y);const s=(this.worldScreenWidth/2-e)*this.scale.x,n=(this.worldScreenHeight/2-i)*this.scale.y;return(this.x!==s||this.y!==n)&&(this.position.set(s,n),this.plugins.reset(),this.dirty=!0),this}get corner(){return new ut(-this.x/this.scale.x,-this.y/this.scale.y)}set corner(t){this.moveCorner(t)}moveCorner(...t){let e,i;return t.length===1?(e=-t[0].x*this.scale.x,i=-t[0].y*this.scale.y):(e=-t[0]*this.scale.x,i=-t[1]*this.scale.y),(e!==this.x||i!==this.y)&&(this.position.set(e,i),this.plugins.reset(),this.dirty=!0),this}get screenWidthInWorldPixels(){return this.screenWidth/this.scale.x}get screenHeightInWorldPixels(){return this.screenHeight/this.scale.y}findFitWidth(t){return this.screenWidth/t}findFitHeight(t){return this.screenHeight/t}findFit(t,e){const i=this.screenWidth/t,s=this.screenHeight/e;return Math.min(i,s)}findCover(t,e){const i=this.screenWidth/t,s=this.screenHeight/e;return Math.max(i,s)}fitWidth(t=this.worldWidth,e,i=!0,s){let n;e&&(n=this.center),this.scale.x=this.screenWidth/t,i&&(this.scale.y=this.scale.x);const o=this.plugins.get("clamp-zoom",!0);return!s&&o&&o.clamp(),e&&n&&this.moveCenter(n),this}fitHeight(t=this.worldHeight,e,i=!0,s){let n;e&&(n=this.center),this.scale.y=this.screenHeight/t,i&&(this.scale.x=this.scale.y);const o=this.plugins.get("clamp-zoom",!0);return!s&&o&&o.clamp(),e&&n&&this.moveCenter(n),this}fitWorld(t){let e;t&&(e=this.center),this.scale.x=this.screenWidth/this.worldWidth,this.scale.y=this.screenHeight/this.worldHeight,this.scale.x<this.scale.y?this.scale.y=this.scale.x:this.scale.x=this.scale.y;const i=this.plugins.get("clamp-zoom",!0);return i&&i.clamp(),t&&e&&this.moveCenter(e),this}fit(t,e=this.worldWidth,i=this.worldHeight){let s;t&&(s=this.center),this.scale.x=this.screenWidth/e,this.scale.y=this.screenHeight/i,this.scale.x<this.scale.y?this.scale.y=this.scale.x:this.scale.x=this.scale.y;const n=this.plugins.get("clamp-zoom",!0);return n&&n.clamp(),t&&s&&this.moveCenter(s),this}setZoom(t,e){let i;e&&(i=this.center),this.scale.set(t);const s=this.plugins.get("clamp-zoom",!0);return s&&s.clamp(),e&&i&&this.moveCenter(i),this}zoomPercent(t,e){return this.setZoom(this.scale.x+this.scale.x*t,e)}zoom(t,e){return this.fitWidth(t+this.worldScreenWidth,e),this}get scaled(){return this.scale.x}set scaled(t){this.setZoom(t,!0)}snapZoom(t){return this.plugins.add("snap-zoom",new HC(this,t)),this}OOB(){return{left:this.left<0,right:this.right>this.worldWidth,top:this.top<0,bottom:this.bottom>this.worldHeight,cornerPoint:new ut(this.worldWidth*this.scale.x-this.screenWidth,this.worldHeight*this.scale.y-this.screenHeight)}}get right(){return-this.x/this.scale.x+this.worldScreenWidth}set right(t){this.x=-t*this.scale.x+this.screenWidth,this.plugins.reset()}get left(){return-this.x/this.scale.x}set left(t){this.x=-t*this.scale.x,this.plugins.reset()}get top(){return-this.y/this.scale.y}set top(t){this.y=-t*this.scale.y,this.plugins.reset()}get bottom(){return-this.y/this.scale.y+this.worldScreenHeight}set bottom(t){this.y=-t*this.scale.y+this.screenHeight,this.plugins.reset()}get dirty(){return!!this._dirty}set dirty(t){this._dirty=t}get forceHitArea(){return this._forceHitArea}set forceHitArea(t){t?(this._forceHitArea=t,this.hitArea=t):(this._forceHitArea=null,this.hitArea=new pt(0,0,this.worldWidth,this.worldHeight))}drag(t){return this.plugins.add("drag",new NC(this,t)),this}clamp(t){return this.plugins.add("clamp",new RC(this,t)),this}decelerate(t){return this.plugins.add("decelerate",new GC(this,t)),this}bounce(t){return this.plugins.add("bounce",new IC(this,t)),this}pinch(t){return this.plugins.add("pinch",new UC(this,t)),this}snap(t,e,i){return this.plugins.add("snap",new ZC(this,t,e,i)),this}follow(t,e){return this.plugins.add("follow",new kC(this,t,e)),this}wheel(t){return this.plugins.add("wheel",new YC(this,t)),this}animate(t){return this.plugins.add("animate",new EC(this,t)),this}clampZoom(t){return this.plugins.add("clamp-zoom",new LC(this,t)),this}mouseEdges(t){return this.plugins.add("mouse-edges",new BC(this,t)),this}get pause(){return!!this._pause}set pause(t){this._pause=t,this.lastViewport=null,this.moving=!1,this.zooming=!1,t&&this.input.pause()}ensureVisible(t,e,i,s,n){n&&(i>this.worldScreenWidth||s>this.worldScreenHeight)&&(this.fit(!0,i,s),this.emit("zoomed",{viewport:this,type:"ensureVisible"}));let o=!1;t<this.left?(this.left=t,o=!0):t+i>this.right&&(this.right=t+i,o=!0),e<this.top?(this.top=e,o=!0):e+s>this.bottom&&(this.bottom=e+s,o=!0),o&&this.emit("moved",{viewport:this,type:"ensureVisible"})}}function Th(r,t){return r==null||t==null?NaN:r<t?-1:r>t?1:r>=t?0:NaN}function QC(r,t){return r==null||t==null?NaN:t<r?-1:t>r?1:t>=r?0:NaN}function Qu(r){let t,e,i;r.length!==2?(t=Th,e=(a,h)=>Th(r(a),h),i=(a,h)=>r(a)-h):(t=r===Th||r===QC?r:qC,e=r,i=r);function s(a,h,l=0,c=a.length){if(l<c){if(t(h,h)!==0)return c;do{const u=l+c>>>1;e(a[u],h)<0?l=u+1:c=u}while(l<c)}return l}function n(a,h,l=0,c=a.length){if(l<c){if(t(h,h)!==0)return c;do{const u=l+c>>>1;e(a[u],h)<=0?l=u+1:c=u}while(l<c)}return l}function o(a,h,l=0,c=a.length){const u=s(a,h,l,c-1);return u>l&&i(a[u-1],h)>-i(a[u],h)?u-1:u}return{left:s,center:o,right:n}}function qC(){return 0}function tI(r){return r===null?NaN:+r}const eI=Qu(Th).right;Qu(tI).center;const iI=eI,rI=Math.sqrt(50),sI=Math.sqrt(10),nI=Math.sqrt(2);function wh(r,t,e){const i=(t-r)/Math.max(0,e),s=Math.floor(Math.log10(i)),n=i/Math.pow(10,s),o=n>=rI?10:n>=sI?5:n>=nI?2:1;let a,h,l;return s<0?(l=Math.pow(10,-s)/o,a=Math.round(r*l),h=Math.round(t*l),a/l<r&&++a,h/l>t&&--h,l=-l):(l=Math.pow(10,s)*o,a=Math.round(r/l),h=Math.round(t/l),a*l<r&&++a,h*l>t&&--h),h<a&&.5<=e&&e<2?wh(r,t,e*2):[a,h,l]}function oI(r,t,e){if(t=+t,r=+r,e=+e,!(e>0))return[];if(r===t)return[r];const i=t<r,[s,n,o]=i?wh(t,r,e):wh(r,t,e);if(!(n>=s))return[];const a=n-s+1,h=new Array(a);if(i)if(o<0)for(let l=0;l<a;++l)h[l]=(n-l)/-o;else for(let l=0;l<a;++l)h[l]=(n-l)*o;else if(o<0)for(let l=0;l<a;++l)h[l]=(s+l)/-o;else for(let l=0;l<a;++l)h[l]=(s+l)*o;return h}function qu(r,t,e){return t=+t,r=+r,e=+e,wh(r,t,e)[2]}function td(r,t,e){t=+t,r=+r,e=+e;const i=t<r,s=i?qu(t,r,e):qu(r,t,e);return(i?-1:1)*(s<0?1/-s:s)}function ed(r,t,e){r.prototype=t.prototype=e,e.constructor=r}function ay(r,t){var e=Object.create(r.prototype);for(var i in t)e[i]=t[i];return e}function vo(){}var To=.7,Sh=1/To,pn="\\s*([+-]?\\d+)\\s*",wo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ki="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",aI=/^#([0-9a-f]{3,8})$/,hI=new RegExp(`^rgb\\(${pn},${pn},${pn}\\)$`),lI=new RegExp(`^rgb\\(${ki},${ki},${ki}\\)$`),cI=new RegExp(`^rgba\\(${pn},${pn},${pn},${wo}\\)$`),uI=new RegExp(`^rgba\\(${ki},${ki},${ki},${wo}\\)$`),dI=new RegExp(`^hsl\\(${wo},${ki},${ki}\\)$`),fI=new RegExp(`^hsla\\(${wo},${ki},${ki},${wo}\\)$`),hy={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};ed(vo,So,{copy(r){return Object.assign(new this.constructor,this,r)},displayable(){return this.rgb().displayable()},hex:ly,formatHex:ly,formatHex8:pI,formatHsl:mI,formatRgb:cy,toString:cy});function ly(){return this.rgb().formatHex()}function pI(){return this.rgb().formatHex8()}function mI(){return my(this).formatHsl()}function cy(){return this.rgb().formatRgb()}function So(r){var t,e;return r=(r+"").trim().toLowerCase(),(t=aI.exec(r))?(e=t[1].length,t=parseInt(t[1],16),e===6?uy(t):e===3?new Me(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):e===8?Eh(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):e===4?Eh(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=hI.exec(r))?new Me(t[1],t[2],t[3],1):(t=lI.exec(r))?new Me(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=cI.exec(r))?Eh(t[1],t[2],t[3],t[4]):(t=uI.exec(r))?Eh(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=dI.exec(r))?py(t[1],t[2]/100,t[3]/100,1):(t=fI.exec(r))?py(t[1],t[2]/100,t[3]/100,t[4]):hy.hasOwnProperty(r)?uy(hy[r]):r==="transparent"?new Me(NaN,NaN,NaN,0):null}function uy(r){return new Me(r>>16&255,r>>8&255,r&255,1)}function Eh(r,t,e,i){return i<=0&&(r=t=e=NaN),new Me(r,t,e,i)}function gI(r){return r instanceof vo||(r=So(r)),r?(r=r.rgb(),new Me(r.r,r.g,r.b,r.opacity)):new Me}function id(r,t,e,i){return arguments.length===1?gI(r):new Me(r,t,e,i??1)}function Me(r,t,e,i){this.r=+r,this.g=+t,this.b=+e,this.opacity=+i}ed(Me,id,ay(vo,{brighter(r){return r=r==null?Sh:Math.pow(Sh,r),new Me(this.r*r,this.g*r,this.b*r,this.opacity)},darker(r){return r=r==null?To:Math.pow(To,r),new Me(this.r*r,this.g*r,this.b*r,this.opacity)},rgb(){return this},clamp(){return new Me(vs(this.r),vs(this.g),vs(this.b),Ch(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:dy,formatHex:dy,formatHex8:yI,formatRgb:fy,toString:fy}));function dy(){return`#${Ts(this.r)}${Ts(this.g)}${Ts(this.b)}`}function yI(){return`#${Ts(this.r)}${Ts(this.g)}${Ts(this.b)}${Ts((isNaN(this.opacity)?1:this.opacity)*255)}`}function fy(){const r=Ch(this.opacity);return`${r===1?"rgb(":"rgba("}${vs(this.r)}, ${vs(this.g)}, ${vs(this.b)}${r===1?")":`, ${r})`}`}function Ch(r){return isNaN(r)?1:Math.max(0,Math.min(1,r))}function vs(r){return Math.max(0,Math.min(255,Math.round(r)||0))}function Ts(r){return r=vs(r),(r<16?"0":"")+r.toString(16)}function py(r,t,e,i){return i<=0?r=t=e=NaN:e<=0||e>=1?r=t=NaN:t<=0&&(r=NaN),new di(r,t,e,i)}function my(r){if(r instanceof di)return new di(r.h,r.s,r.l,r.opacity);if(r instanceof vo||(r=So(r)),!r)return new di;if(r instanceof di)return r;r=r.rgb();var t=r.r/255,e=r.g/255,i=r.b/255,s=Math.min(t,e,i),n=Math.max(t,e,i),o=NaN,a=n-s,h=(n+s)/2;return a?(t===n?o=(e-i)/a+(e<i)*6:e===n?o=(i-t)/a+2:o=(t-e)/a+4,a/=h<.5?n+s:2-n-s,o*=60):a=h>0&&h<1?0:o,new di(o,a,h,r.opacity)}function bI(r,t,e,i){return arguments.length===1?my(r):new di(r,t,e,i??1)}function di(r,t,e,i){this.h=+r,this.s=+t,this.l=+e,this.opacity=+i}ed(di,bI,ay(vo,{brighter(r){return r=r==null?Sh:Math.pow(Sh,r),new di(this.h,this.s,this.l*r,this.opacity)},darker(r){return r=r==null?To:Math.pow(To,r),new di(this.h,this.s,this.l*r,this.opacity)},rgb(){var r=this.h%360+(this.h<0)*360,t=isNaN(r)||isNaN(this.s)?0:this.s,e=this.l,i=e+(e<.5?e:1-e)*t,s=2*e-i;return new Me(rd(r>=240?r-240:r+120,s,i),rd(r,s,i),rd(r<120?r+240:r-120,s,i),this.opacity)},clamp(){return new di(gy(this.h),Ih(this.s),Ih(this.l),Ch(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const r=Ch(this.opacity);return`${r===1?"hsl(":"hsla("}${gy(this.h)}, ${Ih(this.s)*100}%, ${Ih(this.l)*100}%${r===1?")":`, ${r})`}`}}));function gy(r){return r=(r||0)%360,r<0?r+360:r}function Ih(r){return Math.max(0,Math.min(1,r||0))}function rd(r,t,e){return(r<60?t+(e-t)*r/60:r<180?e:r<240?t+(e-t)*(240-r)/60:t)*255}const sd=r=>()=>r;function xI(r,t){return function(e){return r+e*t}}function _I(r,t,e){return r=Math.pow(r,e),t=Math.pow(t,e)-r,e=1/e,function(i){return Math.pow(r+i*t,e)}}function vI(r){return(r=+r)==1?yy:function(t,e){return e-t?_I(t,e,r):sd(isNaN(t)?e:t)}}function yy(r,t){var e=t-r;return e?xI(r,e):sd(isNaN(r)?t:r)}const by=function r(t){var e=vI(t);function i(s,n){var o=e((s=id(s)).r,(n=id(n)).r),a=e(s.g,n.g),h=e(s.b,n.b),l=yy(s.opacity,n.opacity);return function(c){return s.r=o(c),s.g=a(c),s.b=h(c),s.opacity=l(c),s+""}}return i.gamma=r,i}(1);function TI(r,t){t||(t=[]);var e=r?Math.min(t.length,r.length):0,i=t.slice(),s;return function(n){for(s=0;s<e;++s)i[s]=r[s]*(1-n)+t[s]*n;return i}}function wI(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function SI(r,t){var e=t?t.length:0,i=r?Math.min(e,r.length):0,s=new Array(i),n=new Array(e),o;for(o=0;o<i;++o)s[o]=ad(r[o],t[o]);for(;o<e;++o)n[o]=t[o];return function(a){for(o=0;o<i;++o)n[o]=s[o](a);return n}}function EI(r,t){var e=new Date;return r=+r,t=+t,function(i){return e.setTime(r*(1-i)+t*i),e}}function Ah(r,t){return r=+r,t=+t,function(e){return r*(1-e)+t*e}}function CI(r,t){var e={},i={},s;(r===null||typeof r!="object")&&(r={}),(t===null||typeof t!="object")&&(t={});for(s in t)s in r?e[s]=ad(r[s],t[s]):i[s]=t[s];return function(n){for(s in e)i[s]=e[s](n);return i}}var nd=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,od=new RegExp(nd.source,"g");function II(r){return function(){return r}}function AI(r){return function(t){return r(t)+""}}function RI(r,t){var e=nd.lastIndex=od.lastIndex=0,i,s,n,o=-1,a=[],h=[];for(r=r+"",t=t+"";(i=nd.exec(r))&&(s=od.exec(t));)(n=s.index)>e&&(n=t.slice(e,n),a[o]?a[o]+=n:a[++o]=n),(i=i[0])===(s=s[0])?a[o]?a[o]+=s:a[++o]=s:(a[++o]=null,h.push({i:o,x:Ah(i,s)})),e=od.lastIndex;return e<t.length&&(n=t.slice(e),a[o]?a[o]+=n:a[++o]=n),a.length<2?h[0]?AI(h[0].x):II(t):(t=h.length,function(l){for(var c=0,u;c<t;++c)a[(u=h[c]).i]=u.x(l);return a.join("")})}function ad(r,t){var e=typeof t,i;return t==null||e==="boolean"?sd(t):(e==="number"?Ah:e==="string"?(i=So(t))?(t=i,by):RI:t instanceof So?by:t instanceof Date?EI:wI(t)?TI:Array.isArray(t)?SI:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?CI:Ah)(r,t)}function MI(r,t){return r=+r,t=+t,function(e){return Math.round(r*(1-e)+t*e)}}function LI(r){return Math.abs(r=Math.round(r))>=1e21?r.toLocaleString("en").replace(/,/g,""):r.toString(10)}function Rh(r,t){if((e=(r=t?r.toExponential(t-1):r.toExponential()).indexOf("e"))<0)return null;var e,i=r.slice(0,e);return[i.length>1?i[0]+i.slice(2):i,+r.slice(e+1)]}function mn(r){return r=Rh(Math.abs(r)),r?r[1]:NaN}function PI(r,t){return function(e,i){for(var s=e.length,n=[],o=0,a=r[0],h=0;s>0&&a>0&&(h+a+1>i&&(a=Math.max(1,i-h)),n.push(e.substring(s-=a,s+a)),!((h+=a+1)>i));)a=r[o=(o+1)%r.length];return n.reverse().join(t)}}function GI(r){return function(t){return t.replace(/[0-9]/g,function(e){return r[+e]})}}var FI=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Mh(r){if(!(t=FI.exec(r)))throw new Error("invalid format: "+r);var t;return new hd({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Mh.prototype=hd.prototype;function hd(r){this.fill=r.fill===void 0?" ":r.fill+"",this.align=r.align===void 0?">":r.align+"",this.sign=r.sign===void 0?"-":r.sign+"",this.symbol=r.symbol===void 0?"":r.symbol+"",this.zero=!!r.zero,this.width=r.width===void 0?void 0:+r.width,this.comma=!!r.comma,this.precision=r.precision===void 0?void 0:+r.precision,this.trim=!!r.trim,this.type=r.type===void 0?"":r.type+""}hd.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function NI(r){t:for(var t=r.length,e=1,i=-1,s;e<t;++e)switch(r[e]){case".":i=s=e;break;case"0":i===0&&(i=e),s=e;break;default:if(!+r[e])break t;i>0&&(i=0);break}return i>0?r.slice(0,i)+r.slice(s+1):r}var xy;function DI(r,t){var e=Rh(r,t);if(!e)return r+"";var i=e[0],s=e[1],n=s-(xy=Math.max(-8,Math.min(8,Math.floor(s/3)))*3)+1,o=i.length;return n===o?i:n>o?i+new Array(n-o+1).join("0"):n>0?i.slice(0,n)+"."+i.slice(n):"0."+new Array(1-n).join("0")+Rh(r,Math.max(0,t+n-1))[0]}function _y(r,t){var e=Rh(r,t);if(!e)return r+"";var i=e[0],s=e[1];return s<0?"0."+new Array(-s).join("0")+i:i.length>s+1?i.slice(0,s+1)+"."+i.slice(s+1):i+new Array(s-i.length+2).join("0")}const vy={"%":(r,t)=>(r*100).toFixed(t),b:r=>Math.round(r).toString(2),c:r=>r+"",d:LI,e:(r,t)=>r.toExponential(t),f:(r,t)=>r.toFixed(t),g:(r,t)=>r.toPrecision(t),o:r=>Math.round(r).toString(8),p:(r,t)=>_y(r*100,t),r:_y,s:DI,X:r=>Math.round(r).toString(16).toUpperCase(),x:r=>Math.round(r).toString(16)};function Ty(r){return r}var wy=Array.prototype.map,Sy=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function kI(r){var t=r.grouping===void 0||r.thousands===void 0?Ty:PI(wy.call(r.grouping,Number),r.thousands+""),e=r.currency===void 0?"":r.currency[0]+"",i=r.currency===void 0?"":r.currency[1]+"",s=r.decimal===void 0?".":r.decimal+"",n=r.numerals===void 0?Ty:GI(wy.call(r.numerals,String)),o=r.percent===void 0?"%":r.percent+"",a=r.minus===void 0?"−":r.minus+"",h=r.nan===void 0?"NaN":r.nan+"";function l(u){u=Mh(u);var d=u.fill,f=u.align,m=u.sign,p=u.symbol,g=u.zero,y=u.width,_=u.comma,b=u.precision,v=u.trim,w=u.type;w==="n"?(_=!0,w="g"):vy[w]||(b===void 0&&(b=12),v=!0,w="g"),(g||d==="0"&&f==="=")&&(g=!0,d="0",f="=");var E=p==="$"?e:p==="#"&&/[boxX]/.test(w)?"0"+w.toLowerCase():"",C=p==="$"?i:/[%p]/.test(w)?o:"",A=vy[w],R=/[defgprs%]/.test(w);b=b===void 0?6:/[gprs]/.test(w)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b));function G(N){var P=E,I=C,D,X,H;if(w==="c")I=A(N)+I,N="";else{N=+N;var Z=N<0||1/N<0;if(N=isNaN(N)?h:A(Math.abs(N),b),v&&(N=NI(N)),Z&&+N==0&&m!=="+"&&(Z=!1),P=(Z?m==="("?m:a:m==="-"||m==="("?"":m)+P,I=(w==="s"?Sy[8+xy/3]:"")+I+(Z&&m==="("?")":""),R){for(D=-1,X=N.length;++D<X;)if(H=N.charCodeAt(D),48>H||H>57){I=(H===46?s+N.slice(D+1):N.slice(D))+I,N=N.slice(0,D);break}}}_&&!g&&(N=t(N,1/0));var j=P.length+N.length+I.length,O=j<y?new Array(y-j+1).join(d):"";switch(_&&g&&(N=t(O+N,O.length?y-I.length:1/0),O=""),f){case"<":N=P+N+I+O;break;case"=":N=P+O+N+I;break;case"^":N=O.slice(0,j=O.length>>1)+P+N+I+O.slice(j);break;default:N=O+P+N+I;break}return n(N)}return G.toString=function(){return u+""},G}function c(u,d){var f=l((u=Mh(u),u.type="f",u)),m=Math.max(-8,Math.min(8,Math.floor(mn(d)/3)))*3,p=Math.pow(10,-m),g=Sy[8+m/3];return function(y){return f(p*y)+g}}return{format:l,formatPrefix:c}}var Lh,Ey,Cy;OI({thousands:",",grouping:[3],currency:["$",""]});function OI(r){return Lh=kI(r),Ey=Lh.format,Cy=Lh.formatPrefix,Lh}function BI(r){return Math.max(0,-mn(Math.abs(r)))}function WI(r,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(mn(t)/3)))*3-mn(Math.abs(r)))}function UI(r,t){return r=Math.abs(r),t=Math.abs(t)-r,Math.max(0,mn(t)-mn(r))+1}function Iy(r,t){switch(arguments.length){case 0:break;case 1:this.range(r);break;default:this.range(t).domain(r);break}return this}function XI(r){return function(){return r}}function ZI(r){return+r}var Ay=[0,1];function gn(r){return r}function ld(r,t){return(t-=r=+r)?function(e){return(e-r)/t}:XI(isNaN(t)?NaN:.5)}function VI(r,t){var e;return r>t&&(e=r,r=t,t=e),function(i){return Math.max(r,Math.min(t,i))}}function HI(r,t,e){var i=r[0],s=r[1],n=t[0],o=t[1];return s<i?(i=ld(s,i),n=e(o,n)):(i=ld(i,s),n=e(n,o)),function(a){return n(i(a))}}function KI(r,t,e){var i=Math.min(r.length,t.length)-1,s=new Array(i),n=new Array(i),o=-1;for(r[i]<r[0]&&(r=r.slice().reverse(),t=t.slice().reverse());++o<i;)s[o]=ld(r[o],r[o+1]),n[o]=e(t[o],t[o+1]);return function(a){var h=iI(r,a,1,i)-1;return n[h](s[h](a))}}function Ry(r,t){return t.domain(r.domain()).range(r.range()).interpolate(r.interpolate()).clamp(r.clamp()).unknown(r.unknown())}function YI(){var r=Ay,t=Ay,e=ad,i,s,n,o=gn,a,h,l;function c(){var d=Math.min(r.length,t.length);return o!==gn&&(o=VI(r[0],r[d-1])),a=d>2?KI:HI,h=l=null,u}function u(d){return d==null||isNaN(d=+d)?n:(h||(h=a(r.map(i),t,e)))(i(o(d)))}return u.invert=function(d){return o(s((l||(l=a(t,r.map(i),Ah)))(d)))},u.domain=function(d){return arguments.length?(r=Array.from(d,ZI),c()):r.slice()},u.range=function(d){return arguments.length?(t=Array.from(d),c()):t.slice()},u.rangeRound=function(d){return t=Array.from(d),e=MI,c()},u.clamp=function(d){return arguments.length?(o=d?!0:gn,c()):o!==gn},u.interpolate=function(d){return arguments.length?(e=d,c()):e},u.unknown=function(d){return arguments.length?(n=d,u):n},function(d,f){return i=d,s=f,c()}}function My(){return YI()(gn,gn)}function zI(r,t,e,i){var s=td(r,t,e),n;switch(i=Mh(i??",f"),i.type){case"s":{var o=Math.max(Math.abs(r),Math.abs(t));return i.precision==null&&!isNaN(n=WI(s,o))&&(i.precision=n),Cy(i,o)}case"":case"e":case"g":case"p":case"r":{i.precision==null&&!isNaN(n=UI(s,Math.max(Math.abs(r),Math.abs(t))))&&(i.precision=n-(i.type==="e"));break}case"f":case"%":{i.precision==null&&!isNaN(n=BI(s))&&(i.precision=n-(i.type==="%")*2);break}}return Ey(i)}function jI(r){var t=r.domain;return r.ticks=function(e){var i=t();return oI(i[0],i[i.length-1],e??10)},r.tickFormat=function(e,i){var s=t();return zI(s[0],s[s.length-1],e??10,i)},r.nice=function(e){e==null&&(e=10);var i=t(),s=0,n=i.length-1,o=i[s],a=i[n],h,l,c=10;for(a<o&&(l=o,o=a,a=l,l=s,s=n,n=l);c-- >0;){if(l=qu(o,a,e),l===h)return i[s]=o,i[n]=a,t(i);if(l>0)o=Math.floor(o/l)*l,a=Math.ceil(a/l)*l;else if(l<0)o=Math.ceil(o*l)/l,a=Math.floor(a*l)/l;else break;h=l}return r},r}function Ly(){var r=My();return r.copy=function(){return Ry(r,Ly())},Iy.apply(r,arguments),jI(r)}function JI(r,t){r=r.slice();var e=0,i=r.length-1,s=r[e],n=r[i],o;return n<s&&(o=e,e=i,i=o,o=s,s=n,n=o),r[e]=t.floor(s),r[i]=t.ceil(n),r}const cd=new Date,ud=new Date;function te(r,t,e,i){function s(n){return r(n=arguments.length===0?new Date:new Date(+n)),n}return s.floor=n=>(r(n=new Date(+n)),n),s.ceil=n=>(r(n=new Date(n-1)),t(n,1),r(n),n),s.round=n=>{const o=s(n),a=s.ceil(n);return n-o<a-n?o:a},s.offset=(n,o)=>(t(n=new Date(+n),o==null?1:Math.floor(o)),n),s.range=(n,o,a)=>{const h=[];if(n=s.ceil(n),a=a==null?1:Math.floor(a),!(n<o)||!(a>0))return h;let l;do h.push(l=new Date(+n)),t(n,a),r(n);while(l<n&&n<o);return h},s.filter=n=>te(o=>{if(o>=o)for(;r(o),!n(o);)o.setTime(o-1)},(o,a)=>{if(o>=o)if(a<0)for(;++a<=0;)for(;t(o,-1),!n(o););else for(;--a>=0;)for(;t(o,1),!n(o););}),e&&(s.count=(n,o)=>(cd.setTime(+n),ud.setTime(+o),r(cd),r(ud),Math.floor(e(cd,ud))),s.every=n=>(n=Math.floor(n),!isFinite(n)||!(n>0)?null:n>1?s.filter(i?o=>i(o)%n===0:o=>s.count(0,o)%n===0):s)),s}const Ph=te(()=>{},(r,t)=>{r.setTime(+r+t)},(r,t)=>t-r);Ph.every=r=>(r=Math.floor(r),!isFinite(r)||!(r>0)?null:r>1?te(t=>{t.setTime(Math.floor(t/r)*r)},(t,e)=>{t.setTime(+t+e*r)},(t,e)=>(e-t)/r):Ph),Ph.range;const ar=1e3,ti=ar*60,hr=ti*60,lr=hr*24,dd=lr*7,Py=lr*30,fd=lr*365,yn=te(r=>{r.setTime(r-r.getMilliseconds())},(r,t)=>{r.setTime(+r+t*ar)},(r,t)=>(t-r)/ar,r=>r.getUTCSeconds());yn.range;const pd=te(r=>{r.setTime(r-r.getMilliseconds()-r.getSeconds()*ar)},(r,t)=>{r.setTime(+r+t*ti)},(r,t)=>(t-r)/ti,r=>r.getMinutes());pd.range,te(r=>{r.setUTCSeconds(0,0)},(r,t)=>{r.setTime(+r+t*ti)},(r,t)=>(t-r)/ti,r=>r.getUTCMinutes()).range;const md=te(r=>{r.setTime(r-r.getMilliseconds()-r.getSeconds()*ar-r.getMinutes()*ti)},(r,t)=>{r.setTime(+r+t*hr)},(r,t)=>(t-r)/hr,r=>r.getHours());md.range,te(r=>{r.setUTCMinutes(0,0,0)},(r,t)=>{r.setTime(+r+t*hr)},(r,t)=>(t-r)/hr,r=>r.getUTCHours()).range;const Eo=te(r=>r.setHours(0,0,0,0),(r,t)=>r.setDate(r.getDate()+t),(r,t)=>(t-r-(t.getTimezoneOffset()-r.getTimezoneOffset())*ti)/lr,r=>r.getDate()-1);Eo.range;const gd=te(r=>{r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCDate(r.getUTCDate()+t)},(r,t)=>(t-r)/lr,r=>r.getUTCDate()-1);gd.range,te(r=>{r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCDate(r.getUTCDate()+t)},(r,t)=>(t-r)/lr,r=>Math.floor(r/lr)).range;function ws(r){return te(t=>{t.setDate(t.getDate()-(t.getDay()+7-r)%7),t.setHours(0,0,0,0)},(t,e)=>{t.setDate(t.getDate()+e*7)},(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*ti)/dd)}const Gh=ws(0),Fh=ws(1),$I=ws(2),QI=ws(3),bn=ws(4),qI=ws(5),t2=ws(6);Gh.range,Fh.range,$I.range,QI.range,bn.range,qI.range,t2.range;function Ss(r){return te(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-r)%7),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e*7)},(t,e)=>(e-t)/dd)}const Gy=Ss(0),Nh=Ss(1),e2=Ss(2),i2=Ss(3),xn=Ss(4),r2=Ss(5),s2=Ss(6);Gy.range,Nh.range,e2.range,i2.range,xn.range,r2.range,s2.range;const yd=te(r=>{r.setDate(1),r.setHours(0,0,0,0)},(r,t)=>{r.setMonth(r.getMonth()+t)},(r,t)=>t.getMonth()-r.getMonth()+(t.getFullYear()-r.getFullYear())*12,r=>r.getMonth());yd.range,te(r=>{r.setUTCDate(1),r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCMonth(r.getUTCMonth()+t)},(r,t)=>t.getUTCMonth()-r.getUTCMonth()+(t.getUTCFullYear()-r.getUTCFullYear())*12,r=>r.getUTCMonth()).range;const cr=te(r=>{r.setMonth(0,1),r.setHours(0,0,0,0)},(r,t)=>{r.setFullYear(r.getFullYear()+t)},(r,t)=>t.getFullYear()-r.getFullYear(),r=>r.getFullYear());cr.every=r=>!isFinite(r=Math.floor(r))||!(r>0)?null:te(t=>{t.setFullYear(Math.floor(t.getFullYear()/r)*r),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e*r)}),cr.range;const Es=te(r=>{r.setUTCMonth(0,1),r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCFullYear(r.getUTCFullYear()+t)},(r,t)=>t.getUTCFullYear()-r.getUTCFullYear(),r=>r.getUTCFullYear());Es.every=r=>!isFinite(r=Math.floor(r))||!(r>0)?null:te(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/r)*r),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e*r)}),Es.range;function n2(r,t,e,i,s,n){const o=[[yn,1,ar],[yn,5,5*ar],[yn,15,15*ar],[yn,30,30*ar],[n,1,ti],[n,5,5*ti],[n,15,15*ti],[n,30,30*ti],[s,1,hr],[s,3,3*hr],[s,6,6*hr],[s,12,12*hr],[i,1,lr],[i,2,2*lr],[e,1,dd],[t,1,Py],[t,3,3*Py],[r,1,fd]];function a(l,c,u){const d=c<l;d&&([l,c]=[c,l]);const f=u&&typeof u.range=="function"?u:h(l,c,u),m=f?f.range(l,+c+1):[];return d?m.reverse():m}function h(l,c,u){const d=Math.abs(c-l)/u,f=Qu(([,,g])=>g).right(o,d);if(f===o.length)return r.every(td(l/fd,c/fd,u));if(f===0)return Ph.every(Math.max(td(l,c,u),1));const[m,p]=o[d/o[f-1][2]<o[f][2]/d?f-1:f];return m.every(p)}return[a,h]}const[o2,a2]=n2(cr,yd,Gh,Eo,md,pd);function bd(r){if(0<=r.y&&r.y<100){var t=new Date(-1,r.m,r.d,r.H,r.M,r.S,r.L);return t.setFullYear(r.y),t}return new Date(r.y,r.m,r.d,r.H,r.M,r.S,r.L)}function xd(r){if(0<=r.y&&r.y<100){var t=new Date(Date.UTC(-1,r.m,r.d,r.H,r.M,r.S,r.L));return t.setUTCFullYear(r.y),t}return new Date(Date.UTC(r.y,r.m,r.d,r.H,r.M,r.S,r.L))}function Co(r,t,e){return{y:r,m:t,d:e,H:0,M:0,S:0,L:0}}function h2(r){var t=r.dateTime,e=r.date,i=r.time,s=r.periods,n=r.days,o=r.shortDays,a=r.months,h=r.shortMonths,l=Io(s),c=Ao(s),u=Io(n),d=Ao(n),f=Io(o),m=Ao(o),p=Io(a),g=Ao(a),y=Io(h),_=Ao(h),b={a:Z,A:j,b:O,B:k,c:null,d:By,e:By,f:L2,g:U2,G:Z2,H:A2,I:R2,j:M2,L:Wy,m:P2,M:G2,p:F,q:V,Q:Ky,s:Yy,S:F2,u:N2,U:D2,V:k2,w:O2,W:B2,x:null,X:null,y:W2,Y:X2,Z:V2,"%":Hy},v={a:$,A:dt,b:ot,B:Ct,c:null,d:Xy,e:Xy,f:z2,g:sA,G:oA,H:H2,I:K2,j:Y2,L:Zy,m:j2,M:J2,p:Mt,q:_t,Q:Ky,s:Yy,S:$2,u:Q2,U:q2,V:tA,w:eA,W:iA,x:null,X:null,y:rA,Y:nA,Z:aA,"%":Hy},w={a:G,A:N,b:P,B:I,c:D,d:ky,e:ky,f:S2,g:Dy,G:Ny,H:Oy,I:Oy,j:_2,L:w2,m:x2,M:v2,p:R,q:b2,Q:C2,s:I2,S:T2,u:f2,U:p2,V:m2,w:d2,W:g2,x:X,X:H,y:Dy,Y:Ny,Z:y2,"%":E2};b.x=E(e,b),b.X=E(i,b),b.c=E(t,b),v.x=E(e,v),v.X=E(i,v),v.c=E(t,v);function E(Y,tt){return function(et){var B=[],xt=-1,yt=0,Lt=Y.length,Vt,Xe,pi;for(et instanceof Date||(et=new Date(+et));++xt<Lt;)Y.charCodeAt(xt)===37&&(B.push(Y.slice(yt,xt)),(Xe=Fy[Vt=Y.charAt(++xt)])!=null?Vt=Y.charAt(++xt):Xe=Vt==="e"?" ":"0",(pi=tt[Vt])&&(Vt=pi(et,Xe)),B.push(Vt),yt=xt+1);return B.push(Y.slice(yt,xt)),B.join("")}}function C(Y,tt){return function(et){var B=Co(1900,void 0,1),xt=A(B,Y,et+="",0),yt,Lt;if(xt!=et.length)return null;if("Q"in B)return new Date(B.Q);if("s"in B)return new Date(B.s*1e3+("L"in B?B.L:0));if(tt&&!("Z"in B)&&(B.Z=0),"p"in B&&(B.H=B.H%12+B.p*12),B.m===void 0&&(B.m="q"in B?B.q:0),"V"in B){if(B.V<1||B.V>53)return null;"w"in B||(B.w=1),"Z"in B?(yt=xd(Co(B.y,0,1)),Lt=yt.getUTCDay(),yt=Lt>4||Lt===0?Nh.ceil(yt):Nh(yt),yt=gd.offset(yt,(B.V-1)*7),B.y=yt.getUTCFullYear(),B.m=yt.getUTCMonth(),B.d=yt.getUTCDate()+(B.w+6)%7):(yt=bd(Co(B.y,0,1)),Lt=yt.getDay(),yt=Lt>4||Lt===0?Fh.ceil(yt):Fh(yt),yt=Eo.offset(yt,(B.V-1)*7),B.y=yt.getFullYear(),B.m=yt.getMonth(),B.d=yt.getDate()+(B.w+6)%7)}else("W"in B||"U"in B)&&("w"in B||(B.w="u"in B?B.u%7:"W"in B?1:0),Lt="Z"in B?xd(Co(B.y,0,1)).getUTCDay():bd(Co(B.y,0,1)).getDay(),B.m=0,B.d="W"in B?(B.w+6)%7+B.W*7-(Lt+5)%7:B.w+B.U*7-(Lt+6)%7);return"Z"in B?(B.H+=B.Z/100|0,B.M+=B.Z%100,xd(B)):bd(B)}}function A(Y,tt,et,B){for(var xt=0,yt=tt.length,Lt=et.length,Vt,Xe;xt<yt;){if(B>=Lt)return-1;if(Vt=tt.charCodeAt(xt++),Vt===37){if(Vt=tt.charAt(xt++),Xe=w[Vt in Fy?tt.charAt(xt++):Vt],!Xe||(B=Xe(Y,et,B))<0)return-1}else if(Vt!=et.charCodeAt(B++))return-1}return B}function R(Y,tt,et){var B=l.exec(tt.slice(et));return B?(Y.p=c.get(B[0].toLowerCase()),et+B[0].length):-1}function G(Y,tt,et){var B=f.exec(tt.slice(et));return B?(Y.w=m.get(B[0].toLowerCase()),et+B[0].length):-1}function N(Y,tt,et){var B=u.exec(tt.slice(et));return B?(Y.w=d.get(B[0].toLowerCase()),et+B[0].length):-1}function P(Y,tt,et){var B=y.exec(tt.slice(et));return B?(Y.m=_.get(B[0].toLowerCase()),et+B[0].length):-1}function I(Y,tt,et){var B=p.exec(tt.slice(et));return B?(Y.m=g.get(B[0].toLowerCase()),et+B[0].length):-1}function D(Y,tt,et){return A(Y,t,tt,et)}function X(Y,tt,et){return A(Y,e,tt,et)}function H(Y,tt,et){return A(Y,i,tt,et)}function Z(Y){return o[Y.getDay()]}function j(Y){return n[Y.getDay()]}function O(Y){return h[Y.getMonth()]}function k(Y){return a[Y.getMonth()]}function F(Y){return s[+(Y.getHours()>=12)]}function V(Y){return 1+~~(Y.getMonth()/3)}function $(Y){return o[Y.getUTCDay()]}function dt(Y){return n[Y.getUTCDay()]}function ot(Y){return h[Y.getUTCMonth()]}function Ct(Y){return a[Y.getUTCMonth()]}function Mt(Y){return s[+(Y.getUTCHours()>=12)]}function _t(Y){return 1+~~(Y.getUTCMonth()/3)}return{format:function(Y){var tt=E(Y+="",b);return tt.toString=function(){return Y},tt},parse:function(Y){var tt=C(Y+="",!1);return tt.toString=function(){return Y},tt},utcFormat:function(Y){var tt=E(Y+="",v);return tt.toString=function(){return Y},tt},utcParse:function(Y){var tt=C(Y+="",!0);return tt.toString=function(){return Y},tt}}}var Fy={"-":"",_:" ",0:"0"},ae=/^\s*\d+/,l2=/^%/,c2=/[\\^$*+?|[\]().{}]/g;function It(r,t,e){var i=r<0?"-":"",s=(i?-r:r)+"",n=s.length;return i+(n<e?new Array(e-n+1).join(t)+s:s)}function u2(r){return r.replace(c2,"\\$&")}function Io(r){return new RegExp("^(?:"+r.map(u2).join("|")+")","i")}function Ao(r){return new Map(r.map((t,e)=>[t.toLowerCase(),e]))}function d2(r,t,e){var i=ae.exec(t.slice(e,e+1));return i?(r.w=+i[0],e+i[0].length):-1}function f2(r,t,e){var i=ae.exec(t.slice(e,e+1));return i?(r.u=+i[0],e+i[0].length):-1}function p2(r,t,e){var i=ae.exec(t.slice(e,e+2));return i?(r.U=+i[0],e+i[0].length):-1}function m2(r,t,e){var i=ae.exec(t.slice(e,e+2));return i?(r.V=+i[0],e+i[0].length):-1}function g2(r,t,e){var i=ae.exec(t.slice(e,e+2));return i?(r.W=+i[0],e+i[0].length):-1}function Ny(r,t,e){var i=ae.exec(t.slice(e,e+4));return i?(r.y=+i[0],e+i[0].length):-1}function Dy(r,t,e){var i=ae.exec(t.slice(e,e+2));return i?(r.y=+i[0]+(+i[0]>68?1900:2e3),e+i[0].length):-1}function y2(r,t,e){var i=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(e,e+6));return i?(r.Z=i[1]?0:-(i[2]+(i[3]||"00")),e+i[0].length):-1}function b2(r,t,e){var i=ae.exec(t.slice(e,e+1));return i?(r.q=i[0]*3-3,e+i[0].length):-1}function x2(r,t,e){var i=ae.exec(t.slice(e,e+2));return i?(r.m=i[0]-1,e+i[0].length):-1}function ky(r,t,e){var i=ae.exec(t.slice(e,e+2));return i?(r.d=+i[0],e+i[0].length):-1}function _2(r,t,e){var i=ae.exec(t.slice(e,e+3));return i?(r.m=0,r.d=+i[0],e+i[0].length):-1}function Oy(r,t,e){var i=ae.exec(t.slice(e,e+2));return i?(r.H=+i[0],e+i[0].length):-1}function v2(r,t,e){var i=ae.exec(t.slice(e,e+2));return i?(r.M=+i[0],e+i[0].length):-1}function T2(r,t,e){var i=ae.exec(t.slice(e,e+2));return i?(r.S=+i[0],e+i[0].length):-1}function w2(r,t,e){var i=ae.exec(t.slice(e,e+3));return i?(r.L=+i[0],e+i[0].length):-1}function S2(r,t,e){var i=ae.exec(t.slice(e,e+6));return i?(r.L=Math.floor(i[0]/1e3),e+i[0].length):-1}function E2(r,t,e){var i=l2.exec(t.slice(e,e+1));return i?e+i[0].length:-1}function C2(r,t,e){var i=ae.exec(t.slice(e));return i?(r.Q=+i[0],e+i[0].length):-1}function I2(r,t,e){var i=ae.exec(t.slice(e));return i?(r.s=+i[0],e+i[0].length):-1}function By(r,t){return It(r.getDate(),t,2)}function A2(r,t){return It(r.getHours(),t,2)}function R2(r,t){return It(r.getHours()%12||12,t,2)}function M2(r,t){return It(1+Eo.count(cr(r),r),t,3)}function Wy(r,t){return It(r.getMilliseconds(),t,3)}function L2(r,t){return Wy(r,t)+"000"}function P2(r,t){return It(r.getMonth()+1,t,2)}function G2(r,t){return It(r.getMinutes(),t,2)}function F2(r,t){return It(r.getSeconds(),t,2)}function N2(r){var t=r.getDay();return t===0?7:t}function D2(r,t){return It(Gh.count(cr(r)-1,r),t,2)}function Uy(r){var t=r.getDay();return t>=4||t===0?bn(r):bn.ceil(r)}function k2(r,t){return r=Uy(r),It(bn.count(cr(r),r)+(cr(r).getDay()===4),t,2)}function O2(r){return r.getDay()}function B2(r,t){return It(Fh.count(cr(r)-1,r),t,2)}function W2(r,t){return It(r.getFullYear()%100,t,2)}function U2(r,t){return r=Uy(r),It(r.getFullYear()%100,t,2)}function X2(r,t){return It(r.getFullYear()%1e4,t,4)}function Z2(r,t){var e=r.getDay();return r=e>=4||e===0?bn(r):bn.ceil(r),It(r.getFullYear()%1e4,t,4)}function V2(r){var t=r.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+It(t/60|0,"0",2)+It(t%60,"0",2)}function Xy(r,t){return It(r.getUTCDate(),t,2)}function H2(r,t){return It(r.getUTCHours(),t,2)}function K2(r,t){return It(r.getUTCHours()%12||12,t,2)}function Y2(r,t){return It(1+gd.count(Es(r),r),t,3)}function Zy(r,t){return It(r.getUTCMilliseconds(),t,3)}function z2(r,t){return Zy(r,t)+"000"}function j2(r,t){return It(r.getUTCMonth()+1,t,2)}function J2(r,t){return It(r.getUTCMinutes(),t,2)}function $2(r,t){return It(r.getUTCSeconds(),t,2)}function Q2(r){var t=r.getUTCDay();return t===0?7:t}function q2(r,t){return It(Gy.count(Es(r)-1,r),t,2)}function Vy(r){var t=r.getUTCDay();return t>=4||t===0?xn(r):xn.ceil(r)}function tA(r,t){return r=Vy(r),It(xn.count(Es(r),r)+(Es(r).getUTCDay()===4),t,2)}function eA(r){return r.getUTCDay()}function iA(r,t){return It(Nh.count(Es(r)-1,r),t,2)}function rA(r,t){return It(r.getUTCFullYear()%100,t,2)}function sA(r,t){return r=Vy(r),It(r.getUTCFullYear()%100,t,2)}function nA(r,t){return It(r.getUTCFullYear()%1e4,t,4)}function oA(r,t){var e=r.getUTCDay();return r=e>=4||e===0?xn(r):xn.ceil(r),It(r.getUTCFullYear()%1e4,t,4)}function aA(){return"+0000"}function Hy(){return"%"}function Ky(r){return+r}function Yy(r){return Math.floor(+r/1e3)}var _n,zy;hA({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function hA(r){return _n=h2(r),zy=_n.format,_n.parse,_n.utcFormat,_n.utcParse,_n}function lA(r){return new Date(r)}function cA(r){return r instanceof Date?+r:+new Date(+r)}function jy(r,t,e,i,s,n,o,a,h,l){var c=My(),u=c.invert,d=c.domain,f=l(".%L"),m=l(":%S"),p=l("%I:%M"),g=l("%I %p"),y=l("%a %d"),_=l("%b %d"),b=l("%B"),v=l("%Y");function w(E){return(h(E)<E?f:a(E)<E?m:o(E)<E?p:n(E)<E?g:i(E)<E?s(E)<E?y:_:e(E)<E?b:v)(E)}return c.invert=function(E){return new Date(u(E))},c.domain=function(E){return arguments.length?d(Array.from(E,cA)):d().map(lA)},c.ticks=function(E){var C=d();return r(C[0],C[C.length-1],E??10)},c.tickFormat=function(E,C){return C==null?w:l(C)},c.nice=function(E){var C=d();return(!E||typeof E.range!="function")&&(E=t(C[0],C[C.length-1],E??10)),E?d(JI(C,E)):c},c.copy=function(){return Ry(c,jy(r,t,e,i,s,n,o,a,h,l))},c}function uA(){return Iy.apply(jy(o2,a2,cr,yd,Gh,Eo,md,pd,yn,zy).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function Ro(r,t,e){this.k=r,this.x=t,this.y=e}Ro.prototype={constructor:Ro,scale:function(r){return r===1?this:new Ro(this.k*r,this.x,this.y)},translate:function(r,t){return r===0&t===0?this:new Ro(this.k,this.x+this.k*r,this.y+this.k*t)},apply:function(r){return[r[0]*this.k+this.x,r[1]*this.k+this.y]},applyX:function(r){return r*this.k+this.x},applyY:function(r){return r*this.k+this.y},invert:function(r){return[(r[0]-this.x)/this.k,(r[1]-this.y)/this.k]},invertX:function(r){return(r-this.x)/this.k},invertY:function(r){return(r-this.y)/this.k},rescaleX:function(r){return r.copy().domain(r.range().map(this.invertX,this).map(r.invert,r))},rescaleY:function(r){return r.copy().domain(r.range().map(this.invertY,this).map(r.invert,r))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}},Ro.prototype;function Jy(r){return r.mode==="temporal"||r.mode==="left-aligned"?dA(r):fA(r)}function dA({domain:r,range:t}){return uA().domain(r).range(t)}function fA({domain:r,range:t}){return Ly().domain(r).range(t)}function _d(r){return{mode:ct.horizontal,range:qR(),domain:tM(r)}}function pA(){return{mode:ct.vertical}}let vn=null;async function mA(){const r=await Go();$y(r.start_time),st.on("layoutSettingsUpdated",()=>$y(r.start_time))}function gA(){vn=null}async function Cs(){return vn||await Fe("scaleCreated")}async function $y(r){await Ue();const t=vn?"scaleUpdated":"scaleCreated",e=_d(r);vn=Jy(e),st.emit(t,vn)}let Le=null,vd=null;async function yA(){const r=await fe(),t=await cu();Le=new $C({screenHeight:t.clientHeight,screenWidth:t.clientWidth,events:r.renderer.events,passiveWheel:!1}),Le.zIndex=1,Le.drag().pinch().wheel({trackpadPinch:!0}).decelerate({friction:.9}).clampZoom({minWidth:t.clientWidth/2}),Le.on("moved",()=>{st.emit("viewportMoved",null)}).on("moved-end",()=>{st.emit("viewportMoved",null)}),r.stage.addChild(Le),st.emit("viewportCreated",Le),st.on("applicationResized",TA),st.on("scaleUpdated",()=>Dh()),_A()}function bA(){Le=null,vd=null}async function Td({animate:r}={}){const t=await we(),e=await Yt(),i=t.getChildByName(Ef);if(!i)throw new Error("Nodes container not found");const s=e.styles.guideTextSize+e.styles.guideTextTopPadding;EA();const{x:n,y:o,width:a,height:h}=i.getLocalBounds(),l=a+e.styles.columnGap*2,c=h+e.styles.rowGap*2+s*2,u=t.findFit(l,c);!a||!h||t.animate({position:{x:n+a/2,y:o+h/2-s},scale:Math.min(u,1),time:r?e.animationDuration:0,ease:"easeInOutQuad",removeOnInterrupt:!0,callbackOnComplete:()=>{wd(),Dh()}})}async function we(){return Le||await Fe("viewportCreated")}function Qy(r){sy(vd,r)||(vd=r,st.emit("viewportDateRangeUpdated",r))}function xA({xOffset:r,yOffset:t}){if(!Le)return;const{x:e,y:i}=Le.transform.position;Le.setTransform(e+r,i+t,Le.transform.scale.x,Le.transform.scale.y)}async function _A(){const r=await we();Dh(),r.on("moved",()=>Dh())}async function Dh(){const r=await qy();r&&Qy(r)}async function qy(){const r=await we(),t=await Cs(),e=t.invert(r.left),i=t.invert(r.right);return e instanceof Date&&i instanceof Date?[e,i]:null}async function vA(r){const t=await qy(),e=await Ue();if(r===void 0||e.isDependency()||sy(r,t))return;const i=await we(),s=await Cs(),[n,o]=r,a=s(n),h=s(o),l=a+(h-a)/2;Qy(r),i.fitWidth(h-a,!0),i.moveCenter(l,i.center.y)}async function TA(){const r=await fe(),t=await we(),e=await cu(),i=t.screenWidth,s=t.screenHeight,n=e.clientWidth,o=e.clientHeight,a=(n-i)/2,h=(o-s)/2;t.resize(r.screen.width,r.screen.height),xA({xOffset:a,yOffset:h})}class kh{constructor(){yf(this,"status","visible");yf(this,"labels",new Set)}get visible(){return this.status==="visible"}get hidden(){return this.status==="hidden"}show(){if(this.status!=="visible"){for(const t of this.labels)t.visible=!0;this.status="visible"}}hide(){if(this.status!=="hidden"){for(const t of this.labels)t.visible=!1;this.status="hidden"}}toggle(t){t?this.show():this.hide()}add(t){this.labels.add(t),t.visible=this.visible}clear(){this.labels.clear()}}let Oi=null,ei=null,Bi=null,ur=null,fi=null;async function wA(){const r=await we(),t=await fe();Oi=new xC({toggle:"renderable"}),ei=new kh,Bi=new kh,fi=new kh,ur=new kh,t.ticker.add(()=>{if(r.dirty){const e=r.scale.x>.1,i=r.scale.x>.2,s=r.scale.x>.2,n=r.scale.x>.2;fi==null||fi.toggle(e),ei==null||ei.toggle(i),Bi==null||Bi.toggle(s),ur==null||ur.toggle(n),Oi==null||Oi.cull(t.renderer.screen),r.dirty=!1}}),st.emit("cullCreated",Oi),st.emit("labelCullCreated",ei),st.emit("iconCullCreated",ei),st.emit("edgeCullCreated",fi),st.emit("toggleCullCreated",ur)}function SA(){Oi=null,ei==null||ei.clear(),ei=null,Bi==null||Bi.clear(),Bi=null,fi==null||fi.clear(),fi=null,ur==null||ur.clear(),ur=null}async function wd(){const r=await we();r.dirty=!0}function EA(){Oi&&Oi.uncull()}async function tb(){return Oi||await Fe("cullCreated")}async function CA(){return fi||await Fe("edgeCullCreated")}async function eb(){return ei||await Fe("labelCullCreated")}async function IA(){return Bi||await Fe("iconCullCreated")}async function ib(){const r=await Ue(),t=await Yt();function e(i,s,n){const a=r.disableAnimations||n?0:t.animationDuration/1e3;return ry.to(i,{...s,duration:a,ease:"power1.out",onUpdate:()=>{wd()}})}return{animate:e}}let Oh=new Map;function AA(){Oh=new Map}async function Bh(r,t){const e=`${r.toString()}-${JSON.stringify(t)}`;if(Oh.has(e))return Oh.get(e);const i=await r(...t);return Oh.set(e,i),i}async function RA({size:r,stroke:t=1,radius:e=0}){const i=await fe(),s=new so;return s.lineStyle(t,"#fff",1,0),s.drawRoundedRect(0,0,r*2,r*2,e),i.renderer.generateTexture(s,{region:new pt(0,0,r,r),resolution:10})}async function rb(r){return await Bh(RA,[r])}var Wh=(r=>(r[r.Up=0]="Up",r[r.Down=180]="Down",r[r.Left=270]="Left",r[r.Right=90]="Right",r))(Wh||{});function sb(){const r=new qt;async function t(e){const{rotate:i=0}=e,s={size:e.size,radius:e.radius,stroke:e.stroke},n=await rb(s);return r.texture=n,r.anchor.set(.5,.5),r.angle=45+i,r}return{element:r,render:t}}async function MA(){const r=await fe(),t=new so;return t.beginFill("#fff"),t.drawRect(0,0,1,1),t.endFill(),r.renderer.generateTexture(t,{wrapMode:_i.REPEAT})}async function Sd(){return await Bh(MA,[])}function Ed(r,t){return Array.from({length:r},(e,i)=>t(i))}const LA=8,PA=2;async function GA(){const r=await Yt(),t=await tb(),e=await CA(),{animate:i}=await ib(),s=new At,{element:n,render:o}=await sb(),a=await Sd(),h=Ed(20,()=>new ut),l=new dS(a,h);let c=!1;s.name=Bb,s.addChild(n),s.addChild(l),t.addAll([n,l]),e.add(s);async function u(){return await o({size:10,rotate:Wh.Right}),n.tint=r.styles.edgeColor,l.tint=r.styles.edgeColor,s}async function d(m,p){const g=f(p);c||await u();for(const[y,_]of h.entries()){const{x:b,y:v}=g[y];i(_,{x:b,y:v},!c)}i(s,{x:m.x,y:m.y},!c),i(n,{x:p.x-LA,y:p.y},!c),c=!0}function f({x:m,y:p}){const g=[],y={x:0,y:0},_={x:m-PA,y:p},b={x:nb(y.x,{source:y,target:_}),y:y.y},v={x:nb(_.x,{source:y,target:_},!0),y:_.y};for(const[w]of h.entries()){if(w===h.length-1){g[w]=_;continue}const E=FA(w,{source:y,target:_,sourceBezier:b,targetBezier:v});g[w]=E}return g}return{element:s,render:u,setPosition:d}}function nb(r,{source:t,target:e},i){const s=(e.x-t.x)/2;return r+(s>64?s:64)*(i?-1:1)}function FA(r,t){const e=r/20,{source:i,target:s,sourceBezier:n,targetBezier:o}=t,a=i.x+(n.x-i.x)*e,h=i.y+(n.y-i.y)*e,l=n.x+(o.x-n.x)*e,c=n.y+(o.y-n.y)*e,u=o.x+(s.x-o.x)*e,d=o.y+(s.y-o.y)*e,f=a+(l-a)*e,m=h+(c-h)*e,p=l+(u-l)*e,g=c+(d-c)*e,y=f+(p-f)*e,_=m+(g-m)*e;return{x:y,y:_}}async function NA({height:r,radius:t}){const e=await fe(),i=new so;return i.beginFill("#fff"),i.drawRoundedRect(0,0,t*2,r,t),i.endFill(),e.renderer.generateTexture(i,{region:new pt(0,0,t,r),resolution:10})}async function DA(r){return await Bh(NA,[r])}function kA(){const r=new qt,t=new qt;async function e(i){const s=await DA(i);return r.texture=s,t.texture=s,t.anchor.x=1,t.scale.x=-1,{left:r,right:t}}return{left:r,right:t,render:e}}async function Mo(){const r=await Sd();return new qt(r)}async function Cd(){const r=new At,t=await Mo(),{left:e,right:i,render:s}=await kA();r.addChild(t),r.addChild(e),r.addChild(i);async function n(h){const{width:l,x:c,visible:u}=a(h);return await s({height:h.height,radius:h.radius}),t.visible=u,t.width=l,t.height=h.height,t.x=c,e.visible=o(h.capLeft,h.radius),i.visible=o(h.capRight,h.radius),i.x=h.radius+l,t.tint=h.background,e.tint=h.background,i.tint=h.background,r}function o(h,l){return l===0?!1:h??!0}function a(h){const l=o(h.capLeft,h.radius),c=o(h.capRight,h.radius);let u=0;l&&(u+=h.radius),c&&(u+=h.radius);const d=Math.max(h.width-u,0),f=d>0,m=l?h.radius:0;return{width:d,visible:f,x:m}}return{element:r,render:n}}function Id(){const r=new At,t=new qt,e=new qt,i=new qt,s=new qt,n=new qt,o=new qt,a=new qt,h=new qt;t.name="border-corner-top-left",e.name="border-corner-top-right",i.name="border-corner-bottom-left",s.name="border-corner-bottom-right",n.name="border-corner-left",o.name="border-corner-right",a.name="border-corner-top",h.name="border-corner-bottom",e.anchor.x=1,e.scale.x=-1,i.anchor.y=1,i.scale.y=-1,s.anchor.x=1,s.scale.x=-1,s.anchor.y=1,s.scale.y=-1,r.addChild(t),r.addChild(e),r.addChild(i),r.addChild(s),r.addChild(n),r.addChild(o),r.addChild(a),r.addChild(h);async function l(f){const{radius:m=0,color:p="#fff",stroke:g,width:y,height:_}=f,b=Math.min(y,_),v=m*2>b?b/2:m,E=await rb({size:v,radius:m,stroke:g}),C=await Sd();return c({texture:E,width:y,height:_,size:v}),u({texture:C,width:y,height:_,size:v,stroke:g}),d(p),r}function c({texture:f,width:m,height:p,size:g}){t.texture=f,e.texture=f,i.texture=f,s.texture=f,t.position.set(0,0),e.position.set(m-g,0),i.position.set(0,p-g),s.position.set(m-g,p-g)}function u({texture:f,size:m,width:p,height:g,stroke:y}){const _=Math.max(g-m*2,0),b=Math.max(p-m*2,0);a.texture=f,n.texture=f,o.texture=f,h.texture=f,n.position.set(0,m),n.height=_,n.width=y,o.position.set(p-y,m),o.height=_,o.width=y,a.position.set(m,0),a.width=b,a.height=y,h.position.set(m,g-y),h.width=b,h.height=y}function d(f){t.tint=f,e.tint=f,i.tint=f,s.tint=f,a.tint=f,n.tint=f,o.tint=f,h.tint=f}return{element:r,render:l}}async function ob(){const r=await Yt(),t=new At,{element:e,render:i}=await Id();async function s({selected:n,width:o,height:a}){if(!n)return t.removeChild(e),t;const{selectedBorderColor:h,selectedBorderWidth:l,selectedBorderOffset:c,selectedBorderRadius:u}=r.styles;return e.position.set(-c,-c),t.addChild(e),await i({stroke:l,radius:u,width:o+c*2,height:a+c*2,color:h}),t}return{element:t,render:s}}async function OA(){const r=await Yt(),t=new At,{element:e,render:i}=await Cd(),{element:s,render:n}=await ob();t.addChild(e),t.addChild(s);async function o({selected:a,width:h,height:l}){const{artifactBgColor:c,artifactBorderRadius:u}=r.styles,d={width:h,height:l,background:c,radius:u,capLeft:!0,capRight:!0};return await Promise.all([i(d),n({selected:a,width:h,height:l})]),t}return{element:t,render:o}}const BA=Object.freeze(Object.defineProperty({__proto__:null,Artifact:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.5%203.875C7.5%203.11561%208.11561%202.5%208.875%202.5H16.125C16.8844%202.5%2017.5%203.11561%2017.5%203.875V16.125C17.5%2016.8844%2016.8844%2017.5%2016.125%2017.5H8.875C8.11561%2017.5%207.5%2016.8844%207.5%2016.125V10.9375H6.66449C6.31341%2011.6765%205.56012%2012.1875%204.6875%2012.1875C3.47938%2012.1875%202.5%2011.2081%202.5%2010C2.5%208.79188%203.47938%207.8125%204.6875%207.8125C5.56012%207.8125%206.31341%208.32345%206.66449%209.0625H7.5V3.875ZM15.7984%207.99134L12.7215%2012.9913C12.5599%2013.2539%2012.2797%2013.4202%2011.9718%2013.4362C11.664%2013.4523%2011.3679%2013.3159%2011.18%2013.0716L9.25692%2010.5716L10.7431%209.4284L11.8372%2010.8508L14.2016%207.00866L15.7984%207.99134Z'%20fill='white'/%3e%3c/svg%3e",ArtifactMarkdown:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.5%203.875C7.5%203.11561%208.11561%202.5%208.875%202.5H16.125C16.8844%202.5%2017.5%203.11561%2017.5%203.875V16.125C17.5%2016.8844%2016.8844%2017.5%2016.125%2017.5H8.875C8.11561%2017.5%207.5%2016.8844%207.5%2016.125V10.9375H6.66449C6.31341%2011.6765%205.56012%2012.1875%204.6875%2012.1875C3.47938%2012.1875%202.5%2011.2081%202.5%2010C2.5%208.79188%203.47938%207.8125%204.6875%207.8125C5.56012%207.8125%206.31341%208.32345%206.66449%209.0625H7.5V3.875ZM15%207.1875H10V5.3125H15V7.1875ZM15%2010.9375H10V9.0625H15V10.9375ZM10%2014.6875H12.5V12.8125H10V14.6875Z'%20fill='white'/%3e%3c/svg%3e",ArtifactResult:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.5%203.875C7.5%203.11561%208.11561%202.5%208.875%202.5H16.125C16.8844%202.5%2017.5%203.11561%2017.5%203.875V16.125C17.5%2016.8844%2016.8844%2017.5%2016.125%2017.5H8.875C8.11561%2017.5%207.5%2016.8844%207.5%2016.125V10.9375H6.66449C6.31341%2011.6765%205.56012%2012.1875%204.6875%2012.1875C3.47938%2012.1875%202.5%2011.2081%202.5%2010C2.5%208.79188%203.47938%207.8125%204.6875%207.8125C5.56012%207.8125%206.31341%208.32345%206.66449%209.0625H7.5V3.875ZM9.52483%206.61458C9.7035%205.94774%2010.3889%205.55202%2011.0558%205.73069C11.7226%205.90937%2012.1183%206.59479%2011.9396%207.26162C11.761%207.92846%2011.0755%208.32418%2010.4087%208.14551C9.74188%207.96683%209.34615%207.28141%209.52483%206.61458ZM13.0604%2012.7383C13.239%2012.0715%2013.9245%2011.6757%2014.5913%2011.8544C15.2581%2012.0331%2015.6539%2012.7185%2015.4752%2013.3854C15.2965%2014.0522%2014.6111%2014.4479%2013.9442%2014.2692C13.2774%2014.0906%2012.8817%2013.4051%2013.0604%2012.7383ZM10.78%2014.27L15.78%206.77002L14.2199%205.72996L9.21995%2013.23L10.78%2014.27Z'%20fill='white'/%3e%3c/svg%3e",ArtifactTable:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.5%203.875C7.5%203.11561%208.11561%202.5%208.875%202.5H16.125C16.8844%202.5%2017.5%203.11561%2017.5%203.875V16.125C17.5%2016.8844%2016.8844%2017.5%2016.125%2017.5H8.875C8.11561%2017.5%207.5%2016.8844%207.5%2016.125V10.9375H6.66449C6.31341%2011.6765%205.56012%2012.1875%204.6875%2012.1875C3.47938%2012.1875%202.5%2011.2081%202.5%2010C2.5%208.79188%203.47938%207.8125%204.6875%207.8125C5.56012%207.8125%206.31341%208.32345%206.66449%209.0625H7.5V3.875ZM10%207.1875H11.875V5.3125H10V7.1875ZM10%2010.9375H11.875V9.0625H10V10.9375ZM11.875%2014.6875H10V12.8125H11.875V14.6875ZM13.125%207.1875H15V5.3125H13.125V7.1875ZM15%2010.9375H13.125V9.0625H15V10.9375ZM13.125%2014.6875H15V12.8125H13.125V14.6875Z'%20fill='white'/%3e%3c/svg%3e"},Symbol.toStringTag,{value:"Module"}));function WA(r){const t={resolution:4};return rt.from(BA[r],t)}async function UA(r){return await Bh(WA,[r])}async function XA({cullAtZoomThreshold:r=!0}={}){const t=await IA(),e=new qt;r&&t.add(e);async function i(s){const n=await UA(s);return e.texture=n,e}return{element:e,render:i}}var ab={exports:{}};(function(r){(function(){function t(p,g){document.addEventListener?p.addEventListener("scroll",g,!1):p.attachEvent("scroll",g)}function e(p){document.body?p():document.addEventListener?document.addEventListener("DOMContentLoaded",function g(){document.removeEventListener("DOMContentLoaded",g),p()}):document.attachEvent("onreadystatechange",function g(){(document.readyState=="interactive"||document.readyState=="complete")&&(document.detachEvent("onreadystatechange",g),p())})}function i(p){this.g=document.createElement("div"),this.g.setAttribute("aria-hidden","true"),this.g.appendChild(document.createTextNode(p)),this.h=document.createElement("span"),this.i=document.createElement("span"),this.m=document.createElement("span"),this.j=document.createElement("span"),this.l=-1,this.h.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.i.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.j.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.m.style.cssText="display:inline-block;width:200%;height:200%;font-size:16px;max-width:none;",this.h.appendChild(this.m),this.i.appendChild(this.j),this.g.appendChild(this.h),this.g.appendChild(this.i)}function s(p,g){p.g.style.cssText="max-width:none;min-width:20px;min-height:20px;display:inline-block;overflow:hidden;position:absolute;width:auto;margin:0;padding:0;top:-999px;white-space:nowrap;font-synthesis:none;font:"+g+";"}function n(p){var g=p.g.offsetWidth,y=g+100;return p.j.style.width=y+"px",p.i.scrollLeft=y,p.h.scrollLeft=p.h.scrollWidth+100,p.l!==g?(p.l=g,!0):!1}function o(p,g){function y(){var b=_;n(b)&&b.g.parentNode!==null&&g(b.l)}var _=p;t(p.h,y),t(p.i,y),n(p)}function a(p,g,y){g=g||{},y=y||window,this.family=p,this.style=g.style||"normal",this.weight=g.weight||"normal",this.stretch=g.stretch||"normal",this.context=y}var h=null,l=null,c=null,u=null;function d(p){return l===null&&(f(p)&&/Apple/.test(window.navigator.vendor)?(p=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))(?:\.([0-9]+))/.exec(window.navigator.userAgent),l=!!p&&603>parseInt(p[1],10)):l=!1),l}function f(p){return u===null&&(u=!!p.document.fonts),u}function m(p,g){var y=p.style,_=p.weight;if(c===null){var b=document.createElement("div");try{b.style.font="condensed 100px sans-serif"}catch{}c=b.style.font!==""}return[y,_,c?p.stretch:"","100px",g].join(" ")}a.prototype.load=function(p,g){var y=this,_=p||"BESbswy",b=0,v=g||3e3,w=new Date().getTime();return new Promise(function(E,C){if(f(y.context)&&!d(y.context)){var A=new Promise(function(G,N){function P(){new Date().getTime()-w>=v?N(Error(""+v+"ms timeout exceeded")):y.context.document.fonts.load(m(y,'"'+y.family+'"'),_).then(function(I){1<=I.length?G():setTimeout(P,25)},N)}P()}),R=new Promise(function(G,N){b=setTimeout(function(){N(Error(""+v+"ms timeout exceeded"))},v)});Promise.race([R,A]).then(function(){clearTimeout(b),E(y)},C)}else e(function(){function G(){var V;(V=X!=-1&&H!=-1||X!=-1&&Z!=-1||H!=-1&&Z!=-1)&&((V=X!=H&&X!=Z&&H!=Z)||(h===null&&(V=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),h=!!V&&(536>parseInt(V[1],10)||parseInt(V[1],10)===536&&11>=parseInt(V[2],10))),V=h&&(X==j&&H==j&&Z==j||X==O&&H==O&&Z==O||X==k&&H==k&&Z==k)),V=!V),V&&(F.parentNode!==null&&F.parentNode.removeChild(F),clearTimeout(b),E(y))}function N(){if(new Date().getTime()-w>=v)F.parentNode!==null&&F.parentNode.removeChild(F),C(Error(""+v+"ms timeout exceeded"));else{var V=y.context.document.hidden;(V===!0||V===void 0)&&(X=P.g.offsetWidth,H=I.g.offsetWidth,Z=D.g.offsetWidth,G()),b=setTimeout(N,50)}}var P=new i(_),I=new i(_),D=new i(_),X=-1,H=-1,Z=-1,j=-1,O=-1,k=-1,F=document.createElement("div");F.dir="ltr",s(P,m(y,"sans-serif")),s(I,m(y,"serif")),s(D,m(y,"monospace")),F.appendChild(P.g),F.appendChild(I.g),F.appendChild(D.g),y.context.document.body.appendChild(F),j=P.g.offsetWidth,O=I.g.offsetWidth,k=D.g.offsetWidth,N(),o(P,function(V){X=V,G()}),s(P,m(y,'"'+y.family+'",sans-serif')),o(I,function(V){H=V,G()}),s(I,m(y,'"'+y.family+'",serif')),o(D,function(V){Z=V,G()}),s(D,m(y,'"'+y.family+'",monospace'))})})},r.exports=a})()})(ab);var ZA=ab.exports;const VA=Ds(ZA),hb={inter:{fontFamily:"InterVariable",fontSize:16,lineHeight:20,fill:16777215}},lb={resolution:4,chars:ui.ASCII},cb="sans-serif",ub={inter:zA(hb.inter)};let Ad=!1;async function HA(){const r=Object.values(hb);await Promise.all(r.map(t=>KA(t))),Ad=!0,st.emit("fontsLoaded",ub)}async function KA(r){const{fontFamily:t,...e}=r,i=new VA(t);try{await i.load()}catch(s){console.error(s),console.warn(`fonts: font ${t} failed to load, falling back to ${cb}`),ui.from(t,{fontFamily:cb,...e},lb);return}ui.from(t,r,lb)}function YA(){Ad=!1}async function db(){return Ad?ub:await Fe("fontsLoaded")}function zA(r){const{fontFamily:t,...e}=r,i={fontName:t,...e};return s=>new WS(s,i)}async function Rd({cullAtZoomThreshold:r=!0}={}){const{inter:t}=await db(),e=await eb(),i=t("");r&&e.add(i);async function s(n){return i.text=n,await i}return{element:i,render:s}}const jA=["result","markdown","table","unknown"],fb={markdown:"ArtifactMarkdown",table:"ArtifactTable",result:"ArtifactResult",unknown:"Artifact"},Uh=["flow-run","task-run"];function JA(r){return Uh.includes(r)}function Md(r){return Uh.includes(r.kind)}function pb(r){return r.kind==="artifact"}function mb(r){return r.kind==="artifacts"}function gb(r){return r.kind==="state"}const $A=["COMPLETED","RUNNING","SCHEDULED","PENDING","FAILED","CANCELLED","CANCELLING","CRASHED","PAUSED"];async function yb({cullAtZoomThreshold:r}){const t=await Yt(),e=new At,i=new At,{element:s,render:n}=await XA({cullAtZoomThreshold:r}),{element:o,render:a}=await Rd({cullAtZoomThreshold:r}),{element:h,render:l}=await OA();let c=!1,u=null,d=null;i.addChild(s),i.addChild(o),e.addChild(h),e.addChild(i);async function f(y){if(y){const{selected:_,name:b,type:v}=y;c=_??c,u=b??u,d=v??d}return await Promise.all([m(),p()]),await g(),e}async function m(){if(!d)return s;const y=fb[d],{artifactIconSize:_,artifactIconColor:b,artifactPaddingLeft:v,artifactPaddingY:w}=t.styles,E=await n(y);return E.position={x:v,y:w},E.width=_,E.height=_,E.tint=b,E}async function p(){if(!u)return o.visible=!1,o;await a(u);const{artifactPaddingLeft:y,artifactPaddingY:_,artifactTextColor:b,artifactIconSize:v,artifactContentGap:w}=t.styles,E=y+v+w,C=_;return o.tint=b,o.scale.set(.75),o.position={x:E,y:C},o.visible=!0,o}async function g(){const{artifactPaddingLeft:y,artifactPaddingRight:_,artifactPaddingY:b}=t.styles,v={selected:c,width:i.width+y+_,height:i.height+b*2};return await l(v)}return{element:e,render:f}}let he=null,Xh=!1;async function QA(){const r=await we();r.on("click",()=>Tn(null)),r.on("drag-start",()=>{Xh=!0}),r.on("drag-end",()=>{setTimeout(()=>{Xh=!1})})}function qA(){he=null,Xh=!1}function Tn(r){if(!Xh&&!(!r&&!he||r&&wn(r))){if(he=r,r===null){st.emit("itemSelected",null);return}st.emit("itemSelected",r)}}function wn(r){if(he===null)return!1;const{kind:t}=r;switch(t){case"task-run":return Md(he)&&he.id===r.id;case"flow-run":return Md(he)&&he.id===r.id;case"artifact":return pb(he)&&he.id===r.id;case"artifacts":return mb(he)&&he.ids.length===r.ids.length&&he.ids.every(i=>r.ids.includes(i));case"state":return gb(he)&&he.id===r.id;default:const e=t;throw new Error(`switch does not have case for value: ${e}`)}}function tR(){return he&&Uh.includes(he.kind)?he:null}async function bb(r,{cullAtZoomThreshold:t=!0}={}){const{element:e,render:i}=await yb({cullAtZoomThreshold:t});let s=!1;e.eventMode="static",e.cursor="pointer",e.on("click",l=>{l.stopPropagation(),Tn({kind:"artifact",id:r.id})}),st.on("itemSelected",()=>{const l=wn({kind:"artifact",id:r.id});l!==s&&(s=l,n())});async function n(){await i({selected:s,name:r.key,type:r.type})}function o(){return s}function a(){return r.created}function h(){return r.id}return{element:e,render:n,getSelected:o,getDate:a,getId:h}}async function eR(){const r=await Yt(),t=await eb(),e=new At,{element:i,render:s}=await sb(),{element:n,render:o}=await Cd(),{element:a,render:h}=await Id();t.add(e);let l=!1;e.eventMode="static",e.cursor="pointer",e.addChild(n),e.addChild(i),e.addChild(a),e.on("mouseover",u),e.on("mouseout",d);async function c({inside:f,isOpen:m}){l=f;const p={size:10,stroke:2,rotate:m?Wh.Up:Wh.Down},g=await s(p),y={width:r.styles.nodeToggleSize,height:r.styles.nodeToggleSize,background:r.styles.nodeToggleBgColor,radius:r.styles.nodeToggleBorderRadius},_=await o(y);_.alpha=f?0:.5;const b=await h({width:y.width,height:y.height,radius:y.radius,stroke:1,color:r.styles.nodeToggleBorderColor});b.alpha=f?0:1;const v={y:_.height/2,x:_.width/2},w=p.size/4;return g.x=v.x,g.y=m?v.y+w:v.y-w,e}function u(){n.alpha=l?.5:1}function d(){n.alpha=l?0:.5}return{element:e,render:c}}async function xb(){const r=await Yt(),t=await Ue(),e=new At,{element:i,render:s}=await Cd(),{element:n,render:o}=await ob();e.addChild(i),e.addChild(n);async function a(l){const{background:c="#fff"}=r.styles.node(l),{nodeHeight:u,nodeRadius:d}=r.styles,f=wn({kind:l.kind,id:l.id}),m=h(l,d),p=l.state_type!=="RUNNING"||t.isDependency();return await Promise.all([s({width:m,height:u,radius:d,background:c,capRight:p}),o({selected:f,width:m,height:u})]),i}function h(l,c){const u=Pd();if(ct.isTemporal()||ct.isLeftAligned()){const d=l.start_time,f=l.end_time??new Date,p=Cf(f,d)/ta*u;return Math.max(p,c*2)}return u}return{element:e,render:a}}class _b extends At{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)this.children[t].updateTransform()}calculateBounds(){this._bounds.clear(),this._calculateBounds();for(const t of this.children)if(t.calculateBounds(),t._mask){const e=t._mask.isMaskData?t._mask.maskObject:t._mask;e?(e.calculateBounds(),this._bounds.addBoundsMask(t._bounds,e._bounds)):this._bounds.addBounds(t._bounds)}else t.filterArea?this._bounds.addBoundsArea(t._bounds,t.filterArea):this._bounds.addBounds(t._bounds);this._bounds.updateID=this._boundsID}}async function iR(r){const t=new _b,e=await Yt(),{element:i,render:s}=await xb(),{element:n,render:o}=await Rd(),{element:a,render:h,getSize:l,stopWorker:c}=await Lb(),{element:u,render:d}=await eR(),{element:f,render:m}=await Id(),{start:p,stop:g}=await U0(r.id,P=>{h(P)});let y=r,_=!1;t.addChild(f),t.addChild(i),t.addChild(n),t.addChild(u),u.on("click",P=>{P.stopPropagation(),v()}),a.position={x:0,y:e.styles.nodeHeight+e.styles.nodesPadding},a.on("rendered",()=>{wd(),G()});async function b(P){return y=P,await s(P),await A(),await R(P),await w(P),t}async function v(){_?await C():await E()}async function w(P){const{background:I="#fff"}=e.styles.node(P),D=4,{width:X,height:H}=l(),Z=H+e.styles.nodeHeight+e.styles.nodesPadding*2+D*2,j=e.styles.nodeHeight,O=_?-D:D,k=Math.max(i.width,X),F=_?k+D*2:i.width-D*2;(await m({width:F,height:_?Z:j,stroke:_?2:1,radius:e.styles.nodeBorderRadius,color:I})).position.set(O,O)}async function E(){_=!0,t.addChild(a),await Promise.all([p(),b(y)]),G()}async function C(){_=!1,t.removeChild(a),c(),await Promise.all([g(),b(y)]),G()}async function A(){const P=e.styles.nodeToggleSize,I=e.styles.nodeHeight-P,D=i.width>P,X=await d({inside:D,isOpen:_});return X.x=D?I/2:i.width+e.styles.nodePadding,X.y=I/2,X}async function R(P){const I=await o(P.label),D=e.styles.colorMode==="dark"?e.styles.textDefault:e.styles.textInverse,X=e.styles.nodePadding,H=u.x+u.width+X,Z=i.width+X,j=i.width>H+I.width+X,O=e.styles.nodeHeight/2-I.height/2,k=j?H:Math.max(Z,H);return I.position={x:k,y:O},I.tint=j?D:e.styles.textDefault,I}function G(){w(y);const P=N();t.emit("resized",P)}function N(){const P=l(),I=_?P.height+e.styles.nodesPadding*2:0,D=_?P.width:0;return{height:e.styles.nodeHeight+I,width:Math.max(D,t.width)}}return{kind:"flow-run",element:t,bar:i,render:b}}async function rR(){const r=await Yt(),t=new _b,{element:e,render:i}=await Rd(),{element:s,render:n}=await xb();t.addChild(s),t.addChild(e);async function o(h){return await Promise.all([n(h),i(h.label)]),a(),t}function a(){const h=r.styles.colorMode==="dark"?r.styles.textDefault:r.styles.textInverse,l=r.styles.nodePadding,c=s.width>l+e.width+l,u=c?l:s.width+l,d=r.styles.nodeHeight/2-e.height/2;e.position={x:u,y:d},e.tint=c?h:r.styles.textDefault}return{kind:"task-run",element:t,render:o,bar:s}}var vb="Expected a function",Tb=NaN,sR="[object Symbol]",nR=/^\s+|\s+$/g,oR=/^[-+]0x[0-9a-f]+$/i,aR=/^0b[01]+$/i,hR=/^0o[0-7]+$/i,lR=parseInt,cR=typeof xe=="object"&&xe&&xe.Object===Object&&xe,uR=typeof self=="object"&&self&&self.Object===Object&&self,dR=cR||uR||Function("return this")(),fR=Object.prototype,pR=fR.toString,mR=Math.max,gR=Math.min,Ld=function(){return dR.Date.now()};function yR(r,t,e){var i,s,n,o,a,h,l=0,c=!1,u=!1,d=!0;if(typeof r!="function")throw new TypeError(vb);t=wb(t)||0,Zh(e)&&(c=!!e.leading,u="maxWait"in e,n=u?mR(wb(e.maxWait)||0,t):n,d="trailing"in e?!!e.trailing:d);function f(E){var C=i,A=s;return i=s=void 0,l=E,o=r.apply(A,C),o}function m(E){return l=E,a=setTimeout(y,t),c?f(E):o}function p(E){var C=E-h,A=E-l,R=t-C;return u?gR(R,n-A):R}function g(E){var C=E-h,A=E-l;return h===void 0||C>=t||C<0||u&&A>=n}function y(){var E=Ld();if(g(E))return _(E);a=setTimeout(y,p(E))}function _(E){return a=void 0,d&&i?f(E):(i=s=void 0,o)}function b(){a!==void 0&&clearTimeout(a),l=0,i=h=s=a=void 0}function v(){return a===void 0?o:_(Ld())}function w(){var E=Ld(),C=g(E);if(i=arguments,s=this,h=E,C){if(a===void 0)return m(h);if(u)return a=setTimeout(y,t),f(h)}return a===void 0&&(a=setTimeout(y,t)),o}return w.cancel=b,w.flush=v,w}function bR(r,t,e){var i=!0,s=!0;if(typeof r!="function")throw new TypeError(vb);return Zh(e)&&(i="leading"in e?!!e.leading:i,s="trailing"in e?!!e.trailing:s),yR(r,t,{leading:i,maxWait:t,trailing:s})}function Zh(r){var t=typeof r;return!!r&&(t=="object"||t=="function")}function xR(r){return!!r&&typeof r=="object"}function _R(r){return typeof r=="symbol"||xR(r)&&pR.call(r)==sR}function wb(r){if(typeof r=="number")return r;if(_R(r))return Tb;if(Zh(r)){var t=typeof r.valueOf=="function"?r.valueOf():r;r=Zh(t)?t+"":t}if(typeof r!="string")return r===0?r:+r;r=r.replace(nR,"");var e=aR.test(r);return e||hR.test(r)?lR(r.slice(2),e?2:8):oR.test(r)?Tb:+r}var vR=bR;const TR=Ds(vR);async function wR(){const{element:r,render:t}=await yb({cullAtZoomThreshold:!1});let e=null,i=[],s=!1;r.eventMode="static",r.cursor="pointer",r.on("click",l=>{l.stopPropagation();const c={x:r.position.x,y:r.position.y,width:r.width,height:r.height};Tn({kind:"artifacts",ids:i,position:c})}),st.on("itemSelected",()=>{const l=wn({kind:"artifacts",ids:i});l!==s&&e&&(s=l,n({ids:i,date:e}))});async function n(l){if(!l){e=null,i=[],r.visible=!1;return}const{ids:c,date:u}=l;e=u,i=c,await t({selected:s,type:"unknown",name:c.length.toString()}),r.visible=!0}function o(){return s}function a(){return e}function h(){return i}return{element:r,render:n,getSelected:o,getDate:a,getIds:h,isCluster:!0}}async function Sb(r){const t=await fe(),e=await we(),i=await Yt(),s=await Ue();let n=await Cs();const o=await h();st.on("scaleUpdated",c=>{n=c,l()}),st.on("viewportMoved",()=>l());async function a(c){await o.render(c),l()}async function h(){return r.type==="artifact"?await bb(r.artifact,{cullAtZoomThreshold:!1}):await wR()}function l(){const c=o.getDate();if(!c||!ct.isTemporal()||s.disableArtifacts)return;const u=o.getSelected(),{element:d}=o;let f=0;if(u){const{selectedBorderOffset:y,selectedBorderWidth:_}=i.styles;f=y+_*2}const p=n(c)*e.scale._x+e.worldTransform.tx-(d.width-f)/2,g=t.screen.height-(d.height-f)-10;d.position.set(p,g)}return{...o,render:a}}async function SR(){const r=await fe(),t=await we(),e=await Yt(),i=await Ue(),s=new Map,n=[];let o=null,a=null,h=!1;st.on("viewportMoved",()=>d());async function l(b){if(o&&(o.visible=!i.disableArtifacts),i.disableArtifacts||(b&&(a=b),!a))return;o||u();const v=[];for(const w of a)v.push(c(w));await Promise.all(v)}async function c(b){if(s.has(b.id))return s.get(b.id).render();const v=await Sb({type:"artifact",artifact:b});return s.set(b.id,v),o.addChild(v.element),v.render()}function u(){o=new At,o.zIndex=3,r.stage.addChild(o)}function d(){if(!(!o||i.disableArtifacts)){if(!ct.isTemporal()){h||(y(),_(),h=!0),o.position.x=t.scale._x+t.worldTransform.tx;return}h=!1,o.position.x=0,f()}}const f=TR(async()=>{const b=[...s.values()],v=[...n];b.sort((w,E)=>w.element.x-E.element.x),await m(b,v);for(const w of v)w.render()},250);async function m(b,v,w){let E,C=null,A=null;for(let R=w??0;R<b.length;R++){const G=b[R],N=G.element.x;if(G.element.visible=!0,C!==null&&E&&N<E){A=R;break}C=R,E=N+G.element.width}if(A!==null&&C!==null){const R=b[C],G=b[A];R.element.visible=!1,G.element.visible=!1;const N=await p(R,G,v);N&&(b.splice(C,1,N),b.splice(A,1)),m(b,v,C)}}async function p(b,v,w){const E=b.getDate(),C=v.getDate(),A="getId"in b?[b.getId()]:b.getIds(),R="getId"in v?[v.getId()]:v.getIds();if(!E||!C)return console.error("flowRunArtifacts: visible item is missing date"),null;let G;if("isCluster"in b)G=b;else if("isCluster"in v)G=v;else if(w.length>0)G=w.pop();else{const I=await Sb({type:"cluster"});o.addChild(I.element),n.push(I),G=I}const N=[...A,...R],P=g(N);return G.render({ids:N,date:P}),G}function g(b){const v=b.reduce((C,A)=>{const R=s.get(A);return R&&C.push(R.getDate().getTime()),C},[]),w=Math.min(...v),E=Math.max(...v);return new Date((w+E)/2)}function y(){for(const b of n)b.render();for(const b of s.values())b.element.visible=!0}function _(){const{artifactContentGap:b}=e.styles;let v=0;for(const w of s.values())w.element.x=v,v+=w.element.width+b}return{render:l}}async function ER(){const r=await Go(),{render:t}=await SR();function e(i){t(i==null?void 0:i.artifacts)}r.artifacts&&e(r),st.on("runDataCreated",i=>e(i)),st.on("runDataUpdated",i=>e(i)),st.on("configUpdated",()=>e()),st.on("layoutSettingsUpdated",()=>e())}function ZM(){}async function CR(r,t){const e=await fe(),i=await we(),s=await Yt();let n=await Cs();const o=new At,a=await Mo(),h=await Mo();let l=(t==null?void 0:t.end)??null,c=!1,u=!1;o.addChild(h),o.addChild(a),a.eventMode="static",a.cursor="pointer",a.on("mouseover",()=>{c=!0,d()}),a.on("mouseleave",()=>{c=!1,d()}),a.on("click",()=>{const g={x:a.position.x,y:a.position.y,width:a.width,height:a.height};Tn({...r,kind:"state",position:g})}),st.on("viewportMoved",()=>d()),st.on("scaleUpdated",g=>{n=g,d()}),st.on("itemSelected",g=>{const y=wn({kind:"state",...r});y!==u&&(u=y,d())});function d(g){if(g){const{end:_}=g;l=_}if(!ct.isTemporal()){o.visible=!1;return}const y=f();m(y),p(y)}function f(){const{background:g="#fff"}=s.styles.state(r),y=Math.max(n(r.timestamp)*i.scale._x+i.worldTransform.tx,0),_=l?n(l)*i.scale._x+i.worldTransform.tx-y:e.screen.width-y;return{x:y,width:Math.max(_,0),background:g}}function m({x:g,width:y,background:_}){const{flowStateBarHeight:b,flowStateSelectedBarHeight:v}=s.styles,w=c||u?v:b;a.x=g,a.y=e.screen.height-w,a.width=y,a.height=w,a.tint=_}function p({x:g,width:y,background:_}){if(r.type==="RUNNING"){h.visible=!1;return}const{flowStateBarHeight:b,flowStateAreaAlpha:v}=s.styles;h.x=g,h.y=0,h.width=y,h.height=e.screen.height-b,h.tint=_,h.alpha=v}return{element:o,render:d}}function IR(){const r=new At,t=new Map;let e=null;r.zIndex=2;async function i(n){if(n&&(e=n),!e)return;const o=[];for(let a=0;a<e.length;a++)o.push(s(e[a],a));await Promise.all(o)}async function s(n,o){const a=e&&e.length>=o+1&&e[o+1],h=a?{end:a.timestamp}:void 0;if(t.has(n.id))return t.get(n.id).render(h);const l=await CR(n,h);return t.set(n.id,l),r.addChild(l.element),l.render()}return{element:r,render:i}}async function AR(){const r=await fe(),t=await Go(),{element:e,render:i}=await IR();r.stage.addChild(e);function s(n){i(n==null?void 0:n.states)}t.states&&s(t),st.on("runDataUpdated",n=>s(n)),st.on("configUpdated",()=>s()),st.on("layoutSettingsUpdated",()=>s())}function VM(){}async function RR(){const r=await fe(),t=await we(),e=await Ue(),i=await Yt(),{inter:s}=await db(),n=new At,o=await Mo();n.addChild(o);const a=s("");n.addChild(a);let h=await Cs(),l,c;st.on("scaleUpdated",p=>h=p),st.on("viewportMoved",()=>{e.disableGuides||(m(),n.height!==r.screen.height&&d())});function u(p,g){l=p,c=g,d(),f(p)}function d(){o.width=i.styles.guideLineWidth,o.height=r.screen.height,o.tint=i.styles.guideLineColor}function f(p){a.text=c(p),a.fontSize=i.styles.guideTextSize,a.tint=i.styles.guideTextColor,a.position.set(i.styles.guideTextLeftPadding,i.styles.guideTextTopPadding)}function m(){l!==void 0&&(n.position.x=h(l)*t.scale._x+t.worldTransform.tx)}return{element:n,render:u}}class Eb extends Error{constructor(){super("Layout is not temporal")}}function MR(r){return r.toLocaleTimeString()}function Cb(r){const t=navigator.language;return new Intl.DateTimeFormat(t,{timeStyle:"short"}).format(r)}function LR(r){const t=navigator.language;return new Intl.DateTimeFormat(t,{dateStyle:"short"}).format(r)}function PR(r){return r.getHours()===0&&r.getMinutes()===0?`${Vh.date(r)}
|
|
1176
|
+
${Cb(r)}`:Cb(r)}const Vh={timeBySeconds:MR,timeByMinutesWithDates:PR,date:LR},ee={seconds:"seconds",minutes:"minutes",date:"date"},Lo={day:r=>{const t=new Date(r.getTime());return t.setHours(0,0,0,0),t.getTime()},week:r=>{const t=new Date(r.getTime());return t.setHours(0,0,0,0),t.setDate(r.getDate()-r.getDay()+1),t.getTime()}},Et={second:1e3,minute:1e3*60,hour:1e3*60*60,day:1e3*60*60*24,week:1e3*60*60*24*7},Ib=[{ceiling:Et.second*4,increment:Et.second,labelFormat:ee.seconds},{ceiling:Et.second*8,increment:Et.second*5,labelFormat:ee.seconds},{ceiling:Et.second*13,increment:Et.second*10,labelFormat:ee.seconds},{ceiling:Et.second*20,increment:Et.second*15,labelFormat:ee.seconds},{ceiling:Et.second*45,increment:Et.second*30,labelFormat:ee.seconds},{ceiling:Et.minute*4,increment:Et.minute,labelFormat:ee.minutes},{ceiling:Et.minute*8,increment:Et.minute*5,labelFormat:ee.minutes},{ceiling:Et.minute*13,increment:Et.minute*10,labelFormat:ee.minutes},{ceiling:Et.minute*28,increment:Et.minute*15,labelFormat:ee.minutes},{ceiling:Et.hour*1.24,increment:Et.minute*30,labelFormat:ee.minutes},{ceiling:Et.hour*3,increment:Et.hour,labelFormat:ee.minutes},{ceiling:Et.hour*8,increment:Et.hour*2,getAnchor:Lo.day,labelFormat:ee.minutes},{ceiling:Et.hour*13,increment:Et.hour*6,getAnchor:Lo.day,labelFormat:ee.minutes},{ceiling:Et.hour*22,increment:Et.hour*12,getAnchor:Lo.day,labelFormat:ee.minutes},{ceiling:Et.day*4,increment:Et.day,getAnchor:Lo.day,labelFormat:ee.date},{ceiling:Et.week*2,increment:Et.week,getAnchor:Lo.week,labelFormat:ee.date},{ceiling:1/0,increment:Et.week*4,labelFormat:ee.date}],GR=300;async function FR(){const r=await we(),t=await Ue(),e=new At,i=new Map;let s=await Cs();st.on("scaleUpdated",d=>s=d),await o();function n(){if(e.visible=!t.disableGuides,!t.disableGuides)try{const{anchor:d,increment:f,labelFormat:m}=a(),p=u(d,f);c(p,m)}catch(d){if(d instanceof Eb)return;console.error(d)}}async function o(){const d=[];Ed(30,async f=>{const m=RR();d.push(m);const p=await m;e.addChild(p.element),i.set(f,p)}),await Promise.all(d)}function a(){const d=r.left-GR,f=s.invert(d),m=s.invert(d+260/r.scale.x);if(!(f instanceof Date)||!(m instanceof Date))throw new Eb;const p=m.getTime()-f.getTime(),{increment:g,getAnchor:y,labelFormat:_}=h(p);return{anchor:y(f),increment:g,labelFormat:l(_)}}function h(d){const f=Ib.find(m=>m.ceiling>d)??Ib[0];return f.getAnchor||(f.getAnchor=m=>Math.floor(m.getTime()/f.increment)*f.increment),f}function l(d){switch(d){case ee.minutes:return Vh.timeByMinutesWithDates;case ee.date:return Vh.date;default:return Vh.timeBySeconds}}function c(d,f){const m=new Map(i.entries()),p=Array.from(m.keys()).filter(g=>!d.includes(g));i.clear();for(const g of d){if(m.has(g)){const _=m.get(g);i.set(g,_),_.render(new Date(g),f);continue}const y=m.get(p.pop()??-1);if(y===void 0){console.warn("Guides: No unused guides available to render.");continue}y.render(new Date(g),f),i.set(g,y)}}function u(d,f){return Ed(30,m=>d+f*m)}return{element:e,render:n}}async function NR(){const r=await fe(),{element:t,render:e}=await FR();r.stage.addChild(t),e(),st.on("viewportDateRangeUpdated",()=>e()),st.on("layoutSettingsUpdated",()=>e()),st.on("configUpdated",()=>e())}function HM(){}const DR=80;async function kR(){const r=await fe(),t=await we(),e=await Ue(),i=await Yt(),s=await Mo();let n=await Cs();st.on("scaleUpdated",h=>n=h);function o(){if(!e.isTemporal()){s.visible=!1;return}s.width=i.styles.playheadWidth,s.height=r.stage.height,s.tint=i.styles.playheadColor,s.position.x=n(new Date)*t.scale.x+t.worldTransform.tx,a()}function a(){if(t.moving||!(s.position.x>0&&s.position.x<r.screen.width)||!(s.position.x>r.screen.width-DR))return;const c=t.left;t.zoomPercent(-.1,!0),t.left=c}return{element:s,render:o}}async function OR(){const r=await fe(),t=await Go(),{element:e,render:i}=await kR();t.end_time||(r.stage.addChild(e),r.ticker.add(i)),st.on("runDataUpdated",({end_time:s})=>{s&&(r.ticker.remove(i),r.stage.removeChild(e))})}function KM(){}function BR({stage:r,props:t}){KS(),yA(),mA(),NR(),HR(),ER(),AR(),OR(),QS(),HA(),VS(r),iE(t),wA(),$R(),QA()}function WR(){st.clear();try{YS(),bA(),gA(),HS(),KR(),rE(),qS(),YA(),SA(),QR(),qA(),AA()}catch(r){console.error(r)}}async function UR(r){const t=await Yt(),e=await fe(),i=await tb(),s=await Ue();let n=null;const o=new Map,{animate:a}=await ib(),{element:h,render:l,bar:c}=await C(r);let u=r,d=null,f=!1,m=!1;i.add(h),h.eventMode="static",h.cursor="pointer",h.name=Ob,h.on("click",G=>{G.stopPropagation(),Tn({kind:u.kind,id:u.id})}),r.end_time||v(),st.on("itemSelected",()=>{const G=wn({kind:u.kind,id:u.id});G!==f&&(f=G,l(u))});async function p(G){u=G;const N=A(G);return N===d||(d=N,await Promise.all([l(G),g(G.artifacts)]),n&&(n.visible=!s.disableArtifacts),G.end_time&&w()),h}async function g(G){if(!G||s.disableArtifacts)return;n||_();const N=[];for(const P of G)N.push(y(P));await Promise.all(N),b()}async function y(G){if(o.has(G.id))return o.get(G.id).render();const N=await bb(G);return o.set(G.id,N),n.addChild(N.element),N.render()}function _(){n=new At,h.addChild(n)}function b(){if(!n)return;const{artifactsGap:G,artifactsNodeOverlap:N}=t.styles;let P=0;for(const I of o.values())I.element.position.x=P,P+=I.element.width+G;n.position.y=-n.height+N,n.width<c.width&&(n.position.x=c.width-n.width)}function v(){e.ticker.add(E)}function w(){e.ticker.remove(E)}function E(){p(r)}async function C(G){const{kind:N}=G;switch(N){case"task-run":return await rR();case"flow-run":return await iR(G);default:const P=N;throw new Error(`switch does not have case for value: ${P}`)}}function A(G){var D;const N=G.end_time??new Date,P=((D=G.artifacts)==null?void 0:D.length)??0;return[G.state_type,N.getTime(),P,ct.horizontal,ct.horizontalScaleMultiplier,t.styles.colorMode].join("-")}function R({x:G,y:N}){a(h,{x:G,y:N},!m),m=!0}return{element:h,render:p,bar:c,setPosition:R}}function Ab({gap:r=0,minimum:t=0}={}){const e=new Map;function i(c){const u=e.get(c)??[];return Math.max(...u.values(),z.toValue(t))+z.toValue(r)}function s(c){let u=0;for(let d=0;d<c;d++)u+=i(d);return u}function n(c){return s(c+1)-z.toValue(r)}function o({axis:c,nodeId:u,offset:d}){const f=e.get(c)??new Map;f.set(u,d),e.set(c,f)}function a({axis:c,nodeId:u}){let d,f;for(const[m,p]of e.entries())if(p.has(u)){d=m,f=p.get(u);break}d===c||d===void 0||f===void 0||(h({axis:d,nodeId:u}),o({axis:c,nodeId:u,offset:f}))}function h({axis:c,nodeId:u}){var d;(d=e.get(c))==null||d.delete(u)}function l(){e.clear()}return{getOffset:i,getTotalOffset:s,getTotalValue:n,setOffset:o,updateNodeAxis:a,removeOffset:h,clear:l}}function XR(r){throw new Error(`switch does not have case for value: ${r}`)}const Rb="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIEtlKG4pe3Rocm93IG5ldyBFcnJvcihgc3dpdGNoIGRvZXMgbm90IGhhdmUgY2FzZSBmb3IgdmFsdWU6ICR7bn1gKX1mdW5jdGlvbiBDbihuLGUpe3JldHVybiBuPT1udWxsfHxlPT1udWxsP05hTjpuPGU/LTE6bj5lPzE6bj49ZT8wOk5hTn1mdW5jdGlvbiBudChuLGUpe3JldHVybiBuPT1udWxsfHxlPT1udWxsP05hTjplPG4/LTE6ZT5uPzE6ZT49bj8wOk5hTn1mdW5jdGlvbiBSbihuKXtsZXQgZSx0LHI7bi5sZW5ndGghPT0yPyhlPUNuLHQ9KHUsbCk9PkNuKG4odSksbCkscj0odSxsKT0+bih1KS1sKTooZT1uPT09Q258fG49PT1udD9uOmV0LHQ9bixyPW4pO2Z1bmN0aW9uIG8odSxsLGY9MCxnPXUubGVuZ3RoKXtpZihmPGcpe2lmKGUobCxsKSE9PTApcmV0dXJuIGc7ZG97Y29uc3QgbT1mK2c+Pj4xO3QodVttXSxsKTwwP2Y9bSsxOmc9bX13aGlsZ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SkoKTsKLy8jIHNvdXJjZU1hcHBpbmdVUkw9cnVuR3JhcGgud29ya2VyLXNkX0hraDUwLmpzLm1hcAo=",Mb=typeof window<"u"&&window.Blob&&new Blob([atob(Rb)],{type:"text/javascript;charset=utf-8"});function ZR(r){let t;try{if(t=Mb&&(window.URL||window.webkitURL).createObjectURL(Mb),!t)throw"";const e=new Worker(t,{name:r==null?void 0:r.name});return e.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(t)}),e}catch{return new Worker("data:text/javascript;base64,"+Rb,{name:r==null?void 0:r.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}function VR(r){const t=new ZR;return t.onmessage=r,t}async function Lb(){const r=new Map,t=new Map,e=new At,i=new At,s=await Yt();let n=null;const o=Ab({gap:()=>s.styles.rowGap,minimum:()=>s.styles.nodeHeight}),a=Ab({gap:()=>s.styles.columnGap,minimum:()=>Pd()});let h=null,l=null;e.name=Ef,st.on("layoutUpdated",()=>{o.clear(),a.clear()}),st.on("layoutSettingsUpdated",()=>{l&&e.parent&&c(l),I()}),st.on("itemSelected",()=>{I()});async function c(O){u(),l=O,h=null,await Promise.all([f(O),p(O)]),y(O)}function u(){n||(n=VR(N))}function d(){n&&(n.terminate(),n=null)}async function f(O){const k=[];for(const F of O.nodes.values())k.push(m(F));await Promise.all(k)}async function m(O){const{render:k}=await v(O);return await k(O)}async function p(O){if((await Ue()).disableEdges){e.removeChild(i);return}e.addChildAt(i,0);const F=[];for(const[V,{children:$}]of O.nodes)for(const{id:dt}of $)F.push(g(V,dt));await Promise.all(F)}async function g(O,k){const F=`${O}_${k}`;if(t.has(F))return;const V=await GA();t.has(F)||(t.set(F,V),i.addChild(V.element))}function y(O){if(!n)throw new Error("Layout worker not initialized");const k=new Map;for(const[F,{element:V}]of r)k.set(F,V.width);n.postMessage({type:"layout",data:O,widths:k,horizontalSettings:_d(O.start_time),verticalSettings:pA()})}function _(){if(h)for(const[O,k]of t){const[F,V]=O.split("_"),$=h.positions.get(F),dt=h.positions.get(V),ot=r.get(F);if(!$||!dt){console.warn(`Could not find edge in layout: Skipping ${O}`);continue}if(!ot){console.warn(`Could not find parent node in nodes: Skipping ${F}`);continue}const Ct=ot.bar.width,Mt=E($),_t={x:Mt.x+Ct,y:Mt.y+s.styles.nodeHeight/2},Y=E(dt),tt={x:Y.x-_t.x,y:Y.y-_t.y+s.styles.nodeHeight/2};k.setPosition(_t,tt)}}function b(){if(h){for(const[O,k]of r){const F=h.positions.get(O);if(!F){console.warn(`Could not find node in layout: Skipping ${O}`);continue}const V=E(F);k.setPosition(V),o.updateNodeAxis({nodeId:O,axis:F.y}),a.updateNodeAxis({nodeId:O,axis:F.column})}_(),e.emit("rendered"),e.emit("resized",G())}}async function v(O){const k=r.get(O.id);if(k)return k;const F=await UR(O);return F.element.on("resized",V=>w(O.id,V)),r.set(O.id,F),e.addChild(F.element),F}function w(O,k){if(!h)return;const F=r.get(O),V=h.positions.get(O);!F||!V||(o.setOffset({nodeId:O,axis:V.y,offset:k.height}),a.setOffset({nodeId:O,axis:V.column,offset:k.width}),b())}function E(O){const k=o.getTotalOffset(O.y);return{x:C(O),y:k}}function C(O){return ct.isDependency()?a.getTotalOffset(O.column):O.x}function A(){return h?o.getTotalValue(h.maxRow):0}function R(){if(!h||!l)return 0;if(ct.isDependency())return a.getTotalValue(h.maxColumn);const O=_d(l.start_time),k=Jy(O),F=k(l.end_time??new Date),V=k(l.start_time);return F-V}function G(){return{width:R(),height:A()}}function N({data:O}){const{type:k}=O;switch(k){case"layout":P(O);return;default:XR(k)}}function P(O){h=O.layout,b()}async function I(){const O=await Ue(),k=tR();if(!k||O.disableEdges){D([]);return}const F=Z(k.id);D(F)}function D(O){X(O),H(O)}function X(O){for(const[k,{element:F}]of r){if(O.length===0||O.includes(k)){F.alpha=1;continue}F.alpha=s.styles.nodeUnselectedAlpha}}function H(O){for(const[k,{element:F}]of t){const[V,$]=k.split("_");if(O.length===0||O.includes(V)&&O.includes($)){F.alpha=1;continue}F.alpha=s.styles.nodeUnselectedAlpha}}function Z(O){const k=j(O,"parents"),F=j(O,"children");return[O,...k,...F]}function j(O,k){const F=l==null?void 0:l.nodes.get(O);if(!F)return[];const V=[];for(const{id:$}of F[k])V.push($),V.push(...j($,k));return V}return{element:e,stopWorker:d,getSize:G,render:c}}let Po=null,Br=null,Is=null;async function HR(){const r=await we(),t=await Yt(),{element:e,render:i}=await Lb();r.addChild(e),e.alpha=0;const s=await U0(t.runId,async n=>{const o=Br?"runDataUpdated":"runDataCreated";Br=n,st.emit(o,Br),await Ue(),i(n)});st.on("configUpdated",()=>{Br&&i(Br)}),Is=e,Po=s.stop,Is.once("rendered",()=>YR()),st.on("layoutUpdated",()=>zR()),s.start()}function KR(){Po==null||Po(),Po=null,Is=null,Br=null}async function Go(){return Br||await Fe("runDataCreated")}function YR(){Td(),ve.shared.addOnce(()=>{Is&&(Is.alpha=1)})}async function zR(){if(!Is)return;const r=await Yt();Is.once("rendered",()=>{setTimeout(()=>{Td({animate:!0})},r.animationDuration)})}function jR(r){let t=0;for(const[,{children:e}]of r)t+=e.length;return t}function JR({start_time:r,end_time:t,nodes:e},i,s){const n=Math.max(Vb(t??new Date,r),1),o=i.styles.nodeHeight+i.styles.rowGap,a=.5;return e.size*o*a*s/(n*20)}async function $R(){const r=await Go(),t=await Yt(),e=await fe(),i=e.view.width/e.view.height,s=JR(r,t,i);Hh(s,!0),r.nodes.size>t.disableAnimationsThreshold&&(ct.disableAnimations=!0),jR(r.nodes)>t.disableEdgesThreshold&&(ct.disableEdges=!0)}function QR(){ct.horizontal="temporal",ct.vertical="nearest-parent",ct.horizontalScaleMultiplierDefault=0,ct.horizontalScaleMultiplier=0,ct.disableAnimations=!1,ct.disableGuides=!1,ct.disableEdges=!1,ct.disableArtifacts=!1}const ct=z.reactive({horizontal:"temporal",vertical:"nearest-parent",horizontalScaleMultiplierDefault:0,horizontalScaleMultiplier:0,disableAnimations:!1,disableGuides:!1,disableEdges:!1,disableArtifacts:!1,isTemporal(){return this.horizontal==="temporal"},isDependency(){return this.horizontal==="dependency"},isWaterfall(){return this.vertical==="waterfall"},isNearestParent(){return this.vertical==="nearest-parent"},isLeftAligned(){return this.horizontal==="left-aligned"}});async function Ue(){return Gd()?ct:await Fe("layoutSettingsCreated")}function Pd(){return ct.isDependency()?200:20*ct.horizontalScaleMultiplier}function qR(){return[0,Pd()]}function tM(r){if(ct.isDependency())return[0,1];const t=r,e=Xb(t,1);return[t,e]}function Hh(r,t=!1){if(ct.horizontalScaleMultiplier===r)return;const e=Fo();ct.horizontalScaleMultiplier=r,t&&(ct.horizontalScaleMultiplierDefault=r),e()}function eM(){Hh(ct.horizontalScaleMultiplierDefault)}function iM(r){if(ct.horizontal===r)return;const t=Fo();ct.horizontal=r,ct.disableGuides=ct.isDependency()||ct.isLeftAligned(),t()}function rM(r){if(ct.vertical===r)return;const t=Fo();ct.vertical=r,t()}function sM(r){if(ct.disableEdges===r)return;const t=Fo();ct.disableEdges=r,t()}function nM(r){if(ct.disableArtifacts===r)return;const t=Fo();ct.disableArtifacts=r,t()}function Fo(){const r=Gd()?"layoutSettingsUpdated":"layoutSettingsCreated",{horizontal:t,vertical:e}=ct;return()=>{Gd()&&st.emit(r,ct),(t!==ct.horizontal||e!==ct.vertical)&&st.emit("layoutUpdated")}}function Gd(){return ct.horizontalScaleMultiplier!==0}function Pb(r){if(!(r instanceof HTMLElement))return!1;const t=r.tagName.toLowerCase();return["input","textarea"].includes(t)}const oM={class:"flex items-center gap-2"},aM=z.defineComponent({__name:"RunGraphSettings",setup(r){const t=[Ki.positions.topRight,Ki.positions.bottomRight,Ki.positions.topLeft,Ki.positions.bottomLeft],e=[{label:"Temporal dependency",value:"temporal_nearest-parent"},{label:"Temporal sequence",value:"temporal_waterfall"},{label:"Dependency grid",value:"dependency_nearest-parent"},{label:"Sequential grid",value:"dependency_waterfall"},{label:"Comparative duration",value:"left-aligned_duration-sorted"}],i=z.computed({get(){return`${ct.horizontal}_${ct.vertical}`},set(c){const[u,d]=c.split("_");iM(u),rM(d)}}),s=z.computed({get(){return ct.disableEdges},set(c){sM(c)}}),n=z.computed({get(){return ct.disableArtifacts},set(c){nM(c)}});function o(){const u=ct.horizontalScaleMultiplier*1.25;Hh(u)}function a(){const c=Math.abs(-.75),u=ct.horizontalScaleMultiplier*c;Hh(u)}mr.useKeyDown(["-","="],h);function h(c){if(!(Pb(c.target)||c.metaKey||c.ctrlKey))switch(c.key){case"-":a();break;case"=":o();break}}function l(){eM()}return(c,u)=>{const d=z.resolveComponent("p-radio-group"),f=z.resolveComponent("p-label"),m=z.resolveComponent("p-divider"),p=z.resolveComponent("p-checkbox"),g=z.resolveComponent("p-overflow-menu");return z.openBlock(),z.createBlock(z.unref(Ki.PPopOver),{class:"run-graph-settings","auto-close":"",placement:t},{target:z.withCtx(({toggle:y})=>[z.createVNode(z.unref(Ki.PButton),{"aria-label":"Run Graph Options",icon:"CogIcon",flat:"",onClick:y},null,8,["onClick"])]),default:z.withCtx(()=>[z.createVNode(g,{class:"run-graph-settings__menu"},{default:z.withCtx(()=>[z.createVNode(f,{label:"Layout"},{default:z.withCtx(()=>[z.createVNode(d,{modelValue:i.value,"onUpdate:modelValue":u[0]||(u[0]=y=>i.value=y),options:e},{label:z.withCtx(({option:y})=>[z.createTextVNode(z.toDisplayString(y.label),1)]),_:1},8,["modelValue"])]),_:1}),z.unref(ct).isTemporal()||z.unref(ct).isLeftAligned()?(z.openBlock(),z.createElementBlock(z.Fragment,{key:0},[z.createVNode(m),z.createVNode(f,{label:"Scaling"},{default:z.withCtx(()=>[z.createElementVNode("div",oM,[z.createVNode(z.unref(Ki.PButton),{title:"Decrease scale (-)",small:"",icon:"MinusIcon",onClick:a}),z.createVNode(z.unref(Ki.PButton),{title:"Increase scale (+)",small:"",icon:"PlusIcon",onClick:o}),z.createVNode(z.unref(Ki.PButton),{small:"",onClick:l},{default:z.withCtx(()=>[z.createTextVNode(" Reset ")]),_:1})])]),_:1})],64)):z.createCommentVNode("",!0),z.createVNode(m),z.createVNode(p,{modelValue:s.value,"onUpdate:modelValue":u[1]||(u[1]=y=>s.value=y),label:"Hide dependency arrows"},null,8,["modelValue"]),z.createVNode(p,{modelValue:n.value,"onUpdate:modelValue":u[2]||(u[2]=y=>n.value=y),label:"Hide artifacts"},null,8,["modelValue"])]),_:1})]),_:1})}}}),hM={class:"run-graph__actions"},lM=z.defineComponent({__name:"RunGraph",props:{config:{},viewport:{},fullscreen:{type:[Boolean,null],default:null},selected:{default:null}},emits:["update:viewport","update:fullscreen","update:selected"],setup(r,{emit:t}){const e=r,i=z.ref(),s=z.ref(!1),n=z.computed({get(){return e.fullscreen??s.value},set(c){s.value=c,t("update:fullscreen",c)}});z.watch(()=>e.selected,c=>Tn(c)),st.on("itemSelected",c=>t("update:selected",c)),z.watch(()=>e.viewport,c=>vA(c));const o=z.computed(()=>({root:{"run-graph--fullscreen":n.value}}));st.on("viewportDateRangeUpdated",c=>t("update:viewport",c));function a(){Td({animate:!0})}function h(){n.value=!n.value}z.onMounted(()=>{if(!i.value)throw new Error("Stage does not exist");BR({stage:i.value,props:e})}),z.onBeforeUnmount(()=>{WR()}),mr.useKeyDown(["c","f","Escape"],l);function l(c){if(!(Pb(c.target)||c.metaKey||c.ctrlKey))switch(c.key){case"c":a();break;case"f":h();break;case"Escape":n.value&&h();break}}return(c,u)=>{const d=z.resolveComponent("p-button");return z.openBlock(),z.createElementBlock("div",{class:z.normalizeClass(["run-graph",o.value.root])},[z.createElementVNode("div",{ref_key:"stage",ref:i,class:"run-graph__stage"},null,512),z.createElementVNode("div",hM,[z.createVNode(d,{title:"Recenter graph (c)",icon:"Target",flat:"",onClick:a}),z.createVNode(d,{title:"Toggle fullscreen (f)",icon:"ArrowsPointingOutIcon",flat:"",onClick:h}),z.createVNode(aM)])],2)}}});Dt.RunGraph=lM,Dt.artifactTypeIconMap=fb,Dt.artifactTypes=jA,Dt.isArtifactSelection=pb,Dt.isArtifactsSelection=mb,Dt.isNodeSelection=Md,Dt.isRunGraphNodeType=JA,Dt.isStateSelection=gb,Dt.runGraphNodeKinds=Uh,Dt.stateType=$A,Object.defineProperty(Dt,Symbol.toStringTag,{value:"Module"})});
|
|
1177
1177
|
//# sourceMappingURL=graphs.umd.js.map
|