@prefecthq/graphs 2.2.15 → 2.2.17

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.
@@ -1,21 +1,21 @@
1
- (function(Ft,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):(Ft=typeof globalThis<"u"?globalThis:Ft||self,z(Ft["prefect-graphs"]={},Ft.Vue,Ft.vueCompositions,Ft.prefectDesign))})(this,function(Ft,z,_r,ji){"use strict";var FR=Object.defineProperty;var NR=(Ft,z,_r)=>z in Ft?FR(Ft,z,{enumerable:!0,configurable:!0,writable:!0,value:_r}):Ft[z]=_r;var Tf=(Ft,z,_r)=>(NR(Ft,typeof z!="symbol"?z+"":z,_r),_r);const Pf="nodes-container",ix="node-container",rx="edge-container";function Cl(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 sx(r,t){return r instanceof Date?new r.constructor(t):new Date(t)}function nx(r,t){const e=+Cl(r);return sx(r,e+t)}const aa=1e3;function ox(r,t){return nx(r,t*1e3)}function ax(r){return t=>{const i=(r?Math[r]:Math.trunc)(t);return i===0?0:i}}function Lf(r,t){return+Cl(r)-+Cl(t)}function hx(r,t,e){const i=Lf(r,t)/1e3;return ax(e==null?void 0:e.roundingMethod)(i)}var Jr=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(Jr||{}),Gf=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(Gf||{}),Il=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(Il||{}),mt=(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))(mt||{}),_i=(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))(_i||{}),Y=(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))(Y||{}),Us=(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))(Us||{}),ct=(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))(ct||{}),rt=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(rt||{}),Ji=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(Ji||{}),vi=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(vi||{}),wi=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(wi||{}),Ee=(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))(Ee||{}),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||{}),Al=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(Al||{}),Ye=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(Ye||{}),ie=(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))(ie||{}),Jt=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(Jt||{}),Si=(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))(Si||{});const st={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 Ml=/iPhone/i,Ff=/iPod/i,Nf=/iPad/i,kf=/\biOS-universal(?:.+)Mac\b/i,Rl=/\bAndroid(?:.+)Mobile\b/i,Df=/Android/i,Xs=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,ha=/Silk/i,$i=/Windows Phone/i,Of=/\bWindows(?:.+)ARM\b/i,Bf=/BlackBerry/i,Uf=/BB10/i,Xf=/Opera Mini/i,Wf=/\b(CriOS|Chrome)(?:.+)Mobile/i,Zf=/Mobile(?:.+)Firefox\b/i,Vf=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"};function lx(r){return function(t){return t.test(r)}}function Hf(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=lx(e),n={apple:{phone:s(Ml)&&!s($i),ipod:s(Ff),tablet:!s(Ml)&&(s(Nf)||Vf(t))&&!s($i),universal:s(kf),device:(s(Ml)||s(Ff)||s(Nf)||s(kf)||Vf(t))&&!s($i)},amazon:{phone:s(Xs),tablet:!s(Xs)&&s(ha),device:s(Xs)||s(ha)},android:{phone:!s($i)&&s(Xs)||!s($i)&&s(Rl),tablet:!s($i)&&!s(Xs)&&!s(Rl)&&(s(ha)||s(Df)),device:!s($i)&&(s(Xs)||s(ha)||s(Rl)||s(Df))||s(/\bokhttp\b/i)},windows:{phone:s($i),tablet:s(Of),device:s($i)||s(Of)},other:{blackberry:s(Bf),blackberry10:s(Uf),opera:s(Xf),firefox:s(Zf),chrome:s(Wf),device:s(Bf)||s(Uf)||s(Xf)||s(Zf)||s(Wf)},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 cx=Hf.default??Hf,Qi=cx(globalThis.navigator);st.RETINA_PREFIX=/@([0-9\.]+)x/,st.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var ve=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ws(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function ux(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 Kf={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),p=e?e+l:l;return h._events[p]?h._events[p].fn?h._events[p]=[h._events[p],f]:h._events[p].push(f):(h._events[p]=f,h._eventsCount++),h}function 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,p=new Array(f);d<f;d++)p[d]=u[d].fn;return p},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,p){var m=e?e+l:l;if(!this._events[m])return!1;var g=this._events[m],y=arguments.length,x,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,p),!0}for(b=1,x=new Array(y-1);b<y;b++)x[b-1]=arguments[b];g.fn.apply(g.context,x)}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(!x)for(w=1,x=new Array(y-1);w<y;w++)x[w-1]=arguments[w];g[b].fn.apply(g[b].context,x)}}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 p=this._events[f];if(p.fn)p.fn===c&&(!d||p.once)&&(!u||p.context===u)&&o(this,f);else{for(var m=0,g=[],y=p.length;m<y;m++)(p[m].fn!==c||d&&!p[m].once||u&&p[m].context!==u)&&g.push(p[m]);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})(Kf);var dx=Kf.exports;const Kn=Ws(dx);var Pl={exports:{}};Pl.exports=la,Pl.exports.default=la;function la(r,t,e){e=e||2;var i=t&&t.length,s=i?t[0]*e:r.length,n=Yf(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=yx(r,t,n,e)),r.length>80*e){a=l=r[0],h=c=r[1];for(var p=e;p<s;p+=e)u=r[p],d=r[p+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 Yn(n,o,e,a,h,f,0),o}function Yf(r,t,e,i,s){var n,o;if(s===Fl(r,t,e,i)>0)for(n=t;n<e;n+=i)o=Jf(n,r[n],r[n+1],o);else for(n=e-i;n>=t;n-=i)o=Jf(n,r[n],r[n+1],o);return o&&ca(o,o.next)&&(jn(o),o=o.next),o}function $r(r,t){if(!r)return r;t||(t=r);var e=r,i;do if(i=!1,!e.steiner&&(ca(e,e.next)||Xt(e.prev,e,e.next)===0)){if(jn(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function Yn(r,t,e,i,s,n,o){if(r){!o&&n&&wx(r,i,s,n);for(var a=r,h,l;r.prev!==r.next;){if(h=r.prev,l=r.next,n?px(r,i,s,n):fx(r)){t.push(h.i/e|0),t.push(r.i/e|0),t.push(l.i/e|0),jn(r),r=l.next,a=l.next;continue}if(r=l,r===a){o?o===1?(r=mx($r(r),t,e),Yn(r,t,e,i,s,n,2)):o===2&&gx(r,t,e,i,s,n):Yn($r(r),t,e,i,s,n,1);break}}}}function fx(r){var t=r.prev,e=r,i=r.next;if(Xt(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,p=i.next;p!==t;){if(p.x>=c&&p.x<=d&&p.y>=u&&p.y<=f&&Zs(s,a,n,h,o,l,p.x,p.y)&&Xt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function px(r,t,e,i){var s=r.prev,n=r,o=r.next;if(Xt(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,p=c<u?c<d?c:d:u<d?u:d,m=a>h?a>l?a:l:h>l?h:l,g=c>u?c>d?c:d:u>d?u:d,y=Ll(f,p,t,e,i),x=Ll(m,g,t,e,i),b=r.prevZ,v=r.nextZ;b&&b.z>=y&&v&&v.z<=x;){if(b.x>=f&&b.x<=m&&b.y>=p&&b.y<=g&&b!==s&&b!==o&&Zs(a,c,h,u,l,d,b.x,b.y)&&Xt(b.prev,b,b.next)>=0||(b=b.prevZ,v.x>=f&&v.x<=m&&v.y>=p&&v.y<=g&&v!==s&&v!==o&&Zs(a,c,h,u,l,d,v.x,v.y)&&Xt(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;b&&b.z>=y;){if(b.x>=f&&b.x<=m&&b.y>=p&&b.y<=g&&b!==s&&b!==o&&Zs(a,c,h,u,l,d,b.x,b.y)&&Xt(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;v&&v.z<=x;){if(v.x>=f&&v.x<=m&&v.y>=p&&v.y<=g&&v!==s&&v!==o&&Zs(a,c,h,u,l,d,v.x,v.y)&&Xt(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function mx(r,t,e){var i=r;do{var s=i.prev,n=i.next.next;!ca(s,n)&&zf(s,i,i.next,n)&&zn(s,n)&&zn(n,s)&&(t.push(s.i/e|0),t.push(i.i/e|0),t.push(n.i/e|0),jn(i),jn(i.next),i=r=n),i=i.next}while(i!==r);return $r(i)}function gx(r,t,e,i,s,n){var o=r;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&Ex(o,a)){var h=jf(o,a);o=$r(o,o.next),h=$r(h,h.next),Yn(o,t,e,i,s,n,0),Yn(h,t,e,i,s,n,0);return}a=a.next}o=o.next}while(o!==r)}function yx(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=Yf(r,a,h,i,!1),l===l.next&&(l.steiner=!0),s.push(Sx(l));for(s.sort(bx),n=0;n<s.length;n++)e=xx(s[n],e);return e}function bx(r,t){return r.x-t.x}function xx(r,t){var e=_x(r,t);if(!e)return t;var i=jf(e,r);return $r(i,i.next),$r(e,e.next)}function _x(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&&Zs(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),zn(e,r)&&(d<u||d===u&&(e.x>o.x||e.x===o.x&&vx(o,e)))&&(o=e,u=d)),e=e.next;while(e!==h);return o}function vx(r,t){return Xt(r.prev,r,t.prev)<0&&Xt(t.next,r,r.next)<0}function wx(r,t,e,i){var s=r;do s.z===0&&(s.z=Ll(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,Tx(s)}function Tx(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 Ll(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 Sx(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 Zs(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 Ex(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!Cx(r,t)&&(zn(r,t)&&zn(t,r)&&Ix(r,t)&&(Xt(r.prev,r,t.prev)||Xt(r,t.prev,t))||ca(r,t)&&Xt(r.prev,r,r.next)>0&&Xt(t.prev,t,t.next)>0)}function Xt(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function ca(r,t){return r.x===t.x&&r.y===t.y}function zf(r,t,e,i){var s=da(Xt(r,t,e)),n=da(Xt(r,t,i)),o=da(Xt(e,i,r)),a=da(Xt(e,i,t));return!!(s!==n&&o!==a||s===0&&ua(r,e,t)||n===0&&ua(r,i,t)||o===0&&ua(e,r,i)||a===0&&ua(e,t,i))}function ua(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 da(r){return r>0?1:r<0?-1:0}function Cx(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&&zf(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function zn(r,t){return Xt(r.prev,r,r.next)<0?Xt(r,t,r.next)>=0&&Xt(r,r.prev,t)>=0:Xt(r,t,r.prev)<0||Xt(r,r.next,t)<0}function Ix(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 jf(r,t){var e=new Gl(r.i,r.x,r.y),i=new Gl(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 Jf(r,t,e,i){var s=new Gl(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 jn(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 Gl(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}la.deviation=function(r,t,e,i){var s=t&&t.length,n=s?t[0]*e:r.length,o=Math.abs(Fl(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(Fl(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,p=i[a+2]*e;u+=Math.abs((r[d]-r[p])*(r[f+1]-r[d+1])-(r[d]-r[f])*(r[p+1]-r[d+1]))}return o===0&&u===0?0:Math.abs((u-o)/o)};function Fl(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}la.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 Ax=Pl.exports;const Mx=Ws(Ax);var fa={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */fa.exports,function(r,t){(function(e){var i=t&&!t.nodeType&&t,s=r&&!r.nodeType&&r,n=typeof ve=="object"&&ve;(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,p=128,m="-",g=/^xn--/,y=/[^\x20-\x7E]/,x=/[\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,S=String.fromCharCode,C;function I(k){throw new RangeError(b[k])}function M(k,F){for(var V=k.length,et=[];V--;)et[V]=F(k[V]);return et}function L(k,F){var V=k.split("@"),et="";V.length>1&&(et=V[0]+"@",k=V[1]),k=k.replace(x,".");var ft=k.split("."),at=M(ft,F).join(".");return et+at}function G(k){for(var F=[],V=0,et=k.length,ft,at;V<et;)ft=k.charCodeAt(V++),ft>=55296&&ft<=56319&&V<et?(at=k.charCodeAt(V++),(at&64512)==56320?F.push(((ft&1023)<<10)+(at&1023)+65536):(F.push(ft),V--)):F.push(ft);return F}function N(k){return M(k,function(F){var V="";return F>65535&&(F-=65536,V+=S(F>>>10&1023|55296),F=56320|F&1023),V+=S(F),V}).join("")}function A(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 Z(k,F,V){var et=0;for(k=V?w(k/d):k>>1,k+=w(k/F);k>v*c>>1;et+=h)k=w(k/v);return w(et+(v+1)*k/(k+u))}function K(k){var F=[],V=k.length,et,ft=0,at=p,Tt=f,It,Q,W,J,$,O,pt,yt,Rt;for(It=k.lastIndexOf(m),It<0&&(It=0),Q=0;Q<It;++Q)k.charCodeAt(Q)>=128&&I("not-basic"),F.push(k.charCodeAt(Q));for(W=It>0?It+1:0;W<V;){for(J=ft,$=1,O=h;W>=V&&I("invalid-input"),pt=A(k.charCodeAt(W++)),(pt>=h||pt>w((a-ft)/$))&&I("overflow"),ft+=pt*$,yt=O<=Tt?l:O>=Tt+c?c:O-Tt,!(pt<yt);O+=h)Rt=h-yt,$>w(a/Rt)&&I("overflow"),$*=Rt;et=F.length+1,Tt=Z(ft-J,et,J==0),w(ft/et)>a-at&&I("overflow"),at+=w(ft/et),ft%=et,F.splice(ft++,0,at)}return N(F)}function H(k){var F,V,et,ft,at,Tt,It,Q,W,J,$,O=[],pt,yt,Rt,Ot;for(k=G(k),pt=k.length,F=p,V=0,at=f,Tt=0;Tt<pt;++Tt)$=k[Tt],$<128&&O.push(S($));for(et=ft=O.length,ft&&O.push(m);et<pt;){for(It=a,Tt=0;Tt<pt;++Tt)$=k[Tt],$>=F&&$<It&&(It=$);for(yt=et+1,It-F>w((a-V)/yt)&&I("overflow"),V+=(It-F)*yt,F=It,Tt=0;Tt<pt;++Tt)if($=k[Tt],$<F&&++V>a&&I("overflow"),$==F){for(Q=V,W=h;J=W<=at?l:W>=at+c?c:W-at,!(Q<J);W+=h)Ot=Q-J,Rt=h-J,O.push(S(D(J+Ot%Rt,0))),Q=w(Ot/Rt);O.push(S(D(Q,0))),at=Z(V,yt,et==ft),V=0,++et}++V,++F}return O.join("")}function j(k){return L(k,function(F){return g.test(F)?K(F.slice(4).toLowerCase()):F})}function B(k){return L(k,function(F){return y.test(F)?"xn--"+H(F):F})}if(o={version:"1.4.1",ucs2:{decode:G,encode:N},decode:K,encode:H,toASCII:B,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})(ve)}(fa,fa.exports);var Rx=fa.exports,Px=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},$f=typeof Symbol<"u"&&Symbol,Lx=Px,Gx=function(){return typeof $f!="function"||typeof Symbol!="function"||typeof $f("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Lx()},Qf={foo:{}},Fx=Object,Nx=function(){return{__proto__:Qf}.foo===Qf.foo&&!({__proto__:null}instanceof Fx)},kx="Function.prototype.bind called on incompatible ",Nl=Array.prototype.slice,Dx=Object.prototype.toString,Ox="[object Function]",Bx=function(t){var e=this;if(typeof e!="function"||Dx.call(e)!==Ox)throw new TypeError(kx+e);for(var i=Nl.call(arguments,1),s,n=function(){if(this instanceof s){var c=e.apply(this,i.concat(Nl.call(arguments)));return Object(c)===c?c:this}else return e.apply(t,i.concat(Nl.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},Ux=Bx,kl=Function.prototype.bind||Ux,Xx=kl,Wx=Xx.call(Function.call,Object.prototype.hasOwnProperty),St,Vs=SyntaxError,qf=Function,Hs=TypeError,Dl=function(r){try{return qf('"use strict"; return ('+r+").constructor;")()}catch{}},Qr=Object.getOwnPropertyDescriptor;if(Qr)try{Qr({},"")}catch{Qr=null}var Ol=function(){throw new Hs},Zx=Qr?function(){try{return arguments.callee,Ol}catch{try{return Qr(arguments,"callee").get}catch{return Ol}}}():Ol,Ks=Gx(),Vx=Nx(),oe=Object.getPrototypeOf||(Vx?function(r){return r.__proto__}:null),Ys={},Hx=typeof Uint8Array>"u"||!oe?St:oe(Uint8Array),qr={"%AggregateError%":typeof AggregateError>"u"?St:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?St:ArrayBuffer,"%ArrayIteratorPrototype%":Ks&&oe?oe([][Symbol.iterator]()):St,"%AsyncFromSyncIteratorPrototype%":St,"%AsyncFunction%":Ys,"%AsyncGenerator%":Ys,"%AsyncGeneratorFunction%":Ys,"%AsyncIteratorPrototype%":Ys,"%Atomics%":typeof Atomics>"u"?St:Atomics,"%BigInt%":typeof BigInt>"u"?St:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?St:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?St:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?St:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?St:Float32Array,"%Float64Array%":typeof Float64Array>"u"?St:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?St:FinalizationRegistry,"%Function%":qf,"%GeneratorFunction%":Ys,"%Int8Array%":typeof Int8Array>"u"?St:Int8Array,"%Int16Array%":typeof Int16Array>"u"?St:Int16Array,"%Int32Array%":typeof Int32Array>"u"?St:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ks&&oe?oe(oe([][Symbol.iterator]())):St,"%JSON%":typeof JSON=="object"?JSON:St,"%Map%":typeof Map>"u"?St:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Ks||!oe?St:oe(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?St:Promise,"%Proxy%":typeof Proxy>"u"?St:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?St:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?St:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Ks||!oe?St:oe(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?St:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ks&&oe?oe(""[Symbol.iterator]()):St,"%Symbol%":Ks?Symbol:St,"%SyntaxError%":Vs,"%ThrowTypeError%":Zx,"%TypedArray%":Hx,"%TypeError%":Hs,"%Uint8Array%":typeof Uint8Array>"u"?St:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?St:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?St:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?St:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?St:WeakMap,"%WeakRef%":typeof WeakRef>"u"?St:WeakRef,"%WeakSet%":typeof WeakSet>"u"?St:WeakSet};if(oe)try{null.error}catch(r){var Kx=oe(oe(r));qr["%Error.prototype%"]=Kx}var Yx=function r(t){var e;if(t==="%AsyncFunction%")e=Dl("async function () {}");else if(t==="%GeneratorFunction%")e=Dl("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=Dl("async function* () {}");else if(t==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(e=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=r("%AsyncGenerator%");s&&oe&&(e=oe(s.prototype))}return qr[t]=e,e},tp={"%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"]},Jn=kl,pa=Wx,zx=Jn.call(Function.call,Array.prototype.concat),jx=Jn.call(Function.apply,Array.prototype.splice),ep=Jn.call(Function.call,String.prototype.replace),ma=Jn.call(Function.call,String.prototype.slice),Jx=Jn.call(Function.call,RegExp.prototype.exec),$x=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Qx=/\\(\\)?/g,qx=function(t){var e=ma(t,0,1),i=ma(t,-1);if(e==="%"&&i!=="%")throw new Vs("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&e!=="%")throw new Vs("invalid intrinsic syntax, expected opening `%`");var s=[];return ep(t,$x,function(n,o,a,h){s[s.length]=a?ep(h,Qx,"$1"):o||n}),s},t_=function(t,e){var i=t,s;if(pa(tp,i)&&(s=tp[i],i="%"+s[0]+"%"),pa(qr,i)){var n=qr[i];if(n===Ys&&(n=Yx(i)),typeof n>"u"&&!e)throw new Hs("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:n}}throw new Vs("intrinsic "+t+" does not exist!")},Bl=function(t,e){if(typeof t!="string"||t.length===0)throw new Hs("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Hs('"allowMissing" argument must be a boolean');if(Jx(/^%?[^%]*%?$/,t)===null)throw new Vs("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=qx(t),s=i.length>0?i[0]:"",n=t_("%"+s+"%",e),o=n.name,a=n.value,h=!1,l=n.alias;l&&(s=l[0],jx(i,zx([0,1],l)));for(var c=1,u=!0;c<i.length;c+=1){var d=i[c],f=ma(d,0,1),p=ma(d,-1);if((f==='"'||f==="'"||f==="`"||p==='"'||p==="'"||p==="`")&&f!==p)throw new Vs("property names with quotes must have matching quotes");if((d==="constructor"||!u)&&(h=!0),s+="."+d,o="%"+s+"%",pa(qr,o))a=qr[o];else if(a!=null){if(!(d in a)){if(!e)throw new Hs("base intrinsic for "+t+" exists, but the property is not available.");return}if(Qr&&c+1>=i.length){var m=Qr(a,d);u=!!m,u&&"get"in m&&!("originalValue"in m.get)?a=m.get:a=a[d]}else u=pa(a,d),a=a[d];u&&!h&&(qr[o]=a)}}return a},ip={exports:{}};(function(r){var t=kl,e=Bl,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})(ip);var e_=ip.exports,rp=Bl,sp=e_,i_=sp(rp("String.prototype.indexOf")),r_=function(t,e){var i=rp(t,!!e);return typeof i=="function"&&i_(t,".prototype.")>-1?sp(i):i};const s_=ux(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Ul=typeof Map=="function"&&Map.prototype,Xl=Object.getOwnPropertyDescriptor&&Ul?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,ga=Ul&&Xl&&typeof Xl.get=="function"?Xl.get:null,np=Ul&&Map.prototype.forEach,Wl=typeof Set=="function"&&Set.prototype,Zl=Object.getOwnPropertyDescriptor&&Wl?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,ya=Wl&&Zl&&typeof Zl.get=="function"?Zl.get:null,op=Wl&&Set.prototype.forEach,n_=typeof WeakMap=="function"&&WeakMap.prototype,$n=n_?WeakMap.prototype.has:null,o_=typeof WeakSet=="function"&&WeakSet.prototype,Qn=o_?WeakSet.prototype.has:null,a_=typeof WeakRef=="function"&&WeakRef.prototype,ap=a_?WeakRef.prototype.deref:null,h_=Boolean.prototype.valueOf,l_=Object.prototype.toString,c_=Function.prototype.toString,u_=String.prototype.match,Vl=String.prototype.slice,vr=String.prototype.replace,d_=String.prototype.toUpperCase,hp=String.prototype.toLowerCase,lp=RegExp.prototype.test,cp=Array.prototype.concat,Ei=Array.prototype.join,f_=Array.prototype.slice,up=Math.floor,Hl=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Kl=Object.getOwnPropertySymbols,Yl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,zs=typeof Symbol=="function"&&typeof Symbol.iterator=="object",pe=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===zs||!0)?Symbol.toStringTag:null,dp=Object.prototype.propertyIsEnumerable,fp=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function pp(r,t){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||lp.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-up(-r):up(r);if(i!==r){var s=String(i),n=Vl.call(t,s.length+1);return vr.call(s,e,"$&_")+"."+vr.call(vr.call(n,/([0-9]{3})/g,"$&_"),/_$/,"")}}return vr.call(t,e,"$&_")}var zl=s_,mp=zl.custom,gp=xp(mp)?mp:null,p_=function r(t,e,i,s){var n=e||{};if(wr(n,"quoteStyle")&&n.quoteStyle!=="single"&&n.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(wr(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=wr(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(wr(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(wr(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 vp(t,n);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var h=String(t);return a?pp(t,h):h}if(typeof t=="bigint"){var l=String(t)+"n";return a?pp(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 jl(t)?"[Array]":"[Object]";var u=L_(n,i);if(typeof s>"u")s=[];else if(_p(s,t)>=0)return"[Circular]";function d(A,D,Z){if(D&&(s=f_.call(s),s.push(D)),Z){var K={depth:n.depth};return wr(n,"quoteStyle")&&(K.quoteStyle=n.quoteStyle),r(A,K,i+1,s)}return r(A,n,i+1,s)}if(typeof t=="function"&&!bp(t)){var f=T_(t),p=ba(t,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+Ei.call(p,", ")+" }":"")}if(xp(t)){var m=zs?vr.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Yl.call(t);return typeof t=="object"&&!zs?qn(m):m}if(M_(t)){for(var g="<"+hp.call(String(t.nodeName)),y=t.attributes||[],x=0;x<y.length;x++)g+=" "+y[x].name+"="+yp(m_(y[x].value),"double",n);return g+=">",t.childNodes&&t.childNodes.length&&(g+="..."),g+="</"+hp.call(String(t.nodeName))+">",g}if(jl(t)){if(t.length===0)return"[]";var b=ba(t,d);return u&&!P_(b)?"["+$l(b,u)+"]":"[ "+Ei.call(b,", ")+" ]"}if(y_(t)){var v=ba(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!dp.call(t,"cause")?"{ ["+String(t)+"] "+Ei.call(cp.call("[cause]: "+d(t.cause),v),", ")+" }":v.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+Ei.call(v,", ")+" }"}if(typeof t=="object"&&o){if(gp&&typeof t[gp]=="function"&&zl)return zl(t,{depth:c-i});if(o!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(S_(t)){var w=[];return np&&np.call(t,function(A,D){w.push(d(D,t,!0)+" => "+d(A,t))}),wp("Map",ga.call(t),w,u)}if(I_(t)){var S=[];return op&&op.call(t,function(A){S.push(d(A,t))}),wp("Set",ya.call(t),S,u)}if(E_(t))return Jl("WeakMap");if(A_(t))return Jl("WeakSet");if(C_(t))return Jl("WeakRef");if(x_(t))return qn(d(Number(t)));if(v_(t))return qn(d(Hl.call(t)));if(__(t))return qn(h_.call(t));if(b_(t))return qn(d(String(t)));if(!g_(t)&&!bp(t)){var C=ba(t,d),I=fp?fp(t)===Object.prototype:t instanceof Object||t.constructor===Object,M=t instanceof Object?"":"null prototype",L=!I&&pe&&Object(t)===t&&pe in t?Vl.call(Tr(t),8,-1):M?"Object":"",G=I||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",N=G+(L||M?"["+Ei.call(cp.call([],L||[],M||[]),": ")+"] ":"");return C.length===0?N+"{}":u?N+"{"+$l(C,u)+"}":N+"{ "+Ei.call(C,", ")+" }"}return String(t)};function yp(r,t,e){var i=(e.quoteStyle||t)==="double"?'"':"'";return i+r+i}function m_(r){return vr.call(String(r),/"/g,"&quot;")}function jl(r){return Tr(r)==="[object Array]"&&(!pe||!(typeof r=="object"&&pe in r))}function g_(r){return Tr(r)==="[object Date]"&&(!pe||!(typeof r=="object"&&pe in r))}function bp(r){return Tr(r)==="[object RegExp]"&&(!pe||!(typeof r=="object"&&pe in r))}function y_(r){return Tr(r)==="[object Error]"&&(!pe||!(typeof r=="object"&&pe in r))}function b_(r){return Tr(r)==="[object String]"&&(!pe||!(typeof r=="object"&&pe in r))}function x_(r){return Tr(r)==="[object Number]"&&(!pe||!(typeof r=="object"&&pe in r))}function __(r){return Tr(r)==="[object Boolean]"&&(!pe||!(typeof r=="object"&&pe in r))}function xp(r){if(zs)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!Yl)return!1;try{return Yl.call(r),!0}catch{}return!1}function v_(r){if(!r||typeof r!="object"||!Hl)return!1;try{return Hl.call(r),!0}catch{}return!1}var w_=Object.prototype.hasOwnProperty||function(r){return r in this};function wr(r,t){return w_.call(r,t)}function Tr(r){return l_.call(r)}function T_(r){if(r.name)return r.name;var t=u_.call(c_.call(r),/^function\s*([\w$]+)/);return t?t[1]:null}function _p(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 S_(r){if(!ga||!r||typeof r!="object")return!1;try{ga.call(r);try{ya.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function E_(r){if(!$n||!r||typeof r!="object")return!1;try{$n.call(r,$n);try{Qn.call(r,Qn)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function C_(r){if(!ap||!r||typeof r!="object")return!1;try{return ap.call(r),!0}catch{}return!1}function I_(r){if(!ya||!r||typeof r!="object")return!1;try{ya.call(r);try{ga.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function A_(r){if(!Qn||!r||typeof r!="object")return!1;try{Qn.call(r,Qn);try{$n.call(r,$n)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function M_(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function vp(r,t){if(r.length>t.maxStringLength){var e=r.length-t.maxStringLength,i="... "+e+" more character"+(e>1?"s":"");return vp(Vl.call(r,0,t.maxStringLength),t)+i}var s=vr.call(vr.call(r,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,R_);return yp(s,"single",t)}function R_(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":"")+d_.call(t.toString(16))}function qn(r){return"Object("+r+")"}function Jl(r){return r+" { ? }"}function wp(r,t,e,i){var s=i?$l(e,i):Ei.call(e,", ");return r+" ("+t+") {"+s+"}"}function P_(r){for(var t=0;t<r.length;t++)if(_p(r[t],`
2
- `)>=0)return!1;return!0}function L_(r,t){var e;if(r.indent===" ")e=" ";else if(typeof r.indent=="number"&&r.indent>0)e=Ei.call(Array(r.indent+1)," ");else return null;return{base:e,prev:Ei.call(Array(t+1),e)}}function $l(r,t){if(r.length===0)return"";var e=`
3
- `+t.prev+t.base;return e+Ei.call(r,","+e)+`
4
- `+t.prev}function ba(r,t){var e=jl(r),i=[];if(e){i.length=r.length;for(var s=0;s<r.length;s++)i[s]=wr(r,s)?t(r[s],r):""}var n=typeof Kl=="function"?Kl(r):[],o;if(zs){o={};for(var a=0;a<n.length;a++)o["$"+n[a]]=n[a]}for(var h in r)wr(r,h)&&(e&&String(Number(h))===h&&h<r.length||zs&&o["$"+h]instanceof Symbol||(lp.call(/[^\w$]/,h)?i.push(t(h,r)+": "+t(r[h],r)):i.push(h+": "+t(r[h],r))));if(typeof Kl=="function")for(var l=0;l<n.length;l++)dp.call(r,n[l])&&i.push("["+t(n[l])+"]: "+t(r[n[l]],r));return i}var Ql=Bl,js=r_,G_=p_,F_=Ql("%TypeError%"),xa=Ql("%WeakMap%",!0),_a=Ql("%Map%",!0),N_=js("WeakMap.prototype.get",!0),k_=js("WeakMap.prototype.set",!0),D_=js("WeakMap.prototype.has",!0),O_=js("Map.prototype.get",!0),B_=js("Map.prototype.set",!0),U_=js("Map.prototype.has",!0),ql=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},X_=function(r,t){var e=ql(r,t);return e&&e.value},W_=function(r,t,e){var i=ql(r,t);i?i.value=e:r.next={key:t,next:r.next,value:e}},Z_=function(r,t){return!!ql(r,t)},V_=function(){var t,e,i,s={assert:function(n){if(!s.has(n))throw new F_("Side channel does not contain "+G_(n))},get:function(n){if(xa&&n&&(typeof n=="object"||typeof n=="function")){if(t)return N_(t,n)}else if(_a){if(e)return O_(e,n)}else if(i)return X_(i,n)},has:function(n){if(xa&&n&&(typeof n=="object"||typeof n=="function")){if(t)return D_(t,n)}else if(_a){if(e)return U_(e,n)}else if(i)return Z_(i,n);return!1},set:function(n,o){xa&&n&&(typeof n=="object"||typeof n=="function")?(t||(t=new xa),k_(t,n,o)):_a?(e||(e=new _a),B_(e,n,o)):(i||(i={key:{},next:null}),W_(i,n,o))}};return s},H_=String.prototype.replace,K_=/%20/g,tc={RFC1738:"RFC1738",RFC3986:"RFC3986"},ec={default:tc.RFC3986,formatters:{RFC1738:function(r){return H_.call(r,K_,"+")},RFC3986:function(r){return String(r)}},RFC1738:tc.RFC1738,RFC3986:tc.RFC3986},Y_=ec,ic=Object.prototype.hasOwnProperty,ts=Array.isArray,Ci=function(){for(var r=[],t=0;t<256;++t)r.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return r}(),z_=function(t){for(;t.length>1;){var e=t.pop(),i=e.obj[e.prop];if(ts(i)){for(var s=[],n=0;n<i.length;++n)typeof i[n]<"u"&&s.push(i[n]);e.obj[e.prop]=s}}},Tp=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},j_=function r(t,e,i){if(!e)return t;if(typeof e!="object"){if(ts(t))t.push(e);else if(t&&typeof t=="object")(i&&(i.plainObjects||i.allowPrototypes)||!ic.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 ts(t)&&!ts(e)&&(s=Tp(t,i)),ts(t)&&ts(e)?(e.forEach(function(n,o){if(ic.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 ic.call(n,o)?n[o]=r(n[o],a,i):n[o]=a,n},s)},J_=function(t,e){return Object.keys(e).reduce(function(i,s){return i[s]=e[s],i},t)},$_=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}},Q_=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===Y_.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},q_=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 z_(e),t},t1=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},e1=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},i1=function(t,e){return[].concat(t,e)},r1=function(t,e){if(ts(t)){for(var i=[],s=0;s<t.length;s+=1)i.push(e(t[s]));return i}return e(t)},Sp={arrayToObject:Tp,assign:J_,combine:i1,compact:q_,decode:$_,encode:Q_,isBuffer:e1,isRegExp:t1,maybeMap:r1,merge:j_},Ep=V_,va=Sp,to=ec,s1=Object.prototype.hasOwnProperty,Cp={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},qi=Array.isArray,n1=Array.prototype.push,Ip=function(r,t){n1.apply(r,qi(t)?t:[t])},o1=Date.prototype.toISOString,Ap=to.default,me={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:va.encode,encodeValuesOnly:!1,format:Ap,formatter:to.formatters[Ap],indices:!1,serializeDate:function(t){return o1.call(t)},skipNulls:!1,strictNullHandling:!1},a1=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},rc={},h1=function r(t,e,i,s,n,o,a,h,l,c,u,d,f,p,m,g){for(var y=t,x=g,b=0,v=!1;(x=x.get(rc))!==void 0&&!v;){var w=x.get(t);if(b+=1,typeof w<"u"){if(w===b)throw new RangeError("Cyclic object value");v=!0}typeof x.get(rc)>"u"&&(b=0)}if(typeof h=="function"?y=h(e,y):y instanceof Date?y=u(y):i==="comma"&&qi(y)&&(y=va.maybeMap(y,function(K){return K instanceof Date?u(K):K})),y===null){if(n)return a&&!p?a(e,me.encoder,m,"key",d):e;y=""}if(a1(y)||va.isBuffer(y)){if(a){var S=p?e:a(e,me.encoder,m,"key",d);return[f(S)+"="+f(a(y,me.encoder,m,"value",d))]}return[f(e)+"="+f(String(y))]}var C=[];if(typeof y>"u")return C;var I;if(i==="comma"&&qi(y))p&&a&&(y=va.maybeMap(y,a)),I=[{value:y.length>0?y.join(",")||null:void 0}];else if(qi(h))I=h;else{var M=Object.keys(y);I=l?M.sort(l):M}for(var L=s&&qi(y)&&y.length===1?e+"[]":e,G=0;G<I.length;++G){var N=I[G],A=typeof N=="object"&&typeof N.value<"u"?N.value:y[N];if(!(o&&A===null)){var D=qi(y)?typeof i=="function"?i(L,N):L:L+(c?"."+N:"["+N+"]");g.set(t,b);var Z=Ep();Z.set(rc,g),Ip(C,r(A,D,i,s,n,o,i==="comma"&&p&&qi(y)?null:a,h,l,c,u,d,f,p,m,Z))}}return C},l1=function(t){if(!t)return me;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||me.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=to.default;if(typeof t.format<"u"){if(!s1.call(to.formatters,t.format))throw new TypeError("Unknown format option provided.");i=t.format}var s=to.formatters[i],n=me.filter;return(typeof t.filter=="function"||qi(t.filter))&&(n=t.filter),{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:me.addQueryPrefix,allowDots:typeof t.allowDots>"u"?me.allowDots:!!t.allowDots,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:me.charsetSentinel,delimiter:typeof t.delimiter>"u"?me.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:me.encode,encoder:typeof t.encoder=="function"?t.encoder:me.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:me.encodeValuesOnly,filter:n,format:i,formatter:s,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:me.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:me.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:me.strictNullHandling}},c1=function(r,t){var e=r,i=l1(t),s,n;typeof i.filter=="function"?(n=i.filter,e=n("",e)):qi(i.filter)&&(n=i.filter,s=n);var o=[];if(typeof e!="object"||e===null)return"";var a;t&&t.arrayFormat in Cp?a=t.arrayFormat:t&&"indices"in t?a=t.indices?"indices":"repeat":a="indices";var h=Cp[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=Ep(),u=0;u<s.length;++u){var d=s[u];i.skipNulls&&e[d]===null||Ip(o,h1(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),p=i.addQueryPrefix===!0?"?":"";return i.charsetSentinel&&(i.charset==="iso-8859-1"?p+="utf8=%26%2310003%3B&":p+="utf8=%E2%9C%93&"),f.length>0?p+f:""},Js=Sp,sc=Object.prototype.hasOwnProperty,u1=Array.isArray,ae={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:Js.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},d1=function(r){return r.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},Mp=function(r,t){return r&&typeof r=="string"&&t.comma&&r.indexOf(",")>-1?r.split(","):r},f1="utf8=%26%2310003%3B",p1="utf8=%E2%9C%93",m1=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]===p1?l="utf-8":o[h]===f1&&(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,p;d===-1?(f=e.decoder(c,ae.decoder,l,"key"),p=e.strictNullHandling?null:""):(f=e.decoder(c.slice(0,d),ae.decoder,l,"key"),p=Js.maybeMap(Mp(c.slice(d+1),e),function(m){return e.decoder(m,ae.decoder,l,"value")})),p&&e.interpretNumericEntities&&l==="iso-8859-1"&&(p=d1(p)),c.indexOf("[]=")>-1&&(p=u1(p)?[p]:p),sc.call(i,f)?i[f]=Js.combine(i[f],p):i[f]=p}return i},g1=function(r,t,e,i){for(var s=i?t:Mp(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},y1=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&&sc.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&&sc.call(Object.prototype,h[1].slice(1,-1))&&!i.allowPrototypes)return;c.push(h[1])}return h&&c.push("["+n.slice(h.index)+"]"),g1(c,e,i,s)}},b1=function(t){if(!t)return ae;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"?ae.charset:t.charset;return{allowDots:typeof t.allowDots>"u"?ae.allowDots:!!t.allowDots,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:ae.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:ae.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:ae.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:ae.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:ae.comma,decoder:typeof t.decoder=="function"?t.decoder:ae.decoder,delimiter:typeof t.delimiter=="string"||Js.isRegExp(t.delimiter)?t.delimiter:ae.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:ae.depth,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:ae.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:ae.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:ae.plainObjects,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:ae.strictNullHandling}},x1=function(r,t){var e=b1(t);if(r===""||r===null||typeof r>"u")return e.plainObjects?Object.create(null):{};for(var i=typeof r=="string"?m1(r,e):r,s=e.plainObjects?Object.create(null):{},n=Object.keys(i),o=0;o<n.length;++o){var a=n[o],h=y1(a,i[a],e,typeof r=="string");s=Js.merge(s,h,e)}return e.allowSparse===!0?s:Js.compact(s)},_1=c1,v1=x1,w1=ec,T1={formats:w1,parse:v1,stringify:_1},S1=Rx;function tr(){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 E1=/^([a-z0-9.+-]+:)/i,C1=/:[0-9]*$/,I1=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,A1=["<",">",'"',"`"," ","\r",`
5
- `," "],M1=["{","}","|","\\","^","`"].concat(A1),nc=["'"].concat(M1),Rp=["%","/","?",";","#"].concat(nc),Pp=["/","?","#"],R1=255,Lp=/^[+a-z0-9A-Z_-]{0,63}$/,P1=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,L1={javascript:!0,"javascript:":!0},oc={javascript:!0,"javascript:":!0},$s={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},ac=T1;function G1(r,t,e){if(r&&typeof r=="object"&&r instanceof tr)return r;var i=new tr;return i.parse(r,t,e),i}tr.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=I1.exec(a);if(h)return this.path=a,this.href=a,this.pathname=h[1],h[2]?(this.search=h[2],t?this.query=ac.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var l=E1.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&&oc[l])&&(a=a.substr(2),this.slashes=!0)}if(!oc[l]&&(u||l&&!$s[l])){for(var d=-1,f=0;f<Pp.length;f++){var p=a.indexOf(Pp[f]);p!==-1&&(d===-1||p<d)&&(d=p)}var m,g;d===-1?g=a.lastIndexOf("@"):g=a.lastIndexOf("@",d),g!==-1&&(m=a.slice(0,g),a=a.slice(g+1),this.auth=decodeURIComponent(m)),d=-1;for(var f=0;f<Rp.length;f++){var p=a.indexOf(Rp[f]);p!==-1&&(d===-1||p<d)&&(d=p)}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 x=this.hostname.split(/\./),f=0,b=x.length;f<b;f++){var v=x[f];if(v&&!v.match(Lp)){for(var w="",S=0,C=v.length;S<C;S++)v.charCodeAt(S)>127?w+="x":w+=v[S];if(!w.match(Lp)){var I=x.slice(0,f),M=x.slice(f+1),L=v.match(P1);L&&(I.push(L[1]),M.unshift(L[2])),M.length&&(a="/"+M.join(".")+a),this.hostname=I.join(".");break}}}this.hostname.length>R1?this.hostname="":this.hostname=this.hostname.toLowerCase(),y||(this.hostname=S1.toASCII(this.hostname));var G=this.port?":"+this.port:"",N=this.hostname||"";this.host=N+G,this.href+=this.host,y&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!L1[c])for(var f=0,b=nc.length;f<b;f++){var A=nc[f];if(a.indexOf(A)!==-1){var D=encodeURIComponent(A);D===A&&(D=escape(A)),a=a.split(A).join(D)}}var Z=a.indexOf("#");Z!==-1&&(this.hash=a.substr(Z),a=a.slice(0,Z));var K=a.indexOf("?");if(K!==-1?(this.search=a.substr(K),this.query=a.substr(K+1),t&&(this.query=ac.parse(this.query)),a=a.slice(0,K)):t&&(this.search="",this.query={}),a&&(this.pathname=a),$s[c]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var G=this.pathname||"",H=this.search||"";this.path=G+H}return this.href=this.format(),this},tr.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=ac.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var o=this.search||n&&"?"+n||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||$s[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},tr.prototype.resolve=function(r){return this.resolveObject(G1(r,!1,!0)).format()},tr.prototype.resolveObject=function(r){if(typeof r=="string"){var t=new tr;t.parse(r,!1,!0),r=t}for(var e=new tr,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 $s[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(!$s[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&&!oc[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 p=e.pathname&&e.pathname.charAt(0)==="/",m=r.host||r.pathname&&r.pathname.charAt(0)==="/",g=m||p||e.host&&r.pathname,y=g,x=e.pathname&&e.pathname.split("/")||[],b=r.pathname&&r.pathname.split("/")||[],v=e.protocol&&!$s[e.protocol];if(v&&(e.hostname="",e.port=null,e.host&&(x[0]===""?x[0]=e.host:x.unshift(e.host)),e.host="",r.protocol&&(r.hostname=null,r.port=null,r.host&&(b[0]===""?b[0]=r.host:b.unshift(r.host)),r.host=null),g=g&&(b[0]===""||x[0]==="")),m)e.host=r.host||r.host===""?r.host:e.host,e.hostname=r.hostname||r.hostname===""?r.hostname:e.hostname,e.search=r.search,e.query=r.query,x=b;else if(b.length)x||(x=[]),x.pop(),x=x.concat(b),e.search=r.search,e.query=r.query;else if(r.search!=null){if(v){e.host=x.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(!x.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var S=x.slice(-1)[0],C=(e.host||r.host||x.length>1)&&(S==="."||S==="..")||S==="",I=0,M=x.length;M>=0;M--)S=x[M],S==="."?x.splice(M,1):S===".."?(x.splice(M,1),I++):I&&(x.splice(M,1),I--);if(!g&&!y)for(;I--;I)x.unshift("..");g&&x[0]!==""&&(!x[0]||x[0].charAt(0)!=="/")&&x.unshift(""),C&&x.join("/").substr(-1)!=="/"&&x.push("");var L=x[0]===""||x[0]&&x[0].charAt(0)==="/";if(v){e.hostname=L?"":x.length?x.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&&x.length,g&&!L&&x.unshift(""),x.length>0?e.pathname=x.join("/"):(e.pathname=null,e.path=null),(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.auth=r.auth||e.auth,e.slashes=e.slashes||r.slashes,e.href=e.format(),e},tr.prototype.parseHost=function(){var r=this.host,t=C1.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 Gp={};function wt(r,t,e=3){if(Gp[t])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
6
- Deprecated since v${r}`):(i=i.split(`
1
+ (function(kt,Y){typeof exports=="object"&&typeof module<"u"?Y(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"],Y):(kt=typeof globalThis<"u"?globalThis:kt||self,Y(kt["prefect-graphs"]={},kt.Vue,kt.vueCompositions,kt.prefectDesign))})(this,function(kt,Y,wr,Ji){"use strict";var wP=Object.defineProperty;var TP=(kt,Y,wr)=>Y in kt?wP(kt,Y,{enumerable:!0,configurable:!0,writable:!0,value:wr}):kt[Y]=wr;var Ff=(kt,Y,wr)=>(TP(kt,typeof Y!="symbol"?Y+"":Y,wr),wr);const Zf="nodes-container",A1="node-container",M1="edge-container";function Rh(i){const t=Object.prototype.toString.call(i);return i instanceof Date||typeof i=="object"&&t==="[object Date]"?new i.constructor(+i):typeof i=="number"||t==="[object Number]"||typeof i=="string"||t==="[object String]"?new Date(i):new Date(NaN)}function R1(i,t){return i instanceof Date?new i.constructor(t):new Date(t)}function P1(i,t){const e=+Rh(i);return R1(i,e+t)}const ca=1e3;function L1(i,t){return P1(i,t*1e3)}function G1(i){return t=>{const r=(i?Math[i]:Math.trunc)(t);return r===0?0:r}}function Vf(i,t){return+Rh(i)-+Rh(t)}function k1(i,t,e){const r=Vf(i,t)/1e3;return G1(e==null?void 0:e.roundingMethod)(r)}var tn=(i=>(i[i.WEBGL_LEGACY=0]="WEBGL_LEGACY",i[i.WEBGL=1]="WEBGL",i[i.WEBGL2=2]="WEBGL2",i))(tn||{}),Hf=(i=>(i[i.UNKNOWN=0]="UNKNOWN",i[i.WEBGL=1]="WEBGL",i[i.CANVAS=2]="CANVAS",i))(Hf||{}),Ph=(i=>(i[i.COLOR=16384]="COLOR",i[i.DEPTH=256]="DEPTH",i[i.STENCIL=1024]="STENCIL",i))(Ph||{}),mt=(i=>(i[i.NORMAL=0]="NORMAL",i[i.ADD=1]="ADD",i[i.MULTIPLY=2]="MULTIPLY",i[i.SCREEN=3]="SCREEN",i[i.OVERLAY=4]="OVERLAY",i[i.DARKEN=5]="DARKEN",i[i.LIGHTEN=6]="LIGHTEN",i[i.COLOR_DODGE=7]="COLOR_DODGE",i[i.COLOR_BURN=8]="COLOR_BURN",i[i.HARD_LIGHT=9]="HARD_LIGHT",i[i.SOFT_LIGHT=10]="SOFT_LIGHT",i[i.DIFFERENCE=11]="DIFFERENCE",i[i.EXCLUSION=12]="EXCLUSION",i[i.HUE=13]="HUE",i[i.SATURATION=14]="SATURATION",i[i.COLOR=15]="COLOR",i[i.LUMINOSITY=16]="LUMINOSITY",i[i.NORMAL_NPM=17]="NORMAL_NPM",i[i.ADD_NPM=18]="ADD_NPM",i[i.SCREEN_NPM=19]="SCREEN_NPM",i[i.NONE=20]="NONE",i[i.SRC_OVER=0]="SRC_OVER",i[i.SRC_IN=21]="SRC_IN",i[i.SRC_OUT=22]="SRC_OUT",i[i.SRC_ATOP=23]="SRC_ATOP",i[i.DST_OVER=24]="DST_OVER",i[i.DST_IN=25]="DST_IN",i[i.DST_OUT=26]="DST_OUT",i[i.DST_ATOP=27]="DST_ATOP",i[i.ERASE=26]="ERASE",i[i.SUBTRACT=28]="SUBTRACT",i[i.XOR=29]="XOR",i))(mt||{}),vi=(i=>(i[i.POINTS=0]="POINTS",i[i.LINES=1]="LINES",i[i.LINE_LOOP=2]="LINE_LOOP",i[i.LINE_STRIP=3]="LINE_STRIP",i[i.TRIANGLES=4]="TRIANGLES",i[i.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",i[i.TRIANGLE_FAN=6]="TRIANGLE_FAN",i))(vi||{}),z=(i=>(i[i.RGBA=6408]="RGBA",i[i.RGB=6407]="RGB",i[i.RG=33319]="RG",i[i.RED=6403]="RED",i[i.RGBA_INTEGER=36249]="RGBA_INTEGER",i[i.RGB_INTEGER=36248]="RGB_INTEGER",i[i.RG_INTEGER=33320]="RG_INTEGER",i[i.RED_INTEGER=36244]="RED_INTEGER",i[i.ALPHA=6406]="ALPHA",i[i.LUMINANCE=6409]="LUMINANCE",i[i.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",i[i.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",i[i.DEPTH_STENCIL=34041]="DEPTH_STENCIL",i))(z||{}),Hn=(i=>(i[i.TEXTURE_2D=3553]="TEXTURE_2D",i[i.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",i[i.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",i[i.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",i[i.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",i[i.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",i[i.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",i))(Hn||{}),ct=(i=>(i[i.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",i[i.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",i[i.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",i[i.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",i[i.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",i[i.UNSIGNED_INT=5125]="UNSIGNED_INT",i[i.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",i[i.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",i[i.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",i[i.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",i[i.BYTE=5120]="BYTE",i[i.SHORT=5122]="SHORT",i[i.INT=5124]="INT",i[i.FLOAT=5126]="FLOAT",i[i.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",i[i.HALF_FLOAT=36193]="HALF_FLOAT",i))(ct||{}),rt=(i=>(i[i.FLOAT=0]="FLOAT",i[i.INT=1]="INT",i[i.UINT=2]="UINT",i))(rt||{}),$i=(i=>(i[i.NEAREST=0]="NEAREST",i[i.LINEAR=1]="LINEAR",i))($i||{}),wi=(i=>(i[i.CLAMP=33071]="CLAMP",i[i.REPEAT=10497]="REPEAT",i[i.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",i))(wi||{}),Ti=(i=>(i[i.OFF=0]="OFF",i[i.POW2=1]="POW2",i[i.ON=2]="ON",i[i.ON_MANUAL=3]="ON_MANUAL",i))(Ti||{}),Ce=(i=>(i[i.NPM=0]="NPM",i[i.UNPACK=1]="UNPACK",i[i.PMA=2]="PMA",i[i.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",i[i.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",i[i.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",i))(Ce||{}),Si=(i=>(i[i.NO=0]="NO",i[i.YES=1]="YES",i[i.AUTO=2]="AUTO",i[i.BLEND=0]="BLEND",i[i.CLEAR=1]="CLEAR",i[i.BLIT=2]="BLIT",i))(Si||{}),Lh=(i=>(i[i.AUTO=0]="AUTO",i[i.MANUAL=1]="MANUAL",i))(Lh||{}),Ye=(i=>(i.LOW="lowp",i.MEDIUM="mediump",i.HIGH="highp",i))(Ye||{}),re=(i=>(i[i.NONE=0]="NONE",i[i.SCISSOR=1]="SCISSOR",i[i.STENCIL=2]="STENCIL",i[i.SPRITE=3]="SPRITE",i[i.COLOR=4]="COLOR",i))(re||{}),$t=(i=>(i[i.NONE=0]="NONE",i[i.LOW=2]="LOW",i[i.MEDIUM=4]="MEDIUM",i[i.HIGH=8]="HIGH",i))($t||{}),Ei=(i=>(i[i.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",i[i.ARRAY_BUFFER=34962]="ARRAY_BUFFER",i[i.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",i))(Ei||{});const nt={ADAPTER:{createCanvas:(i,t)=>{const e=document.createElement("canvas");return e.width=i,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(i,t)=>fetch(i,t),parseXML:i=>new DOMParser().parseFromString(i,"text/xml")},RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};var Gh=/iPhone/i,Kf=/iPod/i,zf=/iPad/i,Yf=/\biOS-universal(?:.+)Mac\b/i,kh=/\bAndroid(?:.+)Mobile\b/i,jf=/Android/i,Kn=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,ua=/Silk/i,Qi=/Windows Phone/i,Jf=/\bWindows(?:.+)ARM\b/i,$f=/BlackBerry/i,Qf=/BB10/i,qf=/Opera Mini/i,tp=/\b(CriOS|Chrome)(?:.+)Mobile/i,ep=/Mobile(?:.+)Firefox\b/i,ip=function(i){return typeof i<"u"&&i.platform==="MacIntel"&&typeof i.maxTouchPoints=="number"&&i.maxTouchPoints>1&&typeof MSStream>"u"};function F1(i){return function(t){return t.test(i)}}function rp(i){var t={userAgent:"",platform:"",maxTouchPoints:0};!i&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof i=="string"?t.userAgent=i:i&&i.userAgent&&(t={userAgent:i.userAgent,platform:i.platform,maxTouchPoints:i.maxTouchPoints||0});var e=t.userAgent,r=e.split("[FBAN");typeof r[1]<"u"&&(e=r[0]),r=e.split("Twitter"),typeof r[1]<"u"&&(e=r[0]);var n=F1(e),s={apple:{phone:n(Gh)&&!n(Qi),ipod:n(Kf),tablet:!n(Gh)&&(n(zf)||ip(t))&&!n(Qi),universal:n(Yf),device:(n(Gh)||n(Kf)||n(zf)||n(Yf)||ip(t))&&!n(Qi)},amazon:{phone:n(Kn),tablet:!n(Kn)&&n(ua),device:n(Kn)||n(ua)},android:{phone:!n(Qi)&&n(Kn)||!n(Qi)&&n(kh),tablet:!n(Qi)&&!n(Kn)&&!n(kh)&&(n(ua)||n(jf)),device:!n(Qi)&&(n(Kn)||n(ua)||n(kh)||n(jf))||n(/\bokhttp\b/i)},windows:{phone:n(Qi),tablet:n(Jf),device:n(Qi)||n(Jf)},other:{blackberry:n($f),blackberry10:n(Qf),opera:n(qf),firefox:n(ep),chrome:n(tp),device:n($f)||n(Qf)||n(qf)||n(ep)||n(tp)},any:!1,phone:!1,tablet:!1};return s.any=s.apple.device||s.android.device||s.windows.device||s.other.device,s.phone=s.apple.phone||s.android.phone||s.windows.phone,s.tablet=s.apple.tablet||s.android.tablet||s.windows.tablet,s}const D1=rp.default??rp,qi=D1(globalThis.navigator);nt.RETINA_PREFIX=/@([0-9\.]+)x/,nt.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var we=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Tr(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}function N1(i){if(i.__esModule)return i;var t=i.default;if(typeof t=="function"){var e=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(i).forEach(function(r){var n=Object.getOwnPropertyDescriptor(i,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return i[r]}})}),e}var np={exports:{}};(function(i){var t=Object.prototype.hasOwnProperty,e="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(e=!1));function n(l,h,c){this.fn=l,this.context=h,this.once=c||!1}function s(l,h,c,u,d){if(typeof c!="function")throw new TypeError("The listener must be a function");var f=new n(c,u||l,d),p=e?e+h:h;return l._events[p]?l._events[p].fn?l._events[p]=[l._events[p],f]:l._events[p].push(f):(l._events[p]=f,l._eventsCount++),l}function o(l,h){--l._eventsCount===0?l._events=new r:delete l._events[h]}function a(){this._events=new r,this._eventsCount=0}a.prototype.eventNames=function(){var h=[],c,u;if(this._eventsCount===0)return h;for(u in c=this._events)t.call(c,u)&&h.push(e?u.slice(1):u);return Object.getOwnPropertySymbols?h.concat(Object.getOwnPropertySymbols(c)):h},a.prototype.listeners=function(h){var c=e?e+h:h,u=this._events[c];if(!u)return[];if(u.fn)return[u.fn];for(var d=0,f=u.length,p=new Array(f);d<f;d++)p[d]=u[d].fn;return p},a.prototype.listenerCount=function(h){var c=e?e+h:h,u=this._events[c];return u?u.fn?1:u.length:0},a.prototype.emit=function(h,c,u,d,f,p){var m=e?e+h:h;if(!this._events[m])return!1;var g=this._events[m],y=arguments.length,x,b;if(g.fn){switch(g.once&&this.removeListener(h,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,p),!0}for(b=1,x=new Array(y-1);b<y;b++)x[b-1]=arguments[b];g.fn.apply(g.context,x)}else{var v=g.length,w;for(b=0;b<v;b++)switch(g[b].once&&this.removeListener(h,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(!x)for(w=1,x=new Array(y-1);w<y;w++)x[w-1]=arguments[w];g[b].fn.apply(g[b].context,x)}}return!0},a.prototype.on=function(h,c,u){return s(this,h,c,u,!1)},a.prototype.once=function(h,c,u){return s(this,h,c,u,!0)},a.prototype.removeListener=function(h,c,u,d){var f=e?e+h:h;if(!this._events[f])return this;if(!c)return o(this,f),this;var p=this._events[f];if(p.fn)p.fn===c&&(!d||p.once)&&(!u||p.context===u)&&o(this,f);else{for(var m=0,g=[],y=p.length;m<y;m++)(p[m].fn!==c||d&&!p[m].once||u&&p[m].context!==u)&&g.push(p[m]);g.length?this._events[f]=g.length===1?g[0]:g:o(this,f)}return this},a.prototype.removeAllListeners=function(h){var c;return h?(c=e?e+h:h,this._events[c]&&o(this,c)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=e,a.EventEmitter=a,i.exports=a})(np);var O1=np.exports;const js=Tr(O1);var Fh={exports:{}};Fh.exports=da,Fh.exports.default=da;function da(i,t,e){e=e||2;var r=t&&t.length,n=r?t[0]*e:i.length,s=sp(i,0,n,e,!0),o=[];if(!s||s.next===s.prev)return o;var a,l,h,c,u,d,f;if(r&&(s=Z1(i,t,s,e)),i.length>80*e){a=h=i[0],l=c=i[1];for(var p=e;p<n;p+=e)u=i[p],d=i[p+1],u<a&&(a=u),d<l&&(l=d),u>h&&(h=u),d>c&&(c=d);f=Math.max(h-a,c-l),f=f!==0?32767/f:0}return Js(s,o,e,a,l,f,0),o}function sp(i,t,e,r,n){var s,o;if(n===Oh(i,t,e,r)>0)for(s=t;s<e;s+=r)o=lp(s,i[s],i[s+1],o);else for(s=e-r;s>=t;s-=r)o=lp(s,i[s],i[s+1],o);return o&&fa(o,o.next)&&(Qs(o),o=o.next),o}function en(i,t){if(!i)return i;t||(t=i);var e=i,r;do if(r=!1,!e.steiner&&(fa(e,e.next)||Wt(e.prev,e,e.next)===0)){if(Qs(e),e=t=e.prev,e===e.next)break;r=!0}else e=e.next;while(r||e!==t);return t}function Js(i,t,e,r,n,s,o){if(i){!o&&s&&Y1(i,r,n,s);for(var a=i,l,h;i.prev!==i.next;){if(l=i.prev,h=i.next,s?U1(i,r,n,s):B1(i)){t.push(l.i/e|0),t.push(i.i/e|0),t.push(h.i/e|0),Qs(i),i=h.next,a=h.next;continue}if(i=h,i===a){o?o===1?(i=X1(en(i),t,e),Js(i,t,e,r,n,s,2)):o===2&&W1(i,t,e,r,n,s):Js(en(i),t,e,r,n,s,1);break}}}}function B1(i){var t=i.prev,e=i,r=i.next;if(Wt(t,e,r)>=0)return!1;for(var n=t.x,s=e.x,o=r.x,a=t.y,l=e.y,h=r.y,c=n<s?n<o?n:o:s<o?s:o,u=a<l?a<h?a:h:l<h?l:h,d=n>s?n>o?n:o:s>o?s:o,f=a>l?a>h?a:h:l>h?l:h,p=r.next;p!==t;){if(p.x>=c&&p.x<=d&&p.y>=u&&p.y<=f&&zn(n,a,s,l,o,h,p.x,p.y)&&Wt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function U1(i,t,e,r){var n=i.prev,s=i,o=i.next;if(Wt(n,s,o)>=0)return!1;for(var a=n.x,l=s.x,h=o.x,c=n.y,u=s.y,d=o.y,f=a<l?a<h?a:h:l<h?l:h,p=c<u?c<d?c:d:u<d?u:d,m=a>l?a>h?a:h:l>h?l:h,g=c>u?c>d?c:d:u>d?u:d,y=Dh(f,p,t,e,r),x=Dh(m,g,t,e,r),b=i.prevZ,v=i.nextZ;b&&b.z>=y&&v&&v.z<=x;){if(b.x>=f&&b.x<=m&&b.y>=p&&b.y<=g&&b!==n&&b!==o&&zn(a,c,l,u,h,d,b.x,b.y)&&Wt(b.prev,b,b.next)>=0||(b=b.prevZ,v.x>=f&&v.x<=m&&v.y>=p&&v.y<=g&&v!==n&&v!==o&&zn(a,c,l,u,h,d,v.x,v.y)&&Wt(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;b&&b.z>=y;){if(b.x>=f&&b.x<=m&&b.y>=p&&b.y<=g&&b!==n&&b!==o&&zn(a,c,l,u,h,d,b.x,b.y)&&Wt(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;v&&v.z<=x;){if(v.x>=f&&v.x<=m&&v.y>=p&&v.y<=g&&v!==n&&v!==o&&zn(a,c,l,u,h,d,v.x,v.y)&&Wt(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function X1(i,t,e){var r=i;do{var n=r.prev,s=r.next.next;!fa(n,s)&&op(n,r,r.next,s)&&$s(n,s)&&$s(s,n)&&(t.push(n.i/e|0),t.push(r.i/e|0),t.push(s.i/e|0),Qs(r),Qs(r.next),r=i=s),r=r.next}while(r!==i);return en(r)}function W1(i,t,e,r,n,s){var o=i;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&$1(o,a)){var l=ap(o,a);o=en(o,o.next),l=en(l,l.next),Js(o,t,e,r,n,s,0),Js(l,t,e,r,n,s,0);return}a=a.next}o=o.next}while(o!==i)}function Z1(i,t,e,r){var n=[],s,o,a,l,h;for(s=0,o=t.length;s<o;s++)a=t[s]*r,l=s<o-1?t[s+1]*r:i.length,h=sp(i,a,l,r,!1),h===h.next&&(h.steiner=!0),n.push(J1(h));for(n.sort(V1),s=0;s<n.length;s++)e=H1(n[s],e);return e}function V1(i,t){return i.x-t.x}function H1(i,t){var e=K1(i,t);if(!e)return t;var r=ap(e,i);return en(r,r.next),en(e,e.next)}function K1(i,t){var e=t,r=i.x,n=i.y,s=-1/0,o;do{if(n<=e.y&&n>=e.next.y&&e.next.y!==e.y){var a=e.x+(n-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(a<=r&&a>s&&(s=a,o=e.x<e.next.x?e:e.next,a===r))return o}e=e.next}while(e!==t);if(!o)return null;var l=o,h=o.x,c=o.y,u=1/0,d;e=o;do r>=e.x&&e.x>=h&&r!==e.x&&zn(n<c?r:s,n,h,c,n<c?s:r,n,e.x,e.y)&&(d=Math.abs(n-e.y)/(r-e.x),$s(e,i)&&(d<u||d===u&&(e.x>o.x||e.x===o.x&&z1(o,e)))&&(o=e,u=d)),e=e.next;while(e!==l);return o}function z1(i,t){return Wt(i.prev,i,t.prev)<0&&Wt(t.next,i,i.next)<0}function Y1(i,t,e,r){var n=i;do n.z===0&&(n.z=Dh(n.x,n.y,t,e,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==i);n.prevZ.nextZ=null,n.prevZ=null,j1(n)}function j1(i){var t,e,r,n,s,o,a,l,h=1;do{for(e=i,i=null,s=null,o=0;e;){for(o++,r=e,a=0,t=0;t<h&&(a++,r=r.nextZ,!!r);t++);for(l=h;a>0||l>0&&r;)a!==0&&(l===0||!r||e.z<=r.z)?(n=e,e=e.nextZ,a--):(n=r,r=r.nextZ,l--),s?s.nextZ=n:i=n,n.prevZ=s,s=n;e=r}s.nextZ=null,h*=2}while(o>1);return i}function Dh(i,t,e,r,n){return i=(i-e)*n|0,t=(t-r)*n|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,i|t<<1}function J1(i){var t=i,e=i;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==i);return e}function zn(i,t,e,r,n,s,o,a){return(n-o)*(t-a)>=(i-o)*(s-a)&&(i-o)*(r-a)>=(e-o)*(t-a)&&(e-o)*(s-a)>=(n-o)*(r-a)}function $1(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!Q1(i,t)&&($s(i,t)&&$s(t,i)&&q1(i,t)&&(Wt(i.prev,i,t.prev)||Wt(i,t.prev,t))||fa(i,t)&&Wt(i.prev,i,i.next)>0&&Wt(t.prev,t,t.next)>0)}function Wt(i,t,e){return(t.y-i.y)*(e.x-t.x)-(t.x-i.x)*(e.y-t.y)}function fa(i,t){return i.x===t.x&&i.y===t.y}function op(i,t,e,r){var n=ma(Wt(i,t,e)),s=ma(Wt(i,t,r)),o=ma(Wt(e,r,i)),a=ma(Wt(e,r,t));return!!(n!==s&&o!==a||n===0&&pa(i,e,t)||s===0&&pa(i,r,t)||o===0&&pa(e,i,r)||a===0&&pa(e,t,r))}function pa(i,t,e){return t.x<=Math.max(i.x,e.x)&&t.x>=Math.min(i.x,e.x)&&t.y<=Math.max(i.y,e.y)&&t.y>=Math.min(i.y,e.y)}function ma(i){return i>0?1:i<0?-1:0}function Q1(i,t){var e=i;do{if(e.i!==i.i&&e.next.i!==i.i&&e.i!==t.i&&e.next.i!==t.i&&op(e,e.next,i,t))return!0;e=e.next}while(e!==i);return!1}function $s(i,t){return Wt(i.prev,i,i.next)<0?Wt(i,t,i.next)>=0&&Wt(i,i.prev,t)>=0:Wt(i,t,i.prev)<0||Wt(i,i.next,t)<0}function q1(i,t){var e=i,r=!1,n=(i.x+t.x)/2,s=(i.y+t.y)/2;do e.y>s!=e.next.y>s&&e.next.y!==e.y&&n<(e.next.x-e.x)*(s-e.y)/(e.next.y-e.y)+e.x&&(r=!r),e=e.next;while(e!==i);return r}function ap(i,t){var e=new Nh(i.i,i.x,i.y),r=new Nh(t.i,t.x,t.y),n=i.next,s=t.prev;return i.next=t,t.prev=i,e.next=n,n.prev=e,r.next=e,e.prev=r,s.next=r,r.prev=s,r}function lp(i,t,e,r){var n=new Nh(i,t,e);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function Qs(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function Nh(i,t,e){this.i=i,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}da.deviation=function(i,t,e,r){var n=t&&t.length,s=n?t[0]*e:i.length,o=Math.abs(Oh(i,0,s,e));if(n)for(var a=0,l=t.length;a<l;a++){var h=t[a]*e,c=a<l-1?t[a+1]*e:i.length;o-=Math.abs(Oh(i,h,c,e))}var u=0;for(a=0;a<r.length;a+=3){var d=r[a]*e,f=r[a+1]*e,p=r[a+2]*e;u+=Math.abs((i[d]-i[p])*(i[f+1]-i[d+1])-(i[d]-i[f])*(i[p+1]-i[d+1]))}return o===0&&u===0?0:Math.abs((u-o)/o)};function Oh(i,t,e,r){for(var n=0,s=t,o=e-r;s<e;s+=r)n+=(i[o]-i[s])*(i[s+1]+i[o+1]),o=s;return n}da.flatten=function(i){for(var t=i[0][0].length,e={vertices:[],holes:[],dimensions:t},r=0,n=0;n<i.length;n++){for(var s=0;s<i[n].length;s++)for(var o=0;o<t;o++)e.vertices.push(i[n][s][o]);n>0&&(r+=i[n-1].length,e.holes.push(r))}return e};var tx=Fh.exports;const ex=Tr(tx);var ga={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */ga.exports,function(i,t){(function(e){var r=t&&!t.nodeType&&t,n=i&&!i.nodeType&&i,s=typeof we=="object"&&we;(s.global===s||s.window===s||s.self===s)&&(e=s);var o,a=2147483647,l=36,h=1,c=26,u=38,d=700,f=72,p=128,m="-",g=/^xn--/,y=/[^\x20-\x7E]/,x=/[\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=l-h,w=Math.floor,S=String.fromCharCode,C;function I(D){throw new RangeError(b[D])}function M(D,k){for(var V=D.length,et=[];V--;)et[V]=k(D[V]);return et}function L(D,k){var V=D.split("@"),et="";V.length>1&&(et=V[0]+"@",D=V[1]),D=D.replace(x,".");var ft=D.split("."),at=M(ft,k).join(".");return et+at}function G(D){for(var k=[],V=0,et=D.length,ft,at;V<et;)ft=D.charCodeAt(V++),ft>=55296&&ft<=56319&&V<et?(at=D.charCodeAt(V++),(at&64512)==56320?k.push(((ft&1023)<<10)+(at&1023)+65536):(k.push(ft),V--)):k.push(ft);return k}function F(D){return M(D,function(k){var V="";return k>65535&&(k-=65536,V+=S(k>>>10&1023|55296),k=56320|k&1023),V+=S(k),V}).join("")}function A(D){return D-48<10?D-22:D-65<26?D-65:D-97<26?D-97:l}function N(D,k){return D+22+75*(D<26)-((k!=0)<<5)}function Z(D,k,V){var et=0;for(D=V?w(D/d):D>>1,D+=w(D/k);D>v*c>>1;et+=l)D=w(D/v);return w(et+(v+1)*D/(D+u))}function K(D){var k=[],V=D.length,et,ft=0,at=p,Tt=f,It,Q,W,J,$,O,pt,yt,Rt;for(It=D.lastIndexOf(m),It<0&&(It=0),Q=0;Q<It;++Q)D.charCodeAt(Q)>=128&&I("not-basic"),k.push(D.charCodeAt(Q));for(W=It>0?It+1:0;W<V;){for(J=ft,$=1,O=l;W>=V&&I("invalid-input"),pt=A(D.charCodeAt(W++)),(pt>=l||pt>w((a-ft)/$))&&I("overflow"),ft+=pt*$,yt=O<=Tt?h:O>=Tt+c?c:O-Tt,!(pt<yt);O+=l)Rt=l-yt,$>w(a/Rt)&&I("overflow"),$*=Rt;et=k.length+1,Tt=Z(ft-J,et,J==0),w(ft/et)>a-at&&I("overflow"),at+=w(ft/et),ft%=et,k.splice(ft++,0,at)}return F(k)}function H(D){var k,V,et,ft,at,Tt,It,Q,W,J,$,O=[],pt,yt,Rt,Bt;for(D=G(D),pt=D.length,k=p,V=0,at=f,Tt=0;Tt<pt;++Tt)$=D[Tt],$<128&&O.push(S($));for(et=ft=O.length,ft&&O.push(m);et<pt;){for(It=a,Tt=0;Tt<pt;++Tt)$=D[Tt],$>=k&&$<It&&(It=$);for(yt=et+1,It-k>w((a-V)/yt)&&I("overflow"),V+=(It-k)*yt,k=It,Tt=0;Tt<pt;++Tt)if($=D[Tt],$<k&&++V>a&&I("overflow"),$==k){for(Q=V,W=l;J=W<=at?h:W>=at+c?c:W-at,!(Q<J);W+=l)Bt=Q-J,Rt=l-J,O.push(S(N(J+Bt%Rt,0))),Q=w(Bt/Rt);O.push(S(N(Q,0))),at=Z(V,yt,et==ft),V=0,++et}++V,++k}return O.join("")}function j(D){return L(D,function(k){return g.test(k)?K(k.slice(4).toLowerCase()):k})}function B(D){return L(D,function(k){return y.test(k)?"xn--"+H(k):k})}if(o={version:"1.4.1",ucs2:{decode:G,encode:F},decode:K,encode:H,toASCII:B,toUnicode:j},r&&n)if(i.exports==r)n.exports=o;else for(C in o)o.hasOwnProperty(C)&&(r[C]=o[C]);else e.punycode=o})(we)}(ga,ga.exports);var ix=ga.exports,rx=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),r=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var n=42;t[e]=n;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 s=Object.getOwnPropertySymbols(t);if(s.length!==1||s[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(t,e);if(o.value!==n||o.enumerable!==!0)return!1}return!0},hp=typeof Symbol<"u"&&Symbol,nx=rx,sx=function(){return typeof hp!="function"||typeof Symbol!="function"||typeof hp("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:nx()},cp={foo:{}},ox=Object,ax=function(){return{__proto__:cp}.foo===cp.foo&&!({__proto__:null}instanceof ox)},lx="Function.prototype.bind called on incompatible ",Bh=Array.prototype.slice,hx=Object.prototype.toString,cx="[object Function]",ux=function(t){var e=this;if(typeof e!="function"||hx.call(e)!==cx)throw new TypeError(lx+e);for(var r=Bh.call(arguments,1),n,s=function(){if(this instanceof n){var c=e.apply(this,r.concat(Bh.call(arguments)));return Object(c)===c?c:this}else return e.apply(t,r.concat(Bh.call(arguments)))},o=Math.max(0,e.length-r.length),a=[],l=0;l<o;l++)a.push("$"+l);if(n=Function("binder","return function ("+a.join(",")+"){ return binder.apply(this,arguments); }")(s),e.prototype){var h=function(){};h.prototype=e.prototype,n.prototype=new h,h.prototype=null}return n},dx=ux,Uh=Function.prototype.bind||dx,fx=Uh,px=fx.call(Function.call,Object.prototype.hasOwnProperty),St,Yn=SyntaxError,up=Function,jn=TypeError,Xh=function(i){try{return up('"use strict"; return ('+i+").constructor;")()}catch{}},rn=Object.getOwnPropertyDescriptor;if(rn)try{rn({},"")}catch{rn=null}var Wh=function(){throw new jn},mx=rn?function(){try{return arguments.callee,Wh}catch{try{return rn(arguments,"callee").get}catch{return Wh}}}():Wh,Jn=sx(),gx=ax(),ae=Object.getPrototypeOf||(gx?function(i){return i.__proto__}:null),$n={},yx=typeof Uint8Array>"u"||!ae?St:ae(Uint8Array),nn={"%AggregateError%":typeof AggregateError>"u"?St:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?St:ArrayBuffer,"%ArrayIteratorPrototype%":Jn&&ae?ae([][Symbol.iterator]()):St,"%AsyncFromSyncIteratorPrototype%":St,"%AsyncFunction%":$n,"%AsyncGenerator%":$n,"%AsyncGeneratorFunction%":$n,"%AsyncIteratorPrototype%":$n,"%Atomics%":typeof Atomics>"u"?St:Atomics,"%BigInt%":typeof BigInt>"u"?St:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?St:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?St:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?St:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?St:Float32Array,"%Float64Array%":typeof Float64Array>"u"?St:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?St:FinalizationRegistry,"%Function%":up,"%GeneratorFunction%":$n,"%Int8Array%":typeof Int8Array>"u"?St:Int8Array,"%Int16Array%":typeof Int16Array>"u"?St:Int16Array,"%Int32Array%":typeof Int32Array>"u"?St:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Jn&&ae?ae(ae([][Symbol.iterator]())):St,"%JSON%":typeof JSON=="object"?JSON:St,"%Map%":typeof Map>"u"?St:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Jn||!ae?St:ae(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?St:Promise,"%Proxy%":typeof Proxy>"u"?St:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?St:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?St:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Jn||!ae?St:ae(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?St:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Jn&&ae?ae(""[Symbol.iterator]()):St,"%Symbol%":Jn?Symbol:St,"%SyntaxError%":Yn,"%ThrowTypeError%":mx,"%TypedArray%":yx,"%TypeError%":jn,"%Uint8Array%":typeof Uint8Array>"u"?St:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?St:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?St:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?St:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?St:WeakMap,"%WeakRef%":typeof WeakRef>"u"?St:WeakRef,"%WeakSet%":typeof WeakSet>"u"?St:WeakSet};if(ae)try{null.error}catch(i){var bx=ae(ae(i));nn["%Error.prototype%"]=bx}var xx=function i(t){var e;if(t==="%AsyncFunction%")e=Xh("async function () {}");else if(t==="%GeneratorFunction%")e=Xh("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=Xh("async function* () {}");else if(t==="%AsyncGenerator%"){var r=i("%AsyncGeneratorFunction%");r&&(e=r.prototype)}else if(t==="%AsyncIteratorPrototype%"){var n=i("%AsyncGenerator%");n&&ae&&(e=ae(n.prototype))}return nn[t]=e,e},dp={"%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"]},qs=Uh,ya=px,_x=qs.call(Function.call,Array.prototype.concat),vx=qs.call(Function.apply,Array.prototype.splice),fp=qs.call(Function.call,String.prototype.replace),ba=qs.call(Function.call,String.prototype.slice),wx=qs.call(Function.call,RegExp.prototype.exec),Tx=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Sx=/\\(\\)?/g,Ex=function(t){var e=ba(t,0,1),r=ba(t,-1);if(e==="%"&&r!=="%")throw new Yn("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&e!=="%")throw new Yn("invalid intrinsic syntax, expected opening `%`");var n=[];return fp(t,Tx,function(s,o,a,l){n[n.length]=a?fp(l,Sx,"$1"):o||s}),n},Cx=function(t,e){var r=t,n;if(ya(dp,r)&&(n=dp[r],r="%"+n[0]+"%"),ya(nn,r)){var s=nn[r];if(s===$n&&(s=xx(r)),typeof s>"u"&&!e)throw new jn("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:n,name:r,value:s}}throw new Yn("intrinsic "+t+" does not exist!")},Zh=function(t,e){if(typeof t!="string"||t.length===0)throw new jn("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new jn('"allowMissing" argument must be a boolean');if(wx(/^%?[^%]*%?$/,t)===null)throw new Yn("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=Ex(t),n=r.length>0?r[0]:"",s=Cx("%"+n+"%",e),o=s.name,a=s.value,l=!1,h=s.alias;h&&(n=h[0],vx(r,_x([0,1],h)));for(var c=1,u=!0;c<r.length;c+=1){var d=r[c],f=ba(d,0,1),p=ba(d,-1);if((f==='"'||f==="'"||f==="`"||p==='"'||p==="'"||p==="`")&&f!==p)throw new Yn("property names with quotes must have matching quotes");if((d==="constructor"||!u)&&(l=!0),n+="."+d,o="%"+n+"%",ya(nn,o))a=nn[o];else if(a!=null){if(!(d in a)){if(!e)throw new jn("base intrinsic for "+t+" exists, but the property is not available.");return}if(rn&&c+1>=r.length){var m=rn(a,d);u=!!m,u&&"get"in m&&!("originalValue"in m.get)?a=m.get:a=a[d]}else u=ya(a,d),a=a[d];u&&!l&&(nn[o]=a)}}return a},pp={exports:{}};(function(i){var t=Uh,e=Zh,r=e("%Function.prototype.apply%"),n=e("%Function.prototype.call%"),s=e("%Reflect.apply%",!0)||t.call(n,r),o=e("%Object.getOwnPropertyDescriptor%",!0),a=e("%Object.defineProperty%",!0),l=e("%Math.max%");if(a)try{a({},"a",{value:1})}catch{a=null}i.exports=function(u){var d=s(t,n,arguments);if(o&&a){var f=o(d,"length");f.configurable&&a(d,"length",{value:1+l(0,u.length-(arguments.length-1))})}return d};var h=function(){return s(t,r,arguments)};a?a(i.exports,"apply",{value:h}):i.exports.apply=h})(pp);var Ix=pp.exports,mp=Zh,gp=Ix,Ax=gp(mp("String.prototype.indexOf")),Mx=function(t,e){var r=mp(t,!!e);return typeof r=="function"&&Ax(t,".prototype.")>-1?gp(r):r};const Rx=N1(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Vh=typeof Map=="function"&&Map.prototype,Hh=Object.getOwnPropertyDescriptor&&Vh?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,xa=Vh&&Hh&&typeof Hh.get=="function"?Hh.get:null,yp=Vh&&Map.prototype.forEach,Kh=typeof Set=="function"&&Set.prototype,zh=Object.getOwnPropertyDescriptor&&Kh?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,_a=Kh&&zh&&typeof zh.get=="function"?zh.get:null,bp=Kh&&Set.prototype.forEach,Px=typeof WeakMap=="function"&&WeakMap.prototype,to=Px?WeakMap.prototype.has:null,Lx=typeof WeakSet=="function"&&WeakSet.prototype,eo=Lx?WeakSet.prototype.has:null,Gx=typeof WeakRef=="function"&&WeakRef.prototype,xp=Gx?WeakRef.prototype.deref:null,kx=Boolean.prototype.valueOf,Fx=Object.prototype.toString,Dx=Function.prototype.toString,Nx=String.prototype.match,Yh=String.prototype.slice,Sr=String.prototype.replace,Ox=String.prototype.toUpperCase,_p=String.prototype.toLowerCase,vp=RegExp.prototype.test,wp=Array.prototype.concat,Ci=Array.prototype.join,Bx=Array.prototype.slice,Tp=Math.floor,jh=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Jh=Object.getOwnPropertySymbols,$h=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Qn=typeof Symbol=="function"&&typeof Symbol.iterator=="object",me=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Qn||!0)?Symbol.toStringTag:null,Sp=Object.prototype.propertyIsEnumerable,Ep=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(i){return i.__proto__}:null);function Cp(i,t){if(i===1/0||i===-1/0||i!==i||i&&i>-1e3&&i<1e3||vp.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof i=="number"){var r=i<0?-Tp(-i):Tp(i);if(r!==i){var n=String(r),s=Yh.call(t,n.length+1);return Sr.call(n,e,"$&_")+"."+Sr.call(Sr.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Sr.call(t,e,"$&_")}var Qh=Rx,Ip=Qh.custom,Ap=Pp(Ip)?Ip:null,Ux=function i(t,e,r,n){var s=e||{};if(Er(s,"quoteStyle")&&s.quoteStyle!=="single"&&s.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Er(s,"maxStringLength")&&(typeof s.maxStringLength=="number"?s.maxStringLength<0&&s.maxStringLength!==1/0:s.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var o=Er(s,"customInspect")?s.customInspect:!0;if(typeof o!="boolean"&&o!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Er(s,"indent")&&s.indent!==null&&s.indent!==" "&&!(parseInt(s.indent,10)===s.indent&&s.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Er(s,"numericSeparator")&&typeof s.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=s.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 Gp(t,s);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var l=String(t);return a?Cp(t,l):l}if(typeof t=="bigint"){var h=String(t)+"n";return a?Cp(t,h):h}var c=typeof s.depth>"u"?5:s.depth;if(typeof r>"u"&&(r=0),r>=c&&c>0&&typeof t=="object")return qh(t)?"[Array]":"[Object]";var u=n_(s,r);if(typeof n>"u")n=[];else if(Lp(n,t)>=0)return"[Circular]";function d(A,N,Z){if(N&&(n=Bx.call(n),n.push(N)),Z){var K={depth:s.depth};return Er(s,"quoteStyle")&&(K.quoteStyle=s.quoteStyle),i(A,K,r+1,n)}return i(A,s,r+1,n)}if(typeof t=="function"&&!Rp(t)){var f=jx(t),p=va(t,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+Ci.call(p,", ")+" }":"")}if(Pp(t)){var m=Qn?Sr.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):$h.call(t);return typeof t=="object"&&!Qn?io(m):m}if(e_(t)){for(var g="<"+_p.call(String(t.nodeName)),y=t.attributes||[],x=0;x<y.length;x++)g+=" "+y[x].name+"="+Mp(Xx(y[x].value),"double",s);return g+=">",t.childNodes&&t.childNodes.length&&(g+="..."),g+="</"+_p.call(String(t.nodeName))+">",g}if(qh(t)){if(t.length===0)return"[]";var b=va(t,d);return u&&!r_(b)?"["+ec(b,u)+"]":"[ "+Ci.call(b,", ")+" ]"}if(Zx(t)){var v=va(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!Sp.call(t,"cause")?"{ ["+String(t)+"] "+Ci.call(wp.call("[cause]: "+d(t.cause),v),", ")+" }":v.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+Ci.call(v,", ")+" }"}if(typeof t=="object"&&o){if(Ap&&typeof t[Ap]=="function"&&Qh)return Qh(t,{depth:c-r});if(o!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(Jx(t)){var w=[];return yp&&yp.call(t,function(A,N){w.push(d(N,t,!0)+" => "+d(A,t))}),kp("Map",xa.call(t),w,u)}if(qx(t)){var S=[];return bp&&bp.call(t,function(A){S.push(d(A,t))}),kp("Set",_a.call(t),S,u)}if($x(t))return tc("WeakMap");if(t_(t))return tc("WeakSet");if(Qx(t))return tc("WeakRef");if(Hx(t))return io(d(Number(t)));if(zx(t))return io(d(jh.call(t)));if(Kx(t))return io(kx.call(t));if(Vx(t))return io(d(String(t)));if(!Wx(t)&&!Rp(t)){var C=va(t,d),I=Ep?Ep(t)===Object.prototype:t instanceof Object||t.constructor===Object,M=t instanceof Object?"":"null prototype",L=!I&&me&&Object(t)===t&&me in t?Yh.call(Cr(t),8,-1):M?"Object":"",G=I||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",F=G+(L||M?"["+Ci.call(wp.call([],L||[],M||[]),": ")+"] ":"");return C.length===0?F+"{}":u?F+"{"+ec(C,u)+"}":F+"{ "+Ci.call(C,", ")+" }"}return String(t)};function Mp(i,t,e){var r=(e.quoteStyle||t)==="double"?'"':"'";return r+i+r}function Xx(i){return Sr.call(String(i),/"/g,"&quot;")}function qh(i){return Cr(i)==="[object Array]"&&(!me||!(typeof i=="object"&&me in i))}function Wx(i){return Cr(i)==="[object Date]"&&(!me||!(typeof i=="object"&&me in i))}function Rp(i){return Cr(i)==="[object RegExp]"&&(!me||!(typeof i=="object"&&me in i))}function Zx(i){return Cr(i)==="[object Error]"&&(!me||!(typeof i=="object"&&me in i))}function Vx(i){return Cr(i)==="[object String]"&&(!me||!(typeof i=="object"&&me in i))}function Hx(i){return Cr(i)==="[object Number]"&&(!me||!(typeof i=="object"&&me in i))}function Kx(i){return Cr(i)==="[object Boolean]"&&(!me||!(typeof i=="object"&&me in i))}function Pp(i){if(Qn)return i&&typeof i=="object"&&i instanceof Symbol;if(typeof i=="symbol")return!0;if(!i||typeof i!="object"||!$h)return!1;try{return $h.call(i),!0}catch{}return!1}function zx(i){if(!i||typeof i!="object"||!jh)return!1;try{return jh.call(i),!0}catch{}return!1}var Yx=Object.prototype.hasOwnProperty||function(i){return i in this};function Er(i,t){return Yx.call(i,t)}function Cr(i){return Fx.call(i)}function jx(i){if(i.name)return i.name;var t=Nx.call(Dx.call(i),/^function\s*([\w$]+)/);return t?t[1]:null}function Lp(i,t){if(i.indexOf)return i.indexOf(t);for(var e=0,r=i.length;e<r;e++)if(i[e]===t)return e;return-1}function Jx(i){if(!xa||!i||typeof i!="object")return!1;try{xa.call(i);try{_a.call(i)}catch{return!0}return i instanceof Map}catch{}return!1}function $x(i){if(!to||!i||typeof i!="object")return!1;try{to.call(i,to);try{eo.call(i,eo)}catch{return!0}return i instanceof WeakMap}catch{}return!1}function Qx(i){if(!xp||!i||typeof i!="object")return!1;try{return xp.call(i),!0}catch{}return!1}function qx(i){if(!_a||!i||typeof i!="object")return!1;try{_a.call(i);try{xa.call(i)}catch{return!0}return i instanceof Set}catch{}return!1}function t_(i){if(!eo||!i||typeof i!="object")return!1;try{eo.call(i,eo);try{to.call(i,to)}catch{return!0}return i instanceof WeakSet}catch{}return!1}function e_(i){return!i||typeof i!="object"?!1:typeof HTMLElement<"u"&&i instanceof HTMLElement?!0:typeof i.nodeName=="string"&&typeof i.getAttribute=="function"}function Gp(i,t){if(i.length>t.maxStringLength){var e=i.length-t.maxStringLength,r="... "+e+" more character"+(e>1?"s":"");return Gp(Yh.call(i,0,t.maxStringLength),t)+r}var n=Sr.call(Sr.call(i,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,i_);return Mp(n,"single",t)}function i_(i){var t=i.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+Ox.call(t.toString(16))}function io(i){return"Object("+i+")"}function tc(i){return i+" { ? }"}function kp(i,t,e,r){var n=r?ec(e,r):Ci.call(e,", ");return i+" ("+t+") {"+n+"}"}function r_(i){for(var t=0;t<i.length;t++)if(Lp(i[t],`
2
+ `)>=0)return!1;return!0}function n_(i,t){var e;if(i.indent===" ")e=" ";else if(typeof i.indent=="number"&&i.indent>0)e=Ci.call(Array(i.indent+1)," ");else return null;return{base:e,prev:Ci.call(Array(t+1),e)}}function ec(i,t){if(i.length===0)return"";var e=`
3
+ `+t.prev+t.base;return e+Ci.call(i,","+e)+`
4
+ `+t.prev}function va(i,t){var e=qh(i),r=[];if(e){r.length=i.length;for(var n=0;n<i.length;n++)r[n]=Er(i,n)?t(i[n],i):""}var s=typeof Jh=="function"?Jh(i):[],o;if(Qn){o={};for(var a=0;a<s.length;a++)o["$"+s[a]]=s[a]}for(var l in i)Er(i,l)&&(e&&String(Number(l))===l&&l<i.length||Qn&&o["$"+l]instanceof Symbol||(vp.call(/[^\w$]/,l)?r.push(t(l,i)+": "+t(i[l],i)):r.push(l+": "+t(i[l],i))));if(typeof Jh=="function")for(var h=0;h<s.length;h++)Sp.call(i,s[h])&&r.push("["+t(s[h])+"]: "+t(i[s[h]],i));return r}var ic=Zh,qn=Mx,s_=Ux,o_=ic("%TypeError%"),wa=ic("%WeakMap%",!0),Ta=ic("%Map%",!0),a_=qn("WeakMap.prototype.get",!0),l_=qn("WeakMap.prototype.set",!0),h_=qn("WeakMap.prototype.has",!0),c_=qn("Map.prototype.get",!0),u_=qn("Map.prototype.set",!0),d_=qn("Map.prototype.has",!0),rc=function(i,t){for(var e=i,r;(r=e.next)!==null;e=r)if(r.key===t)return e.next=r.next,r.next=i.next,i.next=r,r},f_=function(i,t){var e=rc(i,t);return e&&e.value},p_=function(i,t,e){var r=rc(i,t);r?r.value=e:i.next={key:t,next:i.next,value:e}},m_=function(i,t){return!!rc(i,t)},g_=function(){var t,e,r,n={assert:function(s){if(!n.has(s))throw new o_("Side channel does not contain "+s_(s))},get:function(s){if(wa&&s&&(typeof s=="object"||typeof s=="function")){if(t)return a_(t,s)}else if(Ta){if(e)return c_(e,s)}else if(r)return f_(r,s)},has:function(s){if(wa&&s&&(typeof s=="object"||typeof s=="function")){if(t)return h_(t,s)}else if(Ta){if(e)return d_(e,s)}else if(r)return m_(r,s);return!1},set:function(s,o){wa&&s&&(typeof s=="object"||typeof s=="function")?(t||(t=new wa),l_(t,s,o)):Ta?(e||(e=new Ta),u_(e,s,o)):(r||(r={key:{},next:null}),p_(r,s,o))}};return n},y_=String.prototype.replace,b_=/%20/g,nc={RFC1738:"RFC1738",RFC3986:"RFC3986"},sc={default:nc.RFC3986,formatters:{RFC1738:function(i){return y_.call(i,b_,"+")},RFC3986:function(i){return String(i)}},RFC1738:nc.RFC1738,RFC3986:nc.RFC3986},x_=sc,oc=Object.prototype.hasOwnProperty,sn=Array.isArray,Ii=function(){for(var i=[],t=0;t<256;++t)i.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return i}(),__=function(t){for(;t.length>1;){var e=t.pop(),r=e.obj[e.prop];if(sn(r)){for(var n=[],s=0;s<r.length;++s)typeof r[s]<"u"&&n.push(r[s]);e.obj[e.prop]=n}}},Fp=function(t,e){for(var r=e&&e.plainObjects?Object.create(null):{},n=0;n<t.length;++n)typeof t[n]<"u"&&(r[n]=t[n]);return r},v_=function i(t,e,r){if(!e)return t;if(typeof e!="object"){if(sn(t))t.push(e);else if(t&&typeof t=="object")(r&&(r.plainObjects||r.allowPrototypes)||!oc.call(Object.prototype,e))&&(t[e]=!0);else return[t,e];return t}if(!t||typeof t!="object")return[t].concat(e);var n=t;return sn(t)&&!sn(e)&&(n=Fp(t,r)),sn(t)&&sn(e)?(e.forEach(function(s,o){if(oc.call(t,o)){var a=t[o];a&&typeof a=="object"&&s&&typeof s=="object"?t[o]=i(a,s,r):t.push(s)}else t[o]=s}),t):Object.keys(e).reduce(function(s,o){var a=e[o];return oc.call(s,o)?s[o]=i(s[o],a,r):s[o]=a,s},n)},w_=function(t,e){return Object.keys(e).reduce(function(r,n){return r[n]=e[n],r},t)},T_=function(i,t,e){var r=i.replace(/\+/g," ");if(e==="iso-8859-1")return r.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(r)}catch{return r}},S_=function(t,e,r,n,s){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)),r==="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="",l=0;l<o.length;++l){var h=o.charCodeAt(l);if(h===45||h===46||h===95||h===126||h>=48&&h<=57||h>=65&&h<=90||h>=97&&h<=122||s===x_.RFC1738&&(h===40||h===41)){a+=o.charAt(l);continue}if(h<128){a=a+Ii[h];continue}if(h<2048){a=a+(Ii[192|h>>6]+Ii[128|h&63]);continue}if(h<55296||h>=57344){a=a+(Ii[224|h>>12]+Ii[128|h>>6&63]+Ii[128|h&63]);continue}l+=1,h=65536+((h&1023)<<10|o.charCodeAt(l)&1023),a+=Ii[240|h>>18]+Ii[128|h>>12&63]+Ii[128|h>>6&63]+Ii[128|h&63]}return a},E_=function(t){for(var e=[{obj:{o:t},prop:"o"}],r=[],n=0;n<e.length;++n)for(var s=e[n],o=s.obj[s.prop],a=Object.keys(o),l=0;l<a.length;++l){var h=a[l],c=o[h];typeof c=="object"&&c!==null&&r.indexOf(c)===-1&&(e.push({obj:o,prop:h}),r.push(c))}return __(e),t},C_=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},I_=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},A_=function(t,e){return[].concat(t,e)},M_=function(t,e){if(sn(t)){for(var r=[],n=0;n<t.length;n+=1)r.push(e(t[n]));return r}return e(t)},Dp={arrayToObject:Fp,assign:w_,combine:A_,compact:E_,decode:T_,encode:S_,isBuffer:I_,isRegExp:C_,maybeMap:M_,merge:v_},Np=g_,Sa=Dp,ro=sc,R_=Object.prototype.hasOwnProperty,Op={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},tr=Array.isArray,P_=Array.prototype.push,Bp=function(i,t){P_.apply(i,tr(t)?t:[t])},L_=Date.prototype.toISOString,Up=ro.default,ge={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:Sa.encode,encodeValuesOnly:!1,format:Up,formatter:ro.formatters[Up],indices:!1,serializeDate:function(t){return L_.call(t)},skipNulls:!1,strictNullHandling:!1},G_=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},ac={},k_=function i(t,e,r,n,s,o,a,l,h,c,u,d,f,p,m,g){for(var y=t,x=g,b=0,v=!1;(x=x.get(ac))!==void 0&&!v;){var w=x.get(t);if(b+=1,typeof w<"u"){if(w===b)throw new RangeError("Cyclic object value");v=!0}typeof x.get(ac)>"u"&&(b=0)}if(typeof l=="function"?y=l(e,y):y instanceof Date?y=u(y):r==="comma"&&tr(y)&&(y=Sa.maybeMap(y,function(K){return K instanceof Date?u(K):K})),y===null){if(s)return a&&!p?a(e,ge.encoder,m,"key",d):e;y=""}if(G_(y)||Sa.isBuffer(y)){if(a){var S=p?e:a(e,ge.encoder,m,"key",d);return[f(S)+"="+f(a(y,ge.encoder,m,"value",d))]}return[f(e)+"="+f(String(y))]}var C=[];if(typeof y>"u")return C;var I;if(r==="comma"&&tr(y))p&&a&&(y=Sa.maybeMap(y,a)),I=[{value:y.length>0?y.join(",")||null:void 0}];else if(tr(l))I=l;else{var M=Object.keys(y);I=h?M.sort(h):M}for(var L=n&&tr(y)&&y.length===1?e+"[]":e,G=0;G<I.length;++G){var F=I[G],A=typeof F=="object"&&typeof F.value<"u"?F.value:y[F];if(!(o&&A===null)){var N=tr(y)?typeof r=="function"?r(L,F):L:L+(c?"."+F:"["+F+"]");g.set(t,b);var Z=Np();Z.set(ac,g),Bp(C,i(A,N,r,n,s,o,r==="comma"&&p&&tr(y)?null:a,l,h,c,u,d,f,p,m,Z))}}return C},F_=function(t){if(!t)return ge;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||ge.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 r=ro.default;if(typeof t.format<"u"){if(!R_.call(ro.formatters,t.format))throw new TypeError("Unknown format option provided.");r=t.format}var n=ro.formatters[r],s=ge.filter;return(typeof t.filter=="function"||tr(t.filter))&&(s=t.filter),{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:ge.addQueryPrefix,allowDots:typeof t.allowDots>"u"?ge.allowDots:!!t.allowDots,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:ge.charsetSentinel,delimiter:typeof t.delimiter>"u"?ge.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:ge.encode,encoder:typeof t.encoder=="function"?t.encoder:ge.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:ge.encodeValuesOnly,filter:s,format:r,formatter:n,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:ge.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:ge.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:ge.strictNullHandling}},D_=function(i,t){var e=i,r=F_(t),n,s;typeof r.filter=="function"?(s=r.filter,e=s("",e)):tr(r.filter)&&(s=r.filter,n=s);var o=[];if(typeof e!="object"||e===null)return"";var a;t&&t.arrayFormat in Op?a=t.arrayFormat:t&&"indices"in t?a=t.indices?"indices":"repeat":a="indices";var l=Op[a];if(t&&"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var h=l==="comma"&&t&&t.commaRoundTrip;n||(n=Object.keys(e)),r.sort&&n.sort(r.sort);for(var c=Np(),u=0;u<n.length;++u){var d=n[u];r.skipNulls&&e[d]===null||Bp(o,k_(e[d],d,l,h,r.strictNullHandling,r.skipNulls,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.format,r.formatter,r.encodeValuesOnly,r.charset,c))}var f=o.join(r.delimiter),p=r.addQueryPrefix===!0?"?":"";return r.charsetSentinel&&(r.charset==="iso-8859-1"?p+="utf8=%26%2310003%3B&":p+="utf8=%E2%9C%93&"),f.length>0?p+f:""},ts=Dp,lc=Object.prototype.hasOwnProperty,N_=Array.isArray,le={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:ts.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},O_=function(i){return i.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},Xp=function(i,t){return i&&typeof i=="string"&&t.comma&&i.indexOf(",")>-1?i.split(","):i},B_="utf8=%26%2310003%3B",U_="utf8=%E2%9C%93",X_=function(t,e){var r={__proto__:null},n=e.ignoreQueryPrefix?t.replace(/^\?/,""):t,s=e.parameterLimit===1/0?void 0:e.parameterLimit,o=n.split(e.delimiter,s),a=-1,l,h=e.charset;if(e.charsetSentinel)for(l=0;l<o.length;++l)o[l].indexOf("utf8=")===0&&(o[l]===U_?h="utf-8":o[l]===B_&&(h="iso-8859-1"),a=l,l=o.length);for(l=0;l<o.length;++l)if(l!==a){var c=o[l],u=c.indexOf("]="),d=u===-1?c.indexOf("="):u+1,f,p;d===-1?(f=e.decoder(c,le.decoder,h,"key"),p=e.strictNullHandling?null:""):(f=e.decoder(c.slice(0,d),le.decoder,h,"key"),p=ts.maybeMap(Xp(c.slice(d+1),e),function(m){return e.decoder(m,le.decoder,h,"value")})),p&&e.interpretNumericEntities&&h==="iso-8859-1"&&(p=O_(p)),c.indexOf("[]=")>-1&&(p=N_(p)?[p]:p),lc.call(r,f)?r[f]=ts.combine(r[f],p):r[f]=p}return r},W_=function(i,t,e,r){for(var n=r?t:Xp(t,e),s=i.length-1;s>=0;--s){var o,a=i[s];if(a==="[]"&&e.parseArrays)o=[].concat(n);else{o=e.plainObjects?Object.create(null):{};var l=a.charAt(0)==="["&&a.charAt(a.length-1)==="]"?a.slice(1,-1):a,h=parseInt(l,10);!e.parseArrays&&l===""?o={0:n}:!isNaN(h)&&a!==l&&String(h)===l&&h>=0&&e.parseArrays&&h<=e.arrayLimit?(o=[],o[h]=n):l!=="__proto__"&&(o[l]=n)}n=o}return n},Z_=function(t,e,r,n){if(t){var s=r.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,o=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,l=r.depth>0&&o.exec(s),h=l?s.slice(0,l.index):s,c=[];if(h){if(!r.plainObjects&&lc.call(Object.prototype,h)&&!r.allowPrototypes)return;c.push(h)}for(var u=0;r.depth>0&&(l=a.exec(s))!==null&&u<r.depth;){if(u+=1,!r.plainObjects&&lc.call(Object.prototype,l[1].slice(1,-1))&&!r.allowPrototypes)return;c.push(l[1])}return l&&c.push("["+s.slice(l.index)+"]"),W_(c,e,r,n)}},V_=function(t){if(!t)return le;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"?le.charset:t.charset;return{allowDots:typeof t.allowDots>"u"?le.allowDots:!!t.allowDots,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:le.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:le.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:le.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:le.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:le.comma,decoder:typeof t.decoder=="function"?t.decoder:le.decoder,delimiter:typeof t.delimiter=="string"||ts.isRegExp(t.delimiter)?t.delimiter:le.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:le.depth,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:le.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:le.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:le.plainObjects,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:le.strictNullHandling}},H_=function(i,t){var e=V_(t);if(i===""||i===null||typeof i>"u")return e.plainObjects?Object.create(null):{};for(var r=typeof i=="string"?X_(i,e):i,n=e.plainObjects?Object.create(null):{},s=Object.keys(r),o=0;o<s.length;++o){var a=s[o],l=Z_(a,r[a],e,typeof i=="string");n=ts.merge(n,l,e)}return e.allowSparse===!0?n:ts.compact(n)},K_=D_,z_=H_,Y_=sc,j_={formats:Y_,parse:z_,stringify:K_},J_=ix;function er(){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 $_=/^([a-z0-9.+-]+:)/i,Q_=/:[0-9]*$/,q_=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,tv=["<",">",'"',"`"," ","\r",`
5
+ `," "],ev=["{","}","|","\\","^","`"].concat(tv),hc=["'"].concat(ev),Wp=["%","/","?",";","#"].concat(hc),Zp=["/","?","#"],iv=255,Vp=/^[+a-z0-9A-Z_-]{0,63}$/,rv=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,nv={javascript:!0,"javascript:":!0},cc={javascript:!0,"javascript:":!0},es={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},uc=j_;function sv(i,t,e){if(i&&typeof i=="object"&&i instanceof er)return i;var r=new er;return r.parse(i,t,e),r}er.prototype.parse=function(i,t,e){if(typeof i!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof i);var r=i.indexOf("?"),n=r!==-1&&r<i.indexOf("#")?"?":"#",s=i.split(n),o=/\\/g;s[0]=s[0].replace(o,"/"),i=s.join(n);var a=i;if(a=a.trim(),!e&&i.split("#").length===1){var l=q_.exec(a);if(l)return this.path=a,this.href=a,this.pathname=l[1],l[2]?(this.search=l[2],t?this.query=uc.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var h=$_.exec(a);if(h){h=h[0];var c=h.toLowerCase();this.protocol=c,a=a.substr(h.length)}if(e||h||a.match(/^\/\/[^@/]+@[^@/]+/)){var u=a.substr(0,2)==="//";u&&!(h&&cc[h])&&(a=a.substr(2),this.slashes=!0)}if(!cc[h]&&(u||h&&!es[h])){for(var d=-1,f=0;f<Zp.length;f++){var p=a.indexOf(Zp[f]);p!==-1&&(d===-1||p<d)&&(d=p)}var m,g;d===-1?g=a.lastIndexOf("@"):g=a.lastIndexOf("@",d),g!==-1&&(m=a.slice(0,g),a=a.slice(g+1),this.auth=decodeURIComponent(m)),d=-1;for(var f=0;f<Wp.length;f++){var p=a.indexOf(Wp[f]);p!==-1&&(d===-1||p<d)&&(d=p)}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 x=this.hostname.split(/\./),f=0,b=x.length;f<b;f++){var v=x[f];if(v&&!v.match(Vp)){for(var w="",S=0,C=v.length;S<C;S++)v.charCodeAt(S)>127?w+="x":w+=v[S];if(!w.match(Vp)){var I=x.slice(0,f),M=x.slice(f+1),L=v.match(rv);L&&(I.push(L[1]),M.unshift(L[2])),M.length&&(a="/"+M.join(".")+a),this.hostname=I.join(".");break}}}this.hostname.length>iv?this.hostname="":this.hostname=this.hostname.toLowerCase(),y||(this.hostname=J_.toASCII(this.hostname));var G=this.port?":"+this.port:"",F=this.hostname||"";this.host=F+G,this.href+=this.host,y&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!nv[c])for(var f=0,b=hc.length;f<b;f++){var A=hc[f];if(a.indexOf(A)!==-1){var N=encodeURIComponent(A);N===A&&(N=escape(A)),a=a.split(A).join(N)}}var Z=a.indexOf("#");Z!==-1&&(this.hash=a.substr(Z),a=a.slice(0,Z));var K=a.indexOf("?");if(K!==-1?(this.search=a.substr(K),this.query=a.substr(K+1),t&&(this.query=uc.parse(this.query)),a=a.slice(0,K)):t&&(this.search="",this.query={}),a&&(this.pathname=a),es[c]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var G=this.pathname||"",H=this.search||"";this.path=G+H}return this.href=this.format(),this},er.prototype.format=function(){var i=this.auth||"";i&&(i=encodeURIComponent(i),i=i.replace(/%3A/i,":"),i+="@");var t=this.protocol||"",e=this.pathname||"",r=this.hash||"",n=!1,s="";this.host?n=i+this.host:this.hostname&&(n=i+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(n+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(s=uc.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var o=this.search||s&&"?"+s||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||es[t])&&n!==!1?(n="//"+(n||""),e&&e.charAt(0)!=="/"&&(e="/"+e)):n||(n=""),r&&r.charAt(0)!=="#"&&(r="#"+r),o&&o.charAt(0)!=="?"&&(o="?"+o),e=e.replace(/[?#]/g,function(a){return encodeURIComponent(a)}),o=o.replace("#","%23"),t+n+e+o+r},er.prototype.resolve=function(i){return this.resolveObject(sv(i,!1,!0)).format()},er.prototype.resolveObject=function(i){if(typeof i=="string"){var t=new er;t.parse(i,!1,!0),i=t}for(var e=new er,r=Object.keys(this),n=0;n<r.length;n++){var s=r[n];e[s]=this[s]}if(e.hash=i.hash,i.href==="")return e.href=e.format(),e;if(i.slashes&&!i.protocol){for(var o=Object.keys(i),a=0;a<o.length;a++){var l=o[a];l!=="protocol"&&(e[l]=i[l])}return es[e.protocol]&&e.hostname&&!e.pathname&&(e.pathname="/",e.path=e.pathname),e.href=e.format(),e}if(i.protocol&&i.protocol!==e.protocol){if(!es[i.protocol]){for(var h=Object.keys(i),c=0;c<h.length;c++){var u=h[c];e[u]=i[u]}return e.href=e.format(),e}if(e.protocol=i.protocol,!i.host&&!cc[i.protocol]){for(var b=(i.pathname||"").split("/");b.length&&!(i.host=b.shift()););i.host||(i.host=""),i.hostname||(i.hostname=""),b[0]!==""&&b.unshift(""),b.length<2&&b.unshift(""),e.pathname=b.join("/")}else e.pathname=i.pathname;if(e.search=i.search,e.query=i.query,e.host=i.host||"",e.auth=i.auth,e.hostname=i.hostname||i.host,e.port=i.port,e.pathname||e.search){var d=e.pathname||"",f=e.search||"";e.path=d+f}return e.slashes=e.slashes||i.slashes,e.href=e.format(),e}var p=e.pathname&&e.pathname.charAt(0)==="/",m=i.host||i.pathname&&i.pathname.charAt(0)==="/",g=m||p||e.host&&i.pathname,y=g,x=e.pathname&&e.pathname.split("/")||[],b=i.pathname&&i.pathname.split("/")||[],v=e.protocol&&!es[e.protocol];if(v&&(e.hostname="",e.port=null,e.host&&(x[0]===""?x[0]=e.host:x.unshift(e.host)),e.host="",i.protocol&&(i.hostname=null,i.port=null,i.host&&(b[0]===""?b[0]=i.host:b.unshift(i.host)),i.host=null),g=g&&(b[0]===""||x[0]==="")),m)e.host=i.host||i.host===""?i.host:e.host,e.hostname=i.hostname||i.hostname===""?i.hostname:e.hostname,e.search=i.search,e.query=i.query,x=b;else if(b.length)x||(x=[]),x.pop(),x=x.concat(b),e.search=i.search,e.query=i.query;else if(i.search!=null){if(v){e.host=x.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=i.search,e.query=i.query,(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.href=e.format(),e}if(!x.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var S=x.slice(-1)[0],C=(e.host||i.host||x.length>1)&&(S==="."||S==="..")||S==="",I=0,M=x.length;M>=0;M--)S=x[M],S==="."?x.splice(M,1):S===".."?(x.splice(M,1),I++):I&&(x.splice(M,1),I--);if(!g&&!y)for(;I--;I)x.unshift("..");g&&x[0]!==""&&(!x[0]||x[0].charAt(0)!=="/")&&x.unshift(""),C&&x.join("/").substr(-1)!=="/"&&x.push("");var L=x[0]===""||x[0]&&x[0].charAt(0)==="/";if(v){e.hostname=L?"":x.length?x.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&&x.length,g&&!L&&x.unshift(""),x.length>0?e.pathname=x.join("/"):(e.pathname=null,e.path=null),(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.auth=i.auth||e.auth,e.slashes=e.slashes||i.slashes,e.href=e.format(),e},er.prototype.parseHost=function(){var i=this.host,t=Q_.exec(i);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),i=i.substr(0,i.length-t.length)),i&&(this.hostname=i)};const Hp={};function wt(i,t,e=3){if(Hp[t])return;let r=new Error().stack;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
6
+ Deprecated since v${i}`):(r=r.split(`
7
7
  `).splice(e).join(`
8
8
  `),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t}
9
- Deprecated since v${r}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
10
- Deprecated since v${r}`),console.warn(i))),Gp[t]=!0}function oi(r){if(typeof r!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(r)}`)}function eo(r){return r.split("?")[0].split("#")[0]}function F1(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function N1(r,t,e){return r.replace(new RegExp(F1(t),"g"),e)}function k1(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 re={toPosix(r){return N1(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){oi(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(oi(r),this.isDataUrl(r)||this.isBlobUrl(r))return r;const i=eo(this.toPosix(t??st.ADAPTER.getBaseUrl())),s=eo(this.toPosix(e??this.rootname(i)));return r=this.toPosix(r),r.startsWith("/")?re.join(s,r.slice(1)):this.isAbsolute(r)?r:this.join(i,r)},normalize(r){if(oi(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=k1(r,!1),r.length>0&&i&&(r+="/"),e?`/${r}`:t+r},isAbsolute(r){return oi(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(oi(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(oi(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){oi(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){oi(r),t&&oi(t),r=eo(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){oi(r),r=eo(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){oi(r);const t={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return t;r=eo(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 hc;async function D1(){return hc??(hc=(async()=>{var n;const r=document.createElement("canvas").getContext("webgl");if(!r)return Ee.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 Ee.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]?Ee.PMA:Ee.UNPACK})()),hc}let lc;function O1(){return typeof lc>"u"&&(lc=function(){var t;const r={stencil:!0,failIfMajorPerformanceCaveat:st.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!st.ADAPTER.getWebGLRenderingContext())return!1;const e=st.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}}()),lc}var B1={grad:.9,turn:360,rad:360/(2*Math.PI)},er=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},he=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*r)/e+0},ze=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),r>e?e:r>t?r:t},Fp=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},Np=function(r){return{r:ze(r.r,0,255),g:ze(r.g,0,255),b:ze(r.b,0,255),a:ze(r.a)}},cc=function(r){return{r:he(r.r),g:he(r.g),b:he(r.b),a:he(r.a,3)}},U1=/^#([0-9a-f]{3,8})$/i,wa=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},kp=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}},Dp=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}},Op=function(r){return{h:Fp(r.h),s:ze(r.s,0,100),l:ze(r.l,0,100),a:ze(r.a)}},Bp=function(r){return{h:he(r.h),s:he(r.s),l:he(r.l),a:he(r.a,3)}},Up=function(r){return Dp((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},io=function(r){return{h:(t=kp(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},X1=/^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,Z1=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,V1=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,uc={string:[[function(r){var t=U1.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?he(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?he(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=Z1.exec(r)||V1.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:Np({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(r){var t=X1.exec(r)||W1.exec(r);if(!t)return null;var e,i,s=Op({h:(e=t[1],i=t[2],i===void 0&&(i="deg"),Number(e)*(B1[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Up(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 er(t)&&er(e)&&er(i)?Np({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(!er(t)||!er(e)||!er(i))return null;var o=Op({h:Number(t),s:Number(e),l:Number(i),a:Number(n)});return Up(o)},"hsl"],[function(r){var t=r.h,e=r.s,i=r.v,s=r.a,n=s===void 0?1:s;if(!er(t)||!er(e)||!er(i))return null;var o=function(a){return{h:Fp(a.h),s:ze(a.s,0,100),v:ze(a.v,0,100),a:ze(a.a)}}({h:Number(t),s:Number(e),v:Number(i),a:Number(n)});return Dp(o)},"hsv"]]},Xp=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]},H1=function(r){return typeof r=="string"?Xp(r.trim(),uc.string):typeof r=="object"&&r!==null?Xp(r,uc.object):[null,void 0]},dc=function(r,t){var e=io(r);return{h:e.h,s:ze(e.s+100*t,0,100),l:e.l,a:e.a}},fc=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},Wp=function(r,t){var e=io(r);return{h:e.h,s:e.s,l:ze(e.l+100*t,0,100),a:e.a}},pc=function(){function r(t){this.parsed=H1(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return this.parsed!==null},r.prototype.brightness=function(){return he(fc(this.rgba),2)},r.prototype.isDark=function(){return fc(this.rgba)<.5},r.prototype.isLight=function(){return fc(this.rgba)>=.5},r.prototype.toHex=function(){return t=cc(this.rgba),e=t.r,i=t.g,s=t.b,o=(n=t.a)<1?wa(he(255*n)):"","#"+wa(e)+wa(i)+wa(s)+o;var t,e,i,s,n,o},r.prototype.toRgb=function(){return cc(this.rgba)},r.prototype.toRgbString=function(){return t=cc(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 Bp(io(this.rgba))},r.prototype.toHslString=function(){return t=Bp(io(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=kp(this.rgba),{h:he(t.h),s:he(t.s),v:he(t.v),a:he(t.a,3)};var t},r.prototype.invert=function(){return Ii({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),Ii(dc(this.rgba,t))},r.prototype.desaturate=function(t){return t===void 0&&(t=.1),Ii(dc(this.rgba,-t))},r.prototype.grayscale=function(){return Ii(dc(this.rgba,-1))},r.prototype.lighten=function(t){return t===void 0&&(t=.1),Ii(Wp(this.rgba,t))},r.prototype.darken=function(t){return t===void 0&&(t=.1),Ii(Wp(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"?Ii({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):he(this.rgba.a,3);var e},r.prototype.hue=function(t){var e=io(this.rgba);return typeof t=="number"?Ii({h:t,s:e.s,l:e.l,a:e.a}):he(e.h)},r.prototype.isEqual=function(t){return this.toHex()===Ii(t).toHex()},r}(),Ii=function(r){return r instanceof pc?r:new pc(r)},Zp=[],K1=function(r){r.forEach(function(t){Zp.indexOf(t)<0&&(t(pc,uc),Zp.push(t))})};function Y1(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 p in e){var m=(a=c,h=n[p],Math.pow(a.r-h.r,2)+Math.pow(a.g-h.g,2)+Math.pow(a.b-h.b,2));m<u&&(u=m,d=p)}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"])}K1([Y1]);const Qs=class vl{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 vl)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]=vl.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=vl.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}const o=Ii(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)}};Qs.shared=new Qs,Qs.temp=new Qs,Qs.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let kt=Qs;function z1(r){return wt("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),kt.shared.setValue(r).toHex()}function j1(r){return wt("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),kt.shared.setValue(r).toNumber()}function J1(){const r=[],t=[];for(let i=0;i<32;i++)r[i]=i,t[i]=i;r[mt.NORMAL_NPM]=mt.NORMAL,r[mt.ADD_NPM]=mt.ADD,r[mt.SCREEN_NPM]=mt.SCREEN,t[mt.NORMAL]=mt.NORMAL_NPM,t[mt.ADD]=mt.ADD_NPM,t[mt.SCREEN]=mt.SCREEN_NPM;const e=[];return e.push(t),e.push(r),e}const Vp=J1();function Hp(r,t){return Vp[t?1:0][r]}function $1(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 Kp(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 Ta(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 Yp(r){return!(r&r-1)&&!!r}function zp(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 qs(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 Sr(r){return r===0?0:r<0?-1:1}let Q1=0;function es(){return++Q1}const mc=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}};mc.EMPTY=new mc(0,0,0,0);let jp=mc;const Jp={},Ai=Object.create(null),Er=Object.create(null);class q1{constructor(t,e,i){this._canvas=st.ADAPTER.createCanvas(),this._context=this._canvas.getContext("2d"),this.resolution=i||st.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 $p(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 Qp(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 tv(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&&$p(s,t,o);)++o;if(o===e)return jp.EMPTY;for(;$p(s,t,h);)--h;for(;Qp(s,t,n,o,h);)++n;for(;Qp(s,t,a,o,h);)--a;return++a,++h,new jp(n,o,a,h)}function ev(r){const t=tv(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 iv(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 ir(r,t=1){var i;const e=(i=st.RETINA_PREFIX)==null?void 0:i.exec(r);return e?parseFloat(e[1]):t}var q=(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))(q||{});const gc=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},qp=(r,t)=>gc(r).priority??t,nt={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(gc).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(gc).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)=>qp(n,e)-qp(s,e)))},i=>{const s=t.indexOf(i.ref);s!==-1&&t.splice(s,1)})}};class yc{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 rv=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
11
- `);function sv(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 nv(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=rv.replace(/%forloop%/gi,sv(r));if(t.shaderSource(e,i),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))r=r/2|0;else break}return r}const bc=0,xc=1,_c=2,vc=3,wc=4,Tc=5;class Mi{constructor(){this.data=0,this.blendMode=mt.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<bc)}set blend(t){!!(this.data&1<<bc)!==t&&(this.data^=1<<bc)}get offsets(){return!!(this.data&1<<xc)}set offsets(t){!!(this.data&1<<xc)!==t&&(this.data^=1<<xc)}get culling(){return!!(this.data&1<<_c)}set culling(t){!!(this.data&1<<_c)!==t&&(this.data^=1<<_c)}get depthTest(){return!!(this.data&1<<vc)}set depthTest(t){!!(this.data&1<<vc)!==t&&(this.data^=1<<vc)}get depthMask(){return!!(this.data&1<<Tc)}set depthMask(t){!!(this.data&1<<Tc)!==t&&(this.data^=1<<Tc)}get clockwiseFrontFace(){return!!(this.data&1<<wc)}set clockwiseFrontFace(t){!!(this.data&1<<wc)!==t&&(this.data^=1<<wc)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==mt.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){const t=new Mi;return t.depthTest=!1,t.blend=!0,t}}Mi.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};const Sc=[];function tm(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=Sc.length-1;i>=0;--i){const s=Sc[i];if(s.test&&s.test(r,e))return new s(r,t)}throw new Error("Unrecognized source type to auto-detect Resource")}class ai{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(ai.prototype,{dispatch:{value:ai.prototype.emit},run:{value:ai.prototype.emit}});class ro{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new ai("setRealSize"),this.onUpdate=new ai("update"),this.onError=new ai("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 Sa extends ro{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===Ee.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 ov={scaleMode:Ji.NEAREST,alphaMode:Ee.NPM},Ec=class Wn extends Kn{constructor(t=null,e=null){super(),e=Object.assign({},Wn.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:p}=e;t&&!(t instanceof ro)&&(t=tm(t,p),t.internal=!0),this.resolution=f||st.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=es(),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=Yp(this.realWidth)&&Yp(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 Er[this.cacheId],delete Ai[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),Wn.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=st.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}_${es()}`}n=t._pixiId}let o=Er[n];if(s&&i&&!o)throw new Error(`The cacheId "${n}" does not exist in BaseTextureCache.`);return o||(o=new Wn(t,e),o.cacheId=n,Wn.addToCache(o,n)),o}static fromBuffer(t,e,i,s){t=t||new Float32Array(e*i*4);const n=new Sa(t,{width:e,height:i,...s==null?void 0:s.resourceOptions});let o,a;return t instanceof Float32Array?(o=Y.RGBA,a=ct.FLOAT):t instanceof Int32Array?(o=Y.RGBA_INTEGER,a=ct.INT):t instanceof Uint32Array?(o=Y.RGBA_INTEGER,a=ct.UNSIGNED_INT):t instanceof Int16Array?(o=Y.RGBA_INTEGER,a=ct.SHORT):t instanceof Uint16Array?(o=Y.RGBA_INTEGER,a=ct.UNSIGNED_SHORT):t instanceof Int8Array?(o=Y.RGBA,a=ct.BYTE):(o=Y.RGBA,a=ct.UNSIGNED_BYTE),n.internal=!0,new Wn(n,Object.assign({},ov,{type:a,format:o},s))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),Er[e]&&Er[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),Er[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=Er[t];if(e){const i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete Er[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete Er[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};Ec.defaultOptions={mipmap:wi.POW2,anisotropicLevel:0,scaleMode:Ji.LINEAR,wrapMode:vi.CLAMP,alphaMode:Ee.UNPACK,target:Us.TEXTURE_2D,format:Y.RGBA,type:ct.UNSIGNED_BYTE},Ec._globalBatch=0;let xt=Ec;class Cc{constructor(){this.texArray=null,this.blend=0,this.type=_i.TRIANGLES,this.start=0,this.size=0,this.data=null}}let av=0;class zt{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=av++,this.disposeRunner=new ai("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?Si.ELEMENT_ARRAY_BUFFER:Si.ARRAY_BUFFER}get index(){return this.type===Si.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new zt(t)}}class Ea{constructor(t,e=0,i=!1,s=ct.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 Ea(t,e,i,s,n)}}const hv={Float32Array,Uint32Array,Int32Array,Uint8Array};function lv(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=Kp(c);s[u]||(s[u]=new hv[u](n)),o=s[u];for(let d=0;d<c.length;d++){const f=(d/l|0)*i+a,p=d%l;o[f+p]=c[d]}a+=l}return new Float32Array(n)}const em={5126:4,5123:2,5121:1};let cv=0;const uv={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array};class Cr{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=cv++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new ai("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 zt||(e instanceof Array&&(e=new Float32Array(e)),e=new zt(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 Ea(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 zt||(t instanceof Array&&(t=new Uint16Array(t)),t=new zt(t)),t.type=Si.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 zt;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*em[n.type]/4),n.buffer=0}for(i.data=lv(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 Cr;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new zt(this.buffers[e].data.slice(0));for(const e in this.attributes){const i=this.attributes[e];t.attributes[e]=new Ea(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=Si.ELEMENT_ARRAY_BUFFER),t}static merge(t){const e=new Cr,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 uv[Kp(o.buffers[a].data)](s[a]),e.buffers[a]=new zt(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=Si.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*em[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 im extends Cr{constructor(t=!1){super(),this._buffer=new zt(null,t,!1),this._indexBuffer=new zt(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,ct.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,ct.FLOAT).addAttribute("aColor",this._buffer,4,!0,ct.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,ct.FLOAT).addIndex(this._indexBuffer)}}const Ca=Math.PI*2,dv=180/Math.PI,fv=Math.PI/180;var fe=(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))(fe||{});class dt{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new dt(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}}dt.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};const Ia=[new dt,new dt,new dt,new dt];class gt{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=fe.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 gt(0,0,0,0)}clone(){return new gt(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 I=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=I)return!1;const M=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>M}const i=this.left,s=this.right,n=this.top,o=this.bottom;if(s<=i||o<=n)return!1;const a=Ia[0].set(t.left,t.top),h=Ia[1].set(t.left,t.bottom),l=Ia[2].set(t.right,t.top),c=Ia[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),p=d*i+f*n,m=d*s+f*n,g=d*i+f*o,y=d*s+f*o;if(Math.max(p,m,g,y)<=d*a.x+f*a.y||Math.min(p,m,g,y)>=d*c.x+f*c.y)return!1;const x=u*(a.y-l.y),b=u*(l.x-a.x),v=x*i+b*n,w=x*s+b*n,S=x*i+b*o,C=x*s+b*o;return!(Math.max(v,w,S,C)<=x*a.x+b*a.y||Math.min(v,w,S,C)>=x*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}}gt.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class Aa{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.radius=i,this.type=fe.CIRC}clone(){return new Aa(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const i=this.radius*this.radius;let s=this.x-t,n=this.y-e;return s*=s,n*=n,s+n<=i}getBounds(){return new gt(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}Aa.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};class Ma{constructor(t=0,e=0,i=0,s=0){this.x=t,this.y=e,this.width=i,this.height=s,this.type=fe.ELIP}clone(){return new Ma(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 gt(this.x-this.width,this.y-this.height,this.width,this.height)}}Ma.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class is{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=fe.POLY,this.closeStroke=!0}clone(){const t=this.points.slice(),e=new is(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}}is.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((r,t)=>`${r}, ${t}`,"")}]`};class Ra{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=fe.RREC}clone(){return new Ra(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}}Ra.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};class Dt{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 dt;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 dt;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(Ca-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 Dt;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 Dt}static get TEMP_MATRIX(){return new Dt}}Dt.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 rs=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],ss=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],ns=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],os=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Ic=[],rm=[],Pa=Math.sign;function pv(){for(let r=0;r<16;r++){const t=[];Ic.push(t);for(let e=0;e<16;e++){const i=Pa(rs[r]*rs[e]+ns[r]*ss[e]),s=Pa(ss[r]*rs[e]+os[r]*ss[e]),n=Pa(rs[r]*ns[e]+ns[r]*os[e]),o=Pa(ss[r]*ns[e]+os[r]*os[e]);for(let a=0;a<16;a++)if(rs[a]===i&&ss[a]===s&&ns[a]===n&&os[a]===o){t.push(a);break}}}for(let r=0;r<16;r++){const t=new Dt;t.set(rs[r],ss[r],ns[r],os[r],0,0),rm.push(t)}}pv();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=>rs[r],uY:r=>ss[r],vX:r=>ns[r],vY:r=>os[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>Ic[r][t],sub:(r,t)=>Ic[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=rm[Wt.inv(t)];s.tx=e,s.ty=i,r.append(s)}};class rr{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 rr(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))}}rr.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};const Ac=class{constructor(){this.worldTransform=new Dt,this.localTransform=new Dt,this.position=new rr(this.onChange,this,0,0),this.scale=new rr(this.onChange,this,1,1),this.pivot=new rr(this.onChange,this,0,0),this.skew=new rr(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())}};Ac.IDENTITY=new Ac;let Mc=Ac;Mc.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 mv=`varying vec2 vTextureCoord;
9
+ Deprecated since v${i}`),console.warn(r),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
10
+ Deprecated since v${i}`),console.warn(r))),Hp[t]=!0}function ai(i){if(typeof i!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(i)}`)}function no(i){return i.split("?")[0].split("#")[0]}function ov(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function av(i,t,e){return i.replace(new RegExp(ov(t),"g"),e)}function lv(i,t){let e="",r=0,n=-1,s=0,o=-1;for(let a=0;a<=i.length;++a){if(a<i.length)o=i.charCodeAt(a);else{if(o===47)break;o=47}if(o===47){if(!(n===a-1||s===1))if(n!==a-1&&s===2){if(e.length<2||r!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){const l=e.lastIndexOf("/");if(l!==e.length-1){l===-1?(e="",r=0):(e=e.slice(0,l),r=e.length-1-e.lastIndexOf("/")),n=a,s=0;continue}}else if(e.length===2||e.length===1){e="",r=0,n=a,s=0;continue}}t&&(e.length>0?e+="/..":e="..",r=2)}else e.length>0?e+=`/${i.slice(n+1,a)}`:e=i.slice(n+1,a),r=a-n-1;n=a,s=0}else o===46&&s!==-1?++s:s=-1}return e}const ne={toPosix(i){return av(i,"\\","/")},isUrl(i){return/^https?:/.test(this.toPosix(i))},isDataUrl(i){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(i)},isBlobUrl(i){return i.startsWith("blob:")},hasProtocol(i){return/^[^/:]+:/.test(this.toPosix(i))},getProtocol(i){ai(i),i=this.toPosix(i);const t=/^file:\/\/\//.exec(i);if(t)return t[0];const e=/^[^/:]+:\/{0,2}/.exec(i);return e?e[0]:""},toAbsolute(i,t,e){if(ai(i),this.isDataUrl(i)||this.isBlobUrl(i))return i;const r=no(this.toPosix(t??nt.ADAPTER.getBaseUrl())),n=no(this.toPosix(e??this.rootname(r)));return i=this.toPosix(i),i.startsWith("/")?ne.join(n,i.slice(1)):this.isAbsolute(i)?i:this.join(r,i)},normalize(i){if(ai(i),i.length===0)return".";if(this.isDataUrl(i)||this.isBlobUrl(i))return i;i=this.toPosix(i);let t="";const e=i.startsWith("/");this.hasProtocol(i)&&(t=this.rootname(i),i=i.slice(t.length));const r=i.endsWith("/");return i=lv(i,!1),i.length>0&&r&&(i+="/"),e?`/${i}`:t+i},isAbsolute(i){return ai(i),i=this.toPosix(i),this.hasProtocol(i)?!0:i.startsWith("/")},join(...i){if(i.length===0)return".";let t;for(let e=0;e<i.length;++e){const r=i[e];if(ai(r),r.length>0)if(t===void 0)t=r;else{const n=i[e-1]??"";this.extname(n)?t+=`/../${r}`:t+=`/${r}`}}return t===void 0?".":this.normalize(t)},dirname(i){if(ai(i),i.length===0)return".";i=this.toPosix(i);let t=i.charCodeAt(0);const e=t===47;let r=-1,n=!0;const s=this.getProtocol(i),o=i;i=i.slice(s.length);for(let a=i.length-1;a>=1;--a)if(t=i.charCodeAt(a),t===47){if(!n){r=a;break}}else n=!1;return r===-1?e?"/":this.isUrl(o)?s+i:s:e&&r===1?"//":s+i.slice(0,r)},rootname(i){ai(i),i=this.toPosix(i);let t="";if(i.startsWith("/")?t="/":t=this.getProtocol(i),this.isUrl(i)){const e=i.indexOf("/",t.length);e!==-1?t=i.slice(0,e):t=i,t.endsWith("/")||(t+="/")}return t},basename(i,t){ai(i),t&&ai(t),i=no(this.toPosix(i));let e=0,r=-1,n=!0,s;if(t!==void 0&&t.length>0&&t.length<=i.length){if(t.length===i.length&&t===i)return"";let o=t.length-1,a=-1;for(s=i.length-1;s>=0;--s){const l=i.charCodeAt(s);if(l===47){if(!n){e=s+1;break}}else a===-1&&(n=!1,a=s+1),o>=0&&(l===t.charCodeAt(o)?--o===-1&&(r=s):(o=-1,r=a))}return e===r?r=a:r===-1&&(r=i.length),i.slice(e,r)}for(s=i.length-1;s>=0;--s)if(i.charCodeAt(s)===47){if(!n){e=s+1;break}}else r===-1&&(n=!1,r=s+1);return r===-1?"":i.slice(e,r)},extname(i){ai(i),i=no(this.toPosix(i));let t=-1,e=0,r=-1,n=!0,s=0;for(let o=i.length-1;o>=0;--o){const a=i.charCodeAt(o);if(a===47){if(!n){e=o+1;break}continue}r===-1&&(n=!1,r=o+1),a===46?t===-1?t=o:s!==1&&(s=1):t!==-1&&(s=-1)}return t===-1||r===-1||s===0||s===1&&t===r-1&&t===e+1?"":i.slice(t,r)},parse(i){ai(i);const t={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return t;i=no(this.toPosix(i));let e=i.charCodeAt(0);const r=this.isAbsolute(i);let n;t.root=this.rootname(i),r||this.hasProtocol(i)?n=1:n=0;let s=-1,o=0,a=-1,l=!0,h=i.length-1,c=0;for(;h>=n;--h){if(e=i.charCodeAt(h),e===47){if(!l){o=h+1;break}continue}a===-1&&(l=!1,a=h+1),e===46?s===-1?s=h:c!==1&&(c=1):s!==-1&&(c=-1)}return s===-1||a===-1||c===0||c===1&&s===a-1&&s===o+1?a!==-1&&(o===0&&r?t.base=t.name=i.slice(1,a):t.base=t.name=i.slice(o,a)):(o===0&&r?(t.name=i.slice(1,s),t.base=i.slice(1,a)):(t.name=i.slice(o,s),t.base=i.slice(o,a)),t.ext=i.slice(s,a)),t.dir=this.dirname(i),t},sep:"/",delimiter:":"};let dc;async function hv(){return dc??(dc=(async()=>{var s;const i=document.createElement("canvas").getContext("webgl");if(!i)return Ce.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 Ce.UNPACK;const e=i.createTexture();i.bindTexture(i.TEXTURE_2D,e);const r=i.createFramebuffer();i.bindFramebuffer(i.FRAMEBUFFER,r),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e,0),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,i.NONE),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,t);const n=new Uint8Array(4);return i.readPixels(0,0,1,1,i.RGBA,i.UNSIGNED_BYTE,n),i.deleteFramebuffer(r),i.deleteTexture(e),(s=i.getExtension("WEBGL_lose_context"))==null||s.loseContext(),n[0]<=n[3]?Ce.PMA:Ce.UNPACK})()),dc}let fc;function cv(){return typeof fc>"u"&&(fc=function(){var t;const i={stencil:!0,failIfMajorPerformanceCaveat:nt.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!nt.ADAPTER.getWebGLRenderingContext())return!1;const e=nt.ADAPTER.createCanvas();let r=e.getContext("webgl",i)||e.getContext("experimental-webgl",i);const n=!!((t=r==null?void 0:r.getContextAttributes())!=null&&t.stencil);if(r){const s=r.getExtension("WEBGL_lose_context");s&&s.loseContext()}return r=null,n}catch{return!1}}()),fc}var uv={grad:.9,turn:360,rad:360/(2*Math.PI)},ir=function(i){return typeof i=="string"?i.length>0:typeof i=="number"},he=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*i)/e+0},je=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),i>e?e:i>t?i:t},Kp=function(i){return(i=isFinite(i)?i%360:0)>0?i:i+360},zp=function(i){return{r:je(i.r,0,255),g:je(i.g,0,255),b:je(i.b,0,255),a:je(i.a)}},pc=function(i){return{r:he(i.r),g:he(i.g),b:he(i.b),a:he(i.a,3)}},dv=/^#([0-9a-f]{3,8})$/i,Ea=function(i){var t=i.toString(16);return t.length<2?"0"+t:t},Yp=function(i){var t=i.r,e=i.g,r=i.b,n=i.a,s=Math.max(t,e,r),o=s-Math.min(t,e,r),a=o?s===t?(e-r)/o:s===e?2+(r-t)/o:4+(t-e)/o:0;return{h:60*(a<0?a+6:a),s:s?o/s*100:0,v:s/255*100,a:n}},jp=function(i){var t=i.h,e=i.s,r=i.v,n=i.a;t=t/360*6,e/=100,r/=100;var s=Math.floor(t),o=r*(1-e),a=r*(1-(t-s)*e),l=r*(1-(1-t+s)*e),h=s%6;return{r:255*[r,a,o,o,l,r][h],g:255*[l,r,r,a,o,o][h],b:255*[o,o,l,r,r,a][h],a:n}},Jp=function(i){return{h:Kp(i.h),s:je(i.s,0,100),l:je(i.l,0,100),a:je(i.a)}},$p=function(i){return{h:he(i.h),s:he(i.s),l:he(i.l),a:he(i.a,3)}},Qp=function(i){return jp((e=(t=i).s,{h:t.h,s:(e*=((r=t.l)<50?r:100-r)/100)>0?2*e/(r+e)*100:0,v:r+e,a:t.a}));var t,e,r},so=function(i){return{h:(t=Yp(i)).h,s:(n=(200-(e=t.s))*(r=t.v)/100)>0&&n<200?e*r/100/(n<=100?n:200-n)*100:0,l:n/2,a:t.a};var t,e,r,n},fv=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,pv=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,mv=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,gv=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,mc={string:[[function(i){var t=dv.exec(i);return t?(i=t[1]).length<=4?{r:parseInt(i[0]+i[0],16),g:parseInt(i[1]+i[1],16),b:parseInt(i[2]+i[2],16),a:i.length===4?he(parseInt(i[3]+i[3],16)/255,2):1}:i.length===6||i.length===8?{r:parseInt(i.substr(0,2),16),g:parseInt(i.substr(2,2),16),b:parseInt(i.substr(4,2),16),a:i.length===8?he(parseInt(i.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(i){var t=mv.exec(i)||gv.exec(i);return t?t[2]!==t[4]||t[4]!==t[6]?null:zp({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(i){var t=fv.exec(i)||pv.exec(i);if(!t)return null;var e,r,n=Jp({h:(e=t[1],r=t[2],r===void 0&&(r="deg"),Number(e)*(uv[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Qp(n)},"hsl"]],object:[[function(i){var t=i.r,e=i.g,r=i.b,n=i.a,s=n===void 0?1:n;return ir(t)&&ir(e)&&ir(r)?zp({r:Number(t),g:Number(e),b:Number(r),a:Number(s)}):null},"rgb"],[function(i){var t=i.h,e=i.s,r=i.l,n=i.a,s=n===void 0?1:n;if(!ir(t)||!ir(e)||!ir(r))return null;var o=Jp({h:Number(t),s:Number(e),l:Number(r),a:Number(s)});return Qp(o)},"hsl"],[function(i){var t=i.h,e=i.s,r=i.v,n=i.a,s=n===void 0?1:n;if(!ir(t)||!ir(e)||!ir(r))return null;var o=function(a){return{h:Kp(a.h),s:je(a.s,0,100),v:je(a.v,0,100),a:je(a.a)}}({h:Number(t),s:Number(e),v:Number(r),a:Number(s)});return jp(o)},"hsv"]]},qp=function(i,t){for(var e=0;e<t.length;e++){var r=t[e][0](i);if(r)return[r,t[e][1]]}return[null,void 0]},yv=function(i){return typeof i=="string"?qp(i.trim(),mc.string):typeof i=="object"&&i!==null?qp(i,mc.object):[null,void 0]},gc=function(i,t){var e=so(i);return{h:e.h,s:je(e.s+100*t,0,100),l:e.l,a:e.a}},yc=function(i){return(299*i.r+587*i.g+114*i.b)/1e3/255},tm=function(i,t){var e=so(i);return{h:e.h,s:e.s,l:je(e.l+100*t,0,100),a:e.a}},bc=function(){function i(t){this.parsed=yv(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return i.prototype.isValid=function(){return this.parsed!==null},i.prototype.brightness=function(){return he(yc(this.rgba),2)},i.prototype.isDark=function(){return yc(this.rgba)<.5},i.prototype.isLight=function(){return yc(this.rgba)>=.5},i.prototype.toHex=function(){return t=pc(this.rgba),e=t.r,r=t.g,n=t.b,o=(s=t.a)<1?Ea(he(255*s)):"","#"+Ea(e)+Ea(r)+Ea(n)+o;var t,e,r,n,s,o},i.prototype.toRgb=function(){return pc(this.rgba)},i.prototype.toRgbString=function(){return t=pc(this.rgba),e=t.r,r=t.g,n=t.b,(s=t.a)<1?"rgba("+e+", "+r+", "+n+", "+s+")":"rgb("+e+", "+r+", "+n+")";var t,e,r,n,s},i.prototype.toHsl=function(){return $p(so(this.rgba))},i.prototype.toHslString=function(){return t=$p(so(this.rgba)),e=t.h,r=t.s,n=t.l,(s=t.a)<1?"hsla("+e+", "+r+"%, "+n+"%, "+s+")":"hsl("+e+", "+r+"%, "+n+"%)";var t,e,r,n,s},i.prototype.toHsv=function(){return t=Yp(this.rgba),{h:he(t.h),s:he(t.s),v:he(t.v),a:he(t.a,3)};var t},i.prototype.invert=function(){return Ai({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},i.prototype.saturate=function(t){return t===void 0&&(t=.1),Ai(gc(this.rgba,t))},i.prototype.desaturate=function(t){return t===void 0&&(t=.1),Ai(gc(this.rgba,-t))},i.prototype.grayscale=function(){return Ai(gc(this.rgba,-1))},i.prototype.lighten=function(t){return t===void 0&&(t=.1),Ai(tm(this.rgba,t))},i.prototype.darken=function(t){return t===void 0&&(t=.1),Ai(tm(this.rgba,-t))},i.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},i.prototype.alpha=function(t){return typeof t=="number"?Ai({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):he(this.rgba.a,3);var e},i.prototype.hue=function(t){var e=so(this.rgba);return typeof t=="number"?Ai({h:t,s:e.s,l:e.l,a:e.a}):he(e.h)},i.prototype.isEqual=function(t){return this.toHex()===Ai(t).toHex()},i}(),Ai=function(i){return i instanceof bc?i:new bc(i)},em=[],bv=function(i){i.forEach(function(t){em.indexOf(t)<0&&(t(bc,mc),em.push(t))})};function xv(i,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var n in e)r[e[n]]=n;var s={};i.prototype.toName=function(o){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,l,h=r[this.toHex()];if(h)return h;if(o!=null&&o.closest){var c=this.toRgb(),u=1/0,d="black";if(!s.length)for(var f in e)s[f]=new i(e[f]).toRgb();for(var p in e){var m=(a=c,l=s[p],Math.pow(a.r-l.r,2)+Math.pow(a.g-l.g,2)+Math.pow(a.b-l.b,2));m<u&&(u=m,d=p)}return d}},t.string.push([function(o){var a=o.toLowerCase(),l=a==="transparent"?"#0000":e[a];return l?new i(l).toRgb():null},"name"])}bv([xv]);const is=class Eh{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 Eh)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 r=typeof t;if(r!==typeof e)return!1;if(r==="number"||r==="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((n,s)=>n===e[s]);if(t!==null&&e!==null){const n=Object.keys(t),s=Object.keys(e);return n.length!==s.length?!1:n.every(o=>t[o]===e[o])}return t===e}toRgba(){const[t,e,r,n]=this._components;return{r:t,g:e,b:r,a:n}}toRgb(){const[t,e,r]=this._components;return{r:t,g:e,b:r}}toRgbaString(){const[t,e,r]=this.toUint8RgbArray();return`rgba(${t},${e},${r},${this.alpha})`}toUint8RgbArray(t){const[e,r,n]=this._components;return t=t??[],t[0]=Math.round(e*255),t[1]=Math.round(r*255),t[2]=Math.round(n*255),t}toRgbArray(t){t=t??[];const[e,r,n]=this._components;return t[0]=e,t[1]=r,t[2]=n,t}toNumber(){return this._int}toLittleEndianNumber(){const t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){const[e,r,n,s]=Eh.temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=r,this._components[2]*=n,this._components[3]*=s,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 r=this._int>>16&255,n=this._int>>8&255,s=this._int&255;return e&&(r=r*t+.5|0,n=n*t+.5|0,s=s*t+.5|0),(t*255<<24)+(r<<16)+(n<<8)+s}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,r,n]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(r*t)/t,this._components[2]=Math.round(n*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t??[];const[e,r,n,s]=this._components;return t[0]=e,t[1]=r,t[2]=n,t[3]=s,t}normalize(t){let e,r,n,s;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){const o=t;e=(o>>16&255)/255,r=(o>>8&255)/255,n=(o&255)/255,s=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,r,n,s=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,r,n,s=255]=t,e/=255,r/=255,n/=255,s/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const a=Eh.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}const o=Ai(t);o.isValid()&&({r:e,g:r,b:n,a:s}=o.rgba,e/=255,r/=255,n/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=r,this._components[2]=n,this._components[3]=s,this.refreshInt();else throw new Error(`Unable to convert color ${t}`)}refreshInt(){this._clamp(this._components);const[t,e,r]=this._components;this._int=(t*255<<16)+(e*255<<8)+(r*255|0)}_clamp(t,e=0,r=1){return typeof t=="number"?Math.min(Math.max(t,e),r):(t.forEach((n,s)=>{t[s]=Math.min(Math.max(n,e),r)}),t)}};is.shared=new is,is.temp=new is,is.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let Dt=is;function _v(i){return wt("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),Dt.shared.setValue(i).toHex()}function vv(i){return wt("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),Dt.shared.setValue(i).toNumber()}function wv(){const i=[],t=[];for(let r=0;r<32;r++)i[r]=r,t[r]=r;i[mt.NORMAL_NPM]=mt.NORMAL,i[mt.ADD_NPM]=mt.ADD,i[mt.SCREEN_NPM]=mt.SCREEN,t[mt.NORMAL]=mt.NORMAL_NPM,t[mt.ADD]=mt.ADD_NPM,t[mt.SCREEN]=mt.SCREEN_NPM;const e=[];return e.push(t),e.push(i),e}const im=wv();function rm(i,t){return im[t?1:0][i]}function Tv(i,t=null){const e=i*6;if(t=t||new Uint16Array(e),t.length!==e)throw new Error(`Out buffer length is incorrect, got ${t.length} and expected ${e}`);for(let r=0,n=0;r<e;r+=6,n+=4)t[r+0]=n+0,t[r+1]=n+1,t[r+2]=n+2,t[r+3]=n+0,t[r+4]=n+2,t[r+5]=n+3;return t}function nm(i){if(i.BYTES_PER_ELEMENT===4)return i instanceof Float32Array?"Float32Array":i instanceof Uint32Array?"Uint32Array":"Int32Array";if(i.BYTES_PER_ELEMENT===2){if(i instanceof Uint16Array)return"Uint16Array"}else if(i.BYTES_PER_ELEMENT===1&&i instanceof Uint8Array)return"Uint8Array";return null}function Ca(i){return i+=i===0?1:0,--i,i|=i>>>1,i|=i>>>2,i|=i>>>4,i|=i>>>8,i|=i>>>16,i+1}function sm(i){return!(i&i-1)&&!!i}function om(i){let t=(i>65535?1:0)<<4;i>>>=t;let e=(i>255?1:0)<<3;return i>>>=e,t|=e,e=(i>15?1:0)<<2,i>>>=e,t|=e,e=(i>3?1:0)<<1,i>>>=e,t|=e,t|i>>1}function rs(i,t,e){const r=i.length;let n;if(t>=r||e===0)return;e=t+e>r?r-t:e;const s=r-e;for(n=t;n<s;++n)i[n]=i[n+e];i.length=s}function Ir(i){return i===0?0:i<0?-1:1}let Sv=0;function on(){return++Sv}const xc=class{constructor(i,t,e,r){this.left=i,this.top=t,this.right=e,this.bottom=r}get width(){return this.right-this.left}get height(){return this.bottom-this.top}isEmpty(){return this.left===this.right||this.top===this.bottom}};xc.EMPTY=new xc(0,0,0,0);let am=xc;const lm={},Mi=Object.create(null),Ar=Object.create(null);class Ev{constructor(t,e,r){this._canvas=nt.ADAPTER.createCanvas(),this._context=this._canvas.getContext("2d"),this.resolution=r||nt.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 hm(i,t,e){for(let r=0,n=4*e*t;r<t;++r,n+=4)if(i[n+3]!==0)return!1;return!0}function cm(i,t,e,r,n){const s=4*t;for(let o=r,a=r*s+4*e;o<=n;++o,a+=s)if(i[a+3]!==0)return!1;return!0}function Cv(i){const{width:t,height:e}=i,r=i.getContext("2d",{willReadFrequently:!0});if(r===null)throw new TypeError("Failed to get canvas 2D context");const n=r.getImageData(0,0,t,e).data;let s=0,o=0,a=t-1,l=e-1;for(;o<e&&hm(n,t,o);)++o;if(o===e)return am.EMPTY;for(;hm(n,t,l);)--l;for(;cm(n,t,s,o,l);)++s;for(;cm(n,t,a,o,l);)--a;return++a,++l,new am(s,o,a,l)}function Iv(i){const t=Cv(i),{width:e,height:r}=t;let n=null;if(!t.isEmpty()){const s=i.getContext("2d");if(s===null)throw new TypeError("Failed to get canvas 2D context");n=s.getImageData(t.left,t.top,e,r)}return{width:e,height:r,data:n}}function Av(i,t=globalThis.location){if(i.startsWith("data:"))return"";t=t||globalThis.location;const e=new URL(i,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}function rr(i,t=1){var r;const e=(r=nt.RETINA_PREFIX)==null?void 0:r.exec(i);return e?parseFloat(e[1]):t}var q=(i=>(i.Renderer="renderer",i.Application="application",i.RendererSystem="renderer-webgl-system",i.RendererPlugin="renderer-webgl-plugin",i.CanvasRendererSystem="renderer-canvas-system",i.CanvasRendererPlugin="renderer-canvas-plugin",i.Asset="asset",i.LoadParser="load-parser",i.ResolveParser="resolve-parser",i.CacheParser="cache-parser",i.DetectionParser="detection-parser",i))(q||{});const _c=i=>{if(typeof i=="function"||typeof i=="object"&&i.extension){if(!i.extension)throw new Error("Extension class must have an extension object");i={...typeof i.extension!="object"?{type:i.extension}:i.extension,ref:i}}if(typeof i=="object")i={...i};else throw new Error("Invalid extension type");return typeof i.type=="string"&&(i.type=[i.type]),i},um=(i,t)=>_c(i).priority??t,st={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(_c).forEach(t=>{t.type.forEach(e=>{var r,n;return(n=(r=this._removeHandlers)[e])==null?void 0:n.call(r,t)})}),this},add(...i){return i.map(_c).forEach(t=>{t.type.forEach(e=>{const r=this._addHandlers,n=this._queue;r[e]?r[e](t):(n[e]=n[e]||[],n[e].push(t))})}),this},handle(i,t,e){const r=this._addHandlers,n=this._removeHandlers;if(r[i]||n[i])throw new Error(`Extension type ${i} already has a handler`);r[i]=t,n[i]=e;const s=this._queue;return s[i]&&(s[i].forEach(o=>t(o)),delete s[i]),this},handleByMap(i,t){return this.handle(i,e=>{t[e.name]=e.ref},e=>{delete t[e.name]})},handleByList(i,t,e=-1){return this.handle(i,r=>{t.includes(r.ref)||(t.push(r.ref),t.sort((n,s)=>um(s,e)-um(n,e)))},r=>{const n=t.indexOf(r.ref);n!==-1&&t.splice(n,1)})}};class vc{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 Mv=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
11
+ `);function Rv(i){let t="";for(let e=0;e<i;++e)e>0&&(t+=`
12
+ else `),e<i-1&&(t+=`if(test == ${e}.0){}`);return t}function Pv(i,t){if(i===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const e=t.createShader(t.FRAGMENT_SHADER);for(;;){const r=Mv.replace(/%forloop%/gi,Rv(i));if(t.shaderSource(e,r),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))i=i/2|0;else break}return i}const wc=0,Tc=1,Sc=2,Ec=3,Cc=4,Ic=5;class Ri{constructor(){this.data=0,this.blendMode=mt.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<wc)}set blend(t){!!(this.data&1<<wc)!==t&&(this.data^=1<<wc)}get offsets(){return!!(this.data&1<<Tc)}set offsets(t){!!(this.data&1<<Tc)!==t&&(this.data^=1<<Tc)}get culling(){return!!(this.data&1<<Sc)}set culling(t){!!(this.data&1<<Sc)!==t&&(this.data^=1<<Sc)}get depthTest(){return!!(this.data&1<<Ec)}set depthTest(t){!!(this.data&1<<Ec)!==t&&(this.data^=1<<Ec)}get depthMask(){return!!(this.data&1<<Ic)}set depthMask(t){!!(this.data&1<<Ic)!==t&&(this.data^=1<<Ic)}get clockwiseFrontFace(){return!!(this.data&1<<Cc)}set clockwiseFrontFace(t){!!(this.data&1<<Cc)!==t&&(this.data^=1<<Cc)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==mt.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){const t=new Ri;return t.depthTest=!1,t.blend=!0,t}}Ri.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};const Ac=[];function dm(i,t){if(!i)return null;let e="";if(typeof i=="string"){const r=/\.(\w{3,4})(?:$|\?|#)/i.exec(i);r&&(e=r[1].toLowerCase())}for(let r=Ac.length-1;r>=0;--r){const n=Ac[r];if(n.test&&n.test(i,e))return new n(i,t)}throw new Error("Unrecognized source type to auto-detect Resource")}class li{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,r,n,s,o,a,l){if(arguments.length>8)throw new Error("max arguments reached");const{name:h,items:c}=this;this._aliasCount++;for(let u=0,d=c.length;u<d;u++)c[u][h](t,e,r,n,s,o,a,l);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(li.prototype,{dispatch:{value:li.prototype.emit},run:{value:li.prototype.emit}});class oo{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new li("setRealSize"),this.onUpdate=new li("update"),this.onError=new li("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,r){return!1}dispose(){}destroy(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)}static test(t,e){return!1}}class Ia extends oo{constructor(t,e){const{width:r,height:n}=e||{};if(!r||!n)throw new Error("BufferResource width or height invalid");super(r,n),this.data=t,this.unpackAlignment=e.unpackAlignment??4}upload(t,e,r){const n=t.gl;n.pixelStorei(n.UNPACK_ALIGNMENT,this.unpackAlignment),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===Ce.UNPACK);const s=e.realWidth,o=e.realHeight;return r.width===s&&r.height===o?n.texSubImage2D(e.target,0,0,0,s,o,e.format,r.type,this.data):(r.width=s,r.height=o,n.texImage2D(e.target,0,r.internalFormat,s,o,0,e.format,r.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 Lv={scaleMode:$i.NEAREST,alphaMode:Ce.NPM},Mc=class Hs extends js{constructor(t=null,e=null){super(),e=Object.assign({},Hs.defaultOptions,e);const{alphaMode:r,mipmap:n,anisotropicLevel:s,scaleMode:o,width:a,height:l,wrapMode:h,format:c,type:u,target:d,resolution:f,resourceOptions:p}=e;t&&!(t instanceof oo)&&(t=dm(t,p),t.internal=!0),this.resolution=f||nt.RESOLUTION,this.width=Math.round((a||0)*this.resolution)/this.resolution,this.height=Math.round((l||0)*this.resolution)/this.resolution,this._mipmap=n,this.anisotropicLevel=s,this._wrapMode=h,this._scaleMode=o,this.format=c,this.type=u,this.target=d,this.alphaMode=r,this.uid=on(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=a>0&&l>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 r;return t!==void 0&&t!==this.scaleMode&&(this.scaleMode=t,r=!0),e!==void 0&&e!==this.mipmap&&(this.mipmap=e,r=!0),r&&this.dirtyStyleId++,this}setSize(t,e,r){return r=r||this.resolution,this.setRealSize(t*r,e*r,r)}setRealSize(t,e,r){return this.resolution=r||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=sm(this.realWidth)&&sm(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 Ar[this.cacheId],delete Mi[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),Hs.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,r=nt.STRICT_TEXTURE_CACHE){const n=typeof t=="string";let s=null;if(n)s=t;else{if(!t._pixiId){const a=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${a}_${on()}`}s=t._pixiId}let o=Ar[s];if(n&&r&&!o)throw new Error(`The cacheId "${s}" does not exist in BaseTextureCache.`);return o||(o=new Hs(t,e),o.cacheId=s,Hs.addToCache(o,s)),o}static fromBuffer(t,e,r,n){t=t||new Float32Array(e*r*4);const s=new Ia(t,{width:e,height:r,...n==null?void 0:n.resourceOptions});let o,a;return t instanceof Float32Array?(o=z.RGBA,a=ct.FLOAT):t instanceof Int32Array?(o=z.RGBA_INTEGER,a=ct.INT):t instanceof Uint32Array?(o=z.RGBA_INTEGER,a=ct.UNSIGNED_INT):t instanceof Int16Array?(o=z.RGBA_INTEGER,a=ct.SHORT):t instanceof Uint16Array?(o=z.RGBA_INTEGER,a=ct.UNSIGNED_SHORT):t instanceof Int8Array?(o=z.RGBA,a=ct.BYTE):(o=z.RGBA,a=ct.UNSIGNED_BYTE),s.internal=!0,new Hs(s,Object.assign({},Lv,{type:a,format:o},n))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),Ar[e]&&Ar[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),Ar[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=Ar[t];if(e){const r=e.textureCacheIds.indexOf(t);return r>-1&&e.textureCacheIds.splice(r,1),delete Ar[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete Ar[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};Mc.defaultOptions={mipmap:Ti.POW2,anisotropicLevel:0,scaleMode:$i.LINEAR,wrapMode:wi.CLAMP,alphaMode:Ce.UNPACK,target:Hn.TEXTURE_2D,format:z.RGBA,type:ct.UNSIGNED_BYTE},Mc._globalBatch=0;let xt=Mc;class Rc{constructor(){this.texArray=null,this.blend=0,this.type=vi.TRIANGLES,this.start=0,this.size=0,this.data=null}}let Gv=0;class jt{constructor(t,e=!0,r=!1){this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=r,this.static=e,this.id=Gv++,this.disposeRunner=new li("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?Ei.ELEMENT_ARRAY_BUFFER:Ei.ARRAY_BUFFER}get index(){return this.type===Ei.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new jt(t)}}class Aa{constructor(t,e=0,r=!1,n=ct.FLOAT,s,o,a,l=1){this.buffer=t,this.size=e,this.normalized=r,this.type=n,this.stride=s,this.start=o,this.instance=a,this.divisor=l}destroy(){this.buffer=null}static from(t,e,r,n,s){return new Aa(t,e,r,n,s)}}const kv={Float32Array,Uint32Array,Int32Array,Uint8Array};function Fv(i,t){let e=0,r=0;const n={};for(let l=0;l<i.length;l++)r+=t[l],e+=i[l].length;const s=new ArrayBuffer(e*4);let o=null,a=0;for(let l=0;l<i.length;l++){const h=t[l],c=i[l],u=nm(c);n[u]||(n[u]=new kv[u](s)),o=n[u];for(let d=0;d<c.length;d++){const f=(d/h|0)*r+a,p=d%h;o[f+p]=c[d]}a+=h}return new Float32Array(s)}const fm={5126:4,5123:2,5121:1};let Dv=0;const Nv={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array};class Mr{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=Dv++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new li("disposeGeometry"),this.refCount=0}addAttribute(t,e,r=0,n=!1,s,o,a,l=!1){if(!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof jt||(e instanceof Array&&(e=new Float32Array(e)),e=new jt(e));const h=t.split("|");if(h.length>1){for(let u=0;u<h.length;u++)this.addAttribute(h[u],e,r,n,s);return this}let c=this.buffers.indexOf(e);return c===-1&&(this.buffers.push(e),c=this.buffers.length-1),this.attributes[t]=new Aa(c,r,n,s,o,a,l),this.instanced=this.instanced||l,this}getAttribute(t){return this.attributes[t]}getBuffer(t){return this.buffers[this.getAttribute(t).buffer]}addIndex(t){return t instanceof jt||(t instanceof Array&&(t=new Uint16Array(t)),t=new jt(t)),t.type=Ei.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=[],r=new jt;let n;for(n in this.attributes){const s=this.attributes[n],o=this.buffers[s.buffer];t.push(o.data),e.push(s.size*fm[s.type]/4),s.buffer=0}for(r.data=Fv(t,e),n=0;n<this.buffers.length;n++)this.buffers[n]!==this.indexBuffer&&this.buffers[n].destroy();return this.buffers=[r],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 Mr;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new jt(this.buffers[e].data.slice(0));for(const e in this.attributes){const r=this.attributes[e];t.attributes[e]=new Aa(r.buffer,r.size,r.normalized,r.type,r.stride,r.start,r.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.type=Ei.ELEMENT_ARRAY_BUFFER),t}static merge(t){const e=new Mr,r=[],n=[],s=[];let o;for(let a=0;a<t.length;a++){o=t[a];for(let l=0;l<o.buffers.length;l++)n[l]=n[l]||0,n[l]+=o.buffers[l].data.length,s[l]=0}for(let a=0;a<o.buffers.length;a++)r[a]=new Nv[nm(o.buffers[a].data)](n[a]),e.buffers[a]=new jt(r[a]);for(let a=0;a<t.length;a++){o=t[a];for(let l=0;l<o.buffers.length;l++)r[l].set(o.buffers[l].data,s[l]),s[l]+=o.buffers[l].data.length}if(e.attributes=o.attributes,o.indexBuffer){e.indexBuffer=e.buffers[o.buffers.indexOf(o.indexBuffer)],e.indexBuffer.type=Ei.ELEMENT_ARRAY_BUFFER;let a=0,l=0,h=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&&(l+=d.size*fm[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+h]+=a;a+=t[u].buffers[c].data.length/l,h+=d.length}}return e}}class pm extends Mr{constructor(t=!1){super(),this._buffer=new jt(null,t,!1),this._indexBuffer=new jt(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,ct.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,ct.FLOAT).addAttribute("aColor",this._buffer,4,!0,ct.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,ct.FLOAT).addIndex(this._indexBuffer)}}const Ma=Math.PI*2,Ov=180/Math.PI,Bv=Math.PI/180;var pe=(i=>(i[i.POLY=0]="POLY",i[i.RECT=1]="RECT",i[i.CIRC=2]="CIRC",i[i.ELIP=3]="ELIP",i[i.RREC=4]="RREC",i))(pe||{});class dt{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new dt(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}}dt.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};const Ra=[new dt,new dt,new dt,new dt];class gt{constructor(t=0,e=0,r=0,n=0){this.x=Number(t),this.y=Number(e),this.width=Number(r),this.height=Number(n),this.type=pe.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 gt(0,0,0,0)}clone(){return new gt(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 I=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=I)return!1;const M=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>M}const r=this.left,n=this.right,s=this.top,o=this.bottom;if(n<=r||o<=s)return!1;const a=Ra[0].set(t.left,t.top),l=Ra[1].set(t.left,t.bottom),h=Ra[2].set(t.right,t.top),c=Ra[3].set(t.right,t.bottom);if(h.x<=a.x||l.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(l,l),e.apply(h,h),e.apply(c,c),Math.max(a.x,l.x,h.x,c.x)<=r||Math.min(a.x,l.x,h.x,c.x)>=n||Math.max(a.y,l.y,h.y,c.y)<=s||Math.min(a.y,l.y,h.y,c.y)>=o))return!1;const d=u*(l.y-a.y),f=u*(a.x-l.x),p=d*r+f*s,m=d*n+f*s,g=d*r+f*o,y=d*n+f*o;if(Math.max(p,m,g,y)<=d*a.x+f*a.y||Math.min(p,m,g,y)>=d*c.x+f*c.y)return!1;const x=u*(a.y-h.y),b=u*(h.x-a.x),v=x*r+b*s,w=x*n+b*s,S=x*r+b*o,C=x*n+b*o;return!(Math.max(v,w,S,C)<=x*a.x+b*a.y||Math.min(v,w,S,C)>=x*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),r=Math.min(this.x+this.width,t.x+t.width),n=Math.max(this.y,t.y),s=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(r-e,0),this.y=n,this.height=Math.max(s-n,0),this}ceil(t=1,e=.001){const r=Math.ceil((this.x+this.width-e)*t)/t,n=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=r-this.x,this.height=n-this.y,this}enlarge(t){const e=Math.min(this.x,t.x),r=Math.max(this.x+this.width,t.x+t.width),n=Math.min(this.y,t.y),s=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=r-e,this.y=n,this.height=s-n,this}}gt.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class Pa{constructor(t=0,e=0,r=0){this.x=t,this.y=e,this.radius=r,this.type=pe.CIRC}clone(){return new Pa(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const r=this.radius*this.radius;let n=this.x-t,s=this.y-e;return n*=n,s*=s,n+s<=r}getBounds(){return new gt(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}Pa.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};class La{constructor(t=0,e=0,r=0,n=0){this.x=t,this.y=e,this.width=r,this.height=n,this.type=pe.ELIP}clone(){return new La(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let r=(t-this.x)/this.width,n=(e-this.y)/this.height;return r*=r,n*=n,r+n<=1}getBounds(){return new gt(this.x-this.width,this.y-this.height,this.width,this.height)}}La.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class an{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){const r=[];for(let n=0,s=e.length;n<s;n++)r.push(e[n].x,e[n].y);e=r}this.points=e,this.type=pe.POLY,this.closeStroke=!0}clone(){const t=this.points.slice(),e=new an(t);return e.closeStroke=this.closeStroke,e}contains(t,e){let r=!1;const n=this.points.length/2;for(let s=0,o=n-1;s<n;o=s++){const a=this.points[s*2],l=this.points[s*2+1],h=this.points[o*2],c=this.points[o*2+1];l>e!=c>e&&t<(h-a)*((e-l)/(c-l))+a&&(r=!r)}return r}}an.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((i,t)=>`${i}, ${t}`,"")}]`};class Ga{constructor(t=0,e=0,r=0,n=0,s=20){this.x=t,this.y=e,this.width=r,this.height=n,this.radius=s,this.type=pe.RREC}clone(){return new Ga(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 r=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+r&&e<=this.y+this.height-r||t>=this.x+r&&t<=this.x+this.width-r)return!0;let n=t-(this.x+r),s=e-(this.y+r);const o=r*r;if(n*n+s*s<=o||(n=t-(this.x+this.width-r),n*n+s*s<=o)||(s=e-(this.y+this.height-r),n*n+s*s<=o)||(n=t-(this.x+r),n*n+s*s<=o))return!0}return!1}}Ga.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,r=0,n=1,s=0,o=0){this.array=null,this.a=t,this.b=e,this.c=r,this.d=n,this.tx=s,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,r,n,s,o){return this.a=t,this.b=e,this.c=r,this.d=n,this.tx=s,this.ty=o,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const r=e||this.array;return t?(r[0]=this.a,r[1]=this.b,r[2]=0,r[3]=this.c,r[4]=this.d,r[5]=0,r[6]=this.tx,r[7]=this.ty,r[8]=1):(r[0]=this.a,r[1]=this.c,r[2]=this.tx,r[3]=this.b,r[4]=this.d,r[5]=this.ty,r[6]=0,r[7]=0,r[8]=1),r}apply(t,e){e=e||new dt;const r=t.x,n=t.y;return e.x=this.a*r+this.c*n+this.tx,e.y=this.b*r+this.d*n+this.ty,e}applyInverse(t,e){e=e||new dt;const r=1/(this.a*this.d+this.c*-this.b),n=t.x,s=t.y;return e.x=this.d*r*n+-this.c*r*s+(this.ty*this.c-this.tx*this.d)*r,e.y=this.a*r*s+-this.b*r*n+(-this.ty*this.a+this.tx*this.b)*r,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),r=Math.sin(t),n=this.a,s=this.c,o=this.tx;return this.a=n*e-this.b*r,this.b=n*r+this.b*e,this.c=s*e-this.d*r,this.d=s*r+this.d*e,this.tx=o*e-this.ty*r,this.ty=o*r+this.ty*e,this}append(t){const e=this.a,r=this.b,n=this.c,s=this.d;return this.a=t.a*e+t.b*n,this.b=t.a*r+t.b*s,this.c=t.c*e+t.d*n,this.d=t.c*r+t.d*s,this.tx=t.tx*e+t.ty*n+this.tx,this.ty=t.tx*r+t.ty*s+this.ty,this}setTransform(t,e,r,n,s,o,a,l,h){return this.a=Math.cos(a+h)*s,this.b=Math.sin(a+h)*s,this.c=-Math.sin(a-l)*o,this.d=Math.cos(a-l)*o,this.tx=t-(r*this.a+n*this.c),this.ty=e-(r*this.b+n*this.d),this}prepend(t){const e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){const r=this.a,n=this.c;this.a=r*t.a+this.b*t.c,this.b=r*t.b+this.b*t.d,this.c=n*t.a+this.d*t.c,this.d=n*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,r=this.b,n=this.c,s=this.d,o=t.pivot,a=-Math.atan2(-n,s),l=Math.atan2(r,e),h=Math.abs(a+l);return h<1e-5||Math.abs(Ma-h)<1e-5?(t.rotation=l,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=l),t.scale.x=Math.sqrt(e*e+r*r),t.scale.y=Math.sqrt(n*n+s*s),t.position.x=this.tx+(o.x*e+o.y*n),t.position.y=this.ty+(o.x*r+o.y*s),t}invert(){const t=this.a,e=this.b,r=this.c,n=this.d,s=this.tx,o=t*n-e*r;return this.a=n/o,this.b=-e/o,this.c=-r/o,this.d=t/o,this.tx=(r*this.ty-n*s)/o,this.ty=-(t*this.ty-e*s)/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 ln=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],hn=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],cn=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],un=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Pc=[],mm=[],ka=Math.sign;function Uv(){for(let i=0;i<16;i++){const t=[];Pc.push(t);for(let e=0;e<16;e++){const r=ka(ln[i]*ln[e]+cn[i]*hn[e]),n=ka(hn[i]*ln[e]+un[i]*hn[e]),s=ka(ln[i]*cn[e]+cn[i]*un[e]),o=ka(hn[i]*cn[e]+un[i]*un[e]);for(let a=0;a<16;a++)if(ln[a]===r&&hn[a]===n&&cn[a]===s&&un[a]===o){t.push(a);break}}}for(let i=0;i<16;i++){const t=new Nt;t.set(ln[i],hn[i],cn[i],un[i],0,0),mm.push(t)}}Uv();const Zt={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:i=>ln[i],uY:i=>hn[i],vX:i=>cn[i],vY:i=>un[i],inv:i=>i&8?i&15:-i&7,add:(i,t)=>Pc[i][t],sub:(i,t)=>Pc[i][Zt.inv(t)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,t)=>Math.abs(i)*2<=Math.abs(t)?t>=0?Zt.S:Zt.N:Math.abs(t)*2<=Math.abs(i)?i>0?Zt.E:Zt.W:t>0?i>0?Zt.SE:Zt.SW:i>0?Zt.NE:Zt.NW,matrixAppendRotationInv:(i,t,e=0,r=0)=>{const n=mm[Zt.inv(t)];n.tx=e,n.ty=r,i.append(n)}};class nr{constructor(t,e,r=0,n=0){this._x=r,this._y=n,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new nr(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))}}nr.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};const Lc=class{constructor(){this.worldTransform=new Nt,this.localTransform=new Nt,this.position=new nr(this.onChange,this,0,0),this.scale=new nr(this.onChange,this,1,1),this.pivot=new nr(this.onChange,this,0,0),this.skew=new nr(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}onChange(){this._localID++}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++}updateLocalTransform(){const i=this.localTransform;this._localID!==this._currentLocalID&&(i.a=this._cx*this.scale.x,i.b=this._sx*this.scale.x,i.c=this._cy*this.scale.y,i.d=this._sy*this.scale.y,i.tx=this.position.x-(this.pivot.x*i.a+this.pivot.y*i.c),i.ty=this.position.y-(this.pivot.x*i.b+this.pivot.y*i.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(i){const t=this.localTransform;if(this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==i._worldID){const e=i.worldTransform,r=this.worldTransform;r.a=t.a*e.a+t.b*e.c,r.b=t.a*e.b+t.b*e.d,r.c=t.c*e.a+t.d*e.c,r.d=t.c*e.b+t.d*e.d,r.tx=t.tx*e.a+t.ty*e.c+e.tx,r.ty=t.tx*e.b+t.ty*e.d+e.ty,this._parentID=i._worldID,this._worldID++}}setFromMatrix(i){i.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(i){this._rotation!==i&&(this._rotation=i,this.updateSkew())}};Lc.IDENTITY=new Lc;let Gc=Lc;Gc.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 Xv=`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
- }`,gv=`attribute vec2 aVertexPosition;
18
+ }`,Wv=`attribute vec2 aVertexPosition;
19
19
  attribute vec2 aTextureCoord;
20
20
 
21
21
  uniform mat3 projectionMatrix;
@@ -26,64 +26,64 @@ void main(void){
26
26
  gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
27
27
  vTextureCoord = aTextureCoord;
28
28
  }
29
- `;function sm(r,t,e){const i=r.createShader(t);return r.shaderSource(i,e),r.compileShader(i),i}function Rc(r){const t=new Array(r);for(let e=0;e<t.length;e++)t[e]=!1;return t}function nm(r,t){switch(r){case"float":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*t);case"ivec3":return new Int32Array(3*t);case"ivec4":return new Int32Array(4*t);case"uvec2":return new Uint32Array(2*t);case"uvec3":return new Uint32Array(3*t);case"uvec4":return new Uint32Array(4*t);case"bool":return!1;case"bvec2":return Rc(2*t);case"bvec3":return Rc(3*t);case"bvec4":return Rc(4*t);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}const tn=[{test:r=>r.type==="float"&&r.size===1&&!r.isArray,code:r=>`
30
- if(uv["${r}"] !== ud["${r}"].value)
29
+ `;function gm(i,t,e){const r=i.createShader(t);return i.shaderSource(r,e),i.compileShader(r),r}function kc(i){const t=new Array(i);for(let e=0;e<t.length;e++)t[e]=!1;return t}function ym(i,t){switch(i){case"float":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*t);case"ivec3":return new Int32Array(3*t);case"ivec4":return new Int32Array(4*t);case"uvec2":return new Uint32Array(2*t);case"uvec3":return new Uint32Array(3*t);case"uvec4":return new Uint32Array(4*t);case"bool":return!1;case"bvec2":return kc(2*t);case"bvec3":return kc(3*t);case"bvec4":return kc(4*t);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}const ns=[{test:i=>i.type==="float"&&i.size===1&&!i.isArray,code:i=>`
30
+ if(uv["${i}"] !== ud["${i}"].value)
31
31
  {
32
- ud["${r}"].value = uv["${r}"]
33
- gl.uniform1f(ud["${r}"].location, uv["${r}"])
32
+ ud["${i}"].value = uv["${i}"]
33
+ gl.uniform1f(ud["${i}"].location, uv["${i}"])
34
34
  }
35
- `},{test:(r,t)=>(r.type==="sampler2D"||r.type==="samplerCube"||r.type==="sampler2DArray")&&r.size===1&&!r.isArray&&(t==null||t.castToBaseTexture!==void 0),code:r=>`t = syncData.textureCount++;
35
+ `},{test:(i,t)=>(i.type==="sampler2D"||i.type==="samplerCube"||i.type==="sampler2DArray")&&i.size===1&&!i.isArray&&(t==null||t.castToBaseTexture!==void 0),code:i=>`t = syncData.textureCount++;
36
36
 
37
- renderer.texture.bind(uv["${r}"], t);
37
+ renderer.texture.bind(uv["${i}"], t);
38
38
 
39
- if(ud["${r}"].value !== t)
39
+ if(ud["${i}"].value !== t)
40
40
  {
41
- ud["${r}"].value = t;
42
- gl.uniform1i(ud["${r}"].location, t);
41
+ ud["${i}"].value = t;
42
+ gl.uniform1i(ud["${i}"].location, t);
43
43
  ; // eslint-disable-line max-len
44
- }`},{test:(r,t)=>r.type==="mat3"&&r.size===1&&!r.isArray&&t.a!==void 0,code:r=>`
45
- gl.uniformMatrix3fv(ud["${r}"].location, false, uv["${r}"].toArray(true));
46
- `,codeUbo:r=>`
47
- var ${r}_matrix = uv.${r}.toArray(true);
48
-
49
- data[offset] = ${r}_matrix[0];
50
- data[offset+1] = ${r}_matrix[1];
51
- data[offset+2] = ${r}_matrix[2];
44
+ }`},{test:(i,t)=>i.type==="mat3"&&i.size===1&&!i.isArray&&t.a!==void 0,code:i=>`
45
+ gl.uniformMatrix3fv(ud["${i}"].location, false, uv["${i}"].toArray(true));
46
+ `,codeUbo:i=>`
47
+ var ${i}_matrix = uv.${i}.toArray(true);
48
+
49
+ data[offset] = ${i}_matrix[0];
50
+ data[offset+1] = ${i}_matrix[1];
51
+ data[offset+2] = ${i}_matrix[2];
52
52
 
53
- data[offset + 4] = ${r}_matrix[3];
54
- data[offset + 5] = ${r}_matrix[4];
55
- data[offset + 6] = ${r}_matrix[5];
53
+ data[offset + 4] = ${i}_matrix[3];
54
+ data[offset + 5] = ${i}_matrix[4];
55
+ data[offset + 6] = ${i}_matrix[5];
56
56
 
57
- data[offset + 8] = ${r}_matrix[6];
58
- data[offset + 9] = ${r}_matrix[7];
59
- data[offset + 10] = ${r}_matrix[8];
60
- `},{test:(r,t)=>r.type==="vec2"&&r.size===1&&!r.isArray&&t.x!==void 0,code:r=>`
61
- cv = ud["${r}"].value;
62
- v = uv["${r}"];
57
+ data[offset + 8] = ${i}_matrix[6];
58
+ data[offset + 9] = ${i}_matrix[7];
59
+ data[offset + 10] = ${i}_matrix[8];
60
+ `},{test:(i,t)=>i.type==="vec2"&&i.size===1&&!i.isArray&&t.x!==void 0,code:i=>`
61
+ cv = ud["${i}"].value;
62
+ v = uv["${i}"];
63
63
 
64
64
  if(cv[0] !== v.x || cv[1] !== v.y)
65
65
  {
66
66
  cv[0] = v.x;
67
67
  cv[1] = v.y;
68
- gl.uniform2f(ud["${r}"].location, v.x, v.y);
69
- }`,codeUbo:r=>`
70
- v = uv.${r};
68
+ gl.uniform2f(ud["${i}"].location, v.x, v.y);
69
+ }`,codeUbo:i=>`
70
+ v = uv.${i};
71
71
 
72
72
  data[offset] = v.x;
73
73
  data[offset+1] = v.y;
74
- `},{test:r=>r.type==="vec2"&&r.size===1&&!r.isArray,code:r=>`
75
- cv = ud["${r}"].value;
76
- v = uv["${r}"];
74
+ `},{test:i=>i.type==="vec2"&&i.size===1&&!i.isArray,code:i=>`
75
+ cv = ud["${i}"].value;
76
+ v = uv["${i}"];
77
77
 
78
78
  if(cv[0] !== v[0] || cv[1] !== v[1])
79
79
  {
80
80
  cv[0] = v[0];
81
81
  cv[1] = v[1];
82
- gl.uniform2f(ud["${r}"].location, v[0], v[1]);
82
+ gl.uniform2f(ud["${i}"].location, v[0], v[1]);
83
83
  }
84
- `},{test:(r,t)=>r.type==="vec4"&&r.size===1&&!r.isArray&&t.width!==void 0,code:r=>`
85
- cv = ud["${r}"].value;
86
- v = uv["${r}"];
84
+ `},{test:(i,t)=>i.type==="vec4"&&i.size===1&&!i.isArray&&t.width!==void 0,code:i=>`
85
+ cv = ud["${i}"].value;
86
+ v = uv["${i}"];
87
87
 
88
88
  if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)
89
89
  {
@@ -91,17 +91,17 @@ void main(void){
91
91
  cv[1] = v.y;
92
92
  cv[2] = v.width;
93
93
  cv[3] = v.height;
94
- gl.uniform4f(ud["${r}"].location, v.x, v.y, v.width, v.height)
95
- }`,codeUbo:r=>`
96
- v = uv.${r};
94
+ gl.uniform4f(ud["${i}"].location, v.x, v.y, v.width, v.height)
95
+ }`,codeUbo:i=>`
96
+ v = uv.${i};
97
97
 
98
98
  data[offset] = v.x;
99
99
  data[offset+1] = v.y;
100
100
  data[offset+2] = v.width;
101
101
  data[offset+3] = v.height;
102
- `},{test:(r,t)=>r.type==="vec4"&&r.size===1&&!r.isArray&&t.red!==void 0,code:r=>`
103
- cv = ud["${r}"].value;
104
- v = uv["${r}"];
102
+ `},{test:(i,t)=>i.type==="vec4"&&i.size===1&&!i.isArray&&t.red!==void 0,code:i=>`
103
+ cv = ud["${i}"].value;
104
+ v = uv["${i}"];
105
105
 
106
106
  if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha)
107
107
  {
@@ -109,17 +109,17 @@ void main(void){
109
109
  cv[1] = v.green;
110
110
  cv[2] = v.blue;
111
111
  cv[3] = v.alpha;
112
- gl.uniform4f(ud["${r}"].location, v.red, v.green, v.blue, v.alpha)
113
- }`,codeUbo:r=>`
114
- v = uv.${r};
112
+ gl.uniform4f(ud["${i}"].location, v.red, v.green, v.blue, v.alpha)
113
+ }`,codeUbo:i=>`
114
+ v = uv.${i};
115
115
 
116
116
  data[offset] = v.red;
117
117
  data[offset+1] = v.green;
118
118
  data[offset+2] = v.blue;
119
119
  data[offset+3] = v.alpha;
120
- `},{test:(r,t)=>r.type==="vec3"&&r.size===1&&!r.isArray&&t.red!==void 0,code:r=>`
121
- cv = ud["${r}"].value;
122
- v = uv["${r}"];
120
+ `},{test:(i,t)=>i.type==="vec3"&&i.size===1&&!i.isArray&&t.red!==void 0,code:i=>`
121
+ cv = ud["${i}"].value;
122
+ v = uv["${i}"];
123
123
 
124
124
  if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.a)
125
125
  {
@@ -127,16 +127,16 @@ void main(void){
127
127
  cv[1] = v.green;
128
128
  cv[2] = v.blue;
129
129
 
130
- gl.uniform3f(ud["${r}"].location, v.red, v.green, v.blue)
131
- }`,codeUbo:r=>`
132
- v = uv.${r};
130
+ gl.uniform3f(ud["${i}"].location, v.red, v.green, v.blue)
131
+ }`,codeUbo:i=>`
132
+ v = uv.${i};
133
133
 
134
134
  data[offset] = v.red;
135
135
  data[offset+1] = v.green;
136
136
  data[offset+2] = v.blue;
137
- `},{test:r=>r.type==="vec4"&&r.size===1&&!r.isArray,code:r=>`
138
- cv = ud["${r}"].value;
139
- v = uv["${r}"];
137
+ `},{test:i=>i.type==="vec4"&&i.size===1&&!i.isArray,code:i=>`
138
+ cv = ud["${i}"].value;
139
+ v = uv["${i}"];
140
140
 
141
141
  if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
142
142
  {
@@ -145,8 +145,8 @@ void main(void){
145
145
  cv[2] = v[2];
146
146
  cv[3] = v[3];
147
147
 
148
- gl.uniform4f(ud["${r}"].location, v[0], v[1], v[2], v[3])
149
- }`}],yv={float:`
148
+ gl.uniform4f(ud["${i}"].location, v[0], v[1], v[2], v[3])
149
+ }`}],Zv={float:`
150
150
  if (cv !== v)
151
151
  {
152
152
  cu.value = v;
@@ -282,36 +282,36 @@ void main(void){
282
282
  cu.value = v;
283
283
 
284
284
  gl.uniform1i(location, v);
285
- }`},bv={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 xv(r,t){var i;const e=[`
285
+ }`},Vv={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 Hv(i,t){var r;const e=[`
286
286
  var v = null;
287
287
  var cv = null;
288
288
  var cu = null;
289
289
  var t = 0;
290
290
  var gl = renderer.gl;
291
- `];for(const s in r.uniforms){const n=t[s];if(!n){((i=r.uniforms[s])==null?void 0:i.group)===!0&&(r.uniforms[s].ubo?e.push(`
292
- renderer.shader.syncUniformBufferGroup(uv.${s}, '${s}');
291
+ `];for(const n in i.uniforms){const s=t[n];if(!s){((r=i.uniforms[n])==null?void 0:r.group)===!0&&(i.uniforms[n].ubo?e.push(`
292
+ renderer.shader.syncUniformBufferGroup(uv.${n}, '${n}');
293
293
  `):e.push(`
294
- renderer.shader.syncUniformGroup(uv.${s}, syncData);
295
- `));continue}const o=r.uniforms[s];let a=!1;for(let h=0;h<tn.length;h++)if(tn[h].test(n,o)){e.push(tn[h].code(s,o)),a=!0;break}if(!a){const h=(n.size===1&&!n.isArray?yv:bv)[n.type].replace("location",`ud["${s}"].location`);e.push(`
296
- cu = ud["${s}"];
294
+ renderer.shader.syncUniformGroup(uv.${n}, syncData);
295
+ `));continue}const o=i.uniforms[n];let a=!1;for(let l=0;l<ns.length;l++)if(ns[l].test(s,o)){e.push(ns[l].code(n,o)),a=!0;break}if(!a){const l=(s.size===1&&!s.isArray?Zv:Vv)[s.type].replace("location",`ud["${n}"].location`);e.push(`
296
+ cu = ud["${n}"];
297
297
  cv = cu.value;
298
- v = uv["${s}"];
299
- ${h};`)}}return new Function("ud","uv","renderer","syncData",e.join(`
300
- `))}const om={};let en=om;function _v(){if(en===om||en!=null&&en.isContextLost()){const r=st.ADAPTER.createCanvas();let t;st.PREFER_ENV>=Jr.WEBGL2&&(t=r.getContext("webgl2",{})),t||(t=r.getContext("webgl",{})||r.getContext("experimental-webgl",{}),t?t.getExtension("WEBGL_draw_buffers"):t=null),en=t}return en}let La;function vv(){if(!La){La=Ye.MEDIUM;const r=_v();if(r&&r.getShaderPrecisionFormat){const t=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);t&&(La=t.precision?Ye.HIGH:Ye.MEDIUM)}}return La}function am(r,t){const e=r.getShaderSource(t).split(`
301
- `).map((l,c)=>`${c}: ${l}`),i=r.getShaderInfoLog(t),s=i.split(`
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 wv(r,t,e,i){r.getProgramParameter(t,r.LINK_STATUS)||(r.getShaderParameter(e,r.COMPILE_STATUS)||am(r,e),r.getShaderParameter(i,r.COMPILE_STATUS)||am(r,i),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(t)))}const Tv={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 hm(r){return Tv[r]}let Ga=null;const lm={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 cm(r,t){if(!Ga){const e=Object.keys(lm);Ga={};for(let i=0;i<e.length;++i){const s=e[i];Ga[r[s]]=lm[s]}}return Ga[t]}function um(r,t,e){if(r.substring(0,9)!=="precision"){let i=t;return t===Ye.HIGH&&e!==Ye.HIGH&&(i=Ye.MEDIUM),`precision ${i} float;
304
- ${r}`}else if(e!==Ye.HIGH&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}let so;function Sv(){if(typeof so=="boolean")return so;try{so=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{so=!1}return so}let Ev=0;const Fa={},Pc=class Zn{constructor(t,e,i="pixi-shader",s={}){this.extra={},this.id=Ev++,this.vertexSrc=t||Zn.defaultVertexSrc,this.fragmentSrc=e||Zn.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,"-"),Fa[i]?(Fa[i]++,i+=`-${Fa[i]}`):Fa[i]=1,this.vertexSrc=`#define SHADER_NAME ${i}
305
- ${this.vertexSrc}`,this.fragmentSrc=`#define SHADER_NAME ${i}
306
- ${this.fragmentSrc}`,this.vertexSrc=um(this.vertexSrc,Zn.defaultVertexPrecision,Ye.HIGH),this.fragmentSrc=um(this.fragmentSrc,Zn.defaultFragmentPrecision,vv())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return gv}static get defaultFragmentSrc(){return mv}static from(t,e,i){const s=t+e;let n=Jp[s];return n||(Jp[s]=n=new Zn(t,e,i)),n}};Pc.defaultVertexPrecision=Ye.HIGH,Pc.defaultFragmentPrecision=Qi.apple.device?Ye.HIGH:Ye.MEDIUM;let sr=Pc,Cv=0;class hi{constructor(t,e,i){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=Cv++,this.static=!!e,this.ubo=!!i,t instanceof zt?(this.buffer=t,this.buffer.type=Si.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=t,this.ubo&&(this.buffer=new zt(new Float32Array(1)),this.buffer.type=Si.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 hi(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 hi(t,e,i)}static uboFrom(t,e){return new hi(t,e??!0,!0)}}class Ri{constructor(t,e){this.uniformBindCount=0,this.program=t,e?e instanceof hi?this.uniformGroup=e:this.uniformGroup=new hi(e):this.uniformGroup=new hi({}),this.disposeRunner=new ai("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=sr.from(t,e);return new Ri(s,i)}}class Iv{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]=hi.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 sr(this.vertexSrc,s)}const e={tint:new Float32Array([1,1,1,1]),translationMatrix:new Dt,default:this.defaultGroupCache[t]};return new Ri(this.programCache[t],e)}generateSampleSrc(t){let e="";e+=`
298
+ v = uv["${n}"];
299
+ ${l};`)}}return new Function("ud","uv","renderer","syncData",e.join(`
300
+ `))}const bm={};let ss=bm;function Kv(){if(ss===bm||ss!=null&&ss.isContextLost()){const i=nt.ADAPTER.createCanvas();let t;nt.PREFER_ENV>=tn.WEBGL2&&(t=i.getContext("webgl2",{})),t||(t=i.getContext("webgl",{})||i.getContext("experimental-webgl",{}),t?t.getExtension("WEBGL_draw_buffers"):t=null),ss=t}return ss}let Fa;function zv(){if(!Fa){Fa=Ye.MEDIUM;const i=Kv();if(i&&i.getShaderPrecisionFormat){const t=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT);t&&(Fa=t.precision?Ye.HIGH:Ye.MEDIUM)}}return Fa}function xm(i,t){const e=i.getShaderSource(t).split(`
301
+ `).map((h,c)=>`${c}: ${h}`),r=i.getShaderInfoLog(t),n=r.split(`
302
+ `),s={},o=n.map(h=>parseFloat(h.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(h=>h&&!s[h]?(s[h]=!0,!0):!1),a=[""];o.forEach(h=>{e[h-1]=`%c${e[h-1]}%c`,a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});const l=e.join(`
303
+ `);a[0]=l,console.error(r),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function Yv(i,t,e,r){i.getProgramParameter(t,i.LINK_STATUS)||(i.getShaderParameter(e,i.COMPILE_STATUS)||xm(i,e),i.getShaderParameter(r,i.COMPILE_STATUS)||xm(i,r),console.error("PixiJS Error: Could not initialize shader."),i.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",i.getProgramInfoLog(t)))}const jv={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 _m(i){return jv[i]}let Da=null;const vm={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 wm(i,t){if(!Da){const e=Object.keys(vm);Da={};for(let r=0;r<e.length;++r){const n=e[r];Da[i[n]]=vm[n]}}return Da[t]}function Tm(i,t,e){if(i.substring(0,9)!=="precision"){let r=t;return t===Ye.HIGH&&e!==Ye.HIGH&&(r=Ye.MEDIUM),`precision ${r} float;
304
+ ${i}`}else if(e!==Ye.HIGH&&i.substring(0,15)==="precision highp")return i.replace("precision highp","precision mediump");return i}let ao;function Jv(){if(typeof ao=="boolean")return ao;try{ao=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{ao=!1}return ao}let $v=0;const Na={},Fc=class Ks{constructor(t,e,r="pixi-shader",n={}){this.extra={},this.id=$v++,this.vertexSrc=t||Ks.defaultVertexSrc,this.fragmentSrc=e||Ks.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),this.extra=n,this.vertexSrc.substring(0,8)!=="#version"&&(r=r.replace(/\s+/g,"-"),Na[r]?(Na[r]++,r+=`-${Na[r]}`):Na[r]=1,this.vertexSrc=`#define SHADER_NAME ${r}
305
+ ${this.vertexSrc}`,this.fragmentSrc=`#define SHADER_NAME ${r}
306
+ ${this.fragmentSrc}`,this.vertexSrc=Tm(this.vertexSrc,Ks.defaultVertexPrecision,Ye.HIGH),this.fragmentSrc=Tm(this.fragmentSrc,Ks.defaultFragmentPrecision,zv())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return Wv}static get defaultFragmentSrc(){return Xv}static from(t,e,r){const n=t+e;let s=lm[n];return s||(lm[n]=s=new Ks(t,e,r)),s}};Fc.defaultVertexPrecision=Ye.HIGH,Fc.defaultFragmentPrecision=qi.apple.device?Ye.HIGH:Ye.MEDIUM;let sr=Fc,Qv=0;class hi{constructor(t,e,r){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=Qv++,this.static=!!e,this.ubo=!!r,t instanceof jt?(this.buffer=t,this.buffer.type=Ei.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=t,this.ubo&&(this.buffer=new jt(new Float32Array(1)),this.buffer.type=Ei.UNIFORM_BUFFER,this.autoManage=!0))}update(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update()}add(t,e,r){if(!this.ubo)this.uniforms[t]=new hi(e,r);else throw new Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them")}static from(t,e,r){return new hi(t,e,r)}static uboFrom(t,e){return new hi(t,e??!0,!0)}}class Pi{constructor(t,e){this.uniformBindCount=0,this.program=t,e?e instanceof hi?this.uniformGroup=e:this.uniformGroup=new hi(e):this.uniformGroup=new hi({}),this.disposeRunner=new li("disposeShader")}checkUniformExists(t,e){if(e.uniforms[t])return!0;for(const r in e.uniforms){const n=e.uniforms[r];if(n.group===!0&&this.checkUniformExists(t,n))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,r){const n=sr.from(t,e);return new Pi(n,r)}}class qv{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 r=new Int32Array(t);for(let s=0;s<t;s++)r[s]=s;this.defaultGroupCache[t]=hi.from({uSamplers:r},!0);let n=this.fragTemplate;n=n.replace(/%count%/gi,`${t}`),n=n.replace(/%forloop%/gi,this.generateSampleSrc(t)),this.programCache[t]=new sr(this.vertexSrc,n)}const e={tint:new Float32Array([1,1,1,1]),translationMatrix:new Nt,default:this.defaultGroupCache[t]};return new Pi(this.programCache[t],e)}generateSampleSrc(t){let e="";e+=`
307
307
  `,e+=`
308
- `;for(let i=0;i<t;i++)i>0&&(e+=`
309
- else `),i<t-1&&(e+=`if(vTextureId < ${i}.5)`),e+=`
308
+ `;for(let r=0;r<t;r++)r>0&&(e+=`
309
+ else `),r<t-1&&(e+=`if(vTextureId < ${r}.5)`),e+=`
310
310
  {`,e+=`
311
- color = texture2D(uSamplers[${i}], vTextureCoord);`,e+=`
311
+ color = texture2D(uSamplers[${r}], vTextureCoord);`,e+=`
312
312
  }`;return e+=`
313
313
  `,e+=`
314
- `,e}}class Lc{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 Av(){return!Qi.apple.device}function Mv(r){let t=!0;const e=st.ADAPTER.getNavigator();if(Qi.tablet||Qi.phone){if(Qi.apple.device){const i=e.userAgent.match(/OS (\d+)_(\d+)?/);i&&parseInt(i[1],10)<11&&(t=!1)}if(Qi.android.device){const i=e.userAgent.match(/Android\s([0-9.]*)/);i&&parseInt(i[1],10)<7&&(t=!1)}}return t?r:4}class Na{constructor(t){this.renderer=t}flush(){}destroy(){this.renderer=null}start(){}stop(){this.flush()}render(t){}}var Rv=`varying vec2 vTextureCoord;
314
+ `,e}}class Dc{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 tw(){return!qi.apple.device}function ew(i){let t=!0;const e=nt.ADAPTER.getNavigator();if(qi.tablet||qi.phone){if(qi.apple.device){const r=e.userAgent.match(/OS (\d+)_(\d+)?/);r&&parseInt(r[1],10)<11&&(t=!1)}if(qi.android.device){const r=e.userAgent.match(/Android\s([0-9.]*)/);r&&parseInt(r[1],10)<7&&(t=!1)}}return t?i:4}class Oa{constructor(t){this.renderer=t}flush(){}destroy(){this.renderer=null}start(){}stop(){this.flush()}render(t){}}var iw=`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
- `,Pv=`precision highp float;
324
+ `,rw=`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 no=class xi extends Na{constructor(t){super(t),this.setShaderGenerator(),this.geometryClass=im,this.vertexSize=6,this.state=Mi.for2d(),this.size=xi.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??Mv(32),this._defaultMaxTextures}static set defaultMaxTextures(t){this._defaultMaxTextures=t}static get canUploadSameBuffer(){return this._canUploadSameBuffer=this._canUploadSameBuffer??Av(),this._canUploadSameBuffer}static set canUploadSameBuffer(t){this._canUploadSameBuffer=t}get MAX_TEXTURES(){return wt("7.1.0","BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures"),this.maxTextures}static get defaultVertexSrc(){return Pv}static get defaultFragmentTemplate(){return Rv}setShaderGenerator({vertex:t=xi.defaultVertexSrc,fragment:e=xi.defaultFragmentTemplate}={}){this.shaderGenerator=new Iv(t,e)}contextChange(){const t=this.renderer.gl;st.PREFER_ENV===Jr.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),xi.defaultMaxTextures),this.maxTextures=nv(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}=xi,i=this.size/4,s=Math.floor(i/this.maxTextures)+1;for(;t.length<i;)t.push(new Cc);for(;e.length<s;)e.push(new Lc);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=xi._textureArrayPool,s=this.renderer.batch,n=this._tempBoundTextures,o=this.renderer.textureGC.count;let a=++xt._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;xt._globalBatch=a}buildDrawCalls(t,e,i){const{_bufferedElements:s,_attributeBuffer:n,_indexBuffer:o,vertexSize:a}=this,h=xi._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 p=s[f],m=p._texture.baseTexture,g=Vp[m.alphaMode?1:0][p.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(p,n,o,c,u),c+=p.vertexData.length/2*a,u+=p.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;xi.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=xi._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),xi.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=Ta(Math.ceil(t/8)),i=zp(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 yc(s*this.vertexSize*4)),n}getIndexBuffer(t){const e=Ta(Math.ceil(t/12)),i=zp(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),p=kt.shared.setValue(t._tintRGB).toPremultiplied(f,t._texture.baseTexture.alphaMode>0);for(let m=0;m<u.length;m+=2)a[s++]=u[m],a[s++]=u[m+1],a[s++]=l[m],a[s++]=l[m+1],o[s++]=p,a[s++]=d;for(let m=0;m<c.length;m++)i[n++]=h+c[m]}};no.defaultBatchSize=4096,no.extension={name:"batch",type:q.RendererPlugin},no._drawCallPool=[],no._textureArrayPool=[];let as=no;nt.add(as);var Lv=`varying vec2 vTextureCoord;
345
+ `;const lo=class _i extends Oa{constructor(t){super(t),this.setShaderGenerator(),this.geometryClass=pm,this.vertexSize=6,this.state=Ri.for2d(),this.size=_i.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??ew(32),this._defaultMaxTextures}static set defaultMaxTextures(t){this._defaultMaxTextures=t}static get canUploadSameBuffer(){return this._canUploadSameBuffer=this._canUploadSameBuffer??tw(),this._canUploadSameBuffer}static set canUploadSameBuffer(t){this._canUploadSameBuffer=t}get MAX_TEXTURES(){return wt("7.1.0","BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures"),this.maxTextures}static get defaultVertexSrc(){return rw}static get defaultFragmentTemplate(){return iw}setShaderGenerator({vertex:t=_i.defaultVertexSrc,fragment:e=_i.defaultFragmentTemplate}={}){this.shaderGenerator=new qv(t,e)}contextChange(){const t=this.renderer.gl;nt.PREFER_ENV===tn.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),_i.defaultMaxTextures),this.maxTextures=Pv(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}=_i,r=this.size/4,n=Math.floor(r/this.maxTextures)+1;for(;t.length<r;)t.push(new Rc);for(;e.length<n;)e.push(new Dc);for(let s=0;s<this.maxTextures;s++)this._tempBoundTextures[s]=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,r=_i._textureArrayPool,n=this.renderer.batch,s=this._tempBoundTextures,o=this.renderer.textureGC.count;let a=++xt._globalBatch,l=0,h=r[0],c=0;n.copyBoundTextures(s,e);for(let u=0;u<this._bufferSize;++u){const d=t[u];t[u]=null,d._batchEnabled!==a&&(h.count>=e&&(n.boundArray(h,s,a,e),this.buildDrawCalls(h,c,u),c=u,h=r[++l],++a),d._batchEnabled=a,d.touched=o,h.elements[h.count++]=d)}h.count>0&&(n.boundArray(h,s,a,e),this.buildDrawCalls(h,c,this._bufferSize),++l,++a);for(let u=0;u<s.length;u++)s[u]=null;xt._globalBatch=a}buildDrawCalls(t,e,r){const{_bufferedElements:n,_attributeBuffer:s,_indexBuffer:o,vertexSize:a}=this,l=_i._drawCallPool;let h=this._dcIndex,c=this._aIndex,u=this._iIndex,d=l[h];d.start=this._iIndex,d.texArray=t;for(let f=e;f<r;++f){const p=n[f],m=p._texture.baseTexture,g=im[m.alphaMode?1:0][p.blendMode];n[f]=null,e<f&&d.blend!==g&&(d.size=u-d.start,e=f,d=l[++h],d.texArray=t,d.start=u),this.packInterleavedGeometry(p,s,o,c,u),c+=p.vertexData.length/2*a,u+=p.indices.length,d.blend=g}e<r&&(d.size=u-d.start,++h),this._dcIndex=h,this._aIndex=c,this._iIndex=u}bindAndClearTexArray(t){const e=this.renderer.texture;for(let r=0;r<t.count;r++)e.bind(t.elements[r],t.ids[r]),t.elements[r]=null;t.count=0}updateGeometry(){const{_packedGeometries:t,_attributeBuffer:e,_indexBuffer:r}=this;_i.canUploadSameBuffer?(t[this._flushId]._buffer.update(e.rawBinaryData),t[this._flushId]._indexBuffer.update(r),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(r),this.renderer.geometry.bind(t[this._flushId]),this.renderer.geometry.updateBuffers(),this._flushId++)}drawBatches(){const t=this._dcIndex,{gl:e,state:r}=this.renderer,n=_i._drawCallPool;let s=null;for(let o=0;o<t;o++){const{texArray:a,type:l,size:h,start:c,blend:u}=n[o];s!==a&&(s=a,this.bindAndClearTexArray(a)),this.state.blendMode=u,r.set(this.state),e.drawElements(l,h,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),_i.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=Ca(Math.ceil(t/8)),r=om(e),n=e*8;this._aBuffers.length<=r&&(this._iBuffers.length=r+1);let s=this._aBuffers[n];return s||(this._aBuffers[n]=s=new vc(n*this.vertexSize*4)),s}getIndexBuffer(t){const e=Ca(Math.ceil(t/12)),r=om(e),n=e*12;this._iBuffers.length<=r&&(this._iBuffers.length=r+1);let s=this._iBuffers[r];return s||(this._iBuffers[r]=s=new Uint16Array(n)),s}packInterleavedGeometry(t,e,r,n,s){const{uint32View:o,float32View:a}=e,l=n/this.vertexSize,h=t.uvs,c=t.indices,u=t.vertexData,d=t._texture.baseTexture._batchLocation,f=Math.min(t.worldAlpha,1),p=Dt.shared.setValue(t._tintRGB).toPremultiplied(f,t._texture.baseTexture.alphaMode>0);for(let m=0;m<u.length;m+=2)a[n++]=u[m],a[n++]=u[m+1],a[n++]=h[m],a[n++]=h[m+1],o[n++]=p,a[n++]=d;for(let m=0;m<c.length;m++)r[s++]=l+c[m]}};lo.defaultBatchSize=4096,lo.extension={name:"batch",type:q.RendererPlugin},lo._drawCallPool=[],lo._textureArrayPool=[];let dn=lo;st.add(dn);var nw=`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
- `,Gv=`attribute vec2 aVertexPosition;
352
+ `,sw=`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 Gc=class ia extends Ri{constructor(t,e,i){const s=sr.from(t||ia.defaultVertexSrc,e||ia.defaultFragmentSrc);super(s,i),this.padding=0,this.resolution=ia.defaultResolution,this.multisample=ia.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new Mi}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 Gv}static get defaultFragmentSrc(){return Lv}};Gc.defaultResolution=1,Gc.defaultMultisample=Jt.NONE;let we=Gc;class ka{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new kt(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(){}}ka.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},ka.extension={type:[q.RendererSystem,q.CanvasRendererSystem],name:"background"},nt.add(ka);class dm{constructor(t){this.renderer=t,this.emptyRenderer=new Na(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}}dm.extension={type:q.RendererSystem,name:"batch"},nt.add(dm);let fm=0;class Da{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=fm++}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=fm++,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(st.PREFER_ENV>=Jr.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")}}Da.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},Da.extension={type:q.RendererSystem,name:"context"},nt.add(Da);class Fc{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 ai("disposeFramebuffer"),this.multisample=Jt.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new xt(null,{scaleMode:Ji.NEAREST,resolution:1,mipmap:wi.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new xt(null,{scaleMode:Ji.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:wi.OFF,format:Y.DEPTH_COMPONENT,type:ct.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 pm extends xt{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=wi.OFF,this.valid=!0,this._clear=new kt([0,0,0,0]),this.framebuffer=new Fc(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 Ir extends ro{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=iv(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===Ee.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 mm extends Ir{constructor(t,e){if(e=e||{},typeof t=="string"){const i=new Image;Ir.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??st.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===Ee.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 Nc{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}}Nc.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 gm=new Nc;function Oa(r){r.destroy=function(){},r.on=function(){},r.once=function(){},r.emit=function(){}}class ot extends Kn{constructor(t,e,i,s,n,o,a){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new gt(0,0,1,1)),t instanceof ot&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=s,this.valid=!1,this.destroyed=!1,this._uvs=gm,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 dt(o.x,o.y):new dt(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&&Ai[e.url]&&ot.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,ot.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 ot(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===gm&&(this._uvs=new Nc),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},i=st.STRICT_TEXTURE_CACHE){const s=typeof t=="string";let n=null;if(s)n=t;else if(t instanceof xt){if(!t.cacheId){const a=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t.cacheId=`${a}-${es()}`,xt.addToCache(t,t.cacheId)}n=t.cacheId}else{if(!t._pixiId){const a=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${a}_${es()}`}n=t._pixiId}let o=Ai[n];if(s&&i&&!o)throw new Error(`The cacheId "${n}" does not exist in TextureCache.`);return!o&&!(t instanceof xt)?(e.resolution||(e.resolution=ir(t)),o=new ot(new xt(t,e)),o.baseTexture.cacheId=n,xt.addToCache(o.baseTexture,n),ot.addToCache(o,n)):!o&&t instanceof xt&&(o=new ot(t),ot.addToCache(o,n)),o}static fromURL(t,e){const i=Object.assign({autoLoad:!1},e==null?void 0:e.resourceOptions),s=ot.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 ot(xt.fromBuffer(t,e,i,s))}static fromLoader(t,e,i,s){const n=new xt(t,Object.assign({scaleMode:xt.defaultOptions.scaleMode,resolution:ir(e)},s)),{resource:o}=n;o instanceof mm&&(o.url=e);const a=new ot(n);return i||(i=e),xt.addToCache(a.baseTexture,i),ot.addToCache(a,i),i!==e&&(xt.addToCache(a.baseTexture,e),ot.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),Ai[e]&&Ai[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),Ai[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=Ai[t];if(e){const i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete Ai[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)Ai[t.textureCacheIds[e]]===t&&delete Ai[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 ot._EMPTY||(ot._EMPTY=new ot(new xt),Oa(ot._EMPTY),Oa(ot._EMPTY.baseTexture)),ot._EMPTY}static get WHITE(){if(!ot._WHITE){const t=st.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),ot._WHITE=new ot(xt.from(t)),Oa(ot._WHITE),Oa(ot._WHITE.baseTexture)}return ot._WHITE}}class hs extends ot{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 hs(new pm(t))}}class ym{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 pm(Object.assign({width:t,height:e,resolution:1,multisample:i},this.textureOptions));return new hs(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=Ta(t),e=Ta(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}}}ym.SCREEN_KEY=-1;class Fv extends Cr{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}}class bm extends Cr{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 zt(this.vertices),this.uvBuffer=new zt(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 Nv{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=Jt.NONE,this.sourceFrame=new gt,this.destinationFrame=new gt,this.bindingSourceFrame=new gt,this.bindingDestinationFrame=new gt,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}}const Ba=[new dt,new dt,new dt,new dt],kc=new Dt;class xm{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new ym,this.statePool=[],this.quad=new Fv,this.quadUv=new bm,this.tempRect=new gt,this.activeState={},this.globalUniforms=new hi({outputFrame:new gt,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 Nv,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 p=this.tempRect.copyFrom(o.sourceFrame);i.projection.transform&&this.transformAABB(kc.copyFrom(i.projection.transform).invert(),p),d?(n.sourceFrame.fit(p),(n.sourceFrame.width<=0||n.sourceFrame.height<=0)&&(n.sourceFrame.width=0,n.sourceFrame.height=0)):n.sourceFrame.intersects(p)||(n.sourceFrame.width=0,n.sourceFrame.height=0),this.roundFrame(n.sourceFrame,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 m=this.tempRect;m.x=0,m.y=0,m.width=n.sourceFrame.width,m.height=n.sourceFrame.height,n.renderTexture.filterFrame=n.sourceFrame,n.bindingSourceFrame.copyFrom(o.sourceFrame),n.bindingDestinationFrame.copyFrom(o.destinationFrame),n.transform=i.projection.transform,i.projection.transform=null,o.bind(n.renderTexture,n.sourceFrame,m),i.framebuffer.clear(0,0,0,0)}pop(){const t=this.defaultFilterStack,e=t.pop(),i=e.filters;this.activeState=e;const s=this.globalUniforms.uniforms;s.outputFrame=e.sourceFrame,s.resolution=e.resolution;const n=s.inputSize,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(_i.TRIANGLES)):(n.geometry.bind(this.quad),n.geometry.draw(_i.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(Dt.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=Ba[0],s=Ba[1],n=Ba[2],o=Ba[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?kc.copyFrom(n):kc.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)}}}xm.extension={type:q.RendererSystem,name:"filter"},nt.add(xm);class kv{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 Dv=new gt;class _m{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Fc(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 gt,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;st.PREFER_ENV===Jr.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=Il.COLOR|Il.DEPTH){const{gl:o}=this;o.clearColor(t,e,i,s),o.clear(n)}initFramebuffer(t){const{gl:e}=this,i=new kv(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 Fc(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=Dv,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 gt}destroy(){this.renderer=null}}_m.extension={type:q.RendererSystem,name:"framebuffer"},nt.add(_m);const Dc={5126:4,5123:2,5121:1};class vm{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;st.PREFER_ENV===Jr.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={},p={};for(const m in u)f[m]=0,p[m]=0;for(const m in d)!d[m].size&&a.attributeData[m]?d[m].size=a.attributeData[m].size:d[m].size||console.warn(`PIXI Geometry attribute '${m}' size cannot be determined (likely the bound shader does not have the attribute)`),f[d[m].buffer]+=d[m].size*Dc[d[m].type];for(const m in d){const g=d[m],y=g.size;g.stride===void 0&&(f[g.buffer]===y*Dc[g.type]?g.stride=0:g.stride=f[g.buffer]),g.start===void 0&&(g.start=p[g.buffer],p[g.buffer]+=y*Dc[g.type])}c=s.createVertexArray(),s.bindVertexArray(c);for(let m=0;m<u.length;m++){const g=u[m];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(Si.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}}vm.extension={type:q.RendererSystem,name:"geometry"},nt.add(vm);const wm=new Dt;class Tm{constructor(t,e){this._texture=t,this.mapCoord=new Dt,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&&(wm.set(s.width/n.width,0,0,s.height/n.height,-n.x/n.width,-n.y/n.height),this.mapCoord.append(wm));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 Ov=`varying vec2 vMaskCoord;
378
+ `;const Nc=class sa extends Pi{constructor(t,e,r){const n=sr.from(t||sa.defaultVertexSrc,e||sa.defaultFragmentSrc);super(n,r),this.padding=0,this.resolution=sa.defaultResolution,this.multisample=sa.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new Ri}apply(t,e,r,n,s){t.applyFilter(this,e,r,n)}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 sw}static get defaultFragmentSrc(){return nw}};Nc.defaultResolution=1,Nc.defaultMultisample=$t.NONE;let Te=Nc;class Ba{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new Dt(0),this.alpha=1}init(t){this.clearBeforeRender=t.clearBeforeRender;const{backgroundColor:e,background:r,backgroundAlpha:n}=t,s=r??e;s!==void 0&&(this.color=s),this.alpha=n}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(){}}Ba.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},Ba.extension={type:[q.RendererSystem,q.CanvasRendererSystem],name:"background"},st.add(Ba);class Sm{constructor(t){this.renderer=t,this.emptyRenderer=new Oa(t),this.currentRenderer=this.emptyRenderer}setObjectRenderer(t){this.currentRenderer!==t&&(this.currentRenderer.stop(),this.currentRenderer=t,this.currentRenderer.start())}flush(){this.setObjectRenderer(this.emptyRenderer)}reset(){this.setObjectRenderer(this.emptyRenderer)}copyBoundTextures(t,e){const{boundTextures:r}=this.renderer.texture;for(let n=e-1;n>=0;--n)t[n]=r[n]||null,t[n]&&(t[n]._batchLocation=n)}boundArray(t,e,r,n){const{elements:s,ids:o,count:a}=t;let l=0;for(let h=0;h<a;h++){const c=s[h],u=c._batchLocation;if(u>=0&&u<n&&e[u]===c){o[h]=u;continue}for(;l<n;){const d=e[l];if(d&&d._batchEnabled===r&&d._batchLocation===l){l++;continue}o[h]=l,c._batchLocation=l,e[l]=c;break}}}destroy(){this.renderer=null}}Sm.extension={type:q.RendererSystem,name:"batch"},st.add(Sm);let Em=0;class Ua{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=Em++}init(t){if(t.context)this.initFromContext(t.context);else{const e=this.renderer.background.alpha<1,r=t.premultipliedAlpha;this.preserveDrawingBuffer=t.preserveDrawingBuffer,this.useContextAlpha=t.useContextAlpha,this.powerPreference=t.powerPreference,this.initFromOptions({alpha:e,premultipliedAlpha:r,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=Em++,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 r;if(nt.PREFER_ENV>=tn.WEBGL2&&(r=t.getContext("webgl2",e)),r)this.webGLVersion=2;else if(this.webGLVersion=1,r=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!r)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=r,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(),r="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;r&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const n=r||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=n,n||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}}Ua.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},Ua.extension={type:q.RendererSystem,name:"context"},st.add(Ua);class Oc{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 li("disposeFramebuffer"),this.multisample=$t.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new xt(null,{scaleMode:$i.NEAREST,resolution:1,mipmap:Ti.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new xt(null,{scaleMode:$i.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:Ti.OFF,format:z.DEPTH_COMPONENT,type:ct.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 r=0;r<this.colorTextures.length;r++){const n=this.colorTextures[r],s=n.resolution;n.setSize(t/s,e/s)}if(this.depthTexture){const r=this.depthTexture.resolution;this.depthTexture.setSize(t/r,e/r)}}}dispose(){this.disposeRunner.emit(this,!1)}destroyDepthTexture(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)}}class Cm extends xt{constructor(t={}){if(typeof t=="number"){const e=arguments[0],r=arguments[1],n=arguments[2],s=arguments[3];t={width:e,height:r,scaleMode:n,resolution:s}}t.width=t.width??100,t.height=t.height??100,t.multisample??(t.multisample=$t.NONE),super(null,t),this.mipmap=Ti.OFF,this.valid=!0,this._clear=new Dt([0,0,0,0]),this.framebuffer=new Oc(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 Rr extends oo{constructor(t){const e=t,r=e.naturalWidth||e.videoWidth||e.width,n=e.naturalHeight||e.videoHeight||e.height;super(r,n),this.source=t,this.noSubImage=!1}static crossOrigin(t,e,r){r===void 0&&!e.startsWith("data:")?t.crossOrigin=Av(e):r!==!1&&(t.crossOrigin=typeof r=="string"?r:"anonymous")}upload(t,e,r,n){const s=t.gl,o=e.realWidth,a=e.realHeight;if(n=n||this.source,typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement){if(!n.complete||n.naturalWidth===0)return!1}else if(typeof HTMLVideoElement<"u"&&n instanceof HTMLVideoElement&&n.readyState<=1)return!1;return s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===Ce.UNPACK),!this.noSubImage&&e.target===s.TEXTURE_2D&&r.width===o&&r.height===a?s.texSubImage2D(s.TEXTURE_2D,0,0,0,e.format,r.type,n):(r.width=o,r.height=a,s.texImage2D(e.target,0,r.internalFormat,e.format,r.type,n)),!0}update(){if(this.destroyed)return;const t=this.source,e=t.naturalWidth||t.videoWidth||t.width,r=t.naturalHeight||t.videoHeight||t.height;this.resize(e,r),super.update()}dispose(){this.source=null}}class Im extends Rr{constructor(t,e){if(e=e||{},typeof t=="string"){const r=new Image;Rr.crossOrigin(r,t,e.crossorigin),r.src=t,t=r}super(t),!t.complete&&this._width&&this._height&&(this._width=0,this._height=0),this.url=t.src,this._process=null,this.preserveBitmap=!1,this.createBitmap=(e.createBitmap??nt.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,r)=>{const n=this.source;this.url=n.src;const s=()=>{this.destroyed||(n.onload=null,n.onerror=null,this.update(),this._load=null,this.createBitmap?e(this.process()):e(this))};n.complete&&n.src?s():(n.onload=s,n.onerror=o=>{r(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,r=!t.crossOrigin||t.crossOrigin==="anonymous";return this._process=fetch(t.src,{mode:r?"cors":"no-cors"}).then(n=>n.blob()).then(n=>e(n,0,0,t.width,t.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===Ce.UNPACK?"premultiply":"none"})).then(n=>this.destroyed?Promise.reject():(this.bitmap=n,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(t,e,r){if(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(t,e,r);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(t,e,r,this.bitmap),!this.preserveBitmap){let n=!0;const s=e._glTextures;for(const o in s){const a=s[o];if(a!==r&&a.dirtyId!==e.dirtyId){n=!1;break}}n&&(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 Bc{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,r){const n=e.width,s=e.height;if(r){const o=t.width/2/n,a=t.height/2/s,l=t.x/n+o,h=t.y/s+a;r=Zt.add(r,Zt.NW),this.x0=l+o*Zt.uX(r),this.y0=h+a*Zt.uY(r),r=Zt.add(r,2),this.x1=l+o*Zt.uX(r),this.y1=h+a*Zt.uY(r),r=Zt.add(r,2),this.x2=l+o*Zt.uX(r),this.y2=h+a*Zt.uY(r),r=Zt.add(r,2),this.x3=l+o*Zt.uX(r),this.y3=h+a*Zt.uY(r)}else this.x0=t.x/n,this.y0=t.y/s,this.x1=(t.x+t.width)/n,this.y1=t.y/s,this.x2=(t.x+t.width)/n,this.y2=(t.y+t.height)/s,this.x3=t.x/n,this.y3=(t.y+t.height)/s;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}}Bc.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 Am=new Bc;function Xa(i){i.destroy=function(){},i.on=function(){},i.once=function(){},i.emit=function(){}}class ot extends js{constructor(t,e,r,n,s,o,a){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new gt(0,0,1,1)),t instanceof ot&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=n,this.valid=!1,this.destroyed=!1,this._uvs=Am,this.uvMatrix=null,this.orig=r||e,this._rotate=Number(s||0),s===!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 dt(o.x,o.y):new dt(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&&Mi[e.url]&&ot.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,ot.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){var n;const t=this._frame.clone(),e=this._frame===this.orig?t:this.orig.clone(),r=new ot(this.baseTexture,!this.noFrame&&t,e,(n=this.trim)==null?void 0:n.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(r._frame=t),r}updateUvs(){this._uvs===Am&&(this._uvs=new Bc),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},r=nt.STRICT_TEXTURE_CACHE){const n=typeof t=="string";let s=null;if(n)s=t;else if(t instanceof xt){if(!t.cacheId){const a=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t.cacheId=`${a}-${on()}`,xt.addToCache(t,t.cacheId)}s=t.cacheId}else{if(!t._pixiId){const a=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${a}_${on()}`}s=t._pixiId}let o=Mi[s];if(n&&r&&!o)throw new Error(`The cacheId "${s}" does not exist in TextureCache.`);return!o&&!(t instanceof xt)?(e.resolution||(e.resolution=rr(t)),o=new ot(new xt(t,e)),o.baseTexture.cacheId=s,xt.addToCache(o.baseTexture,s),ot.addToCache(o,s)):!o&&t instanceof xt&&(o=new ot(t),ot.addToCache(o,s)),o}static fromURL(t,e){const r=Object.assign({autoLoad:!1},e==null?void 0:e.resourceOptions),n=ot.from(t,Object.assign({resourceOptions:r},e),!1),s=n.baseTexture.resource;return n.baseTexture.valid?Promise.resolve(n):s.load().then(()=>Promise.resolve(n))}static fromBuffer(t,e,r,n){return new ot(xt.fromBuffer(t,e,r,n))}static fromLoader(t,e,r,n){const s=new xt(t,Object.assign({scaleMode:xt.defaultOptions.scaleMode,resolution:rr(e)},n)),{resource:o}=s;o instanceof Im&&(o.url=e);const a=new ot(s);return r||(r=e),xt.addToCache(a.baseTexture,r),ot.addToCache(a,r),r!==e&&(xt.addToCache(a.baseTexture,e),ot.addToCache(a,e)),a.baseTexture.valid?Promise.resolve(a):new Promise(l=>{a.baseTexture.once("loaded",()=>l(a))})}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),Mi[e]&&Mi[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),Mi[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=Mi[t];if(e){const r=e.textureCacheIds.indexOf(t);return r>-1&&e.textureCacheIds.splice(r,1),delete Mi[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)Mi[t.textureCacheIds[e]]===t&&delete Mi[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:r,width:n,height:s}=t,o=e+n>this.baseTexture.width,a=r+s>this.baseTexture.height;if(o||a){const l=o&&a?"and":"or",h=`X: ${e} + ${n} = ${e+n} > ${this.baseTexture.width}`,c=`Y: ${r} + ${s} = ${r+s} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${h} ${l} ${c}`)}this.valid=n&&s&&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 ot._EMPTY||(ot._EMPTY=new ot(new xt),Xa(ot._EMPTY),Xa(ot._EMPTY.baseTexture)),ot._EMPTY}static get WHITE(){if(!ot._WHITE){const t=nt.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),ot._WHITE=new ot(xt.from(t)),Xa(ot._WHITE),Xa(ot._WHITE.baseTexture)}return ot._WHITE}}class fn extends ot{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,r=!0){const n=this.baseTexture.resolution,s=Math.round(t*n)/n,o=Math.round(e*n)/n;this.valid=s>0&&o>0,this._frame.width=this.orig.width=s,this._frame.height=this.orig.height=o,r&&this.baseTexture.resize(s,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 fn(new Cm(t))}}class Mm{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,r=$t.NONE){const n=new Cm(Object.assign({width:t,height:e,resolution:1,multisample:r},this.textureOptions));return new fn(n)}getOptimalTexture(t,e,r=1,n=$t.NONE){let s;t=Math.max(Math.ceil(t*r-1e-6),1),e=Math.max(Math.ceil(e*r-1e-6),1),!this.enableFullScreen||t!==this._pixelsWidth||e!==this._pixelsHeight?(t=Ca(t),e=Ca(e),s=((t&65535)<<16|e&65535)>>>0,n>1&&(s+=n*4294967296)):s=n>1?-n:-1,this.texturePool[s]||(this.texturePool[s]=[]);let o=this.texturePool[s].pop();return o||(o=this.createTexture(t,e,n)),o.filterPoolKey=s,o.setResolution(r),o}getFilterTexture(t,e,r){const n=this.getOptimalTexture(t.width,t.height,e||t.resolution,r||$t.NONE);return n.filterFrame=t.filterFrame,n}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 r=this.texturePool[e];if(r)for(let n=0;n<r.length;n++)r[n].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 r=this.texturePool[e];if(r)for(let n=0;n<r.length;n++)r[n].destroy(!0);this.texturePool[e]=[]}this._pixelsWidth=t.width,this._pixelsHeight=t.height}}}Mm.SCREEN_KEY=-1;class ow extends Mr{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}}class Rm extends Mr{constructor(){super(),this.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),this.uvs=new Float32Array([0,0,1,0,1,1,0,1]),this.vertexBuffer=new jt(this.vertices),this.uvBuffer=new jt(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(t,e){let r=0,n=0;return this.uvs[0]=r,this.uvs[1]=n,this.uvs[2]=r+e.width/t.width,this.uvs[3]=n,this.uvs[4]=r+e.width/t.width,this.uvs[5]=n+e.height/t.height,this.uvs[6]=r,this.uvs[7]=n+e.height/t.height,r=e.x,n=e.y,this.vertices[0]=r,this.vertices[1]=n,this.vertices[2]=r+e.width,this.vertices[3]=n,this.vertices[4]=r+e.width,this.vertices[5]=n+e.height,this.vertices[6]=r,this.vertices[7]=n+e.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}}class aw{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=$t.NONE,this.sourceFrame=new gt,this.destinationFrame=new gt,this.bindingSourceFrame=new gt,this.bindingDestinationFrame=new gt,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}}const Wa=[new dt,new dt,new dt,new dt],Uc=new Nt;class Pm{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new Mm,this.statePool=[],this.quad=new ow,this.quadUv=new Rm,this.tempRect=new gt,this.activeState={},this.globalUniforms=new hi({outputFrame:new gt,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 r=this.renderer,n=this.defaultFilterStack,s=this.statePool.pop()||new aw,o=r.renderTexture;let a,l;if(o.current){const g=o.current;a=g.resolution,l=g.multisample}else a=r.resolution,l=r.multisample;let h=e[0].resolution||a,c=e[0].multisample??l,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];h=Math.min(h,y.resolution||a),c=Math.min(c,y.multisample??l),u=this.useMaxPadding?Math.max(u,y.padding):u+y.padding,d=d&&y.autoFit,f=f||(y.legacy??!0)}n.length===1&&(this.defaultFilterStack[0].renderTexture=o.current),n.push(s),s.resolution=h,s.multisample=c,s.legacy=f,s.target=t,s.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),s.sourceFrame.pad(u);const p=this.tempRect.copyFrom(o.sourceFrame);r.projection.transform&&this.transformAABB(Uc.copyFrom(r.projection.transform).invert(),p),d?(s.sourceFrame.fit(p),(s.sourceFrame.width<=0||s.sourceFrame.height<=0)&&(s.sourceFrame.width=0,s.sourceFrame.height=0)):s.sourceFrame.intersects(p)||(s.sourceFrame.width=0,s.sourceFrame.height=0),this.roundFrame(s.sourceFrame,o.current?o.current.resolution:r.resolution,o.sourceFrame,o.destinationFrame,r.projection.transform),s.renderTexture=this.getOptimalFilterTexture(s.sourceFrame.width,s.sourceFrame.height,h,c),s.filters=e,s.destinationFrame.width=s.renderTexture.width,s.destinationFrame.height=s.renderTexture.height;const m=this.tempRect;m.x=0,m.y=0,m.width=s.sourceFrame.width,m.height=s.sourceFrame.height,s.renderTexture.filterFrame=s.sourceFrame,s.bindingSourceFrame.copyFrom(o.sourceFrame),s.bindingDestinationFrame.copyFrom(o.destinationFrame),s.transform=r.projection.transform,r.projection.transform=null,o.bind(s.renderTexture,s.sourceFrame,m),r.framebuffer.clear(0,0,0,0)}pop(){const t=this.defaultFilterStack,e=t.pop(),r=e.filters;this.activeState=e;const n=this.globalUniforms.uniforms;n.outputFrame=e.sourceFrame,n.resolution=e.resolution;const s=n.inputSize,o=n.inputPixel,a=n.inputClamp;if(s[0]=e.destinationFrame.width,s[1]=e.destinationFrame.height,s[2]=1/s[0],s[3]=1/s[1],o[0]=Math.round(s[0]*e.resolution),o[1]=Math.round(s[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*s[2]-.5*o[2],a[3]=e.sourceFrame.height*s[3]-.5*o[3],e.legacy){const h=n.filterArea;h[0]=e.destinationFrame.width,h[1]=e.destinationFrame.height,h[2]=e.sourceFrame.x,h[3]=e.sourceFrame.y,n.filterClamp=n.inputClamp}this.globalUniforms.update();const l=t[t.length-1];if(this.renderer.framebuffer.blit(),r.length===1)r[0].apply(this,e.renderTexture,l.renderTexture,Si.BLEND,e),this.returnFilterTexture(e.renderTexture);else{let h=e.renderTexture,c=this.getOptimalFilterTexture(h.width,h.height,e.resolution);c.filterFrame=h.filterFrame;let u=0;for(u=0;u<r.length-1;++u){u===1&&e.multisample>1&&(c=this.getOptimalFilterTexture(h.width,h.height,e.resolution),c.filterFrame=h.filterFrame),r[u].apply(this,h,c,Si.CLEAR,e);const d=h;h=c,c=d}r[u].apply(this,h,l.renderTexture,Si.BLEND,e),u>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(h),this.returnFilterTexture(c)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=Si.CLEAR){const{renderTexture:r,state:n}=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,r.bind(t,t.filterFrame,o)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?r.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);const s=n.stateId&1||this.forceClear;(e===Si.CLEAR||e===Si.BLIT&&s)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,r,n){const s=this.renderer;s.state.set(t.state),this.bindAndClear(r,n),t.uniforms.uSampler=e,t.uniforms.filterGlobals=this.globalUniforms,s.shader.bind(t),t.legacy=!!t.program.attributeData.aTextureCoord,t.legacy?(this.quadUv.map(e._frame,e.filterFrame),s.geometry.bind(this.quadUv),s.geometry.draw(vi.TRIANGLES)):(s.geometry.bind(this.quad),s.geometry.draw(vi.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){const{sourceFrame:r,destinationFrame:n}=this.activeState,{orig:s}=e._texture,o=t.set(n.width,0,0,n.height,r.x,r.y),a=e.worldTransform.copyTo(Nt.TEMP_MATRIX);return a.invert(),o.prepend(a),o.scale(1/s.width,1/s.height),o.translate(e.anchor.x,e.anchor.y),o}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(t,e,r=1,n=$t.NONE){return this.texturePool.getOptimalTexture(t,e,r,n)}getFilterTexture(t,e,r){if(typeof t=="number"){const s=t;t=e,e=s}t=t||this.activeState.renderTexture;const n=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,r||$t.NONE);return n.filterFrame=t.filterFrame,n}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){const r=Wa[0],n=Wa[1],s=Wa[2],o=Wa[3];r.set(e.left,e.top),n.set(e.left,e.bottom),s.set(e.right,e.top),o.set(e.right,e.bottom),t.apply(r,r),t.apply(n,n),t.apply(s,s),t.apply(o,o);const a=Math.min(r.x,n.x,s.x,o.x),l=Math.min(r.y,n.y,s.y,o.y),h=Math.max(r.x,n.x,s.x,o.x),c=Math.max(r.y,n.y,s.y,o.y);e.x=a,e.y=l,e.width=h-a,e.height=c-l}roundFrame(t,e,r,n,s){if(!(t.width<=0||t.height<=0||r.width<=0||r.height<=0)){if(s){const{a:o,b:a,c:l,d:h}=s;if((Math.abs(a)>1e-4||Math.abs(l)>1e-4)&&(Math.abs(o)>1e-4||Math.abs(h)>1e-4))return}s=s?Uc.copyFrom(s):Uc.identity(),s.translate(-r.x,-r.y).scale(n.width/r.width,n.height/r.height).translate(n.x,n.y),this.transformAABB(s,t),t.ceil(e),this.transformAABB(s.invert(),t)}}}Pm.extension={type:q.RendererSystem,name:"filter"},st.add(Pm);class lw{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=$t.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const hw=new gt;class Lm{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Oc(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 gt,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,r=this.renderer.context.extensions.depthTexture;nt.PREFER_ENV===tn.WEBGL_LEGACY&&(e=null,r=null),e?t.drawBuffers=n=>e.drawBuffersWEBGL(n):(this.hasMRT=!1,t.drawBuffers=()=>{}),r||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)}bind(t,e,r=0){const{gl:n}=this;if(t){const s=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,n.bindFramebuffer(n.FRAMEBUFFER,s.framebuffer)),s.mipLevel!==r&&(t.dirtyId++,t.dirtyFormat++,s.mipLevel=r),s.dirtyId!==t.dirtyId&&(s.dirtyId=t.dirtyId,s.dirtyFormat!==t.dirtyFormat?(s.dirtyFormat=t.dirtyFormat,s.dirtySize=t.dirtySize,this.updateFramebuffer(t,r)):s.dirtySize!==t.dirtySize&&(s.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>>r,a=e.height>>r,l=o/e.width;this.setViewport(e.x*l,e.y*l,o,a)}else{const o=t.width>>r,a=t.height>>r;this.setViewport(0,0,o,a)}}else this.current&&(this.current=null,n.bindFramebuffer(n.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,r,n){const s=this.viewport;t=Math.round(t),e=Math.round(e),r=Math.round(r),n=Math.round(n),(s.width!==r||s.height!==n||s.x!==t||s.y!==e)&&(s.x=t,s.y=e,s.width=r,s.height=n,this.gl.viewport(t,e,r,n))}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,r,n,s=Ph.COLOR|Ph.DEPTH){const{gl:o}=this;o.clearColor(t,e,r,n),o.clear(s)}initFramebuffer(t){const{gl:e}=this,r=new lw(e.createFramebuffer());return r.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=r,this.managedFramebuffers.push(t),t.disposeRunner.add(this),r}resizeFramebuffer(t){const{gl:e}=this,r=t.glFramebuffers[this.CONTEXT_UID];if(r.stencil){e.bindRenderbuffer(e.RENDERBUFFER,r.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,r.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,r.multisample,o,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,o,t.width,t.height)}const n=t.colorTextures;let s=n.length;e.drawBuffers||(s=Math.min(s,1));for(let o=0;o<s;o++){const a=n[o],l=a.parentTextureArray||a;this.renderer.texture.bind(l,0),o===0&&r.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,r.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,r.multisample,l._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:r}=this,n=t.glFramebuffers[this.CONTEXT_UID],s=t.colorTextures;let o=s.length;r.drawBuffers||(o=Math.min(o,1)),n.multisample>1&&this.canMultisampleFramebuffer(t)?n.msaaBuffer=n.msaaBuffer||r.createRenderbuffer():n.msaaBuffer&&(r.deleteRenderbuffer(n.msaaBuffer),n.msaaBuffer=null,n.blitFramebuffer&&(n.blitFramebuffer.dispose(),n.blitFramebuffer=null));const a=[];for(let l=0;l<o;l++){const h=s[l],c=h.parentTextureArray||h;this.renderer.texture.bind(c,0),l===0&&n.msaaBuffer?(r.bindRenderbuffer(r.RENDERBUFFER,n.msaaBuffer),r.renderbufferStorageMultisample(r.RENDERBUFFER,n.multisample,c._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,n.msaaBuffer)):(r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+l,h.target,c._glTextures[this.CONTEXT_UID].texture,e),a.push(r.COLOR_ATTACHMENT0+l))}if(a.length>1&&r.drawBuffers(a),t.depthTexture&&this.writeDepthTexture){const l=t.depthTexture;this.renderer.texture.bind(l,0),r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,l._glTextures[this.CONTEXT_UID].texture,e)}if((t.stencil||t.depth)&&!(t.depthTexture&&this.writeDepthTexture)){n.stencil=n.stencil||r.createRenderbuffer();let l,h;this.renderer.context.webGLVersion===1?(l=r.DEPTH_STENCIL_ATTACHMENT,h=r.DEPTH_STENCIL):t.depth&&t.stencil?(l=r.DEPTH_STENCIL_ATTACHMENT,h=r.DEPTH24_STENCIL8):t.depth?(l=r.DEPTH_ATTACHMENT,h=r.DEPTH_COMPONENT24):(l=r.STENCIL_ATTACHMENT,h=r.STENCIL_INDEX8),r.bindRenderbuffer(r.RENDERBUFFER,n.stencil),n.msaaBuffer?r.renderbufferStorageMultisample(r.RENDERBUFFER,n.multisample,h,t.width,t.height):r.renderbufferStorage(r.RENDERBUFFER,h,t.width,t.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,l,r.RENDERBUFFER,n.stencil)}else n.stencil&&(r.deleteRenderbuffer(n.stencil),n.stencil=null)}canMultisampleFramebuffer(t){return this.renderer.context.webGLVersion!==1&&t.colorTextures.length<=1&&!t.depthTexture}detectSamples(t){const{msaaSamples:e}=this;let r=$t.NONE;if(t<=1||e===null)return r;for(let n=0;n<e.length;n++)if(e[n]<=t){r=e[n];break}return r===1&&(r=$t.NONE),r}blit(t,e,r){const{current:n,renderer:s,gl:o,CONTEXT_UID:a}=this;if(s.context.webGLVersion!==2||!n)return;const l=n.glFramebuffers[a];if(!l)return;if(!t){if(!l.msaaBuffer)return;const c=n.colorTextures[0];if(!c)return;l.blitFramebuffer||(l.blitFramebuffer=new Oc(n.width,n.height),l.blitFramebuffer.addColorTexture(0,c)),t=l.blitFramebuffer,t.colorTextures[0]!==c&&(t.colorTextures[0]=c,t.dirtyId++,t.dirtyFormat++),(t.width!==n.width||t.height!==n.height)&&(t.width=n.width,t.height=n.height,t.dirtyId++,t.dirtySize++)}e||(e=hw,e.width=n.width,e.height=n.height),r||(r=e);const h=e.width===r.width&&e.height===r.height;this.bind(t),o.bindFramebuffer(o.READ_FRAMEBUFFER,l.framebuffer),o.blitFramebuffer(e.left,e.top,e.right,e.bottom,r.left,r.top,r.right,r.bottom,o.COLOR_BUFFER_BIT,h?o.NEAREST:o.LINEAR),o.bindFramebuffer(o.READ_FRAMEBUFFER,t.glFramebuffers[this.CONTEXT_UID].framebuffer)}disposeFramebuffer(t,e){const r=t.glFramebuffers[this.CONTEXT_UID],n=this.gl;if(!r)return;delete t.glFramebuffers[this.CONTEXT_UID];const s=this.managedFramebuffers.indexOf(t);s>=0&&this.managedFramebuffers.splice(s,1),t.disposeRunner.remove(this),e||(n.deleteFramebuffer(r.framebuffer),r.msaaBuffer&&n.deleteRenderbuffer(r.msaaBuffer),r.stencil&&n.deleteRenderbuffer(r.stencil)),r.blitFramebuffer&&this.disposeFramebuffer(r.blitFramebuffer,e)}disposeAll(t){const e=this.managedFramebuffers;this.managedFramebuffers=[];for(let r=0;r<e.length;r++)this.disposeFramebuffer(e[r],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 r=t.width,n=t.height,s=this.gl,o=e.stencil=s.createRenderbuffer();s.bindRenderbuffer(s.RENDERBUFFER,o);let a,l;this.renderer.context.webGLVersion===1?(a=s.DEPTH_STENCIL_ATTACHMENT,l=s.DEPTH_STENCIL):t.depth?(a=s.DEPTH_STENCIL_ATTACHMENT,l=s.DEPTH24_STENCIL8):(a=s.STENCIL_ATTACHMENT,l=s.STENCIL_INDEX8),e.msaaBuffer?s.renderbufferStorageMultisample(s.RENDERBUFFER,e.multisample,l,r,n):s.renderbufferStorage(s.RENDERBUFFER,l,r,n),s.framebufferRenderbuffer(s.FRAMEBUFFER,a,s.RENDERBUFFER,o)}reset(){this.current=this.unknownFramebuffer,this.viewport=new gt}destroy(){this.renderer=null}}Lm.extension={type:q.RendererSystem,name:"framebuffer"},st.add(Lm);const Xc={5126:4,5123:2,5121:1};class Gm{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 r=this.renderer.context.extensions.vertexArrayObject;nt.PREFER_ENV===tn.WEBGL_LEGACY&&(r=null),r?(t.createVertexArray=()=>r.createVertexArrayOES(),t.bindVertexArray=n=>r.bindVertexArrayOES(n),t.deleteVertexArray=n=>r.deleteVertexArrayOES(n)):(this.hasVao=!1,t.createVertexArray=()=>null,t.bindVertexArray=()=>null,t.deleteVertexArray=()=>null)}if(e.webGLVersion!==2){const r=t.getExtension("ANGLE_instanced_arrays");r?(t.vertexAttribDivisor=(n,s)=>r.vertexAttribDivisorANGLE(n,s),t.drawElementsInstanced=(n,s,o,a,l)=>r.drawElementsInstancedANGLE(n,s,o,a,l),t.drawArraysInstanced=(n,s,o,a)=>r.drawArraysInstancedANGLE(n,s,o,a)):this.hasInstance=!1}this.canUseUInt32ElementIndex=e.webGLVersion===2||!!e.extensions.uint32ElementIndex}bind(t,e){e=e||this.renderer.shader.shader;const{gl:r}=this;let n=t.glVertexArrayObjects[this.CONTEXT_UID],s=!1;n||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=n={},s=!0);const o=n[e.program.id]||this.initGeometryVao(t,e,s);this._activeGeometry=t,this._activeVao!==o&&(this._activeVao=o,this.hasVao?r.bindVertexArray(o):this.activateVao(t,e.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){const t=this._activeGeometry,e=this.renderer.buffer;for(let r=0;r<t.buffers.length;r++){const n=t.buffers[r];e.update(n)}}checkCompatibility(t,e){const r=t.attributes,n=e.attributeData;for(const s in n)if(!r[s])throw new Error(`shader and geometry incompatible, geometry missing the "${s}" attribute`)}getSignature(t,e){const r=t.attributes,n=e.attributeData,s=["g",t.id];for(const o in r)n[o]&&s.push(o,n[o].location);return s.join("-")}initGeometryVao(t,e,r=!0){const n=this.gl,s=this.CONTEXT_UID,o=this.renderer.buffer,a=e.program;a.glPrograms[s]||this.renderer.shader.generateProgram(e),this.checkCompatibility(t,a);const l=this.getSignature(t,a),h=t.glVertexArrayObjects[this.CONTEXT_UID];let c=h[l];if(c)return h[a.id]=c,c;const u=t.buffers,d=t.attributes,f={},p={};for(const m in u)f[m]=0,p[m]=0;for(const m in d)!d[m].size&&a.attributeData[m]?d[m].size=a.attributeData[m].size:d[m].size||console.warn(`PIXI Geometry attribute '${m}' size cannot be determined (likely the bound shader does not have the attribute)`),f[d[m].buffer]+=d[m].size*Xc[d[m].type];for(const m in d){const g=d[m],y=g.size;g.stride===void 0&&(f[g.buffer]===y*Xc[g.type]?g.stride=0:g.stride=f[g.buffer]),g.start===void 0&&(g.start=p[g.buffer],p[g.buffer]+=y*Xc[g.type])}c=n.createVertexArray(),n.bindVertexArray(c);for(let m=0;m<u.length;m++){const g=u[m];o.bind(g),r&&g._glBuffers[s].refCount++}return this.activateVao(t,a),h[a.id]=c,h[l]=c,n.bindVertexArray(null),o.unbind(Ei.ARRAY_BUFFER),c}disposeGeometry(t,e){var a;if(!this.managedGeometries[t.id])return;delete this.managedGeometries[t.id];const r=t.glVertexArrayObjects[this.CONTEXT_UID],n=this.gl,s=t.buffers,o=(a=this.renderer)==null?void 0:a.buffer;if(t.disposeRunner.remove(this),!!r){if(o)for(let l=0;l<s.length;l++){const h=s[l]._glBuffers[this.CONTEXT_UID];h&&(h.refCount--,h.refCount===0&&!e&&o.dispose(s[l],e))}if(!e){for(const l in r)if(l[0]==="g"){const h=r[l];this._activeVao===h&&this.unbind(),n.deleteVertexArray(h)}}delete t.glVertexArrayObjects[this.CONTEXT_UID]}}disposeAll(t){const e=Object.keys(this.managedGeometries);for(let r=0;r<e.length;r++)this.disposeGeometry(this.managedGeometries[e[r]],t)}activateVao(t,e){const r=this.gl,n=this.CONTEXT_UID,s=this.renderer.buffer,o=t.buffers,a=t.attributes;t.indexBuffer&&s.bind(t.indexBuffer);let l=null;for(const h in a){const c=a[h],u=o[c.buffer],d=u._glBuffers[n];if(e.attributeData[h]){l!==d&&(s.bind(u),l=d);const f=e.attributeData[h].location;if(r.enableVertexAttribArray(f),r.vertexAttribPointer(f,c.size,c.type||r.FLOAT,c.normalized,c.stride,c.start),c.instance)if(this.hasInstance)r.vertexAttribDivisor(f,c.divisor);else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,r,n){const{gl:s}=this,o=this._activeGeometry;if(o.indexBuffer){const a=o.indexBuffer.data.BYTES_PER_ELEMENT,l=a===2?s.UNSIGNED_SHORT:s.UNSIGNED_INT;a===2||a===4&&this.canUseUInt32ElementIndex?o.instanced?s.drawElementsInstanced(t,e||o.indexBuffer.data.length,l,(r||0)*a,n||1):s.drawElements(t,e||o.indexBuffer.data.length,l,(r||0)*a):console.warn("unsupported index buffer type: uint32")}else o.instanced?s.drawArraysInstanced(t,r,e||o.getSize(),n||1):s.drawArrays(t,r,e||o.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}}Gm.extension={type:q.RendererSystem,name:"geometry"},st.add(Gm);const km=new Nt;class Fm{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 r=this.mapCoord;for(let n=0;n<t.length;n+=2){const s=t[n],o=t[n+1];e[n]=s*r.a+o*r.c+r.tx,e[n+1]=s*r.b+o*r.d+r.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 r=e._uvs;this.mapCoord.set(r.x1-r.x0,r.y1-r.y0,r.x3-r.x0,r.y3-r.y0,r.x0,r.y0);const n=e.orig,s=e.trim;s&&(km.set(n.width/s.width,0,0,n.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(km));const o=e.baseTexture,a=this.uClampFrame,l=this.clampMargin/o.resolution,h=this.clampOffset;return a[0]=(e._frame.x+l+h)/o.width,a[1]=(e._frame.y+l+h)/o.height,a[2]=(e._frame.x+e._frame.width-l+h)/o.width,a[3]=(e._frame.y+e._frame.height-l+h)/o.height,this.uClampOffset[0]=h/o.realWidth,this.uClampOffset[1]=h/o.realHeight,this.isSimple=e._frame.width===o.width&&e._frame.height===o.height&&e.rotate===0,!0}}var cw=`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
- `,Bv=`attribute vec2 aVertexPosition;
403
+ `,uw=`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 Uv extends we{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||Bv,e||Ov,i),this.maskSprite=s,this.maskMatrix=new Dt}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 Tm(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 Xv{constructor(t=null){this.type=ie.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=we.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=ie.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 Sm{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 Xv;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!==ie.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case ie.SCISSOR:this.renderer.scissor.push(i);break;case ie.STENCIL:this.renderer.stencil.push(i);break;case ie.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case ie.COLOR:this.pushColorMask(i);break}i.type===ie.SPRITE&&this.maskStack.push(i)}pop(t){const e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case ie.SCISSOR:this.renderer.scissor.pop(e);break;case ie.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case ie.SPRITE:this.popSpriteMask(e);break;case ie.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===ie.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}}detect(t){const e=t.maskObject;e?e.isSprite?t.type=ie.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=ie.SCISSOR:t.type=ie.STENCIL:t.type=ie.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 Uv])),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}}Sm.extension={type:q.RendererSystem,name:"mask"},nt.add(Sm);class Em{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 Cm=new Dt,Im=[],Am=class wl extends Em{constructor(t){super(t),this.glConst=st.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,Im.pop()??new gt);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()||wl.isMatrixRotated(e.worldTransform)||wl.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){wl.isMatrixRotated(n)||(n=n?Cm.copyFrom(n):Cm.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&&Im.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)}};Am.extension={type:q.RendererSystem,name:"scissor"};let Wv=Am;nt.add(Wv);class Mm extends Em{constructor(t){super(t),this.glConst=st.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)}}Mm.extension={type:q.RendererSystem,name:"stencil"},nt.add(Mm);class Rm{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return wt("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract}},prepare:{enumerable:!1,get(){return wt("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare}},interaction:{enumerable:!1,get(){return wt("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}}Rm.extension={type:[q.RendererSystem,q.CanvasRendererSystem],name:"_plugin"},nt.add(Rm);class Pm{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new Dt,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}}Pm.extension={type:q.RendererSystem,name:"projection"},nt.add(Pm);const Zv=new Mc,Lm=new gt;class Gm{constructor(t){this.renderer=t,this._tempMatrix=new Dt}generateTexture(t,e){const{region:i,...s}=e||{},n=(i==null?void 0:i.copyTo(Lm))||t.getLocalBounds(Lm,!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=hs.create(s);this._tempMatrix.tx=-n.x,this._tempMatrix.ty=-n.y;const h=t.transform;return t.transform=Zv,this.renderer.render(t,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=h,a}destroy(){}}Gm.extension={type:[q.RendererSystem,q.CanvasRendererSystem],name:"textureGenerator"},nt.add(Gm);const ls=new gt,oo=new gt;class Fm{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new gt,this.destinationFrame=new gt,this.viewportFrame=new gt}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||(ls.width=t.frame.width,ls.height=t.frame.height,e=ls),i||(oo.x=t.frame.x,oo.y=t.frame.y,oo.width=e.width,oo.height=e.height,i=oo),o=n.framebuffer):(a=s.resolution,e||(ls.width=s._view.screen.width,ls.height=s._view.screen.height,e=ls),i||(i=ls,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=kt.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}}Fm.extension={type:q.RendererSystem,name:"renderTexture"},nt.add(Fm);class Vv{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 Hv(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=cm(t,n.type),a={type:o,name:n.name,size:hm(o),location:t.getAttribLocation(r,n.name)};e[n.name]=a}return e}function Kv(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=cm(t,n.type);e[o]={name:o,index:s,type:h,size:n.size,isArray:a,value:nm(h,n.size)}}return e}function Yv(r,t){var a;const e=sm(r,r.VERTEX_SHADER,t.vertexSrc),i=sm(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)||wv(r,s,e,i),t.attributeData=Hv(s,r),t.uniformData=Kv(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:nm(l.type,l.size)}}return new Vv(s,o)}function zv(r,t,e,i,s){e.buffer.update(s)}const jv={float:`
419
+ `;class dw extends Te{constructor(t,e,r){let n=null;typeof t!="string"&&e===void 0&&r===void 0&&(n=t,t=void 0,e=void 0,r=void 0),super(t||uw,e||cw,r),this.maskSprite=n,this.maskMatrix=new Nt}get maskSprite(){return this._maskSprite}set maskSprite(t){this._maskSprite=t,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(t,e,r,n){const s=this._maskSprite,o=s._texture;o.valid&&(o.uvMatrix||(o.uvMatrix=new Fm(o,0)),o.uvMatrix.update(),this.uniforms.npmAlpha=o.baseTexture.alphaMode?0:1,this.uniforms.mask=o,this.uniforms.otherMatrix=t.calculateSpriteMatrix(this.maskMatrix,s).prepend(o.uvMatrix.mapCoord),this.uniforms.alpha=s.worldAlpha,this.uniforms.maskClamp=o.uvMatrix.uClampFrame,t.applyFilter(this,e,r,n))}}class fw{constructor(t=null){this.type=re.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=Te.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=re.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 Dm{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 r=e;if(!r.isMaskData){const s=this.maskDataPool.pop()||new fw;s.pooled=!0,s.maskObject=e,r=s}const n=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(r.copyCountersOrReset(n),r._colorMask=n?n._colorMask:15,r.autoDetect&&this.detect(r),r._target=t,r.type!==re.SPRITE&&this.maskStack.push(r),r.enabled)switch(r.type){case re.SCISSOR:this.renderer.scissor.push(r);break;case re.STENCIL:this.renderer.stencil.push(r);break;case re.SPRITE:r.copyCountersOrReset(null),this.pushSpriteMask(r);break;case re.COLOR:this.pushColorMask(r);break}r.type===re.SPRITE&&this.maskStack.push(r)}pop(t){const e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case re.SCISSOR:this.renderer.scissor.pop(e);break;case re.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case re.SPRITE:this.popSpriteMask(e);break;case re.COLOR:this.popColorMask(e);break}if(e.reset(),e.pooled&&this.maskDataPool.push(e),this.maskStack.length!==0){const r=this.maskStack[this.maskStack.length-1];r.type===re.SPRITE&&r._filters&&(r._filters[0].maskSprite=r.maskObject)}}}detect(t){const e=t.maskObject;e?e.isSprite?t.type=re.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=re.SCISSOR:t.type=re.STENCIL:t.type=re.COLOR}pushSpriteMask(t){const{maskObject:e}=t,r=t._target;let n=t._filters;n||(n=this.alphaMaskPool[this.alphaMaskIndex],n||(n=this.alphaMaskPool[this.alphaMaskIndex]=[new dw])),n[0].resolution=t.resolution,n[0].multisample=t.multisample,n[0].maskSprite=e;const s=r.filterArea;r.filterArea=e.getBounds(!0),this.renderer.filter.push(r,n),r.filterArea=s,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,r=t._colorMask=e&t.colorMask;r!==e&&this.renderer.gl.colorMask((r&1)!==0,(r&2)!==0,(r&4)!==0,(r&8)!==0)}popColorMask(t){const e=t._colorMask,r=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;r!==e&&this.renderer.gl.colorMask((r&1)!==0,(r&2)!==0,(r&4)!==0,(r&8)!==0)}destroy(){this.renderer=null}}Dm.extension={type:q.RendererSystem,name:"mask"},st.add(Dm);class Nm{constructor(t){this.renderer=t,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(t){const{gl:e}=this.renderer,r=this.getStackLength();this.maskStack=t;const n=this.getStackLength();n!==r&&(n===0?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}}const Om=new Nt,Bm=[],Um=class Ch extends Nm{constructor(t){super(t),this.glConst=nt.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:r}=t,{renderer:n}=this,s=n.renderTexture,o=r.getBounds(!0,Bm.pop()??new gt);this.roundFrameToPixels(o,s.current?s.current.resolution:n.resolution,s.sourceFrame,s.destinationFrame,n.projection.transform),e&&o.fit(e),t._scissorRectLocal=o}static isMatrixRotated(t){if(!t)return!1;const{a:e,b:r,c:n,d:s}=t;return(Math.abs(r)>1e-4||Math.abs(n)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(s)>1e-4)}testScissor(t){const{maskObject:e}=t;if(!e.isFastRect||!e.isFastRect()||Ch.isMatrixRotated(e.worldTransform)||Ch.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);const r=t._scissorRectLocal;return r.width>0&&r.height>0}roundFrameToPixels(t,e,r,n,s){Ch.isMatrixRotated(s)||(s=s?Om.copyFrom(s):Om.identity(),s.translate(-r.x,-r.y).scale(n.width/r.width,n.height/r.height).translate(n.x,n.y),this.renderer.filter.transformAABB(s,t),t.fit(n),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&&Bm.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)}};Um.extension={type:q.RendererSystem,name:"scissor"};let pw=Um;st.add(pw);class Xm extends Nm{constructor(t){super(t),this.glConst=nt.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:r}=this.renderer,n=t._stencilCounter;n===0&&(this.renderer.framebuffer.forceStencil(),r.clearStencil(0),r.clear(r.STENCIL_BUFFER_BIT),r.enable(r.STENCIL_TEST)),t._stencilCounter++;const s=t._colorMask;s!==0&&(t._colorMask=0,r.colorMask(!1,!1,!1,!1)),r.stencilFunc(r.EQUAL,n,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,s!==0&&(t._colorMask=s,r.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)),this._useCurrent()}pop(t){const e=this.renderer.gl;if(this.getStackLength()===0)e.disable(e.STENCIL_TEST);else{const r=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,n=r?r._colorMask:15;n!==0&&(r._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,n!==0&&(r._colorMask=n,e.colorMask((n&1)!==0,(n&2)!==0,(n&4)!==0,(n&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)}}Xm.extension={type:q.RendererSystem,name:"stencil"},st.add(Xm);class Wm{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return wt("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract}},prepare:{enumerable:!1,get(){return wt("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare}},interaction:{enumerable:!1,get(){return wt("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}}Wm.extension={type:[q.RendererSystem,q.CanvasRendererSystem],name:"_plugin"},st.add(Wm);class Zm{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new Nt,this.transform=null}update(t,e,r,n){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,r,n),this.transform&&this.projectionMatrix.append(this.transform);const s=this.renderer;s.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,s.globalUniforms.update(),s.shader.shader&&s.shader.syncUniformGroup(s.shader.shader.uniforms.globals)}calculateProjection(t,e,r,n){const s=this.projectionMatrix,o=n?-1:1;s.identity(),s.a=1/e.width*2,s.d=o*(1/e.height*2),s.tx=-1-e.x*s.a,s.ty=-o-e.y*s.d}setTransform(t){}destroy(){this.renderer=null}}Zm.extension={type:q.RendererSystem,name:"projection"},st.add(Zm);const mw=new Gc,Vm=new gt;class Hm{constructor(t){this.renderer=t,this._tempMatrix=new Nt}generateTexture(t,e){const{region:r,...n}=e||{},s=(r==null?void 0:r.copyTo(Vm))||t.getLocalBounds(Vm,!0),o=n.resolution||this.renderer.resolution;s.width=Math.max(s.width,1/o),s.height=Math.max(s.height,1/o),n.width=s.width,n.height=s.height,n.resolution=o,n.multisample??(n.multisample=this.renderer.multisample);const a=fn.create(n);this._tempMatrix.tx=-s.x,this._tempMatrix.ty=-s.y;const l=t.transform;return t.transform=mw,this.renderer.render(t,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=l,a}destroy(){}}Hm.extension={type:[q.RendererSystem,q.CanvasRendererSystem],name:"textureGenerator"},st.add(Hm);const pn=new gt,ho=new gt;class Km{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new gt,this.destinationFrame=new gt,this.viewportFrame=new gt}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,r){const n=this.renderer;this.current=t;let s,o,a;t?(s=t.baseTexture,a=s.resolution,e||(pn.width=t.frame.width,pn.height=t.frame.height,e=pn),r||(ho.x=t.frame.x,ho.y=t.frame.y,ho.width=e.width,ho.height=e.height,r=ho),o=s.framebuffer):(a=n.resolution,e||(pn.width=n._view.screen.width,pn.height=n._view.screen.height,e=pn),r||(r=pn,r.width=e.width,r.height=e.height));const l=this.viewportFrame;l.x=r.x*a,l.y=r.y*a,l.width=r.width*a,l.height=r.height*a,t||(l.y=n.view.height-(l.y+l.height)),l.ceil(),this.renderer.framebuffer.bind(o,l),this.renderer.projection.update(r,e,a,!o),t?this.renderer.mask.setMaskStack(s.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(r)}clear(t,e){const r=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,n=Dt.shared.setValue(t||r);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&n.premultiply(n.alpha);const s=this.destinationFrame,o=this.current?this.current.baseTexture:this.renderer._view.screen,a=s.width!==o.width||s.height!==o.height;if(a){let{x:l,y:h,width:c,height:u}=this.viewportFrame;l=Math.round(l),h=Math.round(h),c=Math.round(c),u=Math.round(u),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(l,h,c,u)}this.renderer.framebuffer.clear(n.red,n.green,n.blue,n.alpha,e),a&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}Km.extension={type:q.RendererSystem,name:"renderTexture"},st.add(Km);class gw{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 yw(i,t){const e={},r=t.getProgramParameter(i,t.ACTIVE_ATTRIBUTES);for(let n=0;n<r;n++){const s=t.getActiveAttrib(i,n);if(s.name.startsWith("gl_"))continue;const o=wm(t,s.type),a={type:o,name:s.name,size:_m(o),location:t.getAttribLocation(i,s.name)};e[s.name]=a}return e}function bw(i,t){const e={},r=t.getProgramParameter(i,t.ACTIVE_UNIFORMS);for(let n=0;n<r;n++){const s=t.getActiveUniform(i,n),o=s.name.replace(/\[.*?\]$/,""),a=!!s.name.match(/\[.*?\]$/),l=wm(t,s.type);e[o]={name:o,index:n,type:l,size:s.size,isArray:a,value:ym(l,s.size)}}return e}function xw(i,t){var a;const e=gm(i,i.VERTEX_SHADER,t.vertexSrc),r=gm(i,i.FRAGMENT_SHADER,t.fragmentSrc),n=i.createProgram();i.attachShader(n,e),i.attachShader(n,r);const s=(a=t.extra)==null?void 0:a.transformFeedbackVaryings;if(s&&(typeof i.transformFeedbackVaryings!="function"?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):i.transformFeedbackVaryings(n,s.names,s.bufferMode==="separate"?i.SEPARATE_ATTRIBS:i.INTERLEAVED_ATTRIBS)),i.linkProgram(n),i.getProgramParameter(n,i.LINK_STATUS)||Yv(i,n,e,r),t.attributeData=yw(n,i),t.uniformData=bw(n,i),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertexSrc)){const l=Object.keys(t.attributeData);l.sort((h,c)=>h>c?1:-1);for(let h=0;h<l.length;h++)t.attributeData[l[h]].location=h,i.bindAttribLocation(n,h,l[h]);i.linkProgram(n)}i.deleteShader(e),i.deleteShader(r);const o={};for(const l in t.uniformData){const h=t.uniformData[l];o[l]={location:i.getUniformLocation(n,l),value:ym(h.type,h.size)}}return new gw(n,o)}function _w(i,t,e,r,n){e.buffer.update(n)}const vw={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
- `},Nm={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 Jv(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=Nm[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 $v(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 Qv(r,t){if(!r.autoManage)return{size:0,syncFunc:zv};const e=$v(r.uniforms,t),{uboElements:i,size:s}=Jv(e),n=[`
457
+ `},zm={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 ww(i){const t=i.map(s=>({data:s,offset:0,dataLen:0,dirty:0}));let e=0,r=0,n=0;for(let s=0;s<t.length;s++){const o=t[s];if(e=zm[o.data.type],o.data.size>1&&(e=Math.max(e,16)*o.data.size),o.dataLen=e,r%e!==0&&r<16){const a=r%e%16;r+=a,n+=a}r+e>16?(n=Math.ceil(n/16)*16,o.offset=n,n+=e,r=e):(o.offset=n,r+=e,n+=e)}return n=Math.ceil(n/16)*16,{uboElements:t,size:n}}function Tw(i,t){const e=[];for(const r in i)t[r]&&e.push(t[r]);return e.sort((r,n)=>r.index-n.index),e}function Sw(i,t){if(!i.autoManage)return{size:0,syncFunc:_w};const e=Tw(i.uniforms,t),{uboElements:r,size:n}=ww(e),s=[`
458
458
  var v = null;
459
459
  var v2 = null;
460
460
  var cv = null;
@@ -462,9 +462,9 @@ void main(void)
462
462
  var gl = renderer.gl
463
463
  var index = 0;
464
464
  var data = buffer.data;
465
- `];for(let o=0;o<i.length;o++){const a=i[o],h=r.uniforms[a.data.name],l=a.data.name;let c=!1;for(let u=0;u<tn.length;u++){const d=tn[u];if(d.codeUbo&&d.test(a.data,h)){n.push(`offset = ${a.offset/4};`,tn[u].codeUbo(a.data.name,h)),c=!0;break}}if(!c)if(a.data.size>1){const u=hm(a.data.type),d=Math.max(Nm[a.data.type]/16,1),f=u/d,p=(4-f%4)%4;n.push(`
466
- cv = ud.${l}.value;
467
- v = uv.${l};
465
+ `];for(let o=0;o<r.length;o++){const a=r[o],l=i.uniforms[a.data.name],h=a.data.name;let c=!1;for(let u=0;u<ns.length;u++){const d=ns[u];if(d.codeUbo&&d.test(a.data,l)){s.push(`offset = ${a.offset/4};`,ns[u].codeUbo(a.data.name,l)),c=!0;break}}if(!c)if(a.data.size>1){const u=_m(a.data.type),d=Math.max(zm[a.data.type]/16,1),f=u/d,p=(4-f%4)%4;s.push(`
466
+ cv = ud.${h}.value;
467
+ v = uv.${h};
468
468
  offset = ${a.offset/4};
469
469
 
470
470
  t = 0;
@@ -478,15 +478,15 @@ void main(void)
478
478
  offset += ${p};
479
479
  }
480
480
 
481
- `)}else{const u=jv[a.data.type];n.push(`
482
- cv = ud.${l}.value;
483
- v = uv.${l};
481
+ `)}else{const u=vw[a.data.type];s.push(`
482
+ cv = ud.${h}.value;
483
+ v = uv.${h};
484
484
  offset = ${a.offset/4};
485
485
  ${u};
486
- `)}}return n.push(`
486
+ `)}}return s.push(`
487
487
  renderer.buffer.update(buffer);
488
- `),{size:s,syncFunc:new Function("ud","uv","renderer","syncData","buffer",n.join(`
489
- `))}}let qv=0;const Ua={textureCount:0,uboCount:0};class km{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=qv++}systemCheck(){if(!Sv())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||(Ua.textureCount=0,Ua.uboCount=0,this.syncUniformGroup(t.uniformGroup,Ua)),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]=xv(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,Ua,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]=Qv(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=Yv(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}}km.extension={type:q.RendererSystem,name:"shader"},nt.add(km);class Xa{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(){}}Xa.defaultOptions={hello:!1},Xa.extension={type:[q.RendererSystem,q.CanvasRendererSystem],name:"startup"},nt.add(Xa);function tw(r,t=[]){return t[mt.NORMAL]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mt.SRC_ATOP]=[r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[mt.DST_OVER]=[r.ONE_MINUS_DST_ALPHA,r.ONE],t[mt.DST_IN]=[r.ZERO,r.SRC_ALPHA],t[mt.DST_OUT]=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],t[mt.DST_ATOP]=[r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA],t[mt.XOR]=[r.ONE_MINUS_DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[mt.SUBTRACT]=[r.ONE,r.ONE,r.ONE,r.ONE,r.FUNC_REVERSE_SUBTRACT,r.FUNC_ADD],t}const ew=0,iw=1,rw=2,sw=3,nw=4,ow=5,Dm=class Sf{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=mt.NONE,this._blendEq=!1,this.map=[],this.map[ew]=this.setBlend,this.map[iw]=this.setOffset,this.map[rw]=this.setCullFace,this.map[sw]=this.setDepthTest,this.map[nw]=this.setFrontFace,this.map[ow]=this.setDepthMask,this.checks=[],this.defaultState=new Mi,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=tw(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(Sf.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(Sf.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}};Dm.extension={type:q.RendererSystem,name:"state"};let aw=Dm;nt.add(aw);class hw 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 ai(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 ao=class Tl{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=Tl.defaultMaxIdle,this.checkCountMax=Tl.defaultCheckCountMax,this.mode=Tl.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==Al.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}};ao.defaultMode=Al.AUTO,ao.defaultMaxIdle=60*60,ao.defaultCheckCountMax=60*10,ao.extension={type:q.RendererSystem,name:"textureGC"};let cs=ao;nt.add(cs);class Oc{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=ct.UNSIGNED_BYTE,this.internalFormat=Y.RGBA,this.samplerType=0}}function lw(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[r.RGB]:rt.FLOAT,[r.RGBA]:rt.FLOAT,[r.ALPHA]:rt.FLOAT,[r.LUMINANCE]:rt.FLOAT,[r.LUMINANCE_ALPHA]:rt.FLOAT,[r.R8]:rt.FLOAT,[r.R8_SNORM]:rt.FLOAT,[r.RG8]:rt.FLOAT,[r.RG8_SNORM]:rt.FLOAT,[r.RGB8]:rt.FLOAT,[r.RGB8_SNORM]:rt.FLOAT,[r.RGB565]:rt.FLOAT,[r.RGBA4]:rt.FLOAT,[r.RGB5_A1]:rt.FLOAT,[r.RGBA8]:rt.FLOAT,[r.RGBA8_SNORM]:rt.FLOAT,[r.RGB10_A2]:rt.FLOAT,[r.RGB10_A2UI]:rt.FLOAT,[r.SRGB8]:rt.FLOAT,[r.SRGB8_ALPHA8]:rt.FLOAT,[r.R16F]:rt.FLOAT,[r.RG16F]:rt.FLOAT,[r.RGB16F]:rt.FLOAT,[r.RGBA16F]:rt.FLOAT,[r.R32F]:rt.FLOAT,[r.RG32F]:rt.FLOAT,[r.RGB32F]:rt.FLOAT,[r.RGBA32F]:rt.FLOAT,[r.R11F_G11F_B10F]:rt.FLOAT,[r.RGB9_E5]:rt.FLOAT,[r.R8I]:rt.INT,[r.R8UI]:rt.UINT,[r.R16I]:rt.INT,[r.R16UI]:rt.UINT,[r.R32I]:rt.INT,[r.R32UI]:rt.UINT,[r.RG8I]:rt.INT,[r.RG8UI]:rt.UINT,[r.RG16I]:rt.INT,[r.RG16UI]:rt.UINT,[r.RG32I]:rt.INT,[r.RG32UI]:rt.UINT,[r.RGB8I]:rt.INT,[r.RGB8UI]:rt.UINT,[r.RGB16I]:rt.INT,[r.RGB16UI]:rt.UINT,[r.RGB32I]:rt.INT,[r.RGB32UI]:rt.UINT,[r.RGBA8I]:rt.INT,[r.RGBA8UI]:rt.UINT,[r.RGBA16I]:rt.INT,[r.RGBA16UI]:rt.UINT,[r.RGBA32I]:rt.INT,[r.RGBA32UI]:rt.UINT,[r.DEPTH_COMPONENT16]:rt.FLOAT,[r.DEPTH_COMPONENT24]:rt.FLOAT,[r.DEPTH_COMPONENT32F]:rt.FLOAT,[r.DEPTH_STENCIL]:rt.FLOAT,[r.DEPTH24_STENCIL8]:rt.FLOAT,[r.DEPTH32F_STENCIL8]:rt.FLOAT}:t={[r.RGB]:rt.FLOAT,[r.RGBA]:rt.FLOAT,[r.ALPHA]:rt.FLOAT,[r.LUMINANCE]:rt.FLOAT,[r.LUMINANCE_ALPHA]:rt.FLOAT,[r.DEPTH_STENCIL]:rt.FLOAT},t}function cw(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[ct.UNSIGNED_BYTE]:{[Y.RGBA]:r.RGBA8,[Y.RGB]:r.RGB8,[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GB16F,[Y.RG]:r.RG16F,[Y.RED]:r.R16F},[ct.UNSIGNED_SHORT_5_6_5]:{[Y.RGB]:r.RGB565},[ct.UNSIGNED_SHORT_4_4_4_4]:{[Y.RGBA]:r.RGBA4},[ct.UNSIGNED_SHORT_5_5_5_1]:{[Y.RGBA]:r.RGB5_A1},[ct.UNSIGNED_INT_2_10_10_10_REV]:{[Y.RGBA]:r.RGB10_A2,[Y.RGBA_INTEGER]:r.RGB10_A2UI},[ct.UNSIGNED_INT_10F_11F_11F_REV]:{[Y.RGB]:r.R11F_G11F_B10F},[ct.UNSIGNED_INT_5_9_9_9_REV]:{[Y.RGB]:r.RGB9_E5},[ct.UNSIGNED_INT_24_8]:{[Y.DEPTH_STENCIL]:r.DEPTH24_STENCIL8},[ct.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[Y.DEPTH_STENCIL]:r.DEPTH32F_STENCIL8}}:t={[ct.UNSIGNED_BYTE]:{[Y.RGBA]:r.RGBA,[Y.RGB]:r.RGB,[Y.ALPHA]:r.ALPHA,[Y.LUMINANCE]:r.LUMINANCE,[Y.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[ct.UNSIGNED_SHORT_5_6_5]:{[Y.RGB]:r.RGB},[ct.UNSIGNED_SHORT_4_4_4_4]:{[Y.RGBA]:r.RGBA},[ct.UNSIGNED_SHORT_5_5_5_1]:{[Y.RGBA]:r.RGBA}},t}class Om{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new xt,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=cw(t),this.samplerTypes=lw(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 Oc(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 Oc(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!==rt.FLOAT&&this.renderer.texture.unbind(o)}}initTexture(t){const e=new Oc(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]??rt.FLOAT,this.webGLVersion===2&&t.type===ct.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!==rt.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&&qs(this.managedTextures,s,1)}}updateTextureStyle(t){var i;const e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===wi.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=vi.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!==wi.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===Ji.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);const s=this.renderer.context.extensions.anisotropicFiltering;if(s&&t.anisotropicLevel>0&&t.scaleMode===Ji.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===Ji.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(t.target,i.TEXTURE_MAG_FILTER,t.scaleMode===Ji.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}}Om.extension={type:q.RendererSystem,name:"texture"},nt.add(Om);class Bm{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}}Bm.extension={type:q.RendererSystem,name:"transformFeedback"},nt.add(Bm);class Wa{constructor(t){this.renderer=t}init(t){this.screen=new gt(0,0,t.width,t.height),this.element=t.view||st.ADAPTER.createCanvas(),this.resolution=t.resolution||st.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}}Wa.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},Wa.extension={type:[q.RendererSystem,q.CanvasRendererSystem],name:"_view"},nt.add(Wa),st.PREFER_ENV=Jr.WEBGL2,st.STRICT_TEXTURE_CACHE=!1,st.RENDER_OPTIONS={...Da.defaultOptions,...ka.defaultOptions,...Wa.defaultOptions,...Xa.defaultOptions},Object.defineProperties(st,{WRAP_MODE:{get(){return xt.defaultOptions.wrapMode},set(r){wt("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),xt.defaultOptions.wrapMode=r}},SCALE_MODE:{get(){return xt.defaultOptions.scaleMode},set(r){wt("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),xt.defaultOptions.scaleMode=r}},MIPMAP_TEXTURES:{get(){return xt.defaultOptions.mipmap},set(r){wt("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),xt.defaultOptions.mipmap=r}},ANISOTROPIC_LEVEL:{get(){return xt.defaultOptions.anisotropicLevel},set(r){wt("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),xt.defaultOptions.anisotropicLevel=r}},FILTER_RESOLUTION:{get(){return wt("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),we.defaultResolution},set(r){we.defaultResolution=r}},FILTER_MULTISAMPLE:{get(){return wt("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),we.defaultMultisample},set(r){we.defaultMultisample=r}},SPRITE_MAX_TEXTURES:{get(){return as.defaultMaxTextures},set(r){wt("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),as.defaultMaxTextures=r}},SPRITE_BATCH_SIZE:{get(){return as.defaultBatchSize},set(r){wt("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),as.defaultBatchSize=r}},CAN_UPLOAD_SAME_BUFFER:{get(){return as.canUploadSameBuffer},set(r){wt("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),as.canUploadSameBuffer=r}},GC_MODE:{get(){return cs.defaultMode},set(r){wt("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),cs.defaultMode=r}},GC_MAX_IDLE:{get(){return cs.defaultMaxIdle},set(r){wt("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),cs.defaultMaxIdle=r}},GC_MAX_CHECK_COUNT:{get(){return cs.defaultCheckCountMax},set(r){wt("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),cs.defaultCheckCountMax=r}},PRECISION_VERTEX:{get(){return sr.defaultVertexPrecision},set(r){wt("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),sr.defaultVertexPrecision=r}},PRECISION_FRAGMENT:{get(){return sr.defaultFragmentPrecision},set(r){wt("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),sr.defaultFragmentPrecision=r}}});var us=(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))(us||{});class Bc{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 Um=class Ke{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 Bc(null,null,1/0),this.deltaMS=1/Ke.targetFPMS,this.elapsedMS=1/Ke.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=us.NORMAL){return this._addListener(new Bc(t,e,i))}addOnce(t,e,i=us.NORMAL){return this._addListener(new Bc(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*Ke.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,Ke.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(!Ke._shared){const t=Ke._shared=new Ke;t.autoStart=!0,t._protected=!0}return Ke._shared}static get system(){if(!Ke._system){const t=Ke._system=new Ke;t.autoStart=!0,t._protected=!0}return Ke._system}};Um.targetFPMS=.06;let Te=Um;Object.defineProperties(st,{TARGET_FPMS:{get(){return Te.targetFPMS},set(r){wt("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),Te.targetFPMS=r}}});class Xm{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,us.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?Te.shared:new Te,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}Xm.extension=q.Application,nt.add(Xm);const Wm=[];nt.handleByList(q.Renderer,Wm);function uw(r){for(const t of Wm)if(t.test(r))return new t(r);throw new Error("Unable to auto-detect a suitable renderer.")}var dw=`attribute vec2 aVertexPosition;
488
+ `),{size:n,syncFunc:new Function("ud","uv","renderer","syncData","buffer",s.join(`
489
+ `))}}let Ew=0;const Za={textureCount:0,uboCount:0};class Ym{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=Ew++}systemCheck(){if(!Jv())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 r=t.program,n=r.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==r&&(this.program=r,this.gl.useProgram(n.program)),e||(Za.textureCount=0,Za.uboCount=0,this.syncUniformGroup(t.uniformGroup,Za)),n}setUniforms(t){const e=this.shader.program,r=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(r.uniformData,t,this.renderer)}syncUniformGroup(t,e){const r=this.getGlProgram();(!t.static||t.dirtyId!==r.uniformDirtyGroups[t.id])&&(r.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,r,e))}syncUniforms(t,e,r){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,r)}createSyncGroups(t){const e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=Hv(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){const r=this.getGlProgram();if(!t.static||t.dirtyId!==0||!r.uniformGroups[t.id]){t.dirtyId=0;const n=r.uniformGroups[t.id]||this.createSyncBufferGroup(t,r,e);t.buffer.update(),n(r.uniformData,t.uniforms,this.renderer,Za,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,r.uniformBufferBindings[e])}createSyncBufferGroup(t,e,r){const{gl:n}=this.renderer;this.renderer.buffer.bind(t.buffer);const s=this.gl.getUniformBlockIndex(e.program,r);e.uniformBufferBindings[r]=this.shader.uniformBindCount,n.uniformBlockBinding(e.program,s,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]=Sw(t,this.shader.program.uniformData)),t.autoManage){const l=new Float32Array(a.size/4);t.buffer.update(l)}return e.uniformGroups[t.id]=a.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,r){const n=t.uniforms,s=[`${r}-`];for(const o in n)s.push(o),e[o]&&s.push(e[o].type);return s.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){const e=this.gl,r=t.program,n=xw(e,r);return r.glPrograms[this.renderer.CONTEXT_UID]=n,n}reset(){this.program=null,this.shader=null}disposeShader(t){this.shader===t&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}}Ym.extension={type:q.RendererSystem,name:"shader"},st.add(Ym);class Va{constructor(t){this.renderer=t}run(t){const{renderer:e}=this;e.runners.init.emit(e.options),t.hello&&console.log(`PixiJS 7.3.2 - ${e.rendererLogId} - https://pixijs.com`),e.resize(e.screen.width,e.screen.height)}destroy(){}}Va.defaultOptions={hello:!1},Va.extension={type:[q.RendererSystem,q.CanvasRendererSystem],name:"startup"},st.add(Va);function Cw(i,t=[]){return t[mt.NORMAL]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[mt.ADD]=[i.ONE,i.ONE],t[mt.MULTIPLY]=[i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[mt.SCREEN]=[i.ONE,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[mt.OVERLAY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[mt.DARKEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[mt.LIGHTEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[mt.COLOR_DODGE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[mt.COLOR_BURN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[mt.HARD_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[mt.SOFT_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[mt.DIFFERENCE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[mt.EXCLUSION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[mt.HUE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[mt.SATURATION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[mt.COLOR]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[mt.LUMINOSITY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[mt.NONE]=[0,0],t[mt.NORMAL_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[mt.ADD_NPM]=[i.SRC_ALPHA,i.ONE,i.ONE,i.ONE],t[mt.SCREEN_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[mt.SRC_IN]=[i.DST_ALPHA,i.ZERO],t[mt.SRC_OUT]=[i.ONE_MINUS_DST_ALPHA,i.ZERO],t[mt.SRC_ATOP]=[i.DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],t[mt.DST_OVER]=[i.ONE_MINUS_DST_ALPHA,i.ONE],t[mt.DST_IN]=[i.ZERO,i.SRC_ALPHA],t[mt.DST_OUT]=[i.ZERO,i.ONE_MINUS_SRC_ALPHA],t[mt.DST_ATOP]=[i.ONE_MINUS_DST_ALPHA,i.SRC_ALPHA],t[mt.XOR]=[i.ONE_MINUS_DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],t[mt.SUBTRACT]=[i.ONE,i.ONE,i.ONE,i.ONE,i.FUNC_REVERSE_SUBTRACT,i.FUNC_ADD],t}const Iw=0,Aw=1,Mw=2,Rw=3,Pw=4,Lw=5,jm=class Df{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=mt.NONE,this._blendEq=!1,this.map=[],this.map[Iw]=this.setBlend,this.map[Aw]=this.setOffset,this.map[Mw]=this.setCullFace,this.map[Rw]=this.setDepthTest,this.map[Pw]=this.setFrontFace,this.map[Lw]=this.setDepthMask,this.checks=[],this.defaultState=new Ri,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=Cw(t),this.set(this.defaultState),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,r=0;for(;e;)e&1&&this.map[r].call(this,!!(t.data&1<<r)),e=e>>1,r++;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(Df.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(Df.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],r=this.gl;e.length===2?r.blendFunc(e[0],e[1]):r.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,r.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,r.blendEquationSeparate(r.FUNC_ADD,r.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 r=this.checks.indexOf(t);e&&r===-1?this.checks.push(t):!e&&r!==-1&&this.checks.splice(r,1)}static checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null}};jm.extension={type:q.RendererSystem,name:"state"};let Gw=jm;st.add(Gw);class kw extends js{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);const e=(t.priority??[]).filter(n=>t.systems[n]),r=[...e,...Object.keys(t.systems).filter(n=>!e.includes(n))];for(const n of r)this.addSystem(t.systems[n],n)}addRunners(...t){t.forEach(e=>{this.runners[e]=new li(e)})}addSystem(t,e){const r=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=r,this._systemsHash[e]=r;for(const n in this.runners)this.runners[n].add(r);return this}emitWithCustomOptions(t,e){const r=Object.keys(this._systemsHash);t.items.forEach(n=>{const s=r.find(o=>this._systemsHash[o]===n);n[t.name](e[s])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}}const co=class Ih{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=Ih.defaultMaxIdle,this.checkCountMax=Ih.defaultCheckCountMax,this.mode=Ih.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==Lh.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){const t=this.renderer.texture,e=t.managedTextures;let r=!1;for(let n=0;n<e.length;n++){const s=e[n];s.resource&&this.count-s.touched>this.maxIdle&&(t.destroyTexture(s,!0),e[n]=null,r=!0)}if(r){let n=0;for(let s=0;s<e.length;s++)e[s]!==null&&(e[n++]=e[s]);e.length=n}}unload(t){const e=this.renderer.texture,r=t._texture;r&&!r.framebuffer&&e.destroyTexture(r);for(let n=t.children.length-1;n>=0;n--)this.unload(t.children[n])}destroy(){this.renderer=null}};co.defaultMode=Lh.AUTO,co.defaultMaxIdle=60*60,co.defaultCheckCountMax=60*10,co.extension={type:q.RendererSystem,name:"textureGC"};let mn=co;st.add(mn);class Wc{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=ct.UNSIGNED_BYTE,this.internalFormat=z.RGBA,this.samplerType=0}}function Fw(i){let t;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?t={[i.RGB]:rt.FLOAT,[i.RGBA]:rt.FLOAT,[i.ALPHA]:rt.FLOAT,[i.LUMINANCE]:rt.FLOAT,[i.LUMINANCE_ALPHA]:rt.FLOAT,[i.R8]:rt.FLOAT,[i.R8_SNORM]:rt.FLOAT,[i.RG8]:rt.FLOAT,[i.RG8_SNORM]:rt.FLOAT,[i.RGB8]:rt.FLOAT,[i.RGB8_SNORM]:rt.FLOAT,[i.RGB565]:rt.FLOAT,[i.RGBA4]:rt.FLOAT,[i.RGB5_A1]:rt.FLOAT,[i.RGBA8]:rt.FLOAT,[i.RGBA8_SNORM]:rt.FLOAT,[i.RGB10_A2]:rt.FLOAT,[i.RGB10_A2UI]:rt.FLOAT,[i.SRGB8]:rt.FLOAT,[i.SRGB8_ALPHA8]:rt.FLOAT,[i.R16F]:rt.FLOAT,[i.RG16F]:rt.FLOAT,[i.RGB16F]:rt.FLOAT,[i.RGBA16F]:rt.FLOAT,[i.R32F]:rt.FLOAT,[i.RG32F]:rt.FLOAT,[i.RGB32F]:rt.FLOAT,[i.RGBA32F]:rt.FLOAT,[i.R11F_G11F_B10F]:rt.FLOAT,[i.RGB9_E5]:rt.FLOAT,[i.R8I]:rt.INT,[i.R8UI]:rt.UINT,[i.R16I]:rt.INT,[i.R16UI]:rt.UINT,[i.R32I]:rt.INT,[i.R32UI]:rt.UINT,[i.RG8I]:rt.INT,[i.RG8UI]:rt.UINT,[i.RG16I]:rt.INT,[i.RG16UI]:rt.UINT,[i.RG32I]:rt.INT,[i.RG32UI]:rt.UINT,[i.RGB8I]:rt.INT,[i.RGB8UI]:rt.UINT,[i.RGB16I]:rt.INT,[i.RGB16UI]:rt.UINT,[i.RGB32I]:rt.INT,[i.RGB32UI]:rt.UINT,[i.RGBA8I]:rt.INT,[i.RGBA8UI]:rt.UINT,[i.RGBA16I]:rt.INT,[i.RGBA16UI]:rt.UINT,[i.RGBA32I]:rt.INT,[i.RGBA32UI]:rt.UINT,[i.DEPTH_COMPONENT16]:rt.FLOAT,[i.DEPTH_COMPONENT24]:rt.FLOAT,[i.DEPTH_COMPONENT32F]:rt.FLOAT,[i.DEPTH_STENCIL]:rt.FLOAT,[i.DEPTH24_STENCIL8]:rt.FLOAT,[i.DEPTH32F_STENCIL8]:rt.FLOAT}:t={[i.RGB]:rt.FLOAT,[i.RGBA]:rt.FLOAT,[i.ALPHA]:rt.FLOAT,[i.LUMINANCE]:rt.FLOAT,[i.LUMINANCE_ALPHA]:rt.FLOAT,[i.DEPTH_STENCIL]:rt.FLOAT},t}function Dw(i){let t;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?t={[ct.UNSIGNED_BYTE]:{[z.RGBA]:i.RGBA8,[z.RGB]:i.RGB8,[z.RG]:i.RG8,[z.RED]:i.R8,[z.RGBA_INTEGER]:i.RGBA8UI,[z.RGB_INTEGER]:i.RGB8UI,[z.RG_INTEGER]:i.RG8UI,[z.RED_INTEGER]:i.R8UI,[z.ALPHA]:i.ALPHA,[z.LUMINANCE]:i.LUMINANCE,[z.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[ct.BYTE]:{[z.RGBA]:i.RGBA8_SNORM,[z.RGB]:i.RGB8_SNORM,[z.RG]:i.RG8_SNORM,[z.RED]:i.R8_SNORM,[z.RGBA_INTEGER]:i.RGBA8I,[z.RGB_INTEGER]:i.RGB8I,[z.RG_INTEGER]:i.RG8I,[z.RED_INTEGER]:i.R8I},[ct.UNSIGNED_SHORT]:{[z.RGBA_INTEGER]:i.RGBA16UI,[z.RGB_INTEGER]:i.RGB16UI,[z.RG_INTEGER]:i.RG16UI,[z.RED_INTEGER]:i.R16UI,[z.DEPTH_COMPONENT]:i.DEPTH_COMPONENT16},[ct.SHORT]:{[z.RGBA_INTEGER]:i.RGBA16I,[z.RGB_INTEGER]:i.RGB16I,[z.RG_INTEGER]:i.RG16I,[z.RED_INTEGER]:i.R16I},[ct.UNSIGNED_INT]:{[z.RGBA_INTEGER]:i.RGBA32UI,[z.RGB_INTEGER]:i.RGB32UI,[z.RG_INTEGER]:i.RG32UI,[z.RED_INTEGER]:i.R32UI,[z.DEPTH_COMPONENT]:i.DEPTH_COMPONENT24},[ct.INT]:{[z.RGBA_INTEGER]:i.RGBA32I,[z.RGB_INTEGER]:i.RGB32I,[z.RG_INTEGER]:i.RG32I,[z.RED_INTEGER]:i.R32I},[ct.FLOAT]:{[z.RGBA]:i.RGBA32F,[z.RGB]:i.RGB32F,[z.RG]:i.RG32F,[z.RED]:i.R32F,[z.DEPTH_COMPONENT]:i.DEPTH_COMPONENT32F},[ct.HALF_FLOAT]:{[z.RGBA]:i.RGBA16F,[z.RGB]:i.RGB16F,[z.RG]:i.RG16F,[z.RED]:i.R16F},[ct.UNSIGNED_SHORT_5_6_5]:{[z.RGB]:i.RGB565},[ct.UNSIGNED_SHORT_4_4_4_4]:{[z.RGBA]:i.RGBA4},[ct.UNSIGNED_SHORT_5_5_5_1]:{[z.RGBA]:i.RGB5_A1},[ct.UNSIGNED_INT_2_10_10_10_REV]:{[z.RGBA]:i.RGB10_A2,[z.RGBA_INTEGER]:i.RGB10_A2UI},[ct.UNSIGNED_INT_10F_11F_11F_REV]:{[z.RGB]:i.R11F_G11F_B10F},[ct.UNSIGNED_INT_5_9_9_9_REV]:{[z.RGB]:i.RGB9_E5},[ct.UNSIGNED_INT_24_8]:{[z.DEPTH_STENCIL]:i.DEPTH24_STENCIL8},[ct.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[z.DEPTH_STENCIL]:i.DEPTH32F_STENCIL8}}:t={[ct.UNSIGNED_BYTE]:{[z.RGBA]:i.RGBA,[z.RGB]:i.RGB,[z.ALPHA]:i.ALPHA,[z.LUMINANCE]:i.LUMINANCE,[z.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[ct.UNSIGNED_SHORT_5_6_5]:{[z.RGB]:i.RGB},[ct.UNSIGNED_SHORT_4_4_4_4]:{[z.RGBA]:i.RGBA},[ct.UNSIGNED_SHORT_5_5_5_1]:{[z.RGBA]:i.RGBA}},t}class Jm{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new xt,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=Dw(t),this.samplerTypes=Fw(t);const e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let n=0;n<e;n++)this.boundTextures[n]=null;this.emptyTextures={};const r=new Wc(t.createTexture());t.bindTexture(t.TEXTURE_2D,r.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]=r,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new Wc(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture);for(let n=0;n<6;n++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+n,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 n=0;n<this.boundTextures.length;n++)this.bind(null,n)}bind(t,e=0){const{gl:r}=this;if(t=t==null?void 0:t.castToBaseTexture(),(t==null?void 0:t.valid)&&!t.parentTextureArray){t.touched=this.renderer.textureGC.count;const n=t._glTextures[this.CONTEXT_UID]||this.initTexture(t);this.boundTextures[e]!==t&&(this.currentLocation!==e&&(this.currentLocation=e,r.activeTexture(r.TEXTURE0+e)),r.bindTexture(t.target,n.texture)),n.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,r.activeTexture(r.TEXTURE0+e)),this.updateTexture(t)):n.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,r.activeTexture(r.TEXTURE0+e)),r.bindTexture(r.TEXTURE_2D,this.emptyTextures[r.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:r}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let n=0;n<r.length;n++)r[n]===this.unknownTexture&&this.bind(null,n)}for(let n=0;n<r.length;n++)r[n]===t&&(this.currentLocation!==n&&(e.activeTexture(e.TEXTURE0+n),this.currentLocation=n),e.bindTexture(t.target,this.emptyTextures[t.target].texture),r[n]=null)}ensureSamplerType(t){const{boundTextures:e,hasIntegerTextures:r,CONTEXT_UID:n}=this;if(r)for(let s=t-1;s>=0;--s){const o=e[s];o&&o._glTextures[n].samplerType!==rt.FLOAT&&this.renderer.texture.unbind(o)}}initTexture(t){const e=new Wc(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 r;e.internalFormat=((r=this.internalFormats[t.type])==null?void 0:r[t.format])??t.format,e.samplerType=this.samplerTypes[e.internalFormat]??rt.FLOAT,this.webGLVersion===2&&t.type===ct.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){var n;const e=t._glTextures[this.CONTEXT_UID];if(!e)return;const r=this.renderer;if(this.initTextureType(t,e),(n=t.resource)==null?void 0:n.upload(r,t,e))e.samplerType!==rt.FLOAT&&(this.hasIntegerTextures=!0);else{const s=t.realWidth,o=t.realHeight,a=r.gl;(e.width!==s||e.height!==o||e.dirtyId<0)&&(e.width=s,e.height=o,a.texImage2D(t.target,0,e.internalFormat,s,o,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.dirtyId=t.dirtyId}destroyTexture(t,e){const{gl:r}=this;if(t=t.castToBaseTexture(),t._glTextures[this.CONTEXT_UID]&&(this.unbind(t),r.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){const n=this.managedTextures.indexOf(t);n!==-1&&rs(this.managedTextures,n,1)}}updateTextureStyle(t){var r;const e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===Ti.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=wi.CLAMP:e.wrapMode=t.wrapMode,(r=t.resource)!=null&&r.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){const r=this.gl;if(e.mipmap&&t.mipmap!==Ti.ON_MANUAL&&r.generateMipmap(t.target),r.texParameteri(t.target,r.TEXTURE_WRAP_S,e.wrapMode),r.texParameteri(t.target,r.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){r.texParameteri(t.target,r.TEXTURE_MIN_FILTER,t.scaleMode===$i.LINEAR?r.LINEAR_MIPMAP_LINEAR:r.NEAREST_MIPMAP_NEAREST);const n=this.renderer.context.extensions.anisotropicFiltering;if(n&&t.anisotropicLevel>0&&t.scaleMode===$i.LINEAR){const s=Math.min(t.anisotropicLevel,r.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT));r.texParameterf(t.target,n.TEXTURE_MAX_ANISOTROPY_EXT,s)}}else r.texParameteri(t.target,r.TEXTURE_MIN_FILTER,t.scaleMode===$i.LINEAR?r.LINEAR:r.NEAREST);r.texParameteri(t.target,r.TEXTURE_MAG_FILTER,t.scaleMode===$i.LINEAR?r.LINEAR:r.NEAREST)}destroy(){this.renderer=null}}Jm.extension={type:q.RendererSystem,name:"texture"},st.add(Jm);class $m{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:r}=this,n=t._glTransformFeedbacks[r]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,n)}unbind(){const{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){const{gl:r,renderer:n}=this;e&&n.shader.bind(e),r.beginTransformFeedback(t)}endTransformFeedback(){const{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){const{gl:e,renderer:r,CONTEXT_UID:n}=this,s=e.createTransformFeedback();t._glTransformFeedbacks[n]=s,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,s);for(let o=0;o<t.buffers.length;o++){const a=t.buffers[o];a&&(r.buffer.update(a),a._glBuffers[n].refCount++,e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,o,a._glBuffers[n].buffer||null))}return e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null),t.disposeRunner.add(this),s}disposeTransformFeedback(t,e){const r=t._glTransformFeedbacks[this.CONTEXT_UID],n=this.gl;t.disposeRunner.remove(this);const s=this.renderer.buffer;if(s)for(let o=0;o<t.buffers.length;o++){const a=t.buffers[o];if(!a)continue;const l=a._glBuffers[this.CONTEXT_UID];l&&(l.refCount--,l.refCount===0&&!e&&s.dispose(a,e))}r&&(e||n.deleteTransformFeedback(r),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}}$m.extension={type:q.RendererSystem,name:"transformFeedback"},st.add($m);class Ha{constructor(t){this.renderer=t}init(t){this.screen=new gt(0,0,t.width,t.height),this.element=t.view||nt.ADAPTER.createCanvas(),this.resolution=t.resolution||nt.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 r=this.element.width/this.resolution,n=this.element.height/this.resolution;this.screen.width=r,this.screen.height=n,this.autoDensity&&(this.element.style.width=`${r}px`,this.element.style.height=`${n}px`),this.renderer.emit("resize",r,n),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}}Ha.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},Ha.extension={type:[q.RendererSystem,q.CanvasRendererSystem],name:"_view"},st.add(Ha),nt.PREFER_ENV=tn.WEBGL2,nt.STRICT_TEXTURE_CACHE=!1,nt.RENDER_OPTIONS={...Ua.defaultOptions,...Ba.defaultOptions,...Ha.defaultOptions,...Va.defaultOptions},Object.defineProperties(nt,{WRAP_MODE:{get(){return xt.defaultOptions.wrapMode},set(i){wt("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),xt.defaultOptions.wrapMode=i}},SCALE_MODE:{get(){return xt.defaultOptions.scaleMode},set(i){wt("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),xt.defaultOptions.scaleMode=i}},MIPMAP_TEXTURES:{get(){return xt.defaultOptions.mipmap},set(i){wt("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),xt.defaultOptions.mipmap=i}},ANISOTROPIC_LEVEL:{get(){return xt.defaultOptions.anisotropicLevel},set(i){wt("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),xt.defaultOptions.anisotropicLevel=i}},FILTER_RESOLUTION:{get(){return wt("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),Te.defaultResolution},set(i){Te.defaultResolution=i}},FILTER_MULTISAMPLE:{get(){return wt("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),Te.defaultMultisample},set(i){Te.defaultMultisample=i}},SPRITE_MAX_TEXTURES:{get(){return dn.defaultMaxTextures},set(i){wt("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),dn.defaultMaxTextures=i}},SPRITE_BATCH_SIZE:{get(){return dn.defaultBatchSize},set(i){wt("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),dn.defaultBatchSize=i}},CAN_UPLOAD_SAME_BUFFER:{get(){return dn.canUploadSameBuffer},set(i){wt("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),dn.canUploadSameBuffer=i}},GC_MODE:{get(){return mn.defaultMode},set(i){wt("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),mn.defaultMode=i}},GC_MAX_IDLE:{get(){return mn.defaultMaxIdle},set(i){wt("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),mn.defaultMaxIdle=i}},GC_MAX_CHECK_COUNT:{get(){return mn.defaultCheckCountMax},set(i){wt("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),mn.defaultCheckCountMax=i}},PRECISION_VERTEX:{get(){return sr.defaultVertexPrecision},set(i){wt("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),sr.defaultVertexPrecision=i}},PRECISION_FRAGMENT:{get(){return sr.defaultFragmentPrecision},set(i){wt("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),sr.defaultFragmentPrecision=i}}});var gn=(i=>(i[i.INTERACTION=50]="INTERACTION",i[i.HIGH=25]="HIGH",i[i.NORMAL=0]="NORMAL",i[i.LOW=-25]="LOW",i[i.UTILITY=-50]="UTILITY",i))(gn||{});class Zc{constructor(t,e=null,r=0,n=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=r,this.once=n}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 Qm=class ze{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 Zc(null,null,1/0),this.deltaMS=1/ze.targetFPMS,this.elapsedMS=1/ze.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,r=gn.NORMAL){return this._addListener(new Zc(t,e,r))}addOnce(t,e,r=gn.NORMAL){return this._addListener(new Zc(t,e,r,!0))}_addListener(t){let e=this._head.next,r=this._head;if(!e)t.connect(r);else{for(;e;){if(t.priority>e.priority){t.connect(r);break}r=e,e=e.next}t.previous||t.connect(r)}return this._startIfPossible(),this}remove(t,e){let r=this._head.next;for(;r;)r.match(t,e)?r=r.destroy():r=r.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 s=t-this._lastFrame|0;if(s<this._minElapsedMS)return;this._lastFrame=t-s%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*ze.targetFPMS;const r=this._head;let n=r.next;for(;n;)n=n.emit(this.deltaTime);r.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),r=Math.min(Math.max(0,e)/1e3,ze.targetFPMS);this._maxElapsedMS=1/r}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(!ze._shared){const t=ze._shared=new ze;t.autoStart=!0,t._protected=!0}return ze._shared}static get system(){if(!ze._system){const t=ze._system=new ze;t.autoStart=!0,t._protected=!0}return ze._system}};Qm.targetFPMS=.06;let Se=Qm;Object.defineProperties(nt,{TARGET_FPMS:{get(){return Se.targetFPMS},set(i){wt("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),Se.targetFPMS=i}}});class qm{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,gn.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?Se.shared:new Se,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}qm.extension=q.Application,st.add(qm);const t0=[];st.handleByList(q.Renderer,t0);function Nw(i){for(const t of t0)if(t.test(i))return new t(i);throw new Error("Unable to auto-detect a suitable renderer.")}var Ow=`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
- }`,fw=`attribute vec2 aVertexPosition;
500
+ }`,Bw=`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 pw=dw,Zm=fw;class Vm{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(){}}Vm.extension={type:q.RendererSystem,name:"_multisample"},nt.add(Vm);class mw{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class Hm{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 mw(i.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}}Hm.extension={type:q.RendererSystem,name:"buffer"},nt.add(Hm);class Km{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}}Km.extension={type:q.RendererSystem,name:"objectRenderer"},nt.add(Km);const Za=class Ef extends hw{constructor(t){super(),this.type=Gf.WEBGL,t=Object.assign({},st.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new hi({projectionMatrix:new Dt},!0);const e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:Ef.__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&&(wt("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=Ef.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t!=null&&t.forceCanvas?!1:O1()}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 wt("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return wt("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return wt("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return wt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){wt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return wt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){wt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return wt("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)}};Za.extension={type:q.Renderer,priority:1},Za.__plugins={},Za.__systems={};let Uc=Za;nt.handleByMap(q.RendererPlugin,Uc.__plugins),nt.handleByMap(q.RendererSystem,Uc.__systems),nt.add(Uc);class Ym extends ro{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 xt;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 ro?this.addResourceAt(t[i],i):this.addResourceAt(tm(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 gw extends Ym{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=Us.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 yw extends Ir{constructor(t){super(t)}static test(t){const{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}}const zm=class ra extends Ym{constructor(t,e){const{width:i,height:s,autoLoad:n,linkBaseTexture:o}=e||{};if(t&&t.length!==ra.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:i,height:s});for(let a=0;a<ra.SIDES;a++)this.items[a].target=Us.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=Us.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=Us.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<ra.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===ra.SIDES}};zm.SIDES=6;let bw=zm;class rn extends Ir{constructor(t,e){e=e||{};let i,s,n;typeof t=="string"?(i=rn.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 st.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===Ee.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 rn._EMPTY=rn._EMPTY??st.ADAPTER.createCanvas(0,0),rn._EMPTY}}const Xc=class Sl extends Ir{constructor(t,e){e=e||{},super(st.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)},Sl.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;Ir.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_${es()}`,o.getContext("2d").drawImage(t,0,0,e,i,0,0,s,n),this._resolve(),this._resolve=null}}static getSize(t){const e=Sl.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"&&Sl.SVG_XML.test(t)}};Xc.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,Xc.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let Wc=Xc;const Zc=class Cf extends Ir{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];Ir.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||Cf.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=Te.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&&(Te.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||(Te.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Te.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||Cf.TYPES.includes(e)}};Zc.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Zc.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let jm=Zc;Sc.push(rn,mm,yw,jm,Wc,Sa,bw,gw);class Va{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?gt.EMPTY:(t=t||new gt(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,p=this.maxX,m=this.maxY,g=o*e+h*i+c,y=a*e+l*i+u;d=g<d?g:d,f=y<f?y:f,p=g>p?g:p,m=y>m?y:m,g=o*s+h*i+c,y=a*s+l*i+u,d=g<d?g:d,f=y<f?y:f,p=g>p?g:p,m=y>m?y:m,g=o*e+h*n+c,y=a*e+l*n+u,d=g<d?g:d,f=y<f?y:f,p=g>p?g:p,m=y>m?y:m,g=o*s+h*n+c,y=a*s+l*n+u,d=g<d?g:d,f=y<f?y:f,p=g>p?g:p,m=y>m?y:m,this.minX=d,this.minY=f,this.maxX=p,this.maxY=m}addVertexData(t,e,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,p=this.minY,m=this.maxX,g=this.maxY;for(let y=i;y<s;y+=2){const x=e[y],b=e[y+1],v=a*x+l*b+u,w=c*b+h*x+d;f=Math.min(f,v-n),m=Math.max(m,v+n),p=Math.min(p,w-o),g=Math.max(g,w+o)}this.minX=f,this.minY=p,this.maxX=m,this.maxY=g}addBounds(t){const e=this.minX,i=this.minY,s=this.maxX,n=this.maxY;this.minX=t.minX<e?t.minX:e,this.minY=t.minY<i?t.minY:i,this.maxX=t.maxX>s?t.maxX:s,this.maxY=t.maxY>n?t.maxY:n}addBoundsMask(t,e){const i=t.minX>e.minX?t.minX:e.minX,s=t.minY>e.minY?t.minY:e.minY,n=t.maxX<e.maxX?t.maxX:e.maxX,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 Zt extends Kn{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new Mc,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 Va,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(Zt.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 gt),e=this._boundsRect),this._bounds.getRectangle(e)}getLocalBounds(t){t||(this._localBoundsRect||(this._localBoundsRect=new gt),t=this._localBoundsRect),this._localBounds||(this._localBounds=new Va);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 xw),this.tempDisplayObjectParent}enableTempParent(){const t=this.parent;return this.parent=this._tempDisplayObjectParent,t}disableTempParent(t){this.parent=t}get x(){return this.position.x}set x(t){this.transform.position.x=t}get y(){return this.position.y}set y(t){this.transform.position.y=t}get worldTransform(){return this.transform.worldTransform}get localTransform(){return this.transform.localTransform}get position(){return this.transform.position}set position(t){this.transform.position.copyFrom(t)}get scale(){return this.transform.scale}set scale(t){this.transform.scale.copyFrom(t)}get pivot(){return this.transform.pivot}set pivot(t){this.transform.pivot.copyFrom(t)}get skew(){return this.transform.skew}set skew(t){this.transform.skew.copyFrom(t)}get rotation(){return this.transform.rotation}set rotation(t){this.transform.rotation=t}get angle(){return this.transform.rotation*dv}set angle(t){this.transform.rotation=t*fv}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 xw extends Zt{constructor(){super(...arguments),this.sortDirty=null}}Zt.prototype.displayObjectUpdateTransform=Zt.prototype.updateTransform;const _w=new Dt;function vw(r,t){return r.zIndex===t.zIndex?r._lastSortedIndex-t._lastSortedIndex:r.zIndex-t.zIndex}const Jm=class If extends Zt{constructor(){super(),this.children=[],this.sortableChildren=If.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);qs(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,qs(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,qs(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(vw),this.sortDirty=!1}updateTransform(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(let t=0,e=this.children.length;t<e;++t){const 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!==If.prototype._render&&(i=this.getBounds(!0));const n=t.projection.transform;if(n&&(s?(s=_w.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!==ie.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}};Jm.defaultSortableChildren=!1;let Ct=Jm;Ct.prototype.containerUpdateTransform=Ct.prototype.updateTransform,Object.defineProperties(st,{SORTABLE_CHILDREN:{get(){return Ct.defaultSortableChildren},set(r){wt("7.1.0","settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),Ct.defaultSortableChildren=r}}});const ho=new dt,ww=new Uint16Array([0,1,2,0,2,3]);class $t extends Ct{constructor(t){super(),this._anchor=new rr(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 kt(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=mt.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=t||ot.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=ww,this.pluginName="batch",this.isSprite=!0,this._roundPixels=st.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=Sr(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=Sr(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,p=0,m=0,g=0;if(c?(p=c.x-d._x*u.width,f=p+c.width,g=c.y-d._y*u.height,m=g+c.height):(p=-d._x*u.width,f=p+u.width,g=-d._y*u.height,m=g+u.height),l[0]=i*p+n*g+a,l[1]=o*g+s*p+h,l[2]=i*f+n*g+a,l[3]=o*g+s*f+h,l[4]=i*f+n*m+a,l[5]=o*m+s*f+h,l[6]=i*p+n*m+a,l[7]=o*m+s*p+h,this._roundPixels){const y=st.RESOLUTION;for(let x=0;x<l.length;++x)l[x]=Math.round(l[x]*y)/y}}calculateTrimmedVertices(){if(!this.vertexTrimmedData)this.vertexTrimmedData=new Float32Array(8);else if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return;this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;const t=this._texture,e=this.vertexTrimmedData,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,p=-s._y*i.height,m=p+i.height;if(e[0]=o*d+h*p+c,e[1]=l*p+a*d+u,e[2]=o*f+h*p+c,e[3]=l*p+a*f+u,e[4]=o*f+h*m+c,e[5]=l*m+a*f+u,e[6]=o*d+h*m+c,e[7]=l*m+a*d+u,this._roundPixels){const g=st.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 Va),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 gt),t=this._localBoundsRect),this._localBounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,ho);const e=this._texture.orig.width,i=this._texture.orig.height,s=-e*this.anchor.x;let n=0;return ho.x>=s&&ho.x<s+e&&(n=-i*this.anchor.y,ho.y>=n&&ho.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 ot?t:ot.from(t,e);return new $t(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=Sr(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=Sr(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||ot.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))}}const $m=new Dt;Zt.prototype._cacheAsBitmap=!1,Zt.prototype._cacheData=null,Zt.prototype._cacheAsBitmapResolution=null,Zt.prototype._cacheAsBitmapMultisample=null;class Tw{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(Zt.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 Tw),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)}}}),Zt.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))},Zt.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 gt,!0);if((f=this.filters)!=null&&f.length){const p=this.filters[0].padding;e.pad(p)}const i=this.cacheAsBitmapResolution||r.resolution;e.ceil(i),e.width=Math.max(e.width,1/i),e.height=Math.max(e.height,1/i);const s=r.renderTexture.current,n=r.renderTexture.sourceFrame.clone(),o=r.renderTexture.destinationFrame.clone(),a=r.projection.transform,h=hs.create({width:e.width,height:e.height,resolution:i,multisample:this.cacheAsBitmapMultisample??r.multisample}),l=`cacheAsBitmap_${es()}`;this._cacheData.textureCacheId=l,xt.addToCache(h.baseTexture,l),ot.addToCache(h,l);const c=this.transform.localTransform.copyTo($m).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 $t(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)},Zt.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))},Zt.prototype._initCachedDisplayObjectCanvas=function(r){var c;if((c=this._cacheData)!=null&&c.sprite)return;const t=this.getLocalBounds(new gt,!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=hs.create({width:t.width,height:t.height,resolution:n}),a=`cacheAsBitmap_${es()}`;this._cacheData.textureCacheId=a,xt.addToCache(o.baseTexture,a),ot.addToCache(o,a);const h=$m;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 $t(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)},Zt.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},Zt.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},Zt.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,xt.removeFromCache(this._cacheData.textureCacheId),ot.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},Zt.prototype._cacheAsBitmapDestroy=function(r){this.cacheAsBitmap=!1,this.destroy(r)},Zt.prototype.name=null,Ct.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},Zt.prototype.getGlobalPosition=function(r=new dt,t=!1){return this.parent?this.parent.toGlobal(this.position,r,t):(r.x=this.position.x,r.y=this.position.y),r};var Sw=`varying vec2 vTextureCoord;
526
+ `;const Uw=Ow,e0=Bw;class i0{constructor(t){this.renderer=t}contextChange(t){let e;if(this.renderer.context.webGLVersion===1){const r=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,r)}else{const r=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,r)}e>=$t.HIGH?this.multisample=$t.HIGH:e>=$t.MEDIUM?this.multisample=$t.MEDIUM:e>=$t.LOW?this.multisample=$t.LOW:this.multisample=$t.NONE}destroy(){}}i0.extension={type:q.RendererSystem,name:"_multisample"},st.add(i0);class Xw{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class r0{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:r}=this,n=t._glBuffers[r]||this.createGLBuffer(t);e.bindBuffer(t.type,n.buffer)}unbind(t){const{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){const{gl:r,CONTEXT_UID:n}=this;if(this.boundBufferBases[e]!==t){const s=t._glBuffers[n]||this.createGLBuffer(t);this.boundBufferBases[e]=t,r.bindBufferBase(r.UNIFORM_BUFFER,e,s.buffer)}}bindBufferRange(t,e,r){const{gl:n,CONTEXT_UID:s}=this;r=r||0;const o=t._glBuffers[s]||this.createGLBuffer(t);n.bindBufferRange(n.UNIFORM_BUFFER,e||0,o.buffer,r*256,256)}update(t){const{gl:e,CONTEXT_UID:r}=this,n=t._glBuffers[r]||this.createGLBuffer(t);if(t._updateID!==n.updateID)if(n.updateID=t._updateID,e.bindBuffer(t.type,n.buffer),n.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{const s=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;n.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,s)}}dispose(t,e){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];const r=t._glBuffers[this.CONTEXT_UID],n=this.gl;t.disposeRunner.remove(this),r&&(e||n.deleteBuffer(r.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){const e=Object.keys(this.managedBuffers);for(let r=0;r<e.length;r++)this.dispose(this.managedBuffers[e[r]],t)}createGLBuffer(t){const{CONTEXT_UID:e,gl:r}=this;return t._glBuffers[e]=new Xw(r.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}}r0.extension={type:q.RendererSystem,name:"buffer"},st.add(r0);class n0{constructor(t){this.renderer=t}render(t,e){const r=this.renderer;let n,s,o,a;if(e&&(n=e.renderTexture,s=e.clear,o=e.transform,a=e.skipUpdateTransform),this.renderingToScreen=!n,r.runners.prerender.emit(),r.emit("prerender"),r.projection.transform=o,!r.context.isLost){if(n||(this.lastObjectRendered=t),!a){const l=t.enableTempParent();t.updateTransform(),t.disableTempParent(l)}r.renderTexture.bind(n),r.batch.currentRenderer.start(),(s??r.background.clearBeforeRender)&&r.renderTexture.clear(),t.render(r),r.batch.currentRenderer.flush(),n&&(e.blit&&r.framebuffer.blit(),n.baseTexture.update()),r.runners.postrender.emit(),r.projection.transform=null,r.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}}n0.extension={type:q.RendererSystem,name:"objectRenderer"},st.add(n0);const Ka=class Nf extends kw{constructor(t){super(),this.type=Hf.WEBGL,t=Object.assign({},nt.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new hi({projectionMatrix:new Nt},!0);const e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:Nf.__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&&(wt("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=Nf.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t!=null&&t.forceCanvas?!1:cv()}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 wt("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return wt("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return wt("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return wt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){wt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return wt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){wt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return wt("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)}};Ka.extension={type:q.Renderer,priority:1},Ka.__plugins={},Ka.__systems={};let Vc=Ka;st.handleByMap(q.RendererPlugin,Vc.__plugins),st.handleByMap(q.RendererSystem,Vc.__systems),st.add(Vc);class s0 extends oo{constructor(t,e){const{width:r,height:n}=e||{};super(r,n),this.items=[],this.itemDirtyIds=[];for(let s=0;s<t;s++){const o=new xt;this.items.push(o),this.itemDirtyIds.push(-2)}this.length=t,this._load=null,this.baseTexture=null}initFromArray(t,e){for(let r=0;r<this.length;r++)t[r]&&(t[r].castToBaseTexture?this.addBaseTextureAt(t[r].castToBaseTexture(),r):t[r]instanceof oo?this.addResourceAt(t[r],r):this.addResourceAt(dm(t[r],e),r))}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:r}=this.items[0];return this.resize(e,r),this.update(),Promise.resolve(this)}),this._load}}class Ww extends s0{constructor(t,e){const{width:r,height:n}=e||{};let s,o;Array.isArray(t)?(s=t,o=t.length):o=t,super(o,{width:r,height:n}),s&&this.initFromArray(s,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=Hn.TEXTURE_2D_ARRAY}upload(t,e,r){const{length:n,itemDirtyIds:s,items:o}=this,{gl:a}=t;r.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,r.internalFormat,this._width,this._height,n,0,e.format,r.type,null);for(let l=0;l<n;l++){const h=o[l];s[l]<h.dirtyId&&(s[l]=h.dirtyId,h.valid&&a.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,l,h.resource.width,h.resource.height,1,e.format,r.type,h.resource.source))}return!0}}class Zw extends Rr{constructor(t){super(t)}static test(t){const{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}}const o0=class oa extends s0{constructor(t,e){const{width:r,height:n,autoLoad:s,linkBaseTexture:o}=e||{};if(t&&t.length!==oa.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:r,height:n});for(let a=0;a<oa.SIDES;a++)this.items[a].target=Hn.TEXTURE_CUBE_MAP_POSITIVE_X+a;this.linkBaseTexture=o!==!1,t&&this.initFromArray(t,e),s!==!1&&this.load()}bind(t){super.bind(t),t.target=Hn.TEXTURE_CUBE_MAP}addBaseTextureAt(t,e,r){if(r===void 0&&(r=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=Hn.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,r){const n=this.itemDirtyIds;for(let s=0;s<oa.SIDES;s++){const o=this.items[s];(n[s]<o.dirtyId||r.dirtyId<e.dirtyId)&&(o.valid&&o.resource?(o.resource.upload(t,o,r),n[s]=o.dirtyId):n[s]<-1&&(t.gl.texImage2D(o.target,0,r.internalFormat,e.realWidth,e.realHeight,0,e.format,r.type,null),n[s]=-1))}return!0}static test(t){return Array.isArray(t)&&t.length===oa.SIDES}};o0.SIDES=6;let Vw=o0;class os extends Rr{constructor(t,e){e=e||{};let r,n,s;typeof t=="string"?(r=os.EMPTY,n=t,s=!0):(r=t,n=null,s=!1),super(r),this.url=n,this.crossOrigin=e.crossOrigin??!0,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.ownsImageBitmap=e.ownsImageBitmap??s,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 r=await nt.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;const n=await r.blob();if(this.destroyed)return;const s=await createImageBitmap(n,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===Ce.UNPACK?"premultiply":"none"});if(this.destroyed){s.close();return}this.source=s,this.update(),t(this)}catch(r){if(this.destroyed)return;e(r),this.onError.emit(r)}}),this._load)}upload(t,e,r){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),super.upload(t,e,r)):(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 os._EMPTY=os._EMPTY??nt.ADAPTER.createCanvas(0,0),os._EMPTY}}const Hc=class Ah extends Rr{constructor(t,e){e=e||{},super(nt.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=t,this.scale=e.scale||1,this._overrideWidth=e.width,this._overrideHeight=e.height,this._resolve=null,this._crossorigin=e.crossorigin,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(t=>{if(this._resolve=()=>{this.update(),t(this)},Ah.SVG_XML.test(this.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");this.svg=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`}this._loadSvg()}),this._load)}_loadSvg(){const t=new Image;Rr.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,r=t.height;if(!e||!r)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let n=e*this.scale,s=r*this.scale;(this._overrideWidth||this._overrideHeight)&&(n=this._overrideWidth||this._overrideHeight/r*e,s=this._overrideHeight||this._overrideWidth/e*r),n=Math.round(n),s=Math.round(s);const o=this.source;o.width=n,o.height=s,o._pixiId=`canvas_${on()}`,o.getContext("2d").drawImage(t,0,0,e,r,0,0,n,s),this._resolve(),this._resolve=null}}static getSize(t){const e=Ah.SVG_SIZE.exec(t),r={};return e&&(r[e[1]]=Math.round(parseFloat(e[3])),r[e[5]]=Math.round(parseFloat(e[7]))),r}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(t,e){return e==="svg"||typeof t=="string"&&t.startsWith("data:image/svg+xml")||typeof t=="string"&&Ah.SVG_XML.test(t)}};Hc.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,Hc.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let Kc=Hc;const zc=class Of extends Rr{constructor(t,e){if(e=e||{},!(t instanceof HTMLVideoElement)){const r=document.createElement("video");e.autoLoad!==!1&&r.setAttribute("preload","auto"),e.playsinline!==!1&&(r.setAttribute("webkit-playsinline",""),r.setAttribute("playsinline","")),e.muted===!0&&(r.setAttribute("muted",""),r.muted=!0),e.loop===!0&&r.setAttribute("loop",""),e.autoPlay!==!1&&r.setAttribute("autoplay",""),typeof t=="string"&&(t=[t]);const n=t[0].src||t[0];Rr.crossOrigin(r,n,e.crossorigin);for(let s=0;s<t.length;++s){const o=document.createElement("source");let{src:a,mime:l}=t[s];if(a=a||t[s],a.startsWith("data:"))l=a.slice(5,a.indexOf(";"));else if(!a.startsWith("blob:")){const h=a.split("?").shift().toLowerCase(),c=h.slice(h.lastIndexOf(".")+1);l=l||Of.MIME_TYPES[c]||`video/${c}`}o.src=a,l&&(o.type=l),r.appendChild(o)}t=r}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=Se.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,r)=>{this.valid?e(this):(this._resolve=e,this._reject=r,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&&(Se.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||(Se.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Se.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||Of.TYPES.includes(e)}};zc.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],zc.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let a0=zc;Ac.push(os,Im,Zw,a0,Kc,Ia,Vw,Ww);class za{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?gt.EMPTY:(t=t||new gt(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:r,b:n,c:s,d:o,tx:a,ty:l}=t,h=r*e.x+s*e.y+a,c=n*e.x+o*e.y+l;this.minX=Math.min(this.minX,h),this.maxX=Math.max(this.maxX,h),this.minY=Math.min(this.minY,c),this.maxY=Math.max(this.maxY,c)}addQuad(t){let e=this.minX,r=this.minY,n=this.maxX,s=this.maxY,o=t[0],a=t[1];e=o<e?o:e,r=a<r?a:r,n=o>n?o:n,s=a>s?a:s,o=t[2],a=t[3],e=o<e?o:e,r=a<r?a:r,n=o>n?o:n,s=a>s?a:s,o=t[4],a=t[5],e=o<e?o:e,r=a<r?a:r,n=o>n?o:n,s=a>s?a:s,o=t[6],a=t[7],e=o<e?o:e,r=a<r?a:r,n=o>n?o:n,s=a>s?a:s,this.minX=e,this.minY=r,this.maxX=n,this.maxY=s}addFrame(t,e,r,n,s){this.addFrameMatrix(t.worldTransform,e,r,n,s)}addFrameMatrix(t,e,r,n,s){const o=t.a,a=t.b,l=t.c,h=t.d,c=t.tx,u=t.ty;let d=this.minX,f=this.minY,p=this.maxX,m=this.maxY,g=o*e+l*r+c,y=a*e+h*r+u;d=g<d?g:d,f=y<f?y:f,p=g>p?g:p,m=y>m?y:m,g=o*n+l*r+c,y=a*n+h*r+u,d=g<d?g:d,f=y<f?y:f,p=g>p?g:p,m=y>m?y:m,g=o*e+l*s+c,y=a*e+h*s+u,d=g<d?g:d,f=y<f?y:f,p=g>p?g:p,m=y>m?y:m,g=o*n+l*s+c,y=a*n+h*s+u,d=g<d?g:d,f=y<f?y:f,p=g>p?g:p,m=y>m?y:m,this.minX=d,this.minY=f,this.maxX=p,this.maxY=m}addVertexData(t,e,r){let n=this.minX,s=this.minY,o=this.maxX,a=this.maxY;for(let l=e;l<r;l+=2){const h=t[l],c=t[l+1];n=h<n?h:n,s=c<s?c:s,o=h>o?h:o,a=c>a?c:a}this.minX=n,this.minY=s,this.maxX=o,this.maxY=a}addVertices(t,e,r,n){this.addVerticesMatrix(t.worldTransform,e,r,n)}addVerticesMatrix(t,e,r,n,s=0,o=s){const a=t.a,l=t.b,h=t.c,c=t.d,u=t.tx,d=t.ty;let f=this.minX,p=this.minY,m=this.maxX,g=this.maxY;for(let y=r;y<n;y+=2){const x=e[y],b=e[y+1],v=a*x+h*b+u,w=c*b+l*x+d;f=Math.min(f,v-s),m=Math.max(m,v+s),p=Math.min(p,w-o),g=Math.max(g,w+o)}this.minX=f,this.minY=p,this.maxX=m,this.maxY=g}addBounds(t){const e=this.minX,r=this.minY,n=this.maxX,s=this.maxY;this.minX=t.minX<e?t.minX:e,this.minY=t.minY<r?t.minY:r,this.maxX=t.maxX>n?t.maxX:n,this.maxY=t.maxY>s?t.maxY:s}addBoundsMask(t,e){const r=t.minX>e.minX?t.minX:e.minX,n=t.minY>e.minY?t.minY:e.minY,s=t.maxX<e.maxX?t.maxX:e.maxX,o=t.maxY<e.maxY?t.maxY:e.maxY;if(r<=s&&n<=o){const a=this.minX,l=this.minY,h=this.maxX,c=this.maxY;this.minX=r<a?r:a,this.minY=n<l?n:l,this.maxX=s>h?s:h,this.maxY=o>c?o:c}}addBoundsMatrix(t,e){this.addFrameMatrix(e,t.minX,t.minY,t.maxX,t.maxY)}addBoundsArea(t,e){const r=t.minX>e.x?t.minX:e.x,n=t.minY>e.y?t.minY:e.y,s=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(r<=s&&n<=o){const a=this.minX,l=this.minY,h=this.maxX,c=this.maxY;this.minX=r<a?r:a,this.minY=n<l?n:l,this.maxX=s>h?s:h,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,r,n,s,o){t-=s,e-=o,r+=s,n+=o,this.minX=this.minX<t?this.minX:t,this.maxX=this.maxX>r?this.maxX:r,this.minY=this.minY<e?this.minY:e,this.maxY=this.maxY>n?this.maxY:n}}class Vt extends js{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new Gc,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 za,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 r=0;r<e.length;++r){const n=e[r];Object.defineProperty(Vt.prototype,n,Object.getOwnPropertyDescriptor(t,n))}}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 gt),e=this._boundsRect),this._bounds.getRectangle(e)}getLocalBounds(t){t||(this._localBoundsRect||(this._localBoundsRect=new gt),t=this._localBoundsRect),this._localBounds||(this._localBounds=new za);const e=this.transform,r=this.parent;this.parent=null,this._tempDisplayObjectParent.worldAlpha=(r==null?void 0:r.worldAlpha)??1,this.transform=this._tempDisplayObjectParent.transform;const n=this._bounds,s=this._boundsID;this._bounds=this._localBounds;const o=this.getBounds(!1,t);return this.parent=r,this.transform=e,this._bounds=n,this._bounds.updateID+=this._boundsID-s,o}toGlobal(t,e,r=!1){return r||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(t,e)}toLocal(t,e,r,n){return e&&(t=e.toGlobal(t,r,n)),n||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(t,r)}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,r=1,n=1,s=0,o=0,a=0,l=0,h=0){return this.position.x=t,this.position.y=e,this.scale.x=r||1,this.scale.y=n||1,this.rotation=s,this.skew.x=o,this.skew.y=a,this.pivot.x=l,this.pivot.y=h,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 Hw),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*Ov}set angle(t){this.transform.rotation=t*Bv}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 Hw extends Vt{constructor(){super(...arguments),this.sortDirty=null}}Vt.prototype.displayObjectUpdateTransform=Vt.prototype.updateTransform;const Kw=new Nt;function zw(i,t){return i.zIndex===t.zIndex?i._lastSortedIndex-t._lastSortedIndex:i.zIndex-t.zIndex}const l0=class Bf extends Vt{constructor(){super(),this.children=[],this.sortableChildren=Bf.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 r=this.getChildIndex(t),n=this.getChildIndex(e);this.children[r]=e,this.children[n]=t,this.onChildrenChange(r<n?r:n)}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 r=this.getChildIndex(t);rs(this.children,r,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],r=this.children.indexOf(e);if(r===-1)return null;e.parent=null,e.transform._parentID=-1,rs(this.children,r,1),this._boundsID++,this.onChildrenChange(r),e.emit("removed",this),this.emit("childRemoved",e,this,r)}return t[0]}removeChildAt(t){const e=this.getChildAt(t);return e.parent=null,e.transform._parentID=-1,rs(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 r=t,n=e,s=n-r;let o;if(s>0&&s<=n){o=this.children.splice(r,s);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(s===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,r=this.children.length;e<r;++e){const n=this.children[e];n._lastSortedIndex=e,!t&&n.zIndex!==0&&(t=!0)}t&&this.children.length>1&&this.children.sort(zw),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 r=this.children[t];r.visible&&r.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 r=e._mask.isMaskData?e._mask.maskObject:e._mask;r?(r.calculateBounds(),this._bounds.addBoundsMask(e._bounds,r._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 r=super.getLocalBounds(t);if(!e)for(let n=0,s=this.children.length;n<s;++n){const o=this.children[n];o.visible&&o.updateTransform()}return r}_calculateBounds(){}_renderWithCulling(t){const e=t.renderTexture.sourceFrame;if(!(e.width>0&&e.height>0))return;let r,n;this.cullArea?(r=this.cullArea,n=this.worldTransform):this._render!==Bf.prototype._render&&(r=this.getBounds(!0));const s=t.projection.transform;if(s&&(n?(n=Kw.copyFrom(n),n.prepend(s)):n=s),r&&e.intersects(r,n))this._render(t);else if(this.cullArea)return;for(let o=0,a=this.children.length;o<a;++o){const l=this.children[o],h=l.cullable;l.cullable=h||!this.cullArea,l.render(t),l.cullable=h}}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 r=0,n=this.children.length;r<n;++r)this.children[r].render(t)}}renderAdvanced(t){var s,o,a;const e=this.filters,r=this._mask;if(e){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(let l=0;l<e.length;l++)e[l].enabled&&this._enabledFilters.push(e[l])}const n=e&&((s=this._enabledFilters)==null?void 0:s.length)||r&&(!r.isMaskData||r.enabled&&(r.autoDetect||r.type!==re.NONE));if(n&&t.batch.flush(),e&&((o=this._enabledFilters)!=null&&o.length)&&t.filter.push(this,this._enabledFilters),r&&t.mask.push(this,this._mask),this.cullable)this._renderWithCulling(t);else{this._render(t);for(let l=0,h=this.children.length;l<h;++l)this.children[l].render(t)}n&&t.batch.flush(),r&&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,r=this.removeChildren(0,this.children.length);if(e)for(let n=0;n<r.length;++n)r[n].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}};l0.defaultSortableChildren=!1;let Ct=l0;Ct.prototype.containerUpdateTransform=Ct.prototype.updateTransform,Object.defineProperties(nt,{SORTABLE_CHILDREN:{get(){return Ct.defaultSortableChildren},set(i){wt("7.1.0","settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),Ct.defaultSortableChildren=i}}});const uo=new dt,Yw=new Uint16Array([0,1,2,0,2,3]);class Qt extends Ct{constructor(t){super(),this._anchor=new nr(this._onAnchorUpdate,this,t?t.defaultAnchor.x:0,t?t.defaultAnchor.y:0),this._texture=null,this._width=0,this._height=0,this._tintColor=new Dt(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=mt.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=t||ot.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=Yw,this.pluginName="batch",this.isSprite=!0,this._roundPixels=nt.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=Ir(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=Ir(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,r=e.a,n=e.b,s=e.c,o=e.d,a=e.tx,l=e.ty,h=this.vertexData,c=t.trim,u=t.orig,d=this._anchor;let f=0,p=0,m=0,g=0;if(c?(p=c.x-d._x*u.width,f=p+c.width,g=c.y-d._y*u.height,m=g+c.height):(p=-d._x*u.width,f=p+u.width,g=-d._y*u.height,m=g+u.height),h[0]=r*p+s*g+a,h[1]=o*g+n*p+l,h[2]=r*f+s*g+a,h[3]=o*g+n*f+l,h[4]=r*f+s*m+a,h[5]=o*m+n*f+l,h[6]=r*p+s*m+a,h[7]=o*m+n*p+l,this._roundPixels){const y=nt.RESOLUTION;for(let x=0;x<h.length;++x)h[x]=Math.round(h[x]*y)/y}}calculateTrimmedVertices(){if(!this.vertexTrimmedData)this.vertexTrimmedData=new Float32Array(8);else if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return;this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;const t=this._texture,e=this.vertexTrimmedData,r=t.orig,n=this._anchor,s=this.transform.worldTransform,o=s.a,a=s.b,l=s.c,h=s.d,c=s.tx,u=s.ty,d=-n._x*r.width,f=d+r.width,p=-n._y*r.height,m=p+r.height;if(e[0]=o*d+l*p+c,e[1]=h*p+a*d+u,e[2]=o*f+l*p+c,e[3]=h*p+a*f+u,e[4]=o*f+l*m+c,e[5]=h*m+a*f+u,e[6]=o*d+l*m+c,e[7]=h*m+a*d+u,this._roundPixels){const g=nt.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 za),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 gt),t=this._localBoundsRect),this._localBounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,uo);const e=this._texture.orig.width,r=this._texture.orig.height,n=-e*this.anchor.x;let s=0;return uo.x>=n&&uo.x<n+e&&(s=-r*this.anchor.y,uo.y>=s&&uo.y<s+r)}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 r=t instanceof ot?t:ot.from(t,e);return new Qt(r)}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=Ir(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=Ir(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||ot.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))}}const h0=new Nt;Vt.prototype._cacheAsBitmap=!1,Vt.prototype._cacheData=null,Vt.prototype._cacheAsBitmapResolution=null,Vt.prototype._cacheAsBitmapMultisample=null;class jw{constructor(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null}}Object.defineProperties(Vt.prototype,{cacheAsBitmapResolution:{get(){return this._cacheAsBitmapResolution},set(i){i!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=i,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get(){return this._cacheAsBitmapMultisample},set(i){i!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=i,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get(){return this._cacheAsBitmap},set(i){if(this._cacheAsBitmap===i)return;this._cacheAsBitmap=i;let t;i?(this._cacheData||(this._cacheData=new jw),t=this._cacheData,t.originalRender=this.render,t.originalRenderCanvas=this.renderCanvas,t.originalUpdateTransform=this.updateTransform,t.originalCalculateBounds=this.calculateBounds,t.originalGetLocalBounds=this.getLocalBounds,t.originalDestroy=this.destroy,t.originalContainsPoint=this.containsPoint,t.originalMask=this._mask,t.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):(t=this._cacheData,t.sprite&&this._destroyCachedDisplayObject(),this.render=t.originalRender,this.renderCanvas=t.originalRenderCanvas,this.calculateBounds=t.originalCalculateBounds,this.getLocalBounds=t.originalGetLocalBounds,this.destroy=t.originalDestroy,this.updateTransform=t.originalUpdateTransform,this.containsPoint=t.originalContainsPoint,this._mask=t.originalMask,this.filterArea=t.originalFilterArea)}}}),Vt.prototype._renderCached=function(i){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(i),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(i))},Vt.prototype._initCachedDisplayObject=function(i){var d,f;if((d=this._cacheData)!=null&&d.sprite)return;const t=this.alpha;this.alpha=1,i.batch.flush();const e=this.getLocalBounds(new gt,!0);if((f=this.filters)!=null&&f.length){const p=this.filters[0].padding;e.pad(p)}const r=this.cacheAsBitmapResolution||i.resolution;e.ceil(r),e.width=Math.max(e.width,1/r),e.height=Math.max(e.height,1/r);const n=i.renderTexture.current,s=i.renderTexture.sourceFrame.clone(),o=i.renderTexture.destinationFrame.clone(),a=i.projection.transform,l=fn.create({width:e.width,height:e.height,resolution:r,multisample:this.cacheAsBitmapMultisample??i.multisample}),h=`cacheAsBitmap_${on()}`;this._cacheData.textureCacheId=h,xt.addToCache(l.baseTexture,h),ot.addToCache(l,h);const c=this.transform.localTransform.copyTo(h0).invert().translate(-e.x,-e.y);this.render=this._cacheData.originalRender,i.render(this,{renderTexture:l,clear:!0,transform:c,skipUpdateTransform:!1}),i.framebuffer.blit(),i.projection.transform=a,i.renderTexture.bind(n,s,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(l);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)},Vt.prototype._renderCachedCanvas=function(i){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(i),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(i))},Vt.prototype._initCachedDisplayObjectCanvas=function(i){var c;if((c=this._cacheData)!=null&&c.sprite)return;const t=this.getLocalBounds(new gt,!0),e=this.alpha;this.alpha=1;const r=i.canvasContext.activeContext,n=i._projTransform,s=this.cacheAsBitmapResolution||i.resolution;t.ceil(s),t.width=Math.max(t.width,1/s),t.height=Math.max(t.height,1/s);const o=fn.create({width:t.width,height:t.height,resolution:s}),a=`cacheAsBitmap_${on()}`;this._cacheData.textureCacheId=a,xt.addToCache(o.baseTexture,a),ot.addToCache(o,a);const l=h0;this.transform.localTransform.copyTo(l),l.invert(),l.tx-=t.x,l.ty-=t.y,this.renderCanvas=this._cacheData.originalRenderCanvas,i.render(this,{renderTexture:o,clear:!0,transform:l,skipUpdateTransform:!1}),i.canvasContext.activeContext=r,i._projTransform=n,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=e;const h=new Qt(o);h.transform.worldTransform=this.transform.worldTransform,h.anchor.x=-(t.x/t.width),h.anchor.y=-(t.y/t.height),h.alpha=e,h._bounds=this._bounds,this._cacheData.sprite=h,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=i._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=h.containsPoint.bind(h)},Vt.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},Vt.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},Vt.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,xt.removeFromCache(this._cacheData.textureCacheId),ot.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},Vt.prototype._cacheAsBitmapDestroy=function(i){this.cacheAsBitmap=!1,this.destroy(i)},Vt.prototype.name=null,Ct.prototype.getChildByName=function(i,t){for(let e=0,r=this.children.length;e<r;e++)if(this.children[e].name===i)return this.children[e];if(t)for(let e=0,r=this.children.length;e<r;e++){const n=this.children[e];if(!n.getChildByName)continue;const s=n.getChildByName(i,!0);if(s)return s}return null},Vt.prototype.getGlobalPosition=function(i=new dt,t=!1){return this.parent?this.parent.toGlobal(this.position,i,t):(i.x=this.position.x,i.y=this.position.y),i};var Jw=`varying vec2 vTextureCoord;
527
527
 
528
528
  uniform sampler2D uSampler;
529
529
  uniform float uAlpha;
@@ -532,9 +532,9 @@ void main(void)
532
532
  {
533
533
  gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;
534
534
  }
535
- `;class Ew extends we{constructor(t=1){super(pw,Sw,{uAlpha:1}),this.alpha=t}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}}const Cw={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]},Iw=["varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{"," gl_FragColor = vec4(0.0);"," %blur%","}"].join(`
536
- `);function Aw(r){const t=Cw[r],e=t.length;let i=Iw,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 Mw=`
535
+ `;class $w extends Te{constructor(t=1){super(Uw,Jw,{uAlpha:1}),this.alpha=t}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}}const Qw={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]},qw=["varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{"," gl_FragColor = vec4(0.0);"," %blur%","}"].join(`
536
+ `);function tT(i){const t=Qw[i],e=t.length;let r=qw,n="";const s="gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;";let o;for(let a=0;a<i;a++){let l=s.replace("%index%",a.toString());o=a,a>=e&&(o=i-a-1),l=l.replace("%value%",t[o].toString()),n+=l,n+=`
537
+ `}return r=r.replace("%blur%",n),r=r.replace("%size%",i.toString()),r}const eT=`
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 Rw(r,t){const e=Math.ceil(r/2);let i=Mw,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 Vc extends we{constructor(t,e=8,i=4,s=we.defaultResolution,n=5){const o=Rw(n,t),a=Aw(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 Pw extends we{constructor(t=8,e=4,i=we.defaultResolution,s=5){super(),this._repeatEdgePixels=!1,this.blurXFilter=new Vc(!0,t,e,i,s),this.blurYFilter=new Vc(!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 Lw=`varying vec2 vTextureCoord;
567
+ }`;function iT(i,t){const e=Math.ceil(i/2);let r=eT,n="",s;t?s="vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);":s="vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);";for(let o=0;o<i;o++){let a=s.replace("%index%",o.toString());a=a.replace("%sampleIndex%",`${o-(e-1)}.0`),n+=a,n+=`
568
+ `}return r=r.replace("%blur%",n),r=r.replace("%size%",i.toString()),r}class Yc extends Te{constructor(t,e=8,r=4,n=Te.defaultResolution,s=5){const o=iT(s,t),a=tT(s);super(o,a),this.horizontal=t,this.resolution=n,this._quality=0,this.quality=r,this.blur=e}apply(t,e,r,n){if(r?this.horizontal?this.uniforms.strength=1/r.width*(r.width/e.width):this.uniforms.strength=1/r.height*(r.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,r,n);else{const s=t.getFilterTexture(),o=t.renderer;let a=e,l=s;this.state.blend=!1,t.applyFilter(this,a,l,Si.CLEAR);for(let h=1;h<this.passes-1;h++){t.bindAndClear(a,Si.BLIT),this.uniforms.uSampler=l;const c=l;l=a,a=c,o.shader.bind(this),o.geometry.draw(5)}this.state.blend=!0,t.applyFilter(this,l,r,n),t.returnFilterTexture(s)}}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 rT extends Te{constructor(t=8,e=4,r=Te.defaultResolution,n=5){super(),this._repeatEdgePixels=!1,this.blurXFilter=new Yc(!0,t,e,r,n),this.blurYFilter=new Yc(!1,t,e,r,n),this.resolution=r,this.quality=e,this.blur=t,this.repeatEdgePixels=!1}apply(t,e,r,n){const s=Math.abs(this.blurXFilter.strength),o=Math.abs(this.blurYFilter.strength);if(s&&o){const a=t.getFilterTexture();this.blurXFilter.apply(t,e,a,Si.CLEAR),this.blurYFilter.apply(t,a,r,n),t.returnFilterTexture(a)}else o?this.blurYFilter.apply(t,e,r,n):this.blurXFilter.apply(t,e,r,n)}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 nT=`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 Hc extends we{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(Zm,Lw,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]=kt.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,p=o*(1-i)-a*s,m=o*(1-i)+a*s,g=i+o*(1-i),y=[h,l,c,0,0,u,d,f,0,0,p,m,g,0,0,0,0,0,1,0];this._loadMatrix(y,e)}contrast(t,e){const i=(t||0)+1,s=-.5*(i-1),n=[i,0,0,0,s,0,i,0,0,s,0,0,i,0,s,0,0,0,1,0];this._loadMatrix(n,e)}saturate(t=0,e){const i=t*2/3+1,s=(i-1)*-.5,n=[i,s,s,0,0,s,i,s,0,0,s,s,i,0,0,0,0,0,1,0];this._loadMatrix(n,e)}desaturate(){this.saturate(-1)}negative(t){const e=[-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0];this._loadMatrix(e,t)}sepia(t){const e=[.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0];this._loadMatrix(e,t)}technicolor(t){const e=[1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0];this._loadMatrix(e,t)}polaroid(t){const e=[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0];this._loadMatrix(e,t)}toBGR(t){const e=[0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0];this._loadMatrix(e,t)}kodachrome(t){const e=[1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0];this._loadMatrix(e,t)}browni(t){const e=[.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0];this._loadMatrix(e,t)}vintage(t){const e=[.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0];this._loadMatrix(e,t)}colorTone(t,e,i,s,n){t=t||.2,e=e||.15,i=i||16770432,s=s||3375104;const o=kt.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}}Hc.prototype.grayscale=Hc.prototype.greyscale;var Gw=`varying vec2 vFilterCoord;
620
+ `;class jc extends Te{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(e0,nT,t),this.alpha=1}_loadMatrix(t,e=!1){let r=t;e&&(this._multiply(r,this.uniforms.m,t),r=this._colorMatrix(r)),this.uniforms.m=r}_multiply(t,e,r){return t[0]=e[0]*r[0]+e[1]*r[5]+e[2]*r[10]+e[3]*r[15],t[1]=e[0]*r[1]+e[1]*r[6]+e[2]*r[11]+e[3]*r[16],t[2]=e[0]*r[2]+e[1]*r[7]+e[2]*r[12]+e[3]*r[17],t[3]=e[0]*r[3]+e[1]*r[8]+e[2]*r[13]+e[3]*r[18],t[4]=e[0]*r[4]+e[1]*r[9]+e[2]*r[14]+e[3]*r[19]+e[4],t[5]=e[5]*r[0]+e[6]*r[5]+e[7]*r[10]+e[8]*r[15],t[6]=e[5]*r[1]+e[6]*r[6]+e[7]*r[11]+e[8]*r[16],t[7]=e[5]*r[2]+e[6]*r[7]+e[7]*r[12]+e[8]*r[17],t[8]=e[5]*r[3]+e[6]*r[8]+e[7]*r[13]+e[8]*r[18],t[9]=e[5]*r[4]+e[6]*r[9]+e[7]*r[14]+e[8]*r[19]+e[9],t[10]=e[10]*r[0]+e[11]*r[5]+e[12]*r[10]+e[13]*r[15],t[11]=e[10]*r[1]+e[11]*r[6]+e[12]*r[11]+e[13]*r[16],t[12]=e[10]*r[2]+e[11]*r[7]+e[12]*r[12]+e[13]*r[17],t[13]=e[10]*r[3]+e[11]*r[8]+e[12]*r[13]+e[13]*r[18],t[14]=e[10]*r[4]+e[11]*r[9]+e[12]*r[14]+e[13]*r[19]+e[14],t[15]=e[15]*r[0]+e[16]*r[5]+e[17]*r[10]+e[18]*r[15],t[16]=e[15]*r[1]+e[16]*r[6]+e[17]*r[11]+e[18]*r[16],t[17]=e[15]*r[2]+e[16]*r[7]+e[17]*r[12]+e[18]*r[17],t[18]=e[15]*r[3]+e[16]*r[8]+e[17]*r[13]+e[18]*r[18],t[19]=e[15]*r[4]+e[16]*r[9]+e[17]*r[14]+e[18]*r[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 r=[t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0];this._loadMatrix(r,e)}tint(t,e){const[r,n,s]=Dt.shared.setValue(t).toArray(),o=[r,0,0,0,0,0,n,0,0,0,0,0,s,0,0,0,0,0,1,0];this._loadMatrix(o,e)}greyscale(t,e){const r=[t,t,t,0,0,t,t,t,0,0,t,t,t,0,0,0,0,0,1,0];this._loadMatrix(r,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 r=Math.cos(t),n=Math.sin(t),s=Math.sqrt,o=1/3,a=s(o),l=r+(1-r)*o,h=o*(1-r)-a*n,c=o*(1-r)+a*n,u=o*(1-r)+a*n,d=r+o*(1-r),f=o*(1-r)-a*n,p=o*(1-r)-a*n,m=o*(1-r)+a*n,g=r+o*(1-r),y=[l,h,c,0,0,u,d,f,0,0,p,m,g,0,0,0,0,0,1,0];this._loadMatrix(y,e)}contrast(t,e){const r=(t||0)+1,n=-.5*(r-1),s=[r,0,0,0,n,0,r,0,0,n,0,0,r,0,n,0,0,0,1,0];this._loadMatrix(s,e)}saturate(t=0,e){const r=t*2/3+1,n=(r-1)*-.5,s=[r,n,n,0,0,n,r,n,0,0,n,n,r,0,0,0,0,0,1,0];this._loadMatrix(s,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,r,n,s){t=t||.2,e=e||.15,r=r||16770432,n=n||3375104;const o=Dt.shared,[a,l,h]=o.setValue(r).toArray(),[c,u,d]=o.setValue(n).toArray(),f=[.3,.59,.11,0,0,a,l,h,t,0,c,u,d,e,0,a-c,l-u,h-d,0,0];this._loadMatrix(f,s)}night(t,e){t=t||.1;const r=[t*-2,-t,0,0,0,-t,0,t,0,0,0,t,t*2,0,0,0,0,0,1,0];this._loadMatrix(r,e)}predator(t,e){const r=[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(r,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}}jc.prototype.grayscale=jc.prototype.greyscale;var sT=`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
- `,Fw=`attribute vec2 aVertexPosition;
640
+ `,oT=`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 Nw extends we{constructor(t,e){const i=new Dt;t.renderable=!1,super(Fw,Gw,{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 dt(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 kw=`varying vec2 v_rgbNW;
669
+ `;class aT extends Te{constructor(t,e){const r=new Nt;t.renderable=!1,super(oT,sT,{mapSampler:t._texture,filterMatrix:r,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])}),this.maskSprite=t,this.maskMatrix=r,e==null&&(e=20),this.scale=new dt(e,e)}apply(t,e,r,n){this.uniforms.filterMatrix=t.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;const s=this.maskSprite.worldTransform,o=Math.sqrt(s.a*s.a+s.b*s.b),a=Math.sqrt(s.c*s.c+s.d*s.d);o!==0&&a!==0&&(this.uniforms.rotation[0]=s.a/o,this.uniforms.rotation[1]=s.b/o,this.uniforms.rotation[2]=s.c/a,this.uniforms.rotation[3]=s.d/a),t.applyFilter(this,e,r,n)}get map(){return this.uniforms.mapSampler}set map(t){this.uniforms.mapSampler=t}}var lT=`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
- `,Dw=`
790
+ `,hT=`
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 Ow extends we{constructor(){super(Dw,kw)}}var Bw=`precision highp float;
832
+ `;class cT extends Te{constructor(){super(hT,lT)}}var uT=`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 Uw extends we{constructor(t=.5,e=Math.random()){super(Zm,Bw,{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 Qm={AlphaFilter:Ew,BlurFilter:Pw,BlurFilterPass:Vc,ColorMatrixFilter:Hc,DisplacementFilter:Nw,FXAAFilter:Ow,NoiseFilter:Uw};Object.entries(Qm).forEach(([r,t])=>{Object.defineProperty(Qm,r,{get(){return wt("7.1.0",`filters.${r} has moved to ${r}`),t}})});class Xw{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||(Te.system.add(this.tickerUpdate,this,us.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(Te.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 Ar=new Xw;class lo{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=lo.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new dt,this.page=new dt,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 Ha extends lo{constructor(){super(...arguments),this.client=new dt,this.movement=new dt,this.offset=new dt,this.global=new dt,this.screen=new dt}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,p,m){throw new Error("Method not implemented.")}}class li extends Ha{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 sn extends Ha{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}sn.DOM_DELTA_PIXEL=0,sn.DOM_DELTA_LINE=1,sn.DOM_DELTA_PAGE=2;const Ww=2048,Zw=new dt,Kc=new dt;class Vw{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){Ar.pauseUpdate=!0;const i=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",s=this[i](this.rootTarget,this.rootTarget.eventMode,Zw.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<Ww&&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")&&(Ar.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 p=t.isInteractive();(f.length>0||p)&&(p&&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")&&(Ar.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,Kc),!t.hitArea.contains(Kc.x,Kc.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 li)){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 li)){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 li)){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 li)){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 li)){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 li)){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 sn)){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(li);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(sn);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(li);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 li&&e instanceof li&&(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 Ha&&e instanceof Ha&&(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 Hw=1,Kw={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Yc=class Af{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new Vw(null),Ar.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new li(null),this.rootWheelEvent=new sn(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...Af.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,Af._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,Ar.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,Ar.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;Ar.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;Ar.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=Hw),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=Kw[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}};Yc.extension={name:"events",type:[q.RendererSystem,q.CanvasRendererSystem]},Yc.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let zc=Yc;nt.add(zc);function qm(r){return r==="dynamic"||r==="static"}const Yw={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,_internalInteractive:void 0,get interactive(){return this._internalInteractive??qm(zc.defaultEventMode)},set interactive(r){wt("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??zc.defaultEventMode},set eventMode(r){this._internalInteractive=qm(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 lo))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}};Zt.mixin(Yw);const zw={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};Zt.mixin(zw);const jw=9,Ka=100,Jw=0,$w=0,tg=2,eg=1,Qw=-1e3,qw=-1e3,tT=2;class ig{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,(Qi.tablet||Qi.phone)&&this.createTouchHook();const e=document.createElement("div");e.style.width=`${Ka}px`,e.style.height=`${Ka}px`,e.style.position="absolute",e.style.top=`${Jw}px`,e.style.left=`${$w}px`,e.style.zIndex=tg.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=`${eg}px`,t.style.height=`${eg}px`,t.style.position="absolute",t.style.top=`${Qw}px`,t.style.left=`${qw}px`,t.style.zIndex=tT.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(Qi.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,qs(this.children,d,1),this.div.removeChild(f._accessibleDiv),this.pool.push(f._accessibleDiv),f._accessibleDiv=null,d--;else{u=f._accessibleDiv;let p=f.hitArea;const m=f.worldTransform;f.hitArea?(u.style.left=`${(m.tx+p.x*m.a)*l}px`,u.style.top=`${(m.ty+p.y*m.d)*c}px`,u.style.width=`${p.width*m.a*l}px`,u.style.height=`${p.height*m.d*c}px`):(p=f.getBounds(),this.capHitArea(p),u.style.left=`${p.x*l}px`,u.style.top=`${p.y*c}px`,u.style.width=`${p.width*l}px`,u.style.height=`${p.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=`${Ka}px`,e.style.height=`${Ka}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=tg.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 lo(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===jw&&this.activate()}_onMouseMove(t){t.movementX===0&&t.movementY===0||this.deactivate()}destroy(){this.destroyTouchHook(),this.div=null,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null}}ig.extension={name:"accessibility",type:[q.RendererPlugin,q.CanvasRendererPlugin]},nt.add(ig);const rg=class Mf{constructor(t){this.stage=new Ct,t=Object.assign({forceCanvas:!1},t),this.renderer=uw(t),Mf._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=Mf._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}};rg._plugins=[];let sg=rg;nt.handleByList(q.Application,sg._plugins);class ng{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}}ng.extension=q.Application,nt.add(ng);const og={loader:q.LoadParser,resolver:q.ResolveParser,cache:q.CacheParser,detection:q.DetectionParser};nt.handle(q.Asset,r=>{const t=r.ref;Object.entries(og).filter(([e])=>!!t[e]).forEach(([e,i])=>nt.add(Object.assign(t[e],{extension:t[e].extension??i})))},r=>{const t=r.ref;Object.keys(og).filter(e=>!!t[e]).forEach(e=>nt.remove(t[e]))});class eT{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 nn(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 Mr(r,t){const e=r.split("?")[0],i=re.extname(e).toLowerCase();return Array.isArray(t)?t.includes(i):i===t}const ci=(r,t,e=!1)=>(Array.isArray(r)||(r=[r]),t?r.map(i=>typeof i=="string"||e?t(i):i):r),jc=(r,t)=>{const e=t.split("?")[1];return e&&(r+=`?${e}`),r};function ag(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?ag(r.replace(i[e],a),t,e+1,i,s):s.push(r.replace(i[e],a))}}function iT(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)}),ag(r,s,0,e,i)}else i.push(r);return i}const Ya=r=>!Array.isArray(r);class rT{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=ci(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 ot){const a=e;i.forEach(h=>{a.baseTexture!==ot.EMPTY.baseTexture&&xt.addToCache(a.baseTexture,h),ot.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 ds=new rT;class sT{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=Ya(t),o=ci(t,l=>({alias:[l],src:l})),a=o.length,h=o.map(async l=>{const c=re.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=ci(t,i=>({alias:[i],src:i})).map(async i=>{var o,a;const s=re.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 ui=(r=>(r[r.Low=0]="Low",r[r.Normal=1]="Normal",r[r.High=2]="High",r))(ui||{});const nT=".json",oT="application/json",aT={extension:{type:q.LoadParser,priority:ui.Low},name:"loadJson",test(r){return nn(r,oT)||Mr(r,nT)},async load(r){return await(await st.ADAPTER.fetch(r)).json()}};nt.add(aT);const hT=".txt",lT="text/plain",cT={name:"loadTxt",extension:{type:q.LoadParser,priority:ui.Low},test(r){return nn(r,lT)||Mr(r,hT)},async load(r){return await(await st.ADAPTER.fetch(r)).text()}};nt.add(cT);const uT=["normal","bold","100","200","300","400","500","600","700","800","900"],dT=[".ttf",".otf",".woff",".woff2"],fT=["font/ttf","font/otf","font/woff","font/woff2"],pT=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function mT(r){const t=re.extname(r),e=re.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(pT)){i=!1;break}let s=e.join(" ");return i||(s=`"${s.replace(/[\\"]/g,"\\$&")}"`),s}const gT=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function yT(r){return gT.test(r)?r:encodeURI(r)}const bT={extension:{type:q.LoadParser,priority:ui.Low},name:"loadWebFont",test(r){return nn(r,fT)||Mr(r,dT)},async load(r,t){var i,s,n;const e=st.ADAPTER.getFontFaceSet();if(e){const o=[],a=((i=t.data)==null?void 0:i.family)??mT(r),h=((n=(s=t.data)==null?void 0:s.weights)==null?void 0:n.filter(c=>uT.includes(c)))??["normal"],l=t.data??{};for(let c=0;c<h.length;c++){const u=h[c],d=new FontFace(a,`url(${yT(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=>st.ADAPTER.getFontFaceSet().delete(t))}};nt.add(bT);let hg=0,Jc;const xT="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=",_T={id:"checkImageBitmap",code:`
866
+ `;class dT extends Te{constructor(t=.5,e=Math.random()){super(e0,uT,{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 c0={AlphaFilter:$w,BlurFilter:rT,BlurFilterPass:Yc,ColorMatrixFilter:jc,DisplacementFilter:aT,FXAAFilter:cT,NoiseFilter:dT};Object.entries(c0).forEach(([i,t])=>{Object.defineProperty(c0,i,{get(){return wt("7.1.0",`filters.${i} has moved to ${i}`),t}})});class fT{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||(Se.system.add(this.tickerUpdate,this,gn.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(Se.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 Pr=new fT;class fo{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=fo.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new dt,this.page=new dt,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,r){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,r,n,s){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 Ya extends fo{constructor(){super(...arguments),this.client=new dt,this.movement=new dt,this.offset=new dt,this.global=new dt,this.screen=new dt}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,r){return t.worldTransform.applyInverse(r||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,r,n,s,o,a,l,h,c,u,d,f,p,m){throw new Error("Method not implemented.")}}class ci extends Ya{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 as extends Ya{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}as.DOM_DELTA_PIXEL=0,as.DOM_DELTA_LINE=1,as.DOM_DELTA_PAGE=2;const pT=2048,mT=new dt,Jc=new dt;class gT{constructor(t){this.dispatch=new js,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((r,n)=>r.priority-n.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 r=0,n=e.length;r<n;r++)e[r].fn(t);else console.warn(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){Pr.pauseUpdate=!0;const r=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",n=this[r](this.rootTarget,this.rootTarget.eventMode,mT.set(t,e),this.hitTestFn,this.hitPruneFn);return n&&n[0]}propagate(t,e){if(!t.target)return;const r=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let n=0,s=r.length-1;n<s;n++)if(t.currentTarget=r[n],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 n=r.length-2;n>=0;n--)if(t.currentTarget=r[n],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,r=this._allInteractiveElements){if(r.length===0)return;t.eventPhase=t.BUBBLING_PHASE;const n=Array.isArray(e)?e:[e];for(let s=r.length-1;s>=0;s--)n.forEach(o=>{t.currentTarget=r[s],this.notifyTarget(t,o)})}propagationPath(t){const e=[t];for(let r=0;r<pT&&t!==this.rootTarget;r++){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,r,n,s,o=!1){let a=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Pr.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,r,n,s,o||s(t,r));if(f){if(f.length>0&&!f[f.length-1].parent)continue;const p=t.isInteractive();(f.length>0||p)&&(p&&this._allInteractiveElements.push(t),f.push(t)),this._hitElements.length===0&&(this._hitElements=f),a=!0}}}const l=this._isInteractive(e),h=t.isInteractive();return l&&h&&this._allInteractiveElements.push(t),o||this._hitElements.length>0?null:a?this._hitElements:l&&!s(t,r)&&n(t,r)?h?[t]:[]:null}hitTestRecursive(t,e,r,n,s){if(this._interactivePrune(t)||s(t,r))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Pr.pauseUpdate=!1),t.interactiveChildren&&t.children){const l=t.children;for(let h=l.length-1;h>=0;h--){const c=l[h],u=this.hitTestRecursive(c,this._isInteractive(e)?e:c.eventMode,r,n,s);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&&n(t,r)?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 r;if(t.hitArea&&(t.worldTransform.applyInverse(e,Jc),!t.hitArea.contains(Jc.x,Jc.y)))return!0;if(t._mask){const n=t._mask.isMaskData?t._mask.maskObject:t._mask;if(n&&!((r=n.containsPoint)!=null&&r.call(n,e)))return!0}return!1}hitTestFn(t,e){return t.eventMode==="passive"?!1:t.hitArea?!0:t.containsPoint?t.containsPoint(e):!1}notifyTarget(t,e){var s,o;e=e??t.type;const r=`on${e}`;(o=(s=t.currentTarget)[r])==null||o.call(s,t);const n=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,n),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof ci)){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 n=e.button===2;this.dispatchEvent(e,n?"rightdown":"mousedown")}const r=this.trackingData(t.pointerId);r.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){var l,h;if(!(t instanceof ci)){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 r=e.pointerType==="mouse"||e.pointerType==="pen",n=this.trackingData(t.pointerId),s=this.findMountedTarget(n.overTargets);if(((l=n.overTargets)==null?void 0:l.length)>0&&s!==e.target){const c=t.type==="mousemove"?"mouseout":"pointerout",u=this.createPointerEvent(t,c,s);if(this.dispatchEvent(u,"pointerout"),r&&this.dispatchEvent(u,"mouseout"),!e.composedPath().includes(s)){const d=this.createPointerEvent(t,"pointerleave",s);for(d.eventPhase=d.AT_TARGET;d.target&&!e.composedPath().includes(d.target);)d.currentTarget=d.target,this.notifyTarget(d),r&&this.notifyTarget(d,"mouseleave"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(u)}if(s!==e.target){const c=t.type==="mousemove"?"mouseover":"pointerover",u=this.clonePointerEvent(e,c);this.dispatchEvent(u,"pointerover"),r&&this.dispatchEvent(u,"mouseover");let d=s==null?void 0:s.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!==s&&f.target!==this.rootTarget.parent;)f.currentTarget=f.target,this.notifyTarget(f),r&&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")),r&&(this.moveOnAll?o.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),a&&o.push("globalmousemove"),this.cursor=(h=e.target)==null?void 0:h.cursor),o.length>0&&this.all(e,o),this._allInteractiveElements.length=0,this._hitElements.length=0,n.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){var o;if(!(t instanceof ci)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId),r=this.createPointerEvent(t),n=r.pointerType==="mouse"||r.pointerType==="pen";this.dispatchEvent(r,"pointerover"),n&&this.dispatchEvent(r,"mouseover"),r.pointerType==="mouse"&&(this.cursor=(o=r.target)==null?void 0:o.cursor);const s=this.clonePointerEvent(r,"pointerenter");for(s.eventPhase=s.AT_TARGET;s.target&&s.target!==this.rootTarget.parent;)s.currentTarget=s.target,this.notifyTarget(s),n&&this.notifyTarget(s,"mouseenter"),s.target=s.target.parent;e.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(s)}mapPointerOut(t){if(!(t instanceof ci)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId);if(e.overTargets){const r=t.pointerType==="mouse"||t.pointerType==="pen",n=this.findMountedTarget(e.overTargets),s=this.createPointerEvent(t,"pointerout",n);this.dispatchEvent(s),r&&this.dispatchEvent(s,"mouseout");const o=this.createPointerEvent(t,"pointerleave",n);for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),r&&this.notifyTarget(o,"mouseleave"),o.target=o.target.parent;e.overTargets=null,this.freeEvent(s),this.freeEvent(o)}this.cursor=null}mapPointerUp(t){if(!(t instanceof ci)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=performance.now(),r=this.createPointerEvent(t);if(this.dispatchEvent(r,"pointerup"),r.pointerType==="touch")this.dispatchEvent(r,"touchend");else if(r.pointerType==="mouse"||r.pointerType==="pen"){const a=r.button===2;this.dispatchEvent(r,a?"rightup":"mouseup")}const n=this.trackingData(t.pointerId),s=this.findMountedTarget(n.pressTargetsByButton[t.button]);let o=s;if(s&&!r.composedPath().includes(s)){let a=s;for(;a&&!r.composedPath().includes(a);){if(r.currentTarget=a,this.notifyTarget(r,"pointerupoutside"),r.pointerType==="touch")this.notifyTarget(r,"touchendoutside");else if(r.pointerType==="mouse"||r.pointerType==="pen"){const l=r.button===2;this.notifyTarget(r,l?"rightupoutside":"mouseupoutside")}a=a.parent}delete n.pressTargetsByButton[t.button],o=a}if(o){const a=this.clonePointerEvent(r,"click");a.target=o,a.path=null,n.clicksByButton[t.button]||(n.clicksByButton[t.button]={clickCount:0,target:a.target,timeStamp:e});const l=n.clicksByButton[t.button];if(l.target===a.target&&e-l.timeStamp<200?++l.clickCount:l.clickCount=1,l.target=a.target,l.timeStamp=e,a.detail=l.clickCount,a.pointerType==="mouse"){const h=a.button===2;this.dispatchEvent(a,h?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(r)}mapPointerUpOutside(t){if(!(t instanceof ci)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId),r=this.findMountedTarget(e.pressTargetsByButton[t.button]),n=this.createPointerEvent(t);if(r){let s=r;for(;s;)n.currentTarget=s,this.notifyTarget(n,"pointerupoutside"),n.pointerType==="touch"?this.notifyTarget(n,"touchendoutside"):(n.pointerType==="mouse"||n.pointerType==="pen")&&this.notifyTarget(n,n.button===2?"rightupoutside":"mouseupoutside"),s=s.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(n)}mapWheel(t){if(!(t instanceof as)){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 r=1;r<t.length&&t[r].parent===e;r++)e=t[r];return e}createPointerEvent(t,e,r){const n=this.allocateEvent(ci);return this.copyPointerData(t,n),this.copyMouseData(t,n),this.copyData(t,n),n.nativeEvent=t.nativeEvent,n.originalEvent=t,n.target=r??this.hitTest(n.global.x,n.global.y)??this._hitElements[0],typeof e=="string"&&(n.type=e),n}createWheelEvent(t){const e=this.allocateEvent(as);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 r=this.allocateEvent(ci);return r.nativeEvent=t.nativeEvent,r.originalEvent=t.originalEvent,this.copyPointerData(t,r),this.copyMouseData(t,r),this.copyData(t,r),r.target=t.target,r.path=t.composedPath().slice(),r.type=e??r.type,r}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof ci&&e instanceof ci&&(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 Ya&&e instanceof Ya&&(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 r=t.currentTarget._events[e];if(r&&t.currentTarget.isInteractive())if("fn"in r)r.once&&t.currentTarget.removeListener(e,r.fn,void 0,!0),r.fn.call(r.context,t);else for(let n=0,s=r.length;n<s&&!t.propagationImmediatelyStopped;n++)r[n].once&&t.currentTarget.removeListener(e,r[n].fn,void 0,!0),r[n].fn.call(r[n].context,t)}}const yT=1,bT={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},$c=class Uf{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new gT(null),Pr.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new ci(null),this.rootWheelEvent=new as(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...Uf.defaultEventFeatures},{set:(e,r,n)=>(r==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=n),e[r]=n,!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:r}=this.renderer;this.setTargetElement(e),this.resolution=r,Uf._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 r=this.cursorStyles[t];if(r)switch(typeof r){case"string":e&&(this.domElement.style.cursor=r);break;case"function":r(t);break;case"object":e&&Object.assign(this.domElement.style,r);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 r=0,n=e.length;r<n;r++){const s=e[r],o=this.bootstrapEvent(this.rootPointerEvent,s);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,Pr.pointerMoved();const e=this.normalizeToPointerData(t);for(let r=0,n=e.length;r<n;r++){const s=this.bootstrapEvent(this.rootPointerEvent,e[r]);this.rootBoundary.mapEvent(s)}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 r=e!==this.domElement?"outside":"",n=this.normalizeToPointerData(t);for(let s=0,o=n.length;s<o;s++){const a=this.bootstrapEvent(this.rootPointerEvent,n[s]);a.type+=r,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 r=0,n=e.length;r<n;r++){const s=this.bootstrapEvent(this.rootPointerEvent,e[r]);this.rootBoundary.mapEvent(s)}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,Pr.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;Pr.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;Pr.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,r){const n=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},s=1/this.resolution;t.x=(e-n.left)*(this.domElement.width/n.width)*s,t.y=(r-n.top)*(this.domElement.height/n.height)*s}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let r=0,n=t.changedTouches.length;r<n;r++){const s=t.changedTouches[r];typeof s.button>"u"&&(s.button=0),typeof s.buttons>"u"&&(s.buttons=1),typeof s.isPrimary>"u"&&(s.isPrimary=t.touches.length===1&&t.type==="touchstart"),typeof s.width>"u"&&(s.width=s.radiusX||1),typeof s.height>"u"&&(s.height=s.radiusY||1),typeof s.tiltX>"u"&&(s.tiltX=0),typeof s.tiltY>"u"&&(s.tiltY=0),typeof s.pointerType>"u"&&(s.pointerType="touch"),typeof s.pointerId>"u"&&(s.pointerId=s.identifier||0),typeof s.pressure>"u"&&(s.pressure=s.force||.5),typeof s.twist>"u"&&(s.twist=0),typeof s.tangentialPressure>"u"&&(s.tangentialPressure=0),typeof s.layerX>"u"&&(s.layerX=s.offsetX=s.clientX),typeof s.layerY>"u"&&(s.layerY=s.offsetY=s.clientY),s.isNormalized=!0,s.type=t.type,e.push(s)}else if(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent))){const r=t;typeof r.isPrimary>"u"&&(r.isPrimary=!0),typeof r.width>"u"&&(r.width=1),typeof r.height>"u"&&(r.height=1),typeof r.tiltX>"u"&&(r.tiltX=0),typeof r.tiltY>"u"&&(r.tiltY=0),typeof r.pointerType>"u"&&(r.pointerType="mouse"),typeof r.pointerId>"u"&&(r.pointerId=yT),typeof r.pressure>"u"&&(r.pressure=.5),typeof r.twist>"u"&&(r.twist=0),typeof r.tangentialPressure>"u"&&(r.tangentialPressure=0),r.isNormalized=!0,e.push(r)}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=bT[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}};$c.extension={name:"events",type:[q.RendererSystem,q.CanvasRendererSystem]},$c.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let Qc=$c;st.add(Qc);function u0(i){return i==="dynamic"||i==="static"}const xT={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??u0(Qc.defaultEventMode)},set interactive(i){wt("7.2.0","Setting interactive is deprecated, use eventMode = 'none'/'passive'/'auto'/'static'/'dynamic' instead."),this._internalInteractive=i,this.eventMode=i?"static":"auto"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??Qc.defaultEventMode},set eventMode(i){this._internalInteractive=u0(i),this._internalEventMode=i},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(i,t,e){const r=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,n=typeof t=="function"?void 0:t;i=r?`${i}capture`:i,t=typeof t=="function"?t:t.handleEvent,this.on(i,t,n)},removeEventListener(i,t,e){const r=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,n=typeof t=="function"?void 0:t;i=r?`${i}capture`:i,t=typeof t=="function"?t:t.handleEvent,this.off(i,t,n)},dispatchEvent(i){if(!(i instanceof fo))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return i.defaultPrevented=!1,i.path=null,i.target=this,i.manager.dispatchEvent(i),!i.defaultPrevented}};Vt.mixin(xT);const _T={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};Vt.mixin(_T);const vT=9,ja=100,wT=0,TT=0,d0=2,f0=1,ST=-1e3,ET=-1e3,CT=2;class p0{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,(qi.tablet||qi.phone)&&this.createTouchHook();const e=document.createElement("div");e.style.width=`${ja}px`,e.style.height=`${ja}px`,e.style.position="absolute",e.style.top=`${wT}px`,e.style.left=`${TT}px`,e.style.zIndex=d0.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=`${f0}px`,t.style.height=`${f0}px`,t.style.position="absolute",t.style.top=`${ST}px`,t.style.left=`${ET}px`,t.style.zIndex=CT.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 r=0;r<e.length;r++)this.updateAccessibleObjects(e[r])}update(){const t=performance.now();if(qi.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:r,width:n,height:s}=this.renderer.view.getBoundingClientRect(),{width:o,height:a,resolution:l}=this.renderer,h=n/o*l,c=s/a*l;let u=this.div;u.style.left=`${e}px`,u.style.top=`${r}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,rs(this.children,d,1),this.div.removeChild(f._accessibleDiv),this.pool.push(f._accessibleDiv),f._accessibleDiv=null,d--;else{u=f._accessibleDiv;let p=f.hitArea;const m=f.worldTransform;f.hitArea?(u.style.left=`${(m.tx+p.x*m.a)*h}px`,u.style.top=`${(m.ty+p.y*m.d)*c}px`,u.style.width=`${p.width*m.a*h}px`,u.style.height=`${p.height*m.d*c}px`):(p=f.getBounds(),this.capHitArea(p),u.style.left=`${p.x*h}px`,u.style.top=`${p.y*c}px`,u.style.width=`${p.width*h}px`,u.style.height=`${p.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:r}=this.renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>r&&(t.height=r-t.y)}addChild(t){let e=this.pool.pop();e||(e=document.createElement("button"),e.style.width=`${ja}px`,e.style.height=`${ja}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=d0.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:r}=t.target,n=this.renderer.events.rootBoundary,s=Object.assign(new fo(n),{target:r});n.rootTarget=this.renderer.lastObjectRendered,e.forEach(o=>n.dispatchEvent(s,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===vT&&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}}p0.extension={name:"accessibility",type:[q.RendererPlugin,q.CanvasRendererPlugin]},st.add(p0);const m0=class Xf{constructor(t){this.stage=new Ct,t=Object.assign({forceCanvas:!1},t),this.renderer=Nw(t),Xf._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 r=Xf._plugins.slice(0);r.reverse(),r.forEach(n=>{n.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};m0._plugins=[];let g0=m0;st.handleByList(q.Application,g0._plugins);class y0{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,r;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,r=globalThis.innerHeight;else{const{clientWidth:n,clientHeight:s}=this._resizeTo;e=n,r=s}this.renderer.resize(e,r),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}}y0.extension=q.Application,st.add(y0);const b0={loader:q.LoadParser,resolver:q.ResolveParser,cache:q.CacheParser,detection:q.DetectionParser};st.handle(q.Asset,i=>{const t=i.ref;Object.entries(b0).filter(([e])=>!!t[e]).forEach(([e,r])=>st.add(Object.assign(t[e],{extension:t[e].extension??r})))},i=>{const t=i.ref;Object.keys(b0).filter(e=>!!t[e]).forEach(e=>st.remove(t[e]))});class IT{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 r=0;r<e;r++)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 ls(i,t){if(Array.isArray(t)){for(const e of t)if(i.startsWith(`data:${e}`))return!0;return!1}return i.startsWith(`data:${t}`)}function Lr(i,t){const e=i.split("?")[0],r=ne.extname(e).toLowerCase();return Array.isArray(t)?t.includes(r):r===t}const ui=(i,t,e=!1)=>(Array.isArray(i)||(i=[i]),t?i.map(r=>typeof r=="string"||e?t(r):r):i),qc=(i,t)=>{const e=t.split("?")[1];return e&&(i+=`?${e}`),i};function x0(i,t,e,r,n){const s=t[e];for(let o=0;o<s.length;o++){const a=s[o];e<t.length-1?x0(i.replace(r[e],a),t,e+1,r,n):n.push(i.replace(r[e],a))}}function AT(i){const t=/\{(.*?)\}/g,e=i.match(t),r=[];if(e){const n=[];e.forEach(s=>{const o=s.substring(1,s.length-1).split(",");n.push(o)}),x0(i,n,0,e,r)}else r.push(i);return r}const Ja=i=>!Array.isArray(i);class MT{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 r=ui(t);let n;for(let a=0;a<this.parsers.length;a++){const l=this.parsers[a];if(l.test(e)){n=l.getCacheableAssets(r,e);break}}n||(n={},r.forEach(a=>{n[a]=e}));const s=Object.keys(n),o={cacheKeys:s,keys:r};if(r.forEach(a=>{this._cacheMap.set(a,o)}),s.forEach(a=>{this._cache.has(a)&&this._cache.get(a)!==e&&console.warn("[Cache] already has key:",a),this._cache.set(a,n[a])}),e instanceof ot){const a=e;r.forEach(l=>{a.baseTexture!==ot.EMPTY.baseTexture&&xt.addToCache(a.baseTexture,l),ot.addToCache(a,l)})}}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(r=>{this._cache.delete(r)}),e.keys.forEach(r=>{this._cacheMap.delete(r)})}get parsers(){return this._parsers}}const yn=new MT;class RT{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,r)=>(this._parsersValidated=!1,t[e]=r,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){const r={promise:null,parser:null};return r.promise=(async()=>{var o,a;let n=null,s=null;if(e.loadParser&&(s=this._parserHash[e.loadParser],s||console.warn(`[Assets] specified load parser "${e.loadParser}" not found while loading ${t}`)),!s){for(let l=0;l<this.parsers.length;l++){const h=this.parsers[l];if(h.load&&((o=h.test)!=null&&o.call(h,t,e,this))){s=h;break}}if(!s)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}n=await s.load(t,e,this),r.parser=s;for(let l=0;l<this.parsers.length;l++){const h=this.parsers[l];h.parse&&h.parse&&await((a=h.testParse)==null?void 0:a.call(h,n,e,this))&&(n=await h.parse(n,e,this)||n,r.parser=h)}return n})(),r}async load(t,e){this._parsersValidated||this._validateParsers();let r=0;const n={},s=Ja(t),o=ui(t,h=>({alias:[h],src:h})),a=o.length,l=o.map(async h=>{const c=ne.toAbsolute(h.src);if(!n[h.src])try{this.promiseCache[c]||(this.promiseCache[c]=this._getLoadPromiseAndParser(c,h)),n[h.src]=await this.promiseCache[c].promise,e&&e(++r/a)}catch(u){throw delete this.promiseCache[c],delete n[h.src],new Error(`[Loader.load] Failed to load ${c}.
867
+ ${u}`)}});return await Promise.all(l),s?n[o[0].src]:n}async unload(t){const e=ui(t,r=>({alias:[r],src:r})).map(async r=>{var o,a;const n=ne.toAbsolute(r.src),s=this.promiseCache[n];if(s){const l=await s.promise;delete this.promiseCache[n],(a=(o=s.parser)==null?void 0:o.unload)==null||a.call(o,l,r,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 di=(i=>(i[i.Low=0]="Low",i[i.Normal=1]="Normal",i[i.High=2]="High",i))(di||{});const PT=".json",LT="application/json",GT={extension:{type:q.LoadParser,priority:di.Low},name:"loadJson",test(i){return ls(i,LT)||Lr(i,PT)},async load(i){return await(await nt.ADAPTER.fetch(i)).json()}};st.add(GT);const kT=".txt",FT="text/plain",DT={name:"loadTxt",extension:{type:q.LoadParser,priority:di.Low},test(i){return ls(i,FT)||Lr(i,kT)},async load(i){return await(await nt.ADAPTER.fetch(i)).text()}};st.add(DT);const NT=["normal","bold","100","200","300","400","500","600","700","800","900"],OT=[".ttf",".otf",".woff",".woff2"],BT=["font/ttf","font/otf","font/woff","font/woff2"],UT=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function XT(i){const t=ne.extname(i),e=ne.basename(i,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(s=>s.charAt(0).toUpperCase()+s.slice(1));let r=e.length>0;for(const s of e)if(!s.match(UT)){r=!1;break}let n=e.join(" ");return r||(n=`"${n.replace(/[\\"]/g,"\\$&")}"`),n}const WT=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function ZT(i){return WT.test(i)?i:encodeURI(i)}const VT={extension:{type:q.LoadParser,priority:di.Low},name:"loadWebFont",test(i){return ls(i,BT)||Lr(i,OT)},async load(i,t){var r,n,s;const e=nt.ADAPTER.getFontFaceSet();if(e){const o=[],a=((r=t.data)==null?void 0:r.family)??XT(i),l=((s=(n=t.data)==null?void 0:n.weights)==null?void 0:s.filter(c=>NT.includes(c)))??["normal"],h=t.data??{};for(let c=0;c<l.length;c++){const u=l[c],d=new FontFace(a,`url(${ZT(i)})`,{...h,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(i){(Array.isArray(i)?i:[i]).forEach(t=>nt.ADAPTER.getFontFaceSet().delete(t))}};st.add(VT);let _0=0,tu;const HT="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=",KT={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('${xT}');
874
+ const response = await fetch('${HT}');
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=ci
883
883
  }
884
884
  }
885
885
  checkImageBitmap().then((result) => { self.postMessage(result); });
886
- `},vT={id:"loadImageBitmap",code:`
886
+ `},zT={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=ci
919
919
  id: event.data.id,
920
920
  });
921
921
  }
922
- };`};let $c;class wT{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([_T.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(){Jc===void 0&&(Jc=navigator.hardwareConcurrency||4);let t=this.workerPool.pop();return!t&&this._createdWorkers<Jc&&($c||($c=URL.createObjectURL(new Blob([vT.code],{type:"application/javascript"}))),this._createdWorkers++,t=new Worker($c),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[hg]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:hg++,id:i})}}const lg=new wT;function co(r,t,e){r.resource.internal=!0;const i=new ot(r),s=()=>{delete t.promiseCache[e],ds.has(e)&&ds.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 TT=[".jpeg",".jpg",".png",".webp",".avif"],ST=["image/jpeg","image/png","image/webp","image/avif"];async function ET(r){const t=await st.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 za={name:"loadTextures",extension:{type:q.LoadParser,priority:ui.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return nn(r,ST)||Mr(r,TT)},async load(r,t,e){var a;const i=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;let s;i?this.config.preferWorkers&&await lg.isImageBitmapSupported()?s=await lg.loadImageBitmap(r):s=await ET(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=ir(r)),i&&((a=n.resourceOptions)==null?void 0:a.ownsImageBitmap)===void 0&&(n.resourceOptions={...n.resourceOptions},n.resourceOptions.ownsImageBitmap=!0);const o=new xt(s,n);return o.resource.src=r,co(o,e,r)},unload(r){r.destroy(!0)}};nt.add(za);const CT=".svg",IT="image/svg+xml",AT={extension:{type:q.LoadParser,priority:ui.High},name:"loadSVG",test(r){return nn(r,IT)||Mr(r,CT)},async testParse(r){return Wc.test(r)},async parse(r,t,e){var n;const i=new Wc(r,(n=t==null?void 0:t.data)==null?void 0:n.resourceOptions);await i.load();const s=new xt(i,{resolution:ir(r),...t==null?void 0:t.data});return s.resource.src=t.src,co(s,e,t.src)},async load(r,t){return(await st.ADAPTER.fetch(r)).text()},unload:za.unload};nt.add(AT);const MT=[".mp4",".m4v",".webm",".ogv"],RT=["video/mp4","video/webm","video/ogg"],PT={name:"loadVideo",extension:{type:q.LoadParser,priority:ui.High},config:{defaultAutoPlay:!0},test(r){return nn(r,RT)||Mr(r,MT)},async load(r,t,e){var o;let i;const s=await(await st.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 jm(n,a);await h.load();const l=new xt(h,{alphaMode:await D1(),resolution:ir(r),...t==null?void 0:t.data});l.resource.src=r,i=co(l,e,r),i.baseTexture.once("destroyed",()=>{URL.revokeObjectURL(n)})}catch(a){throw URL.revokeObjectURL(n),a}return i},unload(r){r.destroy(!0)}};nt.add(PT);class LT{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 ci(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"?(wt("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`)},ci(o).forEach(h=>{const{src:l,srcs:c}=h;let{data:u,format:d,loadParser:f}=h;const p=ci(l||c).map(y=>typeof y=="string"?iT(y):Array.isArray(y)?y:[y]),m=this.getAlias(h);Array.isArray(m)?m.forEach(a):a(m);const g=[];p.forEach(y=>{y.forEach(x=>{let b={};if(typeof x!="object"){b.src=x;for(let v=0;v<this._parsers.length;v++){const w=this._parsers[v];if(w.test(x)){b=w.parse(x);break}}}else u=x.data??u,d=x.format??d,f=x.loadParser??f,b={...b,...x};if(!m)throw new Error(`[Resolver] alias is undefined for this asset: ${b.src}`);b=this.buildResolvedAsset(b,{aliases:m,data:u,format:d,loadParser:f}),g.push(b)})}),m.forEach(y=>{this._assetMap[y]=g})})}resolveBundle(t){const e=Ya(t);t=ci(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=Ya(t);t=ci(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=re.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??re.extname(t.src).slice(1),t.srcs=t.src,t.name=t.alias,t}}class GT{constructor(){this._detections=[],this._initialized=!1,this.resolver=new LT,this.loader=new sT,this.cache=ds,this._backgroundLoader=new eT(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=Ya(t),s=ci(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 ds.get(t);const e={};for(let i=0;i<t.length;i++)e[i]=ds.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,ds.set(c,l)}),o}async unload(t){this._initialized||await this.init();const e=ci(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=ci(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=>{ds.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 za.config.preferWorkers}set preferWorkers(t){wt("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 ja=new GT;nt.handleByList(q.LoadParser,ja.loader.parsers).handleByList(q.ResolveParser,ja.resolver.parsers).handleByList(q.CacheParser,ja.cache.parsers).handleByList(q.DetectionParser,ja.detections);const FT={extension:q.CacheParser,test:r=>Array.isArray(r)&&r.every(t=>t instanceof ot),getCacheableAssets:(r,t)=>{const e={};return r.forEach(i=>{t.forEach((s,n)=>{e[i+(n===0?"":n+1)]=s})}),e}};nt.add(FT);async function cg(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 NT={extension:{type:q.DetectionParser,priority:1},test:async()=>cg("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(t=>t!=="avif")};nt.add(NT);const kT={extension:{type:q.DetectionParser,priority:0},test:async()=>cg("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(t=>t!=="webp")};nt.add(kT);const ug=["png","jpg","jpeg"],DT={extension:{type:q.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...ug],remove:async r=>r.filter(t=>!ug.includes(t))};nt.add(DT);const OT="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function Qc(r){return OT?!1:document.createElement("video").canPlayType(r)!==""}const BT={extension:{type:q.DetectionParser,priority:0},test:async()=>Qc("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(t=>t!=="webm")};nt.add(BT);const UT={extension:{type:q.DetectionParser,priority:0},test:async()=>Qc("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(t=>t!=="mp4"&&t!=="m4v")};nt.add(UT);const XT={extension:{type:q.DetectionParser,priority:0},test:async()=>Qc("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(t=>t!=="ogv")};nt.add(XT);const WT={extension:q.ResolveParser,test:za.test,parse:r=>{var t;return{resolution:parseFloat(((t=st.RETINA_PREFIX.exec(r))==null?void 0:t[1])??"1"),format:re.extname(r).slice(1),src:r}}};nt.add(WT);var ke=(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))(ke||{});const Ja={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 nr,on;function dg(){on={s3tc:nr.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:nr.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:nr.getExtension("WEBGL_compressed_texture_etc"),etc1:nr.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:nr.getExtension("WEBGL_compressed_texture_pvrtc")||nr.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:nr.getExtension("WEBGL_compressed_texture_atc"),astc:nr.getExtension("WEBGL_compressed_texture_astc")}}const ZT={extension:{type:q.DetectionParser,priority:2},test:async()=>{const r=st.ADAPTER.createCanvas().getContext("webgl");return r?(nr=r,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async r=>{on||dg();const t=[];for(const e in on)on[e]&&t.push(e);return[...t,...r]},remove:async r=>(on||dg(),r.filter(t=>!(t in on)))};nt.add(ZT);class VT extends Sa{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 yc(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 yc(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this)),this._load)}}class fs extends VT{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=fs._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||fs._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=fs._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),p=d*f*Ja[e];for(let m=0;m<i;m++)h[m]={levelID:m,levelWidth:i>1?c:d,levelHeight:i>1?u:f,levelBuffer:new Uint8Array(t.buffer,l,p)},l+=p,c=c>>1||1,u=u>>1||1,d=c+s-1&~(s-1),f=u+n-1&~(n-1),p=d*f*Ja[e];return h}}const qc=4,$a=124,HT=32,fg=20,KT=542327876,Qa={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},YT={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},qa={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},zT=1,jT=2,JT=4,$T=64,QT=512,qT=131072,tS=827611204,eS=861165636,iS=894720068,rS=808540228,sS=4,nS={[tS]:ke.COMPRESSED_RGBA_S3TC_DXT1_EXT,[eS]:ke.COMPRESSED_RGBA_S3TC_DXT3_EXT,[iS]:ke.COMPRESSED_RGBA_S3TC_DXT5_EXT},oS={70:ke.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:ke.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:ke.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:ke.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:ke.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:ke.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:ke.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:ke.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:ke.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT};function aS(r){const t=new Uint32Array(r);if(t[0]!==KT)throw new Error("Invalid DDS file magic word");const e=new Uint32Array(r,0,$a/Uint32Array.BYTES_PER_ELEMENT),i=e[Qa.HEIGHT],s=e[Qa.WIDTH],n=e[Qa.MIPMAP_COUNT],o=new Uint32Array(r,Qa.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,HT/Uint32Array.BYTES_PER_ELEMENT),a=o[zT];if(a&JT){const h=o[YT.FOURCC];if(h!==rS){const x=nS[h],b=qc+$a,v=new Uint8Array(r,b);return[new fs(v,{format:x,width:s,height:i,levels:n})]}const l=qc+$a,c=new Uint32Array(t.buffer,l,fg/Uint32Array.BYTES_PER_ELEMENT),u=c[qa.DXGI_FORMAT],d=c[qa.RESOURCE_DIMENSION],f=c[qa.MISC_FLAG],p=c[qa.ARRAY_SIZE],m=oS[u];if(m===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${u}`);if(f===sS)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=qc+$a+fg;if(p===1)g.push(new Uint8Array(r,y));else{const x=Ja[m];let b=0,v=s,w=i;for(let C=0;C<n;C++){const I=Math.max(1,v+3&-4),M=Math.max(1,w+3&-4),L=I*M*x;b+=L,v=v>>>1,w=w>>>1}let S=y;for(let C=0;C<p;C++)g.push(new Uint8Array(r,S,b)),S+=b}return g.map(x=>new fs(x,{format:m,width:s,height:i,levels:n}))}throw a&$T?new Error("DDSParser does not support uncompressed texture data."):a&QT?new Error("DDSParser does not supported YUV uncompressed texture data."):a&qT?new Error("DDSParser does not support single-channel (lumninance) texture data!"):a&jT?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 pg=[171,75,84,88,32,49,49,187,13,10,26,10],hS=67305985,di={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},tu=64,mg={[ct.UNSIGNED_BYTE]:1,[ct.UNSIGNED_SHORT]:2,[ct.INT]:4,[ct.UNSIGNED_INT]:4,[ct.FLOAT]:4,[ct.HALF_FLOAT]:8},lS={[Y.RGBA]:4,[Y.RGB]:3,[Y.RG]:2,[Y.RED]:1,[Y.LUMINANCE]:1,[Y.LUMINANCE_ALPHA]:2,[Y.ALPHA]:1},cS={[ct.UNSIGNED_SHORT_4_4_4_4]:2,[ct.UNSIGNED_SHORT_5_5_5_1]:2,[ct.UNSIGNED_SHORT_5_6_5]:2};function uS(r,t,e=!1){const i=new DataView(t);if(!dS(r,i))return null;const s=i.getUint32(di.ENDIANNESS,!0)===hS,n=i.getUint32(di.GL_TYPE,s),o=i.getUint32(di.GL_FORMAT,s),a=i.getUint32(di.GL_INTERNAL_FORMAT,s),h=i.getUint32(di.PIXEL_WIDTH,s),l=i.getUint32(di.PIXEL_HEIGHT,s)||1,c=i.getUint32(di.PIXEL_DEPTH,s)||1,u=i.getUint32(di.NUMBER_OF_ARRAY_ELEMENTS,s)||1,d=i.getUint32(di.NUMBER_OF_FACES,s),f=i.getUint32(di.NUMBER_OF_MIPMAP_LEVELS,s),p=i.getUint32(di.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 m=4,g=4,y=h+3&-4,x=l+3&-4,b=new Array(u);let v=h*l;n===0&&(v=y*x);let w;if(n!==0?mg[n]?w=mg[n]*lS[o]:w=cS[n]:w=Ja[a],w===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const S=e?pS(i,p,s):null;let C=v*w,I=h,M=l,L=y,G=x,N=tu+p;for(let A=0;A<f;A++){const D=i.getUint32(N,s);let Z=N+4;for(let K=0;K<u;K++){let H=b[K];H||(H=b[K]=new Array(f)),H[A]={levelID:A,levelWidth:f>1||n!==0?I:L,levelHeight:f>1||n!==0?M:G,levelBuffer:new Uint8Array(t,Z,C)},Z+=C}N+=D+4,N=N%4!==0?N+4-N%4:N,I=I>>1||1,M=M>>1||1,L=I+m-1&~(m-1),G=M+g-1&~(g-1),C=L*G*w}return n!==0?{uncompressed:b.map(A=>{let D=A[0].levelBuffer,Z=!1;return n===ct.FLOAT?D=new Float32Array(A[0].levelBuffer.buffer,A[0].levelBuffer.byteOffset,A[0].levelBuffer.byteLength/4):n===ct.UNSIGNED_INT?(Z=!0,D=new Uint32Array(A[0].levelBuffer.buffer,A[0].levelBuffer.byteOffset,A[0].levelBuffer.byteLength/4)):n===ct.INT&&(Z=!0,D=new Int32Array(A[0].levelBuffer.buffer,A[0].levelBuffer.byteOffset,A[0].levelBuffer.byteLength/4)),{resource:new Sa(D,{width:A[0].levelWidth,height:A[0].levelHeight}),type:n,format:Z?fS(o):o}}),kvData:S}:{compressed:b.map(A=>new fs(null,{format:a,width:h,height:l,levels:f,levelBuffers:A})),kvData:S}}function dS(r,t){for(let e=0;e<pg.length;e++)if(t.getUint8(e)!==pg[e])return console.error(`${r} is not a valid *.ktx file!`),!1;return!0}function fS(r){switch(r){case Y.RGBA:return Y.RGBA_INTEGER;case Y.RGB:return Y.RGB_INTEGER;case Y.RG:return Y.RG_INTEGER;case Y.RED:return Y.RED_INTEGER;default:return r}}function pS(r,t,e){const i=new Map;let s=0;for(;s<t;){const n=r.getUint32(tu+s,e),o=tu+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 mS={extension:{type:q.LoadParser,priority:ui.High},name:"loadDDS",test(r){return Mr(r,".dds")},async load(r,t,e){const i=await(await st.ADAPTER.fetch(r)).arrayBuffer(),s=aS(i).map(n=>{const o=new xt(n,{mipmap:wi.OFF,alphaMode:Ee.NO_PREMULTIPLIED_ALPHA,resolution:ir(r),...t.data});return co(o,e,r)});return s.length===1?s[0]:s},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};nt.add(mS);const gS={extension:{type:q.LoadParser,priority:ui.High},name:"loadKTX",test(r){return Mr(r,".ktx")},async load(r,t,e){const i=await(await st.ADAPTER.fetch(r)).arrayBuffer(),{compressed:s,uncompressed:n,kvData:o}=uS(r,i),a=s??n,h={mipmap:wi.OFF,alphaMode:Ee.NO_PREMULTIPLIED_ALPHA,resolution:ir(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 xt(u,h);return d.ktxKeyValueData=o,co(d,e,r)});return l.length===1?l[0]:l},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};nt.add(gS);const yS={extension:q.ResolveParser,test:r=>{const t=re.extname(r).slice(1);return["basis","ktx","dds"].includes(t)},parse:r=>{var e,i;const t=re.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=st.RETINA_PREFIX.exec(r))==null?void 0:e[1])??"1"),format:s.find(n=>r.endsWith(n)),src:r}}return{resolution:parseFloat(((i=st.RETINA_PREFIX.exec(r))==null?void 0:i[1])??"1"),format:t,src:r}}};nt.add(yS);const th=new gt,bS=4,gg=class sa{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&&sa._flipY(i,s,n),a&&sa._unpremultiplyAlpha(i);const h=new q1(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&&sa._flipY(i,s,n),a&&sa._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 hs?a=t:(a=i.generateTexture(t,{region:e,resolution:i.resolution,multisample:i.multisample}),h=!0,e&&(th.width=e.width,th.height=e.height,e=th)));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===Y.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=th,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(bS*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}}}};gg.extension={name:"extract",type:q.RendererSystem};let xS=gg;nt.add(xS);const eh={build(r){const t=r.points;let e,i,s,n,o,a;if(r.type===fe.CIRC){const p=r.shape;e=p.x,i=p.y,o=a=p.radius,s=n=0}else if(r.type===fe.ELIP){const p=r.shape;e=p.x,i=p.y,o=p.width,a=p.height,s=n=0}else{const p=r.shape,m=p.width/2,g=p.height/2;e=p.x+m,i=p.y+g,o=a=Math.max(0,Math.min(p.radius,Math.min(m,g))),s=m-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 p=s+o,m=n,g=e+p,y=e-p,x=i+m;if(t[c++]=g,t[c++]=x,t[--u]=x,t[--u]=y,n){const b=i-m;t[d++]=y,t[d++]=b,t[--f]=b,t[--f]=g}}for(let p=1;p<h;p++){const m=Math.PI/2*(p/h),g=s+Math.cos(m)*o,y=n+Math.sin(m)*a,x=e+g,b=e-g,v=i+y,w=i-y;t[c++]=x,t[c++]=v,t[--u]=v,t[--u]=b,t[d++]=b,t[d++]=w,t[--f]=w,t[--f]=x}{const p=s,m=n+a,g=e+p,y=e-p,x=i+m,b=i-m;t[c++]=g,t[c++]=x,t[--f]=b,t[--f]=g,s&&(t[c++]=y,t[c++]=x,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!==fe.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 yg(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 bg={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){yg(e,!1);const o=[];for(let l=0;l<i.length;l++){const c=i[l];yg(c.points,!0),o.push(e.length/2),e=e.concat(c.points)}const a=Mx(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])}}},_S={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)}},vS={build(r){eh.build(r)},triangulate(r,t){eh.triangulate(r,t)}};var je=(r=>(r.MITER="miter",r.BEVEL="bevel",r.ROUND="round",r))(je||{}),Rr=(r=>(r.BUTT="butt",r.ROUND="round",r.SQUARE="square",r))(Rr||{});const an={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 xg{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,p=c*c+u*u,m=h*c+l*u,g=n*Math.sqrt(f)/d,y=n*Math.sqrt(p)/d,x=g*m/f,b=y*m/p,v=g*u+y*l,w=g*c+y*h,S=l*(y+x),C=h*(y+x),I=u*(g+b),M=c*(g+b),L=Math.atan2(C-w,S-v),G=Math.atan2(M-w,I-v);return{cx:v+t,cy:w+e,radius:n,startAngle:L,endAngle:G,anticlockwise:l*c>u*h}}static arc(t,e,i,s,n,o,a,h,l){const c=a-o,u=an._segmentsCount(Math.abs(c)*n,Math.ceil(Math.abs(c)/Ca)*40),d=c/(u*2),f=d*2,p=Math.cos(d),m=Math.sin(d),g=u-1,y=g%1/g;for(let x=0;x<=g;++x){const b=x+y*x,v=d+o+f*b,w=Math.cos(v),S=-Math.sin(v);l.push((p*w+m*S)*n+i,(p*-S+m*w)*n+s)}}}class wS{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 eu{static curveLength(t,e,i,s,n,o,a,h){let l=0,c=0,u=0,d=0,f=0,p=0,m=0,g=0,y=0,x=0,b=0,v=t,w=e;for(let S=1;S<=10;++S)c=S/10,u=c*c,d=u*c,f=1-c,p=f*f,m=p*f,g=m*t+3*p*c*i+3*f*u*n+d*a,y=m*e+3*p*c*s+3*f*u*o+d*h,x=v-g,b=w-y,v=g,w=y,l+=Math.sqrt(x*x+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=an._segmentsCount(eu.curveLength(h,l,t,e,i,s,n,o));let u=0,d=0,f=0,p=0,m=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,p=y*y,m=p*y,a.push(f*h+3*d*y*t+3*u*p*i+m*n,f*l+3*d*y*e+3*u*p*s+m*o)}}function _g(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 p=h+d,m=l+f,g=c+d,y=u+f;return a.push(p,m,g,y),2}function ps(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,p=Math.abs(f),m=Math.sqrt(h*h+l*l),g=(15*p*Math.sqrt(m)/Math.PI>>0)+1,y=f/g;if(d+=y,a){o.push(r,t,e,i);for(let x=1,b=d;x<g;x++,b+=y)o.push(r,t,r+Math.sin(b)*m,t+Math.cos(b)*m);o.push(r,t,s,n)}else{o.push(e,i,r,t);for(let x=1,b=d;x<g;x++,b+=y)o.push(r+Math.sin(b)*m,t+Math.cos(b)*m,r,t);o.push(s,n,r,t)}return g*2}function TS(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 dt(i[0],i[1]),a=new dt(i[i.length-2],i[i.length-1]),h=e.type!==fe.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 H=(o.x+a.x)*.5,j=(a.y+o.y)*.5;i.unshift(H,j),i.push(H,j)}const c=t.points,u=i.length/2;let d=i.length;const f=c.length/2,p=n.width/2,m=p*p,g=n.miterLimit*n.miterLimit;let y=i[0],x=i[1],b=i[2],v=i[3],w=0,S=0,C=-(x-v),I=y-b,M=0,L=0,G=Math.sqrt(C*C+I*I);C/=G,I/=G,C*=p,I*=p;const N=n.alignment,A=(1-N)*2,D=N*2;h||(n.cap===Rr.ROUND?d+=ps(y-C*(A-D)*.5,x-I*(A-D)*.5,y-C*A,x-I*A,y+C*D,x+I*D,c,!0)+2:n.cap===Rr.SQUARE&&(d+=_g(y,x,C,I,A,D,!0,c))),c.push(y-C*A,x-I*A,y+C*D,x+I*D);for(let H=1;H<u-1;++H){y=i[(H-1)*2],x=i[(H-1)*2+1],b=i[H*2],v=i[H*2+1],w=i[(H+1)*2],S=i[(H+1)*2+1],C=-(x-v),I=y-b,G=Math.sqrt(C*C+I*I),C/=G,I/=G,C*=p,I*=p,M=-(v-S),L=b-w,G=Math.sqrt(M*M+L*L),M/=G,L/=G,M*=p,L*=p;const j=b-y,B=x-v,k=b-w,F=S-v,V=j*k+B*F,et=B*k-F*j,ft=et<0;if(Math.abs(et)<.001*Math.abs(V)){c.push(b-C*A,v-I*A,b+C*D,v+I*D),V>=0&&(n.join===je.ROUND?d+=ps(b,v,b-C*A,v-I*A,b-M*A,v-L*A,c,!1)+4:d+=2,c.push(b-M*D,v-L*D,b+M*A,v+L*A));continue}const at=(-C+y)*(-I+v)-(-C+b)*(-I+x),Tt=(-M+w)*(-L+v)-(-M+b)*(-L+S),It=(j*Tt-k*at)/et,Q=(F*at-B*Tt)/et,W=(It-b)*(It-b)+(Q-v)*(Q-v),J=b+(It-b)*A,$=v+(Q-v)*A,O=b-(It-b)*D,pt=v-(Q-v)*D,yt=Math.min(j*j+B*B,k*k+F*F),Rt=ft?A:D,Ot=yt+Rt*Rt*m,Fe=W<=Ot;let Ze=n.join;if(Ze===je.MITER&&W/m>g&&(Ze=je.BEVEL),Fe)switch(Ze){case je.MITER:{c.push(J,$,O,pt);break}case je.BEVEL:{ft?c.push(J,$,b+C*D,v+I*D,J,$,b+M*D,v+L*D):c.push(b-C*A,v-I*A,O,pt,b-M*A,v-L*A,O,pt),d+=2;break}case je.ROUND:{ft?(c.push(J,$,b+C*D,v+I*D),d+=ps(b,v,b+C*D,v+I*D,b+M*D,v+L*D,c,!0)+4,c.push(J,$,b+M*D,v+L*D)):(c.push(b-C*A,v-I*A,O,pt),d+=ps(b,v,b-C*A,v-I*A,b-M*A,v-L*A,c,!1)+4,c.push(b-M*A,v-L*A,O,pt));break}}else{switch(c.push(b-C*A,v-I*A,b+C*D,v+I*D),Ze){case je.MITER:{ft?c.push(O,pt,O,pt):c.push(J,$,J,$),d+=2;break}case je.ROUND:{ft?d+=ps(b,v,b+C*D,v+I*D,b+M*D,v+L*D,c,!0)+2:d+=ps(b,v,b-C*A,v-I*A,b-M*A,v-L*A,c,!1)+2;break}}c.push(b-M*A,v-L*A,b+M*D,v+L*D),d+=2}}y=i[(u-2)*2],x=i[(u-2)*2+1],b=i[(u-1)*2],v=i[(u-1)*2+1],C=-(x-v),I=y-b,G=Math.sqrt(C*C+I*I),C/=G,I/=G,C*=p,I*=p,c.push(b-C*A,v-I*A,b+C*D,v+I*D),h||(n.cap===Rr.ROUND?d+=ps(b-C*(A-D)*.5,v-I*(A-D)*.5,b-C*A,v-I*A,b+C*D,v+I*D,c,!1)+2:n.cap===Rr.SQUARE&&(d+=_g(b,v,C,I,A,D,!1,c)));const Z=t.indices,K=an.epsilon*an.epsilon;for(let H=f;H<d+f-2;++H)y=c[H*2],x=c[H*2+1],b=c[(H+1)*2],v=c[(H+1)*2+1],w=c[(H+2)*2],S=c[(H+2)*2+1],!(Math.abs(y*(v-S)+b*(S-x)+w*(x-v))<K)&&Z.push(H,H+1,H+2)}function SS(r,t){let e=0;const i=r.shape,s=r.points||i.points,n=i.type!==fe.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 vg(r,t){r.lineStyle.native?SS(r,t):TS(r,t)}class iu{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,p=2*Math.sqrt(u+d+f),m=Math.sqrt(u),g=2*u*m,y=2*Math.sqrt(f),x=d/m;return(g*p+m*d*(p-y)+(4*f*u-d*d)*Math.log((2*m+x+p)/(x+y)))/(4*g)}static curveTo(t,e,i,s,n){const o=n[n.length-2],a=n[n.length-1],h=an._segmentsCount(iu.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 ru={[fe.POLY]:bg,[fe.CIRC]:eh,[fe.ELIP]:eh,[fe.RECT]:_S,[fe.RREC]:vS},wg=[],ih=[];class rh{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 rh(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 hn=new dt,Tg=class Qb extends im{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 Va,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(),ih.push(this.drawCalls[t]);this.drawCalls.length=0;for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e.reset(),wg.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 rh(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 rh(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,hn):hn.copyFrom(t),s.shape.contains(hn.x,hn.y))){let n=!1;if(s.holes){for(let o=0;o<s.holes.length;o++)if(s.holes[o].shape.contains(hn.x,hn.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;ru[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 p=f.texture.baseTexture,m=this.indices.length,g=this.points.length/2;p.wrapMode=vi.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(m,g),i=null),i||(i=wg.pop()||new wS,i.begin(f,m,g),this.batches.push(i),s=f),this.addUvs(this.points,t,f.texture,g,y,f.matrix))}}const n=this.indices.length,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<Qb.BATCHABLE_SIZE*2}buildDrawCalls(){let t=++xt._globalBatch;for(let u=0;u<this.drawCalls.length;u++)this.drawCalls[u].texArray.clear(),ih.push(this.drawCalls[u]);this.drawCalls.length=0;const e=this.colors,i=this.textureIds;let s=ih.pop();s||(s=new Cc,s.texArray=new Lc),s.texArray.count=0,s.start=0,s.size=0,s.type=_i.TRIANGLES;let n=0,o=null,a=0,h=!1,l=_i.TRIANGLES,c=0;this.drawCalls.push(s);for(let u=0;u<this.batches.length;u++){const d=this.batches[u],f=8,p=d.style,m=p.texture.baseTexture;h!==!!p.native&&(h=!!p.native,l=h?_i.LINES:_i.TRIANGLES,o=null,n=f,t++),o!==m&&(o=m,m._batchEnabled!==t&&(n===f&&(t++,n=0,s.size>0&&(s=ih.pop(),s||(s=new Cc,s.texArray=new Lc),this.drawCalls.push(s)),s.start=c,s.size=0,s.texArray.count=0,s.type=l),m.touched=1,m._batchEnabled=t,m._batchLocation=n,m.wrapMode=vi.REPEAT,s.texArray.elements[s.texArray.count++]=m,n++)),s.size+=d.size,c+=d.size,a=m._batchLocation,this.addColors(e,p.color,p.alpha,d.attribSize,d.attribStart),this.addTextureIds(i,a,d.attribSize,d.attribStart)}xt._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?bg.triangulate(t,this):ru[t.type].triangulate(t,this)}processLine(t){vg(t,this);for(let e=0;e<t.holes.length;e++)vg(t.holes[e],this)}processHoles(t){for(let e=0;e<t.length;e++){const i=t[e];ru[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=kt.shared.setValue(e).toLittleEndianNumber(),a=kt.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),p=Math.floor(t[i+1]+o);for(let m=i+2;m<a;m+=2)f=Math.min(f,Math.floor(t[m]+o)),p=Math.min(p,Math.floor(t[m+1]+o));u-=f,d-=p;for(let m=i;m<a;m+=2)t[m]=(t[m]+u)*l,t[m+1]=(t[m+1]+d)*c}};Tg.BATCHABLE_SIZE=100;let ES=Tg;class sh{constructor(){this.color=16777215,this.alpha=1,this.texture=ot.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){const t=new sh;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=ot.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}class su extends sh{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=Rr.BUTT,this.join=je.MITER,this.miterLimit=10}clone(){const t=new su;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=Rr.BUTT,this.join=je.MITER,this.miterLimit=10}}const nu={},ou=class El extends Ct{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 sh,this._lineStyle=new su,this._matrix=null,this._holeMode=!1,this.state=Mi.for2d(),this._geometry=t||new ES,this._geometry.refCount++,this._transformID=-1,this._tintColor=new kt(16777215),this.blendMode=mt.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new El(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:ot.WHITE,color:t!=null&&t.texture?16777215:0,matrix:null,alignment:.5,native:!1,cap:Rr.BUTT,join:je.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 is,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new is,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),iu.curveTo(t,e,i,s,n),this}bezierCurveTo(t,e,i,s,n,o){return this._initCurve(),eu.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=xg.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+=Ca:o&&s<=n&&(s+=Ca),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 xg.arc(a,h,t,e,i,s,n,o,c),this}beginFill(t=0,e){return this.beginTextureFill({texture:ot.WHITE,color:t,alpha:e})}normalizeColor(t){const e=kt.shared.setValue(t.color??0);t.color=e.toNumber(),t.alpha??(t.alpha=e.alpha)}beginTextureFill(t){const e={texture:ot.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 gt(t,e,i,s))}drawRoundedRect(t,e,i,s,n){return this.drawShape(new Ra(t,e,i,s,n))}drawCircle(t,e,i){return this.drawShape(new Aa(t,e,i))}drawEllipse(t,e,i,s){return this.drawShape(new Ma(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 is(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===fe.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:kt.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,kt.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(!nu[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 Dt,default:hi.from({uSamplers:n},!0)},a=t.plugins[i]._shader.program;nu[i]=new Ri(a,o)}e=nu[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,El._TEMP_POINT),this._geometry.containsPoint(El._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=kt.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],p=l[d+1];c[u++]=i*f+n*p+a,c[u++]=o*p+s*f+h}}closePath(){const t=this.currentPath;return t&&(t.closeStroke=!0,this.finishPoly()),this}setMatrix(t){return this._matrix=t,this}beginHole(){return this.finishPoly(),this._holeMode=!0,this}endHole(){return this.finishPoly(),this._holeMode=!1,this}destroy(t){this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,super.destroy(t)}};ou.curves=an,ou._TEMP_POINT=new dt;let ln=ou;class CS{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 au=new dt,Sg=new is,Eg=class qb extends Ct{constructor(t,e,i,s=_i.TRIANGLES){super(),this.geometry=t,this.shader=e,this.state=i||Mi.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=st.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===_i.TRIANGLES&&e.length<qb.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],p=e[d*2+1];u[d*2]=n*f+a*p+l,u[d*2+1]=o*f+h*p+c}if(this._roundPixels){const d=st.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 CS(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,au);const e=this.geometry.getBuffer("aVertexPosition").data,i=Sg.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],Sg.contains(au.x,au.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}};Eg.BATCHABLE_SIZE=100;let hu=Eg;class Cg extends Cr{constructor(t,e,i){super();const s=new zt(t),n=new zt(e,!0),o=new zt(i,!0,!0);this.addAttribute("aVertexPosition",s,2,!1,ct.FLOAT).addAttribute("aTextureCoord",n,2,!1,ct.FLOAT).addIndex(o),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}var IS=`varying vec2 vTextureCoord;
922
+ };`};let eu;class YT{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([KT.code],{type:"application/javascript"})),r=new Worker(e);r.addEventListener("message",n=>{r.terminate(),URL.revokeObjectURL(e),t(n.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t){return this._run("loadImageBitmap",[t])}async _initWorkers(){this._initialized||(this._initialized=!0)}getWorker(){tu===void 0&&(tu=navigator.hardwareConcurrency||4);let t=this.workerPool.pop();return!t&&this._createdWorkers<tu&&(eu||(eu=URL.createObjectURL(new Blob([zT.code],{type:"application/javascript"}))),this._createdWorkers++,t=new Worker(eu),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 r=new Promise((n,s)=>{this.queue.push({id:t,arguments:e,resolve:n,reject:s})});return this.next(),r}next(){if(!this.queue.length)return;const t=this.getWorker();if(!t)return;const e=this.queue.pop(),r=e.id;this.resolveHash[_0]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:_0++,id:r})}}const v0=new YT;function po(i,t,e){i.resource.internal=!0;const r=new ot(i),n=()=>{delete t.promiseCache[e],yn.has(e)&&yn.remove(e)};return r.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."),n())}),r.once("destroyed",()=>{i.destroyed||(console.warn("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),n())}),r}const jT=[".jpeg",".jpg",".png",".webp",".avif"],JT=["image/jpeg","image/png","image/webp","image/avif"];async function $T(i){const t=await nt.ADAPTER.fetch(i);if(!t.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${i}: ${t.status} ${t.statusText}`);const e=await t.blob();return await createImageBitmap(e)}const $a={name:"loadTextures",extension:{type:q.LoadParser,priority:di.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(i){return ls(i,JT)||Lr(i,jT)},async load(i,t,e){var a;const r=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;let n;r?this.config.preferWorkers&&await v0.isImageBitmapSupported()?n=await v0.loadImageBitmap(i):n=await $T(i):n=await new Promise((l,h)=>{const c=new Image;c.crossOrigin=this.config.crossOrigin,c.src=i,c.complete?l(c):(c.onload=()=>l(c),c.onerror=u=>h(u))});const s={...t.data};s.resolution??(s.resolution=rr(i)),r&&((a=s.resourceOptions)==null?void 0:a.ownsImageBitmap)===void 0&&(s.resourceOptions={...s.resourceOptions},s.resourceOptions.ownsImageBitmap=!0);const o=new xt(n,s);return o.resource.src=i,po(o,e,i)},unload(i){i.destroy(!0)}};st.add($a);const QT=".svg",qT="image/svg+xml",tS={extension:{type:q.LoadParser,priority:di.High},name:"loadSVG",test(i){return ls(i,qT)||Lr(i,QT)},async testParse(i){return Kc.test(i)},async parse(i,t,e){var s;const r=new Kc(i,(s=t==null?void 0:t.data)==null?void 0:s.resourceOptions);await r.load();const n=new xt(r,{resolution:rr(i),...t==null?void 0:t.data});return n.resource.src=t.src,po(n,e,t.src)},async load(i,t){return(await nt.ADAPTER.fetch(i)).text()},unload:$a.unload};st.add(tS);const eS=[".mp4",".m4v",".webm",".ogv"],iS=["video/mp4","video/webm","video/ogg"],rS={name:"loadVideo",extension:{type:q.LoadParser,priority:di.High},config:{defaultAutoPlay:!0},test(i){return ls(i,iS)||Lr(i,eS)},async load(i,t,e){var o;let r;const n=await(await nt.ADAPTER.fetch(i)).blob(),s=URL.createObjectURL(n);try{const a={autoPlay:this.config.defaultAutoPlay,...(o=t==null?void 0:t.data)==null?void 0:o.resourceOptions},l=new a0(s,a);await l.load();const h=new xt(l,{alphaMode:await hv(),resolution:rr(i),...t==null?void 0:t.data});h.resource.src=i,r=po(h,e,i),r.baseTexture.once("destroyed",()=>{URL.revokeObjectURL(s)})}catch(a){throw URL.revokeObjectURL(s),a}return r},unload(i){i.destroy(!0)}};st.add(rS);class nS{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(r=>`${encodeURIComponent(r)}=${encodeURIComponent(e[r])}`).join("&")}}getAlias(t){const{alias:e,name:r,src:n,srcs:s}=t;return ui(e||r||n||s,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 r=[];Array.isArray(e)?e.forEach(n=>{const s=n.src??n.srcs,o=n.alias??n.name;let a;if(typeof o=="string"){const l=this._createBundleAssetId(t,o);r.push(l),a=[o,l]}else{const l=o.map(h=>this._createBundleAssetId(t,h));r.push(...l),a=[...o,...l]}this.add({...n,alias:a,src:s})}):Object.keys(e).forEach(n=>{const s=[n,this._createBundleAssetId(t,n)];if(typeof e[n]=="string")this.add({alias:s,src:e[n]});else if(Array.isArray(e[n]))this.add({alias:s,src:e[n]});else{const o=e[n],a=o.src??o.srcs;this.add({...o,alias:s,src:Array.isArray(a)?a:[a]})}r.push(...s)}),this._bundles[t]=r}add(t,e,r,n,s){const o=[];typeof t=="string"||Array.isArray(t)&&typeof t[0]=="string"?(wt("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:r,format:n,loadParser:s})):Array.isArray(t)?o.push(...t):o.push(t);let a;a=l=>{this.hasKey(l)&&console.warn(`[Resolver] already has key: ${l} overwriting`)},ui(o).forEach(l=>{const{src:h,srcs:c}=l;let{data:u,format:d,loadParser:f}=l;const p=ui(h||c).map(y=>typeof y=="string"?AT(y):Array.isArray(y)?y:[y]),m=this.getAlias(l);Array.isArray(m)?m.forEach(a):a(m);const g=[];p.forEach(y=>{y.forEach(x=>{let b={};if(typeof x!="object"){b.src=x;for(let v=0;v<this._parsers.length;v++){const w=this._parsers[v];if(w.test(x)){b=w.parse(x);break}}}else u=x.data??u,d=x.format??d,f=x.loadParser??f,b={...b,...x};if(!m)throw new Error(`[Resolver] alias is undefined for this asset: ${b.src}`);b=this.buildResolvedAsset(b,{aliases:m,data:u,format:d,loadParser:f}),g.push(b)})}),m.forEach(y=>{this._assetMap[y]=g})})}resolveBundle(t){const e=Ja(t);t=ui(t);const r={};return t.forEach(n=>{const s=this._bundles[n];if(s){const o=this.resolve(s),a={};for(const l in o){const h=o[l];a[this._extractAssetIdFromBundle(n,l)]=h}r[n]=a}}),e?r[t[0]]:r}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const r={};for(const n in e)r[n]=e[n].src;return r}return e.src}resolve(t){const e=Ja(t);t=ui(t);const r={};return t.forEach(n=>{if(!this._resolverHash[n])if(this._assetMap[n]){let s=this._assetMap[n];const o=s[0],a=this._getPreferredOrder(s);a==null||a.priority.forEach(l=>{a.params[l].forEach(h=>{const c=s.filter(u=>u[l]?u[l]===h:!1);c.length&&(s=c)})}),this._resolverHash[n]=s[0]??o}else this._resolverHash[n]=this.buildResolvedAsset({alias:[n],src:n},{});r[n]=this._resolverHash[n]}),e?r[t[0]]:r}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){const r=t[0],n=this._preferredOrder.find(s=>s.params.format.includes(r.format));if(n)return n}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:r,data:n,loadParser:s,format:o}=e;return(this._basePath||this._rootPath)&&(t.src=ne.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=r??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...n||{},...t.data},t.loadParser=s??t.loadParser,t.format=o??ne.extname(t.src).slice(1),t.srcs=t.src,t.name=t.alias,t}}class sS{constructor(){this._detections=[],this._initialized=!1,this.resolver=new nS,this.loader=new RT,this.cache=yn,this._backgroundLoader=new IT(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){var s,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=((s=t.texturePreference)==null?void 0:s.resolution)??1,r=typeof e=="number"?[e]:e,n=await this._detectFormats({preferredFormats:(o=t.texturePreference)==null?void 0:o.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:n,resolution:r}}),t.preferences&&this.setPreferences(t.preferences)}add(t,e,r,n,s){this.resolver.add(t,e,r,n,s)}async load(t,e){this._initialized||await this.init();const r=Ja(t),n=ui(t).map(a=>{if(typeof a!="string"){const l=this.resolver.getAlias(a);return l.some(h=>!this.resolver.hasKey(h))&&this.add(a),Array.isArray(l)?l[0]:l}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),s=this.resolver.resolve(n),o=await this._mapLoadToResolve(s,e);return r?o[n[0]]:o}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let r=!1;typeof t=="string"&&(r=!0,t=[t]);const n=this.resolver.resolveBundle(t),s={},o=Object.keys(n);let a=0,l=0;const h=()=>{e==null||e(++a/l)},c=o.map(u=>{const d=n[u];return l+=Object.keys(d).length,this._mapLoadToResolve(d,h).then(f=>{s[u]=f})});return await Promise.all(c),r?s[t[0]]:s}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(r=>{this._backgroundLoader.add(Object.values(r))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return yn.get(t);const e={};for(let r=0;r<t.length;r++)e[r]=yn.get(t[r]);return e}async _mapLoadToResolve(t,e){const r=Object.values(t),n=Object.keys(t);this._backgroundLoader.active=!1;const s=await this.loader.load(r,e);this._backgroundLoader.active=!0;const o={};return r.forEach((a,l)=>{const h=s[a.src],c=[a.src];a.alias&&c.push(...a.alias),o[n[l]]=h,yn.set(c,h)}),o}async unload(t){this._initialized||await this.init();const e=ui(t).map(n=>typeof n!="string"?n.src:n),r=this.resolver.resolve(e);await this._unloadFromResolved(r)}async unloadBundle(t){this._initialized||await this.init(),t=ui(t);const e=this.resolver.resolveBundle(t),r=Object.keys(e).map(n=>this._unloadFromResolved(e[n]));await Promise.all(r)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach(r=>{yn.remove(r.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(const r of t.detections)t.skipDetections||await r.test()?e=await r.add(e):t.skipDetections||(e=await r.remove(e));return e=e.filter((r,n)=>e.indexOf(r)===n),e}get detections(){return this._detections}get preferWorkers(){return $a.config.preferWorkers}set preferWorkers(t){wt("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(r=>r in t).forEach(r=>{e.config[r]=t[r]})})}}const Qa=new sS;st.handleByList(q.LoadParser,Qa.loader.parsers).handleByList(q.ResolveParser,Qa.resolver.parsers).handleByList(q.CacheParser,Qa.cache.parsers).handleByList(q.DetectionParser,Qa.detections);const oS={extension:q.CacheParser,test:i=>Array.isArray(i)&&i.every(t=>t instanceof ot),getCacheableAssets:(i,t)=>{const e={};return i.forEach(r=>{t.forEach((n,s)=>{e[r+(s===0?"":s+1)]=n})}),e}};st.add(oS);async function w0(i){if("Image"in globalThis)return new Promise(t=>{const e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=i});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const t=await(await fetch(i)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}const aS={extension:{type:q.DetectionParser,priority:1},test:async()=>w0("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async i=>[...i,"avif"],remove:async i=>i.filter(t=>t!=="avif")};st.add(aS);const lS={extension:{type:q.DetectionParser,priority:0},test:async()=>w0("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async i=>[...i,"webp"],remove:async i=>i.filter(t=>t!=="webp")};st.add(lS);const T0=["png","jpg","jpeg"],hS={extension:{type:q.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async i=>[...i,...T0],remove:async i=>i.filter(t=>!T0.includes(t))};st.add(hS);const cS="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function iu(i){return cS?!1:document.createElement("video").canPlayType(i)!==""}const uS={extension:{type:q.DetectionParser,priority:0},test:async()=>iu("video/webm"),add:async i=>[...i,"webm"],remove:async i=>i.filter(t=>t!=="webm")};st.add(uS);const dS={extension:{type:q.DetectionParser,priority:0},test:async()=>iu("video/mp4"),add:async i=>[...i,"mp4","m4v"],remove:async i=>i.filter(t=>t!=="mp4"&&t!=="m4v")};st.add(dS);const fS={extension:{type:q.DetectionParser,priority:0},test:async()=>iu("video/ogg"),add:async i=>[...i,"ogv"],remove:async i=>i.filter(t=>t!=="ogv")};st.add(fS);const pS={extension:q.ResolveParser,test:$a.test,parse:i=>{var t;return{resolution:parseFloat(((t=nt.RETINA_PREFIX.exec(i))==null?void 0:t[1])??"1"),format:ne.extname(i).slice(1),src:i}}};st.add(pS);var Ne=(i=>(i[i.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",i[i.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",i[i.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",i[i.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",i[i.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",i[i.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",i[i.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",i[i.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",i[i.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",i[i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",i[i.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",i[i.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",i[i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",i[i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",i[i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",i[i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",i[i.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",i[i.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",i[i.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",i[i.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",i[i.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",i))(Ne||{});const qa={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 or,hs;function S0(){hs={s3tc:or.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:or.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:or.getExtension("WEBGL_compressed_texture_etc"),etc1:or.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:or.getExtension("WEBGL_compressed_texture_pvrtc")||or.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:or.getExtension("WEBGL_compressed_texture_atc"),astc:or.getExtension("WEBGL_compressed_texture_astc")}}const mS={extension:{type:q.DetectionParser,priority:2},test:async()=>{const i=nt.ADAPTER.createCanvas().getContext("webgl");return i?(or=i,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async i=>{hs||S0();const t=[];for(const e in hs)hs[e]&&t.push(e);return[...t,...i]},remove:async i=>(hs||S0(),i.filter(t=>!(t in hs)))};st.add(mS);class gS extends Ia{constructor(t,e={width:1,height:1,autoLoad:!0}){let r,n;typeof t=="string"?(r=t,n=new Uint8Array):(r=null,n=t),super(n,e),this.origin=r,this.buffer=n?new vc(n):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 vc(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this)),this._load)}}class bn extends gS{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=bn._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||bn._createLevelBuffers(t instanceof Uint8Array?t:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(t,e,r){const n=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;n.pixelStorei(n.UNPACK_ALIGNMENT,4);for(let s=0,o=this.levels;s<o;s++){const{levelID:a,levelWidth:l,levelHeight:h,levelBuffer:c}=this._levelBuffers[s];n.compressedTexImage2D(n.TEXTURE_2D,a,this.format,l,h,0,c)}return!0}onBlobLoaded(){this._levelBuffers=bn._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,r,n,s,o,a){const l=new Array(r);let h=t.byteOffset,c=o,u=a,d=c+n-1&~(n-1),f=u+s-1&~(s-1),p=d*f*qa[e];for(let m=0;m<r;m++)l[m]={levelID:m,levelWidth:r>1?c:d,levelHeight:r>1?u:f,levelBuffer:new Uint8Array(t.buffer,h,p)},h+=p,c=c>>1||1,u=u>>1||1,d=c+n-1&~(n-1),f=u+s-1&~(s-1),p=d*f*qa[e];return l}}const ru=4,tl=124,yS=32,E0=20,bS=542327876,el={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},xS={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},il={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},_S=1,vS=2,wS=4,TS=64,SS=512,ES=131072,CS=827611204,IS=861165636,AS=894720068,MS=808540228,RS=4,PS={[CS]:Ne.COMPRESSED_RGBA_S3TC_DXT1_EXT,[IS]:Ne.COMPRESSED_RGBA_S3TC_DXT3_EXT,[AS]:Ne.COMPRESSED_RGBA_S3TC_DXT5_EXT},LS={70:Ne.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:Ne.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:Ne.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:Ne.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:Ne.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:Ne.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:Ne.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:Ne.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:Ne.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT};function GS(i){const t=new Uint32Array(i);if(t[0]!==bS)throw new Error("Invalid DDS file magic word");const e=new Uint32Array(i,0,tl/Uint32Array.BYTES_PER_ELEMENT),r=e[el.HEIGHT],n=e[el.WIDTH],s=e[el.MIPMAP_COUNT],o=new Uint32Array(i,el.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,yS/Uint32Array.BYTES_PER_ELEMENT),a=o[_S];if(a&wS){const l=o[xS.FOURCC];if(l!==MS){const x=PS[l],b=ru+tl,v=new Uint8Array(i,b);return[new bn(v,{format:x,width:n,height:r,levels:s})]}const h=ru+tl,c=new Uint32Array(t.buffer,h,E0/Uint32Array.BYTES_PER_ELEMENT),u=c[il.DXGI_FORMAT],d=c[il.RESOURCE_DIMENSION],f=c[il.MISC_FLAG],p=c[il.ARRAY_SIZE],m=LS[u];if(m===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${u}`);if(f===RS)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=ru+tl+E0;if(p===1)g.push(new Uint8Array(i,y));else{const x=qa[m];let b=0,v=n,w=r;for(let C=0;C<s;C++){const I=Math.max(1,v+3&-4),M=Math.max(1,w+3&-4),L=I*M*x;b+=L,v=v>>>1,w=w>>>1}let S=y;for(let C=0;C<p;C++)g.push(new Uint8Array(i,S,b)),S+=b}return g.map(x=>new bn(x,{format:m,width:n,height:r,levels:s}))}throw a&TS?new Error("DDSParser does not support uncompressed texture data."):a&SS?new Error("DDSParser does not supported YUV uncompressed texture data."):a&ES?new Error("DDSParser does not support single-channel (lumninance) texture data!"):a&vS?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 C0=[171,75,84,88,32,49,49,187,13,10,26,10],kS=67305985,fi={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},nu=64,I0={[ct.UNSIGNED_BYTE]:1,[ct.UNSIGNED_SHORT]:2,[ct.INT]:4,[ct.UNSIGNED_INT]:4,[ct.FLOAT]:4,[ct.HALF_FLOAT]:8},FS={[z.RGBA]:4,[z.RGB]:3,[z.RG]:2,[z.RED]:1,[z.LUMINANCE]:1,[z.LUMINANCE_ALPHA]:2,[z.ALPHA]:1},DS={[ct.UNSIGNED_SHORT_4_4_4_4]:2,[ct.UNSIGNED_SHORT_5_5_5_1]:2,[ct.UNSIGNED_SHORT_5_6_5]:2};function NS(i,t,e=!1){const r=new DataView(t);if(!OS(i,r))return null;const n=r.getUint32(fi.ENDIANNESS,!0)===kS,s=r.getUint32(fi.GL_TYPE,n),o=r.getUint32(fi.GL_FORMAT,n),a=r.getUint32(fi.GL_INTERNAL_FORMAT,n),l=r.getUint32(fi.PIXEL_WIDTH,n),h=r.getUint32(fi.PIXEL_HEIGHT,n)||1,c=r.getUint32(fi.PIXEL_DEPTH,n)||1,u=r.getUint32(fi.NUMBER_OF_ARRAY_ELEMENTS,n)||1,d=r.getUint32(fi.NUMBER_OF_FACES,n),f=r.getUint32(fi.NUMBER_OF_MIPMAP_LEVELS,n),p=r.getUint32(fi.BYTES_OF_KEY_VALUE_DATA,n);if(h===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 m=4,g=4,y=l+3&-4,x=h+3&-4,b=new Array(u);let v=l*h;s===0&&(v=y*x);let w;if(s!==0?I0[s]?w=I0[s]*FS[o]:w=DS[s]:w=qa[a],w===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const S=e?US(r,p,n):null;let C=v*w,I=l,M=h,L=y,G=x,F=nu+p;for(let A=0;A<f;A++){const N=r.getUint32(F,n);let Z=F+4;for(let K=0;K<u;K++){let H=b[K];H||(H=b[K]=new Array(f)),H[A]={levelID:A,levelWidth:f>1||s!==0?I:L,levelHeight:f>1||s!==0?M:G,levelBuffer:new Uint8Array(t,Z,C)},Z+=C}F+=N+4,F=F%4!==0?F+4-F%4:F,I=I>>1||1,M=M>>1||1,L=I+m-1&~(m-1),G=M+g-1&~(g-1),C=L*G*w}return s!==0?{uncompressed:b.map(A=>{let N=A[0].levelBuffer,Z=!1;return s===ct.FLOAT?N=new Float32Array(A[0].levelBuffer.buffer,A[0].levelBuffer.byteOffset,A[0].levelBuffer.byteLength/4):s===ct.UNSIGNED_INT?(Z=!0,N=new Uint32Array(A[0].levelBuffer.buffer,A[0].levelBuffer.byteOffset,A[0].levelBuffer.byteLength/4)):s===ct.INT&&(Z=!0,N=new Int32Array(A[0].levelBuffer.buffer,A[0].levelBuffer.byteOffset,A[0].levelBuffer.byteLength/4)),{resource:new Ia(N,{width:A[0].levelWidth,height:A[0].levelHeight}),type:s,format:Z?BS(o):o}}),kvData:S}:{compressed:b.map(A=>new bn(null,{format:a,width:l,height:h,levels:f,levelBuffers:A})),kvData:S}}function OS(i,t){for(let e=0;e<C0.length;e++)if(t.getUint8(e)!==C0[e])return console.error(`${i} is not a valid *.ktx file!`),!1;return!0}function BS(i){switch(i){case z.RGBA:return z.RGBA_INTEGER;case z.RGB:return z.RGB_INTEGER;case z.RG:return z.RG_INTEGER;case z.RED:return z.RED_INTEGER;default:return i}}function US(i,t,e){const r=new Map;let n=0;for(;n<t;){const s=i.getUint32(nu+n,e),o=nu+n+4,a=3-(s+3)%4;if(s===0||s>t-n){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let l=0;for(;l<s&&i.getUint8(o+l)!==0;l++);if(l===-1){console.error("KTXLoader: Failed to find null byte terminating kvData key");break}const h=new TextDecoder().decode(new Uint8Array(i.buffer,o,l)),c=new DataView(i.buffer,o+l+1,s-l-1);r.set(h,c),n+=4+s+a}return r}const XS={extension:{type:q.LoadParser,priority:di.High},name:"loadDDS",test(i){return Lr(i,".dds")},async load(i,t,e){const r=await(await nt.ADAPTER.fetch(i)).arrayBuffer(),n=GS(r).map(s=>{const o=new xt(s,{mipmap:Ti.OFF,alphaMode:Ce.NO_PREMULTIPLIED_ALPHA,resolution:rr(i),...t.data});return po(o,e,i)});return n.length===1?n[0]:n},unload(i){Array.isArray(i)?i.forEach(t=>t.destroy(!0)):i.destroy(!0)}};st.add(XS);const WS={extension:{type:q.LoadParser,priority:di.High},name:"loadKTX",test(i){return Lr(i,".ktx")},async load(i,t,e){const r=await(await nt.ADAPTER.fetch(i)).arrayBuffer(),{compressed:n,uncompressed:s,kvData:o}=NS(i,r),a=n??s,l={mipmap:Ti.OFF,alphaMode:Ce.NO_PREMULTIPLIED_ALPHA,resolution:rr(i),...t.data},h=a.map(c=>{a===s&&Object.assign(l,{type:c.type,format:c.format});const u=c.resource??c,d=new xt(u,l);return d.ktxKeyValueData=o,po(d,e,i)});return h.length===1?h[0]:h},unload(i){Array.isArray(i)?i.forEach(t=>t.destroy(!0)):i.destroy(!0)}};st.add(WS);const ZS={extension:q.ResolveParser,test:i=>{const t=ne.extname(i).slice(1);return["basis","ktx","dds"].includes(t)},parse:i=>{var e,r;const t=ne.extname(i).slice(1);if(t==="ktx"){const n=[".s3tc.ktx",".s3tc_sRGB.ktx",".etc.ktx",".etc1.ktx",".pvrt.ktx",".atc.ktx",".astc.ktx"];if(n.some(s=>i.endsWith(s)))return{resolution:parseFloat(((e=nt.RETINA_PREFIX.exec(i))==null?void 0:e[1])??"1"),format:n.find(s=>i.endsWith(s)),src:i}}return{resolution:parseFloat(((r=nt.RETINA_PREFIX.exec(i))==null?void 0:r[1])??"1"),format:t,src:i}}};st.add(ZS);const rl=new gt,VS=4,A0=class aa{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,r,n){const s=new Image;return s.src=await this.base64(t,e,r,n),s}async base64(t,e,r,n){const s=this.canvas(t,n);if(s.toBlob!==void 0)return new Promise((o,a)=>{s.toBlob(l=>{if(!l){a(new Error("ICanvas.toBlob failed!"));return}const h=new FileReader;h.onload=()=>o(h.result),h.onerror=a,h.readAsDataURL(l)},e,r)});if(s.toDataURL!==void 0)return s.toDataURL(e,r);if(s.convertToBlob!==void 0){const o=await s.convertToBlob({type:e,quality:r});return new Promise((a,l)=>{const h=new FileReader;h.onload=()=>a(h.result),h.onerror=l,h.readAsDataURL(o)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t,e){const{pixels:r,width:n,height:s,flipY:o,premultipliedAlpha:a}=this._rawPixels(t,e);o&&aa._flipY(r,n,s),a&&aa._unpremultiplyAlpha(r);const l=new Ev(n,s,1),h=new ImageData(new Uint8ClampedArray(r.buffer),n,s);return l.context.putImageData(h,0,0),l.canvas}pixels(t,e){const{pixels:r,width:n,height:s,flipY:o,premultipliedAlpha:a}=this._rawPixels(t,e);return o&&aa._flipY(r,n,s),a&&aa._unpremultiplyAlpha(r),r}_rawPixels(t,e){const r=this.renderer;if(!r)throw new Error("The Extract has already been destroyed");let n,s=!1,o=!1,a,l=!1;t&&(t instanceof fn?a=t:(a=r.generateTexture(t,{region:e,resolution:r.resolution,multisample:r.multisample}),l=!0,e&&(rl.width=e.width,rl.height=e.height,e=rl)));const h=r.gl;if(a){if(n=a.baseTexture.resolution,e=e??a.frame,s=!1,o=a.baseTexture.alphaMode>0&&a.baseTexture.format===z.RGBA,!l){r.renderTexture.bind(a);const f=a.framebuffer.glFramebuffers[r.CONTEXT_UID];f.blitFramebuffer&&r.framebuffer.bind(f.blitFramebuffer)}}else n=r.resolution,e||(e=rl,e.width=r.width/n,e.height=r.height/n),s=!0,o=this._rendererPremultipliedAlpha,r.renderTexture.bind();const c=Math.max(Math.round(e.width*n),1),u=Math.max(Math.round(e.height*n),1),d=new Uint8Array(VS*c*u);return h.readPixels(Math.round(e.x*n),Math.round(e.y*n),c,u,h.RGBA,h.UNSIGNED_BYTE,d),l&&(a==null||a.destroy(!0)),{pixels:d,width:c,height:u,flipY:s,premultipliedAlpha:o}}destroy(){this.renderer=null}static _flipY(t,e,r){const n=e<<2,s=r>>1,o=new Uint8Array(n);for(let a=0;a<s;a++){const l=a*n,h=(r-a-1)*n;o.set(t.subarray(l,l+n)),t.copyWithin(l,h,h+n),t.set(o,h)}}static _unpremultiplyAlpha(t){t instanceof Uint8ClampedArray&&(t=new Uint8Array(t.buffer));const e=t.length;for(let r=0;r<e;r+=4){const n=t[r+3];if(n!==0){const s=255.001/n;t[r]=t[r]*s+.5,t[r+1]=t[r+1]*s+.5,t[r+2]=t[r+2]*s+.5}}}};A0.extension={name:"extract",type:q.RendererSystem};let HS=A0;st.add(HS);const nl={build(i){const t=i.points;let e,r,n,s,o,a;if(i.type===pe.CIRC){const p=i.shape;e=p.x,r=p.y,o=a=p.radius,n=s=0}else if(i.type===pe.ELIP){const p=i.shape;e=p.x,r=p.y,o=p.width,a=p.height,n=s=0}else{const p=i.shape,m=p.width/2,g=p.height/2;e=p.x+m,r=p.y+g,o=a=Math.max(0,Math.min(p.radius,Math.min(m,g))),n=m-o,s=g-a}if(!(o>=0&&a>=0&&n>=0&&s>=0)){t.length=0;return}const l=Math.ceil(2.3*Math.sqrt(o+a)),h=l*8+(n?4:0)+(s?4:0);if(t.length=h,h===0)return;if(l===0){t.length=8,t[0]=t[6]=e+n,t[1]=t[3]=r+s,t[2]=t[4]=e-n,t[5]=t[7]=r-s;return}let c=0,u=l*4+(n?2:0)+2,d=u,f=h;{const p=n+o,m=s,g=e+p,y=e-p,x=r+m;if(t[c++]=g,t[c++]=x,t[--u]=x,t[--u]=y,s){const b=r-m;t[d++]=y,t[d++]=b,t[--f]=b,t[--f]=g}}for(let p=1;p<l;p++){const m=Math.PI/2*(p/l),g=n+Math.cos(m)*o,y=s+Math.sin(m)*a,x=e+g,b=e-g,v=r+y,w=r-y;t[c++]=x,t[c++]=v,t[--u]=v,t[--u]=b,t[d++]=b,t[d++]=w,t[--f]=w,t[--f]=x}{const p=n,m=s+a,g=e+p,y=e-p,x=r+m,b=r-m;t[c++]=g,t[c++]=x,t[--f]=b,t[--f]=g,n&&(t[c++]=y,t[c++]=x,t[--f]=b,t[--f]=y)}},triangulate(i,t){const e=i.points,r=t.points,n=t.indices;if(e.length===0)return;let s=r.length/2;const o=s;let a,l;if(i.type!==pe.RREC){const c=i.shape;a=c.x,l=c.y}else{const c=i.shape;a=c.x+c.width/2,l=c.y+c.height/2}const h=i.matrix;r.push(i.matrix?h.a*a+h.c*l+h.tx:a,i.matrix?h.b*a+h.d*l+h.ty:l),s++,r.push(e[0],e[1]);for(let c=2;c<e.length;c+=2)r.push(e[c],e[c+1]),n.push(s++,o,s);n.push(o+1,o,s)}};function M0(i,t=!1){const e=i.length;if(e<6)return;let r=0;for(let n=0,s=i[e-2],o=i[e-1];n<e;n+=2){const a=i[n],l=i[n+1];r+=(a-s)*(l+o),s=a,o=l}if(!t&&r>0||t&&r<=0){const n=e/2;for(let s=n+n%2;s<e;s+=2){const o=e-s-2,a=e-s-1,l=s,h=s+1;[i[o],i[l]]=[i[l],i[o]],[i[a],i[h]]=[i[h],i[a]]}}}const R0={build(i){i.points=i.shape.points.slice()},triangulate(i,t){let e=i.points;const r=i.holes,n=t.points,s=t.indices;if(e.length>=6){M0(e,!1);const o=[];for(let h=0;h<r.length;h++){const c=r[h];M0(c.points,!0),o.push(e.length/2),e=e.concat(c.points)}const a=ex(e,o,2);if(!a)return;const l=n.length/2;for(let h=0;h<a.length;h+=3)s.push(a[h]+l),s.push(a[h+1]+l),s.push(a[h+2]+l);for(let h=0;h<e.length;h++)n.push(e[h])}}},KS={build(i){const t=i.shape,e=t.x,r=t.y,n=t.width,s=t.height,o=i.points;o.length=0,n>=0&&s>=0&&o.push(e,r,e+n,r,e+n,r+s,e,r+s)},triangulate(i,t){const e=i.points,r=t.points;if(e.length===0)return;const n=r.length/2;r.push(e[0],e[1],e[2],e[3],e[6],e[7],e[4],e[5]),t.indices.push(n,n+1,n+2,n+1,n+2,n+3)}},zS={build(i){nl.build(i)},triangulate(i,t){nl.triangulate(i,t)}};var Je=(i=>(i.MITER="miter",i.BEVEL="bevel",i.ROUND="round",i))(Je||{}),Gr=(i=>(i.BUTT="butt",i.ROUND="round",i.SQUARE="square",i))(Gr||{});const cs={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount(i,t=20){if(!this.adaptive||!i||isNaN(i))return t;let e=Math.ceil(i/this.maxLength);return e<this.minSegments?e=this.minSegments:e>this.maxSegments&&(e=this.maxSegments),e}};class P0{static curveTo(t,e,r,n,s,o){const a=o[o.length-2],l=o[o.length-1]-e,h=a-t,c=n-e,u=r-t,d=Math.abs(l*u-h*c);if(d<1e-8||s===0)return(o[o.length-2]!==t||o[o.length-1]!==e)&&o.push(t,e),null;const f=l*l+h*h,p=c*c+u*u,m=l*c+h*u,g=s*Math.sqrt(f)/d,y=s*Math.sqrt(p)/d,x=g*m/f,b=y*m/p,v=g*u+y*h,w=g*c+y*l,S=h*(y+x),C=l*(y+x),I=u*(g+b),M=c*(g+b),L=Math.atan2(C-w,S-v),G=Math.atan2(M-w,I-v);return{cx:v+t,cy:w+e,radius:s,startAngle:L,endAngle:G,anticlockwise:h*c>u*l}}static arc(t,e,r,n,s,o,a,l,h){const c=a-o,u=cs._segmentsCount(Math.abs(c)*s,Math.ceil(Math.abs(c)/Ma)*40),d=c/(u*2),f=d*2,p=Math.cos(d),m=Math.sin(d),g=u-1,y=g%1/g;for(let x=0;x<=g;++x){const b=x+y*x,v=d+o+f*b,w=Math.cos(v),S=-Math.sin(v);h.push((p*w+m*S)*s+r,(p*-S+m*w)*s+n)}}}class YS{constructor(){this.reset()}begin(t,e,r){this.reset(),this.style=t,this.start=e,this.attribStart=r}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 su{static curveLength(t,e,r,n,s,o,a,l){let h=0,c=0,u=0,d=0,f=0,p=0,m=0,g=0,y=0,x=0,b=0,v=t,w=e;for(let S=1;S<=10;++S)c=S/10,u=c*c,d=u*c,f=1-c,p=f*f,m=p*f,g=m*t+3*p*c*r+3*f*u*s+d*a,y=m*e+3*p*c*n+3*f*u*o+d*l,x=v-g,b=w-y,v=g,w=y,h+=Math.sqrt(x*x+b*b);return h}static curveTo(t,e,r,n,s,o,a){const l=a[a.length-2],h=a[a.length-1];a.length-=2;const c=cs._segmentsCount(su.curveLength(l,h,t,e,r,n,s,o));let u=0,d=0,f=0,p=0,m=0;a.push(l,h);for(let g=1,y=0;g<=c;++g)y=g/c,u=1-y,d=u*u,f=d*u,p=y*y,m=p*y,a.push(f*l+3*d*y*t+3*u*p*r+m*s,f*h+3*d*y*e+3*u*p*n+m*o)}}function L0(i,t,e,r,n,s,o,a){const l=i-e*n,h=t-r*n,c=i+e*s,u=t+r*s;let d,f;o?(d=r,f=-e):(d=-r,f=e);const p=l+d,m=h+f,g=c+d,y=u+f;return a.push(p,m,g,y),2}function xn(i,t,e,r,n,s,o,a){const l=e-i,h=r-t;let c=Math.atan2(l,h),u=Math.atan2(n-i,s-t);a&&c<u?c+=Math.PI*2:!a&&c>u&&(u+=Math.PI*2);let d=c;const f=u-c,p=Math.abs(f),m=Math.sqrt(l*l+h*h),g=(15*p*Math.sqrt(m)/Math.PI>>0)+1,y=f/g;if(d+=y,a){o.push(i,t,e,r);for(let x=1,b=d;x<g;x++,b+=y)o.push(i,t,i+Math.sin(b)*m,t+Math.cos(b)*m);o.push(i,t,n,s)}else{o.push(e,r,i,t);for(let x=1,b=d;x<g;x++,b+=y)o.push(i+Math.sin(b)*m,t+Math.cos(b)*m,i,t);o.push(n,s,i,t)}return g*2}function jS(i,t){const e=i.shape;let r=i.points||e.points.slice();const n=t.closePointEps;if(r.length===0)return;const s=i.lineStyle,o=new dt(r[0],r[1]),a=new dt(r[r.length-2],r[r.length-1]),l=e.type!==pe.POLY||e.closeStroke,h=Math.abs(o.x-a.x)<n&&Math.abs(o.y-a.y)<n;if(l){r=r.slice(),h&&(r.pop(),r.pop(),a.set(r[r.length-2],r[r.length-1]));const H=(o.x+a.x)*.5,j=(a.y+o.y)*.5;r.unshift(H,j),r.push(H,j)}const c=t.points,u=r.length/2;let d=r.length;const f=c.length/2,p=s.width/2,m=p*p,g=s.miterLimit*s.miterLimit;let y=r[0],x=r[1],b=r[2],v=r[3],w=0,S=0,C=-(x-v),I=y-b,M=0,L=0,G=Math.sqrt(C*C+I*I);C/=G,I/=G,C*=p,I*=p;const F=s.alignment,A=(1-F)*2,N=F*2;l||(s.cap===Gr.ROUND?d+=xn(y-C*(A-N)*.5,x-I*(A-N)*.5,y-C*A,x-I*A,y+C*N,x+I*N,c,!0)+2:s.cap===Gr.SQUARE&&(d+=L0(y,x,C,I,A,N,!0,c))),c.push(y-C*A,x-I*A,y+C*N,x+I*N);for(let H=1;H<u-1;++H){y=r[(H-1)*2],x=r[(H-1)*2+1],b=r[H*2],v=r[H*2+1],w=r[(H+1)*2],S=r[(H+1)*2+1],C=-(x-v),I=y-b,G=Math.sqrt(C*C+I*I),C/=G,I/=G,C*=p,I*=p,M=-(v-S),L=b-w,G=Math.sqrt(M*M+L*L),M/=G,L/=G,M*=p,L*=p;const j=b-y,B=x-v,D=b-w,k=S-v,V=j*D+B*k,et=B*D-k*j,ft=et<0;if(Math.abs(et)<.001*Math.abs(V)){c.push(b-C*A,v-I*A,b+C*N,v+I*N),V>=0&&(s.join===Je.ROUND?d+=xn(b,v,b-C*A,v-I*A,b-M*A,v-L*A,c,!1)+4:d+=2,c.push(b-M*N,v-L*N,b+M*A,v+L*A));continue}const at=(-C+y)*(-I+v)-(-C+b)*(-I+x),Tt=(-M+w)*(-L+v)-(-M+b)*(-L+S),It=(j*Tt-D*at)/et,Q=(k*at-B*Tt)/et,W=(It-b)*(It-b)+(Q-v)*(Q-v),J=b+(It-b)*A,$=v+(Q-v)*A,O=b-(It-b)*N,pt=v-(Q-v)*N,yt=Math.min(j*j+B*B,D*D+k*k),Rt=ft?A:N,Bt=yt+Rt*Rt*m,Fe=W<=Bt;let Ve=s.join;if(Ve===Je.MITER&&W/m>g&&(Ve=Je.BEVEL),Fe)switch(Ve){case Je.MITER:{c.push(J,$,O,pt);break}case Je.BEVEL:{ft?c.push(J,$,b+C*N,v+I*N,J,$,b+M*N,v+L*N):c.push(b-C*A,v-I*A,O,pt,b-M*A,v-L*A,O,pt),d+=2;break}case Je.ROUND:{ft?(c.push(J,$,b+C*N,v+I*N),d+=xn(b,v,b+C*N,v+I*N,b+M*N,v+L*N,c,!0)+4,c.push(J,$,b+M*N,v+L*N)):(c.push(b-C*A,v-I*A,O,pt),d+=xn(b,v,b-C*A,v-I*A,b-M*A,v-L*A,c,!1)+4,c.push(b-M*A,v-L*A,O,pt));break}}else{switch(c.push(b-C*A,v-I*A,b+C*N,v+I*N),Ve){case Je.MITER:{ft?c.push(O,pt,O,pt):c.push(J,$,J,$),d+=2;break}case Je.ROUND:{ft?d+=xn(b,v,b+C*N,v+I*N,b+M*N,v+L*N,c,!0)+2:d+=xn(b,v,b-C*A,v-I*A,b-M*A,v-L*A,c,!1)+2;break}}c.push(b-M*A,v-L*A,b+M*N,v+L*N),d+=2}}y=r[(u-2)*2],x=r[(u-2)*2+1],b=r[(u-1)*2],v=r[(u-1)*2+1],C=-(x-v),I=y-b,G=Math.sqrt(C*C+I*I),C/=G,I/=G,C*=p,I*=p,c.push(b-C*A,v-I*A,b+C*N,v+I*N),l||(s.cap===Gr.ROUND?d+=xn(b-C*(A-N)*.5,v-I*(A-N)*.5,b-C*A,v-I*A,b+C*N,v+I*N,c,!1)+2:s.cap===Gr.SQUARE&&(d+=L0(b,v,C,I,A,N,!1,c)));const Z=t.indices,K=cs.epsilon*cs.epsilon;for(let H=f;H<d+f-2;++H)y=c[H*2],x=c[H*2+1],b=c[(H+1)*2],v=c[(H+1)*2+1],w=c[(H+2)*2],S=c[(H+2)*2+1],!(Math.abs(y*(v-S)+b*(S-x)+w*(x-v))<K)&&Z.push(H,H+1,H+2)}function JS(i,t){let e=0;const r=i.shape,n=i.points||r.points,s=r.type!==pe.POLY||r.closeStroke;if(n.length===0)return;const o=t.points,a=t.indices,l=n.length/2,h=o.length/2;let c=h;for(o.push(n[0],n[1]),e=1;e<l;e++)o.push(n[e*2],n[e*2+1]),a.push(c,c+1),c++;s&&a.push(c,h)}function G0(i,t){i.lineStyle.native?JS(i,t):jS(i,t)}class ou{static curveLength(t,e,r,n,s,o){const a=t-2*r+s,l=e-2*n+o,h=2*r-2*t,c=2*n-2*e,u=4*(a*a+l*l),d=4*(a*h+l*c),f=h*h+c*c,p=2*Math.sqrt(u+d+f),m=Math.sqrt(u),g=2*u*m,y=2*Math.sqrt(f),x=d/m;return(g*p+m*d*(p-y)+(4*f*u-d*d)*Math.log((2*m+x+p)/(x+y)))/(4*g)}static curveTo(t,e,r,n,s){const o=s[s.length-2],a=s[s.length-1],l=cs._segmentsCount(ou.curveLength(o,a,t,e,r,n));let h=0,c=0;for(let u=1;u<=l;++u){const d=u/l;h=o+(t-o)*d,c=a+(e-a)*d,s.push(h+(t+(r-t)*d-h)*d,c+(e+(n-e)*d-c)*d)}}}const au={[pe.POLY]:R0,[pe.CIRC]:nl,[pe.ELIP]:nl,[pe.RECT]:KS,[pe.RREC]:zS},k0=[],sl=[];class ol{constructor(t,e=null,r=null,n=null){this.points=[],this.holes=[],this.shape=t,this.lineStyle=r,this.fillStyle=e,this.matrix=n,this.type=t.type}clone(){return new ol(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 us=new dt,F0=class S1 extends pm{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 za,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(),sl.push(this.drawCalls[t]);this.drawCalls.length=0;for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e.reset(),k0.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,r=null,n=null){const s=new ol(t,e,r,n);return this.graphicsData.push(s),this.dirty++,this}drawHole(t,e=null){if(!this.graphicsData.length)return null;const r=new ol(t,null,null,e),n=this.graphicsData[this.graphicsData.length-1];return r.lineStyle=n.lineStyle,n.holes.push(r),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 r=0;r<e.length;++r){const n=e[r];if(n.fillStyle.visible&&n.shape&&(n.matrix?n.matrix.applyInverse(t,us):us.copyFrom(t),n.shape.contains(us.x,us.y))){let s=!1;if(n.holes){for(let o=0;o<n.holes.length;o++)if(n.holes[o].shape.contains(us.x,us.y)){s=!0;break}}if(!s)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 r=null,n=null;this.batches.length>0&&(r=this.batches[this.batches.length-1],n=r.style);for(let l=this.shapeIndex;l<e.length;l++){this.shapeIndex++;const h=e[l],c=h.fillStyle,u=h.lineStyle;au[h.type].build(h),h.matrix&&this.transformPoints(h.points,h.matrix),(c.visible||u.visible)&&this.processHoles(h.holes);for(let d=0;d<2;d++){const f=d===0?c:u;if(!f.visible)continue;const p=f.texture.baseTexture,m=this.indices.length,g=this.points.length/2;p.wrapMode=wi.REPEAT,d===0?this.processFill(h):this.processLine(h);const y=this.points.length/2-g;y!==0&&(r&&!this._compareStyles(n,f)&&(r.end(m,g),r=null),r||(r=k0.pop()||new YS,r.begin(f,m,g),this.batches.push(r),n=f),this.addUvs(this.points,t,f.texture,g,y,f.matrix))}}const s=this.indices.length,o=this.points.length/2;if(r&&r.end(s,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 r=this.graphicsData[t],n=r.fillStyle,s=r.lineStyle;if(n&&!n.texture.baseTexture.valid||s&&!s.texture.baseTexture.valid)return!1}return!0}packBatches(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);const t=this.batches;for(let e=0,r=t.length;e<r;e++){const n=t[e];for(let s=0;s<n.size;s++){const o=n.start+s;this.indicesUint16[o]=this.indicesUint16[o]-n.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<S1.BATCHABLE_SIZE*2}buildDrawCalls(){let t=++xt._globalBatch;for(let u=0;u<this.drawCalls.length;u++)this.drawCalls[u].texArray.clear(),sl.push(this.drawCalls[u]);this.drawCalls.length=0;const e=this.colors,r=this.textureIds;let n=sl.pop();n||(n=new Rc,n.texArray=new Dc),n.texArray.count=0,n.start=0,n.size=0,n.type=vi.TRIANGLES;let s=0,o=null,a=0,l=!1,h=vi.TRIANGLES,c=0;this.drawCalls.push(n);for(let u=0;u<this.batches.length;u++){const d=this.batches[u],f=8,p=d.style,m=p.texture.baseTexture;l!==!!p.native&&(l=!!p.native,h=l?vi.LINES:vi.TRIANGLES,o=null,s=f,t++),o!==m&&(o=m,m._batchEnabled!==t&&(s===f&&(t++,s=0,n.size>0&&(n=sl.pop(),n||(n=new Rc,n.texArray=new Dc),this.drawCalls.push(n)),n.start=c,n.size=0,n.texArray.count=0,n.type=h),m.touched=1,m._batchEnabled=t,m._batchLocation=s,m.wrapMode=wi.REPEAT,n.texArray.elements[n.texArray.count++]=m,s++)),n.size+=d.size,c+=d.size,a=m._batchLocation,this.addColors(e,p.color,p.alpha,d.attribSize,d.attribStart),this.addTextureIds(r,a,d.attribSize,d.attribStart)}xt._globalBatch=t,this.packAttributes()}packAttributes(){const t=this.points,e=this.uvs,r=this.colors,n=this.textureIds,s=new ArrayBuffer(t.length*3*4),o=new Float32Array(s),a=new Uint32Array(s);let l=0;for(let h=0;h<t.length/2;h++)o[l++]=t[h*2],o[l++]=t[h*2+1],o[l++]=e[h*2],o[l++]=e[h*2+1],a[l++]=r[h],o[l++]=n[h];this._buffer.update(s),this._indexBuffer.update(this.indicesUint16)}processFill(t){t.holes.length?R0.triangulate(t,this):au[t.type].triangulate(t,this)}processLine(t){G0(t,this);for(let e=0;e<t.holes.length;e++)G0(t.holes[e],this)}processHoles(t){for(let e=0;e<t.length;e++){const r=t[e];au[r.type].build(r),r.matrix&&this.transformPoints(r.points,r.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 r=0;r<t.length/2;r++){const n=t[r*2],s=t[r*2+1];t[r*2]=e.a*n+e.c*s+e.tx,t[r*2+1]=e.b*n+e.d*s+e.ty}}addColors(t,e,r,n,s=0){const o=Dt.shared.setValue(e).toLittleEndianNumber(),a=Dt.shared.setValue(o).toPremultiplied(r);t.length=Math.max(t.length,s+n);for(let l=0;l<n;l++)t[s+l]=a}addTextureIds(t,e,r,n=0){t.length=Math.max(t.length,n+r);for(let s=0;s<r;s++)t[n+s]=e}addUvs(t,e,r,n,s,o=null){let a=0;const l=e.length,h=r.frame;for(;a<s;){let u=t[(n+a)*2],d=t[(n+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/h.width,d/h.height)}const c=r.baseTexture;(h.width<c.width||h.height<c.height)&&this.adjustUvs(e,r,l,s)}adjustUvs(t,e,r,n){const s=e.baseTexture,o=1e-6,a=r+n*2,l=e.frame,h=l.width/s.width,c=l.height/s.height;let u=l.x/l.width,d=l.y/l.height,f=Math.floor(t[r]+o),p=Math.floor(t[r+1]+o);for(let m=r+2;m<a;m+=2)f=Math.min(f,Math.floor(t[m]+o)),p=Math.min(p,Math.floor(t[m+1]+o));u-=f,d-=p;for(let m=r;m<a;m+=2)t[m]=(t[m]+u)*h,t[m+1]=(t[m+1]+d)*c}};F0.BATCHABLE_SIZE=100;let $S=F0;class al{constructor(){this.color=16777215,this.alpha=1,this.texture=ot.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){const t=new al;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=ot.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}class lu extends al{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=Gr.BUTT,this.join=Je.MITER,this.miterLimit=10}clone(){const t=new lu;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=Gr.BUTT,this.join=Je.MITER,this.miterLimit=10}}const hu={},cu=class Mh extends Ct{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 al,this._lineStyle=new lu,this._matrix=null,this._holeMode=!1,this.state=Ri.for2d(),this._geometry=t||new $S,this._geometry.refCount++,this._transformID=-1,this._tintColor=new Dt(16777215),this.blendMode=mt.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new Mh(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,r,n=.5,s=!1){return typeof t=="number"&&(t={width:t,color:e,alpha:r,alignment:n,native:s}),this.lineTextureStyle(t)}lineTextureStyle(t){const e={width:0,texture:ot.WHITE,color:t!=null&&t.texture?16777215:0,matrix:null,alignment:.5,native:!1,cap:Gr.BUTT,join:Je.MITER,miterLimit:10};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();const r=t.width>0&&t.alpha>0;return r?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._lineStyle,{visible:r},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 an,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new an,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 r=this.currentPath.points,n=r[r.length-2],s=r[r.length-1];return(n!==t||s!==e)&&r.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,r,n){this._initCurve();const s=this.currentPath.points;return s.length===0&&this.moveTo(0,0),ou.curveTo(t,e,r,n,s),this}bezierCurveTo(t,e,r,n,s,o){return this._initCurve(),su.curveTo(t,e,r,n,s,o,this.currentPath.points),this}arcTo(t,e,r,n,s){this._initCurve(t,e);const o=this.currentPath.points,a=P0.curveTo(t,e,r,n,s,o);if(a){const{cx:l,cy:h,radius:c,startAngle:u,endAngle:d,anticlockwise:f}=a;this.arc(l,h,c,u,d,f)}return this}arc(t,e,r,n,s,o=!1){if(n===s)return this;if(!o&&s<=n?s+=Ma:o&&n<=s&&(n+=Ma),s-n===0)return this;const a=t+Math.cos(n)*r,l=e+Math.sin(n)*r,h=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]-l);u<h&&d<h||c.push(a,l)}else this.moveTo(a,l),c=this.currentPath.points;return P0.arc(a,l,t,e,r,n,s,o,c),this}beginFill(t=0,e){return this.beginTextureFill({texture:ot.WHITE,color:t,alpha:e})}normalizeColor(t){const e=Dt.shared.setValue(t.color??0);t.color=e.toNumber(),t.alpha??(t.alpha=e.alpha)}beginTextureFill(t){const e={texture:ot.WHITE,color:16777215,matrix:null};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();const r=t.alpha>0;return r?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:r},t)):this._fillStyle.reset(),this}endFill(){return this.finishPoly(),this._fillStyle.reset(),this}drawRect(t,e,r,n){return this.drawShape(new gt(t,e,r,n))}drawRoundedRect(t,e,r,n,s){return this.drawShape(new Ga(t,e,r,n,s))}drawCircle(t,e,r){return this.drawShape(new Pa(t,e,r))}drawEllipse(t,e,r,n){return this.drawShape(new La(t,e,r,n))}drawPolygon(...t){let e,r=!0;const n=t[0];n.points?(r=n.closeStroke,e=n.points):Array.isArray(t[0])?e=t[0]:e=t;const s=new an(e);return s.closeStroke=r,this.drawShape(s),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===pe.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,r=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=r,this.vertexData=new Float32Array(t.points);for(let n=0;n<r;n++){const s=t.batches[n],o=s.style.color,a=new Float32Array(this.vertexData.buffer,s.attribStart*4*2,s.attribSize*2),l=new Float32Array(t.uvsFloat32.buffer,s.attribStart*4*2,s.attribSize*2),h=new Uint16Array(t.indicesUint16.buffer,s.start*2,s.size),c={vertexData:a,blendMode:e,indices:h,uvs:l,_batchRGB:Dt.shared.setValue(o).toRgbArray(),_tintRGB:o,_texture:s.style.texture,alpha:s.style.alpha,worldAlpha:1};this.batches[n]=c}}_renderBatched(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(let e=0,r=this.batches.length;e<r;e++){const n=this.batches[e];n.worldAlpha=this.worldAlpha*n.alpha,t.plugins[this.pluginName].render(n)}}}_renderDirect(t){const e=this._resolveDirectShader(t),r=this._geometry,n=this.worldAlpha,s=e.uniforms,o=r.drawCalls;s.translationMatrix=this.transform.worldTransform,Dt.shared.setValue(this._tintColor).premultiply(n).toArray(s.tint),t.shader.bind(e),t.geometry.bind(r,e),t.state.set(this.state);for(let a=0,l=o.length;a<l;a++)this._renderDrawCallDirect(t,r.drawCalls[a])}_renderDrawCallDirect(t,e){const{texArray:r,type:n,size:s,start:o}=e,a=r.count;for(let l=0;l<a;l++)t.texture.bind(r.elements[l],l);t.geometry.draw(n,s,o)}_resolveDirectShader(t){let e=this.shader;const r=this.pluginName;if(!e){if(!hu[r]){const{maxTextures:n}=t.plugins[r],s=new Int32Array(n);for(let l=0;l<n;l++)s[l]=l;const o={tint:new Float32Array([1,1,1,1]),translationMatrix:new Nt,default:hi.from({uSamplers:s},!0)},a=t.plugins[r]._shader.program;hu[r]=new Pi(a,o)}e=hu[r]}return e}_calculateBounds(){this.finishPoly();const t=this._geometry;if(!t.graphicsData.length)return;const{minX:e,minY:r,maxX:n,maxY:s}=t.bounds;this._bounds.addFrame(this.transform,e,r,n,s)}containsPoint(t){return this.worldTransform.applyInverse(t,Mh._TEMP_POINT),this._geometry.containsPoint(Mh._TEMP_POINT)}calculateTints(){if(this.batchTint!==this.tint){this.batchTint=this._tintColor.toNumber();for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e._tintRGB=Dt.shared.setValue(this._tintColor).multiply(e._batchRGB).toLittleEndianNumber()}}}calculateVertices(){const t=this.transform._worldID;if(this._transformID===t)return;this._transformID=t;const e=this.transform.worldTransform,r=e.a,n=e.b,s=e.c,o=e.d,a=e.tx,l=e.ty,h=this._geometry.points,c=this.vertexData;let u=0;for(let d=0;d<h.length;d+=2){const f=h[d],p=h[d+1];c[u++]=r*f+s*p+a,c[u++]=o*p+n*f+l}}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)}};cu.curves=cs,cu._TEMP_POINT=new dt;let ds=cu;class QS{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 uu=new dt,D0=new an,N0=class E1 extends Ct{constructor(t,e,r,n=vi.TRIANGLES){super(),this.geometry=t,this.shader=e,this.state=r||Ri.for2d(),this.drawMode=n,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=nt.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===vi.TRIANGLES&&e.length<E1.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,r=this.shader;r.uvMatrix&&(r.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=e.indexBuffer.data,this._tintRGB=r._tintRGB,this._texture=r.texture;const n=this.material.pluginName;t.batch.setObjectRenderer(t.plugins[n]),t.plugins[n].render(this)}calculateVertices(){const t=this.geometry.buffers[0],e=t.data,r=t._updateID;if(r===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 n=this.transform.worldTransform,s=n.a,o=n.b,a=n.c,l=n.d,h=n.tx,c=n.ty,u=this.vertexData;for(let d=0;d<u.length/2;d++){const f=e[d*2],p=e[d*2+1];u[d*2]=s*f+a*p+h,u[d*2+1]=o*f+l*p+c}if(this._roundPixels){const d=nt.RESOLUTION;for(let f=0;f<u.length;++f)u[f]=Math.round(u[f]*d)/d}this.vertexDirty=r}calculateUvs(){const t=this.geometry.buffers[1],e=this.shader;e.uvMatrix.isSimple?this.uvs=t.data:(this.batchUvs||(this.batchUvs=new QS(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,uu);const e=this.geometry.getBuffer("aVertexPosition").data,r=D0.points,n=this.geometry.getIndex().data,s=n.length,o=this.drawMode===4?3:1;for(let a=0;a+2<s;a+=o){const l=n[a]*2,h=n[a+1]*2,c=n[a+2]*2;if(r[0]=e[l],r[1]=e[l+1],r[2]=e[h],r[3]=e[h+1],r[4]=e[c],r[5]=e[c+1],D0.contains(uu.x,uu.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}};N0.BATCHABLE_SIZE=100;let du=N0;class O0 extends Mr{constructor(t,e,r){super();const n=new jt(t),s=new jt(e,!0),o=new jt(r,!0,!0);this.addAttribute("aVertexPosition",n,2,!1,ct.FLOAT).addAttribute("aTextureCoord",s,2,!1,ct.FLOAT).addIndex(o),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}var qS=`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
- `,AS=`attribute vec2 aVertexPosition;
932
+ `,t2=`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 lu extends Ri{constructor(t,e){const i={uSampler:t,alpha:1,uTextureMatrix:Dt.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||sr.from(AS,IS),i),this._colorDirty=!1,this.uvMatrix=new Tm(t),this.batchable=e.program===void 0,this.pluginName=e.pluginName,this._tintColor=new kt(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;kt.shared.setValue(this._tintColor).premultiply(this._alpha,t).toArray(this.uniforms.uColor)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}}class MS extends Cg{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 p=h.x-t[d].x,m=h.y-t[d].y,g=Math.sqrt(p*p+m*m);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 RS extends hu{constructor(t,e,i=0){const s=new MS(t.height,e,i),n=new lu(t);i>0&&(t.baseTexture.wrapMode=vi.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 Ig{constructor(t,e,i){this.geometry=new Cr,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||ct.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 zt($1(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 zt(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 zt(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===ct.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===ct.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===ct.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===ct.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 PS=`varying vec2 vTextureCoord;
947
+ `;class fu extends Pi{constructor(t,e){const r={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(r,e.uniforms),super(e.program||sr.from(t2,qS),r),this._colorDirty=!1,this.uvMatrix=new Fm(t),this.batchable=e.program===void 0,this.pluginName=e.pluginName,this._tintColor=new Dt(e.tint),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0,this.alpha=e.alpha}get texture(){return this.uniforms.uSampler}set texture(t){this.uniforms.uSampler!==t&&(!this.uniforms.uSampler.baseTexture.alphaMode!=!t.baseTexture.alphaMode&&(this._colorDirty=!0),this.uniforms.uSampler=t,this.uvMatrix.texture=t)}set alpha(t){t!==this._alpha&&(this._alpha=t,this._colorDirty=!0)}get alpha(){return this._alpha}set tint(t){t!==this.tint&&(this._tintColor.setValue(t),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0)}get tint(){return this._tintColor.value}get tintValue(){return this._tintColor.toNumber()}update(){if(this._colorDirty){this._colorDirty=!1;const t=this.texture.baseTexture.alphaMode;Dt.shared.setValue(this._tintColor).premultiply(this._alpha,t).toArray(this.uniforms.uColor)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}}class e2 extends O0{constructor(t=200,e,r=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=r,this.build()}get width(){return this._width}build(){const t=this.points;if(!t)return;const e=this.getBuffer("aVertexPosition"),r=this.getBuffer("aTextureCoord"),n=this.getIndex();if(t.length<1)return;e.data.length/4!==t.length&&(e.data=new Float32Array(t.length*4),r.data=new Float32Array(t.length*4),n.data=new Uint16Array((t.length-1)*6));const s=r.data,o=n.data;s[0]=0,s[1]=0,s[2]=0,s[3]=1;let a=0,l=t[0];const h=this._width*this.textureScale,c=t.length;for(let d=0;d<c;d++){const f=d*4;if(this.textureScale>0){const p=l.x-t[d].x,m=l.y-t[d].y,g=Math.sqrt(p*p+m*m);l=t[d],a+=g/h}else a=d/(c-1);s[f]=a,s[f+1]=0,s[f+2]=a,s[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}r.update(),n.update(),this.updateVertices()}updateVertices(){const t=this.points;if(t.length<1)return;let e=t[0],r,n=0,s=0;const o=this.buffers[0].data,a=t.length,l=this.textureScale>0?this.textureScale*this._width/2:this._width/2;for(let h=0;h<a;h++){const c=t[h],u=h*4;h<t.length-1?r=t[h+1]:r=c,s=-(r.x-e.x),n=r.y-e.y;const d=Math.sqrt(n*n+s*s);d<1e-6?(n=0,s=0):(n/=d,s/=d,n*=l,s*=l),o[u]=c.x+n,o[u+1]=c.y+s,o[u+2]=c.x-n,o[u+3]=c.y-s,e=c}this.buffers[0].update()}update(){this.textureScale>0?this.build():this.updateVertices()}}class i2 extends du{constructor(t,e,r=0){const n=new e2(t.height,e,r),s=new fu(t);r>0&&(t.baseTexture.wrapMode=wi.REPEAT),super(n,s),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 B0{constructor(t,e,r){this.geometry=new Mr,this.indexBuffer=null,this.size=r,this.dynamicProperties=[],this.staticProperties=[];for(let n=0;n<t.length;++n){let s=t[n];s={attributeName:s.attributeName,size:s.size,uploadFunction:s.uploadFunction,type:s.type||ct.FLOAT,offset:s.offset},e[n]?this.dynamicProperties.push(s):this.staticProperties.push(s)}this.staticStride=0,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.dynamicStride=0,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this._updateID=0,this.initBuffers()}initBuffers(){const t=this.geometry;let e=0;this.indexBuffer=new jt(Tv(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 r=new ArrayBuffer(this.size*this.dynamicStride*4*4);this.dynamicData=new Float32Array(r),this.dynamicDataUint32=new Uint32Array(r),this.dynamicBuffer=new jt(this.dynamicData,!1,!1);let n=0;this.staticStride=0;for(let o=0;o<this.staticProperties.length;++o){const a=this.staticProperties[o];a.offset=n,n+=a.size,this.staticStride+=a.size}const s=new ArrayBuffer(this.size*this.staticStride*4*4);this.staticData=new Float32Array(s),this.staticDataUint32=new Uint32Array(s),this.staticBuffer=new jt(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===ct.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===ct.UNSIGNED_BYTE,a.type,this.staticStride*4,a.offset*4)}}uploadDynamic(t,e,r){for(let n=0;n<this.dynamicProperties.length;n++){const s=this.dynamicProperties[n];s.uploadFunction(t,e,r,s.type===ct.UNSIGNED_BYTE?this.dynamicDataUint32:this.dynamicData,this.dynamicStride,s.offset)}this.dynamicBuffer._updateID++}uploadStatic(t,e,r){for(let n=0;n<this.staticProperties.length;n++){const s=this.staticProperties[n];s.uploadFunction(t,e,r,s.type===ct.UNSIGNED_BYTE?this.staticDataUint32:this.staticData,this.staticStride,s.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 r2=`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
- }`,LS=`attribute vec2 aVertexPosition;
955
+ }`,n2=`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 Ag extends Na{constructor(t){super(t),this.shader=null,this.properties=null,this.tempMatrix=new Dt,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:ct.UNSIGNED_BYTE,uploadFunction:this.uploadTint,offset:0}],this.shader=Ri.from(LS,PS,{}),this.state=Mi.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=Hp(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=kt.shared.setValue(t.tintRgb).premultiply(t.worldAlpha,l).toArray(this.shader.uniforms.uColor),this.shader.uniforms.uSampler=h,this.renderer.shader.bind(this.shader);let d=!1;for(let f=0,p=0;f<o;f+=s,p+=1){let m=o-f;m>s&&(m=s),p>=a.length&&a.push(this._generateOneMoreBuffer(t));const g=a[p];g.uploadDynamic(e,f,m);const y=t._bufferUpdateIDs[p]||0;d=d||g._updateID<y,d&&(g._updateID=t._updateID,g.uploadStatic(e,f,m)),n.geometry.bind(g.geometry),c.drawElements(c.TRIANGLES,m*6,c.UNSIGNED_SHORT,0)}}generateBuffers(t){const e=[],i=t._maxSize,s=t._batchSize,n=t._properties;for(let o=0;o<i;o+=s)e.push(new Ig(this.properties,n,s));return e}_generateOneMoreBuffer(t){const e=t._batchSize,i=t._properties;return new Ig(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,p=d.scale.x,m=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*p,s[o+1]=c*m,s[o+n]=a*p,s[o+n+1]=c*m,s[o+n*2]=a*p,s[o+n*2+1]=l*m,s[o+n*3]=h*p,s[o+n*3+1]=l*m,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=kt.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}}Ag.extension={name:"particle",type:q.RendererPlugin},nt.add(Ag);var nh=(r=>(r[r.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",r[r.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",r))(nh||{});const oh={willReadFrequently:!0},Pi=class ht{static get experimentalLetterSpacingSupported(){let t=ht._experimentalLetterSpacingSupported;if(t!==void 0){const e=st.ADAPTER.getCanvasRenderingContext2D().prototype;t=ht._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=ht._canvas){i=i??e.wordWrap;const n=e.toFontString(),o=ht.measureFont(n);o.fontSize===0&&(o.fontSize=e.fontSize,o.ascent=e.fontSize);const a=s.getContext("2d",oh);a.font=n;const h=(i?ht.wordWrap(t,e,s):t).split(/(?:\r\n|\r|\n)/),l=new Array(h.length);let c=0;for(let p=0;p<h.length;p++){const m=ht._measureText(h[p],e.letterSpacing,a);l[p]=m,c=Math.max(c,m)}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 ht(t,e,u,f,h,l,d+e.leading,c,o)}static _measureText(t,e,i){let s=!1;ht.experimentalLetterSpacingSupported&&(ht.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+=(ht.graphemeSegmenter(t).length-1)*e),n}static wordWrap(t,e,i=ht._canvas){const s=i.getContext("2d",oh);let n=0,o="",a="";const h=Object.create(null),{letterSpacing:l,whiteSpace:c}=e,u=ht.collapseSpaces(c),d=ht.collapseNewlines(c);let f=!u;const p=e.wordWrapWidth+l,m=ht.tokenize(t);for(let g=0;g<m.length;g++){let y=m[g];if(ht.isNewline(y)){if(!d){a+=ht.addLine(o),f=!u,o="",n=0;continue}y=" "}if(u){const b=ht.isBreakingSpace(y),v=ht.isBreakingSpace(o[o.length-1]);if(b&&v)continue}const x=ht.getFromCache(y,l,h,s);if(x>p)if(o!==""&&(a+=ht.addLine(o),o="",n=0),ht.canBreakWords(y,e.breakWords)){const b=ht.wordWrapSplit(y);for(let v=0;v<b.length;v++){let w=b[v],S=w,C=1;for(;b[v+C];){const M=b[v+C];if(!ht.canBreakChars(S,M,y,v,e.breakWords))w+=M;else break;S=M,C++}v+=C-1;const I=ht.getFromCache(w,l,h,s);I+n>p&&(a+=ht.addLine(o),f=!1,o="",n=0),o+=w,n+=I}}else{o.length>0&&(a+=ht.addLine(o),o="",n=0);const b=g===m.length-1;a+=ht.addLine(y,!b),f=!1,o="",n=0}else x+n>p&&(f=!1,a+=ht.addLine(o),o="",n=0),(o.length>0||!ht.isBreakingSpace(y)||f)&&(o+=y,n+=x)}return a+=ht.addLine(o,!1),a}static addLine(t,e=!0){return t=ht.trimRight(t),t=e?`${t}
981
- `:t,t}static getFromCache(t,e,i,s){let n=i[t];return typeof n!="number"&&(n=ht._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(!ht.isBreakingSpace(i))break;t=t.slice(0,-1)}return t}static isNewline(t){return typeof t!="string"?!1:ht._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:ht._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(ht.isBreakingSpace(n,o)||ht.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 ht.graphemeSegmenter(t)}static measureFont(t){if(ht._fonts[t])return ht._fonts[t];const e={ascent:0,descent:0,fontSize:0},i=ht._canvas,s=ht._context;s.font=t;const n=ht.METRICS_STRING+ht.BASELINE_SYMBOL,o=Math.ceil(s.measureText(n).width);let a=Math.ceil(s.measureText(ht.BASELINE_SYMBOL).width);const h=Math.ceil(ht.HEIGHT_MULTIPLIER*a);if(a=a*ht.BASELINE_MULTIPLIER|0,o===0||h===0)return ht._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,p=!1;for(d=0;d<a;++d){for(let m=0;m<u;m+=4)if(l[f+m]!==255){p=!0;break}if(!p)f+=u;else break}for(e.ascent=a-d,f=c-u,p=!1,d=h;d>a;--d){for(let m=0;m<u;m+=4)if(l[f+m]!==255){p=!0;break}if(!p)f-=u;else break}return e.descent=d-a,e.fontSize=e.ascent+e.descent,ht._fonts[t]=e,e}static clearMetrics(t=""){t?delete ht._fonts[t]:ht._fonts={}}static get _canvas(){var t;if(!ht.__canvas){let e;try{const i=new OffscreenCanvas(0,0);if((t=i.getContext("2d",oh))!=null&&t.measureText)return ht.__canvas=i,i;e=st.ADAPTER.createCanvas()}catch{e=st.ADAPTER.createCanvas()}e.width=e.height=10,ht.__canvas=e}return ht.__canvas}static get _context(){return ht.__context||(ht.__context=ht._canvas.getContext("2d",oh)),ht.__context}};Pi.METRICS_STRING="|ÉqÅ",Pi.BASELINE_SYMBOL="M",Pi.BASELINE_MULTIPLIER=1.4,Pi.HEIGHT_MULTIPLIER=2,Pi.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]})(),Pi.experimentalLetterSpacing=!1,Pi._fonts={},Pi._newlines=[10,13],Pi._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let Pr=Pi;const GS=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],Mg=class na{constructor(t){this.styleID=0,this.reset(),uu(this,t,t)}clone(){const t={};return uu(t,this,na.defaultStyle),new na(t)}reset(){uu(this,na.defaultStyle,na.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=cu(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=cu(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){FS(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=cu(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)&&!GS.includes(s)&&(s=`"${s}"`),e[i]=s}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${t} ${e.join(",")}`}};Mg.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:nh.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 Lr=Mg;function cu(r){const t=kt.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 FS(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 uu(r,t,e){for(const i in e)Array.isArray(t[i])?r[i]=t[i].slice():r[i]=t[i]}const NS={texture:!0,children:!1,baseTexture:!0},Rg=class Rf extends $t{constructor(t,e,i){let s=!1;i||(i=st.ADAPTER.createCanvas(),s=!0),i.width=3,i.height=3;const n=ot.from(i);n.orig=new gt,n.trim=new gt,super(n),this._ownCanvas=s,this.canvas=i,this.context=i.getContext("2d",{willReadFrequently:!0}),this._resolution=Rf.defaultResolution??st.RESOLUTION,this._autoResolution=Rf.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 Pr.experimentalLetterSpacing}static set experimentalLetterSpacing(t){wt("7.1.0","Text.experimentalLetterSpacing is deprecated, use TextMetrics.experimentalLetterSpacing"),Pr.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=Pr.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 p=e.dropShadow?2:1;for(let m=0;m<p;++m){const g=e.dropShadow&&m===0,y=g?Math.ceil(Math.max(1,o)+e.padding*2):0,x=y*this._resolution;if(g){i.fillStyle="black",i.strokeStyle="black";const v=e.dropShadowColor,w=e.dropShadowBlur*this._resolution,S=e.dropShadowDistance*this._resolution;i.shadowColor=kt.shared.setValue(v).setAlpha(e.dropShadowAlpha).toRgbaString(),i.shadowBlur=w,i.shadowOffsetX=Math.cos(e.dropShadowAngle)*S,i.shadowOffsetY=Math.sin(e.dropShadowAngle)*S+x}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(Pr.experimentalLetterSpacingSupported&&(Pr.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=Pr.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 p=u+1;p<h.length;++p)f+=h[p];c=this.context.measureText(f).width,a+=l-c+n,l=c}}updateTexture(){const t=this.canvas;if(this._style.trim){const o=ev(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===nh.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 p=i.lineHeight*(f-1)+d,m=i.lineHeight*f;let g=m;f>0&&p>m&&(g=(m+p)/2);const y=m+d,x=i.lineHeight*(f+1);let b=y;f+1<e.length&&x<y&&(b=(y+x)/2);const v=(b-g)/l;for(let w=0;w<c.length;w++){let S=0;typeof u[w]=="number"?S=u[w]:S=w/c.length;let C=Math.min(1,Math.max(0,g/l+S*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 p=0;p<c.length;p++){let m;typeof u[p]=="number"?m=u[p]:m=f/d,n.addColorStop(m,c[p]),f++}}return n}destroy(t){typeof t=="boolean"&&(t={children:t}),t=Object.assign({},NS,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=Sr(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=Sr(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 Lr?this._style=t:this._style=new Lr(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)}};Rg.defaultAutoResolution=!0;let Pg=Rg;class kS{constructor(t){this.maxItemsPerFrame=t,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function DS(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 ot){const n=r._textures[s].baseTexture;t.includes(n)||(t.push(n),e=!0)}}return e}function OS(r,t){if(r.baseTexture instanceof xt){const e=r.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function BS(r,t){if(r._texture&&r._texture instanceof ot){const e=r._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function US(r,t){return t instanceof Pg?(t.updateText(!0),!0):!1}function XS(r,t){if(t instanceof Lr){const e=t.toFontString();return Pr.measureFont(e),!0}return!1}function WS(r,t){if(r instanceof Pg){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 ZS(r,t){return r instanceof Lr?(t.includes(r)||t.push(r),!0):!1}const Lg=class tx{constructor(t){this.limiter=new kS(tx.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(ZS),this.registerFindHook(DS),this.registerFindHook(OS),this.registerFindHook(BS),this.registerUploadHook(US),this.registerUploadHook(XS)}upload(t){return new Promise(e=>{t&&this.add(t),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,Te.system.addOnce(this.tick,this,us.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)Te.system.addOnce(this.tick,this,us.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 Ct)for(let e=t.children.length-1;e>=0;e--)this.add(t.children[e]);return this}destroy(){this.ticking&&Te.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}};Lg.uploadsPerFrame=4;let du=Lg;Object.defineProperties(st,{UPLOADS_PER_FRAME:{get(){return du.uploadsPerFrame},set(r){wt("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),du.uploadsPerFrame=r}}});function Gg(r,t){return t instanceof xt?(t._glTextures[r.CONTEXT_UID]||r.texture.bind(t),!0):!1}function VS(r,t){if(!(t instanceof ln))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&&Gg(r,n.baseTexture)}return e.batchable||r.geometry.bind(e,t._resolveDirectShader(r)),!0}function HS(r,t){return r instanceof ln?(t.push(r),!0):!1}class Fg extends du{constructor(t){super(t),this.uploadHookHelper=this.renderer,this.registerFindHook(HS),this.registerUploadHook(Gg),this.registerUploadHook(VS)}}Fg.extension={name:"prepare",type:q.RendererSystem},nt.add(Fg);var KS=`#version 300 es
980
+ `;class U0 extends Oa{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:ct.UNSIGNED_BYTE,uploadFunction:this.uploadTint,offset:0}],this.shader=Pi.from(n2,r2,{}),this.state=Ri.for2d()}render(t){const e=t.children,r=t._maxSize,n=t._batchSize,s=this.renderer;let o=e.length;if(o===0)return;o>r&&!t.autoResize&&(o=r);let a=t._buffers;a||(a=t._buffers=this.generateBuffers(t));const l=e[0]._texture.baseTexture,h=l.alphaMode>0;this.state.blendMode=rm(t.blendMode,h),s.state.set(this.state);const c=s.gl,u=t.worldTransform.copyTo(this.tempMatrix);u.prepend(s.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=u.toArray(!0),this.shader.uniforms.uColor=Dt.shared.setValue(t.tintRgb).premultiply(t.worldAlpha,h).toArray(this.shader.uniforms.uColor),this.shader.uniforms.uSampler=l,this.renderer.shader.bind(this.shader);let d=!1;for(let f=0,p=0;f<o;f+=n,p+=1){let m=o-f;m>n&&(m=n),p>=a.length&&a.push(this._generateOneMoreBuffer(t));const g=a[p];g.uploadDynamic(e,f,m);const y=t._bufferUpdateIDs[p]||0;d=d||g._updateID<y,d&&(g._updateID=t._updateID,g.uploadStatic(e,f,m)),s.geometry.bind(g.geometry),c.drawElements(c.TRIANGLES,m*6,c.UNSIGNED_SHORT,0)}}generateBuffers(t){const e=[],r=t._maxSize,n=t._batchSize,s=t._properties;for(let o=0;o<r;o+=n)e.push(new B0(this.properties,s,n));return e}_generateOneMoreBuffer(t){const e=t._batchSize,r=t._properties;return new B0(this.properties,r,e)}uploadVertices(t,e,r,n,s,o){let a=0,l=0,h=0,c=0;for(let u=0;u<r;++u){const d=t[e+u],f=d._texture,p=d.scale.x,m=d.scale.y,g=f.trim,y=f.orig;g?(l=g.x-d.anchor.x*y.width,a=l+g.width,c=g.y-d.anchor.y*y.height,h=c+g.height):(a=y.width*(1-d.anchor.x),l=y.width*-d.anchor.x,h=y.height*(1-d.anchor.y),c=y.height*-d.anchor.y),n[o]=l*p,n[o+1]=c*m,n[o+s]=a*p,n[o+s+1]=c*m,n[o+s*2]=a*p,n[o+s*2+1]=h*m,n[o+s*3]=l*p,n[o+s*3+1]=h*m,o+=s*4}}uploadPosition(t,e,r,n,s,o){for(let a=0;a<r;a++){const l=t[e+a].position;n[o]=l.x,n[o+1]=l.y,n[o+s]=l.x,n[o+s+1]=l.y,n[o+s*2]=l.x,n[o+s*2+1]=l.y,n[o+s*3]=l.x,n[o+s*3+1]=l.y,o+=s*4}}uploadRotation(t,e,r,n,s,o){for(let a=0;a<r;a++){const l=t[e+a].rotation;n[o]=l,n[o+s]=l,n[o+s*2]=l,n[o+s*3]=l,o+=s*4}}uploadUvs(t,e,r,n,s,o){for(let a=0;a<r;++a){const l=t[e+a]._texture._uvs;l?(n[o]=l.x0,n[o+1]=l.y0,n[o+s]=l.x1,n[o+s+1]=l.y1,n[o+s*2]=l.x2,n[o+s*2+1]=l.y2,n[o+s*3]=l.x3,n[o+s*3+1]=l.y3,o+=s*4):(n[o]=0,n[o+1]=0,n[o+s]=0,n[o+s+1]=0,n[o+s*2]=0,n[o+s*2+1]=0,n[o+s*3]=0,n[o+s*3+1]=0,o+=s*4)}}uploadTint(t,e,r,n,s,o){for(let a=0;a<r;++a){const l=t[e+a],h=Dt.shared.setValue(l._tintRGB).toPremultiplied(l.alpha,l.texture.baseTexture.alphaMode>0);n[o]=h,n[o+s]=h,n[o+s*2]=h,n[o+s*3]=h,o+=s*4}}destroy(){super.destroy(),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null}}U0.extension={name:"particle",type:q.RendererPlugin},st.add(U0);var ll=(i=>(i[i.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",i[i.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",i))(ll||{});const hl={willReadFrequently:!0},Li=class lt{static get experimentalLetterSpacingSupported(){let t=lt._experimentalLetterSpacingSupported;if(t!==void 0){const e=nt.ADAPTER.getCanvasRenderingContext2D().prototype;t=lt._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,r,n,s,o,a,l,h){this.text=t,this.style=e,this.width=r,this.height=n,this.lines=s,this.lineWidths=o,this.lineHeight=a,this.maxLineWidth=l,this.fontProperties=h}static measureText(t,e,r,n=lt._canvas){r=r??e.wordWrap;const s=e.toFontString(),o=lt.measureFont(s);o.fontSize===0&&(o.fontSize=e.fontSize,o.ascent=e.fontSize);const a=n.getContext("2d",hl);a.font=s;const l=(r?lt.wordWrap(t,e,n):t).split(/(?:\r\n|\r|\n)/),h=new Array(l.length);let c=0;for(let p=0;p<l.length;p++){const m=lt._measureText(l[p],e.letterSpacing,a);h[p]=m,c=Math.max(c,m)}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+(l.length-1)*(d+e.leading);return e.dropShadow&&(f+=e.dropShadowDistance),new lt(t,e,u,f,l,h,d+e.leading,c,o)}static _measureText(t,e,r){let n=!1;lt.experimentalLetterSpacingSupported&&(lt.experimentalLetterSpacing?(r.letterSpacing=`${e}px`,r.textLetterSpacing=`${e}px`,n=!0):(r.letterSpacing="0px",r.textLetterSpacing="0px"));let s=r.measureText(t).width;return s>0&&(n?s-=e:s+=(lt.graphemeSegmenter(t).length-1)*e),s}static wordWrap(t,e,r=lt._canvas){const n=r.getContext("2d",hl);let s=0,o="",a="";const l=Object.create(null),{letterSpacing:h,whiteSpace:c}=e,u=lt.collapseSpaces(c),d=lt.collapseNewlines(c);let f=!u;const p=e.wordWrapWidth+h,m=lt.tokenize(t);for(let g=0;g<m.length;g++){let y=m[g];if(lt.isNewline(y)){if(!d){a+=lt.addLine(o),f=!u,o="",s=0;continue}y=" "}if(u){const b=lt.isBreakingSpace(y),v=lt.isBreakingSpace(o[o.length-1]);if(b&&v)continue}const x=lt.getFromCache(y,h,l,n);if(x>p)if(o!==""&&(a+=lt.addLine(o),o="",s=0),lt.canBreakWords(y,e.breakWords)){const b=lt.wordWrapSplit(y);for(let v=0;v<b.length;v++){let w=b[v],S=w,C=1;for(;b[v+C];){const M=b[v+C];if(!lt.canBreakChars(S,M,y,v,e.breakWords))w+=M;else break;S=M,C++}v+=C-1;const I=lt.getFromCache(w,h,l,n);I+s>p&&(a+=lt.addLine(o),f=!1,o="",s=0),o+=w,s+=I}}else{o.length>0&&(a+=lt.addLine(o),o="",s=0);const b=g===m.length-1;a+=lt.addLine(y,!b),f=!1,o="",s=0}else x+s>p&&(f=!1,a+=lt.addLine(o),o="",s=0),(o.length>0||!lt.isBreakingSpace(y)||f)&&(o+=y,s+=x)}return a+=lt.addLine(o,!1),a}static addLine(t,e=!0){return t=lt.trimRight(t),t=e?`${t}
981
+ `:t,t}static getFromCache(t,e,r,n){let s=r[t];return typeof s!="number"&&(s=lt._measureText(t,e,n)+e,r[t]=s),s}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 r=t[e];if(!lt.isBreakingSpace(r))break;t=t.slice(0,-1)}return t}static isNewline(t){return typeof t!="string"?!1:lt._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:lt._breakingSpaces.includes(t.charCodeAt(0))}static tokenize(t){const e=[];let r="";if(typeof t!="string")return e;for(let n=0;n<t.length;n++){const s=t[n],o=t[n+1];if(lt.isBreakingSpace(s,o)||lt.isNewline(s)){r!==""&&(e.push(r),r=""),e.push(s);continue}r+=s}return r!==""&&e.push(r),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,r,n,s){return!0}static wordWrapSplit(t){return lt.graphemeSegmenter(t)}static measureFont(t){if(lt._fonts[t])return lt._fonts[t];const e={ascent:0,descent:0,fontSize:0},r=lt._canvas,n=lt._context;n.font=t;const s=lt.METRICS_STRING+lt.BASELINE_SYMBOL,o=Math.ceil(n.measureText(s).width);let a=Math.ceil(n.measureText(lt.BASELINE_SYMBOL).width);const l=Math.ceil(lt.HEIGHT_MULTIPLIER*a);if(a=a*lt.BASELINE_MULTIPLIER|0,o===0||l===0)return lt._fonts[t]=e,e;r.width=o,r.height=l,n.fillStyle="#f00",n.fillRect(0,0,o,l),n.font=t,n.textBaseline="alphabetic",n.fillStyle="#000",n.fillText(s,0,a);const h=n.getImageData(0,0,o,l).data,c=h.length,u=o*4;let d=0,f=0,p=!1;for(d=0;d<a;++d){for(let m=0;m<u;m+=4)if(h[f+m]!==255){p=!0;break}if(!p)f+=u;else break}for(e.ascent=a-d,f=c-u,p=!1,d=l;d>a;--d){for(let m=0;m<u;m+=4)if(h[f+m]!==255){p=!0;break}if(!p)f-=u;else break}return e.descent=d-a,e.fontSize=e.ascent+e.descent,lt._fonts[t]=e,e}static clearMetrics(t=""){t?delete lt._fonts[t]:lt._fonts={}}static get _canvas(){var t;if(!lt.__canvas){let e;try{const r=new OffscreenCanvas(0,0);if((t=r.getContext("2d",hl))!=null&&t.measureText)return lt.__canvas=r,r;e=nt.ADAPTER.createCanvas()}catch{e=nt.ADAPTER.createCanvas()}e.width=e.height=10,lt.__canvas=e}return lt.__canvas}static get _context(){return lt.__context||(lt.__context=lt._canvas.getContext("2d",hl)),lt.__context}};Li.METRICS_STRING="|ÉqÅ",Li.BASELINE_SYMBOL="M",Li.BASELINE_MULTIPLIER=1.4,Li.HEIGHT_MULTIPLIER=2,Li.graphemeSegmenter=(()=>{if(typeof(Intl==null?void 0:Intl.Segmenter)=="function"){const i=new Intl.Segmenter;return t=>[...i.segment(t)].map(e=>e.segment)}return i=>[...i]})(),Li.experimentalLetterSpacing=!1,Li._fonts={},Li._newlines=[10,13],Li._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let kr=Li;const s2=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],X0=class la{constructor(t){this.styleID=0,this.reset(),mu(this,t,t)}clone(){const t={};return mu(t,this,la.defaultStyle),new la(t)}reset(){mu(this,la.defaultStyle,la.defaultStyle)}get align(){return this._align}set align(t){this._align!==t&&(this._align=t,this.styleID++)}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords!==t&&(this._breakWords=t,this.styleID++)}get dropShadow(){return this._dropShadow}set dropShadow(t){this._dropShadow!==t&&(this._dropShadow=t,this.styleID++)}get dropShadowAlpha(){return this._dropShadowAlpha}set dropShadowAlpha(t){this._dropShadowAlpha!==t&&(this._dropShadowAlpha=t,this.styleID++)}get dropShadowAngle(){return this._dropShadowAngle}set dropShadowAngle(t){this._dropShadowAngle!==t&&(this._dropShadowAngle=t,this.styleID++)}get dropShadowBlur(){return this._dropShadowBlur}set dropShadowBlur(t){this._dropShadowBlur!==t&&(this._dropShadowBlur=t,this.styleID++)}get dropShadowColor(){return this._dropShadowColor}set dropShadowColor(t){const e=pu(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=pu(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){o2(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=pu(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 r=e.length-1;r>=0;r--){let n=e[r].trim();!/([\"\'])[^\'\"]+\1/.test(n)&&!s2.includes(n)&&(n=`"${n}"`),e[r]=n}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${t} ${e.join(",")}`}};X0.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:ll.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 Fr=X0;function pu(i){const t=Dt.shared,e=r=>{const n=t.setValue(r);return n.alpha===1?n.toHex():n.toRgbaString()};return Array.isArray(i)?i.map(e):e(i)}function o2(i,t){if(!Array.isArray(i)||!Array.isArray(t)||i.length!==t.length)return!1;for(let e=0;e<i.length;++e)if(i[e]!==t[e])return!1;return!0}function mu(i,t,e){for(const r in e)Array.isArray(t[r])?i[r]=t[r].slice():i[r]=t[r]}const a2={texture:!0,children:!1,baseTexture:!0},W0=class Wf extends Qt{constructor(t,e,r){let n=!1;r||(r=nt.ADAPTER.createCanvas(),n=!0),r.width=3,r.height=3;const s=ot.from(r);s.orig=new gt,s.trim=new gt,super(s),this._ownCanvas=n,this.canvas=r,this.context=r.getContext("2d",{willReadFrequently:!0}),this._resolution=Wf.defaultResolution??nt.RESOLUTION,this._autoResolution=Wf.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 kr.experimentalLetterSpacing}static set experimentalLetterSpacing(t){wt("7.1.0","Text.experimentalLetterSpacing is deprecated, use TextMetrics.experimentalLetterSpacing"),kr.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 r=this.context,n=kr.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),s=n.width,o=n.height,a=n.lines,l=n.lineHeight,h=n.lineWidths,c=n.maxLineWidth,u=n.fontProperties;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,s)+e.padding*2)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,o)+e.padding*2)*this._resolution),r.scale(this._resolution,this._resolution),r.clearRect(0,0,this.canvas.width,this.canvas.height),r.font=this._font,r.lineWidth=e.strokeThickness,r.textBaseline=e.textBaseline,r.lineJoin=e.lineJoin,r.miterLimit=e.miterLimit;let d,f;const p=e.dropShadow?2:1;for(let m=0;m<p;++m){const g=e.dropShadow&&m===0,y=g?Math.ceil(Math.max(1,o)+e.padding*2):0,x=y*this._resolution;if(g){r.fillStyle="black",r.strokeStyle="black";const v=e.dropShadowColor,w=e.dropShadowBlur*this._resolution,S=e.dropShadowDistance*this._resolution;r.shadowColor=Dt.shared.setValue(v).setAlpha(e.dropShadowAlpha).toRgbaString(),r.shadowBlur=w,r.shadowOffsetX=Math.cos(e.dropShadowAngle)*S,r.shadowOffsetY=Math.sin(e.dropShadowAngle)*S+x}else r.fillStyle=this._generateFillStyle(e,a,n),r.strokeStyle=e.stroke,r.shadowColor="black",r.shadowBlur=0,r.shadowOffsetX=0,r.shadowOffsetY=0;let b=(l-u.fontSize)/2;l-u.fontSize<0&&(b=0);for(let v=0;v<a.length;v++)d=e.strokeThickness/2,f=e.strokeThickness/2+v*l+u.ascent+b,e.align==="right"?d+=c-h[v]:e.align==="center"&&(d+=(c-h[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,r,n=!1){const s=this._style.letterSpacing;let o=!1;if(kr.experimentalLetterSpacingSupported&&(kr.experimentalLetterSpacing?(this.context.letterSpacing=`${s}px`,this.context.textLetterSpacing=`${s}px`,o=!0):(this.context.letterSpacing="0px",this.context.textLetterSpacing="0px")),s===0||o){n?this.context.strokeText(t,e,r):this.context.fillText(t,e,r);return}let a=e;const l=kr.graphemeSegmenter(t);let h=this.context.measureText(t).width,c=0;for(let u=0;u<l.length;++u){const d=l[u];n?this.context.strokeText(d,a,r):this.context.fillText(d,a,r);let f="";for(let p=u+1;p<l.length;++p)f+=l[p];c=this.context.measureText(f).width,a+=h-c+s,h=c}}updateTexture(){const t=this.canvas;if(this._style.trim){const o=Iv(t);o.data&&(t.width=o.width,t.height=o.height,this.context.putImageData(o.data,0,0))}const e=this._texture,r=this._style,n=r.trim?0:r.padding,s=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=-n,e.trim.y=-n,e.orig.width=e._frame.width-n*2,e.orig.height=e._frame.height-n*2,this._onTextureUpdate(),s.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,r){const n=t.fill;if(Array.isArray(n)){if(n.length===1)return n[0]}else return n;let s;const o=t.dropShadow?t.dropShadowDistance:0,a=t.padding||0,l=this.canvas.width/this._resolution-o-a*2,h=this.canvas.height/this._resolution-o-a*2,c=n.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(n[0]),u.unshift(0),c.push(n[n.length-1]),u.push(1),t.fillGradientType===ll.LINEAR_VERTICAL){s=this.context.createLinearGradient(l/2,a,l/2,h+a);const d=r.fontProperties.fontSize+t.strokeThickness;for(let f=0;f<e.length;f++){const p=r.lineHeight*(f-1)+d,m=r.lineHeight*f;let g=m;f>0&&p>m&&(g=(m+p)/2);const y=m+d,x=r.lineHeight*(f+1);let b=y;f+1<e.length&&x<y&&(b=(y+x)/2);const v=(b-g)/h;for(let w=0;w<c.length;w++){let S=0;typeof u[w]=="number"?S=u[w]:S=w/c.length;let C=Math.min(1,Math.max(0,g/h+S*v));C=Number(C.toFixed(5)),s.addColorStop(C,c[w])}}}else{s=this.context.createLinearGradient(a,h/2,l+a,h/2);const d=c.length+1;let f=1;for(let p=0;p<c.length;p++){let m;typeof u[p]=="number"?m=u[p]:m=f/d,s.addColorStop(m,c[p]),f++}}return s}destroy(t){typeof t=="boolean"&&(t={children:t}),t=Object.assign({},a2,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=Ir(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=Ir(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 Fr?this._style=t:this._style=new Fr(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)}};W0.defaultAutoResolution=!0;let Z0=W0;class l2{constructor(t){this.maxItemsPerFrame=t,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function h2(i,t){var r;let e=!1;if((r=i==null?void 0:i._textures)!=null&&r.length){for(let n=0;n<i._textures.length;n++)if(i._textures[n]instanceof ot){const s=i._textures[n].baseTexture;t.includes(s)||(t.push(s),e=!0)}}return e}function c2(i,t){if(i.baseTexture instanceof xt){const e=i.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function u2(i,t){if(i._texture&&i._texture instanceof ot){const e=i._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function d2(i,t){return t instanceof Z0?(t.updateText(!0),!0):!1}function f2(i,t){if(t instanceof Fr){const e=t.toFontString();return kr.measureFont(e),!0}return!1}function p2(i,t){if(i instanceof Z0){t.includes(i.style)||t.push(i.style),t.includes(i)||t.push(i);const e=i._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function m2(i,t){return i instanceof Fr?(t.includes(i)||t.push(i),!0):!1}const V0=class C1{constructor(t){this.limiter=new l2(C1.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(p2),this.registerFindHook(m2),this.registerFindHook(h2),this.registerFindHook(c2),this.registerFindHook(u2),this.registerUploadHook(d2),this.registerUploadHook(f2)}upload(t){return new Promise(e=>{t&&this.add(t),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,Se.system.addOnce(this.tick,this,gn.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 r=0,n=this.uploadHooks.length;r<n;r++)if(this.uploadHooks[r](this.uploadHookHelper,t)){this.queue.shift(),e=!0;break}}e||this.queue.shift()}if(this.queue.length)Se.system.addOnce(this.tick,this,gn.UTILITY);else{this.ticking=!1;const t=this.completes.slice(0);this.completes.length=0;for(let e=0,r=t.length;e<r;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,r=this.addHooks.length;e<r&&!this.addHooks[e](t,this.queue);e++);if(t instanceof Ct)for(let e=t.children.length-1;e>=0;e--)this.add(t.children[e]);return this}destroy(){this.ticking&&Se.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}};V0.uploadsPerFrame=4;let gu=V0;Object.defineProperties(nt,{UPLOADS_PER_FRAME:{get(){return gu.uploadsPerFrame},set(i){wt("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),gu.uploadsPerFrame=i}}});function H0(i,t){return t instanceof xt?(t._glTextures[i.CONTEXT_UID]||i.texture.bind(t),!0):!1}function g2(i,t){if(!(t instanceof ds))return!1;const{geometry:e}=t;t.finishPoly(),e.updateBatches();const{batches:r}=e;for(let n=0;n<r.length;n++){const{texture:s}=r[n].style;s&&H0(i,s.baseTexture)}return e.batchable||i.geometry.bind(e,t._resolveDirectShader(i)),!0}function y2(i,t){return i instanceof ds?(t.push(i),!0):!1}class K0 extends gu{constructor(t){super(t),this.uploadHookHelper=this.renderer,this.registerFindHook(y2),this.registerUploadHook(H0),this.registerUploadHook(g2)}}K0.extension={name:"prepare",type:q.RendererSystem},st.add(K0);var b2=`#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
- `,YS=`#version 300 es
1007
+ `,x2=`#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
- `,zS=`#version 100
1027
+ `,_2=`#version 100
1028
1028
  #ifdef GL_EXT_shader_texture_lod
1029
1029
  #extension GL_EXT_shader_texture_lod : enable
1030
1030
  #endif
@@ -1057,7 +1057,7 @@ void main(void)
1057
1057
 
1058
1058
  gl_FragColor = texSample * uColor;
1059
1059
  }
1060
- `,Ng=`#version 100
1060
+ `,z0=`#version 100
1061
1061
  #define SHADER_NAME Tiling-Sprite-100
1062
1062
 
1063
1063
  precision lowp float;
@@ -1077,7 +1077,7 @@ void main(void)
1077
1077
 
1078
1078
  vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;
1079
1079
  }
1080
- `,jS=`#version 100
1080
+ `,v2=`#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 ah=new Dt;class kg extends Na{constructor(t){super(t),t.runners.contextChange.add(this),this.quad=new bm,this.state=Mi.for2d()}contextChange(){const t=this.renderer,e={globals:t.globalUniforms};this.simpleShader=Ri.from(Ng,jS,e),this.shader=t.context.webGLVersion>1?Ri.from(YS,KS,e):Ri.from(Ng,zS,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!==vi.CLAMP:h.wrapMode===vi.CLAMP&&(h.wrapMode=vi.REPEAT));const f=d?this.simpleShader:this.shader,p=a.width,m=a.height,g=t._width,y=t._height;ah.set(c.a*p/g,c.b*p/y,c.c*m/g,c.d*m/y,c.tx/g,c.ty/y),ah.invert(),d?ah.prepend(u.mapCoord):(f.uniforms.uMapCoord=u.mapCoord.toArray(!0),f.uniforms.uClampFrame=u.uClampFrame,f.uniforms.uClampOffset=u.uClampOffset),f.uniforms.uTransform=ah.toArray(!0),f.uniforms.uColor=kt.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=Hp(t.blendMode,l),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}kg.extension={name:"tilingSprite",type:q.RendererPlugin},nt.add(kg);const Dg=class oa{constructor(t,e,i=null){this.linkedSheets=[],this._texture=t instanceof ot?t:null,this.baseTexture=t instanceof xt?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=ir(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<=oa.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const i=oa.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 gt(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);n.rotated?a=new gt(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 gt(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 gt(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 ot(this.baseTexture,a,c,h,n.rotated?2:0,n.anchor,n.borders),ot.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*oa.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*oa.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=[]}};Dg.BATCH_SIZE=1e3;let Og=Dg;const JS=["jpg","png","jpeg","avif","webp"];function Bg(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=re.dirname(r[0]);t.linkedSheets.forEach((n,o)=>{const a=Bg([`${s}/${t.data.meta.related_multi_packs[o]}`],n,!0);Object.assign(i,a)})}return i}const $S={extension:q.Asset,cache:{test:r=>r instanceof Og,getCacheableAssets:(r,t)=>Bg(r,t,!1)},resolver:{test:r=>{const t=r.split("?")[0].split("."),e=t.pop(),i=t.pop();return e==="json"&&JS.includes(i)},parse:r=>{var e;const t=r.split(".");return{resolution:parseFloat(((e=st.RETINA_PREFIX.exec(r))==null?void 0:e[1])??"1"),format:t[t.length-2],src:r}}},loader:{name:"spritesheetLoader",extension:{type:q.LoadParser,priority:ui.Normal},async testParse(r,t){return re.extname(t.src).toLowerCase()===".json"&&!!r.frames},async parse(r,t,e){var h,l;let i=re.dirname(t.src);i&&i.lastIndexOf("/")!==i.length-1&&(i+="/");let s=i+r.meta.image;s=jc(s,t.src);const n=(await e.load([s]))[s],o=new Og(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=jc(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)}}};nt.add($S);class hh{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class lh{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),p=isNaN(f)?d:f;h[u]=p}i[o].push(h)}const s=new hh;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 fu{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 hh,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 pu{static test(t){return typeof t=="string"&&t.includes("<font>")?fu.test(st.ADAPTER.parseXML(t)):!1}static parse(t){return fu.parse(st.ADAPTER.parseXML(t))}}const mu=[lh,fu,pu];function QS(r){for(let t=0;t<mu.length;t++)if(mu[t].test(r))return mu[t];return null}function qS(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 p=d.length+1;for(let m=1;m<p;++m)f.push(m/p)}if(d.unshift(o[0]),f.unshift(0),d.push(o[o.length-1]),f.push(1),e.fillGradientType===nh.LINEAR_VERTICAL){a=t.createLinearGradient(c/2,l,c/2,u+l);let p=0;const m=(n.fontProperties.fontSize+e.strokeThickness)/u;for(let g=0;g<s.length;g++){const y=n.lineHeight*g;for(let x=0;x<d.length;x++){let b=0;typeof f[x]=="number"?b=f[x]:b=x/d.length;const v=y/u+b*m;let w=Math.max(p,v);w=Math.min(w,1),a.addColorStop(w,d[x]),p=w}}}else{a=t.createLinearGradient(l,u/2,c+l,u/2);const p=d.length+1;let m=1;for(let g=0;g<d.length;g++){let y;typeof f[g]=="number"?y=f[g]:y=m/p,a.addColorStop(y,d[g]),m++}}return a}function tE(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=qS(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=kt.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 ch(r){return r.codePointAt?r.codePointAt(0):r.charCodeAt(0)}function Ug(r){return Array.from?Array.from(r):r.split("")}function eE(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(...Ug(s))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}const Gr=class zi{constructor(t,e,i){var c;const[s]=t.info,[n]=t.common,[o]=t.page,[a]=t.distanceField,h=ir(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=Ee.NO_PREMULTIPLIED_ALPHA,l[d].baseTexture.mipmap=wi.OFF)}for(let u=0;u<t.char.length;u++){const{id:d,page:f}=t.char[u];let{x:p,y:m,width:g,height:y,xoffset:x,yoffset:b,xadvance:v}=t.char[u];p/=h,m/=h,g/=h,y/=h,x/=h,b/=h,v/=h;const w=new gt(p+l[f].frame.x/h,m+l[f].frame.y/h,g,y);this.chars[d]={xOffset:x,yOffset:b,xAdvance:v,kerning:{},texture:new ot(l[f].baseTexture,w),page:f}}for(let u=0;u<t.kerning.length;u++){let{first:d,second:f,amount:p}=t.kerning[u];d/=h,f/=h,p/=h,this.chars[f]&&(this.chars[f].kerning[d]=p)}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 hh)s=t;else{const o=QS(t);if(!o)throw new Error("Unrecognized data format for font.");s=o.parse(t)}e instanceof ot&&(e=[e]);const n=new zi(s,e,i);return zi.available[n.font]=n,n}static uninstall(t){const e=zi.available[t];if(!e)throw new Error(`No font found named '${t}'`);e.destroy(),delete zi.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({},zi.defaultOptions,i),c=eE(s),u=e instanceof Lr?e:new Lr(e),d=a,f=new hh;f.info[0]={face:u.fontFamily,size:u.fontSize},f.common[0]={lineHeight:u.fontSize};let p=0,m=0,g,y,x,b=0;const v=[];for(let S=0;S<c.length;S++){g||(g=st.ADAPTER.createCanvas(),g.width=a,g.height=h,y=g.getContext("2d"),x=new xt(g,{resolution:o,...l}),v.push(new ot(x)),f.page.push({id:v.length-1,file:""}));const C=c[S],I=Pr.measureText(C,u,!1,g),M=I.width,L=Math.ceil(I.height),G=Math.ceil((u.fontStyle==="italic"?2:1)*M);if(m>=h-L*o){if(m===0)throw new Error(`[BitmapFont] textureHeight ${h}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${C}')`);--S,g=null,y=null,x=null,m=0,p=0,b=0;continue}if(b=Math.max(L+I.fontProperties.descent,b),G*o+p>=d){if(p===0)throw new Error(`[BitmapFont] textureWidth ${a}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${C}')`);--S,m+=b*o,m=Math.ceil(m),p=0,b=0;continue}tE(g,y,I,p,m,o,u);const N=ch(I.text);f.char.push({id:N,page:v.length-1,x:p/o,y:m/o,width:G,height:L,xoffset:0,yoffset:0,xadvance:M-(u.dropShadow?u.dropShadowDistance:0)-(u.stroke?u.strokeThickness:0)}),p+=(G+2*n)*o,p=Math.ceil(p)}if(!(i!=null&&i.skipKerning))for(let S=0,C=c.length;S<C;S++){const I=c[S];for(let M=0;M<C;M++){const L=c[M],G=y.measureText(I).width,N=y.measureText(L).width,A=y.measureText(I+L).width-(G+N);A&&f.kerning.push({first:ch(I),second:ch(L),amount:A})}}const w=new zi(f,v,!0);return zi.available[t]!==void 0&&zi.uninstall(t),zi.available[t]=w,w}};Gr.ALPHA=[["a","z"],["A","Z"]," "],Gr.NUMERIC=[["0","9"]],Gr.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],Gr.ASCII=[[" ","~"]],Gr.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:Gr.ALPHANUMERIC},Gr.available={};let fi=Gr;var iE=`// Pixi texture info\r
1095
+ `;const cl=new Nt;class Y0 extends Oa{constructor(t){super(t),t.runners.contextChange.add(this),this.quad=new Rm,this.state=Ri.for2d()}contextChange(){const t=this.renderer,e={globals:t.globalUniforms};this.simpleShader=Pi.from(z0,v2,e),this.shader=t.context.webGLVersion>1?Pi.from(x2,b2,e):Pi.from(z0,_2,e)}render(t){const e=this.renderer,r=this.quad;let n=r.vertices;n[0]=n[6]=t._width*-t.anchor.x,n[1]=n[3]=t._height*-t.anchor.y,n[2]=n[4]=t._width*(1-t.anchor.x),n[5]=n[7]=t._height*(1-t.anchor.y);const s=t.uvRespectAnchor?t.anchor.x:0,o=t.uvRespectAnchor?t.anchor.y:0;n=r.uvs,n[0]=n[6]=-s,n[1]=n[3]=-o,n[2]=n[4]=1-s,n[5]=n[7]=1-o,r.invalidate();const a=t._texture,l=a.baseTexture,h=l.alphaMode>0,c=t.tileTransform.localTransform,u=t.uvMatrix;let d=l.isPowerOfTwo&&a.frame.width===l.width&&a.frame.height===l.height;d&&(l._glTextures[e.CONTEXT_UID]?d=l.wrapMode!==wi.CLAMP:l.wrapMode===wi.CLAMP&&(l.wrapMode=wi.REPEAT));const f=d?this.simpleShader:this.shader,p=a.width,m=a.height,g=t._width,y=t._height;cl.set(c.a*p/g,c.b*p/y,c.c*m/g,c.d*m/y,c.tx/g,c.ty/y),cl.invert(),d?cl.prepend(u.mapCoord):(f.uniforms.uMapCoord=u.mapCoord.toArray(!0),f.uniforms.uClampFrame=u.uClampFrame,f.uniforms.uClampOffset=u.uClampOffset),f.uniforms.uTransform=cl.toArray(!0),f.uniforms.uColor=Dt.shared.setValue(t.tint).premultiply(t.worldAlpha,h).toArray(f.uniforms.uColor),f.uniforms.translationMatrix=t.transform.worldTransform.toArray(!0),f.uniforms.uSampler=a,e.shader.bind(f),e.geometry.bind(r),this.state.blendMode=rm(t.blendMode,h),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}Y0.extension={name:"tilingSprite",type:q.RendererPlugin},st.add(Y0);const j0=class ha{constructor(t,e,r=null){this.linkedSheets=[],this._texture=t instanceof ot?t:null,this.baseTexture=t instanceof xt?t:this._texture.baseTexture,this.textures={},this.animations={},this.data=e;const n=this.baseTexture.resource;this.resolution=this._updateResolution(r||(n?n.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 r=rr(t,null);return r===null&&(r=parseFloat(e??"1")),r!==1&&this.baseTexture.setResolution(r),r}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=ha.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const r=ha.BATCH_SIZE;for(;e-t<r&&e<this._frameKeys.length;){const n=this._frameKeys[e],s=this._frames[n],o=s.frame;if(o){let a=null,l=null;const h=s.trimmed!==!1&&s.sourceSize?s.sourceSize:s.frame,c=new gt(0,0,Math.floor(h.w)/this.resolution,Math.floor(h.h)/this.resolution);s.rotated?a=new gt(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 gt(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution),s.trimmed!==!1&&s.spriteSourceSize&&(l=new gt(Math.floor(s.spriteSourceSize.x)/this.resolution,Math.floor(s.spriteSourceSize.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution)),this.textures[n]=new ot(this.baseTexture,a,c,l,s.rotated?2:0,s.anchor,s.borders),ot.addToCache(this.textures[n],n.toString())}e++}}_processAnimations(){const t=this.data.animations||{};for(const e in t){this.animations[e]=[];for(let r=0;r<t[e].length;r++){const n=t[e][r];this.animations[e].push(this.textures[n])}}}_parseComplete(){const t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*ha.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*ha.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){var e;for(const r in this.textures)this.textures[r].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=[]}};j0.BATCH_SIZE=1e3;let J0=j0;const w2=["jpg","png","jpeg","avif","webp"];function $0(i,t,e){const r={};if(i.forEach(n=>{r[n]=t}),Object.keys(t.textures).forEach(n=>{r[n]=t.textures[n]}),!e){const n=ne.dirname(i[0]);t.linkedSheets.forEach((s,o)=>{const a=$0([`${n}/${t.data.meta.related_multi_packs[o]}`],s,!0);Object.assign(r,a)})}return r}const T2={extension:q.Asset,cache:{test:i=>i instanceof J0,getCacheableAssets:(i,t)=>$0(i,t,!1)},resolver:{test:i=>{const t=i.split("?")[0].split("."),e=t.pop(),r=t.pop();return e==="json"&&w2.includes(r)},parse:i=>{var e;const t=i.split(".");return{resolution:parseFloat(((e=nt.RETINA_PREFIX.exec(i))==null?void 0:e[1])??"1"),format:t[t.length-2],src:i}}},loader:{name:"spritesheetLoader",extension:{type:q.LoadParser,priority:di.Normal},async testParse(i,t){return ne.extname(t.src).toLowerCase()===".json"&&!!i.frames},async parse(i,t,e){var l,h;let r=ne.dirname(t.src);r&&r.lastIndexOf("/")!==r.length-1&&(r+="/");let n=r+i.meta.image;n=qc(n,t.src);const s=(await e.load([n]))[n],o=new J0(s.baseTexture,i,t.src);await o.parse();const a=(l=i==null?void 0:i.meta)==null?void 0:l.related_multi_packs;if(Array.isArray(a)){const c=[];for(const d of a){if(typeof d!="string")continue;let f=r+d;(h=t.data)!=null&&h.ignoreMultiPack||(f=qc(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(i){i.destroy(!0)}}};st.add(T2);class ul{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class dl{static test(t){return typeof t=="string"&&t.startsWith("info face=")}static parse(t){const e=t.match(/^[a-z]+\s+.+$/gm),r={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(const s in e){const o=e[s].match(/^[a-z]+/gm)[0],a=e[s].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),l={};for(const h in a){const c=a[h].split("="),u=c[0],d=c[1].replace(/"/gm,""),f=parseFloat(d),p=isNaN(f)?d:f;l[u]=p}r[o].push(l)}const n=new ul;return r.info.forEach(s=>n.info.push({face:s.face,size:parseInt(s.size,10)})),r.common.forEach(s=>n.common.push({lineHeight:parseInt(s.lineHeight,10)})),r.page.forEach(s=>n.page.push({id:parseInt(s.id,10),file:s.file})),r.char.forEach(s=>n.char.push({id:parseInt(s.id,10),page:parseInt(s.page,10),x:parseInt(s.x,10),y:parseInt(s.y,10),width:parseInt(s.width,10),height:parseInt(s.height,10),xoffset:parseInt(s.xoffset,10),yoffset:parseInt(s.yoffset,10),xadvance:parseInt(s.xadvance,10)})),r.kerning.forEach(s=>n.kerning.push({first:parseInt(s.first,10),second:parseInt(s.second,10),amount:parseInt(s.amount,10)})),r.distanceField.forEach(s=>n.distanceField.push({distanceRange:parseInt(s.distanceRange,10),fieldType:s.fieldType})),n}}class yu{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 ul,r=t.getElementsByTagName("info"),n=t.getElementsByTagName("common"),s=t.getElementsByTagName("page"),o=t.getElementsByTagName("char"),a=t.getElementsByTagName("kerning"),l=t.getElementsByTagName("distanceField");for(let h=0;h<r.length;h++)e.info.push({face:r[h].getAttribute("face"),size:parseInt(r[h].getAttribute("size"),10)});for(let h=0;h<n.length;h++)e.common.push({lineHeight:parseInt(n[h].getAttribute("lineHeight"),10)});for(let h=0;h<s.length;h++)e.page.push({id:parseInt(s[h].getAttribute("id"),10)||0,file:s[h].getAttribute("file")});for(let h=0;h<o.length;h++){const c=o[h];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 h=0;h<a.length;h++)e.kerning.push({first:parseInt(a[h].getAttribute("first"),10),second:parseInt(a[h].getAttribute("second"),10),amount:parseInt(a[h].getAttribute("amount"),10)});for(let h=0;h<l.length;h++)e.distanceField.push({fieldType:l[h].getAttribute("fieldType"),distanceRange:parseInt(l[h].getAttribute("distanceRange"),10)});return e}}class bu{static test(t){return typeof t=="string"&&t.includes("<font>")?yu.test(nt.ADAPTER.parseXML(t)):!1}static parse(t){return yu.parse(nt.ADAPTER.parseXML(t))}}const xu=[dl,yu,bu];function S2(i){for(let t=0;t<xu.length;t++)if(xu[t].test(i))return xu[t];return null}function E2(i,t,e,r,n,s){const o=e.fill;if(Array.isArray(o)){if(o.length===1)return o[0]}else return o;let a;const l=e.dropShadow?e.dropShadowDistance:0,h=e.padding||0,c=i.width/r-l-h*2,u=i.height/r-l-h*2,d=o.slice(),f=e.fillGradientStops.slice();if(!f.length){const p=d.length+1;for(let m=1;m<p;++m)f.push(m/p)}if(d.unshift(o[0]),f.unshift(0),d.push(o[o.length-1]),f.push(1),e.fillGradientType===ll.LINEAR_VERTICAL){a=t.createLinearGradient(c/2,h,c/2,u+h);let p=0;const m=(s.fontProperties.fontSize+e.strokeThickness)/u;for(let g=0;g<n.length;g++){const y=s.lineHeight*g;for(let x=0;x<d.length;x++){let b=0;typeof f[x]=="number"?b=f[x]:b=x/d.length;const v=y/u+b*m;let w=Math.max(p,v);w=Math.min(w,1),a.addColorStop(w,d[x]),p=w}}}else{a=t.createLinearGradient(h,u/2,c+h,u/2);const p=d.length+1;let m=1;for(let g=0;g<d.length;g++){let y;typeof f[g]=="number"?y=f[g]:y=m/p,a.addColorStop(y,d[g]),m++}}return a}function C2(i,t,e,r,n,s,o){const a=e.text,l=e.fontProperties;t.translate(r,n),t.scale(s,s);const h=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=E2(i,t,o,s,[a],e),t.strokeStyle=o.stroke,o.dropShadow){const u=o.dropShadowColor,d=o.dropShadowBlur*s,f=o.dropShadowDistance*s;t.shadowColor=Dt.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,h,c+e.lineHeight-l.descent),o.fill&&t.fillText(a,h,c+e.lineHeight-l.descent),t.setTransform(1,0,0,1,0,0),t.fillStyle="rgba(0, 0, 0, 0)"}function fl(i){return i.codePointAt?i.codePointAt(0):i.charCodeAt(0)}function Q0(i){return Array.from?Array.from(i):i.split("")}function I2(i){typeof i=="string"&&(i=[i]);const t=[];for(let e=0,r=i.length;e<r;e++){const n=i[e];if(Array.isArray(n)){if(n.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${n.length}.`);const s=n[0].charCodeAt(0),o=n[1].charCodeAt(0);if(o<s)throw new Error("[BitmapFont]: Invalid character range.");for(let a=s,l=o;a<=l;a++)t.push(String.fromCharCode(a))}else t.push(...Q0(n))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}const Dr=class ji{constructor(t,e,r){var c;const[n]=t.info,[s]=t.common,[o]=t.page,[a]=t.distanceField,l=rr(o.file),h={};this._ownsTextures=r,this.font=n.face,this.size=n.size,this.lineHeight=s.lineHeight/l,this.chars={},this.pageTextures=h;for(let u=0;u<t.page.length;u++){const{id:d,file:f}=t.page[u];h[d]=e instanceof Array?e[u]:e[f],a!=null&&a.fieldType&&a.fieldType!=="none"&&(h[d].baseTexture.alphaMode=Ce.NO_PREMULTIPLIED_ALPHA,h[d].baseTexture.mipmap=Ti.OFF)}for(let u=0;u<t.char.length;u++){const{id:d,page:f}=t.char[u];let{x:p,y:m,width:g,height:y,xoffset:x,yoffset:b,xadvance:v}=t.char[u];p/=l,m/=l,g/=l,y/=l,x/=l,b/=l,v/=l;const w=new gt(p+h[f].frame.x/l,m+h[f].frame.y/l,g,y);this.chars[d]={xOffset:x,yOffset:b,xAdvance:v,kerning:{},texture:new ot(h[f].baseTexture,w),page:f}}for(let u=0;u<t.kerning.length;u++){let{first:d,second:f,amount:p}=t.kerning[u];d/=l,f/=l,p/=l,this.chars[f]&&(this.chars[f].kerning[d]=p)}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,r){let n;if(t instanceof ul)n=t;else{const o=S2(t);if(!o)throw new Error("Unrecognized data format for font.");n=o.parse(t)}e instanceof ot&&(e=[e]);const s=new ji(n,e,r);return ji.available[s.font]=s,s}static uninstall(t){const e=ji.available[t];if(!e)throw new Error(`No font found named '${t}'`);e.destroy(),delete ji.available[t]}static from(t,e,r){if(!t)throw new Error("[BitmapFont] Property `name` is required.");const{chars:n,padding:s,resolution:o,textureWidth:a,textureHeight:l,...h}=Object.assign({},ji.defaultOptions,r),c=I2(n),u=e instanceof Fr?e:new Fr(e),d=a,f=new ul;f.info[0]={face:u.fontFamily,size:u.fontSize},f.common[0]={lineHeight:u.fontSize};let p=0,m=0,g,y,x,b=0;const v=[];for(let S=0;S<c.length;S++){g||(g=nt.ADAPTER.createCanvas(),g.width=a,g.height=l,y=g.getContext("2d"),x=new xt(g,{resolution:o,...h}),v.push(new ot(x)),f.page.push({id:v.length-1,file:""}));const C=c[S],I=kr.measureText(C,u,!1,g),M=I.width,L=Math.ceil(I.height),G=Math.ceil((u.fontStyle==="italic"?2:1)*M);if(m>=l-L*o){if(m===0)throw new Error(`[BitmapFont] textureHeight ${l}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${C}')`);--S,g=null,y=null,x=null,m=0,p=0,b=0;continue}if(b=Math.max(L+I.fontProperties.descent,b),G*o+p>=d){if(p===0)throw new Error(`[BitmapFont] textureWidth ${a}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${C}')`);--S,m+=b*o,m=Math.ceil(m),p=0,b=0;continue}C2(g,y,I,p,m,o,u);const F=fl(I.text);f.char.push({id:F,page:v.length-1,x:p/o,y:m/o,width:G,height:L,xoffset:0,yoffset:0,xadvance:M-(u.dropShadow?u.dropShadowDistance:0)-(u.stroke?u.strokeThickness:0)}),p+=(G+2*s)*o,p=Math.ceil(p)}if(!(r!=null&&r.skipKerning))for(let S=0,C=c.length;S<C;S++){const I=c[S];for(let M=0;M<C;M++){const L=c[M],G=y.measureText(I).width,F=y.measureText(L).width,A=y.measureText(I+L).width-(G+F);A&&f.kerning.push({first:fl(I),second:fl(L),amount:A})}}const w=new ji(f,v,!0);return ji.available[t]!==void 0&&ji.uninstall(t),ji.available[t]=w,w}};Dr.ALPHA=[["a","z"],["A","Z"]," "],Dr.NUMERIC=[["0","9"]],Dr.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],Dr.ASCII=[[" ","~"]],Dr.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:Dr.ALPHANUMERIC},Dr.available={};let pi=Dr;var A2=`// 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
- `,rE=`// Mesh material default fragment\r
1133
+ `,M2=`// 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 Xg=[],Wg=[],Zg=[],Vg=class ex extends Ct{constructor(t,e={}){super();const{align:i,tint:s,maxWidth:n,letterSpacing:o,fontName:a,fontSize:h}=Object.assign({},ex.styleDefaults,e);if(!fi.available[a])throw new Error(`Missing BitmapFont "${a}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=i,this._tintColor=new kt(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 rr(()=>{this.dirty=!0},this,0,0),this._roundPixels=st.ROUND_PIXELS,this.dirty=!0,this._resolution=st.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){var G;const t=fi.available[this._fontName],e=this.fontSize,i=e/t.size,s=new dt,n=[],o=[],a=[],h=this._text.replace(/(?:\r\n|\r)/g,`
1150
- `)||" ",l=Ug(h),c=this._maxWidth*t.size/e,u=t.distanceFieldType==="none"?Xg:Wg;let d=null,f=0,p=0,m=0,g=-1,y=0,x=0,b=0,v=0;for(let N=0;N<l.length;N++){const A=l[N],D=ch(A);if(/(?:\s)/.test(A)&&(g=N,y=f,v++),A==="\r"||A===`
1151
- `){o.push(f),a.push(-1),p=Math.max(p,f),++m,++x,s.x=0,s.y+=t.lineHeight,d=null,v=0;continue}const Z=t.chars[D];if(!Z)continue;d&&Z.kerning[d]&&(s.x+=Z.kerning[d]);const K=Zg.pop()||{texture:ot.EMPTY,line:0,charCode:0,prevSpaces:0,position:new dt};K.texture=Z.texture,K.line=m,K.charCode=D,K.position.x=Math.round(s.x+Z.xOffset+this._letterSpacing/2),K.position.y=Math.round(s.y+Z.yOffset),K.prevSpaces=v,n.push(K),f=K.position.x+Math.max(Z.xAdvance-Z.xOffset,Z.texture.orig.width),s.x+=Z.xAdvance+this._letterSpacing,b=Math.max(b,Z.yOffset+Z.texture.height),d=D,g!==-1&&c>0&&s.x>c&&(++x,qs(n,1+g-x,1+N-g),N=g,g=-1,o.push(y),a.push(n.length>0?n[n.length-1].prevSpaces:0),p=Math.max(p,y),m++,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),p=Math.max(p,f),a.push(-1));const S=[];for(let N=0;N<=m;N++){let A=0;this._align==="right"?A=p-o[N]:this._align==="center"?A=(p-o[N])/2:this._align==="justify"&&(A=a[N]<0?0:(p-o[N])/a[N]),S.push(A)}const C=n.length,I={},M=[],L=this._activePagesMeshData;u.push(...L);for(let N=0;N<C;N++){const A=n[N].texture,D=A.baseTexture.uid;if(!I[D]){let Z=u.pop();if(!Z){const H=new Cg;let j,B;t.distanceFieldType==="none"?(j=new lu(ot.EMPTY),B=mt.NORMAL):(j=new lu(ot.EMPTY,{program:sr.from(rE,iE),uniforms:{uFWidth:0}}),B=mt.NORMAL_NPM);const k=new hu(H,j);k.blendMode=B,Z={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:k,vertices:null,uvs:null,indices:null}}Z.index=0,Z.indexCount=0,Z.vertexCount=0,Z.uvsCount=0,Z.total=0;const{_textureCache:K}=this;K[D]=K[D]||new ot(A.baseTexture),Z.mesh.texture=K[D],Z.mesh.tint=this._tintColor.value,M.push(Z),I[D]=Z}I[D].total++}for(let N=0;N<L.length;N++)M.includes(L[N])||this.removeChild(L[N].mesh);for(let N=0;N<M.length;N++)M[N].mesh.parent!==this&&this.addChild(M[N].mesh);this._activePagesMeshData=M;for(const N in I){const A=I[N],D=A.total;if(!(((G=A.indices)==null?void 0:G.length)>6*D)||A.vertices.length<hu.BATCHABLE_SIZE*2)A.vertices=new Float32Array(4*2*D),A.uvs=new Float32Array(4*2*D),A.indices=new Uint16Array(6*D);else{const Z=A.total,K=A.vertices;for(let H=Z*4*2;H<K.length;H++)K[H]=0}A.mesh.size=6*D}for(let N=0;N<C;N++){const A=n[N];let D=A.position.x+S[A.line]*(this._align==="justify"?A.prevSpaces:1);this._roundPixels&&(D=Math.round(D));const Z=D*i,K=A.position.y*i,H=A.texture,j=I[H.baseTexture.uid],B=H.frame,k=H._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]=Z,j.vertices[F*8+1]=K,j.vertices[F*8+2]=Z+B.width*i,j.vertices[F*8+3]=K,j.vertices[F*8+4]=Z+B.width*i,j.vertices[F*8+5]=K+B.height*i,j.vertices[F*8+6]=Z,j.vertices[F*8+7]=K+B.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=p*i,this._textHeight=(s.y+t.lineHeight)*i;for(const N in I){const A=I[N];if(this.anchor.x!==0||this.anchor.y!==0){let H=0;const j=this._textWidth*this.anchor.x,B=this._textHeight*this.anchor.y;for(let k=0;k<A.total;k++)A.vertices[H++]-=j,A.vertices[H++]-=B,A.vertices[H++]-=j,A.vertices[H++]-=B,A.vertices[H++]-=j,A.vertices[H++]-=B,A.vertices[H++]-=j,A.vertices[H++]-=B}this._maxLineHeight=b*i;const D=A.mesh.geometry.getBuffer("aVertexPosition"),Z=A.mesh.geometry.getBuffer("aTextureCoord"),K=A.mesh.geometry.getIndex();D.data=A.vertices,Z.data=A.uvs,K.data=A.indices,D.update(),Z.update(),K.update()}for(let N=0;N<n.length;N++)Zg.push(n[N]);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}=fi.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 p of this._activePagesMeshData)p.mesh.shader.uniforms.uFWidth=u*e*d*f}super._render(t)}getLocalBounds(){return this.validate(),super.getLocalBounds()}validate(){const t=fi.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(!fi.available[t])throw new Error(`Missing BitmapFont "${t}"`);this._fontName!==t&&(this._fontName=t,this.dirty=!0)}get fontSize(){return this._fontSize??fi.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=fi.available[this._fontName].distanceFieldType==="none"?Xg:Wg;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=ot.EMPTY});for(const s in e)e[s].destroy(),delete e[s];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(t)}};Vg.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};let sE=Vg;const nE=[".xml",".fnt"],oE={extension:{type:q.LoadParser,priority:ui.Normal},name:"loadBitmapFont",test(r){return nE.includes(re.extname(r).toLowerCase())},async testParse(r){return lh.test(r)||pu.test(r)},async parse(r,t,e){const i=lh.test(r)?lh.parse(r):pu.parse(r),{src:s}=t,{page:n}=i,o=[];for(let l=0;l<n.length;++l){const c=n[l].file;let u=re.join(re.dirname(s),c);u=jc(u,s),o.push(u)}const a=await e.load(o),h=o.map(l=>a[l]);return fi.install(i,h,!0)},async load(r,t){return(await st.ADAPTER.fetch(r)).text()},unload(r){r.destroy()}};nt.add(oE);const gu=class Vn extends Lr{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(t){return new Vn(Object.keys(Vn.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 Vn.availableFonts[t.originalUrl])}),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(t,e={}){const{availableFonts:i}=Vn;if(i[t]){const s=i[t];return this._fonts.push(s),s.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return st.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:re.basename(t,re.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}
1149
+ `;const q0=[],tg=[],eg=[],ig=class I1 extends Ct{constructor(t,e={}){super();const{align:r,tint:n,maxWidth:s,letterSpacing:o,fontName:a,fontSize:l}=Object.assign({},I1.styleDefaults,e);if(!pi.available[a])throw new Error(`Missing BitmapFont "${a}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=r,this._tintColor=new Dt(n),this._font=void 0,this._fontName=a,this._fontSize=l,this.text=t,this._maxWidth=s,this._maxLineHeight=0,this._letterSpacing=o,this._anchor=new nr(()=>{this.dirty=!0},this,0,0),this._roundPixels=nt.ROUND_PIXELS,this.dirty=!0,this._resolution=nt.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){var G;const t=pi.available[this._fontName],e=this.fontSize,r=e/t.size,n=new dt,s=[],o=[],a=[],l=this._text.replace(/(?:\r\n|\r)/g,`
1150
+ `)||" ",h=Q0(l),c=this._maxWidth*t.size/e,u=t.distanceFieldType==="none"?q0:tg;let d=null,f=0,p=0,m=0,g=-1,y=0,x=0,b=0,v=0;for(let F=0;F<h.length;F++){const A=h[F],N=fl(A);if(/(?:\s)/.test(A)&&(g=F,y=f,v++),A==="\r"||A===`
1151
+ `){o.push(f),a.push(-1),p=Math.max(p,f),++m,++x,n.x=0,n.y+=t.lineHeight,d=null,v=0;continue}const Z=t.chars[N];if(!Z)continue;d&&Z.kerning[d]&&(n.x+=Z.kerning[d]);const K=eg.pop()||{texture:ot.EMPTY,line:0,charCode:0,prevSpaces:0,position:new dt};K.texture=Z.texture,K.line=m,K.charCode=N,K.position.x=Math.round(n.x+Z.xOffset+this._letterSpacing/2),K.position.y=Math.round(n.y+Z.yOffset),K.prevSpaces=v,s.push(K),f=K.position.x+Math.max(Z.xAdvance-Z.xOffset,Z.texture.orig.width),n.x+=Z.xAdvance+this._letterSpacing,b=Math.max(b,Z.yOffset+Z.texture.height),d=N,g!==-1&&c>0&&n.x>c&&(++x,rs(s,1+g-x,1+F-g),F=g,g=-1,o.push(y),a.push(s.length>0?s[s.length-1].prevSpaces:0),p=Math.max(p,y),m++,n.x=0,n.y+=t.lineHeight,d=null,v=0)}const w=h[h.length-1];w!=="\r"&&w!==`
1152
+ `&&(/(?:\s)/.test(w)&&(f=y),o.push(f),p=Math.max(p,f),a.push(-1));const S=[];for(let F=0;F<=m;F++){let A=0;this._align==="right"?A=p-o[F]:this._align==="center"?A=(p-o[F])/2:this._align==="justify"&&(A=a[F]<0?0:(p-o[F])/a[F]),S.push(A)}const C=s.length,I={},M=[],L=this._activePagesMeshData;u.push(...L);for(let F=0;F<C;F++){const A=s[F].texture,N=A.baseTexture.uid;if(!I[N]){let Z=u.pop();if(!Z){const H=new O0;let j,B;t.distanceFieldType==="none"?(j=new fu(ot.EMPTY),B=mt.NORMAL):(j=new fu(ot.EMPTY,{program:sr.from(M2,A2),uniforms:{uFWidth:0}}),B=mt.NORMAL_NPM);const D=new du(H,j);D.blendMode=B,Z={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:D,vertices:null,uvs:null,indices:null}}Z.index=0,Z.indexCount=0,Z.vertexCount=0,Z.uvsCount=0,Z.total=0;const{_textureCache:K}=this;K[N]=K[N]||new ot(A.baseTexture),Z.mesh.texture=K[N],Z.mesh.tint=this._tintColor.value,M.push(Z),I[N]=Z}I[N].total++}for(let F=0;F<L.length;F++)M.includes(L[F])||this.removeChild(L[F].mesh);for(let F=0;F<M.length;F++)M[F].mesh.parent!==this&&this.addChild(M[F].mesh);this._activePagesMeshData=M;for(const F in I){const A=I[F],N=A.total;if(!(((G=A.indices)==null?void 0:G.length)>6*N)||A.vertices.length<du.BATCHABLE_SIZE*2)A.vertices=new Float32Array(4*2*N),A.uvs=new Float32Array(4*2*N),A.indices=new Uint16Array(6*N);else{const Z=A.total,K=A.vertices;for(let H=Z*4*2;H<K.length;H++)K[H]=0}A.mesh.size=6*N}for(let F=0;F<C;F++){const A=s[F];let N=A.position.x+S[A.line]*(this._align==="justify"?A.prevSpaces:1);this._roundPixels&&(N=Math.round(N));const Z=N*r,K=A.position.y*r,H=A.texture,j=I[H.baseTexture.uid],B=H.frame,D=H._uvs,k=j.index++;j.indices[k*6+0]=0+k*4,j.indices[k*6+1]=1+k*4,j.indices[k*6+2]=2+k*4,j.indices[k*6+3]=0+k*4,j.indices[k*6+4]=2+k*4,j.indices[k*6+5]=3+k*4,j.vertices[k*8+0]=Z,j.vertices[k*8+1]=K,j.vertices[k*8+2]=Z+B.width*r,j.vertices[k*8+3]=K,j.vertices[k*8+4]=Z+B.width*r,j.vertices[k*8+5]=K+B.height*r,j.vertices[k*8+6]=Z,j.vertices[k*8+7]=K+B.height*r,j.uvs[k*8+0]=D.x0,j.uvs[k*8+1]=D.y0,j.uvs[k*8+2]=D.x1,j.uvs[k*8+3]=D.y1,j.uvs[k*8+4]=D.x2,j.uvs[k*8+5]=D.y2,j.uvs[k*8+6]=D.x3,j.uvs[k*8+7]=D.y3}this._textWidth=p*r,this._textHeight=(n.y+t.lineHeight)*r;for(const F in I){const A=I[F];if(this.anchor.x!==0||this.anchor.y!==0){let H=0;const j=this._textWidth*this.anchor.x,B=this._textHeight*this.anchor.y;for(let D=0;D<A.total;D++)A.vertices[H++]-=j,A.vertices[H++]-=B,A.vertices[H++]-=j,A.vertices[H++]-=B,A.vertices[H++]-=j,A.vertices[H++]-=B,A.vertices[H++]-=j,A.vertices[H++]-=B}this._maxLineHeight=b*r;const N=A.mesh.geometry.getBuffer("aVertexPosition"),Z=A.mesh.geometry.getBuffer("aTextureCoord"),K=A.mesh.geometry.getIndex();N.data=A.vertices,Z.data=A.uvs,K.data=A.indices,N.update(),Z.update(),K.update()}for(let F=0;F<s.length;F++)eg.push(s[F]);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:r,size:n}=pi.available[this._fontName];if(r!=="none"){const{a:s,b:o,c:a,d:l}=this.worldTransform,h=Math.sqrt(s*s+o*o),c=Math.sqrt(a*a+l*l),u=(Math.abs(h)+Math.abs(c))/2,d=this.fontSize/n,f=t._view.resolution;for(const p of this._activePagesMeshData)p.mesh.shader.uniforms.uFWidth=u*e*d*f}super._render(t)}getLocalBounds(){return this.validate(),super.getLocalBounds()}validate(){const t=pi.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(!pi.available[t])throw new Error(`Missing BitmapFont "${t}"`);this._fontName!==t&&(this._fontName=t,this.dirty=!0)}get fontSize(){return this._fontSize??pi.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,r=pi.available[this._fontName].distanceFieldType==="none"?q0:tg;r.push(...this._activePagesMeshData);for(const n of this._activePagesMeshData)this.removeChild(n.mesh);this._activePagesMeshData=[],r.filter(n=>e[n.mesh.texture.baseTexture.uid]).forEach(n=>{n.mesh.texture=ot.EMPTY});for(const n in e)e[n].destroy(),delete e[n];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(t)}};ig.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};let R2=ig;const P2=[".xml",".fnt"],L2={extension:{type:q.LoadParser,priority:di.Normal},name:"loadBitmapFont",test(i){return P2.includes(ne.extname(i).toLowerCase())},async testParse(i){return dl.test(i)||bu.test(i)},async parse(i,t,e){const r=dl.test(i)?dl.parse(i):bu.parse(i),{src:n}=t,{page:s}=r,o=[];for(let h=0;h<s.length;++h){const c=s[h].file;let u=ne.join(ne.dirname(n),c);u=qc(u,n),o.push(u)}const a=await e.load(o),l=o.map(h=>a[h]);return pi.install(r,l,!0)},async load(i,t){return(await nt.ADAPTER.fetch(i)).text()},unload(i){i.destroy()}};st.add(L2);const _u=class zs extends Fr{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(t){return new zs(Object.keys(zs.defaultOptions).reduce((e,r)=>({...e,[r]:t[r]}),{}))}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 zs.availableFonts[t.originalUrl])}),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(t,e={}){const{availableFonts:r}=zs;if(r[t]){const n=r[t];return this._fonts.push(n),n.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return nt.ADAPTER.fetch(t).then(n=>n.blob()).then(async n=>new Promise((s,o)=>{const a=URL.createObjectURL(n),l=new FileReader;l.onload=()=>s([a,l.result]),l.onerror=o,l.readAsDataURL(n)})).then(async([n,s])=>{const o=Object.assign({family:ne.basename(t,ne.extname(t)),weight:"normal",style:"normal",display:"auto",src:n,dataSrc:s,refs:1,originalUrl:t,fontFace:null},e);r[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(r=>!this._overrides.includes(r));e.length>0&&(this._overrides.push(...e),this.styleID++)}removeOverride(...t){const e=t.filter(r=>this._overrides.includes(r));e.length>0&&(this._overrides=this._overrides.filter(r=>!e.includes(r)),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=j1(t)),typeof t=="number"?z1(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,Vn.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}=st.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}};gu.availableFonts={},gu.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 yu=gu;const uh=class Hn extends $t{constructor(t="",e={}){super(ot.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=ot.from(i,{scaleMode:st.SCALE_MODE,resourceOptions:{autoLoad:!1}});s.orig=new gt,s.trim=new gt,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=Hn.defaultMaxWidth,this.maxHeight=Hn.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=Hn.defaultAutoResolution,this._resolution=Hn.defaultResolution??st.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({},Hn.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=Sr(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=Sr(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 yu?(this.ownsStyle=!1,this._style=t):t instanceof Lr?(console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle"),this.ownsStyle=!0,this._style=yu.from(t)):(this.ownsStyle=!0,this._style=new yu(t)),this.localStyleID=-1,this.dirty=!0)}get text(){return this._text}set text(t){t=String(t===""||t===null||t===void 0?" ":t),t=this.sanitiseText(t),this._text!==t&&(this._text=t,this.dirty=!0)}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}sanitiseText(t){return t.replace(/<br>/gi,"<br/>").replace(/<hr>/gi,"<hr/>").replace(/&nbsp;/gi,"&#160;")}};uh.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},uh.defaultMaxWidth=2024,uh.defaultMaxHeight=2024,uh.defaultAutoResolution=!0;function aE(){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 tt=aE();function Ce(r){let t;return new Promise(e=>{t=e,tt.on(r,t)}).then(e=>(tt.off(r,t),e))}let Li=null;const Hg=new ResizeObserver(()=>{Li&&tt.emit("stageUpdated",Li)});function hE(r){Li=r,Hg.observe(Li),tt.emit("stageCreated",Li)}function lE(){Li&&Hg.unobserve(Li),Li=null}async function bu(){return Li||await Ce("stageCreated")}let De=null;async function cE(){const r=await bu();dE(r),tt.on("stageUpdated",fE)}function uE(){De&&(De.destroy(!0,{children:!0}),De=null)}function dE(r){De=new sg({backgroundAlpha:0,resizeTo:r,antialias:!0,resolution:Math.ceil(window.devicePixelRatio)}),De.stage.sortableChildren=!0,r.appendChild(De.view),tt.emit("applicationCreated",De),process.env.NODE_ENV==="development"&&(globalThis.__PIXI_APP__=De)}async function Qt(){return De||await Ce("applicationCreated")}function fE(r){De&&(De.resizeTo=r,tt.emit("applicationResized",De))}var dh={exports:{}};dh.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]",p="[object GeneratorFunction]",m="[object Map]",g="[object Number]",y="[object Null]",x="[object Object]",b="[object Proxy]",v="[object RegExp]",w="[object Set]",S="[object String]",C="[object Undefined]",I="[object WeakMap]",M="[object ArrayBuffer]",L="[object DataView]",G="[object Float32Array]",N="[object Float64Array]",A="[object Int8Array]",D="[object Int16Array]",Z="[object Int32Array]",K="[object Uint8Array]",H="[object Uint8ClampedArray]",j="[object Uint16Array]",B="[object Uint32Array]",k=/[\\^$.*+?()[\]{}|]/g,F=/^\[object .+?Constructor\]$/,V=/^(?:0|[1-9]\d*)$/,et={};et[G]=et[N]=et[A]=et[D]=et[Z]=et[K]=et[H]=et[j]=et[B]=!0,et[a]=et[h]=et[M]=et[c]=et[L]=et[u]=et[d]=et[f]=et[m]=et[g]=et[x]=et[v]=et[w]=et[S]=et[I]=!1;var ft=typeof ve=="object"&&ve&&ve.Object===Object&&ve,at=typeof self=="object"&&self&&self.Object===Object&&self,Tt=ft||at||Function("return this")(),It=t&&!t.nodeType&&t,Q=It&&!0&&r&&!r.nodeType&&r,W=Q&&Q.exports===It,J=W&&ft.process,$=function(){try{var _=Q&&Q.require&&Q.require("util").types;return _||J&&J.binding&&J.binding("util")}catch{}}(),O=$&&$.isTypedArray;function pt(_,E,P){switch(P.length){case 0:return _.call(E);case 1:return _.call(E,P[0]);case 2:return _.call(E,P[0],P[1]);case 3:return _.call(E,P[0],P[1],P[2])}return _.apply(E,P)}function yt(_,E){for(var P=-1,X=Array(_);++P<_;)X[P]=E(P);return X}function Rt(_){return function(E){return _(E)}}function Ot(_,E){return _==null?void 0:_[E]}function Fe(_,E){return function(P){return _(E(P))}}var Ze=Array.prototype,Wo=Function.prototype,Kr=Object.prototype,Pn=Tt["__core-js_shared__"],Ln=Wo.toString,gi=Kr.hasOwnProperty,tl=function(){var _=/[^.]+$/.exec(Pn&&Pn.keys&&Pn.keys.IE_PROTO||"");return _?"Symbol(src)_1."+_:""}(),el=Kr.toString,Xd=Ln.call(Object),Gn=RegExp("^"+Ln.call(gi).replace(k,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Yr=W?Tt.Buffer:void 0,Zo=Tt.Symbol,Ve=Tt.Uint8Array,Vo=Yr?Yr.allocUnsafe:void 0,Ho=Fe(Object.getPrototypeOf,Object),il=Object.create,rl=Kr.propertyIsEnumerable,Fn=Ze.splice,Zi=Zo?Zo.toStringTag:void 0,Fs=function(){try{var _=qo(Object,"defineProperty");return _({},"",{}),_}catch{}}(),Wd=Yr?Yr.isBuffer:void 0,Vi=Math.max,sl=Date.now,nl=qo(Tt,"Map"),Ns=qo(Object,"create"),Ko=function(){function _(){}return function(E){if(!Yi(E))return{};if(il)return il(E);_.prototype=E;var P=new _;return _.prototype=void 0,P}}();function He(_){var E=-1,P=_==null?0:_.length;for(this.clear();++E<P;){var X=_[E];this.set(X[0],X[1])}}function Yo(){this.__data__=Ns?Ns(null):{},this.size=0}function zo(_){var E=this.has(_)&&delete this.__data__[_];return this.size-=E?1:0,E}function jo(_){var E=this.__data__;if(Ns){var P=E[_];return P===i?void 0:P}return gi.call(E,_)?E[_]:void 0}function ks(_){var E=this.__data__;return Ns?E[_]!==void 0:gi.call(E,_)}function Zd(_,E){var P=this.__data__;return this.size+=this.has(_)?0:1,P[_]=Ns&&E===void 0?i:E,this}He.prototype.clear=Yo,He.prototype.delete=zo,He.prototype.get=jo,He.prototype.has=ks,He.prototype.set=Zd;function yi(_){var E=-1,P=_==null?0:_.length;for(this.clear();++E<P;){var X=_[E];this.set(X[0],X[1])}}function Vd(){this.__data__=[],this.size=0}function Hd(_){var E=this.__data__,P=Nn(E,_);if(P<0)return!1;var X=E.length-1;return P==X?E.pop():Fn.call(E,P,1),--this.size,!0}function Kd(_){var E=this.__data__,P=Nn(E,_);return P<0?void 0:E[P][1]}function ol(_){return Nn(this.__data__,_)>-1}function Jo(_,E){var P=this.__data__,X=Nn(P,_);return X<0?(++this.size,P.push([_,E])):P[X][1]=E,this}yi.prototype.clear=Vd,yi.prototype.delete=Hd,yi.prototype.get=Kd,yi.prototype.has=ol,yi.prototype.set=Jo;function Ne(_){var E=-1,P=_==null?0:_.length;for(this.clear();++E<P;){var X=_[E];this.set(X[0],X[1])}}function Yd(){this.size=0,this.__data__={hash:new He,map:new(nl||yi),string:new He}}function zd(_){var E=Dn(this,_).delete(_);return this.size-=E?1:0,E}function jd(_){return Dn(this,_).get(_)}function Jd(_){return Dn(this,_).has(_)}function $d(_,E){var P=Dn(this,_),X=P.size;return P.set(_,E),this.size+=P.size==X?0:1,this}Ne.prototype.clear=Yd,Ne.prototype.delete=zd,Ne.prototype.get=jd,Ne.prototype.has=Jd,Ne.prototype.set=$d;function xe(_){var E=this.__data__=new yi(_);this.size=E.size}function Qd(){this.__data__=new yi,this.size=0}function qd(_){var E=this.__data__,P=E.delete(_);return this.size=E.size,P}function tf(_){return this.__data__.get(_)}function ef(_){return this.__data__.has(_)}function rf(_,E){var P=this.__data__;if(P instanceof yi){var X=P.__data__;if(!nl||X.length<e-1)return X.push([_,E]),this.size=++P.size,this;P=this.__data__=new Ne(X)}return P.set(_,E),this.size=P.size,this}xe.prototype.clear=Qd,xe.prototype.delete=qd,xe.prototype.get=tf,xe.prototype.has=ef,xe.prototype.set=rf;function yr(_,E){var P=Un(_),X=!P&&bi(_),ut=!P&&!X&&pl(_),bt=!P&&!X&&!ut&&jr(_),_t=P||X||ut||bt,lt=_t?yt(_.length,String):[],vt=lt.length;for(var Ut in _)(E||gi.call(_,Ut))&&!(_t&&(Ut=="length"||ut&&(Ut=="offset"||Ut=="parent")||bt&&(Ut=="buffer"||Ut=="byteLength"||Ut=="byteOffset")||dl(Ut,vt)))&&lt.push(Ut);return lt}function $o(_,E,P){(P!==void 0&&!Bn(_[E],P)||P===void 0&&!(E in _))&&Qo(_,E,P)}function sf(_,E,P){var X=_[E];(!(gi.call(_,E)&&Bn(X,P))||P===void 0&&!(E in _))&&Qo(_,E,P)}function Nn(_,E){for(var P=_.length;P--;)if(Bn(_[P][0],E))return P;return-1}function Qo(_,E,P){E=="__proto__"&&Fs?Fs(_,E,{configurable:!0,enumerable:!0,value:P,writable:!0}):_[E]=P}var nf=ff();function br(_){return _==null?_===void 0?C:y:Zi&&Zi in Object(_)?pf(_):yf(_)}function al(_){return zr(_)&&br(_)==a}function of(_){if(!Yi(_)||On(_))return!1;var E=Os(_)?Gn:F;return E.test(_f(_))}function Hi(_){return zr(_)&&ml(_.length)&&!!et[br(_)]}function af(_){if(!Yi(_))return gf(_);var E=xr(_),P=[];for(var X in _)X=="constructor"&&(E||!gi.call(_,X))||P.push(X);return P}function hl(_,E,P,X,ut){_!==E&&nf(E,function(bt,_t){if(ut||(ut=new xe),Yi(bt))hf(_,E,_t,P,hl,X,ut);else{var lt=X?X(ta(_,_t),bt,_t+"",_,E,ut):void 0;lt===void 0&&(lt=bt),$o(_,_t,lt)}},bl)}function hf(_,E,P,X,ut,bt,_t){var lt=ta(_,P),vt=ta(E,P),Ut=_t.get(vt);if(Ut){$o(_,P,Ut);return}var Pt=bt?bt(lt,vt,P+"",_,E,_t):void 0,de=Pt===void 0;if(de){var _e=Un(vt),si=!_e&&pl(vt),ni=!_e&&!si&&jr(vt);Pt=vt,_e||si||ni?Un(lt)?Pt=lt:Xn(lt)?Pt=Ds(lt):si?(de=!1,Pt=uf(vt,!0)):ni?(de=!1,Pt=df(vt,!0)):Pt=[]:gl(vt)||bi(vt)?(Pt=lt,bi(lt)?Pt=yl(lt):(!Yi(lt)||Os(lt))&&(Pt=ul(vt))):de=!1}de&&(_t.set(vt,Pt),ut(Pt,vt,X,bt,_t),_t.delete(vt)),$o(_,P,Pt)}function lf(_,E){return bf(Ki(_,E,T),_+"")}var cf=Fs?function(_,E){return Fs(_,"toString",{configurable:!0,enumerable:!1,value:wf(E),writable:!0})}:T;function uf(_,E){if(E)return _.slice();var P=_.length,X=Vo?Vo(P):new _.constructor(P);return _.copy(X),X}function kn(_){var E=new _.constructor(_.byteLength);return new Ve(E).set(new Ve(_)),E}function df(_,E){var P=E?kn(_.buffer):_.buffer;return new _.constructor(P,_.byteOffset,_.length)}function Ds(_,E){var P=-1,X=_.length;for(E||(E=Array(X));++P<X;)E[P]=_[P];return E}function ll(_,E,P,X){var ut=!P;P||(P={});for(var bt=-1,_t=E.length;++bt<_t;){var lt=E[bt],vt=X?X(P[lt],_[lt],lt,P,_):void 0;vt===void 0&&(vt=_[lt]),ut?Qo(P,lt,vt):sf(P,lt,vt)}return P}function cl(_){return lf(function(E,P){var X=-1,ut=P.length,bt=ut>1?P[ut-1]:void 0,_t=ut>2?P[2]:void 0;for(bt=_.length>3&&typeof bt=="function"?(ut--,bt):void 0,_t&&mf(P[0],P[1],_t)&&(bt=ut<3?void 0:bt,ut=1),E=Object(E);++X<ut;){var lt=P[X];lt&&_(E,lt,X,bt)}return E})}function ff(_){return function(E,P,X){for(var ut=-1,bt=Object(E),_t=X(E),lt=_t.length;lt--;){var vt=_t[_?lt:++ut];if(P(bt[vt],vt,bt)===!1)break}return E}}function Dn(_,E){var P=_.__data__;return fl(E)?P[typeof E=="string"?"string":"hash"]:P.map}function qo(_,E){var P=Ot(_,E);return of(P)?P:void 0}function pf(_){var E=gi.call(_,Zi),P=_[Zi];try{_[Zi]=void 0;var X=!0}catch{}var ut=el.call(_);return X&&(E?_[Zi]=P:delete _[Zi]),ut}function ul(_){return typeof _.constructor=="function"&&!xr(_)?Ko(Ho(_)):{}}function dl(_,E){var P=typeof _;return E=E??o,!!E&&(P=="number"||P!="symbol"&&V.test(_))&&_>-1&&_%1==0&&_<E}function mf(_,E,P){if(!Yi(P))return!1;var X=typeof E;return(X=="number"?ea(P)&&dl(E,P.length):X=="string"&&E in P)?Bn(P[E],_):!1}function fl(_){var E=typeof _;return E=="string"||E=="number"||E=="symbol"||E=="boolean"?_!=="__proto__":_===null}function On(_){return!!tl&&tl in _}function xr(_){var E=_&&_.constructor,P=typeof E=="function"&&E.prototype||Kr;return _===P}function gf(_){var E=[];if(_!=null)for(var P in Object(_))E.push(P);return E}function yf(_){return el.call(_)}function Ki(_,E,P){return E=Vi(E===void 0?_.length-1:E,0),function(){for(var X=arguments,ut=-1,bt=Vi(X.length-E,0),_t=Array(bt);++ut<bt;)_t[ut]=X[E+ut];ut=-1;for(var lt=Array(E+1);++ut<E;)lt[ut]=X[ut];return lt[E]=P(_t),pt(_,this,lt)}}function ta(_,E){if(!(E==="constructor"&&typeof _[E]=="function")&&E!="__proto__")return _[E]}var bf=xf(cf);function xf(_){var E=0,P=0;return function(){var X=sl(),ut=n-(X-P);if(P=X,ut>0){if(++E>=s)return arguments[0]}else E=0;return _.apply(void 0,arguments)}}function _f(_){if(_!=null){try{return Ln.call(_)}catch{}try{return _+""}catch{}}return""}function Bn(_,E){return _===E||_!==_&&E!==E}var bi=al(function(){return arguments}())?al:function(_){return zr(_)&&gi.call(_,"callee")&&!rl.call(_,"callee")},Un=Array.isArray;function ea(_){return _!=null&&ml(_.length)&&!Os(_)}function Xn(_){return zr(_)&&ea(_)}var pl=Wd||R;function Os(_){if(!Yi(_))return!1;var E=br(_);return E==f||E==p||E==l||E==b}function ml(_){return typeof _=="number"&&_>-1&&_%1==0&&_<=o}function Yi(_){var E=typeof _;return _!=null&&(E=="object"||E=="function")}function zr(_){return _!=null&&typeof _=="object"}function gl(_){if(!zr(_)||br(_)!=x)return!1;var E=Ho(_);if(E===null)return!0;var P=gi.call(E,"constructor")&&E.constructor;return typeof P=="function"&&P instanceof P&&Ln.call(P)==Xd}var jr=O?Rt(O):Hi;function yl(_){return ll(_,bl(_))}function bl(_){return ea(_)?yr(_,!0):af(_)}var vf=cl(function(_,E,P){hl(_,E,P)});function wf(_){return function(){return _}}function T(_){return _}function R(){return!1}r.exports=vf}(dh,dh.exports);var pE=dh.exports;const mE=Ws(pE);let ms=null;function gE(){ms=z.effectScope()}function yE(){ms==null||ms.stop(),ms=null}async function bE(){return ms||await Ce("scopeCreated")}let Fr=null;const Kg={animationDuration:500,disableAnimationsThreshold:500,disableEdgesThreshold:500,fetchEvents:()=>[],fetchEventsInterval:3e4,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:8,flowStateSelectedBarHeight:10,flowStateAreaAlpha:.1,eventTargetSize:30,eventBottomMargin:4,eventSelectedBorderInset:8,eventRadiusDefault:4,eventColor:"#A564F9",eventClusterRadiusDefault:6,eventClusterColor:"#A564F9",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 xE(r){const t=mE({},Kg,r);return t.styles.node=e=>{var i,s;return{...Kg.styles.node(e),...(s=(i=r.styles)==null?void 0:i.node)==null?void 0:s.call(i,e)}},t}async function _E(r){(await bE()).run(()=>{z.watch(()=>r.config,e=>{const i=xE(e);if(!Fr){Fr=i,tt.emit("configCreated",Fr);return}Object.assign(Fr,i),tt.emit("configUpdated",Fr)},{immediate:!0})})}function vE(){Fr=null}async function Lt(){return Fr||await Ce("configCreated")}async function Yg(r,t){const e=await Lt();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(),wE(s)))}function o(){clearTimeout(i)}return{start:n,stop:o}}function wE(r){const t=Math.floor(r.nodes.size/aa)*aa;return Math.max(aa,t)}function or(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function zg(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=vv(t)),typeof t=="number"?_v(t):t}dropShadowToCSS(){let t=this.normalizeColor(this.dropShadowColor);const e=this.dropShadowAlpha,r=Math.round(Math.cos(this.dropShadowAngle)*this.dropShadowDistance),n=Math.round(Math.sin(this.dropShadowAngle)*this.dropShadowDistance);t.startsWith("#")&&e<1&&(t+=(e*255|0).toString(16).padStart(2,"0"));const s=`${r}px ${n}px`;return this.dropShadowBlur>0?`text-shadow: ${s} ${this.dropShadowBlur}px ${t}`:`text-shadow: ${s} ${t}`}reset(){Object.assign(this,zs.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}=nt.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}};_u.availableFonts={},_u.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 vu=_u;const pl=class Ys extends Qt{constructor(t="",e={}){super(ot.EMPTY),this._text=null,this._style=null,this._autoResolution=!0,this.localStyleID=-1,this.dirty=!1,this._updateID=0,this.ownsStyle=!1;const r=new Image,n=ot.from(r,{scaleMode:nt.SCALE_MODE,resourceOptions:{autoLoad:!1}});n.orig=new gt,n.trim=new gt,this.texture=n;const s="http://www.w3.org/2000/svg",o="http://www.w3.org/1999/xhtml",a=document.createElementNS(s,"svg"),l=document.createElementNS(s,"foreignObject"),h=document.createElementNS(o,"div"),c=document.createElementNS(o,"style");l.setAttribute("width","10000"),l.setAttribute("height","10000"),l.style.overflow="hidden",a.appendChild(l),this.maxWidth=Ys.defaultMaxWidth,this.maxHeight=Ys.defaultMaxHeight,this._domElement=h,this._styleElement=c,this._svgRoot=a,this._foreignObject=l,this._foreignObject.appendChild(c),this._foreignObject.appendChild(h),this._image=r,this._loadImage=new Image,this._autoResolution=Ys.defaultAutoResolution,this._resolution=Ys.defaultResolution??nt.RESOLUTION,this.text=t,this.style=e}measureText(t){var c,u;const{text:e,style:r,resolution:n}=Object.assign({text:this._text,style:this._style,resolution:this._resolution},t);Object.assign(this._domElement,{innerHTML:e,style:r.toCSS(n)}),this._styleElement.textContent=r.toGlobalCSS(),document.body.appendChild(this._svgRoot);const s=this._domElement.getBoundingClientRect();this._svgRoot.remove();const{width:o,height:a}=s;(o>this.maxWidth||a>this.maxHeight)&&console.warn("[HTMLText] Large expanse of text, increase HTMLText.maxWidth or HTMLText.maxHeight property.");const l=Math.min(this.maxWidth,Math.ceil(o)),h=Math.min(this.maxHeight,Math.ceil(a));return this._svgRoot.setAttribute("width",l.toString()),this._svgRoot.setAttribute("height",h.toString()),e!==this._text&&(this._domElement.innerHTML=this._text),r!==this._style&&(Object.assign(this._domElement,{style:(c=this._style)==null?void 0:c.toCSS(n)}),this._styleElement.textContent=(u=this._style)==null?void 0:u.toGlobalCSS()),{width:l+r.padding*2,height:h+r.padding*2}}async updateText(t=!0){const{style:e,_image:r,_loadImage:n}=this;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&t)return;const{width:s,height:o}=this.measureText();r.width=n.width=Math.ceil(Math.max(1,s)),r.height=n.height=Math.ceil(Math.max(1,o)),this._updateID++;const a=this._updateID;await new Promise(l=>{n.onload=async()=>{if(a<this._updateID){l();return}await e.onBeforeDraw(),r.src=n.src,n.onload=null,n.src="",this.updateTexture(),l()};const h=new XMLSerializer().serializeToString(this._svgRoot);n.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(h)}`})}get source(){return this._image}updateTexture(){const{style:t,texture:e,_image:r,resolution:n}=this,{padding:s}=t,{baseTexture:o}=e;e.trim.width=e._frame.width=r.width/n,e.trim.height=e._frame.height=r.height/n,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(),o.setRealSize(r.width,r.height,n),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 r,n,s,o,a;typeof t=="boolean"&&(t={children:t}),t=Object.assign({},Ys.defaultDestroyOptions,t),super.destroy(t);const e=null;this.ownsStyle&&((r=this._style)==null||r.cleanFonts()),this._style=e,(n=this._svgRoot)==null||n.remove(),this._svgRoot=e,(s=this._domElement)==null||s.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=Ir(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=Ir(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 vu?(this.ownsStyle=!1,this._style=t):t instanceof Fr?(console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle"),this.ownsStyle=!0,this._style=vu.from(t)):(this.ownsStyle=!0,this._style=new vu(t)),this.localStyleID=-1,this.dirty=!0)}get text(){return this._text}set text(t){t=String(t===""||t===null||t===void 0?" ":t),t=this.sanitiseText(t),this._text!==t&&(this._text=t,this.dirty=!0)}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}sanitiseText(t){return t.replace(/<br>/gi,"<br/>").replace(/<hr>/gi,"<hr/>").replace(/&nbsp;/gi,"&#160;")}};pl.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},pl.defaultMaxWidth=2024,pl.defaultMaxHeight=2024,pl.defaultAutoResolution=!0;function G2(){const i=new Map;function t(o,a){const l=i.get(o);return l?l.add(a):i.set(o,new Set([a])),()=>r(o,a)}function e(o,a){const l=h=>{r(o,l),a(h)};t(o,l)}function r(o,a){var l;(l=i.get(o))==null||l.delete(a)}function n(o,a){var l;(l=i.get(o))==null||l.forEach(h=>h(a))}function s(){i.clear()}return{on:t,off:r,once:e,emit:n,clear:s}}const tt=G2();function Ie(i){let t;return new Promise(e=>{t=e,tt.on(i,t)}).then(e=>(tt.off(i,t),e))}let Gi=null;const rg=new ResizeObserver(()=>{Gi&&tt.emit("stageUpdated",Gi)});function k2(i){Gi=i,rg.observe(Gi),tt.emit("stageCreated",Gi)}function F2(){Gi&&rg.unobserve(Gi),Gi=null}async function wu(){return Gi||await Ie("stageCreated")}let Oe=null;async function D2(){const i=await wu();O2(i),tt.on("stageUpdated",B2)}function N2(){Oe&&(Oe.destroy(!0,{children:!0}),Oe=null)}function O2(i){Oe=new g0({backgroundAlpha:0,resizeTo:i,antialias:!0,resolution:Math.ceil(window.devicePixelRatio)}),Oe.stage.sortableChildren=!0,i.appendChild(Oe.view),tt.emit("applicationCreated",Oe),process.env.NODE_ENV==="development"&&(globalThis.__PIXI_APP__=Oe)}async function qt(){return Oe||await Ie("applicationCreated")}function B2(i){Oe&&(Oe.resizeTo=i,tt.emit("applicationResized",Oe))}var ml={exports:{}};ml.exports,function(i,t){var e=200,r="__lodash_hash_undefined__",n=800,s=16,o=9007199254740991,a="[object Arguments]",l="[object Array]",h="[object AsyncFunction]",c="[object Boolean]",u="[object Date]",d="[object Error]",f="[object Function]",p="[object GeneratorFunction]",m="[object Map]",g="[object Number]",y="[object Null]",x="[object Object]",b="[object Proxy]",v="[object RegExp]",w="[object Set]",S="[object String]",C="[object Undefined]",I="[object WeakMap]",M="[object ArrayBuffer]",L="[object DataView]",G="[object Float32Array]",F="[object Float64Array]",A="[object Int8Array]",N="[object Int16Array]",Z="[object Int32Array]",K="[object Uint8Array]",H="[object Uint8ClampedArray]",j="[object Uint16Array]",B="[object Uint32Array]",D=/[\\^$.*+?()[\]{}|]/g,k=/^\[object .+?Constructor\]$/,V=/^(?:0|[1-9]\d*)$/,et={};et[G]=et[F]=et[A]=et[N]=et[Z]=et[K]=et[H]=et[j]=et[B]=!0,et[a]=et[l]=et[M]=et[c]=et[L]=et[u]=et[d]=et[f]=et[m]=et[g]=et[x]=et[v]=et[w]=et[S]=et[I]=!1;var ft=typeof we=="object"&&we&&we.Object===Object&&we,at=typeof self=="object"&&self&&self.Object===Object&&self,Tt=ft||at||Function("return this")(),It=t&&!t.nodeType&&t,Q=It&&!0&&i&&!i.nodeType&&i,W=Q&&Q.exports===It,J=W&&ft.process,$=function(){try{var _=Q&&Q.require&&Q.require("util").types;return _||J&&J.binding&&J.binding("util")}catch{}}(),O=$&&$.isTypedArray;function pt(_,E,P){switch(P.length){case 0:return _.call(E);case 1:return _.call(E,P[0]);case 2:return _.call(E,P[0],P[1]);case 3:return _.call(E,P[0],P[1],P[2])}return _.apply(E,P)}function yt(_,E){for(var P=-1,X=Array(_);++P<_;)X[P]=E(P);return X}function Rt(_){return function(E){return _(E)}}function Bt(_,E){return _==null?void 0:_[E]}function Fe(_,E){return function(P){return _(E(P))}}var Ve=Array.prototype,Ho=Function.prototype,Jr=Object.prototype,ks=Tt["__core-js_shared__"],Fs=Ho.toString,yi=Jr.hasOwnProperty,nh=function(){var _=/[^.]+$/.exec(ks&&ks.keys&&ks.keys.IE_PROTO||"");return _?"Symbol(src)_1."+_:""}(),sh=Jr.toString,qd=Fs.call(Object),Ds=RegExp("^"+Fs.call(yi).replace(D,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),$r=W?Tt.Buffer:void 0,Ko=Tt.Symbol,He=Tt.Uint8Array,zo=$r?$r.allocUnsafe:void 0,Yo=Fe(Object.getPrototypeOf,Object),oh=Object.create,ah=Jr.propertyIsEnumerable,Ns=Ve.splice,Vi=Ko?Ko.toStringTag:void 0,Bn=function(){try{var _=ia(Object,"defineProperty");return _({},"",{}),_}catch{}}(),tf=$r?$r.isBuffer:void 0,Hi=Math.max,lh=Date.now,hh=ia(Tt,"Map"),Un=ia(Object,"create"),jo=function(){function _(){}return function(E){if(!Yi(E))return{};if(oh)return oh(E);_.prototype=E;var P=new _;return _.prototype=void 0,P}}();function Ke(_){var E=-1,P=_==null?0:_.length;for(this.clear();++E<P;){var X=_[E];this.set(X[0],X[1])}}function Jo(){this.__data__=Un?Un(null):{},this.size=0}function $o(_){var E=this.has(_)&&delete this.__data__[_];return this.size-=E?1:0,E}function Qo(_){var E=this.__data__;if(Un){var P=E[_];return P===r?void 0:P}return yi.call(E,_)?E[_]:void 0}function Xn(_){var E=this.__data__;return Un?E[_]!==void 0:yi.call(E,_)}function ef(_,E){var P=this.__data__;return this.size+=this.has(_)?0:1,P[_]=Un&&E===void 0?r:E,this}Ke.prototype.clear=Jo,Ke.prototype.delete=$o,Ke.prototype.get=Qo,Ke.prototype.has=Xn,Ke.prototype.set=ef;function bi(_){var E=-1,P=_==null?0:_.length;for(this.clear();++E<P;){var X=_[E];this.set(X[0],X[1])}}function rf(){this.__data__=[],this.size=0}function nf(_){var E=this.__data__,P=Os(E,_);if(P<0)return!1;var X=E.length-1;return P==X?E.pop():Ns.call(E,P,1),--this.size,!0}function sf(_){var E=this.__data__,P=Os(E,_);return P<0?void 0:E[P][1]}function ch(_){return Os(this.__data__,_)>-1}function qo(_,E){var P=this.__data__,X=Os(P,_);return X<0?(++this.size,P.push([_,E])):P[X][1]=E,this}bi.prototype.clear=rf,bi.prototype.delete=nf,bi.prototype.get=sf,bi.prototype.has=ch,bi.prototype.set=qo;function De(_){var E=-1,P=_==null?0:_.length;for(this.clear();++E<P;){var X=_[E];this.set(X[0],X[1])}}function of(){this.size=0,this.__data__={hash:new Ke,map:new(hh||bi),string:new Ke}}function af(_){var E=Us(this,_).delete(_);return this.size-=E?1:0,E}function lf(_){return Us(this,_).get(_)}function hf(_){return Us(this,_).has(_)}function cf(_,E){var P=Us(this,_),X=P.size;return P.set(_,E),this.size+=P.size==X?0:1,this}De.prototype.clear=of,De.prototype.delete=af,De.prototype.get=lf,De.prototype.has=hf,De.prototype.set=cf;function _e(_){var E=this.__data__=new bi(_);this.size=E.size}function uf(){this.__data__=new bi,this.size=0}function df(_){var E=this.__data__,P=E.delete(_);return this.size=E.size,P}function ff(_){return this.__data__.get(_)}function pf(_){return this.__data__.has(_)}function mf(_,E){var P=this.__data__;if(P instanceof bi){var X=P.__data__;if(!hh||X.length<e-1)return X.push([_,E]),this.size=++P.size,this;P=this.__data__=new De(X)}return P.set(_,E),this.size=P.size,this}_e.prototype.clear=uf,_e.prototype.delete=df,_e.prototype.get=ff,_e.prototype.has=pf,_e.prototype.set=mf;function xr(_,E){var P=Zs(_),X=!P&&xi(_),ut=!P&&!X&&bh(_),bt=!P&&!X&&!ut&&qr(_),_t=P||X||ut||bt,ht=_t?yt(_.length,String):[],vt=ht.length;for(var Xt in _)(E||yi.call(_,Xt))&&!(_t&&(Xt=="length"||ut&&(Xt=="offset"||Xt=="parent")||bt&&(Xt=="buffer"||Xt=="byteLength"||Xt=="byteOffset")||gh(Xt,vt)))&&ht.push(Xt);return ht}function ta(_,E,P){(P!==void 0&&!Ws(_[E],P)||P===void 0&&!(E in _))&&ea(_,E,P)}function gf(_,E,P){var X=_[E];(!(yi.call(_,E)&&Ws(X,P))||P===void 0&&!(E in _))&&ea(_,E,P)}function Os(_,E){for(var P=_.length;P--;)if(Ws(_[P][0],E))return P;return-1}function ea(_,E,P){E=="__proto__"&&Bn?Bn(_,E,{configurable:!0,enumerable:!0,value:P,writable:!0}):_[E]=P}var yf=Ef();function _r(_){return _==null?_===void 0?C:y:Vi&&Vi in Object(_)?Cf(_):Mf(_)}function uh(_){return Qr(_)&&_r(_)==a}function bf(_){if(!Yi(_)||Xs(_))return!1;var E=Zn(_)?Ds:k;return E.test(Lf(_))}function Ki(_){return Qr(_)&&xh(_.length)&&!!et[_r(_)]}function xf(_){if(!Yi(_))return Af(_);var E=vr(_),P=[];for(var X in _)X=="constructor"&&(E||!yi.call(_,X))||P.push(X);return P}function dh(_,E,P,X,ut){_!==E&&yf(E,function(bt,_t){if(ut||(ut=new _e),Yi(bt))_f(_,E,_t,P,dh,X,ut);else{var ht=X?X(ra(_,_t),bt,_t+"",_,E,ut):void 0;ht===void 0&&(ht=bt),ta(_,_t,ht)}},wh)}function _f(_,E,P,X,ut,bt,_t){var ht=ra(_,P),vt=ra(E,P),Xt=_t.get(vt);if(Xt){ta(_,P,Xt);return}var Pt=bt?bt(ht,vt,P+"",_,E,_t):void 0,fe=Pt===void 0;if(fe){var ve=Zs(vt),si=!ve&&bh(vt),oi=!ve&&!si&&qr(vt);Pt=vt,ve||si||oi?Zs(ht)?Pt=ht:Vs(ht)?Pt=Wn(ht):si?(fe=!1,Pt=Tf(vt,!0)):oi?(fe=!1,Pt=Sf(vt,!0)):Pt=[]:_h(vt)||xi(vt)?(Pt=ht,xi(ht)?Pt=vh(ht):(!Yi(ht)||Zn(ht))&&(Pt=mh(vt))):fe=!1}fe&&(_t.set(vt,Pt),ut(Pt,vt,X,bt,_t),_t.delete(vt)),ta(_,P,Pt)}function vf(_,E){return Rf(zi(_,E,T),_+"")}var wf=Bn?function(_,E){return Bn(_,"toString",{configurable:!0,enumerable:!1,value:kf(E),writable:!0})}:T;function Tf(_,E){if(E)return _.slice();var P=_.length,X=zo?zo(P):new _.constructor(P);return _.copy(X),X}function Bs(_){var E=new _.constructor(_.byteLength);return new He(E).set(new He(_)),E}function Sf(_,E){var P=E?Bs(_.buffer):_.buffer;return new _.constructor(P,_.byteOffset,_.length)}function Wn(_,E){var P=-1,X=_.length;for(E||(E=Array(X));++P<X;)E[P]=_[P];return E}function fh(_,E,P,X){var ut=!P;P||(P={});for(var bt=-1,_t=E.length;++bt<_t;){var ht=E[bt],vt=X?X(P[ht],_[ht],ht,P,_):void 0;vt===void 0&&(vt=_[ht]),ut?ea(P,ht,vt):gf(P,ht,vt)}return P}function ph(_){return vf(function(E,P){var X=-1,ut=P.length,bt=ut>1?P[ut-1]:void 0,_t=ut>2?P[2]:void 0;for(bt=_.length>3&&typeof bt=="function"?(ut--,bt):void 0,_t&&If(P[0],P[1],_t)&&(bt=ut<3?void 0:bt,ut=1),E=Object(E);++X<ut;){var ht=P[X];ht&&_(E,ht,X,bt)}return E})}function Ef(_){return function(E,P,X){for(var ut=-1,bt=Object(E),_t=X(E),ht=_t.length;ht--;){var vt=_t[_?ht:++ut];if(P(bt[vt],vt,bt)===!1)break}return E}}function Us(_,E){var P=_.__data__;return yh(E)?P[typeof E=="string"?"string":"hash"]:P.map}function ia(_,E){var P=Bt(_,E);return bf(P)?P:void 0}function Cf(_){var E=yi.call(_,Vi),P=_[Vi];try{_[Vi]=void 0;var X=!0}catch{}var ut=sh.call(_);return X&&(E?_[Vi]=P:delete _[Vi]),ut}function mh(_){return typeof _.constructor=="function"&&!vr(_)?jo(Yo(_)):{}}function gh(_,E){var P=typeof _;return E=E??o,!!E&&(P=="number"||P!="symbol"&&V.test(_))&&_>-1&&_%1==0&&_<E}function If(_,E,P){if(!Yi(P))return!1;var X=typeof E;return(X=="number"?na(P)&&gh(E,P.length):X=="string"&&E in P)?Ws(P[E],_):!1}function yh(_){var E=typeof _;return E=="string"||E=="number"||E=="symbol"||E=="boolean"?_!=="__proto__":_===null}function Xs(_){return!!nh&&nh in _}function vr(_){var E=_&&_.constructor,P=typeof E=="function"&&E.prototype||Jr;return _===P}function Af(_){var E=[];if(_!=null)for(var P in Object(_))E.push(P);return E}function Mf(_){return sh.call(_)}function zi(_,E,P){return E=Hi(E===void 0?_.length-1:E,0),function(){for(var X=arguments,ut=-1,bt=Hi(X.length-E,0),_t=Array(bt);++ut<bt;)_t[ut]=X[E+ut];ut=-1;for(var ht=Array(E+1);++ut<E;)ht[ut]=X[ut];return ht[E]=P(_t),pt(_,this,ht)}}function ra(_,E){if(!(E==="constructor"&&typeof _[E]=="function")&&E!="__proto__")return _[E]}var Rf=Pf(wf);function Pf(_){var E=0,P=0;return function(){var X=lh(),ut=s-(X-P);if(P=X,ut>0){if(++E>=n)return arguments[0]}else E=0;return _.apply(void 0,arguments)}}function Lf(_){if(_!=null){try{return Fs.call(_)}catch{}try{return _+""}catch{}}return""}function Ws(_,E){return _===E||_!==_&&E!==E}var xi=uh(function(){return arguments}())?uh:function(_){return Qr(_)&&yi.call(_,"callee")&&!ah.call(_,"callee")},Zs=Array.isArray;function na(_){return _!=null&&xh(_.length)&&!Zn(_)}function Vs(_){return Qr(_)&&na(_)}var bh=tf||R;function Zn(_){if(!Yi(_))return!1;var E=_r(_);return E==f||E==p||E==h||E==b}function xh(_){return typeof _=="number"&&_>-1&&_%1==0&&_<=o}function Yi(_){var E=typeof _;return _!=null&&(E=="object"||E=="function")}function Qr(_){return _!=null&&typeof _=="object"}function _h(_){if(!Qr(_)||_r(_)!=x)return!1;var E=Yo(_);if(E===null)return!0;var P=yi.call(E,"constructor")&&E.constructor;return typeof P=="function"&&P instanceof P&&Fs.call(P)==qd}var qr=O?Rt(O):Ki;function vh(_){return fh(_,wh(_))}function wh(_){return na(_)?xr(_,!0):xf(_)}var Gf=ph(function(_,E,P){dh(_,E,P)});function kf(_){return function(){return _}}function T(_){return _}function R(){return!1}i.exports=Gf}(ml,ml.exports);var U2=ml.exports;const X2=Tr(U2);let _n=null;function W2(){_n=Y.effectScope()}function Z2(){_n==null||_n.stop(),_n=null}async function V2(){return _n||await Ie("scopeCreated")}let Nr=null;const ng={animationDuration:500,disableAnimationsThreshold:500,disableEdgesThreshold:500,fetchEvents:()=>[],fetchEventsInterval:3e4,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:8,flowStateSelectedBarHeight:10,flowStateAreaAlpha:.1,eventTargetSize:30,eventBottomMargin:4,eventSelectedBorderInset:8,eventRadiusDefault:4,eventColor:"#A564F9",eventClusterRadiusDefault:6,eventClusterColor:"#A564F9",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 H2(i){const t=X2({},ng,i);return t.styles.node=e=>{var r,n;return{...ng.styles.node(e),...(n=(r=i.styles)==null?void 0:r.node)==null?void 0:n.call(r,e)}},t}async function K2(i){(await V2()).run(()=>{Y.watch(()=>i.config,e=>{const r=H2(e);if(!Nr){Nr=r,tt.emit("configCreated",Nr);return}Object.assign(Nr,r),tt.emit("configUpdated",Nr)},{immediate:!0})})}function z2(){Nr=null}async function Lt(){return Nr||await Ie("configCreated")}async function sg(i,t){const e=await Lt();let r,n=null;async function s(){try{n=await e.fetch(i),t(n)}catch(a){console.error(a)}n&&!n.end_time&&(r=setTimeout(()=>s(),Y2(n)))}function o(){clearTimeout(r)}return{start:s,stop:o}}function Y2(i){const t=Math.floor(i.nodes.size/ca)*ca;return Math.max(ca,t)}function ar(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function og(i,t){i.prototype=Object.create(t.prototype),i.prototype.constructor=i,i.__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 Oe={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},cn={duration:.5,overwrite:!1,delay:0},xu,ge,Bt,Je=1e8,Nt=1/Je,_u=Math.PI*2,TE=_u/4,SE=0,jg=Math.sqrt,EE=Math.cos,CE=Math.sin,le=function(t){return typeof t=="string"},Yt=function(t){return typeof t=="function"},ar=function(t){return typeof t=="number"},vu=function(t){return typeof t>"u"},Gi=function(t){return typeof t=="object"},Ie=function(t){return t!==!1},wu=function(){return typeof window<"u"},fh=function(t){return Yt(t)||le(t)},Jg=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},ye=Array.isArray,Tu=/(?:-?\.?\d|\.)+/gi,$g=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,un=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,Su=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,Qg=/[+-]=-?[.\d]+/,qg=/[^,'"\[\]\s]+/gi,IE=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,Vt,Fi,Eu,Cu,Be={},ph={},t0,e0=function(t){return(ph=ys(t,Be))&&Re},Iu=function(t,e){return console.warn("Invalid property",t,"set to",e,"Missing plugin? gsap.registerPlugin()")},uo=function(t,e){return!e&&console.warn(t)},i0=function(t,e){return t&&(Be[t]=e)&&ph&&(ph[t]=e)||Be},fo=function(){return 0},AE={suppressEvents:!0,isStart:!0,kill:!1},mh={suppressEvents:!0,kill:!1},ME={suppressEvents:!0},Au={},Nr=[],Mu={},r0,Ue={},Ru={},s0=30,gh=[],Pu="",Lu=function(t){var e=t[0],i,s;if(Gi(e)||Yt(e)||(t=[t]),!(i=(e._gsap||{}).harness)){for(s=gh.length;s--&&!gh[s].targetTest(e););i=gh[s]}for(s=t.length;s--;)t[s]&&(t[s]._gsap||(t[s]._gsap=new G0(t[s],i)))||t.splice(s,1);return t},gs=function(t){return t._gsap||Lu(qe(t))[0]._gsap},n0=function(t,e,i){return(i=t[e])&&Yt(i)?t[e]():vu(i)&&t.getAttribute&&t.getAttribute(e)||i},Ae=function(t,e){return(t=t.split(",")).forEach(e)||t},jt=function(t){return Math.round(t*1e5)/1e5||0},ce=function(t){return Math.round(t*1e7)/1e7||0},dn=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},RE=function(t,e){for(var i=e.length,s=0;t.indexOf(e[s])<0&&++s<i;);return s<i},yh=function(){var t=Nr.length,e=Nr.slice(0),i,s;for(Mu={},Nr.length=0,i=0;i<t;i++)s=e[i],s&&s._lazy&&(s.render(s._lazy[0],s._lazy[1],!0)._lazy=0)},o0=function(t,e,i,s){Nr.length&&!ge&&yh(),t.render(e,i,s||ge&&e<0&&(t._initted||t._startAt)),Nr.length&&!ge&&yh()},a0=function(t){var e=parseFloat(t);return(e||e===0)&&(t+"").match(qg).length<2?e:le(t)?t.trim():t},h0=function(t){return t},$e=function(t,e){for(var i in e)i in t||(t[i]=e[i]);return t},PE=function(t){return function(e,i){for(var s in i)s in e||s==="duration"&&t||s==="ease"||(e[s]=i[s])}},ys=function(t,e){for(var i in e)t[i]=e[i];return t},l0=function r(t,e){for(var i in e)i!=="__proto__"&&i!=="constructor"&&i!=="prototype"&&(t[i]=Gi(e[i])?r(t[i]||(t[i]={}),e[i]):e[i]);return t},bh=function(t,e){var i={},s;for(s in t)s in e||(i[s]=t[s]);return i},po=function(t){var e=t.parent||Vt,i=t.keyframes?PE(ye(t.keyframes)):$e;if(Ie(t.inherit))for(;e;)i(t,e.vars.defaults),e=e.parent||e._dp;return t},LE=function(t,e){for(var i=t.length,s=i===e.length;s&&i--&&t[i]===e[i];);return i<0},c0=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},xh=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},kr=function(t,e){t.parent&&(!e||t.parent.autoRemoveChildren)&&t.parent.remove&&t.parent.remove(t),t._act=0},bs=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},GE=function(t){for(var e=t.parent;e&&e.parent;)e._dirty=1,e.totalDuration(),e=e.parent;return t},Gu=function(t,e,i,s){return t._startAt&&(ge?t._startAt.revert(mh):t.vars.immediateRender&&!t.vars.autoRevert||t._startAt.render(e,!0,s))},FE=function r(t){return!t||t._ts&&r(t.parent)},u0=function(t){return t._repeat?fn(t._tTime,t=t.duration()+t._rDelay)*t:0},fn=function(t,e){var i=Math.floor(t/=e);return t&&i===t?i-1:i},_h=function(t,e){return(t-e._start)*e._ts+(e._ts>=0?0:e._dirty?e.totalDuration():e._tDur)},vh=function(t){return t._end=ce(t._start+(t._tDur/Math.abs(t._ts||t._rts||Nt)||0))},wh=function(t,e){var i=t._dp;return i&&i.smoothChildTiming&&t._ts&&(t._start=ce(i._time-(t._ts>0?e/t._ts:((t._dirty?t.totalDuration():t._tDur)-e)/-t._ts)),vh(t),i._dirty||bs(i,t)),t},d0=function(t,e){var i;if((e._time||!e._dur&&e._initted||e._start<t._time&&(e._dur||!e.add))&&(i=_h(t.rawTime(),e),(!e._dur||go(0,e.totalDuration(),i)-e._tTime>Nt)&&e.render(i,!0)),bs(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=-Nt}},Ni=function(t,e,i,s){return e.parent&&kr(e),e._start=ce((ar(i)?i:i||t!==Vt?Qe(t,i,e):t._time)+e._delay),e._end=ce(e._start+(e.totalDuration()/Math.abs(e.timeScale())||0)),c0(t,e,"_first","_last",t._sort?"_start":0),Fu(e)||(t._recent=e),s||d0(t,e),t._ts<0&&wh(t,t._tTime),t},f0=function(t,e){return(Be.ScrollTrigger||Iu("scrollTrigger",e))&&Be.ScrollTrigger.create(e,t)},p0=function(t,e,i,s,n){if(Zu(t,e,n),!t._initted)return 1;if(!i&&t._pt&&!ge&&(t._dur&&t.vars.lazy!==!1||!t._dur&&t.vars.lazy)&&r0!==We.frame)return Nr.push(t),t._lazy=[n,s],1},NE=function r(t){var e=t.parent;return e&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||r(e))},Fu=function(t){var e=t.data;return e==="isFromStart"||e==="isStart"},kE=function(t,e,i,s){var n=t.ratio,o=e<0||!e&&(!t._start&&NE(t)&&!(!t._initted&&Fu(t))||(t._ts<0||t._dp._ts<0)&&!Fu(t))?0:1,a=t._rDelay,h=0,l,c,u;if(a&&t._repeat&&(h=go(0,t._tDur,e),c=fn(h,a),t._yoyo&&c&1&&(o=1-o),c!==fn(t._tTime,a)&&(n=1-o,t.vars.repeatRefresh&&t._initted&&t.invalidate())),o!==n||ge||s||t._zTime===Nt||!e&&t._zTime){if(!t._initted&&p0(t,e,s,i,h))return;for(u=t._zTime,t._zTime=e||(i?Nt: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&&Gu(t,e,i,!0),t._onUpdate&&!i&&Xe(t,"onUpdate"),h&&t._repeat&&!i&&t.parent&&Xe(t,"onRepeat"),(e>=t._tDur||e<0)&&t.ratio===o&&(o&&kr(t,1),!i&&!ge&&(Xe(t,o?"onComplete":"onReverseComplete",!0),t._prom&&t._prom()))}else t._zTime||(t._zTime=e)},DE=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}},pn=function(t,e,i,s){var n=t._repeat,o=ce(e)||0,a=t._tTime/t._tDur;return a&&!s&&(t._time*=o/t._dur),t._dur=o,t._tDur=n?n<0?1e10:ce(o*(n+1)+t._rDelay*n):o,a>0&&!s&&wh(t,t._tTime=t._tDur*a),t.parent&&vh(t),i||bs(t.parent,t),t},m0=function(t){return t instanceof Se?bs(t):pn(t,t._dur)},OE={_start:0,endTime:fo,totalDuration:fo},Qe=function r(t,e,i){var s=t.labels,n=t._recent||OE,o=t.duration()>=Je?n.endTime(!1):t._dur,a,h,l;return le(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*(ye(i)?i[0]:i).totalDuration()),a>1?r(t,e.substr(0,a-1),i)+h:o+h)):e==null?o:+e},mo=function(t,e,i){var s=ar(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=Ie(h.vars.inherit)&&h.parent;o.immediateRender=Ie(a.immediateRender),t<2?o.runBackwards=1:o.startAt=e[n-1]}return new qt(e[0],o,e[n+1])},Dr=function(t,e){return t||t===0?e(t):e},go=function(t,e,i){return i<t?t:i>e?e:i},be=function(t,e){return!le(t)||!(e=IE.exec(t))?"":e[1]},BE=function(t,e,i){return Dr(i,function(s){return go(t,e,s)})},Nu=[].slice,g0=function(t,e){return t&&Gi(t)&&"length"in t&&(!e&&!t.length||t.length-1 in t&&Gi(t[0]))&&!t.nodeType&&t!==Fi},UE=function(t,e,i){return i===void 0&&(i=[]),t.forEach(function(s){var n;return le(s)&&!e||g0(s,1)?(n=i).push.apply(n,qe(s)):i.push(s)})||i},qe=function(t,e,i){return Bt&&!e&&Bt.selector?Bt.selector(t):le(t)&&!i&&(Eu||!gn())?Nu.call((e||Cu).querySelectorAll(t),0):ye(t)?UE(t,i):g0(t)?Nu.call(t,0):t?[t]:[]},ku=function(t){return t=qe(t)[0]||uo("Invalid scope")||{},function(e){var i=t.current||t.nativeElement||t;return qe(e,i.querySelectorAll?i:i===t?uo("Invalid scope")||Cu.createElement("div"):t)}},y0=function(t){return t.sort(function(){return .5-Math.random()})},b0=function(t){if(Yt(t))return t;var e=Gi(t)?t:{each:t},i=xs(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 le(s)?c=u={center:.5,edges:.5,end:1}[s]||0:!a&&h&&(c=s[0],u=s[1]),function(d,f,p){var m=(p||e).length,g=o[m],y,x,b,v,w,S,C,I,M;if(!g){if(M=e.grid==="auto"?0:(e.grid||[1,Je])[1],!M){for(C=-Je;C<(C=p[M++].getBoundingClientRect().left)&&M<m;);M<m&&M--}for(g=o[m]=[],y=h?Math.min(M,m)*c-.5:s%M,x=M===Je?0:h?m*u/M-.5:s/M|0,C=0,I=Je,S=0;S<m;S++)b=S%M-y,v=x-(S/M|0),g[S]=w=l?Math.abs(l==="y"?v:b):jg(b*b+v*v),w>C&&(C=w),w<I&&(I=w);s==="random"&&y0(g),g.max=C-I,g.min=I,g.v=m=(parseFloat(e.amount)||parseFloat(e.each)*(M>m?m-1:l?l==="y"?m/M:M:Math.max(M,m/M))||0)*(s==="edges"?-1:1),g.b=m<0?n-m:n,g.u=be(e.amount||e.each)||0,i=i&&m<0?R0(i):i}return m=(g[d]-g.min)/g.max||0,ce(g.b+(i?i(m):m)*g.v)+g.u}},Du=function(t){var e=Math.pow(10,((t+"").split(".")[1]||"").length);return function(i){var s=ce(Math.round(parseFloat(i)/t)*t*e);return(s-s%1)/e+(ar(i)?0:be(i))}},x0=function(t,e){var i=ye(t),s,n;return!i&&Gi(t)&&(s=i=t.radius||Je,t.values?(t=qe(t.values),(n=!ar(t[0]))&&(s*=s)):t=Du(t.increment)),Dr(e,i?Yt(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||ar(o)?c:c+be(o)}:Du(t))},_0=function(t,e,i,s){return Dr(ye(t)?!e:i===!0?!!(i=0):!s,function(){return ye(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})},XE=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)}},WE=function(t,e){return function(i){return t(parseFloat(i))+(e||be(i))}},ZE=function(t,e,i){return w0(t,e,0,1,i)},v0=function(t,e,i){return Dr(i,function(s){return t[~~e(s)]})},VE=function r(t,e,i){var s=e-t;return ye(t)?v0(t,r(0,t.length),e):Dr(i,function(n){return(s+(n-t)%s)%s+t})},HE=function r(t,e,i){var s=e-t,n=s*2;return ye(t)?v0(t,r(0,t.length-1),e):Dr(i,function(o){return o=(n+(o-t)%n)%n||0,t+(o>s?n-o:o)})},yo=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?qg:Tu),i+=t.substr(e,s-e)+_0(a?n:+n[0],a?0:+n[1],+n[2]||1e-5),e=o+1;return i+t.substr(e,t.length-e)},w0=function(t,e,i,s,n){var o=e-t,a=s-i;return Dr(n,function(h){return i+((h-t)/o*a||0)})},KE=function r(t,e,i,s){var n=isNaN(t+e)?0:function(f){return(1-f)*t+f*e};if(!n){var o=le(t),a={},h,l,c,u,d;if(i===!0&&(s=1)&&(i=null),o)t={p:t},e={p:e};else if(ye(t)&&!ye(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(p){p*=u;var m=Math.min(d,~~p);return c[m](p-m)},i=e}else s||(t=ys(ye(t)?[]:{},t));if(!c){for(h in e)Xu.call(a,t,h,"get",e[h]);n=function(p){return Ku(p,a)||(o?t.p:t)}}}return Dr(i,n)},T0=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},Xe=function(t,e,i){var s=t.vars,n=s[e],o=Bt,a=t._ctx,h,l,c;if(n)return h=s[e+"Params"],l=s.callbackScope||t,i&&Nr.length&&yh(),a&&(Bt=a),c=h?n.apply(l,h):n.call(l),Bt=o,c},bo=function(t){return kr(t),t.scrollTrigger&&t.scrollTrigger.kill(!!ge),t.progress()<1&&Xe(t,"onInterrupt"),t},mn,S0=[],E0=function(t){if(t)if(t=!t.name&&t.default||t,wu()||t.headless){var e=t.name,i=Yt(t),s=e&&!i&&t.init?function(){this._props=[]}:t,n={init:fo,render:Ku,add:Xu,kill:hC,modifier:aC,rawVars:0},o={targetTest:0,get:0,getSetter:Hu,aliases:{},register:0};if(gn(),t!==s){if(Ue[e])return;$e(s,$e(bh(t,n),o)),ys(s.prototype,ys(n,bh(t,o))),Ue[s.prop=e]=s,t.targetTest&&(gh.push(s),Au[e]=1),e=(e==="css"?"CSS":e.charAt(0).toUpperCase()+e.substr(1))+"Plugin"}i0(e,s),t.register&&t.register(Re,s,Me)}else S0.push(t)},Gt=255,xo={aqua:[0,Gt,Gt],lime:[0,Gt,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,Gt],navy:[0,0,128],white:[Gt,Gt,Gt],olive:[128,128,0],yellow:[Gt,Gt,0],orange:[Gt,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[Gt,0,0],pink:[Gt,192,203],cyan:[0,Gt,Gt],transparent:[Gt,Gt,Gt,0]},Ou=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)*Gt+.5|0},C0=function(t,e,i){var s=t?ar(t)?[t>>16,t>>8&Gt,t&Gt]:0:xo.black,n,o,a,h,l,c,u,d,f,p;if(!s){if(t.substr(-1)===","&&(t=t.substr(0,t.length-1)),xo[t])s=xo[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&Gt,s&Gt,parseInt(t.substr(7),16)/255];t=parseInt(t.substr(1),16),s=[t>>16,t>>8&Gt,t&Gt]}else if(t.substr(0,3)==="hsl"){if(s=p=t.match(Tu),!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]=Ou(h+1/3,n,o),s[1]=Ou(h,n,o),s[2]=Ou(h-1/3,n,o);else if(~t.indexOf("="))return s=t.match($g),i&&s.length<4&&(s[3]=1),s}else s=t.match(Tu)||xo.transparent;s=s.map(Number)}return e&&!p&&(n=s[0]/Gt,o=s[1]/Gt,a=s[2]/Gt,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},I0=function(t){var e=[],i=[],s=-1;return t.split(Or).forEach(function(n){var o=n.match(un)||[];e.push.apply(e,o),i.push(s+=o.length+1)}),e.c=i,e},A0=function(t,e,i){var s="",n=(t+s).match(Or),o=e?"hsla(":"rgba(",a=0,h,l,c,u;if(!n)return t;if(n=n.map(function(d){return(d=C0(d,e,1))&&o+(e?d[0]+","+d[1]+"%,"+d[2]+"%,"+d[3]:d.join(","))+")"}),i&&(c=I0(t),h=i.c,h.join(s)!==c.c.join(s)))for(l=t.replace(Or,"1").split(un),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(Or),u=l.length-1;a<u;a++)s+=l[a]+n[a];return s+l[u]},Or=function(){var r="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b",t;for(t in xo)r+="|"+t+"\\b";return new RegExp(r+")","gi")}(),YE=/hsl[a]?\(/,M0=function(t){var e=t.join(" "),i;if(Or.lastIndex=0,Or.test(e))return i=YE.test(e),t[1]=A0(t[1],i),t[0]=A0(t[0],i,I0(t[1])),!0},_o,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,p=function m(g){var y=r()-s,x=g===!0,b,v,w,S;if((y>t||y<0)&&(i+=y-e),s+=y,w=s-i,b=w-o,(b>0||x)&&(S=++u.frame,d=w-u.time*1e3,u.time=w=w/1e3,o+=b+(b>=n?4:n-b),v=1),x||(h=l(m)),v)for(f=0;f<a.length;f++)a[f](w,d,S,g)};return u={time:0,frame:0,tick:function(){p(!0)},deltaRatio:function(g){return d/(1e3/(g||60))},wake:function(){t0&&(!Eu&&wu()&&(Fi=Eu=window,Cu=Fi.document||{},Be.gsap=Re,(Fi.gsapVersions||(Fi.gsapVersions=[])).push(Re.version),e0(ph||Fi.GreenSockGlobals||!Fi.gsap&&Fi||{}),S0.forEach(E0)),c=typeof requestAnimationFrame<"u"&&requestAnimationFrame,h&&u.sleep(),l=c||function(g){return setTimeout(g,o-u.time*1e3+1|0)},_o=1,p(2))},sleep:function(){(c?cancelAnimationFrame:clearTimeout)(h),_o=0,l=fo},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,x){var b=y?function(v,w,S,C){g(v,w,S,C),u.remove(b)}:g;return u.remove(g),a[x?"unshift":"push"](b),gn(),b},remove:function(g,y){~(y=a.indexOf(g))&&a.splice(y,1)&&f>=y&&f--},_listeners:a},u}(),gn=function(){return!_o&&We.wake()},Et={},zE=/^[\d.\-M][\d.\-,\s]/,jE=/["']/g,JE=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(jE,"").trim():+l,s=h.substr(a+1).trim();return e},$E=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)},QE=function(t){var e=(t+"").split("("),i=Et[e[0]];return i&&e.length>1&&i.config?i.config.apply(null,~t.indexOf("{")?[JE(e[1])]:$E(t).split(",").map(a0)):Et._CE&&zE.test(t)?Et._CE("",t):i},R0=function(t){return function(e){return 1-t(1-e)}},P0=function r(t,e){for(var i=t._first,s;i;)i instanceof Se?r(i,e):i.vars.yoyoEase&&(!i._yoyo||!i._repeat)&&i._yoyo!==e&&(i.timeline?r(i.timeline,e):(s=i._ease,i._ease=i._yEase,i._yEase=s,i._yoyo=e)),i=i._next},xs=function(t,e){return t&&(Yt(t)?t:Et[t]||QE(t))||e},_s=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 Ae(t,function(a){Et[a]=Be[a]=n,Et[o=a.toLowerCase()]=i;for(var h in n)Et[o+(h==="easeIn"?".in":h==="easeOut"?".out":".inOut")]=Et[a+"."+h]=n[h]}),n},L0=function(t){return function(e){return e<.5?(1-t(1-e*2))/2:.5+t((e-.5)*2)/2}},Bu=function r(t,e,i){var s=e>=1?e:1,n=(i||(t?.3:.45))/(e<1?e:1),o=n/_u*(Math.asin(1/s)||0),a=function(c){return c===1?1:s*Math.pow(2,-10*c)*CE((c-o)*n)+1},h=t==="out"?a:t==="in"?function(l){return 1-a(1-l)}:L0(a);return n=_u/n,h.config=function(l,c){return r(t,l,c)},h},Uu=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)}:L0(i);return s.config=function(n){return r(t,n)},s};Ae("Linear,Quad,Cubic,Quart,Quint,Strong",function(r,t){var e=t<5?t+1:t;_s(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})}),Et.Linear.easeNone=Et.none=Et.Linear.easeIn,_s("Elastic",Bu("in"),Bu("out"),Bu()),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};_s("Bounce",function(o){return 1-n(1-o)},n)}(7.5625,2.75),_s("Expo",function(r){return r?Math.pow(2,10*(r-1)):0}),_s("Circ",function(r){return-(jg(1-r*r)-1)}),_s("Sine",function(r){return r===1?1:-EE(r*TE)+1}),_s("Back",Uu("in"),Uu("out"),Uu()),Et.SteppedEase=Et.steps=Be.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-Nt;return function(a){return((s*go(0,o,a)|0)+n)*i}}},cn.ease=Et["quad.out"],Ae("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",function(r){return Pu+=r+","+r+"Params,"});var G0=function(t,e){this.id=SE++,t._gsap=this,this.target=t,this.harness=e,this.get=e?e.get:n0,this.set=e?e.getSetter:Hu},vo=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,pn(this,+e.duration,1,1),this.data=e.data,Bt&&(this._ctx=Bt,Bt.data.push(this)),_o||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,pn(this,this._repeat<0?i:(i-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},t.totalTime=function(i,s){if(gn(),!arguments.length)return this._tTime;var n=this._dp;if(n&&n.smoothChildTiming&&this._ts){for(wh(this,i),!n._dp||n.parent||d0(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)&&Ni(this._dp,this,this._start-this._delay)}return(this._tTime!==i||!this._dur&&!s||this._initted&&Math.abs(this._zTime)===Nt||!i&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=i),o0(this,i,s)),this},t.time=function(i,s){return arguments.length?this.totalTime(Math.min(this.totalDuration(),i+u0(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)+u0(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?fn(this._tTime,n)+1:1},t.timeScale=function(i,s){if(!arguments.length)return this._rts===-Nt?0:this._rts;if(this._rts===i)return this;var n=this.parent&&this._ts?_h(this.parent._time,this):this._tTime;return this._rts=+i||0,this._ts=this._ps||i===-Nt?0:this._rts,this.totalTime(go(-Math.abs(this._delay),this._tDur,n),s!==!1),vh(this),GE(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):(gn(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,this.progress()===1&&Math.abs(this._zTime)!==Nt&&(this._tTime-=Nt)))),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)&&Ni(s,this,i-this._delay),this}return this._start},t.endTime=function(i){return this._start+(Ie(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?_h(s.rawTime(i),this):this._tTime:this._tTime},t.revert=function(i){i===void 0&&(i=ME);var s=ge;return ge=i,(this._initted||this._startAt)&&(this.timeline&&this.timeline.revert(i),this.totalTime(-.01,i.suppressEvents)),this.data!=="nested"&&i.kill!==!1&&this.kill(),ge=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,m0(this)):this._repeat===-2?1/0:this._repeat},t.repeatDelay=function(i){if(arguments.length){var s=this._time;return this._rDelay=i,m0(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(Qe(this,i),Ie(s))},t.restart=function(i,s){return this.play().totalTime(i?-this._delay:0,Ie(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?-Nt:0)),this):this._rts<0},t.invalidate=function(){return this._initted=this._act=0,this._zTime=-Nt,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)-Nt)},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=Yt(i)?i:h0,a=function(){var l=s.then;s.then=null,Yt(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(){bo(this)},r}();$e(vo.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-Nt,_prom:0,_ps:!1,_rts:1});var Se=function(r){zg(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=Ie(i.sortChildren),Vt&&Ni(i.parent||Vt,or(n),s),i.reversed&&n.reverse(),i.paused&&n.paused(!0),i.scrollTrigger&&f0(or(n),i.scrollTrigger),n}var e=t.prototype;return e.to=function(s,n,o){return mo(0,arguments,this),this},e.from=function(s,n,o){return mo(1,arguments,this),this},e.fromTo=function(s,n,o,a){return mo(2,arguments,this),this},e.set=function(s,n,o){return n.duration=0,n.parent=this,po(n).repeatDelay||(n.repeat=0),n.immediateRender=!!n.immediateRender,new qt(s,n,Qe(this,o),1),this},e.call=function(s,n,o){return Ni(this,qt.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 qt(s,o,Qe(this,h)),this},e.staggerFrom=function(s,n,o,a,h,l,c){return o.runBackwards=1,po(o).immediateRender=Ie(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,po(a).immediateRender=Ie(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:ce(s),u=this._zTime<0!=s<0&&(this._initted||!l),d,f,p,m,g,y,x,b,v,w,S,C;if(this!==Vt&&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(S=this._yoyo,g=l+this._rDelay,this._repeat<-1&&s<0)return this.totalTime(g*100+s,n,o);if(d=ce(c%g),c===h?(m=this._repeat,d=l):(m=~~(c/g),m&&m===c/g&&(d=l,m--),d>l&&(d=l)),w=fn(this._tTime,g),!a&&this._tTime&&w!==m&&this._tTime-w*g-this._dur<=0&&(w=m),S&&m&1&&(d=l-d,C=1),m!==w&&!this._lock){var I=S&&w&1,M=I===(S&&m&1);if(m<w&&(I=!I),a=I?0:c%l?l:c,this._lock=1,this.render(a||(C?0:ce(m*g)),n,!l)._lock=0,this._tTime=c,!n&&this.parent&&Xe(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,M&&(this._lock=2,a=I?l:-1e-4,this.render(a,!0),this.vars.repeatRefresh&&!C&&this.invalidate()),this._lock=0,!this._ts&&!y)return this;P0(this,C)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(x=DE(this,ce(a),ce(d)),x&&(c-=d-(d=x._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&&!m&&(Xe(this,"onStart"),this._tTime!==c))return this;if(d>=a&&s>=0)for(f=this._first;f;){if(p=f._next,(f._act||d>=f._start)&&f._ts&&x!==f){if(f.parent!==this)return this.render(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){x=0,p&&(c+=this._zTime=-Nt);break}}f=p}else{f=this._last;for(var L=s<0?s:d;f;){if(p=f._prev,(f._act||L<=f._end)&&f._ts&&x!==f){if(f.parent!==this)return this.render(s,n,o);if(f.render(f._ts>0?(L-f._start)*f._ts:(f._dirty?f.totalDuration():f._tDur)+(L-f._start)*f._ts,n,o||ge&&(f._initted||f._startAt)),d!==this._time||!this._ts&&!y){x=0,p&&(c+=this._zTime=L?-Nt:Nt);break}}f=p}}if(x&&!n&&(this.pause(),x.render(d>=a?0:-Nt)._zTime=d>=a?1:-1,this._ts))return this._start=v,vh(this),this.render(s,n,o);this._onUpdate&&!n&&Xe(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)&&kr(this,1),!n&&!(s<0&&!a)&&(c||a||!h)&&(Xe(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(ar(n)||(n=Qe(this,n,s)),!(s instanceof vo)){if(ye(s))return s.forEach(function(a){return o.add(a,n)}),this;if(le(s))return this.addLabel(s,n);if(Yt(s))s=qt.delayedCall(0,s);else return this}return this!==s?Ni(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 qt?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 le(s)?this.removeLabel(s):Yt(s)?this.killTweensOf(s):(xh(this,s),s===this._recent&&(this._recent=this._last),bs(this))},e.totalTime=function(s,n){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=ce(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]=Qe(this,n),this},e.removeLabel=function(s){return delete this.labels[s],this},e.addPause=function(s,n,o){var a=qt.delayedCall(0,n||fo,o);return a.data="isPause",this._hasPause=1,Ni(this,a,Qe(this,s))},e.removePause=function(s){var n=this._first;for(s=Qe(this,s);n;)n._start===s&&n.data==="isPause"&&kr(n),n=n._next},e.killTweensOf=function(s,n,o){for(var a=this.getTweensOf(s,o),h=a.length;h--;)Br!==a[h]&&a[h].kill(s,n);return this},e.getTweensOf=function(s,n){for(var o=[],a=qe(s),h=this._first,l=ar(n),c;h;)h instanceof qt?RE(h._targets,a)&&(l?(!Br||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=Qe(o,s),h=n,l=h.startAt,c=h.onStart,u=h.onStartParams,d=h.immediateRender,f,p=qt.to(o,$e({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())||Nt,onStart:function(){if(o.pause(),!f){var g=n.duration||Math.abs((a-(l&&"time"in l?l.time:o._time))/o.timeScale());p._dur!==g&&pn(p,g,0,1).render(p._time,!0,!0),f=1}c&&c.apply(p,u||[])}},n));return d?p.render(0):p},e.tweenFromTo=function(s,n,o){return this.tweenTo(n,$e({startAt:{time:Qe(this,s)}},o))},e.recent=function(){return this._recent},e.nextLabel=function(s){return s===void 0&&(s=this._time),T0(this,Qe(this,s))},e.previousLabel=function(s){return s===void 0&&(s=this._time),T0(this,Qe(this,s),1)},e.currentLabel=function(s){return arguments.length?this.seek(s,!0):this.previousLabel(this._time+Nt)},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 bs(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={}),bs(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,Ni(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;pn(o,o===Vt&&o._time>n?o._time:n,1,1),o._dirty=0}return o._tDur},t.updateRoot=function(s){if(Vt._ts&&(o0(Vt,_h(s,Vt)),r0=We.frame),We.frame>=s0){s0+=Oe.autoSleep||120;var n=Vt._first;if((!n||!n._ts)&&Oe.autoSleep&&We._listeners.length<2){for(;n&&!n._ts;)n=n._next;n||We.sleep()}}},t}(vo);$e(Se.prototype,{_lock:0,_hasPause:0,_forcing:0});var qE=function(t,e,i,s,n,o,a){var h=new Me(this._pt,t,e,0,1,B0,null,n),l=0,c=0,u,d,f,p,m,g,y,x;for(h.b=i,h.e=s,i+="",s+="",(y=~s.indexOf("random("))&&(s=yo(s)),o&&(x=[i,s],o(x,t,e),i=x[0],s=x[1]),d=i.match(Su)||[];u=Su.exec(s);)p=u[0],m=s.substring(l,u.index),f?f=(f+1)%5:m.substr(-5)==="rgba("&&(f=1),p!==d[c++]&&(g=parseFloat(d[c-1])||0,h._pt={_next:h._pt,p:m||c===1?m:",",s:g,c:p.charAt(1)==="="?dn(g,p)-g:parseFloat(p)-g,m:f&&f<4?Math.round:0},l=Su.lastIndex);return h.c=l<s.length?s.substring(l,s.length):"",h.fp=a,(Qg.test(s)||y)&&(h.e=0),this._pt=h,h},Xu=function(t,e,i,s,n,o,a,h,l,c){Yt(s)&&(s=s(n||0,t,o));var u=t[e],d=i!=="get"?i:Yt(u)?l?t[e.indexOf("set")||!Yt(t["get"+e.substr(3)])?e:"get"+e.substr(3)](l):t[e]():u,f=Yt(u)?l?sC:D0:Vu,p;if(le(s)&&(~s.indexOf("random(")&&(s=yo(s)),s.charAt(1)==="="&&(p=dn(d,s)+(be(d)||0),(p||p===0)&&(s=p))),!c||d!==s||Wu)return!isNaN(d*s)&&s!==""?(p=new Me(this._pt,t,e,+d||0,s-(d||0),typeof u=="boolean"?oC:O0,0,f),l&&(p.fp=l),a&&p.modifier(a,this,t),this._pt=p):(!u&&!(e in t)&&Iu(e,s),qE.call(this,t,e,d,s,f,h||Oe.stringFilter,l))},tC=function(t,e,i,s,n){if(Yt(t)&&(t=wo(t,n,e,i,s)),!Gi(t)||t.style&&t.nodeType||ye(t)||Jg(t))return le(t)?wo(t,n,e,i,s):t;var o={},a;for(a in t)o[a]=wo(t[a],n,e,i,s);return o},F0=function(t,e,i,s,n,o){var a,h,l,c;if(Ue[t]&&(a=new Ue[t]).init(n,a.rawVars?e[t]:tC(e[t],s,n,o,i),i,s,o)!==!1&&(i._pt=h=new Me(i._pt,n,t,0,1,a.render,a,0,a.priority),i!==mn))for(l=i._ptLookup[i._targets.indexOf(n)],c=a._props.length;c--;)l[a._props[c]]=h;return a},Br,Wu,Zu=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,p=t._dur,m=t._startAt,g=t._targets,y=t.parent,x=y&&y.data==="nested"?y.vars.targets:g,b=t._overwrite==="auto"&&!xu,v=t.timeline,w,S,C,I,M,L,G,N,A,D,Z,K,H;if(v&&(!d||!n)&&(n="none"),t._ease=xs(n,cn.ease),t._yEase=u?R0(xs(u===!0?n:u,cn.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(N=g[0]?gs(g[0]).harness:0,K=N&&s[N.prop],w=bh(s,Au),m&&(m._zTime<0&&m.progress(1),e<0&&c&&a&&!f?m.render(-1,!0):m.revert(c&&p?mh:AE),m._lazy=0),o){if(kr(t._startAt=qt.set(g,$e({data:"isStart",overwrite:!1,parent:y,immediateRender:!0,lazy:!m&&Ie(h),startAt:null,delay:0,onUpdate:l&&function(){return Xe(t,"onUpdate")},stagger:0},o))),t._startAt._dp=0,t._startAt._sat=t,e<0&&(ge||!a&&!f)&&t._startAt.revert(mh),a&&p&&e<=0&&i<=0){e&&(t._zTime=e);return}}else if(c&&p&&!m){if(e&&(a=!1),C=$e({overwrite:!1,data:"isFromStart",lazy:a&&!m&&Ie(h),immediateRender:a,stagger:0,parent:y},w),K&&(C[N.prop]=K),kr(t._startAt=qt.set(g,C)),t._startAt._dp=0,t._startAt._sat=t,e<0&&(ge?t._startAt.revert(mh):t._startAt.render(-1,!0)),t._zTime=e,!a)r(t._startAt,Nt,Nt);else if(!e)return}for(t._pt=t._ptCache=0,h=p&&Ie(h)||h&&!p,S=0;S<g.length;S++){if(M=g[S],G=M._gsap||Lu(g)[S]._gsap,t._ptLookup[S]=D={},Mu[G.id]&&Nr.length&&yh(),Z=x===g?S:x.indexOf(M),N&&(A=new N).init(M,K||w,t,Z,x)!==!1&&(t._pt=I=new Me(t._pt,M,A.name,0,1,A.render,A,0,A.priority),A._props.forEach(function(j){D[j]=I}),A.priority&&(L=1)),!N||K)for(C in w)Ue[C]&&(A=F0(C,w,t,Z,M,x))?A.priority&&(L=1):D[C]=I=Xu.call(t,M,C,"get",w[C],Z,x,0,s.stringFilter);t._op&&t._op[S]&&t.kill(M,t._op[S]),b&&t._pt&&(Br=t,Vt.killTweensOf(M,D,t.globalTime(e)),H=!t.parent,Br=0),t._pt&&h&&(Mu[G.id]=1)}L&&U0(t),t._onInit&&t._onInit(t)}t._onUpdate=l,t._initted=(!t._op||t._pt)&&!H,d&&e<=0&&v.render(Je,!0,!0)},eC=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 Wu=1,t.vars[e]="+=0",Zu(t,a),Wu=0,h?uo(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=jt(i)+be(u.e)),u.b&&(u.b=c.s+be(u.b))},iC=function(t,e){var i=t[0]?gs(t[0]).harness:0,s=i&&i.aliases,n,o,a,h;if(!s)return e;n=ys({},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},rC=function(t,e,i,s){var n=e.ease||s||"power1.inOut",o,a;if(ye(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})},wo=function(t,e,i,s,n){return Yt(t)?t.call(e,i,s,n):le(t)&&~t.indexOf("random(")?yo(t):t},N0=Pu+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert",k0={};Ae(N0+",id,stagger,delay,duration,paused,scrollTrigger",function(r){return k0[r]=1});var qt=function(r){zg(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:po(s))||this;var h=a.vars,l=h.duration,c=h.delay,u=h.immediateRender,d=h.stagger,f=h.overwrite,p=h.keyframes,m=h.defaults,g=h.scrollTrigger,y=h.yoyoEase,x=s.parent||Vt,b=(ye(i)||Jg(i)?ar(i[0]):"length"in s)?[i]:qe(i),v,w,S,C,I,M,L,G;if(a._targets=b.length?Lu(b):uo("GSAP target "+i+" not found. https://gsap.com",!Oe.nullTargetWarn)||[],a._ptLookup=[],a._overwrite=f,p||d||fh(l)||fh(c)){if(s=a.vars,v=a.timeline=new Se({data:"nested",defaults:m||{},targets:x&&x.data==="nested"?x.vars.targets:b}),v.kill(),v.parent=v._dp=or(a),v._start=0,d||fh(l)||fh(c)){if(C=b.length,L=d&&b0(d),Gi(d))for(I in d)~N0.indexOf(I)&&(G||(G={}),G[I]=d[I]);for(w=0;w<C;w++)S=bh(s,k0),S.stagger=0,y&&(S.yoyoEase=y),G&&ys(S,G),M=b[w],S.duration=+wo(l,or(a),w,M,b),S.delay=(+wo(c,or(a),w,M,b)||0)-a._delay,!d&&C===1&&S.delay&&(a._delay=c=S.delay,a._start+=c,S.delay=0),v.to(M,S,L?L(w,M,b):0),v._ease=Et.none;v.duration()?l=c=0:a.timeline=0}else if(p){po($e(v.vars.defaults,{ease:"none"})),v._ease=xs(p.ease||s.ease||"none");var N=0,A,D,Z;if(ye(p))p.forEach(function(K){return v.to(b,K,">")}),v.duration();else{S={};for(I in p)I==="ease"||I==="easeEach"||rC(I,p[I],S,p.easeEach);for(I in S)for(A=S[I].sort(function(K,H){return K.t-H.t}),N=0,w=0;w<A.length;w++)D=A[w],Z={ease:D.e,duration:(D.t-(w?A[w-1].t:0))/100*l},Z[I]=D.v,v.to(b,Z,N),N+=Z.duration;v.duration()<l&&v.to({},{duration:l-v.duration()})}}l||a.duration(l=v.duration())}else a.timeline=0;return f===!0&&!xu&&(Br=or(a),Vt.killTweensOf(b),Br=0),Ni(x,or(a),n),s.reversed&&a.reverse(),s.paused&&a.paused(!0),(u||!l&&!p&&a._start===ce(x._time)&&Ie(u)&&FE(or(a))&&x.data!=="nested")&&(a._tTime=-Nt,a.render(Math.max(0,-c)||0)),g&&f0(or(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-Nt&&!c?h:s<Nt?0:s,d,f,p,m,g,y,x,b,v;if(!l)kE(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(m=l+this._rDelay,this._repeat<-1&&c)return this.totalTime(m*100+s,n,o);if(d=ce(u%m),u===h?(p=this._repeat,d=l):(p=~~(u/m),p&&p===ce(u/m)&&(d=l,p--),d>l&&(d=l)),y=this._yoyo&&p&1,y&&(v=this._yEase,d=l-d),g=fn(this._tTime,m),d===a&&!o&&this._initted&&p===g)return this._tTime=u,this;p!==g&&(b&&this._yEase&&P0(b,y),this.vars.repeatRefresh&&!y&&!this._lock&&this._time!==m&&this._initted&&(this._lock=o=1,this.render(ce(m*p),!0).invalidate()._lock=0))}if(!this._initted){if(p0(this,c?s:d,o,n,u))return this._tTime=0,this;if(a!==this._time&&!(o&&this.vars.repeatRefresh&&p!==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=x=(v||this._ease)(d/l),this._from&&(this.ratio=x=1-x),d&&!a&&!n&&!p&&(Xe(this,"onStart"),this._tTime!==u))return this;for(f=this._pt;f;)f.r(x,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&&Gu(this,s,n,o),Xe(this,"onUpdate")),this._repeat&&p!==g&&this.vars.onRepeat&&!n&&this.parent&&Xe(this,"onRepeat"),(u===this._tDur||!u)&&this._tTime===u&&(c&&!this._onUpdate&&Gu(this,s,!0,!0),(s||!l)&&(u===this._tDur&&this._ts>0||!u&&this._ts<0)&&kr(this,1),!n&&!(c&&!a)&&(u||a||y)&&(Xe(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){_o||We.wake(),this._ts||this.play();var l=Math.min(this._dur,(this._dp._time-this._start)*this._ts),c;return this._initted||Zu(this,l),c=this._ease(l/this._dur),eC(this,s,n,o,a,c,l,h)?this.resetTo(s,n,o,a,1):(wh(this,0),this.parent||c0(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?bo(this):this;if(this.timeline){var o=this.timeline.totalDuration();return this.timeline.killTweensOf(s,n,Br&&Br.vars.overwrite!==!0)._first||bo(this),this.parent&&o!==this.timeline.totalDuration()&&pn(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,p,m,g,y;if((!n||n==="all")&&LE(a,h))return n==="all"&&(this._pt=0),bo(this);for(u=this._op=this._op||[],n!=="all"&&(le(n)&&(m={},Ae(n,function(x){return m[x]=1}),n=m),n=iC(a,n)),y=a.length;y--;)if(~h.indexOf(a[y])){d=l[y],n==="all"?(u[y]=n,p=d,f={}):(f=u[y]=u[y]||{},p=n);for(m in p)g=d&&d[m],g&&((!("kill"in g.d)||g.d.kill(m)===!0)&&xh(this,g,"_pt"),delete d[m]),f!=="all"&&(f[m]=1)}return this._initted&&!this._pt&&c&&bo(this),this},t.to=function(s,n){return new t(s,n,arguments[2])},t.from=function(s,n){return mo(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 mo(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 Vt.killTweensOf(s,n,o)},t}(vo);$e(qt.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),Ae("staggerTo,staggerFrom,staggerFromTo",function(r){qt[r]=function(){var t=new Se,e=Nu.call(arguments,0);return e.splice(r==="staggerFromTo"?5:4,0,0),t[r].apply(t,e)}});var Vu=function(t,e,i){return t[e]=i},D0=function(t,e,i){return t[e](i)},sC=function(t,e,i,s){return t[e](s.fp,i)},nC=function(t,e,i){return t.setAttribute(e,i)},Hu=function(t,e){return Yt(t[e])?D0:vu(t[e])&&t.setAttribute?nC:Vu},O0=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e6)/1e6,e)},oC=function(t,e){return e.set(e.t,e.p,!!(e.s+e.c*t),e)},B0=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)},Ku=function(t,e){for(var i=e._pt;i;)i.r(t,i.d),i=i._next},aC=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},hC=function(t){for(var e=this._pt,i,s;e;)s=e._next,e.p===t&&!e.op||e.op===t?xh(this,e,"_pt"):e.dep||(i=1),e=s;return!i},lC=function(t,e,i,s){s.mSet(t,e,s.m.call(s.tween,i,s.mt),s)},U0=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},Me=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||O0,this.d=h||this,this.set=l||Vu,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=lC,this.m=i,this.mt=n,this.tween=s},r}();Ae(Pu+"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 Au[r]=1}),Be.TweenMax=Be.TweenLite=qt,Be.TimelineLite=Be.TimelineMax=Se,Vt=new Se({sortChildren:!1,defaults:cn,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),Oe.stringFilter=M0;var vs=[],Th={},cC=[],X0=0,uC=0,Yu=function(t){return(Th[t]||cC).map(function(e){return e()})},zu=function(){var t=Date.now(),e=[];t-X0>2&&(Yu("matchMediaInit"),vs.forEach(function(i){var s=i.queries,n=i.conditions,o,a,h,l;for(a in s)o=Fi.matchMedia(s[a]).matches,o&&(h=1),o!==n[a]&&(n[a]=o,l=1);l&&(i.revert(),h&&e.push(i))}),Yu("matchMediaRevert"),e.forEach(function(i){return i.onMatch(i,function(s){return i.add(null,s)})}),X0=t,Yu("matchMedia"))},W0=function(){function r(e,i){this.selector=i&&ku(i),this.data=[],this._r=[],this.isReverted=!1,this.id=uC++,e&&this.add(e)}var t=r.prototype;return t.add=function(i,s,n){Yt(i)&&(n=s,s=i,i=Yt);var o=this,a=function(){var l=Bt,c=o.selector,u;return l&&l!==o&&l.data.push(o),n&&(o.selector=ku(n)),Bt=o,u=s.apply(o,arguments),Yt(u)&&o._r.push(u),Bt=l,o.selector=c,o.isReverted=!1,u};return o.last=a,i===Yt?a(o,function(h){return o.add(null,h)}):i?o[i]=a:a},t.ignore=function(i){var s=Bt;Bt=null,i(this),Bt=s},t.getTweens=function(){var i=[];return this.data.forEach(function(s){return s instanceof r?i.push.apply(i,s.getTweens()):s instanceof qt&&!(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 Se?l.data!=="nested"&&(l.scrollTrigger&&l.scrollTrigger.revert(),l.kill()):!(l instanceof qt)&&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=vs.length;o--;)vs[o].id===this.id&&vs.splice(o,1)},t.revert=function(i){this.kill(i||{})},r}(),dC=function(){function r(e){this.contexts=[],this.scope=e,Bt&&Bt.data.push(this)}var t=r.prototype;return t.add=function(i,s,n){Gi(i)||(i={matches:i});var o=new W0(0,n||this.scope),a=o.conditions={},h,l,c;Bt&&!o.selector&&(o.selector=Bt.selector),this.contexts.push(o),s=o.add("onMatch",s),o.queries=i;for(l in i)l==="all"?c=1:(h=Fi.matchMedia(i[l]),h&&(vs.indexOf(o)<0&&vs.push(o),(a[l]=h.matches)&&(c=1),h.addListener?h.addListener(zu):h.addEventListener("change",zu)));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}(),Sh={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 E0(s)})},timeline:function(t){return new Se(t)},getTweensOf:function(t,e){return Vt.getTweensOf(t,e)},getProperty:function(t,e,i,s){le(t)&&(t=qe(t)[0]);var n=gs(t||{}).get,o=i?h0:a0;return i==="native"&&(i=""),t&&(e?o((Ue[e]&&Ue[e].get||n)(t,e,i,s)):function(a,h,l){return o((Ue[a]&&Ue[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 Re.quickSetter(c,e,i)}),n=s.length;return function(c){for(var u=n;u--;)s[u](c)}}t=t[0]||{};var o=Ue[e],a=gs(t),h=a.harness&&(a.harness.aliases||{})[e]||e,l=o?function(c){var u=new o;mn._pt=0,u.init(t,i?c+i:c,mn,0,[t]),u.render(1,u),mn._pt&&Ku(1,mn)}: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=Re.to(t,ys((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 Vt.getTweensOf(t,!0).length>0},defaults:function(t){return t&&t.ease&&(t.ease=xs(t.ease,cn.ease)),l0(cn,t||{})},config:function(t){return l0(Oe,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&&!Ue[a]&&!Be[a]&&uo(e+" effect requires "+a+" plugin.")}),Ru[e]=function(a,h,l){return i(qe(a),$e(h||{},n),l)},o&&(Se.prototype[e]=function(a,h,l){return this.add(Ru[e](a,Gi(h)?h:(l=h)&&{},this),l)})},registerEase:function(t,e){Et[t]=xs(e)},parseEase:function(t,e){return arguments.length?xs(t,e):Et},getById:function(t){return Vt.getById(t)},exportRoot:function(t,e){t===void 0&&(t={});var i=new Se(t),s,n;for(i.smoothChildTiming=Ie(t.smoothChildTiming),Vt.remove(i),i._dp=0,i._time=i._tTime=Vt._time,s=Vt._first;s;)n=s._next,(e||!(!s._dur&&s instanceof qt&&s.vars.onComplete===s._targets[0]))&&Ni(i,s,s._start-s._delay),s=n;return Ni(Vt,i,0),i},context:function(t,e){return t?new W0(t,e):Bt},matchMedia:function(t){return new dC(t)},matchMediaRefresh:function(){return vs.forEach(function(t){var e=t.conditions,i,s;for(s in e)e[s]&&(e[s]=!1,i=1);i&&t.revert()})||zu()},addEventListener:function(t,e){var i=Th[t]||(Th[t]=[]);~i.indexOf(e)||i.push(e)},removeEventListener:function(t,e){var i=Th[t],s=i&&i.indexOf(e);s>=0&&i.splice(s,1)},utils:{wrap:VE,wrapYoyo:HE,distribute:b0,random:_0,snap:x0,normalize:ZE,getUnit:be,clamp:BE,splitColor:C0,toArray:qe,selector:ku,mapRange:w0,pipe:XE,unitize:WE,interpolate:KE,shuffle:y0},install:e0,effects:Ru,ticker:We,updateRoot:Se.updateRoot,plugins:Ue,globalTimeline:Vt,core:{PropTween:Me,globals:i0,Tween:qt,Timeline:Se,Animation:vo,getCache:gs,_removeLinkedListItem:xh,reverting:function(){return ge},context:function(t){return t&&Bt&&(Bt.data.push(t),t._ctx=Bt),Bt},suppressOverwrites:function(t){return xu=t}}};Ae("to,from,fromTo,delayedCall,set,killTweensOf",function(r){return Sh[r]=qt[r]}),We.add(Se.updateRoot),mn=Sh.to({},{duration:0});var fC=function(t,e){for(var i=t._pt;i&&i.p!==e&&i.op!==e&&i.fp!==e;)i=i._next;return i},pC=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=fC(o,s)),o&&o.modifier&&o.modifier(e[s],t,i[n],s))},ju=function(t,e){return{name:t,rawVars:1,init:function(s,n,o){o._onInit=function(a){var h,l;if(le(n)&&(h={},Ae(n,function(c){return h[c]=1}),n=h),e){h={};for(l in n)h[l]=e(n[l]);n=h}pC(a,n)}}}},Re=Sh.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;)ge?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)}},ju("roundProps",Du),ju("modifiers"),ju("snap",x0))||Sh;qt.version=Se.version=Re.version="3.12.5",t0=1,wu()&&gn(),Et.Power0,Et.Power1,Et.Power2,Et.Power3,Et.Power4,Et.Linear,Et.Quad,Et.Cubic,Et.Quart,Et.Quint,Et.Strong,Et.Elastic,Et.Back,Et.SteppedEase,Et.Bounce,Et.Sine,Et.Expo,Et.Circ;/*!
1167
+ */var Be={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},fs={duration:.5,overwrite:!1,delay:0},Tu,ye,Ut,$e=1e8,Ft=1/$e,Su=Math.PI*2,j2=Su/4,J2=0,ag=Math.sqrt,$2=Math.cos,Q2=Math.sin,ce=function(t){return typeof t=="string"},Yt=function(t){return typeof t=="function"},lr=function(t){return typeof t=="number"},Eu=function(t){return typeof t>"u"},ki=function(t){return typeof t=="object"},Ae=function(t){return t!==!1},Cu=function(){return typeof window<"u"},gl=function(t){return Yt(t)||ce(t)},lg=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},be=Array.isArray,Iu=/(?:-?\.?\d|\.)+/gi,hg=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,ps=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,Au=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,cg=/[+-]=-?[.\d]+/,ug=/[^,'"\[\]\s]+/gi,q2=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,Ht,Fi,Mu,Ru,Ue={},yl={},dg,fg=function(t){return(yl=wn(t,Ue))&&Pe},Pu=function(t,e){return console.warn("Invalid property",t,"set to",e,"Missing plugin? gsap.registerPlugin()")},mo=function(t,e){return!e&&console.warn(t)},pg=function(t,e){return t&&(Ue[t]=e)&&yl&&(yl[t]=e)||Ue},go=function(){return 0},tE={suppressEvents:!0,isStart:!0,kill:!1},bl={suppressEvents:!0,kill:!1},eE={suppressEvents:!0},Lu={},Or=[],Gu={},mg,Xe={},ku={},gg=30,xl=[],Fu="",Du=function(t){var e=t[0],r,n;if(ki(e)||Yt(e)||(t=[t]),!(r=(e._gsap||{}).harness)){for(n=xl.length;n--&&!xl[n].targetTest(e););r=xl[n]}for(n=t.length;n--;)t[n]&&(t[n]._gsap||(t[n]._gsap=new Hg(t[n],r)))||t.splice(n,1);return t},vn=function(t){return t._gsap||Du(ti(t))[0]._gsap},yg=function(t,e,r){return(r=t[e])&&Yt(r)?t[e]():Eu(r)&&t.getAttribute&&t.getAttribute(e)||r},Me=function(t,e){return(t=t.split(",")).forEach(e)||t},Jt=function(t){return Math.round(t*1e5)/1e5||0},ue=function(t){return Math.round(t*1e7)/1e7||0},ms=function(t,e){var r=e.charAt(0),n=parseFloat(e.substr(2));return t=parseFloat(t),r==="+"?t+n:r==="-"?t-n:r==="*"?t*n:t/n},iE=function(t,e){for(var r=e.length,n=0;t.indexOf(e[n])<0&&++n<r;);return n<r},_l=function(){var t=Or.length,e=Or.slice(0),r,n;for(Gu={},Or.length=0,r=0;r<t;r++)n=e[r],n&&n._lazy&&(n.render(n._lazy[0],n._lazy[1],!0)._lazy=0)},bg=function(t,e,r,n){Or.length&&!ye&&_l(),t.render(e,r,n||ye&&e<0&&(t._initted||t._startAt)),Or.length&&!ye&&_l()},xg=function(t){var e=parseFloat(t);return(e||e===0)&&(t+"").match(ug).length<2?e:ce(t)?t.trim():t},_g=function(t){return t},Qe=function(t,e){for(var r in e)r in t||(t[r]=e[r]);return t},rE=function(t){return function(e,r){for(var n in r)n in e||n==="duration"&&t||n==="ease"||(e[n]=r[n])}},wn=function(t,e){for(var r in e)t[r]=e[r];return t},vg=function i(t,e){for(var r in e)r!=="__proto__"&&r!=="constructor"&&r!=="prototype"&&(t[r]=ki(e[r])?i(t[r]||(t[r]={}),e[r]):e[r]);return t},vl=function(t,e){var r={},n;for(n in t)n in e||(r[n]=t[n]);return r},yo=function(t){var e=t.parent||Ht,r=t.keyframes?rE(be(t.keyframes)):Qe;if(Ae(t.inherit))for(;e;)r(t,e.vars.defaults),e=e.parent||e._dp;return t},nE=function(t,e){for(var r=t.length,n=r===e.length;n&&r--&&t[r]===e[r];);return r<0},wg=function(t,e,r,n,s){r===void 0&&(r="_first"),n===void 0&&(n="_last");var o=t[n],a;if(s)for(a=e[s];o&&o[s]>a;)o=o._prev;return o?(e._next=o._next,o._next=e):(e._next=t[r],t[r]=e),e._next?e._next._prev=e:t[n]=e,e._prev=o,e.parent=e._dp=t,e},wl=function(t,e,r,n){r===void 0&&(r="_first"),n===void 0&&(n="_last");var s=e._prev,o=e._next;s?s._next=o:t[r]===e&&(t[r]=o),o?o._prev=s:t[n]===e&&(t[n]=s),e._next=e._prev=e.parent=null},Br=function(t,e){t.parent&&(!e||t.parent.autoRemoveChildren)&&t.parent.remove&&t.parent.remove(t),t._act=0},Tn=function(t,e){if(t&&(!e||e._end>t._dur||e._start<0))for(var r=t;r;)r._dirty=1,r=r.parent;return t},sE=function(t){for(var e=t.parent;e&&e.parent;)e._dirty=1,e.totalDuration(),e=e.parent;return t},Nu=function(t,e,r,n){return t._startAt&&(ye?t._startAt.revert(bl):t.vars.immediateRender&&!t.vars.autoRevert||t._startAt.render(e,!0,n))},oE=function i(t){return!t||t._ts&&i(t.parent)},Tg=function(t){return t._repeat?gs(t._tTime,t=t.duration()+t._rDelay)*t:0},gs=function(t,e){var r=Math.floor(t/=e);return t&&r===t?r-1:r},Tl=function(t,e){return(t-e._start)*e._ts+(e._ts>=0?0:e._dirty?e.totalDuration():e._tDur)},Sl=function(t){return t._end=ue(t._start+(t._tDur/Math.abs(t._ts||t._rts||Ft)||0))},El=function(t,e){var r=t._dp;return r&&r.smoothChildTiming&&t._ts&&(t._start=ue(r._time-(t._ts>0?e/t._ts:((t._dirty?t.totalDuration():t._tDur)-e)/-t._ts)),Sl(t),r._dirty||Tn(r,t)),t},Sg=function(t,e){var r;if((e._time||!e._dur&&e._initted||e._start<t._time&&(e._dur||!e.add))&&(r=Tl(t.rawTime(),e),(!e._dur||xo(0,e.totalDuration(),r)-e._tTime>Ft)&&e.render(r,!0)),Tn(t,e)._dp&&t._initted&&t._time>=t._dur&&t._ts){if(t._dur<t.duration())for(r=t;r._dp;)r.rawTime()>=0&&r.totalTime(r._tTime),r=r._dp;t._zTime=-Ft}},Di=function(t,e,r,n){return e.parent&&Br(e),e._start=ue((lr(r)?r:r||t!==Ht?qe(t,r,e):t._time)+e._delay),e._end=ue(e._start+(e.totalDuration()/Math.abs(e.timeScale())||0)),wg(t,e,"_first","_last",t._sort?"_start":0),Ou(e)||(t._recent=e),n||Sg(t,e),t._ts<0&&El(t,t._tTime),t},Eg=function(t,e){return(Ue.ScrollTrigger||Pu("scrollTrigger",e))&&Ue.ScrollTrigger.create(e,t)},Cg=function(t,e,r,n,s){if(zu(t,e,s),!t._initted)return 1;if(!r&&t._pt&&!ye&&(t._dur&&t.vars.lazy!==!1||!t._dur&&t.vars.lazy)&&mg!==Ze.frame)return Or.push(t),t._lazy=[s,n],1},aE=function i(t){var e=t.parent;return e&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||i(e))},Ou=function(t){var e=t.data;return e==="isFromStart"||e==="isStart"},lE=function(t,e,r,n){var s=t.ratio,o=e<0||!e&&(!t._start&&aE(t)&&!(!t._initted&&Ou(t))||(t._ts<0||t._dp._ts<0)&&!Ou(t))?0:1,a=t._rDelay,l=0,h,c,u;if(a&&t._repeat&&(l=xo(0,t._tDur,e),c=gs(l,a),t._yoyo&&c&1&&(o=1-o),c!==gs(t._tTime,a)&&(s=1-o,t.vars.repeatRefresh&&t._initted&&t.invalidate())),o!==s||ye||n||t._zTime===Ft||!e&&t._zTime){if(!t._initted&&Cg(t,e,n,r,l))return;for(u=t._zTime,t._zTime=e||(r?Ft:0),r||(r=e&&!u),t.ratio=o,t._from&&(o=1-o),t._time=0,t._tTime=l,h=t._pt;h;)h.r(o,h.d),h=h._next;e<0&&Nu(t,e,r,!0),t._onUpdate&&!r&&We(t,"onUpdate"),l&&t._repeat&&!r&&t.parent&&We(t,"onRepeat"),(e>=t._tDur||e<0)&&t.ratio===o&&(o&&Br(t,1),!r&&!ye&&(We(t,o?"onComplete":"onReverseComplete",!0),t._prom&&t._prom()))}else t._zTime||(t._zTime=e)},hE=function(t,e,r){var n;if(r>e)for(n=t._first;n&&n._start<=r;){if(n.data==="isPause"&&n._start>e)return n;n=n._next}else for(n=t._last;n&&n._start>=r;){if(n.data==="isPause"&&n._start<e)return n;n=n._prev}},ys=function(t,e,r,n){var s=t._repeat,o=ue(e)||0,a=t._tTime/t._tDur;return a&&!n&&(t._time*=o/t._dur),t._dur=o,t._tDur=s?s<0?1e10:ue(o*(s+1)+t._rDelay*s):o,a>0&&!n&&El(t,t._tTime=t._tDur*a),t.parent&&Sl(t),r||Tn(t.parent,t),t},Ig=function(t){return t instanceof Ee?Tn(t):ys(t,t._dur)},cE={_start:0,endTime:go,totalDuration:go},qe=function i(t,e,r){var n=t.labels,s=t._recent||cE,o=t.duration()>=$e?s.endTime(!1):t._dur,a,l,h;return ce(e)&&(isNaN(e)||e in n)?(l=e.charAt(0),h=e.substr(-1)==="%",a=e.indexOf("="),l==="<"||l===">"?(a>=0&&(e=e.replace(/=/,"")),(l==="<"?s._start:s.endTime(s._repeat>=0))+(parseFloat(e.substr(1))||0)*(h?(a<0?s:r).totalDuration()/100:1)):a<0?(e in n||(n[e]=o),n[e]):(l=parseFloat(e.charAt(a-1)+e.substr(a+1)),h&&r&&(l=l/100*(be(r)?r[0]:r).totalDuration()),a>1?i(t,e.substr(0,a-1),r)+l:o+l)):e==null?o:+e},bo=function(t,e,r){var n=lr(e[1]),s=(n?2:1)+(t<2?0:1),o=e[s],a,l;if(n&&(o.duration=e[1]),o.parent=r,t){for(a=o,l=r;l&&!("immediateRender"in a);)a=l.vars.defaults||{},l=Ae(l.vars.inherit)&&l.parent;o.immediateRender=Ae(a.immediateRender),t<2?o.runBackwards=1:o.startAt=e[s-1]}return new te(e[0],o,e[s+1])},Ur=function(t,e){return t||t===0?e(t):e},xo=function(t,e,r){return r<t?t:r>e?e:r},xe=function(t,e){return!ce(t)||!(e=q2.exec(t))?"":e[1]},uE=function(t,e,r){return Ur(r,function(n){return xo(t,e,n)})},Bu=[].slice,Ag=function(t,e){return t&&ki(t)&&"length"in t&&(!e&&!t.length||t.length-1 in t&&ki(t[0]))&&!t.nodeType&&t!==Fi},dE=function(t,e,r){return r===void 0&&(r=[]),t.forEach(function(n){var s;return ce(n)&&!e||Ag(n,1)?(s=r).push.apply(s,ti(n)):r.push(n)})||r},ti=function(t,e,r){return Ut&&!e&&Ut.selector?Ut.selector(t):ce(t)&&!r&&(Mu||!xs())?Bu.call((e||Ru).querySelectorAll(t),0):be(t)?dE(t,r):Ag(t)?Bu.call(t,0):t?[t]:[]},Uu=function(t){return t=ti(t)[0]||mo("Invalid scope")||{},function(e){var r=t.current||t.nativeElement||t;return ti(e,r.querySelectorAll?r:r===t?mo("Invalid scope")||Ru.createElement("div"):t)}},Mg=function(t){return t.sort(function(){return .5-Math.random()})},Rg=function(t){if(Yt(t))return t;var e=ki(t)?t:{each:t},r=Sn(e.ease),n=e.from||0,s=parseFloat(e.base)||0,o={},a=n>0&&n<1,l=isNaN(n)||a,h=e.axis,c=n,u=n;return ce(n)?c=u={center:.5,edges:.5,end:1}[n]||0:!a&&l&&(c=n[0],u=n[1]),function(d,f,p){var m=(p||e).length,g=o[m],y,x,b,v,w,S,C,I,M;if(!g){if(M=e.grid==="auto"?0:(e.grid||[1,$e])[1],!M){for(C=-$e;C<(C=p[M++].getBoundingClientRect().left)&&M<m;);M<m&&M--}for(g=o[m]=[],y=l?Math.min(M,m)*c-.5:n%M,x=M===$e?0:l?m*u/M-.5:n/M|0,C=0,I=$e,S=0;S<m;S++)b=S%M-y,v=x-(S/M|0),g[S]=w=h?Math.abs(h==="y"?v:b):ag(b*b+v*v),w>C&&(C=w),w<I&&(I=w);n==="random"&&Mg(g),g.max=C-I,g.min=I,g.v=m=(parseFloat(e.amount)||parseFloat(e.each)*(M>m?m-1:h?h==="y"?m/M:M:Math.max(M,m/M))||0)*(n==="edges"?-1:1),g.b=m<0?s-m:s,g.u=xe(e.amount||e.each)||0,r=r&&m<0?Wg(r):r}return m=(g[d]-g.min)/g.max||0,ue(g.b+(r?r(m):m)*g.v)+g.u}},Xu=function(t){var e=Math.pow(10,((t+"").split(".")[1]||"").length);return function(r){var n=ue(Math.round(parseFloat(r)/t)*t*e);return(n-n%1)/e+(lr(r)?0:xe(r))}},Pg=function(t,e){var r=be(t),n,s;return!r&&ki(t)&&(n=r=t.radius||$e,t.values?(t=ti(t.values),(s=!lr(t[0]))&&(n*=n)):t=Xu(t.increment)),Ur(e,r?Yt(t)?function(o){return s=t(o),Math.abs(s-o)<=n?s:o}:function(o){for(var a=parseFloat(s?o.x:o),l=parseFloat(s?o.y:0),h=$e,c=0,u=t.length,d,f;u--;)s?(d=t[u].x-a,f=t[u].y-l,d=d*d+f*f):d=Math.abs(t[u]-a),d<h&&(h=d,c=u);return c=!n||h<=n?t[c]:o,s||c===o||lr(o)?c:c+xe(o)}:Xu(t))},Lg=function(t,e,r,n){return Ur(be(t)?!e:r===!0?!!(r=0):!n,function(){return be(t)?t[~~(Math.random()*t.length)]:(r=r||1e-5)&&(n=r<1?Math.pow(10,(r+"").length-2):1)&&Math.floor(Math.round((t-r/2+Math.random()*(e-t+r*.99))/r)*r*n)/n})},fE=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(n){return e.reduce(function(s,o){return o(s)},n)}},pE=function(t,e){return function(r){return t(parseFloat(r))+(e||xe(r))}},mE=function(t,e,r){return kg(t,e,0,1,r)},Gg=function(t,e,r){return Ur(r,function(n){return t[~~e(n)]})},gE=function i(t,e,r){var n=e-t;return be(t)?Gg(t,i(0,t.length),e):Ur(r,function(s){return(n+(s-t)%n)%n+t})},yE=function i(t,e,r){var n=e-t,s=n*2;return be(t)?Gg(t,i(0,t.length-1),e):Ur(r,function(o){return o=(s+(o-t)%s)%s||0,t+(o>n?s-o:o)})},_o=function(t){for(var e=0,r="",n,s,o,a;~(n=t.indexOf("random(",e));)o=t.indexOf(")",n),a=t.charAt(n+7)==="[",s=t.substr(n+7,o-n-7).match(a?ug:Iu),r+=t.substr(e,n-e)+Lg(a?s:+s[0],a?0:+s[1],+s[2]||1e-5),e=o+1;return r+t.substr(e,t.length-e)},kg=function(t,e,r,n,s){var o=e-t,a=n-r;return Ur(s,function(l){return r+((l-t)/o*a||0)})},bE=function i(t,e,r,n){var s=isNaN(t+e)?0:function(f){return(1-f)*t+f*e};if(!s){var o=ce(t),a={},l,h,c,u,d;if(r===!0&&(n=1)&&(r=null),o)t={p:t},e={p:e};else if(be(t)&&!be(e)){for(c=[],u=t.length,d=u-2,h=1;h<u;h++)c.push(i(t[h-1],t[h]));u--,s=function(p){p*=u;var m=Math.min(d,~~p);return c[m](p-m)},r=e}else n||(t=wn(be(t)?[]:{},t));if(!c){for(l in e)Hu.call(a,t,l,"get",e[l]);s=function(p){return Ju(p,a)||(o?t.p:t)}}}return Ur(r,s)},Fg=function(t,e,r){var n=t.labels,s=$e,o,a,l;for(o in n)a=n[o]-e,a<0==!!r&&a&&s>(a=Math.abs(a))&&(l=o,s=a);return l},We=function(t,e,r){var n=t.vars,s=n[e],o=Ut,a=t._ctx,l,h,c;if(s)return l=n[e+"Params"],h=n.callbackScope||t,r&&Or.length&&_l(),a&&(Ut=a),c=l?s.apply(h,l):s.call(h),Ut=o,c},vo=function(t){return Br(t),t.scrollTrigger&&t.scrollTrigger.kill(!!ye),t.progress()<1&&We(t,"onInterrupt"),t},bs,Dg=[],Ng=function(t){if(t)if(t=!t.name&&t.default||t,Cu()||t.headless){var e=t.name,r=Yt(t),n=e&&!r&&t.init?function(){this._props=[]}:t,s={init:go,render:Ju,add:Hu,kill:kE,modifier:GE,rawVars:0},o={targetTest:0,get:0,getSetter:ju,aliases:{},register:0};if(xs(),t!==n){if(Xe[e])return;Qe(n,Qe(vl(t,s),o)),wn(n.prototype,wn(s,vl(t,o))),Xe[n.prop=e]=n,t.targetTest&&(xl.push(n),Lu[e]=1),e=(e==="css"?"CSS":e.charAt(0).toUpperCase()+e.substr(1))+"Plugin"}pg(e,n),t.register&&t.register(Pe,n,Re)}else Dg.push(t)},Gt=255,wo={aqua:[0,Gt,Gt],lime:[0,Gt,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,Gt],navy:[0,0,128],white:[Gt,Gt,Gt],olive:[128,128,0],yellow:[Gt,Gt,0],orange:[Gt,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[Gt,0,0],pink:[Gt,192,203],cyan:[0,Gt,Gt],transparent:[Gt,Gt,Gt,0]},Wu=function(t,e,r){return t+=t<0?1:t>1?-1:0,(t*6<1?e+(r-e)*t*6:t<.5?r:t*3<2?e+(r-e)*(2/3-t)*6:e)*Gt+.5|0},Og=function(t,e,r){var n=t?lr(t)?[t>>16,t>>8&Gt,t&Gt]:0:wo.black,s,o,a,l,h,c,u,d,f,p;if(!n){if(t.substr(-1)===","&&(t=t.substr(0,t.length-1)),wo[t])n=wo[t];else if(t.charAt(0)==="#"){if(t.length<6&&(s=t.charAt(1),o=t.charAt(2),a=t.charAt(3),t="#"+s+s+o+o+a+a+(t.length===5?t.charAt(4)+t.charAt(4):"")),t.length===9)return n=parseInt(t.substr(1,6),16),[n>>16,n>>8&Gt,n&Gt,parseInt(t.substr(7),16)/255];t=parseInt(t.substr(1),16),n=[t>>16,t>>8&Gt,t&Gt]}else if(t.substr(0,3)==="hsl"){if(n=p=t.match(Iu),!e)l=+n[0]%360/360,h=+n[1]/100,c=+n[2]/100,o=c<=.5?c*(h+1):c+h-c*h,s=c*2-o,n.length>3&&(n[3]*=1),n[0]=Wu(l+1/3,s,o),n[1]=Wu(l,s,o),n[2]=Wu(l-1/3,s,o);else if(~t.indexOf("="))return n=t.match(hg),r&&n.length<4&&(n[3]=1),n}else n=t.match(Iu)||wo.transparent;n=n.map(Number)}return e&&!p&&(s=n[0]/Gt,o=n[1]/Gt,a=n[2]/Gt,u=Math.max(s,o,a),d=Math.min(s,o,a),c=(u+d)/2,u===d?l=h=0:(f=u-d,h=c>.5?f/(2-u-d):f/(u+d),l=u===s?(o-a)/f+(o<a?6:0):u===o?(a-s)/f+2:(s-o)/f+4,l*=60),n[0]=~~(l+.5),n[1]=~~(h*100+.5),n[2]=~~(c*100+.5)),r&&n.length<4&&(n[3]=1),n},Bg=function(t){var e=[],r=[],n=-1;return t.split(Xr).forEach(function(s){var o=s.match(ps)||[];e.push.apply(e,o),r.push(n+=o.length+1)}),e.c=r,e},Ug=function(t,e,r){var n="",s=(t+n).match(Xr),o=e?"hsla(":"rgba(",a=0,l,h,c,u;if(!s)return t;if(s=s.map(function(d){return(d=Og(d,e,1))&&o+(e?d[0]+","+d[1]+"%,"+d[2]+"%,"+d[3]:d.join(","))+")"}),r&&(c=Bg(t),l=r.c,l.join(n)!==c.c.join(n)))for(h=t.replace(Xr,"1").split(ps),u=h.length-1;a<u;a++)n+=h[a]+(~l.indexOf(a)?s.shift()||o+"0,0,0,0)":(c.length?c:s.length?s:r).shift());if(!h)for(h=t.split(Xr),u=h.length-1;a<u;a++)n+=h[a]+s[a];return n+h[u]},Xr=function(){var i="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b",t;for(t in wo)i+="|"+t+"\\b";return new RegExp(i+")","gi")}(),xE=/hsl[a]?\(/,Xg=function(t){var e=t.join(" "),r;if(Xr.lastIndex=0,Xr.test(e))return r=xE.test(e),t[1]=Ug(t[1],r),t[0]=Ug(t[0],r,Bg(t[1])),!0},To,Ze=function(){var i=Date.now,t=500,e=33,r=i(),n=r,s=1e3/240,o=s,a=[],l,h,c,u,d,f,p=function m(g){var y=i()-n,x=g===!0,b,v,w,S;if((y>t||y<0)&&(r+=y-e),n+=y,w=n-r,b=w-o,(b>0||x)&&(S=++u.frame,d=w-u.time*1e3,u.time=w=w/1e3,o+=b+(b>=s?4:s-b),v=1),x||(l=h(m)),v)for(f=0;f<a.length;f++)a[f](w,d,S,g)};return u={time:0,frame:0,tick:function(){p(!0)},deltaRatio:function(g){return d/(1e3/(g||60))},wake:function(){dg&&(!Mu&&Cu()&&(Fi=Mu=window,Ru=Fi.document||{},Ue.gsap=Pe,(Fi.gsapVersions||(Fi.gsapVersions=[])).push(Pe.version),fg(yl||Fi.GreenSockGlobals||!Fi.gsap&&Fi||{}),Dg.forEach(Ng)),c=typeof requestAnimationFrame<"u"&&requestAnimationFrame,l&&u.sleep(),h=c||function(g){return setTimeout(g,o-u.time*1e3+1|0)},To=1,p(2))},sleep:function(){(c?cancelAnimationFrame:clearTimeout)(l),To=0,h=go},lagSmoothing:function(g,y){t=g||1/0,e=Math.min(y||33,t)},fps:function(g){s=1e3/(g||240),o=u.time*1e3+s},add:function(g,y,x){var b=y?function(v,w,S,C){g(v,w,S,C),u.remove(b)}:g;return u.remove(g),a[x?"unshift":"push"](b),xs(),b},remove:function(g,y){~(y=a.indexOf(g))&&a.splice(y,1)&&f>=y&&f--},_listeners:a},u}(),xs=function(){return!To&&Ze.wake()},Et={},_E=/^[\d.\-M][\d.\-,\s]/,vE=/["']/g,wE=function(t){for(var e={},r=t.substr(1,t.length-3).split(":"),n=r[0],s=1,o=r.length,a,l,h;s<o;s++)l=r[s],a=s!==o-1?l.lastIndexOf(","):l.length,h=l.substr(0,a),e[n]=isNaN(h)?h.replace(vE,"").trim():+h,n=l.substr(a+1).trim();return e},TE=function(t){var e=t.indexOf("(")+1,r=t.indexOf(")"),n=t.indexOf("(",e);return t.substring(e,~n&&n<r?t.indexOf(")",r+1):r)},SE=function(t){var e=(t+"").split("("),r=Et[e[0]];return r&&e.length>1&&r.config?r.config.apply(null,~t.indexOf("{")?[wE(e[1])]:TE(t).split(",").map(xg)):Et._CE&&_E.test(t)?Et._CE("",t):r},Wg=function(t){return function(e){return 1-t(1-e)}},Zg=function i(t,e){for(var r=t._first,n;r;)r instanceof Ee?i(r,e):r.vars.yoyoEase&&(!r._yoyo||!r._repeat)&&r._yoyo!==e&&(r.timeline?i(r.timeline,e):(n=r._ease,r._ease=r._yEase,r._yEase=n,r._yoyo=e)),r=r._next},Sn=function(t,e){return t&&(Yt(t)?t:Et[t]||SE(t))||e},En=function(t,e,r,n){r===void 0&&(r=function(l){return 1-e(1-l)}),n===void 0&&(n=function(l){return l<.5?e(l*2)/2:1-e((1-l)*2)/2});var s={easeIn:e,easeOut:r,easeInOut:n},o;return Me(t,function(a){Et[a]=Ue[a]=s,Et[o=a.toLowerCase()]=r;for(var l in s)Et[o+(l==="easeIn"?".in":l==="easeOut"?".out":".inOut")]=Et[a+"."+l]=s[l]}),s},Vg=function(t){return function(e){return e<.5?(1-t(1-e*2))/2:.5+t((e-.5)*2)/2}},Zu=function i(t,e,r){var n=e>=1?e:1,s=(r||(t?.3:.45))/(e<1?e:1),o=s/Su*(Math.asin(1/n)||0),a=function(c){return c===1?1:n*Math.pow(2,-10*c)*Q2((c-o)*s)+1},l=t==="out"?a:t==="in"?function(h){return 1-a(1-h)}:Vg(a);return s=Su/s,l.config=function(h,c){return i(t,h,c)},l},Vu=function i(t,e){e===void 0&&(e=1.70158);var r=function(o){return o?--o*o*((e+1)*o+e)+1:0},n=t==="out"?r:t==="in"?function(s){return 1-r(1-s)}:Vg(r);return n.config=function(s){return i(t,s)},n};Me("Linear,Quad,Cubic,Quart,Quint,Strong",function(i,t){var e=t<5?t+1:t;En(i+",Power"+(e-1),t?function(r){return Math.pow(r,e)}:function(r){return r},function(r){return 1-Math.pow(1-r,e)},function(r){return r<.5?Math.pow(r*2,e)/2:1-Math.pow((1-r)*2,e)/2})}),Et.Linear.easeNone=Et.none=Et.Linear.easeIn,En("Elastic",Zu("in"),Zu("out"),Zu()),function(i,t){var e=1/t,r=2*e,n=2.5*e,s=function(a){return a<e?i*a*a:a<r?i*Math.pow(a-1.5/t,2)+.75:a<n?i*(a-=2.25/t)*a+.9375:i*Math.pow(a-2.625/t,2)+.984375};En("Bounce",function(o){return 1-s(1-o)},s)}(7.5625,2.75),En("Expo",function(i){return i?Math.pow(2,10*(i-1)):0}),En("Circ",function(i){return-(ag(1-i*i)-1)}),En("Sine",function(i){return i===1?1:-$2(i*j2)+1}),En("Back",Vu("in"),Vu("out"),Vu()),Et.SteppedEase=Et.steps=Ue.SteppedEase={config:function(t,e){t===void 0&&(t=1);var r=1/t,n=t+(e?0:1),s=e?1:0,o=1-Ft;return function(a){return((n*xo(0,o,a)|0)+s)*r}}},fs.ease=Et["quad.out"],Me("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",function(i){return Fu+=i+","+i+"Params,"});var Hg=function(t,e){this.id=J2++,t._gsap=this,this.target=t,this.harness=e,this.get=e?e.get:yg,this.set=e?e.getSetter:ju},So=function(){function i(e){this.vars=e,this._delay=+e.delay||0,(this._repeat=e.repeat===1/0?-2:e.repeat||0)&&(this._rDelay=e.repeatDelay||0,this._yoyo=!!e.yoyo||!!e.yoyoEase),this._ts=1,ys(this,+e.duration,1,1),this.data=e.data,Ut&&(this._ctx=Ut,Ut.data.push(this)),To||Ze.wake()}var t=i.prototype;return t.delay=function(r){return r||r===0?(this.parent&&this.parent.smoothChildTiming&&this.startTime(this._start+r-this._delay),this._delay=r,this):this._delay},t.duration=function(r){return arguments.length?this.totalDuration(this._repeat>0?r+(r+this._rDelay)*this._repeat:r):this.totalDuration()&&this._dur},t.totalDuration=function(r){return arguments.length?(this._dirty=0,ys(this,this._repeat<0?r:(r-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},t.totalTime=function(r,n){if(xs(),!arguments.length)return this._tTime;var s=this._dp;if(s&&s.smoothChildTiming&&this._ts){for(El(this,r),!s._dp||s.parent||Sg(s,this);s&&s.parent;)s.parent._time!==s._start+(s._ts>=0?s._tTime/s._ts:(s.totalDuration()-s._tTime)/-s._ts)&&s.totalTime(s._tTime,!0),s=s.parent;!this.parent&&this._dp.autoRemoveChildren&&(this._ts>0&&r<this._tDur||this._ts<0&&r>0||!this._tDur&&!r)&&Di(this._dp,this,this._start-this._delay)}return(this._tTime!==r||!this._dur&&!n||this._initted&&Math.abs(this._zTime)===Ft||!r&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=r),bg(this,r,n)),this},t.time=function(r,n){return arguments.length?this.totalTime(Math.min(this.totalDuration(),r+Tg(this))%(this._dur+this._rDelay)||(r?this._dur:0),n):this._time},t.totalProgress=function(r,n){return arguments.length?this.totalTime(this.totalDuration()*r,n):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.rawTime()>0?1:0},t.progress=function(r,n){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&!(this.iteration()&1)?1-r:r)+Tg(this),n):this.duration()?Math.min(1,this._time/this._dur):this.rawTime()>0?1:0},t.iteration=function(r,n){var s=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(r-1)*s,n):this._repeat?gs(this._tTime,s)+1:1},t.timeScale=function(r,n){if(!arguments.length)return this._rts===-Ft?0:this._rts;if(this._rts===r)return this;var s=this.parent&&this._ts?Tl(this.parent._time,this):this._tTime;return this._rts=+r||0,this._ts=this._ps||r===-Ft?0:this._rts,this.totalTime(xo(-Math.abs(this._delay),this._tDur,s),n!==!1),Sl(this),sE(this)},t.paused=function(r){return arguments.length?(this._ps!==r&&(this._ps=r,r?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(xs(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,this.progress()===1&&Math.abs(this._zTime)!==Ft&&(this._tTime-=Ft)))),this):this._ps},t.startTime=function(r){if(arguments.length){this._start=r;var n=this.parent||this._dp;return n&&(n._sort||!this.parent)&&Di(n,this,r-this._delay),this}return this._start},t.endTime=function(r){return this._start+(Ae(r)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},t.rawTime=function(r){var n=this.parent||this._dp;return n?r&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?Tl(n.rawTime(r),this):this._tTime:this._tTime},t.revert=function(r){r===void 0&&(r=eE);var n=ye;return ye=r,(this._initted||this._startAt)&&(this.timeline&&this.timeline.revert(r),this.totalTime(-.01,r.suppressEvents)),this.data!=="nested"&&r.kill!==!1&&this.kill(),ye=n,this},t.globalTime=function(r){for(var n=this,s=arguments.length?r:n.rawTime();n;)s=n._start+s/(Math.abs(n._ts)||1),n=n._dp;return!this.parent&&this._sat?this._sat.globalTime(r):s},t.repeat=function(r){return arguments.length?(this._repeat=r===1/0?-2:r,Ig(this)):this._repeat===-2?1/0:this._repeat},t.repeatDelay=function(r){if(arguments.length){var n=this._time;return this._rDelay=r,Ig(this),n?this.time(n):this}return this._rDelay},t.yoyo=function(r){return arguments.length?(this._yoyo=r,this):this._yoyo},t.seek=function(r,n){return this.totalTime(qe(this,r),Ae(n))},t.restart=function(r,n){return this.play().totalTime(r?-this._delay:0,Ae(n))},t.play=function(r,n){return r!=null&&this.seek(r,n),this.reversed(!1).paused(!1)},t.reverse=function(r,n){return r!=null&&this.seek(r||this.totalDuration(),n),this.reversed(!0).paused(!1)},t.pause=function(r,n){return r!=null&&this.seek(r,n),this.paused(!0)},t.resume=function(){return this.paused(!1)},t.reversed=function(r){return arguments.length?(!!r!==this.reversed()&&this.timeScale(-this._rts||(r?-Ft:0)),this):this._rts<0},t.invalidate=function(){return this._initted=this._act=0,this._zTime=-Ft,this},t.isActive=function(){var r=this.parent||this._dp,n=this._start,s;return!!(!r||this._ts&&this._initted&&r.isActive()&&(s=r.rawTime(!0))>=n&&s<this.endTime(!0)-Ft)},t.eventCallback=function(r,n,s){var o=this.vars;return arguments.length>1?(n?(o[r]=n,s&&(o[r+"Params"]=s),r==="onUpdate"&&(this._onUpdate=n)):delete o[r],this):o[r]},t.then=function(r){var n=this;return new Promise(function(s){var o=Yt(r)?r:_g,a=function(){var h=n.then;n.then=null,Yt(o)&&(o=o(n))&&(o.then||o===n)&&(n.then=h),s(o),n.then=h};n._initted&&n.totalProgress()===1&&n._ts>=0||!n._tTime&&n._ts<0?a():n._prom=a})},t.kill=function(){vo(this)},i}();Qe(So.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:-Ft,_prom:0,_ps:!1,_rts:1});var Ee=function(i){og(t,i);function t(r,n){var s;return r===void 0&&(r={}),s=i.call(this,r)||this,s.labels={},s.smoothChildTiming=!!r.smoothChildTiming,s.autoRemoveChildren=!!r.autoRemoveChildren,s._sort=Ae(r.sortChildren),Ht&&Di(r.parent||Ht,ar(s),n),r.reversed&&s.reverse(),r.paused&&s.paused(!0),r.scrollTrigger&&Eg(ar(s),r.scrollTrigger),s}var e=t.prototype;return e.to=function(n,s,o){return bo(0,arguments,this),this},e.from=function(n,s,o){return bo(1,arguments,this),this},e.fromTo=function(n,s,o,a){return bo(2,arguments,this),this},e.set=function(n,s,o){return s.duration=0,s.parent=this,yo(s).repeatDelay||(s.repeat=0),s.immediateRender=!!s.immediateRender,new te(n,s,qe(this,o),1),this},e.call=function(n,s,o){return Di(this,te.delayedCall(0,n,s),o)},e.staggerTo=function(n,s,o,a,l,h,c){return o.duration=s,o.stagger=o.stagger||a,o.onComplete=h,o.onCompleteParams=c,o.parent=this,new te(n,o,qe(this,l)),this},e.staggerFrom=function(n,s,o,a,l,h,c){return o.runBackwards=1,yo(o).immediateRender=Ae(o.immediateRender),this.staggerTo(n,s,o,a,l,h,c)},e.staggerFromTo=function(n,s,o,a,l,h,c,u){return a.startAt=o,yo(a).immediateRender=Ae(a.immediateRender),this.staggerTo(n,s,a,l,h,c,u)},e.render=function(n,s,o){var a=this._time,l=this._dirty?this.totalDuration():this._tDur,h=this._dur,c=n<=0?0:ue(n),u=this._zTime<0!=n<0&&(this._initted||!h),d,f,p,m,g,y,x,b,v,w,S,C;if(this!==Ht&&c>l&&n>=0&&(c=l),c!==this._tTime||o||u){if(a!==this._time&&h&&(c+=this._time-a,n+=this._time-a),d=c,v=this._start,b=this._ts,y=!b,u&&(h||(a=this._zTime),(n||!s)&&(this._zTime=n)),this._repeat){if(S=this._yoyo,g=h+this._rDelay,this._repeat<-1&&n<0)return this.totalTime(g*100+n,s,o);if(d=ue(c%g),c===l?(m=this._repeat,d=h):(m=~~(c/g),m&&m===c/g&&(d=h,m--),d>h&&(d=h)),w=gs(this._tTime,g),!a&&this._tTime&&w!==m&&this._tTime-w*g-this._dur<=0&&(w=m),S&&m&1&&(d=h-d,C=1),m!==w&&!this._lock){var I=S&&w&1,M=I===(S&&m&1);if(m<w&&(I=!I),a=I?0:c%h?h:c,this._lock=1,this.render(a||(C?0:ue(m*g)),s,!h)._lock=0,this._tTime=c,!s&&this.parent&&We(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(h=this._dur,l=this._tDur,M&&(this._lock=2,a=I?h:-1e-4,this.render(a,!0),this.vars.repeatRefresh&&!C&&this.invalidate()),this._lock=0,!this._ts&&!y)return this;Zg(this,C)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(x=hE(this,ue(a),ue(d)),x&&(c-=d-(d=x._start))),this._tTime=c,this._time=d,this._act=!b,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=n,a=0),!a&&d&&!s&&!m&&(We(this,"onStart"),this._tTime!==c))return this;if(d>=a&&n>=0)for(f=this._first;f;){if(p=f._next,(f._act||d>=f._start)&&f._ts&&x!==f){if(f.parent!==this)return this.render(n,s,o);if(f.render(f._ts>0?(d-f._start)*f._ts:(f._dirty?f.totalDuration():f._tDur)+(d-f._start)*f._ts,s,o),d!==this._time||!this._ts&&!y){x=0,p&&(c+=this._zTime=-Ft);break}}f=p}else{f=this._last;for(var L=n<0?n:d;f;){if(p=f._prev,(f._act||L<=f._end)&&f._ts&&x!==f){if(f.parent!==this)return this.render(n,s,o);if(f.render(f._ts>0?(L-f._start)*f._ts:(f._dirty?f.totalDuration():f._tDur)+(L-f._start)*f._ts,s,o||ye&&(f._initted||f._startAt)),d!==this._time||!this._ts&&!y){x=0,p&&(c+=this._zTime=L?-Ft:Ft);break}}f=p}}if(x&&!s&&(this.pause(),x.render(d>=a?0:-Ft)._zTime=d>=a?1:-1,this._ts))return this._start=v,Sl(this),this.render(n,s,o);this._onUpdate&&!s&&We(this,"onUpdate",!0),(c===l&&this._tTime>=this.totalDuration()||!c&&a)&&(v===this._start||Math.abs(b)!==Math.abs(this._ts))&&(this._lock||((n||!h)&&(c===l&&this._ts>0||!c&&this._ts<0)&&Br(this,1),!s&&!(n<0&&!a)&&(c||a||!l)&&(We(this,c===l&&n>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(c<l&&this.timeScale()>0)&&this._prom())))}return this},e.add=function(n,s){var o=this;if(lr(s)||(s=qe(this,s,n)),!(n instanceof So)){if(be(n))return n.forEach(function(a){return o.add(a,s)}),this;if(ce(n))return this.addLabel(n,s);if(Yt(n))n=te.delayedCall(0,n);else return this}return this!==n?Di(this,n,s):this},e.getChildren=function(n,s,o,a){n===void 0&&(n=!0),s===void 0&&(s=!0),o===void 0&&(o=!0),a===void 0&&(a=-$e);for(var l=[],h=this._first;h;)h._start>=a&&(h instanceof te?s&&l.push(h):(o&&l.push(h),n&&l.push.apply(l,h.getChildren(!0,s,o)))),h=h._next;return l},e.getById=function(n){for(var s=this.getChildren(1,1,1),o=s.length;o--;)if(s[o].vars.id===n)return s[o]},e.remove=function(n){return ce(n)?this.removeLabel(n):Yt(n)?this.killTweensOf(n):(wl(this,n),n===this._recent&&(this._recent=this._last),Tn(this))},e.totalTime=function(n,s){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=ue(Ze.time-(this._ts>0?n/this._ts:(this.totalDuration()-n)/-this._ts))),i.prototype.totalTime.call(this,n,s),this._forcing=0,this):this._tTime},e.addLabel=function(n,s){return this.labels[n]=qe(this,s),this},e.removeLabel=function(n){return delete this.labels[n],this},e.addPause=function(n,s,o){var a=te.delayedCall(0,s||go,o);return a.data="isPause",this._hasPause=1,Di(this,a,qe(this,n))},e.removePause=function(n){var s=this._first;for(n=qe(this,n);s;)s._start===n&&s.data==="isPause"&&Br(s),s=s._next},e.killTweensOf=function(n,s,o){for(var a=this.getTweensOf(n,o),l=a.length;l--;)Wr!==a[l]&&a[l].kill(n,s);return this},e.getTweensOf=function(n,s){for(var o=[],a=ti(n),l=this._first,h=lr(s),c;l;)l instanceof te?iE(l._targets,a)&&(h?(!Wr||l._initted&&l._ts)&&l.globalTime(0)<=s&&l.globalTime(l.totalDuration())>s:!s||l.isActive())&&o.push(l):(c=l.getTweensOf(a,s)).length&&o.push.apply(o,c),l=l._next;return o},e.tweenTo=function(n,s){s=s||{};var o=this,a=qe(o,n),l=s,h=l.startAt,c=l.onStart,u=l.onStartParams,d=l.immediateRender,f,p=te.to(o,Qe({ease:s.ease||"none",lazy:!1,immediateRender:!1,time:a,overwrite:"auto",duration:s.duration||Math.abs((a-(h&&"time"in h?h.time:o._time))/o.timeScale())||Ft,onStart:function(){if(o.pause(),!f){var g=s.duration||Math.abs((a-(h&&"time"in h?h.time:o._time))/o.timeScale());p._dur!==g&&ys(p,g,0,1).render(p._time,!0,!0),f=1}c&&c.apply(p,u||[])}},s));return d?p.render(0):p},e.tweenFromTo=function(n,s,o){return this.tweenTo(s,Qe({startAt:{time:qe(this,n)}},o))},e.recent=function(){return this._recent},e.nextLabel=function(n){return n===void 0&&(n=this._time),Fg(this,qe(this,n))},e.previousLabel=function(n){return n===void 0&&(n=this._time),Fg(this,qe(this,n),1)},e.currentLabel=function(n){return arguments.length?this.seek(n,!0):this.previousLabel(this._time+Ft)},e.shiftChildren=function(n,s,o){o===void 0&&(o=0);for(var a=this._first,l=this.labels,h;a;)a._start>=o&&(a._start+=n,a._end+=n),a=a._next;if(s)for(h in l)l[h]>=o&&(l[h]+=n);return Tn(this)},e.invalidate=function(n){var s=this._first;for(this._lock=0;s;)s.invalidate(n),s=s._next;return i.prototype.invalidate.call(this,n)},e.clear=function(n){n===void 0&&(n=!0);for(var s=this._first,o;s;)o=s._next,this.remove(s),s=o;return this._dp&&(this._time=this._tTime=this._pTime=0),n&&(this.labels={}),Tn(this)},e.totalDuration=function(n){var s=0,o=this,a=o._last,l=$e,h,c,u;if(arguments.length)return o.timeScale((o._repeat<0?o.duration():o.totalDuration())/(o.reversed()?-n:n));if(o._dirty){for(u=o.parent;a;)h=a._prev,a._dirty&&a.totalDuration(),c=a._start,c>l&&o._sort&&a._ts&&!o._lock?(o._lock=1,Di(o,a,c-a._delay,1)._lock=0):l=c,c<0&&a._ts&&(s-=c,(!u&&!o._dp||u&&u.smoothChildTiming)&&(o._start+=c/o._ts,o._time-=c,o._tTime-=c),o.shiftChildren(-c,!1,-1/0),l=0),a._end>s&&a._ts&&(s=a._end),a=h;ys(o,o===Ht&&o._time>s?o._time:s,1,1),o._dirty=0}return o._tDur},t.updateRoot=function(n){if(Ht._ts&&(bg(Ht,Tl(n,Ht)),mg=Ze.frame),Ze.frame>=gg){gg+=Be.autoSleep||120;var s=Ht._first;if((!s||!s._ts)&&Be.autoSleep&&Ze._listeners.length<2){for(;s&&!s._ts;)s=s._next;s||Ze.sleep()}}},t}(So);Qe(Ee.prototype,{_lock:0,_hasPause:0,_forcing:0});var EE=function(t,e,r,n,s,o,a){var l=new Re(this._pt,t,e,0,1,$g,null,s),h=0,c=0,u,d,f,p,m,g,y,x;for(l.b=r,l.e=n,r+="",n+="",(y=~n.indexOf("random("))&&(n=_o(n)),o&&(x=[r,n],o(x,t,e),r=x[0],n=x[1]),d=r.match(Au)||[];u=Au.exec(n);)p=u[0],m=n.substring(h,u.index),f?f=(f+1)%5:m.substr(-5)==="rgba("&&(f=1),p!==d[c++]&&(g=parseFloat(d[c-1])||0,l._pt={_next:l._pt,p:m||c===1?m:",",s:g,c:p.charAt(1)==="="?ms(g,p)-g:parseFloat(p)-g,m:f&&f<4?Math.round:0},h=Au.lastIndex);return l.c=h<n.length?n.substring(h,n.length):"",l.fp=a,(cg.test(n)||y)&&(l.e=0),this._pt=l,l},Hu=function(t,e,r,n,s,o,a,l,h,c){Yt(n)&&(n=n(s||0,t,o));var u=t[e],d=r!=="get"?r:Yt(u)?h?t[e.indexOf("set")||!Yt(t["get"+e.substr(3)])?e:"get"+e.substr(3)](h):t[e]():u,f=Yt(u)?h?RE:jg:Yu,p;if(ce(n)&&(~n.indexOf("random(")&&(n=_o(n)),n.charAt(1)==="="&&(p=ms(d,n)+(xe(d)||0),(p||p===0)&&(n=p))),!c||d!==n||Ku)return!isNaN(d*n)&&n!==""?(p=new Re(this._pt,t,e,+d||0,n-(d||0),typeof u=="boolean"?LE:Jg,0,f),h&&(p.fp=h),a&&p.modifier(a,this,t),this._pt=p):(!u&&!(e in t)&&Pu(e,n),EE.call(this,t,e,d,n,f,l||Be.stringFilter,h))},CE=function(t,e,r,n,s){if(Yt(t)&&(t=Eo(t,s,e,r,n)),!ki(t)||t.style&&t.nodeType||be(t)||lg(t))return ce(t)?Eo(t,s,e,r,n):t;var o={},a;for(a in t)o[a]=Eo(t[a],s,e,r,n);return o},Kg=function(t,e,r,n,s,o){var a,l,h,c;if(Xe[t]&&(a=new Xe[t]).init(s,a.rawVars?e[t]:CE(e[t],n,s,o,r),r,n,o)!==!1&&(r._pt=l=new Re(r._pt,s,t,0,1,a.render,a,0,a.priority),r!==bs))for(h=r._ptLookup[r._targets.indexOf(s)],c=a._props.length;c--;)h[a._props[c]]=l;return a},Wr,Ku,zu=function i(t,e,r){var n=t.vars,s=n.ease,o=n.startAt,a=n.immediateRender,l=n.lazy,h=n.onUpdate,c=n.runBackwards,u=n.yoyoEase,d=n.keyframes,f=n.autoRevert,p=t._dur,m=t._startAt,g=t._targets,y=t.parent,x=y&&y.data==="nested"?y.vars.targets:g,b=t._overwrite==="auto"&&!Tu,v=t.timeline,w,S,C,I,M,L,G,F,A,N,Z,K,H;if(v&&(!d||!s)&&(s="none"),t._ease=Sn(s,fs.ease),t._yEase=u?Wg(Sn(u===!0?s:u,fs.ease)):0,u&&t._yoyo&&!t._repeat&&(u=t._yEase,t._yEase=t._ease,t._ease=u),t._from=!v&&!!n.runBackwards,!v||d&&!n.stagger){if(F=g[0]?vn(g[0]).harness:0,K=F&&n[F.prop],w=vl(n,Lu),m&&(m._zTime<0&&m.progress(1),e<0&&c&&a&&!f?m.render(-1,!0):m.revert(c&&p?bl:tE),m._lazy=0),o){if(Br(t._startAt=te.set(g,Qe({data:"isStart",overwrite:!1,parent:y,immediateRender:!0,lazy:!m&&Ae(l),startAt:null,delay:0,onUpdate:h&&function(){return We(t,"onUpdate")},stagger:0},o))),t._startAt._dp=0,t._startAt._sat=t,e<0&&(ye||!a&&!f)&&t._startAt.revert(bl),a&&p&&e<=0&&r<=0){e&&(t._zTime=e);return}}else if(c&&p&&!m){if(e&&(a=!1),C=Qe({overwrite:!1,data:"isFromStart",lazy:a&&!m&&Ae(l),immediateRender:a,stagger:0,parent:y},w),K&&(C[F.prop]=K),Br(t._startAt=te.set(g,C)),t._startAt._dp=0,t._startAt._sat=t,e<0&&(ye?t._startAt.revert(bl):t._startAt.render(-1,!0)),t._zTime=e,!a)i(t._startAt,Ft,Ft);else if(!e)return}for(t._pt=t._ptCache=0,l=p&&Ae(l)||l&&!p,S=0;S<g.length;S++){if(M=g[S],G=M._gsap||Du(g)[S]._gsap,t._ptLookup[S]=N={},Gu[G.id]&&Or.length&&_l(),Z=x===g?S:x.indexOf(M),F&&(A=new F).init(M,K||w,t,Z,x)!==!1&&(t._pt=I=new Re(t._pt,M,A.name,0,1,A.render,A,0,A.priority),A._props.forEach(function(j){N[j]=I}),A.priority&&(L=1)),!F||K)for(C in w)Xe[C]&&(A=Kg(C,w,t,Z,M,x))?A.priority&&(L=1):N[C]=I=Hu.call(t,M,C,"get",w[C],Z,x,0,n.stringFilter);t._op&&t._op[S]&&t.kill(M,t._op[S]),b&&t._pt&&(Wr=t,Ht.killTweensOf(M,N,t.globalTime(e)),H=!t.parent,Wr=0),t._pt&&l&&(Gu[G.id]=1)}L&&Qg(t),t._onInit&&t._onInit(t)}t._onUpdate=h,t._initted=(!t._op||t._pt)&&!H,d&&e<=0&&v.render($e,!0,!0)},IE=function(t,e,r,n,s,o,a,l){var h=(t._pt&&t._ptCache||(t._ptCache={}))[e],c,u,d,f;if(!h)for(h=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 Ku=1,t.vars[e]="+=0",zu(t,a),Ku=0,l?mo(e+" not eligible for reset"):1;h.push(c)}for(f=h.length;f--;)u=h[f],c=u._pt||u,c.s=(n||n===0)&&!s?n:c.s+(n||0)+o*c.c,c.c=r-c.s,u.e&&(u.e=Jt(r)+xe(u.e)),u.b&&(u.b=c.s+xe(u.b))},AE=function(t,e){var r=t[0]?vn(t[0]).harness:0,n=r&&r.aliases,s,o,a,l;if(!n)return e;s=wn({},e);for(o in n)if(o in s)for(l=n[o].split(","),a=l.length;a--;)s[l[a]]=s[o];return s},ME=function(t,e,r,n){var s=e.ease||n||"power1.inOut",o,a;if(be(e))a=r[t]||(r[t]=[]),e.forEach(function(l,h){return a.push({t:h/(e.length-1)*100,v:l,e:s})});else for(o in e)a=r[o]||(r[o]=[]),o==="ease"||a.push({t:parseFloat(t),v:e[o],e:s})},Eo=function(t,e,r,n,s){return Yt(t)?t.call(e,r,n,s):ce(t)&&~t.indexOf("random(")?_o(t):t},zg=Fu+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert",Yg={};Me(zg+",id,stagger,delay,duration,paused,scrollTrigger",function(i){return Yg[i]=1});var te=function(i){og(t,i);function t(r,n,s,o){var a;typeof n=="number"&&(s.duration=n,n=s,s=null),a=i.call(this,o?n:yo(n))||this;var l=a.vars,h=l.duration,c=l.delay,u=l.immediateRender,d=l.stagger,f=l.overwrite,p=l.keyframes,m=l.defaults,g=l.scrollTrigger,y=l.yoyoEase,x=n.parent||Ht,b=(be(r)||lg(r)?lr(r[0]):"length"in n)?[r]:ti(r),v,w,S,C,I,M,L,G;if(a._targets=b.length?Du(b):mo("GSAP target "+r+" not found. https://gsap.com",!Be.nullTargetWarn)||[],a._ptLookup=[],a._overwrite=f,p||d||gl(h)||gl(c)){if(n=a.vars,v=a.timeline=new Ee({data:"nested",defaults:m||{},targets:x&&x.data==="nested"?x.vars.targets:b}),v.kill(),v.parent=v._dp=ar(a),v._start=0,d||gl(h)||gl(c)){if(C=b.length,L=d&&Rg(d),ki(d))for(I in d)~zg.indexOf(I)&&(G||(G={}),G[I]=d[I]);for(w=0;w<C;w++)S=vl(n,Yg),S.stagger=0,y&&(S.yoyoEase=y),G&&wn(S,G),M=b[w],S.duration=+Eo(h,ar(a),w,M,b),S.delay=(+Eo(c,ar(a),w,M,b)||0)-a._delay,!d&&C===1&&S.delay&&(a._delay=c=S.delay,a._start+=c,S.delay=0),v.to(M,S,L?L(w,M,b):0),v._ease=Et.none;v.duration()?h=c=0:a.timeline=0}else if(p){yo(Qe(v.vars.defaults,{ease:"none"})),v._ease=Sn(p.ease||n.ease||"none");var F=0,A,N,Z;if(be(p))p.forEach(function(K){return v.to(b,K,">")}),v.duration();else{S={};for(I in p)I==="ease"||I==="easeEach"||ME(I,p[I],S,p.easeEach);for(I in S)for(A=S[I].sort(function(K,H){return K.t-H.t}),F=0,w=0;w<A.length;w++)N=A[w],Z={ease:N.e,duration:(N.t-(w?A[w-1].t:0))/100*h},Z[I]=N.v,v.to(b,Z,F),F+=Z.duration;v.duration()<h&&v.to({},{duration:h-v.duration()})}}h||a.duration(h=v.duration())}else a.timeline=0;return f===!0&&!Tu&&(Wr=ar(a),Ht.killTweensOf(b),Wr=0),Di(x,ar(a),s),n.reversed&&a.reverse(),n.paused&&a.paused(!0),(u||!h&&!p&&a._start===ue(x._time)&&Ae(u)&&oE(ar(a))&&x.data!=="nested")&&(a._tTime=-Ft,a.render(Math.max(0,-c)||0)),g&&Eg(ar(a),g),a}var e=t.prototype;return e.render=function(n,s,o){var a=this._time,l=this._tDur,h=this._dur,c=n<0,u=n>l-Ft&&!c?l:n<Ft?0:n,d,f,p,m,g,y,x,b,v;if(!h)lE(this,n,s,o);else if(u!==this._tTime||!n||o||!this._initted&&this._tTime||this._startAt&&this._zTime<0!==c){if(d=u,b=this.timeline,this._repeat){if(m=h+this._rDelay,this._repeat<-1&&c)return this.totalTime(m*100+n,s,o);if(d=ue(u%m),u===l?(p=this._repeat,d=h):(p=~~(u/m),p&&p===ue(u/m)&&(d=h,p--),d>h&&(d=h)),y=this._yoyo&&p&1,y&&(v=this._yEase,d=h-d),g=gs(this._tTime,m),d===a&&!o&&this._initted&&p===g)return this._tTime=u,this;p!==g&&(b&&this._yEase&&Zg(b,y),this.vars.repeatRefresh&&!y&&!this._lock&&this._time!==m&&this._initted&&(this._lock=o=1,this.render(ue(m*p),!0).invalidate()._lock=0))}if(!this._initted){if(Cg(this,c?n:d,o,s,u))return this._tTime=0,this;if(a!==this._time&&!(o&&this.vars.repeatRefresh&&p!==g))return this;if(h!==this._dur)return this.render(n,s,o)}if(this._tTime=u,this._time=d,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=x=(v||this._ease)(d/h),this._from&&(this.ratio=x=1-x),d&&!a&&!s&&!p&&(We(this,"onStart"),this._tTime!==u))return this;for(f=this._pt;f;)f.r(x,f.d),f=f._next;b&&b.render(n<0?n:b._dur*b._ease(d/this._dur),s,o)||this._startAt&&(this._zTime=n),this._onUpdate&&!s&&(c&&Nu(this,n,s,o),We(this,"onUpdate")),this._repeat&&p!==g&&this.vars.onRepeat&&!s&&this.parent&&We(this,"onRepeat"),(u===this._tDur||!u)&&this._tTime===u&&(c&&!this._onUpdate&&Nu(this,n,!0,!0),(n||!h)&&(u===this._tDur&&this._ts>0||!u&&this._ts<0)&&Br(this,1),!s&&!(c&&!a)&&(u||a||y)&&(We(this,u===l?"onComplete":"onReverseComplete",!0),this._prom&&!(u<l&&this.timeScale()>0)&&this._prom()))}return this},e.targets=function(){return this._targets},e.invalidate=function(n){return(!n||!this.vars.runBackwards)&&(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(n),i.prototype.invalidate.call(this,n)},e.resetTo=function(n,s,o,a,l){To||Ze.wake(),this._ts||this.play();var h=Math.min(this._dur,(this._dp._time-this._start)*this._ts),c;return this._initted||zu(this,h),c=this._ease(h/this._dur),IE(this,n,s,o,a,c,h,l)?this.resetTo(n,s,o,a,1):(El(this,0),this.parent||wg(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},e.kill=function(n,s){if(s===void 0&&(s="all"),!n&&(!s||s==="all"))return this._lazy=this._pt=0,this.parent?vo(this):this;if(this.timeline){var o=this.timeline.totalDuration();return this.timeline.killTweensOf(n,s,Wr&&Wr.vars.overwrite!==!0)._first||vo(this),this.parent&&o!==this.timeline.totalDuration()&&ys(this,this._dur*this.timeline._tDur/o,0,1),this}var a=this._targets,l=n?ti(n):a,h=this._ptLookup,c=this._pt,u,d,f,p,m,g,y;if((!s||s==="all")&&nE(a,l))return s==="all"&&(this._pt=0),vo(this);for(u=this._op=this._op||[],s!=="all"&&(ce(s)&&(m={},Me(s,function(x){return m[x]=1}),s=m),s=AE(a,s)),y=a.length;y--;)if(~l.indexOf(a[y])){d=h[y],s==="all"?(u[y]=s,p=d,f={}):(f=u[y]=u[y]||{},p=s);for(m in p)g=d&&d[m],g&&((!("kill"in g.d)||g.d.kill(m)===!0)&&wl(this,g,"_pt"),delete d[m]),f!=="all"&&(f[m]=1)}return this._initted&&!this._pt&&c&&vo(this),this},t.to=function(n,s){return new t(n,s,arguments[2])},t.from=function(n,s){return bo(1,arguments)},t.delayedCall=function(n,s,o,a){return new t(s,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:n,onComplete:s,onReverseComplete:s,onCompleteParams:o,onReverseCompleteParams:o,callbackScope:a})},t.fromTo=function(n,s,o){return bo(2,arguments)},t.set=function(n,s){return s.duration=0,s.repeatDelay||(s.repeat=0),new t(n,s)},t.killTweensOf=function(n,s,o){return Ht.killTweensOf(n,s,o)},t}(So);Qe(te.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),Me("staggerTo,staggerFrom,staggerFromTo",function(i){te[i]=function(){var t=new Ee,e=Bu.call(arguments,0);return e.splice(i==="staggerFromTo"?5:4,0,0),t[i].apply(t,e)}});var Yu=function(t,e,r){return t[e]=r},jg=function(t,e,r){return t[e](r)},RE=function(t,e,r,n){return t[e](n.fp,r)},PE=function(t,e,r){return t.setAttribute(e,r)},ju=function(t,e){return Yt(t[e])?jg:Eu(t[e])&&t.setAttribute?PE:Yu},Jg=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e6)/1e6,e)},LE=function(t,e){return e.set(e.t,e.p,!!(e.s+e.c*t),e)},$g=function(t,e){var r=e._pt,n="";if(!t&&e.b)n=e.b;else if(t===1&&e.e)n=e.e;else{for(;r;)n=r.p+(r.m?r.m(r.s+r.c*t):Math.round((r.s+r.c*t)*1e4)/1e4)+n,r=r._next;n+=e.c}e.set(e.t,e.p,n,e)},Ju=function(t,e){for(var r=e._pt;r;)r.r(t,r.d),r=r._next},GE=function(t,e,r,n){for(var s=this._pt,o;s;)o=s._next,s.p===n&&s.modifier(t,e,r),s=o},kE=function(t){for(var e=this._pt,r,n;e;)n=e._next,e.p===t&&!e.op||e.op===t?wl(this,e,"_pt"):e.dep||(r=1),e=n;return!r},FE=function(t,e,r,n){n.mSet(t,e,n.m.call(n.tween,r,n.mt),n)},Qg=function(t){for(var e=t._pt,r,n,s,o;e;){for(r=e._next,n=s;n&&n.pr>e.pr;)n=n._next;(e._prev=n?n._prev:o)?e._prev._next=e:s=e,(e._next=n)?n._prev=e:o=e,e=r}t._pt=s},Re=function(){function i(e,r,n,s,o,a,l,h,c){this.t=r,this.s=s,this.c=o,this.p=n,this.r=a||Jg,this.d=l||this,this.set=h||Yu,this.pr=c||0,this._next=e,e&&(e._prev=this)}var t=i.prototype;return t.modifier=function(r,n,s){this.mSet=this.mSet||this.set,this.set=FE,this.m=r,this.mt=s,this.tween=n},i}();Me(Fu+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",function(i){return Lu[i]=1}),Ue.TweenMax=Ue.TweenLite=te,Ue.TimelineLite=Ue.TimelineMax=Ee,Ht=new Ee({sortChildren:!1,defaults:fs,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),Be.stringFilter=Xg;var Cn=[],Cl={},DE=[],qg=0,NE=0,$u=function(t){return(Cl[t]||DE).map(function(e){return e()})},Qu=function(){var t=Date.now(),e=[];t-qg>2&&($u("matchMediaInit"),Cn.forEach(function(r){var n=r.queries,s=r.conditions,o,a,l,h;for(a in n)o=Fi.matchMedia(n[a]).matches,o&&(l=1),o!==s[a]&&(s[a]=o,h=1);h&&(r.revert(),l&&e.push(r))}),$u("matchMediaRevert"),e.forEach(function(r){return r.onMatch(r,function(n){return r.add(null,n)})}),qg=t,$u("matchMedia"))},ty=function(){function i(e,r){this.selector=r&&Uu(r),this.data=[],this._r=[],this.isReverted=!1,this.id=NE++,e&&this.add(e)}var t=i.prototype;return t.add=function(r,n,s){Yt(r)&&(s=n,n=r,r=Yt);var o=this,a=function(){var h=Ut,c=o.selector,u;return h&&h!==o&&h.data.push(o),s&&(o.selector=Uu(s)),Ut=o,u=n.apply(o,arguments),Yt(u)&&o._r.push(u),Ut=h,o.selector=c,o.isReverted=!1,u};return o.last=a,r===Yt?a(o,function(l){return o.add(null,l)}):r?o[r]=a:a},t.ignore=function(r){var n=Ut;Ut=null,r(this),Ut=n},t.getTweens=function(){var r=[];return this.data.forEach(function(n){return n instanceof i?r.push.apply(r,n.getTweens()):n instanceof te&&!(n.parent&&n.parent.data==="nested")&&r.push(n)}),r},t.clear=function(){this._r.length=this.data.length=0},t.kill=function(r,n){var s=this;if(r?function(){for(var a=s.getTweens(),l=s.data.length,h;l--;)h=s.data[l],h.data==="isFlip"&&(h.revert(),h.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(r)}),l=s.data.length;l--;)h=s.data[l],h instanceof Ee?h.data!=="nested"&&(h.scrollTrigger&&h.scrollTrigger.revert(),h.kill()):!(h instanceof te)&&h.revert&&h.revert(r);s._r.forEach(function(c){return c(r,s)}),s.isReverted=!0}():this.data.forEach(function(a){return a.kill&&a.kill()}),this.clear(),n)for(var o=Cn.length;o--;)Cn[o].id===this.id&&Cn.splice(o,1)},t.revert=function(r){this.kill(r||{})},i}(),OE=function(){function i(e){this.contexts=[],this.scope=e,Ut&&Ut.data.push(this)}var t=i.prototype;return t.add=function(r,n,s){ki(r)||(r={matches:r});var o=new ty(0,s||this.scope),a=o.conditions={},l,h,c;Ut&&!o.selector&&(o.selector=Ut.selector),this.contexts.push(o),n=o.add("onMatch",n),o.queries=r;for(h in r)h==="all"?c=1:(l=Fi.matchMedia(r[h]),l&&(Cn.indexOf(o)<0&&Cn.push(o),(a[h]=l.matches)&&(c=1),l.addListener?l.addListener(Qu):l.addEventListener("change",Qu)));return c&&n(o,function(u){return o.add(null,u)}),this},t.revert=function(r){this.kill(r||{})},t.kill=function(r){this.contexts.forEach(function(n){return n.kill(r,!0)})},i}(),Il={registerPlugin:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];e.forEach(function(n){return Ng(n)})},timeline:function(t){return new Ee(t)},getTweensOf:function(t,e){return Ht.getTweensOf(t,e)},getProperty:function(t,e,r,n){ce(t)&&(t=ti(t)[0]);var s=vn(t||{}).get,o=r?_g:xg;return r==="native"&&(r=""),t&&(e?o((Xe[e]&&Xe[e].get||s)(t,e,r,n)):function(a,l,h){return o((Xe[a]&&Xe[a].get||s)(t,a,l,h))})},quickSetter:function(t,e,r){if(t=ti(t),t.length>1){var n=t.map(function(c){return Pe.quickSetter(c,e,r)}),s=n.length;return function(c){for(var u=s;u--;)n[u](c)}}t=t[0]||{};var o=Xe[e],a=vn(t),l=a.harness&&(a.harness.aliases||{})[e]||e,h=o?function(c){var u=new o;bs._pt=0,u.init(t,r?c+r:c,bs,0,[t]),u.render(1,u),bs._pt&&Ju(1,bs)}:a.set(t,l);return o?h:function(c){return h(t,l,r?c+r:c,a,1)}},quickTo:function(t,e,r){var n,s=Pe.to(t,wn((n={},n[e]="+=0.1",n.paused=!0,n),r||{})),o=function(l,h,c){return s.resetTo(e,l,h,c)};return o.tween=s,o},isTweening:function(t){return Ht.getTweensOf(t,!0).length>0},defaults:function(t){return t&&t.ease&&(t.ease=Sn(t.ease,fs.ease)),vg(fs,t||{})},config:function(t){return vg(Be,t||{})},registerEffect:function(t){var e=t.name,r=t.effect,n=t.plugins,s=t.defaults,o=t.extendTimeline;(n||"").split(",").forEach(function(a){return a&&!Xe[a]&&!Ue[a]&&mo(e+" effect requires "+a+" plugin.")}),ku[e]=function(a,l,h){return r(ti(a),Qe(l||{},s),h)},o&&(Ee.prototype[e]=function(a,l,h){return this.add(ku[e](a,ki(l)?l:(h=l)&&{},this),h)})},registerEase:function(t,e){Et[t]=Sn(e)},parseEase:function(t,e){return arguments.length?Sn(t,e):Et},getById:function(t){return Ht.getById(t)},exportRoot:function(t,e){t===void 0&&(t={});var r=new Ee(t),n,s;for(r.smoothChildTiming=Ae(t.smoothChildTiming),Ht.remove(r),r._dp=0,r._time=r._tTime=Ht._time,n=Ht._first;n;)s=n._next,(e||!(!n._dur&&n instanceof te&&n.vars.onComplete===n._targets[0]))&&Di(r,n,n._start-n._delay),n=s;return Di(Ht,r,0),r},context:function(t,e){return t?new ty(t,e):Ut},matchMedia:function(t){return new OE(t)},matchMediaRefresh:function(){return Cn.forEach(function(t){var e=t.conditions,r,n;for(n in e)e[n]&&(e[n]=!1,r=1);r&&t.revert()})||Qu()},addEventListener:function(t,e){var r=Cl[t]||(Cl[t]=[]);~r.indexOf(e)||r.push(e)},removeEventListener:function(t,e){var r=Cl[t],n=r&&r.indexOf(e);n>=0&&r.splice(n,1)},utils:{wrap:gE,wrapYoyo:yE,distribute:Rg,random:Lg,snap:Pg,normalize:mE,getUnit:xe,clamp:uE,splitColor:Og,toArray:ti,selector:Uu,mapRange:kg,pipe:fE,unitize:pE,interpolate:bE,shuffle:Mg},install:fg,effects:ku,ticker:Ze,updateRoot:Ee.updateRoot,plugins:Xe,globalTimeline:Ht,core:{PropTween:Re,globals:pg,Tween:te,Timeline:Ee,Animation:So,getCache:vn,_removeLinkedListItem:wl,reverting:function(){return ye},context:function(t){return t&&Ut&&(Ut.data.push(t),t._ctx=Ut),Ut},suppressOverwrites:function(t){return Tu=t}}};Me("to,from,fromTo,delayedCall,set,killTweensOf",function(i){return Il[i]=te[i]}),Ze.add(Ee.updateRoot),bs=Il.to({},{duration:0});var BE=function(t,e){for(var r=t._pt;r&&r.p!==e&&r.op!==e&&r.fp!==e;)r=r._next;return r},UE=function(t,e){var r=t._targets,n,s,o;for(n in e)for(s=r.length;s--;)o=t._ptLookup[s][n],o&&(o=o.d)&&(o._pt&&(o=BE(o,n)),o&&o.modifier&&o.modifier(e[n],t,r[s],n))},qu=function(t,e){return{name:t,rawVars:1,init:function(n,s,o){o._onInit=function(a){var l,h;if(ce(s)&&(l={},Me(s,function(c){return l[c]=1}),s=l),e){l={};for(h in s)l[h]=e(s[h]);s=l}UE(a,s)}}}},Pe=Il.registerPlugin({name:"attr",init:function(t,e,r,n,s){var o,a,l;this.tween=r;for(o in e)l=t.getAttribute(o)||"",a=this.add(t,"setAttribute",(l||0)+"",e[o],n,s,0,0,o),a.op=o,a.b=l,this._props.push(o)},render:function(t,e){for(var r=e._pt;r;)ye?r.set(r.t,r.p,r.b,r):r.r(t,r.d),r=r._next}},{name:"endArray",init:function(t,e){for(var r=e.length;r--;)this.add(t,r,t[r]||0,e[r],0,0,0,0,0,1)}},qu("roundProps",Xu),qu("modifiers"),qu("snap",Pg))||Il;te.version=Ee.version=Pe.version="3.12.5",dg=1,Cu()&&xs(),Et.Power0,Et.Power1,Et.Power2,Et.Power3,Et.Power4,Et.Linear,Et.Quad,Et.Cubic,Et.Quart,Et.Quint,Et.Strong,Et.Elastic,Et.Back,Et.SteppedEase,Et.Bounce,Et.Sine,Et.Expo,Et.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 Z0,Ur,yn,Ju,ws,V0,$u,mC=function(){return typeof window<"u"},hr={},Ts=180/Math.PI,bn=Math.PI/180,xn=Math.atan2,H0=1e8,Qu=/([A-Z])/g,gC=/(left|right|width|margin|padding|x)/i,yC=/[\s,\(]\S/,ki={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},qu=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},bC=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)},xC=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)},_C=function(t,e){var i=e.s+e.c*t;e.set(e.t,e.p,~~(i+(i<0?-.5:.5))+e.u,e)},K0=function(t,e){return e.set(e.t,e.p,t?e.e:e.b,e)},Y0=function(t,e){return e.set(e.t,e.p,t!==1?e.b:e.e,e)},vC=function(t,e,i){return t.style[e]=i},wC=function(t,e,i){return t.style.setProperty(e,i)},TC=function(t,e,i){return t._gsap[e]=i},SC=function(t,e,i){return t._gsap.scaleX=t._gsap.scaleY=i},EC=function(t,e,i,s,n){var o=t._gsap;o.scaleX=o.scaleY=i,o.renderTransform(n,o)},CC=function(t,e,i,s,n){var o=t._gsap;o[e]=i,o.renderTransform(n,o)},Ht="transform",Pe=Ht+"Origin",IC=function r(t,e){var i=this,s=this.target,n=s.style,o=s._gsap;if(t in hr&&n){if(this.tfm=this.tfm||{},t!=="transform")t=ki[t]||t,~t.indexOf(",")?t.split(",").forEach(function(a){return i.tfm[a]=lr(s,a)}):this.tfm[t]=o.x?o[t]:lr(s,t),t===Pe&&(this.tfm.zOrigin=o.zOrigin);else return ki.transform.split(",").forEach(function(a){return r.call(i,a,e)});if(this.props.indexOf(Ht)>=0)return;o.svg&&(this.svgo=s.getAttribute("data-svg-origin"),this.props.push(Pe,e,"")),t=Ht}(n||e)&&this.props.push(t,e,n[t])},z0=function(t){t.translate&&(t.removeProperty("translate"),t.removeProperty("scale"),t.removeProperty("rotate"))},AC=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(Qu,"-$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=$u(),(!n||!n.isStart)&&!i[Ht]&&(z0(i),s.zOrigin&&i[Pe]&&(i[Pe]+=" "+s.zOrigin+"px",s.zOrigin=0,s.renderTransform()),s.uncache=1)}},j0=function(t,e){var i={target:t,props:[],revert:AC,save:IC};return t._gsap||Re.core.getCache(t),e&&e.split(",").forEach(function(s){return i.save(s)}),i},J0,td=function(t,e){var i=Ur.createElementNS?Ur.createElementNS((e||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),t):Ur.createElement(t);return i&&i.style?i:Ur.createElement(t)},Di=function r(t,e,i){var s=getComputedStyle(t);return s[e]||s.getPropertyValue(e.replace(Qu,"-$1").toLowerCase())||s.getPropertyValue(e)||!i&&r(t,_n(e)||e,1)||""},$0="O,Moz,ms,Ms,Webkit".split(","),_n=function(t,e,i){var s=e||ws,n=s.style,o=5;if(t in n&&!i)return t;for(t=t.charAt(0).toUpperCase()+t.substr(1);o--&&!($0[o]+t in n););return o<0?null:(o===3?"ms":o>=0?$0[o]:"")+t},ed=function(){mC()&&window.document&&(Z0=window,Ur=Z0.document,yn=Ur.documentElement,ws=td("div")||{style:{}},td("div"),Ht=_n(Ht),Pe=Ht+"Origin",ws.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",J0=!!_n("perspective"),$u=Re.core.reverting,Ju=1)},id=function r(t){var e=td("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(yn.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)),yn.removeChild(e),this.style.cssText=n,o},Q0=function(t,e){for(var i=e.length;i--;)if(t.hasAttribute(e[i]))return t.getAttribute(e[i])},q0=function(t){var e;try{e=t.getBBox()}catch{e=id.call(t,!0)}return e&&(e.width||e.height)||t.getBBox===id||(e=id.call(t,!0)),e&&!e.width&&!e.x&&!e.y?{x:+Q0(t,["x","cx","x1"])||0,y:+Q0(t,["y","cy","y1"])||0,width:0,height:0}:e},ty=function(t){return!!(t.getCTM&&(!t.parentNode||t.ownerSVGElement)&&q0(t))},Ss=function(t,e){if(e){var i=t.style,s;e in hr&&e!==Pe&&(e=Ht),i.removeProperty?(s=e.substr(0,2),(s==="ms"||e.substr(0,6)==="webkit")&&(e="-"+e),i.removeProperty(s==="--"?e:e.replace(Qu,"-$1").toLowerCase())):i.removeAttribute(e)}},Xr=function(t,e,i,s,n,o){var a=new Me(t._pt,e,i,0,1,o?Y0:K0);return t._pt=a,a.b=s,a.e=n,t._props.push(i),a},ey={deg:1,rad:1,turn:1},MC={grid:1,flex:1},Wr=function r(t,e,i,s){var n=parseFloat(i)||0,o=(i+"").trim().substr((n+"").length)||"px",a=ws.style,h=gC.test(e),l=t.tagName.toLowerCase()==="svg",c=(l?"client":"offset")+(h?"Width":"Height"),u=100,d=s==="px",f=s==="%",p,m,g,y;if(s===o||!n||ey[s]||ey[o])return n;if(o!=="px"&&!d&&(n=r(t,e,i,"px")),y=t.getCTM&&ty(t),(f||o==="%")&&(hr[e]||~e.indexOf("adius")))return p=y?t.getBBox()[h?"width":"height"]:t[c],jt(f?n/p*u:n/100*p);if(a[h?"width":"height"]=u+(d?o:s),m=~e.indexOf("adius")||s==="em"&&t.appendChild&&!l?t:t.parentNode,y&&(m=(t.ownerSVGElement||{}).parentNode),(!m||m===Ur||!m.appendChild)&&(m=Ur.body),g=m._gsap,g&&f&&g.width&&h&&g.time===We.time&&!g.uncache)return jt(n/g.width*u);if(f&&(e==="height"||e==="width")){var x=t.style[e];t.style[e]=u+s,p=t[c],x?t.style[e]=x:Ss(t,e)}else(f||o==="%")&&!MC[Di(m,"display")]&&(a.position=Di(t,"position")),m===t&&(a.position="static"),m.appendChild(ws),p=ws[c],m.removeChild(ws),a.position="absolute";return h&&f&&(g=gs(m),g.time=We.time,g.width=m[c]),jt(d?p*n/u:p&&n?u/p*n:0)},lr=function(t,e,i,s){var n;return Ju||ed(),e in ki&&e!=="transform"&&(e=ki[e],~e.indexOf(",")&&(e=e.split(",")[0])),hr[e]&&e!=="transform"?(n=So(t,s),n=e!=="transformOrigin"?n[e]:n.svg?n.origin:Ch(Di(t,Pe))+" "+n.zOrigin+"px"):(n=t.style[e],(!n||n==="auto"||s||~(n+"").indexOf("calc("))&&(n=Eh[e]&&Eh[e](t,e,i)||Di(t,e)||n0(t,e)||(e==="opacity"?1:0))),i&&!~(n+"").trim().indexOf(" ")?Wr(t,e,n,i)+i:n},RC=function(t,e,i,s){if(!i||i==="none"){var n=_n(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 Me(this._pt,t.style,e,0,1,B0),h=0,l=0,c,u,d,f,p,m,g,y,x,b,v,w;if(a.b=i,a.e=s,i+="",s+="",s==="auto"&&(m=t.style[e],t.style[e]=s,s=Di(t,e)||s,m?t.style[e]=m:Ss(t,e)),c=[i,s],M0(c),i=c[0],s=c[1],d=i.match(un)||[],w=s.match(un)||[],w.length){for(;u=un.exec(s);)g=u[0],x=s.substring(h,u.index),p?p=(p+1)%5:(x.substr(-5)==="rgba("||x.substr(-5)==="hsla(")&&(p=1),g!==(m=d[l++]||"")&&(f=parseFloat(m)||0,v=m.substr((f+"").length),g.charAt(1)==="="&&(g=dn(f,g)+v),y=parseFloat(g),b=g.substr((y+"").length),h=un.lastIndex-b.length,b||(b=b||Oe.units[e]||v,h===s.length&&(s+=b,a.e+=b)),v!==b&&(f=Wr(t,e,m,b)||0),a._pt={_next:a._pt,p:x||l===1?x:",",s:f,c:y-f,m:p&&p<4||e==="zIndex"?Math.round:0});a.c=h<s.length?s.substring(h,s.length):""}else a.r=e==="display"&&s==="none"?Y0:K0;return Qg.test(s)&&(a.e=0),this._pt=a,a},iy={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},PC=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]=iy[i]||i,e[1]=iy[s]||s,e.join(" ")},LC=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],hr[a]&&(h=1,a=a==="transformOrigin"?Pe:Ht),Ss(i,a);h&&(Ss(i,Ht),o&&(o.svg&&i.removeAttribute("transform"),So(i,1),o.uncache=1,z0(s)))}},Eh={clearProps:function(t,e,i,s,n){if(n.data!=="isFromStart"){var o=t._pt=new Me(t._pt,e,i,0,0,LC);return o.u=s,o.pr=-10,o.tween=n,t._props.push(i),1}}},To=[1,0,0,1,0,0],ry={},sy=function(t){return t==="matrix(1, 0, 0, 1, 0, 0)"||t==="none"||!t},ny=function(t){var e=Di(t,Ht);return sy(e)?To:e.substr(7).match($g).map(jt)},rd=function(t,e){var i=t._gsap||gs(t),s=t.style,n=ny(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"?To:n):(n===To&&!t.offsetParent&&t!==yn&&!i.svg&&(h=s.display,s.display="block",o=t.parentNode,(!o||!t.offsetParent)&&(l=1,a=t.nextElementSibling,yn.appendChild(t)),n=ny(t),h?s.display=h:Ss(t,"display"),l&&(a?o.insertBefore(t,a):o?o.appendChild(t):yn.removeChild(t))),e&&n.length>6?[n[0],n[1],n[4],n[5],n[12],n[13]]:n)},sd=function(t,e,i,s,n,o){var a=t._gsap,h=n||rd(t,!0),l=a.xOrigin||0,c=a.yOrigin||0,u=a.xOffset||0,d=a.yOffset||0,f=h[0],p=h[1],m=h[2],g=h[3],y=h[4],x=h[5],b=e.split(" "),v=parseFloat(b[0])||0,w=parseFloat(b[1])||0,S,C,I,M;i?h!==To&&(C=f*g-p*m)&&(I=v*(g/C)+w*(-m/C)+(m*x-g*y)/C,M=v*(-p/C)+w*(f/C)-(f*x-p*y)/C,v=I,w=M):(S=q0(t),v=S.x+(~b[0].indexOf("%")?v/100*S.width:v),w=S.y+(~(b[1]||b[0]).indexOf("%")?w/100*S.height:w)),s||s!==!1&&a.smooth?(y=v-l,x=w-c,a.xOffset=u+(y*f+x*m)-y,a.yOffset=d+(y*p+x*g)-x):a.xOffset=a.yOffset=0,a.xOrigin=v,a.yOrigin=w,a.smooth=!!s,a.origin=e,a.originIsAbsolute=!!i,t.style[Pe]="0px 0px",o&&(Xr(o,a,"xOrigin",l,v),Xr(o,a,"yOrigin",c,w),Xr(o,a,"xOffset",u,a.xOffset),Xr(o,a,"yOffset",d,a.yOffset)),t.setAttribute("data-svg-origin",v+" "+w)},So=function(t,e){var i=t._gsap||new G0(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,Pe)||"0",c,u,d,f,p,m,g,y,x,b,v,w,S,C,I,M,L,G,N,A,D,Z,K,H,j,B,k,F,V,et,ft,at;return c=u=d=m=g=y=x=b=v=0,f=p=1,i.svg=!!(t.getCTM&&ty(t)),h.translate&&((h.translate!=="none"||h.scale!=="none"||h.rotate!=="none")&&(s[Ht]=(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[Ht]!=="none"?h[Ht]:"")),s.scale=s.rotate=s.translate="none"),C=rd(t,i.svg),i.svg&&(i.uncache?(j=t.getBBox(),l=i.xOrigin-j.x+"px "+(i.yOrigin-j.y)+"px",H=""):H=!e&&t.getAttribute("data-svg-origin"),sd(t,H||l,!!H||i.originIsAbsolute,i.smooth!==!1,C)),w=i.xOrigin||0,S=i.yOrigin||0,C!==To&&(G=C[0],N=C[1],A=C[2],D=C[3],c=Z=C[4],u=K=C[5],C.length===6?(f=Math.sqrt(G*G+N*N),p=Math.sqrt(D*D+A*A),m=G||N?xn(N,G)*Ts:0,x=A||D?xn(A,D)*Ts+m:0,x&&(p*=Math.abs(Math.cos(x*bn))),i.svg&&(c-=w-(w*G+S*A),u-=S-(w*N+S*D))):(at=C[6],et=C[7],k=C[8],F=C[9],V=C[10],ft=C[11],c=C[12],u=C[13],d=C[14],I=xn(at,V),g=I*Ts,I&&(M=Math.cos(-I),L=Math.sin(-I),H=Z*M+k*L,j=K*M+F*L,B=at*M+V*L,k=Z*-L+k*M,F=K*-L+F*M,V=at*-L+V*M,ft=et*-L+ft*M,Z=H,K=j,at=B),I=xn(-A,V),y=I*Ts,I&&(M=Math.cos(-I),L=Math.sin(-I),H=G*M-k*L,j=N*M-F*L,B=A*M-V*L,ft=D*L+ft*M,G=H,N=j,A=B),I=xn(N,G),m=I*Ts,I&&(M=Math.cos(I),L=Math.sin(I),H=G*M+N*L,j=Z*M+K*L,N=N*M-G*L,K=K*M-Z*L,G=H,Z=j),g&&Math.abs(g)+Math.abs(m)>359.9&&(g=m=0,y=180-y),f=jt(Math.sqrt(G*G+N*N+A*A)),p=jt(Math.sqrt(K*K+at*at)),I=xn(Z,K),x=Math.abs(I)>2e-4?I*Ts:0,v=ft?1/(ft<0?-ft:ft):0),i.svg&&(H=t.getAttribute("transform"),i.forceCSS=t.setAttribute("transform","")||!sy(Di(t,Ht)),H&&t.setAttribute("transform",H))),Math.abs(x)>90&&Math.abs(x)<270&&(n?(f*=-1,x+=m<=0?180:-180,m+=m<=0?180:-180):(p*=-1,x+=x<=0?180:-180)),e=e||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=jt(f),i.scaleY=jt(p),i.rotation=jt(m)+a,i.rotationX=jt(g)+a,i.rotationY=jt(y)+a,i.skewX=x+a,i.skewY=b+a,i.transformPerspective=v+o,(i.zOrigin=parseFloat(l.split(" ")[2])||!e&&i.zOrigin||0)&&(s[Pe]=Ch(l)),i.xOffset=i.yOffset=0,i.force3D=Oe.force3D,i.renderTransform=i.svg?FC:J0?oy:GC,i.uncache=0,i},Ch=function(t){return(t=t.split(" "))[0]+" "+t[1]},nd=function(t,e,i){var s=be(e);return jt(parseFloat(e)+parseFloat(Wr(t,"x",i+"px",s)))+s},GC=function(t,e){e.z="0px",e.rotationY=e.rotationX="0deg",e.force3D=0,oy(t,e)},Es="0deg",Eo="0px",Cs=") ",oy=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,p=i.scaleX,m=i.scaleY,g=i.transformPerspective,y=i.force3D,x=i.target,b=i.zOrigin,v="",w=y==="auto"&&t&&t!==1||y===!0;if(b&&(u!==Es||c!==Es)){var S=parseFloat(c)*bn,C=Math.sin(S),I=Math.cos(S),M;S=parseFloat(u)*bn,M=Math.cos(S),o=nd(x,o,C*M*-b),a=nd(x,a,-Math.sin(S)*-b),h=nd(x,h,I*M*-b+b)}g!==Eo&&(v+="perspective("+g+Cs),(s||n)&&(v+="translate("+s+"%, "+n+"%) "),(w||o!==Eo||a!==Eo||h!==Eo)&&(v+=h!==Eo||w?"translate3d("+o+", "+a+", "+h+") ":"translate("+o+", "+a+Cs),l!==Es&&(v+="rotate("+l+Cs),c!==Es&&(v+="rotateY("+c+Cs),u!==Es&&(v+="rotateX("+u+Cs),(d!==Es||f!==Es)&&(v+="skew("+d+", "+f+Cs),(p!==1||m!==1)&&(v+="scale("+p+", "+m+Cs),x.style[Ht]=v||"translate(0, 0)"},FC=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,p=i.xOrigin,m=i.yOrigin,g=i.xOffset,y=i.yOffset,x=i.forceCSS,b=parseFloat(o),v=parseFloat(a),w,S,C,I,M;h=parseFloat(h),l=parseFloat(l),c=parseFloat(c),c&&(c=parseFloat(c),l+=c,h+=c),h||l?(h*=bn,l*=bn,w=Math.cos(h)*u,S=Math.sin(h)*u,C=Math.sin(h-l)*-d,I=Math.cos(h-l)*d,l&&(c*=bn,M=Math.tan(l-c),M=Math.sqrt(1+M*M),C*=M,I*=M,c&&(M=Math.tan(c),M=Math.sqrt(1+M*M),w*=M,S*=M)),w=jt(w),S=jt(S),C=jt(C),I=jt(I)):(w=u,I=d,S=C=0),(b&&!~(o+"").indexOf("px")||v&&!~(a+"").indexOf("px"))&&(b=Wr(f,"x",o,"px"),v=Wr(f,"y",a,"px")),(p||m||g||y)&&(b=jt(b+p-(p*w+m*C)+g),v=jt(v+m-(p*S+m*I)+y)),(s||n)&&(M=f.getBBox(),b=jt(b+s/100*M.width),v=jt(v+n/100*M.height)),M="matrix("+w+","+S+","+C+","+I+","+b+","+v+")",f.setAttribute("transform",M),x&&(f.style[Ht]=M)},NC=function(t,e,i,s,n){var o=360,a=le(n),h=parseFloat(n)*(a&&~n.indexOf("rad")?Ts: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*H0)%o-~~(l/o)*o:u==="ccw"&&l>0&&(l=(l-o*H0)%o-~~(l/o)*o)),t._pt=d=new Me(t._pt,e,i,s,l,bC),d.e=c,d.u="deg",t._props.push(i),d},ay=function(t,e){for(var i in e)t[i]=e[i];return t},kC=function(t,e,i){var s=ay({},i._gsap),n="perspective,force3D,transformOrigin,svgOrigin",o=i.style,a,h,l,c,u,d,f,p;s.svg?(l=i.getAttribute("transform"),i.setAttribute("transform",""),o[Ht]=e,a=So(i,1),Ss(i,Ht),i.setAttribute("transform",l)):(l=getComputedStyle(i)[Ht],o[Ht]=e,a=So(i,1),o[Ht]=l);for(h in hr)l=s[h],c=a[h],l!==c&&n.indexOf(h)<0&&(f=be(l),p=be(c),u=f!==p?Wr(i,h,l,p):parseFloat(l),d=parseFloat(c),t._pt=new Me(t._pt,a,h,u,d-u,qu),t._pt.u=p||0,t._props.push(h));ay(a,s)};Ae("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});Eh[t>1?"border"+r:r]=function(a,h,l,c,u){var d,f;if(arguments.length<4)return d=o.map(function(p){return lr(a,p,l)}),f=d.join(" "),f.split(d[0]).length===5?d[0]:f;d=(c+"").split(" "),f={},o.forEach(function(p,m){return f[p]=d[m]=d[m]||d[(m-1)/2|0]}),a.init(h,f,u)}});var hy={name:"css",register:ed,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,p,m,g,y,x,b,v,w,S,C,I;Ju||ed(),this.styles=this.styles||j0(t),I=this.styles.props,this.tween=i;for(m in e)if(m!=="autoRound"&&(c=e[m],!(Ue[m]&&F0(m,e,i,s,t,n)))){if(f=typeof c,p=Eh[m],f==="function"&&(c=c.call(i,s,t,n),f=typeof c),f==="string"&&~c.indexOf("random(")&&(c=yo(c)),p)p(this,t,m,c,i)&&(C=1);else if(m.substr(0,2)==="--")l=(getComputedStyle(t).getPropertyValue(m)+"").trim(),c+="",Or.lastIndex=0,Or.test(l)||(g=be(l),y=be(c)),y?g!==y&&(l=Wr(t,m,l,y)+y):g&&(c+=g),this.add(a,"setProperty",l,c,s,n,0,0,m),o.push(m),I.push(m,0,a[m]);else if(f!=="undefined"){if(h&&m in h?(l=typeof h[m]=="function"?h[m].call(i,s,t,n):h[m],le(l)&&~l.indexOf("random(")&&(l=yo(l)),be(l+"")||l==="auto"||(l+=Oe.units[m]||be(lr(t,m))||""),(l+"").charAt(1)==="="&&(l=lr(t,m))):l=lr(t,m),d=parseFloat(l),x=f==="string"&&c.charAt(1)==="="&&c.substr(0,2),x&&(c=c.substr(2)),u=parseFloat(c),m in ki&&(m==="autoAlpha"&&(d===1&&lr(t,"visibility")==="hidden"&&u&&(d=0),I.push("visibility",0,a.visibility),Xr(this,a,"visibility",d?"inherit":"hidden",u?"inherit":"hidden",!u)),m!=="scale"&&m!=="transform"&&(m=ki[m],~m.indexOf(",")&&(m=m.split(",")[0]))),b=m in hr,b){if(this.styles.save(m),v||(w=t._gsap,w.renderTransform&&!e.parseTransform||So(t,e.parseTransform),S=e.smoothOrigin!==!1&&w.smooth,v=this._pt=new Me(this._pt,a,Ht,0,1,w.renderTransform,w,0,-1),v.dep=1),m==="scale")this._pt=new Me(this._pt,w,"scaleY",w.scaleY,(x?dn(w.scaleY,x+u):u)-w.scaleY||0,qu),this._pt.u=0,o.push("scaleY",m),m+="X";else if(m==="transformOrigin"){I.push(Pe,0,a[Pe]),c=PC(c),w.svg?sd(t,c,0,S,0,this):(y=parseFloat(c.split(" ")[2])||0,y!==w.zOrigin&&Xr(this,w,"zOrigin",w.zOrigin,y),Xr(this,a,m,Ch(l),Ch(c)));continue}else if(m==="svgOrigin"){sd(t,c,1,S,0,this);continue}else if(m in ry){NC(this,w,m,d,x?dn(d,x+c):c);continue}else if(m==="smoothOrigin"){Xr(this,w,"smooth",w.smooth,c);continue}else if(m==="force3D"){w[m]=c;continue}else if(m==="transform"){kC(this,c,t);continue}}else m in a||(m=_n(m)||m);if(b||(u||u===0)&&(d||d===0)&&!yC.test(c)&&m in a)g=(l+"").substr((d+"").length),u||(u=0),y=be(c)||(m in Oe.units?Oe.units[m]:g),g!==y&&(d=Wr(t,m,l,y)),this._pt=new Me(this._pt,b?w:a,m,d,(x?dn(d,x+u):u)-d,!b&&(y==="px"||m==="zIndex")&&e.autoRound!==!1?_C:qu),this._pt.u=y||0,g!==y&&y!=="%"&&(this._pt.b=l,this._pt.r=xC);else if(m in a)RC.call(this,t,m,l,x?x+c:c);else if(m in t)this.add(t,m,l||t[m],x?x+c:c,s,n);else if(m!=="parseTransform"){Iu(m,c);continue}b||(m in a?I.push(m,0,a[m]):I.push(m,1,l||t[m])),o.push(m)}}C&&U0(this)},render:function(t,e){if(e.tween._time||!$u())for(var i=e._pt;i;)i.r(t,i.d),i=i._next;else e.styles.revert()},get:lr,aliases:ki,getSetter:function(t,e,i){var s=ki[e];return s&&s.indexOf(",")<0&&(e=s),e in hr&&e!==Pe&&(t._gsap.x||lr(t,"x"))?i&&V0===i?e==="scale"?SC:TC:(V0=i||{})&&(e==="scale"?EC:CC):t.style&&!vu(t.style[e])?vC:~e.indexOf("-")?wC:Hu(t,e)},core:{_removeProperty:Ss,_getMatrix:rd}};Re.utils.checkPrefix=_n,Re.core.getStyleSaver=j0,function(r,t,e,i){var s=Ae(r+","+t+","+e,function(n){hr[n]=1});Ae(t,function(n){Oe.units[n]="deg",ry[n]=1}),ki[s[13]]=r+","+t,Ae(i,function(n){var o=n.split(":");ki[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"),Ae("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(r){Oe.units[r]="px"}),Re.registerPlugin(hy);var ly=Re.registerPlugin(hy)||Re;ly.core.Tween;const Is=new gt;class DC{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,Is),this._recursive?this.cullRecursive(t,i,e):(e&&i._bounds.getRectangle(t),i[this._toggle]=Is.right>t.left&&Is.left<t.right&&Is.bottom>t.top&&Is.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(Is):e.getBounds(!0,Is);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 Ih={exports:{}};Ih.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]",p="[object GeneratorFunction]",m="[object Map]",g="[object Number]",y="[object Null]",x="[object Object]",b="[object Promise]",v="[object Proxy]",w="[object RegExp]",S="[object Set]",C="[object String]",I="[object Symbol]",M="[object Undefined]",L="[object WeakMap]",G="[object ArrayBuffer]",N="[object DataView]",A="[object Float32Array]",D="[object Float64Array]",Z="[object Int8Array]",K="[object Int16Array]",H="[object Int32Array]",j="[object Uint8Array]",B="[object Uint8ClampedArray]",k="[object Uint16Array]",F="[object Uint32Array]",V=/[\\^$.*+?()[\]{}|]/g,et=/^\[object .+?Constructor\]$/,ft=/^(?:0|[1-9]\d*)$/,at={};at[A]=at[D]=at[Z]=at[K]=at[H]=at[j]=at[B]=at[k]=at[F]=!0,at[a]=at[h]=at[G]=at[c]=at[N]=at[u]=at[d]=at[f]=at[m]=at[g]=at[x]=at[w]=at[S]=at[C]=at[L]=!1;var Tt=typeof ve=="object"&&ve&&ve.Object===Object&&ve,It=typeof self=="object"&&self&&self.Object===Object&&self,Q=Tt||It||Function("return this")(),W=t&&!t.nodeType&&t,J=W&&!0&&r&&!r.nodeType&&r,$=J&&J.exports===W,O=$&&Tt.process,pt=function(){try{return O&&O.binding&&O.binding("util")}catch{}}(),yt=pt&&pt.isTypedArray;function Rt(T,R){for(var _=-1,E=T==null?0:T.length,P=0,X=[];++_<E;){var ut=T[_];R(ut,_,T)&&(X[P++]=ut)}return X}function Ot(T,R){for(var _=-1,E=R.length,P=T.length;++_<E;)T[P+_]=R[_];return T}function Fe(T,R){for(var _=-1,E=T==null?0:T.length;++_<E;)if(R(T[_],_,T))return!0;return!1}function Ze(T,R){for(var _=-1,E=Array(T);++_<T;)E[_]=R(_);return E}function Wo(T){return function(R){return T(R)}}function Kr(T,R){return T.has(R)}function Pn(T,R){return T==null?void 0:T[R]}function Ln(T){var R=-1,_=Array(T.size);return T.forEach(function(E,P){_[++R]=[P,E]}),_}function gi(T,R){return function(_){return T(R(_))}}function tl(T){var R=-1,_=Array(T.size);return T.forEach(function(E){_[++R]=E}),_}var el=Array.prototype,Xd=Function.prototype,Gn=Object.prototype,Yr=Q["__core-js_shared__"],Zo=Xd.toString,Ve=Gn.hasOwnProperty,Vo=function(){var T=/[^.]+$/.exec(Yr&&Yr.keys&&Yr.keys.IE_PROTO||"");return T?"Symbol(src)_1."+T:""}(),Ho=Gn.toString,il=RegExp("^"+Zo.call(Ve).replace(V,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),rl=$?Q.Buffer:void 0,Fn=Q.Symbol,Zi=Q.Uint8Array,Fs=Gn.propertyIsEnumerable,Wd=el.splice,Vi=Fn?Fn.toStringTag:void 0,sl=Object.getOwnPropertySymbols,nl=rl?rl.isBuffer:void 0,Ns=gi(Object.keys,Object),Ko=xr(Q,"DataView"),He=xr(Q,"Map"),Yo=xr(Q,"Promise"),zo=xr(Q,"Set"),jo=xr(Q,"WeakMap"),ks=xr(Object,"create"),Zd=bi(Ko),yi=bi(He),Vd=bi(Yo),Hd=bi(zo),Kd=bi(jo),ol=Fn?Fn.prototype:void 0,Jo=ol?ol.valueOf:void 0;function Ne(T){var R=-1,_=T==null?0:T.length;for(this.clear();++R<_;){var E=T[R];this.set(E[0],E[1])}}function Yd(){this.__data__=ks?ks(null):{},this.size=0}function zd(T){var R=this.has(T)&&delete this.__data__[T];return this.size-=R?1:0,R}function jd(T){var R=this.__data__;if(ks){var _=R[T];return _===i?void 0:_}return Ve.call(R,T)?R[T]:void 0}function Jd(T){var R=this.__data__;return ks?R[T]!==void 0:Ve.call(R,T)}function $d(T,R){var _=this.__data__;return this.size+=this.has(T)?0:1,_[T]=ks&&R===void 0?i:R,this}Ne.prototype.clear=Yd,Ne.prototype.delete=zd,Ne.prototype.get=jd,Ne.prototype.has=Jd,Ne.prototype.set=$d;function xe(T){var R=-1,_=T==null?0:T.length;for(this.clear();++R<_;){var E=T[R];this.set(E[0],E[1])}}function Qd(){this.__data__=[],this.size=0}function qd(T){var R=this.__data__,_=kn(R,T);if(_<0)return!1;var E=R.length-1;return _==E?R.pop():Wd.call(R,_,1),--this.size,!0}function tf(T){var R=this.__data__,_=kn(R,T);return _<0?void 0:R[_][1]}function ef(T){return kn(this.__data__,T)>-1}function rf(T,R){var _=this.__data__,E=kn(_,T);return E<0?(++this.size,_.push([T,R])):_[E][1]=R,this}xe.prototype.clear=Qd,xe.prototype.delete=qd,xe.prototype.get=tf,xe.prototype.has=ef,xe.prototype.set=rf;function yr(T){var R=-1,_=T==null?0:T.length;for(this.clear();++R<_;){var E=T[R];this.set(E[0],E[1])}}function $o(){this.size=0,this.__data__={hash:new Ne,map:new(He||xe),string:new Ne}}function sf(T){var R=On(this,T).delete(T);return this.size-=R?1:0,R}function Nn(T){return On(this,T).get(T)}function Qo(T){return On(this,T).has(T)}function nf(T,R){var _=On(this,T),E=_.size;return _.set(T,R),this.size+=_.size==E?0:1,this}yr.prototype.clear=$o,yr.prototype.delete=sf,yr.prototype.get=Nn,yr.prototype.has=Qo,yr.prototype.set=nf;function br(T){var R=-1,_=T==null?0:T.length;for(this.__data__=new yr;++R<_;)this.add(T[R])}function al(T){return this.__data__.set(T,i),this}function of(T){return this.__data__.has(T)}br.prototype.add=br.prototype.push=al,br.prototype.has=of;function Hi(T){var R=this.__data__=new xe(T);this.size=R.size}function af(){this.__data__=new xe,this.size=0}function hl(T){var R=this.__data__,_=R.delete(T);return this.size=R.size,_}function hf(T){return this.__data__.get(T)}function lf(T){return this.__data__.has(T)}function cf(T,R){var _=this.__data__;if(_ instanceof xe){var E=_.__data__;if(!He||E.length<e-1)return E.push([T,R]),this.size=++_.size,this;_=this.__data__=new yr(E)}return _.set(T,R),this.size=_.size,this}Hi.prototype.clear=af,Hi.prototype.delete=hl,Hi.prototype.get=hf,Hi.prototype.has=lf,Hi.prototype.set=cf;function uf(T,R){var _=Xn(T),E=!_&&ea(T),P=!_&&!E&&Os(T),X=!_&&!E&&!P&&yl(T),ut=_||E||P||X,bt=ut?Ze(T.length,String):[],_t=bt.length;for(var lt in T)(R||Ve.call(T,lt))&&!(ut&&(lt=="length"||P&&(lt=="offset"||lt=="parent")||X&&(lt=="buffer"||lt=="byteLength"||lt=="byteOffset")||ta(lt,_t)))&&bt.push(lt);return bt}function kn(T,R){for(var _=T.length;_--;)if(Un(T[_][0],R))return _;return-1}function df(T,R,_){var E=R(T);return Xn(T)?E:Ot(E,_(T))}function Ds(T){return T==null?T===void 0?M:y:Vi&&Vi in Object(T)?gf(T):Bn(T)}function ll(T){return jr(T)&&Ds(T)==a}function cl(T,R,_,E,P){return T===R?!0:T==null||R==null||!jr(T)&&!jr(R)?T!==T&&R!==R:ff(T,R,_,E,cl,P)}function ff(T,R,_,E,P,X){var ut=Xn(T),bt=Xn(R),_t=ut?h:Ki(T),lt=bt?h:Ki(R);_t=_t==a?x:_t,lt=lt==a?x:lt;var vt=_t==x,Ut=lt==x,Pt=_t==lt;if(Pt&&Os(T)){if(!Os(R))return!1;ut=!0,vt=!1}if(Pt&&!vt)return X||(X=new Hi),ut||yl(T)?ul(T,R,_,E,P,X):dl(T,R,_t,_,E,P,X);if(!(_&s)){var de=vt&&Ve.call(T,"__wrapped__"),_e=Ut&&Ve.call(R,"__wrapped__");if(de||_e){var si=de?T.value():T,ni=_e?R.value():R;return X||(X=new Hi),P(si,ni,_,E,X)}}return Pt?(X||(X=new Hi),mf(T,R,_,E,P,X)):!1}function Dn(T){if(!gl(T)||xf(T))return!1;var R=Yi(T)?il:et;return R.test(bi(T))}function qo(T){return jr(T)&&zr(T.length)&&!!at[Ds(T)]}function pf(T){if(!_f(T))return Ns(T);var R=[];for(var _ in Object(T))Ve.call(T,_)&&_!="constructor"&&R.push(_);return R}function ul(T,R,_,E,P,X){var ut=_&s,bt=T.length,_t=R.length;if(bt!=_t&&!(ut&&_t>bt))return!1;var lt=X.get(T);if(lt&&X.get(R))return lt==R;var vt=-1,Ut=!0,Pt=_&n?new br:void 0;for(X.set(T,R),X.set(R,T);++vt<bt;){var de=T[vt],_e=R[vt];if(E)var si=ut?E(_e,de,vt,R,T,X):E(de,_e,vt,T,R,X);if(si!==void 0){if(si)continue;Ut=!1;break}if(Pt){if(!Fe(R,function(ni,Bs){if(!Kr(Pt,Bs)&&(de===ni||P(de,ni,_,E,X)))return Pt.push(Bs)})){Ut=!1;break}}else if(!(de===_e||P(de,_e,_,E,X))){Ut=!1;break}}return X.delete(T),X.delete(R),Ut}function dl(T,R,_,E,P,X,ut){switch(_){case N:if(T.byteLength!=R.byteLength||T.byteOffset!=R.byteOffset)return!1;T=T.buffer,R=R.buffer;case G:return!(T.byteLength!=R.byteLength||!X(new Zi(T),new Zi(R)));case c:case u:case g:return Un(+T,+R);case d:return T.name==R.name&&T.message==R.message;case w:case C:return T==R+"";case m:var bt=Ln;case S:var _t=E&s;if(bt||(bt=tl),T.size!=R.size&&!_t)return!1;var lt=ut.get(T);if(lt)return lt==R;E|=n,ut.set(T,R);var vt=ul(bt(T),bt(R),E,P,X,ut);return ut.delete(T),vt;case I:if(Jo)return Jo.call(T)==Jo.call(R)}return!1}function mf(T,R,_,E,P,X){var ut=_&s,bt=fl(T),_t=bt.length,lt=fl(R),vt=lt.length;if(_t!=vt&&!ut)return!1;for(var Ut=_t;Ut--;){var Pt=bt[Ut];if(!(ut?Pt in R:Ve.call(R,Pt)))return!1}var de=X.get(T);if(de&&X.get(R))return de==R;var _e=!0;X.set(T,R),X.set(R,T);for(var si=ut;++Ut<_t;){Pt=bt[Ut];var ni=T[Pt],Bs=R[Pt];if(E)var $b=ut?E(Bs,ni,Pt,R,T,X):E(ni,Bs,Pt,T,R,X);if(!($b===void 0?ni===Bs||P(ni,Bs,_,E,X):$b)){_e=!1;break}si||(si=Pt=="constructor")}if(_e&&!si){var xl=T.constructor,_l=R.constructor;xl!=_l&&"constructor"in T&&"constructor"in R&&!(typeof xl=="function"&&xl instanceof xl&&typeof _l=="function"&&_l instanceof _l)&&(_e=!1)}return X.delete(T),X.delete(R),_e}function fl(T){return df(T,bl,yf)}function On(T,R){var _=T.__data__;return bf(R)?_[typeof R=="string"?"string":"hash"]:_.map}function xr(T,R){var _=Pn(T,R);return Dn(_)?_:void 0}function gf(T){var R=Ve.call(T,Vi),_=T[Vi];try{T[Vi]=void 0;var E=!0}catch{}var P=Ho.call(T);return E&&(R?T[Vi]=_:delete T[Vi]),P}var yf=sl?function(T){return T==null?[]:(T=Object(T),Rt(sl(T),function(R){return Fs.call(T,R)}))}:vf,Ki=Ds;(Ko&&Ki(new Ko(new ArrayBuffer(1)))!=N||He&&Ki(new He)!=m||Yo&&Ki(Yo.resolve())!=b||zo&&Ki(new zo)!=S||jo&&Ki(new jo)!=L)&&(Ki=function(T){var R=Ds(T),_=R==x?T.constructor:void 0,E=_?bi(_):"";if(E)switch(E){case Zd:return N;case yi:return m;case Vd:return b;case Hd:return S;case Kd:return L}return R});function ta(T,R){return R=R??o,!!R&&(typeof T=="number"||ft.test(T))&&T>-1&&T%1==0&&T<R}function bf(T){var R=typeof T;return R=="string"||R=="number"||R=="symbol"||R=="boolean"?T!=="__proto__":T===null}function xf(T){return!!Vo&&Vo in T}function _f(T){var R=T&&T.constructor,_=typeof R=="function"&&R.prototype||Gn;return T===_}function Bn(T){return Ho.call(T)}function bi(T){if(T!=null){try{return Zo.call(T)}catch{}try{return T+""}catch{}}return""}function Un(T,R){return T===R||T!==T&&R!==R}var ea=ll(function(){return arguments}())?ll:function(T){return jr(T)&&Ve.call(T,"callee")&&!Fs.call(T,"callee")},Xn=Array.isArray;function pl(T){return T!=null&&zr(T.length)&&!Yi(T)}var Os=nl||wf;function ml(T,R){return cl(T,R)}function Yi(T){if(!gl(T))return!1;var R=Ds(T);return R==f||R==p||R==l||R==v}function zr(T){return typeof T=="number"&&T>-1&&T%1==0&&T<=o}function gl(T){var R=typeof T;return T!=null&&(R=="object"||R=="function")}function jr(T){return T!=null&&typeof T=="object"}var yl=yt?Wo(yt):qo;function bl(T){return pl(T)?uf(T):pf(T)}function vf(){return[]}function wf(){return!1}r.exports=ml}(Ih,Ih.exports);var OC=Ih.exports;const cy=Ws(OC);var BC=Object.defineProperty,UC=(r,t,e)=>t in r?BC(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,U=(r,t,e)=>(UC(r,typeof t!="symbol"?t+"":t,e),e);class ti{constructor(t){U(this,"parent"),U(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 XC=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},uy={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(XC)})(uy);const dy=uy.exports;function Ah(r,t){if(r){if(typeof r=="function")return r;if(typeof r=="string")return dy[r]}else return dy[t]}const WC={removeOnInterrupt:!1,ease:"linear",time:1e3};class ZC extends ti{constructor(t,e={}){super(t),U(this,"options"),U(this,"startX"),U(this,"startY"),U(this,"deltaX"),U(this,"deltaY"),U(this,"keepCenter"),U(this,"startWidth",null),U(this,"startHeight",null),U(this,"deltaWidth",null),U(this,"deltaHeight",null),U(this,"width",null),U(this,"height",null),U(this,"time",0),this.options=Object.assign({},WC,e),this.options.ease=Ah(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 dt(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 dt(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 VC={sides:"all",friction:.5,time:150,ease:"easeInOutSine",underflow:"center",bounceBox:null};class HC extends ti{constructor(t,e={}){super(t),U(this,"options"),U(this,"left"),U(this,"top"),U(this,"right"),U(this,"bottom"),U(this,"underflowX"),U(this,"underflowY"),U(this,"ease"),U(this,"toX"),U(this,"toY"),this.options=Object.assign({},VC,e),this.ease=Ah(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 dt(e*this.parent.scale.x,i*this.parent.scale.y),bottomRight:new dt(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 dt(0,0),bottomRight:new dt(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 KC={left:!1,right:!1,top:!1,bottom:!1,direction:null,underflow:"center"};class YC extends ti{constructor(t,e={}){super(t),U(this,"options"),U(this,"last"),U(this,"noUnderflow"),U(this,"underflowX"),U(this,"underflowY"),this.options=Object.assign({},KC,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 dt(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 zC={minWidth:null,minHeight:null,maxWidth:null,maxHeight:null,minScale:null,maxScale:null};class jC extends ti{constructor(t,e={}){super(t),U(this,"options"),this.options=Object.assign({},zC,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 JC={friction:.98,bounce:.8,minSpeed:.01},Zr=16;class $C extends ti{constructor(t,e={}){super(t),U(this,"options"),U(this,"x"),U(this,"y"),U(this,"percentChangeX"),U(this,"percentChangeY"),U(this,"saved"),U(this,"timeSinceRelease"),this.options=Object.assign({},JC,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*Zr/o*(Math.pow(n,s/Zr)-Math.pow(n,i/Zr)),this.x*=Math.pow(this.percentChangeX,t/Zr)}if(this.y){const n=this.percentChangeY,o=Math.log(n);this.parent.y+=this.y*Zr/o*(Math.pow(n,s/Zr)-Math.pow(n,i/Zr)),this.y*=Math.pow(this.percentChangeY,t/Zr)}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 QC={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 qC extends ti{constructor(t,e={}){super(t),U(this,"options"),U(this,"moved"),U(this,"reverse"),U(this,"xDirection"),U(this,"yDirection"),U(this,"keyIsPressed"),U(this,"mouse"),U(this,"underflowX"),U(this,"underflowY"),U(this,"last"),U(this,"current"),U(this,"windowEventHandlers",[]),this.options=Object.assign({},QC,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 dt(this.last.x,this.last.y),world:this.parent.toWorld(new dt(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 dt(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 tI={speed:0,acceleration:null,radius:null};class eI extends ti{constructor(t,e,i={}){super(t),U(this,"options"),U(this,"target"),U(this,"velocity"),this.target=e,this.options=Object.assign({},tI,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 iI={radius:null,distance:null,top:null,bottom:null,left:null,right:null,speed:8,reverse:!1,noDecelerate:!1,linear:!1,allowButtons:!1};class rI extends ti{constructor(t,e={}){super(t),U(this,"options"),U(this,"reverse"),U(this,"radiusSquared"),U(this,"left"),U(this,"top"),U(this,"right"),U(this,"bottom"),U(this,"horizontal"),U(this,"vertical"),this.options=Object.assign({},iI,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 sI={noDrag:!1,percent:1,center:null,factor:1,axis:"all"};class nI extends ti{constructor(t,e={}){super(t),U(this,"options"),U(this,"active",!1),U(this,"pinching",!1),U(this,"moved",!1),U(this,"lastCenter"),this.options=Object.assign({},sI,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 dt(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 oI={topLeft:!1,friction:.8,time:1e3,ease:"easeInOutSine",interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1};class aI extends ti{constructor(t,e,i,s={}){super(t),U(this,"options"),U(this,"ease"),U(this,"x"),U(this,"y"),U(this,"percent"),U(this,"snapping"),U(this,"deltaX"),U(this,"deltaY"),U(this,"startX"),U(this,"startY"),this.options=Object.assign({},oI,s),this.ease=Ah(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 hI={width:0,height:0,time:1e3,ease:"easeInOutSine",center:null,interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1,noMove:!1};class lI extends ti{constructor(t,e={}){super(t),U(this,"options"),U(this,"ease"),U(this,"xScale"),U(this,"yScale"),U(this,"xIndependent"),U(this,"yIndependent"),U(this,"snapping"),this.options=Object.assign({},hI,e),this.ease=Ah(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 cI={percent:.1,smooth:!1,interrupt:!0,reverse:!1,center:null,lineHeight:20,axis:"all",keyToPress:null,trackpadPinch:!1,wheelZoom:!0};class uI extends ti{constructor(t,e={}){super(t),U(this,"options"),U(this,"smoothing"),U(this,"smoothingCenter"),U(this,"smoothingCount"),U(this,"keyIsPressed"),this.options=Object.assign({},cI,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 dI{constructor(t){U(this,"viewport"),U(this,"clickedAvailable"),U(this,"isMouseDown"),U(this,"last"),U(this,"wheelFunction"),U(this,"touches"),this.viewport=t,this.touches=[],this.addListeners()}addListeners(){this.viewport.interactive=!0,this.viewport.forceHitArea||(this.viewport.hitArea=new gt(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 dt;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 Co=["drag","pinch","wheel","follow","mouse-edges","decelerate","animate","bounce","snap-zoom","clamp-zoom","snap","clamp"];class fI{constructor(t){U(this,"plugins"),U(this,"list"),U(this,"viewport"),this.viewport=t,this.list=[],this.plugins={}}add(t,e,i=Co.length){const s=this.plugins[t];s&&s.destroy(),this.plugins[t]=e;const n=Co.indexOf(t);n!==-1&&Co.splice(n,1),Co.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 Co)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 pI={screenWidth:window.innerWidth,screenHeight:window.innerHeight,worldWidth:null,worldHeight:null,threshold:5,passiveWheel:!0,stopPropagation:!1,forceHitArea:null,noTicker:!1,disableOnContextMenu:!1,ticker:Te.shared,allowPreserveDragOutside:!1};class mI extends Ct{constructor(t){super(),U(this,"moving"),U(this,"screenWidth"),U(this,"screenHeight"),U(this,"threshold"),U(this,"input"),U(this,"plugins"),U(this,"zooming"),U(this,"lastViewport"),U(this,"options"),U(this,"_dirty"),U(this,"_forceHitArea"),U(this,"_hitAreaDefault"),U(this,"_pause"),U(this,"tickerFunction"),U(this,"_worldWidth"),U(this,"_worldHeight"),U(this,"_disableOnContextMenu",e=>e.preventDefault()),this.options={...pI,...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 dI(this),this.plugins=new fI(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 gt(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 gt(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight)}toWorld(t,e){return arguments.length===2?this.toLocal(new dt(t,e)):this.toLocal(t)}toScreen(t,e){return arguments.length===2?this.toGlobal(new dt(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 dt(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 dt(-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 lI(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 dt(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 gt(0,0,this.worldWidth,this.worldHeight))}drag(t){return this.plugins.add("drag",new qC(this,t)),this}clamp(t){return this.plugins.add("clamp",new YC(this,t)),this}decelerate(t){return this.plugins.add("decelerate",new $C(this,t)),this}bounce(t){return this.plugins.add("bounce",new HC(this,t)),this}pinch(t){return this.plugins.add("pinch",new nI(this,t)),this}snap(t,e,i){return this.plugins.add("snap",new aI(this,t,e,i)),this}follow(t,e){return this.plugins.add("follow",new eI(this,t,e)),this}wheel(t){return this.plugins.add("wheel",new uI(this,t)),this}animate(t){return this.plugins.add("animate",new ZC(this,t)),this}clampZoom(t){return this.plugins.add("clamp-zoom",new jC(this,t)),this}mouseEdges(t){return this.plugins.add("mouse-edges",new rI(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 Mh(r,t){return r==null||t==null?NaN:r<t?-1:r>t?1:r>=t?0:NaN}function gI(r,t){return r==null||t==null?NaN:t<r?-1:t>r?1:t>=r?0:NaN}function od(r){let t,e,i;r.length!==2?(t=Mh,e=(a,h)=>Mh(r(a),h),i=(a,h)=>r(a)-h):(t=r===Mh||r===gI?r:yI,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 yI(){return 0}function bI(r){return r===null?NaN:+r}const xI=od(Mh).right;od(bI).center;const _I=Math.sqrt(50),vI=Math.sqrt(10),wI=Math.sqrt(2);function Rh(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>=_I?10:n>=vI?5:n>=wI?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?Rh(r,t,e*2):[a,h,l]}function TI(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?Rh(t,r,e):Rh(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 ad(r,t,e){return t=+t,r=+r,e=+e,Rh(r,t,e)[2]}function hd(r,t,e){t=+t,r=+r,e=+e;const i=t<r,s=i?ad(t,r,e):ad(r,t,e);return(i?-1:1)*(s<0?1/-s:s)}function ld(r,t,e){r.prototype=t.prototype=e,e.constructor=r}function fy(r,t){var e=Object.create(r.prototype);for(var i in t)e[i]=t[i];return e}function Io(){}var Ao=.7,Ph=1/Ao,vn="\\s*([+-]?\\d+)\\s*",Mo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Oi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",SI=/^#([0-9a-f]{3,8})$/,EI=new RegExp(`^rgb\\(${vn},${vn},${vn}\\)$`),CI=new RegExp(`^rgb\\(${Oi},${Oi},${Oi}\\)$`),II=new RegExp(`^rgba\\(${vn},${vn},${vn},${Mo}\\)$`),AI=new RegExp(`^rgba\\(${Oi},${Oi},${Oi},${Mo}\\)$`),MI=new RegExp(`^hsl\\(${Mo},${Oi},${Oi}\\)$`),RI=new RegExp(`^hsla\\(${Mo},${Oi},${Oi},${Mo}\\)$`),py={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};ld(Io,Ro,{copy(r){return Object.assign(new this.constructor,this,r)},displayable(){return this.rgb().displayable()},hex:my,formatHex:my,formatHex8:PI,formatHsl:LI,formatRgb:gy,toString:gy});function my(){return this.rgb().formatHex()}function PI(){return this.rgb().formatHex8()}function LI(){return vy(this).formatHsl()}function gy(){return this.rgb().formatRgb()}function Ro(r){var t,e;return r=(r+"").trim().toLowerCase(),(t=SI.exec(r))?(e=t[1].length,t=parseInt(t[1],16),e===6?yy(t):e===3?new Le(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):e===8?Lh(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):e===4?Lh(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=EI.exec(r))?new Le(t[1],t[2],t[3],1):(t=CI.exec(r))?new Le(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=II.exec(r))?Lh(t[1],t[2],t[3],t[4]):(t=AI.exec(r))?Lh(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=MI.exec(r))?_y(t[1],t[2]/100,t[3]/100,1):(t=RI.exec(r))?_y(t[1],t[2]/100,t[3]/100,t[4]):py.hasOwnProperty(r)?yy(py[r]):r==="transparent"?new Le(NaN,NaN,NaN,0):null}function yy(r){return new Le(r>>16&255,r>>8&255,r&255,1)}function Lh(r,t,e,i){return i<=0&&(r=t=e=NaN),new Le(r,t,e,i)}function GI(r){return r instanceof Io||(r=Ro(r)),r?(r=r.rgb(),new Le(r.r,r.g,r.b,r.opacity)):new Le}function cd(r,t,e,i){return arguments.length===1?GI(r):new Le(r,t,e,i??1)}function Le(r,t,e,i){this.r=+r,this.g=+t,this.b=+e,this.opacity=+i}ld(Le,cd,fy(Io,{brighter(r){return r=r==null?Ph:Math.pow(Ph,r),new Le(this.r*r,this.g*r,this.b*r,this.opacity)},darker(r){return r=r==null?Ao:Math.pow(Ao,r),new Le(this.r*r,this.g*r,this.b*r,this.opacity)},rgb(){return this},clamp(){return new Le(As(this.r),As(this.g),As(this.b),Gh(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:by,formatHex:by,formatHex8:FI,formatRgb:xy,toString:xy}));function by(){return`#${Ms(this.r)}${Ms(this.g)}${Ms(this.b)}`}function FI(){return`#${Ms(this.r)}${Ms(this.g)}${Ms(this.b)}${Ms((isNaN(this.opacity)?1:this.opacity)*255)}`}function xy(){const r=Gh(this.opacity);return`${r===1?"rgb(":"rgba("}${As(this.r)}, ${As(this.g)}, ${As(this.b)}${r===1?")":`, ${r})`}`}function Gh(r){return isNaN(r)?1:Math.max(0,Math.min(1,r))}function As(r){return Math.max(0,Math.min(255,Math.round(r)||0))}function Ms(r){return r=As(r),(r<16?"0":"")+r.toString(16)}function _y(r,t,e,i){return i<=0?r=t=e=NaN:e<=0||e>=1?r=t=NaN:t<=0&&(r=NaN),new pi(r,t,e,i)}function vy(r){if(r instanceof pi)return new pi(r.h,r.s,r.l,r.opacity);if(r instanceof Io||(r=Ro(r)),!r)return new pi;if(r instanceof pi)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 pi(o,a,h,r.opacity)}function NI(r,t,e,i){return arguments.length===1?vy(r):new pi(r,t,e,i??1)}function pi(r,t,e,i){this.h=+r,this.s=+t,this.l=+e,this.opacity=+i}ld(pi,NI,fy(Io,{brighter(r){return r=r==null?Ph:Math.pow(Ph,r),new pi(this.h,this.s,this.l*r,this.opacity)},darker(r){return r=r==null?Ao:Math.pow(Ao,r),new pi(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 Le(ud(r>=240?r-240:r+120,s,i),ud(r,s,i),ud(r<120?r+240:r-120,s,i),this.opacity)},clamp(){return new pi(wy(this.h),Fh(this.s),Fh(this.l),Gh(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=Gh(this.opacity);return`${r===1?"hsl(":"hsla("}${wy(this.h)}, ${Fh(this.s)*100}%, ${Fh(this.l)*100}%${r===1?")":`, ${r})`}`}}));function wy(r){return r=(r||0)%360,r<0?r+360:r}function Fh(r){return Math.max(0,Math.min(1,r||0))}function ud(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 dd=r=>()=>r;function kI(r,t){return function(e){return r+e*t}}function DI(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 OI(r){return(r=+r)==1?Ty:function(t,e){return e-t?DI(t,e,r):dd(isNaN(t)?e:t)}}function Ty(r,t){var e=t-r;return e?kI(r,e):dd(isNaN(r)?t:r)}const Sy=function r(t){var e=OI(t);function i(s,n){var o=e((s=cd(s)).r,(n=cd(n)).r),a=e(s.g,n.g),h=e(s.b,n.b),l=Ty(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 BI(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 UI(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function XI(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]=md(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 WI(r,t){var e=new Date;return r=+r,t=+t,function(i){return e.setTime(r*(1-i)+t*i),e}}function Nh(r,t){return r=+r,t=+t,function(e){return r*(1-e)+t*e}}function ZI(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]=md(r[s],t[s]):i[s]=t[s];return function(n){for(s in e)i[s]=e[s](n);return i}}var fd=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,pd=new RegExp(fd.source,"g");function VI(r){return function(){return r}}function HI(r){return function(t){return r(t)+""}}function KI(r,t){var e=fd.lastIndex=pd.lastIndex=0,i,s,n,o=-1,a=[],h=[];for(r=r+"",t=t+"";(i=fd.exec(r))&&(s=pd.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:Nh(i,s)})),e=pd.lastIndex;return e<t.length&&(n=t.slice(e),a[o]?a[o]+=n:a[++o]=n),a.length<2?h[0]?HI(h[0].x):VI(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 md(r,t){var e=typeof t,i;return t==null||e==="boolean"?dd(t):(e==="number"?Nh:e==="string"?(i=Ro(t))?(t=i,Sy):KI:t instanceof Ro?Sy:t instanceof Date?WI:UI(t)?BI:Array.isArray(t)?XI:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?ZI:Nh)(r,t)}function YI(r,t){return r=+r,t=+t,function(e){return Math.round(r*(1-e)+t*e)}}function zI(r){return Math.abs(r=Math.round(r))>=1e21?r.toLocaleString("en").replace(/,/g,""):r.toString(10)}function kh(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 wn(r){return r=kh(Math.abs(r)),r?r[1]:NaN}function jI(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 JI(r){return function(t){return t.replace(/[0-9]/g,function(e){return r[+e]})}}var $I=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Dh(r){if(!(t=$I.exec(r)))throw new Error("invalid format: "+r);var t;return new gd({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]})}Dh.prototype=gd.prototype;function gd(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+""}gd.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 QI(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 Ey;function qI(r,t){var e=kh(r,t);if(!e)return r+"";var i=e[0],s=e[1],n=s-(Ey=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")+kh(r,Math.max(0,t+n-1))[0]}function Cy(r,t){var e=kh(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 Iy={"%":(r,t)=>(r*100).toFixed(t),b:r=>Math.round(r).toString(2),c:r=>r+"",d:zI,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)=>Cy(r*100,t),r:Cy,s:qI,X:r=>Math.round(r).toString(16).toUpperCase(),x:r=>Math.round(r).toString(16)};function Ay(r){return r}var My=Array.prototype.map,Ry=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function t2(r){var t=r.grouping===void 0||r.thousands===void 0?Ay:jI(My.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?Ay:JI(My.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=Dh(u);var d=u.fill,f=u.align,p=u.sign,m=u.symbol,g=u.zero,y=u.width,x=u.comma,b=u.precision,v=u.trim,w=u.type;w==="n"?(x=!0,w="g"):Iy[w]||(b===void 0&&(b=12),v=!0,w="g"),(g||d==="0"&&f==="=")&&(g=!0,d="0",f="=");var S=m==="$"?e:m==="#"&&/[boxX]/.test(w)?"0"+w.toLowerCase():"",C=m==="$"?i:/[%p]/.test(w)?o:"",I=Iy[w],M=/[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 L(G){var N=S,A=C,D,Z,K;if(w==="c")A=I(G)+A,G="";else{G=+G;var H=G<0||1/G<0;if(G=isNaN(G)?h:I(Math.abs(G),b),v&&(G=QI(G)),H&&+G==0&&p!=="+"&&(H=!1),N=(H?p==="("?p:a:p==="-"||p==="("?"":p)+N,A=(w==="s"?Ry[8+Ey/3]:"")+A+(H&&p==="("?")":""),M){for(D=-1,Z=G.length;++D<Z;)if(K=G.charCodeAt(D),48>K||K>57){A=(K===46?s+G.slice(D+1):G.slice(D))+A,G=G.slice(0,D);break}}}x&&!g&&(G=t(G,1/0));var j=N.length+G.length+A.length,B=j<y?new Array(y-j+1).join(d):"";switch(x&&g&&(G=t(B+G,B.length?y-A.length:1/0),B=""),f){case"<":G=N+G+A+B;break;case"=":G=N+B+G+A;break;case"^":G=B.slice(0,j=B.length>>1)+N+G+A+B.slice(j);break;default:G=B+N+G+A;break}return n(G)}return L.toString=function(){return u+""},L}function c(u,d){var f=l((u=Dh(u),u.type="f",u)),p=Math.max(-8,Math.min(8,Math.floor(wn(d)/3)))*3,m=Math.pow(10,-p),g=Ry[8+p/3];return function(y){return f(m*y)+g}}return{format:l,formatPrefix:c}}var Oh,Py,Ly;e2({thousands:",",grouping:[3],currency:["$",""]});function e2(r){return Oh=t2(r),Py=Oh.format,Ly=Oh.formatPrefix,Oh}function i2(r){return Math.max(0,-wn(Math.abs(r)))}function r2(r,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(wn(t)/3)))*3-wn(Math.abs(r)))}function s2(r,t){return r=Math.abs(r),t=Math.abs(t)-r,Math.max(0,wn(t)-wn(r))+1}function Gy(r,t){switch(arguments.length){case 0:break;case 1:this.range(r);break;default:this.range(t).domain(r);break}return this}function n2(r){return function(){return r}}function o2(r){return+r}var Fy=[0,1];function Tn(r){return r}function yd(r,t){return(t-=r=+r)?function(e){return(e-r)/t}:n2(isNaN(t)?NaN:.5)}function a2(r,t){var e;return r>t&&(e=r,r=t,t=e),function(i){return Math.max(r,Math.min(t,i))}}function h2(r,t,e){var i=r[0],s=r[1],n=t[0],o=t[1];return s<i?(i=yd(s,i),n=e(o,n)):(i=yd(i,s),n=e(n,o)),function(a){return n(i(a))}}function l2(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]=yd(r[o],r[o+1]),n[o]=e(t[o],t[o+1]);return function(a){var h=xI(r,a,1,i)-1;return n[h](s[h](a))}}function Ny(r,t){return t.domain(r.domain()).range(r.range()).interpolate(r.interpolate()).clamp(r.clamp()).unknown(r.unknown())}function c2(){var r=Fy,t=Fy,e=md,i,s,n,o=Tn,a,h,l;function c(){var d=Math.min(r.length,t.length);return o!==Tn&&(o=a2(r[0],r[d-1])),a=d>2?l2:h2,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),Nh)))(d)))},u.domain=function(d){return arguments.length?(r=Array.from(d,o2),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=YI,c()},u.clamp=function(d){return arguments.length?(o=d?!0:Tn,c()):o!==Tn},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 ky(){return c2()(Tn,Tn)}function u2(r,t,e,i){var s=hd(r,t,e),n;switch(i=Dh(i??",f"),i.type){case"s":{var o=Math.max(Math.abs(r),Math.abs(t));return i.precision==null&&!isNaN(n=r2(s,o))&&(i.precision=n),Ly(i,o)}case"":case"e":case"g":case"p":case"r":{i.precision==null&&!isNaN(n=s2(s,Math.max(Math.abs(r),Math.abs(t))))&&(i.precision=n-(i.type==="e"));break}case"f":case"%":{i.precision==null&&!isNaN(n=i2(s))&&(i.precision=n-(i.type==="%")*2);break}}return Py(i)}function d2(r){var t=r.domain;return r.ticks=function(e){var i=t();return TI(i[0],i[i.length-1],e??10)},r.tickFormat=function(e,i){var s=t();return u2(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=ad(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 Dy(){var r=ky();return r.copy=function(){return Ny(r,Dy())},Gy.apply(r,arguments),d2(r)}function f2(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 bd=new Date,xd=new Date;function se(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=>se(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)=>(bd.setTime(+n),xd.setTime(+o),r(bd),r(xd),Math.floor(e(bd,xd))),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 Bh=se(()=>{},(r,t)=>{r.setTime(+r+t)},(r,t)=>t-r);Bh.every=r=>(r=Math.floor(r),!isFinite(r)||!(r>0)?null:r>1?se(t=>{t.setTime(Math.floor(t/r)*r)},(t,e)=>{t.setTime(+t+e*r)},(t,e)=>(e-t)/r):Bh),Bh.range;const cr=1e3,ei=cr*60,ur=ei*60,dr=ur*24,_d=dr*7,Oy=dr*30,vd=dr*365,Sn=se(r=>{r.setTime(r-r.getMilliseconds())},(r,t)=>{r.setTime(+r+t*cr)},(r,t)=>(t-r)/cr,r=>r.getUTCSeconds());Sn.range;const wd=se(r=>{r.setTime(r-r.getMilliseconds()-r.getSeconds()*cr)},(r,t)=>{r.setTime(+r+t*ei)},(r,t)=>(t-r)/ei,r=>r.getMinutes());wd.range,se(r=>{r.setUTCSeconds(0,0)},(r,t)=>{r.setTime(+r+t*ei)},(r,t)=>(t-r)/ei,r=>r.getUTCMinutes()).range;const Td=se(r=>{r.setTime(r-r.getMilliseconds()-r.getSeconds()*cr-r.getMinutes()*ei)},(r,t)=>{r.setTime(+r+t*ur)},(r,t)=>(t-r)/ur,r=>r.getHours());Td.range,se(r=>{r.setUTCMinutes(0,0,0)},(r,t)=>{r.setTime(+r+t*ur)},(r,t)=>(t-r)/ur,r=>r.getUTCHours()).range;const Po=se(r=>r.setHours(0,0,0,0),(r,t)=>r.setDate(r.getDate()+t),(r,t)=>(t-r-(t.getTimezoneOffset()-r.getTimezoneOffset())*ei)/dr,r=>r.getDate()-1);Po.range;const Sd=se(r=>{r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCDate(r.getUTCDate()+t)},(r,t)=>(t-r)/dr,r=>r.getUTCDate()-1);Sd.range,se(r=>{r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCDate(r.getUTCDate()+t)},(r,t)=>(t-r)/dr,r=>Math.floor(r/dr)).range;function Rs(r){return se(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())*ei)/_d)}const Uh=Rs(0),Xh=Rs(1),p2=Rs(2),m2=Rs(3),En=Rs(4),g2=Rs(5),y2=Rs(6);Uh.range,Xh.range,p2.range,m2.range,En.range,g2.range,y2.range;function Ps(r){return se(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)/_d)}const By=Ps(0),Wh=Ps(1),b2=Ps(2),x2=Ps(3),Cn=Ps(4),_2=Ps(5),v2=Ps(6);By.range,Wh.range,b2.range,x2.range,Cn.range,_2.range,v2.range;const Ed=se(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());Ed.range,se(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 fr=se(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());fr.every=r=>!isFinite(r=Math.floor(r))||!(r>0)?null:se(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)}),fr.range;const Ls=se(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());Ls.every=r=>!isFinite(r=Math.floor(r))||!(r>0)?null:se(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)}),Ls.range;function w2(r,t,e,i,s,n){const o=[[Sn,1,cr],[Sn,5,5*cr],[Sn,15,15*cr],[Sn,30,30*cr],[n,1,ei],[n,5,5*ei],[n,15,15*ei],[n,30,30*ei],[s,1,ur],[s,3,3*ur],[s,6,6*ur],[s,12,12*ur],[i,1,dr],[i,2,2*dr],[e,1,_d],[t,1,Oy],[t,3,3*Oy],[r,1,vd]];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),p=f?f.range(l,+c+1):[];return d?p.reverse():p}function h(l,c,u){const d=Math.abs(c-l)/u,f=od(([,,g])=>g).right(o,d);if(f===o.length)return r.every(hd(l/vd,c/vd,u));if(f===0)return Bh.every(Math.max(hd(l,c,u),1));const[p,m]=o[d/o[f-1][2]<o[f][2]/d?f-1:f];return p.every(m)}return[a,h]}const[T2,S2]=w2(fr,Ed,Uh,Po,Td,wd);function Cd(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 Id(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 Lo(r,t,e){return{y:r,m:t,d:e,H:0,M:0,S:0,L:0}}function E2(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=Go(s),c=Fo(s),u=Go(n),d=Fo(n),f=Go(o),p=Fo(o),m=Go(a),g=Fo(a),y=Go(h),x=Fo(h),b={a:H,A:j,b:B,B:k,c:null,d:Hy,e:Hy,f:z2,g:sA,G:oA,H:H2,I:K2,j:Y2,L:Ky,m:j2,M:J2,p:F,q:V,Q:Qy,s:qy,S:$2,u:Q2,U:q2,V:tA,w:eA,W:iA,x:null,X:null,y:rA,Y:nA,Z:aA,"%":$y},v={a:et,A:ft,b:at,B:Tt,c:null,d:zy,e:zy,f:uA,g:vA,G:TA,H:hA,I:lA,j:cA,L:jy,m:dA,M:fA,p:It,q:Q,Q:Qy,s:qy,S:pA,u:mA,U:gA,V:yA,w:bA,W:xA,x:null,X:null,y:_A,Y:wA,Z:SA,"%":$y},w={a:L,A:G,b:N,B:A,c:D,d:Zy,e:Zy,f:X2,g:Wy,G:Xy,H:Vy,I:Vy,j:D2,L:U2,m:k2,M:O2,p:M,q:N2,Q:Z2,s:V2,S:B2,u:R2,U:P2,V:L2,w:M2,W:G2,x:Z,X:K,y:Wy,Y:Xy,Z:F2,"%":W2};b.x=S(e,b),b.X=S(i,b),b.c=S(t,b),v.x=S(e,v),v.X=S(i,v),v.c=S(t,v);function S(W,J){return function($){var O=[],pt=-1,yt=0,Rt=W.length,Ot,Fe,Ze;for($ instanceof Date||($=new Date(+$));++pt<Rt;)W.charCodeAt(pt)===37&&(O.push(W.slice(yt,pt)),(Fe=Uy[Ot=W.charAt(++pt)])!=null?Ot=W.charAt(++pt):Fe=Ot==="e"?" ":"0",(Ze=J[Ot])&&(Ot=Ze($,Fe)),O.push(Ot),yt=pt+1);return O.push(W.slice(yt,pt)),O.join("")}}function C(W,J){return function($){var O=Lo(1900,void 0,1),pt=I(O,W,$+="",0),yt,Rt;if(pt!=$.length)return null;if("Q"in O)return new Date(O.Q);if("s"in O)return new Date(O.s*1e3+("L"in O?O.L:0));if(J&&!("Z"in O)&&(O.Z=0),"p"in O&&(O.H=O.H%12+O.p*12),O.m===void 0&&(O.m="q"in O?O.q:0),"V"in O){if(O.V<1||O.V>53)return null;"w"in O||(O.w=1),"Z"in O?(yt=Id(Lo(O.y,0,1)),Rt=yt.getUTCDay(),yt=Rt>4||Rt===0?Wh.ceil(yt):Wh(yt),yt=Sd.offset(yt,(O.V-1)*7),O.y=yt.getUTCFullYear(),O.m=yt.getUTCMonth(),O.d=yt.getUTCDate()+(O.w+6)%7):(yt=Cd(Lo(O.y,0,1)),Rt=yt.getDay(),yt=Rt>4||Rt===0?Xh.ceil(yt):Xh(yt),yt=Po.offset(yt,(O.V-1)*7),O.y=yt.getFullYear(),O.m=yt.getMonth(),O.d=yt.getDate()+(O.w+6)%7)}else("W"in O||"U"in O)&&("w"in O||(O.w="u"in O?O.u%7:"W"in O?1:0),Rt="Z"in O?Id(Lo(O.y,0,1)).getUTCDay():Cd(Lo(O.y,0,1)).getDay(),O.m=0,O.d="W"in O?(O.w+6)%7+O.W*7-(Rt+5)%7:O.w+O.U*7-(Rt+6)%7);return"Z"in O?(O.H+=O.Z/100|0,O.M+=O.Z%100,Id(O)):Cd(O)}}function I(W,J,$,O){for(var pt=0,yt=J.length,Rt=$.length,Ot,Fe;pt<yt;){if(O>=Rt)return-1;if(Ot=J.charCodeAt(pt++),Ot===37){if(Ot=J.charAt(pt++),Fe=w[Ot in Uy?J.charAt(pt++):Ot],!Fe||(O=Fe(W,$,O))<0)return-1}else if(Ot!=$.charCodeAt(O++))return-1}return O}function M(W,J,$){var O=l.exec(J.slice($));return O?(W.p=c.get(O[0].toLowerCase()),$+O[0].length):-1}function L(W,J,$){var O=f.exec(J.slice($));return O?(W.w=p.get(O[0].toLowerCase()),$+O[0].length):-1}function G(W,J,$){var O=u.exec(J.slice($));return O?(W.w=d.get(O[0].toLowerCase()),$+O[0].length):-1}function N(W,J,$){var O=y.exec(J.slice($));return O?(W.m=x.get(O[0].toLowerCase()),$+O[0].length):-1}function A(W,J,$){var O=m.exec(J.slice($));return O?(W.m=g.get(O[0].toLowerCase()),$+O[0].length):-1}function D(W,J,$){return I(W,t,J,$)}function Z(W,J,$){return I(W,e,J,$)}function K(W,J,$){return I(W,i,J,$)}function H(W){return o[W.getDay()]}function j(W){return n[W.getDay()]}function B(W){return h[W.getMonth()]}function k(W){return a[W.getMonth()]}function F(W){return s[+(W.getHours()>=12)]}function V(W){return 1+~~(W.getMonth()/3)}function et(W){return o[W.getUTCDay()]}function ft(W){return n[W.getUTCDay()]}function at(W){return h[W.getUTCMonth()]}function Tt(W){return a[W.getUTCMonth()]}function It(W){return s[+(W.getUTCHours()>=12)]}function Q(W){return 1+~~(W.getUTCMonth()/3)}return{format:function(W){var J=S(W+="",b);return J.toString=function(){return W},J},parse:function(W){var J=C(W+="",!1);return J.toString=function(){return W},J},utcFormat:function(W){var J=S(W+="",v);return J.toString=function(){return W},J},utcParse:function(W){var J=C(W+="",!0);return J.toString=function(){return W},J}}}var Uy={"-":"",_:" ",0:"0"},ue=/^\s*\d+/,C2=/^%/,I2=/[\\^$*+?|[\]().{}]/g;function Mt(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 A2(r){return r.replace(I2,"\\$&")}function Go(r){return new RegExp("^(?:"+r.map(A2).join("|")+")","i")}function Fo(r){return new Map(r.map((t,e)=>[t.toLowerCase(),e]))}function M2(r,t,e){var i=ue.exec(t.slice(e,e+1));return i?(r.w=+i[0],e+i[0].length):-1}function R2(r,t,e){var i=ue.exec(t.slice(e,e+1));return i?(r.u=+i[0],e+i[0].length):-1}function P2(r,t,e){var i=ue.exec(t.slice(e,e+2));return i?(r.U=+i[0],e+i[0].length):-1}function L2(r,t,e){var i=ue.exec(t.slice(e,e+2));return i?(r.V=+i[0],e+i[0].length):-1}function G2(r,t,e){var i=ue.exec(t.slice(e,e+2));return i?(r.W=+i[0],e+i[0].length):-1}function Xy(r,t,e){var i=ue.exec(t.slice(e,e+4));return i?(r.y=+i[0],e+i[0].length):-1}function Wy(r,t,e){var i=ue.exec(t.slice(e,e+2));return i?(r.y=+i[0]+(+i[0]>68?1900:2e3),e+i[0].length):-1}function F2(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 N2(r,t,e){var i=ue.exec(t.slice(e,e+1));return i?(r.q=i[0]*3-3,e+i[0].length):-1}function k2(r,t,e){var i=ue.exec(t.slice(e,e+2));return i?(r.m=i[0]-1,e+i[0].length):-1}function Zy(r,t,e){var i=ue.exec(t.slice(e,e+2));return i?(r.d=+i[0],e+i[0].length):-1}function D2(r,t,e){var i=ue.exec(t.slice(e,e+3));return i?(r.m=0,r.d=+i[0],e+i[0].length):-1}function Vy(r,t,e){var i=ue.exec(t.slice(e,e+2));return i?(r.H=+i[0],e+i[0].length):-1}function O2(r,t,e){var i=ue.exec(t.slice(e,e+2));return i?(r.M=+i[0],e+i[0].length):-1}function B2(r,t,e){var i=ue.exec(t.slice(e,e+2));return i?(r.S=+i[0],e+i[0].length):-1}function U2(r,t,e){var i=ue.exec(t.slice(e,e+3));return i?(r.L=+i[0],e+i[0].length):-1}function X2(r,t,e){var i=ue.exec(t.slice(e,e+6));return i?(r.L=Math.floor(i[0]/1e3),e+i[0].length):-1}function W2(r,t,e){var i=C2.exec(t.slice(e,e+1));return i?e+i[0].length:-1}function Z2(r,t,e){var i=ue.exec(t.slice(e));return i?(r.Q=+i[0],e+i[0].length):-1}function V2(r,t,e){var i=ue.exec(t.slice(e));return i?(r.s=+i[0],e+i[0].length):-1}function Hy(r,t){return Mt(r.getDate(),t,2)}function H2(r,t){return Mt(r.getHours(),t,2)}function K2(r,t){return Mt(r.getHours()%12||12,t,2)}function Y2(r,t){return Mt(1+Po.count(fr(r),r),t,3)}function Ky(r,t){return Mt(r.getMilliseconds(),t,3)}function z2(r,t){return Ky(r,t)+"000"}function j2(r,t){return Mt(r.getMonth()+1,t,2)}function J2(r,t){return Mt(r.getMinutes(),t,2)}function $2(r,t){return Mt(r.getSeconds(),t,2)}function Q2(r){var t=r.getDay();return t===0?7:t}function q2(r,t){return Mt(Uh.count(fr(r)-1,r),t,2)}function Yy(r){var t=r.getDay();return t>=4||t===0?En(r):En.ceil(r)}function tA(r,t){return r=Yy(r),Mt(En.count(fr(r),r)+(fr(r).getDay()===4),t,2)}function eA(r){return r.getDay()}function iA(r,t){return Mt(Xh.count(fr(r)-1,r),t,2)}function rA(r,t){return Mt(r.getFullYear()%100,t,2)}function sA(r,t){return r=Yy(r),Mt(r.getFullYear()%100,t,2)}function nA(r,t){return Mt(r.getFullYear()%1e4,t,4)}function oA(r,t){var e=r.getDay();return r=e>=4||e===0?En(r):En.ceil(r),Mt(r.getFullYear()%1e4,t,4)}function aA(r){var t=r.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Mt(t/60|0,"0",2)+Mt(t%60,"0",2)}function zy(r,t){return Mt(r.getUTCDate(),t,2)}function hA(r,t){return Mt(r.getUTCHours(),t,2)}function lA(r,t){return Mt(r.getUTCHours()%12||12,t,2)}function cA(r,t){return Mt(1+Sd.count(Ls(r),r),t,3)}function jy(r,t){return Mt(r.getUTCMilliseconds(),t,3)}function uA(r,t){return jy(r,t)+"000"}function dA(r,t){return Mt(r.getUTCMonth()+1,t,2)}function fA(r,t){return Mt(r.getUTCMinutes(),t,2)}function pA(r,t){return Mt(r.getUTCSeconds(),t,2)}function mA(r){var t=r.getUTCDay();return t===0?7:t}function gA(r,t){return Mt(By.count(Ls(r)-1,r),t,2)}function Jy(r){var t=r.getUTCDay();return t>=4||t===0?Cn(r):Cn.ceil(r)}function yA(r,t){return r=Jy(r),Mt(Cn.count(Ls(r),r)+(Ls(r).getUTCDay()===4),t,2)}function bA(r){return r.getUTCDay()}function xA(r,t){return Mt(Wh.count(Ls(r)-1,r),t,2)}function _A(r,t){return Mt(r.getUTCFullYear()%100,t,2)}function vA(r,t){return r=Jy(r),Mt(r.getUTCFullYear()%100,t,2)}function wA(r,t){return Mt(r.getUTCFullYear()%1e4,t,4)}function TA(r,t){var e=r.getUTCDay();return r=e>=4||e===0?Cn(r):Cn.ceil(r),Mt(r.getUTCFullYear()%1e4,t,4)}function SA(){return"+0000"}function $y(){return"%"}function Qy(r){return+r}function qy(r){return Math.floor(+r/1e3)}var In,tb;EA({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 EA(r){return In=E2(r),tb=In.format,In.parse,In.utcFormat,In.utcParse,In}function CA(r){return new Date(r)}function IA(r){return r instanceof Date?+r:+new Date(+r)}function eb(r,t,e,i,s,n,o,a,h,l){var c=ky(),u=c.invert,d=c.domain,f=l(".%L"),p=l(":%S"),m=l("%I:%M"),g=l("%I %p"),y=l("%a %d"),x=l("%b %d"),b=l("%B"),v=l("%Y");function w(S){return(h(S)<S?f:a(S)<S?p:o(S)<S?m:n(S)<S?g:i(S)<S?s(S)<S?y:x:e(S)<S?b:v)(S)}return c.invert=function(S){return new Date(u(S))},c.domain=function(S){return arguments.length?d(Array.from(S,IA)):d().map(CA)},c.ticks=function(S){var C=d();return r(C[0],C[C.length-1],S??10)},c.tickFormat=function(S,C){return C==null?w:l(C)},c.nice=function(S){var C=d();return(!S||typeof S.range!="function")&&(S=t(C[0],C[C.length-1],S??10)),S?d(f2(C,S)):c},c.copy=function(){return Ny(c,eb(r,t,e,i,s,n,o,a,h,l))},c}function AA(){return Gy.apply(eb(T2,S2,fr,Ed,Uh,Po,Td,wd,Sn,tb).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function No(r,t,e){this.k=r,this.x=t,this.y=e}No.prototype={constructor:No,scale:function(r){return r===1?this:new No(this.k*r,this.x,this.y)},translate:function(r,t){return r===0&t===0?this:new No(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+")"}},No.prototype;function ib(r){return r.mode==="temporal"||r.mode==="left-aligned"?MA(r):RA(r)}function MA({domain:r,range:t}){return AA().domain(r).range(t)}function RA({domain:r,range:t}){return Dy().domain(r).range(t)}function Ad(r){return{mode:it.horizontal,range:wR(),domain:TR(r)}}function PA(){return{mode:it.vertical}}let An=null;async function LA(){const r=await Wi();rb(r.start_time),tt.on("layoutSettingsUpdated",()=>rb(r.start_time))}function GA(){An=null}async function ii(){return An||await Ce("scaleCreated")}async function rb(r){await ee();const t=An?"scaleUpdated":"scaleCreated",e=Ad(r);An=ib(e),tt.emit(t,An)}let Ge=null,Md=null;async function FA(){const r=await Qt(),t=await bu();Ge=new mI({screenHeight:t.clientHeight,screenWidth:t.clientWidth,events:r.renderer.events,passiveWheel:!1}),Ge.zIndex=1,Ge.drag().pinch().wheel({trackpadPinch:!0}).decelerate({friction:.9}).clampZoom({minWidth:t.clientWidth/2}),Ge.on("moved",()=>{tt.emit("viewportMoved",null)}).on("moved-end",()=>{tt.emit("viewportMoved",null)}),r.stage.addChild(Ge),tt.emit("viewportCreated",Ge),tt.on("applicationResized",XA),tt.on("scaleUpdated",()=>ko()),BA()}function NA(){Ge=null,Md=null}async function Rd({animate:r}={}){const e=(await te()).getChildByName(Pf);if(!e)throw new Error("Nodes container not found");VA();const{x:i,y:s,width:n,height:o}=e.getLocalBounds();if(!n||!o){DA({animate:r});return}kA({x:i,y:s,width:n,height:o,animate:r})}async function kA({x:r,y:t,width:e,height:i,animate:s}){const n=await Lt(),o=await te(),{guideTextSize:a,guideTextTopPadding:h,columnGap:l,rowGap:c,eventTargetSize:u}=n.styles,d=a+h,f=e+l*2,p=i+c*4+d+u,m=o.findFit(f,p);o.animate({position:{x:r+e/2,y:t+i/2+d},scale:Math.min(m,1),time:s?n.animationDuration:0,ease:"easeInOutQuad",removeOnInterrupt:!0,callbackOnComplete:()=>{Vh(),ko()}})}async function DA({animate:r}){const t=await Wi(),e=await Lt(),i=await te(),s=await ii();let n=s(t.start_time)-e.styles.columnGap,o=s(t.end_time??new Date)+e.styles.columnGap;if(n>o){const c=n;n=o,o=c}const a=o-n,h=n+a/2,l=i.findFit(a,0);i.animate({position:{x:h,y:0},scale:l,time:r?e.animationDuration:0,ease:"easeInOutQuad",removeOnInterrupt:!0,callbackOnComplete:()=>{Vh(),ko()}})}async function te(){return Ge||await Ce("viewportCreated")}function sb(r){cy(Md,r)||(Md=r,tt.emit("viewportDateRangeUpdated",r))}function OA({xOffset:r,yOffset:t}){if(!Ge)return;const{x:e,y:i}=Ge.transform.position;Ge.setTransform(e+r,i+t,Ge.transform.scale.x,Ge.transform.scale.y)}async function BA(){const r=await te();ko(),r.on("moved",()=>ko())}async function ko(){const r=await nb();r&&sb(r)}async function nb(){const r=await te(),t=await ii(),e=t.invert(r.left),i=t.invert(r.right);return e instanceof Date&&i instanceof Date?[e,i]:null}async function UA(r){const t=await nb(),e=await ee();if(r===void 0||e.isDependency()||cy(r,t))return;const i=await te(),s=await ii(),[n,o]=r,a=s(n),h=s(o),l=a+(h-a)/2;sb(r),i.fitWidth(h-a,!0),i.moveCenter(l,i.center.y)}async function XA(){const r=await Qt(),t=await te(),e=await bu(),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),OA({xOffset:a,yOffset:h})}class Zh{constructor(){Tf(this,"status","visible");Tf(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 Bi=null,ri=null,Ui=null,pr=null,mi=null;async function WA(){const r=await te(),t=await Qt();Bi=new DC({toggle:"renderable"}),ri=new Zh,Ui=new Zh,mi=new Zh,pr=new Zh,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;mi==null||mi.toggle(e),ri==null||ri.toggle(i),Ui==null||Ui.toggle(s),pr==null||pr.toggle(n),Bi==null||Bi.cull(t.renderer.screen),r.dirty=!1}}),tt.emit("cullCreated",Bi),tt.emit("labelCullCreated",ri),tt.emit("iconCullCreated",ri),tt.emit("edgeCullCreated",mi),tt.emit("toggleCullCreated",pr)}function ZA(){Bi=null,ri==null||ri.clear(),ri=null,Ui==null||Ui.clear(),Ui=null,mi==null||mi.clear(),mi=null,pr==null||pr.clear(),pr=null}async function Vh(){const r=await te();r.dirty=!0}function VA(){Bi&&Bi.uncull()}async function ob(){return Bi||await Ce("cullCreated")}async function HA(){return mi||await Ce("edgeCullCreated")}async function ab(){return ri||await Ce("labelCullCreated")}async function KA(){return Ui||await Ce("iconCullCreated")}async function hb(){const r=await ee(),t=await Lt();function e(i,s,n){const a=r.disableAnimations||n?0:t.animationDuration/1e3;return ly.to(i,{...s,duration:a,ease:"power1.out",onUpdate:()=>{Vh()}})}return{animate:e}}let Hh=new Map;function YA(){Hh=new Map}async function Do(r,t){const e=`${r.toString()}-${JSON.stringify(t)}`;if(Hh.has(e))return Hh.get(e);const i=await r(...t);return Hh.set(e,i),i}async function zA({size:r,stroke:t=1,radius:e=0}){const i=await Qt(),s=new ln;return s.lineStyle(t,"#fff",1,0),s.drawRoundedRect(0,0,r*2,r*2,e),i.renderer.generateTexture(s,{region:new gt(0,0,r,r),resolution:10})}async function Oo(r){return await Do(zA,[r])}var Kh=(r=>(r[r.Up=0]="Up",r[r.Down=180]="Down",r[r.Left=270]="Left",r[r.Right=90]="Right",r))(Kh||{});function lb(){const r=new $t;async function t(e){const{rotate:i=0}=e,s={size:e.size,radius:e.radius,stroke:e.stroke},n=await Oo(s);return r.texture=n,r.anchor.set(.5,.5),r.angle=45+i,r}return{element:r,render:t}}async function jA(){const r=await Qt(),t=new ln;return t.beginFill("#fff"),t.drawRect(0,0,1,1),t.endFill(),r.renderer.generateTexture(t,{wrapMode:vi.REPEAT})}async function Pd(){return await Do(jA,[])}function Ld(r,t){return Array.from({length:r},(e,i)=>t(i))}const JA=8,$A=2;async function QA(){const r=await Lt(),t=await ob(),e=await HA(),{animate:i}=await hb(),s=new Ct,{element:n,render:o}=await lb(),a=await Pd(),h=Ld(20,()=>new dt),l=new RS(a,h);let c=!1;s.name=rx,s.addChild(n),s.addChild(l),t.addAll([n,l]),e.add(s);async function u(){return await o({size:10,rotate:Kh.Right}),n.tint=r.styles.edgeColor,l.tint=r.styles.edgeColor,s}async function d(p,m){const g=f(m);c||await u();for(const[y,x]of h.entries()){const{x:b,y:v}=g[y];i(x,{x:b,y:v},!c)}i(s,{x:p.x,y:p.y},!c),i(n,{x:m.x-JA,y:m.y},!c),c=!0}function f({x:p,y:m}){const g=[],y={x:0,y:0},x={x:p-$A,y:m},b={x:cb(y.x,{source:y,target:x}),y:y.y},v={x:cb(x.x,{source:y,target:x},!0),y:x.y};for(const[w]of h.entries()){if(w===h.length-1){g[w]=x;continue}const S=qA(w,{source:y,target:x,sourceBezier:b,targetBezier:v});g[w]=S}return g}return{element:s,render:u,setPosition:d}}function cb(r,{source:t,target:e},i){const s=(e.x-t.x)/2;return r+(s>64?s:64)*(i?-1:1)}function qA(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,p=h+(c-h)*e,m=l+(u-l)*e,g=c+(d-c)*e,y=f+(m-f)*e,x=p+(g-p)*e;return{x:y,y:x}}async function tM({height:r,radius:t}){const e=await Qt(),i=new ln;return i.beginFill("#fff"),i.drawRoundedRect(0,0,t*2,r,t),i.endFill(),e.renderer.generateTexture(i,{region:new gt(0,0,t,r),resolution:10})}async function eM(r){return await Do(tM,[r])}function iM(){const r=new $t,t=new $t;async function e(i){const s=await eM(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 mr(){const r=await Pd();return new $t(r)}async function Gd(){const r=new Ct,t=await mr(),{left:e,right:i,render:s}=await iM();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,p=l?h.radius:0;return{width:d,visible:f,x:p}}return{element:r,render:n}}function Fd(){const r=new Ct,t=new $t,e=new $t,i=new $t,s=new $t,n=new $t,o=new $t,a=new $t,h=new $t;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(p){const{radius:m=0,color:g="#fff",stroke:y,width:x,height:b}=p,v=typeof m=="number",w={topLeft:c(v?m:m[0],x,b),topRight:c(v?m:m[1],x,b),bottomLeft:c(v?m:m[2],x,b),bottomRight:c(v?m:m[3],x,b)};return await u({width:x,height:b,stroke:y,cornerSizes:w}),await d({width:x,height:b,stroke:y,cornerSizes:w}),f(g),r}function c(p,m,g){const y=Math.min(m,g);return{size:p*2>y?y/2:p,radius:p}}async function u({width:p,height:m,stroke:g,cornerSizes:y}){const{topLeft:x,topRight:b,bottomLeft:v,bottomRight:w}=y,[S,C,I,M]=await Promise.all([Oo({...x,stroke:g}),Oo({...b,stroke:g}),Oo({...v,stroke:g}),Oo({...w,stroke:g})]);t.texture=S,e.texture=C,i.texture=M,s.texture=I,t.position.set(0,0),e.position.set(p-b.size,0),i.position.set(0,m-v.size),s.position.set(p-w.size,m-w.size)}async function d({width:p,height:m,stroke:g,cornerSizes:y}){const x=await Pd(),{topLeft:b,topRight:v,bottomLeft:w,bottomRight:S}=y;a.texture=x,n.texture=x,o.texture=x,h.texture=x,n.position.set(0,b.size),n.height=Math.max(m-b.size-w.size,0),n.width=g,o.position.set(p-g,v.size),o.height=Math.max(m-v.size-S.size,0),o.width=g,a.position.set(b.size,0),a.width=Math.max(p-b.size-v.size,0),a.height=g,h.position.set(w.size,m-g),h.width=Math.max(p-w.size-S.size,0),h.height=g}function f(p){t.tint=p,e.tint=p,i.tint=p,s.tint=p,a.tint=p,n.tint=p,o.tint=p,h.tint=p}return{element:r,render:l}}async function Yh(){const r=await Lt(),t=new Ct,{element:e,render:i}=await Fd();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 rM(){const r=await Lt(),t=new Ct,{element:e,render:i}=await Gd(),{element:s,render:n}=await Yh();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 sM=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 nM(r){const t={resolution:4};return ot.from(sM[r],t)}async function oM(r){return await Do(nM,[r])}async function aM({cullAtZoomThreshold:r=!0}={}){const t=await KA(),e=new $t;r&&t.add(e);async function i(s){const n=await oM(s);return e.texture=n,e}return{element:e,render:i}}var ub={exports:{}};(function(r){(function(){function t(m,g){document.addEventListener?m.addEventListener("scroll",g,!1):m.attachEvent("scroll",g)}function e(m){document.body?m():document.addEventListener?document.addEventListener("DOMContentLoaded",function g(){document.removeEventListener("DOMContentLoaded",g),m()}):document.attachEvent("onreadystatechange",function g(){(document.readyState=="interactive"||document.readyState=="complete")&&(document.detachEvent("onreadystatechange",g),m())})}function i(m){this.g=document.createElement("div"),this.g.setAttribute("aria-hidden","true"),this.g.appendChild(document.createTextNode(m)),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(m,g){m.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(m){var g=m.g.offsetWidth,y=g+100;return m.j.style.width=y+"px",m.i.scrollLeft=y,m.h.scrollLeft=m.h.scrollWidth+100,m.l!==g?(m.l=g,!0):!1}function o(m,g){function y(){var b=x;n(b)&&b.g.parentNode!==null&&g(b.l)}var x=m;t(m.h,y),t(m.i,y),n(m)}function a(m,g,y){g=g||{},y=y||window,this.family=m,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(m){return l===null&&(f(m)&&/Apple/.test(window.navigator.vendor)?(m=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))(?:\.([0-9]+))/.exec(window.navigator.userAgent),l=!!m&&603>parseInt(m[1],10)):l=!1),l}function f(m){return u===null&&(u=!!m.document.fonts),u}function p(m,g){var y=m.style,x=m.weight;if(c===null){var b=document.createElement("div");try{b.style.font="condensed 100px sans-serif"}catch{}c=b.style.font!==""}return[y,x,c?m.stretch:"","100px",g].join(" ")}a.prototype.load=function(m,g){var y=this,x=m||"BESbswy",b=0,v=g||3e3,w=new Date().getTime();return new Promise(function(S,C){if(f(y.context)&&!d(y.context)){var I=new Promise(function(L,G){function N(){new Date().getTime()-w>=v?G(Error(""+v+"ms timeout exceeded")):y.context.document.fonts.load(p(y,'"'+y.family+'"'),x).then(function(A){1<=A.length?L():setTimeout(N,25)},G)}N()}),M=new Promise(function(L,G){b=setTimeout(function(){G(Error(""+v+"ms timeout exceeded"))},v)});Promise.race([M,I]).then(function(){clearTimeout(b),S(y)},C)}else e(function(){function L(){var V;(V=Z!=-1&&K!=-1||Z!=-1&&H!=-1||K!=-1&&H!=-1)&&((V=Z!=K&&Z!=H&&K!=H)||(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&&(Z==j&&K==j&&H==j||Z==B&&K==B&&H==B||Z==k&&K==k&&H==k)),V=!V),V&&(F.parentNode!==null&&F.parentNode.removeChild(F),clearTimeout(b),S(y))}function G(){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)&&(Z=N.g.offsetWidth,K=A.g.offsetWidth,H=D.g.offsetWidth,L()),b=setTimeout(G,50)}}var N=new i(x),A=new i(x),D=new i(x),Z=-1,K=-1,H=-1,j=-1,B=-1,k=-1,F=document.createElement("div");F.dir="ltr",s(N,p(y,"sans-serif")),s(A,p(y,"serif")),s(D,p(y,"monospace")),F.appendChild(N.g),F.appendChild(A.g),F.appendChild(D.g),y.context.document.body.appendChild(F),j=N.g.offsetWidth,B=A.g.offsetWidth,k=D.g.offsetWidth,G(),o(N,function(V){Z=V,L()}),s(N,p(y,'"'+y.family+'",sans-serif')),o(A,function(V){K=V,L()}),s(A,p(y,'"'+y.family+'",serif')),o(D,function(V){H=V,L()}),s(D,p(y,'"'+y.family+'",monospace'))})})},r.exports=a})()})(ub);var hM=ub.exports;const lM=Ws(hM),db={inter:{fontFamily:"InterVariable",fontSize:16,lineHeight:20,fill:16777215}},fb={resolution:4,chars:fi.ASCII},pb="sans-serif",mb={inter:fM(db.inter)};let Nd=!1;async function cM(){const r=Object.values(db);await Promise.all(r.map(t=>uM(t))),Nd=!0,tt.emit("fontsLoaded",mb)}async function uM(r){const{fontFamily:t,...e}=r,i=new lM(t);try{await i.load()}catch(s){console.error(s),console.warn(`fonts: font ${t} failed to load, falling back to ${pb}`),fi.from(t,{fontFamily:pb,...e},fb);return}fi.from(t,r,fb)}function dM(){Nd=!1}async function gb(){return Nd?mb:await Ce("fontsLoaded")}function fM(r){const{fontFamily:t,...e}=r,i={fontName:t,...e};return s=>new sE(s,i)}async function zh({cullAtZoomThreshold:r=!0}={}){const{inter:t}=await gb(),e=await ab(),i=t("");r&&e.add(i);async function s(n){return i.text=n,await i}return{element:i,render:s}}const pM=["result","markdown","table","unknown"],yb={markdown:"ArtifactMarkdown",table:"ArtifactTable",result:"ArtifactResult",unknown:"Artifact"},kd=["flow-run","task-run"];function mM(r){return kd.includes(r)}function jh(r){return kd.includes(r.kind)}function bb(r){return r.kind==="artifact"}function xb(r){return r.kind==="artifacts"}function _b(r){return r.kind==="state"}function vb(r){return r.kind==="event"}function wb(r){return r.kind==="events"}const gM=["COMPLETED","RUNNING","SCHEDULED","PENDING","FAILED","CANCELLED","CANCELLING","CRASHED","PAUSED"];async function Tb({cullAtZoomThreshold:r}){const t=await Lt(),e=new Ct,i=new Ct,{element:s,render:n}=await aM({cullAtZoomThreshold:r}),{element:o,render:a}=await zh({cullAtZoomThreshold:r}),{element:h,render:l}=await rM();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:x,name:b,type:v}=y;c=x??c,u=b??u,d=v??d}return await Promise.all([p(),m()]),await g(),e}async function p(){if(!d)return s;const y=yb[d],{artifactIconSize:x,artifactIconColor:b,artifactPaddingLeft:v,artifactPaddingY:w}=t.styles,S=await n(y);return S.position={x:v,y:w},S.width=x,S.height=x,S.tint=b,S}async function m(){if(!u)return o.visible=!1,o;await a(u);const{artifactPaddingLeft:y,artifactPaddingY:x,artifactTextColor:b,artifactIconSize:v,artifactContentGap:w}=t.styles,S=y+v+w,C=x;return o.tint=b,o.scale.set(.75),o.position={x:S,y:C},o.visible=!0,o}async function g(){const{artifactPaddingLeft:y,artifactPaddingRight:x,artifactPaddingY:b}=t.styles,v={selected:c,width:i.width+y+x,height:i.height+b*2};return await l(v)}return{element:e,render:f}}let Kt=null,Jh=!1;async function yM(){const r=await te();r.on("click",()=>Xi(null)),r.on("drag-start",()=>{Jh=!0}),r.on("drag-end",()=>{setTimeout(()=>{Jh=!1})})}function bM(){Kt=null,Jh=!1}function Xi(r){if(!Jh&&!(!r&&!Kt||r&&gr(r))){if(Kt=r,r===null){tt.emit("itemSelected",null);return}tt.emit("itemSelected",r)}}function gr(r){if(Kt===null)return!1;const{kind:t}=r;switch(t){case"task-run":return jh(Kt)&&Kt.id===r.id;case"flow-run":return jh(Kt)&&Kt.id===r.id;case"artifact":return bb(Kt)&&Kt.id===r.id;case"artifacts":return xb(Kt)&&Kt.ids.length===r.ids.length&&Kt.ids.every(i=>r.ids.includes(i));case"state":return _b(Kt)&&Kt.id===r.id;case"event":return vb(Kt)&&Kt.id===r.id;case"events":return wb(Kt)&&Kt.ids.length===r.ids.length&&Kt.ids.every(i=>r.ids.includes(i));default:const e=t;throw new Error(`switch does not have case for value: ${e}`)}}function xM(){return Kt&&jh(Kt)?Kt:null}async function Dd(r,{cullAtZoomThreshold:t=!0,enableLocalClickHandling:e=!1}={}){const{element:i,render:s}=await Tb({cullAtZoomThreshold:t});let n=!1;i.eventMode="static",i.cursor="pointer",e&&i.on("click",c=>{c.stopPropagation(),Xi({kind:"artifact",id:r.id})}),tt.on("itemSelected",()=>{const c=gr({kind:"artifact",id:r.id});c!==n&&(n=c,o())});async function o(){await s({selected:n,name:r.key,type:r.type})}function a(){return n}function h(){return r.created}function l(){return r.id}return{element:i,render:o,getSelected:a,getDate:h,getId:l}}async function Sb(r,t){const e=await Wi(),i=await Lt();let s,n=null;async function o(){try{n=await i.fetchEvents(z.toValue(r)),t(n)}catch(h){console.error(h)}e.end_time||(s=setTimeout(()=>o(),i.fetchEventsInterval))}function a(){clearTimeout(s)}return{start:o,stop:a}}async function _M(){const r=await Lt(),t=await ab(),e=new Ct,{element:i,render:s}=await lb(),{element:n,render:o}=await Gd(),{element:a,render:h}=await Fd();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:p}){l=f;const m={size:10,stroke:2,rotate:p?Kh.Up:Kh.Down},g=await s(m),y={width:r.styles.nodeToggleSize,height:r.styles.nodeToggleSize,background:r.styles.nodeToggleBgColor,radius:r.styles.nodeToggleBorderRadius},x=await o(y);x.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:x.height/2,x:x.width/2},w=m.size/4;return g.x=v.x,g.y=p?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 Eb(){const r=await Lt(),t=await ee(),e=new Ct,{element:i,render:s}=await Gd(),{element:n,render:o}=await Yh();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=gr({kind:l.kind,id:l.id}),p=h(l,d),m=l.state_type!=="RUNNING"||t.isDependency();return await Promise.all([s({width:p,height:u,radius:d,background:c,capRight:m}),o({selected:f,width:p,height:u})]),i}function h(l,c){const u=Bd();if(it.isTemporal()||it.isLeftAligned()){const d=l.start_time,f=l.end_time??new Date,m=Lf(f,d)/aa*u;return Math.max(m,c*2)}return u}return{element:e,render:a}}var Cb="Expected a function",Ib=NaN,vM="[object Symbol]",wM=/^\s+|\s+$/g,TM=/^[-+]0x[0-9a-f]+$/i,SM=/^0b[01]+$/i,EM=/^0o[0-7]+$/i,CM=parseInt,IM=typeof ve=="object"&&ve&&ve.Object===Object&&ve,AM=typeof self=="object"&&self&&self.Object===Object&&self,MM=IM||AM||Function("return this")(),RM=Object.prototype,PM=RM.toString,LM=Math.max,GM=Math.min,Od=function(){return MM.Date.now()};function FM(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(Cb);t=Ab(t)||0,$h(e)&&(c=!!e.leading,u="maxWait"in e,n=u?LM(Ab(e.maxWait)||0,t):n,d="trailing"in e?!!e.trailing:d);function f(S){var C=i,I=s;return i=s=void 0,l=S,o=r.apply(I,C),o}function p(S){return l=S,a=setTimeout(y,t),c?f(S):o}function m(S){var C=S-h,I=S-l,M=t-C;return u?GM(M,n-I):M}function g(S){var C=S-h,I=S-l;return h===void 0||C>=t||C<0||u&&I>=n}function y(){var S=Od();if(g(S))return x(S);a=setTimeout(y,m(S))}function x(S){return a=void 0,d&&i?f(S):(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:x(Od())}function w(){var S=Od(),C=g(S);if(i=arguments,s=this,h=S,C){if(a===void 0)return p(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 NM(r,t,e){var i=!0,s=!0;if(typeof r!="function")throw new TypeError(Cb);return $h(e)&&(i="leading"in e?!!e.leading:i,s="trailing"in e?!!e.trailing:s),FM(r,t,{leading:i,maxWait:t,trailing:s})}function $h(r){var t=typeof r;return!!r&&(t=="object"||t=="function")}function kM(r){return!!r&&typeof r=="object"}function DM(r){return typeof r=="symbol"||kM(r)&&PM.call(r)==vM}function Ab(r){if(typeof r=="number")return r;if(DM(r))return Ib;if($h(r)){var t=typeof r.valueOf=="function"?r.valueOf():r;r=$h(t)?t+"":t}if(typeof r!="string")return r===0?r:+r;r=r.replace(wM,"");var e=SM.test(r);return e||EM.test(r)?CM(r.slice(2),e?2:8):TM.test(r)?Ib:+r}var OM=NM;const Mb=Ws(OM);async function Rb(){const{element:r,render:t}=await Tb({cullAtZoomThreshold:!1});let e=null,i=[],s=!1;r.eventMode="static",r.cursor="pointer",tt.on("itemSelected",()=>{const l=gr({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 BM(){const r=await Qt(),t=await Wi(),e=await ee(),{element:i,render:s,update:n}=await Vb({isRoot:!0});i.zIndex=4;function o(a){if(it.isTemporal()&&!e.disableArtifacts){r.stage.addChild(i),s(a==null?void 0:a.artifacts);return}r.stage.removeChild(i)}t.artifacts&&o(t),tt.on("viewportMoved",()=>n()),tt.on("runDataCreated",a=>o(a)),tt.on("runDataUpdated",a=>o(a)),tt.on("configUpdated",()=>o()),tt.on("layoutSettingsUpdated",()=>o())}function _P(){}async function UM({radius:r}){const t=await Qt(),e=new ln;return e.beginFill("#fff"),e.drawCircle(0,0,r),e.endFill(),t.renderer.generateTexture(e,{resolution:10})}async function XM(r){return await Do(UM,[r])}async function Pb(r){const t=await XM(r);return new $t(t)}async function Lb(r){const t=new Ct,e=await Lt(),i=await mr(),s=await Pb({radius:e.styles.eventRadiusDefault}),{element:n,render:o}=await Yh();let a=!1;t.addChild(i),t.addChild(s),t.addChild(n),t.eventMode="static",t.cursor="pointer",t.on("mouseenter",()=>{a||s.scale.set(1.5)}),t.on("mouseleave",()=>{a||s.scale.set(1)}),tt.on("itemSelected",()=>{const u=gr({kind:"event",id:r.id,occurred:r.occurred});u!==a&&(a=u,s.scale.set(u?1.5:1),h())});function h(){const{eventColor:u,eventTargetSize:d,eventSelectedBorderInset:f}=e.styles;i.alpha=0,i.width=d,i.height=d,s.tint=u,s.anchor.set(.5),s.position.set(d/2,d/2),n.position.set(f,f),o({selected:a,width:d-f*2,height:d-f*2})}function l(){return r.id}function c(){return r.occurred}return{element:t,render:h,getId:l,getDate:c}}async function Gb(){const r=new Ct,t=await Lt(),e=await mr(),i=await Pb({radius:t.styles.eventClusterRadiusDefault}),{element:s,render:n}=await Yh(),{element:o,render:a}=await zh({cullAtZoomThreshold:!1});let h=null,l=[],c=!1;r.addChild(e),r.addChild(i),r.addChild(o),r.addChild(s),r.eventMode="static",r.cursor="pointer",r.on("mouseenter",()=>{c||i.scale.set(1.5)}),r.on("mouseleave",()=>{c||i.scale.set(1)}),tt.on("itemSelected",()=>{const x=gr({kind:"events",occurred:h,ids:l});x!==c&&(c=x,i.scale.set(x?1.5:1),h&&u({ids:l,date:h}))});async function u(x){if(!x){h=null,l=[],r.visible=!1;return}const{ids:b,date:v}=x;h=v,l=b,d(),f(),m(),await p(b.length.toString()),r.visible=!0}function d(){const{eventTargetSize:x}=t.styles;e.alpha=0,e.width=x,e.height=x}function f(){const{eventClusterColor:x,eventTargetSize:b}=t.styles;i.tint=x,i.anchor.set(.5),i.position.set(b/2,b/2)}async function p(x){if(l.length<2)return;const{eventTargetSize:b}=t.styles,v=-1;o.scale.set(.6),o.anchor.set(.5),o.position.set(b/2,b/2+v),await a(x)}function m(){const{eventSelectedBorderInset:x,eventTargetSize:b}=t.styles;s.position.set(x,x),n({selected:c,width:b-x*2,height:b-x*2})}function g(){return l}function y(){return h}return{element:r,render:u,getIds:g,getDate:y}}function Vr(r){return"getIds"in r}async function Fb({items:r,createCluster:t}){const e=[...r.values()].sort((o,a)=>o.element.x-a.element.x);async function i(o){let a,h=null,l=null;for(let c=o??0;c<e.length;c++){const u=e[c],d=u.element.x;if(u.element.visible=!0,h!==null&&a&&d<a){l=c;break}h=c,a=d+u.element.width}if(l!==null&&h!==null){const c=e[h],u=e[l];c.element.visible=!1,u.element.visible=!1;const d=await s(c,u);d&&(e.splice(h,1,d),e.splice(l,1)),i(h)}}async function s(o,a){const h=o.getDate(),l=a.getDate(),c=Vr(o)?o.getIds():[o.getId()],u=Vr(a)?a.getIds():[a.getId()];if(!h||!l)return console.error("flowRunArtifacts: visible item is missing date"),null;let d;Vr(o)?d=o:Vr(a)?d=a:d=await t();const f=[...c,...u],p=n(f);return await d.render({ids:f,date:p}),d}function n(o){const a=o.reduce((c,u)=>{const d=r.get(u),f=d==null?void 0:d.getDate();return f&&c.push(f.getTime()),c},[]),h=Math.min(...a),l=Math.max(...a);return new Date((h+l)/2)}await i()}async function Nb(r){const t=await Qt(),e=await te(),i=await Lt(),s=await ee();let n=await ii();const o=await h();o.element.on("click",c=>{c.stopPropagation();const{element:u}=o,d={x:u.position.x,y:u.position.y,width:u.width,height:u.height},f=Vr(o)?{kind:"events",ids:o.getIds(),occurred:o.getDate(),position:d}:{kind:"event",id:o.getId(),occurred:o.getDate(),position:d};Xi(f)}),tt.on("scaleUpdated",c=>{n=c,l()}),tt.on("viewportMoved",()=>l());async function a(c){await o.render(c),l()}async function h(){return r.type==="event"?await Lb(r.event):await Gb()}function l(){const c=o.getDate();if(!c||s.disableEvents||!it.isTemporal())return;const{element:u}=o,f=n(c)*e.scale._x+e.worldTransform.tx-u.width/2,p=t.screen.height-u.height-i.styles.eventBottomMargin;u.position.set(f,p)}return{...o,render:a}}async function kb(r){const t=await te(),e=await ee();let i=await ii();const s=await o();s.element.on("click",h=>{h.stopPropagation();const{element:l}=s,c=l.getGlobalPosition(),u={x:c.x,y:c.y,width:l.width*t.scale.x,height:l.height*t.scale.y},d=Vr(s)?{kind:"events",ids:s.getIds(),occurred:s.getDate(),position:u}:{kind:"event",id:s.getId(),occurred:s.getDate(),position:u};Xi(d)}),tt.on("scaleUpdated",h=>{i=h,a()});async function n(h){await s.render(h),a()}async function o(){return r.type==="event"?await Lb(r.event):await Gb()}function a(){const h=s.getDate(),{parentStartDate:l}=r;if(!h||e.disableEvents||!it.isTemporal()||!l)return;const{element:c}=s,d=i(h)-i(l)-c.width/2,f=-c.height;c.position.set(d,f)}return{...s,render:n}}async function Db({isRoot:r,parentStartDate:t}={}){const e=await ee(),i=new Map,s=new Map,n=[];let o=[];const a=new Ct;let h=null;tt.on("scaleUpdated",()=>u());async function l(p){if(p&&(h=p),!h)return;const m=[];for(const g of h)m.push(c(g));await Promise.all(m),u()}async function c(p){if(i.has(p.id))return i.get(p.id).render();if(s.has(p.id))return await s.get(p.id);const m=(async()=>{const g=r?await Nb({type:"event",event:p}):await kb({type:"event",event:p,parentStartDate:t});i.set(p.id,g),a.addChild(g.element)})();return s.set(p.id,m),await m,s.delete(p.id),i.get(p.id).render()}function u(){e.disableEvents||!it.isTemporal()||d()}const d=Mb(async()=>{o=[...n],await Fb({items:i,createCluster:f});for(const p of o)p.render()},250);async function f(){if(o.length>0)return o.pop();const p=r?await Nb({type:"cluster"}):await kb({type:"cluster",parentStartDate:t});return a.addChild(p.element),n.push(p),p}return{element:a,render:l,update:u}}let Bo=null,Mn=null;async function WM(){const r=await Qt(),t=await Lt(),e=await ee(),i=await Wi(),{element:s,render:n,update:o}=await Db({isRoot:!0});s.zIndex=2;async function a(l){if(!it.isTemporal()||e.disableEvents){r.stage.removeChild(s);return}r.stage.addChild(s),await n(l)}const h=await Sb(()=>({nodeId:t.runId,since:i.start_time,until:i.end_time??new Date}),l=>{const c=Mn?"eventDataUpdated":"eventDataCreated";Mn=l,tt.emit(c,Mn),a(l)});tt.on("configUpdated",()=>a()),tt.on("viewportMoved",()=>o()),tt.on("layoutSettingsUpdated",()=>a()),Bo=h.stop,h.start()}function ZM(){Bo==null||Bo(),Bo=null,Mn=null}async function VM(){return Mn||await Ce("eventDataCreated")}async function HM(r){const t=await Qt(),e=await te(),i=await Lt(),s=await Wi();let n=await ii();const o=new Ct,a=await mr(),h=await mr();let l=null,c=!1,u=!1;t.stage.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 b={x:a.position.x,y:a.position.y,width:a.width,height:a.height};Xi({...r,kind:"state",position:b})}),tt.on("viewportMoved",()=>d()),tt.on("scaleUpdated",b=>{n=b,d()}),tt.on("itemSelected",()=>{const b=gr({kind:"state",...r});b!==u&&(u=b,c=!1,d())}),r.type==="RUNNING"&&!s.end_time&&g();function d(b){const{end:v}=b??{};if(v&&(l=v),s.end_time&&y(),!it.isTemporal()){h.visible=!1,o.visible=!1;return}const w=f();p(w),m(w),h.visible=!0,o.visible=!0}function f(){const{background:b="#fff"}=i.styles.state(r),v=Math.max(n(r.timestamp)*e.scale._x+e.worldTransform.tx,0);let w=0;return r.type==="RUNNING"&&!s.end_time?w=n(new Date)*e.scale._x+e.worldTransform.tx-v:l?w=n(l)*e.scale._x+e.worldTransform.tx-v:w=t.screen.width-v,{x:v,width:Math.max(w,0),background:b}}function p({x:b,width:v,background:w}){const{flowStateBarHeight:S,flowStateSelectedBarHeight:C}=i.styles,I=c||u?C:S;a.x=b,a.y=t.screen.height-I,a.width=v,a.height=I,a.tint=w}function m({x:b,width:v,background:w}){if(r.type==="RUNNING"){h.visible=!1;return}const{flowStateBarHeight:S,flowStateAreaAlpha:C}=i.styles;h.x=b,h.y=0,h.width=v,h.height=t.screen.height-S,h.tint=w,h.alpha=C}function g(){t.ticker.add(x)}function y(){t.ticker.remove(x)}function x(){d()}return{element:o,render:d}}function KM(r){return"isNodesFlowRunStateFactory"in r}async function YM(r){const t=await Qt(),e=await te(),i=await Lt(),s=await Wi();let n=await ii();const o=new Ct,a=await mr(),h=await mr();let l=null,c=null,u=0,d=0,f=!1,p=!1;o.visible=!1,o.addChild(h),o.addChild(a),a.eventMode="static",a.cursor="pointer",a.on("mouseover",()=>{f=!0,m()}),a.on("mouseleave",()=>{f=!1,m()}),a.on("click",S=>{S.stopPropagation();const C=a.getGlobalPosition(),I={x:C.x,y:C.y,width:a.width*e.scale.x,height:a.height*e.scale.y};Xi({...r,kind:"state",position:I})}),h.eventMode="none",h.cursor="default",tt.on("scaleUpdated",S=>{n=S,m()}),tt.on("itemSelected",()=>{const S=gr({kind:"state",...r});S!==p&&(p=S,f=!1,m())}),r.type==="RUNNING"&&!s.end_time&&b();function m(S){const{end:C,parentStartDate:I,width:M,height:L}=S??{};if(C&&(l=C),I&&(c=I),M&&(u=M),L&&(d=L),s.end_time&&v(),!it.isTemporal()){o.visible=!1;return}if(!c||u<=0){o.visible=!1;return}const G=g();if(G.width<=0){o.visible=!1;return}y(G),x(G),o.visible=!0}function g(){const{background:S="#fff"}=i.styles.state(r);if(!c)return{x:0,width:0,background:S};const C=n(c);let I=n(r.timestamp)-C;if(I>=u)return{x:u,width:0,background:S};I<0&&(I=0);let M=n(l??new Date)-C;M>u&&(M=u);const L=Math.max(M-I,0);return{x:I,width:L,background:S}}function y({x:S,width:C,background:I}){const{flowStateBarHeight:M,flowStateSelectedBarHeight:L}=i.styles,G=f||p?L:M;a.x=S,a.y=d-G,a.width=C,a.height=G,a.tint=I}function x({x:S,width:C,background:I}){const{flowStateBarHeight:M,flowStateAreaAlpha:L,nodeHeight:G}=i.styles,N=G/2;h.x=S,h.y=N,h.width=C,h.height=d-M-N,h.tint=I,h.alpha=L}function b(){t.ticker.add(w)}function v(){t.ticker.remove(w)}function w(){m()}return{element:o,render:m,isNodesFlowRunStateFactory:!0}}function Ob({isRoot:r}={}){const t=new Ct,e=new Map,i=new Map;let s=null;async function n(a,h){if(a&&(s=a),!s)return;const l=[];for(let c=0;c<s.length;c++)l.push(o(s[c],c,h));await Promise.all(l)}async function o(a,h,l){const c=s&&s.length>=h+1&&s[h+1],u=c?c.timestamp:void 0;let d;if(i.has(a.id)&&await i.get(a.id),e.has(a.id))d=e.get(a.id);else{const f=(async()=>{const p=r?await HM(a):await YM(a);e.set(a.id,p),t.addChild(p.element)})();i.set(a.id,f),await f,i.delete(a.id),d=e.get(a.id)}KM(d)?await d.render({end:u,...l}):await d.render(u?{end:u}:void 0)}return{element:t,render:n}}async function zM(){const r=await Qt(),t=await Wi(),{element:e,render:i}=await Ob({isRoot:!0});e.zIndex=3,r.stage.addChild(e);function s(n){i(n==null?void 0:n.states)}t.states&&s(t),tt.on("runDataUpdated",n=>s(n)),tt.on("configUpdated",()=>s()),tt.on("layoutSettingsUpdated",()=>s())}function vP(){}async function jM(){const r=await Qt(),t=await te(),e=await ee(),i=await Lt(),{inter:s}=await gb(),n=new Ct,o=await mr();n.addChild(o);const a=s("");n.addChild(a);let h=await ii(),l,c;tt.on("scaleUpdated",m=>{h=m,p()}),tt.on("viewportMoved",()=>{e.disableGuides||(p(),n.height!==r.screen.height&&d())});function u(m,g){l=m,c=g,d(),f(m)}function d(){o.width=i.styles.guideLineWidth,o.height=r.screen.height,o.tint=i.styles.guideLineColor}function f(m){a.text=c(m),a.fontSize=i.styles.guideTextSize,a.tint=i.styles.guideTextColor,a.position.set(i.styles.guideTextLeftPadding,i.styles.guideTextTopPadding)}function p(){l!==void 0&&(n.position.x=h(l)*t.scale._x+t.worldTransform.tx)}return{element:n,render:u}}class Bb extends Error{constructor(){super("Layout is not temporal")}}function JM(r){return r.toLocaleTimeString()}function Ub(r){const t=navigator.language;return new Intl.DateTimeFormat(t,{timeStyle:"short"}).format(r)}function $M(r){const t=navigator.language;return new Intl.DateTimeFormat(t,{dateStyle:"short"}).format(r)}function QM(r){return r.getHours()===0&&r.getMinutes()===0?`${Qh.date(r)}
1176
- ${Ub(r)}`:Ub(r)}const Qh={timeBySeconds:JM,timeByMinutesWithDates:QM,date:$M},ne={seconds:"seconds",minutes:"minutes",date:"date"},Uo={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()}},At={second:1e3,minute:1e3*60,hour:1e3*60*60,day:1e3*60*60*24,week:1e3*60*60*24*7},Xb=[{ceiling:At.second*4,increment:At.second,labelFormat:ne.seconds},{ceiling:At.second*8,increment:At.second*5,labelFormat:ne.seconds},{ceiling:At.second*13,increment:At.second*10,labelFormat:ne.seconds},{ceiling:At.second*20,increment:At.second*15,labelFormat:ne.seconds},{ceiling:At.second*45,increment:At.second*30,labelFormat:ne.seconds},{ceiling:At.minute*4,increment:At.minute,labelFormat:ne.minutes},{ceiling:At.minute*8,increment:At.minute*5,labelFormat:ne.minutes},{ceiling:At.minute*13,increment:At.minute*10,labelFormat:ne.minutes},{ceiling:At.minute*28,increment:At.minute*15,labelFormat:ne.minutes},{ceiling:At.hour*1.24,increment:At.minute*30,labelFormat:ne.minutes},{ceiling:At.hour*3,increment:At.hour,labelFormat:ne.minutes},{ceiling:At.hour*8,increment:At.hour*2,getAnchor:Uo.day,labelFormat:ne.minutes},{ceiling:At.hour*13,increment:At.hour*6,getAnchor:Uo.day,labelFormat:ne.minutes},{ceiling:At.hour*22,increment:At.hour*12,getAnchor:Uo.day,labelFormat:ne.minutes},{ceiling:At.day*4,increment:At.day,getAnchor:Uo.day,labelFormat:ne.date},{ceiling:At.week*2,increment:At.week,getAnchor:Uo.week,labelFormat:ne.date},{ceiling:1/0,increment:At.week*4,labelFormat:ne.date}],qM=300;async function tR(){const r=await te(),t=await ee(),e=new Ct,i=new Map;let s=await ii();tt.on("scaleUpdated",d=>s=d),await o();function n(){if(e.visible=!t.disableGuides,!t.disableGuides)try{const{anchor:d,increment:f,labelFormat:p}=a(),m=u(d,f);c(m,p)}catch(d){if(d instanceof Bb)return;console.error(d)}}async function o(){const d=[];Ld(30,async f=>{const p=jM();d.push(p);const m=await p;e.addChild(m.element),i.set(f,m)}),await Promise.all(d)}function a(){const d=r.left-qM,f=s.invert(d),p=s.invert(d+260/r.scale.x);if(!(f instanceof Date)||!(p instanceof Date))throw new Bb;const m=p.getTime()-f.getTime(),{increment:g,getAnchor:y,labelFormat:x}=h(m);return{anchor:y(f),increment:g,labelFormat:l(x)}}function h(d){const f=Xb.find(p=>p.ceiling>d)??Xb[0];return f.getAnchor||(f.getAnchor=p=>Math.floor(p.getTime()/f.increment)*f.increment),f}function l(d){switch(d){case ne.minutes:return Qh.timeByMinutesWithDates;case ne.date:return Qh.date;default:return Qh.timeBySeconds}}function c(d,f){const p=new Map(i.entries()),m=Array.from(p.keys()).filter(g=>!d.includes(g));i.clear();for(const g of d){if(p.has(g)){const x=p.get(g);i.set(g,x),x.render(new Date(g),f);continue}const y=p.get(m.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 Ld(30,p=>d+f*p)}return{element:e,render:n}}async function eR(){const r=await Qt(),{element:t,render:e}=await tR();r.stage.addChild(t),e(),tt.on("viewportDateRangeUpdated",()=>e()),tt.on("layoutSettingsUpdated",()=>e()),tt.on("configUpdated",()=>e())}function wP(){}const iR=80;async function rR(){const r=await Qt(),t=await te(),e=await ee(),i=await Lt(),s=await mr();let n=await ii();tt.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-iR))return;const c=t.left;t.zoomPercent(-.1,!0),t.left=c}return{element:s,render:o}}async function sR(){const r=await Qt(),t=await Wi(),{element:e,render:i}=await rR();t.end_time||(r.stage.addChild(e),r.ticker.add(i)),tt.on("runDataUpdated",({end_time:s})=>{s&&(r.ticker.remove(i),r.stage.removeChild(e))})}function TP(){}function nR({stage:r,props:t}){cE(),FA(),LA(),eR(),pR(),BM(),WM(),zM(),sR(),gE(),cM(),hE(r),_E(t),WA(),_R(),yM()}function oR(){tt.clear();try{uE(),NA(),GA(),lE(),mR(),ZM(),vE(),yE(),dM(),ZA(),vR(),bM(),YA()}catch(r){console.error(r)}}async function Wb(r){const t=await Qt(),e=await te(),i=await Lt(),s=await ee(),n=await VM();let o=await ii(),a=n&&n.length>0;const h=await c();h.element.on("click",d=>{d.stopPropagation();const{element:f}=h,p=f.getGlobalPosition(),m={x:p.x,y:p.y,width:f.width,height:f.height},g=Vr(h)?{kind:"artifacts",ids:h.getIds(),position:m}:{kind:"artifact",id:h.getId()};Xi(g)}),tt.on("scaleUpdated",d=>{o=d,u()}),tt.on("viewportMoved",()=>u()),tt.on("eventDataCreated",d=>{a=d.length>0,u()}),tt.on("eventDataUpdated",d=>{a=d.length>0,u()});async function l(d){await h.render(d),u()}async function c(){return r.type==="artifact"?await Dd(r.artifact,{cullAtZoomThreshold:!1}):await Rb()}function u(){const d=h.getDate();if(!d||!it.isTemporal()||s.disableArtifacts)return;const f=h.getSelected(),{element:p}=h,{eventTargetSize:m,flowStateSelectedBarHeight:g}=i.styles;let y=0;if(f){const{selectedBorderOffset:S,selectedBorderWidth:C}=i.styles;y=S+C*2}const b=o(d)*e.scale._x+e.worldTransform.tx-(p.width-y)/2,v=a&&!s.disableEvents?m:g,w=t.screen.height-(p.height-y)-v;p.position.set(b,w)}return{...h,render:l}}async function Zb(r){const t=await te(),e=await Lt(),i=await ee();let s=await ii();const n=await a();n.element.on("click",l=>{console.log("artifact click"),l.stopPropagation();const{element:c}=n,u=c.getGlobalPosition(),d={x:u.x,y:u.y,width:c.width*t.scale.x,height:c.height*t.scale.y},f=Vr(n)?{kind:"artifacts",ids:n.getIds(),position:d}:{kind:"artifact",id:n.getId()};Xi(f)}),tt.on("scaleUpdated",l=>{s=l,h()});async function o(l){await n.render(l),h()}async function a(){return r.type==="artifact"?await Dd(r.artifact):await Rb()}function h(){const l=n.getDate(),{parentStartDate:c}=r;if(!l||!it.isTemporal()||i.disableArtifacts||!c)return;const u=n.getSelected(),{element:d}=n;let f=0;if(u){const{selectedBorderOffset:y,selectedBorderWidth:x}=e.styles;f=y+x*2}const m=s(l)-s(c)-(d.width-f)/2,g=-(d.height-f);d.position.set(m,g)}return{...n,render:o}}async function Vb({isRoot:r,parentStartDate:t}={}){const e=await ee(),i=new Map,s=new Map,n=[];let o=[];const a=new Ct;let h=null;async function l(p){if(p&&(h=p),!h)return;const m=[];for(const g of h)m.push(c(g));await Promise.all(m),u()}async function c(p){if(i.has(p.id))return i.get(p.id).render();s.has(p.id)&&await s.get(p.id);const m=(async()=>{const g=r?await Wb({type:"artifact",artifact:p}):await Zb({type:"artifact",artifact:p,parentStartDate:t});i.set(p.id,g),a.addChild(g.element)})();return s.set(p.id,m),await m,s.delete(p.id),i.get(p.id).render()}function u(){if(!(e.disableArtifacts||!it.isTemporal())){if(!it.isTemporal()){a.visible=!1;return}a.visible=!0,a.position.x=0,d()}}const d=Mb(async()=>{o=[...n],await Fb({items:i,createCluster:f});for(const p of o)p.render()},250);async function f(){if(o.length>0)return o.pop();const p=r?await Wb({type:"cluster"}):await Zb({type:"cluster",parentStartDate:t});return a.addChild(p.element),n.push(p),p}return{element:a,render:l,update:u}}class Hb extends Ct{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 aR(r){const t=new Hb,e=await Lt(),i=await ee(),{element:s,render:n}=await Eb(),{element:o,render:a}=await zh(),{element:h,render:l}=await _M(),{element:c,render:u}=await Fd(),{element:d,render:f,getSize:p,stopWorker:m}=await jb(),{element:g,render:y}=await Ob(),{element:x,render:b,update:v}=await Db({parentStartDate:r.start_time}),{element:w,render:S,update:C}=await Vb({parentStartDate:r.start_time});let I=!1,M=!1,L=r,G=!1;t.sortableChildren=!0,c.zIndex=0,s.zIndex=4,o.zIndex=5,h.zIndex=5,d.zIndex=2,x.zIndex=1,g.zIndex=2,w.zIndex=3,c.eventMode="none",c.cursor="default";const{start:N,stop:A}=await Yg(L.id,Q=>{M=!!Q.artifacts&&Q.artifacts.length>0,f(Q),B(Q.states),F(Q.artifacts),j()}),{start:D,stop:Z}=await Sb(()=>({nodeId:L.id,since:L.start_time,until:L.end_time??new Date}),Q=>{I=Q.length>0,k(Q)});t.addChild(s),t.addChild(o),t.addChild(h),h.on("click",Q=>{Q.stopPropagation(),H()}),d.position={x:0,y:e.styles.nodeHeight+e.styles.nodesPadding},d.on("rendered",()=>{Vh(),Tt()});async function K(Q){return L=Q,await n(Q),await ft(),await at(),G&&(await B(),await k(),await F(),await j()),t}async function H(){G?await et():await V()}async function j(){const{background:Q="#fff"}=e.styles.node(L),{width:W,height:J}=p(),{height:$}=It(),{nodeBorderRadius:O}=e.styles,pt=2;c.position={x:-pt,y:-pt};const yt=it.isTemporal()?$+pt*2:J+pt*2;await u({width:W+pt*2,height:yt,stroke:pt,radius:[O,O,0,0],color:Q})}async function B(Q){const{height:W}=It(),{width:J}=s;await y(Q??void 0,{parentStartDate:L.start_time,width:J,height:W})}async function k(Q){if(!G||!it.isTemporal()||i.disableEvents){t.removeChild(x);return}t.addChild(x);const{height:W}=It();if(x.position={x:0,y:W-e.styles.eventBottomMargin},Q){await b(Q);return}await v()}async function F(Q){if(!G||!it.isTemporal()||i.disableArtifacts){t.removeChild(w);return}t.addChild(w);const{eventTargetSize:W,flowStateSelectedBarHeight:J}=e.styles,{height:$}=It(),O=$-(I&&!i.disableEvents?W:J);if(w.position={x:0,y:O},Q){await S(Q);return}await C()}async function V(){G=!0,t.addChild(g),t.addChild(d),t.addChild(c),await Promise.all([N(),D(),K(L)]),Tt()}async function et(){G=!1,t.removeChild(g),t.removeChild(d),t.removeChild(c),t.removeChild(x),t.removeChild(w),m(),await Promise.all([A(),Z(),K(L)]),Tt()}async function ft(){const Q=e.styles.nodeToggleSize,W=e.styles.nodeHeight-Q,J=s.width>Q,$=await l({inside:J,isOpen:G});return $.x=J?W/2:s.width+e.styles.nodePadding,$.y=W/2,$}async function at(){const Q=await a(L.label),W=e.styles.colorMode==="dark"?e.styles.textDefault:e.styles.textInverse,J=e.styles.nodePadding,$=h.x+h.width+J,O=s.width+J,pt=s.width>$+Q.width+J,yt=e.styles.nodeHeight/2-Q.height/2,Rt=pt?$:Math.max(O,$);return Q.position={x:Rt,y:yt},Q.tint=pt?W:e.styles.textDefault,Q}function Tt(){G&&(B(),k(),F(),j());const Q=It();t.emit("resized",Q)}function It(){const Q=p(),{nodeHeight:W,nodesPadding:J,eventTargetSize:$,eventBottomMargin:O,artifactPaddingY:pt,artifactIconSize:yt}=e.styles,Ot=M&&it.isTemporal()&&!i.disableArtifacts?yt+pt*2:0,Ze=I&&it.isTemporal()&&!i.disableEvents?$+O:0,Wo=G?Q.height+Ot+Ze+J*2:0,Kr=G?Q.width:0;return{height:W+Wo,width:Math.max(Kr,t.width)}}return{kind:"flow-run",element:t,bar:s,render:K}}async function hR(){const r=await Lt(),t=new Hb,{element:e,render:i}=await zh(),{element:s,render:n}=await Eb();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}}async function lR(r){const t=await Lt(),e=await Qt(),i=await ob(),s=await ee();let n=null;const o=new Map,{animate:a}=await hb(),{element:h,render:l,bar:c}=await C(r);let u=r,d=null,f=!1,p=!1;i.add(h),h.eventMode="static",h.cursor="pointer",h.name=ix,h.on("click",L=>{L.stopPropagation(),Xi({kind:u.kind,id:u.id})}),u.end_time||v(),tt.on("itemSelected",()=>{const L=gr({kind:u.kind,id:u.id});L!==f&&(f=L,l(u))});async function m(L){u=L;const G=I(L);return G===d||(d=G,await Promise.all([l(L),g(L.artifacts)]),L.end_time&&w()),h}async function g(L){if(!L||(x(),s.disableArtifacts||!it.isTemporal()))return;const G=[];for(const N of L)G.push(y(N));await Promise.all(G),b()}async function y(L){if(o.has(L.id))return o.get(L.id).render();const G=await Dd(L,{enableLocalClickHandling:!0});return o.set(L.id,G),n.addChild(G.element),G.render()}function x(){if(it.isTemporal()&&!s.disableArtifacts){n||(n=new Ct),h.addChild(n);return}n&&h.removeChild(n)}function b(){if(!n)return;const{artifactsGap:L,artifactsNodeOverlap:G}=t.styles;let N=0;for(const A of o.values())A.element.position.x=N,N+=A.element.width+L;n.position.y=-n.height+G,n.width<c.width&&(n.position.x=c.width-n.width)}function v(){e.ticker.add(S)}function w(){e.ticker.remove(S)}function S(){m(u)}async function C(L){const{kind:G}=L;switch(G){case"task-run":return await hR();case"flow-run":return await aR(L);default:const N=G;throw new Error(`switch does not have case for value: ${N}`)}}function I(L){var D;const G=L.end_time??new Date,N=((D=L.artifacts)==null?void 0:D.length)??0;return[L.state_type,G.getTime(),N,it.horizontal,it.horizontalScaleMultiplier,t.styles.colorMode,N>0&&s.disableArtifacts].join("-")}function M({x:L,y:G}){a(h,{x:L,y:G},!p),p=!0}return{element:h,render:m,bar:c,setPosition:M}}function Kb({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[p,m]of e.entries())if(m.has(u)){d=p,f=m.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}}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4pe2NvbnN0e2RhdGE6ZX09bix0PXBvKG4pLHI9YXdhaXQgVG8obix0KSxvPW5ldyBNYXA7bGV0IGk9MCxhPTA7Zm9yKGNvbnN0W3UsbF1vZiBlLm5vZGVzKXtjb25zdCBmPXQuZ2V0KHUpLGc9ci5nZXQodSk7aWYoZj09PXZvaWQgMCl7Y29uc29sZS53YXJuKGBOb2RlSWQgbm90IGZvdW5kIGluIGhvcml6b250YWwgbGF5b3V0OiBTa2lwcGluZyAke2wubGFiZWx9YCk7Y29udGludWV9aWYoZz09PXZvaWQgMCl7Y29uc29sZS53YXJuKGBOb2RlSWQgbm90IGZvdW5kIGluIHZlcnRpY2FsIGxheW91dDogU2tpcHBpbmcgJHtsLmxhYmVsfWApO2NvbnRpbnVlfWk9TWF0aC5tYXgoaSxnKSxhPU1hdGgubWF4KGEsZi5jb2x1bW4pLG8uc2V0KHUsey4uLmYseTpnLHJvdzpnfSl9RG8oe3R5cGU6ImxheW91dCIsbGF5b3V0OnttYXhSb3c6aSxtYXhDb2x1bW46YSxwb3NpdGlvbnM6b319KX19KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1ydW5HcmFwaC53b3JrZXItQzRjMjBKZ3UuanMubWFwCg==",uR=r=>Uint8Array.from(atob(r),t=>t.charCodeAt(0)),zb=typeof window<"u"&&window.Blob&&new Blob([uR(Yb)],{type:"text/javascript;charset=utf-8"});function dR(r){let t;try{if(t=zb&&(window.URL||window.webkitURL).createObjectURL(zb),!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,"+Yb,{name:r==null?void 0:r.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}function fR(r){const t=new dR;return t.onmessage=r,t}async function jb(){const r=new Map,t=new Map,e=new Ct,i=new Ct,s=await Lt();let n=null;const o=Kb({gap:()=>s.styles.rowGap,minimum:()=>s.styles.nodeHeight}),a=Kb({gap:()=>s.styles.columnGap,minimum:()=>Bd()});let h=null,l=null;e.name=Pf,tt.on("layoutUpdated",()=>{o.clear(),a.clear()}),tt.on("layoutSettingsUpdated",()=>{l&&e.parent&&c(l),A()}),tt.on("itemSelected",()=>{A()});async function c(B){u(),l=B,h=null,await Promise.all([f(B),m(B)]),y(B)}function u(){n||(n=fR(G))}function d(){n&&(n.terminate(),n=null)}async function f(B){const k=[];for(const F of B.nodes.values())k.push(p(F));await Promise.all(k)}async function p(B){const{render:k}=await v(B);return await k(B)}async function m(B){if((await ee()).disableEdges){e.removeChild(i);return}e.addChildAt(i,0);const F=[];for(const[V,{children:et}]of B.nodes)for(const{id:ft}of et)F.push(g(V,ft));await Promise.all(F)}async function g(B,k){const F=`${B}_${k}`;if(t.has(F))return;const V=await QA();t.has(F)||(t.set(F,V),i.addChild(V.element))}function y(B){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:B,widths:k,horizontalSettings:Ad(B.start_time),verticalSettings:PA()})}function x(){if(h)for(const[B,k]of t){const[F,V]=B.split("_"),et=h.positions.get(F),ft=h.positions.get(V),at=r.get(F);if(!et||!ft){console.warn(`Could not find edge in layout: Skipping ${B}`);continue}if(!at){console.warn(`Could not find parent node in nodes: Skipping ${F}`);continue}const Tt=at.bar.width,It=S(et),Q={x:It.x+Tt,y:It.y+s.styles.nodeHeight/2},W=S(ft),J={x:W.x-Q.x,y:W.y-Q.y+s.styles.nodeHeight/2};k.setPosition(Q,J)}}function b(){if(h){for(const[B,k]of r){const F=h.positions.get(B);if(!F){console.warn(`Could not find node in layout: Skipping ${B}`);continue}const V=S(F);k.setPosition(V),o.updateNodeAxis({nodeId:B,axis:F.y}),a.updateNodeAxis({nodeId:B,axis:F.column})}x(),e.emit("rendered"),e.emit("resized",L())}}async function v(B){const k=r.get(B.id);if(k)return k;const F=await lR(B);return F.element.on("resized",V=>w(B.id,V)),r.set(B.id,F),e.addChild(F.element),F}function w(B,k){if(!h)return;const F=r.get(B),V=h.positions.get(B);!F||!V||(o.setOffset({nodeId:B,axis:V.y,offset:k.height}),a.setOffset({nodeId:B,axis:V.column,offset:k.width}),b())}function S(B){const k=o.getTotalOffset(B.y);return{x:C(B),y:k}}function C(B){return it.isDependency()?a.getTotalOffset(B.column):B.x}function I(){return h?o.getTotalValue(h.maxRow):0}function M(){if(!h||!l)return 0;if(it.isDependency())return a.getTotalValue(h.maxColumn);const B=Ad(l.start_time),k=ib(B),F=k(l.end_time??new Date),V=k(l.start_time);return F-V}function L(){return{width:M(),height:I()}}function G({data:B}){const{type:k}=B;switch(k){case"layout":N(B);return;default:cR(k)}}function N(B){h=B.layout,b()}async function A(){const B=await ee(),k=xM();if(B.disableEdges||!k||!(l!=null&&l.nodes.has(k.id))){D([]);return}const F=H(k.id);D(F)}function D(B){Z(B),K(B)}function Z(B){for(const[k,{element:F}]of r){if(B.length===0||B.includes(k)){F.alpha=1;continue}F.alpha=s.styles.nodeUnselectedAlpha}}function K(B){for(const[k,{element:F}]of t){const[V,et]=k.split("_");if(B.length===0||B.includes(V)&&B.includes(et)){F.alpha=1;continue}F.alpha=s.styles.nodeUnselectedAlpha}}function H(B){const k=j(B,"parents"),F=j(B,"children");return[B,...k,...F]}function j(B,k){const F=l==null?void 0:l.nodes.get(B);if(!F)return[];const V=[];for(const{id:et}of F[k])V.push(et),V.push(...j(et,k));return V}return{element:e,stopWorker:d,getSize:L,render:c}}let Xo=null,Hr=null,Gs=null;async function pR(){const r=await te(),t=await Lt(),{element:e,render:i}=await jb();r.addChild(e),e.alpha=0;const s=await Yg(t.runId,async n=>{const o=Hr?"runDataUpdated":"runDataCreated";Hr=n,tt.emit(o,Hr),await ee(),i(n)});tt.on("configUpdated",()=>{Hr&&i(Hr)}),Gs=e,Xo=s.stop,Gs.once("rendered",()=>gR()),tt.on("layoutUpdated",()=>yR()),s.start()}function mR(){Xo==null||Xo(),Xo=null,Gs=null,Hr=null}async function Wi(){return Hr||await Ce("runDataCreated")}function gR(){Rd(),Te.shared.addOnce(()=>{Gs&&(Gs.alpha=1)})}async function yR(){if(!Gs)return;const r=await Lt();Gs.once("rendered",()=>{setTimeout(()=>{Rd({animate:!0})},r.animationDuration)})}function bR(r){let t=0;for(const[,{children:e}]of r)t+=e.length;return t}function xR({start_time:r,end_time:t,nodes:e},i,s){const n=Math.max(hx(t??new Date,r),1),o=i.styles.nodeHeight+i.styles.rowGap;return(e.size>0?e.size*o*.5:o*4)*s/(n*20)}async function _R(){const r=await Wi(),t=await Lt(),e=await Qt(),i=e.view.width/e.view.height,s=xR(r,t,i);qh(s,!0),r.nodes.size>t.disableAnimationsThreshold&&(it.disableAnimations=!0),bR(r.nodes)>t.disableEdgesThreshold&&(it.disableEdges=!0)}function vR(){it.horizontal="temporal",it.vertical="nearest-parent",it.horizontalScaleMultiplierDefault=0,it.horizontalScaleMultiplier=0,it.disableAnimations=!1,it.disableGuides=!1,it.disableEdges=!1,it.disableArtifacts=!1,it.disableEvents=!1}const it=z.reactive({horizontal:"temporal",vertical:"nearest-parent",horizontalScaleMultiplierDefault:0,horizontalScaleMultiplier:0,disableAnimations:!1,disableGuides:!1,disableEdges:!1,disableArtifacts:!1,disableEvents:!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 ee(){return Ud()?it:await Ce("layoutSettingsCreated")}function Bd(){return it.isDependency()?200:20*it.horizontalScaleMultiplier}function wR(){return[0,Bd()]}function TR(r){if(it.isDependency())return[0,1];const t=r,e=ox(t,1);return[t,e]}function qh(r,t=!1){if(it.horizontalScaleMultiplier===r)return;const e=Rn();it.horizontalScaleMultiplier=r,t&&(it.horizontalScaleMultiplierDefault=r),e()}function SR(){qh(it.horizontalScaleMultiplierDefault)}function ER(r){if(it.horizontal===r)return;const t=Rn();it.horizontal=r,it.disableGuides=it.isDependency()||it.isLeftAligned(),t()}function CR(r){if(it.vertical===r)return;const t=Rn();it.vertical=r,t()}function IR(r){if(it.disableEdges===r)return;const t=Rn();it.disableEdges=r,t()}function AR(r){if(it.disableArtifacts===r)return;const t=Rn();it.disableArtifacts=r,t()}function MR(r){if(it.disableEvents===r)return;const t=Rn();it.disableEvents=r,t()}function Rn(){const r=Ud()?"layoutSettingsUpdated":"layoutSettingsCreated",{horizontal:t,vertical:e}=it;return()=>{Ud()&&tt.emit(r,it),(t!==it.horizontal||e!==it.vertical)&&tt.emit("layoutUpdated")}}function Ud(){return it.horizontalScaleMultiplier!==0}function Jb(r){if(!(r instanceof HTMLElement))return!1;const t=r.tagName.toLowerCase();return["input","textarea"].includes(t)}const RR={class:"flex items-center gap-2"},PR=z.defineComponent({__name:"RunGraphSettings",setup(r){const t=[ji.positions.topRight,ji.positions.bottomRight,ji.positions.topLeft,ji.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`${it.horizontal}_${it.vertical}`},set(u){const[d,f]=u.split("_");ER(d),CR(f)}}),s=z.computed({get(){return it.disableEdges},set(u){IR(u)}}),n=z.computed({get(){return it.disableArtifacts},set(u){AR(u)}}),o=z.computed({get(){return it.disableEvents},set(u){MR(u)}});function a(){const d=it.horizontalScaleMultiplier*1.25;qh(d)}function h(){const u=Math.abs(-.75),d=it.horizontalScaleMultiplier*u;qh(d)}_r.useKeyDown(["-","="],l);function l(u){if(!(Jb(u.target)||u.metaKey||u.ctrlKey))switch(u.key){case"-":h();break;case"=":a();break}}function c(){SR()}return(u,d)=>{const f=z.resolveComponent("p-radio-group"),p=z.resolveComponent("p-label"),m=z.resolveComponent("p-divider"),g=z.resolveComponent("p-checkbox"),y=z.resolveComponent("p-overflow-menu");return z.openBlock(),z.createBlock(z.unref(ji.PPopOver),{class:"run-graph-settings","auto-close":"",placement:t},{target:z.withCtx(({toggle:x})=>[z.createVNode(z.unref(ji.PButton),{"aria-label":"Run Graph Options",icon:"CogIcon",flat:"",onClick:x},null,8,["onClick"])]),default:z.withCtx(()=>[z.createVNode(y,{class:"run-graph-settings__menu"},{default:z.withCtx(()=>[z.createVNode(p,{label:"Layout"},{default:z.withCtx(()=>[z.createVNode(f,{modelValue:i.value,"onUpdate:modelValue":d[0]||(d[0]=x=>i.value=x),options:e},{label:z.withCtx(({option:x})=>[z.createTextVNode(z.toDisplayString(x.label),1)]),_:1},8,["modelValue"])]),_:1}),z.unref(it).isTemporal()||z.unref(it).isLeftAligned()?(z.openBlock(),z.createElementBlock(z.Fragment,{key:0},[z.createVNode(m),z.createVNode(p,{label:"Scaling"},{default:z.withCtx(()=>[z.createElementVNode("div",RR,[z.createVNode(z.unref(ji.PButton),{title:"Decrease scale (-)",small:"",icon:"MinusIcon",onClick:h}),z.createVNode(z.unref(ji.PButton),{title:"Increase scale (+)",small:"",icon:"PlusIcon",onClick:a}),z.createVNode(z.unref(ji.PButton),{small:"",onClick:c},{default:z.withCtx(()=>[z.createTextVNode(" Reset ")]),_:1})])]),_:1})],64)):z.createCommentVNode("",!0),z.createVNode(m),z.createVNode(g,{modelValue:s.value,"onUpdate:modelValue":d[1]||(d[1]=x=>s.value=x),label:"Hide dependency arrows"},null,8,["modelValue"]),z.createVNode(g,{modelValue:n.value,"onUpdate:modelValue":d[2]||(d[2]=x=>n.value=x),label:"Hide artifacts"},null,8,["modelValue"]),z.createVNode(g,{modelValue:o.value,"onUpdate:modelValue":d[3]||(d[3]=x=>o.value=x),label:"Hide events"},null,8,["modelValue"])]),_:1})]),_:1})}}}),LR={class:"run-graph__actions"},GR=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=>Xi(c)),tt.on("itemSelected",c=>t("update:selected",c)),z.watch(()=>e.viewport,c=>UA(c));const o=z.computed(()=>({root:{"run-graph--fullscreen":n.value}}));tt.on("viewportDateRangeUpdated",c=>t("update:viewport",c));function a(){Rd({animate:!0})}function h(){n.value=!n.value}z.onMounted(()=>{if(!i.value)throw new Error("Stage does not exist");nR({stage:i.value,props:e})}),z.onBeforeUnmount(()=>{oR()}),_r.useKeyDown(["c","f","Escape"],l);function l(c){if(!(Jb(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",LR,[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(PR)])],2)}}});Ft.RunGraph=GR,Ft.artifactTypeIconMap=yb,Ft.artifactTypes=pM,Ft.isArtifactSelection=bb,Ft.isArtifactsSelection=xb,Ft.isEventSelection=vb,Ft.isEventsSelection=wb,Ft.isNodeSelection=jh,Ft.isRunGraphNodeType=mM,Ft.isStateSelection=_b,Ft.runGraphNodeKinds=kd,Ft.stateType=gM,Object.defineProperty(Ft,Symbol.toStringTag,{value:"Module"})});
1175
+ */var ey,Zr,_s,td,In,iy,ed,XE=function(){return typeof window<"u"},hr={},An=180/Math.PI,vs=Math.PI/180,ws=Math.atan2,ry=1e8,id=/([A-Z])/g,WE=/(left|right|width|margin|padding|x)/i,ZE=/[\s,\(]\S/,Ni={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},rd=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},VE=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)},HE=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)},KE=function(t,e){var r=e.s+e.c*t;e.set(e.t,e.p,~~(r+(r<0?-.5:.5))+e.u,e)},ny=function(t,e){return e.set(e.t,e.p,t?e.e:e.b,e)},sy=function(t,e){return e.set(e.t,e.p,t!==1?e.b:e.e,e)},zE=function(t,e,r){return t.style[e]=r},YE=function(t,e,r){return t.style.setProperty(e,r)},jE=function(t,e,r){return t._gsap[e]=r},JE=function(t,e,r){return t._gsap.scaleX=t._gsap.scaleY=r},$E=function(t,e,r,n,s){var o=t._gsap;o.scaleX=o.scaleY=r,o.renderTransform(s,o)},QE=function(t,e,r,n,s){var o=t._gsap;o[e]=r,o.renderTransform(s,o)},Kt="transform",Le=Kt+"Origin",qE=function i(t,e){var r=this,n=this.target,s=n.style,o=n._gsap;if(t in hr&&s){if(this.tfm=this.tfm||{},t!=="transform")t=Ni[t]||t,~t.indexOf(",")?t.split(",").forEach(function(a){return r.tfm[a]=cr(n,a)}):this.tfm[t]=o.x?o[t]:cr(n,t),t===Le&&(this.tfm.zOrigin=o.zOrigin);else return Ni.transform.split(",").forEach(function(a){return i.call(r,a,e)});if(this.props.indexOf(Kt)>=0)return;o.svg&&(this.svgo=n.getAttribute("data-svg-origin"),this.props.push(Le,e,"")),t=Kt}(s||e)&&this.props.push(t,e,s[t])},oy=function(t){t.translate&&(t.removeProperty("translate"),t.removeProperty("scale"),t.removeProperty("rotate"))},tC=function(){var t=this.props,e=this.target,r=e.style,n=e._gsap,s,o;for(s=0;s<t.length;s+=3)t[s+1]?e[t[s]]=t[s+2]:t[s+2]?r[t[s]]=t[s+2]:r.removeProperty(t[s].substr(0,2)==="--"?t[s]:t[s].replace(id,"-$1").toLowerCase());if(this.tfm){for(o in this.tfm)n[o]=this.tfm[o];n.svg&&(n.renderTransform(),e.setAttribute("data-svg-origin",this.svgo||"")),s=ed(),(!s||!s.isStart)&&!r[Kt]&&(oy(r),n.zOrigin&&r[Le]&&(r[Le]+=" "+n.zOrigin+"px",n.zOrigin=0,n.renderTransform()),n.uncache=1)}},ay=function(t,e){var r={target:t,props:[],revert:tC,save:qE};return t._gsap||Pe.core.getCache(t),e&&e.split(",").forEach(function(n){return r.save(n)}),r},ly,nd=function(t,e){var r=Zr.createElementNS?Zr.createElementNS((e||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),t):Zr.createElement(t);return r&&r.style?r:Zr.createElement(t)},Oi=function i(t,e,r){var n=getComputedStyle(t);return n[e]||n.getPropertyValue(e.replace(id,"-$1").toLowerCase())||n.getPropertyValue(e)||!r&&i(t,Ts(e)||e,1)||""},hy="O,Moz,ms,Ms,Webkit".split(","),Ts=function(t,e,r){var n=e||In,s=n.style,o=5;if(t in s&&!r)return t;for(t=t.charAt(0).toUpperCase()+t.substr(1);o--&&!(hy[o]+t in s););return o<0?null:(o===3?"ms":o>=0?hy[o]:"")+t},sd=function(){XE()&&window.document&&(ey=window,Zr=ey.document,_s=Zr.documentElement,In=nd("div")||{style:{}},nd("div"),Kt=Ts(Kt),Le=Kt+"Origin",In.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",ly=!!Ts("perspective"),ed=Pe.core.reverting,td=1)},od=function i(t){var e=nd("svg",this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),r=this.parentNode,n=this.nextSibling,s=this.style.cssText,o;if(_s.appendChild(e),e.appendChild(this),this.style.display="block",t)try{o=this.getBBox(),this._gsapBBox=this.getBBox,this.getBBox=i}catch{}else this._gsapBBox&&(o=this._gsapBBox());return r&&(n?r.insertBefore(this,n):r.appendChild(this)),_s.removeChild(e),this.style.cssText=s,o},cy=function(t,e){for(var r=e.length;r--;)if(t.hasAttribute(e[r]))return t.getAttribute(e[r])},uy=function(t){var e;try{e=t.getBBox()}catch{e=od.call(t,!0)}return e&&(e.width||e.height)||t.getBBox===od||(e=od.call(t,!0)),e&&!e.width&&!e.x&&!e.y?{x:+cy(t,["x","cx","x1"])||0,y:+cy(t,["y","cy","y1"])||0,width:0,height:0}:e},dy=function(t){return!!(t.getCTM&&(!t.parentNode||t.ownerSVGElement)&&uy(t))},Mn=function(t,e){if(e){var r=t.style,n;e in hr&&e!==Le&&(e=Kt),r.removeProperty?(n=e.substr(0,2),(n==="ms"||e.substr(0,6)==="webkit")&&(e="-"+e),r.removeProperty(n==="--"?e:e.replace(id,"-$1").toLowerCase())):r.removeAttribute(e)}},Vr=function(t,e,r,n,s,o){var a=new Re(t._pt,e,r,0,1,o?sy:ny);return t._pt=a,a.b=n,a.e=s,t._props.push(r),a},fy={deg:1,rad:1,turn:1},eC={grid:1,flex:1},Hr=function i(t,e,r,n){var s=parseFloat(r)||0,o=(r+"").trim().substr((s+"").length)||"px",a=In.style,l=WE.test(e),h=t.tagName.toLowerCase()==="svg",c=(h?"client":"offset")+(l?"Width":"Height"),u=100,d=n==="px",f=n==="%",p,m,g,y;if(n===o||!s||fy[n]||fy[o])return s;if(o!=="px"&&!d&&(s=i(t,e,r,"px")),y=t.getCTM&&dy(t),(f||o==="%")&&(hr[e]||~e.indexOf("adius")))return p=y?t.getBBox()[l?"width":"height"]:t[c],Jt(f?s/p*u:s/100*p);if(a[l?"width":"height"]=u+(d?o:n),m=~e.indexOf("adius")||n==="em"&&t.appendChild&&!h?t:t.parentNode,y&&(m=(t.ownerSVGElement||{}).parentNode),(!m||m===Zr||!m.appendChild)&&(m=Zr.body),g=m._gsap,g&&f&&g.width&&l&&g.time===Ze.time&&!g.uncache)return Jt(s/g.width*u);if(f&&(e==="height"||e==="width")){var x=t.style[e];t.style[e]=u+n,p=t[c],x?t.style[e]=x:Mn(t,e)}else(f||o==="%")&&!eC[Oi(m,"display")]&&(a.position=Oi(t,"position")),m===t&&(a.position="static"),m.appendChild(In),p=In[c],m.removeChild(In),a.position="absolute";return l&&f&&(g=vn(m),g.time=Ze.time,g.width=m[c]),Jt(d?p*s/u:p&&s?u/p*s:0)},cr=function(t,e,r,n){var s;return td||sd(),e in Ni&&e!=="transform"&&(e=Ni[e],~e.indexOf(",")&&(e=e.split(",")[0])),hr[e]&&e!=="transform"?(s=Io(t,n),s=e!=="transformOrigin"?s[e]:s.svg?s.origin:Ml(Oi(t,Le))+" "+s.zOrigin+"px"):(s=t.style[e],(!s||s==="auto"||n||~(s+"").indexOf("calc("))&&(s=Al[e]&&Al[e](t,e,r)||Oi(t,e)||yg(t,e)||(e==="opacity"?1:0))),r&&!~(s+"").trim().indexOf(" ")?Hr(t,e,s,r)+r:s},iC=function(t,e,r,n){if(!r||r==="none"){var s=Ts(e,t,1),o=s&&Oi(t,s,1);o&&o!==r?(e=s,r=o):e==="borderColor"&&(r=Oi(t,"borderTopColor"))}var a=new Re(this._pt,t.style,e,0,1,$g),l=0,h=0,c,u,d,f,p,m,g,y,x,b,v,w;if(a.b=r,a.e=n,r+="",n+="",n==="auto"&&(m=t.style[e],t.style[e]=n,n=Oi(t,e)||n,m?t.style[e]=m:Mn(t,e)),c=[r,n],Xg(c),r=c[0],n=c[1],d=r.match(ps)||[],w=n.match(ps)||[],w.length){for(;u=ps.exec(n);)g=u[0],x=n.substring(l,u.index),p?p=(p+1)%5:(x.substr(-5)==="rgba("||x.substr(-5)==="hsla(")&&(p=1),g!==(m=d[h++]||"")&&(f=parseFloat(m)||0,v=m.substr((f+"").length),g.charAt(1)==="="&&(g=ms(f,g)+v),y=parseFloat(g),b=g.substr((y+"").length),l=ps.lastIndex-b.length,b||(b=b||Be.units[e]||v,l===n.length&&(n+=b,a.e+=b)),v!==b&&(f=Hr(t,e,m,b)||0),a._pt={_next:a._pt,p:x||h===1?x:",",s:f,c:y-f,m:p&&p<4||e==="zIndex"?Math.round:0});a.c=l<n.length?n.substring(l,n.length):""}else a.r=e==="display"&&n==="none"?sy:ny;return cg.test(n)&&(a.e=0),this._pt=a,a},py={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},rC=function(t){var e=t.split(" "),r=e[0],n=e[1]||"50%";return(r==="top"||r==="bottom"||n==="left"||n==="right")&&(t=r,r=n,n=t),e[0]=py[r]||r,e[1]=py[n]||n,e.join(" ")},nC=function(t,e){if(e.tween&&e.tween._time===e.tween._dur){var r=e.t,n=r.style,s=e.u,o=r._gsap,a,l,h;if(s==="all"||s===!0)n.cssText="",l=1;else for(s=s.split(","),h=s.length;--h>-1;)a=s[h],hr[a]&&(l=1,a=a==="transformOrigin"?Le:Kt),Mn(r,a);l&&(Mn(r,Kt),o&&(o.svg&&r.removeAttribute("transform"),Io(r,1),o.uncache=1,oy(n)))}},Al={clearProps:function(t,e,r,n,s){if(s.data!=="isFromStart"){var o=t._pt=new Re(t._pt,e,r,0,0,nC);return o.u=n,o.pr=-10,o.tween=s,t._props.push(r),1}}},Co=[1,0,0,1,0,0],my={},gy=function(t){return t==="matrix(1, 0, 0, 1, 0, 0)"||t==="none"||!t},yy=function(t){var e=Oi(t,Kt);return gy(e)?Co:e.substr(7).match(hg).map(Jt)},ad=function(t,e){var r=t._gsap||vn(t),n=t.style,s=yy(t),o,a,l,h;return r.svg&&t.getAttribute("transform")?(l=t.transform.baseVal.consolidate().matrix,s=[l.a,l.b,l.c,l.d,l.e,l.f],s.join(",")==="1,0,0,1,0,0"?Co:s):(s===Co&&!t.offsetParent&&t!==_s&&!r.svg&&(l=n.display,n.display="block",o=t.parentNode,(!o||!t.offsetParent)&&(h=1,a=t.nextElementSibling,_s.appendChild(t)),s=yy(t),l?n.display=l:Mn(t,"display"),h&&(a?o.insertBefore(t,a):o?o.appendChild(t):_s.removeChild(t))),e&&s.length>6?[s[0],s[1],s[4],s[5],s[12],s[13]]:s)},ld=function(t,e,r,n,s,o){var a=t._gsap,l=s||ad(t,!0),h=a.xOrigin||0,c=a.yOrigin||0,u=a.xOffset||0,d=a.yOffset||0,f=l[0],p=l[1],m=l[2],g=l[3],y=l[4],x=l[5],b=e.split(" "),v=parseFloat(b[0])||0,w=parseFloat(b[1])||0,S,C,I,M;r?l!==Co&&(C=f*g-p*m)&&(I=v*(g/C)+w*(-m/C)+(m*x-g*y)/C,M=v*(-p/C)+w*(f/C)-(f*x-p*y)/C,v=I,w=M):(S=uy(t),v=S.x+(~b[0].indexOf("%")?v/100*S.width:v),w=S.y+(~(b[1]||b[0]).indexOf("%")?w/100*S.height:w)),n||n!==!1&&a.smooth?(y=v-h,x=w-c,a.xOffset=u+(y*f+x*m)-y,a.yOffset=d+(y*p+x*g)-x):a.xOffset=a.yOffset=0,a.xOrigin=v,a.yOrigin=w,a.smooth=!!n,a.origin=e,a.originIsAbsolute=!!r,t.style[Le]="0px 0px",o&&(Vr(o,a,"xOrigin",h,v),Vr(o,a,"yOrigin",c,w),Vr(o,a,"xOffset",u,a.xOffset),Vr(o,a,"yOffset",d,a.yOffset)),t.setAttribute("data-svg-origin",v+" "+w)},Io=function(t,e){var r=t._gsap||new Hg(t);if("x"in r&&!e&&!r.uncache)return r;var n=t.style,s=r.scaleX<0,o="px",a="deg",l=getComputedStyle(t),h=Oi(t,Le)||"0",c,u,d,f,p,m,g,y,x,b,v,w,S,C,I,M,L,G,F,A,N,Z,K,H,j,B,D,k,V,et,ft,at;return c=u=d=m=g=y=x=b=v=0,f=p=1,r.svg=!!(t.getCTM&&dy(t)),l.translate&&((l.translate!=="none"||l.scale!=="none"||l.rotate!=="none")&&(n[Kt]=(l.translate!=="none"?"translate3d("+(l.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+(l.rotate!=="none"?"rotate("+l.rotate+") ":"")+(l.scale!=="none"?"scale("+l.scale.split(" ").join(",")+") ":"")+(l[Kt]!=="none"?l[Kt]:"")),n.scale=n.rotate=n.translate="none"),C=ad(t,r.svg),r.svg&&(r.uncache?(j=t.getBBox(),h=r.xOrigin-j.x+"px "+(r.yOrigin-j.y)+"px",H=""):H=!e&&t.getAttribute("data-svg-origin"),ld(t,H||h,!!H||r.originIsAbsolute,r.smooth!==!1,C)),w=r.xOrigin||0,S=r.yOrigin||0,C!==Co&&(G=C[0],F=C[1],A=C[2],N=C[3],c=Z=C[4],u=K=C[5],C.length===6?(f=Math.sqrt(G*G+F*F),p=Math.sqrt(N*N+A*A),m=G||F?ws(F,G)*An:0,x=A||N?ws(A,N)*An+m:0,x&&(p*=Math.abs(Math.cos(x*vs))),r.svg&&(c-=w-(w*G+S*A),u-=S-(w*F+S*N))):(at=C[6],et=C[7],D=C[8],k=C[9],V=C[10],ft=C[11],c=C[12],u=C[13],d=C[14],I=ws(at,V),g=I*An,I&&(M=Math.cos(-I),L=Math.sin(-I),H=Z*M+D*L,j=K*M+k*L,B=at*M+V*L,D=Z*-L+D*M,k=K*-L+k*M,V=at*-L+V*M,ft=et*-L+ft*M,Z=H,K=j,at=B),I=ws(-A,V),y=I*An,I&&(M=Math.cos(-I),L=Math.sin(-I),H=G*M-D*L,j=F*M-k*L,B=A*M-V*L,ft=N*L+ft*M,G=H,F=j,A=B),I=ws(F,G),m=I*An,I&&(M=Math.cos(I),L=Math.sin(I),H=G*M+F*L,j=Z*M+K*L,F=F*M-G*L,K=K*M-Z*L,G=H,Z=j),g&&Math.abs(g)+Math.abs(m)>359.9&&(g=m=0,y=180-y),f=Jt(Math.sqrt(G*G+F*F+A*A)),p=Jt(Math.sqrt(K*K+at*at)),I=ws(Z,K),x=Math.abs(I)>2e-4?I*An:0,v=ft?1/(ft<0?-ft:ft):0),r.svg&&(H=t.getAttribute("transform"),r.forceCSS=t.setAttribute("transform","")||!gy(Oi(t,Kt)),H&&t.setAttribute("transform",H))),Math.abs(x)>90&&Math.abs(x)<270&&(s?(f*=-1,x+=m<=0?180:-180,m+=m<=0?180:-180):(p*=-1,x+=x<=0?180:-180)),e=e||r.uncache,r.x=c-((r.xPercent=c&&(!e&&r.xPercent||(Math.round(t.offsetWidth/2)===Math.round(-c)?-50:0)))?t.offsetWidth*r.xPercent/100:0)+o,r.y=u-((r.yPercent=u&&(!e&&r.yPercent||(Math.round(t.offsetHeight/2)===Math.round(-u)?-50:0)))?t.offsetHeight*r.yPercent/100:0)+o,r.z=d+o,r.scaleX=Jt(f),r.scaleY=Jt(p),r.rotation=Jt(m)+a,r.rotationX=Jt(g)+a,r.rotationY=Jt(y)+a,r.skewX=x+a,r.skewY=b+a,r.transformPerspective=v+o,(r.zOrigin=parseFloat(h.split(" ")[2])||!e&&r.zOrigin||0)&&(n[Le]=Ml(h)),r.xOffset=r.yOffset=0,r.force3D=Be.force3D,r.renderTransform=r.svg?oC:ly?by:sC,r.uncache=0,r},Ml=function(t){return(t=t.split(" "))[0]+" "+t[1]},hd=function(t,e,r){var n=xe(e);return Jt(parseFloat(e)+parseFloat(Hr(t,"x",r+"px",n)))+n},sC=function(t,e){e.z="0px",e.rotationY=e.rotationX="0deg",e.force3D=0,by(t,e)},Rn="0deg",Ao="0px",Pn=") ",by=function(t,e){var r=e||this,n=r.xPercent,s=r.yPercent,o=r.x,a=r.y,l=r.z,h=r.rotation,c=r.rotationY,u=r.rotationX,d=r.skewX,f=r.skewY,p=r.scaleX,m=r.scaleY,g=r.transformPerspective,y=r.force3D,x=r.target,b=r.zOrigin,v="",w=y==="auto"&&t&&t!==1||y===!0;if(b&&(u!==Rn||c!==Rn)){var S=parseFloat(c)*vs,C=Math.sin(S),I=Math.cos(S),M;S=parseFloat(u)*vs,M=Math.cos(S),o=hd(x,o,C*M*-b),a=hd(x,a,-Math.sin(S)*-b),l=hd(x,l,I*M*-b+b)}g!==Ao&&(v+="perspective("+g+Pn),(n||s)&&(v+="translate("+n+"%, "+s+"%) "),(w||o!==Ao||a!==Ao||l!==Ao)&&(v+=l!==Ao||w?"translate3d("+o+", "+a+", "+l+") ":"translate("+o+", "+a+Pn),h!==Rn&&(v+="rotate("+h+Pn),c!==Rn&&(v+="rotateY("+c+Pn),u!==Rn&&(v+="rotateX("+u+Pn),(d!==Rn||f!==Rn)&&(v+="skew("+d+", "+f+Pn),(p!==1||m!==1)&&(v+="scale("+p+", "+m+Pn),x.style[Kt]=v||"translate(0, 0)"},oC=function(t,e){var r=e||this,n=r.xPercent,s=r.yPercent,o=r.x,a=r.y,l=r.rotation,h=r.skewX,c=r.skewY,u=r.scaleX,d=r.scaleY,f=r.target,p=r.xOrigin,m=r.yOrigin,g=r.xOffset,y=r.yOffset,x=r.forceCSS,b=parseFloat(o),v=parseFloat(a),w,S,C,I,M;l=parseFloat(l),h=parseFloat(h),c=parseFloat(c),c&&(c=parseFloat(c),h+=c,l+=c),l||h?(l*=vs,h*=vs,w=Math.cos(l)*u,S=Math.sin(l)*u,C=Math.sin(l-h)*-d,I=Math.cos(l-h)*d,h&&(c*=vs,M=Math.tan(h-c),M=Math.sqrt(1+M*M),C*=M,I*=M,c&&(M=Math.tan(c),M=Math.sqrt(1+M*M),w*=M,S*=M)),w=Jt(w),S=Jt(S),C=Jt(C),I=Jt(I)):(w=u,I=d,S=C=0),(b&&!~(o+"").indexOf("px")||v&&!~(a+"").indexOf("px"))&&(b=Hr(f,"x",o,"px"),v=Hr(f,"y",a,"px")),(p||m||g||y)&&(b=Jt(b+p-(p*w+m*C)+g),v=Jt(v+m-(p*S+m*I)+y)),(n||s)&&(M=f.getBBox(),b=Jt(b+n/100*M.width),v=Jt(v+s/100*M.height)),M="matrix("+w+","+S+","+C+","+I+","+b+","+v+")",f.setAttribute("transform",M),x&&(f.style[Kt]=M)},aC=function(t,e,r,n,s){var o=360,a=ce(s),l=parseFloat(s)*(a&&~s.indexOf("rad")?An:1),h=l-n,c=n+h+"deg",u,d;return a&&(u=s.split("_")[1],u==="short"&&(h%=o,h!==h%(o/2)&&(h+=h<0?o:-o)),u==="cw"&&h<0?h=(h+o*ry)%o-~~(h/o)*o:u==="ccw"&&h>0&&(h=(h-o*ry)%o-~~(h/o)*o)),t._pt=d=new Re(t._pt,e,r,n,h,VE),d.e=c,d.u="deg",t._props.push(r),d},xy=function(t,e){for(var r in e)t[r]=e[r];return t},lC=function(t,e,r){var n=xy({},r._gsap),s="perspective,force3D,transformOrigin,svgOrigin",o=r.style,a,l,h,c,u,d,f,p;n.svg?(h=r.getAttribute("transform"),r.setAttribute("transform",""),o[Kt]=e,a=Io(r,1),Mn(r,Kt),r.setAttribute("transform",h)):(h=getComputedStyle(r)[Kt],o[Kt]=e,a=Io(r,1),o[Kt]=h);for(l in hr)h=n[l],c=a[l],h!==c&&s.indexOf(l)<0&&(f=xe(h),p=xe(c),u=f!==p?Hr(r,l,h,p):parseFloat(h),d=parseFloat(c),t._pt=new Re(t._pt,a,l,u,d-u,rd),t._pt.u=p||0,t._props.push(l));xy(a,n)};Me("padding,margin,Width,Radius",function(i,t){var e="Top",r="Right",n="Bottom",s="Left",o=(t<3?[e,r,n,s]:[e+s,e+r,n+r,n+s]).map(function(a){return t<2?i+a:"border"+a+i});Al[t>1?"border"+i:i]=function(a,l,h,c,u){var d,f;if(arguments.length<4)return d=o.map(function(p){return cr(a,p,h)}),f=d.join(" "),f.split(d[0]).length===5?d[0]:f;d=(c+"").split(" "),f={},o.forEach(function(p,m){return f[p]=d[m]=d[m]||d[(m-1)/2|0]}),a.init(l,f,u)}});var _y={name:"css",register:sd,targetTest:function(t){return t.style&&t.nodeType},init:function(t,e,r,n,s){var o=this._props,a=t.style,l=r.vars.startAt,h,c,u,d,f,p,m,g,y,x,b,v,w,S,C,I;td||sd(),this.styles=this.styles||ay(t),I=this.styles.props,this.tween=r;for(m in e)if(m!=="autoRound"&&(c=e[m],!(Xe[m]&&Kg(m,e,r,n,t,s)))){if(f=typeof c,p=Al[m],f==="function"&&(c=c.call(r,n,t,s),f=typeof c),f==="string"&&~c.indexOf("random(")&&(c=_o(c)),p)p(this,t,m,c,r)&&(C=1);else if(m.substr(0,2)==="--")h=(getComputedStyle(t).getPropertyValue(m)+"").trim(),c+="",Xr.lastIndex=0,Xr.test(h)||(g=xe(h),y=xe(c)),y?g!==y&&(h=Hr(t,m,h,y)+y):g&&(c+=g),this.add(a,"setProperty",h,c,n,s,0,0,m),o.push(m),I.push(m,0,a[m]);else if(f!=="undefined"){if(l&&m in l?(h=typeof l[m]=="function"?l[m].call(r,n,t,s):l[m],ce(h)&&~h.indexOf("random(")&&(h=_o(h)),xe(h+"")||h==="auto"||(h+=Be.units[m]||xe(cr(t,m))||""),(h+"").charAt(1)==="="&&(h=cr(t,m))):h=cr(t,m),d=parseFloat(h),x=f==="string"&&c.charAt(1)==="="&&c.substr(0,2),x&&(c=c.substr(2)),u=parseFloat(c),m in Ni&&(m==="autoAlpha"&&(d===1&&cr(t,"visibility")==="hidden"&&u&&(d=0),I.push("visibility",0,a.visibility),Vr(this,a,"visibility",d?"inherit":"hidden",u?"inherit":"hidden",!u)),m!=="scale"&&m!=="transform"&&(m=Ni[m],~m.indexOf(",")&&(m=m.split(",")[0]))),b=m in hr,b){if(this.styles.save(m),v||(w=t._gsap,w.renderTransform&&!e.parseTransform||Io(t,e.parseTransform),S=e.smoothOrigin!==!1&&w.smooth,v=this._pt=new Re(this._pt,a,Kt,0,1,w.renderTransform,w,0,-1),v.dep=1),m==="scale")this._pt=new Re(this._pt,w,"scaleY",w.scaleY,(x?ms(w.scaleY,x+u):u)-w.scaleY||0,rd),this._pt.u=0,o.push("scaleY",m),m+="X";else if(m==="transformOrigin"){I.push(Le,0,a[Le]),c=rC(c),w.svg?ld(t,c,0,S,0,this):(y=parseFloat(c.split(" ")[2])||0,y!==w.zOrigin&&Vr(this,w,"zOrigin",w.zOrigin,y),Vr(this,a,m,Ml(h),Ml(c)));continue}else if(m==="svgOrigin"){ld(t,c,1,S,0,this);continue}else if(m in my){aC(this,w,m,d,x?ms(d,x+c):c);continue}else if(m==="smoothOrigin"){Vr(this,w,"smooth",w.smooth,c);continue}else if(m==="force3D"){w[m]=c;continue}else if(m==="transform"){lC(this,c,t);continue}}else m in a||(m=Ts(m)||m);if(b||(u||u===0)&&(d||d===0)&&!ZE.test(c)&&m in a)g=(h+"").substr((d+"").length),u||(u=0),y=xe(c)||(m in Be.units?Be.units[m]:g),g!==y&&(d=Hr(t,m,h,y)),this._pt=new Re(this._pt,b?w:a,m,d,(x?ms(d,x+u):u)-d,!b&&(y==="px"||m==="zIndex")&&e.autoRound!==!1?KE:rd),this._pt.u=y||0,g!==y&&y!=="%"&&(this._pt.b=h,this._pt.r=HE);else if(m in a)iC.call(this,t,m,h,x?x+c:c);else if(m in t)this.add(t,m,h||t[m],x?x+c:c,n,s);else if(m!=="parseTransform"){Pu(m,c);continue}b||(m in a?I.push(m,0,a[m]):I.push(m,1,h||t[m])),o.push(m)}}C&&Qg(this)},render:function(t,e){if(e.tween._time||!ed())for(var r=e._pt;r;)r.r(t,r.d),r=r._next;else e.styles.revert()},get:cr,aliases:Ni,getSetter:function(t,e,r){var n=Ni[e];return n&&n.indexOf(",")<0&&(e=n),e in hr&&e!==Le&&(t._gsap.x||cr(t,"x"))?r&&iy===r?e==="scale"?JE:jE:(iy=r||{})&&(e==="scale"?$E:QE):t.style&&!Eu(t.style[e])?zE:~e.indexOf("-")?YE:ju(t,e)},core:{_removeProperty:Mn,_getMatrix:ad}};Pe.utils.checkPrefix=Ts,Pe.core.getStyleSaver=ay,function(i,t,e,r){var n=Me(i+","+t+","+e,function(s){hr[s]=1});Me(t,function(s){Be.units[s]="deg",my[s]=1}),Ni[n[13]]=i+","+t,Me(r,function(s){var o=s.split(":");Ni[o[1]]=n[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"),Me("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(i){Be.units[i]="px"}),Pe.registerPlugin(_y);var vy=Pe.registerPlugin(_y)||Pe;vy.core.Tween;const Ln=new gt;class hC{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,r=t.length;e<r;e++)this._targetList.add(t[e]);return this}remove(t){return this._targetList.delete(t),this}removeAll(t){for(let e=0,r=t.length;e<r;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(r=>{e||r.getBounds(!1,Ln),this._recursive?this.cullRecursive(t,r,e):(e&&r._bounds.getRectangle(t),r[this._toggle]=Ln.right>t.left&&Ln.left<t.right&&Ln.bottom>t.top&&Ln.top<t.bottom)}),this}uncull(){return this._targetList.forEach(t=>{this._recursive?this.uncullRecursive(t):t[this._toggle]=!1}),this}cullRecursive(t,e,r){const n=r?e._bounds.getRectangle(Ln):e.getBounds(!0,Ln);if(e[this._toggle]=n.right>t.left&&n.left<t.right&&n.bottom>t.top&&n.top<t.bottom,!(n.left>=t.left&&n.top>=t.top&&n.right<=t.right&&n.bottom<=t.bottom)&&e[this._toggle]&&e.children&&e.children.length){const o=e.children;for(let a=0,l=o.length;a<l;a++)this.cullRecursive(t,o[a])}}uncullRecursive(t){if(t[this._toggle]=!0,t.children&&t.children.length){const e=t.children;for(let r=0,n=e.length;r<n;r++)this.uncullRecursive(e[r])}}}var Rl={exports:{}};Rl.exports,function(i,t){var e=200,r="__lodash_hash_undefined__",n=1,s=2,o=9007199254740991,a="[object Arguments]",l="[object Array]",h="[object AsyncFunction]",c="[object Boolean]",u="[object Date]",d="[object Error]",f="[object Function]",p="[object GeneratorFunction]",m="[object Map]",g="[object Number]",y="[object Null]",x="[object Object]",b="[object Promise]",v="[object Proxy]",w="[object RegExp]",S="[object Set]",C="[object String]",I="[object Symbol]",M="[object Undefined]",L="[object WeakMap]",G="[object ArrayBuffer]",F="[object DataView]",A="[object Float32Array]",N="[object Float64Array]",Z="[object Int8Array]",K="[object Int16Array]",H="[object Int32Array]",j="[object Uint8Array]",B="[object Uint8ClampedArray]",D="[object Uint16Array]",k="[object Uint32Array]",V=/[\\^$.*+?()[\]{}|]/g,et=/^\[object .+?Constructor\]$/,ft=/^(?:0|[1-9]\d*)$/,at={};at[A]=at[N]=at[Z]=at[K]=at[H]=at[j]=at[B]=at[D]=at[k]=!0,at[a]=at[l]=at[G]=at[c]=at[F]=at[u]=at[d]=at[f]=at[m]=at[g]=at[x]=at[w]=at[S]=at[C]=at[L]=!1;var Tt=typeof we=="object"&&we&&we.Object===Object&&we,It=typeof self=="object"&&self&&self.Object===Object&&self,Q=Tt||It||Function("return this")(),W=t&&!t.nodeType&&t,J=W&&!0&&i&&!i.nodeType&&i,$=J&&J.exports===W,O=$&&Tt.process,pt=function(){try{return O&&O.binding&&O.binding("util")}catch{}}(),yt=pt&&pt.isTypedArray;function Rt(T,R){for(var _=-1,E=T==null?0:T.length,P=0,X=[];++_<E;){var ut=T[_];R(ut,_,T)&&(X[P++]=ut)}return X}function Bt(T,R){for(var _=-1,E=R.length,P=T.length;++_<E;)T[P+_]=R[_];return T}function Fe(T,R){for(var _=-1,E=T==null?0:T.length;++_<E;)if(R(T[_],_,T))return!0;return!1}function Ve(T,R){for(var _=-1,E=Array(T);++_<T;)E[_]=R(_);return E}function Ho(T){return function(R){return T(R)}}function Jr(T,R){return T.has(R)}function ks(T,R){return T==null?void 0:T[R]}function Fs(T){var R=-1,_=Array(T.size);return T.forEach(function(E,P){_[++R]=[P,E]}),_}function yi(T,R){return function(_){return T(R(_))}}function nh(T){var R=-1,_=Array(T.size);return T.forEach(function(E){_[++R]=E}),_}var sh=Array.prototype,qd=Function.prototype,Ds=Object.prototype,$r=Q["__core-js_shared__"],Ko=qd.toString,He=Ds.hasOwnProperty,zo=function(){var T=/[^.]+$/.exec($r&&$r.keys&&$r.keys.IE_PROTO||"");return T?"Symbol(src)_1."+T:""}(),Yo=Ds.toString,oh=RegExp("^"+Ko.call(He).replace(V,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ah=$?Q.Buffer:void 0,Ns=Q.Symbol,Vi=Q.Uint8Array,Bn=Ds.propertyIsEnumerable,tf=sh.splice,Hi=Ns?Ns.toStringTag:void 0,lh=Object.getOwnPropertySymbols,hh=ah?ah.isBuffer:void 0,Un=yi(Object.keys,Object),jo=vr(Q,"DataView"),Ke=vr(Q,"Map"),Jo=vr(Q,"Promise"),$o=vr(Q,"Set"),Qo=vr(Q,"WeakMap"),Xn=vr(Object,"create"),ef=xi(jo),bi=xi(Ke),rf=xi(Jo),nf=xi($o),sf=xi(Qo),ch=Ns?Ns.prototype:void 0,qo=ch?ch.valueOf:void 0;function De(T){var R=-1,_=T==null?0:T.length;for(this.clear();++R<_;){var E=T[R];this.set(E[0],E[1])}}function of(){this.__data__=Xn?Xn(null):{},this.size=0}function af(T){var R=this.has(T)&&delete this.__data__[T];return this.size-=R?1:0,R}function lf(T){var R=this.__data__;if(Xn){var _=R[T];return _===r?void 0:_}return He.call(R,T)?R[T]:void 0}function hf(T){var R=this.__data__;return Xn?R[T]!==void 0:He.call(R,T)}function cf(T,R){var _=this.__data__;return this.size+=this.has(T)?0:1,_[T]=Xn&&R===void 0?r:R,this}De.prototype.clear=of,De.prototype.delete=af,De.prototype.get=lf,De.prototype.has=hf,De.prototype.set=cf;function _e(T){var R=-1,_=T==null?0:T.length;for(this.clear();++R<_;){var E=T[R];this.set(E[0],E[1])}}function uf(){this.__data__=[],this.size=0}function df(T){var R=this.__data__,_=Bs(R,T);if(_<0)return!1;var E=R.length-1;return _==E?R.pop():tf.call(R,_,1),--this.size,!0}function ff(T){var R=this.__data__,_=Bs(R,T);return _<0?void 0:R[_][1]}function pf(T){return Bs(this.__data__,T)>-1}function mf(T,R){var _=this.__data__,E=Bs(_,T);return E<0?(++this.size,_.push([T,R])):_[E][1]=R,this}_e.prototype.clear=uf,_e.prototype.delete=df,_e.prototype.get=ff,_e.prototype.has=pf,_e.prototype.set=mf;function xr(T){var R=-1,_=T==null?0:T.length;for(this.clear();++R<_;){var E=T[R];this.set(E[0],E[1])}}function ta(){this.size=0,this.__data__={hash:new De,map:new(Ke||_e),string:new De}}function gf(T){var R=Xs(this,T).delete(T);return this.size-=R?1:0,R}function Os(T){return Xs(this,T).get(T)}function ea(T){return Xs(this,T).has(T)}function yf(T,R){var _=Xs(this,T),E=_.size;return _.set(T,R),this.size+=_.size==E?0:1,this}xr.prototype.clear=ta,xr.prototype.delete=gf,xr.prototype.get=Os,xr.prototype.has=ea,xr.prototype.set=yf;function _r(T){var R=-1,_=T==null?0:T.length;for(this.__data__=new xr;++R<_;)this.add(T[R])}function uh(T){return this.__data__.set(T,r),this}function bf(T){return this.__data__.has(T)}_r.prototype.add=_r.prototype.push=uh,_r.prototype.has=bf;function Ki(T){var R=this.__data__=new _e(T);this.size=R.size}function xf(){this.__data__=new _e,this.size=0}function dh(T){var R=this.__data__,_=R.delete(T);return this.size=R.size,_}function _f(T){return this.__data__.get(T)}function vf(T){return this.__data__.has(T)}function wf(T,R){var _=this.__data__;if(_ instanceof _e){var E=_.__data__;if(!Ke||E.length<e-1)return E.push([T,R]),this.size=++_.size,this;_=this.__data__=new xr(E)}return _.set(T,R),this.size=_.size,this}Ki.prototype.clear=xf,Ki.prototype.delete=dh,Ki.prototype.get=_f,Ki.prototype.has=vf,Ki.prototype.set=wf;function Tf(T,R){var _=Vs(T),E=!_&&na(T),P=!_&&!E&&Zn(T),X=!_&&!E&&!P&&vh(T),ut=_||E||P||X,bt=ut?Ve(T.length,String):[],_t=bt.length;for(var ht in T)(R||He.call(T,ht))&&!(ut&&(ht=="length"||P&&(ht=="offset"||ht=="parent")||X&&(ht=="buffer"||ht=="byteLength"||ht=="byteOffset")||ra(ht,_t)))&&bt.push(ht);return bt}function Bs(T,R){for(var _=T.length;_--;)if(Zs(T[_][0],R))return _;return-1}function Sf(T,R,_){var E=R(T);return Vs(T)?E:Bt(E,_(T))}function Wn(T){return T==null?T===void 0?M:y:Hi&&Hi in Object(T)?Af(T):Ws(T)}function fh(T){return qr(T)&&Wn(T)==a}function ph(T,R,_,E,P){return T===R?!0:T==null||R==null||!qr(T)&&!qr(R)?T!==T&&R!==R:Ef(T,R,_,E,ph,P)}function Ef(T,R,_,E,P,X){var ut=Vs(T),bt=Vs(R),_t=ut?l:zi(T),ht=bt?l:zi(R);_t=_t==a?x:_t,ht=ht==a?x:ht;var vt=_t==x,Xt=ht==x,Pt=_t==ht;if(Pt&&Zn(T)){if(!Zn(R))return!1;ut=!0,vt=!1}if(Pt&&!vt)return X||(X=new Ki),ut||vh(T)?mh(T,R,_,E,P,X):gh(T,R,_t,_,E,P,X);if(!(_&n)){var fe=vt&&He.call(T,"__wrapped__"),ve=Xt&&He.call(R,"__wrapped__");if(fe||ve){var si=fe?T.value():T,oi=ve?R.value():R;return X||(X=new Ki),P(si,oi,_,E,X)}}return Pt?(X||(X=new Ki),If(T,R,_,E,P,X)):!1}function Us(T){if(!_h(T)||Pf(T))return!1;var R=Yi(T)?oh:et;return R.test(xi(T))}function ia(T){return qr(T)&&Qr(T.length)&&!!at[Wn(T)]}function Cf(T){if(!Lf(T))return Un(T);var R=[];for(var _ in Object(T))He.call(T,_)&&_!="constructor"&&R.push(_);return R}function mh(T,R,_,E,P,X){var ut=_&n,bt=T.length,_t=R.length;if(bt!=_t&&!(ut&&_t>bt))return!1;var ht=X.get(T);if(ht&&X.get(R))return ht==R;var vt=-1,Xt=!0,Pt=_&s?new _r:void 0;for(X.set(T,R),X.set(R,T);++vt<bt;){var fe=T[vt],ve=R[vt];if(E)var si=ut?E(ve,fe,vt,R,T,X):E(fe,ve,vt,T,R,X);if(si!==void 0){if(si)continue;Xt=!1;break}if(Pt){if(!Fe(R,function(oi,Vn){if(!Jr(Pt,Vn)&&(fe===oi||P(fe,oi,_,E,X)))return Pt.push(Vn)})){Xt=!1;break}}else if(!(fe===ve||P(fe,ve,_,E,X))){Xt=!1;break}}return X.delete(T),X.delete(R),Xt}function gh(T,R,_,E,P,X,ut){switch(_){case F:if(T.byteLength!=R.byteLength||T.byteOffset!=R.byteOffset)return!1;T=T.buffer,R=R.buffer;case G:return!(T.byteLength!=R.byteLength||!X(new Vi(T),new Vi(R)));case c:case u:case g:return Zs(+T,+R);case d:return T.name==R.name&&T.message==R.message;case w:case C:return T==R+"";case m:var bt=Fs;case S:var _t=E&n;if(bt||(bt=nh),T.size!=R.size&&!_t)return!1;var ht=ut.get(T);if(ht)return ht==R;E|=s,ut.set(T,R);var vt=mh(bt(T),bt(R),E,P,X,ut);return ut.delete(T),vt;case I:if(qo)return qo.call(T)==qo.call(R)}return!1}function If(T,R,_,E,P,X){var ut=_&n,bt=yh(T),_t=bt.length,ht=yh(R),vt=ht.length;if(_t!=vt&&!ut)return!1;for(var Xt=_t;Xt--;){var Pt=bt[Xt];if(!(ut?Pt in R:He.call(R,Pt)))return!1}var fe=X.get(T);if(fe&&X.get(R))return fe==R;var ve=!0;X.set(T,R),X.set(R,T);for(var si=ut;++Xt<_t;){Pt=bt[Xt];var oi=T[Pt],Vn=R[Pt];if(E)var T1=ut?E(Vn,oi,Pt,R,T,X):E(oi,Vn,Pt,T,R,X);if(!(T1===void 0?oi===Vn||P(oi,Vn,_,E,X):T1)){ve=!1;break}si||(si=Pt=="constructor")}if(ve&&!si){var Th=T.constructor,Sh=R.constructor;Th!=Sh&&"constructor"in T&&"constructor"in R&&!(typeof Th=="function"&&Th instanceof Th&&typeof Sh=="function"&&Sh instanceof Sh)&&(ve=!1)}return X.delete(T),X.delete(R),ve}function yh(T){return Sf(T,wh,Mf)}function Xs(T,R){var _=T.__data__;return Rf(R)?_[typeof R=="string"?"string":"hash"]:_.map}function vr(T,R){var _=ks(T,R);return Us(_)?_:void 0}function Af(T){var R=He.call(T,Hi),_=T[Hi];try{T[Hi]=void 0;var E=!0}catch{}var P=Yo.call(T);return E&&(R?T[Hi]=_:delete T[Hi]),P}var Mf=lh?function(T){return T==null?[]:(T=Object(T),Rt(lh(T),function(R){return Bn.call(T,R)}))}:Gf,zi=Wn;(jo&&zi(new jo(new ArrayBuffer(1)))!=F||Ke&&zi(new Ke)!=m||Jo&&zi(Jo.resolve())!=b||$o&&zi(new $o)!=S||Qo&&zi(new Qo)!=L)&&(zi=function(T){var R=Wn(T),_=R==x?T.constructor:void 0,E=_?xi(_):"";if(E)switch(E){case ef:return F;case bi:return m;case rf:return b;case nf:return S;case sf:return L}return R});function ra(T,R){return R=R??o,!!R&&(typeof T=="number"||ft.test(T))&&T>-1&&T%1==0&&T<R}function Rf(T){var R=typeof T;return R=="string"||R=="number"||R=="symbol"||R=="boolean"?T!=="__proto__":T===null}function Pf(T){return!!zo&&zo in T}function Lf(T){var R=T&&T.constructor,_=typeof R=="function"&&R.prototype||Ds;return T===_}function Ws(T){return Yo.call(T)}function xi(T){if(T!=null){try{return Ko.call(T)}catch{}try{return T+""}catch{}}return""}function Zs(T,R){return T===R||T!==T&&R!==R}var na=fh(function(){return arguments}())?fh:function(T){return qr(T)&&He.call(T,"callee")&&!Bn.call(T,"callee")},Vs=Array.isArray;function bh(T){return T!=null&&Qr(T.length)&&!Yi(T)}var Zn=hh||kf;function xh(T,R){return ph(T,R)}function Yi(T){if(!_h(T))return!1;var R=Wn(T);return R==f||R==p||R==h||R==v}function Qr(T){return typeof T=="number"&&T>-1&&T%1==0&&T<=o}function _h(T){var R=typeof T;return T!=null&&(R=="object"||R=="function")}function qr(T){return T!=null&&typeof T=="object"}var vh=yt?Ho(yt):ia;function wh(T){return bh(T)?Tf(T):Cf(T)}function Gf(){return[]}function kf(){return!1}i.exports=xh}(Rl,Rl.exports);var cC=Rl.exports;const wy=Tr(cC);var uC=Object.defineProperty,dC=(i,t,e)=>t in i?uC(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,U=(i,t,e)=>(dC(i,typeof t!="symbol"?t+"":t,e),e);class ei{constructor(t){U(this,"parent"),U(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 fC=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Ty={exports:{}};(function(i,t){(function(){var e,r;r=function(n){return i.exports=n},e={linear:function(n,s,o,a){return o*n/a+s},easeInQuad:function(n,s,o,a){return o*(n/=a)*n+s},easeOutQuad:function(n,s,o,a){return-o*(n/=a)*(n-2)+s},easeInOutQuad:function(n,s,o,a){return(n/=a/2)<1?o/2*n*n+s:-o/2*(--n*(n-2)-1)+s},easeInCubic:function(n,s,o,a){return o*(n/=a)*n*n+s},easeOutCubic:function(n,s,o,a){return o*((n=n/a-1)*n*n+1)+s},easeInOutCubic:function(n,s,o,a){return(n/=a/2)<1?o/2*n*n*n+s:o/2*((n-=2)*n*n+2)+s},easeInQuart:function(n,s,o,a){return o*(n/=a)*n*n*n+s},easeOutQuart:function(n,s,o,a){return-o*((n=n/a-1)*n*n*n-1)+s},easeInOutQuart:function(n,s,o,a){return(n/=a/2)<1?o/2*n*n*n*n+s:-o/2*((n-=2)*n*n*n-2)+s},easeInQuint:function(n,s,o,a){return o*(n/=a)*n*n*n*n+s},easeOutQuint:function(n,s,o,a){return o*((n=n/a-1)*n*n*n*n+1)+s},easeInOutQuint:function(n,s,o,a){return(n/=a/2)<1?o/2*n*n*n*n*n+s:o/2*((n-=2)*n*n*n*n+2)+s},easeInSine:function(n,s,o,a){return-o*Math.cos(n/a*(Math.PI/2))+o+s},easeOutSine:function(n,s,o,a){return o*Math.sin(n/a*(Math.PI/2))+s},easeInOutSine:function(n,s,o,a){return-o/2*(Math.cos(Math.PI*n/a)-1)+s},easeInExpo:function(n,s,o,a){return n===0?s:o*Math.pow(2,10*(n/a-1))+s},easeOutExpo:function(n,s,o,a){return n===a?s+o:o*(-Math.pow(2,-10*n/a)+1)+s},easeInOutExpo:function(n,s,o,a){return(n/=a/2)<1?o/2*Math.pow(2,10*(n-1))+s:o/2*(-Math.pow(2,-10*--n)+2)+s},easeInCirc:function(n,s,o,a){return-o*(Math.sqrt(1-(n/=a)*n)-1)+s},easeOutCirc:function(n,s,o,a){return o*Math.sqrt(1-(n=n/a-1)*n)+s},easeInOutCirc:function(n,s,o,a){return(n/=a/2)<1?-o/2*(Math.sqrt(1-n*n)-1)+s:o/2*(Math.sqrt(1-(n-=2)*n)+1)+s},easeInElastic:function(n,s,o,a){var l,h,c;return c=1.70158,h=0,l=o,n===0||(n/=a),h||(h=a*.3),l<Math.abs(o)?(l=o,c=h/4):c=h/(2*Math.PI)*Math.asin(o/l),-(l*Math.pow(2,10*(n-=1))*Math.sin((n*a-c)*(2*Math.PI)/h))+s},easeOutElastic:function(n,s,o,a){var l,h,c;return c=1.70158,h=0,l=o,n===0||(n/=a),h||(h=a*.3),l<Math.abs(o)?(l=o,c=h/4):c=h/(2*Math.PI)*Math.asin(o/l),l*Math.pow(2,-10*n)*Math.sin((n*a-c)*(2*Math.PI)/h)+o+s},easeInOutElastic:function(n,s,o,a){var l,h,c;return c=1.70158,h=0,l=o,n===0||(n/=a/2),h||(h=a*(.3*1.5)),l<Math.abs(o)?(l=o,c=h/4):c=h/(2*Math.PI)*Math.asin(o/l),n<1?-.5*(l*Math.pow(2,10*(n-=1))*Math.sin((n*a-c)*(2*Math.PI)/h))+s:l*Math.pow(2,-10*(n-=1))*Math.sin((n*a-c)*(2*Math.PI)/h)*.5+o+s},easeInBack:function(n,s,o,a,l){return l===void 0&&(l=1.70158),o*(n/=a)*n*((l+1)*n-l)+s},easeOutBack:function(n,s,o,a,l){return l===void 0&&(l=1.70158),o*((n=n/a-1)*n*((l+1)*n+l)+1)+s},easeInOutBack:function(n,s,o,a,l){return l===void 0&&(l=1.70158),(n/=a/2)<1?o/2*(n*n*(((l*=1.525)+1)*n-l))+s:o/2*((n-=2)*n*(((l*=1.525)+1)*n+l)+2)+s},easeInBounce:function(n,s,o,a){var l;return l=e.easeOutBounce(a-n,0,o,a),o-l+s},easeOutBounce:function(n,s,o,a){return(n/=a)<1/2.75?o*(7.5625*n*n)+s:n<2/2.75?o*(7.5625*(n-=1.5/2.75)*n+.75)+s:n<2.5/2.75?o*(7.5625*(n-=2.25/2.75)*n+.9375)+s:o*(7.5625*(n-=2.625/2.75)*n+.984375)+s},easeInOutBounce:function(n,s,o,a){var l;return n<a/2?(l=e.easeInBounce(n*2,0,o,a),l*.5+s):(l=e.easeOutBounce(n*2-a,0,o,a),l*.5+o*.5+s)}},r(e)}).call(fC)})(Ty);const Sy=Ty.exports;function Pl(i,t){if(i){if(typeof i=="function")return i;if(typeof i=="string")return Sy[i]}else return Sy[t]}const pC={removeOnInterrupt:!1,ease:"linear",time:1e3};class mC extends ei{constructor(t,e={}){super(t),U(this,"options"),U(this,"startX"),U(this,"startY"),U(this,"deltaX"),U(this,"deltaY"),U(this,"keepCenter"),U(this,"startWidth",null),U(this,"startHeight",null),U(this,"deltaWidth",null),U(this,"deltaHeight",null),U(this,"width",null),U(this,"height",null),U(this,"time",0),this.options=Object.assign({},pC,e),this.options.ease=Pl(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 dt(this.parent.scale.x,this.parent.scale.y);if(this.time>=this.options.time){const r=this.parent.width,n=this.parent.height;this.complete(),(r!==this.parent.width||n!==this.parent.height)&&this.parent.emit("zoomed",{viewport:this.parent,original:e,type:"animate"})}else{const r=this.options.ease(this.time,0,1,this.options.time);if(this.width!==null){const n=this.startWidth,s=this.deltaWidth;this.parent.fitWidth(n+s*r,this.keepCenter,this.height===null)}if(this.height!==null){const n=this.startHeight,s=this.deltaHeight;this.parent.fitHeight(n+s*r,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 n=this.startX,s=this.startY,o=this.deltaX,a=this.deltaY,l=new dt(this.parent.x,this.parent.y);this.parent.moveCenter(n+o*r,s+a*r),this.parent.emit("moved",{viewport:this.parent,original:l,type:"animate"})}(this.width||this.height)&&this.parent.emit("zoomed",{viewport:this.parent,original:e,type:"animate"})}}}const gC={sides:"all",friction:.5,time:150,ease:"easeInOutSine",underflow:"center",bounceBox:null};class yC extends ei{constructor(t,e={}){super(t),U(this,"options"),U(this,"left"),U(this,"top"),U(this,"right"),U(this,"bottom"),U(this,"underflowX"),U(this,"underflowY"),U(this,"ease"),U(this,"toX"),U(this,"toY"),this.options=Object.assign({},gC,e),this.ease=Pl(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 r=this.options.underflow.toLowerCase();r==="center"?(this.underflowX=0,this.underflowY=0):(this.underflowX=r.indexOf("left")!==-1?-1:r.indexOf("right")!==-1?1:0,this.underflowY=r.indexOf("top")!==-1?-1:r.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,r=typeof t.y>"u"?0:t.y,n=typeof t.width>"u"?this.parent.worldWidth:t.width,s=typeof t.height>"u"?this.parent.worldHeight:t.height;return{left:this.parent.left<e,right:this.parent.right>n,top:this.parent.top<r,bottom:this.parent.bottom>s,topLeft:new dt(e*this.parent.scale.x,r*this.parent.scale.y),bottomRight:new dt(n*this.parent.scale.x-this.parent.screenWidth,s*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 dt(0,0),bottomRight:new dt(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 r,n=this.parent.plugins.get("decelerate",!0);n&&(n.x||n.y)&&(n.x&&n.percentChangeX===((t=n.options)==null?void 0:t.friction)||n.y&&n.percentChangeY===((e=n.options)==null?void 0:e.friction))&&(r=this.oob(),(r.left&&this.left||r.right&&this.right)&&(n.percentChangeX=this.options.friction),(r.top&&this.top||r.bottom&&this.bottom)&&(n.percentChangeY=this.options.friction));const s=this.parent.plugins.get("drag",!0)||{},o=this.parent.plugins.get("pinch",!0)||{};if(n=n||{},!(s!=null&&s.active)&&!(o!=null&&o.active)&&(!this.toX||!this.toY)&&(!n.x||!n.y)){r=r||this.oob();const a=r.topLeft,l=r.bottomRight;if(!this.toX&&!n.x){let h=null;r.left&&this.left?h=this.parent.screenWorldWidth<this.parent.screenWidth?this.calcUnderflowX():-a.x:r.right&&this.right&&(h=this.parent.screenWorldWidth<this.parent.screenWidth?this.calcUnderflowX():-l.x),h!==null&&this.parent.x!==h&&(this.toX={time:0,start:this.parent.x,delta:h-this.parent.x,end:h},this.parent.emit("bounce-x-start",this.parent))}if(!this.toY&&!n.y){let h=null;r.top&&this.top?h=this.parent.screenWorldHeight<this.parent.screenHeight?this.calcUnderflowY():-a.y:r.bottom&&this.bottom&&(h=this.parent.screenWorldHeight<this.parent.screenHeight?this.calcUnderflowY():-l.y),h!==null&&this.parent.y!==h&&(this.toY={time:0,start:this.parent.y,delta:h-this.parent.y,end:h},this.parent.emit("bounce-y-start",this.parent))}}}reset(){this.toX=this.toY=null,this.bounce()}}const bC={left:!1,right:!1,top:!1,bottom:!1,direction:null,underflow:"center"};class xC extends ei{constructor(t,e={}){super(t),U(this,"options"),U(this,"last"),U(this,"noUnderflow"),U(this,"underflowX"),U(this,"underflowY"),this.options=Object.assign({},bC,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 dt(this.parent.x,this.parent.y),e=this.parent.plugins.decelerate||{};if(this.options.left!==null||this.options.right!==null){let r=!1;if(!this.noUnderflow&&this.parent.screenWorldWidth<this.parent.screenWidth)switch(this.underflowX){case-1:this.parent.x!==0&&(this.parent.x=0,r=!0);break;case 1:this.parent.x!==this.parent.screenWidth-this.parent.screenWorldWidth&&(this.parent.x=this.parent.screenWidth-this.parent.screenWorldWidth,r=!0);break;default:this.parent.x!==(this.parent.screenWidth-this.parent.screenWorldWidth)/2&&(this.parent.x=(this.parent.screenWidth-this.parent.screenWorldWidth)/2,r=!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,r=!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,r=!0);r&&this.parent.emit("moved",{viewport:this.parent,original:t,type:"clamp-x"})}if(this.options.top!==null||this.options.bottom!==null){let r=!1;if(!this.noUnderflow&&this.parent.screenWorldHeight<this.parent.screenHeight)switch(this.underflowY){case-1:this.parent.y!==0&&(this.parent.y=0,r=!0);break;case 1:this.parent.y!==this.parent.screenHeight-this.parent.screenWorldHeight&&(this.parent.y=this.parent.screenHeight-this.parent.screenWorldHeight,r=!0);break;default:this.parent.y!==(this.parent.screenHeight-this.parent.screenWorldHeight)/2&&(this.parent.y=(this.parent.screenHeight-this.parent.screenWorldHeight)/2,r=!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,r=!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,r=!0);r&&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 _C={minWidth:null,minHeight:null,maxWidth:null,maxHeight:null,minScale:null,maxScale:null};class vC extends ei{constructor(t,e={}){super(t),U(this,"options"),this.options=Object.assign({},_C,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 r=this.parent.scale.x;this.parent.fitWidth(this.options.minWidth,!1,!1,!0),this.parent.scale.y*=this.parent.scale.x/r,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 r=this.parent.scale.x;this.parent.fitWidth(this.options.maxWidth,!1,!1,!0),this.parent.scale.y*=this.parent.scale.x/r,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 r=this.parent.scale.y;this.parent.fitHeight(this.options.minHeight,!1,!1,!0),this.parent.scale.x*=this.parent.scale.y/r,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 r=this.parent.scale.y;this.parent.fitHeight(this.options.maxHeight,!1,!1,!0),this.parent.scale.x*=this.parent.scale.y/r,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 s=this.options.minScale;t.x=typeof s.x>"u"?null:s.x,t.y=typeof s.y>"u"?null:s.y}if(typeof this.options.maxScale=="number")e.x=this.options.maxScale,e.y=this.options.maxScale;else if(this.options.maxScale!==null){const s=this.options.maxScale;e.x=typeof s.x>"u"?null:s.x,e.y=typeof s.y>"u"?null:s.y}let r=this.parent.scale.x,n=this.parent.scale.y;t.x!==null&&r<t.x&&(r=t.x),e.x!==null&&r>e.x&&(r=e.x),t.y!==null&&n<t.y&&(n=t.y),e.y!==null&&n>e.y&&(n=e.y),(r!==this.parent.scale.x||n!==this.parent.scale.y)&&(this.parent.scale.set(r,n),this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"}))}}}reset(){this.clamp()}}const wC={friction:.98,bounce:.8,minSpeed:.01},Kr=16;class TC extends ei{constructor(t,e={}){super(t),U(this,"options"),U(this,"x"),U(this,"y"),U(this,"percentChangeX"),U(this,"percentChangeY"),U(this,"saved"),U(this,"timeSinceRelease"),this.options=Object.assign({},wC,e),this.saved=[],this.timeSinceRelease=0,this.reset(),this.parent.on("moved",r=>this.handleMoved(r))}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 r=t-e.time;this.x=(this.parent.x-e.x)/r,this.y=(this.parent.y-e.y)/r,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,r=this.timeSinceRelease,n=this.timeSinceRelease+t;if(this.x){const s=this.percentChangeX,o=Math.log(s);this.parent.x+=this.x*Kr/o*(Math.pow(s,n/Kr)-Math.pow(s,r/Kr)),this.x*=Math.pow(this.percentChangeX,t/Kr)}if(this.y){const s=this.percentChangeY,o=Math.log(s);this.parent.y+=this.y*Kr/o*(Math.pow(s,n/Kr)-Math.pow(s,r/Kr)),this.y*=Math.pow(this.percentChangeY,t/Kr)}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 SC={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 EC extends ei{constructor(t,e={}){super(t),U(this,"options"),U(this,"moved"),U(this,"reverse"),U(this,"xDirection"),U(this,"yDirection"),U(this,"keyIsPressed"),U(this,"mouse"),U(this,"underflowX"),U(this,"underflowY"),U(this,"last"),U(this,"current"),U(this,"windowEventHandlers",[]),this.options=Object.assign({},SC,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=n=>{t.includes(n.code)&&(this.keyIsPressed=!0)},r=n=>{t.includes(n.code)&&(this.keyIsPressed=!1)};this.addWindowEventHandler("keyup",r),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",r=this.parent.input.count();return!!((r===1||r>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,r=t.global.y,n=this.parent.input.count();if(n===1||n>1&&!this.parent.plugins.get("pinch",!0)){const s=e-this.last.x,o=r-this.last.y;if(this.moved||this.xDirection&&this.parent.input.checkThreshold(s)||this.yDirection&&this.parent.input.checkThreshold(o)){const a={x:e,y:r};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 dt(this.last.x,this.last.y),world:this.parent.toWorld(new dt(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 r=e[0];return r.last&&(this.last={x:r.last.x,y:r.last.y},this.current=r.id),this.moved=!1,!0}else if(this.last&&this.moved){const r=new dt(this.last.x,this.last.y);return this.parent.emit("drag-end",{event:t,screen:r,world:this.parent.toWorld(r),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 r=t.deltaMode?this.options.lineHeight:1,n=[t.deltaX,t.deltaY],[s,o]=this.options.wheelSwapAxes?n.reverse():n;return this.xDirection&&(this.parent.x+=s*r*this.options.wheelScroll*this.reverse),this.yDirection&&(this.parent.y+=o*r*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 CC={speed:0,acceleration:null,radius:null};class IC extends ei{constructor(t,e,r={}){super(t),U(this,"options"),U(this,"target"),U(this,"velocity"),this.target=e,this.options=Object.assign({},CC,r),this.velocity={x:0,y:0}}update(t){if(this.paused)return;const e=this.parent.center;let r=this.target.x,n=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);r=this.target.x-Math.cos(a)*this.options.radius,n=this.target.y-Math.sin(a)*this.options.radius}else return;const s=r-e.x,o=n-e.y;if(s||o)if(this.options.speed)if(this.options.acceleration){const a=Math.atan2(n-e.y,r-e.x),l=Math.sqrt(Math.pow(s,2)+Math.pow(o,2));if(l){const h=(Math.pow(this.velocity.x,2)+Math.pow(this.velocity.y,2))/(2*this.options.acceleration);l>h?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(s)?r:e.x+c,f=Math.abs(u)>Math.abs(o)?n:e.y+u;this.parent.moveCenter(d,f),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}else{const a=Math.atan2(n-e.y,r-e.x),l=Math.cos(a)*this.options.speed,h=Math.sin(a)*this.options.speed,c=Math.abs(l)>Math.abs(s)?r:e.x+l,u=Math.abs(h)>Math.abs(o)?n:e.y+h;this.parent.moveCenter(c,u),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}else this.parent.moveCenter(r,n),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}const AC={radius:null,distance:null,top:null,bottom:null,left:null,right:null,speed:8,reverse:!1,noDecelerate:!1,linear:!1,allowButtons:!1};class MC extends ei{constructor(t,e={}){super(t),U(this,"options"),U(this,"reverse"),U(this,"radiusSquared"),U(this,"left"),U(this,"top"),U(this,"right"),U(this,"bottom"),U(this,"horizontal"),U(this,"vertical"),this.options=Object.assign({},AC,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,r=t.global.y;if(this.radiusSquared){const n=this.parent.toScreen(this.parent.center);if(Math.pow(n.x-e,2)+Math.pow(n.y-r,2)>=this.radiusSquared){const s=Math.atan2(n.y-r,n.x-e);this.options.linear?(this.horizontal=Math.round(Math.cos(s))*this.options.speed*this.reverse*(60/1e3),this.vertical=Math.round(Math.sin(s))*this.options.speed*this.reverse*(60/1e3)):(this.horizontal=Math.cos(s)*this.options.speed*this.reverse*(60/1e3),this.vertical=Math.sin(s)*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&&r<this.top?this.vertical=Number(this.reverse)*this.options.speed*(60/1e3):this.bottom!==null&&r>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 RC={noDrag:!1,percent:1,center:null,factor:1,axis:"all"};class PC extends ei{constructor(t,e={}){super(t),U(this,"options"),U(this,"active",!1),U(this,"pinching",!1),U(this,"moved",!1),U(this,"lastCenter"),this.options=Object.assign({},RC,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,r=t.global.y,n=this.parent.input.touches;if(n.length>=2){const s=n[0],o=n[1],a=s.last&&o.last?Math.sqrt(Math.pow(o.last.x-s.last.x,2)+Math.pow(o.last.y-s.last.y,2)):null;if(s.id===t.pointerId?s.last={x:e,y:r,data:t}:o.id===t.pointerId&&(o.last={x:e,y:r,data:t}),a){let l;const h=new dt(s.last.x+(o.last.x-s.last.x)/2,s.last.y+(o.last.y-s.last.y)/2);this.options.center||(l=this.parent.toLocal(h));let c=Math.sqrt(Math.pow(o.last.x-s.last.x,2)+Math.pow(o.last.y-s.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:h});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(l);this.parent.x+=(h.x-f.x)*this.options.factor,this.parent.y+=(h.y-f.y)*this.options.factor,this.parent.emit("moved",{viewport:this.parent,type:"pinch"})}!this.options.noDrag&&this.lastCenter&&(this.parent.x+=(h.x-this.lastCenter.x)*this.options.factor,this.parent.y+=(h.y-this.lastCenter.y)*this.options.factor,this.parent.emit("moved",{viewport:this.parent,type:"pinch"})),this.lastCenter=h,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 LC={topLeft:!1,friction:.8,time:1e3,ease:"easeInOutSine",interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1};class GC extends ei{constructor(t,e,r,n={}){super(t),U(this,"options"),U(this,"ease"),U(this,"x"),U(this,"y"),U(this,"percent"),U(this,"snapping"),U(this,"deltaX"),U(this,"deltaY"),U(this,"startX"),U(this,"startY"),this.options=Object.assign({},LC,n),this.ease=Pl(n.ease,"easeInOutSine"),this.x=e,this.y=r,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 r,n,s;const o=this.startX,a=this.startY,l=this.deltaX,h=this.deltaY;if(e.time>this.options.time)r=!0,n=o+l,s=a+h;else{const c=this.ease(e.time,0,1,this.options.time);n=o+l*c,s=a+h*c}this.options.topLeft?this.parent.moveCorner(n,s):this.parent.moveCenter(n,s),this.parent.emit("moved",{viewport:this.parent,type:"snap"}),r&&(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 kC={width:0,height:0,time:1e3,ease:"easeInOutSine",center:null,interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1,noMove:!1};class FC extends ei{constructor(t,e={}){super(t),U(this,"options"),U(this,"ease"),U(this,"xScale"),U(this,"yScale"),U(this,"xIndependent"),U(this,"yIndependent"),U(this,"snapping"),this.options=Object.assign({},kC,e),this.ease=Pl(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,r=this.parent.screenWidth/this.xScale,n=this.parent.screenHeight/this.yScale;this.snapping={time:0,startX:t,startY:e,deltaX:r-t,deltaY:n-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 r=this.snapping;if(r.time+=t,r.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 s=this.snapping,o=this.ease(s.time,s.startX,s.deltaX,this.options.time),a=this.ease(s.time,s.startY,s.deltaY,this.options.time);this.parent.scale.x=this.parent.screenWidth/o,this.parent.scale.y=this.parent.screenHeight/a}const n=this.parent.plugins.get("clamp-zoom",!0);n&&n.clamp(),this.options.noMove||(this.options.center?this.parent.moveCenter(this.options.center):this.parent.moveCenter(e))}}resume(){this.snapping=null,super.resume()}}const DC={percent:.1,smooth:!1,interrupt:!0,reverse:!1,center:null,lineHeight:20,axis:"all",keyToPress:null,trackpadPinch:!1,wheelZoom:!0};class NC extends ei{constructor(t,e={}){super(t),U(this,"options"),U(this,"smoothing"),U(this,"smoothingCenter"),U(this,"smoothingCount"),U(this,"keyIsPressed"),this.options=Object.assign({},DC,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 r;this.options.center||(r=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 n=this.parent.plugins.get("clamp-zoom",!0);if(n&&n.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const s=this.parent.toGlobal(r);this.parent.x+=t.x-s.x,this.parent.y+=t.y-s.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),r=-t.deltaY*(t.deltaMode?this.options.lineHeight:1)/200,n=Math.pow(2,(1+this.options.percent)*r);let s;this.options.center||(s=this.parent.toLocal(e)),this.isAxisX()&&(this.parent.scale.x*=n),this.isAxisY()&&(this.parent.scale.y*=n),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(s);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),r=(this.options.reverse?-1:1)*-t.deltaY*(t.deltaMode?this.options.lineHeight:1)/500,n=Math.pow(2,(1+this.options.percent)*r);if(this.options.smooth){const s={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+s.x)*n-this.parent.scale.x)/this.options.smooth,y:((this.parent.scale.y+s.y)*n-this.parent.scale.y)/this.options.smooth},this.smoothingCount=0,this.smoothingCenter=e}else{let s;this.options.center||(s=this.parent.toLocal(e)),this.isAxisX()&&(this.parent.scale.x*=n),this.isAxisY()&&(this.parent.scale.y*=n),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(s);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 OC{constructor(t){U(this,"viewport"),U(this,"clickedAvailable"),U(this,"isMouseDown"),U(this,"last"),U(this,"wheelFunction"),U(this,"touches"),this.viewport=t,this.touches=[],this.addListeners()}addListeners(){this.viewport.interactive=!0,this.viewport.forceHitArea||(this.viewport.hitArea=new gt(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),r=this.viewport.plugins.get("bounce",!0);(!e||!e.isActive())&&(!r||!r.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 r=t.global.x-this.last.x,n=t.global.y-this.last.y;(this.checkThreshold(r)||this.checkThreshold(n))&&(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 dt;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 Mo=["drag","pinch","wheel","follow","mouse-edges","decelerate","animate","bounce","snap-zoom","clamp-zoom","snap","clamp"];class BC{constructor(t){U(this,"plugins"),U(this,"list"),U(this,"viewport"),this.viewport=t,this.list=[],this.plugins={}}add(t,e,r=Mo.length){const n=this.plugins[t];n&&n.destroy(),this.plugins[t]=e;const s=Mo.indexOf(t);s!==-1&&Mo.splice(s,1),Mo.splice(r,0,t),this.sort()}get(t,e){var r;return e&&(r=this.plugins[t])!=null&&r.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 Mo)this.plugins[t]&&this.list.push(this.plugins[t])}down(t){let e=!1;for(const r of this.list)r.down(t)&&(e=!0);return e}move(t){let e=!1;for(const r of this.viewport.plugins.list)r.move(t)&&(e=!0);return e}up(t){let e=!1;for(const r of this.list)r.up(t)&&(e=!0);return e}wheel(t){let e=!1;for(const r of this.list)r.wheel(t)&&(e=!0);return e}}const UC={screenWidth:window.innerWidth,screenHeight:window.innerHeight,worldWidth:null,worldHeight:null,threshold:5,passiveWheel:!0,stopPropagation:!1,forceHitArea:null,noTicker:!1,disableOnContextMenu:!1,ticker:Se.shared,allowPreserveDragOutside:!1};class XC extends Ct{constructor(t){super(),U(this,"moving"),U(this,"screenWidth"),U(this,"screenHeight"),U(this,"threshold"),U(this,"input"),U(this,"plugins"),U(this,"zooming"),U(this,"lastViewport"),U(this,"options"),U(this,"_dirty"),U(this,"_forceHitArea"),U(this,"_hitAreaDefault"),U(this,"_pause"),U(this,"tickerFunction"),U(this,"_worldWidth"),U(this,"_worldHeight"),U(this,"_disableOnContextMenu",e=>e.preventDefault()),this.options={...UC,...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 OC(this),this.plugins=new BC(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 gt(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,r,n){this.screenWidth=t,this.screenHeight=e,typeof r<"u"&&(this._worldWidth=r),typeof n<"u"&&(this._worldHeight=n),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 gt(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight)}toWorld(t,e){return arguments.length===2?this.toLocal(new dt(t,e)):this.toLocal(t)}toScreen(t,e){return arguments.length===2?this.toGlobal(new dt(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 dt(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,r;typeof t[0]=="number"?(e=t[0],r=t[1]):(e=t[0].x,r=t[0].y);const n=(this.worldScreenWidth/2-e)*this.scale.x,s=(this.worldScreenHeight/2-r)*this.scale.y;return(this.x!==n||this.y!==s)&&(this.position.set(n,s),this.plugins.reset(),this.dirty=!0),this}get corner(){return new dt(-this.x/this.scale.x,-this.y/this.scale.y)}set corner(t){this.moveCorner(t)}moveCorner(...t){let e,r;return t.length===1?(e=-t[0].x*this.scale.x,r=-t[0].y*this.scale.y):(e=-t[0]*this.scale.x,r=-t[1]*this.scale.y),(e!==this.x||r!==this.y)&&(this.position.set(e,r),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 r=this.screenWidth/t,n=this.screenHeight/e;return Math.min(r,n)}findCover(t,e){const r=this.screenWidth/t,n=this.screenHeight/e;return Math.max(r,n)}fitWidth(t=this.worldWidth,e,r=!0,n){let s;e&&(s=this.center),this.scale.x=this.screenWidth/t,r&&(this.scale.y=this.scale.x);const o=this.plugins.get("clamp-zoom",!0);return!n&&o&&o.clamp(),e&&s&&this.moveCenter(s),this}fitHeight(t=this.worldHeight,e,r=!0,n){let s;e&&(s=this.center),this.scale.y=this.screenHeight/t,r&&(this.scale.x=this.scale.y);const o=this.plugins.get("clamp-zoom",!0);return!n&&o&&o.clamp(),e&&s&&this.moveCenter(s),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 r=this.plugins.get("clamp-zoom",!0);return r&&r.clamp(),t&&e&&this.moveCenter(e),this}fit(t,e=this.worldWidth,r=this.worldHeight){let n;t&&(n=this.center),this.scale.x=this.screenWidth/e,this.scale.y=this.screenHeight/r,this.scale.x<this.scale.y?this.scale.y=this.scale.x:this.scale.x=this.scale.y;const s=this.plugins.get("clamp-zoom",!0);return s&&s.clamp(),t&&n&&this.moveCenter(n),this}setZoom(t,e){let r;e&&(r=this.center),this.scale.set(t);const n=this.plugins.get("clamp-zoom",!0);return n&&n.clamp(),e&&r&&this.moveCenter(r),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 FC(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 dt(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 gt(0,0,this.worldWidth,this.worldHeight))}drag(t){return this.plugins.add("drag",new EC(this,t)),this}clamp(t){return this.plugins.add("clamp",new xC(this,t)),this}decelerate(t){return this.plugins.add("decelerate",new TC(this,t)),this}bounce(t){return this.plugins.add("bounce",new yC(this,t)),this}pinch(t){return this.plugins.add("pinch",new PC(this,t)),this}snap(t,e,r){return this.plugins.add("snap",new GC(this,t,e,r)),this}follow(t,e){return this.plugins.add("follow",new IC(this,t,e)),this}wheel(t){return this.plugins.add("wheel",new NC(this,t)),this}animate(t){return this.plugins.add("animate",new mC(this,t)),this}clampZoom(t){return this.plugins.add("clamp-zoom",new vC(this,t)),this}mouseEdges(t){return this.plugins.add("mouse-edges",new MC(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,r,n,s){s&&(r>this.worldScreenWidth||n>this.worldScreenHeight)&&(this.fit(!0,r,n),this.emit("zoomed",{viewport:this,type:"ensureVisible"}));let o=!1;t<this.left?(this.left=t,o=!0):t+r>this.right&&(this.right=t+r,o=!0),e<this.top?(this.top=e,o=!0):e+n>this.bottom&&(this.bottom=e+n,o=!0),o&&this.emit("moved",{viewport:this,type:"ensureVisible"})}}function Ll(i,t){return i==null||t==null?NaN:i<t?-1:i>t?1:i>=t?0:NaN}function WC(i,t){return i==null||t==null?NaN:t<i?-1:t>i?1:t>=i?0:NaN}function cd(i){let t,e,r;i.length!==2?(t=Ll,e=(a,l)=>Ll(i(a),l),r=(a,l)=>i(a)-l):(t=i===Ll||i===WC?i:ZC,e=i,r=i);function n(a,l,h=0,c=a.length){if(h<c){if(t(l,l)!==0)return c;do{const u=h+c>>>1;e(a[u],l)<0?h=u+1:c=u}while(h<c)}return h}function s(a,l,h=0,c=a.length){if(h<c){if(t(l,l)!==0)return c;do{const u=h+c>>>1;e(a[u],l)<=0?h=u+1:c=u}while(h<c)}return h}function o(a,l,h=0,c=a.length){const u=n(a,l,h,c-1);return u>h&&r(a[u-1],l)>-r(a[u],l)?u-1:u}return{left:n,center:o,right:s}}function ZC(){return 0}function VC(i){return i===null?NaN:+i}const HC=cd(Ll).right;cd(VC).center;const KC=Math.sqrt(50),zC=Math.sqrt(10),YC=Math.sqrt(2);function Gl(i,t,e){const r=(t-i)/Math.max(0,e),n=Math.floor(Math.log10(r)),s=r/Math.pow(10,n),o=s>=KC?10:s>=zC?5:s>=YC?2:1;let a,l,h;return n<0?(h=Math.pow(10,-n)/o,a=Math.round(i*h),l=Math.round(t*h),a/h<i&&++a,l/h>t&&--l,h=-h):(h=Math.pow(10,n)*o,a=Math.round(i/h),l=Math.round(t/h),a*h<i&&++a,l*h>t&&--l),l<a&&.5<=e&&e<2?Gl(i,t,e*2):[a,l,h]}function jC(i,t,e){if(t=+t,i=+i,e=+e,!(e>0))return[];if(i===t)return[i];const r=t<i,[n,s,o]=r?Gl(t,i,e):Gl(i,t,e);if(!(s>=n))return[];const a=s-n+1,l=new Array(a);if(r)if(o<0)for(let h=0;h<a;++h)l[h]=(s-h)/-o;else for(let h=0;h<a;++h)l[h]=(s-h)*o;else if(o<0)for(let h=0;h<a;++h)l[h]=(n+h)/-o;else for(let h=0;h<a;++h)l[h]=(n+h)*o;return l}function ud(i,t,e){return t=+t,i=+i,e=+e,Gl(i,t,e)[2]}function dd(i,t,e){t=+t,i=+i,e=+e;const r=t<i,n=r?ud(t,i,e):ud(i,t,e);return(r?-1:1)*(n<0?1/-n:n)}function fd(i,t,e){i.prototype=t.prototype=e,e.constructor=i}function Ey(i,t){var e=Object.create(i.prototype);for(var r in t)e[r]=t[r];return e}function Ro(){}var Po=.7,kl=1/Po,Ss="\\s*([+-]?\\d+)\\s*",Lo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Bi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",JC=/^#([0-9a-f]{3,8})$/,$C=new RegExp(`^rgb\\(${Ss},${Ss},${Ss}\\)$`),QC=new RegExp(`^rgb\\(${Bi},${Bi},${Bi}\\)$`),qC=new RegExp(`^rgba\\(${Ss},${Ss},${Ss},${Lo}\\)$`),tI=new RegExp(`^rgba\\(${Bi},${Bi},${Bi},${Lo}\\)$`),eI=new RegExp(`^hsl\\(${Lo},${Bi},${Bi}\\)$`),iI=new RegExp(`^hsla\\(${Lo},${Bi},${Bi},${Lo}\\)$`),Cy={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};fd(Ro,Go,{copy(i){return Object.assign(new this.constructor,this,i)},displayable(){return this.rgb().displayable()},hex:Iy,formatHex:Iy,formatHex8:rI,formatHsl:nI,formatRgb:Ay,toString:Ay});function Iy(){return this.rgb().formatHex()}function rI(){return this.rgb().formatHex8()}function nI(){return Gy(this).formatHsl()}function Ay(){return this.rgb().formatRgb()}function Go(i){var t,e;return i=(i+"").trim().toLowerCase(),(t=JC.exec(i))?(e=t[1].length,t=parseInt(t[1],16),e===6?My(t):e===3?new Ge(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):e===8?Fl(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):e===4?Fl(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=$C.exec(i))?new Ge(t[1],t[2],t[3],1):(t=QC.exec(i))?new Ge(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=qC.exec(i))?Fl(t[1],t[2],t[3],t[4]):(t=tI.exec(i))?Fl(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=eI.exec(i))?Ly(t[1],t[2]/100,t[3]/100,1):(t=iI.exec(i))?Ly(t[1],t[2]/100,t[3]/100,t[4]):Cy.hasOwnProperty(i)?My(Cy[i]):i==="transparent"?new Ge(NaN,NaN,NaN,0):null}function My(i){return new Ge(i>>16&255,i>>8&255,i&255,1)}function Fl(i,t,e,r){return r<=0&&(i=t=e=NaN),new Ge(i,t,e,r)}function sI(i){return i instanceof Ro||(i=Go(i)),i?(i=i.rgb(),new Ge(i.r,i.g,i.b,i.opacity)):new Ge}function pd(i,t,e,r){return arguments.length===1?sI(i):new Ge(i,t,e,r??1)}function Ge(i,t,e,r){this.r=+i,this.g=+t,this.b=+e,this.opacity=+r}fd(Ge,pd,Ey(Ro,{brighter(i){return i=i==null?kl:Math.pow(kl,i),new Ge(this.r*i,this.g*i,this.b*i,this.opacity)},darker(i){return i=i==null?Po:Math.pow(Po,i),new Ge(this.r*i,this.g*i,this.b*i,this.opacity)},rgb(){return this},clamp(){return new Ge(Gn(this.r),Gn(this.g),Gn(this.b),Dl(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:Ry,formatHex:Ry,formatHex8:oI,formatRgb:Py,toString:Py}));function Ry(){return`#${kn(this.r)}${kn(this.g)}${kn(this.b)}`}function oI(){return`#${kn(this.r)}${kn(this.g)}${kn(this.b)}${kn((isNaN(this.opacity)?1:this.opacity)*255)}`}function Py(){const i=Dl(this.opacity);return`${i===1?"rgb(":"rgba("}${Gn(this.r)}, ${Gn(this.g)}, ${Gn(this.b)}${i===1?")":`, ${i})`}`}function Dl(i){return isNaN(i)?1:Math.max(0,Math.min(1,i))}function Gn(i){return Math.max(0,Math.min(255,Math.round(i)||0))}function kn(i){return i=Gn(i),(i<16?"0":"")+i.toString(16)}function Ly(i,t,e,r){return r<=0?i=t=e=NaN:e<=0||e>=1?i=t=NaN:t<=0&&(i=NaN),new mi(i,t,e,r)}function Gy(i){if(i instanceof mi)return new mi(i.h,i.s,i.l,i.opacity);if(i instanceof Ro||(i=Go(i)),!i)return new mi;if(i instanceof mi)return i;i=i.rgb();var t=i.r/255,e=i.g/255,r=i.b/255,n=Math.min(t,e,r),s=Math.max(t,e,r),o=NaN,a=s-n,l=(s+n)/2;return a?(t===s?o=(e-r)/a+(e<r)*6:e===s?o=(r-t)/a+2:o=(t-e)/a+4,a/=l<.5?s+n:2-s-n,o*=60):a=l>0&&l<1?0:o,new mi(o,a,l,i.opacity)}function aI(i,t,e,r){return arguments.length===1?Gy(i):new mi(i,t,e,r??1)}function mi(i,t,e,r){this.h=+i,this.s=+t,this.l=+e,this.opacity=+r}fd(mi,aI,Ey(Ro,{brighter(i){return i=i==null?kl:Math.pow(kl,i),new mi(this.h,this.s,this.l*i,this.opacity)},darker(i){return i=i==null?Po:Math.pow(Po,i),new mi(this.h,this.s,this.l*i,this.opacity)},rgb(){var i=this.h%360+(this.h<0)*360,t=isNaN(i)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*t,n=2*e-r;return new Ge(md(i>=240?i-240:i+120,n,r),md(i,n,r),md(i<120?i+240:i-120,n,r),this.opacity)},clamp(){return new mi(ky(this.h),Nl(this.s),Nl(this.l),Dl(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 i=Dl(this.opacity);return`${i===1?"hsl(":"hsla("}${ky(this.h)}, ${Nl(this.s)*100}%, ${Nl(this.l)*100}%${i===1?")":`, ${i})`}`}}));function ky(i){return i=(i||0)%360,i<0?i+360:i}function Nl(i){return Math.max(0,Math.min(1,i||0))}function md(i,t,e){return(i<60?t+(e-t)*i/60:i<180?e:i<240?t+(e-t)*(240-i)/60:t)*255}const gd=i=>()=>i;function lI(i,t){return function(e){return i+e*t}}function hI(i,t,e){return i=Math.pow(i,e),t=Math.pow(t,e)-i,e=1/e,function(r){return Math.pow(i+r*t,e)}}function cI(i){return(i=+i)==1?Fy:function(t,e){return e-t?hI(t,e,i):gd(isNaN(t)?e:t)}}function Fy(i,t){var e=t-i;return e?lI(i,e):gd(isNaN(i)?t:i)}const Dy=function i(t){var e=cI(t);function r(n,s){var o=e((n=pd(n)).r,(s=pd(s)).r),a=e(n.g,s.g),l=e(n.b,s.b),h=Fy(n.opacity,s.opacity);return function(c){return n.r=o(c),n.g=a(c),n.b=l(c),n.opacity=h(c),n+""}}return r.gamma=i,r}(1);function uI(i,t){t||(t=[]);var e=i?Math.min(t.length,i.length):0,r=t.slice(),n;return function(s){for(n=0;n<e;++n)r[n]=i[n]*(1-s)+t[n]*s;return r}}function dI(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function fI(i,t){var e=t?t.length:0,r=i?Math.min(e,i.length):0,n=new Array(r),s=new Array(e),o;for(o=0;o<r;++o)n[o]=xd(i[o],t[o]);for(;o<e;++o)s[o]=t[o];return function(a){for(o=0;o<r;++o)s[o]=n[o](a);return s}}function pI(i,t){var e=new Date;return i=+i,t=+t,function(r){return e.setTime(i*(1-r)+t*r),e}}function Ol(i,t){return i=+i,t=+t,function(e){return i*(1-e)+t*e}}function mI(i,t){var e={},r={},n;(i===null||typeof i!="object")&&(i={}),(t===null||typeof t!="object")&&(t={});for(n in t)n in i?e[n]=xd(i[n],t[n]):r[n]=t[n];return function(s){for(n in e)r[n]=e[n](s);return r}}var yd=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,bd=new RegExp(yd.source,"g");function gI(i){return function(){return i}}function yI(i){return function(t){return i(t)+""}}function bI(i,t){var e=yd.lastIndex=bd.lastIndex=0,r,n,s,o=-1,a=[],l=[];for(i=i+"",t=t+"";(r=yd.exec(i))&&(n=bd.exec(t));)(s=n.index)>e&&(s=t.slice(e,s),a[o]?a[o]+=s:a[++o]=s),(r=r[0])===(n=n[0])?a[o]?a[o]+=n:a[++o]=n:(a[++o]=null,l.push({i:o,x:Ol(r,n)})),e=bd.lastIndex;return e<t.length&&(s=t.slice(e),a[o]?a[o]+=s:a[++o]=s),a.length<2?l[0]?yI(l[0].x):gI(t):(t=l.length,function(h){for(var c=0,u;c<t;++c)a[(u=l[c]).i]=u.x(h);return a.join("")})}function xd(i,t){var e=typeof t,r;return t==null||e==="boolean"?gd(t):(e==="number"?Ol:e==="string"?(r=Go(t))?(t=r,Dy):bI:t instanceof Go?Dy:t instanceof Date?pI:dI(t)?uI:Array.isArray(t)?fI:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?mI:Ol)(i,t)}function xI(i,t){return i=+i,t=+t,function(e){return Math.round(i*(1-e)+t*e)}}function _I(i){return Math.abs(i=Math.round(i))>=1e21?i.toLocaleString("en").replace(/,/g,""):i.toString(10)}function Bl(i,t){if((e=(i=t?i.toExponential(t-1):i.toExponential()).indexOf("e"))<0)return null;var e,r=i.slice(0,e);return[r.length>1?r[0]+r.slice(2):r,+i.slice(e+1)]}function Es(i){return i=Bl(Math.abs(i)),i?i[1]:NaN}function vI(i,t){return function(e,r){for(var n=e.length,s=[],o=0,a=i[0],l=0;n>0&&a>0&&(l+a+1>r&&(a=Math.max(1,r-l)),s.push(e.substring(n-=a,n+a)),!((l+=a+1)>r));)a=i[o=(o+1)%i.length];return s.reverse().join(t)}}function wI(i){return function(t){return t.replace(/[0-9]/g,function(e){return i[+e]})}}var TI=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Ul(i){if(!(t=TI.exec(i)))throw new Error("invalid format: "+i);var t;return new _d({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]})}Ul.prototype=_d.prototype;function _d(i){this.fill=i.fill===void 0?" ":i.fill+"",this.align=i.align===void 0?">":i.align+"",this.sign=i.sign===void 0?"-":i.sign+"",this.symbol=i.symbol===void 0?"":i.symbol+"",this.zero=!!i.zero,this.width=i.width===void 0?void 0:+i.width,this.comma=!!i.comma,this.precision=i.precision===void 0?void 0:+i.precision,this.trim=!!i.trim,this.type=i.type===void 0?"":i.type+""}_d.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 SI(i){t:for(var t=i.length,e=1,r=-1,n;e<t;++e)switch(i[e]){case".":r=n=e;break;case"0":r===0&&(r=e),n=e;break;default:if(!+i[e])break t;r>0&&(r=0);break}return r>0?i.slice(0,r)+i.slice(n+1):i}var Ny;function EI(i,t){var e=Bl(i,t);if(!e)return i+"";var r=e[0],n=e[1],s=n-(Ny=Math.max(-8,Math.min(8,Math.floor(n/3)))*3)+1,o=r.length;return s===o?r:s>o?r+new Array(s-o+1).join("0"):s>0?r.slice(0,s)+"."+r.slice(s):"0."+new Array(1-s).join("0")+Bl(i,Math.max(0,t+s-1))[0]}function Oy(i,t){var e=Bl(i,t);if(!e)return i+"";var r=e[0],n=e[1];return n<0?"0."+new Array(-n).join("0")+r:r.length>n+1?r.slice(0,n+1)+"."+r.slice(n+1):r+new Array(n-r.length+2).join("0")}const By={"%":(i,t)=>(i*100).toFixed(t),b:i=>Math.round(i).toString(2),c:i=>i+"",d:_I,e:(i,t)=>i.toExponential(t),f:(i,t)=>i.toFixed(t),g:(i,t)=>i.toPrecision(t),o:i=>Math.round(i).toString(8),p:(i,t)=>Oy(i*100,t),r:Oy,s:EI,X:i=>Math.round(i).toString(16).toUpperCase(),x:i=>Math.round(i).toString(16)};function Uy(i){return i}var Xy=Array.prototype.map,Wy=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function CI(i){var t=i.grouping===void 0||i.thousands===void 0?Uy:vI(Xy.call(i.grouping,Number),i.thousands+""),e=i.currency===void 0?"":i.currency[0]+"",r=i.currency===void 0?"":i.currency[1]+"",n=i.decimal===void 0?".":i.decimal+"",s=i.numerals===void 0?Uy:wI(Xy.call(i.numerals,String)),o=i.percent===void 0?"%":i.percent+"",a=i.minus===void 0?"−":i.minus+"",l=i.nan===void 0?"NaN":i.nan+"";function h(u){u=Ul(u);var d=u.fill,f=u.align,p=u.sign,m=u.symbol,g=u.zero,y=u.width,x=u.comma,b=u.precision,v=u.trim,w=u.type;w==="n"?(x=!0,w="g"):By[w]||(b===void 0&&(b=12),v=!0,w="g"),(g||d==="0"&&f==="=")&&(g=!0,d="0",f="=");var S=m==="$"?e:m==="#"&&/[boxX]/.test(w)?"0"+w.toLowerCase():"",C=m==="$"?r:/[%p]/.test(w)?o:"",I=By[w],M=/[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 L(G){var F=S,A=C,N,Z,K;if(w==="c")A=I(G)+A,G="";else{G=+G;var H=G<0||1/G<0;if(G=isNaN(G)?l:I(Math.abs(G),b),v&&(G=SI(G)),H&&+G==0&&p!=="+"&&(H=!1),F=(H?p==="("?p:a:p==="-"||p==="("?"":p)+F,A=(w==="s"?Wy[8+Ny/3]:"")+A+(H&&p==="("?")":""),M){for(N=-1,Z=G.length;++N<Z;)if(K=G.charCodeAt(N),48>K||K>57){A=(K===46?n+G.slice(N+1):G.slice(N))+A,G=G.slice(0,N);break}}}x&&!g&&(G=t(G,1/0));var j=F.length+G.length+A.length,B=j<y?new Array(y-j+1).join(d):"";switch(x&&g&&(G=t(B+G,B.length?y-A.length:1/0),B=""),f){case"<":G=F+G+A+B;break;case"=":G=F+B+G+A;break;case"^":G=B.slice(0,j=B.length>>1)+F+G+A+B.slice(j);break;default:G=B+F+G+A;break}return s(G)}return L.toString=function(){return u+""},L}function c(u,d){var f=h((u=Ul(u),u.type="f",u)),p=Math.max(-8,Math.min(8,Math.floor(Es(d)/3)))*3,m=Math.pow(10,-p),g=Wy[8+p/3];return function(y){return f(m*y)+g}}return{format:h,formatPrefix:c}}var Xl,Zy,Vy;II({thousands:",",grouping:[3],currency:["$",""]});function II(i){return Xl=CI(i),Zy=Xl.format,Vy=Xl.formatPrefix,Xl}function AI(i){return Math.max(0,-Es(Math.abs(i)))}function MI(i,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Es(t)/3)))*3-Es(Math.abs(i)))}function RI(i,t){return i=Math.abs(i),t=Math.abs(t)-i,Math.max(0,Es(t)-Es(i))+1}function Hy(i,t){switch(arguments.length){case 0:break;case 1:this.range(i);break;default:this.range(t).domain(i);break}return this}function PI(i){return function(){return i}}function LI(i){return+i}var Ky=[0,1];function Cs(i){return i}function vd(i,t){return(t-=i=+i)?function(e){return(e-i)/t}:PI(isNaN(t)?NaN:.5)}function GI(i,t){var e;return i>t&&(e=i,i=t,t=e),function(r){return Math.max(i,Math.min(t,r))}}function kI(i,t,e){var r=i[0],n=i[1],s=t[0],o=t[1];return n<r?(r=vd(n,r),s=e(o,s)):(r=vd(r,n),s=e(s,o)),function(a){return s(r(a))}}function FI(i,t,e){var r=Math.min(i.length,t.length)-1,n=new Array(r),s=new Array(r),o=-1;for(i[r]<i[0]&&(i=i.slice().reverse(),t=t.slice().reverse());++o<r;)n[o]=vd(i[o],i[o+1]),s[o]=e(t[o],t[o+1]);return function(a){var l=HC(i,a,1,r)-1;return s[l](n[l](a))}}function zy(i,t){return t.domain(i.domain()).range(i.range()).interpolate(i.interpolate()).clamp(i.clamp()).unknown(i.unknown())}function DI(){var i=Ky,t=Ky,e=xd,r,n,s,o=Cs,a,l,h;function c(){var d=Math.min(i.length,t.length);return o!==Cs&&(o=GI(i[0],i[d-1])),a=d>2?FI:kI,l=h=null,u}function u(d){return d==null||isNaN(d=+d)?s:(l||(l=a(i.map(r),t,e)))(r(o(d)))}return u.invert=function(d){return o(n((h||(h=a(t,i.map(r),Ol)))(d)))},u.domain=function(d){return arguments.length?(i=Array.from(d,LI),c()):i.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=xI,c()},u.clamp=function(d){return arguments.length?(o=d?!0:Cs,c()):o!==Cs},u.interpolate=function(d){return arguments.length?(e=d,c()):e},u.unknown=function(d){return arguments.length?(s=d,u):s},function(d,f){return r=d,n=f,c()}}function Yy(){return DI()(Cs,Cs)}function NI(i,t,e,r){var n=dd(i,t,e),s;switch(r=Ul(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(i),Math.abs(t));return r.precision==null&&!isNaN(s=MI(n,o))&&(r.precision=s),Vy(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(s=RI(n,Math.max(Math.abs(i),Math.abs(t))))&&(r.precision=s-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(s=AI(n))&&(r.precision=s-(r.type==="%")*2);break}}return Zy(r)}function OI(i){var t=i.domain;return i.ticks=function(e){var r=t();return jC(r[0],r[r.length-1],e??10)},i.tickFormat=function(e,r){var n=t();return NI(n[0],n[n.length-1],e??10,r)},i.nice=function(e){e==null&&(e=10);var r=t(),n=0,s=r.length-1,o=r[n],a=r[s],l,h,c=10;for(a<o&&(h=o,o=a,a=h,h=n,n=s,s=h);c-- >0;){if(h=ud(o,a,e),h===l)return r[n]=o,r[s]=a,t(r);if(h>0)o=Math.floor(o/h)*h,a=Math.ceil(a/h)*h;else if(h<0)o=Math.ceil(o*h)/h,a=Math.floor(a*h)/h;else break;l=h}return i},i}function jy(){var i=Yy();return i.copy=function(){return zy(i,jy())},Hy.apply(i,arguments),OI(i)}function BI(i,t){i=i.slice();var e=0,r=i.length-1,n=i[e],s=i[r],o;return s<n&&(o=e,e=r,r=o,o=n,n=s,s=o),i[e]=t.floor(n),i[r]=t.ceil(s),i}const wd=new Date,Td=new Date;function se(i,t,e,r){function n(s){return i(s=arguments.length===0?new Date:new Date(+s)),s}return n.floor=s=>(i(s=new Date(+s)),s),n.ceil=s=>(i(s=new Date(s-1)),t(s,1),i(s),s),n.round=s=>{const o=n(s),a=n.ceil(s);return s-o<a-s?o:a},n.offset=(s,o)=>(t(s=new Date(+s),o==null?1:Math.floor(o)),s),n.range=(s,o,a)=>{const l=[];if(s=n.ceil(s),a=a==null?1:Math.floor(a),!(s<o)||!(a>0))return l;let h;do l.push(h=new Date(+s)),t(s,a),i(s);while(h<s&&s<o);return l},n.filter=s=>se(o=>{if(o>=o)for(;i(o),!s(o);)o.setTime(o-1)},(o,a)=>{if(o>=o)if(a<0)for(;++a<=0;)for(;t(o,-1),!s(o););else for(;--a>=0;)for(;t(o,1),!s(o););}),e&&(n.count=(s,o)=>(wd.setTime(+s),Td.setTime(+o),i(wd),i(Td),Math.floor(e(wd,Td))),n.every=s=>(s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?n.filter(r?o=>r(o)%s===0:o=>n.count(0,o)%s===0):n)),n}const Wl=se(()=>{},(i,t)=>{i.setTime(+i+t)},(i,t)=>t-i);Wl.every=i=>(i=Math.floor(i),!isFinite(i)||!(i>0)?null:i>1?se(t=>{t.setTime(Math.floor(t/i)*i)},(t,e)=>{t.setTime(+t+e*i)},(t,e)=>(e-t)/i):Wl),Wl.range;const ur=1e3,ii=ur*60,dr=ii*60,fr=dr*24,Sd=fr*7,Jy=fr*30,Ed=fr*365,Is=se(i=>{i.setTime(i-i.getMilliseconds())},(i,t)=>{i.setTime(+i+t*ur)},(i,t)=>(t-i)/ur,i=>i.getUTCSeconds());Is.range;const Cd=se(i=>{i.setTime(i-i.getMilliseconds()-i.getSeconds()*ur)},(i,t)=>{i.setTime(+i+t*ii)},(i,t)=>(t-i)/ii,i=>i.getMinutes());Cd.range,se(i=>{i.setUTCSeconds(0,0)},(i,t)=>{i.setTime(+i+t*ii)},(i,t)=>(t-i)/ii,i=>i.getUTCMinutes()).range;const Id=se(i=>{i.setTime(i-i.getMilliseconds()-i.getSeconds()*ur-i.getMinutes()*ii)},(i,t)=>{i.setTime(+i+t*dr)},(i,t)=>(t-i)/dr,i=>i.getHours());Id.range,se(i=>{i.setUTCMinutes(0,0,0)},(i,t)=>{i.setTime(+i+t*dr)},(i,t)=>(t-i)/dr,i=>i.getUTCHours()).range;const ko=se(i=>i.setHours(0,0,0,0),(i,t)=>i.setDate(i.getDate()+t),(i,t)=>(t-i-(t.getTimezoneOffset()-i.getTimezoneOffset())*ii)/fr,i=>i.getDate()-1);ko.range;const Ad=se(i=>{i.setUTCHours(0,0,0,0)},(i,t)=>{i.setUTCDate(i.getUTCDate()+t)},(i,t)=>(t-i)/fr,i=>i.getUTCDate()-1);Ad.range,se(i=>{i.setUTCHours(0,0,0,0)},(i,t)=>{i.setUTCDate(i.getUTCDate()+t)},(i,t)=>(t-i)/fr,i=>Math.floor(i/fr)).range;function Fn(i){return se(t=>{t.setDate(t.getDate()-(t.getDay()+7-i)%7),t.setHours(0,0,0,0)},(t,e)=>{t.setDate(t.getDate()+e*7)},(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*ii)/Sd)}const Zl=Fn(0),Vl=Fn(1),UI=Fn(2),XI=Fn(3),As=Fn(4),WI=Fn(5),ZI=Fn(6);Zl.range,Vl.range,UI.range,XI.range,As.range,WI.range,ZI.range;function Dn(i){return se(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-i)%7),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e*7)},(t,e)=>(e-t)/Sd)}const $y=Dn(0),Hl=Dn(1),VI=Dn(2),HI=Dn(3),Ms=Dn(4),KI=Dn(5),zI=Dn(6);$y.range,Hl.range,VI.range,HI.range,Ms.range,KI.range,zI.range;const Md=se(i=>{i.setDate(1),i.setHours(0,0,0,0)},(i,t)=>{i.setMonth(i.getMonth()+t)},(i,t)=>t.getMonth()-i.getMonth()+(t.getFullYear()-i.getFullYear())*12,i=>i.getMonth());Md.range,se(i=>{i.setUTCDate(1),i.setUTCHours(0,0,0,0)},(i,t)=>{i.setUTCMonth(i.getUTCMonth()+t)},(i,t)=>t.getUTCMonth()-i.getUTCMonth()+(t.getUTCFullYear()-i.getUTCFullYear())*12,i=>i.getUTCMonth()).range;const pr=se(i=>{i.setMonth(0,1),i.setHours(0,0,0,0)},(i,t)=>{i.setFullYear(i.getFullYear()+t)},(i,t)=>t.getFullYear()-i.getFullYear(),i=>i.getFullYear());pr.every=i=>!isFinite(i=Math.floor(i))||!(i>0)?null:se(t=>{t.setFullYear(Math.floor(t.getFullYear()/i)*i),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e*i)}),pr.range;const Nn=se(i=>{i.setUTCMonth(0,1),i.setUTCHours(0,0,0,0)},(i,t)=>{i.setUTCFullYear(i.getUTCFullYear()+t)},(i,t)=>t.getUTCFullYear()-i.getUTCFullYear(),i=>i.getUTCFullYear());Nn.every=i=>!isFinite(i=Math.floor(i))||!(i>0)?null:se(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/i)*i),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e*i)}),Nn.range;function YI(i,t,e,r,n,s){const o=[[Is,1,ur],[Is,5,5*ur],[Is,15,15*ur],[Is,30,30*ur],[s,1,ii],[s,5,5*ii],[s,15,15*ii],[s,30,30*ii],[n,1,dr],[n,3,3*dr],[n,6,6*dr],[n,12,12*dr],[r,1,fr],[r,2,2*fr],[e,1,Sd],[t,1,Jy],[t,3,3*Jy],[i,1,Ed]];function a(h,c,u){const d=c<h;d&&([h,c]=[c,h]);const f=u&&typeof u.range=="function"?u:l(h,c,u),p=f?f.range(h,+c+1):[];return d?p.reverse():p}function l(h,c,u){const d=Math.abs(c-h)/u,f=cd(([,,g])=>g).right(o,d);if(f===o.length)return i.every(dd(h/Ed,c/Ed,u));if(f===0)return Wl.every(Math.max(dd(h,c,u),1));const[p,m]=o[d/o[f-1][2]<o[f][2]/d?f-1:f];return p.every(m)}return[a,l]}const[jI,JI]=YI(pr,Md,Zl,ko,Id,Cd);function Rd(i){if(0<=i.y&&i.y<100){var t=new Date(-1,i.m,i.d,i.H,i.M,i.S,i.L);return t.setFullYear(i.y),t}return new Date(i.y,i.m,i.d,i.H,i.M,i.S,i.L)}function Pd(i){if(0<=i.y&&i.y<100){var t=new Date(Date.UTC(-1,i.m,i.d,i.H,i.M,i.S,i.L));return t.setUTCFullYear(i.y),t}return new Date(Date.UTC(i.y,i.m,i.d,i.H,i.M,i.S,i.L))}function Fo(i,t,e){return{y:i,m:t,d:e,H:0,M:0,S:0,L:0}}function $I(i){var t=i.dateTime,e=i.date,r=i.time,n=i.periods,s=i.days,o=i.shortDays,a=i.months,l=i.shortMonths,h=Do(n),c=No(n),u=Do(s),d=No(s),f=Do(o),p=No(o),m=Do(a),g=No(a),y=Do(l),x=No(l),b={a:H,A:j,b:B,B:D,c:null,d:rb,e:rb,f:_A,g:RA,G:LA,H:yA,I:bA,j:xA,L:nb,m:vA,M:wA,p:k,q:V,Q:cb,s:ub,S:TA,u:SA,U:EA,V:CA,w:IA,W:AA,x:null,X:null,y:MA,Y:PA,Z:GA,"%":hb},v={a:et,A:ft,b:at,B:Tt,c:null,d:ob,e:ob,f:NA,g:zA,G:jA,H:kA,I:FA,j:DA,L:ab,m:OA,M:BA,p:It,q:Q,Q:cb,s:ub,S:UA,u:XA,U:WA,V:ZA,w:VA,W:HA,x:null,X:null,y:KA,Y:YA,Z:JA,"%":hb},w={a:L,A:G,b:F,B:A,c:N,d:eb,e:eb,f:fA,g:tb,G:qy,H:ib,I:ib,j:hA,L:dA,m:lA,M:cA,p:M,q:aA,Q:mA,s:gA,S:uA,u:iA,U:rA,V:nA,w:eA,W:sA,x:Z,X:K,y:tb,Y:qy,Z:oA,"%":pA};b.x=S(e,b),b.X=S(r,b),b.c=S(t,b),v.x=S(e,v),v.X=S(r,v),v.c=S(t,v);function S(W,J){return function($){var O=[],pt=-1,yt=0,Rt=W.length,Bt,Fe,Ve;for($ instanceof Date||($=new Date(+$));++pt<Rt;)W.charCodeAt(pt)===37&&(O.push(W.slice(yt,pt)),(Fe=Qy[Bt=W.charAt(++pt)])!=null?Bt=W.charAt(++pt):Fe=Bt==="e"?" ":"0",(Ve=J[Bt])&&(Bt=Ve($,Fe)),O.push(Bt),yt=pt+1);return O.push(W.slice(yt,pt)),O.join("")}}function C(W,J){return function($){var O=Fo(1900,void 0,1),pt=I(O,W,$+="",0),yt,Rt;if(pt!=$.length)return null;if("Q"in O)return new Date(O.Q);if("s"in O)return new Date(O.s*1e3+("L"in O?O.L:0));if(J&&!("Z"in O)&&(O.Z=0),"p"in O&&(O.H=O.H%12+O.p*12),O.m===void 0&&(O.m="q"in O?O.q:0),"V"in O){if(O.V<1||O.V>53)return null;"w"in O||(O.w=1),"Z"in O?(yt=Pd(Fo(O.y,0,1)),Rt=yt.getUTCDay(),yt=Rt>4||Rt===0?Hl.ceil(yt):Hl(yt),yt=Ad.offset(yt,(O.V-1)*7),O.y=yt.getUTCFullYear(),O.m=yt.getUTCMonth(),O.d=yt.getUTCDate()+(O.w+6)%7):(yt=Rd(Fo(O.y,0,1)),Rt=yt.getDay(),yt=Rt>4||Rt===0?Vl.ceil(yt):Vl(yt),yt=ko.offset(yt,(O.V-1)*7),O.y=yt.getFullYear(),O.m=yt.getMonth(),O.d=yt.getDate()+(O.w+6)%7)}else("W"in O||"U"in O)&&("w"in O||(O.w="u"in O?O.u%7:"W"in O?1:0),Rt="Z"in O?Pd(Fo(O.y,0,1)).getUTCDay():Rd(Fo(O.y,0,1)).getDay(),O.m=0,O.d="W"in O?(O.w+6)%7+O.W*7-(Rt+5)%7:O.w+O.U*7-(Rt+6)%7);return"Z"in O?(O.H+=O.Z/100|0,O.M+=O.Z%100,Pd(O)):Rd(O)}}function I(W,J,$,O){for(var pt=0,yt=J.length,Rt=$.length,Bt,Fe;pt<yt;){if(O>=Rt)return-1;if(Bt=J.charCodeAt(pt++),Bt===37){if(Bt=J.charAt(pt++),Fe=w[Bt in Qy?J.charAt(pt++):Bt],!Fe||(O=Fe(W,$,O))<0)return-1}else if(Bt!=$.charCodeAt(O++))return-1}return O}function M(W,J,$){var O=h.exec(J.slice($));return O?(W.p=c.get(O[0].toLowerCase()),$+O[0].length):-1}function L(W,J,$){var O=f.exec(J.slice($));return O?(W.w=p.get(O[0].toLowerCase()),$+O[0].length):-1}function G(W,J,$){var O=u.exec(J.slice($));return O?(W.w=d.get(O[0].toLowerCase()),$+O[0].length):-1}function F(W,J,$){var O=y.exec(J.slice($));return O?(W.m=x.get(O[0].toLowerCase()),$+O[0].length):-1}function A(W,J,$){var O=m.exec(J.slice($));return O?(W.m=g.get(O[0].toLowerCase()),$+O[0].length):-1}function N(W,J,$){return I(W,t,J,$)}function Z(W,J,$){return I(W,e,J,$)}function K(W,J,$){return I(W,r,J,$)}function H(W){return o[W.getDay()]}function j(W){return s[W.getDay()]}function B(W){return l[W.getMonth()]}function D(W){return a[W.getMonth()]}function k(W){return n[+(W.getHours()>=12)]}function V(W){return 1+~~(W.getMonth()/3)}function et(W){return o[W.getUTCDay()]}function ft(W){return s[W.getUTCDay()]}function at(W){return l[W.getUTCMonth()]}function Tt(W){return a[W.getUTCMonth()]}function It(W){return n[+(W.getUTCHours()>=12)]}function Q(W){return 1+~~(W.getUTCMonth()/3)}return{format:function(W){var J=S(W+="",b);return J.toString=function(){return W},J},parse:function(W){var J=C(W+="",!1);return J.toString=function(){return W},J},utcFormat:function(W){var J=S(W+="",v);return J.toString=function(){return W},J},utcParse:function(W){var J=C(W+="",!0);return J.toString=function(){return W},J}}}var Qy={"-":"",_:" ",0:"0"},de=/^\s*\d+/,QI=/^%/,qI=/[\\^$*+?|[\]().{}]/g;function Mt(i,t,e){var r=i<0?"-":"",n=(r?-i:i)+"",s=n.length;return r+(s<e?new Array(e-s+1).join(t)+n:n)}function tA(i){return i.replace(qI,"\\$&")}function Do(i){return new RegExp("^(?:"+i.map(tA).join("|")+")","i")}function No(i){return new Map(i.map((t,e)=>[t.toLowerCase(),e]))}function eA(i,t,e){var r=de.exec(t.slice(e,e+1));return r?(i.w=+r[0],e+r[0].length):-1}function iA(i,t,e){var r=de.exec(t.slice(e,e+1));return r?(i.u=+r[0],e+r[0].length):-1}function rA(i,t,e){var r=de.exec(t.slice(e,e+2));return r?(i.U=+r[0],e+r[0].length):-1}function nA(i,t,e){var r=de.exec(t.slice(e,e+2));return r?(i.V=+r[0],e+r[0].length):-1}function sA(i,t,e){var r=de.exec(t.slice(e,e+2));return r?(i.W=+r[0],e+r[0].length):-1}function qy(i,t,e){var r=de.exec(t.slice(e,e+4));return r?(i.y=+r[0],e+r[0].length):-1}function tb(i,t,e){var r=de.exec(t.slice(e,e+2));return r?(i.y=+r[0]+(+r[0]>68?1900:2e3),e+r[0].length):-1}function oA(i,t,e){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(e,e+6));return r?(i.Z=r[1]?0:-(r[2]+(r[3]||"00")),e+r[0].length):-1}function aA(i,t,e){var r=de.exec(t.slice(e,e+1));return r?(i.q=r[0]*3-3,e+r[0].length):-1}function lA(i,t,e){var r=de.exec(t.slice(e,e+2));return r?(i.m=r[0]-1,e+r[0].length):-1}function eb(i,t,e){var r=de.exec(t.slice(e,e+2));return r?(i.d=+r[0],e+r[0].length):-1}function hA(i,t,e){var r=de.exec(t.slice(e,e+3));return r?(i.m=0,i.d=+r[0],e+r[0].length):-1}function ib(i,t,e){var r=de.exec(t.slice(e,e+2));return r?(i.H=+r[0],e+r[0].length):-1}function cA(i,t,e){var r=de.exec(t.slice(e,e+2));return r?(i.M=+r[0],e+r[0].length):-1}function uA(i,t,e){var r=de.exec(t.slice(e,e+2));return r?(i.S=+r[0],e+r[0].length):-1}function dA(i,t,e){var r=de.exec(t.slice(e,e+3));return r?(i.L=+r[0],e+r[0].length):-1}function fA(i,t,e){var r=de.exec(t.slice(e,e+6));return r?(i.L=Math.floor(r[0]/1e3),e+r[0].length):-1}function pA(i,t,e){var r=QI.exec(t.slice(e,e+1));return r?e+r[0].length:-1}function mA(i,t,e){var r=de.exec(t.slice(e));return r?(i.Q=+r[0],e+r[0].length):-1}function gA(i,t,e){var r=de.exec(t.slice(e));return r?(i.s=+r[0],e+r[0].length):-1}function rb(i,t){return Mt(i.getDate(),t,2)}function yA(i,t){return Mt(i.getHours(),t,2)}function bA(i,t){return Mt(i.getHours()%12||12,t,2)}function xA(i,t){return Mt(1+ko.count(pr(i),i),t,3)}function nb(i,t){return Mt(i.getMilliseconds(),t,3)}function _A(i,t){return nb(i,t)+"000"}function vA(i,t){return Mt(i.getMonth()+1,t,2)}function wA(i,t){return Mt(i.getMinutes(),t,2)}function TA(i,t){return Mt(i.getSeconds(),t,2)}function SA(i){var t=i.getDay();return t===0?7:t}function EA(i,t){return Mt(Zl.count(pr(i)-1,i),t,2)}function sb(i){var t=i.getDay();return t>=4||t===0?As(i):As.ceil(i)}function CA(i,t){return i=sb(i),Mt(As.count(pr(i),i)+(pr(i).getDay()===4),t,2)}function IA(i){return i.getDay()}function AA(i,t){return Mt(Vl.count(pr(i)-1,i),t,2)}function MA(i,t){return Mt(i.getFullYear()%100,t,2)}function RA(i,t){return i=sb(i),Mt(i.getFullYear()%100,t,2)}function PA(i,t){return Mt(i.getFullYear()%1e4,t,4)}function LA(i,t){var e=i.getDay();return i=e>=4||e===0?As(i):As.ceil(i),Mt(i.getFullYear()%1e4,t,4)}function GA(i){var t=i.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Mt(t/60|0,"0",2)+Mt(t%60,"0",2)}function ob(i,t){return Mt(i.getUTCDate(),t,2)}function kA(i,t){return Mt(i.getUTCHours(),t,2)}function FA(i,t){return Mt(i.getUTCHours()%12||12,t,2)}function DA(i,t){return Mt(1+Ad.count(Nn(i),i),t,3)}function ab(i,t){return Mt(i.getUTCMilliseconds(),t,3)}function NA(i,t){return ab(i,t)+"000"}function OA(i,t){return Mt(i.getUTCMonth()+1,t,2)}function BA(i,t){return Mt(i.getUTCMinutes(),t,2)}function UA(i,t){return Mt(i.getUTCSeconds(),t,2)}function XA(i){var t=i.getUTCDay();return t===0?7:t}function WA(i,t){return Mt($y.count(Nn(i)-1,i),t,2)}function lb(i){var t=i.getUTCDay();return t>=4||t===0?Ms(i):Ms.ceil(i)}function ZA(i,t){return i=lb(i),Mt(Ms.count(Nn(i),i)+(Nn(i).getUTCDay()===4),t,2)}function VA(i){return i.getUTCDay()}function HA(i,t){return Mt(Hl.count(Nn(i)-1,i),t,2)}function KA(i,t){return Mt(i.getUTCFullYear()%100,t,2)}function zA(i,t){return i=lb(i),Mt(i.getUTCFullYear()%100,t,2)}function YA(i,t){return Mt(i.getUTCFullYear()%1e4,t,4)}function jA(i,t){var e=i.getUTCDay();return i=e>=4||e===0?Ms(i):Ms.ceil(i),Mt(i.getUTCFullYear()%1e4,t,4)}function JA(){return"+0000"}function hb(){return"%"}function cb(i){return+i}function ub(i){return Math.floor(+i/1e3)}var Rs,db;$A({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 $A(i){return Rs=$I(i),db=Rs.format,Rs.parse,Rs.utcFormat,Rs.utcParse,Rs}function QA(i){return new Date(i)}function qA(i){return i instanceof Date?+i:+new Date(+i)}function fb(i,t,e,r,n,s,o,a,l,h){var c=Yy(),u=c.invert,d=c.domain,f=h(".%L"),p=h(":%S"),m=h("%I:%M"),g=h("%I %p"),y=h("%a %d"),x=h("%b %d"),b=h("%B"),v=h("%Y");function w(S){return(l(S)<S?f:a(S)<S?p:o(S)<S?m:s(S)<S?g:r(S)<S?n(S)<S?y:x:e(S)<S?b:v)(S)}return c.invert=function(S){return new Date(u(S))},c.domain=function(S){return arguments.length?d(Array.from(S,qA)):d().map(QA)},c.ticks=function(S){var C=d();return i(C[0],C[C.length-1],S??10)},c.tickFormat=function(S,C){return C==null?w:h(C)},c.nice=function(S){var C=d();return(!S||typeof S.range!="function")&&(S=t(C[0],C[C.length-1],S??10)),S?d(BI(C,S)):c},c.copy=function(){return zy(c,fb(i,t,e,r,n,s,o,a,l,h))},c}function tM(){return Hy.apply(fb(jI,JI,pr,Md,Zl,ko,Id,Cd,Is,db).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function Oo(i,t,e){this.k=i,this.x=t,this.y=e}Oo.prototype={constructor:Oo,scale:function(i){return i===1?this:new Oo(this.k*i,this.x,this.y)},translate:function(i,t){return i===0&t===0?this:new Oo(this.k,this.x+this.k*i,this.y+this.k*t)},apply:function(i){return[i[0]*this.k+this.x,i[1]*this.k+this.y]},applyX:function(i){return i*this.k+this.x},applyY:function(i){return i*this.k+this.y},invert:function(i){return[(i[0]-this.x)/this.k,(i[1]-this.y)/this.k]},invertX:function(i){return(i-this.x)/this.k},invertY:function(i){return(i-this.y)/this.k},rescaleX:function(i){return i.copy().domain(i.range().map(this.invertX,this).map(i.invert,i))},rescaleY:function(i){return i.copy().domain(i.range().map(this.invertY,this).map(i.invert,i))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}},Oo.prototype;function pb(i){return i.mode==="temporal"||i.mode==="left-aligned"?eM(i):iM(i)}function eM({domain:i,range:t}){return tM().domain(i).range(t)}function iM({domain:i,range:t}){return jy().domain(i).range(t)}function Ld(i){return{mode:it.horizontal,range:cP(),domain:uP(i)}}function rM(){return{mode:it.vertical}}let Ps=null;async function nM(){const i=await Zi();mb(i.start_time),tt.on("layoutSettingsUpdated",()=>mb(i.start_time))}function sM(){Ps=null}async function ri(){return Ps||await Ie("scaleCreated")}async function mb(i){await ie();const t=Ps?"scaleUpdated":"scaleCreated",e=Ld(i);Ps=pb(e),tt.emit(t,Ps)}let ke=null,Gd=null;async function oM(){const i=await qt(),t=await wu();ke=new XC({screenHeight:t.clientHeight,screenWidth:t.clientWidth,events:i.renderer.events,passiveWheel:!1}),ke.zIndex=1,ke.drag().pinch().wheel({trackpadPinch:!0}).decelerate({friction:.9}).clampZoom({minWidth:t.clientWidth/2}),ke.on("moved",()=>{tt.emit("viewportMoved",null)}).on("moved-end",()=>{tt.emit("viewportMoved",null)}),i.stage.addChild(ke),tt.emit("viewportCreated",ke),tt.on("applicationResized",fM),tt.on("scaleUpdated",()=>Bo()),uM()}function aM(){ke=null,Gd=null}async function kd({animate:i}={}){const e=(await ee()).getChildByName(Zf);if(!e)throw new Error("Nodes container not found");gM();const{x:r,y:n,width:s,height:o}=e.getLocalBounds();if(!s||!o){hM({animate:i});return}lM({x:r,y:n,width:s,height:o,animate:i})}async function lM({x:i,y:t,width:e,height:r,animate:n}){const s=await Lt(),o=await ee(),{guideTextSize:a,guideTextTopPadding:l,columnGap:h,rowGap:c,eventTargetSize:u}=s.styles,d=a+l,f=e+h*2,p=r+c*4+d+u,m=o.findFit(f,p);o.animate({position:{x:i+e/2,y:t+r/2+d},scale:Math.min(m,1),time:n?s.animationDuration:0,ease:"easeInOutQuad",removeOnInterrupt:!0,callbackOnComplete:()=>{zl(),Bo()}})}async function hM({animate:i}){const t=await Zi(),e=await Lt(),r=await ee(),n=await ri();let s=n(t.start_time)-e.styles.columnGap,o=n(t.end_time??new Date)+e.styles.columnGap;if(s>o){const c=s;s=o,o=c}const a=o-s,l=s+a/2,h=r.findFit(a,0);r.animate({position:{x:l,y:0},scale:h,time:i?e.animationDuration:0,ease:"easeInOutQuad",removeOnInterrupt:!0,callbackOnComplete:()=>{zl(),Bo()}})}async function ee(){return ke||await Ie("viewportCreated")}function gb(i){wy(Gd,i)||(Gd=i,tt.emit("viewportDateRangeUpdated",i))}function cM({xOffset:i,yOffset:t}){if(!ke)return;const{x:e,y:r}=ke.transform.position;ke.setTransform(e+i,r+t,ke.transform.scale.x,ke.transform.scale.y)}async function uM(){const i=await ee();Bo(),i.on("moved",()=>Bo())}async function Bo(){const i=await yb();i&&gb(i)}async function yb(){const i=await ee(),t=await ri(),e=t.invert(i.left),r=t.invert(i.right);return e instanceof Date&&r instanceof Date?[e,r]:null}async function dM(i){const t=await yb(),e=await ie();if(i===void 0||e.isDependency()||wy(i,t))return;const r=await ee(),n=await ri(),[s,o]=i,a=n(s),l=n(o),h=a+(l-a)/2;gb(i),r.fitWidth(l-a,!0),r.moveCenter(h,r.center.y)}async function fM(){const i=await qt(),t=await ee(),e=await wu(),r=t.screenWidth,n=t.screenHeight,s=e.clientWidth,o=e.clientHeight,a=(s-r)/2,l=(o-n)/2;t.resize(i.screen.width,i.screen.height),cM({xOffset:a,yOffset:l})}class Kl{constructor(){Ff(this,"status","visible");Ff(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 Ui=null,ni=null,Xi=null,mr=null,gi=null;async function pM(){const i=await ee(),t=await qt();Ui=new hC({toggle:"renderable"}),ni=new Kl,Xi=new Kl,gi=new Kl,mr=new Kl,t.ticker.add(()=>{if(i.dirty){const e=i.scale.x>.1,r=i.scale.x>.2,n=i.scale.x>.2,s=i.scale.x>.2;gi==null||gi.toggle(e),ni==null||ni.toggle(r),Xi==null||Xi.toggle(n),mr==null||mr.toggle(s),Ui==null||Ui.cull(t.renderer.screen),i.dirty=!1}}),tt.emit("cullCreated",Ui),tt.emit("labelCullCreated",ni),tt.emit("iconCullCreated",ni),tt.emit("edgeCullCreated",gi),tt.emit("toggleCullCreated",mr)}function mM(){Ui=null,ni==null||ni.clear(),ni=null,Xi==null||Xi.clear(),Xi=null,gi==null||gi.clear(),gi=null,mr==null||mr.clear(),mr=null}async function zl(){const i=await ee();i.dirty=!0}function gM(){Ui&&Ui.uncull()}async function bb(){return Ui||await Ie("cullCreated")}async function yM(){return gi||await Ie("edgeCullCreated")}async function xb(){return ni||await Ie("labelCullCreated")}async function bM(){return Xi||await Ie("iconCullCreated")}async function _b(){const i=await ie(),t=await Lt();function e(r,n,s){const a=i.disableAnimations||s?0:t.animationDuration/1e3;return vy.to(r,{...n,duration:a,ease:"power1.out",onUpdate:()=>{zl()}})}return{animate:e}}let Yl=new Map;function xM(){Yl=new Map}async function Uo(i,t){const e=`${i.toString()}-${JSON.stringify(t)}`;if(Yl.has(e))return Yl.get(e);const r=await i(...t);return Yl.set(e,r),r}async function _M({size:i,stroke:t=1,radius:e=0}){const r=await qt(),n=new ds;return n.lineStyle(t,"#fff",1,0),n.drawRoundedRect(0,0,i*2,i*2,e),r.renderer.generateTexture(n,{region:new gt(0,0,i,i),resolution:10})}async function Xo(i){return await Uo(_M,[i])}var jl=(i=>(i[i.Up=0]="Up",i[i.Down=180]="Down",i[i.Left=270]="Left",i[i.Right=90]="Right",i))(jl||{});function vb(){const i=new Qt;async function t(e){const{rotate:r=0}=e,n={size:e.size,radius:e.radius,stroke:e.stroke},s=await Xo(n);return i.texture=s,i.anchor.set(.5,.5),i.angle=45+r,i}return{element:i,render:t}}async function vM(){const i=await qt(),t=new ds;return t.beginFill("#fff"),t.drawRect(0,0,1,1),t.endFill(),i.renderer.generateTexture(t,{wrapMode:wi.REPEAT})}async function Fd(){return await Uo(vM,[])}function Dd(i,t){return Array.from({length:i},(e,r)=>t(r))}const wM=8,TM=2;async function SM(){const i=await Lt(),t=await bb(),e=await yM(),{animate:r}=await _b(),n=new Ct,{element:s,render:o}=await vb(),a=await Fd(),l=Dd(20,()=>new dt),h=new i2(a,l);let c=!1;n.name=M1,n.addChild(s),n.addChild(h),t.addAll([s,h]),e.add(n);async function u(){return await o({size:10,rotate:jl.Right}),s.tint=i.styles.edgeColor,h.tint=i.styles.edgeColor,n}async function d(p,m){const g=f(m);c||await u();for(const[y,x]of l.entries()){const{x:b,y:v}=g[y];r(x,{x:b,y:v},!c)}r(n,{x:p.x,y:p.y},!c),r(s,{x:m.x-wM,y:m.y},!c),c=!0}function f({x:p,y:m}){const g=[],y={x:0,y:0},x={x:p-TM,y:m},b={x:wb(y.x,{source:y,target:x}),y:y.y},v={x:wb(x.x,{source:y,target:x},!0),y:x.y};for(const[w]of l.entries()){if(w===l.length-1){g[w]=x;continue}const S=EM(w,{source:y,target:x,sourceBezier:b,targetBezier:v});g[w]=S}return g}return{element:n,render:u,setPosition:d}}function wb(i,{source:t,target:e},r){const n=(e.x-t.x)/2;return i+(n>64?n:64)*(r?-1:1)}function EM(i,t){const e=i/20,{source:r,target:n,sourceBezier:s,targetBezier:o}=t,a=r.x+(s.x-r.x)*e,l=r.y+(s.y-r.y)*e,h=s.x+(o.x-s.x)*e,c=s.y+(o.y-s.y)*e,u=o.x+(n.x-o.x)*e,d=o.y+(n.y-o.y)*e,f=a+(h-a)*e,p=l+(c-l)*e,m=h+(u-h)*e,g=c+(d-c)*e,y=f+(m-f)*e,x=p+(g-p)*e;return{x:y,y:x}}async function CM({height:i,radius:t}){const e=await qt(),r=new ds;return r.beginFill("#fff"),r.drawRoundedRect(0,0,t*2,i,t),r.endFill(),e.renderer.generateTexture(r,{region:new gt(0,0,t,i),resolution:10})}async function IM(i){return await Uo(CM,[i])}function AM(){const i=new Qt,t=new Qt;async function e(r){const n=await IM(r);return i.texture=n,t.texture=n,t.anchor.x=1,t.scale.x=-1,{left:i,right:t}}return{left:i,right:t,render:e}}async function gr(){const i=await Fd();return new Qt(i)}async function Nd(){const i=new Ct,t=await gr(),{left:e,right:r,render:n}=await AM();i.addChild(t),i.addChild(e),i.addChild(r);async function s(l){const{width:h,x:c,visible:u}=a(l);return await n({height:l.height,radius:l.radius}),t.visible=u,t.width=h,t.height=l.height,t.x=c,e.visible=o(l.capLeft,l.radius),r.visible=o(l.capRight,l.radius),r.x=l.radius+h,t.tint=l.background,e.tint=l.background,r.tint=l.background,i}function o(l,h){return h===0?!1:l??!0}function a(l){const h=o(l.capLeft,l.radius),c=o(l.capRight,l.radius);let u=0;h&&(u+=l.radius),c&&(u+=l.radius);const d=Math.max(l.width-u,0),f=d>0,p=h?l.radius:0;return{width:d,visible:f,x:p}}return{element:i,render:s}}function Od(){const i=new Ct,t=new Qt,e=new Qt,r=new Qt,n=new Qt,s=new Qt,o=new Qt,a=new Qt,l=new Qt;t.name="border-corner-top-left",e.name="border-corner-top-right",r.name="border-corner-bottom-left",n.name="border-corner-bottom-right",s.name="border-corner-left",o.name="border-corner-right",a.name="border-corner-top",l.name="border-corner-bottom",e.anchor.x=1,e.scale.x=-1,r.anchor.y=1,r.scale.y=-1,n.anchor.x=1,n.scale.x=-1,n.anchor.y=1,n.scale.y=-1,i.addChild(t),i.addChild(e),i.addChild(r),i.addChild(n),i.addChild(s),i.addChild(o),i.addChild(a),i.addChild(l);async function h(p){const{radius:m=0,color:g="#fff",stroke:y,width:x,height:b}=p,v=typeof m=="number",w={topLeft:c(v?m:m[0],x,b),topRight:c(v?m:m[1],x,b),bottomLeft:c(v?m:m[2],x,b),bottomRight:c(v?m:m[3],x,b)};return await u({width:x,height:b,stroke:y,cornerSizes:w}),await d({width:x,height:b,stroke:y,cornerSizes:w}),f(g),i}function c(p,m,g){const y=Math.min(m,g);return{size:p*2>y?y/2:p,radius:p}}async function u({width:p,height:m,stroke:g,cornerSizes:y}){const{topLeft:x,topRight:b,bottomLeft:v,bottomRight:w}=y,[S,C,I,M]=await Promise.all([Xo({...x,stroke:g}),Xo({...b,stroke:g}),Xo({...v,stroke:g}),Xo({...w,stroke:g})]);t.texture=S,e.texture=C,r.texture=M,n.texture=I,t.position.set(0,0),e.position.set(p-b.size,0),r.position.set(0,m-v.size),n.position.set(p-w.size,m-w.size)}async function d({width:p,height:m,stroke:g,cornerSizes:y}){const x=await Fd(),{topLeft:b,topRight:v,bottomLeft:w,bottomRight:S}=y;a.texture=x,s.texture=x,o.texture=x,l.texture=x,s.position.set(0,b.size),s.height=Math.max(m-b.size-w.size,0),s.width=g,o.position.set(p-g,v.size),o.height=Math.max(m-v.size-S.size,0),o.width=g,a.position.set(b.size,0),a.width=Math.max(p-b.size-v.size,0),a.height=g,l.position.set(w.size,m-g),l.width=Math.max(p-w.size-S.size,0),l.height=g}function f(p){t.tint=p,e.tint=p,r.tint=p,n.tint=p,a.tint=p,s.tint=p,o.tint=p,l.tint=p}return{element:i,render:h}}async function Jl(){const i=await Lt(),t=new Ct,{element:e,render:r}=await Od();async function n({selected:s,width:o,height:a}){if(!s)return t.removeChild(e),t;const{selectedBorderColor:l,selectedBorderWidth:h,selectedBorderOffset:c,selectedBorderRadius:u}=i.styles;return e.position.set(-c,-c),t.addChild(e),await r({stroke:h,radius:u,width:o+c*2,height:a+c*2,color:l}),t}return{element:t,render:n}}async function MM(){const i=await Lt(),t=new Ct,{element:e,render:r}=await Nd(),{element:n,render:s}=await Jl();t.addChild(e),t.addChild(n);async function o({selected:a,width:l,height:h}){const{artifactBgColor:c,artifactBorderRadius:u}=i.styles,d={width:l,height:h,background:c,radius:u,capLeft:!0,capRight:!0};return await Promise.all([r(d),s({selected:a,width:l,height:h})]),t}return{element:t,render:o}}const RM=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 PM(i){const t={resolution:4};return ot.from(RM[i],t)}async function LM(i){return await Uo(PM,[i])}async function GM({cullAtZoomThreshold:i=!0}={}){const t=await bM(),e=new Qt;i&&t.add(e);async function r(n){const s=await LM(n);return e.texture=s,e}return{element:e,render:r}}var kM={aqua:/#00ffff(ff)?(?!\w)|#0ff(f)?(?!\w)/gi,azure:/#f0ffff(ff)?(?!\w)/gi,beige:/#f5f5dc(ff)?(?!\w)/gi,bisque:/#ffe4c4(ff)?(?!\w)/gi,black:/#000000(ff)?(?!\w)|#000(f)?(?!\w)/gi,blue:/#0000ff(ff)?(?!\w)|#00f(f)?(?!\w)/gi,brown:/#a52a2a(ff)?(?!\w)/gi,coral:/#ff7f50(ff)?(?!\w)/gi,cornsilk:/#fff8dc(ff)?(?!\w)/gi,crimson:/#dc143c(ff)?(?!\w)/gi,cyan:/#00ffff(ff)?(?!\w)|#0ff(f)?(?!\w)/gi,darkblue:/#00008b(ff)?(?!\w)/gi,darkcyan:/#008b8b(ff)?(?!\w)/gi,darkgrey:/#a9a9a9(ff)?(?!\w)/gi,darkred:/#8b0000(ff)?(?!\w)/gi,deeppink:/#ff1493(ff)?(?!\w)/gi,dimgrey:/#696969(ff)?(?!\w)/gi,gold:/#ffd700(ff)?(?!\w)/gi,green:/#008000(ff)?(?!\w)/gi,grey:/#808080(ff)?(?!\w)/gi,honeydew:/#f0fff0(ff)?(?!\w)/gi,hotpink:/#ff69b4(ff)?(?!\w)/gi,indigo:/#4b0082(ff)?(?!\w)/gi,ivory:/#fffff0(ff)?(?!\w)/gi,khaki:/#f0e68c(ff)?(?!\w)/gi,lavender:/#e6e6fa(ff)?(?!\w)/gi,lime:/#00ff00(ff)?(?!\w)|#0f0(f)?(?!\w)/gi,linen:/#faf0e6(ff)?(?!\w)/gi,maroon:/#800000(ff)?(?!\w)/gi,moccasin:/#ffe4b5(ff)?(?!\w)/gi,navy:/#000080(ff)?(?!\w)/gi,oldlace:/#fdf5e6(ff)?(?!\w)/gi,olive:/#808000(ff)?(?!\w)/gi,orange:/#ffa500(ff)?(?!\w)/gi,orchid:/#da70d6(ff)?(?!\w)/gi,peru:/#cd853f(ff)?(?!\w)/gi,pink:/#ffc0cb(ff)?(?!\w)/gi,plum:/#dda0dd(ff)?(?!\w)/gi,purple:/#800080(ff)?(?!\w)/gi,red:/#ff0000(ff)?(?!\w)|#f00(f)?(?!\w)/gi,salmon:/#fa8072(ff)?(?!\w)/gi,seagreen:/#2e8b57(ff)?(?!\w)/gi,seashell:/#fff5ee(ff)?(?!\w)/gi,sienna:/#a0522d(ff)?(?!\w)/gi,silver:/#c0c0c0(ff)?(?!\w)/gi,skyblue:/#87ceeb(ff)?(?!\w)/gi,snow:/#fffafa(ff)?(?!\w)/gi,tan:/#d2b48c(ff)?(?!\w)/gi,teal:/#008080(ff)?(?!\w)/gi,thistle:/#d8bfd8(ff)?(?!\w)/gi,tomato:/#ff6347(ff)?(?!\w)/gi,violet:/#ee82ee(ff)?(?!\w)/gi,wheat:/#f5deb3(ff)?(?!\w)/gi,white:/#ffffff(ff)?(?!\w)|#fff(f)?(?!\w)/gi},Bd=kM,Ud={whitespace:/\s+/g,urlHexPairs:/%[\dA-F]{2}/g,quotes:/"/g};function FM(i){return i.trim().replace(Ud.whitespace," ")}function DM(i){return encodeURIComponent(i).replace(Ud.urlHexPairs,OM)}function NM(i){return Object.keys(Bd).forEach(function(t){Bd[t].test(i)&&(i=i.replace(Bd[t],t))}),i}function OM(i){switch(i){case"%20":return" ";case"%3D":return"=";case"%3A":return":";case"%2F":return"/";default:return i.toLowerCase()}}function Xd(i){if(typeof i!="string")throw new TypeError("Expected a string, but received "+typeof i);i.charCodeAt(0)===65279&&(i=i.slice(1));var t=NM(FM(i)).replace(Ud.quotes,"'");return"data:image/svg+xml,"+DM(t)}Xd.toSrcset=function(t){return Xd(t).replace(/ /g,"%20")};var BM=Xd,Tb={},Sb={};(function(i){Object.defineProperty(i,"__esModule",{value:!0}),Object.defineProperty(i,"default",{enumerable:!0,get:function(){return e}});function t(r,n){return{handler:r,config:n}}t.withOptions=function(r,n=()=>({})){const s=function(o){return{__options:o,handler:r(o),config:n(o)}};return s.__isOptionsFunction=!0,s.__pluginFunction=r,s.__configFunction=n,s};const e=t})(Sb),function(i){Object.defineProperty(i,"__esModule",{value:!0}),Object.defineProperty(i,"default",{enumerable:!0,get:function(){return r}});const t=e(Sb);function e(n){return n&&n.__esModule?n:{default:n}}const r=t.default}(Tb);let Wd=Tb;var Zd=(Wd.__esModule?Wd:{default:Wd}).default;const UM=Tr(Zd);var Eb={},Cb={};(function(i){Object.defineProperty(i,"__esModule",{value:!0}),Object.defineProperty(i,"cloneDeep",{enumerable:!0,get:function(){return t}});function t(e){return Array.isArray(e)?e.map(r=>t(r)):typeof e=="object"&&e!==null?Object.fromEntries(Object.entries(e).map(([r,n])=>[r,t(n)])):e}})(Cb);var XM={content:[],presets:[],darkMode:"media",theme:{accentColor:({theme:i})=>({...i("colors"),auto:"auto"}),animation:{none:"none",spin:"spin 1s linear infinite",ping:"ping 1s cubic-bezier(0, 0, 0.2, 1) infinite",pulse:"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",bounce:"bounce 1s infinite"},aria:{busy:'busy="true"',checked:'checked="true"',disabled:'disabled="true"',expanded:'expanded="true"',hidden:'hidden="true"',pressed:'pressed="true"',readonly:'readonly="true"',required:'required="true"',selected:'selected="true"'},aspectRatio:{auto:"auto",square:"1 / 1",video:"16 / 9"},backdropBlur:({theme:i})=>i("blur"),backdropBrightness:({theme:i})=>i("brightness"),backdropContrast:({theme:i})=>i("contrast"),backdropGrayscale:({theme:i})=>i("grayscale"),backdropHueRotate:({theme:i})=>i("hueRotate"),backdropInvert:({theme:i})=>i("invert"),backdropOpacity:({theme:i})=>i("opacity"),backdropSaturate:({theme:i})=>i("saturate"),backdropSepia:({theme:i})=>i("sepia"),backgroundColor:({theme:i})=>i("colors"),backgroundImage:{none:"none","gradient-to-t":"linear-gradient(to top, var(--tw-gradient-stops))","gradient-to-tr":"linear-gradient(to top right, var(--tw-gradient-stops))","gradient-to-r":"linear-gradient(to right, var(--tw-gradient-stops))","gradient-to-br":"linear-gradient(to bottom right, var(--tw-gradient-stops))","gradient-to-b":"linear-gradient(to bottom, var(--tw-gradient-stops))","gradient-to-bl":"linear-gradient(to bottom left, var(--tw-gradient-stops))","gradient-to-l":"linear-gradient(to left, var(--tw-gradient-stops))","gradient-to-tl":"linear-gradient(to top left, var(--tw-gradient-stops))"},backgroundOpacity:({theme:i})=>i("opacity"),backgroundPosition:{bottom:"bottom",center:"center",left:"left","left-bottom":"left bottom","left-top":"left top",right:"right","right-bottom":"right bottom","right-top":"right top",top:"top"},backgroundSize:{auto:"auto",cover:"cover",contain:"contain"},blur:{0:"0",none:"0",sm:"4px",DEFAULT:"8px",md:"12px",lg:"16px",xl:"24px","2xl":"40px","3xl":"64px"},borderColor:({theme:i})=>({...i("colors"),DEFAULT:i("colors.gray.200","currentColor")}),borderOpacity:({theme:i})=>i("opacity"),borderRadius:{none:"0px",sm:"0.125rem",DEFAULT:"0.25rem",md:"0.375rem",lg:"0.5rem",xl:"0.75rem","2xl":"1rem","3xl":"1.5rem",full:"9999px"},borderSpacing:({theme:i})=>({...i("spacing")}),borderWidth:{DEFAULT:"1px",0:"0px",2:"2px",4:"4px",8:"8px"},boxShadow:{sm:"0 1px 2px 0 rgb(0 0 0 / 0.05)",DEFAULT:"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",md:"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",lg:"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",xl:"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)","2xl":"0 25px 50px -12px rgb(0 0 0 / 0.25)",inner:"inset 0 2px 4px 0 rgb(0 0 0 / 0.05)",none:"none"},boxShadowColor:({theme:i})=>i("colors"),brightness:{0:"0",50:".5",75:".75",90:".9",95:".95",100:"1",105:"1.05",110:"1.1",125:"1.25",150:"1.5",200:"2"},caretColor:({theme:i})=>i("colors"),colors:({colors:i})=>({inherit:i.inherit,current:i.current,transparent:i.transparent,black:i.black,white:i.white,slate:i.slate,gray:i.gray,zinc:i.zinc,neutral:i.neutral,stone:i.stone,red:i.red,orange:i.orange,amber:i.amber,yellow:i.yellow,lime:i.lime,green:i.green,emerald:i.emerald,teal:i.teal,cyan:i.cyan,sky:i.sky,blue:i.blue,indigo:i.indigo,violet:i.violet,purple:i.purple,fuchsia:i.fuchsia,pink:i.pink,rose:i.rose}),columns:{auto:"auto",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",10:"10",11:"11",12:"12","3xs":"16rem","2xs":"18rem",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem"},container:{},content:{none:"none"},contrast:{0:"0",50:".5",75:".75",100:"1",125:"1.25",150:"1.5",200:"2"},cursor:{auto:"auto",default:"default",pointer:"pointer",wait:"wait",text:"text",move:"move",help:"help","not-allowed":"not-allowed",none:"none","context-menu":"context-menu",progress:"progress",cell:"cell",crosshair:"crosshair","vertical-text":"vertical-text",alias:"alias",copy:"copy","no-drop":"no-drop",grab:"grab",grabbing:"grabbing","all-scroll":"all-scroll","col-resize":"col-resize","row-resize":"row-resize","n-resize":"n-resize","e-resize":"e-resize","s-resize":"s-resize","w-resize":"w-resize","ne-resize":"ne-resize","nw-resize":"nw-resize","se-resize":"se-resize","sw-resize":"sw-resize","ew-resize":"ew-resize","ns-resize":"ns-resize","nesw-resize":"nesw-resize","nwse-resize":"nwse-resize","zoom-in":"zoom-in","zoom-out":"zoom-out"},divideColor:({theme:i})=>i("borderColor"),divideOpacity:({theme:i})=>i("borderOpacity"),divideWidth:({theme:i})=>i("borderWidth"),dropShadow:{sm:"0 1px 1px rgb(0 0 0 / 0.05)",DEFAULT:["0 1px 2px rgb(0 0 0 / 0.1)","0 1px 1px rgb(0 0 0 / 0.06)"],md:["0 4px 3px rgb(0 0 0 / 0.07)","0 2px 2px rgb(0 0 0 / 0.06)"],lg:["0 10px 8px rgb(0 0 0 / 0.04)","0 4px 3px rgb(0 0 0 / 0.1)"],xl:["0 20px 13px rgb(0 0 0 / 0.03)","0 8px 5px rgb(0 0 0 / 0.08)"],"2xl":"0 25px 25px rgb(0 0 0 / 0.15)",none:"0 0 #0000"},fill:({theme:i})=>({none:"none",...i("colors")}),flex:{1:"1 1 0%",auto:"1 1 auto",initial:"0 1 auto",none:"none"},flexBasis:({theme:i})=>({auto:"auto",...i("spacing"),"1/2":"50%","1/3":"33.333333%","2/3":"66.666667%","1/4":"25%","2/4":"50%","3/4":"75%","1/5":"20%","2/5":"40%","3/5":"60%","4/5":"80%","1/6":"16.666667%","2/6":"33.333333%","3/6":"50%","4/6":"66.666667%","5/6":"83.333333%","1/12":"8.333333%","2/12":"16.666667%","3/12":"25%","4/12":"33.333333%","5/12":"41.666667%","6/12":"50%","7/12":"58.333333%","8/12":"66.666667%","9/12":"75%","10/12":"83.333333%","11/12":"91.666667%",full:"100%"}),flexGrow:{0:"0",DEFAULT:"1"},flexShrink:{0:"0",DEFAULT:"1"},fontFamily:{sans:["ui-sans-serif","system-ui","sans-serif",'"Apple Color Emoji"','"Segoe UI Emoji"','"Segoe UI Symbol"','"Noto Color Emoji"'],serif:["ui-serif","Georgia","Cambria",'"Times New Roman"',"Times","serif"],mono:["ui-monospace","SFMono-Regular","Menlo","Monaco","Consolas",'"Liberation Mono"','"Courier New"',"monospace"]},fontSize:{xs:["0.75rem",{lineHeight:"1rem"}],sm:["0.875rem",{lineHeight:"1.25rem"}],base:["1rem",{lineHeight:"1.5rem"}],lg:["1.125rem",{lineHeight:"1.75rem"}],xl:["1.25rem",{lineHeight:"1.75rem"}],"2xl":["1.5rem",{lineHeight:"2rem"}],"3xl":["1.875rem",{lineHeight:"2.25rem"}],"4xl":["2.25rem",{lineHeight:"2.5rem"}],"5xl":["3rem",{lineHeight:"1"}],"6xl":["3.75rem",{lineHeight:"1"}],"7xl":["4.5rem",{lineHeight:"1"}],"8xl":["6rem",{lineHeight:"1"}],"9xl":["8rem",{lineHeight:"1"}]},fontWeight:{thin:"100",extralight:"200",light:"300",normal:"400",medium:"500",semibold:"600",bold:"700",extrabold:"800",black:"900"},gap:({theme:i})=>i("spacing"),gradientColorStops:({theme:i})=>i("colors"),gradientColorStopPositions:{"0%":"0%","5%":"5%","10%":"10%","15%":"15%","20%":"20%","25%":"25%","30%":"30%","35%":"35%","40%":"40%","45%":"45%","50%":"50%","55%":"55%","60%":"60%","65%":"65%","70%":"70%","75%":"75%","80%":"80%","85%":"85%","90%":"90%","95%":"95%","100%":"100%"},grayscale:{0:"0",DEFAULT:"100%"},gridAutoColumns:{auto:"auto",min:"min-content",max:"max-content",fr:"minmax(0, 1fr)"},gridAutoRows:{auto:"auto",min:"min-content",max:"max-content",fr:"minmax(0, 1fr)"},gridColumn:{auto:"auto","span-1":"span 1 / span 1","span-2":"span 2 / span 2","span-3":"span 3 / span 3","span-4":"span 4 / span 4","span-5":"span 5 / span 5","span-6":"span 6 / span 6","span-7":"span 7 / span 7","span-8":"span 8 / span 8","span-9":"span 9 / span 9","span-10":"span 10 / span 10","span-11":"span 11 / span 11","span-12":"span 12 / span 12","span-full":"1 / -1"},gridColumnEnd:{auto:"auto",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",10:"10",11:"11",12:"12",13:"13"},gridColumnStart:{auto:"auto",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",10:"10",11:"11",12:"12",13:"13"},gridRow:{auto:"auto","span-1":"span 1 / span 1","span-2":"span 2 / span 2","span-3":"span 3 / span 3","span-4":"span 4 / span 4","span-5":"span 5 / span 5","span-6":"span 6 / span 6","span-7":"span 7 / span 7","span-8":"span 8 / span 8","span-9":"span 9 / span 9","span-10":"span 10 / span 10","span-11":"span 11 / span 11","span-12":"span 12 / span 12","span-full":"1 / -1"},gridRowEnd:{auto:"auto",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",10:"10",11:"11",12:"12",13:"13"},gridRowStart:{auto:"auto",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",10:"10",11:"11",12:"12",13:"13"},gridTemplateColumns:{none:"none",subgrid:"subgrid",1:"repeat(1, minmax(0, 1fr))",2:"repeat(2, minmax(0, 1fr))",3:"repeat(3, minmax(0, 1fr))",4:"repeat(4, minmax(0, 1fr))",5:"repeat(5, minmax(0, 1fr))",6:"repeat(6, minmax(0, 1fr))",7:"repeat(7, minmax(0, 1fr))",8:"repeat(8, minmax(0, 1fr))",9:"repeat(9, minmax(0, 1fr))",10:"repeat(10, minmax(0, 1fr))",11:"repeat(11, minmax(0, 1fr))",12:"repeat(12, minmax(0, 1fr))"},gridTemplateRows:{none:"none",subgrid:"subgrid",1:"repeat(1, minmax(0, 1fr))",2:"repeat(2, minmax(0, 1fr))",3:"repeat(3, minmax(0, 1fr))",4:"repeat(4, minmax(0, 1fr))",5:"repeat(5, minmax(0, 1fr))",6:"repeat(6, minmax(0, 1fr))",7:"repeat(7, minmax(0, 1fr))",8:"repeat(8, minmax(0, 1fr))",9:"repeat(9, minmax(0, 1fr))",10:"repeat(10, minmax(0, 1fr))",11:"repeat(11, minmax(0, 1fr))",12:"repeat(12, minmax(0, 1fr))"},height:({theme:i})=>({auto:"auto",...i("spacing"),"1/2":"50%","1/3":"33.333333%","2/3":"66.666667%","1/4":"25%","2/4":"50%","3/4":"75%","1/5":"20%","2/5":"40%","3/5":"60%","4/5":"80%","1/6":"16.666667%","2/6":"33.333333%","3/6":"50%","4/6":"66.666667%","5/6":"83.333333%",full:"100%",screen:"100vh",svh:"100svh",lvh:"100lvh",dvh:"100dvh",min:"min-content",max:"max-content",fit:"fit-content"}),hueRotate:{0:"0deg",15:"15deg",30:"30deg",60:"60deg",90:"90deg",180:"180deg"},inset:({theme:i})=>({auto:"auto",...i("spacing"),"1/2":"50%","1/3":"33.333333%","2/3":"66.666667%","1/4":"25%","2/4":"50%","3/4":"75%",full:"100%"}),invert:{0:"0",DEFAULT:"100%"},keyframes:{spin:{to:{transform:"rotate(360deg)"}},ping:{"75%, 100%":{transform:"scale(2)",opacity:"0"}},pulse:{"50%":{opacity:".5"}},bounce:{"0%, 100%":{transform:"translateY(-25%)",animationTimingFunction:"cubic-bezier(0.8,0,1,1)"},"50%":{transform:"none",animationTimingFunction:"cubic-bezier(0,0,0.2,1)"}}},letterSpacing:{tighter:"-0.05em",tight:"-0.025em",normal:"0em",wide:"0.025em",wider:"0.05em",widest:"0.1em"},lineHeight:{none:"1",tight:"1.25",snug:"1.375",normal:"1.5",relaxed:"1.625",loose:"2",3:".75rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem"},listStyleType:{none:"none",disc:"disc",decimal:"decimal"},listStyleImage:{none:"none"},margin:({theme:i})=>({auto:"auto",...i("spacing")}),lineClamp:{1:"1",2:"2",3:"3",4:"4",5:"5",6:"6"},maxHeight:({theme:i})=>({...i("spacing"),none:"none",full:"100%",screen:"100vh",svh:"100svh",lvh:"100lvh",dvh:"100dvh",min:"min-content",max:"max-content",fit:"fit-content"}),maxWidth:({theme:i,breakpoints:t})=>({...i("spacing"),none:"none",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem",full:"100%",min:"min-content",max:"max-content",fit:"fit-content",prose:"65ch",...t(i("screens"))}),minHeight:({theme:i})=>({...i("spacing"),full:"100%",screen:"100vh",svh:"100svh",lvh:"100lvh",dvh:"100dvh",min:"min-content",max:"max-content",fit:"fit-content"}),minWidth:({theme:i})=>({...i("spacing"),full:"100%",min:"min-content",max:"max-content",fit:"fit-content"}),objectPosition:{bottom:"bottom",center:"center",left:"left","left-bottom":"left bottom","left-top":"left top",right:"right","right-bottom":"right bottom","right-top":"right top",top:"top"},opacity:{0:"0",5:"0.05",10:"0.1",15:"0.15",20:"0.2",25:"0.25",30:"0.3",35:"0.35",40:"0.4",45:"0.45",50:"0.5",55:"0.55",60:"0.6",65:"0.65",70:"0.7",75:"0.75",80:"0.8",85:"0.85",90:"0.9",95:"0.95",100:"1"},order:{first:"-9999",last:"9999",none:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",10:"10",11:"11",12:"12"},outlineColor:({theme:i})=>i("colors"),outlineOffset:{0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"},outlineWidth:{0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"},padding:({theme:i})=>i("spacing"),placeholderColor:({theme:i})=>i("colors"),placeholderOpacity:({theme:i})=>i("opacity"),ringColor:({theme:i})=>({DEFAULT:i("colors.blue.500","#3b82f6"),...i("colors")}),ringOffsetColor:({theme:i})=>i("colors"),ringOffsetWidth:{0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"},ringOpacity:({theme:i})=>({DEFAULT:"0.5",...i("opacity")}),ringWidth:{DEFAULT:"3px",0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"},rotate:{0:"0deg",1:"1deg",2:"2deg",3:"3deg",6:"6deg",12:"12deg",45:"45deg",90:"90deg",180:"180deg"},saturate:{0:"0",50:".5",100:"1",150:"1.5",200:"2"},scale:{0:"0",50:".5",75:".75",90:".9",95:".95",100:"1",105:"1.05",110:"1.1",125:"1.25",150:"1.5"},screens:{sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},scrollMargin:({theme:i})=>({...i("spacing")}),scrollPadding:({theme:i})=>i("spacing"),sepia:{0:"0",DEFAULT:"100%"},skew:{0:"0deg",1:"1deg",2:"2deg",3:"3deg",6:"6deg",12:"12deg"},space:({theme:i})=>({...i("spacing")}),spacing:{px:"1px",0:"0px",.5:"0.125rem",1:"0.25rem",1.5:"0.375rem",2:"0.5rem",2.5:"0.625rem",3:"0.75rem",3.5:"0.875rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem",11:"2.75rem",12:"3rem",14:"3.5rem",16:"4rem",20:"5rem",24:"6rem",28:"7rem",32:"8rem",36:"9rem",40:"10rem",44:"11rem",48:"12rem",52:"13rem",56:"14rem",60:"15rem",64:"16rem",72:"18rem",80:"20rem",96:"24rem"},stroke:({theme:i})=>({none:"none",...i("colors")}),strokeWidth:{0:"0",1:"1",2:"2"},supports:{},data:{},textColor:({theme:i})=>i("colors"),textDecorationColor:({theme:i})=>i("colors"),textDecorationThickness:{auto:"auto","from-font":"from-font",0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"},textIndent:({theme:i})=>({...i("spacing")}),textOpacity:({theme:i})=>i("opacity"),textUnderlineOffset:{auto:"auto",0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"},transformOrigin:{center:"center",top:"top","top-right":"top right",right:"right","bottom-right":"bottom right",bottom:"bottom","bottom-left":"bottom left",left:"left","top-left":"top left"},transitionDelay:{0:"0s",75:"75ms",100:"100ms",150:"150ms",200:"200ms",300:"300ms",500:"500ms",700:"700ms",1e3:"1000ms"},transitionDuration:{DEFAULT:"150ms",0:"0s",75:"75ms",100:"100ms",150:"150ms",200:"200ms",300:"300ms",500:"500ms",700:"700ms",1e3:"1000ms"},transitionProperty:{none:"none",all:"all",DEFAULT:"color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter",colors:"color, background-color, border-color, text-decoration-color, fill, stroke",opacity:"opacity",shadow:"box-shadow",transform:"transform"},transitionTimingFunction:{DEFAULT:"cubic-bezier(0.4, 0, 0.2, 1)",linear:"linear",in:"cubic-bezier(0.4, 0, 1, 1)",out:"cubic-bezier(0, 0, 0.2, 1)","in-out":"cubic-bezier(0.4, 0, 0.2, 1)"},translate:({theme:i})=>({...i("spacing"),"1/2":"50%","1/3":"33.333333%","2/3":"66.666667%","1/4":"25%","2/4":"50%","3/4":"75%",full:"100%"}),size:({theme:i})=>({auto:"auto",...i("spacing"),"1/2":"50%","1/3":"33.333333%","2/3":"66.666667%","1/4":"25%","2/4":"50%","3/4":"75%","1/5":"20%","2/5":"40%","3/5":"60%","4/5":"80%","1/6":"16.666667%","2/6":"33.333333%","3/6":"50%","4/6":"66.666667%","5/6":"83.333333%","1/12":"8.333333%","2/12":"16.666667%","3/12":"25%","4/12":"33.333333%","5/12":"41.666667%","6/12":"50%","7/12":"58.333333%","8/12":"66.666667%","9/12":"75%","10/12":"83.333333%","11/12":"91.666667%",full:"100%",min:"min-content",max:"max-content",fit:"fit-content"}),width:({theme:i})=>({auto:"auto",...i("spacing"),"1/2":"50%","1/3":"33.333333%","2/3":"66.666667%","1/4":"25%","2/4":"50%","3/4":"75%","1/5":"20%","2/5":"40%","3/5":"60%","4/5":"80%","1/6":"16.666667%","2/6":"33.333333%","3/6":"50%","4/6":"66.666667%","5/6":"83.333333%","1/12":"8.333333%","2/12":"16.666667%","3/12":"25%","4/12":"33.333333%","5/12":"41.666667%","6/12":"50%","7/12":"58.333333%","8/12":"66.666667%","9/12":"75%","10/12":"83.333333%","11/12":"91.666667%",full:"100%",screen:"100vw",svw:"100svw",lvw:"100lvw",dvw:"100dvw",min:"min-content",max:"max-content",fit:"fit-content"}),willChange:{auto:"auto",scroll:"scroll-position",contents:"contents",transform:"transform"},zIndex:{auto:"auto",0:"0",10:"10",20:"20",30:"30",40:"40",50:"50"}},plugins:[]};(function(i){Object.defineProperty(i,"__esModule",{value:!0}),Object.defineProperty(i,"default",{enumerable:!0,get:function(){return n}});const t=Cb,e=r(XM);function r(s){return s&&s.__esModule?s:{default:s}}const n=(0,t.cloneDeep)(e.default.theme)})(Eb);let Vd=Eb;var Ib=(Vd.__esModule?Vd:{default:Vd}).default;const Ab=Tr(Ib);var Mb={},Rb={},Hd={exports:{}},Ot=String,Pb=function(){return{isColorSupported:!1,reset:Ot,bold:Ot,dim:Ot,italic:Ot,underline:Ot,inverse:Ot,hidden:Ot,strikethrough:Ot,black:Ot,red:Ot,green:Ot,yellow:Ot,blue:Ot,magenta:Ot,cyan:Ot,white:Ot,gray:Ot,bgBlack:Ot,bgRed:Ot,bgGreen:Ot,bgYellow:Ot,bgBlue:Ot,bgMagenta:Ot,bgCyan:Ot,bgWhite:Ot}};Hd.exports=Pb(),Hd.exports.createColors=Pb;var WM=Hd.exports;(function(i){Object.defineProperty(i,"__esModule",{value:!0});function t(l,h){for(var c in h)Object.defineProperty(l,c,{enumerable:!0,get:h[c]})}t(i,{dim:function(){return o},default:function(){return a}});const e=r(WM);function r(l){return l&&l.__esModule?l:{default:l}}let n=new Set;function s(l,h,c){typeof process<"u"&&process.env.JEST_WORKER_ID||c&&n.has(c)||(c&&n.add(c),console.warn(""),h.forEach(u=>console.warn(l,"-",u)))}function o(l){return e.default.dim(l)}const a={info(l,h){s(e.default.bold(e.default.cyan("info")),...Array.isArray(l)?[l]:[h,l])},warn(l,h){s(e.default.bold(e.default.yellow("warn")),...Array.isArray(l)?[l]:[h,l])},risk(l,h){s(e.default.bold(e.default.magenta("risk")),...Array.isArray(l)?[l]:[h,l])}}})(Rb),function(i){Object.defineProperty(i,"__esModule",{value:!0}),Object.defineProperty(i,"default",{enumerable:!0,get:function(){return n}});const t=e(Rb);function e(s){return s&&s.__esModule?s:{default:s}}function r({version:s,from:o,to:a}){t.default.warn(`${o}-color-renamed`,[`As of Tailwind CSS ${s}, \`${o}\` has been renamed to \`${a}\`.`,"Update your configuration file to silence this warning."])}const n={inherit:"inherit",current:"currentColor",transparent:"transparent",black:"#000",white:"#fff",slate:{50:"#f8fafc",100:"#f1f5f9",200:"#e2e8f0",300:"#cbd5e1",400:"#94a3b8",500:"#64748b",600:"#475569",700:"#334155",800:"#1e293b",900:"#0f172a",950:"#020617"},gray:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#1f2937",900:"#111827",950:"#030712"},zinc:{50:"#fafafa",100:"#f4f4f5",200:"#e4e4e7",300:"#d4d4d8",400:"#a1a1aa",500:"#71717a",600:"#52525b",700:"#3f3f46",800:"#27272a",900:"#18181b",950:"#09090b"},neutral:{50:"#fafafa",100:"#f5f5f5",200:"#e5e5e5",300:"#d4d4d4",400:"#a3a3a3",500:"#737373",600:"#525252",700:"#404040",800:"#262626",900:"#171717",950:"#0a0a0a"},stone:{50:"#fafaf9",100:"#f5f5f4",200:"#e7e5e4",300:"#d6d3d1",400:"#a8a29e",500:"#78716c",600:"#57534e",700:"#44403c",800:"#292524",900:"#1c1917",950:"#0c0a09"},red:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",600:"#dc2626",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d",950:"#450a0a"},orange:{50:"#fff7ed",100:"#ffedd5",200:"#fed7aa",300:"#fdba74",400:"#fb923c",500:"#f97316",600:"#ea580c",700:"#c2410c",800:"#9a3412",900:"#7c2d12",950:"#431407"},amber:{50:"#fffbeb",100:"#fef3c7",200:"#fde68a",300:"#fcd34d",400:"#fbbf24",500:"#f59e0b",600:"#d97706",700:"#b45309",800:"#92400e",900:"#78350f",950:"#451a03"},yellow:{50:"#fefce8",100:"#fef9c3",200:"#fef08a",300:"#fde047",400:"#facc15",500:"#eab308",600:"#ca8a04",700:"#a16207",800:"#854d0e",900:"#713f12",950:"#422006"},lime:{50:"#f7fee7",100:"#ecfccb",200:"#d9f99d",300:"#bef264",400:"#a3e635",500:"#84cc16",600:"#65a30d",700:"#4d7c0f",800:"#3f6212",900:"#365314",950:"#1a2e05"},green:{50:"#f0fdf4",100:"#dcfce7",200:"#bbf7d0",300:"#86efac",400:"#4ade80",500:"#22c55e",600:"#16a34a",700:"#15803d",800:"#166534",900:"#14532d",950:"#052e16"},emerald:{50:"#ecfdf5",100:"#d1fae5",200:"#a7f3d0",300:"#6ee7b7",400:"#34d399",500:"#10b981",600:"#059669",700:"#047857",800:"#065f46",900:"#064e3b",950:"#022c22"},teal:{50:"#f0fdfa",100:"#ccfbf1",200:"#99f6e4",300:"#5eead4",400:"#2dd4bf",500:"#14b8a6",600:"#0d9488",700:"#0f766e",800:"#115e59",900:"#134e4a",950:"#042f2e"},cyan:{50:"#ecfeff",100:"#cffafe",200:"#a5f3fc",300:"#67e8f9",400:"#22d3ee",500:"#06b6d4",600:"#0891b2",700:"#0e7490",800:"#155e75",900:"#164e63",950:"#083344"},sky:{50:"#f0f9ff",100:"#e0f2fe",200:"#bae6fd",300:"#7dd3fc",400:"#38bdf8",500:"#0ea5e9",600:"#0284c7",700:"#0369a1",800:"#075985",900:"#0c4a6e",950:"#082f49"},blue:{50:"#eff6ff",100:"#dbeafe",200:"#bfdbfe",300:"#93c5fd",400:"#60a5fa",500:"#3b82f6",600:"#2563eb",700:"#1d4ed8",800:"#1e40af",900:"#1e3a8a",950:"#172554"},indigo:{50:"#eef2ff",100:"#e0e7ff",200:"#c7d2fe",300:"#a5b4fc",400:"#818cf8",500:"#6366f1",600:"#4f46e5",700:"#4338ca",800:"#3730a3",900:"#312e81",950:"#1e1b4b"},violet:{50:"#f5f3ff",100:"#ede9fe",200:"#ddd6fe",300:"#c4b5fd",400:"#a78bfa",500:"#8b5cf6",600:"#7c3aed",700:"#6d28d9",800:"#5b21b6",900:"#4c1d95",950:"#2e1065"},purple:{50:"#faf5ff",100:"#f3e8ff",200:"#e9d5ff",300:"#d8b4fe",400:"#c084fc",500:"#a855f7",600:"#9333ea",700:"#7e22ce",800:"#6b21a8",900:"#581c87",950:"#3b0764"},fuchsia:{50:"#fdf4ff",100:"#fae8ff",200:"#f5d0fe",300:"#f0abfc",400:"#e879f9",500:"#d946ef",600:"#c026d3",700:"#a21caf",800:"#86198f",900:"#701a75",950:"#4a044e"},pink:{50:"#fdf2f8",100:"#fce7f3",200:"#fbcfe8",300:"#f9a8d4",400:"#f472b6",500:"#ec4899",600:"#db2777",700:"#be185d",800:"#9d174d",900:"#831843",950:"#500724"},rose:{50:"#fff1f2",100:"#ffe4e6",200:"#fecdd3",300:"#fda4af",400:"#fb7185",500:"#f43f5e",600:"#e11d48",700:"#be123c",800:"#9f1239",900:"#881337",950:"#4c0519"},get lightBlue(){return r({version:"v2.2",from:"lightBlue",to:"sky"}),this.sky},get warmGray(){return r({version:"v3.0",from:"warmGray",to:"stone"}),this.stone},get trueGray(){return r({version:"v3.0",from:"trueGray",to:"neutral"}),this.neutral},get coolGray(){return r({version:"v3.0",from:"coolGray",to:"gray"}),this.gray},get blueGray(){return r({version:"v3.0",from:"blueGray",to:"slate"}),this.slate}}}(Mb);let Kd=Mb;var ZM=(Kd.__esModule?Kd:{default:Kd}).default;const $l=BM,VM=Zd,Lb=Ib,zr=ZM,[HM,{lineHeight:KM}]=Lb.fontSize.base,{spacing:yr,borderWidth:Gb,borderRadius:kb}=Lb;VM.withOptions(function(i={strategy:void 0}){return function({addBase:t,addComponents:e,theme:r}){const n=i.strategy===void 0?["base","class"]:[i.strategy],s=[{base:["[type='text']","[type='email']","[type='url']","[type='password']","[type='number']","[type='date']","[type='datetime-local']","[type='month']","[type='search']","[type='tel']","[type='time']","[type='week']","[multiple]","textarea","select"],class:[".form-input",".form-textarea",".form-select",".form-multiselect"],styles:{appearance:"none","background-color":"#fff","border-color":r("colors.gray.500",zr.gray[500]),"border-width":Gb.DEFAULT,"border-radius":kb.none,"padding-top":yr[2],"padding-right":yr[3],"padding-bottom":yr[2],"padding-left":yr[3],"font-size":HM,"line-height":KM,"--tw-shadow":"0 0 #0000","&:focus":{outline:"2px solid transparent","outline-offset":"2px","--tw-ring-inset":"var(--tw-empty,/*!*/ /*!*/)","--tw-ring-offset-width":"0px","--tw-ring-offset-color":"#fff","--tw-ring-color":r("colors.blue.600",zr.blue[600]),"--tw-ring-offset-shadow":"var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)","--tw-ring-shadow":"var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color)","box-shadow":"var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)","border-color":r("colors.blue.600",zr.blue[600])}}},{base:["input::placeholder","textarea::placeholder"],class:[".form-input::placeholder",".form-textarea::placeholder"],styles:{color:r("colors.gray.500",zr.gray[500]),opacity:"1"}},{base:["::-webkit-datetime-edit-fields-wrapper"],class:[".form-input::-webkit-datetime-edit-fields-wrapper"],styles:{padding:"0"}},{base:["::-webkit-date-and-time-value"],class:[".form-input::-webkit-date-and-time-value"],styles:{"min-height":"1.5em"}},{base:["::-webkit-datetime-edit","::-webkit-datetime-edit-year-field","::-webkit-datetime-edit-month-field","::-webkit-datetime-edit-day-field","::-webkit-datetime-edit-hour-field","::-webkit-datetime-edit-minute-field","::-webkit-datetime-edit-second-field","::-webkit-datetime-edit-millisecond-field","::-webkit-datetime-edit-meridiem-field"],class:[".form-input::-webkit-datetime-edit",".form-input::-webkit-datetime-edit-year-field",".form-input::-webkit-datetime-edit-month-field",".form-input::-webkit-datetime-edit-day-field",".form-input::-webkit-datetime-edit-hour-field",".form-input::-webkit-datetime-edit-minute-field",".form-input::-webkit-datetime-edit-second-field",".form-input::-webkit-datetime-edit-millisecond-field",".form-input::-webkit-datetime-edit-meridiem-field"],styles:{"padding-top":0,"padding-bottom":0}},{base:["select"],class:[".form-select"],styles:{"background-image":`url("${$l(`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 20"><path stroke="${r("colors.gray.500",zr.gray[500])}" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M6 8l4 4 4-4"/></svg>`)}")`,"background-position":`right ${yr[2]} center`,"background-repeat":"no-repeat","background-size":"1.5em 1.5em","padding-right":yr[10],"print-color-adjust":"exact"}},{base:["[multiple]"],class:null,styles:{"background-image":"initial","background-position":"initial","background-repeat":"unset","background-size":"initial","padding-right":yr[3],"print-color-adjust":"unset"}},{base:["[type='checkbox']","[type='radio']"],class:[".form-checkbox",".form-radio"],styles:{appearance:"none",padding:"0","print-color-adjust":"exact",display:"inline-block","vertical-align":"middle","background-origin":"border-box","user-select":"none","flex-shrink":"0",height:yr[4],width:yr[4],color:r("colors.blue.600",zr.blue[600]),"background-color":"#fff","border-color":r("colors.gray.500",zr.gray[500]),"border-width":Gb.DEFAULT,"--tw-shadow":"0 0 #0000"}},{base:["[type='checkbox']"],class:[".form-checkbox"],styles:{"border-radius":kb.none}},{base:["[type='radio']"],class:[".form-radio"],styles:{"border-radius":"100%"}},{base:["[type='checkbox']:focus","[type='radio']:focus"],class:[".form-checkbox:focus",".form-radio:focus"],styles:{outline:"2px solid transparent","outline-offset":"2px","--tw-ring-inset":"var(--tw-empty,/*!*/ /*!*/)","--tw-ring-offset-width":"2px","--tw-ring-offset-color":"#fff","--tw-ring-color":r("colors.blue.600",zr.blue[600]),"--tw-ring-offset-shadow":"var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)","--tw-ring-shadow":"var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color)","box-shadow":"var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)"}},{base:["[type='checkbox']:checked","[type='radio']:checked"],class:[".form-checkbox:checked",".form-radio:checked"],styles:{"border-color":"transparent","background-color":"currentColor","background-size":"100% 100%","background-position":"center","background-repeat":"no-repeat"}},{base:["[type='checkbox']:checked"],class:[".form-checkbox:checked"],styles:{"background-image":`url("${$l('<svg viewBox="0 0 16 16" fill="white" xmlns="http://www.w3.org/2000/svg"><path d="M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z"/></svg>')}")`}},{base:["[type='radio']:checked"],class:[".form-radio:checked"],styles:{"background-image":`url("${$l('<svg viewBox="0 0 16 16" fill="white" xmlns="http://www.w3.org/2000/svg"><circle cx="8" cy="8" r="3"/></svg>')}")`}},{base:["[type='checkbox']:checked:hover","[type='checkbox']:checked:focus","[type='radio']:checked:hover","[type='radio']:checked:focus"],class:[".form-checkbox:checked:hover",".form-checkbox:checked:focus",".form-radio:checked:hover",".form-radio:checked:focus"],styles:{"border-color":"transparent","background-color":"currentColor"}},{base:["[type='checkbox']:indeterminate"],class:[".form-checkbox:indeterminate"],styles:{"background-image":`url("${$l('<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 16 16"><path stroke="white" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 8h8"/></svg>')}")`,"border-color":"transparent","background-color":"currentColor","background-size":"100% 100%","background-position":"center","background-repeat":"no-repeat"}},{base:["[type='checkbox']:indeterminate:hover","[type='checkbox']:indeterminate:focus"],class:[".form-checkbox:indeterminate:hover",".form-checkbox:indeterminate:focus"],styles:{"border-color":"transparent","background-color":"currentColor"}},{base:["[type='file']"],class:null,styles:{background:"unset","border-color":"inherit","border-width":"0","border-radius":"0",padding:"0","font-size":"unset","line-height":"inherit"}},{base:["[type='file']:focus"],class:null,styles:{outline:["1px solid ButtonText","1px auto -webkit-focus-ring-color"]}}],o=a=>s.map(l=>l[a]===null?null:{[l[a]]:l.styles}).filter(Boolean);n.includes("base")&&t(o("base")),n.includes("class")&&e(o("class"))}});const zM=Zd;function Fb(i){return Object.fromEntries(Object.entries(i).filter(([t])=>t!=="DEFAULT"))}zM(({addUtilities:i,matchUtilities:t,theme:e})=>{i({"@keyframes enter":e("keyframes.enter"),"@keyframes exit":e("keyframes.exit"),".animate-in":{animationName:"enter",animationDuration:e("animationDuration.DEFAULT"),"--tw-enter-opacity":"initial","--tw-enter-scale":"initial","--tw-enter-rotate":"initial","--tw-enter-translate-x":"initial","--tw-enter-translate-y":"initial"},".animate-out":{animationName:"exit",animationDuration:e("animationDuration.DEFAULT"),"--tw-exit-opacity":"initial","--tw-exit-scale":"initial","--tw-exit-rotate":"initial","--tw-exit-translate-x":"initial","--tw-exit-translate-y":"initial"}}),t({"fade-in":r=>({"--tw-enter-opacity":r}),"fade-out":r=>({"--tw-exit-opacity":r})},{values:e("animationOpacity")}),t({"zoom-in":r=>({"--tw-enter-scale":r}),"zoom-out":r=>({"--tw-exit-scale":r})},{values:e("animationScale")}),t({"spin-in":r=>({"--tw-enter-rotate":r}),"spin-out":r=>({"--tw-exit-rotate":r})},{values:e("animationRotate")}),t({"slide-in-from-top":r=>({"--tw-enter-translate-y":`-${r}`}),"slide-in-from-bottom":r=>({"--tw-enter-translate-y":r}),"slide-in-from-left":r=>({"--tw-enter-translate-x":`-${r}`}),"slide-in-from-right":r=>({"--tw-enter-translate-x":r}),"slide-out-to-top":r=>({"--tw-exit-translate-y":`-${r}`}),"slide-out-to-bottom":r=>({"--tw-exit-translate-y":r}),"slide-out-to-left":r=>({"--tw-exit-translate-x":`-${r}`}),"slide-out-to-right":r=>({"--tw-exit-translate-x":r})},{values:e("animationTranslate")}),t({duration:r=>({animationDuration:r})},{values:Fb(e("animationDuration"))}),t({delay:r=>({animationDelay:r})},{values:e("animationDelay")}),t({ease:r=>({animationTimingFunction:r})},{values:Fb(e("animationTimingFunction"))}),i({".running":{animationPlayState:"running"},".paused":{animationPlayState:"paused"}}),t({"fill-mode":r=>({animationFillMode:r})},{values:e("animationFillMode")}),t({direction:r=>({animationDirection:r})},{values:e("animationDirection")}),t({repeat:r=>({animationIterationCount:r})},{values:e("animationRepeat")})},{theme:{extend:{animationDelay:({theme:i})=>({...i("transitionDelay")}),animationDuration:({theme:i})=>({0:"0ms",...i("transitionDuration")}),animationTimingFunction:({theme:i})=>({...i("transitionTimingFunction")}),animationFillMode:{none:"none",forwards:"forwards",backwards:"backwards",both:"both"},animationDirection:{normal:"normal",reverse:"reverse",alternate:"alternate","alternate-reverse":"alternate-reverse"},animationOpacity:({theme:i})=>({DEFAULT:0,...i("opacity")}),animationTranslate:({theme:i})=>({DEFAULT:"100%",...i("translate")}),animationScale:({theme:i})=>({DEFAULT:0,...i("scale")}),animationRotate:({theme:i})=>({DEFAULT:"30deg",...i("rotate")}),animationRepeat:{0:"0",1:"1",infinite:"infinite"},keyframes:{enter:{from:{opacity:"var(--tw-enter-opacity, 1)",transform:"translate3d(var(--tw-enter-translate-x, 0), var(--tw-enter-translate-y, 0), 0) scale3d(var(--tw-enter-scale, 1), var(--tw-enter-scale, 1), var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))"}},exit:{to:{opacity:"var(--tw-exit-opacity, 1)",transform:"translate3d(var(--tw-exit-translate-x, 0), var(--tw-exit-translate-y, 0), 0) scale3d(var(--tw-exit-scale, 1), var(--tw-exit-scale, 1), var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))"}}}}}});const Db="Inter Variable",YM="Inconsolata Variable";[...Ab.fontFamily.sans],[...Ab.fontFamily.mono];const jM={".bg-floating":{backgroundColor:"var(--p-color-bg-floating)"},".bg-floating-sticky":{backgroundColor:"var(--p-color-bg-floating-sticky)"},".bg-code":{backgroundColor:"var(--p-color-bg-code)"},".bg-overlay":{backgroundColor:"var(--p-color-bg-overlay)"},".bg-selected":{backgroundColor:"var(--p-color-selected)"},".border-default":{borderColor:"var(--p-color-divider)"},".border-selected":{borderColor:"var(--p-color-selected)"},".text-default":{color:"var(--p-color-text-default)"},".text-subdued":{color:"var(--p-color-text-subdued)"},".text-inverse":{color:"var(--p-color-text-inverse)"},".text-link":{color:"var(--p-color-text-link)"},".text-code":{color:"var(--p-color-text-code)"},".text-invalid":{color:"var(--p-color-text-invalid)"},".text-selected":{color:"var(--p-color-text-selected)"},".caret-default":{caretColor:"var(--p-color-text-default)"}};UM(({addUtilities:i})=>i(jM));var Nb={exports:{}};(function(i){(function(){function t(m,g){document.addEventListener?m.addEventListener("scroll",g,!1):m.attachEvent("scroll",g)}function e(m){document.body?m():document.addEventListener?document.addEventListener("DOMContentLoaded",function g(){document.removeEventListener("DOMContentLoaded",g),m()}):document.attachEvent("onreadystatechange",function g(){(document.readyState=="interactive"||document.readyState=="complete")&&(document.detachEvent("onreadystatechange",g),m())})}function r(m){this.g=document.createElement("div"),this.g.setAttribute("aria-hidden","true"),this.g.appendChild(document.createTextNode(m)),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 n(m,g){m.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 s(m){var g=m.g.offsetWidth,y=g+100;return m.j.style.width=y+"px",m.i.scrollLeft=y,m.h.scrollLeft=m.h.scrollWidth+100,m.l!==g?(m.l=g,!0):!1}function o(m,g){function y(){var b=x;s(b)&&b.g.parentNode!==null&&g(b.l)}var x=m;t(m.h,y),t(m.i,y),s(m)}function a(m,g,y){g=g||{},y=y||window,this.family=m,this.style=g.style||"normal",this.weight=g.weight||"normal",this.stretch=g.stretch||"normal",this.context=y}var l=null,h=null,c=null,u=null;function d(m){return h===null&&(f(m)&&/Apple/.test(window.navigator.vendor)?(m=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))(?:\.([0-9]+))/.exec(window.navigator.userAgent),h=!!m&&603>parseInt(m[1],10)):h=!1),h}function f(m){return u===null&&(u=!!m.document.fonts),u}function p(m,g){var y=m.style,x=m.weight;if(c===null){var b=document.createElement("div");try{b.style.font="condensed 100px sans-serif"}catch{}c=b.style.font!==""}return[y,x,c?m.stretch:"","100px",g].join(" ")}a.prototype.load=function(m,g){var y=this,x=m||"BESbswy",b=0,v=g||3e3,w=new Date().getTime();return new Promise(function(S,C){if(f(y.context)&&!d(y.context)){var I=new Promise(function(L,G){function F(){new Date().getTime()-w>=v?G(Error(""+v+"ms timeout exceeded")):y.context.document.fonts.load(p(y,'"'+y.family+'"'),x).then(function(A){1<=A.length?L():setTimeout(F,25)},G)}F()}),M=new Promise(function(L,G){b=setTimeout(function(){G(Error(""+v+"ms timeout exceeded"))},v)});Promise.race([M,I]).then(function(){clearTimeout(b),S(y)},C)}else e(function(){function L(){var V;(V=Z!=-1&&K!=-1||Z!=-1&&H!=-1||K!=-1&&H!=-1)&&((V=Z!=K&&Z!=H&&K!=H)||(l===null&&(V=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),l=!!V&&(536>parseInt(V[1],10)||parseInt(V[1],10)===536&&11>=parseInt(V[2],10))),V=l&&(Z==j&&K==j&&H==j||Z==B&&K==B&&H==B||Z==D&&K==D&&H==D)),V=!V),V&&(k.parentNode!==null&&k.parentNode.removeChild(k),clearTimeout(b),S(y))}function G(){if(new Date().getTime()-w>=v)k.parentNode!==null&&k.parentNode.removeChild(k),C(Error(""+v+"ms timeout exceeded"));else{var V=y.context.document.hidden;(V===!0||V===void 0)&&(Z=F.g.offsetWidth,K=A.g.offsetWidth,H=N.g.offsetWidth,L()),b=setTimeout(G,50)}}var F=new r(x),A=new r(x),N=new r(x),Z=-1,K=-1,H=-1,j=-1,B=-1,D=-1,k=document.createElement("div");k.dir="ltr",n(F,p(y,"sans-serif")),n(A,p(y,"serif")),n(N,p(y,"monospace")),k.appendChild(F.g),k.appendChild(A.g),k.appendChild(N.g),y.context.document.body.appendChild(k),j=F.g.offsetWidth,B=A.g.offsetWidth,D=N.g.offsetWidth,G(),o(F,function(V){Z=V,L()}),n(F,p(y,'"'+y.family+'",sans-serif')),o(A,function(V){K=V,L()}),n(A,p(y,'"'+y.family+'",serif')),o(N,function(V){H=V,L()}),n(N,p(y,'"'+y.family+'",monospace'))})})},i.exports=a})()})(Nb);var JM=Nb.exports;const $M=Tr(JM),Ob={inter:{fontFamily:Db,fontSize:16,lineHeight:20,fill:16777215}},Bb={resolution:4,chars:pi.ASCII},Ub="sans-serif",Xb={inter:eR(Ob.inter)};let zd=!1;async function QM(){const i=Object.values(Ob);await Promise.all(i.map(t=>qM(t))),zd=!0,tt.emit("fontsLoaded",Xb)}async function qM(i){const{fontFamily:t,...e}=i,r=new $M(t);try{await r.load()}catch(n){console.error(n),console.warn(`fonts: font ${t} failed to load, falling back to ${Ub}`),pi.from(t,{fontFamily:Ub,...e},Bb);return}pi.from(t,i,Bb)}function tR(){zd=!1}async function Wb(){return zd?Xb:await Ie("fontsLoaded")}function eR(i){const{fontFamily:t,...e}=i,r={fontName:t,...e};return n=>new R2(n,r)}async function Ql({cullAtZoomThreshold:i=!0}={}){const{inter:t}=await Wb(),e=await xb(),r=t("");i&&e.add(r);async function n(s){return r.text=s,await r}return{element:r,render:n}}const iR=["result","markdown","table","unknown"],Zb={markdown:"ArtifactMarkdown",table:"ArtifactTable",result:"ArtifactResult",unknown:"Artifact"},Yd=["flow-run","task-run"];function rR(i){return Yd.includes(i)}function ql(i){return Yd.includes(i.kind)}function Vb(i){return i.kind==="artifact"}function Hb(i){return i.kind==="artifacts"}function Kb(i){return i.kind==="state"}function zb(i){return i.kind==="event"}function Yb(i){return i.kind==="events"}const nR=["COMPLETED","RUNNING","SCHEDULED","PENDING","FAILED","CANCELLED","CANCELLING","CRASHED","PAUSED"];async function jb({cullAtZoomThreshold:i}){const t=await Lt(),e=new Ct,r=new Ct,{element:n,render:s}=await GM({cullAtZoomThreshold:i}),{element:o,render:a}=await Ql({cullAtZoomThreshold:i}),{element:l,render:h}=await MM();let c=!1,u=null,d=null;r.addChild(n),r.addChild(o),e.addChild(l),e.addChild(r);async function f(y){if(y){const{selected:x,name:b,type:v}=y;c=x??c,u=b??u,d=v??d}return await Promise.all([p(),m()]),await g(),e}async function p(){if(!d)return n;const y=Zb[d],{artifactIconSize:x,artifactIconColor:b,artifactPaddingLeft:v,artifactPaddingY:w}=t.styles,S=await s(y);return S.position={x:v,y:w},S.width=x,S.height=x,S.tint=b,S}async function m(){if(!u)return o.visible=!1,o;await a(u);const{artifactPaddingLeft:y,artifactPaddingY:x,artifactTextColor:b,artifactIconSize:v,artifactContentGap:w}=t.styles,S=y+v+w,C=x;return o.tint=b,o.scale.set(.75),o.position={x:S,y:C},o.visible=!0,o}async function g(){const{artifactPaddingLeft:y,artifactPaddingRight:x,artifactPaddingY:b}=t.styles,v={selected:c,width:r.width+y+x,height:r.height+b*2};return await h(v)}return{element:e,render:f}}let zt=null,th=!1;async function sR(){const i=await ee();i.on("click",()=>Wi(null)),i.on("drag-start",()=>{th=!0}),i.on("drag-end",()=>{setTimeout(()=>{th=!1})})}function oR(){zt=null,th=!1}function Wi(i){if(!th&&!(!i&&!zt||i&&br(i))){if(zt=i,i===null){tt.emit("itemSelected",null);return}tt.emit("itemSelected",i)}}function br(i){if(zt===null)return!1;const{kind:t}=i;switch(t){case"task-run":return ql(zt)&&zt.id===i.id;case"flow-run":return ql(zt)&&zt.id===i.id;case"artifact":return Vb(zt)&&zt.id===i.id;case"artifacts":return Hb(zt)&&zt.ids.length===i.ids.length&&zt.ids.every(r=>i.ids.includes(r));case"state":return Kb(zt)&&zt.id===i.id;case"event":return zb(zt)&&zt.id===i.id;case"events":return Yb(zt)&&zt.ids.length===i.ids.length&&zt.ids.every(r=>i.ids.includes(r));default:const e=t;throw new Error(`switch does not have case for value: ${e}`)}}function aR(){return zt&&ql(zt)?zt:null}async function jd(i,{cullAtZoomThreshold:t=!0,enableLocalClickHandling:e=!1}={}){const{element:r,render:n}=await jb({cullAtZoomThreshold:t});let s=!1;r.eventMode="static",r.cursor="pointer",e&&r.on("click",c=>{c.stopPropagation(),Wi({kind:"artifact",id:i.id})}),tt.on("itemSelected",()=>{const c=br({kind:"artifact",id:i.id});c!==s&&(s=c,o())});async function o(){await n({selected:s,name:i.key,type:i.type})}function a(){return s}function l(){return i.created}function h(){return i.id}return{element:r,render:o,getSelected:a,getDate:l,getId:h}}async function Jb(i,t){const e=await Zi(),r=await Lt();let n,s=null;async function o(){try{s=await r.fetchEvents(Y.toValue(i)),t(s)}catch(l){console.error(l)}e.end_time||(n=setTimeout(()=>o(),r.fetchEventsInterval))}function a(){clearTimeout(n)}return{start:o,stop:a}}async function lR(){const i=await Lt(),t=await xb(),e=new Ct,{element:r,render:n}=await vb(),{element:s,render:o}=await Nd(),{element:a,render:l}=await Od();t.add(e);let h=!1;e.eventMode="static",e.cursor="pointer",e.addChild(s),e.addChild(r),e.addChild(a),e.on("mouseover",u),e.on("mouseout",d);async function c({inside:f,isOpen:p}){h=f;const m={size:10,stroke:2,rotate:p?jl.Up:jl.Down},g=await n(m),y={width:i.styles.nodeToggleSize,height:i.styles.nodeToggleSize,background:i.styles.nodeToggleBgColor,radius:i.styles.nodeToggleBorderRadius},x=await o(y);x.alpha=f?0:.5;const b=await l({width:y.width,height:y.height,radius:y.radius,stroke:1,color:i.styles.nodeToggleBorderColor});b.alpha=f?0:1;const v={y:x.height/2,x:x.width/2},w=m.size/4;return g.x=v.x,g.y=p?v.y+w:v.y-w,e}function u(){s.alpha=h?.5:1}function d(){s.alpha=h?0:.5}return{element:e,render:c}}async function $b(){const i=await Lt(),t=await ie(),e=new Ct,{element:r,render:n}=await Nd(),{element:s,render:o}=await Jl();e.addChild(r),e.addChild(s);async function a(h){const{background:c="#fff"}=i.styles.node(h),{nodeHeight:u,nodeRadius:d}=i.styles,f=br({kind:h.kind,id:h.id}),p=l(h,d),m=h.state_type!=="RUNNING"||t.isDependency();return await Promise.all([n({width:p,height:u,radius:d,background:c,capRight:m}),o({selected:f,width:p,height:u})]),r}function l(h,c){const u=$d();if(it.isTemporal()||it.isLeftAligned()){const d=h.start_time,f=h.end_time??new Date,m=Vf(f,d)/ca*u;return Math.max(m,c*2)}return u}return{element:e,render:a}}var Qb="Expected a function",qb=NaN,hR="[object Symbol]",cR=/^\s+|\s+$/g,uR=/^[-+]0x[0-9a-f]+$/i,dR=/^0b[01]+$/i,fR=/^0o[0-7]+$/i,pR=parseInt,mR=typeof we=="object"&&we&&we.Object===Object&&we,gR=typeof self=="object"&&self&&self.Object===Object&&self,yR=mR||gR||Function("return this")(),bR=Object.prototype,xR=bR.toString,_R=Math.max,vR=Math.min,Jd=function(){return yR.Date.now()};function wR(i,t,e){var r,n,s,o,a,l,h=0,c=!1,u=!1,d=!0;if(typeof i!="function")throw new TypeError(Qb);t=t1(t)||0,eh(e)&&(c=!!e.leading,u="maxWait"in e,s=u?_R(t1(e.maxWait)||0,t):s,d="trailing"in e?!!e.trailing:d);function f(S){var C=r,I=n;return r=n=void 0,h=S,o=i.apply(I,C),o}function p(S){return h=S,a=setTimeout(y,t),c?f(S):o}function m(S){var C=S-l,I=S-h,M=t-C;return u?vR(M,s-I):M}function g(S){var C=S-l,I=S-h;return l===void 0||C>=t||C<0||u&&I>=s}function y(){var S=Jd();if(g(S))return x(S);a=setTimeout(y,m(S))}function x(S){return a=void 0,d&&r?f(S):(r=n=void 0,o)}function b(){a!==void 0&&clearTimeout(a),h=0,r=l=n=a=void 0}function v(){return a===void 0?o:x(Jd())}function w(){var S=Jd(),C=g(S);if(r=arguments,n=this,l=S,C){if(a===void 0)return p(l);if(u)return a=setTimeout(y,t),f(l)}return a===void 0&&(a=setTimeout(y,t)),o}return w.cancel=b,w.flush=v,w}function TR(i,t,e){var r=!0,n=!0;if(typeof i!="function")throw new TypeError(Qb);return eh(e)&&(r="leading"in e?!!e.leading:r,n="trailing"in e?!!e.trailing:n),wR(i,t,{leading:r,maxWait:t,trailing:n})}function eh(i){var t=typeof i;return!!i&&(t=="object"||t=="function")}function SR(i){return!!i&&typeof i=="object"}function ER(i){return typeof i=="symbol"||SR(i)&&xR.call(i)==hR}function t1(i){if(typeof i=="number")return i;if(ER(i))return qb;if(eh(i)){var t=typeof i.valueOf=="function"?i.valueOf():i;i=eh(t)?t+"":t}if(typeof i!="string")return i===0?i:+i;i=i.replace(cR,"");var e=dR.test(i);return e||fR.test(i)?pR(i.slice(2),e?2:8):uR.test(i)?qb:+i}var CR=TR;const e1=Tr(CR);async function i1(){const{element:i,render:t}=await jb({cullAtZoomThreshold:!1});let e=null,r=[],n=!1;i.eventMode="static",i.cursor="pointer",tt.on("itemSelected",()=>{const h=br({kind:"artifacts",ids:r});h!==n&&e&&(n=h,s({ids:r,date:e}))});async function s(h){if(!h){e=null,r=[],i.visible=!1;return}const{ids:c,date:u}=h;e=u,r=c,await t({selected:n,type:"unknown",name:c.length.toString()}),i.visible=!0}function o(){return n}function a(){return e}function l(){return r}return{element:i,render:s,getSelected:o,getDate:a,getIds:l,isCluster:!0}}async function IR(){const i=await qt(),t=await Zi(),e=await ie(),{element:r,render:n,update:s}=await g1({isRoot:!0});r.zIndex=4;function o(a){if(it.isTemporal()&&!e.disableArtifacts){i.stage.addChild(r),n(a==null?void 0:a.artifacts);return}i.stage.removeChild(r)}t.artifacts&&o(t),tt.on("viewportMoved",()=>s()),tt.on("runDataCreated",a=>o(a)),tt.on("runDataUpdated",a=>o(a)),tt.on("configUpdated",()=>o()),tt.on("layoutSettingsUpdated",()=>o())}function lL(){}async function AR({radius:i}){const t=await qt(),e=new ds;return e.beginFill("#fff"),e.drawCircle(0,0,i),e.endFill(),t.renderer.generateTexture(e,{resolution:10})}async function MR(i){return await Uo(AR,[i])}async function r1(i){const t=await MR(i);return new Qt(t)}async function n1(i){const t=new Ct,e=await Lt(),r=await gr(),n=await r1({radius:e.styles.eventRadiusDefault}),{element:s,render:o}=await Jl();let a=!1;t.addChild(r),t.addChild(n),t.addChild(s),t.eventMode="static",t.cursor="pointer",t.on("mouseenter",()=>{a||n.scale.set(1.5)}),t.on("mouseleave",()=>{a||n.scale.set(1)}),tt.on("itemSelected",()=>{const u=br({kind:"event",id:i.id,occurred:i.occurred});u!==a&&(a=u,n.scale.set(u?1.5:1),l())});function l(){const{eventColor:u,eventTargetSize:d,eventSelectedBorderInset:f}=e.styles;r.alpha=0,r.width=d,r.height=d,n.tint=u,n.anchor.set(.5),n.position.set(d/2,d/2),s.position.set(f,f),o({selected:a,width:d-f*2,height:d-f*2})}function h(){return i.id}function c(){return i.occurred}return{element:t,render:l,getId:h,getDate:c}}async function s1(){const i=new Ct,t=await Lt(),e=await gr(),r=await r1({radius:t.styles.eventClusterRadiusDefault}),{element:n,render:s}=await Jl(),{element:o,render:a}=await Ql({cullAtZoomThreshold:!1});let l=null,h=[],c=!1;i.addChild(e),i.addChild(r),i.addChild(o),i.addChild(n),i.eventMode="static",i.cursor="pointer",i.on("mouseenter",()=>{c||r.scale.set(1.5)}),i.on("mouseleave",()=>{c||r.scale.set(1)}),tt.on("itemSelected",()=>{const x=br({kind:"events",occurred:l,ids:h});x!==c&&(c=x,r.scale.set(x?1.5:1),l&&u({ids:h,date:l}))});async function u(x){if(!x){l=null,h=[],i.visible=!1;return}const{ids:b,date:v}=x;l=v,h=b,d(),f(),m(),await p(b.length.toString()),i.visible=!0}function d(){const{eventTargetSize:x}=t.styles;e.alpha=0,e.width=x,e.height=x}function f(){const{eventClusterColor:x,eventTargetSize:b}=t.styles;r.tint=x,r.anchor.set(.5),r.position.set(b/2,b/2)}async function p(x){if(h.length<2)return;const{eventTargetSize:b}=t.styles,v=-1;o.scale.set(.6),o.anchor.set(.5),o.position.set(b/2,b/2+v),await a(x)}function m(){const{eventSelectedBorderInset:x,eventTargetSize:b}=t.styles;n.position.set(x,x),s({selected:c,width:b-x*2,height:b-x*2})}function g(){return h}function y(){return l}return{element:i,render:u,getIds:g,getDate:y}}function Yr(i){return"getIds"in i}async function o1({items:i,createCluster:t}){const e=[...i.values()].sort((o,a)=>o.element.x-a.element.x);async function r(o){let a,l=null,h=null;for(let c=o??0;c<e.length;c++){const u=e[c],d=u.element.x;if(u.element.visible=!0,l!==null&&a&&d<a){h=c;break}l=c,a=d+u.element.width}if(h!==null&&l!==null){const c=e[l],u=e[h];c.element.visible=!1,u.element.visible=!1;const d=await n(c,u);d&&(e.splice(l,1,d),e.splice(h,1)),r(l)}}async function n(o,a){const l=o.getDate(),h=a.getDate(),c=Yr(o)?o.getIds():[o.getId()],u=Yr(a)?a.getIds():[a.getId()];if(!l||!h)return console.error("flowRunArtifacts: visible item is missing date"),null;let d;Yr(o)?d=o:Yr(a)?d=a:d=await t();const f=[...c,...u],p=s(f);return await d.render({ids:f,date:p}),d}function s(o){const a=o.reduce((c,u)=>{const d=i.get(u),f=d==null?void 0:d.getDate();return f&&c.push(f.getTime()),c},[]),l=Math.min(...a),h=Math.max(...a);return new Date((l+h)/2)}await r()}async function a1(i){const t=await qt(),e=await ee(),r=await Lt(),n=await ie();let s=await ri();const o=await l();o.element.on("click",c=>{c.stopPropagation();const{element:u}=o,d={x:u.position.x,y:u.position.y,width:u.width,height:u.height},f=Yr(o)?{kind:"events",ids:o.getIds(),occurred:o.getDate(),position:d}:{kind:"event",id:o.getId(),occurred:o.getDate(),position:d};Wi(f)}),tt.on("scaleUpdated",c=>{s=c,h()}),tt.on("viewportMoved",()=>h());async function a(c){await o.render(c),h()}async function l(){return i.type==="event"?await n1(i.event):await s1()}function h(){const c=o.getDate();if(!c||n.disableEvents||!it.isTemporal())return;const{element:u}=o,f=s(c)*e.scale._x+e.worldTransform.tx-u.width/2,p=t.screen.height-u.height-r.styles.eventBottomMargin;u.position.set(f,p)}return{...o,render:a}}async function l1(i){const t=await ee(),e=await ie();let r=await ri();const n=await o();n.element.on("click",l=>{l.stopPropagation();const{element:h}=n,c=h.getGlobalPosition(),u={x:c.x,y:c.y,width:h.width*t.scale.x,height:h.height*t.scale.y},d=Yr(n)?{kind:"events",ids:n.getIds(),occurred:n.getDate(),position:u}:{kind:"event",id:n.getId(),occurred:n.getDate(),position:u};Wi(d)}),tt.on("scaleUpdated",l=>{r=l,a()});async function s(l){await n.render(l),a()}async function o(){return i.type==="event"?await n1(i.event):await s1()}function a(){const l=n.getDate(),{parentStartDate:h}=i;if(!l||e.disableEvents||!it.isTemporal()||!h)return;const{element:c}=n,d=r(l)-r(h)-c.width/2,f=-c.height;c.position.set(d,f)}return{...n,render:s}}async function h1({isRoot:i,parentStartDate:t}={}){const e=await ie(),r=new Map,n=new Map,s=[];let o=[];const a=new Ct;let l=null;tt.on("scaleUpdated",()=>u());async function h(p){if(p&&(l=p),!l)return;const m=[];for(const g of l)m.push(c(g));await Promise.all(m),u()}async function c(p){if(r.has(p.id))return r.get(p.id).render();if(n.has(p.id))return await n.get(p.id);const m=(async()=>{const g=i?await a1({type:"event",event:p}):await l1({type:"event",event:p,parentStartDate:t});r.set(p.id,g),a.addChild(g.element)})();return n.set(p.id,m),await m,n.delete(p.id),r.get(p.id).render()}function u(){e.disableEvents||!it.isTemporal()||d()}const d=e1(async()=>{o=[...s],await o1({items:r,createCluster:f});for(const p of o)p.render()},250);async function f(){if(o.length>0)return o.pop();const p=i?await a1({type:"cluster"}):await l1({type:"cluster",parentStartDate:t});return a.addChild(p.element),s.push(p),p}return{element:a,render:h,update:u}}let Wo=null,Ls=null;async function RR(){const i=await qt(),t=await Lt(),e=await ie(),r=await Zi(),{element:n,render:s,update:o}=await h1({isRoot:!0});n.zIndex=2;async function a(h){if(!it.isTemporal()||e.disableEvents){i.stage.removeChild(n);return}i.stage.addChild(n),await s(h)}const l=await Jb(()=>({nodeId:t.runId,since:r.start_time,until:r.end_time??new Date}),h=>{const c=Ls?"eventDataUpdated":"eventDataCreated";Ls=h,tt.emit(c,Ls),a(h)});tt.on("configUpdated",()=>a()),tt.on("viewportMoved",()=>o()),tt.on("layoutSettingsUpdated",()=>a()),Wo=l.stop,l.start()}function PR(){Wo==null||Wo(),Wo=null,Ls=null}async function LR(){return Ls||await Ie("eventDataCreated")}async function GR(i){const t=await qt(),e=await ee(),r=await Lt(),n=await Zi();let s=await ri();const o=new Ct,a=await gr(),l=await gr();let h=null,c=!1,u=!1;t.stage.addChild(l),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 b={x:a.position.x,y:a.position.y,width:a.width,height:a.height};Wi({...i,kind:"state",position:b})}),tt.on("viewportMoved",()=>d()),tt.on("scaleUpdated",b=>{s=b,d()}),tt.on("itemSelected",()=>{const b=br({kind:"state",...i});b!==u&&(u=b,c=!1,d())}),i.type==="RUNNING"&&!n.end_time&&g();function d(b){const{end:v}=b??{};if(v&&(h=v),n.end_time&&y(),!it.isTemporal()){l.visible=!1,o.visible=!1;return}const w=f();p(w),m(w),l.visible=!0,o.visible=!0}function f(){const{background:b="#fff"}=r.styles.state(i),v=Math.max(s(i.timestamp)*e.scale._x+e.worldTransform.tx,0);let w=0;return i.type==="RUNNING"&&!n.end_time?w=s(new Date)*e.scale._x+e.worldTransform.tx-v:h?w=s(h)*e.scale._x+e.worldTransform.tx-v:w=t.screen.width-v,{x:v,width:Math.max(w,0),background:b}}function p({x:b,width:v,background:w}){const{flowStateBarHeight:S,flowStateSelectedBarHeight:C}=r.styles,I=c||u?C:S;a.x=b,a.y=t.screen.height-I,a.width=v,a.height=I,a.tint=w}function m({x:b,width:v,background:w}){if(i.type==="RUNNING"){l.visible=!1;return}const{flowStateBarHeight:S,flowStateAreaAlpha:C}=r.styles;l.x=b,l.y=0,l.width=v,l.height=t.screen.height-S,l.tint=w,l.alpha=C}function g(){t.ticker.add(x)}function y(){t.ticker.remove(x)}function x(){d()}return{element:o,render:d}}function kR(i){return"isNodesFlowRunStateFactory"in i}async function FR(i){const t=await qt(),e=await ee(),r=await Lt(),n=await Zi();let s=await ri();const o=new Ct,a=await gr(),l=await gr();let h=null,c=null,u=0,d=0,f=!1,p=!1;o.visible=!1,o.addChild(l),o.addChild(a),a.eventMode="static",a.cursor="pointer",a.on("mouseover",()=>{f=!0,m()}),a.on("mouseleave",()=>{f=!1,m()}),a.on("click",S=>{S.stopPropagation();const C=a.getGlobalPosition(),I={x:C.x,y:C.y,width:a.width*e.scale.x,height:a.height*e.scale.y};Wi({...i,kind:"state",position:I})}),l.eventMode="none",l.cursor="default",tt.on("scaleUpdated",S=>{s=S,m()}),tt.on("itemSelected",()=>{const S=br({kind:"state",...i});S!==p&&(p=S,f=!1,m())}),i.type==="RUNNING"&&!n.end_time&&b();function m(S){const{end:C,parentStartDate:I,width:M,height:L}=S??{};if(C&&(h=C),I&&(c=I),M&&(u=M),L&&(d=L),n.end_time&&v(),!it.isTemporal()){o.visible=!1;return}if(!c||u<=0){o.visible=!1;return}const G=g();if(G.width<=0){o.visible=!1;return}y(G),x(G),o.visible=!0}function g(){const{background:S="#fff"}=r.styles.state(i);if(!c)return{x:0,width:0,background:S};const C=s(c);let I=s(i.timestamp)-C;if(I>=u)return{x:u,width:0,background:S};I<0&&(I=0);let M=s(h??new Date)-C;M>u&&(M=u);const L=Math.max(M-I,0);return{x:I,width:L,background:S}}function y({x:S,width:C,background:I}){const{flowStateBarHeight:M,flowStateSelectedBarHeight:L}=r.styles,G=f||p?L:M;a.x=S,a.y=d-G,a.width=C,a.height=G,a.tint=I}function x({x:S,width:C,background:I}){const{flowStateBarHeight:M,flowStateAreaAlpha:L,nodeHeight:G}=r.styles,F=G/2;l.x=S,l.y=F,l.width=C,l.height=d-M-F,l.tint=I,l.alpha=L}function b(){t.ticker.add(w)}function v(){t.ticker.remove(w)}function w(){m()}return{element:o,render:m,isNodesFlowRunStateFactory:!0}}function c1({isRoot:i}={}){const t=new Ct,e=new Map,r=new Map;let n=null;async function s(a,l){if(a&&(n=a),!n)return;const h=[];for(let c=0;c<n.length;c++)h.push(o(n[c],c,l));await Promise.all(h)}async function o(a,l,h){const c=n&&n.length>=l+1&&n[l+1],u=c?c.timestamp:void 0;let d;if(r.has(a.id)&&await r.get(a.id),e.has(a.id))d=e.get(a.id);else{const f=(async()=>{const p=i?await GR(a):await FR(a);e.set(a.id,p),t.addChild(p.element)})();r.set(a.id,f),await f,r.delete(a.id),d=e.get(a.id)}kR(d)?await d.render({end:u,...h}):await d.render(u?{end:u}:void 0)}return{element:t,render:s}}async function DR(){const i=await qt(),t=await Zi(),{element:e,render:r}=await c1({isRoot:!0});e.zIndex=3,i.stage.addChild(e);function n(s){r(s==null?void 0:s.states)}t.states&&n(t),tt.on("runDataUpdated",s=>n(s)),tt.on("configUpdated",()=>n()),tt.on("layoutSettingsUpdated",()=>n())}function hL(){}async function NR(){const i=await qt(),t=await ee(),e=await ie(),r=await Lt(),{inter:n}=await Wb(),s=new Ct,o=await gr();s.addChild(o);const a=n("");s.addChild(a);let l=await ri(),h,c;tt.on("scaleUpdated",m=>{l=m,p()}),tt.on("viewportMoved",()=>{e.disableGuides||(p(),s.height!==i.screen.height&&d())});function u(m,g){h=m,c=g,d(),f(m)}function d(){o.width=r.styles.guideLineWidth,o.height=i.screen.height,o.tint=r.styles.guideLineColor}function f(m){a.text=c(m),a.fontSize=r.styles.guideTextSize,a.tint=r.styles.guideTextColor,a.position.set(r.styles.guideTextLeftPadding,r.styles.guideTextTopPadding)}function p(){h!==void 0&&(s.position.x=l(h)*t.scale._x+t.worldTransform.tx)}return{element:s,render:u}}class u1 extends Error{constructor(){super("Layout is not temporal")}}function OR(i){return i.toLocaleTimeString()}function d1(i){const t=navigator.language;return new Intl.DateTimeFormat(t,{timeStyle:"short"}).format(i)}function BR(i){const t=navigator.language;return new Intl.DateTimeFormat(t,{dateStyle:"short"}).format(i)}function UR(i){return i.getHours()===0&&i.getMinutes()===0?`${ih.date(i)}
1176
+ ${d1(i)}`:d1(i)}const ih={timeBySeconds:OR,timeByMinutesWithDates:UR,date:BR},oe={seconds:"seconds",minutes:"minutes",date:"date"},Zo={day:i=>{const t=new Date(i.getTime());return t.setHours(0,0,0,0),t.getTime()},week:i=>{const t=new Date(i.getTime());return t.setHours(0,0,0,0),t.setDate(i.getDate()-i.getDay()+1),t.getTime()}},At={second:1e3,minute:1e3*60,hour:1e3*60*60,day:1e3*60*60*24,week:1e3*60*60*24*7},f1=[{ceiling:At.second*4,increment:At.second,labelFormat:oe.seconds},{ceiling:At.second*8,increment:At.second*5,labelFormat:oe.seconds},{ceiling:At.second*13,increment:At.second*10,labelFormat:oe.seconds},{ceiling:At.second*20,increment:At.second*15,labelFormat:oe.seconds},{ceiling:At.second*45,increment:At.second*30,labelFormat:oe.seconds},{ceiling:At.minute*4,increment:At.minute,labelFormat:oe.minutes},{ceiling:At.minute*8,increment:At.minute*5,labelFormat:oe.minutes},{ceiling:At.minute*13,increment:At.minute*10,labelFormat:oe.minutes},{ceiling:At.minute*28,increment:At.minute*15,labelFormat:oe.minutes},{ceiling:At.hour*1.24,increment:At.minute*30,labelFormat:oe.minutes},{ceiling:At.hour*3,increment:At.hour,labelFormat:oe.minutes},{ceiling:At.hour*8,increment:At.hour*2,getAnchor:Zo.day,labelFormat:oe.minutes},{ceiling:At.hour*13,increment:At.hour*6,getAnchor:Zo.day,labelFormat:oe.minutes},{ceiling:At.hour*22,increment:At.hour*12,getAnchor:Zo.day,labelFormat:oe.minutes},{ceiling:At.day*4,increment:At.day,getAnchor:Zo.day,labelFormat:oe.date},{ceiling:At.week*2,increment:At.week,getAnchor:Zo.week,labelFormat:oe.date},{ceiling:1/0,increment:At.week*4,labelFormat:oe.date}],XR=300;async function WR(){const i=await ee(),t=await ie(),e=new Ct,r=new Map;let n=await ri();tt.on("scaleUpdated",d=>n=d),await o();function s(){if(e.visible=!t.disableGuides,!t.disableGuides)try{const{anchor:d,increment:f,labelFormat:p}=a(),m=u(d,f);c(m,p)}catch(d){if(d instanceof u1)return;console.error(d)}}async function o(){const d=[];Dd(30,async f=>{const p=NR();d.push(p);const m=await p;e.addChild(m.element),r.set(f,m)}),await Promise.all(d)}function a(){const d=i.left-XR,f=n.invert(d),p=n.invert(d+260/i.scale.x);if(!(f instanceof Date)||!(p instanceof Date))throw new u1;const m=p.getTime()-f.getTime(),{increment:g,getAnchor:y,labelFormat:x}=l(m);return{anchor:y(f),increment:g,labelFormat:h(x)}}function l(d){const f=f1.find(p=>p.ceiling>d)??f1[0];return f.getAnchor||(f.getAnchor=p=>Math.floor(p.getTime()/f.increment)*f.increment),f}function h(d){switch(d){case oe.minutes:return ih.timeByMinutesWithDates;case oe.date:return ih.date;default:return ih.timeBySeconds}}function c(d,f){const p=new Map(r.entries()),m=Array.from(p.keys()).filter(g=>!d.includes(g));r.clear();for(const g of d){if(p.has(g)){const x=p.get(g);r.set(g,x),x.render(new Date(g),f);continue}const y=p.get(m.pop()??-1);if(y===void 0){console.warn("Guides: No unused guides available to render.");continue}y.render(new Date(g),f),r.set(g,y)}}function u(d,f){return Dd(30,p=>d+f*p)}return{element:e,render:s}}async function ZR(){const i=await qt(),{element:t,render:e}=await WR();i.stage.addChild(t),e(),tt.on("viewportDateRangeUpdated",()=>e()),tt.on("layoutSettingsUpdated",()=>e()),tt.on("configUpdated",()=>e())}function cL(){}const VR=80;async function HR(){const i=await qt(),t=await ee(),e=await ie(),r=await Lt(),n=await gr();let s=await ri();tt.on("scaleUpdated",l=>s=l);function o(){if(!e.isTemporal()){n.visible=!1;return}n.width=r.styles.playheadWidth,n.height=i.stage.height,n.tint=r.styles.playheadColor,n.position.x=s(new Date)*t.scale.x+t.worldTransform.tx,a()}function a(){if(t.moving||!(n.position.x>0&&n.position.x<i.screen.width)||!(n.position.x>i.screen.width-VR))return;const c=t.left;t.zoomPercent(-.1,!0),t.left=c}return{element:n,render:o}}async function KR(){const i=await qt(),t=await Zi(),{element:e,render:r}=await HR();t.end_time||(i.stage.addChild(e),i.ticker.add(r)),tt.on("runDataUpdated",({end_time:n})=>{n&&(i.ticker.remove(r),i.stage.removeChild(e))})}function uL(){}function zR({stage:i,props:t}){D2(),oM(),nM(),ZR(),iP(),IR(),RR(),DR(),KR(),W2(),QM(),k2(i),K2(t),pM(),lP(),sR()}function YR(){tt.clear();try{N2(),aM(),sM(),F2(),rP(),PR(),z2(),Z2(),tR(),mM(),hP(),oR(),xM()}catch(i){console.error(i)}}async function p1(i){const t=await qt(),e=await ee(),r=await Lt(),n=await ie(),s=await LR();let o=await ri(),a=s&&s.length>0;const l=await c();l.element.on("click",d=>{d.stopPropagation();const{element:f}=l,p=f.getGlobalPosition(),m={x:p.x,y:p.y,width:f.width,height:f.height},g=Yr(l)?{kind:"artifacts",ids:l.getIds(),position:m}:{kind:"artifact",id:l.getId()};Wi(g)}),tt.on("scaleUpdated",d=>{o=d,u()}),tt.on("viewportMoved",()=>u()),tt.on("eventDataCreated",d=>{a=d.length>0,u()}),tt.on("eventDataUpdated",d=>{a=d.length>0,u()});async function h(d){await l.render(d),u()}async function c(){return i.type==="artifact"?await jd(i.artifact,{cullAtZoomThreshold:!1}):await i1()}function u(){const d=l.getDate();if(!d||!it.isTemporal()||n.disableArtifacts)return;const f=l.getSelected(),{element:p}=l,{eventTargetSize:m,flowStateSelectedBarHeight:g}=r.styles;let y=0;if(f){const{selectedBorderOffset:S,selectedBorderWidth:C}=r.styles;y=S+C*2}const b=o(d)*e.scale._x+e.worldTransform.tx-(p.width-y)/2,v=a&&!n.disableEvents?m:g,w=t.screen.height-(p.height-y)-v;p.position.set(b,w)}return{...l,render:h}}async function m1(i){const t=await ee(),e=await Lt(),r=await ie();let n=await ri();const s=await a();s.element.on("click",h=>{console.log("artifact click"),h.stopPropagation();const{element:c}=s,u=c.getGlobalPosition(),d={x:u.x,y:u.y,width:c.width*t.scale.x,height:c.height*t.scale.y},f=Yr(s)?{kind:"artifacts",ids:s.getIds(),position:d}:{kind:"artifact",id:s.getId()};Wi(f)}),tt.on("scaleUpdated",h=>{n=h,l()});async function o(h){await s.render(h),l()}async function a(){return i.type==="artifact"?await jd(i.artifact):await i1()}function l(){const h=s.getDate(),{parentStartDate:c}=i;if(!h||!it.isTemporal()||r.disableArtifacts||!c)return;const u=s.getSelected(),{element:d}=s;let f=0;if(u){const{selectedBorderOffset:y,selectedBorderWidth:x}=e.styles;f=y+x*2}const m=n(h)-n(c)-(d.width-f)/2,g=-(d.height-f);d.position.set(m,g)}return{...s,render:o}}async function g1({isRoot:i,parentStartDate:t}={}){const e=await ie(),r=new Map,n=new Map,s=[];let o=[];const a=new Ct;let l=null;async function h(p){if(p&&(l=p),!l)return;const m=[];for(const g of l)m.push(c(g));await Promise.all(m),u()}async function c(p){if(r.has(p.id))return r.get(p.id).render();n.has(p.id)&&await n.get(p.id);const m=(async()=>{const g=i?await p1({type:"artifact",artifact:p}):await m1({type:"artifact",artifact:p,parentStartDate:t});r.set(p.id,g),a.addChild(g.element)})();return n.set(p.id,m),await m,n.delete(p.id),r.get(p.id).render()}function u(){if(!(e.disableArtifacts||!it.isTemporal())){if(!it.isTemporal()){a.visible=!1;return}a.visible=!0,a.position.x=0,d()}}const d=e1(async()=>{o=[...s],await o1({items:r,createCluster:f});for(const p of o)p.render()},250);async function f(){if(o.length>0)return o.pop();const p=i?await p1({type:"cluster"}):await m1({type:"cluster",parentStartDate:t});return a.addChild(p.element),s.push(p),p}return{element:a,render:h,update:u}}class y1 extends Ct{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 jR(i){const t=new y1,e=await Lt(),r=await ie(),{element:n,render:s}=await $b(),{element:o,render:a}=await Ql(),{element:l,render:h}=await lR(),{element:c,render:u}=await Od(),{element:d,render:f,getSize:p,stopWorker:m}=await v1(),{element:g,render:y}=await c1(),{element:x,render:b,update:v}=await h1({parentStartDate:i.start_time}),{element:w,render:S,update:C}=await g1({parentStartDate:i.start_time});let I=!1,M=!1,L=i,G=!1;t.sortableChildren=!0,c.zIndex=0,n.zIndex=4,o.zIndex=5,l.zIndex=5,d.zIndex=2,x.zIndex=1,g.zIndex=2,w.zIndex=3,c.eventMode="none",c.cursor="default";const{start:F,stop:A}=await sg(L.id,Q=>{M=!!Q.artifacts&&Q.artifacts.length>0,f(Q),B(Q.states),k(Q.artifacts),j()}),{start:N,stop:Z}=await Jb(()=>({nodeId:L.id,since:L.start_time,until:L.end_time??new Date}),Q=>{I=Q.length>0,D(Q)});t.addChild(n),t.addChild(o),t.addChild(l),l.on("click",Q=>{Q.stopPropagation(),H()}),d.position={x:0,y:e.styles.nodeHeight+e.styles.nodesPadding},d.on("rendered",()=>{zl(),Tt()});async function K(Q){return L=Q,await s(Q),await ft(),await at(),G&&(await B(),await D(),await k(),await j()),t}async function H(){G?await et():await V()}async function j(){const{background:Q="#fff"}=e.styles.node(L),{width:W,height:J}=p(),{height:$}=It(),{nodeBorderRadius:O}=e.styles,pt=2;c.position={x:-pt,y:-pt};const yt=it.isTemporal()?$+pt*2:J+pt*2;await u({width:W+pt*2,height:yt,stroke:pt,radius:[O,O,0,0],color:Q})}async function B(Q){const{height:W}=It(),{width:J}=n;await y(Q??void 0,{parentStartDate:L.start_time,width:J,height:W})}async function D(Q){if(!G||!it.isTemporal()||r.disableEvents){t.removeChild(x);return}t.addChild(x);const{height:W}=It();if(x.position={x:0,y:W-e.styles.eventBottomMargin},Q){await b(Q);return}await v()}async function k(Q){if(!G||!it.isTemporal()||r.disableArtifacts){t.removeChild(w);return}t.addChild(w);const{eventTargetSize:W,flowStateSelectedBarHeight:J}=e.styles,{height:$}=It(),O=$-(I&&!r.disableEvents?W:J);if(w.position={x:0,y:O},Q){await S(Q);return}await C()}async function V(){G=!0,t.addChild(g),t.addChild(d),t.addChild(c),await Promise.all([F(),N(),K(L)]),Tt()}async function et(){G=!1,t.removeChild(g),t.removeChild(d),t.removeChild(c),t.removeChild(x),t.removeChild(w),m(),await Promise.all([A(),Z(),K(L)]),Tt()}async function ft(){const Q=e.styles.nodeToggleSize,W=e.styles.nodeHeight-Q,J=n.width>Q,$=await h({inside:J,isOpen:G});return $.x=J?W/2:n.width+e.styles.nodePadding,$.y=W/2,$}async function at(){const Q=await a(L.label),W=e.styles.colorMode==="dark"?e.styles.textDefault:e.styles.textInverse,J=e.styles.nodePadding,$=l.x+l.width+J,O=n.width+J,pt=n.width>$+Q.width+J,yt=e.styles.nodeHeight/2-Q.height/2,Rt=pt?$:Math.max(O,$);return Q.position={x:Rt,y:yt},Q.tint=pt?W:e.styles.textDefault,Q}function Tt(){G&&(B(),D(),k(),j());const Q=It();t.emit("resized",Q)}function It(){const Q=p(),{nodeHeight:W,nodesPadding:J,eventTargetSize:$,eventBottomMargin:O,artifactPaddingY:pt,artifactIconSize:yt}=e.styles,Bt=M&&it.isTemporal()&&!r.disableArtifacts?yt+pt*2:0,Ve=I&&it.isTemporal()&&!r.disableEvents?$+O:0,Ho=G?Q.height+Bt+Ve+J*2:0,Jr=G?Q.width:0;return{height:W+Ho,width:Math.max(Jr,t.width)}}return{kind:"flow-run",element:t,bar:n,render:K}}async function JR(){const i=await Lt(),t=new y1,{element:e,render:r}=await Ql(),{element:n,render:s}=await $b();t.addChild(n),t.addChild(e);async function o(l){return await Promise.all([s(l),r(l.label)]),a(),t}function a(){const l=i.styles.colorMode==="dark"?i.styles.textDefault:i.styles.textInverse,h=i.styles.nodePadding,c=n.width>h+e.width+h,u=c?h:n.width+h,d=i.styles.nodeHeight/2-e.height/2;e.position={x:u,y:d},e.tint=c?l:i.styles.textDefault}return{kind:"task-run",element:t,render:o,bar:n}}async function $R(i){const t=await Lt(),e=await qt(),r=await bb(),n=await ie();let s=null;const o=new Map,{animate:a}=await _b(),{element:l,render:h,bar:c}=await C(i);let u=i,d=null,f=!1,p=!1;r.add(l),l.eventMode="static",l.cursor="pointer",l.name=A1,l.on("click",L=>{L.stopPropagation(),Wi({kind:u.kind,id:u.id})}),u.end_time||v(),tt.on("itemSelected",()=>{const L=br({kind:u.kind,id:u.id});L!==f&&(f=L,h(u))});async function m(L){u=L;const G=I(L);return G===d||(d=G,await Promise.all([h(L),g(L.artifacts)]),L.end_time&&w()),l}async function g(L){if(!L||(x(),n.disableArtifacts||!it.isTemporal()))return;const G=[];for(const F of L)G.push(y(F));await Promise.all(G),b()}async function y(L){if(o.has(L.id))return o.get(L.id).render();const G=await jd(L,{enableLocalClickHandling:!0});return o.set(L.id,G),s.addChild(G.element),G.render()}function x(){if(it.isTemporal()&&!n.disableArtifacts){s||(s=new Ct),l.addChild(s);return}s&&l.removeChild(s)}function b(){if(!s)return;const{artifactsGap:L,artifactsNodeOverlap:G}=t.styles;let F=0;for(const A of o.values())A.element.position.x=F,F+=A.element.width+L;s.position.y=-s.height+G,s.width<c.width&&(s.position.x=c.width-s.width)}function v(){e.ticker.add(S)}function w(){e.ticker.remove(S)}function S(){m(u)}async function C(L){const{kind:G}=L;switch(G){case"task-run":return await JR();case"flow-run":return await jR(L);default:const F=G;throw new Error(`switch does not have case for value: ${F}`)}}function I(L){var N;const G=L.end_time??new Date,F=((N=L.artifacts)==null?void 0:N.length)??0;return[L.state_type,G.getTime(),F,it.horizontal,it.horizontalScaleMultiplier,t.styles.colorMode,F>0&&n.disableArtifacts].join("-")}function M({x:L,y:G}){a(l,{x:L,y:G},!p),p=!0}return{element:l,render:m,bar:c,setPosition:M}}function b1({gap:i=0,minimum:t=0}={}){const e=new Map;function r(c){const u=e.get(c)??[];return Math.max(...u.values(),Y.toValue(t))+Y.toValue(i)}function n(c){let u=0;for(let d=0;d<c;d++)u+=r(d);return u}function s(c){return n(c+1)-Y.toValue(i)}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[p,m]of e.entries())if(m.has(u)){d=p,f=m.get(u);break}d===c||d===void 0||f===void 0||(l({axis:d,nodeId:u}),o({axis:c,nodeId:u,offset:f}))}function l({axis:c,nodeId:u}){var d;(d=e.get(c))==null||d.delete(u)}function h(){e.clear()}return{getOffset:r,getTotalOffset:n,getTotalValue:s,setOffset:o,updateNodeAxis:a,removeOffset:l,clear:h}}function QR(i){throw new Error(`switch does not have case for value: ${i}`)}const x1="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIEtlKG4pe3Rocm93IG5ldyBFcnJvcihgc3dpdGNoIGRvZXMgbm90IGhhdmUgY2FzZSBmb3IgdmFsdWU6ICR7bn1gKX1mdW5jdGlvbiBDbihuLGUpe3JldHVybiBuPT1udWxsfHxlPT1udWxsP05hTjpuPGU/LTE6bj5lPzE6bj49ZT8wOk5hTn1mdW5jdGlvbiBudChuLGUpe3JldHVybiBuPT1udWxsfHxlPT1udWxsP05hTjplPG4/LTE6ZT5uPzE6ZT49bj8wOk5hTn1mdW5jdGlvbiBSbihuKXtsZXQgZSx0LHI7bi5sZW5ndGghPT0yPyhlPUNuLHQ9KHUsbCk9PkNuKG4odSksbCk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hdGgubWF4KGEsZi5jb2x1bW4pLG8uc2V0KHUsey4uLmYseTpnLHJvdzpnfSl9RG8oe3R5cGU6ImxheW91dCIsbGF5b3V0OnttYXhSb3c6aSxtYXhDb2x1bW46YSxwb3NpdGlvbnM6b319KX19KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1ydW5HcmFwaC53b3JrZXItQzRjMjBKZ3UuanMubWFwCg==",qR=i=>Uint8Array.from(atob(i),t=>t.charCodeAt(0)),_1=typeof window<"u"&&window.Blob&&new Blob([qR(x1)],{type:"text/javascript;charset=utf-8"});function tP(i){let t;try{if(t=_1&&(window.URL||window.webkitURL).createObjectURL(_1),!t)throw"";const e=new Worker(t,{name:i==null?void 0:i.name});return e.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(t)}),e}catch{return new Worker("data:text/javascript;base64,"+x1,{name:i==null?void 0:i.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}function eP(i){const t=new tP;return t.onmessage=i,t}async function v1(){const i=new Map,t=new Map,e=new Ct,r=new Ct,n=await Lt();let s=null;const o=b1({gap:()=>n.styles.rowGap,minimum:()=>n.styles.nodeHeight}),a=b1({gap:()=>n.styles.columnGap,minimum:()=>$d()});let l=null,h=null;e.name=Zf,tt.on("layoutUpdated",()=>{o.clear(),a.clear()}),tt.on("layoutSettingsUpdated",()=>{h&&e.parent&&c(h),A()}),tt.on("itemSelected",()=>{A()});async function c(B){u(),h=B,l=null,await Promise.all([f(B),m(B)]),y(B)}function u(){s||(s=eP(G))}function d(){s&&(s.terminate(),s=null)}async function f(B){const D=[];for(const k of B.nodes.values())D.push(p(k));await Promise.all(D)}async function p(B){const{render:D}=await v(B);return await D(B)}async function m(B){if((await ie()).disableEdges){e.removeChild(r);return}e.addChildAt(r,0);const k=[];for(const[V,{children:et}]of B.nodes)for(const{id:ft}of et)k.push(g(V,ft));await Promise.all(k)}async function g(B,D){const k=`${B}_${D}`;if(t.has(k))return;const V=await SM();t.has(k)||(t.set(k,V),r.addChild(V.element))}function y(B){if(!s)throw new Error("Layout worker not initialized");const D=new Map;for(const[k,{element:V}]of i)D.set(k,V.width);s.postMessage({type:"layout",data:B,widths:D,horizontalSettings:Ld(B.start_time),verticalSettings:rM()})}function x(){if(l)for(const[B,D]of t){const[k,V]=B.split("_"),et=l.positions.get(k),ft=l.positions.get(V),at=i.get(k);if(!et||!ft){console.warn(`Could not find edge in layout: Skipping ${B}`);continue}if(!at){console.warn(`Could not find parent node in nodes: Skipping ${k}`);continue}const Tt=at.bar.width,It=S(et),Q={x:It.x+Tt,y:It.y+n.styles.nodeHeight/2},W=S(ft),J={x:W.x-Q.x,y:W.y-Q.y+n.styles.nodeHeight/2};D.setPosition(Q,J)}}function b(){if(l){for(const[B,D]of i){const k=l.positions.get(B);if(!k){console.warn(`Could not find node in layout: Skipping ${B}`);continue}const V=S(k);D.setPosition(V),o.updateNodeAxis({nodeId:B,axis:k.y}),a.updateNodeAxis({nodeId:B,axis:k.column})}x(),e.emit("rendered"),e.emit("resized",L())}}async function v(B){const D=i.get(B.id);if(D)return D;const k=await $R(B);return k.element.on("resized",V=>w(B.id,V)),i.set(B.id,k),e.addChild(k.element),k}function w(B,D){if(!l)return;const k=i.get(B),V=l.positions.get(B);!k||!V||(o.setOffset({nodeId:B,axis:V.y,offset:D.height}),a.setOffset({nodeId:B,axis:V.column,offset:D.width}),b())}function S(B){const D=o.getTotalOffset(B.y);return{x:C(B),y:D}}function C(B){return it.isDependency()?a.getTotalOffset(B.column):B.x}function I(){return l?o.getTotalValue(l.maxRow):0}function M(){if(!l||!h)return 0;if(it.isDependency())return a.getTotalValue(l.maxColumn);const B=Ld(h.start_time),D=pb(B),k=D(h.end_time??new Date),V=D(h.start_time);return k-V}function L(){return{width:M(),height:I()}}function G({data:B}){const{type:D}=B;switch(D){case"layout":F(B);return;default:QR(D)}}function F(B){l=B.layout,b()}async function A(){const B=await ie(),D=aR();if(B.disableEdges||!D||!(h!=null&&h.nodes.has(D.id))){N([]);return}const k=H(D.id);N(k)}function N(B){Z(B),K(B)}function Z(B){for(const[D,{element:k}]of i){if(B.length===0||B.includes(D)){k.alpha=1;continue}k.alpha=n.styles.nodeUnselectedAlpha}}function K(B){for(const[D,{element:k}]of t){const[V,et]=D.split("_");if(B.length===0||B.includes(V)&&B.includes(et)){k.alpha=1;continue}k.alpha=n.styles.nodeUnselectedAlpha}}function H(B){const D=j(B,"parents"),k=j(B,"children");return[B,...D,...k]}function j(B,D){const k=h==null?void 0:h.nodes.get(B);if(!k)return[];const V=[];for(const{id:et}of k[D])V.push(et),V.push(...j(et,D));return V}return{element:e,stopWorker:d,getSize:L,render:c}}let Vo=null,jr=null,On=null;async function iP(){const i=await ee(),t=await Lt(),{element:e,render:r}=await v1();i.addChild(e),e.alpha=0;const n=await sg(t.runId,async s=>{const o=jr?"runDataUpdated":"runDataCreated";jr=s,tt.emit(o,jr),await ie(),r(s)});tt.on("configUpdated",()=>{jr&&r(jr)}),On=e,Vo=n.stop,On.once("rendered",()=>nP()),tt.on("layoutUpdated",()=>sP()),n.start()}function rP(){Vo==null||Vo(),Vo=null,On=null,jr=null}async function Zi(){return jr||await Ie("runDataCreated")}function nP(){kd(),Se.shared.addOnce(()=>{On&&(On.alpha=1)})}async function sP(){if(!On)return;const i=await Lt();On.once("rendered",()=>{setTimeout(()=>{kd({animate:!0})},i.animationDuration)})}function oP(i){let t=0;for(const[,{children:e}]of i)t+=e.length;return t}function aP({start_time:i,end_time:t,nodes:e},r,n){const s=Math.max(k1(t??new Date,i),1),o=r.styles.nodeHeight+r.styles.rowGap;return(e.size>0?e.size*o*.5:o*4)*n/(s*20)}async function lP(){const i=await Zi(),t=await Lt(),e=await qt(),r=e.view.width/e.view.height,n=aP(i,t,r);rh(n,!0),i.nodes.size>t.disableAnimationsThreshold&&(it.disableAnimations=!0),oP(i.nodes)>t.disableEdgesThreshold&&(it.disableEdges=!0)}function hP(){it.horizontal="temporal",it.vertical="nearest-parent",it.horizontalScaleMultiplierDefault=0,it.horizontalScaleMultiplier=0,it.disableAnimations=!1,it.disableGuides=!1,it.disableEdges=!1,it.disableArtifacts=!1,it.disableEvents=!1}const it=Y.reactive({horizontal:"temporal",vertical:"nearest-parent",horizontalScaleMultiplierDefault:0,horizontalScaleMultiplier:0,disableAnimations:!1,disableGuides:!1,disableEdges:!1,disableArtifacts:!1,disableEvents:!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 ie(){return Qd()?it:await Ie("layoutSettingsCreated")}function $d(){return it.isDependency()?200:20*it.horizontalScaleMultiplier}function cP(){return[0,$d()]}function uP(i){if(it.isDependency())return[0,1];const t=i,e=L1(t,1);return[t,e]}function rh(i,t=!1){if(it.horizontalScaleMultiplier===i)return;const e=Gs();it.horizontalScaleMultiplier=i,t&&(it.horizontalScaleMultiplierDefault=i),e()}function dP(){rh(it.horizontalScaleMultiplierDefault)}function fP(i){if(it.horizontal===i)return;const t=Gs();it.horizontal=i,it.disableGuides=it.isDependency()||it.isLeftAligned(),t()}function pP(i){if(it.vertical===i)return;const t=Gs();it.vertical=i,t()}function mP(i){if(it.disableEdges===i)return;const t=Gs();it.disableEdges=i,t()}function gP(i){if(it.disableArtifacts===i)return;const t=Gs();it.disableArtifacts=i,t()}function yP(i){if(it.disableEvents===i)return;const t=Gs();it.disableEvents=i,t()}function Gs(){const i=Qd()?"layoutSettingsUpdated":"layoutSettingsCreated",{horizontal:t,vertical:e}=it;return()=>{Qd()&&tt.emit(i,it),(t!==it.horizontal||e!==it.vertical)&&tt.emit("layoutUpdated")}}function Qd(){return it.horizontalScaleMultiplier!==0}function w1(i){if(!(i instanceof HTMLElement))return!1;const t=i.tagName.toLowerCase();return["input","textarea"].includes(t)}const bP={class:"flex items-center gap-2"},xP=Y.defineComponent({__name:"RunGraphSettings",setup(i){const t=[Ji.positions.topRight,Ji.positions.bottomRight,Ji.positions.topLeft,Ji.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"}],r=Y.computed({get(){return`${it.horizontal}_${it.vertical}`},set(u){const[d,f]=u.split("_");fP(d),pP(f)}}),n=Y.computed({get(){return it.disableEdges},set(u){mP(u)}}),s=Y.computed({get(){return it.disableArtifacts},set(u){gP(u)}}),o=Y.computed({get(){return it.disableEvents},set(u){yP(u)}});function a(){const d=it.horizontalScaleMultiplier*1.25;rh(d)}function l(){const u=Math.abs(-.75),d=it.horizontalScaleMultiplier*u;rh(d)}wr.useKeyDown(["-","="],h);function h(u){if(!(w1(u.target)||u.metaKey||u.ctrlKey))switch(u.key){case"-":l();break;case"=":a();break}}function c(){dP()}return(u,d)=>{const f=Y.resolveComponent("p-radio-group"),p=Y.resolveComponent("p-label"),m=Y.resolveComponent("p-divider"),g=Y.resolveComponent("p-checkbox"),y=Y.resolveComponent("p-overflow-menu");return Y.openBlock(),Y.createBlock(Y.unref(Ji.PPopOver),{class:"run-graph-settings","auto-close":"",placement:t},{target:Y.withCtx(({toggle:x})=>[Y.createVNode(Y.unref(Ji.PButton),{"aria-label":"Run Graph Options",icon:"CogIcon",flat:"",onClick:x},null,8,["onClick"])]),default:Y.withCtx(()=>[Y.createVNode(y,{class:"run-graph-settings__menu"},{default:Y.withCtx(()=>[Y.createVNode(p,{label:"Layout"},{default:Y.withCtx(()=>[Y.createVNode(f,{modelValue:r.value,"onUpdate:modelValue":d[0]||(d[0]=x=>r.value=x),options:e},{label:Y.withCtx(({option:x})=>[Y.createTextVNode(Y.toDisplayString(x.label),1)]),_:1},8,["modelValue"])]),_:1}),Y.unref(it).isTemporal()||Y.unref(it).isLeftAligned()?(Y.openBlock(),Y.createElementBlock(Y.Fragment,{key:0},[Y.createVNode(m),Y.createVNode(p,{label:"Scaling"},{default:Y.withCtx(()=>[Y.createElementVNode("div",bP,[Y.createVNode(Y.unref(Ji.PButton),{title:"Decrease scale (-)",small:"",icon:"MinusIcon",onClick:l}),Y.createVNode(Y.unref(Ji.PButton),{title:"Increase scale (+)",small:"",icon:"PlusIcon",onClick:a}),Y.createVNode(Y.unref(Ji.PButton),{small:"",onClick:c},{default:Y.withCtx(()=>[Y.createTextVNode(" Reset ")]),_:1})])]),_:1})],64)):Y.createCommentVNode("",!0),Y.createVNode(m),Y.createVNode(g,{modelValue:n.value,"onUpdate:modelValue":d[1]||(d[1]=x=>n.value=x),label:"Hide dependency arrows"},null,8,["modelValue"]),Y.createVNode(g,{modelValue:s.value,"onUpdate:modelValue":d[2]||(d[2]=x=>s.value=x),label:"Hide artifacts"},null,8,["modelValue"]),Y.createVNode(g,{modelValue:o.value,"onUpdate:modelValue":d[3]||(d[3]=x=>o.value=x),label:"Hide events"},null,8,["modelValue"])]),_:1})]),_:1})}}}),_P={class:"run-graph__actions"},vP=Y.defineComponent({__name:"RunGraph",props:{config:{},viewport:{},fullscreen:{type:[Boolean,null],default:null},selected:{default:null}},emits:["update:viewport","update:fullscreen","update:selected"],setup(i,{emit:t}){const e=i,r=t,n=Y.ref(),s=Y.ref(!1),o=Y.computed({get(){return e.fullscreen??s.value},set(u){s.value=u,r("update:fullscreen",u)}});Y.watch(()=>e.selected,u=>Wi(u)),tt.on("itemSelected",u=>r("update:selected",u)),Y.watch(()=>e.viewport,u=>dM(u));const a=Y.computed(()=>({root:{"run-graph--fullscreen":o.value}}));tt.on("viewportDateRangeUpdated",u=>r("update:viewport",u));function l(){kd({animate:!0})}function h(){o.value=!o.value}Y.onMounted(()=>{if(!n.value)throw new Error("Stage does not exist");zR({stage:n.value,props:e})}),Y.onBeforeUnmount(()=>{YR()}),wr.useKeyDown(["c","f","Escape"],c);function c(u){if(!(w1(u.target)||u.metaKey||u.ctrlKey))switch(u.key){case"c":l();break;case"f":h();break;case"Escape":o.value&&h();break}}return(u,d)=>{const f=Y.resolveComponent("p-button");return Y.openBlock(),Y.createElementBlock("div",{class:Y.normalizeClass(["run-graph",a.value.root])},[Y.createElementVNode("div",{ref_key:"stage",ref:n,class:"run-graph__stage"},null,512),Y.createElementVNode("div",_P,[Y.createVNode(f,{title:"Recenter graph (c)",icon:"Target",flat:"",onClick:l}),Y.createVNode(f,{title:"Toggle fullscreen (f)",icon:"ArrowsPointingOutIcon",flat:"",onClick:h}),Y.createVNode(xP)])],2)}}});kt.RunGraph=vP,kt.artifactTypeIconMap=Zb,kt.artifactTypes=iR,kt.isArtifactSelection=Vb,kt.isArtifactsSelection=Hb,kt.isEventSelection=zb,kt.isEventsSelection=Yb,kt.isNodeSelection=ql,kt.isRunGraphNodeType=rR,kt.isStateSelection=Kb,kt.runGraphNodeKinds=Yd,kt.stateType=nR,Object.defineProperty(kt,Symbol.toStringTag,{value:"Module"})});
1177
1177
  //# sourceMappingURL=graphs.umd.js.map