@prefecthq/graphs 3.0.2 → 3.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +1,15 @@
1
- (function(q,Ie){typeof exports=="object"&&typeof module<"u"?Ie(exports):typeof define=="function"&&define.amd?define(["exports"],Ie):(q=typeof globalThis<"u"?globalThis:q||self,Ie(q["prefect-graphs"]={}))})(this,function(q){"use strict";var lP=Object.defineProperty;var cP=(q,Ie,Gr)=>Ie in q?lP(q,Ie,{enumerable:!0,configurable:!0,writable:!0,value:Gr}):q[Ie]=Gr;var gd=(q,Ie,Gr)=>cP(q,typeof Ie!="symbol"?Ie+"":Ie,Gr);const Ie=["result","markdown","table","progress","image","unknown"],Gr={markdown:"ArtifactMarkdown",table:"ArtifactTable",result:"ArtifactResult",image:"ArtifactImage",progress:"ArtifactProgress",unknown:"Artifact"},Lh=["flow-run","task-run"];function L1(r){return Lh.includes(r)}function Io(r){return Lh.includes(r.kind)}function Sd(r){return r.kind==="artifact"}function Cd(r){return r.kind==="artifacts"}function Ed(r){return r.kind==="state"}function Id(r){return r.kind==="event"}function Ad(r){return r.kind==="events"}const G1=["COMPLETED","RUNNING","SCHEDULED","PENDING","FAILED","CANCELLED","CANCELLING","CRASHED","PAUSED"];function k1(r){return["waterfall","nearest-parent","duration-sorted"].includes(r)}function F1(r){return["temporal","dependency","left-aligned"].includes(r)}const Gh="nodes-container",Md="node-container",Rd="edge-container",Pd=1,kh=20,Ld=200,Gd=.2,kd=.2,Fd=.2,Nd=.1,Fh=10,Nh=4,Dh=20,Oh=64,N1=.25,D1=1,Uh=30,Dd=260,Bh=250,Od=1,Ud=2,Bd=3,Xd=4,Xh=0,Wh=2,Wd=1,Zd=2,Vd=3,Zh=4,bn=5;var kr=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(kr||{}),Hd=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(Hd||{}),Vh=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(Vh||{}),lt=(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))(lt||{}),ci=(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))(ci||{}),W=(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))(W||{}),Ts=(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))(Ts||{}),ot=(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))(ot||{}),$=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))($||{}),Ni=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(Ni||{}),ui=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(ui||{}),di=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(di||{}),ye=(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))(ye||{}),fi=(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))(fi||{}),Hh=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(Hh||{}),Oe=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(Oe||{}),jt=(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))(jt||{}),Zt=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(Zt||{}),pi=(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))(pi||{});const Q={ADAPTER:{createCanvas:(r,t)=>{const e=document.createElement("canvas");return e.width=r,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")},RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};var Kh=/iPhone/i,Kd=/iPod/i,Yd=/iPad/i,zd=/\biOS-universal(?:.+)Mac\b/i,Yh=/\bAndroid(?:.+)Mobile\b/i,jd=/Android/i,Ss=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Ao=/Silk/i,Di=/Windows Phone/i,Jd=/\bWindows(?:.+)ARM\b/i,$d=/BlackBerry/i,Qd=/BB10/i,qd=/Opera Mini/i,tf=/\b(CriOS|Chrome)(?:.+)Mobile/i,ef=/Mobile(?:.+)Firefox\b/i,rf=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"};function O1(r){return function(t){return t.test(r)}}function sf(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=O1(e),n={apple:{phone:s(Kh)&&!s(Di),ipod:s(Kd),tablet:!s(Kh)&&(s(Yd)||rf(t))&&!s(Di),universal:s(zd),device:(s(Kh)||s(Kd)||s(Yd)||s(zd)||rf(t))&&!s(Di)},amazon:{phone:s(Ss),tablet:!s(Ss)&&s(Ao),device:s(Ss)||s(Ao)},android:{phone:!s(Di)&&s(Ss)||!s(Di)&&s(Yh),tablet:!s(Di)&&!s(Ss)&&!s(Yh)&&(s(Ao)||s(jd)),device:!s(Di)&&(s(Ss)||s(Ao)||s(Yh)||s(jd))||s(/\bokhttp\b/i)},windows:{phone:s(Di),tablet:s(Jd),device:s(Di)||s(Jd)},other:{blackberry:s($d),blackberry10:s(Qd),opera:s(qd),firefox:s(ef),chrome:s(tf),device:s($d)||s(Qd)||s(qd)||s(ef)||s(tf)},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 U1=sf.default??sf,Oi=U1(globalThis.navigator);Q.RETINA_PREFIX=/@([0-9\.]+)x/,Q.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var $e=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xn(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function B1(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 nf={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 _=g.length,v;for(b=0;b<_;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(v=1,x=new Array(y-1);v<y;v++)x[v-1]=arguments[v];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})(nf);var X1=nf.exports;const _n=xn(X1);var zh={exports:{}};zh.exports=Mo,zh.exports.default=Mo;function Mo(r,t,e){e=e||2;var i=t&&t.length,s=i?t[0]*e:r.length,n=of(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=K1(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 vn(n,o,e,a,h,f,0),o}function of(r,t,e,i,s){var n,o;if(s===$h(r,t,e,i)>0)for(n=t;n<e;n+=i)o=lf(n,r[n],r[n+1],o);else for(n=e-i;n>=t;n-=i)o=lf(n,r[n],r[n+1],o);return o&&Ro(o,o.next)&&(Tn(o),o=o.next),o}function Fr(r,t){if(!r)return r;t||(t=r);var e=r,i;do if(i=!1,!e.steiner&&(Ro(e,e.next)||Pt(e.prev,e,e.next)===0)){if(Tn(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function vn(r,t,e,i,s,n,o){if(r){!o&&n&&$1(r,i,s,n);for(var a=r,h,l;r.prev!==r.next;){if(h=r.prev,l=r.next,n?Z1(r,i,s,n):W1(r)){t.push(h.i/e|0),t.push(r.i/e|0),t.push(l.i/e|0),Tn(r),r=l.next,a=l.next;continue}if(r=l,r===a){o?o===1?(r=V1(Fr(r),t,e),vn(r,t,e,i,s,n,2)):o===2&&H1(r,t,e,i,s,n):vn(Fr(r),t,e,i,s,n,1);break}}}}function W1(r){var t=r.prev,e=r,i=r.next;if(Pt(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&&Cs(s,a,n,h,o,l,p.x,p.y)&&Pt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Z1(r,t,e,i){var s=r.prev,n=r,o=r.next;if(Pt(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=jh(f,p,t,e,i),x=jh(m,g,t,e,i),b=r.prevZ,_=r.nextZ;b&&b.z>=y&&_&&_.z<=x;){if(b.x>=f&&b.x<=m&&b.y>=p&&b.y<=g&&b!==s&&b!==o&&Cs(a,c,h,u,l,d,b.x,b.y)&&Pt(b.prev,b,b.next)>=0||(b=b.prevZ,_.x>=f&&_.x<=m&&_.y>=p&&_.y<=g&&_!==s&&_!==o&&Cs(a,c,h,u,l,d,_.x,_.y)&&Pt(_.prev,_,_.next)>=0))return!1;_=_.nextZ}for(;b&&b.z>=y;){if(b.x>=f&&b.x<=m&&b.y>=p&&b.y<=g&&b!==s&&b!==o&&Cs(a,c,h,u,l,d,b.x,b.y)&&Pt(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;_&&_.z<=x;){if(_.x>=f&&_.x<=m&&_.y>=p&&_.y<=g&&_!==s&&_!==o&&Cs(a,c,h,u,l,d,_.x,_.y)&&Pt(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}function V1(r,t,e){var i=r;do{var s=i.prev,n=i.next.next;!Ro(s,n)&&af(s,i,i.next,n)&&wn(s,n)&&wn(n,s)&&(t.push(s.i/e|0),t.push(i.i/e|0),t.push(n.i/e|0),Tn(i),Tn(i.next),i=r=n),i=i.next}while(i!==r);return Fr(i)}function H1(r,t,e,i,s,n){var o=r;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&tb(o,a)){var h=hf(o,a);o=Fr(o,o.next),h=Fr(h,h.next),vn(o,t,e,i,s,n,0),vn(h,t,e,i,s,n,0);return}a=a.next}o=o.next}while(o!==r)}function K1(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=of(r,a,h,i,!1),l===l.next&&(l.steiner=!0),s.push(q1(l));for(s.sort(Y1),n=0;n<s.length;n++)e=z1(s[n],e);return e}function Y1(r,t){return r.x-t.x}function z1(r,t){var e=j1(r,t);if(!e)return t;var i=hf(e,r);return Fr(i,i.next),Fr(e,e.next)}function j1(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&&Cs(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),wn(e,r)&&(d<u||d===u&&(e.x>o.x||e.x===o.x&&J1(o,e)))&&(o=e,u=d)),e=e.next;while(e!==h);return o}function J1(r,t){return Pt(r.prev,r,t.prev)<0&&Pt(t.next,r,r.next)<0}function $1(r,t,e,i){var s=r;do s.z===0&&(s.z=jh(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,Q1(s)}function Q1(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 jh(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 q1(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 Cs(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 tb(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!eb(r,t)&&(wn(r,t)&&wn(t,r)&&ib(r,t)&&(Pt(r.prev,r,t.prev)||Pt(r,t.prev,t))||Ro(r,t)&&Pt(r.prev,r,r.next)>0&&Pt(t.prev,t,t.next)>0)}function Pt(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function Ro(r,t){return r.x===t.x&&r.y===t.y}function af(r,t,e,i){var s=Lo(Pt(r,t,e)),n=Lo(Pt(r,t,i)),o=Lo(Pt(e,i,r)),a=Lo(Pt(e,i,t));return!!(s!==n&&o!==a||s===0&&Po(r,e,t)||n===0&&Po(r,i,t)||o===0&&Po(e,r,i)||a===0&&Po(e,t,i))}function Po(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 Lo(r){return r>0?1:r<0?-1:0}function eb(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&&af(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function wn(r,t){return Pt(r.prev,r,r.next)<0?Pt(r,t,r.next)>=0&&Pt(r,r.prev,t)>=0:Pt(r,t,r.prev)<0||Pt(r,r.next,t)<0}function ib(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 hf(r,t){var e=new Jh(r.i,r.x,r.y),i=new Jh(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 lf(r,t,e,i){var s=new Jh(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 Tn(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 Jh(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}Mo.deviation=function(r,t,e,i){var s=t&&t.length,n=s?t[0]*e:r.length,o=Math.abs($h(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($h(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 $h(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}Mo.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 rb=zh.exports;const sb=xn(rb);var Go={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */Go.exports,function(r,t){(function(e){var i=t&&!t.nodeType&&t,s=r&&!r.nodeType&&r,n=typeof $e=="object"&&$e;(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"},_=h-l,v=Math.floor,T=String.fromCharCode,C;function E(X){throw new RangeError(b[X])}function I(X,M){for(var D=X.length,V=[];D--;)V[D]=M(X[D]);return V}function k(X,M){var D=X.split("@"),V="";D.length>1&&(V=D[0]+"@",X=D[1]),X=X.replace(x,".");var J=X.split("."),j=I(J,M).join(".");return V+j}function L(X){for(var M=[],D=0,V=X.length,J,j;D<V;)J=X.charCodeAt(D++),J>=55296&&J<=56319&&D<V?(j=X.charCodeAt(D++),(j&64512)==56320?M.push(((J&1023)<<10)+(j&1023)+65536):(M.push(J),D--)):M.push(J);return M}function P(X){return I(X,function(M){var D="";return M>65535&&(M-=65536,D+=T(M>>>10&1023|55296),M=56320|M&1023),D+=T(M),D}).join("")}function S(X){return X-48<10?X-22:X-65<26?X-65:X-97<26?X-97:h}function R(X,M){return X+22+75*(X<26)-((M!=0)<<5)}function F(X,M,D){var V=0;for(X=D?v(X/d):X>>1,X+=v(X/M);X>_*c>>1;V+=h)X=v(X/_);return v(V+(_+1)*X/(X+u))}function O(X){var M=[],D=X.length,V,J=0,j=p,mt=f,Tt,bt,N,Y,H,G,ut,ht,wt;for(Tt=X.lastIndexOf(m),Tt<0&&(Tt=0),bt=0;bt<Tt;++bt)X.charCodeAt(bt)>=128&&E("not-basic"),M.push(X.charCodeAt(bt));for(N=Tt>0?Tt+1:0;N<D;){for(Y=J,H=1,G=h;N>=D&&E("invalid-input"),ut=S(X.charCodeAt(N++)),(ut>=h||ut>v((a-J)/H))&&E("overflow"),J+=ut*H,ht=G<=mt?l:G>=mt+c?c:G-mt,!(ut<ht);G+=h)wt=h-ht,H>v(a/wt)&&E("overflow"),H*=wt;V=M.length+1,mt=F(J-Y,V,Y==0),v(J/V)>a-j&&E("overflow"),j+=v(J/V),J%=V,M.splice(J++,0,j)}return P(M)}function B(X){var M,D,V,J,j,mt,Tt,bt,N,Y,H,G=[],ut,ht,wt,Rt;for(X=L(X),ut=X.length,M=p,D=0,j=f,mt=0;mt<ut;++mt)H=X[mt],H<128&&G.push(T(H));for(V=J=G.length,J&&G.push(m);V<ut;){for(Tt=a,mt=0;mt<ut;++mt)H=X[mt],H>=M&&H<Tt&&(Tt=H);for(ht=V+1,Tt-M>v((a-D)/ht)&&E("overflow"),D+=(Tt-M)*ht,M=Tt,mt=0;mt<ut;++mt)if(H=X[mt],H<M&&++D>a&&E("overflow"),H==M){for(bt=D,N=h;Y=N<=j?l:N>=j+c?c:N-j,!(bt<Y);N+=h)Rt=bt-Y,wt=h-Y,G.push(T(R(Y+Rt%wt,0))),bt=v(Rt/wt);G.push(T(R(bt,0))),j=F(D,ht,V==J),D=0,++V}++D,++M}return G.join("")}function Z(X){return k(X,function(M){return g.test(M)?O(M.slice(4).toLowerCase()):M})}function st(X){return k(X,function(M){return y.test(M)?"xn--"+B(M):M})}if(o={version:"1.4.1",ucs2:{decode:L,encode:P},decode:O,encode:B,toASCII:st,toUnicode:Z},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})($e)}(Go,Go.exports);var nb=Go.exports,ob=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},cf=typeof Symbol<"u"&&Symbol,ab=ob,hb=function(){return typeof cf!="function"||typeof Symbol!="function"||typeof cf("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:ab()},uf={foo:{}},lb=Object,cb=function(){return{__proto__:uf}.foo===uf.foo&&!({__proto__:null}instanceof lb)},ub="Function.prototype.bind called on incompatible ",Qh=Array.prototype.slice,db=Object.prototype.toString,fb="[object Function]",pb=function(t){var e=this;if(typeof e!="function"||db.call(e)!==fb)throw new TypeError(ub+e);for(var i=Qh.call(arguments,1),s,n=function(){if(this instanceof s){var c=e.apply(this,i.concat(Qh.call(arguments)));return Object(c)===c?c:this}else return e.apply(t,i.concat(Qh.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},mb=pb,qh=Function.prototype.bind||mb,gb=qh,yb=gb.call(Function.call,Object.prototype.hasOwnProperty),gt,Es=SyntaxError,df=Function,Is=TypeError,tl=function(r){try{return df('"use strict"; return ('+r+").constructor;")()}catch{}},Nr=Object.getOwnPropertyDescriptor;if(Nr)try{Nr({},"")}catch{Nr=null}var el=function(){throw new Is},bb=Nr?function(){try{return arguments.callee,el}catch{try{return Nr(arguments,"callee").get}catch{return el}}}():el,As=hb(),xb=cb(),qt=Object.getPrototypeOf||(xb?function(r){return r.__proto__}:null),Ms={},_b=typeof Uint8Array>"u"||!qt?gt:qt(Uint8Array),Dr={"%AggregateError%":typeof AggregateError>"u"?gt:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?gt:ArrayBuffer,"%ArrayIteratorPrototype%":As&&qt?qt([][Symbol.iterator]()):gt,"%AsyncFromSyncIteratorPrototype%":gt,"%AsyncFunction%":Ms,"%AsyncGenerator%":Ms,"%AsyncGeneratorFunction%":Ms,"%AsyncIteratorPrototype%":Ms,"%Atomics%":typeof Atomics>"u"?gt:Atomics,"%BigInt%":typeof BigInt>"u"?gt:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?gt:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?gt:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?gt:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?gt:Float32Array,"%Float64Array%":typeof Float64Array>"u"?gt:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?gt:FinalizationRegistry,"%Function%":df,"%GeneratorFunction%":Ms,"%Int8Array%":typeof Int8Array>"u"?gt:Int8Array,"%Int16Array%":typeof Int16Array>"u"?gt:Int16Array,"%Int32Array%":typeof Int32Array>"u"?gt:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":As&&qt?qt(qt([][Symbol.iterator]())):gt,"%JSON%":typeof JSON=="object"?JSON:gt,"%Map%":typeof Map>"u"?gt:Map,"%MapIteratorPrototype%":typeof Map>"u"||!As||!qt?gt:qt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?gt:Promise,"%Proxy%":typeof Proxy>"u"?gt:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?gt:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?gt:Set,"%SetIteratorPrototype%":typeof Set>"u"||!As||!qt?gt:qt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?gt:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":As&&qt?qt(""[Symbol.iterator]()):gt,"%Symbol%":As?Symbol:gt,"%SyntaxError%":Es,"%ThrowTypeError%":bb,"%TypedArray%":_b,"%TypeError%":Is,"%Uint8Array%":typeof Uint8Array>"u"?gt:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?gt:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?gt:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?gt:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?gt:WeakMap,"%WeakRef%":typeof WeakRef>"u"?gt:WeakRef,"%WeakSet%":typeof WeakSet>"u"?gt:WeakSet};if(qt)try{null.error}catch(r){var vb=qt(qt(r));Dr["%Error.prototype%"]=vb}var wb=function r(t){var e;if(t==="%AsyncFunction%")e=tl("async function () {}");else if(t==="%GeneratorFunction%")e=tl("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=tl("async function* () {}");else if(t==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(e=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=r("%AsyncGenerator%");s&&qt&&(e=qt(s.prototype))}return Dr[t]=e,e},ff={"%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"]},Sn=qh,ko=yb,Tb=Sn.call(Function.call,Array.prototype.concat),Sb=Sn.call(Function.apply,Array.prototype.splice),pf=Sn.call(Function.call,String.prototype.replace),Fo=Sn.call(Function.call,String.prototype.slice),Cb=Sn.call(Function.call,RegExp.prototype.exec),Eb=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Ib=/\\(\\)?/g,Ab=function(t){var e=Fo(t,0,1),i=Fo(t,-1);if(e==="%"&&i!=="%")throw new Es("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&e!=="%")throw new Es("invalid intrinsic syntax, expected opening `%`");var s=[];return pf(t,Eb,function(n,o,a,h){s[s.length]=a?pf(h,Ib,"$1"):o||n}),s},Mb=function(t,e){var i=t,s;if(ko(ff,i)&&(s=ff[i],i="%"+s[0]+"%"),ko(Dr,i)){var n=Dr[i];if(n===Ms&&(n=wb(i)),typeof n>"u"&&!e)throw new Is("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:n}}throw new Es("intrinsic "+t+" does not exist!")},il=function(t,e){if(typeof t!="string"||t.length===0)throw new Is("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Is('"allowMissing" argument must be a boolean');if(Cb(/^%?[^%]*%?$/,t)===null)throw new Es("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=Ab(t),s=i.length>0?i[0]:"",n=Mb("%"+s+"%",e),o=n.name,a=n.value,h=!1,l=n.alias;l&&(s=l[0],Sb(i,Tb([0,1],l)));for(var c=1,u=!0;c<i.length;c+=1){var d=i[c],f=Fo(d,0,1),p=Fo(d,-1);if((f==='"'||f==="'"||f==="`"||p==='"'||p==="'"||p==="`")&&f!==p)throw new Es("property names with quotes must have matching quotes");if((d==="constructor"||!u)&&(h=!0),s+="."+d,o="%"+s+"%",ko(Dr,o))a=Dr[o];else if(a!=null){if(!(d in a)){if(!e)throw new Is("base intrinsic for "+t+" exists, but the property is not available.");return}if(Nr&&c+1>=i.length){var m=Nr(a,d);u=!!m,u&&"get"in m&&!("originalValue"in m.get)?a=m.get:a=a[d]}else u=ko(a,d),a=a[d];u&&!h&&(Dr[o]=a)}}return a},mf={exports:{}};(function(r){var t=qh,e=il,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})(mf);var Rb=mf.exports,gf=il,yf=Rb,Pb=yf(gf("String.prototype.indexOf")),Lb=function(t,e){var i=gf(t,!!e);return typeof i=="function"&&Pb(t,".prototype.")>-1?yf(i):i};const Gb=B1(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var rl=typeof Map=="function"&&Map.prototype,sl=Object.getOwnPropertyDescriptor&&rl?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,No=rl&&sl&&typeof sl.get=="function"?sl.get:null,bf=rl&&Map.prototype.forEach,nl=typeof Set=="function"&&Set.prototype,ol=Object.getOwnPropertyDescriptor&&nl?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Do=nl&&ol&&typeof ol.get=="function"?ol.get:null,xf=nl&&Set.prototype.forEach,kb=typeof WeakMap=="function"&&WeakMap.prototype,Cn=kb?WeakMap.prototype.has:null,Fb=typeof WeakSet=="function"&&WeakSet.prototype,En=Fb?WeakSet.prototype.has:null,Nb=typeof WeakRef=="function"&&WeakRef.prototype,_f=Nb?WeakRef.prototype.deref:null,Db=Boolean.prototype.valueOf,Ob=Object.prototype.toString,Ub=Function.prototype.toString,Bb=String.prototype.match,al=String.prototype.slice,nr=String.prototype.replace,Xb=String.prototype.toUpperCase,vf=String.prototype.toLowerCase,wf=RegExp.prototype.test,Tf=Array.prototype.concat,mi=Array.prototype.join,Wb=Array.prototype.slice,Sf=Math.floor,hl=typeof BigInt=="function"?BigInt.prototype.valueOf:null,ll=Object.getOwnPropertySymbols,cl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Rs=typeof Symbol=="function"&&typeof Symbol.iterator=="object",he=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Rs||!0)?Symbol.toStringTag:null,Cf=Object.prototype.propertyIsEnumerable,Ef=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function If(r,t){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||wf.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-Sf(-r):Sf(r);if(i!==r){var s=String(i),n=al.call(t,s.length+1);return nr.call(s,e,"$&_")+"."+nr.call(nr.call(n,/([0-9]{3})/g,"$&_"),/_$/,"")}}return nr.call(t,e,"$&_")}var ul=Gb,Af=ul.custom,Mf=Lf(Af)?Af:null,Zb=function r(t,e,i,s){var n=e||{};if(or(n,"quoteStyle")&&n.quoteStyle!=="single"&&n.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(or(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=or(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(or(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(or(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 kf(t,n);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var h=String(t);return a?If(t,h):h}if(typeof t=="bigint"){var l=String(t)+"n";return a?If(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 dl(t)?"[Array]":"[Object]";var u=ax(n,i);if(typeof s>"u")s=[];else if(Gf(s,t)>=0)return"[Circular]";function d(S,R,F){if(R&&(s=Wb.call(s),s.push(R)),F){var O={depth:n.depth};return or(n,"quoteStyle")&&(O.quoteStyle=n.quoteStyle),r(S,O,i+1,s)}return r(S,n,i+1,s)}if(typeof t=="function"&&!Pf(t)){var f=Qb(t),p=Oo(t,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+mi.call(p,", ")+" }":"")}if(Lf(t)){var m=Rs?nr.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):cl.call(t);return typeof t=="object"&&!Rs?In(m):m}if(sx(t)){for(var g="<"+vf.call(String(t.nodeName)),y=t.attributes||[],x=0;x<y.length;x++)g+=" "+y[x].name+"="+Rf(Vb(y[x].value),"double",n);return g+=">",t.childNodes&&t.childNodes.length&&(g+="..."),g+="</"+vf.call(String(t.nodeName))+">",g}if(dl(t)){if(t.length===0)return"[]";var b=Oo(t,d);return u&&!ox(b)?"["+pl(b,u)+"]":"[ "+mi.call(b,", ")+" ]"}if(Kb(t)){var _=Oo(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!Cf.call(t,"cause")?"{ ["+String(t)+"] "+mi.call(Tf.call("[cause]: "+d(t.cause),_),", ")+" }":_.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+mi.call(_,", ")+" }"}if(typeof t=="object"&&o){if(Mf&&typeof t[Mf]=="function"&&ul)return ul(t,{depth:c-i});if(o!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(qb(t)){var v=[];return bf&&bf.call(t,function(S,R){v.push(d(R,t,!0)+" => "+d(S,t))}),Ff("Map",No.call(t),v,u)}if(ix(t)){var T=[];return xf&&xf.call(t,function(S){T.push(d(S,t))}),Ff("Set",Do.call(t),T,u)}if(tx(t))return fl("WeakMap");if(rx(t))return fl("WeakSet");if(ex(t))return fl("WeakRef");if(zb(t))return In(d(Number(t)));if(Jb(t))return In(d(hl.call(t)));if(jb(t))return In(Db.call(t));if(Yb(t))return In(d(String(t)));if(!Hb(t)&&!Pf(t)){var C=Oo(t,d),E=Ef?Ef(t)===Object.prototype:t instanceof Object||t.constructor===Object,I=t instanceof Object?"":"null prototype",k=!E&&he&&Object(t)===t&&he in t?al.call(ar(t),8,-1):I?"Object":"",L=E||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",P=L+(k||I?"["+mi.call(Tf.call([],k||[],I||[]),": ")+"] ":"");return C.length===0?P+"{}":u?P+"{"+pl(C,u)+"}":P+"{ "+mi.call(C,", ")+" }"}return String(t)};function Rf(r,t,e){var i=(e.quoteStyle||t)==="double"?'"':"'";return i+r+i}function Vb(r){return nr.call(String(r),/"/g,"&quot;")}function dl(r){return ar(r)==="[object Array]"&&(!he||!(typeof r=="object"&&he in r))}function Hb(r){return ar(r)==="[object Date]"&&(!he||!(typeof r=="object"&&he in r))}function Pf(r){return ar(r)==="[object RegExp]"&&(!he||!(typeof r=="object"&&he in r))}function Kb(r){return ar(r)==="[object Error]"&&(!he||!(typeof r=="object"&&he in r))}function Yb(r){return ar(r)==="[object String]"&&(!he||!(typeof r=="object"&&he in r))}function zb(r){return ar(r)==="[object Number]"&&(!he||!(typeof r=="object"&&he in r))}function jb(r){return ar(r)==="[object Boolean]"&&(!he||!(typeof r=="object"&&he in r))}function Lf(r){if(Rs)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!cl)return!1;try{return cl.call(r),!0}catch{}return!1}function Jb(r){if(!r||typeof r!="object"||!hl)return!1;try{return hl.call(r),!0}catch{}return!1}var $b=Object.prototype.hasOwnProperty||function(r){return r in this};function or(r,t){return $b.call(r,t)}function ar(r){return Ob.call(r)}function Qb(r){if(r.name)return r.name;var t=Bb.call(Ub.call(r),/^function\s*([\w$]+)/);return t?t[1]:null}function Gf(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 qb(r){if(!No||!r||typeof r!="object")return!1;try{No.call(r);try{Do.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function tx(r){if(!Cn||!r||typeof r!="object")return!1;try{Cn.call(r,Cn);try{En.call(r,En)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function ex(r){if(!_f||!r||typeof r!="object")return!1;try{return _f.call(r),!0}catch{}return!1}function ix(r){if(!Do||!r||typeof r!="object")return!1;try{Do.call(r);try{No.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function rx(r){if(!En||!r||typeof r!="object")return!1;try{En.call(r,En);try{Cn.call(r,Cn)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function sx(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function kf(r,t){if(r.length>t.maxStringLength){var e=r.length-t.maxStringLength,i="... "+e+" more character"+(e>1?"s":"");return kf(al.call(r,0,t.maxStringLength),t)+i}var s=nr.call(nr.call(r,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,nx);return Rf(s,"single",t)}function nx(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":"")+Xb.call(t.toString(16))}function In(r){return"Object("+r+")"}function fl(r){return r+" { ? }"}function Ff(r,t,e,i){var s=i?pl(e,i):mi.call(e,", ");return r+" ("+t+") {"+s+"}"}function ox(r){for(var t=0;t<r.length;t++)if(Gf(r[t],`
1
+ (function(q,Ie){typeof exports=="object"&&typeof module<"u"?Ie(exports):typeof define=="function"&&define.amd?define(["exports"],Ie):(q=typeof globalThis<"u"?globalThis:q||self,Ie(q["prefect-graphs"]={}))})(this,function(q){"use strict";var lP=Object.defineProperty;var cP=(q,Ie,Gr)=>Ie in q?lP(q,Ie,{enumerable:!0,configurable:!0,writable:!0,value:Gr}):q[Ie]=Gr;var gd=(q,Ie,Gr)=>cP(q,typeof Ie!="symbol"?Ie+"":Ie,Gr);const Ie=["result","markdown","table","progress","image","unknown"],Gr={markdown:"ArtifactMarkdown",table:"ArtifactTable",result:"ArtifactResult",image:"ArtifactImage",progress:"ArtifactProgress",unknown:"Artifact"},Lh=["flow-run","task-run"];function L1(r){return Lh.includes(r)}function Io(r){return Lh.includes(r.kind)}function Sd(r){return r.kind==="artifact"}function Cd(r){return r.kind==="artifacts"}function Ed(r){return r.kind==="state"}function Id(r){return r.kind==="event"}function Ad(r){return r.kind==="events"}const G1=["COMPLETED","RUNNING","SCHEDULED","PENDING","FAILED","CANCELLED","CANCELLING","CRASHED","PAUSED"];function k1(r){return["waterfall","nearest-parent","duration-sorted"].includes(r)}function F1(r){return["temporal","dependency","left-aligned"].includes(r)}const Gh="nodes-container",Md="node-container",Rd="edge-container",Pd=1,kh=20,Ld=200,Gd=.2,kd=.2,Fd=.2,Nd=.1,Fh=10,Nh=4,Dh=20,Oh=64,N1=.25,D1=1,Bh=30,Dd=260,Uh=250,Od=1,Bd=2,Ud=3,Xd=4,Xh=0,Wh=2,Wd=1,Zd=2,Vd=3,Zh=4,bn=5;var kr=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(kr||{}),Hd=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(Hd||{}),Vh=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(Vh||{}),lt=(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))(lt||{}),ci=(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))(ci||{}),W=(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))(W||{}),Ts=(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))(Ts||{}),ot=(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))(ot||{}),J=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(J||{}),Ni=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(Ni||{}),ui=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(ui||{}),di=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(di||{}),ye=(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))(ye||{}),fi=(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))(fi||{}),Hh=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(Hh||{}),Oe=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(Oe||{}),jt=(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))(jt||{}),Zt=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(Zt||{}),pi=(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))(pi||{});const $={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 Kh=/iPhone/i,Kd=/iPod/i,Yd=/iPad/i,zd=/\biOS-universal(?:.+)Mac\b/i,Yh=/\bAndroid(?:.+)Mobile\b/i,jd=/Android/i,Ss=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Ao=/Silk/i,Di=/Windows Phone/i,Jd=/\bWindows(?:.+)ARM\b/i,$d=/BlackBerry/i,Qd=/BB10/i,qd=/Opera Mini/i,tf=/\b(CriOS|Chrome)(?:.+)Mobile/i,ef=/Mobile(?:.+)Firefox\b/i,rf=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"};function O1(r){return function(t){return t.test(r)}}function sf(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=O1(e),n={apple:{phone:s(Kh)&&!s(Di),ipod:s(Kd),tablet:!s(Kh)&&(s(Yd)||rf(t))&&!s(Di),universal:s(zd),device:(s(Kh)||s(Kd)||s(Yd)||s(zd)||rf(t))&&!s(Di)},amazon:{phone:s(Ss),tablet:!s(Ss)&&s(Ao),device:s(Ss)||s(Ao)},android:{phone:!s(Di)&&s(Ss)||!s(Di)&&s(Yh),tablet:!s(Di)&&!s(Ss)&&!s(Yh)&&(s(Ao)||s(jd)),device:!s(Di)&&(s(Ss)||s(Ao)||s(Yh)||s(jd))||s(/\bokhttp\b/i)},windows:{phone:s(Di),tablet:s(Jd),device:s(Di)||s(Jd)},other:{blackberry:s($d),blackberry10:s(Qd),opera:s(qd),firefox:s(ef),chrome:s(tf),device:s($d)||s(Qd)||s(qd)||s(ef)||s(tf)},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 B1=sf.default??sf,Oi=B1(globalThis.navigator);$.RETINA_PREFIX=/@([0-9\.]+)x/,$.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var $e=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xn(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function U1(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 nf={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 _=g.length,v;for(b=0;b<_;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(v=1,x=new Array(y-1);v<y;v++)x[v-1]=arguments[v];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})(nf);var X1=nf.exports;const _n=xn(X1);var zh={exports:{}};zh.exports=Mo,zh.exports.default=Mo;function Mo(r,t,e){e=e||2;var i=t&&t.length,s=i?t[0]*e:r.length,n=of(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=K1(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 vn(n,o,e,a,h,f,0),o}function of(r,t,e,i,s){var n,o;if(s===$h(r,t,e,i)>0)for(n=t;n<e;n+=i)o=lf(n,r[n],r[n+1],o);else for(n=e-i;n>=t;n-=i)o=lf(n,r[n],r[n+1],o);return o&&Ro(o,o.next)&&(Tn(o),o=o.next),o}function Fr(r,t){if(!r)return r;t||(t=r);var e=r,i;do if(i=!1,!e.steiner&&(Ro(e,e.next)||Pt(e.prev,e,e.next)===0)){if(Tn(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function vn(r,t,e,i,s,n,o){if(r){!o&&n&&$1(r,i,s,n);for(var a=r,h,l;r.prev!==r.next;){if(h=r.prev,l=r.next,n?Z1(r,i,s,n):W1(r)){t.push(h.i/e|0),t.push(r.i/e|0),t.push(l.i/e|0),Tn(r),r=l.next,a=l.next;continue}if(r=l,r===a){o?o===1?(r=V1(Fr(r),t,e),vn(r,t,e,i,s,n,2)):o===2&&H1(r,t,e,i,s,n):vn(Fr(r),t,e,i,s,n,1);break}}}}function W1(r){var t=r.prev,e=r,i=r.next;if(Pt(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&&Cs(s,a,n,h,o,l,p.x,p.y)&&Pt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Z1(r,t,e,i){var s=r.prev,n=r,o=r.next;if(Pt(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=jh(f,p,t,e,i),x=jh(m,g,t,e,i),b=r.prevZ,_=r.nextZ;b&&b.z>=y&&_&&_.z<=x;){if(b.x>=f&&b.x<=m&&b.y>=p&&b.y<=g&&b!==s&&b!==o&&Cs(a,c,h,u,l,d,b.x,b.y)&&Pt(b.prev,b,b.next)>=0||(b=b.prevZ,_.x>=f&&_.x<=m&&_.y>=p&&_.y<=g&&_!==s&&_!==o&&Cs(a,c,h,u,l,d,_.x,_.y)&&Pt(_.prev,_,_.next)>=0))return!1;_=_.nextZ}for(;b&&b.z>=y;){if(b.x>=f&&b.x<=m&&b.y>=p&&b.y<=g&&b!==s&&b!==o&&Cs(a,c,h,u,l,d,b.x,b.y)&&Pt(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;_&&_.z<=x;){if(_.x>=f&&_.x<=m&&_.y>=p&&_.y<=g&&_!==s&&_!==o&&Cs(a,c,h,u,l,d,_.x,_.y)&&Pt(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}function V1(r,t,e){var i=r;do{var s=i.prev,n=i.next.next;!Ro(s,n)&&af(s,i,i.next,n)&&wn(s,n)&&wn(n,s)&&(t.push(s.i/e|0),t.push(i.i/e|0),t.push(n.i/e|0),Tn(i),Tn(i.next),i=r=n),i=i.next}while(i!==r);return Fr(i)}function H1(r,t,e,i,s,n){var o=r;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&tb(o,a)){var h=hf(o,a);o=Fr(o,o.next),h=Fr(h,h.next),vn(o,t,e,i,s,n,0),vn(h,t,e,i,s,n,0);return}a=a.next}o=o.next}while(o!==r)}function K1(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=of(r,a,h,i,!1),l===l.next&&(l.steiner=!0),s.push(q1(l));for(s.sort(Y1),n=0;n<s.length;n++)e=z1(s[n],e);return e}function Y1(r,t){return r.x-t.x}function z1(r,t){var e=j1(r,t);if(!e)return t;var i=hf(e,r);return Fr(i,i.next),Fr(e,e.next)}function j1(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&&Cs(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),wn(e,r)&&(d<u||d===u&&(e.x>o.x||e.x===o.x&&J1(o,e)))&&(o=e,u=d)),e=e.next;while(e!==h);return o}function J1(r,t){return Pt(r.prev,r,t.prev)<0&&Pt(t.next,r,r.next)<0}function $1(r,t,e,i){var s=r;do s.z===0&&(s.z=jh(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,Q1(s)}function Q1(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 jh(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 q1(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 Cs(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 tb(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!eb(r,t)&&(wn(r,t)&&wn(t,r)&&ib(r,t)&&(Pt(r.prev,r,t.prev)||Pt(r,t.prev,t))||Ro(r,t)&&Pt(r.prev,r,r.next)>0&&Pt(t.prev,t,t.next)>0)}function Pt(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function Ro(r,t){return r.x===t.x&&r.y===t.y}function af(r,t,e,i){var s=Lo(Pt(r,t,e)),n=Lo(Pt(r,t,i)),o=Lo(Pt(e,i,r)),a=Lo(Pt(e,i,t));return!!(s!==n&&o!==a||s===0&&Po(r,e,t)||n===0&&Po(r,i,t)||o===0&&Po(e,r,i)||a===0&&Po(e,t,i))}function Po(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 Lo(r){return r>0?1:r<0?-1:0}function eb(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&&af(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function wn(r,t){return Pt(r.prev,r,r.next)<0?Pt(r,t,r.next)>=0&&Pt(r,r.prev,t)>=0:Pt(r,t,r.prev)<0||Pt(r,r.next,t)<0}function ib(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 hf(r,t){var e=new Jh(r.i,r.x,r.y),i=new Jh(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 lf(r,t,e,i){var s=new Jh(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 Tn(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 Jh(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}Mo.deviation=function(r,t,e,i){var s=t&&t.length,n=s?t[0]*e:r.length,o=Math.abs($h(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($h(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 $h(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}Mo.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 rb=zh.exports;const sb=xn(rb);var Go={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */Go.exports,function(r,t){(function(e){var i=t&&!t.nodeType&&t,s=r&&!r.nodeType&&r,n=typeof $e=="object"&&$e;(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"},_=h-l,v=Math.floor,T=String.fromCharCode,C;function E(X){throw new RangeError(b[X])}function I(X,M){for(var D=X.length,V=[];D--;)V[D]=M(X[D]);return V}function k(X,M){var D=X.split("@"),V="";D.length>1&&(V=D[0]+"@",X=D[1]),X=X.replace(x,".");var Q=X.split("."),j=I(Q,M).join(".");return V+j}function L(X){for(var M=[],D=0,V=X.length,Q,j;D<V;)Q=X.charCodeAt(D++),Q>=55296&&Q<=56319&&D<V?(j=X.charCodeAt(D++),(j&64512)==56320?M.push(((Q&1023)<<10)+(j&1023)+65536):(M.push(Q),D--)):M.push(Q);return M}function P(X){return I(X,function(M){var D="";return M>65535&&(M-=65536,D+=T(M>>>10&1023|55296),M=56320|M&1023),D+=T(M),D}).join("")}function S(X){return X-48<10?X-22:X-65<26?X-65:X-97<26?X-97:h}function R(X,M){return X+22+75*(X<26)-((M!=0)<<5)}function F(X,M,D){var V=0;for(X=D?v(X/d):X>>1,X+=v(X/M);X>_*c>>1;V+=h)X=v(X/_);return v(V+(_+1)*X/(X+u))}function O(X){var M=[],D=X.length,V,Q=0,j=p,xt=f,Tt,yt,N,Y,H,G,ut,ht,wt;for(Tt=X.lastIndexOf(m),Tt<0&&(Tt=0),yt=0;yt<Tt;++yt)X.charCodeAt(yt)>=128&&E("not-basic"),M.push(X.charCodeAt(yt));for(N=Tt>0?Tt+1:0;N<D;){for(Y=Q,H=1,G=h;N>=D&&E("invalid-input"),ut=S(X.charCodeAt(N++)),(ut>=h||ut>v((a-Q)/H))&&E("overflow"),Q+=ut*H,ht=G<=xt?l:G>=xt+c?c:G-xt,!(ut<ht);G+=h)wt=h-ht,H>v(a/wt)&&E("overflow"),H*=wt;V=M.length+1,xt=F(Q-Y,V,Y==0),v(Q/V)>a-j&&E("overflow"),j+=v(Q/V),Q%=V,M.splice(Q++,0,j)}return P(M)}function U(X){var M,D,V,Q,j,xt,Tt,yt,N,Y,H,G=[],ut,ht,wt,Rt;for(X=L(X),ut=X.length,M=p,D=0,j=f,xt=0;xt<ut;++xt)H=X[xt],H<128&&G.push(T(H));for(V=Q=G.length,Q&&G.push(m);V<ut;){for(Tt=a,xt=0;xt<ut;++xt)H=X[xt],H>=M&&H<Tt&&(Tt=H);for(ht=V+1,Tt-M>v((a-D)/ht)&&E("overflow"),D+=(Tt-M)*ht,M=Tt,xt=0;xt<ut;++xt)if(H=X[xt],H<M&&++D>a&&E("overflow"),H==M){for(yt=D,N=h;Y=N<=j?l:N>=j+c?c:N-j,!(yt<Y);N+=h)Rt=yt-Y,wt=h-Y,G.push(T(R(Y+Rt%wt,0))),yt=v(Rt/wt);G.push(T(R(yt,0))),j=F(D,ht,V==Q),D=0,++V}++D,++M}return G.join("")}function Z(X){return k(X,function(M){return g.test(M)?O(M.slice(4).toLowerCase()):M})}function st(X){return k(X,function(M){return y.test(M)?"xn--"+U(M):M})}if(o={version:"1.4.1",ucs2:{decode:L,encode:P},decode:O,encode:U,toASCII:st,toUnicode:Z},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})($e)}(Go,Go.exports);var nb=Go.exports,ob=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},cf=typeof Symbol<"u"&&Symbol,ab=ob,hb=function(){return typeof cf!="function"||typeof Symbol!="function"||typeof cf("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:ab()},uf={foo:{}},lb=Object,cb=function(){return{__proto__:uf}.foo===uf.foo&&!({__proto__:null}instanceof lb)},ub="Function.prototype.bind called on incompatible ",Qh=Array.prototype.slice,db=Object.prototype.toString,fb="[object Function]",pb=function(t){var e=this;if(typeof e!="function"||db.call(e)!==fb)throw new TypeError(ub+e);for(var i=Qh.call(arguments,1),s,n=function(){if(this instanceof s){var c=e.apply(this,i.concat(Qh.call(arguments)));return Object(c)===c?c:this}else return e.apply(t,i.concat(Qh.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},mb=pb,qh=Function.prototype.bind||mb,gb=qh,yb=gb.call(Function.call,Object.prototype.hasOwnProperty),mt,Es=SyntaxError,df=Function,Is=TypeError,tl=function(r){try{return df('"use strict"; return ('+r+").constructor;")()}catch{}},Nr=Object.getOwnPropertyDescriptor;if(Nr)try{Nr({},"")}catch{Nr=null}var el=function(){throw new Is},bb=Nr?function(){try{return arguments.callee,el}catch{try{return Nr(arguments,"callee").get}catch{return el}}}():el,As=hb(),xb=cb(),qt=Object.getPrototypeOf||(xb?function(r){return r.__proto__}:null),Ms={},_b=typeof Uint8Array>"u"||!qt?mt:qt(Uint8Array),Dr={"%AggregateError%":typeof AggregateError>"u"?mt:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?mt:ArrayBuffer,"%ArrayIteratorPrototype%":As&&qt?qt([][Symbol.iterator]()):mt,"%AsyncFromSyncIteratorPrototype%":mt,"%AsyncFunction%":Ms,"%AsyncGenerator%":Ms,"%AsyncGeneratorFunction%":Ms,"%AsyncIteratorPrototype%":Ms,"%Atomics%":typeof Atomics>"u"?mt:Atomics,"%BigInt%":typeof BigInt>"u"?mt:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?mt:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?mt:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?mt:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?mt:Float32Array,"%Float64Array%":typeof Float64Array>"u"?mt:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?mt:FinalizationRegistry,"%Function%":df,"%GeneratorFunction%":Ms,"%Int8Array%":typeof Int8Array>"u"?mt:Int8Array,"%Int16Array%":typeof Int16Array>"u"?mt:Int16Array,"%Int32Array%":typeof Int32Array>"u"?mt:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":As&&qt?qt(qt([][Symbol.iterator]())):mt,"%JSON%":typeof JSON=="object"?JSON:mt,"%Map%":typeof Map>"u"?mt:Map,"%MapIteratorPrototype%":typeof Map>"u"||!As||!qt?mt:qt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?mt:Promise,"%Proxy%":typeof Proxy>"u"?mt:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?mt:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?mt:Set,"%SetIteratorPrototype%":typeof Set>"u"||!As||!qt?mt:qt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?mt:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":As&&qt?qt(""[Symbol.iterator]()):mt,"%Symbol%":As?Symbol:mt,"%SyntaxError%":Es,"%ThrowTypeError%":bb,"%TypedArray%":_b,"%TypeError%":Is,"%Uint8Array%":typeof Uint8Array>"u"?mt:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?mt:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?mt:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?mt:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?mt:WeakMap,"%WeakRef%":typeof WeakRef>"u"?mt:WeakRef,"%WeakSet%":typeof WeakSet>"u"?mt:WeakSet};if(qt)try{null.error}catch(r){var vb=qt(qt(r));Dr["%Error.prototype%"]=vb}var wb=function r(t){var e;if(t==="%AsyncFunction%")e=tl("async function () {}");else if(t==="%GeneratorFunction%")e=tl("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=tl("async function* () {}");else if(t==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(e=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=r("%AsyncGenerator%");s&&qt&&(e=qt(s.prototype))}return Dr[t]=e,e},ff={"%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"]},Sn=qh,ko=yb,Tb=Sn.call(Function.call,Array.prototype.concat),Sb=Sn.call(Function.apply,Array.prototype.splice),pf=Sn.call(Function.call,String.prototype.replace),Fo=Sn.call(Function.call,String.prototype.slice),Cb=Sn.call(Function.call,RegExp.prototype.exec),Eb=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Ib=/\\(\\)?/g,Ab=function(t){var e=Fo(t,0,1),i=Fo(t,-1);if(e==="%"&&i!=="%")throw new Es("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&e!=="%")throw new Es("invalid intrinsic syntax, expected opening `%`");var s=[];return pf(t,Eb,function(n,o,a,h){s[s.length]=a?pf(h,Ib,"$1"):o||n}),s},Mb=function(t,e){var i=t,s;if(ko(ff,i)&&(s=ff[i],i="%"+s[0]+"%"),ko(Dr,i)){var n=Dr[i];if(n===Ms&&(n=wb(i)),typeof n>"u"&&!e)throw new Is("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:n}}throw new Es("intrinsic "+t+" does not exist!")},il=function(t,e){if(typeof t!="string"||t.length===0)throw new Is("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Is('"allowMissing" argument must be a boolean');if(Cb(/^%?[^%]*%?$/,t)===null)throw new Es("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=Ab(t),s=i.length>0?i[0]:"",n=Mb("%"+s+"%",e),o=n.name,a=n.value,h=!1,l=n.alias;l&&(s=l[0],Sb(i,Tb([0,1],l)));for(var c=1,u=!0;c<i.length;c+=1){var d=i[c],f=Fo(d,0,1),p=Fo(d,-1);if((f==='"'||f==="'"||f==="`"||p==='"'||p==="'"||p==="`")&&f!==p)throw new Es("property names with quotes must have matching quotes");if((d==="constructor"||!u)&&(h=!0),s+="."+d,o="%"+s+"%",ko(Dr,o))a=Dr[o];else if(a!=null){if(!(d in a)){if(!e)throw new Is("base intrinsic for "+t+" exists, but the property is not available.");return}if(Nr&&c+1>=i.length){var m=Nr(a,d);u=!!m,u&&"get"in m&&!("originalValue"in m.get)?a=m.get:a=a[d]}else u=ko(a,d),a=a[d];u&&!h&&(Dr[o]=a)}}return a},mf={exports:{}};(function(r){var t=qh,e=il,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})(mf);var Rb=mf.exports,gf=il,yf=Rb,Pb=yf(gf("String.prototype.indexOf")),Lb=function(t,e){var i=gf(t,!!e);return typeof i=="function"&&Pb(t,".prototype.")>-1?yf(i):i};const Gb=U1(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var rl=typeof Map=="function"&&Map.prototype,sl=Object.getOwnPropertyDescriptor&&rl?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,No=rl&&sl&&typeof sl.get=="function"?sl.get:null,bf=rl&&Map.prototype.forEach,nl=typeof Set=="function"&&Set.prototype,ol=Object.getOwnPropertyDescriptor&&nl?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Do=nl&&ol&&typeof ol.get=="function"?ol.get:null,xf=nl&&Set.prototype.forEach,kb=typeof WeakMap=="function"&&WeakMap.prototype,Cn=kb?WeakMap.prototype.has:null,Fb=typeof WeakSet=="function"&&WeakSet.prototype,En=Fb?WeakSet.prototype.has:null,Nb=typeof WeakRef=="function"&&WeakRef.prototype,_f=Nb?WeakRef.prototype.deref:null,Db=Boolean.prototype.valueOf,Ob=Object.prototype.toString,Bb=Function.prototype.toString,Ub=String.prototype.match,al=String.prototype.slice,nr=String.prototype.replace,Xb=String.prototype.toUpperCase,vf=String.prototype.toLowerCase,wf=RegExp.prototype.test,Tf=Array.prototype.concat,mi=Array.prototype.join,Wb=Array.prototype.slice,Sf=Math.floor,hl=typeof BigInt=="function"?BigInt.prototype.valueOf:null,ll=Object.getOwnPropertySymbols,cl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Rs=typeof Symbol=="function"&&typeof Symbol.iterator=="object",he=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Rs||!0)?Symbol.toStringTag:null,Cf=Object.prototype.propertyIsEnumerable,Ef=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function If(r,t){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||wf.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-Sf(-r):Sf(r);if(i!==r){var s=String(i),n=al.call(t,s.length+1);return nr.call(s,e,"$&_")+"."+nr.call(nr.call(n,/([0-9]{3})/g,"$&_"),/_$/,"")}}return nr.call(t,e,"$&_")}var ul=Gb,Af=ul.custom,Mf=Lf(Af)?Af:null,Zb=function r(t,e,i,s){var n=e||{};if(or(n,"quoteStyle")&&n.quoteStyle!=="single"&&n.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(or(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=or(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(or(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(or(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 kf(t,n);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var h=String(t);return a?If(t,h):h}if(typeof t=="bigint"){var l=String(t)+"n";return a?If(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 dl(t)?"[Array]":"[Object]";var u=ax(n,i);if(typeof s>"u")s=[];else if(Gf(s,t)>=0)return"[Circular]";function d(S,R,F){if(R&&(s=Wb.call(s),s.push(R)),F){var O={depth:n.depth};return or(n,"quoteStyle")&&(O.quoteStyle=n.quoteStyle),r(S,O,i+1,s)}return r(S,n,i+1,s)}if(typeof t=="function"&&!Pf(t)){var f=Qb(t),p=Oo(t,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+mi.call(p,", ")+" }":"")}if(Lf(t)){var m=Rs?nr.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):cl.call(t);return typeof t=="object"&&!Rs?In(m):m}if(sx(t)){for(var g="<"+vf.call(String(t.nodeName)),y=t.attributes||[],x=0;x<y.length;x++)g+=" "+y[x].name+"="+Rf(Vb(y[x].value),"double",n);return g+=">",t.childNodes&&t.childNodes.length&&(g+="..."),g+="</"+vf.call(String(t.nodeName))+">",g}if(dl(t)){if(t.length===0)return"[]";var b=Oo(t,d);return u&&!ox(b)?"["+pl(b,u)+"]":"[ "+mi.call(b,", ")+" ]"}if(Kb(t)){var _=Oo(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!Cf.call(t,"cause")?"{ ["+String(t)+"] "+mi.call(Tf.call("[cause]: "+d(t.cause),_),", ")+" }":_.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+mi.call(_,", ")+" }"}if(typeof t=="object"&&o){if(Mf&&typeof t[Mf]=="function"&&ul)return ul(t,{depth:c-i});if(o!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(qb(t)){var v=[];return bf&&bf.call(t,function(S,R){v.push(d(R,t,!0)+" => "+d(S,t))}),Ff("Map",No.call(t),v,u)}if(ix(t)){var T=[];return xf&&xf.call(t,function(S){T.push(d(S,t))}),Ff("Set",Do.call(t),T,u)}if(tx(t))return fl("WeakMap");if(rx(t))return fl("WeakSet");if(ex(t))return fl("WeakRef");if(zb(t))return In(d(Number(t)));if(Jb(t))return In(d(hl.call(t)));if(jb(t))return In(Db.call(t));if(Yb(t))return In(d(String(t)));if(!Hb(t)&&!Pf(t)){var C=Oo(t,d),E=Ef?Ef(t)===Object.prototype:t instanceof Object||t.constructor===Object,I=t instanceof Object?"":"null prototype",k=!E&&he&&Object(t)===t&&he in t?al.call(ar(t),8,-1):I?"Object":"",L=E||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",P=L+(k||I?"["+mi.call(Tf.call([],k||[],I||[]),": ")+"] ":"");return C.length===0?P+"{}":u?P+"{"+pl(C,u)+"}":P+"{ "+mi.call(C,", ")+" }"}return String(t)};function Rf(r,t,e){var i=(e.quoteStyle||t)==="double"?'"':"'";return i+r+i}function Vb(r){return nr.call(String(r),/"/g,"&quot;")}function dl(r){return ar(r)==="[object Array]"&&(!he||!(typeof r=="object"&&he in r))}function Hb(r){return ar(r)==="[object Date]"&&(!he||!(typeof r=="object"&&he in r))}function Pf(r){return ar(r)==="[object RegExp]"&&(!he||!(typeof r=="object"&&he in r))}function Kb(r){return ar(r)==="[object Error]"&&(!he||!(typeof r=="object"&&he in r))}function Yb(r){return ar(r)==="[object String]"&&(!he||!(typeof r=="object"&&he in r))}function zb(r){return ar(r)==="[object Number]"&&(!he||!(typeof r=="object"&&he in r))}function jb(r){return ar(r)==="[object Boolean]"&&(!he||!(typeof r=="object"&&he in r))}function Lf(r){if(Rs)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!cl)return!1;try{return cl.call(r),!0}catch{}return!1}function Jb(r){if(!r||typeof r!="object"||!hl)return!1;try{return hl.call(r),!0}catch{}return!1}var $b=Object.prototype.hasOwnProperty||function(r){return r in this};function or(r,t){return $b.call(r,t)}function ar(r){return Ob.call(r)}function Qb(r){if(r.name)return r.name;var t=Ub.call(Bb.call(r),/^function\s*([\w$]+)/);return t?t[1]:null}function Gf(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 qb(r){if(!No||!r||typeof r!="object")return!1;try{No.call(r);try{Do.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function tx(r){if(!Cn||!r||typeof r!="object")return!1;try{Cn.call(r,Cn);try{En.call(r,En)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function ex(r){if(!_f||!r||typeof r!="object")return!1;try{return _f.call(r),!0}catch{}return!1}function ix(r){if(!Do||!r||typeof r!="object")return!1;try{Do.call(r);try{No.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function rx(r){if(!En||!r||typeof r!="object")return!1;try{En.call(r,En);try{Cn.call(r,Cn)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function sx(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function kf(r,t){if(r.length>t.maxStringLength){var e=r.length-t.maxStringLength,i="... "+e+" more character"+(e>1?"s":"");return kf(al.call(r,0,t.maxStringLength),t)+i}var s=nr.call(nr.call(r,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,nx);return Rf(s,"single",t)}function nx(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":"")+Xb.call(t.toString(16))}function In(r){return"Object("+r+")"}function fl(r){return r+" { ? }"}function Ff(r,t,e,i){var s=i?pl(e,i):mi.call(e,", ");return r+" ("+t+") {"+s+"}"}function ox(r){for(var t=0;t<r.length;t++)if(Gf(r[t],`
2
2
  `)>=0)return!1;return!0}function ax(r,t){var e;if(r.indent===" ")e=" ";else if(typeof r.indent=="number"&&r.indent>0)e=mi.call(Array(r.indent+1)," ");else return null;return{base:e,prev:mi.call(Array(t+1),e)}}function pl(r,t){if(r.length===0)return"";var e=`
3
3
  `+t.prev+t.base;return e+mi.call(r,","+e)+`
4
- `+t.prev}function Oo(r,t){var e=dl(r),i=[];if(e){i.length=r.length;for(var s=0;s<r.length;s++)i[s]=or(r,s)?t(r[s],r):""}var n=typeof ll=="function"?ll(r):[],o;if(Rs){o={};for(var a=0;a<n.length;a++)o["$"+n[a]]=n[a]}for(var h in r)or(r,h)&&(e&&String(Number(h))===h&&h<r.length||Rs&&o["$"+h]instanceof Symbol||(wf.call(/[^\w$]/,h)?i.push(t(h,r)+": "+t(r[h],r)):i.push(h+": "+t(r[h],r))));if(typeof ll=="function")for(var l=0;l<n.length;l++)Cf.call(r,n[l])&&i.push("["+t(n[l])+"]: "+t(r[n[l]],r));return i}var ml=il,Ps=Lb,hx=Zb,lx=ml("%TypeError%"),Uo=ml("%WeakMap%",!0),Bo=ml("%Map%",!0),cx=Ps("WeakMap.prototype.get",!0),ux=Ps("WeakMap.prototype.set",!0),dx=Ps("WeakMap.prototype.has",!0),fx=Ps("Map.prototype.get",!0),px=Ps("Map.prototype.set",!0),mx=Ps("Map.prototype.has",!0),gl=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},gx=function(r,t){var e=gl(r,t);return e&&e.value},yx=function(r,t,e){var i=gl(r,t);i?i.value=e:r.next={key:t,next:r.next,value:e}},bx=function(r,t){return!!gl(r,t)},xx=function(){var t,e,i,s={assert:function(n){if(!s.has(n))throw new lx("Side channel does not contain "+hx(n))},get:function(n){if(Uo&&n&&(typeof n=="object"||typeof n=="function")){if(t)return cx(t,n)}else if(Bo){if(e)return fx(e,n)}else if(i)return gx(i,n)},has:function(n){if(Uo&&n&&(typeof n=="object"||typeof n=="function")){if(t)return dx(t,n)}else if(Bo){if(e)return mx(e,n)}else if(i)return bx(i,n);return!1},set:function(n,o){Uo&&n&&(typeof n=="object"||typeof n=="function")?(t||(t=new Uo),ux(t,n,o)):Bo?(e||(e=new Bo),px(e,n,o)):(i||(i={key:{},next:null}),yx(i,n,o))}};return s},_x=String.prototype.replace,vx=/%20/g,yl={RFC1738:"RFC1738",RFC3986:"RFC3986"},bl={default:yl.RFC3986,formatters:{RFC1738:function(r){return _x.call(r,vx,"+")},RFC3986:function(r){return String(r)}},RFC1738:yl.RFC1738,RFC3986:yl.RFC3986},wx=bl,xl=Object.prototype.hasOwnProperty,Or=Array.isArray,gi=function(){for(var r=[],t=0;t<256;++t)r.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return r}(),Tx=function(t){for(;t.length>1;){var e=t.pop(),i=e.obj[e.prop];if(Or(i)){for(var s=[],n=0;n<i.length;++n)typeof i[n]<"u"&&s.push(i[n]);e.obj[e.prop]=s}}},Nf=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},Sx=function r(t,e,i){if(!e)return t;if(typeof e!="object"){if(Or(t))t.push(e);else if(t&&typeof t=="object")(i&&(i.plainObjects||i.allowPrototypes)||!xl.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 Or(t)&&!Or(e)&&(s=Nf(t,i)),Or(t)&&Or(e)?(e.forEach(function(n,o){if(xl.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 xl.call(n,o)?n[o]=r(n[o],a,i):n[o]=a,n},s)},Cx=function(t,e){return Object.keys(e).reduce(function(i,s){return i[s]=e[s],i},t)},Ex=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}},Ix=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===wx.RFC1738&&(l===40||l===41)){a+=o.charAt(h);continue}if(l<128){a=a+gi[l];continue}if(l<2048){a=a+(gi[192|l>>6]+gi[128|l&63]);continue}if(l<55296||l>=57344){a=a+(gi[224|l>>12]+gi[128|l>>6&63]+gi[128|l&63]);continue}h+=1,l=65536+((l&1023)<<10|o.charCodeAt(h)&1023),a+=gi[240|l>>18]+gi[128|l>>12&63]+gi[128|l>>6&63]+gi[128|l&63]}return a},Ax=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 Tx(e),t},Mx=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},Rx=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},Px=function(t,e){return[].concat(t,e)},Lx=function(t,e){if(Or(t)){for(var i=[],s=0;s<t.length;s+=1)i.push(e(t[s]));return i}return e(t)},Df={arrayToObject:Nf,assign:Cx,combine:Px,compact:Ax,decode:Ex,encode:Ix,isBuffer:Rx,isRegExp:Mx,maybeMap:Lx,merge:Sx},Of=xx,Xo=Df,An=bl,Gx=Object.prototype.hasOwnProperty,Uf={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},Ui=Array.isArray,kx=Array.prototype.push,Bf=function(r,t){kx.apply(r,Ui(t)?t:[t])},Fx=Date.prototype.toISOString,Xf=An.default,le={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:Xo.encode,encodeValuesOnly:!1,format:Xf,formatter:An.formatters[Xf],indices:!1,serializeDate:function(t){return Fx.call(t)},skipNulls:!1,strictNullHandling:!1},Nx=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},_l={},Dx=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,_=!1;(x=x.get(_l))!==void 0&&!_;){var v=x.get(t);if(b+=1,typeof v<"u"){if(v===b)throw new RangeError("Cyclic object value");_=!0}typeof x.get(_l)>"u"&&(b=0)}if(typeof h=="function"?y=h(e,y):y instanceof Date?y=u(y):i==="comma"&&Ui(y)&&(y=Xo.maybeMap(y,function(O){return O instanceof Date?u(O):O})),y===null){if(n)return a&&!p?a(e,le.encoder,m,"key",d):e;y=""}if(Nx(y)||Xo.isBuffer(y)){if(a){var T=p?e:a(e,le.encoder,m,"key",d);return[f(T)+"="+f(a(y,le.encoder,m,"value",d))]}return[f(e)+"="+f(String(y))]}var C=[];if(typeof y>"u")return C;var E;if(i==="comma"&&Ui(y))p&&a&&(y=Xo.maybeMap(y,a)),E=[{value:y.length>0?y.join(",")||null:void 0}];else if(Ui(h))E=h;else{var I=Object.keys(y);E=l?I.sort(l):I}for(var k=s&&Ui(y)&&y.length===1?e+"[]":e,L=0;L<E.length;++L){var P=E[L],S=typeof P=="object"&&typeof P.value<"u"?P.value:y[P];if(!(o&&S===null)){var R=Ui(y)?typeof i=="function"?i(k,P):k:k+(c?"."+P:"["+P+"]");g.set(t,b);var F=Of();F.set(_l,g),Bf(C,r(S,R,i,s,n,o,i==="comma"&&p&&Ui(y)?null:a,h,l,c,u,d,f,p,m,F))}}return C},Ox=function(t){if(!t)return le;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||le.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=An.default;if(typeof t.format<"u"){if(!Gx.call(An.formatters,t.format))throw new TypeError("Unknown format option provided.");i=t.format}var s=An.formatters[i],n=le.filter;return(typeof t.filter=="function"||Ui(t.filter))&&(n=t.filter),{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:le.addQueryPrefix,allowDots:typeof t.allowDots>"u"?le.allowDots:!!t.allowDots,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:le.charsetSentinel,delimiter:typeof t.delimiter>"u"?le.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:le.encode,encoder:typeof t.encoder=="function"?t.encoder:le.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:le.encodeValuesOnly,filter:n,format:i,formatter:s,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:le.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:le.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:le.strictNullHandling}},Ux=function(r,t){var e=r,i=Ox(t),s,n;typeof i.filter=="function"?(n=i.filter,e=n("",e)):Ui(i.filter)&&(n=i.filter,s=n);var o=[];if(typeof e!="object"||e===null)return"";var a;t&&t.arrayFormat in Uf?a=t.arrayFormat:t&&"indices"in t?a=t.indices?"indices":"repeat":a="indices";var h=Uf[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=Of(),u=0;u<s.length;++u){var d=s[u];i.skipNulls&&e[d]===null||Bf(o,Dx(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:""},Ls=Df,vl=Object.prototype.hasOwnProperty,Bx=Array.isArray,te={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:Ls.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},Xx=function(r){return r.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},Wf=function(r,t){return r&&typeof r=="string"&&t.comma&&r.indexOf(",")>-1?r.split(","):r},Wx="utf8=%26%2310003%3B",Zx="utf8=%E2%9C%93",Vx=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]===Zx?l="utf-8":o[h]===Wx&&(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,te.decoder,l,"key"),p=e.strictNullHandling?null:""):(f=e.decoder(c.slice(0,d),te.decoder,l,"key"),p=Ls.maybeMap(Wf(c.slice(d+1),e),function(m){return e.decoder(m,te.decoder,l,"value")})),p&&e.interpretNumericEntities&&l==="iso-8859-1"&&(p=Xx(p)),c.indexOf("[]=")>-1&&(p=Bx(p)?[p]:p),vl.call(i,f)?i[f]=Ls.combine(i[f],p):i[f]=p}return i},Hx=function(r,t,e,i){for(var s=i?t:Wf(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},Kx=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&&vl.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&&vl.call(Object.prototype,h[1].slice(1,-1))&&!i.allowPrototypes)return;c.push(h[1])}return h&&c.push("["+n.slice(h.index)+"]"),Hx(c,e,i,s)}},Yx=function(t){if(!t)return te;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"?te.charset:t.charset;return{allowDots:typeof t.allowDots>"u"?te.allowDots:!!t.allowDots,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:te.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:te.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:te.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:te.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:te.comma,decoder:typeof t.decoder=="function"?t.decoder:te.decoder,delimiter:typeof t.delimiter=="string"||Ls.isRegExp(t.delimiter)?t.delimiter:te.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:te.depth,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:te.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:te.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:te.plainObjects,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:te.strictNullHandling}},zx=function(r,t){var e=Yx(t);if(r===""||r===null||typeof r>"u")return e.plainObjects?Object.create(null):{};for(var i=typeof r=="string"?Vx(r,e):r,s=e.plainObjects?Object.create(null):{},n=Object.keys(i),o=0;o<n.length;++o){var a=n[o],h=Kx(a,i[a],e,typeof r=="string");s=Ls.merge(s,h,e)}return e.allowSparse===!0?s:Ls.compact(s)},jx=Ux,Jx=zx,$x=bl,Qx={formats:$x,parse:Jx,stringify:jx},qx=nb;function Bi(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var t_=/^([a-z0-9.+-]+:)/i,e_=/:[0-9]*$/,i_=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,r_=["<",">",'"',"`"," ","\r",`
5
- `," "],s_=["{","}","|","\\","^","`"].concat(r_),wl=["'"].concat(s_),Zf=["%","/","?",";","#"].concat(wl),Vf=["/","?","#"],n_=255,Hf=/^[+a-z0-9A-Z_-]{0,63}$/,o_=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,a_={javascript:!0,"javascript:":!0},Tl={javascript:!0,"javascript:":!0},Gs={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Sl=Qx;function h_(r,t,e){if(r&&typeof r=="object"&&r instanceof Bi)return r;var i=new Bi;return i.parse(r,t,e),i}Bi.prototype.parse=function(r,t,e){if(typeof r!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof r);var i=r.indexOf("?"),s=i!==-1&&i<r.indexOf("#")?"?":"#",n=r.split(s),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=i_.exec(a);if(h)return this.path=a,this.href=a,this.pathname=h[1],h[2]?(this.search=h[2],t?this.query=Sl.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var l=t_.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&&Tl[l])&&(a=a.substr(2),this.slashes=!0)}if(!Tl[l]&&(u||l&&!Gs[l])){for(var d=-1,f=0;f<Vf.length;f++){var p=a.indexOf(Vf[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<Zf.length;f++){var p=a.indexOf(Zf[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 _=x[f];if(_&&!_.match(Hf)){for(var v="",T=0,C=_.length;T<C;T++)_.charCodeAt(T)>127?v+="x":v+=_[T];if(!v.match(Hf)){var E=x.slice(0,f),I=x.slice(f+1),k=_.match(o_);k&&(E.push(k[1]),I.unshift(k[2])),I.length&&(a="/"+I.join(".")+a),this.hostname=E.join(".");break}}}this.hostname.length>n_?this.hostname="":this.hostname=this.hostname.toLowerCase(),y||(this.hostname=qx.toASCII(this.hostname));var L=this.port?":"+this.port:"",P=this.hostname||"";this.host=P+L,this.href+=this.host,y&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!a_[c])for(var f=0,b=wl.length;f<b;f++){var S=wl[f];if(a.indexOf(S)!==-1){var R=encodeURIComponent(S);R===S&&(R=escape(S)),a=a.split(S).join(R)}}var F=a.indexOf("#");F!==-1&&(this.hash=a.substr(F),a=a.slice(0,F));var O=a.indexOf("?");if(O!==-1?(this.search=a.substr(O),this.query=a.substr(O+1),t&&(this.query=Sl.parse(this.query)),a=a.slice(0,O)):t&&(this.search="",this.query={}),a&&(this.pathname=a),Gs[c]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var L=this.pathname||"",B=this.search||"";this.path=L+B}return this.href=this.format(),this},Bi.prototype.format=function(){var r=this.auth||"";r&&(r=encodeURIComponent(r),r=r.replace(/%3A/i,":"),r+="@");var t=this.protocol||"",e=this.pathname||"",i=this.hash||"",s=!1,n="";this.host?s=r+this.host:this.hostname&&(s=r+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(s+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(n=Sl.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var o=this.search||n&&"?"+n||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||Gs[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},Bi.prototype.resolve=function(r){return this.resolveObject(h_(r,!1,!0)).format()},Bi.prototype.resolveObject=function(r){if(typeof r=="string"){var t=new Bi;t.parse(r,!1,!0),r=t}for(var e=new Bi,i=Object.keys(this),s=0;s<i.length;s++){var n=i[s];e[n]=this[n]}if(e.hash=r.hash,r.href==="")return e.href=e.format(),e;if(r.slashes&&!r.protocol){for(var o=Object.keys(r),a=0;a<o.length;a++){var h=o[a];h!=="protocol"&&(e[h]=r[h])}return Gs[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(!Gs[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&&!Tl[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("/")||[],_=e.protocol&&!Gs[e.protocol];if(_&&(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(_){e.host=x.shift(),e.hostname=e.host;var v=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;v&&(e.auth=v.shift(),e.hostname=v.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 T=x.slice(-1)[0],C=(e.host||r.host||x.length>1)&&(T==="."||T==="..")||T==="",E=0,I=x.length;I>=0;I--)T=x[I],T==="."?x.splice(I,1):T===".."?(x.splice(I,1),E++):E&&(x.splice(I,1),E--);if(!g&&!y)for(;E--;E)x.unshift("..");g&&x[0]!==""&&(!x[0]||x[0].charAt(0)!=="/")&&x.unshift(""),C&&x.join("/").substr(-1)!=="/"&&x.push("");var k=x[0]===""||x[0]&&x[0].charAt(0)==="/";if(_){e.hostname=k?"":x.length?x.shift():"",e.host=e.hostname;var v=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;v&&(e.auth=v.shift(),e.hostname=v.shift(),e.host=e.hostname)}return g=g||e.host&&x.length,g&&!k&&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},Bi.prototype.parseHost=function(){var r=this.host,t=e_.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 Kf={};function pt(r,t,e=3){if(Kf[t])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
4
+ `+t.prev}function Oo(r,t){var e=dl(r),i=[];if(e){i.length=r.length;for(var s=0;s<r.length;s++)i[s]=or(r,s)?t(r[s],r):""}var n=typeof ll=="function"?ll(r):[],o;if(Rs){o={};for(var a=0;a<n.length;a++)o["$"+n[a]]=n[a]}for(var h in r)or(r,h)&&(e&&String(Number(h))===h&&h<r.length||Rs&&o["$"+h]instanceof Symbol||(wf.call(/[^\w$]/,h)?i.push(t(h,r)+": "+t(r[h],r)):i.push(h+": "+t(r[h],r))));if(typeof ll=="function")for(var l=0;l<n.length;l++)Cf.call(r,n[l])&&i.push("["+t(n[l])+"]: "+t(r[n[l]],r));return i}var ml=il,Ps=Lb,hx=Zb,lx=ml("%TypeError%"),Bo=ml("%WeakMap%",!0),Uo=ml("%Map%",!0),cx=Ps("WeakMap.prototype.get",!0),ux=Ps("WeakMap.prototype.set",!0),dx=Ps("WeakMap.prototype.has",!0),fx=Ps("Map.prototype.get",!0),px=Ps("Map.prototype.set",!0),mx=Ps("Map.prototype.has",!0),gl=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},gx=function(r,t){var e=gl(r,t);return e&&e.value},yx=function(r,t,e){var i=gl(r,t);i?i.value=e:r.next={key:t,next:r.next,value:e}},bx=function(r,t){return!!gl(r,t)},xx=function(){var t,e,i,s={assert:function(n){if(!s.has(n))throw new lx("Side channel does not contain "+hx(n))},get:function(n){if(Bo&&n&&(typeof n=="object"||typeof n=="function")){if(t)return cx(t,n)}else if(Uo){if(e)return fx(e,n)}else if(i)return gx(i,n)},has:function(n){if(Bo&&n&&(typeof n=="object"||typeof n=="function")){if(t)return dx(t,n)}else if(Uo){if(e)return mx(e,n)}else if(i)return bx(i,n);return!1},set:function(n,o){Bo&&n&&(typeof n=="object"||typeof n=="function")?(t||(t=new Bo),ux(t,n,o)):Uo?(e||(e=new Uo),px(e,n,o)):(i||(i={key:{},next:null}),yx(i,n,o))}};return s},_x=String.prototype.replace,vx=/%20/g,yl={RFC1738:"RFC1738",RFC3986:"RFC3986"},bl={default:yl.RFC3986,formatters:{RFC1738:function(r){return _x.call(r,vx,"+")},RFC3986:function(r){return String(r)}},RFC1738:yl.RFC1738,RFC3986:yl.RFC3986},wx=bl,xl=Object.prototype.hasOwnProperty,Or=Array.isArray,gi=function(){for(var r=[],t=0;t<256;++t)r.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return r}(),Tx=function(t){for(;t.length>1;){var e=t.pop(),i=e.obj[e.prop];if(Or(i)){for(var s=[],n=0;n<i.length;++n)typeof i[n]<"u"&&s.push(i[n]);e.obj[e.prop]=s}}},Nf=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},Sx=function r(t,e,i){if(!e)return t;if(typeof e!="object"){if(Or(t))t.push(e);else if(t&&typeof t=="object")(i&&(i.plainObjects||i.allowPrototypes)||!xl.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 Or(t)&&!Or(e)&&(s=Nf(t,i)),Or(t)&&Or(e)?(e.forEach(function(n,o){if(xl.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 xl.call(n,o)?n[o]=r(n[o],a,i):n[o]=a,n},s)},Cx=function(t,e){return Object.keys(e).reduce(function(i,s){return i[s]=e[s],i},t)},Ex=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}},Ix=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===wx.RFC1738&&(l===40||l===41)){a+=o.charAt(h);continue}if(l<128){a=a+gi[l];continue}if(l<2048){a=a+(gi[192|l>>6]+gi[128|l&63]);continue}if(l<55296||l>=57344){a=a+(gi[224|l>>12]+gi[128|l>>6&63]+gi[128|l&63]);continue}h+=1,l=65536+((l&1023)<<10|o.charCodeAt(h)&1023),a+=gi[240|l>>18]+gi[128|l>>12&63]+gi[128|l>>6&63]+gi[128|l&63]}return a},Ax=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 Tx(e),t},Mx=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},Rx=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},Px=function(t,e){return[].concat(t,e)},Lx=function(t,e){if(Or(t)){for(var i=[],s=0;s<t.length;s+=1)i.push(e(t[s]));return i}return e(t)},Df={arrayToObject:Nf,assign:Cx,combine:Px,compact:Ax,decode:Ex,encode:Ix,isBuffer:Rx,isRegExp:Mx,maybeMap:Lx,merge:Sx},Of=xx,Xo=Df,An=bl,Gx=Object.prototype.hasOwnProperty,Bf={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},Bi=Array.isArray,kx=Array.prototype.push,Uf=function(r,t){kx.apply(r,Bi(t)?t:[t])},Fx=Date.prototype.toISOString,Xf=An.default,le={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:Xo.encode,encodeValuesOnly:!1,format:Xf,formatter:An.formatters[Xf],indices:!1,serializeDate:function(t){return Fx.call(t)},skipNulls:!1,strictNullHandling:!1},Nx=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},_l={},Dx=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,_=!1;(x=x.get(_l))!==void 0&&!_;){var v=x.get(t);if(b+=1,typeof v<"u"){if(v===b)throw new RangeError("Cyclic object value");_=!0}typeof x.get(_l)>"u"&&(b=0)}if(typeof h=="function"?y=h(e,y):y instanceof Date?y=u(y):i==="comma"&&Bi(y)&&(y=Xo.maybeMap(y,function(O){return O instanceof Date?u(O):O})),y===null){if(n)return a&&!p?a(e,le.encoder,m,"key",d):e;y=""}if(Nx(y)||Xo.isBuffer(y)){if(a){var T=p?e:a(e,le.encoder,m,"key",d);return[f(T)+"="+f(a(y,le.encoder,m,"value",d))]}return[f(e)+"="+f(String(y))]}var C=[];if(typeof y>"u")return C;var E;if(i==="comma"&&Bi(y))p&&a&&(y=Xo.maybeMap(y,a)),E=[{value:y.length>0?y.join(",")||null:void 0}];else if(Bi(h))E=h;else{var I=Object.keys(y);E=l?I.sort(l):I}for(var k=s&&Bi(y)&&y.length===1?e+"[]":e,L=0;L<E.length;++L){var P=E[L],S=typeof P=="object"&&typeof P.value<"u"?P.value:y[P];if(!(o&&S===null)){var R=Bi(y)?typeof i=="function"?i(k,P):k:k+(c?"."+P:"["+P+"]");g.set(t,b);var F=Of();F.set(_l,g),Uf(C,r(S,R,i,s,n,o,i==="comma"&&p&&Bi(y)?null:a,h,l,c,u,d,f,p,m,F))}}return C},Ox=function(t){if(!t)return le;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||le.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=An.default;if(typeof t.format<"u"){if(!Gx.call(An.formatters,t.format))throw new TypeError("Unknown format option provided.");i=t.format}var s=An.formatters[i],n=le.filter;return(typeof t.filter=="function"||Bi(t.filter))&&(n=t.filter),{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:le.addQueryPrefix,allowDots:typeof t.allowDots>"u"?le.allowDots:!!t.allowDots,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:le.charsetSentinel,delimiter:typeof t.delimiter>"u"?le.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:le.encode,encoder:typeof t.encoder=="function"?t.encoder:le.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:le.encodeValuesOnly,filter:n,format:i,formatter:s,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:le.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:le.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:le.strictNullHandling}},Bx=function(r,t){var e=r,i=Ox(t),s,n;typeof i.filter=="function"?(n=i.filter,e=n("",e)):Bi(i.filter)&&(n=i.filter,s=n);var o=[];if(typeof e!="object"||e===null)return"";var a;t&&t.arrayFormat in Bf?a=t.arrayFormat:t&&"indices"in t?a=t.indices?"indices":"repeat":a="indices";var h=Bf[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=Of(),u=0;u<s.length;++u){var d=s[u];i.skipNulls&&e[d]===null||Uf(o,Dx(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:""},Ls=Df,vl=Object.prototype.hasOwnProperty,Ux=Array.isArray,te={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:Ls.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},Xx=function(r){return r.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},Wf=function(r,t){return r&&typeof r=="string"&&t.comma&&r.indexOf(",")>-1?r.split(","):r},Wx="utf8=%26%2310003%3B",Zx="utf8=%E2%9C%93",Vx=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]===Zx?l="utf-8":o[h]===Wx&&(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,te.decoder,l,"key"),p=e.strictNullHandling?null:""):(f=e.decoder(c.slice(0,d),te.decoder,l,"key"),p=Ls.maybeMap(Wf(c.slice(d+1),e),function(m){return e.decoder(m,te.decoder,l,"value")})),p&&e.interpretNumericEntities&&l==="iso-8859-1"&&(p=Xx(p)),c.indexOf("[]=")>-1&&(p=Ux(p)?[p]:p),vl.call(i,f)?i[f]=Ls.combine(i[f],p):i[f]=p}return i},Hx=function(r,t,e,i){for(var s=i?t:Wf(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},Kx=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&&vl.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&&vl.call(Object.prototype,h[1].slice(1,-1))&&!i.allowPrototypes)return;c.push(h[1])}return h&&c.push("["+n.slice(h.index)+"]"),Hx(c,e,i,s)}},Yx=function(t){if(!t)return te;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"?te.charset:t.charset;return{allowDots:typeof t.allowDots>"u"?te.allowDots:!!t.allowDots,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:te.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:te.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:te.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:te.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:te.comma,decoder:typeof t.decoder=="function"?t.decoder:te.decoder,delimiter:typeof t.delimiter=="string"||Ls.isRegExp(t.delimiter)?t.delimiter:te.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:te.depth,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:te.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:te.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:te.plainObjects,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:te.strictNullHandling}},zx=function(r,t){var e=Yx(t);if(r===""||r===null||typeof r>"u")return e.plainObjects?Object.create(null):{};for(var i=typeof r=="string"?Vx(r,e):r,s=e.plainObjects?Object.create(null):{},n=Object.keys(i),o=0;o<n.length;++o){var a=n[o],h=Kx(a,i[a],e,typeof r=="string");s=Ls.merge(s,h,e)}return e.allowSparse===!0?s:Ls.compact(s)},jx=Bx,Jx=zx,$x=bl,Qx={formats:$x,parse:Jx,stringify:jx},qx=nb;function Ui(){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 t_=/^([a-z0-9.+-]+:)/i,e_=/:[0-9]*$/,i_=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,r_=["<",">",'"',"`"," ","\r",`
5
+ `," "],s_=["{","}","|","\\","^","`"].concat(r_),wl=["'"].concat(s_),Zf=["%","/","?",";","#"].concat(wl),Vf=["/","?","#"],n_=255,Hf=/^[+a-z0-9A-Z_-]{0,63}$/,o_=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,a_={javascript:!0,"javascript:":!0},Tl={javascript:!0,"javascript:":!0},Gs={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Sl=Qx;function h_(r,t,e){if(r&&typeof r=="object"&&r instanceof Ui)return r;var i=new Ui;return i.parse(r,t,e),i}Ui.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=i_.exec(a);if(h)return this.path=a,this.href=a,this.pathname=h[1],h[2]?(this.search=h[2],t?this.query=Sl.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var l=t_.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&&Tl[l])&&(a=a.substr(2),this.slashes=!0)}if(!Tl[l]&&(u||l&&!Gs[l])){for(var d=-1,f=0;f<Vf.length;f++){var p=a.indexOf(Vf[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<Zf.length;f++){var p=a.indexOf(Zf[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 _=x[f];if(_&&!_.match(Hf)){for(var v="",T=0,C=_.length;T<C;T++)_.charCodeAt(T)>127?v+="x":v+=_[T];if(!v.match(Hf)){var E=x.slice(0,f),I=x.slice(f+1),k=_.match(o_);k&&(E.push(k[1]),I.unshift(k[2])),I.length&&(a="/"+I.join(".")+a),this.hostname=E.join(".");break}}}this.hostname.length>n_?this.hostname="":this.hostname=this.hostname.toLowerCase(),y||(this.hostname=qx.toASCII(this.hostname));var L=this.port?":"+this.port:"",P=this.hostname||"";this.host=P+L,this.href+=this.host,y&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!a_[c])for(var f=0,b=wl.length;f<b;f++){var S=wl[f];if(a.indexOf(S)!==-1){var R=encodeURIComponent(S);R===S&&(R=escape(S)),a=a.split(S).join(R)}}var F=a.indexOf("#");F!==-1&&(this.hash=a.substr(F),a=a.slice(0,F));var O=a.indexOf("?");if(O!==-1?(this.search=a.substr(O),this.query=a.substr(O+1),t&&(this.query=Sl.parse(this.query)),a=a.slice(0,O)):t&&(this.search="",this.query={}),a&&(this.pathname=a),Gs[c]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var L=this.pathname||"",U=this.search||"";this.path=L+U}return this.href=this.format(),this},Ui.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=Sl.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var o=this.search||n&&"?"+n||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||Gs[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},Ui.prototype.resolve=function(r){return this.resolveObject(h_(r,!1,!0)).format()},Ui.prototype.resolveObject=function(r){if(typeof r=="string"){var t=new Ui;t.parse(r,!1,!0),r=t}for(var e=new Ui,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 Gs[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(!Gs[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&&!Tl[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("/")||[],_=e.protocol&&!Gs[e.protocol];if(_&&(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(_){e.host=x.shift(),e.hostname=e.host;var v=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;v&&(e.auth=v.shift(),e.hostname=v.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 T=x.slice(-1)[0],C=(e.host||r.host||x.length>1)&&(T==="."||T==="..")||T==="",E=0,I=x.length;I>=0;I--)T=x[I],T==="."?x.splice(I,1):T===".."?(x.splice(I,1),E++):E&&(x.splice(I,1),E--);if(!g&&!y)for(;E--;E)x.unshift("..");g&&x[0]!==""&&(!x[0]||x[0].charAt(0)!=="/")&&x.unshift(""),C&&x.join("/").substr(-1)!=="/"&&x.push("");var k=x[0]===""||x[0]&&x[0].charAt(0)==="/";if(_){e.hostname=k?"":x.length?x.shift():"",e.host=e.hostname;var v=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;v&&(e.auth=v.shift(),e.hostname=v.shift(),e.host=e.hostname)}return g=g||e.host&&x.length,g&&!k&&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},Ui.prototype.parseHost=function(){var r=this.host,t=e_.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 Kf={};function pt(r,t,e=3){if(Kf[t])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
6
6
  Deprecated since v${r}`):(i=i.split(`
7
7
  `).splice(e).join(`
8
8
  `),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t}
9
9
  Deprecated since v${r}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
10
- Deprecated since v${r}`),console.warn(i))),Kf[t]=!0}function Qe(r){if(typeof r!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(r)}`)}function Mn(r){return r.split("?")[0].split("#")[0]}function l_(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function c_(r,t,e){return r.replace(new RegExp(l_(t),"g"),e)}function u_(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}}}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 Jt={toPosix(r){return c_(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){Qe(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(Qe(r),this.isDataUrl(r)||this.isBlobUrl(r))return r;const i=Mn(this.toPosix(t??Q.ADAPTER.getBaseUrl())),s=Mn(this.toPosix(e??this.rootname(i)));return r=this.toPosix(r),r.startsWith("/")?Jt.join(s,r.slice(1)):this.isAbsolute(r)?r:this.join(i,r)},normalize(r){if(Qe(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=u_(r),r.length>0&&i&&(r+="/"),e?`/${r}`:t+r},isAbsolute(r){return Qe(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(Qe(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(Qe(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){Qe(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){Qe(r),t&&Qe(t),r=Mn(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){Qe(r),r=Mn(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){Qe(r);const t={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return t;r=Mn(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 Cl;async function d_(){return Cl??(Cl=(async()=>{var n;const r=document.createElement("canvas").getContext("webgl");if(!r)return ye.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 ye.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]?ye.PMA:ye.UNPACK})()),Cl}let El;function f_(){return typeof El>"u"&&(El=function(){var t;const r={stencil:!0,failIfMajorPerformanceCaveat:Q.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!Q.ADAPTER.getWebGLRenderingContext())return!1;const e=Q.ADAPTER.createCanvas();let i=e.getContext("webgl",r)||e.getContext("experimental-webgl",r);const s=!!((t=i==null?void 0:i.getContextAttributes())!=null&&t.stencil);if(i){const n=i.getExtension("WEBGL_lose_context");n&&n.loseContext()}return i=null,s}catch{return!1}}()),El}var p_={grad:.9,turn:360,rad:360/(2*Math.PI)},Xi=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},ee=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*r)/e+0},Ue=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),r>e?e:r>t?r:t},Yf=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},zf=function(r){return{r:Ue(r.r,0,255),g:Ue(r.g,0,255),b:Ue(r.b,0,255),a:Ue(r.a)}},Il=function(r){return{r:ee(r.r),g:ee(r.g),b:ee(r.b),a:ee(r.a,3)}},m_=/^#([0-9a-f]{3,8})$/i,Wo=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},jf=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}},Jf=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}},$f=function(r){return{h:Yf(r.h),s:Ue(r.s,0,100),l:Ue(r.l,0,100),a:Ue(r.a)}},Qf=function(r){return{h:ee(r.h),s:ee(r.s),l:ee(r.l),a:ee(r.a,3)}},qf=function(r){return Jf((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},Rn=function(r){return{h:(t=jf(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},g_=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,y_=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,b_=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,x_=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Al={string:[[function(r){var t=m_.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?ee(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?ee(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=b_.exec(r)||x_.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:zf({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(r){var t=g_.exec(r)||y_.exec(r);if(!t)return null;var e,i,s=$f({h:(e=t[1],i=t[2],i===void 0&&(i="deg"),Number(e)*(p_[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return qf(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 Xi(t)&&Xi(e)&&Xi(i)?zf({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(!Xi(t)||!Xi(e)||!Xi(i))return null;var o=$f({h:Number(t),s:Number(e),l:Number(i),a:Number(n)});return qf(o)},"hsl"],[function(r){var t=r.h,e=r.s,i=r.v,s=r.a,n=s===void 0?1:s;if(!Xi(t)||!Xi(e)||!Xi(i))return null;var o=function(a){return{h:Yf(a.h),s:Ue(a.s,0,100),v:Ue(a.v,0,100),a:Ue(a.a)}}({h:Number(t),s:Number(e),v:Number(i),a:Number(n)});return Jf(o)},"hsv"]]},tp=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]},__=function(r){return typeof r=="string"?tp(r.trim(),Al.string):typeof r=="object"&&r!==null?tp(r,Al.object):[null,void 0]},Ml=function(r,t){var e=Rn(r);return{h:e.h,s:Ue(e.s+100*t,0,100),l:e.l,a:e.a}},Rl=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},ep=function(r,t){var e=Rn(r);return{h:e.h,s:e.s,l:Ue(e.l+100*t,0,100),a:e.a}},Pl=function(){function r(t){this.parsed=__(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 ee(Rl(this.rgba),2)},r.prototype.isDark=function(){return Rl(this.rgba)<.5},r.prototype.isLight=function(){return Rl(this.rgba)>=.5},r.prototype.toHex=function(){return t=Il(this.rgba),e=t.r,i=t.g,s=t.b,o=(n=t.a)<1?Wo(ee(255*n)):"","#"+Wo(e)+Wo(i)+Wo(s)+o;var t,e,i,s,n,o},r.prototype.toRgb=function(){return Il(this.rgba)},r.prototype.toRgbString=function(){return t=Il(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 Qf(Rn(this.rgba))},r.prototype.toHslString=function(){return t=Qf(Rn(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=jf(this.rgba),{h:ee(t.h),s:ee(t.s),v:ee(t.v),a:ee(t.a,3)};var t},r.prototype.invert=function(){return yi({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),yi(Ml(this.rgba,t))},r.prototype.desaturate=function(t){return t===void 0&&(t=.1),yi(Ml(this.rgba,-t))},r.prototype.grayscale=function(){return yi(Ml(this.rgba,-1))},r.prototype.lighten=function(t){return t===void 0&&(t=.1),yi(ep(this.rgba,t))},r.prototype.darken=function(t){return t===void 0&&(t=.1),yi(ep(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"?yi({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):ee(this.rgba.a,3);var e},r.prototype.hue=function(t){var e=Rn(this.rgba);return typeof t=="number"?yi({h:t,s:e.s,l:e.l,a:e.a}):ee(e.h)},r.prototype.isEqual=function(t){return this.toHex()===yi(t).toHex()},r}(),yi=function(r){return r instanceof Pl?r:new Pl(r)},ip=[],v_=function(r){r.forEach(function(t){ip.indexOf(t)<0&&(t(Pl,Al),ip.push(t))})};function w_(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"])}v_([w_]);const ks=class Ih{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 Ih)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]=Ih.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=Ih.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}const o=yi(t);o.isValid()&&({r:e,g:i,b:s,a:n}=o.rgba,e/=255,i/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,this._components[2]=s,this._components[3]=n,this.refreshInt();else throw new Error(`Unable to convert color ${t}`)}refreshInt(){this._clamp(this._components);const[t,e,i]=this._components;this._int=(t*255<<16)+(e*255<<8)+(i*255|0)}_clamp(t,e=0,i=1){return typeof t=="number"?Math.min(Math.max(t,e),i):(t.forEach((s,n)=>{t[n]=Math.min(Math.max(s,e),i)}),t)}};ks.shared=new ks,ks.temp=new ks,ks.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let Et=ks;function T_(r){return pt("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),Et.shared.setValue(r).toHex()}function S_(r){return pt("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),Et.shared.setValue(r).toNumber()}function C_(){const r=[],t=[];for(let i=0;i<32;i++)r[i]=i,t[i]=i;r[lt.NORMAL_NPM]=lt.NORMAL,r[lt.ADD_NPM]=lt.ADD,r[lt.SCREEN_NPM]=lt.SCREEN,t[lt.NORMAL]=lt.NORMAL_NPM,t[lt.ADD]=lt.ADD_NPM,t[lt.SCREEN]=lt.SCREEN_NPM;const e=[];return e.push(t),e.push(r),e}const rp=C_();function sp(r,t){return rp[t?1:0][r]}function E_(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 np(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 Zo(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 op(r){return!(r&r-1)&&!!r}function ap(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 Fs(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 hr(r){return r===0?0:r<0?-1:1}let I_=0;function Ur(){return++I_}const Ll=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}};Ll.EMPTY=new Ll(0,0,0,0);let hp=Ll;const lp={},bi=Object.create(null),lr=Object.create(null);class A_{constructor(t,e,i){this._canvas=Q.ADAPTER.createCanvas(),this._context=this._canvas.getContext("2d"),this.resolution=i||Q.RESOLUTION,this.resize(t,e)}clear(){this._checkDestroyed(),this._context.setTransform(1,0,0,1,0,0),this._context.clearRect(0,0,this._canvas.width,this._canvas.height)}resize(t,e){this._checkDestroyed(),this._canvas.width=Math.round(t*this.resolution),this._canvas.height=Math.round(e*this.resolution)}destroy(){this._context=null,this._canvas=null}get width(){return this._checkDestroyed(),this._canvas.width}set width(t){this._checkDestroyed(),this._canvas.width=Math.round(t)}get height(){return this._checkDestroyed(),this._canvas.height}set height(t){this._checkDestroyed(),this._canvas.height=Math.round(t)}get canvas(){return this._checkDestroyed(),this._canvas}get context(){return this._checkDestroyed(),this._context}_checkDestroyed(){if(this._canvas===null)throw new TypeError("The CanvasRenderTarget has already been destroyed")}}function cp(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 up(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 M_(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&&cp(s,t,o);)++o;if(o===e)return hp.EMPTY;for(;cp(s,t,h);)--h;for(;up(s,t,n,o,h);)++n;for(;up(s,t,a,o,h);)--a;return++a,++h,new hp(n,o,a,h)}function R_(r){const t=M_(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 P_(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 Wi(r,t=1){var i;const e=(i=Q.RETINA_PREFIX)==null?void 0:i.exec(r);return e?parseFloat(e[1]):t}var z=(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))(z||{});const Gl=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},dp=(r,t)=>Gl(r).priority??t,it={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(Gl).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(Gl).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)=>dp(n,e)-dp(s,e)))},i=>{const s=t.indexOf(i.ref);s!==-1&&t.splice(s,1)})}};class kl{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 L_=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
10
+ Deprecated since v${r}`),console.warn(i))),Kf[t]=!0}function Qe(r){if(typeof r!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(r)}`)}function Mn(r){return r.split("?")[0].split("#")[0]}function l_(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function c_(r,t,e){return r.replace(new RegExp(l_(t),"g"),e)}function u_(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}}}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 Jt={toPosix(r){return c_(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){Qe(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(Qe(r),this.isDataUrl(r)||this.isBlobUrl(r))return r;const i=Mn(this.toPosix(t??$.ADAPTER.getBaseUrl())),s=Mn(this.toPosix(e??this.rootname(i)));return r=this.toPosix(r),r.startsWith("/")?Jt.join(s,r.slice(1)):this.isAbsolute(r)?r:this.join(i,r)},normalize(r){if(Qe(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=u_(r),r.length>0&&i&&(r+="/"),e?`/${r}`:t+r},isAbsolute(r){return Qe(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(Qe(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(Qe(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){Qe(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){Qe(r),t&&Qe(t),r=Mn(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){Qe(r),r=Mn(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){Qe(r);const t={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return t;r=Mn(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 Cl;async function d_(){return Cl??(Cl=(async()=>{var n;const r=document.createElement("canvas").getContext("webgl");if(!r)return ye.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 ye.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]?ye.PMA:ye.UNPACK})()),Cl}let El;function f_(){return typeof El>"u"&&(El=function(){var t;const r={stencil:!0,failIfMajorPerformanceCaveat:$.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!$.ADAPTER.getWebGLRenderingContext())return!1;const e=$.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}}()),El}var p_={grad:.9,turn:360,rad:360/(2*Math.PI)},Xi=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},ee=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*r)/e+0},Be=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),r>e?e:r>t?r:t},Yf=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},zf=function(r){return{r:Be(r.r,0,255),g:Be(r.g,0,255),b:Be(r.b,0,255),a:Be(r.a)}},Il=function(r){return{r:ee(r.r),g:ee(r.g),b:ee(r.b),a:ee(r.a,3)}},m_=/^#([0-9a-f]{3,8})$/i,Wo=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},jf=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}},Jf=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}},$f=function(r){return{h:Yf(r.h),s:Be(r.s,0,100),l:Be(r.l,0,100),a:Be(r.a)}},Qf=function(r){return{h:ee(r.h),s:ee(r.s),l:ee(r.l),a:ee(r.a,3)}},qf=function(r){return Jf((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},Rn=function(r){return{h:(t=jf(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},g_=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,y_=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,b_=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,x_=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Al={string:[[function(r){var t=m_.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?ee(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?ee(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=b_.exec(r)||x_.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:zf({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(r){var t=g_.exec(r)||y_.exec(r);if(!t)return null;var e,i,s=$f({h:(e=t[1],i=t[2],i===void 0&&(i="deg"),Number(e)*(p_[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return qf(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 Xi(t)&&Xi(e)&&Xi(i)?zf({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(!Xi(t)||!Xi(e)||!Xi(i))return null;var o=$f({h:Number(t),s:Number(e),l:Number(i),a:Number(n)});return qf(o)},"hsl"],[function(r){var t=r.h,e=r.s,i=r.v,s=r.a,n=s===void 0?1:s;if(!Xi(t)||!Xi(e)||!Xi(i))return null;var o=function(a){return{h:Yf(a.h),s:Be(a.s,0,100),v:Be(a.v,0,100),a:Be(a.a)}}({h:Number(t),s:Number(e),v:Number(i),a:Number(n)});return Jf(o)},"hsv"]]},tp=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]},__=function(r){return typeof r=="string"?tp(r.trim(),Al.string):typeof r=="object"&&r!==null?tp(r,Al.object):[null,void 0]},Ml=function(r,t){var e=Rn(r);return{h:e.h,s:Be(e.s+100*t,0,100),l:e.l,a:e.a}},Rl=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},ep=function(r,t){var e=Rn(r);return{h:e.h,s:e.s,l:Be(e.l+100*t,0,100),a:e.a}},Pl=function(){function r(t){this.parsed=__(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 ee(Rl(this.rgba),2)},r.prototype.isDark=function(){return Rl(this.rgba)<.5},r.prototype.isLight=function(){return Rl(this.rgba)>=.5},r.prototype.toHex=function(){return t=Il(this.rgba),e=t.r,i=t.g,s=t.b,o=(n=t.a)<1?Wo(ee(255*n)):"","#"+Wo(e)+Wo(i)+Wo(s)+o;var t,e,i,s,n,o},r.prototype.toRgb=function(){return Il(this.rgba)},r.prototype.toRgbString=function(){return t=Il(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 Qf(Rn(this.rgba))},r.prototype.toHslString=function(){return t=Qf(Rn(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=jf(this.rgba),{h:ee(t.h),s:ee(t.s),v:ee(t.v),a:ee(t.a,3)};var t},r.prototype.invert=function(){return yi({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),yi(Ml(this.rgba,t))},r.prototype.desaturate=function(t){return t===void 0&&(t=.1),yi(Ml(this.rgba,-t))},r.prototype.grayscale=function(){return yi(Ml(this.rgba,-1))},r.prototype.lighten=function(t){return t===void 0&&(t=.1),yi(ep(this.rgba,t))},r.prototype.darken=function(t){return t===void 0&&(t=.1),yi(ep(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"?yi({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):ee(this.rgba.a,3);var e},r.prototype.hue=function(t){var e=Rn(this.rgba);return typeof t=="number"?yi({h:t,s:e.s,l:e.l,a:e.a}):ee(e.h)},r.prototype.isEqual=function(t){return this.toHex()===yi(t).toHex()},r}(),yi=function(r){return r instanceof Pl?r:new Pl(r)},ip=[],v_=function(r){r.forEach(function(t){ip.indexOf(t)<0&&(t(Pl,Al),ip.push(t))})};function w_(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"])}v_([w_]);const ks=class Ih{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 Ih)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]=Ih.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=Ih.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}const o=yi(t);o.isValid()&&({r:e,g:i,b:s,a:n}=o.rgba,e/=255,i/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,this._components[2]=s,this._components[3]=n,this.refreshInt();else throw new Error(`Unable to convert color ${t}`)}refreshInt(){this._clamp(this._components);const[t,e,i]=this._components;this._int=(t*255<<16)+(e*255<<8)+(i*255|0)}_clamp(t,e=0,i=1){return typeof t=="number"?Math.min(Math.max(t,e),i):(t.forEach((s,n)=>{t[n]=Math.min(Math.max(s,e),i)}),t)}};ks.shared=new ks,ks.temp=new ks,ks.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let Et=ks;function T_(r){return pt("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),Et.shared.setValue(r).toHex()}function S_(r){return pt("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),Et.shared.setValue(r).toNumber()}function C_(){const r=[],t=[];for(let i=0;i<32;i++)r[i]=i,t[i]=i;r[lt.NORMAL_NPM]=lt.NORMAL,r[lt.ADD_NPM]=lt.ADD,r[lt.SCREEN_NPM]=lt.SCREEN,t[lt.NORMAL]=lt.NORMAL_NPM,t[lt.ADD]=lt.ADD_NPM,t[lt.SCREEN]=lt.SCREEN_NPM;const e=[];return e.push(t),e.push(r),e}const rp=C_();function sp(r,t){return rp[t?1:0][r]}function E_(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 np(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 Zo(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 op(r){return!(r&r-1)&&!!r}function ap(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 Fs(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 hr(r){return r===0?0:r<0?-1:1}let I_=0;function Br(){return++I_}const Ll=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}};Ll.EMPTY=new Ll(0,0,0,0);let hp=Ll;const lp={},bi=Object.create(null),lr=Object.create(null);class A_{constructor(t,e,i){this._canvas=$.ADAPTER.createCanvas(),this._context=this._canvas.getContext("2d"),this.resolution=i||$.RESOLUTION,this.resize(t,e)}clear(){this._checkDestroyed(),this._context.setTransform(1,0,0,1,0,0),this._context.clearRect(0,0,this._canvas.width,this._canvas.height)}resize(t,e){this._checkDestroyed(),this._canvas.width=Math.round(t*this.resolution),this._canvas.height=Math.round(e*this.resolution)}destroy(){this._context=null,this._canvas=null}get width(){return this._checkDestroyed(),this._canvas.width}set width(t){this._checkDestroyed(),this._canvas.width=Math.round(t)}get height(){return this._checkDestroyed(),this._canvas.height}set height(t){this._checkDestroyed(),this._canvas.height=Math.round(t)}get canvas(){return this._checkDestroyed(),this._canvas}get context(){return this._checkDestroyed(),this._context}_checkDestroyed(){if(this._canvas===null)throw new TypeError("The CanvasRenderTarget has already been destroyed")}}function cp(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 up(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 M_(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&&cp(s,t,o);)++o;if(o===e)return hp.EMPTY;for(;cp(s,t,h);)--h;for(;up(s,t,n,o,h);)++n;for(;up(s,t,a,o,h);)--a;return++a,++h,new hp(n,o,a,h)}function R_(r){const t=M_(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 P_(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 Wi(r,t=1){var i;const e=(i=$.RETINA_PREFIX)==null?void 0:i.exec(r);return e?parseFloat(e[1]):t}var z=(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))(z||{});const Gl=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},dp=(r,t)=>Gl(r).priority??t,it={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(Gl).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(Gl).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)=>dp(n,e)-dp(s,e)))},i=>{const s=t.indexOf(i.ref);s!==-1&&t.splice(s,1)})}};class kl{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 L_=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
11
11
  `);function G_(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 k_(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=L_.replace(/%forloop%/gi,G_(r));if(t.shaderSource(e,i),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))r=r/2|0;else break}return r}const Fl=0,Nl=1,Dl=2,Ol=3,Ul=4,Bl=5;class xi{constructor(){this.data=0,this.blendMode=lt.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Fl)}set blend(t){!!(this.data&1<<Fl)!==t&&(this.data^=1<<Fl)}get offsets(){return!!(this.data&1<<Nl)}set offsets(t){!!(this.data&1<<Nl)!==t&&(this.data^=1<<Nl)}get culling(){return!!(this.data&1<<Dl)}set culling(t){!!(this.data&1<<Dl)!==t&&(this.data^=1<<Dl)}get depthTest(){return!!(this.data&1<<Ol)}set depthTest(t){!!(this.data&1<<Ol)!==t&&(this.data^=1<<Ol)}get depthMask(){return!!(this.data&1<<Bl)}set depthMask(t){!!(this.data&1<<Bl)!==t&&(this.data^=1<<Bl)}get clockwiseFrontFace(){return!!(this.data&1<<Ul)}set clockwiseFrontFace(t){!!(this.data&1<<Ul)!==t&&(this.data^=1<<Ul)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==lt.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){const t=new xi;return t.depthTest=!1,t.blend=!0,t}}xi.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};const Xl=[];function fp(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=Xl.length-1;i>=0;--i){const s=Xl[i];if(s.test&&s.test(r,e))return new s(r,t)}throw new Error("Unrecognized source type to auto-detect Resource")}class qe{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(qe.prototype,{dispatch:{value:qe.prototype.emit},run:{value:qe.prototype.emit}});class Pn{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new qe("setRealSize"),this.onUpdate=new qe("update"),this.onError=new qe("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 Vo extends Pn{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===ye.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 F_={scaleMode:Ni.NEAREST,alphaMode:ye.NPM},Wl=class pn extends _n{constructor(t=null,e=null){super(),e=Object.assign({},pn.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 Pn)&&(t=fp(t,p),t.internal=!0),this.resolution=f||Q.RESOLUTION,this.width=Math.round((a||0)*this.resolution)/this.resolution,this.height=Math.round((h||0)*this.resolution)/this.resolution,this._mipmap=s,this.anisotropicLevel=n,this._wrapMode=l,this._scaleMode=o,this.format=c,this.type=u,this.target=d,this.alphaMode=i,this.uid=Ur(),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=op(this.realWidth)&&op(this.realHeight)}setResolution(t){const e=this.resolution;return e===t?this:(this.resolution=t,this.valid&&(this.width=Math.round(this.width*e)/t,this.height=Math.round(this.height*e)/t,this.emit("update",this)),this._refreshPOT(),this)}setResource(t){if(this.resource===t)return this;if(this.resource)throw new Error("Resource can be set only once");return t.bind(this),this.resource=t,this}update(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))}onError(t){this.emit("error",this,t)}destroy(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete lr[this.cacheId],delete bi[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),pn.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(t,e,i=Q.STRICT_TEXTURE_CACHE){const s=typeof t=="string";let n=null;if(s)n=t;else{if(!t._pixiId){const a=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${a}_${Ur()}`}n=t._pixiId}let o=lr[n];if(s&&i&&!o)throw new Error(`The cacheId "${n}" does not exist in BaseTextureCache.`);return o||(o=new pn(t,e),o.cacheId=n,pn.addToCache(o,n)),o}static fromBuffer(t,e,i,s){t=t||new Float32Array(e*i*4);const n=new Vo(t,{width:e,height:i,...s==null?void 0:s.resourceOptions});let o,a;return t instanceof Float32Array?(o=W.RGBA,a=ot.FLOAT):t instanceof Int32Array?(o=W.RGBA_INTEGER,a=ot.INT):t instanceof Uint32Array?(o=W.RGBA_INTEGER,a=ot.UNSIGNED_INT):t instanceof Int16Array?(o=W.RGBA_INTEGER,a=ot.SHORT):t instanceof Uint16Array?(o=W.RGBA_INTEGER,a=ot.UNSIGNED_SHORT):t instanceof Int8Array?(o=W.RGBA,a=ot.BYTE):(o=W.RGBA,a=ot.UNSIGNED_BYTE),n.internal=!0,new pn(n,Object.assign({},F_,{type:a,format:o},s))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),lr[e]&&lr[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),lr[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=lr[t];if(e){const i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete lr[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete lr[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};Wl.defaultOptions={mipmap:di.POW2,anisotropicLevel:0,scaleMode:Ni.LINEAR,wrapMode:ui.CLAMP,alphaMode:ye.UNPACK,target:Ts.TEXTURE_2D,format:W.RGBA,type:ot.UNSIGNED_BYTE},Wl._globalBatch=0;let dt=Wl;class Zl{constructor(){this.texArray=null,this.blend=0,this.type=ci.TRIANGLES,this.start=0,this.size=0,this.data=null}}let N_=0;class Xt{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=N_++,this.disposeRunner=new qe("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?pi.ELEMENT_ARRAY_BUFFER:pi.ARRAY_BUFFER}get index(){return this.type===pi.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new Xt(t)}}class Ho{constructor(t,e=0,i=!1,s=ot.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 Ho(t,e,i,s,n)}}const D_={Float32Array,Uint32Array,Int32Array,Uint8Array};function O_(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=np(c);s[u]||(s[u]=new D_[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 pp={5126:4,5123:2,5121:1};let U_=0;const B_={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array};class cr{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=U_++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new qe("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 Xt||(e instanceof Array&&(e=new Float32Array(e)),e=new Xt(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 Ho(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 Xt||(t instanceof Array&&(t=new Uint16Array(t)),t=new Xt(t)),t.type=pi.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 Xt;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*pp[n.type]/4),n.buffer=0}for(i.data=O_(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 Xt(this.buffers[e].data.slice(0));for(const e in this.attributes){const i=this.attributes[e];t.attributes[e]=new Ho(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=pi.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 B_[np(o.buffers[a].data)](s[a]),e.buffers[a]=new Xt(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=pi.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*pp[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 mp extends cr{constructor(t=!1){super(),this._buffer=new Xt(null,t,!1),this._indexBuffer=new Xt(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,ot.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,ot.FLOAT).addAttribute("aColor",this._buffer,4,!0,ot.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,ot.FLOAT).addIndex(this._indexBuffer)}}const Ko=Math.PI*2,X_=180/Math.PI,Vl=Math.PI/180;var oe=(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))(oe||{});class at{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new at(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}}at.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};const Yo=[new at,new at,new at,new at];class ct{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=oe.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 ct(0,0,0,0)}clone(){return new ct(this.x,this.y,this.width,this.height)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}intersects(t,e){if(!e){const E=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=E)return!1;const I=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>I}const i=this.left,s=this.right,n=this.top,o=this.bottom;if(s<=i||o<=n)return!1;const a=Yo[0].set(t.left,t.top),h=Yo[1].set(t.left,t.bottom),l=Yo[2].set(t.right,t.top),c=Yo[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),_=x*i+b*n,v=x*s+b*n,T=x*i+b*o,C=x*s+b*o;return!(Math.max(_,v,T,C)<=x*a.x+b*a.y||Math.min(_,v,T,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}}ct.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class zo{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.radius=i,this.type=oe.CIRC}clone(){return new zo(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 ct(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}zo.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};class jo{constructor(t=0,e=0,i=0,s=0){this.x=t,this.y=e,this.width=i,this.height=s,this.type=oe.ELIP}clone(){return new jo(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 ct(this.x-this.width,this.y-this.height,this.width,this.height)}}jo.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class Br{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=oe.POLY,this.closeStroke=!0}clone(){const t=this.points.slice(),e=new Br(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}}Br.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((r,t)=>`${r}, ${t}`,"")}]`};class Jo{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=oe.RREC}clone(){return new Jo(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}}Jo.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};class It{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 at;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 at;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(Ko-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 It;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 It}static get TEMP_MATRIX(){return new It}}It.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 Xr=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Wr=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Zr=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Vr=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Hl=[],gp=[],$o=Math.sign;function W_(){for(let r=0;r<16;r++){const t=[];Hl.push(t);for(let e=0;e<16;e++){const i=$o(Xr[r]*Xr[e]+Zr[r]*Wr[e]),s=$o(Wr[r]*Xr[e]+Vr[r]*Wr[e]),n=$o(Xr[r]*Zr[e]+Zr[r]*Vr[e]),o=$o(Wr[r]*Zr[e]+Vr[r]*Vr[e]);for(let a=0;a<16;a++)if(Xr[a]===i&&Wr[a]===s&&Zr[a]===n&&Vr[a]===o){t.push(a);break}}}for(let r=0;r<16;r++){const t=new It;t.set(Xr[r],Wr[r],Zr[r],Vr[r],0,0),gp.push(t)}}W_();const Lt={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=>Xr[r],uY:r=>Wr[r],vX:r=>Zr[r],vY:r=>Vr[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>Hl[r][t],sub:(r,t)=>Hl[r][Lt.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?Lt.S:Lt.N:Math.abs(t)*2<=Math.abs(r)?r>0?Lt.E:Lt.W:t>0?r>0?Lt.SE:Lt.SW:r>0?Lt.NE:Lt.NW,matrixAppendRotationInv:(r,t,e=0,i=0)=>{const s=gp[Lt.inv(t)];s.tx=e,s.ty=i,r.append(s)}};class Zi{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 Zi(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))}}Zi.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};const Kl=class{constructor(){this.worldTransform=new It,this.localTransform=new It,this.position=new Zi(this.onChange,this,0,0),this.scale=new Zi(this.onChange,this,1,1),this.pivot=new Zi(this.onChange,this,0,0),this.skew=new Zi(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())}};Kl.IDENTITY=new Kl;let Yl=Kl;Yl.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 Z_=`varying vec2 vTextureCoord;
12
+ else `),e<r-1&&(t+=`if(test == ${e}.0){}`);return t}function k_(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=L_.replace(/%forloop%/gi,G_(r));if(t.shaderSource(e,i),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))r=r/2|0;else break}return r}const Fl=0,Nl=1,Dl=2,Ol=3,Bl=4,Ul=5;class xi{constructor(){this.data=0,this.blendMode=lt.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Fl)}set blend(t){!!(this.data&1<<Fl)!==t&&(this.data^=1<<Fl)}get offsets(){return!!(this.data&1<<Nl)}set offsets(t){!!(this.data&1<<Nl)!==t&&(this.data^=1<<Nl)}get culling(){return!!(this.data&1<<Dl)}set culling(t){!!(this.data&1<<Dl)!==t&&(this.data^=1<<Dl)}get depthTest(){return!!(this.data&1<<Ol)}set depthTest(t){!!(this.data&1<<Ol)!==t&&(this.data^=1<<Ol)}get depthMask(){return!!(this.data&1<<Ul)}set depthMask(t){!!(this.data&1<<Ul)!==t&&(this.data^=1<<Ul)}get clockwiseFrontFace(){return!!(this.data&1<<Bl)}set clockwiseFrontFace(t){!!(this.data&1<<Bl)!==t&&(this.data^=1<<Bl)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==lt.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){const t=new xi;return t.depthTest=!1,t.blend=!0,t}}xi.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};const Xl=[];function fp(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=Xl.length-1;i>=0;--i){const s=Xl[i];if(s.test&&s.test(r,e))return new s(r,t)}throw new Error("Unrecognized source type to auto-detect Resource")}class qe{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(qe.prototype,{dispatch:{value:qe.prototype.emit},run:{value:qe.prototype.emit}});class Pn{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new qe("setRealSize"),this.onUpdate=new qe("update"),this.onError=new qe("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 Vo extends Pn{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===ye.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 F_={scaleMode:Ni.NEAREST,alphaMode:ye.NPM},Wl=class pn extends _n{constructor(t=null,e=null){super(),e=Object.assign({},pn.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 Pn)&&(t=fp(t,p),t.internal=!0),this.resolution=f||$.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=Br(),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=op(this.realWidth)&&op(this.realHeight)}setResolution(t){const e=this.resolution;return e===t?this:(this.resolution=t,this.valid&&(this.width=Math.round(this.width*e)/t,this.height=Math.round(this.height*e)/t,this.emit("update",this)),this._refreshPOT(),this)}setResource(t){if(this.resource===t)return this;if(this.resource)throw new Error("Resource can be set only once");return t.bind(this),this.resource=t,this}update(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))}onError(t){this.emit("error",this,t)}destroy(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete lr[this.cacheId],delete bi[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),pn.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=$.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}_${Br()}`}n=t._pixiId}let o=lr[n];if(s&&i&&!o)throw new Error(`The cacheId "${n}" does not exist in BaseTextureCache.`);return o||(o=new pn(t,e),o.cacheId=n,pn.addToCache(o,n)),o}static fromBuffer(t,e,i,s){t=t||new Float32Array(e*i*4);const n=new Vo(t,{width:e,height:i,...s==null?void 0:s.resourceOptions});let o,a;return t instanceof Float32Array?(o=W.RGBA,a=ot.FLOAT):t instanceof Int32Array?(o=W.RGBA_INTEGER,a=ot.INT):t instanceof Uint32Array?(o=W.RGBA_INTEGER,a=ot.UNSIGNED_INT):t instanceof Int16Array?(o=W.RGBA_INTEGER,a=ot.SHORT):t instanceof Uint16Array?(o=W.RGBA_INTEGER,a=ot.UNSIGNED_SHORT):t instanceof Int8Array?(o=W.RGBA,a=ot.BYTE):(o=W.RGBA,a=ot.UNSIGNED_BYTE),n.internal=!0,new pn(n,Object.assign({},F_,{type:a,format:o},s))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),lr[e]&&lr[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),lr[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=lr[t];if(e){const i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete lr[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete lr[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};Wl.defaultOptions={mipmap:di.POW2,anisotropicLevel:0,scaleMode:Ni.LINEAR,wrapMode:ui.CLAMP,alphaMode:ye.UNPACK,target:Ts.TEXTURE_2D,format:W.RGBA,type:ot.UNSIGNED_BYTE},Wl._globalBatch=0;let dt=Wl;class Zl{constructor(){this.texArray=null,this.blend=0,this.type=ci.TRIANGLES,this.start=0,this.size=0,this.data=null}}let N_=0;class Xt{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=N_++,this.disposeRunner=new qe("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?pi.ELEMENT_ARRAY_BUFFER:pi.ARRAY_BUFFER}get index(){return this.type===pi.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new Xt(t)}}class Ho{constructor(t,e=0,i=!1,s=ot.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 Ho(t,e,i,s,n)}}const D_={Float32Array,Uint32Array,Int32Array,Uint8Array};function O_(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=np(c);s[u]||(s[u]=new D_[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 pp={5126:4,5123:2,5121:1};let B_=0;const U_={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array};class cr{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=B_++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new qe("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 Xt||(e instanceof Array&&(e=new Float32Array(e)),e=new Xt(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 Ho(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 Xt||(t instanceof Array&&(t=new Uint16Array(t)),t=new Xt(t)),t.type=pi.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 Xt;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*pp[n.type]/4),n.buffer=0}for(i.data=O_(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 Xt(this.buffers[e].data.slice(0));for(const e in this.attributes){const i=this.attributes[e];t.attributes[e]=new Ho(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=pi.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 U_[np(o.buffers[a].data)](s[a]),e.buffers[a]=new Xt(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=pi.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*pp[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 mp extends cr{constructor(t=!1){super(),this._buffer=new Xt(null,t,!1),this._indexBuffer=new Xt(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,ot.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,ot.FLOAT).addAttribute("aColor",this._buffer,4,!0,ot.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,ot.FLOAT).addIndex(this._indexBuffer)}}const Ko=Math.PI*2,X_=180/Math.PI,Vl=Math.PI/180;var oe=(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))(oe||{});class at{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new at(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}}at.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};const Yo=[new at,new at,new at,new at];class ct{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=oe.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 ct(0,0,0,0)}clone(){return new ct(this.x,this.y,this.width,this.height)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}intersects(t,e){if(!e){const E=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=E)return!1;const I=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>I}const i=this.left,s=this.right,n=this.top,o=this.bottom;if(s<=i||o<=n)return!1;const a=Yo[0].set(t.left,t.top),h=Yo[1].set(t.left,t.bottom),l=Yo[2].set(t.right,t.top),c=Yo[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),_=x*i+b*n,v=x*s+b*n,T=x*i+b*o,C=x*s+b*o;return!(Math.max(_,v,T,C)<=x*a.x+b*a.y||Math.min(_,v,T,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}}ct.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class zo{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.radius=i,this.type=oe.CIRC}clone(){return new zo(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 ct(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}zo.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};class jo{constructor(t=0,e=0,i=0,s=0){this.x=t,this.y=e,this.width=i,this.height=s,this.type=oe.ELIP}clone(){return new jo(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 ct(this.x-this.width,this.y-this.height,this.width,this.height)}}jo.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class Ur{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=oe.POLY,this.closeStroke=!0}clone(){const t=this.points.slice(),e=new Ur(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}}Ur.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((r,t)=>`${r}, ${t}`,"")}]`};class Jo{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=oe.RREC}clone(){return new Jo(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}}Jo.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};class It{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 at;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 at;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(Ko-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 It;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 It}static get TEMP_MATRIX(){return new It}}It.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 Xr=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Wr=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Zr=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Vr=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Hl=[],gp=[],$o=Math.sign;function W_(){for(let r=0;r<16;r++){const t=[];Hl.push(t);for(let e=0;e<16;e++){const i=$o(Xr[r]*Xr[e]+Zr[r]*Wr[e]),s=$o(Wr[r]*Xr[e]+Vr[r]*Wr[e]),n=$o(Xr[r]*Zr[e]+Zr[r]*Vr[e]),o=$o(Wr[r]*Zr[e]+Vr[r]*Vr[e]);for(let a=0;a<16;a++)if(Xr[a]===i&&Wr[a]===s&&Zr[a]===n&&Vr[a]===o){t.push(a);break}}}for(let r=0;r<16;r++){const t=new It;t.set(Xr[r],Wr[r],Zr[r],Vr[r],0,0),gp.push(t)}}W_();const Lt={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=>Xr[r],uY:r=>Wr[r],vX:r=>Zr[r],vY:r=>Vr[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>Hl[r][t],sub:(r,t)=>Hl[r][Lt.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?Lt.S:Lt.N:Math.abs(t)*2<=Math.abs(r)?r>0?Lt.E:Lt.W:t>0?r>0?Lt.SE:Lt.SW:r>0?Lt.NE:Lt.NW,matrixAppendRotationInv:(r,t,e=0,i=0)=>{const s=gp[Lt.inv(t)];s.tx=e,s.ty=i,r.append(s)}};class Zi{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 Zi(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))}}Zi.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};const Kl=class{constructor(){this.worldTransform=new It,this.localTransform=new It,this.position=new Zi(this.onChange,this,0,0),this.scale=new Zi(this.onChange,this,1,1),this.pivot=new Zi(this.onChange,this,0,0),this.skew=new Zi(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())}};Kl.IDENTITY=new Kl;let Yl=Kl;Yl.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 Z_=`varying vec2 vTextureCoord;
13
13
 
14
14
  uniform sampler2D uSampler;
15
15
 
@@ -297,7 +297,7 @@ void main(void){
297
297
  cv = cu.value;
298
298
  v = uv["${s}"];
299
299
  ${h};`)}}return new Function("ud","uv","renderer","syncData",e.join(`
300
- `))}const xp={};let Ds=xp;function z_(){if(Ds===xp||Ds!=null&&Ds.isContextLost()){const r=Q.ADAPTER.createCanvas();let t;Q.PREFER_ENV>=kr.WEBGL2&&(t=r.getContext("webgl2",{})),t||(t=r.getContext("webgl",{})||r.getContext("experimental-webgl",{}),t?t.getExtension("WEBGL_draw_buffers"):t=null),Ds=t}return Ds}let Qo;function j_(){if(!Qo){Qo=Oe.MEDIUM;const r=z_();if(r&&r.getShaderPrecisionFormat){const t=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);t&&(Qo=t.precision?Oe.HIGH:Oe.MEDIUM)}}return Qo}function _p(r,t){const e=r.getShaderSource(t).split(`
300
+ `))}const xp={};let Ds=xp;function z_(){if(Ds===xp||Ds!=null&&Ds.isContextLost()){const r=$.ADAPTER.createCanvas();let t;$.PREFER_ENV>=kr.WEBGL2&&(t=r.getContext("webgl2",{})),t||(t=r.getContext("webgl",{})||r.getContext("experimental-webgl",{}),t?t.getExtension("WEBGL_draw_buffers"):t=null),Ds=t}return Ds}let Qo;function j_(){if(!Qo){Qo=Oe.MEDIUM;const r=z_();if(r&&r.getShaderPrecisionFormat){const t=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);t&&(Qo=t.precision?Oe.HIGH:Oe.MEDIUM)}}return Qo}function _p(r,t){const e=r.getShaderSource(t).split(`
301
301
  `).map((l,c)=>`${c}: ${l}`),i=r.getShaderInfoLog(t),s=i.split(`
302
302
  `),n={},o=s.map(l=>parseFloat(l.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(l=>l&&!n[l]?(n[l]=!0,!0):!1),a=[""];o.forEach(l=>{e[l-1]=`%c${e[l-1]}%c`,a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});const h=e.join(`
303
303
  `);a[0]=h,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function J_(r,t,e,i){r.getProgramParameter(t,r.LINK_STATUS)||(r.getShaderParameter(e,r.COMPILE_STATUS)||_p(r,e),r.getShaderParameter(i,r.COMPILE_STATUS)||_p(r,i),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(t)))}const $_={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 vp(r){return $_[r]}let qo=null;const wp={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function Tp(r,t){if(!qo){const e=Object.keys(wp);qo={};for(let i=0;i<e.length;++i){const s=e[i];qo[r[s]]=wp[s]}}return qo[t]}function Sp(r,t,e){if(r.substring(0,9)!=="precision"){let i=t;return t===Oe.HIGH&&e!==Oe.HIGH&&(i=Oe.MEDIUM),`precision ${i} float;
@@ -311,7 +311,7 @@ else `),i<t-1&&(e+=`if(vTextureId < ${i}.5)`),e+=`
311
311
  color = texture2D(uSamplers[${i}], vTextureCoord);`,e+=`
312
312
  }`;return e+=`
313
313
  `,e+=`
314
- `,e}}class Jl{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 iv(){return!Oi.apple.device}function rv(r){let t=!0;const e=Q.ADAPTER.getNavigator();if(Oi.tablet||Oi.phone){if(Oi.apple.device){const i=e.userAgent.match(/OS (\d+)_(\d+)?/);i&&parseInt(i[1],10)<11&&(t=!1)}if(Oi.android.device){const i=e.userAgent.match(/Android\s([0-9.]*)/);i&&parseInt(i[1],10)<7&&(t=!1)}}return t?r:4}class ea{constructor(t){this.renderer=t}flush(){}destroy(){this.renderer=null}start(){}stop(){this.flush()}render(t){}}var sv=`varying vec2 vTextureCoord;
314
+ `,e}}class Jl{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 iv(){return!Oi.apple.device}function rv(r){let t=!0;const e=$.ADAPTER.getNavigator();if(Oi.tablet||Oi.phone){if(Oi.apple.device){const i=e.userAgent.match(/OS (\d+)_(\d+)?/);i&&parseInt(i[1],10)<11&&(t=!1)}if(Oi.android.device){const i=e.userAgent.match(/Android\s([0-9.]*)/);i&&parseInt(i[1],10)<7&&(t=!1)}}return t?r:4}class ea{constructor(t){this.renderer=t}flush(){}destroy(){this.renderer=null}start(){}stop(){this.flush()}render(t){}}var sv=`varying vec2 vTextureCoord;
315
315
  varying vec4 vColor;
316
316
  varying float vTextureId;
317
317
  uniform sampler2D uSamplers[%count%];
@@ -342,7 +342,7 @@ void main(void){
342
342
  vTextureId = aTextureId;
343
343
  vColor = aColor * tint;
344
344
  }
345
- `;const Gn=class li extends ea{constructor(t){super(t),this.setShaderGenerator(),this.geometryClass=mp,this.vertexSize=6,this.state=xi.for2d(),this.size=li.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??rv(32),this._defaultMaxTextures}static set defaultMaxTextures(t){this._defaultMaxTextures=t}static get canUploadSameBuffer(){return this._canUploadSameBuffer=this._canUploadSameBuffer??iv(),this._canUploadSameBuffer}static set canUploadSameBuffer(t){this._canUploadSameBuffer=t}get MAX_TEXTURES(){return pt("7.1.0","BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures"),this.maxTextures}static get defaultVertexSrc(){return nv}static get defaultFragmentTemplate(){return sv}setShaderGenerator({vertex:t=li.defaultVertexSrc,fragment:e=li.defaultFragmentTemplate}={}){this.shaderGenerator=new ev(t,e)}contextChange(){const t=this.renderer.gl;Q.PREFER_ENV===kr.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),li.defaultMaxTextures),this.maxTextures=k_(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}=li,i=this.size/4,s=Math.floor(i/this.maxTextures)+1;for(;t.length<i;)t.push(new Zl);for(;e.length<s;)e.push(new Jl);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=li._textureArrayPool,s=this.renderer.batch,n=this._tempBoundTextures,o=this.renderer.textureGC.count;let a=++dt._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;dt._globalBatch=a}buildDrawCalls(t,e,i){const{_bufferedElements:s,_attributeBuffer:n,_indexBuffer:o,vertexSize:a}=this,h=li._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=rp[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;li.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=li._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),li.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=Zo(Math.ceil(t/8)),i=ap(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 kl(s*this.vertexSize*4)),n}getIndexBuffer(t){const e=Zo(Math.ceil(t/12)),i=ap(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=Et.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]}};Gn.defaultBatchSize=4096,Gn.extension={name:"batch",type:z.RendererPlugin},Gn._drawCallPool=[],Gn._textureArrayPool=[];let Hr=Gn;it.add(Hr);var ov=`varying vec2 vTextureCoord;
345
+ `;const Gn=class li extends ea{constructor(t){super(t),this.setShaderGenerator(),this.geometryClass=mp,this.vertexSize=6,this.state=xi.for2d(),this.size=li.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??rv(32),this._defaultMaxTextures}static set defaultMaxTextures(t){this._defaultMaxTextures=t}static get canUploadSameBuffer(){return this._canUploadSameBuffer=this._canUploadSameBuffer??iv(),this._canUploadSameBuffer}static set canUploadSameBuffer(t){this._canUploadSameBuffer=t}get MAX_TEXTURES(){return pt("7.1.0","BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures"),this.maxTextures}static get defaultVertexSrc(){return nv}static get defaultFragmentTemplate(){return sv}setShaderGenerator({vertex:t=li.defaultVertexSrc,fragment:e=li.defaultFragmentTemplate}={}){this.shaderGenerator=new ev(t,e)}contextChange(){const t=this.renderer.gl;$.PREFER_ENV===kr.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),li.defaultMaxTextures),this.maxTextures=k_(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}=li,i=this.size/4,s=Math.floor(i/this.maxTextures)+1;for(;t.length<i;)t.push(new Zl);for(;e.length<s;)e.push(new Jl);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=li._textureArrayPool,s=this.renderer.batch,n=this._tempBoundTextures,o=this.renderer.textureGC.count;let a=++dt._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;dt._globalBatch=a}buildDrawCalls(t,e,i){const{_bufferedElements:s,_attributeBuffer:n,_indexBuffer:o,vertexSize:a}=this,h=li._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=rp[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;li.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=li._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),li.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=Zo(Math.ceil(t/8)),i=ap(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 kl(s*this.vertexSize*4)),n}getIndexBuffer(t){const e=Zo(Math.ceil(t/12)),i=ap(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=Et.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]}};Gn.defaultBatchSize=4096,Gn.extension={name:"batch",type:z.RendererPlugin},Gn._drawCallPool=[],Gn._textureArrayPool=[];let Hr=Gn;it.add(Hr);var ov=`varying vec2 vTextureCoord;
346
346
 
347
347
  uniform sampler2D uSampler;
348
348
 
@@ -375,7 +375,7 @@ void main(void)
375
375
  gl_Position = filterVertexPosition();
376
376
  vTextureCoord = filterTextureCoord();
377
377
  }
378
- `;const $l=class wo extends _i{constructor(t,e,i){const s=Vi.from(t||wo.defaultVertexSrc,e||wo.defaultFragmentSrc);super(s,i),this.padding=0,this.resolution=wo.defaultResolution,this.multisample=wo.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new xi}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 av}static get defaultFragmentSrc(){return ov}};$l.defaultResolution=1,$l.defaultMultisample=Zt.NONE;let pe=$l;class ia{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new Et(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(){}}ia.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},ia.extension={type:[z.RendererSystem,z.CanvasRendererSystem],name:"background"},it.add(ia);class Cp{constructor(t){this.renderer=t,this.emptyRenderer=new ea(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}}Cp.extension={type:z.RendererSystem,name:"batch"},it.add(Cp);let Ep=0;class ra{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=Ep++}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=Ep++,this.renderer.runners.contextChange.emit(t);const e=this.renderer.view;e.addEventListener!==void 0&&(e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1))}initFromOptions(t){const e=this.createContext(this.renderer.view,t);this.initFromContext(e)}createContext(t,e){let i;if(Q.PREFER_ENV>=kr.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")}}ra.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},ra.extension={type:z.RendererSystem,name:"context"},it.add(ra);class Ql{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 qe("disposeFramebuffer"),this.multisample=Zt.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new dt(null,{scaleMode:Ni.NEAREST,resolution:1,mipmap:di.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new dt(null,{scaleMode:Ni.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:di.OFF,format:W.DEPTH_COMPONENT,type:ot.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 Ip extends dt{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=Zt.NONE),super(null,t),this.mipmap=di.OFF,this.valid=!0,this._clear=new Et([0,0,0,0]),this.framebuffer=new Ql(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 ur extends Pn{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=P_(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===ye.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 Ap extends ur{constructor(t,e){if(e=e||{},typeof t=="string"){const i=new Image;ur.crossOrigin(i,t,e.crossorigin),i.src=t,t=i}super(t),!t.complete&&this._width&&this._height&&(this._width=0,this._height=0),this.url=t.src,this._process=null,this.preserveBitmap=!1,this.createBitmap=(e.createBitmap??Q.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.bitmap=null,this._load=null,e.autoLoad!==!1&&this.load()}load(t){return this._load?this._load:(t!==void 0&&(this.createBitmap=t),this._load=new Promise((e,i)=>{const s=this.source;this.url=s.src;const n=()=>{this.destroyed||(s.onload=null,s.onerror=null,this.update(),this._load=null,this.createBitmap?e(this.process()):e(this))};s.complete&&s.src?n():(s.onload=n,s.onerror=o=>{i(o),this.onError.emit(o)})}),this._load)}process(){const t=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);const e=globalThis.createImageBitmap,i=!t.crossOrigin||t.crossOrigin==="anonymous";return this._process=fetch(t.src,{mode:i?"cors":"no-cors"}).then(s=>s.blob()).then(s=>e(s,0,0,t.width,t.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===ye.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 ql{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=Lt.add(i,Lt.NW),this.x0=h+o*Lt.uX(i),this.y0=l+a*Lt.uY(i),i=Lt.add(i,2),this.x1=h+o*Lt.uX(i),this.y1=l+a*Lt.uY(i),i=Lt.add(i,2),this.x2=h+o*Lt.uX(i),this.y2=l+a*Lt.uY(i),i=Lt.add(i,2),this.x3=h+o*Lt.uX(i),this.y3=l+a*Lt.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}}ql.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 Mp=new ql;function sa(r){r.destroy=function(){},r.on=function(){},r.once=function(){},r.emit=function(){}}class rt extends _n{constructor(t,e,i,s,n,o,a){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new ct(0,0,1,1)),t instanceof rt&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=s,this.valid=!1,this.destroyed=!1,this._uvs=Mp,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 at(o.x,o.y):new at(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&&bi[e.url]&&rt.removeFromCache(e.url),this.baseTexture.destroy()}this.baseTexture.off("loaded",this.onBaseTextureUpdated,this),this.baseTexture.off("update",this.onBaseTextureUpdated,this),this.baseTexture=null}this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,rt.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){var s;const t=this._frame.clone(),e=this._frame===this.orig?t:this.orig.clone(),i=new rt(this.baseTexture,!this.noFrame&&t,e,(s=this.trim)==null?void 0:s.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(i._frame=t),i}updateUvs(){this._uvs===Mp&&(this._uvs=new ql),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},i=Q.STRICT_TEXTURE_CACHE){const s=typeof t=="string";let n=null;if(s)n=t;else if(t instanceof dt){if(!t.cacheId){const a=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t.cacheId=`${a}-${Ur()}`,dt.addToCache(t,t.cacheId)}n=t.cacheId}else{if(!t._pixiId){const a=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${a}_${Ur()}`}n=t._pixiId}let o=bi[n];if(s&&i&&!o)throw new Error(`The cacheId "${n}" does not exist in TextureCache.`);return!o&&!(t instanceof dt)?(e.resolution||(e.resolution=Wi(t)),o=new rt(new dt(t,e)),o.baseTexture.cacheId=n,dt.addToCache(o.baseTexture,n),rt.addToCache(o,n)):!o&&t instanceof dt&&(o=new rt(t),rt.addToCache(o,n)),o}static fromURL(t,e){const i=Object.assign({autoLoad:!1},e==null?void 0:e.resourceOptions),s=rt.from(t,Object.assign({resourceOptions:i},e),!1),n=s.baseTexture.resource;return s.baseTexture.valid?Promise.resolve(s):n.load().then(()=>Promise.resolve(s))}static fromBuffer(t,e,i,s){return new rt(dt.fromBuffer(t,e,i,s))}static fromLoader(t,e,i,s){const n=new dt(t,Object.assign({scaleMode:dt.defaultOptions.scaleMode,resolution:Wi(e)},s)),{resource:o}=n;o instanceof Ap&&(o.url=e);const a=new rt(n);return i||(i=e),dt.addToCache(a.baseTexture,i),rt.addToCache(a,i),i!==e&&(dt.addToCache(a.baseTexture,e),rt.addToCache(a,e)),a.baseTexture.valid?Promise.resolve(a):new Promise(h=>{a.baseTexture.once("loaded",()=>h(a))})}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),bi[e]&&bi[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),bi[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=bi[t];if(e){const i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete bi[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)bi[t.textureCacheIds[e]]===t&&delete bi[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}get resolution(){return this.baseTexture.resolution}get frame(){return this._frame}set frame(t){this._frame=t,this.noFrame=!1;const{x:e,y:i,width:s,height:n}=t,o=e+s>this.baseTexture.width,a=i+n>this.baseTexture.height;if(o||a){const h=o&&a?"and":"or",l=`X: ${e} + ${s} = ${e+s} > ${this.baseTexture.width}`,c=`Y: ${i} + ${n} = ${i+n} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${l} ${h} ${c}`)}this.valid=s&&n&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=t),this.valid&&this.updateUvs()}get rotate(){return this._rotate}set rotate(t){this._rotate=t,this.valid&&this.updateUvs()}get width(){return this.orig.width}get height(){return this.orig.height}castToBaseTexture(){return this.baseTexture}static get EMPTY(){return rt._EMPTY||(rt._EMPTY=new rt(new dt),sa(rt._EMPTY),sa(rt._EMPTY.baseTexture)),rt._EMPTY}static get WHITE(){if(!rt._WHITE){const t=Q.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),rt._WHITE=new rt(dt.from(t)),sa(rt._WHITE),sa(rt._WHITE.baseTexture)}return rt._WHITE}}class Kr extends rt{constructor(t,e){super(t,e),this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}get framebuffer(){return this.baseTexture.framebuffer}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e,i=!0){const s=this.baseTexture.resolution,n=Math.round(t*s)/s,o=Math.round(e*s)/s;this.valid=n>0&&o>0,this._frame.width=this.orig.width=n,this._frame.height=this.orig.height=o,i&&this.baseTexture.resize(n,o),this.updateUvs()}setResolution(t){const{baseTexture:e}=this;e.resolution!==t&&(e.setResolution(t),this.resize(e.width,e.height,!1))}static create(t){return new Kr(new Ip(t))}}class Rp{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,i=Zt.NONE){const s=new Ip(Object.assign({width:t,height:e,resolution:1,multisample:i},this.textureOptions));return new Kr(s)}getOptimalTexture(t,e,i=1,s=Zt.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=Zo(t),e=Zo(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||Zt.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}}}Rp.SCREEN_KEY=-1;class hv extends cr{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}}class Pp 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 Xt(this.vertices),this.uvBuffer=new Xt(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 lv{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=Zt.NONE,this.sourceFrame=new ct,this.destinationFrame=new ct,this.bindingSourceFrame=new ct,this.bindingDestinationFrame=new ct,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}}const na=[new at,new at,new at,new at],tc=new It;class Lp{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new Rp,this.statePool=[],this.quad=new hv,this.quadUv=new Pp,this.tempRect=new ct,this.activeState={},this.globalUniforms=new ti({outputFrame:new ct,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 lv,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(tc.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,fi.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,fi.CLEAR,e);const d=l;l=c,c=d}i[u].apply(this,l,h.renderTexture,fi.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=fi.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===fi.CLEAR||e===fi.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(ci.TRIANGLES)):(n.geometry.bind(this.quad),n.geometry.draw(ci.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(It.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=Zt.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||Zt.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=na[0],s=na[1],n=na[2],o=na[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?tc.copyFrom(n):tc.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)}}}Lp.extension={type:z.RendererSystem,name:"filter"},it.add(Lp);class cv{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=Zt.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const uv=new ct;class Gp{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Ql(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 ct,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;Q.PREFER_ENV===kr.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=Vh.COLOR|Vh.DEPTH){const{gl:o}=this;o.clearColor(t,e,i,s),o.clear(n)}initFramebuffer(t){const{gl:e}=this,i=new cv(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=Zt.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=Zt.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 Ql(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=uv,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 ct}destroy(){this.renderer=null}}Gp.extension={type:z.RendererSystem,name:"framebuffer"},it.add(Gp);const ec={5126:4,5123:2,5121:1};class kp{constructor(t){this.renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this.canUseUInt32ElementIndex=!1,this.managedGeometries={}}contextChange(){this.disposeAll(!0);const t=this.gl=this.renderer.gl,e=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,e.webGLVersion!==2){let i=this.renderer.context.extensions.vertexArrayObject;Q.PREFER_ENV===kr.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*ec[d[m].type];for(const m in d){const g=d[m],y=g.size;g.stride===void 0&&(f[g.buffer]===y*ec[g.type]?g.stride=0:g.stride=f[g.buffer]),g.start===void 0&&(g.start=p[g.buffer],p[g.buffer]+=y*ec[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(pi.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}}kp.extension={type:z.RendererSystem,name:"geometry"},it.add(kp);const Fp=new It;class Np{constructor(t,e){this._texture=t,this.mapCoord=new It,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&&(Fp.set(s.width/n.width,0,0,s.height/n.height,-n.x/n.width,-n.y/n.height),this.mapCoord.append(Fp));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 dv=`varying vec2 vMaskCoord;
378
+ `;const $l=class wo extends _i{constructor(t,e,i){const s=Vi.from(t||wo.defaultVertexSrc,e||wo.defaultFragmentSrc);super(s,i),this.padding=0,this.resolution=wo.defaultResolution,this.multisample=wo.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new xi}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 av}static get defaultFragmentSrc(){return ov}};$l.defaultResolution=1,$l.defaultMultisample=Zt.NONE;let pe=$l;class ia{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new Et(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(){}}ia.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},ia.extension={type:[z.RendererSystem,z.CanvasRendererSystem],name:"background"},it.add(ia);class Cp{constructor(t){this.renderer=t,this.emptyRenderer=new ea(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}}Cp.extension={type:z.RendererSystem,name:"batch"},it.add(Cp);let Ep=0;class ra{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=Ep++}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=Ep++,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($.PREFER_ENV>=kr.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")}}ra.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},ra.extension={type:z.RendererSystem,name:"context"},it.add(ra);class Ql{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 qe("disposeFramebuffer"),this.multisample=Zt.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new dt(null,{scaleMode:Ni.NEAREST,resolution:1,mipmap:di.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new dt(null,{scaleMode:Ni.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:di.OFF,format:W.DEPTH_COMPONENT,type:ot.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 Ip extends dt{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=Zt.NONE),super(null,t),this.mipmap=di.OFF,this.valid=!0,this._clear=new Et([0,0,0,0]),this.framebuffer=new Ql(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 ur extends Pn{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=P_(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===ye.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 Ap extends ur{constructor(t,e){if(e=e||{},typeof t=="string"){const i=new Image;ur.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??$.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===ye.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 ql{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=Lt.add(i,Lt.NW),this.x0=h+o*Lt.uX(i),this.y0=l+a*Lt.uY(i),i=Lt.add(i,2),this.x1=h+o*Lt.uX(i),this.y1=l+a*Lt.uY(i),i=Lt.add(i,2),this.x2=h+o*Lt.uX(i),this.y2=l+a*Lt.uY(i),i=Lt.add(i,2),this.x3=h+o*Lt.uX(i),this.y3=l+a*Lt.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}}ql.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 Mp=new ql;function sa(r){r.destroy=function(){},r.on=function(){},r.once=function(){},r.emit=function(){}}class rt extends _n{constructor(t,e,i,s,n,o,a){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new ct(0,0,1,1)),t instanceof rt&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=s,this.valid=!1,this.destroyed=!1,this._uvs=Mp,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 at(o.x,o.y):new at(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&&bi[e.url]&&rt.removeFromCache(e.url),this.baseTexture.destroy()}this.baseTexture.off("loaded",this.onBaseTextureUpdated,this),this.baseTexture.off("update",this.onBaseTextureUpdated,this),this.baseTexture=null}this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,rt.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){var s;const t=this._frame.clone(),e=this._frame===this.orig?t:this.orig.clone(),i=new rt(this.baseTexture,!this.noFrame&&t,e,(s=this.trim)==null?void 0:s.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(i._frame=t),i}updateUvs(){this._uvs===Mp&&(this._uvs=new ql),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},i=$.STRICT_TEXTURE_CACHE){const s=typeof t=="string";let n=null;if(s)n=t;else if(t instanceof dt){if(!t.cacheId){const a=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t.cacheId=`${a}-${Br()}`,dt.addToCache(t,t.cacheId)}n=t.cacheId}else{if(!t._pixiId){const a=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${a}_${Br()}`}n=t._pixiId}let o=bi[n];if(s&&i&&!o)throw new Error(`The cacheId "${n}" does not exist in TextureCache.`);return!o&&!(t instanceof dt)?(e.resolution||(e.resolution=Wi(t)),o=new rt(new dt(t,e)),o.baseTexture.cacheId=n,dt.addToCache(o.baseTexture,n),rt.addToCache(o,n)):!o&&t instanceof dt&&(o=new rt(t),rt.addToCache(o,n)),o}static fromURL(t,e){const i=Object.assign({autoLoad:!1},e==null?void 0:e.resourceOptions),s=rt.from(t,Object.assign({resourceOptions:i},e),!1),n=s.baseTexture.resource;return s.baseTexture.valid?Promise.resolve(s):n.load().then(()=>Promise.resolve(s))}static fromBuffer(t,e,i,s){return new rt(dt.fromBuffer(t,e,i,s))}static fromLoader(t,e,i,s){const n=new dt(t,Object.assign({scaleMode:dt.defaultOptions.scaleMode,resolution:Wi(e)},s)),{resource:o}=n;o instanceof Ap&&(o.url=e);const a=new rt(n);return i||(i=e),dt.addToCache(a.baseTexture,i),rt.addToCache(a,i),i!==e&&(dt.addToCache(a.baseTexture,e),rt.addToCache(a,e)),a.baseTexture.valid?Promise.resolve(a):new Promise(h=>{a.baseTexture.once("loaded",()=>h(a))})}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),bi[e]&&bi[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),bi[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=bi[t];if(e){const i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete bi[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)bi[t.textureCacheIds[e]]===t&&delete bi[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}get resolution(){return this.baseTexture.resolution}get frame(){return this._frame}set frame(t){this._frame=t,this.noFrame=!1;const{x:e,y:i,width:s,height:n}=t,o=e+s>this.baseTexture.width,a=i+n>this.baseTexture.height;if(o||a){const h=o&&a?"and":"or",l=`X: ${e} + ${s} = ${e+s} > ${this.baseTexture.width}`,c=`Y: ${i} + ${n} = ${i+n} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${l} ${h} ${c}`)}this.valid=s&&n&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=t),this.valid&&this.updateUvs()}get rotate(){return this._rotate}set rotate(t){this._rotate=t,this.valid&&this.updateUvs()}get width(){return this.orig.width}get height(){return this.orig.height}castToBaseTexture(){return this.baseTexture}static get EMPTY(){return rt._EMPTY||(rt._EMPTY=new rt(new dt),sa(rt._EMPTY),sa(rt._EMPTY.baseTexture)),rt._EMPTY}static get WHITE(){if(!rt._WHITE){const t=$.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),rt._WHITE=new rt(dt.from(t)),sa(rt._WHITE),sa(rt._WHITE.baseTexture)}return rt._WHITE}}class Kr extends rt{constructor(t,e){super(t,e),this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}get framebuffer(){return this.baseTexture.framebuffer}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e,i=!0){const s=this.baseTexture.resolution,n=Math.round(t*s)/s,o=Math.round(e*s)/s;this.valid=n>0&&o>0,this._frame.width=this.orig.width=n,this._frame.height=this.orig.height=o,i&&this.baseTexture.resize(n,o),this.updateUvs()}setResolution(t){const{baseTexture:e}=this;e.resolution!==t&&(e.setResolution(t),this.resize(e.width,e.height,!1))}static create(t){return new Kr(new Ip(t))}}class Rp{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,i=Zt.NONE){const s=new Ip(Object.assign({width:t,height:e,resolution:1,multisample:i},this.textureOptions));return new Kr(s)}getOptimalTexture(t,e,i=1,s=Zt.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=Zo(t),e=Zo(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||Zt.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}}}Rp.SCREEN_KEY=-1;class hv extends cr{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}}class Pp 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 Xt(this.vertices),this.uvBuffer=new Xt(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 lv{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=Zt.NONE,this.sourceFrame=new ct,this.destinationFrame=new ct,this.bindingSourceFrame=new ct,this.bindingDestinationFrame=new ct,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}}const na=[new at,new at,new at,new at],tc=new It;class Lp{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new Rp,this.statePool=[],this.quad=new hv,this.quadUv=new Pp,this.tempRect=new ct,this.activeState={},this.globalUniforms=new ti({outputFrame:new ct,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 lv,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(tc.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,fi.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,fi.CLEAR,e);const d=l;l=c,c=d}i[u].apply(this,l,h.renderTexture,fi.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=fi.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===fi.CLEAR||e===fi.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(ci.TRIANGLES)):(n.geometry.bind(this.quad),n.geometry.draw(ci.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(It.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=Zt.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||Zt.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=na[0],s=na[1],n=na[2],o=na[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?tc.copyFrom(n):tc.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)}}}Lp.extension={type:z.RendererSystem,name:"filter"},it.add(Lp);class cv{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=Zt.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const uv=new ct;class Gp{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Ql(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 ct,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;$.PREFER_ENV===kr.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=Vh.COLOR|Vh.DEPTH){const{gl:o}=this;o.clearColor(t,e,i,s),o.clear(n)}initFramebuffer(t){const{gl:e}=this,i=new cv(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=Zt.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=Zt.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 Ql(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=uv,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 ct}destroy(){this.renderer=null}}Gp.extension={type:z.RendererSystem,name:"framebuffer"},it.add(Gp);const ec={5126:4,5123:2,5121:1};class kp{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;$.PREFER_ENV===kr.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*ec[d[m].type];for(const m in d){const g=d[m],y=g.size;g.stride===void 0&&(f[g.buffer]===y*ec[g.type]?g.stride=0:g.stride=f[g.buffer]),g.start===void 0&&(g.start=p[g.buffer],p[g.buffer]+=y*ec[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(pi.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}}kp.extension={type:z.RendererSystem,name:"geometry"},it.add(kp);const Fp=new It;class Np{constructor(t,e){this._texture=t,this.mapCoord=new It,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&&(Fp.set(s.width/n.width,0,0,s.height/n.height,-n.x/n.width,-n.y/n.height),this.mapCoord.append(Fp));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 dv=`varying vec2 vMaskCoord;
379
379
  varying vec2 vTextureCoord;
380
380
 
381
381
  uniform sampler2D uSampler;
@@ -416,7 +416,7 @@ void main(void)
416
416
  vTextureCoord = aTextureCoord;
417
417
  vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;
418
418
  }
419
- `;class pv extends pe{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||fv,e||dv,i),this.maskSprite=s,this.maskMatrix=new It}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 Np(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 mv{constructor(t=null){this.type=jt.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=pe.defaultMultisample,this.enabled=!0,this.colorMask=15,this._filters=null,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._scissorRectLocal=null,this._colorMask=15,this._target=null}get filter(){return this._filters?this._filters[0]:null}set filter(t){t?this._filters?this._filters[0]=t:this._filters=[t]:this._filters=null}reset(){this.pooled&&(this.maskObject=null,this.type=jt.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 Dp{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 mv;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!==jt.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case jt.SCISSOR:this.renderer.scissor.push(i);break;case jt.STENCIL:this.renderer.stencil.push(i);break;case jt.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case jt.COLOR:this.pushColorMask(i);break}i.type===jt.SPRITE&&this.maskStack.push(i)}pop(t){const e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case jt.SCISSOR:this.renderer.scissor.pop(e);break;case jt.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case jt.SPRITE:this.popSpriteMask(e);break;case jt.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===jt.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}}detect(t){const e=t.maskObject;e?e.isSprite?t.type=jt.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=jt.SCISSOR:t.type=jt.STENCIL:t.type=jt.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 pv])),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}}Dp.extension={type:z.RendererSystem,name:"mask"},it.add(Dp);class Op{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 Up=new It,Bp=[],Xp=class Ah extends Op{constructor(t){super(t),this.glConst=Q.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0}calcScissorRect(t){if(t._scissorRectLocal)return;const e=t._scissorRect,{maskObject:i}=t,{renderer:s}=this,n=s.renderTexture,o=i.getBounds(!0,Bp.pop()??new ct);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()||Ah.isMatrixRotated(e.worldTransform)||Ah.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){Ah.isMatrixRotated(n)||(n=n?Up.copyFrom(n):Up.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&&Bp.push(t._scissorRectLocal),this.getStackLength()>0?this._useCurrent():e.disable(e.SCISSOR_TEST)}_useCurrent(){const t=this.maskStack[this.maskStack.length-1]._scissorRect;let e;this.renderer.renderTexture.current?e=t.y:e=this.renderer.height-t.height-t.y,this.renderer.gl.scissor(t.x,e,t.width,t.height)}};Xp.extension={type:z.RendererSystem,name:"scissor"};let gv=Xp;it.add(gv);class Wp extends Op{constructor(t){super(t),this.glConst=Q.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0}push(t){const e=t.maskObject,{gl:i}=this.renderer,s=t._stencilCounter;s===0&&(this.renderer.framebuffer.forceStencil(),i.clearStencil(0),i.clear(i.STENCIL_BUFFER_BIT),i.enable(i.STENCIL_TEST)),t._stencilCounter++;const n=t._colorMask;n!==0&&(t._colorMask=0,i.colorMask(!1,!1,!1,!1)),i.stencilFunc(i.EQUAL,s,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,n!==0&&(t._colorMask=n,i.colorMask((n&1)!==0,(n&2)!==0,(n&4)!==0,(n&8)!==0)),this._useCurrent()}pop(t){const e=this.renderer.gl;if(this.getStackLength()===0)e.disable(e.STENCIL_TEST);else{const i=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,s=i?i._colorMask:15;s!==0&&(i._colorMask=0,e.colorMask(!1,!1,!1,!1)),e.stencilOp(e.KEEP,e.KEEP,e.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,s!==0&&(i._colorMask=s,e.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)),this._useCurrent()}}_useCurrent(){const t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)}}Wp.extension={type:z.RendererSystem,name:"stencil"},it.add(Wp);class Zp{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return pt("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract}},prepare:{enumerable:!1,get(){return pt("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare}},interaction:{enumerable:!1,get(){return pt("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}}Zp.extension={type:[z.RendererSystem,z.CanvasRendererSystem],name:"_plugin"},it.add(Zp);class Vp{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new It,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}}Vp.extension={type:z.RendererSystem,name:"projection"},it.add(Vp);const yv=new Yl,Hp=new ct;class Kp{constructor(t){this.renderer=t,this._tempMatrix=new It}generateTexture(t,e){const{region:i,...s}=e||{},n=(i==null?void 0:i.copyTo(Hp))||t.getLocalBounds(Hp,!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=Kr.create(s);this._tempMatrix.tx=-n.x,this._tempMatrix.ty=-n.y;const h=t.transform;return t.transform=yv,this.renderer.render(t,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=h,a}destroy(){}}Kp.extension={type:[z.RendererSystem,z.CanvasRendererSystem],name:"textureGenerator"},it.add(Kp);const Yr=new ct,kn=new ct;class Yp{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new ct,this.destinationFrame=new ct,this.viewportFrame=new ct}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||(Yr.width=t.frame.width,Yr.height=t.frame.height,e=Yr),i||(kn.x=t.frame.x,kn.y=t.frame.y,kn.width=e.width,kn.height=e.height,i=kn),o=n.framebuffer):(a=s.resolution,e||(Yr.width=s._view.screen.width,Yr.height=s._view.screen.height,e=Yr),i||(i=Yr,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=Et.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}}Yp.extension={type:z.RendererSystem,name:"renderTexture"},it.add(Yp);class bv{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 xv(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=Tp(t,n.type),a={type:o,name:n.name,size:vp(o),location:t.getAttribLocation(r,n.name)};e[n.name]=a}return e}function _v(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=Tp(t,n.type);e[o]={name:o,index:s,type:h,size:n.size,isArray:a,value:bp(h,n.size)}}return e}function vv(r,t){var a;const e=yp(r,r.VERTEX_SHADER,t.vertexSrc),i=yp(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)||J_(r,s,e,i),t.attributeData=xv(s,r),t.uniformData=_v(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:bp(l.type,l.size)}}return new bv(s,o)}function wv(r,t,e,i,s){e.buffer.update(s)}const Tv={float:`
419
+ `;class pv extends pe{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||fv,e||dv,i),this.maskSprite=s,this.maskMatrix=new It}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 Np(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 mv{constructor(t=null){this.type=jt.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=pe.defaultMultisample,this.enabled=!0,this.colorMask=15,this._filters=null,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._scissorRectLocal=null,this._colorMask=15,this._target=null}get filter(){return this._filters?this._filters[0]:null}set filter(t){t?this._filters?this._filters[0]=t:this._filters=[t]:this._filters=null}reset(){this.pooled&&(this.maskObject=null,this.type=jt.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 Dp{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 mv;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!==jt.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case jt.SCISSOR:this.renderer.scissor.push(i);break;case jt.STENCIL:this.renderer.stencil.push(i);break;case jt.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case jt.COLOR:this.pushColorMask(i);break}i.type===jt.SPRITE&&this.maskStack.push(i)}pop(t){const e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case jt.SCISSOR:this.renderer.scissor.pop(e);break;case jt.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case jt.SPRITE:this.popSpriteMask(e);break;case jt.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===jt.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}}detect(t){const e=t.maskObject;e?e.isSprite?t.type=jt.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=jt.SCISSOR:t.type=jt.STENCIL:t.type=jt.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 pv])),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}}Dp.extension={type:z.RendererSystem,name:"mask"},it.add(Dp);class Op{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 Bp=new It,Up=[],Xp=class Ah extends Op{constructor(t){super(t),this.glConst=$.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,Up.pop()??new ct);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()||Ah.isMatrixRotated(e.worldTransform)||Ah.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){Ah.isMatrixRotated(n)||(n=n?Bp.copyFrom(n):Bp.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&&Up.push(t._scissorRectLocal),this.getStackLength()>0?this._useCurrent():e.disable(e.SCISSOR_TEST)}_useCurrent(){const t=this.maskStack[this.maskStack.length-1]._scissorRect;let e;this.renderer.renderTexture.current?e=t.y:e=this.renderer.height-t.height-t.y,this.renderer.gl.scissor(t.x,e,t.width,t.height)}};Xp.extension={type:z.RendererSystem,name:"scissor"};let gv=Xp;it.add(gv);class Wp extends Op{constructor(t){super(t),this.glConst=$.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)}}Wp.extension={type:z.RendererSystem,name:"stencil"},it.add(Wp);class Zp{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return pt("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract}},prepare:{enumerable:!1,get(){return pt("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare}},interaction:{enumerable:!1,get(){return pt("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}}Zp.extension={type:[z.RendererSystem,z.CanvasRendererSystem],name:"_plugin"},it.add(Zp);class Vp{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new It,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}}Vp.extension={type:z.RendererSystem,name:"projection"},it.add(Vp);const yv=new Yl,Hp=new ct;class Kp{constructor(t){this.renderer=t,this._tempMatrix=new It}generateTexture(t,e){const{region:i,...s}=e||{},n=(i==null?void 0:i.copyTo(Hp))||t.getLocalBounds(Hp,!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=Kr.create(s);this._tempMatrix.tx=-n.x,this._tempMatrix.ty=-n.y;const h=t.transform;return t.transform=yv,this.renderer.render(t,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=h,a}destroy(){}}Kp.extension={type:[z.RendererSystem,z.CanvasRendererSystem],name:"textureGenerator"},it.add(Kp);const Yr=new ct,kn=new ct;class Yp{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new ct,this.destinationFrame=new ct,this.viewportFrame=new ct}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||(Yr.width=t.frame.width,Yr.height=t.frame.height,e=Yr),i||(kn.x=t.frame.x,kn.y=t.frame.y,kn.width=e.width,kn.height=e.height,i=kn),o=n.framebuffer):(a=s.resolution,e||(Yr.width=s._view.screen.width,Yr.height=s._view.screen.height,e=Yr),i||(i=Yr,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=Et.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}}Yp.extension={type:z.RendererSystem,name:"renderTexture"},it.add(Yp);class bv{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 xv(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=Tp(t,n.type),a={type:o,name:n.name,size:vp(o),location:t.getAttribLocation(r,n.name)};e[n.name]=a}return e}function _v(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=Tp(t,n.type);e[o]={name:o,index:s,type:h,size:n.size,isArray:a,value:bp(h,n.size)}}return e}function vv(r,t){var a;const e=yp(r,r.VERTEX_SHADER,t.vertexSrc),i=yp(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)||J_(r,s,e,i),t.attributeData=xv(s,r),t.uniformData=_v(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:bp(l.type,l.size)}}return new bv(s,o)}function wv(r,t,e,i,s){e.buffer.update(s)}const Tv={float:`
420
420
  data[offset] = v;
421
421
  `,vec2:`
422
422
  data[offset] = v[0];
@@ -486,7 +486,7 @@ void main(void)
486
486
  `)}}return n.push(`
487
487
  renderer.buffer.update(buffer);
488
488
  `),{size:s,syncFunc:new Function("ud","uv","renderer","syncData","buffer",n.join(`
489
- `))}}let Iv=0;const oa={textureCount:0,uboCount:0};class jp{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=Iv++}systemCheck(){if(!Q_())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||(oa.textureCount=0,oa.uboCount=0,this.syncUniformGroup(t.uniformGroup,oa)),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]=Y_(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,oa,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]=Ev(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=vv(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}}jp.extension={type:z.RendererSystem,name:"shader"},it.add(jp);class aa{constructor(t){this.renderer=t}run(t){const{renderer:e}=this;e.runners.init.emit(e.options),t.hello&&console.log(`PixiJS 7.3.2 - ${e.rendererLogId} - https://pixijs.com`),e.resize(e.screen.width,e.screen.height)}destroy(){}}aa.defaultOptions={hello:!1},aa.extension={type:[z.RendererSystem,z.CanvasRendererSystem],name:"startup"},it.add(aa);function Av(r,t=[]){return t[lt.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[lt.ADD]=[r.ONE,r.ONE],t[lt.MULTI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.ONE_MINUS_DST_ALPHA,r.ONE],t[lt.DST_IN]=[r.ZERO,r.SRC_ALPHA],t[lt.DST_OUT]=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],t[lt.DST_ATOP]=[r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA],t[lt.XOR]=[r.ONE_MINUS_DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[lt.SUBTRACT]=[r.ONE,r.ONE,r.ONE,r.ONE,r.FUNC_REVERSE_SUBTRACT,r.FUNC_ADD],t}const Mv=0,Rv=1,Pv=2,Lv=3,Gv=4,kv=5,Jp=class yd{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=lt.NONE,this._blendEq=!1,this.map=[],this.map[Mv]=this.setBlend,this.map[Rv]=this.setOffset,this.map[Pv]=this.setCullFace,this.map[Lv]=this.setDepthTest,this.map[Gv]=this.setFrontFace,this.map[kv]=this.setDepthMask,this.checks=[],this.defaultState=new xi,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=Av(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(yd.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(yd.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}};Jp.extension={type:z.RendererSystem,name:"state"};let Fv=Jp;it.add(Fv);class Nv extends _n{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 qe(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 Fn=class Mh{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=Mh.defaultMaxIdle,this.checkCountMax=Mh.defaultCheckCountMax,this.mode=Mh.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==Hh.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}};Fn.defaultMode=Hh.AUTO,Fn.defaultMaxIdle=60*60,Fn.defaultCheckCountMax=60*10,Fn.extension={type:z.RendererSystem,name:"textureGC"};let zr=Fn;it.add(zr);class ic{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=ot.UNSIGNED_BYTE,this.internalFormat=W.RGBA,this.samplerType=0}}function Dv(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[r.RGB]:$.FLOAT,[r.RGBA]:$.FLOAT,[r.ALPHA]:$.FLOAT,[r.LUMINANCE]:$.FLOAT,[r.LUMINANCE_ALPHA]:$.FLOAT,[r.R8]:$.FLOAT,[r.R8_SNORM]:$.FLOAT,[r.RG8]:$.FLOAT,[r.RG8_SNORM]:$.FLOAT,[r.RGB8]:$.FLOAT,[r.RGB8_SNORM]:$.FLOAT,[r.RGB565]:$.FLOAT,[r.RGBA4]:$.FLOAT,[r.RGB5_A1]:$.FLOAT,[r.RGBA8]:$.FLOAT,[r.RGBA8_SNORM]:$.FLOAT,[r.RGB10_A2]:$.FLOAT,[r.RGB10_A2UI]:$.FLOAT,[r.SRGB8]:$.FLOAT,[r.SRGB8_ALPHA8]:$.FLOAT,[r.R16F]:$.FLOAT,[r.RG16F]:$.FLOAT,[r.RGB16F]:$.FLOAT,[r.RGBA16F]:$.FLOAT,[r.R32F]:$.FLOAT,[r.RG32F]:$.FLOAT,[r.RGB32F]:$.FLOAT,[r.RGBA32F]:$.FLOAT,[r.R11F_G11F_B10F]:$.FLOAT,[r.RGB9_E5]:$.FLOAT,[r.R8I]:$.INT,[r.R8UI]:$.UINT,[r.R16I]:$.INT,[r.R16UI]:$.UINT,[r.R32I]:$.INT,[r.R32UI]:$.UINT,[r.RG8I]:$.INT,[r.RG8UI]:$.UINT,[r.RG16I]:$.INT,[r.RG16UI]:$.UINT,[r.RG32I]:$.INT,[r.RG32UI]:$.UINT,[r.RGB8I]:$.INT,[r.RGB8UI]:$.UINT,[r.RGB16I]:$.INT,[r.RGB16UI]:$.UINT,[r.RGB32I]:$.INT,[r.RGB32UI]:$.UINT,[r.RGBA8I]:$.INT,[r.RGBA8UI]:$.UINT,[r.RGBA16I]:$.INT,[r.RGBA16UI]:$.UINT,[r.RGBA32I]:$.INT,[r.RGBA32UI]:$.UINT,[r.DEPTH_COMPONENT16]:$.FLOAT,[r.DEPTH_COMPONENT24]:$.FLOAT,[r.DEPTH_COMPONENT32F]:$.FLOAT,[r.DEPTH_STENCIL]:$.FLOAT,[r.DEPTH24_STENCIL8]:$.FLOAT,[r.DEPTH32F_STENCIL8]:$.FLOAT}:t={[r.RGB]:$.FLOAT,[r.RGBA]:$.FLOAT,[r.ALPHA]:$.FLOAT,[r.LUMINANCE]:$.FLOAT,[r.LUMINANCE_ALPHA]:$.FLOAT,[r.DEPTH_STENCIL]:$.FLOAT},t}function Ov(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[ot.UNSIGNED_BYTE]:{[W.RGBA]:r.RGBA8,[W.RGB]:r.RGB8,[W.RG]:r.RG8,[W.RED]:r.R8,[W.RGBA_INTEGER]:r.RGBA8UI,[W.RGB_INTEGER]:r.RGB8UI,[W.RG_INTEGER]:r.RG8UI,[W.RED_INTEGER]:r.R8UI,[W.ALPHA]:r.ALPHA,[W.LUMINANCE]:r.LUMINANCE,[W.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[ot.BYTE]:{[W.RGBA]:r.RGBA8_SNORM,[W.RGB]:r.RGB8_SNORM,[W.RG]:r.RG8_SNORM,[W.RED]:r.R8_SNORM,[W.RGBA_INTEGER]:r.RGBA8I,[W.RGB_INTEGER]:r.RGB8I,[W.RG_INTEGER]:r.RG8I,[W.RED_INTEGER]:r.R8I},[ot.UNSIGNED_SHORT]:{[W.RGBA_INTEGER]:r.RGBA16UI,[W.RGB_INTEGER]:r.RGB16UI,[W.RG_INTEGER]:r.RG16UI,[W.RED_INTEGER]:r.R16UI,[W.DEPTH_COMPONENT]:r.DEPTH_COMPONENT16},[ot.SHORT]:{[W.RGBA_INTEGER]:r.RGBA16I,[W.RGB_INTEGER]:r.RGB16I,[W.RG_INTEGER]:r.RG16I,[W.RED_INTEGER]:r.R16I},[ot.UNSIGNED_INT]:{[W.RGBA_INTEGER]:r.RGBA32UI,[W.RGB_INTEGER]:r.RGB32UI,[W.RG_INTEGER]:r.RG32UI,[W.RED_INTEGER]:r.R32UI,[W.DEPTH_COMPONENT]:r.DEPTH_COMPONENT24},[ot.INT]:{[W.RGBA_INTEGER]:r.RGBA32I,[W.RGB_INTEGER]:r.RGB32I,[W.RG_INTEGER]:r.RG32I,[W.RED_INTEGER]:r.R32I},[ot.FLOAT]:{[W.RGBA]:r.RGBA32F,[W.RGB]:r.RGB32F,[W.RG]:r.RG32F,[W.RED]:r.R32F,[W.DEPTH_COMPONENT]:r.DEPTH_COMPONENT32F},[ot.HALF_FLOAT]:{[W.RGBA]:r.RGBA16F,[W.RGB]:r.RGB16F,[W.RG]:r.RG16F,[W.RED]:r.R16F},[ot.UNSIGNED_SHORT_5_6_5]:{[W.RGB]:r.RGB565},[ot.UNSIGNED_SHORT_4_4_4_4]:{[W.RGBA]:r.RGBA4},[ot.UNSIGNED_SHORT_5_5_5_1]:{[W.RGBA]:r.RGB5_A1},[ot.UNSIGNED_INT_2_10_10_10_REV]:{[W.RGBA]:r.RGB10_A2,[W.RGBA_INTEGER]:r.RGB10_A2UI},[ot.UNSIGNED_INT_10F_11F_11F_REV]:{[W.RGB]:r.R11F_G11F_B10F},[ot.UNSIGNED_INT_5_9_9_9_REV]:{[W.RGB]:r.RGB9_E5},[ot.UNSIGNED_INT_24_8]:{[W.DEPTH_STENCIL]:r.DEPTH24_STENCIL8},[ot.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[W.DEPTH_STENCIL]:r.DEPTH32F_STENCIL8}}:t={[ot.UNSIGNED_BYTE]:{[W.RGBA]:r.RGBA,[W.RGB]:r.RGB,[W.ALPHA]:r.ALPHA,[W.LUMINANCE]:r.LUMINANCE,[W.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[ot.UNSIGNED_SHORT_5_6_5]:{[W.RGB]:r.RGB},[ot.UNSIGNED_SHORT_4_4_4_4]:{[W.RGBA]:r.RGBA},[ot.UNSIGNED_SHORT_5_5_5_1]:{[W.RGBA]:r.RGBA}},t}class $p{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new dt,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=Ov(t),this.samplerTypes=Dv(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 ic(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 ic(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!==$.FLOAT&&this.renderer.texture.unbind(o)}}initTexture(t){const e=new ic(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]??$.FLOAT,this.webGLVersion===2&&t.type===ot.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!==$.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&&Fs(this.managedTextures,s,1)}}updateTextureStyle(t){var i;const e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===di.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=ui.CLAMP:e.wrapMode=t.wrapMode,(i=t.resource)!=null&&i.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){const i=this.gl;if(e.mipmap&&t.mipmap!==di.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===Ni.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);const s=this.renderer.context.extensions.anisotropicFiltering;if(s&&t.anisotropicLevel>0&&t.scaleMode===Ni.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===Ni.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(t.target,i.TEXTURE_MAG_FILTER,t.scaleMode===Ni.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}}$p.extension={type:z.RendererSystem,name:"texture"},it.add($p);class Qp{constructor(t){this.renderer=t}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:e,CONTEXT_UID: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}}Qp.extension={type:z.RendererSystem,name:"transformFeedback"},it.add(Qp);class ha{constructor(t){this.renderer=t}init(t){this.screen=new ct(0,0,t.width,t.height),this.element=t.view||Q.ADAPTER.createCanvas(),this.resolution=t.resolution||Q.RESOLUTION,this.autoDensity=!!t.autoDensity}resizeView(t,e){this.element.width=Math.round(t*this.resolution),this.element.height=Math.round(e*this.resolution);const i=this.element.width/this.resolution,s=this.element.height/this.resolution;this.screen.width=i,this.screen.height=s,this.autoDensity&&(this.element.style.width=`${i}px`,this.element.style.height=`${s}px`),this.renderer.emit("resize",i,s),this.renderer.runners.resize.emit(this.screen.width,this.screen.height)}destroy(t){var e;t&&((e=this.element.parentNode)==null||e.removeChild(this.element)),this.renderer=null,this.element=null,this.screen=null}}ha.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},ha.extension={type:[z.RendererSystem,z.CanvasRendererSystem],name:"_view"},it.add(ha),Q.PREFER_ENV=kr.WEBGL2,Q.STRICT_TEXTURE_CACHE=!1,Q.RENDER_OPTIONS={...ra.defaultOptions,...ia.defaultOptions,...ha.defaultOptions,...aa.defaultOptions},Object.defineProperties(Q,{WRAP_MODE:{get(){return dt.defaultOptions.wrapMode},set(r){pt("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),dt.defaultOptions.wrapMode=r}},SCALE_MODE:{get(){return dt.defaultOptions.scaleMode},set(r){pt("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),dt.defaultOptions.scaleMode=r}},MIPMAP_TEXTURES:{get(){return dt.defaultOptions.mipmap},set(r){pt("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),dt.defaultOptions.mipmap=r}},ANISOTROPIC_LEVEL:{get(){return dt.defaultOptions.anisotropicLevel},set(r){pt("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),dt.defaultOptions.anisotropicLevel=r}},FILTER_RESOLUTION:{get(){return pt("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),pe.defaultResolution},set(r){pe.defaultResolution=r}},FILTER_MULTISAMPLE:{get(){return pt("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),pe.defaultMultisample},set(r){pe.defaultMultisample=r}},SPRITE_MAX_TEXTURES:{get(){return Hr.defaultMaxTextures},set(r){pt("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),Hr.defaultMaxTextures=r}},SPRITE_BATCH_SIZE:{get(){return Hr.defaultBatchSize},set(r){pt("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),Hr.defaultBatchSize=r}},CAN_UPLOAD_SAME_BUFFER:{get(){return Hr.canUploadSameBuffer},set(r){pt("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),Hr.canUploadSameBuffer=r}},GC_MODE:{get(){return zr.defaultMode},set(r){pt("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),zr.defaultMode=r}},GC_MAX_IDLE:{get(){return zr.defaultMaxIdle},set(r){pt("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),zr.defaultMaxIdle=r}},GC_MAX_CHECK_COUNT:{get(){return zr.defaultCheckCountMax},set(r){pt("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),zr.defaultCheckCountMax=r}},PRECISION_VERTEX:{get(){return Vi.defaultVertexPrecision},set(r){pt("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),Vi.defaultVertexPrecision=r}},PRECISION_FRAGMENT:{get(){return Vi.defaultFragmentPrecision},set(r){pt("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),Vi.defaultFragmentPrecision=r}}});var jr=(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))(jr||{});class rc{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 qp=class De{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 rc(null,null,1/0),this.deltaMS=1/De.targetFPMS,this.elapsedMS=1/De.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=jr.NORMAL){return this._addListener(new rc(t,e,i))}addOnce(t,e,i=jr.NORMAL){return this._addListener(new rc(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*De.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,De.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(!De._shared){const t=De._shared=new De;t.autoStart=!0,t._protected=!0}return De._shared}static get system(){if(!De._system){const t=De._system=new De;t.autoStart=!0,t._protected=!0}return De._system}};qp.targetFPMS=.06;let me=qp;Object.defineProperties(Q,{TARGET_FPMS:{get(){return me.targetFPMS},set(r){pt("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),me.targetFPMS=r}}});class t0{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,jr.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?me.shared:new me,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}t0.extension=z.Application,it.add(t0);const e0=[];it.handleByList(z.Renderer,e0);function Uv(r){for(const t of e0)if(t.test(r))return new t(r);throw new Error("Unable to auto-detect a suitable renderer.")}var Bv=`attribute vec2 aVertexPosition;
489
+ `))}}let Iv=0;const oa={textureCount:0,uboCount:0};class jp{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=Iv++}systemCheck(){if(!Q_())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||(oa.textureCount=0,oa.uboCount=0,this.syncUniformGroup(t.uniformGroup,oa)),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]=Y_(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,oa,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]=Ev(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=vv(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}}jp.extension={type:z.RendererSystem,name:"shader"},it.add(jp);class aa{constructor(t){this.renderer=t}run(t){const{renderer:e}=this;e.runners.init.emit(e.options),t.hello&&console.log(`PixiJS 7.3.2 - ${e.rendererLogId} - https://pixijs.com`),e.resize(e.screen.width,e.screen.height)}destroy(){}}aa.defaultOptions={hello:!1},aa.extension={type:[z.RendererSystem,z.CanvasRendererSystem],name:"startup"},it.add(aa);function Av(r,t=[]){return t[lt.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[lt.ADD]=[r.ONE,r.ONE],t[lt.MULTIPLY]=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[lt.SCREEN]=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[lt.OVERLAY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[lt.DARKEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[lt.LIGHTEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[lt.COLOR_DODGE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[lt.COLOR_BURN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[lt.HARD_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[lt.SOFT_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[lt.DIFFERENCE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[lt.EXCLUSION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[lt.HUE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[lt.SATURATION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[lt.COLOR]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[lt.LUMINOSITY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[lt.NONE]=[0,0],t[lt.NORMAL_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[lt.ADD_NPM]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t[lt.SCREEN_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[lt.SRC_IN]=[r.DST_ALPHA,r.ZERO],t[lt.SRC_OUT]=[r.ONE_MINUS_DST_ALPHA,r.ZERO],t[lt.SRC_ATOP]=[r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[lt.DST_OVER]=[r.ONE_MINUS_DST_ALPHA,r.ONE],t[lt.DST_IN]=[r.ZERO,r.SRC_ALPHA],t[lt.DST_OUT]=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],t[lt.DST_ATOP]=[r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA],t[lt.XOR]=[r.ONE_MINUS_DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[lt.SUBTRACT]=[r.ONE,r.ONE,r.ONE,r.ONE,r.FUNC_REVERSE_SUBTRACT,r.FUNC_ADD],t}const Mv=0,Rv=1,Pv=2,Lv=3,Gv=4,kv=5,Jp=class yd{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=lt.NONE,this._blendEq=!1,this.map=[],this.map[Mv]=this.setBlend,this.map[Rv]=this.setOffset,this.map[Pv]=this.setCullFace,this.map[Lv]=this.setDepthTest,this.map[Gv]=this.setFrontFace,this.map[kv]=this.setDepthMask,this.checks=[],this.defaultState=new xi,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=Av(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(yd.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(yd.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}};Jp.extension={type:z.RendererSystem,name:"state"};let Fv=Jp;it.add(Fv);class Nv extends _n{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 qe(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 Fn=class Mh{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=Mh.defaultMaxIdle,this.checkCountMax=Mh.defaultCheckCountMax,this.mode=Mh.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==Hh.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}};Fn.defaultMode=Hh.AUTO,Fn.defaultMaxIdle=60*60,Fn.defaultCheckCountMax=60*10,Fn.extension={type:z.RendererSystem,name:"textureGC"};let zr=Fn;it.add(zr);class ic{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=ot.UNSIGNED_BYTE,this.internalFormat=W.RGBA,this.samplerType=0}}function Dv(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[r.RGB]:J.FLOAT,[r.RGBA]:J.FLOAT,[r.ALPHA]:J.FLOAT,[r.LUMINANCE]:J.FLOAT,[r.LUMINANCE_ALPHA]:J.FLOAT,[r.R8]:J.FLOAT,[r.R8_SNORM]:J.FLOAT,[r.RG8]:J.FLOAT,[r.RG8_SNORM]:J.FLOAT,[r.RGB8]:J.FLOAT,[r.RGB8_SNORM]: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},t}function Ov(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[ot.UNSIGNED_BYTE]:{[W.RGBA]:r.RGBA8,[W.RGB]:r.RGB8,[W.RG]:r.RG8,[W.RED]:r.R8,[W.RGBA_INTEGER]:r.RGBA8UI,[W.RGB_INTEGER]:r.RGB8UI,[W.RG_INTEGER]:r.RG8UI,[W.RED_INTEGER]:r.R8UI,[W.ALPHA]:r.ALPHA,[W.LUMINANCE]:r.LUMINANCE,[W.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[ot.BYTE]:{[W.RGBA]:r.RGBA8_SNORM,[W.RGB]:r.RGB8_SNORM,[W.RG]:r.RG8_SNORM,[W.RED]:r.R8_SNORM,[W.RGBA_INTEGER]:r.RGBA8I,[W.RGB_INTEGER]:r.RGB8I,[W.RG_INTEGER]:r.RG8I,[W.RED_INTEGER]:r.R8I},[ot.UNSIGNED_SHORT]:{[W.RGBA_INTEGER]:r.RGBA16UI,[W.RGB_INTEGER]:r.RGB16UI,[W.RG_INTEGER]:r.RG16UI,[W.RED_INTEGER]:r.R16UI,[W.DEPTH_COMPONENT]:r.DEPTH_COMPONENT16},[ot.SHORT]:{[W.RGBA_INTEGER]:r.RGBA16I,[W.RGB_INTEGER]:r.RGB16I,[W.RG_INTEGER]:r.RG16I,[W.RED_INTEGER]:r.R16I},[ot.UNSIGNED_INT]:{[W.RGBA_INTEGER]:r.RGBA32UI,[W.RGB_INTEGER]:r.RGB32UI,[W.RG_INTEGER]:r.RG32UI,[W.RED_INTEGER]:r.R32UI,[W.DEPTH_COMPONENT]:r.DEPTH_COMPONENT24},[ot.INT]:{[W.RGBA_INTEGER]:r.RGBA32I,[W.RGB_INTEGER]:r.RGB32I,[W.RG_INTEGER]:r.RG32I,[W.RED_INTEGER]:r.R32I},[ot.FLOAT]:{[W.RGBA]:r.RGBA32F,[W.RGB]:r.RGB32F,[W.RG]:r.RG32F,[W.RED]:r.R32F,[W.DEPTH_COMPONENT]:r.DEPTH_COMPONENT32F},[ot.HALF_FLOAT]:{[W.RGBA]:r.RGBA16F,[W.RGB]:r.RGB16F,[W.RG]:r.RG16F,[W.RED]:r.R16F},[ot.UNSIGNED_SHORT_5_6_5]:{[W.RGB]:r.RGB565},[ot.UNSIGNED_SHORT_4_4_4_4]:{[W.RGBA]:r.RGBA4},[ot.UNSIGNED_SHORT_5_5_5_1]:{[W.RGBA]:r.RGB5_A1},[ot.UNSIGNED_INT_2_10_10_10_REV]:{[W.RGBA]:r.RGB10_A2,[W.RGBA_INTEGER]:r.RGB10_A2UI},[ot.UNSIGNED_INT_10F_11F_11F_REV]:{[W.RGB]:r.R11F_G11F_B10F},[ot.UNSIGNED_INT_5_9_9_9_REV]:{[W.RGB]:r.RGB9_E5},[ot.UNSIGNED_INT_24_8]:{[W.DEPTH_STENCIL]:r.DEPTH24_STENCIL8},[ot.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[W.DEPTH_STENCIL]:r.DEPTH32F_STENCIL8}}:t={[ot.UNSIGNED_BYTE]:{[W.RGBA]:r.RGBA,[W.RGB]:r.RGB,[W.ALPHA]:r.ALPHA,[W.LUMINANCE]:r.LUMINANCE,[W.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[ot.UNSIGNED_SHORT_5_6_5]:{[W.RGB]:r.RGB},[ot.UNSIGNED_SHORT_4_4_4_4]:{[W.RGBA]:r.RGBA},[ot.UNSIGNED_SHORT_5_5_5_1]:{[W.RGBA]:r.RGBA}},t}class $p{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new dt,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=Ov(t),this.samplerTypes=Dv(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 ic(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 ic(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!==J.FLOAT&&this.renderer.texture.unbind(o)}}initTexture(t){const e=new ic(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]??J.FLOAT,this.webGLVersion===2&&t.type===ot.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!==J.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&&Fs(this.managedTextures,s,1)}}updateTextureStyle(t){var i;const e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===di.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=ui.CLAMP:e.wrapMode=t.wrapMode,(i=t.resource)!=null&&i.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){const i=this.gl;if(e.mipmap&&t.mipmap!==di.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===Ni.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);const s=this.renderer.context.extensions.anisotropicFiltering;if(s&&t.anisotropicLevel>0&&t.scaleMode===Ni.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===Ni.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(t.target,i.TEXTURE_MAG_FILTER,t.scaleMode===Ni.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}}$p.extension={type:z.RendererSystem,name:"texture"},it.add($p);class Qp{constructor(t){this.renderer=t}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:e,CONTEXT_UID: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}}Qp.extension={type:z.RendererSystem,name:"transformFeedback"},it.add(Qp);class ha{constructor(t){this.renderer=t}init(t){this.screen=new ct(0,0,t.width,t.height),this.element=t.view||$.ADAPTER.createCanvas(),this.resolution=t.resolution||$.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}}ha.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},ha.extension={type:[z.RendererSystem,z.CanvasRendererSystem],name:"_view"},it.add(ha),$.PREFER_ENV=kr.WEBGL2,$.STRICT_TEXTURE_CACHE=!1,$.RENDER_OPTIONS={...ra.defaultOptions,...ia.defaultOptions,...ha.defaultOptions,...aa.defaultOptions},Object.defineProperties($,{WRAP_MODE:{get(){return dt.defaultOptions.wrapMode},set(r){pt("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),dt.defaultOptions.wrapMode=r}},SCALE_MODE:{get(){return dt.defaultOptions.scaleMode},set(r){pt("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),dt.defaultOptions.scaleMode=r}},MIPMAP_TEXTURES:{get(){return dt.defaultOptions.mipmap},set(r){pt("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),dt.defaultOptions.mipmap=r}},ANISOTROPIC_LEVEL:{get(){return dt.defaultOptions.anisotropicLevel},set(r){pt("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),dt.defaultOptions.anisotropicLevel=r}},FILTER_RESOLUTION:{get(){return pt("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),pe.defaultResolution},set(r){pe.defaultResolution=r}},FILTER_MULTISAMPLE:{get(){return pt("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),pe.defaultMultisample},set(r){pe.defaultMultisample=r}},SPRITE_MAX_TEXTURES:{get(){return Hr.defaultMaxTextures},set(r){pt("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),Hr.defaultMaxTextures=r}},SPRITE_BATCH_SIZE:{get(){return Hr.defaultBatchSize},set(r){pt("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),Hr.defaultBatchSize=r}},CAN_UPLOAD_SAME_BUFFER:{get(){return Hr.canUploadSameBuffer},set(r){pt("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),Hr.canUploadSameBuffer=r}},GC_MODE:{get(){return zr.defaultMode},set(r){pt("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),zr.defaultMode=r}},GC_MAX_IDLE:{get(){return zr.defaultMaxIdle},set(r){pt("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),zr.defaultMaxIdle=r}},GC_MAX_CHECK_COUNT:{get(){return zr.defaultCheckCountMax},set(r){pt("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),zr.defaultCheckCountMax=r}},PRECISION_VERTEX:{get(){return Vi.defaultVertexPrecision},set(r){pt("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),Vi.defaultVertexPrecision=r}},PRECISION_FRAGMENT:{get(){return Vi.defaultFragmentPrecision},set(r){pt("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),Vi.defaultFragmentPrecision=r}}});var jr=(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))(jr||{});class rc{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 qp=class De{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 rc(null,null,1/0),this.deltaMS=1/De.targetFPMS,this.elapsedMS=1/De.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=jr.NORMAL){return this._addListener(new rc(t,e,i))}addOnce(t,e,i=jr.NORMAL){return this._addListener(new rc(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*De.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,De.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(!De._shared){const t=De._shared=new De;t.autoStart=!0,t._protected=!0}return De._shared}static get system(){if(!De._system){const t=De._system=new De;t.autoStart=!0,t._protected=!0}return De._system}};qp.targetFPMS=.06;let me=qp;Object.defineProperties($,{TARGET_FPMS:{get(){return me.targetFPMS},set(r){pt("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),me.targetFPMS=r}}});class t0{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,jr.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?me.shared:new me,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}t0.extension=z.Application,it.add(t0);const e0=[];it.handleByList(z.Renderer,e0);function Bv(r){for(const t of e0)if(t.test(r))return new t(r);throw new Error("Unable to auto-detect a suitable renderer.")}var Uv=`attribute vec2 aVertexPosition;
490
490
  attribute vec2 aTextureCoord;
491
491
 
492
492
  uniform mat3 projectionMatrix;
@@ -523,7 +523,7 @@ void main(void)
523
523
  gl_Position = filterVertexPosition();
524
524
  vTextureCoord = filterTextureCoord();
525
525
  }
526
- `;const Wv=Bv,i0=Xv;class r0{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>=Zt.HIGH?this.multisample=Zt.HIGH:e>=Zt.MEDIUM?this.multisample=Zt.MEDIUM:e>=Zt.LOW?this.multisample=Zt.LOW:this.multisample=Zt.NONE}destroy(){}}r0.extension={type:z.RendererSystem,name:"_multisample"},it.add(r0);class Zv{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class s0{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 Zv(i.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}}s0.extension={type:z.RendererSystem,name:"buffer"},it.add(s0);class n0{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}}n0.extension={type:z.RendererSystem,name:"objectRenderer"},it.add(n0);const la=class bd extends Nv{constructor(t){super(),this.type=Hd.WEBGL,t=Object.assign({},Q.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new ti({projectionMatrix:new It},!0);const e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:bd.__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&&(pt("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=bd.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t!=null&&t.forceCanvas?!1:f_()}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 pt("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return pt("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return pt("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return pt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){pt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return pt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){pt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return pt("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)}};la.extension={type:z.Renderer,priority:1},la.__plugins={},la.__systems={};let sc=la;it.handleByMap(z.RendererPlugin,sc.__plugins),it.handleByMap(z.RendererSystem,sc.__systems),it.add(sc);class o0 extends Pn{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 dt;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 Pn?this.addResourceAt(t[i],i):this.addResourceAt(fp(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 Vv extends o0{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=Ts.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 Hv extends ur{constructor(t){super(t)}static test(t){const{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}}const a0=class To extends o0{constructor(t,e){const{width:i,height:s,autoLoad:n,linkBaseTexture:o}=e||{};if(t&&t.length!==To.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:i,height:s});for(let a=0;a<To.SIDES;a++)this.items[a].target=Ts.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=Ts.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=Ts.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<To.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===To.SIDES}};a0.SIDES=6;let Kv=a0;class Os extends ur{constructor(t,e){e=e||{};let i,s,n;typeof t=="string"?(i=Os.EMPTY,s=t,n=!0):(i=t,s=null,n=!1),super(i),this.url=s,this.crossOrigin=e.crossOrigin??!0,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.ownsImageBitmap=e.ownsImageBitmap??n,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(async(t,e)=>{if(this.url===null){t(this);return}try{const i=await Q.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;const s=await i.blob();if(this.destroyed)return;const n=await createImageBitmap(s,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===ye.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 Os._EMPTY=Os._EMPTY??Q.ADAPTER.createCanvas(0,0),Os._EMPTY}}const nc=class Rh extends ur{constructor(t,e){e=e||{},super(Q.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=t,this.scale=e.scale||1,this._overrideWidth=e.width,this._overrideHeight=e.height,this._resolve=null,this._crossorigin=e.crossorigin,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(t=>{if(this._resolve=()=>{this.update(),t(this)},Rh.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;ur.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_${Ur()}`,o.getContext("2d").drawImage(t,0,0,e,i,0,0,s,n),this._resolve(),this._resolve=null}}static getSize(t){const e=Rh.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"&&Rh.SVG_XML.test(t)}};nc.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,nc.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let oc=nc;const ac=class xd extends ur{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];ur.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||xd.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=me.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&&(me.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||(me.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(me.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||xd.TYPES.includes(e)}};ac.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],ac.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let h0=ac;Xl.push(Os,Ap,Hv,h0,oc,Vo,Kv,Vv);class ca{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?ct.EMPTY:(t=t||new ct(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],_=a*x+l*b+u,v=c*b+h*x+d;f=Math.min(f,_-n),m=Math.max(m,_+n),p=Math.min(p,v-o),g=Math.max(g,v+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 Gt extends _n{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new Yl,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 ca,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(Gt.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 ct),e=this._boundsRect),this._bounds.getRectangle(e)}getLocalBounds(t){t||(this._localBoundsRect||(this._localBoundsRect=new ct),t=this._localBoundsRect),this._localBounds||(this._localBounds=new ca);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 Yv),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*X_}set angle(t){this.transform.rotation=t*Vl}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 Yv extends Gt{constructor(){super(...arguments),this.sortDirty=null}}Gt.prototype.displayObjectUpdateTransform=Gt.prototype.updateTransform;const zv=new It;function jv(r,t){return r.zIndex===t.zIndex?r._lastSortedIndex-t._lastSortedIndex:r.zIndex-t.zIndex}const l0=class _d extends Gt{constructor(){super(),this.children=[],this.sortableChildren=_d.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);Fs(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,Fs(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,Fs(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(jv),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!==_d.prototype._render&&(i=this.getBounds(!0));const n=t.projection.transform;if(n&&(s?(s=zv.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!==jt.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}};l0.defaultSortableChildren=!1;let yt=l0;yt.prototype.containerUpdateTransform=yt.prototype.updateTransform,Object.defineProperties(Q,{SORTABLE_CHILDREN:{get(){return yt.defaultSortableChildren},set(r){pt("7.1.0","settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),yt.defaultSortableChildren=r}}});const Nn=new at,Jv=new Uint16Array([0,1,2,0,2,3]);class Vt extends yt{constructor(t){super(),this._anchor=new Zi(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 Et(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=lt.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=t||rt.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=Jv,this.pluginName="batch",this.isSprite=!0,this._roundPixels=Q.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=hr(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=hr(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=Q.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=Q.RESOLUTION;for(let y=0;y<e.length;++y)e[y]=Math.round(e[y]*g)/g}}_render(t){this.calculateVertices(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this)}_calculateBounds(){const t=this._texture.trim,e=this._texture.orig;!t||t.width===e.width&&t.height===e.height?(this.calculateVertices(),this._bounds.addQuad(this.vertexData)):(this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData))}getLocalBounds(t){return this.children.length===0?(this._localBounds||(this._localBounds=new ca),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 ct),t=this._localBoundsRect),this._localBounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,Nn);const e=this._texture.orig.width,i=this._texture.orig.height,s=-e*this.anchor.x;let n=0;return Nn.x>=s&&Nn.x<s+e&&(n=-i*this.anchor.y,Nn.y>=n&&Nn.y<n+i)}destroy(t){if(super.destroy(t),this._texture.off("update",this._onTextureUpdate,this),this._anchor=null,typeof t=="boolean"?t:t==null?void 0:t.texture){const e=typeof t=="boolean"?t:t==null?void 0:t.baseTexture;this._texture.destroy(!!e)}this._texture=null}static from(t,e){const i=t instanceof rt?t:rt.from(t,e);return new Vt(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=hr(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=hr(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t}get anchor(){return this._anchor}set anchor(t){this._anchor.copyFrom(t)}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t),this._tintRGB=this._tintColor.toLittleEndianNumber()}get tintValue(){return this._tintColor.toNumber()}get texture(){return this._texture}set texture(t){this._texture!==t&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=t||rt.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))}}const c0=new It;Gt.prototype._cacheAsBitmap=!1,Gt.prototype._cacheData=null,Gt.prototype._cacheAsBitmapResolution=null,Gt.prototype._cacheAsBitmapMultisample=null;class $v{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(Gt.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 $v),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)}}}),Gt.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))},Gt.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 ct,!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=Kr.create({width:e.width,height:e.height,resolution:i,multisample:this.cacheAsBitmapMultisample??r.multisample}),l=`cacheAsBitmap_${Ur()}`;this._cacheData.textureCacheId=l,dt.addToCache(h.baseTexture,l),rt.addToCache(h,l);const c=this.transform.localTransform.copyTo(c0).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 Vt(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)},Gt.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))},Gt.prototype._initCachedDisplayObjectCanvas=function(r){var c;if((c=this._cacheData)!=null&&c.sprite)return;const t=this.getLocalBounds(new ct,!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=Kr.create({width:t.width,height:t.height,resolution:n}),a=`cacheAsBitmap_${Ur()}`;this._cacheData.textureCacheId=a,dt.addToCache(o.baseTexture,a),rt.addToCache(o,a);const h=c0;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 Vt(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)},Gt.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},Gt.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},Gt.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,dt.removeFromCache(this._cacheData.textureCacheId),rt.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},Gt.prototype._cacheAsBitmapDestroy=function(r){this.cacheAsBitmap=!1,this.destroy(r)},Gt.prototype.name=null,yt.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},Gt.prototype.getGlobalPosition=function(r=new at,t=!1){return this.parent?this.parent.toGlobal(this.position,r,t):(r.x=this.position.x,r.y=this.position.y),r};var Qv=`varying vec2 vTextureCoord;
526
+ `;const Wv=Uv,i0=Xv;class r0{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>=Zt.HIGH?this.multisample=Zt.HIGH:e>=Zt.MEDIUM?this.multisample=Zt.MEDIUM:e>=Zt.LOW?this.multisample=Zt.LOW:this.multisample=Zt.NONE}destroy(){}}r0.extension={type:z.RendererSystem,name:"_multisample"},it.add(r0);class Zv{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class s0{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 Zv(i.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}}s0.extension={type:z.RendererSystem,name:"buffer"},it.add(s0);class n0{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}}n0.extension={type:z.RendererSystem,name:"objectRenderer"},it.add(n0);const la=class bd extends Nv{constructor(t){super(),this.type=Hd.WEBGL,t=Object.assign({},$.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new ti({projectionMatrix:new It},!0);const e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:bd.__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&&(pt("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=bd.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t!=null&&t.forceCanvas?!1:f_()}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 pt("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return pt("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return pt("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return pt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){pt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return pt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){pt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return pt("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)}};la.extension={type:z.Renderer,priority:1},la.__plugins={},la.__systems={};let sc=la;it.handleByMap(z.RendererPlugin,sc.__plugins),it.handleByMap(z.RendererSystem,sc.__systems),it.add(sc);class o0 extends Pn{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 dt;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 Pn?this.addResourceAt(t[i],i):this.addResourceAt(fp(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 Vv extends o0{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=Ts.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 Hv extends ur{constructor(t){super(t)}static test(t){const{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}}const a0=class To extends o0{constructor(t,e){const{width:i,height:s,autoLoad:n,linkBaseTexture:o}=e||{};if(t&&t.length!==To.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:i,height:s});for(let a=0;a<To.SIDES;a++)this.items[a].target=Ts.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=Ts.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=Ts.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<To.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===To.SIDES}};a0.SIDES=6;let Kv=a0;class Os extends ur{constructor(t,e){e=e||{};let i,s,n;typeof t=="string"?(i=Os.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 $.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===ye.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 Os._EMPTY=Os._EMPTY??$.ADAPTER.createCanvas(0,0),Os._EMPTY}}const nc=class Rh extends ur{constructor(t,e){e=e||{},super($.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)},Rh.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;ur.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_${Br()}`,o.getContext("2d").drawImage(t,0,0,e,i,0,0,s,n),this._resolve(),this._resolve=null}}static getSize(t){const e=Rh.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"&&Rh.SVG_XML.test(t)}};nc.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,nc.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let oc=nc;const ac=class xd extends ur{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];ur.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||xd.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=me.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&&(me.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||(me.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(me.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||xd.TYPES.includes(e)}};ac.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],ac.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let h0=ac;Xl.push(Os,Ap,Hv,h0,oc,Vo,Kv,Vv);class ca{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?ct.EMPTY:(t=t||new ct(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],_=a*x+l*b+u,v=c*b+h*x+d;f=Math.min(f,_-n),m=Math.max(m,_+n),p=Math.min(p,v-o),g=Math.max(g,v+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 Gt extends _n{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new Yl,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 ca,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(Gt.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 ct),e=this._boundsRect),this._bounds.getRectangle(e)}getLocalBounds(t){t||(this._localBoundsRect||(this._localBoundsRect=new ct),t=this._localBoundsRect),this._localBounds||(this._localBounds=new ca);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 Yv),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*X_}set angle(t){this.transform.rotation=t*Vl}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 Yv extends Gt{constructor(){super(...arguments),this.sortDirty=null}}Gt.prototype.displayObjectUpdateTransform=Gt.prototype.updateTransform;const zv=new It;function jv(r,t){return r.zIndex===t.zIndex?r._lastSortedIndex-t._lastSortedIndex:r.zIndex-t.zIndex}const l0=class _d extends Gt{constructor(){super(),this.children=[],this.sortableChildren=_d.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);Fs(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,Fs(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,Fs(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(jv),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!==_d.prototype._render&&(i=this.getBounds(!0));const n=t.projection.transform;if(n&&(s?(s=zv.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!==jt.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}};l0.defaultSortableChildren=!1;let gt=l0;gt.prototype.containerUpdateTransform=gt.prototype.updateTransform,Object.defineProperties($,{SORTABLE_CHILDREN:{get(){return gt.defaultSortableChildren},set(r){pt("7.1.0","settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),gt.defaultSortableChildren=r}}});const Nn=new at,Jv=new Uint16Array([0,1,2,0,2,3]);class Vt extends gt{constructor(t){super(),this._anchor=new Zi(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 Et(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=lt.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=t||rt.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=Jv,this.pluginName="batch",this.isSprite=!0,this._roundPixels=$.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=hr(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=hr(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=$.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=$.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 ca),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 ct),t=this._localBoundsRect),this._localBounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,Nn);const e=this._texture.orig.width,i=this._texture.orig.height,s=-e*this.anchor.x;let n=0;return Nn.x>=s&&Nn.x<s+e&&(n=-i*this.anchor.y,Nn.y>=n&&Nn.y<n+i)}destroy(t){if(super.destroy(t),this._texture.off("update",this._onTextureUpdate,this),this._anchor=null,typeof t=="boolean"?t:t==null?void 0:t.texture){const e=typeof t=="boolean"?t:t==null?void 0:t.baseTexture;this._texture.destroy(!!e)}this._texture=null}static from(t,e){const i=t instanceof rt?t:rt.from(t,e);return new Vt(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=hr(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=hr(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t}get anchor(){return this._anchor}set anchor(t){this._anchor.copyFrom(t)}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t),this._tintRGB=this._tintColor.toLittleEndianNumber()}get tintValue(){return this._tintColor.toNumber()}get texture(){return this._texture}set texture(t){this._texture!==t&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=t||rt.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))}}const c0=new It;Gt.prototype._cacheAsBitmap=!1,Gt.prototype._cacheData=null,Gt.prototype._cacheAsBitmapResolution=null,Gt.prototype._cacheAsBitmapMultisample=null;class $v{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(Gt.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 $v),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)}}}),Gt.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))},Gt.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 ct,!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=Kr.create({width:e.width,height:e.height,resolution:i,multisample:this.cacheAsBitmapMultisample??r.multisample}),l=`cacheAsBitmap_${Br()}`;this._cacheData.textureCacheId=l,dt.addToCache(h.baseTexture,l),rt.addToCache(h,l);const c=this.transform.localTransform.copyTo(c0).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 Vt(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)},Gt.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))},Gt.prototype._initCachedDisplayObjectCanvas=function(r){var c;if((c=this._cacheData)!=null&&c.sprite)return;const t=this.getLocalBounds(new ct,!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=Kr.create({width:t.width,height:t.height,resolution:n}),a=`cacheAsBitmap_${Br()}`;this._cacheData.textureCacheId=a,dt.addToCache(o.baseTexture,a),rt.addToCache(o,a);const h=c0;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 Vt(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)},Gt.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},Gt.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},Gt.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,dt.removeFromCache(this._cacheData.textureCacheId),rt.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},Gt.prototype._cacheAsBitmapDestroy=function(r){this.cacheAsBitmap=!1,this.destroy(r)},Gt.prototype.name=null,gt.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},Gt.prototype.getGlobalPosition=function(r=new at,t=!1){return this.parent?this.parent.toGlobal(this.position,r,t):(r.x=this.position.x,r.y=this.position.y),r};var Qv=`varying vec2 vTextureCoord;
527
527
 
528
528
  uniform sampler2D uSampler;
529
529
  uniform float uAlpha;
@@ -863,8 +863,8 @@ void main()
863
863
 
864
864
  gl_FragColor = color;
865
865
  }
866
- `;class pw extends pe{constructor(t=.5,e=Math.random()){super(i0,fw,{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 u0={AlphaFilter:qv,BlurFilter:nw,BlurFilterPass:hc,ColorMatrixFilter:lc,DisplacementFilter:lw,FXAAFilter:dw,NoiseFilter:pw};Object.entries(u0).forEach(([r,t])=>{Object.defineProperty(u0,r,{get(){return pt("7.1.0",`filters.${r} has moved to ${r}`),t}})});class mw{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||(me.system.add(this.tickerUpdate,this,jr.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(me.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 dr=new mw;class Dn{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=Dn.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new at,this.page=new at,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 ua extends Dn{constructor(){super(...arguments),this.client=new at,this.movement=new at,this.offset=new at,this.global=new at,this.screen=new at}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 ei extends ua{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 Us extends ua{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}Us.DOM_DELTA_PIXEL=0,Us.DOM_DELTA_LINE=1,Us.DOM_DELTA_PAGE=2;const gw=2048,yw=new at,cc=new at;class bw{constructor(t){this.dispatch=new _n,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){dr.pauseUpdate=!0;const i=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",s=this[i](this.rootTarget,this.rootTarget.eventMode,yw.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<gw&&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")&&(dr.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")&&(dr.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,cc),!t.hitArea.contains(cc.x,cc.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 ei)){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 ei)){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 ei)){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 ei)){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 ei)){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 ei)){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 Us)){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(ei);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(Us);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(ei);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 ei&&e instanceof ei&&(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 ua&&e instanceof ua&&(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 xw=1,_w={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},uc=class vd{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new bw(null),dr.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new ei(null),this.rootWheelEvent=new Us(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...vd.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,vd._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,dr.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,dr.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;dr.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;dr.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=xw),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=_w[t.type]||t.type),t}transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.relatedTarget=null,t.shiftKey=e.shiftKey}};uc.extension={name:"events",type:[z.RendererSystem,z.CanvasRendererSystem]},uc.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let dc=uc;it.add(dc);function d0(r){return r==="dynamic"||r==="static"}const vw={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??d0(dc.defaultEventMode)},set interactive(r){pt("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??dc.defaultEventMode},set eventMode(r){this._internalInteractive=d0(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 Dn))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}};Gt.mixin(vw);const ww={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};Gt.mixin(ww);const Tw=9,da=100,Sw=0,Cw=0,f0=2,p0=1,Ew=-1e3,Iw=-1e3,Aw=2;class m0{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,(Oi.tablet||Oi.phone)&&this.createTouchHook();const e=document.createElement("div");e.style.width=`${da}px`,e.style.height=`${da}px`,e.style.position="absolute",e.style.top=`${Sw}px`,e.style.left=`${Cw}px`,e.style.zIndex=f0.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=`${p0}px`,t.style.height=`${p0}px`,t.style.position="absolute",t.style.top=`${Ew}px`,t.style.left=`${Iw}px`,t.style.zIndex=Aw.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(Oi.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,Fs(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=`${da}px`,e.style.height=`${da}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=f0.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 Dn(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===Tw&&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}}m0.extension={name:"accessibility",type:[z.RendererPlugin,z.CanvasRendererPlugin]},it.add(m0);const g0=class wd{constructor(t){this.stage=new yt,t=Object.assign({forceCanvas:!1},t),this.renderer=Uv(t),wd._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=wd._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}};g0._plugins=[];let y0=g0;it.handleByList(z.Application,y0._plugins);class b0{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}}b0.extension=z.Application,it.add(b0);const x0={loader:z.LoadParser,resolver:z.ResolveParser,cache:z.CacheParser,detection:z.DetectionParser};it.handle(z.Asset,r=>{const t=r.ref;Object.entries(x0).filter(([e])=>!!t[e]).forEach(([e,i])=>it.add(Object.assign(t[e],{extension:t[e].extension??i})))},r=>{const t=r.ref;Object.keys(x0).filter(e=>!!t[e]).forEach(e=>it.remove(t[e]))});class Mw{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 Bs(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 fr(r,t){const e=r.split("?")[0],i=Jt.extname(e).toLowerCase();return Array.isArray(t)?t.includes(i):i===t}const ii=(r,t,e=!1)=>(Array.isArray(r)||(r=[r]),t?r.map(i=>typeof i=="string"||e?t(i):i):r),fc=(r,t)=>{const e=t.split("?")[1];return e&&(r+=`?${e}`),r};function _0(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?_0(r.replace(i[e],a),t,e+1,i,s):s.push(r.replace(i[e],a))}}function Rw(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)}),_0(r,s,0,e,i)}else i.push(r);return i}const fa=r=>!Array.isArray(r);class Pw{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=ii(t);let s;for(let a=0;a<this.parsers.length;a++){const h=this.parsers[a];if(h.test(e)){s=h.getCacheableAssets(i,e);break}}s||(s={},i.forEach(a=>{s[a]=e}));const n=Object.keys(s),o={cacheKeys:n,keys:i};if(i.forEach(a=>{this._cacheMap.set(a,o)}),n.forEach(a=>{this._cache.has(a)&&this._cache.get(a)!==e&&console.warn("[Cache] already has key:",a),this._cache.set(a,s[a])}),e instanceof rt){const a=e;i.forEach(h=>{a.baseTexture!==rt.EMPTY.baseTexture&&dt.addToCache(a.baseTexture,h),rt.addToCache(a,h)})}}remove(t){if(!this._cacheMap.has(t)){console.warn(`[Assets] Asset id ${t} was not found in the Cache`);return}const e=this._cacheMap.get(t);e.cacheKeys.forEach(i=>{this._cache.delete(i)}),e.keys.forEach(i=>{this._cacheMap.delete(i)})}get parsers(){return this._parsers}}const Jr=new Pw;class Lw{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=fa(t),o=ii(t,l=>({alias:[l],src:l})),a=o.length,h=o.map(async l=>{const c=Jt.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=ii(t,i=>({alias:[i],src:i})).map(async i=>{var o,a;const s=Jt.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 ri=(r=>(r[r.Low=0]="Low",r[r.Normal=1]="Normal",r[r.High=2]="High",r))(ri||{});const Gw=".json",kw="application/json",Fw={extension:{type:z.LoadParser,priority:ri.Low},name:"loadJson",test(r){return Bs(r,kw)||fr(r,Gw)},async load(r){return await(await Q.ADAPTER.fetch(r)).json()}};it.add(Fw);const Nw=".txt",Dw="text/plain",Ow={name:"loadTxt",extension:{type:z.LoadParser,priority:ri.Low},test(r){return Bs(r,Dw)||fr(r,Nw)},async load(r){return await(await Q.ADAPTER.fetch(r)).text()}};it.add(Ow);const Uw=["normal","bold","100","200","300","400","500","600","700","800","900"],Bw=[".ttf",".otf",".woff",".woff2"],Xw=["font/ttf","font/otf","font/woff","font/woff2"],Ww=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function Zw(r){const t=Jt.extname(r),e=Jt.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(Ww)){i=!1;break}let s=e.join(" ");return i||(s=`"${s.replace(/[\\"]/g,"\\$&")}"`),s}const Vw=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function Hw(r){return Vw.test(r)?r:encodeURI(r)}const Kw={extension:{type:z.LoadParser,priority:ri.Low},name:"loadWebFont",test(r){return Bs(r,Xw)||fr(r,Bw)},async load(r,t){var i,s,n;const e=Q.ADAPTER.getFontFaceSet();if(e){const o=[],a=((i=t.data)==null?void 0:i.family)??Zw(r),h=((n=(s=t.data)==null?void 0:s.weights)==null?void 0:n.filter(c=>Uw.includes(c)))??["normal"],l=t.data??{};for(let c=0;c<h.length;c++){const u=h[c],d=new FontFace(a,`url(${Hw(r)})`,{...l,weight:u});await d.load(),e.add(d),o.push(d)}return o.length===1?o[0]:o}return console.warn("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(r){(Array.isArray(r)?r:[r]).forEach(t=>Q.ADAPTER.getFontFaceSet().delete(t))}};it.add(Kw);let v0=0,pc;const Yw="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=",zw={id:"checkImageBitmap",code:`
866
+ `;class pw extends pe{constructor(t=.5,e=Math.random()){super(i0,fw,{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 u0={AlphaFilter:qv,BlurFilter:nw,BlurFilterPass:hc,ColorMatrixFilter:lc,DisplacementFilter:lw,FXAAFilter:dw,NoiseFilter:pw};Object.entries(u0).forEach(([r,t])=>{Object.defineProperty(u0,r,{get(){return pt("7.1.0",`filters.${r} has moved to ${r}`),t}})});class mw{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||(me.system.add(this.tickerUpdate,this,jr.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(me.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 dr=new mw;class Dn{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=Dn.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new at,this.page=new at,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 ua extends Dn{constructor(){super(...arguments),this.client=new at,this.movement=new at,this.offset=new at,this.global=new at,this.screen=new at}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 ei extends ua{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 Bs extends ua{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}Bs.DOM_DELTA_PIXEL=0,Bs.DOM_DELTA_LINE=1,Bs.DOM_DELTA_PAGE=2;const gw=2048,yw=new at,cc=new at;class bw{constructor(t){this.dispatch=new _n,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){dr.pauseUpdate=!0;const i=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",s=this[i](this.rootTarget,this.rootTarget.eventMode,yw.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<gw&&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")&&(dr.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")&&(dr.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,cc),!t.hitArea.contains(cc.x,cc.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 ei)){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 ei)){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 ei)){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 ei)){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 ei)){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 ei)){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 Bs)){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(ei);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(Bs);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(ei);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 ei&&e instanceof ei&&(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 ua&&e instanceof ua&&(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 xw=1,_w={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},uc=class vd{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new bw(null),dr.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new ei(null),this.rootWheelEvent=new Bs(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...vd.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,vd._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,dr.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,dr.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;dr.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;dr.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=xw),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=_w[t.type]||t.type),t}transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.relatedTarget=null,t.shiftKey=e.shiftKey}};uc.extension={name:"events",type:[z.RendererSystem,z.CanvasRendererSystem]},uc.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let dc=uc;it.add(dc);function d0(r){return r==="dynamic"||r==="static"}const vw={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??d0(dc.defaultEventMode)},set interactive(r){pt("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??dc.defaultEventMode},set eventMode(r){this._internalInteractive=d0(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 Dn))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}};Gt.mixin(vw);const ww={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};Gt.mixin(ww);const Tw=9,da=100,Sw=0,Cw=0,f0=2,p0=1,Ew=-1e3,Iw=-1e3,Aw=2;class m0{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,(Oi.tablet||Oi.phone)&&this.createTouchHook();const e=document.createElement("div");e.style.width=`${da}px`,e.style.height=`${da}px`,e.style.position="absolute",e.style.top=`${Sw}px`,e.style.left=`${Cw}px`,e.style.zIndex=f0.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=`${p0}px`,t.style.height=`${p0}px`,t.style.position="absolute",t.style.top=`${Ew}px`,t.style.left=`${Iw}px`,t.style.zIndex=Aw.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(Oi.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,Fs(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=`${da}px`,e.style.height=`${da}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=f0.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 Dn(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===Tw&&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}}m0.extension={name:"accessibility",type:[z.RendererPlugin,z.CanvasRendererPlugin]},it.add(m0);const g0=class wd{constructor(t){this.stage=new gt,t=Object.assign({forceCanvas:!1},t),this.renderer=Bv(t),wd._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=wd._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}};g0._plugins=[];let y0=g0;it.handleByList(z.Application,y0._plugins);class b0{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}}b0.extension=z.Application,it.add(b0);const x0={loader:z.LoadParser,resolver:z.ResolveParser,cache:z.CacheParser,detection:z.DetectionParser};it.handle(z.Asset,r=>{const t=r.ref;Object.entries(x0).filter(([e])=>!!t[e]).forEach(([e,i])=>it.add(Object.assign(t[e],{extension:t[e].extension??i})))},r=>{const t=r.ref;Object.keys(x0).filter(e=>!!t[e]).forEach(e=>it.remove(t[e]))});class Mw{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 Us(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 fr(r,t){const e=r.split("?")[0],i=Jt.extname(e).toLowerCase();return Array.isArray(t)?t.includes(i):i===t}const ii=(r,t,e=!1)=>(Array.isArray(r)||(r=[r]),t?r.map(i=>typeof i=="string"||e?t(i):i):r),fc=(r,t)=>{const e=t.split("?")[1];return e&&(r+=`?${e}`),r};function _0(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?_0(r.replace(i[e],a),t,e+1,i,s):s.push(r.replace(i[e],a))}}function Rw(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)}),_0(r,s,0,e,i)}else i.push(r);return i}const fa=r=>!Array.isArray(r);class Pw{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=ii(t);let s;for(let a=0;a<this.parsers.length;a++){const h=this.parsers[a];if(h.test(e)){s=h.getCacheableAssets(i,e);break}}s||(s={},i.forEach(a=>{s[a]=e}));const n=Object.keys(s),o={cacheKeys:n,keys:i};if(i.forEach(a=>{this._cacheMap.set(a,o)}),n.forEach(a=>{this._cache.has(a)&&this._cache.get(a)!==e&&console.warn("[Cache] already has key:",a),this._cache.set(a,s[a])}),e instanceof rt){const a=e;i.forEach(h=>{a.baseTexture!==rt.EMPTY.baseTexture&&dt.addToCache(a.baseTexture,h),rt.addToCache(a,h)})}}remove(t){if(!this._cacheMap.has(t)){console.warn(`[Assets] Asset id ${t} was not found in the Cache`);return}const e=this._cacheMap.get(t);e.cacheKeys.forEach(i=>{this._cache.delete(i)}),e.keys.forEach(i=>{this._cacheMap.delete(i)})}get parsers(){return this._parsers}}const Jr=new Pw;class Lw{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=fa(t),o=ii(t,l=>({alias:[l],src:l})),a=o.length,h=o.map(async l=>{const c=Jt.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=ii(t,i=>({alias:[i],src:i})).map(async i=>{var o,a;const s=Jt.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 ri=(r=>(r[r.Low=0]="Low",r[r.Normal=1]="Normal",r[r.High=2]="High",r))(ri||{});const Gw=".json",kw="application/json",Fw={extension:{type:z.LoadParser,priority:ri.Low},name:"loadJson",test(r){return Us(r,kw)||fr(r,Gw)},async load(r){return await(await $.ADAPTER.fetch(r)).json()}};it.add(Fw);const Nw=".txt",Dw="text/plain",Ow={name:"loadTxt",extension:{type:z.LoadParser,priority:ri.Low},test(r){return Us(r,Dw)||fr(r,Nw)},async load(r){return await(await $.ADAPTER.fetch(r)).text()}};it.add(Ow);const Bw=["normal","bold","100","200","300","400","500","600","700","800","900"],Uw=[".ttf",".otf",".woff",".woff2"],Xw=["font/ttf","font/otf","font/woff","font/woff2"],Ww=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function Zw(r){const t=Jt.extname(r),e=Jt.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(Ww)){i=!1;break}let s=e.join(" ");return i||(s=`"${s.replace(/[\\"]/g,"\\$&")}"`),s}const Vw=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function Hw(r){return Vw.test(r)?r:encodeURI(r)}const Kw={extension:{type:z.LoadParser,priority:ri.Low},name:"loadWebFont",test(r){return Us(r,Xw)||fr(r,Uw)},async load(r,t){var i,s,n;const e=$.ADAPTER.getFontFaceSet();if(e){const o=[],a=((i=t.data)==null?void 0:i.family)??Zw(r),h=((n=(s=t.data)==null?void 0:s.weights)==null?void 0:n.filter(c=>Bw.includes(c)))??["normal"],l=t.data??{};for(let c=0;c<h.length;c++){const u=h[c],d=new FontFace(a,`url(${Hw(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=>$.ADAPTER.getFontFaceSet().delete(t))}};it.add(Kw);let v0=0,pc;const Yw="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=",zw={id:"checkImageBitmap",code:`
868
868
  async function checkImageBitmap()
869
869
  {
870
870
  try
@@ -919,8 +919,8 @@ ${u}`)}});return await Promise.all(h),n?s[o[0].src]:s}async unload(t){const e=ii
919
919
  id: event.data.id,
920
920
  });
921
921
  }
922
- };`};let mc;class Jw{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([zw.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(){pc===void 0&&(pc=navigator.hardwareConcurrency||4);let t=this.workerPool.pop();return!t&&this._createdWorkers<pc&&(mc||(mc=URL.createObjectURL(new Blob([jw.code],{type:"application/javascript"}))),this._createdWorkers++,t=new Worker(mc),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[v0]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:v0++,id:i})}}const w0=new Jw;function On(r,t,e){r.resource.internal=!0;const i=new rt(r),s=()=>{delete t.promiseCache[e],Jr.has(e)&&Jr.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 $w=[".jpeg",".jpg",".png",".webp",".avif"],Qw=["image/jpeg","image/png","image/webp","image/avif"];async function qw(r){const t=await Q.ADAPTER.fetch(r);if(!t.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${t.status} ${t.statusText}`);const e=await t.blob();return await createImageBitmap(e)}const pa={name:"loadTextures",extension:{type:z.LoadParser,priority:ri.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return Bs(r,Qw)||fr(r,$w)},async load(r,t,e){var a;const i=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;let s;i?this.config.preferWorkers&&await w0.isImageBitmapSupported()?s=await w0.loadImageBitmap(r):s=await qw(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=Wi(r)),i&&((a=n.resourceOptions)==null?void 0:a.ownsImageBitmap)===void 0&&(n.resourceOptions={...n.resourceOptions},n.resourceOptions.ownsImageBitmap=!0);const o=new dt(s,n);return o.resource.src=r,On(o,e,r)},unload(r){r.destroy(!0)}};it.add(pa);const t2=".svg",e2="image/svg+xml",i2={extension:{type:z.LoadParser,priority:ri.High},name:"loadSVG",test(r){return Bs(r,e2)||fr(r,t2)},async testParse(r){return oc.test(r)},async parse(r,t,e){var n;const i=new oc(r,(n=t==null?void 0:t.data)==null?void 0:n.resourceOptions);await i.load();const s=new dt(i,{resolution:Wi(r),...t==null?void 0:t.data});return s.resource.src=t.src,On(s,e,t.src)},async load(r,t){return(await Q.ADAPTER.fetch(r)).text()},unload:pa.unload};it.add(i2);const r2=[".mp4",".m4v",".webm",".ogv"],s2=["video/mp4","video/webm","video/ogg"],n2={name:"loadVideo",extension:{type:z.LoadParser,priority:ri.High},config:{defaultAutoPlay:!0},test(r){return Bs(r,s2)||fr(r,r2)},async load(r,t,e){var o;let i;const s=await(await Q.ADAPTER.fetch(r)).blob(),n=URL.createObjectURL(s);try{const a={autoPlay:this.config.defaultAutoPlay,...(o=t==null?void 0:t.data)==null?void 0:o.resourceOptions},h=new h0(n,a);await h.load();const l=new dt(h,{alphaMode:await d_(),resolution:Wi(r),...t==null?void 0:t.data});l.resource.src=r,i=On(l,e,r),i.baseTexture.once("destroyed",()=>{URL.revokeObjectURL(n)})}catch(a){throw URL.revokeObjectURL(n),a}return i},unload(r){r.destroy(!0)}};it.add(n2);class o2{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 ii(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"?(pt("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`)},ii(o).forEach(h=>{const{src:l,srcs:c}=h;let{data:u,format:d,loadParser:f}=h;const p=ii(l||c).map(y=>typeof y=="string"?Rw(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 _=0;_<this._parsers.length;_++){const v=this._parsers[_];if(v.test(x)){b=v.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=fa(t);t=ii(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=fa(t);t=ii(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=Jt.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??Jt.extname(t.src).slice(1),t.srcs=t.src,t.name=t.alias,t}}class a2{constructor(){this._detections=[],this._initialized=!1,this.resolver=new o2,this.loader=new Lw,this.cache=Jr,this._backgroundLoader=new Mw(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=fa(t),s=ii(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 Jr.get(t);const e={};for(let i=0;i<t.length;i++)e[i]=Jr.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,Jr.set(c,l)}),o}async unload(t){this._initialized||await this.init();const e=ii(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=ii(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=>{Jr.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 pa.config.preferWorkers}set preferWorkers(t){pt("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 ma=new a2;it.handleByList(z.LoadParser,ma.loader.parsers).handleByList(z.ResolveParser,ma.resolver.parsers).handleByList(z.CacheParser,ma.cache.parsers).handleByList(z.DetectionParser,ma.detections);const h2={extension:z.CacheParser,test:r=>Array.isArray(r)&&r.every(t=>t instanceof rt),getCacheableAssets:(r,t)=>{const e={};return r.forEach(i=>{t.forEach((s,n)=>{e[i+(n===0?"":n+1)]=s})}),e}};it.add(h2);async function T0(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 l2={extension:{type:z.DetectionParser,priority:1},test:async()=>T0("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(t=>t!=="avif")};it.add(l2);const c2={extension:{type:z.DetectionParser,priority:0},test:async()=>T0("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(t=>t!=="webp")};it.add(c2);const S0=["png","jpg","jpeg"],u2={extension:{type:z.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...S0],remove:async r=>r.filter(t=>!S0.includes(t))};it.add(u2);const d2="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function gc(r){return d2?!1:document.createElement("video").canPlayType(r)!==""}const f2={extension:{type:z.DetectionParser,priority:0},test:async()=>gc("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(t=>t!=="webm")};it.add(f2);const p2={extension:{type:z.DetectionParser,priority:0},test:async()=>gc("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(t=>t!=="mp4"&&t!=="m4v")};it.add(p2);const m2={extension:{type:z.DetectionParser,priority:0},test:async()=>gc("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(t=>t!=="ogv")};it.add(m2);const g2={extension:z.ResolveParser,test:pa.test,parse:r=>{var t;return{resolution:parseFloat(((t=Q.RETINA_PREFIX.exec(r))==null?void 0:t[1])??"1"),format:Jt.extname(r).slice(1),src:r}}};it.add(g2);var Ae=(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))(Ae||{});const ga={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 Hi,Xs;function C0(){Xs={s3tc:Hi.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:Hi.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:Hi.getExtension("WEBGL_compressed_texture_etc"),etc1:Hi.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:Hi.getExtension("WEBGL_compressed_texture_pvrtc")||Hi.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:Hi.getExtension("WEBGL_compressed_texture_atc"),astc:Hi.getExtension("WEBGL_compressed_texture_astc")}}const y2={extension:{type:z.DetectionParser,priority:2},test:async()=>{const r=Q.ADAPTER.createCanvas().getContext("webgl");return r?(Hi=r,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async r=>{Xs||C0();const t=[];for(const e in Xs)Xs[e]&&t.push(e);return[...t,...r]},remove:async r=>(Xs||C0(),r.filter(t=>!(t in Xs)))};it.add(y2);class b2 extends Vo{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 kl(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 kl(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this)),this._load)}}class $r extends b2{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=$r._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||$r._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=$r._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*ga[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*ga[e];return h}}const yc=4,ya=124,x2=32,E0=20,_2=542327876,ba={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},v2={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},xa={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},w2=1,T2=2,S2=4,C2=64,E2=512,I2=131072,A2=827611204,M2=861165636,R2=894720068,P2=808540228,L2=4,G2={[A2]:Ae.COMPRESSED_RGBA_S3TC_DXT1_EXT,[M2]:Ae.COMPRESSED_RGBA_S3TC_DXT3_EXT,[R2]:Ae.COMPRESSED_RGBA_S3TC_DXT5_EXT},k2={70:Ae.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:Ae.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:Ae.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:Ae.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:Ae.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:Ae.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:Ae.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:Ae.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:Ae.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT};function F2(r){const t=new Uint32Array(r);if(t[0]!==_2)throw new Error("Invalid DDS file magic word");const e=new Uint32Array(r,0,ya/Uint32Array.BYTES_PER_ELEMENT),i=e[ba.HEIGHT],s=e[ba.WIDTH],n=e[ba.MIPMAP_COUNT],o=new Uint32Array(r,ba.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,x2/Uint32Array.BYTES_PER_ELEMENT),a=o[w2];if(a&S2){const h=o[v2.FOURCC];if(h!==P2){const x=G2[h],b=yc+ya,_=new Uint8Array(r,b);return[new $r(_,{format:x,width:s,height:i,levels:n})]}const l=yc+ya,c=new Uint32Array(t.buffer,l,E0/Uint32Array.BYTES_PER_ELEMENT),u=c[xa.DXGI_FORMAT],d=c[xa.RESOURCE_DIMENSION],f=c[xa.MISC_FLAG],p=c[xa.ARRAY_SIZE],m=k2[u];if(m===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${u}`);if(f===L2)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=yc+ya+E0;if(p===1)g.push(new Uint8Array(r,y));else{const x=ga[m];let b=0,_=s,v=i;for(let C=0;C<n;C++){const E=Math.max(1,_+3&-4),I=Math.max(1,v+3&-4),k=E*I*x;b+=k,_=_>>>1,v=v>>>1}let T=y;for(let C=0;C<p;C++)g.push(new Uint8Array(r,T,b)),T+=b}return g.map(x=>new $r(x,{format:m,width:s,height:i,levels:n}))}throw a&C2?new Error("DDSParser does not support uncompressed texture data."):a&E2?new Error("DDSParser does not supported YUV uncompressed texture data."):a&I2?new Error("DDSParser does not support single-channel (lumninance) texture data!"):a&T2?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 I0=[171,75,84,88,32,49,49,187,13,10,26,10],N2=67305985,si={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},bc=64,A0={[ot.UNSIGNED_BYTE]:1,[ot.UNSIGNED_SHORT]:2,[ot.INT]:4,[ot.UNSIGNED_INT]:4,[ot.FLOAT]:4,[ot.HALF_FLOAT]:8},D2={[W.RGBA]:4,[W.RGB]:3,[W.RG]:2,[W.RED]:1,[W.LUMINANCE]:1,[W.LUMINANCE_ALPHA]:2,[W.ALPHA]:1},O2={[ot.UNSIGNED_SHORT_4_4_4_4]:2,[ot.UNSIGNED_SHORT_5_5_5_1]:2,[ot.UNSIGNED_SHORT_5_6_5]:2};function U2(r,t,e=!1){const i=new DataView(t);if(!B2(r,i))return null;const s=i.getUint32(si.ENDIANNESS,!0)===N2,n=i.getUint32(si.GL_TYPE,s),o=i.getUint32(si.GL_FORMAT,s),a=i.getUint32(si.GL_INTERNAL_FORMAT,s),h=i.getUint32(si.PIXEL_WIDTH,s),l=i.getUint32(si.PIXEL_HEIGHT,s)||1,c=i.getUint32(si.PIXEL_DEPTH,s)||1,u=i.getUint32(si.NUMBER_OF_ARRAY_ELEMENTS,s)||1,d=i.getUint32(si.NUMBER_OF_FACES,s),f=i.getUint32(si.NUMBER_OF_MIPMAP_LEVELS,s),p=i.getUint32(si.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 _=h*l;n===0&&(_=y*x);let v;if(n!==0?A0[n]?v=A0[n]*D2[o]:v=O2[n]:v=ga[a],v===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const T=e?W2(i,p,s):null;let C=_*v,E=h,I=l,k=y,L=x,P=bc+p;for(let S=0;S<f;S++){const R=i.getUint32(P,s);let F=P+4;for(let O=0;O<u;O++){let B=b[O];B||(B=b[O]=new Array(f)),B[S]={levelID:S,levelWidth:f>1||n!==0?E:k,levelHeight:f>1||n!==0?I:L,levelBuffer:new Uint8Array(t,F,C)},F+=C}P+=R+4,P=P%4!==0?P+4-P%4:P,E=E>>1||1,I=I>>1||1,k=E+m-1&~(m-1),L=I+g-1&~(g-1),C=k*L*v}return n!==0?{uncompressed:b.map(S=>{let R=S[0].levelBuffer,F=!1;return n===ot.FLOAT?R=new Float32Array(S[0].levelBuffer.buffer,S[0].levelBuffer.byteOffset,S[0].levelBuffer.byteLength/4):n===ot.UNSIGNED_INT?(F=!0,R=new Uint32Array(S[0].levelBuffer.buffer,S[0].levelBuffer.byteOffset,S[0].levelBuffer.byteLength/4)):n===ot.INT&&(F=!0,R=new Int32Array(S[0].levelBuffer.buffer,S[0].levelBuffer.byteOffset,S[0].levelBuffer.byteLength/4)),{resource:new Vo(R,{width:S[0].levelWidth,height:S[0].levelHeight}),type:n,format:F?X2(o):o}}),kvData:T}:{compressed:b.map(S=>new $r(null,{format:a,width:h,height:l,levels:f,levelBuffers:S})),kvData:T}}function B2(r,t){for(let e=0;e<I0.length;e++)if(t.getUint8(e)!==I0[e])return console.error(`${r} is not a valid *.ktx file!`),!1;return!0}function X2(r){switch(r){case W.RGBA:return W.RGBA_INTEGER;case W.RGB:return W.RGB_INTEGER;case W.RG:return W.RG_INTEGER;case W.RED:return W.RED_INTEGER;default:return r}}function W2(r,t,e){const i=new Map;let s=0;for(;s<t;){const n=r.getUint32(bc+s,e),o=bc+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 Z2={extension:{type:z.LoadParser,priority:ri.High},name:"loadDDS",test(r){return fr(r,".dds")},async load(r,t,e){const i=await(await Q.ADAPTER.fetch(r)).arrayBuffer(),s=F2(i).map(n=>{const o=new dt(n,{mipmap:di.OFF,alphaMode:ye.NO_PREMULTIPLIED_ALPHA,resolution:Wi(r),...t.data});return On(o,e,r)});return s.length===1?s[0]:s},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};it.add(Z2);const V2={extension:{type:z.LoadParser,priority:ri.High},name:"loadKTX",test(r){return fr(r,".ktx")},async load(r,t,e){const i=await(await Q.ADAPTER.fetch(r)).arrayBuffer(),{compressed:s,uncompressed:n,kvData:o}=U2(r,i),a=s??n,h={mipmap:di.OFF,alphaMode:ye.NO_PREMULTIPLIED_ALPHA,resolution:Wi(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 dt(u,h);return d.ktxKeyValueData=o,On(d,e,r)});return l.length===1?l[0]:l},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};it.add(V2);const H2={extension:z.ResolveParser,test:r=>{const t=Jt.extname(r).slice(1);return["basis","ktx","dds"].includes(t)},parse:r=>{var e,i;const t=Jt.extname(r).slice(1);if(t==="ktx"){const s=[".s3tc.ktx",".s3tc_sRGB.ktx",".etc.ktx",".etc1.ktx",".pvrt.ktx",".atc.ktx",".astc.ktx"];if(s.some(n=>r.endsWith(n)))return{resolution:parseFloat(((e=Q.RETINA_PREFIX.exec(r))==null?void 0:e[1])??"1"),format:s.find(n=>r.endsWith(n)),src:r}}return{resolution:parseFloat(((i=Q.RETINA_PREFIX.exec(r))==null?void 0:i[1])??"1"),format:t,src:r}}};it.add(H2);const _a=new ct,K2=4,M0=class So{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&&So._flipY(i,s,n),a&&So._unpremultiplyAlpha(i);const h=new A_(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&&So._flipY(i,s,n),a&&So._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 Kr?a=t:(a=i.generateTexture(t,{region:e,resolution:i.resolution,multisample:i.multisample}),h=!0,e&&(_a.width=e.width,_a.height=e.height,e=_a)));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===W.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=_a,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(K2*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}}}};M0.extension={name:"extract",type:z.RendererSystem};let Y2=M0;it.add(Y2);const va={build(r){const t=r.points;let e,i,s,n,o,a;if(r.type===oe.CIRC){const p=r.shape;e=p.x,i=p.y,o=a=p.radius,s=n=0}else if(r.type===oe.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,_=i+y,v=i-y;t[c++]=x,t[c++]=_,t[--u]=_,t[--u]=b,t[d++]=b,t[d++]=v,t[--f]=v,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!==oe.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 R0(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 P0={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){R0(e,!1);const o=[];for(let l=0;l<i.length;l++){const c=i[l];R0(c.points,!0),o.push(e.length/2),e=e.concat(c.points)}const a=sb(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])}}},z2={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)}},j2={build(r){va.build(r)},triangulate(r,t){va.triangulate(r,t)}};var Be=(r=>(r.MITER="miter",r.BEVEL="bevel",r.ROUND="round",r))(Be||{}),pr=(r=>(r.BUTT="butt",r.ROUND="round",r.SQUARE="square",r))(pr||{});const Ws={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 L0{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,_=g*u+y*l,v=g*c+y*h,T=l*(y+x),C=h*(y+x),E=u*(g+b),I=c*(g+b),k=Math.atan2(C-v,T-_),L=Math.atan2(I-v,E-_);return{cx:_+t,cy:v+e,radius:n,startAngle:k,endAngle:L,anticlockwise:l*c>u*h}}static arc(t,e,i,s,n,o,a,h,l){const c=a-o,u=Ws._segmentsCount(Math.abs(c)*n,Math.ceil(Math.abs(c)/Ko)*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,_=d+o+f*b,v=Math.cos(_),T=-Math.sin(_);l.push((p*v+m*T)*n+i,(p*-T+m*v)*n+s)}}}class J2{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 xc{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,_=t,v=e;for(let T=1;T<=10;++T)c=T/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=_-g,b=v-y,_=g,v=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=Ws._segmentsCount(xc.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 G0(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 Qr(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 $2(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 at(i[0],i[1]),a=new at(i[i.length-2],i[i.length-1]),h=e.type!==oe.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 B=(o.x+a.x)*.5,Z=(a.y+o.y)*.5;i.unshift(B,Z),i.push(B,Z)}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],_=i[3],v=0,T=0,C=-(x-_),E=y-b,I=0,k=0,L=Math.sqrt(C*C+E*E);C/=L,E/=L,C*=p,E*=p;const P=n.alignment,S=(1-P)*2,R=P*2;h||(n.cap===pr.ROUND?d+=Qr(y-C*(S-R)*.5,x-E*(S-R)*.5,y-C*S,x-E*S,y+C*R,x+E*R,c,!0)+2:n.cap===pr.SQUARE&&(d+=G0(y,x,C,E,S,R,!0,c))),c.push(y-C*S,x-E*S,y+C*R,x+E*R);for(let B=1;B<u-1;++B){y=i[(B-1)*2],x=i[(B-1)*2+1],b=i[B*2],_=i[B*2+1],v=i[(B+1)*2],T=i[(B+1)*2+1],C=-(x-_),E=y-b,L=Math.sqrt(C*C+E*E),C/=L,E/=L,C*=p,E*=p,I=-(_-T),k=b-v,L=Math.sqrt(I*I+k*k),I/=L,k/=L,I*=p,k*=p;const Z=b-y,st=x-_,X=b-v,M=T-_,D=Z*X+st*M,V=st*X-M*Z,J=V<0;if(Math.abs(V)<.001*Math.abs(D)){c.push(b-C*S,_-E*S,b+C*R,_+E*R),D>=0&&(n.join===Be.ROUND?d+=Qr(b,_,b-C*S,_-E*S,b-I*S,_-k*S,c,!1)+4:d+=2,c.push(b-I*R,_-k*R,b+I*S,_+k*S));continue}const j=(-C+y)*(-E+_)-(-C+b)*(-E+x),mt=(-I+v)*(-k+_)-(-I+b)*(-k+T),Tt=(Z*mt-X*j)/V,bt=(M*j-st*mt)/V,N=(Tt-b)*(Tt-b)+(bt-_)*(bt-_),Y=b+(Tt-b)*S,H=_+(bt-_)*S,G=b-(Tt-b)*R,ut=_-(bt-_)*R,ht=Math.min(Z*Z+st*st,X*X+M*M),wt=J?S:R,Rt=ht+wt*wt*m,Fe=N<=Rt;let Gi=n.join;if(Gi===Be.MITER&&N/m>g&&(Gi=Be.BEVEL),Fe)switch(Gi){case Be.MITER:{c.push(Y,H,G,ut);break}case Be.BEVEL:{J?c.push(Y,H,b+C*R,_+E*R,Y,H,b+I*R,_+k*R):c.push(b-C*S,_-E*S,G,ut,b-I*S,_-k*S,G,ut),d+=2;break}case Be.ROUND:{J?(c.push(Y,H,b+C*R,_+E*R),d+=Qr(b,_,b+C*R,_+E*R,b+I*R,_+k*R,c,!0)+4,c.push(Y,H,b+I*R,_+k*R)):(c.push(b-C*S,_-E*S,G,ut),d+=Qr(b,_,b-C*S,_-E*S,b-I*S,_-k*S,c,!1)+4,c.push(b-I*S,_-k*S,G,ut));break}}else{switch(c.push(b-C*S,_-E*S,b+C*R,_+E*R),Gi){case Be.MITER:{J?c.push(G,ut,G,ut):c.push(Y,H,Y,H),d+=2;break}case Be.ROUND:{J?d+=Qr(b,_,b+C*R,_+E*R,b+I*R,_+k*R,c,!0)+2:d+=Qr(b,_,b-C*S,_-E*S,b-I*S,_-k*S,c,!1)+2;break}}c.push(b-I*S,_-k*S,b+I*R,_+k*R),d+=2}}y=i[(u-2)*2],x=i[(u-2)*2+1],b=i[(u-1)*2],_=i[(u-1)*2+1],C=-(x-_),E=y-b,L=Math.sqrt(C*C+E*E),C/=L,E/=L,C*=p,E*=p,c.push(b-C*S,_-E*S,b+C*R,_+E*R),h||(n.cap===pr.ROUND?d+=Qr(b-C*(S-R)*.5,_-E*(S-R)*.5,b-C*S,_-E*S,b+C*R,_+E*R,c,!1)+2:n.cap===pr.SQUARE&&(d+=G0(b,_,C,E,S,R,!1,c)));const F=t.indices,O=Ws.epsilon*Ws.epsilon;for(let B=f;B<d+f-2;++B)y=c[B*2],x=c[B*2+1],b=c[(B+1)*2],_=c[(B+1)*2+1],v=c[(B+2)*2],T=c[(B+2)*2+1],!(Math.abs(y*(_-T)+b*(T-x)+v*(x-_))<O)&&F.push(B,B+1,B+2)}function Q2(r,t){let e=0;const i=r.shape,s=r.points||i.points,n=i.type!==oe.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 k0(r,t){r.lineStyle.native?Q2(r,t):$2(r,t)}class _c{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=Ws._segmentsCount(_c.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 vc={[oe.POLY]:P0,[oe.CIRC]:va,[oe.ELIP]:va,[oe.RECT]:z2,[oe.RREC]:j2},F0=[],wa=[];class Ta{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 Ta(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 Zs=new at,N0=class A1 extends mp{constructor(){super(),this.closePointEps=1e-4,this.boundsPadding=0,this.uvsFloat32=null,this.indicesUint16=null,this.batchable=!1,this.points=[],this.colors=[],this.uvs=[],this.indices=[],this.textureIds=[],this.graphicsData=[],this.drawCalls=[],this.batchDirty=-1,this.batches=[],this.dirty=0,this.cacheDirty=-1,this.clearDirty=0,this.shapeIndex=0,this._bounds=new ca,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(),wa.push(this.drawCalls[t]);this.drawCalls.length=0;for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e.reset(),F0.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 Ta(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 Ta(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,Zs):Zs.copyFrom(t),s.shape.contains(Zs.x,Zs.y))){let n=!1;if(s.holes){for(let o=0;o<s.holes.length;o++)if(s.holes[o].shape.contains(Zs.x,Zs.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;vc[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=ui.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=F0.pop()||new J2,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<A1.BATCHABLE_SIZE*2}buildDrawCalls(){let t=++dt._globalBatch;for(let u=0;u<this.drawCalls.length;u++)this.drawCalls[u].texArray.clear(),wa.push(this.drawCalls[u]);this.drawCalls.length=0;const e=this.colors,i=this.textureIds;let s=wa.pop();s||(s=new Zl,s.texArray=new Jl),s.texArray.count=0,s.start=0,s.size=0,s.type=ci.TRIANGLES;let n=0,o=null,a=0,h=!1,l=ci.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?ci.LINES:ci.TRIANGLES,o=null,n=f,t++),o!==m&&(o=m,m._batchEnabled!==t&&(n===f&&(t++,n=0,s.size>0&&(s=wa.pop(),s||(s=new Zl,s.texArray=new Jl),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=ui.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)}dt._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?P0.triangulate(t,this):vc[t.type].triangulate(t,this)}processLine(t){k0(t,this);for(let e=0;e<t.holes.length;e++)k0(t.holes[e],this)}processHoles(t){for(let e=0;e<t.length;e++){const i=t[e];vc[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=Et.shared.setValue(e).toLittleEndianNumber(),a=Et.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}};N0.BATCHABLE_SIZE=100;let q2=N0;class Sa{constructor(){this.color=16777215,this.alpha=1,this.texture=rt.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){const t=new Sa;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t}reset(){this.color=16777215,this.alpha=1,this.texture=rt.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}class wc extends Sa{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=pr.BUTT,this.join=Be.MITER,this.miterLimit=10}clone(){const t=new wc;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=pr.BUTT,this.join=Be.MITER,this.miterLimit=10}}const Tc={},Sc=class Ph extends yt{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 Sa,this._lineStyle=new wc,this._matrix=null,this._holeMode=!1,this.state=xi.for2d(),this._geometry=t||new q2,this._geometry.refCount++,this._transformID=-1,this._tintColor=new Et(16777215),this.blendMode=lt.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new Ph(this._geometry)}set blendMode(t){this.state.blendMode=t}get blendMode(){return this.state.blendMode}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t)}get fill(){return this._fillStyle}get line(){return this._lineStyle}lineStyle(t=null,e=0,i,s=.5,n=!1){return typeof t=="number"&&(t={width:t,color:e,alpha:i,alignment:s,native:n}),this.lineTextureStyle(t)}lineTextureStyle(t){const e={width:0,texture:rt.WHITE,color:t!=null&&t.texture?16777215:0,matrix:null,alignment:.5,native:!1,cap:pr.BUTT,join:Be.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 Br,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new Br,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),_c.curveTo(t,e,i,s,n),this}bezierCurveTo(t,e,i,s,n,o){return this._initCurve(),xc.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=L0.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+=Ko:o&&s<=n&&(s+=Ko),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 L0.arc(a,h,t,e,i,s,n,o,c),this}beginFill(t=0,e){return this.beginTextureFill({texture:rt.WHITE,color:t,alpha:e})}normalizeColor(t){const e=Et.shared.setValue(t.color??0);t.color=e.toNumber(),t.alpha??(t.alpha=e.alpha)}beginTextureFill(t){const e={texture:rt.WHITE,color:16777215,matrix:null};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();const i=t.alpha>0;return i?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:i},t)):this._fillStyle.reset(),this}endFill(){return this.finishPoly(),this._fillStyle.reset(),this}drawRect(t,e,i,s){return this.drawShape(new ct(t,e,i,s))}drawRoundedRect(t,e,i,s,n){return this.drawShape(new Jo(t,e,i,s,n))}drawCircle(t,e,i){return this.drawShape(new zo(t,e,i))}drawEllipse(t,e,i,s){return this.drawShape(new jo(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 Br(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===oe.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:Et.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,Et.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(!Tc[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 It,default:ti.from({uSamplers:n},!0)},a=t.plugins[i]._shader.program;Tc[i]=new _i(a,o)}e=Tc[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,Ph._TEMP_POINT),this._geometry.containsPoint(Ph._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=Et.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)}};Sc.curves=Ws,Sc._TEMP_POINT=new at;let mr=Sc;class tT{constructor(t,e){this.uvBuffer=t,this.uvMatrix=e,this.data=null,this._bufferUpdateId=-1,this._textureUpdateId=-1,this._updateID=0}update(t){if(!t&&this._bufferUpdateId===this.uvBuffer._updateID&&this._textureUpdateId===this.uvMatrix._updateID)return;this._bufferUpdateId=this.uvBuffer._updateID,this._textureUpdateId=this.uvMatrix._updateID;const e=this.uvBuffer.data;(!this.data||this.data.length!==e.length)&&(this.data=new Float32Array(e.length)),this.uvMatrix.multiplyUvs(e,this.data),this._updateID++}}const Cc=new at,D0=new Br,O0=class M1 extends yt{constructor(t,e,i,s=ci.TRIANGLES){super(),this.geometry=t,this.shader=e,this.state=i||xi.for2d(),this.drawMode=s,this.start=0,this.size=0,this.uvs=null,this.indices=null,this.vertexData=new Float32Array(1),this.vertexDirty=-1,this._transformID=-1,this._roundPixels=Q.ROUND_PIXELS,this.batchUvs=null}get geometry(){return this._geometry}set geometry(t){this._geometry!==t&&(this._geometry&&(this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose()),this._geometry=t,this._geometry&&this._geometry.refCount++,this.vertexDirty=-1)}get uvBuffer(){return this.geometry.buffers[1]}get verticesBuffer(){return this.geometry.buffers[0]}set material(t){this.shader=t}get material(){return this.shader}set blendMode(t){this.state.blendMode=t}get blendMode(){return this.state.blendMode}set roundPixels(t){this._roundPixels!==t&&(this._transformID=-1),this._roundPixels=t}get roundPixels(){return this._roundPixels}get tint(){return"tint"in this.shader?this.shader.tint:null}set tint(t){this.shader.tint=t}get tintValue(){return this.shader.tintValue}get texture(){return"texture"in this.shader?this.shader.texture:null}set texture(t){this.shader.texture=t}_render(t){const e=this.geometry.buffers[0].data;this.shader.batchable&&this.drawMode===ci.TRIANGLES&&e.length<M1.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=Q.RESOLUTION;for(let f=0;f<u.length;++f)u[f]=Math.round(u[f]*d)/d}this.vertexDirty=i}calculateUvs(){const t=this.geometry.buffers[1],e=this.shader;e.uvMatrix.isSimple?this.uvs=t.data:(this.batchUvs||(this.batchUvs=new tT(t,e.uvMatrix)),this.batchUvs.update(),this.uvs=this.batchUvs.data)}_calculateBounds(){this.calculateVertices(),this._bounds.addVertexData(this.vertexData,0,this.vertexData.length)}containsPoint(t){if(!this.getBounds().contains(t.x,t.y))return!1;this.worldTransform.applyInverse(t,Cc);const e=this.geometry.getBuffer("aVertexPosition").data,i=D0.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],D0.contains(Cc.x,Cc.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}};O0.BATCHABLE_SIZE=100;let Ec=O0;class U0 extends cr{constructor(t,e,i){super();const s=new Xt(t),n=new Xt(e,!0),o=new Xt(i,!0,!0);this.addAttribute("aVertexPosition",s,2,!1,ot.FLOAT).addAttribute("aTextureCoord",n,2,!1,ot.FLOAT).addIndex(o),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}var eT=`varying vec2 vTextureCoord;
922
+ };`};let mc;class Jw{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([zw.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(){pc===void 0&&(pc=navigator.hardwareConcurrency||4);let t=this.workerPool.pop();return!t&&this._createdWorkers<pc&&(mc||(mc=URL.createObjectURL(new Blob([jw.code],{type:"application/javascript"}))),this._createdWorkers++,t=new Worker(mc),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[v0]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:v0++,id:i})}}const w0=new Jw;function On(r,t,e){r.resource.internal=!0;const i=new rt(r),s=()=>{delete t.promiseCache[e],Jr.has(e)&&Jr.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 $w=[".jpeg",".jpg",".png",".webp",".avif"],Qw=["image/jpeg","image/png","image/webp","image/avif"];async function qw(r){const t=await $.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 pa={name:"loadTextures",extension:{type:z.LoadParser,priority:ri.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return Us(r,Qw)||fr(r,$w)},async load(r,t,e){var a;const i=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;let s;i?this.config.preferWorkers&&await w0.isImageBitmapSupported()?s=await w0.loadImageBitmap(r):s=await qw(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=Wi(r)),i&&((a=n.resourceOptions)==null?void 0:a.ownsImageBitmap)===void 0&&(n.resourceOptions={...n.resourceOptions},n.resourceOptions.ownsImageBitmap=!0);const o=new dt(s,n);return o.resource.src=r,On(o,e,r)},unload(r){r.destroy(!0)}};it.add(pa);const t2=".svg",e2="image/svg+xml",i2={extension:{type:z.LoadParser,priority:ri.High},name:"loadSVG",test(r){return Us(r,e2)||fr(r,t2)},async testParse(r){return oc.test(r)},async parse(r,t,e){var n;const i=new oc(r,(n=t==null?void 0:t.data)==null?void 0:n.resourceOptions);await i.load();const s=new dt(i,{resolution:Wi(r),...t==null?void 0:t.data});return s.resource.src=t.src,On(s,e,t.src)},async load(r,t){return(await $.ADAPTER.fetch(r)).text()},unload:pa.unload};it.add(i2);const r2=[".mp4",".m4v",".webm",".ogv"],s2=["video/mp4","video/webm","video/ogg"],n2={name:"loadVideo",extension:{type:z.LoadParser,priority:ri.High},config:{defaultAutoPlay:!0},test(r){return Us(r,s2)||fr(r,r2)},async load(r,t,e){var o;let i;const s=await(await $.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 h0(n,a);await h.load();const l=new dt(h,{alphaMode:await d_(),resolution:Wi(r),...t==null?void 0:t.data});l.resource.src=r,i=On(l,e,r),i.baseTexture.once("destroyed",()=>{URL.revokeObjectURL(n)})}catch(a){throw URL.revokeObjectURL(n),a}return i},unload(r){r.destroy(!0)}};it.add(n2);class o2{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 ii(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"?(pt("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`)},ii(o).forEach(h=>{const{src:l,srcs:c}=h;let{data:u,format:d,loadParser:f}=h;const p=ii(l||c).map(y=>typeof y=="string"?Rw(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 _=0;_<this._parsers.length;_++){const v=this._parsers[_];if(v.test(x)){b=v.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=fa(t);t=ii(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=fa(t);t=ii(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=Jt.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??Jt.extname(t.src).slice(1),t.srcs=t.src,t.name=t.alias,t}}class a2{constructor(){this._detections=[],this._initialized=!1,this.resolver=new o2,this.loader=new Lw,this.cache=Jr,this._backgroundLoader=new Mw(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=fa(t),s=ii(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 Jr.get(t);const e={};for(let i=0;i<t.length;i++)e[i]=Jr.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,Jr.set(c,l)}),o}async unload(t){this._initialized||await this.init();const e=ii(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=ii(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=>{Jr.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 pa.config.preferWorkers}set preferWorkers(t){pt("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 ma=new a2;it.handleByList(z.LoadParser,ma.loader.parsers).handleByList(z.ResolveParser,ma.resolver.parsers).handleByList(z.CacheParser,ma.cache.parsers).handleByList(z.DetectionParser,ma.detections);const h2={extension:z.CacheParser,test:r=>Array.isArray(r)&&r.every(t=>t instanceof rt),getCacheableAssets:(r,t)=>{const e={};return r.forEach(i=>{t.forEach((s,n)=>{e[i+(n===0?"":n+1)]=s})}),e}};it.add(h2);async function T0(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 l2={extension:{type:z.DetectionParser,priority:1},test:async()=>T0("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(t=>t!=="avif")};it.add(l2);const c2={extension:{type:z.DetectionParser,priority:0},test:async()=>T0("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(t=>t!=="webp")};it.add(c2);const S0=["png","jpg","jpeg"],u2={extension:{type:z.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...S0],remove:async r=>r.filter(t=>!S0.includes(t))};it.add(u2);const d2="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function gc(r){return d2?!1:document.createElement("video").canPlayType(r)!==""}const f2={extension:{type:z.DetectionParser,priority:0},test:async()=>gc("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(t=>t!=="webm")};it.add(f2);const p2={extension:{type:z.DetectionParser,priority:0},test:async()=>gc("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(t=>t!=="mp4"&&t!=="m4v")};it.add(p2);const m2={extension:{type:z.DetectionParser,priority:0},test:async()=>gc("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(t=>t!=="ogv")};it.add(m2);const g2={extension:z.ResolveParser,test:pa.test,parse:r=>{var t;return{resolution:parseFloat(((t=$.RETINA_PREFIX.exec(r))==null?void 0:t[1])??"1"),format:Jt.extname(r).slice(1),src:r}}};it.add(g2);var Ae=(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))(Ae||{});const ga={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 Hi,Xs;function C0(){Xs={s3tc:Hi.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:Hi.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:Hi.getExtension("WEBGL_compressed_texture_etc"),etc1:Hi.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:Hi.getExtension("WEBGL_compressed_texture_pvrtc")||Hi.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:Hi.getExtension("WEBGL_compressed_texture_atc"),astc:Hi.getExtension("WEBGL_compressed_texture_astc")}}const y2={extension:{type:z.DetectionParser,priority:2},test:async()=>{const r=$.ADAPTER.createCanvas().getContext("webgl");return r?(Hi=r,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async r=>{Xs||C0();const t=[];for(const e in Xs)Xs[e]&&t.push(e);return[...t,...r]},remove:async r=>(Xs||C0(),r.filter(t=>!(t in Xs)))};it.add(y2);class b2 extends Vo{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 kl(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 kl(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this)),this._load)}}class $r extends b2{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=$r._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||$r._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=$r._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*ga[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*ga[e];return h}}const yc=4,ya=124,x2=32,E0=20,_2=542327876,ba={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},v2={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},xa={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},w2=1,T2=2,S2=4,C2=64,E2=512,I2=131072,A2=827611204,M2=861165636,R2=894720068,P2=808540228,L2=4,G2={[A2]:Ae.COMPRESSED_RGBA_S3TC_DXT1_EXT,[M2]:Ae.COMPRESSED_RGBA_S3TC_DXT3_EXT,[R2]:Ae.COMPRESSED_RGBA_S3TC_DXT5_EXT},k2={70:Ae.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:Ae.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:Ae.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:Ae.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:Ae.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:Ae.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:Ae.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:Ae.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:Ae.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT};function F2(r){const t=new Uint32Array(r);if(t[0]!==_2)throw new Error("Invalid DDS file magic word");const e=new Uint32Array(r,0,ya/Uint32Array.BYTES_PER_ELEMENT),i=e[ba.HEIGHT],s=e[ba.WIDTH],n=e[ba.MIPMAP_COUNT],o=new Uint32Array(r,ba.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,x2/Uint32Array.BYTES_PER_ELEMENT),a=o[w2];if(a&S2){const h=o[v2.FOURCC];if(h!==P2){const x=G2[h],b=yc+ya,_=new Uint8Array(r,b);return[new $r(_,{format:x,width:s,height:i,levels:n})]}const l=yc+ya,c=new Uint32Array(t.buffer,l,E0/Uint32Array.BYTES_PER_ELEMENT),u=c[xa.DXGI_FORMAT],d=c[xa.RESOURCE_DIMENSION],f=c[xa.MISC_FLAG],p=c[xa.ARRAY_SIZE],m=k2[u];if(m===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${u}`);if(f===L2)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=yc+ya+E0;if(p===1)g.push(new Uint8Array(r,y));else{const x=ga[m];let b=0,_=s,v=i;for(let C=0;C<n;C++){const E=Math.max(1,_+3&-4),I=Math.max(1,v+3&-4),k=E*I*x;b+=k,_=_>>>1,v=v>>>1}let T=y;for(let C=0;C<p;C++)g.push(new Uint8Array(r,T,b)),T+=b}return g.map(x=>new $r(x,{format:m,width:s,height:i,levels:n}))}throw a&C2?new Error("DDSParser does not support uncompressed texture data."):a&E2?new Error("DDSParser does not supported YUV uncompressed texture data."):a&I2?new Error("DDSParser does not support single-channel (lumninance) texture data!"):a&T2?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 I0=[171,75,84,88,32,49,49,187,13,10,26,10],N2=67305985,si={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},bc=64,A0={[ot.UNSIGNED_BYTE]:1,[ot.UNSIGNED_SHORT]:2,[ot.INT]:4,[ot.UNSIGNED_INT]:4,[ot.FLOAT]:4,[ot.HALF_FLOAT]:8},D2={[W.RGBA]:4,[W.RGB]:3,[W.RG]:2,[W.RED]:1,[W.LUMINANCE]:1,[W.LUMINANCE_ALPHA]:2,[W.ALPHA]:1},O2={[ot.UNSIGNED_SHORT_4_4_4_4]:2,[ot.UNSIGNED_SHORT_5_5_5_1]:2,[ot.UNSIGNED_SHORT_5_6_5]:2};function B2(r,t,e=!1){const i=new DataView(t);if(!U2(r,i))return null;const s=i.getUint32(si.ENDIANNESS,!0)===N2,n=i.getUint32(si.GL_TYPE,s),o=i.getUint32(si.GL_FORMAT,s),a=i.getUint32(si.GL_INTERNAL_FORMAT,s),h=i.getUint32(si.PIXEL_WIDTH,s),l=i.getUint32(si.PIXEL_HEIGHT,s)||1,c=i.getUint32(si.PIXEL_DEPTH,s)||1,u=i.getUint32(si.NUMBER_OF_ARRAY_ELEMENTS,s)||1,d=i.getUint32(si.NUMBER_OF_FACES,s),f=i.getUint32(si.NUMBER_OF_MIPMAP_LEVELS,s),p=i.getUint32(si.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 _=h*l;n===0&&(_=y*x);let v;if(n!==0?A0[n]?v=A0[n]*D2[o]:v=O2[n]:v=ga[a],v===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const T=e?W2(i,p,s):null;let C=_*v,E=h,I=l,k=y,L=x,P=bc+p;for(let S=0;S<f;S++){const R=i.getUint32(P,s);let F=P+4;for(let O=0;O<u;O++){let U=b[O];U||(U=b[O]=new Array(f)),U[S]={levelID:S,levelWidth:f>1||n!==0?E:k,levelHeight:f>1||n!==0?I:L,levelBuffer:new Uint8Array(t,F,C)},F+=C}P+=R+4,P=P%4!==0?P+4-P%4:P,E=E>>1||1,I=I>>1||1,k=E+m-1&~(m-1),L=I+g-1&~(g-1),C=k*L*v}return n!==0?{uncompressed:b.map(S=>{let R=S[0].levelBuffer,F=!1;return n===ot.FLOAT?R=new Float32Array(S[0].levelBuffer.buffer,S[0].levelBuffer.byteOffset,S[0].levelBuffer.byteLength/4):n===ot.UNSIGNED_INT?(F=!0,R=new Uint32Array(S[0].levelBuffer.buffer,S[0].levelBuffer.byteOffset,S[0].levelBuffer.byteLength/4)):n===ot.INT&&(F=!0,R=new Int32Array(S[0].levelBuffer.buffer,S[0].levelBuffer.byteOffset,S[0].levelBuffer.byteLength/4)),{resource:new Vo(R,{width:S[0].levelWidth,height:S[0].levelHeight}),type:n,format:F?X2(o):o}}),kvData:T}:{compressed:b.map(S=>new $r(null,{format:a,width:h,height:l,levels:f,levelBuffers:S})),kvData:T}}function U2(r,t){for(let e=0;e<I0.length;e++)if(t.getUint8(e)!==I0[e])return console.error(`${r} is not a valid *.ktx file!`),!1;return!0}function X2(r){switch(r){case W.RGBA:return W.RGBA_INTEGER;case W.RGB:return W.RGB_INTEGER;case W.RG:return W.RG_INTEGER;case W.RED:return W.RED_INTEGER;default:return r}}function W2(r,t,e){const i=new Map;let s=0;for(;s<t;){const n=r.getUint32(bc+s,e),o=bc+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 Z2={extension:{type:z.LoadParser,priority:ri.High},name:"loadDDS",test(r){return fr(r,".dds")},async load(r,t,e){const i=await(await $.ADAPTER.fetch(r)).arrayBuffer(),s=F2(i).map(n=>{const o=new dt(n,{mipmap:di.OFF,alphaMode:ye.NO_PREMULTIPLIED_ALPHA,resolution:Wi(r),...t.data});return On(o,e,r)});return s.length===1?s[0]:s},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};it.add(Z2);const V2={extension:{type:z.LoadParser,priority:ri.High},name:"loadKTX",test(r){return fr(r,".ktx")},async load(r,t,e){const i=await(await $.ADAPTER.fetch(r)).arrayBuffer(),{compressed:s,uncompressed:n,kvData:o}=B2(r,i),a=s??n,h={mipmap:di.OFF,alphaMode:ye.NO_PREMULTIPLIED_ALPHA,resolution:Wi(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 dt(u,h);return d.ktxKeyValueData=o,On(d,e,r)});return l.length===1?l[0]:l},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};it.add(V2);const H2={extension:z.ResolveParser,test:r=>{const t=Jt.extname(r).slice(1);return["basis","ktx","dds"].includes(t)},parse:r=>{var e,i;const t=Jt.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=$.RETINA_PREFIX.exec(r))==null?void 0:e[1])??"1"),format:s.find(n=>r.endsWith(n)),src:r}}return{resolution:parseFloat(((i=$.RETINA_PREFIX.exec(r))==null?void 0:i[1])??"1"),format:t,src:r}}};it.add(H2);const _a=new ct,K2=4,M0=class So{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&&So._flipY(i,s,n),a&&So._unpremultiplyAlpha(i);const h=new A_(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&&So._flipY(i,s,n),a&&So._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 Kr?a=t:(a=i.generateTexture(t,{region:e,resolution:i.resolution,multisample:i.multisample}),h=!0,e&&(_a.width=e.width,_a.height=e.height,e=_a)));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===W.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=_a,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(K2*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}}}};M0.extension={name:"extract",type:z.RendererSystem};let Y2=M0;it.add(Y2);const va={build(r){const t=r.points;let e,i,s,n,o,a;if(r.type===oe.CIRC){const p=r.shape;e=p.x,i=p.y,o=a=p.radius,s=n=0}else if(r.type===oe.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,_=i+y,v=i-y;t[c++]=x,t[c++]=_,t[--u]=_,t[--u]=b,t[d++]=b,t[d++]=v,t[--f]=v,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!==oe.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 R0(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 P0={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){R0(e,!1);const o=[];for(let l=0;l<i.length;l++){const c=i[l];R0(c.points,!0),o.push(e.length/2),e=e.concat(c.points)}const a=sb(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])}}},z2={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)}},j2={build(r){va.build(r)},triangulate(r,t){va.triangulate(r,t)}};var Ue=(r=>(r.MITER="miter",r.BEVEL="bevel",r.ROUND="round",r))(Ue||{}),pr=(r=>(r.BUTT="butt",r.ROUND="round",r.SQUARE="square",r))(pr||{});const Ws={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 L0{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,_=g*u+y*l,v=g*c+y*h,T=l*(y+x),C=h*(y+x),E=u*(g+b),I=c*(g+b),k=Math.atan2(C-v,T-_),L=Math.atan2(I-v,E-_);return{cx:_+t,cy:v+e,radius:n,startAngle:k,endAngle:L,anticlockwise:l*c>u*h}}static arc(t,e,i,s,n,o,a,h,l){const c=a-o,u=Ws._segmentsCount(Math.abs(c)*n,Math.ceil(Math.abs(c)/Ko)*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,_=d+o+f*b,v=Math.cos(_),T=-Math.sin(_);l.push((p*v+m*T)*n+i,(p*-T+m*v)*n+s)}}}class J2{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 xc{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,_=t,v=e;for(let T=1;T<=10;++T)c=T/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=_-g,b=v-y,_=g,v=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=Ws._segmentsCount(xc.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 G0(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 Qr(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 $2(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 at(i[0],i[1]),a=new at(i[i.length-2],i[i.length-1]),h=e.type!==oe.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 U=(o.x+a.x)*.5,Z=(a.y+o.y)*.5;i.unshift(U,Z),i.push(U,Z)}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],_=i[3],v=0,T=0,C=-(x-_),E=y-b,I=0,k=0,L=Math.sqrt(C*C+E*E);C/=L,E/=L,C*=p,E*=p;const P=n.alignment,S=(1-P)*2,R=P*2;h||(n.cap===pr.ROUND?d+=Qr(y-C*(S-R)*.5,x-E*(S-R)*.5,y-C*S,x-E*S,y+C*R,x+E*R,c,!0)+2:n.cap===pr.SQUARE&&(d+=G0(y,x,C,E,S,R,!0,c))),c.push(y-C*S,x-E*S,y+C*R,x+E*R);for(let U=1;U<u-1;++U){y=i[(U-1)*2],x=i[(U-1)*2+1],b=i[U*2],_=i[U*2+1],v=i[(U+1)*2],T=i[(U+1)*2+1],C=-(x-_),E=y-b,L=Math.sqrt(C*C+E*E),C/=L,E/=L,C*=p,E*=p,I=-(_-T),k=b-v,L=Math.sqrt(I*I+k*k),I/=L,k/=L,I*=p,k*=p;const Z=b-y,st=x-_,X=b-v,M=T-_,D=Z*X+st*M,V=st*X-M*Z,Q=V<0;if(Math.abs(V)<.001*Math.abs(D)){c.push(b-C*S,_-E*S,b+C*R,_+E*R),D>=0&&(n.join===Ue.ROUND?d+=Qr(b,_,b-C*S,_-E*S,b-I*S,_-k*S,c,!1)+4:d+=2,c.push(b-I*R,_-k*R,b+I*S,_+k*S));continue}const j=(-C+y)*(-E+_)-(-C+b)*(-E+x),xt=(-I+v)*(-k+_)-(-I+b)*(-k+T),Tt=(Z*xt-X*j)/V,yt=(M*j-st*xt)/V,N=(Tt-b)*(Tt-b)+(yt-_)*(yt-_),Y=b+(Tt-b)*S,H=_+(yt-_)*S,G=b-(Tt-b)*R,ut=_-(yt-_)*R,ht=Math.min(Z*Z+st*st,X*X+M*M),wt=Q?S:R,Rt=ht+wt*wt*m,Fe=N<=Rt;let Gi=n.join;if(Gi===Ue.MITER&&N/m>g&&(Gi=Ue.BEVEL),Fe)switch(Gi){case Ue.MITER:{c.push(Y,H,G,ut);break}case Ue.BEVEL:{Q?c.push(Y,H,b+C*R,_+E*R,Y,H,b+I*R,_+k*R):c.push(b-C*S,_-E*S,G,ut,b-I*S,_-k*S,G,ut),d+=2;break}case Ue.ROUND:{Q?(c.push(Y,H,b+C*R,_+E*R),d+=Qr(b,_,b+C*R,_+E*R,b+I*R,_+k*R,c,!0)+4,c.push(Y,H,b+I*R,_+k*R)):(c.push(b-C*S,_-E*S,G,ut),d+=Qr(b,_,b-C*S,_-E*S,b-I*S,_-k*S,c,!1)+4,c.push(b-I*S,_-k*S,G,ut));break}}else{switch(c.push(b-C*S,_-E*S,b+C*R,_+E*R),Gi){case Ue.MITER:{Q?c.push(G,ut,G,ut):c.push(Y,H,Y,H),d+=2;break}case Ue.ROUND:{Q?d+=Qr(b,_,b+C*R,_+E*R,b+I*R,_+k*R,c,!0)+2:d+=Qr(b,_,b-C*S,_-E*S,b-I*S,_-k*S,c,!1)+2;break}}c.push(b-I*S,_-k*S,b+I*R,_+k*R),d+=2}}y=i[(u-2)*2],x=i[(u-2)*2+1],b=i[(u-1)*2],_=i[(u-1)*2+1],C=-(x-_),E=y-b,L=Math.sqrt(C*C+E*E),C/=L,E/=L,C*=p,E*=p,c.push(b-C*S,_-E*S,b+C*R,_+E*R),h||(n.cap===pr.ROUND?d+=Qr(b-C*(S-R)*.5,_-E*(S-R)*.5,b-C*S,_-E*S,b+C*R,_+E*R,c,!1)+2:n.cap===pr.SQUARE&&(d+=G0(b,_,C,E,S,R,!1,c)));const F=t.indices,O=Ws.epsilon*Ws.epsilon;for(let U=f;U<d+f-2;++U)y=c[U*2],x=c[U*2+1],b=c[(U+1)*2],_=c[(U+1)*2+1],v=c[(U+2)*2],T=c[(U+2)*2+1],!(Math.abs(y*(_-T)+b*(T-x)+v*(x-_))<O)&&F.push(U,U+1,U+2)}function Q2(r,t){let e=0;const i=r.shape,s=r.points||i.points,n=i.type!==oe.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 k0(r,t){r.lineStyle.native?Q2(r,t):$2(r,t)}class _c{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=Ws._segmentsCount(_c.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 vc={[oe.POLY]:P0,[oe.CIRC]:va,[oe.ELIP]:va,[oe.RECT]:z2,[oe.RREC]:j2},F0=[],wa=[];class Ta{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 Ta(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 Zs=new at,N0=class A1 extends mp{constructor(){super(),this.closePointEps=1e-4,this.boundsPadding=0,this.uvsFloat32=null,this.indicesUint16=null,this.batchable=!1,this.points=[],this.colors=[],this.uvs=[],this.indices=[],this.textureIds=[],this.graphicsData=[],this.drawCalls=[],this.batchDirty=-1,this.batches=[],this.dirty=0,this.cacheDirty=-1,this.clearDirty=0,this.shapeIndex=0,this._bounds=new ca,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(),wa.push(this.drawCalls[t]);this.drawCalls.length=0;for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e.reset(),F0.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 Ta(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 Ta(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,Zs):Zs.copyFrom(t),s.shape.contains(Zs.x,Zs.y))){let n=!1;if(s.holes){for(let o=0;o<s.holes.length;o++)if(s.holes[o].shape.contains(Zs.x,Zs.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;vc[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=ui.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=F0.pop()||new J2,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<A1.BATCHABLE_SIZE*2}buildDrawCalls(){let t=++dt._globalBatch;for(let u=0;u<this.drawCalls.length;u++)this.drawCalls[u].texArray.clear(),wa.push(this.drawCalls[u]);this.drawCalls.length=0;const e=this.colors,i=this.textureIds;let s=wa.pop();s||(s=new Zl,s.texArray=new Jl),s.texArray.count=0,s.start=0,s.size=0,s.type=ci.TRIANGLES;let n=0,o=null,a=0,h=!1,l=ci.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?ci.LINES:ci.TRIANGLES,o=null,n=f,t++),o!==m&&(o=m,m._batchEnabled!==t&&(n===f&&(t++,n=0,s.size>0&&(s=wa.pop(),s||(s=new Zl,s.texArray=new Jl),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=ui.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)}dt._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?P0.triangulate(t,this):vc[t.type].triangulate(t,this)}processLine(t){k0(t,this);for(let e=0;e<t.holes.length;e++)k0(t.holes[e],this)}processHoles(t){for(let e=0;e<t.length;e++){const i=t[e];vc[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=Et.shared.setValue(e).toLittleEndianNumber(),a=Et.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}};N0.BATCHABLE_SIZE=100;let q2=N0;class Sa{constructor(){this.color=16777215,this.alpha=1,this.texture=rt.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){const t=new Sa;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t}reset(){this.color=16777215,this.alpha=1,this.texture=rt.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}class wc extends Sa{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=pr.BUTT,this.join=Ue.MITER,this.miterLimit=10}clone(){const t=new wc;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=pr.BUTT,this.join=Ue.MITER,this.miterLimit=10}}const Tc={},Sc=class Ph extends gt{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 Sa,this._lineStyle=new wc,this._matrix=null,this._holeMode=!1,this.state=xi.for2d(),this._geometry=t||new q2,this._geometry.refCount++,this._transformID=-1,this._tintColor=new Et(16777215),this.blendMode=lt.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new Ph(this._geometry)}set blendMode(t){this.state.blendMode=t}get blendMode(){return this.state.blendMode}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t)}get fill(){return this._fillStyle}get line(){return this._lineStyle}lineStyle(t=null,e=0,i,s=.5,n=!1){return typeof t=="number"&&(t={width:t,color:e,alpha:i,alignment:s,native:n}),this.lineTextureStyle(t)}lineTextureStyle(t){const e={width:0,texture:rt.WHITE,color:t!=null&&t.texture?16777215:0,matrix:null,alignment:.5,native:!1,cap:pr.BUTT,join:Ue.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 Ur,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new Ur,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),_c.curveTo(t,e,i,s,n),this}bezierCurveTo(t,e,i,s,n,o){return this._initCurve(),xc.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=L0.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+=Ko:o&&s<=n&&(s+=Ko),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 L0.arc(a,h,t,e,i,s,n,o,c),this}beginFill(t=0,e){return this.beginTextureFill({texture:rt.WHITE,color:t,alpha:e})}normalizeColor(t){const e=Et.shared.setValue(t.color??0);t.color=e.toNumber(),t.alpha??(t.alpha=e.alpha)}beginTextureFill(t){const e={texture:rt.WHITE,color:16777215,matrix:null};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();const i=t.alpha>0;return i?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:i},t)):this._fillStyle.reset(),this}endFill(){return this.finishPoly(),this._fillStyle.reset(),this}drawRect(t,e,i,s){return this.drawShape(new ct(t,e,i,s))}drawRoundedRect(t,e,i,s,n){return this.drawShape(new Jo(t,e,i,s,n))}drawCircle(t,e,i){return this.drawShape(new zo(t,e,i))}drawEllipse(t,e,i,s){return this.drawShape(new jo(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 Ur(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===oe.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:Et.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,Et.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(!Tc[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 It,default:ti.from({uSamplers:n},!0)},a=t.plugins[i]._shader.program;Tc[i]=new _i(a,o)}e=Tc[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,Ph._TEMP_POINT),this._geometry.containsPoint(Ph._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=Et.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)}};Sc.curves=Ws,Sc._TEMP_POINT=new at;let mr=Sc;class tT{constructor(t,e){this.uvBuffer=t,this.uvMatrix=e,this.data=null,this._bufferUpdateId=-1,this._textureUpdateId=-1,this._updateID=0}update(t){if(!t&&this._bufferUpdateId===this.uvBuffer._updateID&&this._textureUpdateId===this.uvMatrix._updateID)return;this._bufferUpdateId=this.uvBuffer._updateID,this._textureUpdateId=this.uvMatrix._updateID;const e=this.uvBuffer.data;(!this.data||this.data.length!==e.length)&&(this.data=new Float32Array(e.length)),this.uvMatrix.multiplyUvs(e,this.data),this._updateID++}}const Cc=new at,D0=new Ur,O0=class M1 extends gt{constructor(t,e,i,s=ci.TRIANGLES){super(),this.geometry=t,this.shader=e,this.state=i||xi.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=$.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===ci.TRIANGLES&&e.length<M1.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=$.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 tT(t,e.uvMatrix)),this.batchUvs.update(),this.uvs=this.batchUvs.data)}_calculateBounds(){this.calculateVertices(),this._bounds.addVertexData(this.vertexData,0,this.vertexData.length)}containsPoint(t){if(!this.getBounds().contains(t.x,t.y))return!1;this.worldTransform.applyInverse(t,Cc);const e=this.geometry.getBuffer("aVertexPosition").data,i=D0.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],D0.contains(Cc.x,Cc.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}};O0.BATCHABLE_SIZE=100;let Ec=O0;class B0 extends cr{constructor(t,e,i){super();const s=new Xt(t),n=new Xt(e,!0),o=new Xt(i,!0,!0);this.addAttribute("aVertexPosition",s,2,!1,ot.FLOAT).addAttribute("aTextureCoord",n,2,!1,ot.FLOAT).addIndex(o),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}var eT=`varying vec2 vTextureCoord;
924
924
  uniform vec4 uColor;
925
925
 
926
926
  uniform sampler2D uSampler;
@@ -944,7 +944,7 @@ void main(void)
944
944
 
945
945
  vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;
946
946
  }
947
- `;class Ic extends _i{constructor(t,e){const i={uSampler:t,alpha:1,uTextureMatrix:It.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||Vi.from(iT,eT),i),this._colorDirty=!1,this.uvMatrix=new Np(t),this.batchable=e.program===void 0,this.pluginName=e.pluginName,this._tintColor=new Et(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;Et.shared.setValue(this._tintColor).premultiply(this._alpha,t).toArray(this.uniforms.uColor)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}}class rT extends U0{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 sT extends Ec{constructor(t,e,i=0){const s=new rT(t.height,e,i),n=new Ic(t);i>0&&(t.baseTexture.wrapMode=ui.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 B0{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||ot.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 Xt(E_(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 Xt(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 Xt(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===ot.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===ot.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===ot.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===ot.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 nT=`varying vec2 vTextureCoord;
947
+ `;class Ic extends _i{constructor(t,e){const i={uSampler:t,alpha:1,uTextureMatrix:It.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||Vi.from(iT,eT),i),this._colorDirty=!1,this.uvMatrix=new Np(t),this.batchable=e.program===void 0,this.pluginName=e.pluginName,this._tintColor=new Et(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;Et.shared.setValue(this._tintColor).premultiply(this._alpha,t).toArray(this.uniforms.uColor)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}}class rT extends B0{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 sT extends Ec{constructor(t,e,i=0){const s=new rT(t.height,e,i),n=new Ic(t);i>0&&(t.baseTexture.wrapMode=ui.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 U0{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||ot.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 Xt(E_(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 Xt(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 Xt(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===ot.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===ot.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===ot.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===ot.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 nT=`varying vec2 vTextureCoord;
948
948
  varying vec4 vColor;
949
949
 
950
950
  uniform sampler2D uSampler;
@@ -977,8 +977,8 @@ void main(void){
977
977
  vTextureCoord = aTextureCoord;
978
978
  vColor = aColor * uColor;
979
979
  }
980
- `;class X0 extends ea{constructor(t){super(t),this.shader=null,this.properties=null,this.tempMatrix=new It,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:ot.UNSIGNED_BYTE,uploadFunction:this.uploadTint,offset:0}],this.shader=_i.from(oT,nT,{}),this.state=xi.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=sp(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=Et.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 B0(this.properties,n,s));return e}_generateOneMoreBuffer(t){const e=t._batchSize,i=t._properties;return new B0(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=Et.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}}X0.extension={name:"particle",type:z.RendererPlugin},it.add(X0);var Ca=(r=>(r[r.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",r[r.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",r))(Ca||{});const Ea={willReadFrequently:!0},vi=class nt{static get experimentalLetterSpacingSupported(){let t=nt._experimentalLetterSpacingSupported;if(t!==void 0){const e=Q.ADAPTER.getCanvasRenderingContext2D().prototype;t=nt._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,i,s,n,o,a,h,l){this.text=t,this.style=e,this.width=i,this.height=s,this.lines=n,this.lineWidths=o,this.lineHeight=a,this.maxLineWidth=h,this.fontProperties=l}static measureText(t,e,i,s=nt._canvas){i=i??e.wordWrap;const n=e.toFontString(),o=nt.measureFont(n);o.fontSize===0&&(o.fontSize=e.fontSize,o.ascent=e.fontSize);const a=s.getContext("2d",Ea);a.font=n;const h=(i?nt.wordWrap(t,e,s):t).split(/(?:\r\n|\r|\n)/),l=new Array(h.length);let c=0;for(let p=0;p<h.length;p++){const m=nt._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 nt(t,e,u,f,h,l,d+e.leading,c,o)}static _measureText(t,e,i){let s=!1;nt.experimentalLetterSpacingSupported&&(nt.experimentalLetterSpacing?(i.letterSpacing=`${e}px`,i.textLetterSpacing=`${e}px`,s=!0):(i.letterSpacing="0px",i.textLetterSpacing="0px"));let n=i.measureText(t).width;return n>0&&(s?n-=e:n+=(nt.graphemeSegmenter(t).length-1)*e),n}static wordWrap(t,e,i=nt._canvas){const s=i.getContext("2d",Ea);let n=0,o="",a="";const h=Object.create(null),{letterSpacing:l,whiteSpace:c}=e,u=nt.collapseSpaces(c),d=nt.collapseNewlines(c);let f=!u;const p=e.wordWrapWidth+l,m=nt.tokenize(t);for(let g=0;g<m.length;g++){let y=m[g];if(nt.isNewline(y)){if(!d){a+=nt.addLine(o),f=!u,o="",n=0;continue}y=" "}if(u){const b=nt.isBreakingSpace(y),_=nt.isBreakingSpace(o[o.length-1]);if(b&&_)continue}const x=nt.getFromCache(y,l,h,s);if(x>p)if(o!==""&&(a+=nt.addLine(o),o="",n=0),nt.canBreakWords(y,e.breakWords)){const b=nt.wordWrapSplit(y);for(let _=0;_<b.length;_++){let v=b[_],T=v,C=1;for(;b[_+C];){const I=b[_+C];if(!nt.canBreakChars(T,I,y,_,e.breakWords))v+=I;else break;T=I,C++}_+=C-1;const E=nt.getFromCache(v,l,h,s);E+n>p&&(a+=nt.addLine(o),f=!1,o="",n=0),o+=v,n+=E}}else{o.length>0&&(a+=nt.addLine(o),o="",n=0);const b=g===m.length-1;a+=nt.addLine(y,!b),f=!1,o="",n=0}else x+n>p&&(f=!1,a+=nt.addLine(o),o="",n=0),(o.length>0||!nt.isBreakingSpace(y)||f)&&(o+=y,n+=x)}return a+=nt.addLine(o,!1),a}static addLine(t,e=!0){return t=nt.trimRight(t),t=e?`${t}
981
- `:t,t}static getFromCache(t,e,i,s){let n=i[t];return typeof n!="number"&&(n=nt._measureText(t,e,s)+e,i[t]=n),n}static collapseSpaces(t){return t==="normal"||t==="pre-line"}static collapseNewlines(t){return t==="normal"}static trimRight(t){if(typeof t!="string")return"";for(let e=t.length-1;e>=0;e--){const i=t[e];if(!nt.isBreakingSpace(i))break;t=t.slice(0,-1)}return t}static isNewline(t){return typeof t!="string"?!1:nt._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:nt._breakingSpaces.includes(t.charCodeAt(0))}static tokenize(t){const e=[];let i="";if(typeof t!="string")return e;for(let s=0;s<t.length;s++){const n=t[s],o=t[s+1];if(nt.isBreakingSpace(n,o)||nt.isNewline(n)){i!==""&&(e.push(i),i=""),e.push(n);continue}i+=n}return i!==""&&e.push(i),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,i,s,n){return!0}static wordWrapSplit(t){return nt.graphemeSegmenter(t)}static measureFont(t){if(nt._fonts[t])return nt._fonts[t];const e={ascent:0,descent:0,fontSize:0},i=nt._canvas,s=nt._context;s.font=t;const n=nt.METRICS_STRING+nt.BASELINE_SYMBOL,o=Math.ceil(s.measureText(n).width);let a=Math.ceil(s.measureText(nt.BASELINE_SYMBOL).width);const h=Math.ceil(nt.HEIGHT_MULTIPLIER*a);if(a=a*nt.BASELINE_MULTIPLIER|0,o===0||h===0)return nt._fonts[t]=e,e;i.width=o,i.height=h,s.fillStyle="#f00",s.fillRect(0,0,o,h),s.font=t,s.textBaseline="alphabetic",s.fillStyle="#000",s.fillText(n,0,a);const l=s.getImageData(0,0,o,h).data,c=l.length,u=o*4;let d=0,f=0,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,nt._fonts[t]=e,e}static clearMetrics(t=""){t?delete nt._fonts[t]:nt._fonts={}}static get _canvas(){var t;if(!nt.__canvas){let e;try{const i=new OffscreenCanvas(0,0);if((t=i.getContext("2d",Ea))!=null&&t.measureText)return nt.__canvas=i,i;e=Q.ADAPTER.createCanvas()}catch{e=Q.ADAPTER.createCanvas()}e.width=e.height=10,nt.__canvas=e}return nt.__canvas}static get _context(){return nt.__context||(nt.__context=nt._canvas.getContext("2d",Ea)),nt.__context}};vi.METRICS_STRING="|ÉqÅ",vi.BASELINE_SYMBOL="M",vi.BASELINE_MULTIPLIER=1.4,vi.HEIGHT_MULTIPLIER=2,vi.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]})(),vi.experimentalLetterSpacing=!1,vi._fonts={},vi._newlines=[10,13],vi._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let gr=vi;const aT=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],W0=class Co{constructor(t){this.styleID=0,this.reset(),Mc(this,t,t)}clone(){const t={};return Mc(t,this,Co.defaultStyle),new Co(t)}reset(){Mc(this,Co.defaultStyle,Co.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=Ac(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=Ac(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){hT(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=Ac(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)&&!aT.includes(s)&&(s=`"${s}"`),e[i]=s}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${t} ${e.join(",")}`}};W0.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:Ca.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 yr=W0;function Ac(r){const t=Et.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 hT(r,t){if(!Array.isArray(r)||!Array.isArray(t)||r.length!==t.length)return!1;for(let e=0;e<r.length;++e)if(r[e]!==t[e])return!1;return!0}function Mc(r,t,e){for(const i in e)Array.isArray(t[i])?r[i]=t[i].slice():r[i]=t[i]}const lT={texture:!0,children:!1,baseTexture:!0},Z0=class Td extends Vt{constructor(t,e,i){let s=!1;i||(i=Q.ADAPTER.createCanvas(),s=!0),i.width=3,i.height=3;const n=rt.from(i);n.orig=new ct,n.trim=new ct,super(n),this._ownCanvas=s,this.canvas=i,this.context=i.getContext("2d",{willReadFrequently:!0}),this._resolution=Td.defaultResolution??Q.RESOLUTION,this._autoResolution=Td.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 gr.experimentalLetterSpacing}static set experimentalLetterSpacing(t){pt("7.1.0","Text.experimentalLetterSpacing is deprecated, use TextMetrics.experimentalLetterSpacing"),gr.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=gr.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 _=e.dropShadowColor,v=e.dropShadowBlur*this._resolution,T=e.dropShadowDistance*this._resolution;i.shadowColor=Et.shared.setValue(_).setAlpha(e.dropShadowAlpha).toRgbaString(),i.shadowBlur=v,i.shadowOffsetX=Math.cos(e.dropShadowAngle)*T,i.shadowOffsetY=Math.sin(e.dropShadowAngle)*T+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 _=0;_<a.length;_++)d=e.strokeThickness/2,f=e.strokeThickness/2+_*h+u.ascent+b,e.align==="right"?d+=c-l[_]:e.align==="center"&&(d+=(c-l[_])/2),e.stroke&&e.strokeThickness&&this.drawLetterSpacing(a[_],d+e.padding,f+e.padding-y,!0),e.fill&&this.drawLetterSpacing(a[_],d+e.padding,f+e.padding-y)}this.updateTexture()}drawLetterSpacing(t,e,i,s=!1){const n=this._style.letterSpacing;let o=!1;if(gr.experimentalLetterSpacingSupported&&(gr.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=gr.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=R_(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===Ca.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 _=(b-g)/l;for(let v=0;v<c.length;v++){let T=0;typeof u[v]=="number"?T=u[v]:T=v/c.length;let C=Math.min(1,Math.max(0,g/l+T*_));C=Number(C.toFixed(5)),n.addColorStop(C,c[v])}}}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({},lT,t),super.destroy(t),this._ownCanvas&&(this.canvas.height=this.canvas.width=0),this.context=null,this.canvas=null,this._style=null}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this.updateText(!0);const e=hr(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=hr(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 yr?this._style=t:this._style=new yr(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)}};Z0.defaultAutoResolution=!0;let V0=Z0;class cT{constructor(t){this.maxItemsPerFrame=t,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function uT(r,t){var i;let e=!1;if((i=r==null?void 0:r._textures)!=null&&i.length){for(let s=0;s<r._textures.length;s++)if(r._textures[s]instanceof rt){const n=r._textures[s].baseTexture;t.includes(n)||(t.push(n),e=!0)}}return e}function dT(r,t){if(r.baseTexture instanceof dt){const e=r.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function fT(r,t){if(r._texture&&r._texture instanceof rt){const e=r._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function pT(r,t){return t instanceof V0?(t.updateText(!0),!0):!1}function mT(r,t){if(t instanceof yr){const e=t.toFontString();return gr.measureFont(e),!0}return!1}function gT(r,t){if(r instanceof V0){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 yT(r,t){return r instanceof yr?(t.includes(r)||t.push(r),!0):!1}const H0=class R1{constructor(t){this.limiter=new cT(R1.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(gT),this.registerFindHook(yT),this.registerFindHook(uT),this.registerFindHook(dT),this.registerFindHook(fT),this.registerUploadHook(pT),this.registerUploadHook(mT)}upload(t){return new Promise(e=>{t&&this.add(t),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,me.system.addOnce(this.tick,this,jr.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)me.system.addOnce(this.tick,this,jr.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 yt)for(let e=t.children.length-1;e>=0;e--)this.add(t.children[e]);return this}destroy(){this.ticking&&me.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}};H0.uploadsPerFrame=4;let Rc=H0;Object.defineProperties(Q,{UPLOADS_PER_FRAME:{get(){return Rc.uploadsPerFrame},set(r){pt("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),Rc.uploadsPerFrame=r}}});function K0(r,t){return t instanceof dt?(t._glTextures[r.CONTEXT_UID]||r.texture.bind(t),!0):!1}function bT(r,t){if(!(t instanceof mr))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&&K0(r,n.baseTexture)}return e.batchable||r.geometry.bind(e,t._resolveDirectShader(r)),!0}function xT(r,t){return r instanceof mr?(t.push(r),!0):!1}class Y0 extends Rc{constructor(t){super(t),this.uploadHookHelper=this.renderer,this.registerFindHook(xT),this.registerUploadHook(K0),this.registerUploadHook(bT)}}Y0.extension={name:"prepare",type:z.RendererSystem},it.add(Y0);var _T=`#version 300 es
980
+ `;class X0 extends ea{constructor(t){super(t),this.shader=null,this.properties=null,this.tempMatrix=new It,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:ot.UNSIGNED_BYTE,uploadFunction:this.uploadTint,offset:0}],this.shader=_i.from(oT,nT,{}),this.state=xi.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=sp(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=Et.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 U0(this.properties,n,s));return e}_generateOneMoreBuffer(t){const e=t._batchSize,i=t._properties;return new U0(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=Et.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}}X0.extension={name:"particle",type:z.RendererPlugin},it.add(X0);var Ca=(r=>(r[r.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",r[r.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",r))(Ca||{});const Ea={willReadFrequently:!0},vi=class nt{static get experimentalLetterSpacingSupported(){let t=nt._experimentalLetterSpacingSupported;if(t!==void 0){const e=$.ADAPTER.getCanvasRenderingContext2D().prototype;t=nt._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,i,s,n,o,a,h,l){this.text=t,this.style=e,this.width=i,this.height=s,this.lines=n,this.lineWidths=o,this.lineHeight=a,this.maxLineWidth=h,this.fontProperties=l}static measureText(t,e,i,s=nt._canvas){i=i??e.wordWrap;const n=e.toFontString(),o=nt.measureFont(n);o.fontSize===0&&(o.fontSize=e.fontSize,o.ascent=e.fontSize);const a=s.getContext("2d",Ea);a.font=n;const h=(i?nt.wordWrap(t,e,s):t).split(/(?:\r\n|\r|\n)/),l=new Array(h.length);let c=0;for(let p=0;p<h.length;p++){const m=nt._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 nt(t,e,u,f,h,l,d+e.leading,c,o)}static _measureText(t,e,i){let s=!1;nt.experimentalLetterSpacingSupported&&(nt.experimentalLetterSpacing?(i.letterSpacing=`${e}px`,i.textLetterSpacing=`${e}px`,s=!0):(i.letterSpacing="0px",i.textLetterSpacing="0px"));let n=i.measureText(t).width;return n>0&&(s?n-=e:n+=(nt.graphemeSegmenter(t).length-1)*e),n}static wordWrap(t,e,i=nt._canvas){const s=i.getContext("2d",Ea);let n=0,o="",a="";const h=Object.create(null),{letterSpacing:l,whiteSpace:c}=e,u=nt.collapseSpaces(c),d=nt.collapseNewlines(c);let f=!u;const p=e.wordWrapWidth+l,m=nt.tokenize(t);for(let g=0;g<m.length;g++){let y=m[g];if(nt.isNewline(y)){if(!d){a+=nt.addLine(o),f=!u,o="",n=0;continue}y=" "}if(u){const b=nt.isBreakingSpace(y),_=nt.isBreakingSpace(o[o.length-1]);if(b&&_)continue}const x=nt.getFromCache(y,l,h,s);if(x>p)if(o!==""&&(a+=nt.addLine(o),o="",n=0),nt.canBreakWords(y,e.breakWords)){const b=nt.wordWrapSplit(y);for(let _=0;_<b.length;_++){let v=b[_],T=v,C=1;for(;b[_+C];){const I=b[_+C];if(!nt.canBreakChars(T,I,y,_,e.breakWords))v+=I;else break;T=I,C++}_+=C-1;const E=nt.getFromCache(v,l,h,s);E+n>p&&(a+=nt.addLine(o),f=!1,o="",n=0),o+=v,n+=E}}else{o.length>0&&(a+=nt.addLine(o),o="",n=0);const b=g===m.length-1;a+=nt.addLine(y,!b),f=!1,o="",n=0}else x+n>p&&(f=!1,a+=nt.addLine(o),o="",n=0),(o.length>0||!nt.isBreakingSpace(y)||f)&&(o+=y,n+=x)}return a+=nt.addLine(o,!1),a}static addLine(t,e=!0){return t=nt.trimRight(t),t=e?`${t}
981
+ `:t,t}static getFromCache(t,e,i,s){let n=i[t];return typeof n!="number"&&(n=nt._measureText(t,e,s)+e,i[t]=n),n}static collapseSpaces(t){return t==="normal"||t==="pre-line"}static collapseNewlines(t){return t==="normal"}static trimRight(t){if(typeof t!="string")return"";for(let e=t.length-1;e>=0;e--){const i=t[e];if(!nt.isBreakingSpace(i))break;t=t.slice(0,-1)}return t}static isNewline(t){return typeof t!="string"?!1:nt._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:nt._breakingSpaces.includes(t.charCodeAt(0))}static tokenize(t){const e=[];let i="";if(typeof t!="string")return e;for(let s=0;s<t.length;s++){const n=t[s],o=t[s+1];if(nt.isBreakingSpace(n,o)||nt.isNewline(n)){i!==""&&(e.push(i),i=""),e.push(n);continue}i+=n}return i!==""&&e.push(i),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,i,s,n){return!0}static wordWrapSplit(t){return nt.graphemeSegmenter(t)}static measureFont(t){if(nt._fonts[t])return nt._fonts[t];const e={ascent:0,descent:0,fontSize:0},i=nt._canvas,s=nt._context;s.font=t;const n=nt.METRICS_STRING+nt.BASELINE_SYMBOL,o=Math.ceil(s.measureText(n).width);let a=Math.ceil(s.measureText(nt.BASELINE_SYMBOL).width);const h=Math.ceil(nt.HEIGHT_MULTIPLIER*a);if(a=a*nt.BASELINE_MULTIPLIER|0,o===0||h===0)return nt._fonts[t]=e,e;i.width=o,i.height=h,s.fillStyle="#f00",s.fillRect(0,0,o,h),s.font=t,s.textBaseline="alphabetic",s.fillStyle="#000",s.fillText(n,0,a);const l=s.getImageData(0,0,o,h).data,c=l.length,u=o*4;let d=0,f=0,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,nt._fonts[t]=e,e}static clearMetrics(t=""){t?delete nt._fonts[t]:nt._fonts={}}static get _canvas(){var t;if(!nt.__canvas){let e;try{const i=new OffscreenCanvas(0,0);if((t=i.getContext("2d",Ea))!=null&&t.measureText)return nt.__canvas=i,i;e=$.ADAPTER.createCanvas()}catch{e=$.ADAPTER.createCanvas()}e.width=e.height=10,nt.__canvas=e}return nt.__canvas}static get _context(){return nt.__context||(nt.__context=nt._canvas.getContext("2d",Ea)),nt.__context}};vi.METRICS_STRING="|ÉqÅ",vi.BASELINE_SYMBOL="M",vi.BASELINE_MULTIPLIER=1.4,vi.HEIGHT_MULTIPLIER=2,vi.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]})(),vi.experimentalLetterSpacing=!1,vi._fonts={},vi._newlines=[10,13],vi._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let gr=vi;const aT=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],W0=class Co{constructor(t){this.styleID=0,this.reset(),Mc(this,t,t)}clone(){const t={};return Mc(t,this,Co.defaultStyle),new Co(t)}reset(){Mc(this,Co.defaultStyle,Co.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=Ac(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=Ac(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){hT(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=Ac(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)&&!aT.includes(s)&&(s=`"${s}"`),e[i]=s}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${t} ${e.join(",")}`}};W0.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:Ca.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 yr=W0;function Ac(r){const t=Et.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 hT(r,t){if(!Array.isArray(r)||!Array.isArray(t)||r.length!==t.length)return!1;for(let e=0;e<r.length;++e)if(r[e]!==t[e])return!1;return!0}function Mc(r,t,e){for(const i in e)Array.isArray(t[i])?r[i]=t[i].slice():r[i]=t[i]}const lT={texture:!0,children:!1,baseTexture:!0},Z0=class Td extends Vt{constructor(t,e,i){let s=!1;i||(i=$.ADAPTER.createCanvas(),s=!0),i.width=3,i.height=3;const n=rt.from(i);n.orig=new ct,n.trim=new ct,super(n),this._ownCanvas=s,this.canvas=i,this.context=i.getContext("2d",{willReadFrequently:!0}),this._resolution=Td.defaultResolution??$.RESOLUTION,this._autoResolution=Td.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 gr.experimentalLetterSpacing}static set experimentalLetterSpacing(t){pt("7.1.0","Text.experimentalLetterSpacing is deprecated, use TextMetrics.experimentalLetterSpacing"),gr.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=gr.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 _=e.dropShadowColor,v=e.dropShadowBlur*this._resolution,T=e.dropShadowDistance*this._resolution;i.shadowColor=Et.shared.setValue(_).setAlpha(e.dropShadowAlpha).toRgbaString(),i.shadowBlur=v,i.shadowOffsetX=Math.cos(e.dropShadowAngle)*T,i.shadowOffsetY=Math.sin(e.dropShadowAngle)*T+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 _=0;_<a.length;_++)d=e.strokeThickness/2,f=e.strokeThickness/2+_*h+u.ascent+b,e.align==="right"?d+=c-l[_]:e.align==="center"&&(d+=(c-l[_])/2),e.stroke&&e.strokeThickness&&this.drawLetterSpacing(a[_],d+e.padding,f+e.padding-y,!0),e.fill&&this.drawLetterSpacing(a[_],d+e.padding,f+e.padding-y)}this.updateTexture()}drawLetterSpacing(t,e,i,s=!1){const n=this._style.letterSpacing;let o=!1;if(gr.experimentalLetterSpacingSupported&&(gr.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=gr.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=R_(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===Ca.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 _=(b-g)/l;for(let v=0;v<c.length;v++){let T=0;typeof u[v]=="number"?T=u[v]:T=v/c.length;let C=Math.min(1,Math.max(0,g/l+T*_));C=Number(C.toFixed(5)),n.addColorStop(C,c[v])}}}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({},lT,t),super.destroy(t),this._ownCanvas&&(this.canvas.height=this.canvas.width=0),this.context=null,this.canvas=null,this._style=null}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this.updateText(!0);const e=hr(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=hr(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 yr?this._style=t:this._style=new yr(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)}};Z0.defaultAutoResolution=!0;let V0=Z0;class cT{constructor(t){this.maxItemsPerFrame=t,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function uT(r,t){var i;let e=!1;if((i=r==null?void 0:r._textures)!=null&&i.length){for(let s=0;s<r._textures.length;s++)if(r._textures[s]instanceof rt){const n=r._textures[s].baseTexture;t.includes(n)||(t.push(n),e=!0)}}return e}function dT(r,t){if(r.baseTexture instanceof dt){const e=r.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function fT(r,t){if(r._texture&&r._texture instanceof rt){const e=r._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function pT(r,t){return t instanceof V0?(t.updateText(!0),!0):!1}function mT(r,t){if(t instanceof yr){const e=t.toFontString();return gr.measureFont(e),!0}return!1}function gT(r,t){if(r instanceof V0){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 yT(r,t){return r instanceof yr?(t.includes(r)||t.push(r),!0):!1}const H0=class R1{constructor(t){this.limiter=new cT(R1.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(gT),this.registerFindHook(yT),this.registerFindHook(uT),this.registerFindHook(dT),this.registerFindHook(fT),this.registerUploadHook(pT),this.registerUploadHook(mT)}upload(t){return new Promise(e=>{t&&this.add(t),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,me.system.addOnce(this.tick,this,jr.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)me.system.addOnce(this.tick,this,jr.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 gt)for(let e=t.children.length-1;e>=0;e--)this.add(t.children[e]);return this}destroy(){this.ticking&&me.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}};H0.uploadsPerFrame=4;let Rc=H0;Object.defineProperties($,{UPLOADS_PER_FRAME:{get(){return Rc.uploadsPerFrame},set(r){pt("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),Rc.uploadsPerFrame=r}}});function K0(r,t){return t instanceof dt?(t._glTextures[r.CONTEXT_UID]||r.texture.bind(t),!0):!1}function bT(r,t){if(!(t instanceof mr))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&&K0(r,n.baseTexture)}return e.batchable||r.geometry.bind(e,t._resolveDirectShader(r)),!0}function xT(r,t){return r instanceof mr?(t.push(r),!0):!1}class Y0 extends Rc{constructor(t){super(t),this.uploadHookHelper=this.renderer,this.registerFindHook(xT),this.registerUploadHook(K0),this.registerUploadHook(bT)}}Y0.extension={name:"prepare",type:z.RendererSystem},it.add(Y0);var _T=`#version 300 es
982
982
  #define SHADER_NAME Tiling-Sprite-100
983
983
 
984
984
  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 Ia=new It;class j0 extends ea{constructor(t){super(t),t.runners.contextChange.add(this),this.quad=new Pp,this.state=xi.for2d()}contextChange(){const t=this.renderer,e={globals:t.globalUniforms};this.simpleShader=_i.from(z0,TT,e),this.shader=t.context.webGLVersion>1?_i.from(vT,_T,e):_i.from(z0,wT,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!==ui.CLAMP:h.wrapMode===ui.CLAMP&&(h.wrapMode=ui.REPEAT));const f=d?this.simpleShader:this.shader,p=a.width,m=a.height,g=t._width,y=t._height;Ia.set(c.a*p/g,c.b*p/y,c.c*m/g,c.d*m/y,c.tx/g,c.ty/y),Ia.invert(),d?Ia.prepend(u.mapCoord):(f.uniforms.uMapCoord=u.mapCoord.toArray(!0),f.uniforms.uClampFrame=u.uClampFrame,f.uniforms.uClampOffset=u.uClampOffset),f.uniforms.uTransform=Ia.toArray(!0),f.uniforms.uColor=Et.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=sp(t.blendMode,l),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}j0.extension={name:"tilingSprite",type:z.RendererPlugin},it.add(j0);const J0=class Eo{constructor(t,e,i=null){this.linkedSheets=[],this._texture=t instanceof rt?t:null,this.baseTexture=t instanceof dt?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=Wi(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<=Eo.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const i=Eo.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 ct(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);n.rotated?a=new ct(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 ct(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 ct(Math.floor(n.spriteSourceSize.x)/this.resolution,Math.floor(n.spriteSourceSize.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution)),this.textures[s]=new rt(this.baseTexture,a,c,h,n.rotated?2:0,n.anchor,n.borders),rt.addToCache(this.textures[s],s.toString())}e++}}_processAnimations(){const t=this.data.animations||{};for(const e in t){this.animations[e]=[];for(let i=0;i<t[e].length;i++){const s=t[e][i];this.animations[e].push(this.textures[s])}}}_parseComplete(){const t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*Eo.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Eo.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=[]}};J0.BATCH_SIZE=1e3;let $0=J0;const ST=["jpg","png","jpeg","avif","webp"];function Q0(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=Jt.dirname(r[0]);t.linkedSheets.forEach((n,o)=>{const a=Q0([`${s}/${t.data.meta.related_multi_packs[o]}`],n,!0);Object.assign(i,a)})}return i}const CT={extension:z.Asset,cache:{test:r=>r instanceof $0,getCacheableAssets:(r,t)=>Q0(r,t,!1)},resolver:{test:r=>{const t=r.split("?")[0].split("."),e=t.pop(),i=t.pop();return e==="json"&&ST.includes(i)},parse:r=>{var e;const t=r.split(".");return{resolution:parseFloat(((e=Q.RETINA_PREFIX.exec(r))==null?void 0:e[1])??"1"),format:t[t.length-2],src:r}}},loader:{name:"spritesheetLoader",extension:{type:z.LoadParser,priority:ri.Normal},async testParse(r,t){return Jt.extname(t.src).toLowerCase()===".json"&&!!r.frames},async parse(r,t,e){var h,l;let i=Jt.dirname(t.src);i&&i.lastIndexOf("/")!==i.length-1&&(i+="/");let s=i+r.meta.image;s=fc(s,t.src);const n=(await e.load([s]))[s],o=new $0(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=fc(f,t.src),c.push(e.load({src:f,data:{ignoreMultiPack:!0}})))}const u=await Promise.all(c);o.linkedSheets=u,u.forEach(d=>{d.linkedSheets=[o].concat(o.linkedSheets.filter(f=>f!==d))})}return o},unload(r){r.destroy(!0)}}};it.add(CT);class Aa{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class Ma{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 Aa;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 Pc{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 Aa,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 Lc{static test(t){return typeof t=="string"&&t.includes("<font>")?Pc.test(Q.ADAPTER.parseXML(t)):!1}static parse(t){return Pc.parse(Q.ADAPTER.parseXML(t))}}const Gc=[Ma,Pc,Lc];function ET(r){for(let t=0;t<Gc.length;t++)if(Gc[t].test(r))return Gc[t];return null}function IT(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===Ca.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 _=y/u+b*m;let v=Math.max(p,_);v=Math.min(v,1),a.addColorStop(v,d[x]),p=v}}}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 AT(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=IT(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=Et.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 Ra(r){return r.codePointAt?r.codePointAt(0):r.charCodeAt(0)}function q0(r){return Array.from?Array.from(r):r.split("")}function MT(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(...q0(s))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}const br=class Fi{constructor(t,e,i){var c;const[s]=t.info,[n]=t.common,[o]=t.page,[a]=t.distanceField,h=Wi(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=ye.NO_PREMULTIPLIED_ALPHA,l[d].baseTexture.mipmap=di.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:_}=t.char[u];p/=h,m/=h,g/=h,y/=h,x/=h,b/=h,_/=h;const v=new ct(p+l[f].frame.x/h,m+l[f].frame.y/h,g,y);this.chars[d]={xOffset:x,yOffset:b,xAdvance:_,kerning:{},texture:new rt(l[f].baseTexture,v),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 Aa)s=t;else{const o=ET(t);if(!o)throw new Error("Unrecognized data format for font.");s=o.parse(t)}e instanceof rt&&(e=[e]);const n=new Fi(s,e,i);return Fi.available[n.font]=n,n}static uninstall(t){const e=Fi.available[t];if(!e)throw new Error(`No font found named '${t}'`);e.destroy(),delete Fi.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({},Fi.defaultOptions,i),c=MT(s),u=e instanceof yr?e:new yr(e),d=a,f=new Aa;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 _=[];for(let T=0;T<c.length;T++){g||(g=Q.ADAPTER.createCanvas(),g.width=a,g.height=h,y=g.getContext("2d"),x=new dt(g,{resolution:o,...l}),_.push(new rt(x)),f.page.push({id:_.length-1,file:""}));const C=c[T],E=gr.measureText(C,u,!1,g),I=E.width,k=Math.ceil(E.height),L=Math.ceil((u.fontStyle==="italic"?2:1)*I);if(m>=h-k*o){if(m===0)throw new Error(`[BitmapFont] textureHeight ${h}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${C}')`);--T,g=null,y=null,x=null,m=0,p=0,b=0;continue}if(b=Math.max(k+E.fontProperties.descent,b),L*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}')`);--T,m+=b*o,m=Math.ceil(m),p=0,b=0;continue}AT(g,y,E,p,m,o,u);const P=Ra(E.text);f.char.push({id:P,page:_.length-1,x:p/o,y:m/o,width:L,height:k,xoffset:0,yoffset:0,xadvance:I-(u.dropShadow?u.dropShadowDistance:0)-(u.stroke?u.strokeThickness:0)}),p+=(L+2*n)*o,p=Math.ceil(p)}if(!(i!=null&&i.skipKerning))for(let T=0,C=c.length;T<C;T++){const E=c[T];for(let I=0;I<C;I++){const k=c[I],L=y.measureText(E).width,P=y.measureText(k).width,S=y.measureText(E+k).width-(L+P);S&&f.kerning.push({first:Ra(E),second:Ra(k),amount:S})}}const v=new Fi(f,_,!0);return Fi.available[t]!==void 0&&Fi.uninstall(t),Fi.available[t]=v,v}};br.ALPHA=[["a","z"],["A","Z"]," "],br.NUMERIC=[["0","9"]],br.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],br.ASCII=[[" ","~"]],br.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:br.ALPHANUMERIC},br.available={};let ni=br;var RT=`// Pixi texture info\r
1095
+ `;const Ia=new It;class j0 extends ea{constructor(t){super(t),t.runners.contextChange.add(this),this.quad=new Pp,this.state=xi.for2d()}contextChange(){const t=this.renderer,e={globals:t.globalUniforms};this.simpleShader=_i.from(z0,TT,e),this.shader=t.context.webGLVersion>1?_i.from(vT,_T,e):_i.from(z0,wT,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!==ui.CLAMP:h.wrapMode===ui.CLAMP&&(h.wrapMode=ui.REPEAT));const f=d?this.simpleShader:this.shader,p=a.width,m=a.height,g=t._width,y=t._height;Ia.set(c.a*p/g,c.b*p/y,c.c*m/g,c.d*m/y,c.tx/g,c.ty/y),Ia.invert(),d?Ia.prepend(u.mapCoord):(f.uniforms.uMapCoord=u.mapCoord.toArray(!0),f.uniforms.uClampFrame=u.uClampFrame,f.uniforms.uClampOffset=u.uClampOffset),f.uniforms.uTransform=Ia.toArray(!0),f.uniforms.uColor=Et.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=sp(t.blendMode,l),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}j0.extension={name:"tilingSprite",type:z.RendererPlugin},it.add(j0);const J0=class Eo{constructor(t,e,i=null){this.linkedSheets=[],this._texture=t instanceof rt?t:null,this.baseTexture=t instanceof dt?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=Wi(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<=Eo.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const i=Eo.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 ct(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);n.rotated?a=new ct(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 ct(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 ct(Math.floor(n.spriteSourceSize.x)/this.resolution,Math.floor(n.spriteSourceSize.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution)),this.textures[s]=new rt(this.baseTexture,a,c,h,n.rotated?2:0,n.anchor,n.borders),rt.addToCache(this.textures[s],s.toString())}e++}}_processAnimations(){const t=this.data.animations||{};for(const e in t){this.animations[e]=[];for(let i=0;i<t[e].length;i++){const s=t[e][i];this.animations[e].push(this.textures[s])}}}_parseComplete(){const t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*Eo.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Eo.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=[]}};J0.BATCH_SIZE=1e3;let $0=J0;const ST=["jpg","png","jpeg","avif","webp"];function Q0(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=Jt.dirname(r[0]);t.linkedSheets.forEach((n,o)=>{const a=Q0([`${s}/${t.data.meta.related_multi_packs[o]}`],n,!0);Object.assign(i,a)})}return i}const CT={extension:z.Asset,cache:{test:r=>r instanceof $0,getCacheableAssets:(r,t)=>Q0(r,t,!1)},resolver:{test:r=>{const t=r.split("?")[0].split("."),e=t.pop(),i=t.pop();return e==="json"&&ST.includes(i)},parse:r=>{var e;const t=r.split(".");return{resolution:parseFloat(((e=$.RETINA_PREFIX.exec(r))==null?void 0:e[1])??"1"),format:t[t.length-2],src:r}}},loader:{name:"spritesheetLoader",extension:{type:z.LoadParser,priority:ri.Normal},async testParse(r,t){return Jt.extname(t.src).toLowerCase()===".json"&&!!r.frames},async parse(r,t,e){var h,l;let i=Jt.dirname(t.src);i&&i.lastIndexOf("/")!==i.length-1&&(i+="/");let s=i+r.meta.image;s=fc(s,t.src);const n=(await e.load([s]))[s],o=new $0(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=fc(f,t.src),c.push(e.load({src:f,data:{ignoreMultiPack:!0}})))}const u=await Promise.all(c);o.linkedSheets=u,u.forEach(d=>{d.linkedSheets=[o].concat(o.linkedSheets.filter(f=>f!==d))})}return o},unload(r){r.destroy(!0)}}};it.add(CT);class Aa{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class Ma{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 Aa;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 Pc{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 Aa,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 Lc{static test(t){return typeof t=="string"&&t.includes("<font>")?Pc.test($.ADAPTER.parseXML(t)):!1}static parse(t){return Pc.parse($.ADAPTER.parseXML(t))}}const Gc=[Ma,Pc,Lc];function ET(r){for(let t=0;t<Gc.length;t++)if(Gc[t].test(r))return Gc[t];return null}function IT(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===Ca.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 _=y/u+b*m;let v=Math.max(p,_);v=Math.min(v,1),a.addColorStop(v,d[x]),p=v}}}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 AT(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=IT(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=Et.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 Ra(r){return r.codePointAt?r.codePointAt(0):r.charCodeAt(0)}function q0(r){return Array.from?Array.from(r):r.split("")}function MT(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(...q0(s))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}const br=class Fi{constructor(t,e,i){var c;const[s]=t.info,[n]=t.common,[o]=t.page,[a]=t.distanceField,h=Wi(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=ye.NO_PREMULTIPLIED_ALPHA,l[d].baseTexture.mipmap=di.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:_}=t.char[u];p/=h,m/=h,g/=h,y/=h,x/=h,b/=h,_/=h;const v=new ct(p+l[f].frame.x/h,m+l[f].frame.y/h,g,y);this.chars[d]={xOffset:x,yOffset:b,xAdvance:_,kerning:{},texture:new rt(l[f].baseTexture,v),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 Aa)s=t;else{const o=ET(t);if(!o)throw new Error("Unrecognized data format for font.");s=o.parse(t)}e instanceof rt&&(e=[e]);const n=new Fi(s,e,i);return Fi.available[n.font]=n,n}static uninstall(t){const e=Fi.available[t];if(!e)throw new Error(`No font found named '${t}'`);e.destroy(),delete Fi.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({},Fi.defaultOptions,i),c=MT(s),u=e instanceof yr?e:new yr(e),d=a,f=new Aa;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 _=[];for(let T=0;T<c.length;T++){g||(g=$.ADAPTER.createCanvas(),g.width=a,g.height=h,y=g.getContext("2d"),x=new dt(g,{resolution:o,...l}),_.push(new rt(x)),f.page.push({id:_.length-1,file:""}));const C=c[T],E=gr.measureText(C,u,!1,g),I=E.width,k=Math.ceil(E.height),L=Math.ceil((u.fontStyle==="italic"?2:1)*I);if(m>=h-k*o){if(m===0)throw new Error(`[BitmapFont] textureHeight ${h}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${C}')`);--T,g=null,y=null,x=null,m=0,p=0,b=0;continue}if(b=Math.max(k+E.fontProperties.descent,b),L*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}')`);--T,m+=b*o,m=Math.ceil(m),p=0,b=0;continue}AT(g,y,E,p,m,o,u);const P=Ra(E.text);f.char.push({id:P,page:_.length-1,x:p/o,y:m/o,width:L,height:k,xoffset:0,yoffset:0,xadvance:I-(u.dropShadow?u.dropShadowDistance:0)-(u.stroke?u.strokeThickness:0)}),p+=(L+2*n)*o,p=Math.ceil(p)}if(!(i!=null&&i.skipKerning))for(let T=0,C=c.length;T<C;T++){const E=c[T];for(let I=0;I<C;I++){const k=c[I],L=y.measureText(E).width,P=y.measureText(k).width,S=y.measureText(E+k).width-(L+P);S&&f.kerning.push({first:Ra(E),second:Ra(k),amount:S})}}const v=new Fi(f,_,!0);return Fi.available[t]!==void 0&&Fi.uninstall(t),Fi.available[t]=v,v}};br.ALPHA=[["a","z"],["A","Z"]," "],br.NUMERIC=[["0","9"]],br.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],br.ASCII=[[" ","~"]],br.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:br.ALPHANUMERIC},br.available={};let ni=br;var RT=`// Pixi texture info\r
1096
1096
  varying vec2 vTextureCoord;\r
1097
1097
  uniform sampler2D uSampler;\r
1098
1098
  \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 tm=[],em=[],im=[],rm=class P1 extends yt{constructor(t,e={}){super();const{align:i,tint:s,maxWidth:n,letterSpacing:o,fontName:a,fontSize:h}=Object.assign({},P1.styleDefaults,e);if(!ni.available[a])throw new Error(`Missing BitmapFont "${a}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=i,this._tintColor=new Et(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 Zi(()=>{this.dirty=!0},this,0,0),this._roundPixels=Q.ROUND_PIXELS,this.dirty=!0,this._resolution=Q.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){var L;const t=ni.available[this._fontName],e=this.fontSize,i=e/t.size,s=new at,n=[],o=[],a=[],h=this._text.replace(/(?:\r\n|\r)/g,`
1149
+ `;const tm=[],em=[],im=[],rm=class P1 extends gt{constructor(t,e={}){super();const{align:i,tint:s,maxWidth:n,letterSpacing:o,fontName:a,fontSize:h}=Object.assign({},P1.styleDefaults,e);if(!ni.available[a])throw new Error(`Missing BitmapFont "${a}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=i,this._tintColor=new Et(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 Zi(()=>{this.dirty=!0},this,0,0),this._roundPixels=$.ROUND_PIXELS,this.dirty=!0,this._resolution=$.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){var L;const t=ni.available[this._fontName],e=this.fontSize,i=e/t.size,s=new at,n=[],o=[],a=[],h=this._text.replace(/(?:\r\n|\r)/g,`
1150
1150
  `)||" ",l=q0(h),c=this._maxWidth*t.size/e,u=t.distanceFieldType==="none"?tm:em;let d=null,f=0,p=0,m=0,g=-1,y=0,x=0,b=0,_=0;for(let P=0;P<l.length;P++){const S=l[P],R=Ra(S);if(/(?:\s)/.test(S)&&(g=P,y=f,_++),S==="\r"||S===`
1151
1151
  `){o.push(f),a.push(-1),p=Math.max(p,f),++m,++x,s.x=0,s.y+=t.lineHeight,d=null,_=0;continue}const F=t.chars[R];if(!F)continue;d&&F.kerning[d]&&(s.x+=F.kerning[d]);const O=im.pop()||{texture:rt.EMPTY,line:0,charCode:0,prevSpaces:0,position:new at};O.texture=F.texture,O.line=m,O.charCode=R,O.position.x=Math.round(s.x+F.xOffset+this._letterSpacing/2),O.position.y=Math.round(s.y+F.yOffset),O.prevSpaces=_,n.push(O),f=O.position.x+Math.max(F.xAdvance-F.xOffset,F.texture.orig.width),s.x+=F.xAdvance+this._letterSpacing,b=Math.max(b,F.yOffset+F.texture.height),d=R,g!==-1&&c>0&&s.x>c&&(++x,Fs(n,1+g-x,1+P-g),P=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,_=0)}const v=l[l.length-1];v!=="\r"&&v!==`
1152
- `&&(/(?:\s)/.test(v)&&(f=y),o.push(f),p=Math.max(p,f),a.push(-1));const T=[];for(let P=0;P<=m;P++){let S=0;this._align==="right"?S=p-o[P]:this._align==="center"?S=(p-o[P])/2:this._align==="justify"&&(S=a[P]<0?0:(p-o[P])/a[P]),T.push(S)}const C=n.length,E={},I=[],k=this._activePagesMeshData;u.push(...k);for(let P=0;P<C;P++){const S=n[P].texture,R=S.baseTexture.uid;if(!E[R]){let F=u.pop();if(!F){const B=new U0;let Z,st;t.distanceFieldType==="none"?(Z=new Ic(rt.EMPTY),st=lt.NORMAL):(Z=new Ic(rt.EMPTY,{program:Vi.from(PT,RT),uniforms:{uFWidth:0}}),st=lt.NORMAL_NPM);const X=new Ec(B,Z);X.blendMode=st,F={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:X,vertices:null,uvs:null,indices:null}}F.index=0,F.indexCount=0,F.vertexCount=0,F.uvsCount=0,F.total=0;const{_textureCache:O}=this;O[R]=O[R]||new rt(S.baseTexture),F.mesh.texture=O[R],F.mesh.tint=this._tintColor.value,I.push(F),E[R]=F}E[R].total++}for(let P=0;P<k.length;P++)I.includes(k[P])||this.removeChild(k[P].mesh);for(let P=0;P<I.length;P++)I[P].mesh.parent!==this&&this.addChild(I[P].mesh);this._activePagesMeshData=I;for(const P in E){const S=E[P],R=S.total;if(!(((L=S.indices)==null?void 0:L.length)>6*R)||S.vertices.length<Ec.BATCHABLE_SIZE*2)S.vertices=new Float32Array(4*2*R),S.uvs=new Float32Array(4*2*R),S.indices=new Uint16Array(6*R);else{const F=S.total,O=S.vertices;for(let B=F*4*2;B<O.length;B++)O[B]=0}S.mesh.size=6*R}for(let P=0;P<C;P++){const S=n[P];let R=S.position.x+T[S.line]*(this._align==="justify"?S.prevSpaces:1);this._roundPixels&&(R=Math.round(R));const F=R*i,O=S.position.y*i,B=S.texture,Z=E[B.baseTexture.uid],st=B.frame,X=B._uvs,M=Z.index++;Z.indices[M*6+0]=0+M*4,Z.indices[M*6+1]=1+M*4,Z.indices[M*6+2]=2+M*4,Z.indices[M*6+3]=0+M*4,Z.indices[M*6+4]=2+M*4,Z.indices[M*6+5]=3+M*4,Z.vertices[M*8+0]=F,Z.vertices[M*8+1]=O,Z.vertices[M*8+2]=F+st.width*i,Z.vertices[M*8+3]=O,Z.vertices[M*8+4]=F+st.width*i,Z.vertices[M*8+5]=O+st.height*i,Z.vertices[M*8+6]=F,Z.vertices[M*8+7]=O+st.height*i,Z.uvs[M*8+0]=X.x0,Z.uvs[M*8+1]=X.y0,Z.uvs[M*8+2]=X.x1,Z.uvs[M*8+3]=X.y1,Z.uvs[M*8+4]=X.x2,Z.uvs[M*8+5]=X.y2,Z.uvs[M*8+6]=X.x3,Z.uvs[M*8+7]=X.y3}this._textWidth=p*i,this._textHeight=(s.y+t.lineHeight)*i;for(const P in E){const S=E[P];if(this.anchor.x!==0||this.anchor.y!==0){let B=0;const Z=this._textWidth*this.anchor.x,st=this._textHeight*this.anchor.y;for(let X=0;X<S.total;X++)S.vertices[B++]-=Z,S.vertices[B++]-=st,S.vertices[B++]-=Z,S.vertices[B++]-=st,S.vertices[B++]-=Z,S.vertices[B++]-=st,S.vertices[B++]-=Z,S.vertices[B++]-=st}this._maxLineHeight=b*i;const R=S.mesh.geometry.getBuffer("aVertexPosition"),F=S.mesh.geometry.getBuffer("aTextureCoord"),O=S.mesh.geometry.getIndex();R.data=S.vertices,F.data=S.uvs,O.data=S.indices,R.update(),F.update(),O.update()}for(let P=0;P<n.length;P++)im.push(n[P]);this._font=t,this.dirty=!1}updateTransform(){this.validate(),this.containerUpdateTransform()}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0);const{distanceFieldRange:e,distanceFieldType:i,size:s}=ni.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=ni.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(!ni.available[t])throw new Error(`Missing BitmapFont "${t}"`);this._fontName!==t&&(this._fontName=t,this.dirty=!0)}get fontSize(){return this._fontSize??ni.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=ni.available[this._fontName].distanceFieldType==="none"?tm:em;i.push(...this._activePagesMeshData);for(const s of this._activePagesMeshData)this.removeChild(s.mesh);this._activePagesMeshData=[],i.filter(s=>e[s.mesh.texture.baseTexture.uid]).forEach(s=>{s.mesh.texture=rt.EMPTY});for(const s in e)e[s].destroy(),delete e[s];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(t)}};rm.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};let LT=rm;const GT=[".xml",".fnt"],kT={extension:{type:z.LoadParser,priority:ri.Normal},name:"loadBitmapFont",test(r){return GT.includes(Jt.extname(r).toLowerCase())},async testParse(r){return Ma.test(r)||Lc.test(r)},async parse(r,t,e){const i=Ma.test(r)?Ma.parse(r):Lc.parse(r),{src:s}=t,{page:n}=i,o=[];for(let l=0;l<n.length;++l){const c=n[l].file;let u=Jt.join(Jt.dirname(s),c);u=fc(u,s),o.push(u)}const a=await e.load(o),h=o.map(l=>a[l]);return ni.install(i,h,!0)},async load(r,t){return(await Q.ADAPTER.fetch(r)).text()},unload(r){r.destroy()}};it.add(kT);const kc=class gn extends yr{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(t){return new gn(Object.keys(gn.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 gn.availableFonts[t.originalUrl])}),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(t,e={}){const{availableFonts:i}=gn;if(i[t]){const s=i[t];return this._fonts.push(s),s.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return Q.ADAPTER.fetch(t).then(s=>s.blob()).then(async s=>new Promise((n,o)=>{const a=URL.createObjectURL(s),h=new FileReader;h.onload=()=>n([a,h.result]),h.onerror=o,h.readAsDataURL(s)})).then(async([s,n])=>{const o=Object.assign({family:Jt.basename(t,Jt.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}
1152
+ `&&(/(?:\s)/.test(v)&&(f=y),o.push(f),p=Math.max(p,f),a.push(-1));const T=[];for(let P=0;P<=m;P++){let S=0;this._align==="right"?S=p-o[P]:this._align==="center"?S=(p-o[P])/2:this._align==="justify"&&(S=a[P]<0?0:(p-o[P])/a[P]),T.push(S)}const C=n.length,E={},I=[],k=this._activePagesMeshData;u.push(...k);for(let P=0;P<C;P++){const S=n[P].texture,R=S.baseTexture.uid;if(!E[R]){let F=u.pop();if(!F){const U=new B0;let Z,st;t.distanceFieldType==="none"?(Z=new Ic(rt.EMPTY),st=lt.NORMAL):(Z=new Ic(rt.EMPTY,{program:Vi.from(PT,RT),uniforms:{uFWidth:0}}),st=lt.NORMAL_NPM);const X=new Ec(U,Z);X.blendMode=st,F={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:X,vertices:null,uvs:null,indices:null}}F.index=0,F.indexCount=0,F.vertexCount=0,F.uvsCount=0,F.total=0;const{_textureCache:O}=this;O[R]=O[R]||new rt(S.baseTexture),F.mesh.texture=O[R],F.mesh.tint=this._tintColor.value,I.push(F),E[R]=F}E[R].total++}for(let P=0;P<k.length;P++)I.includes(k[P])||this.removeChild(k[P].mesh);for(let P=0;P<I.length;P++)I[P].mesh.parent!==this&&this.addChild(I[P].mesh);this._activePagesMeshData=I;for(const P in E){const S=E[P],R=S.total;if(!(((L=S.indices)==null?void 0:L.length)>6*R)||S.vertices.length<Ec.BATCHABLE_SIZE*2)S.vertices=new Float32Array(4*2*R),S.uvs=new Float32Array(4*2*R),S.indices=new Uint16Array(6*R);else{const F=S.total,O=S.vertices;for(let U=F*4*2;U<O.length;U++)O[U]=0}S.mesh.size=6*R}for(let P=0;P<C;P++){const S=n[P];let R=S.position.x+T[S.line]*(this._align==="justify"?S.prevSpaces:1);this._roundPixels&&(R=Math.round(R));const F=R*i,O=S.position.y*i,U=S.texture,Z=E[U.baseTexture.uid],st=U.frame,X=U._uvs,M=Z.index++;Z.indices[M*6+0]=0+M*4,Z.indices[M*6+1]=1+M*4,Z.indices[M*6+2]=2+M*4,Z.indices[M*6+3]=0+M*4,Z.indices[M*6+4]=2+M*4,Z.indices[M*6+5]=3+M*4,Z.vertices[M*8+0]=F,Z.vertices[M*8+1]=O,Z.vertices[M*8+2]=F+st.width*i,Z.vertices[M*8+3]=O,Z.vertices[M*8+4]=F+st.width*i,Z.vertices[M*8+5]=O+st.height*i,Z.vertices[M*8+6]=F,Z.vertices[M*8+7]=O+st.height*i,Z.uvs[M*8+0]=X.x0,Z.uvs[M*8+1]=X.y0,Z.uvs[M*8+2]=X.x1,Z.uvs[M*8+3]=X.y1,Z.uvs[M*8+4]=X.x2,Z.uvs[M*8+5]=X.y2,Z.uvs[M*8+6]=X.x3,Z.uvs[M*8+7]=X.y3}this._textWidth=p*i,this._textHeight=(s.y+t.lineHeight)*i;for(const P in E){const S=E[P];if(this.anchor.x!==0||this.anchor.y!==0){let U=0;const Z=this._textWidth*this.anchor.x,st=this._textHeight*this.anchor.y;for(let X=0;X<S.total;X++)S.vertices[U++]-=Z,S.vertices[U++]-=st,S.vertices[U++]-=Z,S.vertices[U++]-=st,S.vertices[U++]-=Z,S.vertices[U++]-=st,S.vertices[U++]-=Z,S.vertices[U++]-=st}this._maxLineHeight=b*i;const R=S.mesh.geometry.getBuffer("aVertexPosition"),F=S.mesh.geometry.getBuffer("aTextureCoord"),O=S.mesh.geometry.getIndex();R.data=S.vertices,F.data=S.uvs,O.data=S.indices,R.update(),F.update(),O.update()}for(let P=0;P<n.length;P++)im.push(n[P]);this._font=t,this.dirty=!1}updateTransform(){this.validate(),this.containerUpdateTransform()}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0);const{distanceFieldRange:e,distanceFieldType:i,size:s}=ni.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=ni.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(!ni.available[t])throw new Error(`Missing BitmapFont "${t}"`);this._fontName!==t&&(this._fontName=t,this.dirty=!0)}get fontSize(){return this._fontSize??ni.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=ni.available[this._fontName].distanceFieldType==="none"?tm:em;i.push(...this._activePagesMeshData);for(const s of this._activePagesMeshData)this.removeChild(s.mesh);this._activePagesMeshData=[],i.filter(s=>e[s.mesh.texture.baseTexture.uid]).forEach(s=>{s.mesh.texture=rt.EMPTY});for(const s in e)e[s].destroy(),delete e[s];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(t)}};rm.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};let LT=rm;const GT=[".xml",".fnt"],kT={extension:{type:z.LoadParser,priority:ri.Normal},name:"loadBitmapFont",test(r){return GT.includes(Jt.extname(r).toLowerCase())},async testParse(r){return Ma.test(r)||Lc.test(r)},async parse(r,t,e){const i=Ma.test(r)?Ma.parse(r):Lc.parse(r),{src:s}=t,{page:n}=i,o=[];for(let l=0;l<n.length;++l){const c=n[l].file;let u=Jt.join(Jt.dirname(s),c);u=fc(u,s),o.push(u)}const a=await e.load(o),h=o.map(l=>a[l]);return ni.install(i,h,!0)},async load(r,t){return(await $.ADAPTER.fetch(r)).text()},unload(r){r.destroy()}};it.add(kT);const kc=class gn extends yr{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(t){return new gn(Object.keys(gn.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 gn.availableFonts[t.originalUrl])}),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(t,e={}){const{availableFonts:i}=gn;if(i[t]){const s=i[t];return this._fonts.push(s),s.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return $.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:Jt.basename(t,Jt.extname(t)),weight:"normal",style:"normal",display:"auto",src:s,dataSrc:n,refs:1,originalUrl:t,fontFace:null},e);i[t]=o,this._fonts.push(o),this.styleID++;const a=new FontFace(o.family,`url(${o.src})`,{weight:o.weight,style:o.style,display:o.display});o.fontFace=a,await a.load(),document.fonts.add(a),await document.fonts.ready,this.styleID++,this.fontsDirty=!0})}addOverride(...t){const e=t.filter(i=>!this._overrides.includes(i));e.length>0&&(this._overrides.push(...e),this.styleID++)}removeOverride(...t){const e=t.filter(i=>this._overrides.includes(i));e.length>0&&(this._overrides=this._overrides.filter(i=>!e.includes(i)),this.styleID++)}toCSS(t){return[`transform: scale(${t})`,"transform-origin: top left","display: inline-block",`color: ${this.normalizeColor(this.fill)}`,`font-size: ${this.fontSize}px`,`font-family: ${this.fontFamily}`,`font-weight: ${this.fontWeight}`,`font-style: ${this.fontStyle}`,`font-variant: ${this.fontVariant}`,`letter-spacing: ${this.letterSpacing}px`,`text-align: ${this.align}`,`padding: ${this.padding}px`,`white-space: ${this.whiteSpace}`,...this.lineHeight?[`line-height: ${this.lineHeight}px`]:[],...this.wordWrap?[`word-wrap: ${this.breakWords?"break-all":"break-word"}`,`max-width: ${this.wordWrapWidth}px`]:[],...this.strokeThickness?[`-webkit-text-stroke-width: ${this.strokeThickness}px`,`-webkit-text-stroke-color: ${this.normalizeColor(this.stroke)}`,`text-stroke-width: ${this.strokeThickness}px`,`text-stroke-color: ${this.normalizeColor(this.stroke)}`,"paint-order: stroke"]:[],...this.dropShadow?[this.dropShadowToCSS()]:[],...this._overrides].join(";")}toGlobalCSS(){return this._fonts.reduce((t,e)=>`${t}
1153
1153
  @font-face {
1154
1154
  font-family: "${e.family}";
1155
1155
  src: url('${e.dataSrc}');
1156
1156
  font-weight: ${e.weight};
1157
1157
  font-style: ${e.style};
1158
1158
  font-display: ${e.display};
1159
- }`,this._stylesheet)}get stylesheet(){return this._stylesheet}set stylesheet(t){this._stylesheet!==t&&(this._stylesheet=t,this.styleID++)}normalizeColor(t){return Array.isArray(t)&&(t=S_(t)),typeof t=="number"?T_(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,gn.defaultOptions)}onBeforeDraw(){const{fontsDirty:t}=this;return this.fontsDirty=!1,this.isSafari&&this._fonts.length>0&&t?new Promise(e=>setTimeout(e,100)):Promise.resolve()}get isSafari(){const{userAgent:t}=Q.ADAPTER.getNavigator();return/^((?!chrome|android).)*safari/i.test(t)}set fillGradientStops(t){console.warn("[HTMLTextStyle] fillGradientStops is not supported by HTMLText")}get fillGradientStops(){return super.fillGradientStops}set fillGradientType(t){console.warn("[HTMLTextStyle] fillGradientType is not supported by HTMLText")}get fillGradientType(){return super.fillGradientType}set miterLimit(t){console.warn("[HTMLTextStyle] miterLimit is not supported by HTMLText")}get miterLimit(){return super.miterLimit}set trim(t){console.warn("[HTMLTextStyle] trim is not supported by HTMLText")}get trim(){return super.trim}set textBaseline(t){console.warn("[HTMLTextStyle] textBaseline is not supported by HTMLText")}get textBaseline(){return super.textBaseline}set leading(t){console.warn("[HTMLTextStyle] leading is not supported by HTMLText")}get leading(){return super.leading}set lineJoin(t){console.warn("[HTMLTextStyle] lineJoin is not supported by HTMLText")}get lineJoin(){return super.lineJoin}};kc.availableFonts={},kc.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 Fc=kc;const Pa=class yn extends Vt{constructor(t="",e={}){super(rt.EMPTY),this._text=null,this._style=null,this._autoResolution=!0,this.localStyleID=-1,this.dirty=!1,this._updateID=0,this.ownsStyle=!1;const i=new Image,s=rt.from(i,{scaleMode:Q.SCALE_MODE,resourceOptions:{autoLoad:!1}});s.orig=new ct,s.trim=new ct,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=yn.defaultMaxWidth,this.maxHeight=yn.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=yn.defaultAutoResolution,this._resolution=yn.defaultResolution??Q.RESOLUTION,this.text=t,this.style=e}measureText(t){var c,u;const{text:e,style:i,resolution:s}=Object.assign({text:this._text,style:this._style,resolution:this._resolution},t);Object.assign(this._domElement,{innerHTML:e,style:i.toCSS(s)}),this._styleElement.textContent=i.toGlobalCSS(),document.body.appendChild(this._svgRoot);const n=this._domElement.getBoundingClientRect();this._svgRoot.remove();const{width:o,height:a}=n;(o>this.maxWidth||a>this.maxHeight)&&console.warn("[HTMLText] Large expanse of text, increase HTMLText.maxWidth or HTMLText.maxHeight property.");const h=Math.min(this.maxWidth,Math.ceil(o)),l=Math.min(this.maxHeight,Math.ceil(a));return this._svgRoot.setAttribute("width",h.toString()),this._svgRoot.setAttribute("height",l.toString()),e!==this._text&&(this._domElement.innerHTML=this._text),i!==this._style&&(Object.assign(this._domElement,{style:(c=this._style)==null?void 0:c.toCSS(s)}),this._styleElement.textContent=(u=this._style)==null?void 0:u.toGlobalCSS()),{width:h+i.padding*2,height:l+i.padding*2}}async updateText(t=!0){const{style:e,_image:i,_loadImage:s}=this;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&t)return;const{width:n,height:o}=this.measureText();i.width=s.width=Math.ceil(Math.max(1,n)),i.height=s.height=Math.ceil(Math.max(1,o)),this._updateID++;const a=this._updateID;await new Promise(h=>{s.onload=async()=>{if(a<this._updateID){h();return}await e.onBeforeDraw(),i.src=s.src,s.onload=null,s.src="",this.updateTexture(),h()};const l=new XMLSerializer().serializeToString(this._svgRoot);s.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(l)}`})}get source(){return this._image}updateTexture(){const{style:t,texture:e,_image:i,resolution:s}=this,{padding:n}=t,{baseTexture:o}=e;e.trim.width=e._frame.width=i.width/s,e.trim.height=e._frame.height=i.height/s,e.trim.x=-n,e.trim.y=-n,e.orig.width=e._frame.width-n*2,e.orig.height=e._frame.height-n*2,this._onTextureUpdate(),o.setRealSize(i.width,i.height,s),this.dirty=!1}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._render(t)}_renderCanvas(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._renderCanvas(t)}getLocalBounds(t){return this.updateText(!0),super.getLocalBounds(t)}_calculateBounds(){this.updateText(!0),this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_onStyleChange(){this.dirty=!0}destroy(t){var i,s,n,o,a;typeof t=="boolean"&&(t={children:t}),t=Object.assign({},yn.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=hr(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=hr(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 Fc?(this.ownsStyle=!1,this._style=t):t instanceof yr?(console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle"),this.ownsStyle=!0,this._style=Fc.from(t)):(this.ownsStyle=!0,this._style=new Fc(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;")}};Pa.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},Pa.defaultMaxWidth=2024,Pa.defaultMaxHeight=2024,Pa.defaultAutoResolution=!0;function FT(){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 K=FT();function be(r){let t;return new Promise(e=>{t=e,K.on(r,t)}).then(e=>(K.off(r,t),e))}let wi=null;const sm=new ResizeObserver(()=>{wi&&K.emit("stageUpdated",wi)});function NT(r){wi=r,sm.observe(wi),K.emit("stageCreated",wi)}function DT(){wi&&sm.unobserve(wi),wi=null}async function Nc(){return wi||await be("stageCreated")}let xe=null;async function OT(){const r=await Nc();BT(r),K.on("stageUpdated",XT)}function UT(){xe&&(xe.destroy(!0,{children:!0}),xe=null)}function BT(r){xe||(xe=new y0({backgroundAlpha:0,resizeTo:r,antialias:!0,resolution:Math.ceil(window.devicePixelRatio)}),xe.stage.sortableChildren=!0,r.appendChild(xe.view),K.emit("applicationCreated",xe),process.env.NODE_ENV==="development"&&(globalThis.__PIXI_APP__=xe))}async function Ht(){return xe||await be("applicationCreated")}function XT(r){xe&&(xe.resizeTo=r,K.emit("applicationResized",xe))}let La=new Map;function WT(){La=new Map}async function Un(r,t){const e=`${r.toString()}-${JSON.stringify(t)}`;if(La.has(e))return La.get(e);const i=await r(...t);return La.set(e,i),i}let Vs=null;const ZT={animationDuration:500,disableAnimationsThreshold:500,disableEdgesThreshold:500,fetchEvents:()=>[],fetchEventsInterval:3e4,theme:"dark"};function VT(r){return{...ZT,...r}}function HT(r){nm(r)}function nm(r){const t=VT(r);if(!Vs){Vs=t,K.emit("configCreated",t);return}Object.assign(Vs,t),K.emit("configUpdated",t)}function KT(){Vs=null}async function Me(){return Vs||await be("configCreated")}const qr=new ct;class YT{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,qr),this._recursive?this.cullRecursive(t,i,e):(e&&i._bounds.getRectangle(t),i[this._toggle]=qr.right>t.left&&qr.left<t.right&&qr.bottom>t.top&&qr.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(qr):e.getBounds(!0,qr);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 Ga={exports:{}};Ga.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]",_="[object Proxy]",v="[object RegExp]",T="[object Set]",C="[object String]",E="[object Symbol]",I="[object Undefined]",k="[object WeakMap]",L="[object ArrayBuffer]",P="[object DataView]",S="[object Float32Array]",R="[object Float64Array]",F="[object Int8Array]",O="[object Int16Array]",B="[object Int32Array]",Z="[object Uint8Array]",st="[object Uint8ClampedArray]",X="[object Uint16Array]",M="[object Uint32Array]",D=/[\\^$.*+?()[\]{}|]/g,V=/^\[object .+?Constructor\]$/,J=/^(?:0|[1-9]\d*)$/,j={};j[S]=j[R]=j[F]=j[O]=j[B]=j[Z]=j[st]=j[X]=j[M]=!0,j[a]=j[h]=j[L]=j[c]=j[P]=j[u]=j[d]=j[f]=j[m]=j[g]=j[x]=j[v]=j[T]=j[C]=j[k]=!1;var mt=typeof $e=="object"&&$e&&$e.Object===Object&&$e,Tt=typeof self=="object"&&self&&self.Object===Object&&self,bt=mt||Tt||Function("return this")(),N=t&&!t.nodeType&&t,Y=N&&!0&&r&&!r.nodeType&&r,H=Y&&Y.exports===N,G=H&&mt.process,ut=function(){try{return G&&G.binding&&G.binding("util")}catch{}}(),ht=ut&&ut.isTypedArray;function wt(w,A){for(var U=-1,tt=w==null?0:w.length,At=0,ft=[];++U<tt;){var Bt=w[U];A(Bt,U,w)&&(ft[At++]=Bt)}return ft}function Rt(w,A){for(var U=-1,tt=A.length,At=w.length;++U<tt;)w[At+U]=A[U];return w}function Fe(w,A){for(var U=-1,tt=w==null?0:w.length;++U<tt;)if(A(w[U],U,w))return!0;return!1}function Gi(w,A){for(var U=-1,tt=Array(w);++U<w;)tt[U]=A(U);return tt}function od(w){return function(A){return w(A)}}function ad(w,A){return w.has(A)}function hd(w,A){return w==null?void 0:w[A]}function l1(w){var A=-1,U=Array(w.size);return w.forEach(function(tt,At){U[++A]=[At,tt]}),U}function aR(w,A){return function(U){return w(A(U))}}function hR(w){var A=-1,U=Array(w.size);return w.forEach(function(tt){U[++A]=tt}),U}var lR=Array.prototype,cR=Function.prototype,xh=Object.prototype,ld=bt["__core-js_shared__"],c1=cR.toString,ki=xh.hasOwnProperty,u1=function(){var w=/[^.]+$/.exec(ld&&ld.keys&&ld.keys.IE_PROTO||"");return w?"Symbol(src)_1."+w:""}(),d1=xh.toString,uR=RegExp("^"+c1.call(ki).replace(D,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),f1=H?bt.Buffer:void 0,_h=bt.Symbol,p1=bt.Uint8Array,m1=xh.propertyIsEnumerable,dR=lR.splice,bs=_h?_h.toStringTag:void 0,g1=Object.getOwnPropertySymbols,fR=f1?f1.isBuffer:void 0,pR=aR(Object.keys,Object),cd=fn(bt,"DataView"),bo=fn(bt,"Map"),ud=fn(bt,"Promise"),dd=fn(bt,"Set"),fd=fn(bt,"WeakMap"),xo=fn(Object,"create"),mR=vs(cd),gR=vs(bo),yR=vs(ud),bR=vs(dd),xR=vs(fd),y1=_h?_h.prototype:void 0,pd=y1?y1.valueOf:void 0;function xs(w){var A=-1,U=w==null?0:w.length;for(this.clear();++A<U;){var tt=w[A];this.set(tt[0],tt[1])}}function _R(){this.__data__=xo?xo(null):{},this.size=0}function vR(w){var A=this.has(w)&&delete this.__data__[w];return this.size-=A?1:0,A}function wR(w){var A=this.__data__;if(xo){var U=A[w];return U===i?void 0:U}return ki.call(A,w)?A[w]:void 0}function TR(w){var A=this.__data__;return xo?A[w]!==void 0:ki.call(A,w)}function SR(w,A){var U=this.__data__;return this.size+=this.has(w)?0:1,U[w]=xo&&A===void 0?i:A,this}xs.prototype.clear=_R,xs.prototype.delete=vR,xs.prototype.get=wR,xs.prototype.has=TR,xs.prototype.set=SR;function rr(w){var A=-1,U=w==null?0:w.length;for(this.clear();++A<U;){var tt=w[A];this.set(tt[0],tt[1])}}function CR(){this.__data__=[],this.size=0}function ER(w){var A=this.__data__,U=wh(A,w);if(U<0)return!1;var tt=A.length-1;return U==tt?A.pop():dR.call(A,U,1),--this.size,!0}function IR(w){var A=this.__data__,U=wh(A,w);return U<0?void 0:A[U][1]}function AR(w){return wh(this.__data__,w)>-1}function MR(w,A){var U=this.__data__,tt=wh(U,w);return tt<0?(++this.size,U.push([w,A])):U[tt][1]=A,this}rr.prototype.clear=CR,rr.prototype.delete=ER,rr.prototype.get=IR,rr.prototype.has=AR,rr.prototype.set=MR;function _s(w){var A=-1,U=w==null?0:w.length;for(this.clear();++A<U;){var tt=w[A];this.set(tt[0],tt[1])}}function RR(){this.size=0,this.__data__={hash:new xs,map:new(bo||rr),string:new xs}}function PR(w){var A=Th(this,w).delete(w);return this.size-=A?1:0,A}function LR(w){return Th(this,w).get(w)}function GR(w){return Th(this,w).has(w)}function kR(w,A){var U=Th(this,w),tt=U.size;return U.set(w,A),this.size+=U.size==tt?0:1,this}_s.prototype.clear=RR,_s.prototype.delete=PR,_s.prototype.get=LR,_s.prototype.has=GR,_s.prototype.set=kR;function vh(w){var A=-1,U=w==null?0:w.length;for(this.__data__=new _s;++A<U;)this.add(w[A])}function FR(w){return this.__data__.set(w,i),this}function NR(w){return this.__data__.has(w)}vh.prototype.add=vh.prototype.push=FR,vh.prototype.has=NR;function Rr(w){var A=this.__data__=new rr(w);this.size=A.size}function DR(){this.__data__=new rr,this.size=0}function OR(w){var A=this.__data__,U=A.delete(w);return this.size=A.size,U}function UR(w){return this.__data__.get(w)}function BR(w){return this.__data__.has(w)}function XR(w,A){var U=this.__data__;if(U instanceof rr){var tt=U.__data__;if(!bo||tt.length<e-1)return tt.push([w,A]),this.size=++U.size,this;U=this.__data__=new _s(tt)}return U.set(w,A),this.size=U.size,this}Rr.prototype.clear=DR,Rr.prototype.delete=OR,Rr.prototype.get=UR,Rr.prototype.has=BR,Rr.prototype.set=XR;function WR(w,A){var U=Sh(w),tt=!U&&rP(w),At=!U&&!tt&&md(w),ft=!U&&!tt&&!At&&E1(w),Bt=U||tt||At||ft,ne=Bt?Gi(w.length,String):[],ae=ne.length;for(var Dt in w)ki.call(w,Dt)&&!(Bt&&(Dt=="length"||At&&(Dt=="offset"||Dt=="parent")||ft&&(Dt=="buffer"||Dt=="byteLength"||Dt=="byteOffset")||QR(Dt,ae)))&&ne.push(Dt);return ne}function wh(w,A){for(var U=w.length;U--;)if(w1(w[U][0],A))return U;return-1}function ZR(w,A,U){var tt=A(w);return Sh(w)?tt:Rt(tt,U(w))}function _o(w){return w==null?w===void 0?I:y:bs&&bs in Object(w)?JR(w):iP(w)}function b1(w){return vo(w)&&_o(w)==a}function x1(w,A,U,tt,At){return w===A?!0:w==null||A==null||!vo(w)&&!vo(A)?w!==w&&A!==A:VR(w,A,U,tt,x1,At)}function VR(w,A,U,tt,At,ft){var Bt=Sh(w),ne=Sh(A),ae=Bt?h:Pr(w),Dt=ne?h:Pr(A);ae=ae==a?x:ae,Dt=Dt==a?x:Dt;var Ne=ae==x,hi=Dt==x,fe=ae==Dt;if(fe&&md(w)){if(!md(A))return!1;Bt=!0,Ne=!1}if(fe&&!Ne)return ft||(ft=new Rr),Bt||E1(w)?_1(w,A,U,tt,At,ft):zR(w,A,ae,U,tt,At,ft);if(!(U&s)){var je=Ne&&ki.call(w,"__wrapped__"),Je=hi&&ki.call(A,"__wrapped__");if(je||Je){var Lr=je?w.value():w,sr=Je?A.value():A;return ft||(ft=new Rr),At(Lr,sr,U,tt,ft)}}return fe?(ft||(ft=new Rr),jR(w,A,U,tt,At,ft)):!1}function HR(w){if(!C1(w)||tP(w))return!1;var A=T1(w)?uR:V;return A.test(vs(w))}function KR(w){return vo(w)&&S1(w.length)&&!!j[_o(w)]}function YR(w){if(!eP(w))return pR(w);var A=[];for(var U in Object(w))ki.call(w,U)&&U!="constructor"&&A.push(U);return A}function _1(w,A,U,tt,At,ft){var Bt=U&s,ne=w.length,ae=A.length;if(ne!=ae&&!(Bt&&ae>ne))return!1;var Dt=ft.get(w);if(Dt&&ft.get(A))return Dt==A;var Ne=-1,hi=!0,fe=U&n?new vh:void 0;for(ft.set(w,A),ft.set(A,w);++Ne<ne;){var je=w[Ne],Je=A[Ne];if(tt)var Lr=Bt?tt(Je,je,Ne,A,w,ft):tt(je,Je,Ne,w,A,ft);if(Lr!==void 0){if(Lr)continue;hi=!1;break}if(fe){if(!Fe(A,function(sr,ws){if(!ad(fe,ws)&&(je===sr||At(je,sr,U,tt,ft)))return fe.push(ws)})){hi=!1;break}}else if(!(je===Je||At(je,Je,U,tt,ft))){hi=!1;break}}return ft.delete(w),ft.delete(A),hi}function zR(w,A,U,tt,At,ft,Bt){switch(U){case P:if(w.byteLength!=A.byteLength||w.byteOffset!=A.byteOffset)return!1;w=w.buffer,A=A.buffer;case L:return!(w.byteLength!=A.byteLength||!ft(new p1(w),new p1(A)));case c:case u:case g:return w1(+w,+A);case d:return w.name==A.name&&w.message==A.message;case v:case C:return w==A+"";case m:var ne=l1;case T:var ae=tt&s;if(ne||(ne=hR),w.size!=A.size&&!ae)return!1;var Dt=Bt.get(w);if(Dt)return Dt==A;tt|=n,Bt.set(w,A);var Ne=_1(ne(w),ne(A),tt,At,ft,Bt);return Bt.delete(w),Ne;case E:if(pd)return pd.call(w)==pd.call(A)}return!1}function jR(w,A,U,tt,At,ft){var Bt=U&s,ne=v1(w),ae=ne.length,Dt=v1(A),Ne=Dt.length;if(ae!=Ne&&!Bt)return!1;for(var hi=ae;hi--;){var fe=ne[hi];if(!(Bt?fe in A:ki.call(A,fe)))return!1}var je=ft.get(w);if(je&&ft.get(A))return je==A;var Je=!0;ft.set(w,A),ft.set(A,w);for(var Lr=Bt;++hi<ae;){fe=ne[hi];var sr=w[fe],ws=A[fe];if(tt)var I1=Bt?tt(ws,sr,fe,A,w,ft):tt(sr,ws,fe,w,A,ft);if(!(I1===void 0?sr===ws||At(sr,ws,U,tt,ft):I1)){Je=!1;break}Lr||(Lr=fe=="constructor")}if(Je&&!Lr){var Ch=w.constructor,Eh=A.constructor;Ch!=Eh&&"constructor"in w&&"constructor"in A&&!(typeof Ch=="function"&&Ch instanceof Ch&&typeof Eh=="function"&&Eh instanceof Eh)&&(Je=!1)}return ft.delete(w),ft.delete(A),Je}function v1(w){return ZR(w,oP,$R)}function Th(w,A){var U=w.__data__;return qR(A)?U[typeof A=="string"?"string":"hash"]:U.map}function fn(w,A){var U=hd(w,A);return HR(U)?U:void 0}function JR(w){var A=ki.call(w,bs),U=w[bs];try{w[bs]=void 0;var tt=!0}catch{}var At=d1.call(w);return tt&&(A?w[bs]=U:delete w[bs]),At}var $R=g1?function(w){return w==null?[]:(w=Object(w),wt(g1(w),function(A){return m1.call(w,A)}))}:aP,Pr=_o;(cd&&Pr(new cd(new ArrayBuffer(1)))!=P||bo&&Pr(new bo)!=m||ud&&Pr(ud.resolve())!=b||dd&&Pr(new dd)!=T||fd&&Pr(new fd)!=k)&&(Pr=function(w){var A=_o(w),U=A==x?w.constructor:void 0,tt=U?vs(U):"";if(tt)switch(tt){case mR:return P;case gR:return m;case yR:return b;case bR:return T;case xR:return k}return A});function QR(w,A){return A=A??o,!!A&&(typeof w=="number"||J.test(w))&&w>-1&&w%1==0&&w<A}function qR(w){var A=typeof w;return A=="string"||A=="number"||A=="symbol"||A=="boolean"?w!=="__proto__":w===null}function tP(w){return!!u1&&u1 in w}function eP(w){var A=w&&w.constructor,U=typeof A=="function"&&A.prototype||xh;return w===U}function iP(w){return d1.call(w)}function vs(w){if(w!=null){try{return c1.call(w)}catch{}try{return w+""}catch{}}return""}function w1(w,A){return w===A||w!==w&&A!==A}var rP=b1(function(){return arguments}())?b1:function(w){return vo(w)&&ki.call(w,"callee")&&!m1.call(w,"callee")},Sh=Array.isArray;function sP(w){return w!=null&&S1(w.length)&&!T1(w)}var md=fR||hP;function nP(w,A){return x1(w,A)}function T1(w){if(!C1(w))return!1;var A=_o(w);return A==f||A==p||A==l||A==_}function S1(w){return typeof w=="number"&&w>-1&&w%1==0&&w<=o}function C1(w){var A=typeof w;return w!=null&&(A=="object"||A=="function")}function vo(w){return w!=null&&typeof w=="object"}var E1=ht?od(ht):KR;function oP(w){return sP(w)?WR(w):YR(w)}function aP(){return[]}function hP(){return!1}r.exports=nP}(Ga,Ga.exports);var zT=Ga.exports;const om=xn(zT);class Xe{constructor(t){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 jT=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function JT(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var am={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(jT)})(am);var $T=am.exports;const hm=JT($T);function ka(r,t){if(r){if(typeof r=="function")return r;if(typeof r=="string")return hm[r]}else return hm[t]}const QT={removeOnInterrupt:!1,ease:"linear",time:1e3};class qT extends Xe{constructor(t,e={}){super(t),this.startWidth=null,this.startHeight=null,this.deltaWidth=null,this.deltaHeight=null,this.width=null,this.height=null,this.time=0,this.options=Object.assign({},QT,e),this.options.ease=ka(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 at(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 at(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 tS={sides:"all",friction:.5,time:150,ease:"easeInOutSine",underflow:"center",bounceBox:null};class eS extends Xe{constructor(t,e={}){super(t),this.options=Object.assign({},tS,e),this.ease=ka(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 at(e*this.parent.scale.x,i*this.parent.scale.y),bottomRight:new at(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 at(0,0),bottomRight:new at(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 iS={left:!1,right:!1,top:!1,bottom:!1,direction:null,underflow:"center"};class rS extends Xe{constructor(t,e={}){super(t),this.options=Object.assign({},iS,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 at(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 sS={minWidth:null,minHeight:null,maxWidth:null,maxHeight:null,minScale:null,maxScale:null};class nS extends Xe{constructor(t,e={}){super(t),this.options=Object.assign({},sS,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 oS={friction:.98,bounce:.8,minSpeed:.01},xr=16;class aS extends Xe{constructor(t,e={}){super(t),this.options=Object.assign({},oS,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*xr/o*(Math.pow(n,s/xr)-Math.pow(n,i/xr)),this.x*=Math.pow(this.percentChangeX,t/xr)}if(this.y){const n=this.percentChangeY,o=Math.log(n);this.parent.y+=this.y*xr/o*(Math.pow(n,s/xr)-Math.pow(n,i/xr)),this.y*=Math.pow(this.percentChangeY,t/xr)}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 hS={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 lS extends Xe{constructor(t,e={}){super(t),this.windowEventHandlers=[],this.options=Object.assign({},hS,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){typeof window>"u"||(window.addEventListener(t,e),this.windowEventHandlers.push({event:t,handler:e}))}destroy(){typeof window>"u"||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 at(this.last.x,this.last.y),world:this.parent.toWorld(new at(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 at(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 cS={speed:0,acceleration:null,radius:null};class uS extends Xe{constructor(t,e,i={}){super(t),this.target=e,this.options=Object.assign({},cS,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 dS={radius:null,distance:null,top:null,bottom:null,left:null,right:null,speed:8,reverse:!1,noDecelerate:!1,linear:!1,allowButtons:!1};class fS extends Xe{constructor(t,e={}){super(t),this.options=Object.assign({},dS,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 pS={noDrag:!1,percent:1,center:null,factor:1,axis:"all"};class mS extends Xe{constructor(t,e={}){super(t),this.active=!1,this.pinching=!1,this.moved=!1,this.options=Object.assign({},pS,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 at(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 gS={topLeft:!1,friction:.8,time:1e3,ease:"easeInOutSine",interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1};class yS extends Xe{constructor(t,e,i,s={}){super(t),this.options=Object.assign({},gS,s),this.ease=ka(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 bS={width:0,height:0,time:1e3,ease:"easeInOutSine",center:null,interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1,noMove:!1};class xS extends Xe{constructor(t,e={}){super(t),this.options=Object.assign({},bS,e),this.ease=ka(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 _S={percent:.1,smooth:!1,interrupt:!0,reverse:!1,center:null,lineHeight:20,axis:"all",keyToPress:null,trackpadPinch:!1,wheelZoom:!0};class vS extends Xe{constructor(t,e={}){super(t),this.options=Object.assign({},_S,e),this.keyIsPressed=!1,this.options.keyToPress&&this.handleKeyPresses(this.options.keyToPress)}handleKeyPresses(t){typeof window>"u"||(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 wS{constructor(t){this.viewport=t,this.touches=[],this.addListeners()}addListeners(){this.viewport.eventMode="static",this.viewport.forceHitArea||(this.viewport.hitArea=new ct(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(){var t;(t=this.viewport.options.events.domElement)==null||t.removeEventListener("wheel",this.wheelFunction)}down(t){if(!(this.viewport.pause||!this.viewport.visible)){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.visible)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.visible)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 at;return this.viewport.options.events.mapPositionToPoint(e,t.clientX,t.clientY),e}handleWheel(t){if(this.viewport.pause||!this.viewport.visible)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 Bn=["drag","pinch","wheel","follow","mouse-edges","decelerate","animate","bounce","snap-zoom","clamp-zoom","snap","clamp"];class TS{constructor(t){this.viewport=t,this.list=[],this.plugins={}}add(t,e,i=Bn.length){const s=this.plugins[t];s&&s.destroy(),this.plugins[t]=e;const n=Bn.indexOf(t);n!==-1&&Bn.splice(n,1),Bn.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 Bn)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 SS={screenWidth:typeof window>"u"?0:window.innerWidth,screenHeight:typeof window>"u"?0:window.innerHeight,worldWidth:null,worldHeight:null,threshold:5,passiveWheel:!0,stopPropagation:!1,forceHitArea:null,noTicker:!1,disableOnContextMenu:!1,ticker:me.shared,allowPreserveDragOutside:!1};class CS extends yt{constructor(t){super(),this._disableOnContextMenu=e=>e.preventDefault(),this.options={...SS,...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 wS(this),this.plugins=new TS(this)}destroy(t){var e;!this.options.noTicker&&this.tickerFunction&&this.options.ticker.remove(this.tickerFunction),this.options.disableOnContextMenu&&((e=this.options.events.domElement)==null||e.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 ct(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=typeof window>"u"?0:window.innerWidth,e=typeof window>"u"?0: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 ct(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight)}toWorld(t,e){return arguments.length===2?this.toLocal(new at(t,e)):this.toLocal(t)}toScreen(t,e){return arguments.length===2?this.toGlobal(new at(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 at(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 at(-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 xS(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 at(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 ct(0,0,this.worldWidth,this.worldHeight))}drag(t){return this.plugins.add("drag",new lS(this,t)),this}clamp(t){return this.plugins.add("clamp",new rS(this,t)),this}decelerate(t){return this.plugins.add("decelerate",new aS(this,t)),this}bounce(t){return this.plugins.add("bounce",new eS(this,t)),this}pinch(t){return this.plugins.add("pinch",new mS(this,t)),this}snap(t,e,i){return this.plugins.add("snap",new yS(this,t,e,i)),this}follow(t,e){return this.plugins.add("follow",new uS(this,t,e)),this}wheel(t){return this.plugins.add("wheel",new vS(this,t)),this}animate(t){return this.plugins.add("animate",new qT(this,t)),this}clampZoom(t){return this.plugins.add("clamp-zoom",new nS(this,t)),this}mouseEdges(t){return this.plugins.add("mouse-edges",new fS(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"})}}const Fa=1e3,lm=Symbol.for("constructDateFrom");async function cm(r,t){const e=await Me();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(),ES(s)))}function o(){clearTimeout(i)}return{start:n,stop:o}}function ES(r){const t=Math.floor(r.nodes.size/Fa)*Fa;return Math.max(Fa,t)}function Ki(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function um(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=S_(t)),typeof t=="number"?T_(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,gn.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}=$.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}};kc.availableFonts={},kc.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 Fc=kc;const Pa=class yn extends Vt{constructor(t="",e={}){super(rt.EMPTY),this._text=null,this._style=null,this._autoResolution=!0,this.localStyleID=-1,this.dirty=!1,this._updateID=0,this.ownsStyle=!1;const i=new Image,s=rt.from(i,{scaleMode:$.SCALE_MODE,resourceOptions:{autoLoad:!1}});s.orig=new ct,s.trim=new ct,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=yn.defaultMaxWidth,this.maxHeight=yn.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=yn.defaultAutoResolution,this._resolution=yn.defaultResolution??$.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({},yn.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=hr(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=hr(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 Fc?(this.ownsStyle=!1,this._style=t):t instanceof yr?(console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle"),this.ownsStyle=!0,this._style=Fc.from(t)):(this.ownsStyle=!0,this._style=new Fc(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;")}};Pa.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},Pa.defaultMaxWidth=2024,Pa.defaultMaxHeight=2024,Pa.defaultAutoResolution=!0;function FT(){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 K=FT();function be(r){let t;return new Promise(e=>{t=e,K.on(r,t)}).then(e=>(K.off(r,t),e))}let wi=null;const sm=new ResizeObserver(()=>{wi&&K.emit("stageUpdated",wi)});function NT(r){wi=r,sm.observe(wi),K.emit("stageCreated",wi)}function DT(){wi&&sm.unobserve(wi),wi=null}async function Nc(){return wi||await be("stageCreated")}let xe=null;async function OT(){const r=await Nc();UT(r),K.on("stageUpdated",XT)}function BT(){xe&&(xe.destroy(!0,{children:!0}),xe=null)}function UT(r){xe||(xe=new y0({backgroundAlpha:0,resizeTo:r,antialias:!0,resolution:Math.ceil(window.devicePixelRatio)}),xe.stage.sortableChildren=!0,r.appendChild(xe.view),K.emit("applicationCreated",xe),process.env.NODE_ENV==="development"&&(globalThis.__PIXI_APP__=xe))}async function Ht(){return xe||await be("applicationCreated")}function XT(r){xe&&(xe.resizeTo=r,K.emit("applicationResized",xe))}let La=new Map;function WT(){La=new Map}async function Bn(r,t){const e=`${r.toString()}-${JSON.stringify(t)}`;if(La.has(e))return La.get(e);const i=await r(...t);return La.set(e,i),i}let Vs=null;const ZT={animationDuration:500,disableAnimationsThreshold:500,disableEdgesThreshold:500,fetchEvents:()=>[],fetchEventsInterval:3e4,theme:"dark"};function VT(r){return{...ZT,...r}}function HT(r){nm(r)}function nm(r){const t=VT(r);if(!Vs){Vs=t,K.emit("configCreated",t);return}Object.assign(Vs,t),K.emit("configUpdated",t)}function KT(){Vs=null}async function Me(){return Vs||await be("configCreated")}const qr=new ct;class YT{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,qr),this._recursive?this.cullRecursive(t,i,e):(e&&i._bounds.getRectangle(t),i[this._toggle]=qr.right>t.left&&qr.left<t.right&&qr.bottom>t.top&&qr.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(qr):e.getBounds(!0,qr);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 Ga={exports:{}};Ga.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]",_="[object Proxy]",v="[object RegExp]",T="[object Set]",C="[object String]",E="[object Symbol]",I="[object Undefined]",k="[object WeakMap]",L="[object ArrayBuffer]",P="[object DataView]",S="[object Float32Array]",R="[object Float64Array]",F="[object Int8Array]",O="[object Int16Array]",U="[object Int32Array]",Z="[object Uint8Array]",st="[object Uint8ClampedArray]",X="[object Uint16Array]",M="[object Uint32Array]",D=/[\\^$.*+?()[\]{}|]/g,V=/^\[object .+?Constructor\]$/,Q=/^(?:0|[1-9]\d*)$/,j={};j[S]=j[R]=j[F]=j[O]=j[U]=j[Z]=j[st]=j[X]=j[M]=!0,j[a]=j[h]=j[L]=j[c]=j[P]=j[u]=j[d]=j[f]=j[m]=j[g]=j[x]=j[v]=j[T]=j[C]=j[k]=!1;var xt=typeof $e=="object"&&$e&&$e.Object===Object&&$e,Tt=typeof self=="object"&&self&&self.Object===Object&&self,yt=xt||Tt||Function("return this")(),N=t&&!t.nodeType&&t,Y=N&&!0&&r&&!r.nodeType&&r,H=Y&&Y.exports===N,G=H&&xt.process,ut=function(){try{return G&&G.binding&&G.binding("util")}catch{}}(),ht=ut&&ut.isTypedArray;function wt(w,A){for(var B=-1,tt=w==null?0:w.length,At=0,ft=[];++B<tt;){var Ut=w[B];A(Ut,B,w)&&(ft[At++]=Ut)}return ft}function Rt(w,A){for(var B=-1,tt=A.length,At=w.length;++B<tt;)w[At+B]=A[B];return w}function Fe(w,A){for(var B=-1,tt=w==null?0:w.length;++B<tt;)if(A(w[B],B,w))return!0;return!1}function Gi(w,A){for(var B=-1,tt=Array(w);++B<w;)tt[B]=A(B);return tt}function od(w){return function(A){return w(A)}}function ad(w,A){return w.has(A)}function hd(w,A){return w==null?void 0:w[A]}function l1(w){var A=-1,B=Array(w.size);return w.forEach(function(tt,At){B[++A]=[At,tt]}),B}function aR(w,A){return function(B){return w(A(B))}}function hR(w){var A=-1,B=Array(w.size);return w.forEach(function(tt){B[++A]=tt}),B}var lR=Array.prototype,cR=Function.prototype,xh=Object.prototype,ld=yt["__core-js_shared__"],c1=cR.toString,ki=xh.hasOwnProperty,u1=function(){var w=/[^.]+$/.exec(ld&&ld.keys&&ld.keys.IE_PROTO||"");return w?"Symbol(src)_1."+w:""}(),d1=xh.toString,uR=RegExp("^"+c1.call(ki).replace(D,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),f1=H?yt.Buffer:void 0,_h=yt.Symbol,p1=yt.Uint8Array,m1=xh.propertyIsEnumerable,dR=lR.splice,bs=_h?_h.toStringTag:void 0,g1=Object.getOwnPropertySymbols,fR=f1?f1.isBuffer:void 0,pR=aR(Object.keys,Object),cd=fn(yt,"DataView"),bo=fn(yt,"Map"),ud=fn(yt,"Promise"),dd=fn(yt,"Set"),fd=fn(yt,"WeakMap"),xo=fn(Object,"create"),mR=vs(cd),gR=vs(bo),yR=vs(ud),bR=vs(dd),xR=vs(fd),y1=_h?_h.prototype:void 0,pd=y1?y1.valueOf:void 0;function xs(w){var A=-1,B=w==null?0:w.length;for(this.clear();++A<B;){var tt=w[A];this.set(tt[0],tt[1])}}function _R(){this.__data__=xo?xo(null):{},this.size=0}function vR(w){var A=this.has(w)&&delete this.__data__[w];return this.size-=A?1:0,A}function wR(w){var A=this.__data__;if(xo){var B=A[w];return B===i?void 0:B}return ki.call(A,w)?A[w]:void 0}function TR(w){var A=this.__data__;return xo?A[w]!==void 0:ki.call(A,w)}function SR(w,A){var B=this.__data__;return this.size+=this.has(w)?0:1,B[w]=xo&&A===void 0?i:A,this}xs.prototype.clear=_R,xs.prototype.delete=vR,xs.prototype.get=wR,xs.prototype.has=TR,xs.prototype.set=SR;function rr(w){var A=-1,B=w==null?0:w.length;for(this.clear();++A<B;){var tt=w[A];this.set(tt[0],tt[1])}}function CR(){this.__data__=[],this.size=0}function ER(w){var A=this.__data__,B=wh(A,w);if(B<0)return!1;var tt=A.length-1;return B==tt?A.pop():dR.call(A,B,1),--this.size,!0}function IR(w){var A=this.__data__,B=wh(A,w);return B<0?void 0:A[B][1]}function AR(w){return wh(this.__data__,w)>-1}function MR(w,A){var B=this.__data__,tt=wh(B,w);return tt<0?(++this.size,B.push([w,A])):B[tt][1]=A,this}rr.prototype.clear=CR,rr.prototype.delete=ER,rr.prototype.get=IR,rr.prototype.has=AR,rr.prototype.set=MR;function _s(w){var A=-1,B=w==null?0:w.length;for(this.clear();++A<B;){var tt=w[A];this.set(tt[0],tt[1])}}function RR(){this.size=0,this.__data__={hash:new xs,map:new(bo||rr),string:new xs}}function PR(w){var A=Th(this,w).delete(w);return this.size-=A?1:0,A}function LR(w){return Th(this,w).get(w)}function GR(w){return Th(this,w).has(w)}function kR(w,A){var B=Th(this,w),tt=B.size;return B.set(w,A),this.size+=B.size==tt?0:1,this}_s.prototype.clear=RR,_s.prototype.delete=PR,_s.prototype.get=LR,_s.prototype.has=GR,_s.prototype.set=kR;function vh(w){var A=-1,B=w==null?0:w.length;for(this.__data__=new _s;++A<B;)this.add(w[A])}function FR(w){return this.__data__.set(w,i),this}function NR(w){return this.__data__.has(w)}vh.prototype.add=vh.prototype.push=FR,vh.prototype.has=NR;function Rr(w){var A=this.__data__=new rr(w);this.size=A.size}function DR(){this.__data__=new rr,this.size=0}function OR(w){var A=this.__data__,B=A.delete(w);return this.size=A.size,B}function BR(w){return this.__data__.get(w)}function UR(w){return this.__data__.has(w)}function XR(w,A){var B=this.__data__;if(B instanceof rr){var tt=B.__data__;if(!bo||tt.length<e-1)return tt.push([w,A]),this.size=++B.size,this;B=this.__data__=new _s(tt)}return B.set(w,A),this.size=B.size,this}Rr.prototype.clear=DR,Rr.prototype.delete=OR,Rr.prototype.get=BR,Rr.prototype.has=UR,Rr.prototype.set=XR;function WR(w,A){var B=Sh(w),tt=!B&&rP(w),At=!B&&!tt&&md(w),ft=!B&&!tt&&!At&&E1(w),Ut=B||tt||At||ft,ne=Ut?Gi(w.length,String):[],ae=ne.length;for(var Dt in w)ki.call(w,Dt)&&!(Ut&&(Dt=="length"||At&&(Dt=="offset"||Dt=="parent")||ft&&(Dt=="buffer"||Dt=="byteLength"||Dt=="byteOffset")||QR(Dt,ae)))&&ne.push(Dt);return ne}function wh(w,A){for(var B=w.length;B--;)if(w1(w[B][0],A))return B;return-1}function ZR(w,A,B){var tt=A(w);return Sh(w)?tt:Rt(tt,B(w))}function _o(w){return w==null?w===void 0?I:y:bs&&bs in Object(w)?JR(w):iP(w)}function b1(w){return vo(w)&&_o(w)==a}function x1(w,A,B,tt,At){return w===A?!0:w==null||A==null||!vo(w)&&!vo(A)?w!==w&&A!==A:VR(w,A,B,tt,x1,At)}function VR(w,A,B,tt,At,ft){var Ut=Sh(w),ne=Sh(A),ae=Ut?h:Pr(w),Dt=ne?h:Pr(A);ae=ae==a?x:ae,Dt=Dt==a?x:Dt;var Ne=ae==x,hi=Dt==x,fe=ae==Dt;if(fe&&md(w)){if(!md(A))return!1;Ut=!0,Ne=!1}if(fe&&!Ne)return ft||(ft=new Rr),Ut||E1(w)?_1(w,A,B,tt,At,ft):zR(w,A,ae,B,tt,At,ft);if(!(B&s)){var je=Ne&&ki.call(w,"__wrapped__"),Je=hi&&ki.call(A,"__wrapped__");if(je||Je){var Lr=je?w.value():w,sr=Je?A.value():A;return ft||(ft=new Rr),At(Lr,sr,B,tt,ft)}}return fe?(ft||(ft=new Rr),jR(w,A,B,tt,At,ft)):!1}function HR(w){if(!C1(w)||tP(w))return!1;var A=T1(w)?uR:V;return A.test(vs(w))}function KR(w){return vo(w)&&S1(w.length)&&!!j[_o(w)]}function YR(w){if(!eP(w))return pR(w);var A=[];for(var B in Object(w))ki.call(w,B)&&B!="constructor"&&A.push(B);return A}function _1(w,A,B,tt,At,ft){var Ut=B&s,ne=w.length,ae=A.length;if(ne!=ae&&!(Ut&&ae>ne))return!1;var Dt=ft.get(w);if(Dt&&ft.get(A))return Dt==A;var Ne=-1,hi=!0,fe=B&n?new vh:void 0;for(ft.set(w,A),ft.set(A,w);++Ne<ne;){var je=w[Ne],Je=A[Ne];if(tt)var Lr=Ut?tt(Je,je,Ne,A,w,ft):tt(je,Je,Ne,w,A,ft);if(Lr!==void 0){if(Lr)continue;hi=!1;break}if(fe){if(!Fe(A,function(sr,ws){if(!ad(fe,ws)&&(je===sr||At(je,sr,B,tt,ft)))return fe.push(ws)})){hi=!1;break}}else if(!(je===Je||At(je,Je,B,tt,ft))){hi=!1;break}}return ft.delete(w),ft.delete(A),hi}function zR(w,A,B,tt,At,ft,Ut){switch(B){case P:if(w.byteLength!=A.byteLength||w.byteOffset!=A.byteOffset)return!1;w=w.buffer,A=A.buffer;case L:return!(w.byteLength!=A.byteLength||!ft(new p1(w),new p1(A)));case c:case u:case g:return w1(+w,+A);case d:return w.name==A.name&&w.message==A.message;case v:case C:return w==A+"";case m:var ne=l1;case T:var ae=tt&s;if(ne||(ne=hR),w.size!=A.size&&!ae)return!1;var Dt=Ut.get(w);if(Dt)return Dt==A;tt|=n,Ut.set(w,A);var Ne=_1(ne(w),ne(A),tt,At,ft,Ut);return Ut.delete(w),Ne;case E:if(pd)return pd.call(w)==pd.call(A)}return!1}function jR(w,A,B,tt,At,ft){var Ut=B&s,ne=v1(w),ae=ne.length,Dt=v1(A),Ne=Dt.length;if(ae!=Ne&&!Ut)return!1;for(var hi=ae;hi--;){var fe=ne[hi];if(!(Ut?fe in A:ki.call(A,fe)))return!1}var je=ft.get(w);if(je&&ft.get(A))return je==A;var Je=!0;ft.set(w,A),ft.set(A,w);for(var Lr=Ut;++hi<ae;){fe=ne[hi];var sr=w[fe],ws=A[fe];if(tt)var I1=Ut?tt(ws,sr,fe,A,w,ft):tt(sr,ws,fe,w,A,ft);if(!(I1===void 0?sr===ws||At(sr,ws,B,tt,ft):I1)){Je=!1;break}Lr||(Lr=fe=="constructor")}if(Je&&!Lr){var Ch=w.constructor,Eh=A.constructor;Ch!=Eh&&"constructor"in w&&"constructor"in A&&!(typeof Ch=="function"&&Ch instanceof Ch&&typeof Eh=="function"&&Eh instanceof Eh)&&(Je=!1)}return ft.delete(w),ft.delete(A),Je}function v1(w){return ZR(w,oP,$R)}function Th(w,A){var B=w.__data__;return qR(A)?B[typeof A=="string"?"string":"hash"]:B.map}function fn(w,A){var B=hd(w,A);return HR(B)?B:void 0}function JR(w){var A=ki.call(w,bs),B=w[bs];try{w[bs]=void 0;var tt=!0}catch{}var At=d1.call(w);return tt&&(A?w[bs]=B:delete w[bs]),At}var $R=g1?function(w){return w==null?[]:(w=Object(w),wt(g1(w),function(A){return m1.call(w,A)}))}:aP,Pr=_o;(cd&&Pr(new cd(new ArrayBuffer(1)))!=P||bo&&Pr(new bo)!=m||ud&&Pr(ud.resolve())!=b||dd&&Pr(new dd)!=T||fd&&Pr(new fd)!=k)&&(Pr=function(w){var A=_o(w),B=A==x?w.constructor:void 0,tt=B?vs(B):"";if(tt)switch(tt){case mR:return P;case gR:return m;case yR:return b;case bR:return T;case xR:return k}return A});function QR(w,A){return A=A??o,!!A&&(typeof w=="number"||Q.test(w))&&w>-1&&w%1==0&&w<A}function qR(w){var A=typeof w;return A=="string"||A=="number"||A=="symbol"||A=="boolean"?w!=="__proto__":w===null}function tP(w){return!!u1&&u1 in w}function eP(w){var A=w&&w.constructor,B=typeof A=="function"&&A.prototype||xh;return w===B}function iP(w){return d1.call(w)}function vs(w){if(w!=null){try{return c1.call(w)}catch{}try{return w+""}catch{}}return""}function w1(w,A){return w===A||w!==w&&A!==A}var rP=b1(function(){return arguments}())?b1:function(w){return vo(w)&&ki.call(w,"callee")&&!m1.call(w,"callee")},Sh=Array.isArray;function sP(w){return w!=null&&S1(w.length)&&!T1(w)}var md=fR||hP;function nP(w,A){return x1(w,A)}function T1(w){if(!C1(w))return!1;var A=_o(w);return A==f||A==p||A==l||A==_}function S1(w){return typeof w=="number"&&w>-1&&w%1==0&&w<=o}function C1(w){var A=typeof w;return w!=null&&(A=="object"||A=="function")}function vo(w){return w!=null&&typeof w=="object"}var E1=ht?od(ht):KR;function oP(w){return sP(w)?WR(w):YR(w)}function aP(){return[]}function hP(){return!1}r.exports=nP}(Ga,Ga.exports);var zT=Ga.exports;const om=xn(zT);class Xe{constructor(t){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 jT=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function JT(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var am={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(jT)})(am);var $T=am.exports;const hm=JT($T);function ka(r,t){if(r){if(typeof r=="function")return r;if(typeof r=="string")return hm[r]}else return hm[t]}const QT={removeOnInterrupt:!1,ease:"linear",time:1e3};class qT extends Xe{constructor(t,e={}){super(t),this.startWidth=null,this.startHeight=null,this.deltaWidth=null,this.deltaHeight=null,this.width=null,this.height=null,this.time=0,this.options=Object.assign({},QT,e),this.options.ease=ka(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 at(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 at(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 tS={sides:"all",friction:.5,time:150,ease:"easeInOutSine",underflow:"center",bounceBox:null};class eS extends Xe{constructor(t,e={}){super(t),this.options=Object.assign({},tS,e),this.ease=ka(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 at(e*this.parent.scale.x,i*this.parent.scale.y),bottomRight:new at(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 at(0,0),bottomRight:new at(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 iS={left:!1,right:!1,top:!1,bottom:!1,direction:null,underflow:"center"};class rS extends Xe{constructor(t,e={}){super(t),this.options=Object.assign({},iS,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 at(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 sS={minWidth:null,minHeight:null,maxWidth:null,maxHeight:null,minScale:null,maxScale:null};class nS extends Xe{constructor(t,e={}){super(t),this.options=Object.assign({},sS,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 oS={friction:.98,bounce:.8,minSpeed:.01},xr=16;class aS extends Xe{constructor(t,e={}){super(t),this.options=Object.assign({},oS,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*xr/o*(Math.pow(n,s/xr)-Math.pow(n,i/xr)),this.x*=Math.pow(this.percentChangeX,t/xr)}if(this.y){const n=this.percentChangeY,o=Math.log(n);this.parent.y+=this.y*xr/o*(Math.pow(n,s/xr)-Math.pow(n,i/xr)),this.y*=Math.pow(this.percentChangeY,t/xr)}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 hS={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 lS extends Xe{constructor(t,e={}){super(t),this.windowEventHandlers=[],this.options=Object.assign({},hS,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){typeof window>"u"||(window.addEventListener(t,e),this.windowEventHandlers.push({event:t,handler:e}))}destroy(){typeof window>"u"||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 at(this.last.x,this.last.y),world:this.parent.toWorld(new at(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 at(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 cS={speed:0,acceleration:null,radius:null};class uS extends Xe{constructor(t,e,i={}){super(t),this.target=e,this.options=Object.assign({},cS,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 dS={radius:null,distance:null,top:null,bottom:null,left:null,right:null,speed:8,reverse:!1,noDecelerate:!1,linear:!1,allowButtons:!1};class fS extends Xe{constructor(t,e={}){super(t),this.options=Object.assign({},dS,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 pS={noDrag:!1,percent:1,center:null,factor:1,axis:"all"};class mS extends Xe{constructor(t,e={}){super(t),this.active=!1,this.pinching=!1,this.moved=!1,this.options=Object.assign({},pS,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 at(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 gS={topLeft:!1,friction:.8,time:1e3,ease:"easeInOutSine",interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1};class yS extends Xe{constructor(t,e,i,s={}){super(t),this.options=Object.assign({},gS,s),this.ease=ka(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 bS={width:0,height:0,time:1e3,ease:"easeInOutSine",center:null,interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1,noMove:!1};class xS extends Xe{constructor(t,e={}){super(t),this.options=Object.assign({},bS,e),this.ease=ka(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 _S={percent:.1,smooth:!1,interrupt:!0,reverse:!1,center:null,lineHeight:20,axis:"all",keyToPress:null,trackpadPinch:!1,wheelZoom:!0};class vS extends Xe{constructor(t,e={}){super(t),this.options=Object.assign({},_S,e),this.keyIsPressed=!1,this.options.keyToPress&&this.handleKeyPresses(this.options.keyToPress)}handleKeyPresses(t){typeof window>"u"||(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 wS{constructor(t){this.viewport=t,this.touches=[],this.addListeners()}addListeners(){this.viewport.eventMode="static",this.viewport.forceHitArea||(this.viewport.hitArea=new ct(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(){var t;(t=this.viewport.options.events.domElement)==null||t.removeEventListener("wheel",this.wheelFunction)}down(t){if(!(this.viewport.pause||!this.viewport.visible)){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.visible)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.visible)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 at;return this.viewport.options.events.mapPositionToPoint(e,t.clientX,t.clientY),e}handleWheel(t){if(this.viewport.pause||!this.viewport.visible)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 Un=["drag","pinch","wheel","follow","mouse-edges","decelerate","animate","bounce","snap-zoom","clamp-zoom","snap","clamp"];class TS{constructor(t){this.viewport=t,this.list=[],this.plugins={}}add(t,e,i=Un.length){const s=this.plugins[t];s&&s.destroy(),this.plugins[t]=e;const n=Un.indexOf(t);n!==-1&&Un.splice(n,1),Un.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 Un)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 SS={screenWidth:typeof window>"u"?0:window.innerWidth,screenHeight:typeof window>"u"?0:window.innerHeight,worldWidth:null,worldHeight:null,threshold:5,passiveWheel:!0,stopPropagation:!1,forceHitArea:null,noTicker:!1,disableOnContextMenu:!1,ticker:me.shared,allowPreserveDragOutside:!1};class CS extends gt{constructor(t){super(),this._disableOnContextMenu=e=>e.preventDefault(),this.options={...SS,...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 wS(this),this.plugins=new TS(this)}destroy(t){var e;!this.options.noTicker&&this.tickerFunction&&this.options.ticker.remove(this.tickerFunction),this.options.disableOnContextMenu&&((e=this.options.events.domElement)==null||e.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 ct(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=typeof window>"u"?0:window.innerWidth,e=typeof window>"u"?0: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 ct(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight)}toWorld(t,e){return arguments.length===2?this.toLocal(new at(t,e)):this.toLocal(t)}toScreen(t,e){return arguments.length===2?this.toGlobal(new at(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 at(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 at(-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 xS(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 at(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 ct(0,0,this.worldWidth,this.worldHeight))}drag(t){return this.plugins.add("drag",new lS(this,t)),this}clamp(t){return this.plugins.add("clamp",new rS(this,t)),this}decelerate(t){return this.plugins.add("decelerate",new aS(this,t)),this}bounce(t){return this.plugins.add("bounce",new eS(this,t)),this}pinch(t){return this.plugins.add("pinch",new mS(this,t)),this}snap(t,e,i){return this.plugins.add("snap",new yS(this,t,e,i)),this}follow(t,e){return this.plugins.add("follow",new uS(this,t,e)),this}wheel(t){return this.plugins.add("wheel",new vS(this,t)),this}animate(t){return this.plugins.add("animate",new qT(this,t)),this}clampZoom(t){return this.plugins.add("clamp-zoom",new nS(this,t)),this}mouseEdges(t){return this.plugins.add("mouse-edges",new fS(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"})}}const Fa=1e3,lm=Symbol.for("constructDateFrom");async function cm(r,t){const e=await Me();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(),ES(s)))}function o(){clearTimeout(i)}return{start:n,stop:o}}function ES(r){const t=Math.floor(r.nodes.size/Fa)*Fa;return Math.max(Fa,t)}function Ki(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function um(r,t){r.prototype=Object.create(t.prototype),r.prototype.constructor=r,r.__proto__=t}/*!
1160
1160
  * GSAP 3.12.5
1161
1161
  * https://gsap.com
1162
1162
  *
@@ -1164,7 +1164,7 @@ void main(void)\r
1164
1164
  * Subject to the terms at https://gsap.com/standard-license or for
1165
1165
  * Club GSAP members, the agreement issued with that membership.
1166
1166
  * @author: Jack Doyle, jack@greensock.com
1167
- */var Re={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},Hs={duration:.5,overwrite:!1,delay:0},Dc,ce,Mt,We=1e8,Ct=1/We,Oc=Math.PI*2,IS=Oc/4,AS=0,dm=Math.sqrt,MS=Math.cos,RS=Math.sin,ie=function(t){return typeof t=="string"},Ot=function(t){return typeof t=="function"},Yi=function(t){return typeof t=="number"},Uc=function(t){return typeof t>"u"},Ti=function(t){return typeof t=="object"},_e=function(t){return t!==!1},Bc=function(){return typeof window<"u"},Na=function(t){return Ot(t)||ie(t)},fm=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},ue=Array.isArray,Xc=/(?:-?\.?\d|\.)+/gi,pm=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,Ks=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,Wc=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,mm=/[+-]=-?[.\d]+/,gm=/[^,'"\[\]\s]+/gi,PS=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,kt,Si,Zc,Vc,Pe={},Da={},ym,bm=function(t){return(Da=es(t,Pe))&&Te},Hc=function(t,e){return console.warn("Invalid property",t,"set to",e,"Missing plugin? gsap.registerPlugin()")},Xn=function(t,e){return!e&&console.warn(t)},xm=function(t,e){return t&&(Pe[t]=e)&&Da&&(Da[t]=e)||Pe},Wn=function(){return 0},LS={suppressEvents:!0,isStart:!0,kill:!1},Oa={suppressEvents:!0,kill:!1},GS={suppressEvents:!0},Kc={},_r=[],Yc={},_m,Le={},zc={},vm=30,Ua=[],jc="",Jc=function(t){var e=t[0],i,s;if(Ti(e)||Ot(e)||(t=[t]),!(i=(e._gsap||{}).harness)){for(s=Ua.length;s--&&!Ua[s].targetTest(e););i=Ua[s]}for(s=t.length;s--;)t[s]&&(t[s]._gsap||(t[s]._gsap=new Jm(t[s],i)))||t.splice(s,1);return t},ts=function(t){return t._gsap||Jc(He(t))[0]._gsap},wm=function(t,e,i){return(i=t[e])&&Ot(i)?t[e]():Uc(i)&&t.getAttribute&&t.getAttribute(e)||i},ve=function(t,e){return(t=t.split(",")).forEach(e)||t},Wt=function(t){return Math.round(t*1e5)/1e5||0},re=function(t){return Math.round(t*1e7)/1e7||0},Ys=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},kS=function(t,e){for(var i=e.length,s=0;t.indexOf(e[s])<0&&++s<i;);return s<i},Ba=function(){var t=_r.length,e=_r.slice(0),i,s;for(Yc={},_r.length=0,i=0;i<t;i++)s=e[i],s&&s._lazy&&(s.render(s._lazy[0],s._lazy[1],!0)._lazy=0)},Tm=function(t,e,i,s){_r.length&&!ce&&Ba(),t.render(e,i,ce&&e<0&&(t._initted||t._startAt)),_r.length&&!ce&&Ba()},Sm=function(t){var e=parseFloat(t);return(e||e===0)&&(t+"").match(gm).length<2?e:ie(t)?t.trim():t},Cm=function(t){return t},Ze=function(t,e){for(var i in e)i in t||(t[i]=e[i]);return t},FS=function(t){return function(e,i){for(var s in i)s in e||s==="duration"&&t||s==="ease"||(e[s]=i[s])}},es=function(t,e){for(var i in e)t[i]=e[i];return t},Em=function r(t,e){for(var i in e)i!=="__proto__"&&i!=="constructor"&&i!=="prototype"&&(t[i]=Ti(e[i])?r(t[i]||(t[i]={}),e[i]):e[i]);return t},Xa=function(t,e){var i={},s;for(s in t)s in e||(i[s]=t[s]);return i},Zn=function(t){var e=t.parent||kt,i=t.keyframes?FS(ue(t.keyframes)):Ze;if(_e(t.inherit))for(;e;)i(t,e.vars.defaults),e=e.parent||e._dp;return t},NS=function(t,e){for(var i=t.length,s=i===e.length;s&&i--&&t[i]===e[i];);return i<0},Im=function(t,e,i,s,n){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},Wa=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},vr=function(t,e){t.parent&&(!e||t.parent.autoRemoveChildren)&&t.parent.remove&&t.parent.remove(t),t._act=0},is=function(t,e){if(t&&(!e||e._end>t._dur||e._start<0))for(var i=t;i;)i._dirty=1,i=i.parent;return t},DS=function(t){for(var e=t.parent;e&&e.parent;)e._dirty=1,e.totalDuration(),e=e.parent;return t},$c=function(t,e,i,s){return t._startAt&&(ce?t._startAt.revert(Oa):t.vars.immediateRender&&!t.vars.autoRevert||t._startAt.render(e,!0,s))},OS=function r(t){return!t||t._ts&&r(t.parent)},Am=function(t){return t._repeat?zs(t._tTime,t=t.duration()+t._rDelay)*t:0},zs=function(t,e){var i=Math.floor(t/=e);return t&&i===t?i-1:i},Za=function(t,e){return(t-e._start)*e._ts+(e._ts>=0?0:e._dirty?e.totalDuration():e._tDur)},Va=function(t){return t._end=re(t._start+(t._tDur/Math.abs(t._ts||t._rts||Ct)||0))},Ha=function(t,e){var i=t._dp;return i&&i.smoothChildTiming&&t._ts&&(t._start=re(i._time-(t._ts>0?e/t._ts:((t._dirty?t.totalDuration():t._tDur)-e)/-t._ts)),Va(t),i._dirty||is(i,t)),t},Mm=function(t,e){var i;if((e._time||!e._dur&&e._initted||e._start<t._time&&(e._dur||!e.add))&&(i=Za(t.rawTime(),e),(!e._dur||Hn(0,e.totalDuration(),i)-e._tTime>Ct)&&e.render(i,!0)),is(t,e)._dp&&t._initted&&t._time>=t._dur&&t._ts){if(t._dur<t.duration())for(i=t;i._dp;)i.rawTime()>=0&&i.totalTime(i._tTime),i=i._dp;t._zTime=-Ct}},Ci=function(t,e,i,s){return e.parent&&vr(e),e._start=re((Yi(i)?i:i||t!==kt?Ve(t,i,e):t._time)+e._delay),e._end=re(e._start+(e.totalDuration()/Math.abs(e.timeScale())||0)),Im(t,e,"_first","_last",t._sort?"_start":0),Qc(e)||(t._recent=e),s||Mm(t,e),t._ts<0&&Ha(t,t._tTime),t},Rm=function(t,e){return(Pe.ScrollTrigger||Hc("scrollTrigger",e))&&Pe.ScrollTrigger.create(e,t)},Pm=function(t,e,i,s,n){if(au(t,e,n),!t._initted)return 1;if(!i&&t._pt&&!ce&&(t._dur&&t.vars.lazy!==!1||!t._dur&&t.vars.lazy)&&_m!==ke.frame)return _r.push(t),t._lazy=[n,s],1},US=function r(t){var e=t.parent;return e&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||r(e))},Qc=function(t){var e=t.data;return e==="isFromStart"||e==="isStart"},BS=function(t,e,i,s){var n=t.ratio,o=e<0||!e&&(!t._start&&US(t)&&!(!t._initted&&Qc(t))||(t._ts<0||t._dp._ts<0)&&!Qc(t))?0:1,a=t._rDelay,h=0,l,c,u;if(a&&t._repeat&&(h=Hn(0,t._tDur,e),c=zs(h,a),t._yoyo&&c&1&&(o=1-o),c!==zs(t._tTime,a)&&(n=1-o,t.vars.repeatRefresh&&t._initted&&t.invalidate())),o!==n||ce||s||t._zTime===Ct||!e&&t._zTime){if(!t._initted&&Pm(t,e,s,i,h))return;for(u=t._zTime,t._zTime=e||(i?Ct: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&&$c(t,e,i,!0),t._onUpdate&&!i&&Ge(t,"onUpdate"),h&&t._repeat&&!i&&t.parent&&Ge(t,"onRepeat"),(e>=t._tDur||e<0)&&t.ratio===o&&(o&&vr(t,1),!i&&!ce&&(Ge(t,o?"onComplete":"onReverseComplete",!0),t._prom&&t._prom()))}else t._zTime||(t._zTime=e)},XS=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}},js=function(t,e,i,s){var n=t._repeat,o=re(e)||0,a=t._tTime/t._tDur;return a&&!s&&(t._time*=o/t._dur),t._dur=o,t._tDur=n?n<0?1e10:re(o*(n+1)+t._rDelay*n):o,a>0&&!s&&Ha(t,t._tTime=t._tDur*a),t.parent&&Va(t),i||is(t.parent,t),t},Lm=function(t){return t instanceof ge?is(t):js(t,t._dur)},WS={_start:0,endTime:Wn,totalDuration:Wn},Ve=function r(t,e,i){var s=t.labels,n=t._recent||WS,o=t.duration()>=We?n.endTime(!1):t._dur,a,h,l;return ie(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*(ue(i)?i[0]:i).totalDuration()),a>1?r(t,e.substr(0,a-1),i)+h:o+h)):e==null?o:+e},Vn=function(t,e,i){var s=Yi(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=_e(h.vars.inherit)&&h.parent;o.immediateRender=_e(a.immediateRender),t<2?o.runBackwards=1:o.startAt=e[n-1]}return new Kt(e[0],o,e[n+1])},wr=function(t,e){return t||t===0?e(t):e},Hn=function(t,e,i){return i<t?t:i>e?e:i},de=function(t,e){return!ie(t)||!(e=PS.exec(t))?"":e[1]},ZS=function(t,e,i){return wr(i,function(s){return Hn(t,e,s)})},qc=[].slice,Gm=function(t,e){return t&&Ti(t)&&"length"in t&&(!e&&!t.length||t.length-1 in t&&Ti(t[0]))&&!t.nodeType&&t!==Si},VS=function(t,e,i){return i===void 0&&(i=[]),t.forEach(function(s){var n;return ie(s)&&!e||Gm(s,1)?(n=i).push.apply(n,He(s)):i.push(s)})||i},He=function(t,e,i){return Mt&&!e&&Mt.selector?Mt.selector(t):ie(t)&&!i&&(Zc||!$s())?qc.call((e||Vc).querySelectorAll(t),0):ue(t)?VS(t,i):Gm(t)?qc.call(t,0):t?[t]:[]},tu=function(t){return t=He(t)[0]||Xn("Invalid scope")||{},function(e){var i=t.current||t.nativeElement||t;return He(e,i.querySelectorAll?i:i===t?Xn("Invalid scope")||Vc.createElement("div"):t)}},km=function(t){return t.sort(function(){return .5-Math.random()})},Fm=function(t){if(Ot(t))return t;var e=Ti(t)?t:{each:t},i=rs(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 ie(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,T,C,E,I;if(!g){if(I=e.grid==="auto"?0:(e.grid||[1,We])[1],!I){for(C=-We;C<(C=p[I++].getBoundingClientRect().left)&&I<m;);I<m&&I--}for(g=o[m]=[],y=h?Math.min(I,m)*c-.5:s%I,x=I===We?0:h?m*u/I-.5:s/I|0,C=0,E=We,T=0;T<m;T++)b=T%I-y,_=x-(T/I|0),g[T]=v=l?Math.abs(l==="y"?_:b):dm(b*b+_*_),v>C&&(C=v),v<E&&(E=v);s==="random"&&km(g),g.max=C-E,g.min=E,g.v=m=(parseFloat(e.amount)||parseFloat(e.each)*(I>m?m-1:l?l==="y"?m/I:I:Math.max(I,m/I))||0)*(s==="edges"?-1:1),g.b=m<0?n-m:n,g.u=de(e.amount||e.each)||0,i=i&&m<0?Ym(i):i}return m=(g[d]-g.min)/g.max||0,re(g.b+(i?i(m):m)*g.v)+g.u}},eu=function(t){var e=Math.pow(10,((t+"").split(".")[1]||"").length);return function(i){var s=re(Math.round(parseFloat(i)/t)*t*e);return(s-s%1)/e+(Yi(i)?0:de(i))}},Nm=function(t,e){var i=ue(t),s,n;return!i&&Ti(t)&&(s=i=t.radius||We,t.values?(t=He(t.values),(n=!Yi(t[0]))&&(s*=s)):t=eu(t.increment)),wr(e,i?Ot(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=We,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||Yi(o)?c:c+de(o)}:eu(t))},Dm=function(t,e,i,s){return wr(ue(t)?!e:i===!0?!!(i=0):!s,function(){return ue(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})},HS=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)}},KS=function(t,e){return function(i){return t(parseFloat(i))+(e||de(i))}},YS=function(t,e,i){return Um(t,e,0,1,i)},Om=function(t,e,i){return wr(i,function(s){return t[~~e(s)]})},zS=function r(t,e,i){var s=e-t;return ue(t)?Om(t,r(0,t.length),e):wr(i,function(n){return(s+(n-t)%s)%s+t})},jS=function r(t,e,i){var s=e-t,n=s*2;return ue(t)?Om(t,r(0,t.length-1),e):wr(i,function(o){return o=(n+(o-t)%n)%n||0,t+(o>s?n-o:o)})},Kn=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?gm:Xc),i+=t.substr(e,s-e)+Dm(a?n:+n[0],a?0:+n[1],+n[2]||1e-5),e=o+1;return i+t.substr(e,t.length-e)},Um=function(t,e,i,s,n){var o=e-t,a=s-i;return wr(n,function(h){return i+((h-t)/o*a||0)})},JS=function r(t,e,i,s){var n=isNaN(t+e)?0:function(f){return(1-f)*t+f*e};if(!n){var o=ie(t),a={},h,l,c,u,d;if(i===!0&&(s=1)&&(i=null),o)t={p:t},e={p:e};else if(ue(t)&&!ue(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=es(ue(t)?[]:{},t));if(!c){for(h in e)nu.call(a,t,h,"get",e[h]);n=function(p){return cu(p,a)||(o?t.p:t)}}}return wr(i,n)},Bm=function(t,e,i){var s=t.labels,n=We,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},Ge=function(t,e,i){var s=t.vars,n=s[e],o=Mt,a=t._ctx,h,l,c;if(n)return h=s[e+"Params"],l=s.callbackScope||t,i&&_r.length&&Ba(),a&&(Mt=a),c=h?n.apply(l,h):n.call(l),Mt=o,c},Yn=function(t){return vr(t),t.scrollTrigger&&t.scrollTrigger.kill(!!ce),t.progress()<1&&Ge(t,"onInterrupt"),t},Js,Xm=[],Wm=function(t){if(t)if(t=!t.name&&t.default||t,Bc()||t.headless){var e=t.name,i=Ot(t),s=e&&!i&&t.init?function(){this._props=[]}:t,n={init:Wn,render:cu,add:nu,kill:dC,modifier:uC,rawVars:0},o={targetTest:0,get:0,getSetter:lu,aliases:{},register:0};if($s(),t!==s){if(Le[e])return;Ze(s,Ze(Xa(t,n),o)),es(s.prototype,es(n,Xa(t,o))),Le[s.prop=e]=s,t.targetTest&&(Ua.push(s),Kc[e]=1),e=(e==="css"?"CSS":e.charAt(0).toUpperCase()+e.substr(1))+"Plugin"}xm(e,s),t.register&&t.register(Te,s,we)}else Xm.push(t)},St=255,zn={aqua:[0,St,St],lime:[0,St,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,St],navy:[0,0,128],white:[St,St,St],olive:[128,128,0],yellow:[St,St,0],orange:[St,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[St,0,0],pink:[St,192,203],cyan:[0,St,St],transparent:[St,St,St,0]},iu=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)*St+.5|0},Zm=function(t,e,i){var s=t?Yi(t)?[t>>16,t>>8&St,t&St]:0:zn.black,n,o,a,h,l,c,u,d,f,p;if(!s){if(t.substr(-1)===","&&(t=t.substr(0,t.length-1)),zn[t])s=zn[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&St,s&St,parseInt(t.substr(7),16)/255];t=parseInt(t.substr(1),16),s=[t>>16,t>>8&St,t&St]}else if(t.substr(0,3)==="hsl"){if(s=p=t.match(Xc),!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]=iu(h+1/3,n,o),s[1]=iu(h,n,o),s[2]=iu(h-1/3,n,o);else if(~t.indexOf("="))return s=t.match(pm),i&&s.length<4&&(s[3]=1),s}else s=t.match(Xc)||zn.transparent;s=s.map(Number)}return e&&!p&&(n=s[0]/St,o=s[1]/St,a=s[2]/St,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},Vm=function(t){var e=[],i=[],s=-1;return t.split(Tr).forEach(function(n){var o=n.match(Ks)||[];e.push.apply(e,o),i.push(s+=o.length+1)}),e.c=i,e},Hm=function(t,e,i){var s="",n=(t+s).match(Tr),o=e?"hsla(":"rgba(",a=0,h,l,c,u;if(!n)return t;if(n=n.map(function(d){return(d=Zm(d,e,1))&&o+(e?d[0]+","+d[1]+"%,"+d[2]+"%,"+d[3]:d.join(","))+")"}),i&&(c=Vm(t),h=i.c,h.join(s)!==c.c.join(s)))for(l=t.replace(Tr,"1").split(Ks),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(Tr),u=l.length-1;a<u;a++)s+=l[a]+n[a];return s+l[u]},Tr=function(){var r="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b",t;for(t in zn)r+="|"+t+"\\b";return new RegExp(r+")","gi")}(),$S=/hsl[a]?\(/,Km=function(t){var e=t.join(" "),i;if(Tr.lastIndex=0,Tr.test(e))return i=$S.test(e),t[1]=Hm(t[1],i),t[0]=Hm(t[0],i,Vm(t[1])),!0},jn,ke=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,T;if((y>t||y<0)&&(i+=y-e),s+=y,v=s-i,b=v-o,(b>0||x)&&(T=++u.frame,d=v-u.time*1e3,u.time=v=v/1e3,o+=b+(b>=n?4:n-b),_=1),x||(h=l(m)),_)for(f=0;f<a.length;f++)a[f](v,d,T,g)};return u={time:0,frame:0,tick:function(){p(!0)},deltaRatio:function(g){return d/(1e3/(g||60))},wake:function(){ym&&(!Zc&&Bc()&&(Si=Zc=window,Vc=Si.document||{},Pe.gsap=Te,(Si.gsapVersions||(Si.gsapVersions=[])).push(Te.version),bm(Da||Si.GreenSockGlobals||!Si.gsap&&Si||{}),Xm.forEach(Wm)),c=typeof requestAnimationFrame<"u"&&requestAnimationFrame,h&&u.sleep(),l=c||function(g){return setTimeout(g,o-u.time*1e3+1|0)},jn=1,p(2))},sleep:function(){(c?cancelAnimationFrame:clearTimeout)(h),jn=0,l=Wn},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,T,C){g(_,v,T,C),u.remove(b)}:g;return u.remove(g),a[x?"unshift":"push"](b),$s(),b},remove:function(g,y){~(y=a.indexOf(g))&&a.splice(y,1)&&f>=y&&f--},_listeners:a},u}(),$s=function(){return!jn&&ke.wake()},xt={},QS=/^[\d.\-M][\d.\-,\s]/,qS=/["']/g,tC=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(qS,"").trim():+l,s=h.substr(a+1).trim();return e},eC=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)},iC=function(t){var e=(t+"").split("("),i=xt[e[0]];return i&&e.length>1&&i.config?i.config.apply(null,~t.indexOf("{")?[tC(e[1])]:eC(t).split(",").map(Sm)):xt._CE&&QS.test(t)?xt._CE("",t):i},Ym=function(t){return function(e){return 1-t(1-e)}},zm=function r(t,e){for(var i=t._first,s;i;)i instanceof ge?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},rs=function(t,e){return t&&(Ot(t)?t:xt[t]||iC(t))||e},ss=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 ve(t,function(a){xt[a]=Pe[a]=n,xt[o=a.toLowerCase()]=i;for(var h in n)xt[o+(h==="easeIn"?".in":h==="easeOut"?".out":".inOut")]=xt[a+"."+h]=n[h]}),n},jm=function(t){return function(e){return e<.5?(1-t(1-e*2))/2:.5+t((e-.5)*2)/2}},ru=function r(t,e,i){var s=e>=1?e:1,n=(i||(t?.3:.45))/(e<1?e:1),o=n/Oc*(Math.asin(1/s)||0),a=function(c){return c===1?1:s*Math.pow(2,-10*c)*RS((c-o)*n)+1},h=t==="out"?a:t==="in"?function(l){return 1-a(1-l)}:jm(a);return n=Oc/n,h.config=function(l,c){return r(t,l,c)},h},su=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)}:jm(i);return s.config=function(n){return r(t,n)},s};ve("Linear,Quad,Cubic,Quart,Quint,Strong",function(r,t){var e=t<5?t+1:t;ss(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})}),xt.Linear.easeNone=xt.none=xt.Linear.easeIn,ss("Elastic",ru("in"),ru("out"),ru()),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};ss("Bounce",function(o){return 1-n(1-o)},n)}(7.5625,2.75),ss("Expo",function(r){return r?Math.pow(2,10*(r-1)):0}),ss("Circ",function(r){return-(dm(1-r*r)-1)}),ss("Sine",function(r){return r===1?1:-MS(r*IS)+1}),ss("Back",su("in"),su("out"),su()),xt.SteppedEase=xt.steps=Pe.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-Ct;return function(a){return((s*Hn(0,o,a)|0)+n)*i}}},Hs.ease=xt["quad.out"],ve("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",function(r){return jc+=r+","+r+"Params,"});var Jm=function(t,e){this.id=AS++,t._gsap=this,this.target=t,this.harness=e,this.get=e?e.get:wm,this.set=e?e.getSetter:lu},Jn=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,js(this,+e.duration,1,1),this.data=e.data,Mt&&(this._ctx=Mt,Mt.data.push(this)),jn||ke.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,js(this,this._repeat<0?i:(i-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},t.totalTime=function(i,s){if($s(),!arguments.length)return this._tTime;var n=this._dp;if(n&&n.smoothChildTiming&&this._ts){for(Ha(this,i),!n._dp||n.parent||Mm(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)&&Ci(this._dp,this,this._start-this._delay)}return(this._tTime!==i||!this._dur&&!s||this._initted&&Math.abs(this._zTime)===Ct||!i&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=i),Tm(this,i,s)),this},t.time=function(i,s){return arguments.length?this.totalTime(Math.min(this.totalDuration(),i+Am(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)+Am(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?zs(this._tTime,n)+1:1},t.timeScale=function(i,s){if(!arguments.length)return this._rts===-Ct?0:this._rts;if(this._rts===i)return this;var n=this.parent&&this._ts?Za(this.parent._time,this):this._tTime;return this._rts=+i||0,this._ts=this._ps||i===-Ct?0:this._rts,this.totalTime(Hn(-Math.abs(this._delay),this._tDur,n),s!==!1),Va(this),DS(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):($s(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,this.progress()===1&&Math.abs(this._zTime)!==Ct&&(this._tTime-=Ct)))),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)&&Ci(s,this,i-this._delay),this}return this._start},t.endTime=function(i){return this._start+(_e(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?Za(s.rawTime(i),this):this._tTime:this._tTime},t.revert=function(i){i===void 0&&(i=GS);var s=ce;return ce=i,(this._initted||this._startAt)&&(this.timeline&&this.timeline.revert(i),this.totalTime(-.01,i.suppressEvents)),this.data!=="nested"&&i.kill!==!1&&this.kill(),ce=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,Lm(this)):this._repeat===-2?1/0:this._repeat},t.repeatDelay=function(i){if(arguments.length){var s=this._time;return this._rDelay=i,Lm(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(Ve(this,i),_e(s))},t.restart=function(i,s){return this.play().totalTime(i?-this._delay:0,_e(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?-Ct:0)),this):this._rts<0},t.invalidate=function(){return this._initted=this._act=0,this._zTime=-Ct,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)-Ct)},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=Ot(i)?i:Cm,a=function(){var l=s.then;s.then=null,Ot(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(){Yn(this)},r}();Ze(Jn.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:-Ct,_prom:0,_ps:!1,_rts:1});var ge=function(r){um(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=_e(i.sortChildren),kt&&Ci(i.parent||kt,Ki(n),s),i.reversed&&n.reverse(),i.paused&&n.paused(!0),i.scrollTrigger&&Rm(Ki(n),i.scrollTrigger),n}var e=t.prototype;return e.to=function(s,n,o){return Vn(0,arguments,this),this},e.from=function(s,n,o){return Vn(1,arguments,this),this},e.fromTo=function(s,n,o,a){return Vn(2,arguments,this),this},e.set=function(s,n,o){return n.duration=0,n.parent=this,Zn(n).repeatDelay||(n.repeat=0),n.immediateRender=!!n.immediateRender,new Kt(s,n,Ve(this,o),1),this},e.call=function(s,n,o){return Ci(this,Kt.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 Kt(s,o,Ve(this,h)),this},e.staggerFrom=function(s,n,o,a,h,l,c){return o.runBackwards=1,Zn(o).immediateRender=_e(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,Zn(a).immediateRender=_e(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:re(s),u=this._zTime<0!=s<0&&(this._initted||!l),d,f,p,m,g,y,x,b,_,v,T,C;if(this!==kt&&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,_=this._start,b=this._ts,y=!b,u&&(l||(a=this._zTime),(s||!n)&&(this._zTime=s)),this._repeat){if(T=this._yoyo,g=l+this._rDelay,this._repeat<-1&&s<0)return this.totalTime(g*100+s,n,o);if(d=re(c%g),c===h?(m=this._repeat,d=l):(m=~~(c/g),m&&m===c/g&&(d=l,m--),d>l&&(d=l)),v=zs(this._tTime,g),!a&&this._tTime&&v!==m&&this._tTime-v*g-this._dur<=0&&(v=m),T&&m&1&&(d=l-d,C=1),m!==v&&!this._lock){var E=T&&v&1,I=E===(T&&m&1);if(m<v&&(E=!E),a=E?0:c%l?l:c,this._lock=1,this.render(a||(C?0:re(m*g)),n,!l)._lock=0,this._tTime=c,!n&&this.parent&&Ge(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,I&&(this._lock=2,a=E?l:-1e-4,this.render(a,!0),this.vars.repeatRefresh&&!C&&this.invalidate()),this._lock=0,!this._ts&&!y)return this;zm(this,C)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(x=XS(this,re(a),re(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&&(Ge(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=-Ct);break}}f=p}else{f=this._last;for(var k=s<0?s:d;f;){if(p=f._prev,(f._act||k<=f._end)&&f._ts&&x!==f){if(f.parent!==this)return this.render(s,n,o);if(f.render(f._ts>0?(k-f._start)*f._ts:(f._dirty?f.totalDuration():f._tDur)+(k-f._start)*f._ts,n,o||ce&&(f._initted||f._startAt)),d!==this._time||!this._ts&&!y){x=0,p&&(c+=this._zTime=k?-Ct:Ct);break}}f=p}}if(x&&!n&&(this.pause(),x.render(d>=a?0:-Ct)._zTime=d>=a?1:-1,this._ts))return this._start=_,Va(this),this.render(s,n,o);this._onUpdate&&!n&&Ge(this,"onUpdate",!0),(c===h&&this._tTime>=this.totalDuration()||!c&&a)&&(_===this._start||Math.abs(b)!==Math.abs(this._ts))&&(this._lock||((s||!l)&&(c===h&&this._ts>0||!c&&this._ts<0)&&vr(this,1),!n&&!(s<0&&!a)&&(c||a||!h)&&(Ge(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(Yi(n)||(n=Ve(this,n,s)),!(s instanceof Jn)){if(ue(s))return s.forEach(function(a){return o.add(a,n)}),this;if(ie(s))return this.addLabel(s,n);if(Ot(s))s=Kt.delayedCall(0,s);else return this}return this!==s?Ci(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=-We);for(var h=[],l=this._first;l;)l._start>=a&&(l instanceof Kt?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 ie(s)?this.removeLabel(s):Ot(s)?this.killTweensOf(s):(Wa(this,s),s===this._recent&&(this._recent=this._last),is(this))},e.totalTime=function(s,n){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=re(ke.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]=Ve(this,n),this},e.removeLabel=function(s){return delete this.labels[s],this},e.addPause=function(s,n,o){var a=Kt.delayedCall(0,n||Wn,o);return a.data="isPause",this._hasPause=1,Ci(this,a,Ve(this,s))},e.removePause=function(s){var n=this._first;for(s=Ve(this,s);n;)n._start===s&&n.data==="isPause"&&vr(n),n=n._next},e.killTweensOf=function(s,n,o){for(var a=this.getTweensOf(s,o),h=a.length;h--;)Sr!==a[h]&&a[h].kill(s,n);return this},e.getTweensOf=function(s,n){for(var o=[],a=He(s),h=this._first,l=Yi(n),c;h;)h instanceof Kt?kS(h._targets,a)&&(l?(!Sr||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=Ve(o,s),h=n,l=h.startAt,c=h.onStart,u=h.onStartParams,d=h.immediateRender,f,p=Kt.to(o,Ze({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())||Ct,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&&js(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,Ze({startAt:{time:Ve(this,s)}},o))},e.recent=function(){return this._recent},e.nextLabel=function(s){return s===void 0&&(s=this._time),Bm(this,Ve(this,s))},e.previousLabel=function(s){return s===void 0&&(s=this._time),Bm(this,Ve(this,s),1)},e.currentLabel=function(s){return arguments.length?this.seek(s,!0):this.previousLabel(this._time+Ct)},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 is(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={}),is(this)},e.totalDuration=function(s){var n=0,o=this,a=o._last,h=We,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,Ci(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;js(o,o===kt&&o._time>n?o._time:n,1,1),o._dirty=0}return o._tDur},t.updateRoot=function(s){if(kt._ts&&(Tm(kt,Za(s,kt)),_m=ke.frame),ke.frame>=vm){vm+=Re.autoSleep||120;var n=kt._first;if((!n||!n._ts)&&Re.autoSleep&&ke._listeners.length<2){for(;n&&!n._ts;)n=n._next;n||ke.sleep()}}},t}(Jn);Ze(ge.prototype,{_lock:0,_hasPause:0,_forcing:0});var rC=function(t,e,i,s,n,o,a){var h=new we(this._pt,t,e,0,1,ig,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=Kn(s)),o&&(x=[i,s],o(x,t,e),i=x[0],s=x[1]),d=i.match(Wc)||[];u=Wc.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)==="="?Ys(g,p)-g:parseFloat(p)-g,m:f&&f<4?Math.round:0},l=Wc.lastIndex);return h.c=l<s.length?s.substring(l,s.length):"",h.fp=a,(mm.test(s)||y)&&(h.e=0),this._pt=h,h},nu=function(t,e,i,s,n,o,a,h,l,c){Ot(s)&&(s=s(n||0,t,o));var u=t[e],d=i!=="get"?i:Ot(u)?l?t[e.indexOf("set")||!Ot(t["get"+e.substr(3)])?e:"get"+e.substr(3)](l):t[e]():u,f=Ot(u)?l?hC:tg:hu,p;if(ie(s)&&(~s.indexOf("random(")&&(s=Kn(s)),s.charAt(1)==="="&&(p=Ys(d,s)+(de(d)||0),(p||p===0)&&(s=p))),!c||d!==s||ou)return!isNaN(d*s)&&s!==""?(p=new we(this._pt,t,e,+d||0,s-(d||0),typeof u=="boolean"?cC:eg,0,f),l&&(p.fp=l),a&&p.modifier(a,this,t),this._pt=p):(!u&&!(e in t)&&Hc(e,s),rC.call(this,t,e,d,s,f,h||Re.stringFilter,l))},sC=function(t,e,i,s,n){if(Ot(t)&&(t=$n(t,n,e,i,s)),!Ti(t)||t.style&&t.nodeType||ue(t)||fm(t))return ie(t)?$n(t,n,e,i,s):t;var o={},a;for(a in t)o[a]=$n(t[a],n,e,i,s);return o},$m=function(t,e,i,s,n,o){var a,h,l,c;if(Le[t]&&(a=new Le[t]).init(n,a.rawVars?e[t]:sC(e[t],s,n,o,i),i,s,o)!==!1&&(i._pt=h=new we(i._pt,n,t,0,1,a.render,a,0,a.priority),i!==Js))for(l=i._ptLookup[i._targets.indexOf(n)],c=a._props.length;c--;)l[a._props[c]]=h;return a},Sr,ou,au=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"&&!Dc,_=t.timeline,v,T,C,E,I,k,L,P,S,R,F,O,B;if(_&&(!d||!n)&&(n="none"),t._ease=rs(n,Hs.ease),t._yEase=u?Ym(rs(u===!0?n:u,Hs.ease)):0,u&&t._yoyo&&!t._repeat&&(u=t._yEase,t._yEase=t._ease,t._ease=u),t._from=!_&&!!s.runBackwards,!_||d&&!s.stagger){if(P=g[0]?ts(g[0]).harness:0,O=P&&s[P.prop],v=Xa(s,Kc),m&&(m._zTime<0&&m.progress(1),e<0&&c&&a&&!f?m.render(-1,!0):m.revert(c&&p?Oa:LS),m._lazy=0),o){if(vr(t._startAt=Kt.set(g,Ze({data:"isStart",overwrite:!1,parent:y,immediateRender:!0,lazy:!m&&_e(h),startAt:null,delay:0,onUpdate:l&&function(){return Ge(t,"onUpdate")},stagger:0},o))),t._startAt._dp=0,t._startAt._sat=t,e<0&&(ce||!a&&!f)&&t._startAt.revert(Oa),a&&p&&e<=0&&i<=0){e&&(t._zTime=e);return}}else if(c&&p&&!m){if(e&&(a=!1),C=Ze({overwrite:!1,data:"isFromStart",lazy:a&&!m&&_e(h),immediateRender:a,stagger:0,parent:y},v),O&&(C[P.prop]=O),vr(t._startAt=Kt.set(g,C)),t._startAt._dp=0,t._startAt._sat=t,e<0&&(ce?t._startAt.revert(Oa):t._startAt.render(-1,!0)),t._zTime=e,!a)r(t._startAt,Ct,Ct);else if(!e)return}for(t._pt=t._ptCache=0,h=p&&_e(h)||h&&!p,T=0;T<g.length;T++){if(I=g[T],L=I._gsap||Jc(g)[T]._gsap,t._ptLookup[T]=R={},Yc[L.id]&&_r.length&&Ba(),F=x===g?T:x.indexOf(I),P&&(S=new P).init(I,O||v,t,F,x)!==!1&&(t._pt=E=new we(t._pt,I,S.name,0,1,S.render,S,0,S.priority),S._props.forEach(function(Z){R[Z]=E}),S.priority&&(k=1)),!P||O)for(C in v)Le[C]&&(S=$m(C,v,t,F,I,x))?S.priority&&(k=1):R[C]=E=nu.call(t,I,C,"get",v[C],F,x,0,s.stringFilter);t._op&&t._op[T]&&t.kill(I,t._op[T]),b&&t._pt&&(Sr=t,kt.killTweensOf(I,R,t.globalTime(e)),B=!t.parent,Sr=0),t._pt&&h&&(Yc[L.id]=1)}k&&rg(t),t._onInit&&t._onInit(t)}t._onUpdate=l,t._initted=(!t._op||t._pt)&&!B,d&&e<=0&&_.render(We,!0,!0)},nC=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 ou=1,t.vars[e]="+=0",au(t,a),ou=0,h?Xn(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=Wt(i)+de(u.e)),u.b&&(u.b=c.s+de(u.b))},oC=function(t,e){var i=t[0]?ts(t[0]).harness:0,s=i&&i.aliases,n,o,a,h;if(!s)return e;n=es({},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},aC=function(t,e,i,s){var n=e.ease||s||"power1.inOut",o,a;if(ue(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})},$n=function(t,e,i,s,n){return Ot(t)?t.call(e,i,s,n):ie(t)&&~t.indexOf("random(")?Kn(t):t},Qm=jc+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert",qm={};ve(Qm+",id,stagger,delay,duration,paused,scrollTrigger",function(r){return qm[r]=1});var Kt=function(r){um(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:Zn(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||kt,b=(ue(i)||fm(i)?Yi(i[0]):"length"in s)?[i]:He(i),_,v,T,C,E,I,k,L;if(a._targets=b.length?Jc(b):Xn("GSAP target "+i+" not found. https://gsap.com",!Re.nullTargetWarn)||[],a._ptLookup=[],a._overwrite=f,p||d||Na(l)||Na(c)){if(s=a.vars,_=a.timeline=new ge({data:"nested",defaults:m||{},targets:x&&x.data==="nested"?x.vars.targets:b}),_.kill(),_.parent=_._dp=Ki(a),_._start=0,d||Na(l)||Na(c)){if(C=b.length,k=d&&Fm(d),Ti(d))for(E in d)~Qm.indexOf(E)&&(L||(L={}),L[E]=d[E]);for(v=0;v<C;v++)T=Xa(s,qm),T.stagger=0,y&&(T.yoyoEase=y),L&&es(T,L),I=b[v],T.duration=+$n(l,Ki(a),v,I,b),T.delay=(+$n(c,Ki(a),v,I,b)||0)-a._delay,!d&&C===1&&T.delay&&(a._delay=c=T.delay,a._start+=c,T.delay=0),_.to(I,T,k?k(v,I,b):0),_._ease=xt.none;_.duration()?l=c=0:a.timeline=0}else if(p){Zn(Ze(_.vars.defaults,{ease:"none"})),_._ease=rs(p.ease||s.ease||"none");var P=0,S,R,F;if(ue(p))p.forEach(function(O){return _.to(b,O,">")}),_.duration();else{T={};for(E in p)E==="ease"||E==="easeEach"||aC(E,p[E],T,p.easeEach);for(E in T)for(S=T[E].sort(function(O,B){return O.t-B.t}),P=0,v=0;v<S.length;v++)R=S[v],F={ease:R.e,duration:(R.t-(v?S[v-1].t:0))/100*l},F[E]=R.v,_.to(b,F,P),P+=F.duration;_.duration()<l&&_.to({},{duration:l-_.duration()})}}l||a.duration(l=_.duration())}else a.timeline=0;return f===!0&&!Dc&&(Sr=Ki(a),kt.killTweensOf(b),Sr=0),Ci(x,Ki(a),n),s.reversed&&a.reverse(),s.paused&&a.paused(!0),(u||!l&&!p&&a._start===re(x._time)&&_e(u)&&OS(Ki(a))&&x.data!=="nested")&&(a._tTime=-Ct,a.render(Math.max(0,-c)||0)),g&&Rm(Ki(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-Ct&&!c?h:s<Ct?0:s,d,f,p,m,g,y,x,b,_;if(!l)BS(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=re(u%m),u===h?(p=this._repeat,d=l):(p=~~(u/m),p&&p===re(u/m)&&(d=l,p--),d>l&&(d=l)),y=this._yoyo&&p&1,y&&(_=this._yEase,d=l-d),g=zs(this._tTime,m),d===a&&!o&&this._initted&&p===g)return this._tTime=u,this;p!==g&&(b&&this._yEase&&zm(b,y),this.vars.repeatRefresh&&!y&&!this._lock&&this._time!==m&&this._initted&&(this._lock=o=1,this.render(re(m*p),!0).invalidate()._lock=0))}if(!this._initted){if(Pm(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=(_||this._ease)(d/l),this._from&&(this.ratio=x=1-x),d&&!a&&!n&&!p&&(Ge(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&&$c(this,s,n,o),Ge(this,"onUpdate")),this._repeat&&p!==g&&this.vars.onRepeat&&!n&&this.parent&&Ge(this,"onRepeat"),(u===this._tDur||!u)&&this._tTime===u&&(c&&!this._onUpdate&&$c(this,s,!0,!0),(s||!l)&&(u===this._tDur&&this._ts>0||!u&&this._ts<0)&&vr(this,1),!n&&!(c&&!a)&&(u||a||y)&&(Ge(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){jn||ke.wake(),this._ts||this.play();var l=Math.min(this._dur,(this._dp._time-this._start)*this._ts),c;return this._initted||au(this,l),c=this._ease(l/this._dur),nC(this,s,n,o,a,c,l,h)?this.resetTo(s,n,o,a,1):(Ha(this,0),this.parent||Im(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?Yn(this):this;if(this.timeline){var o=this.timeline.totalDuration();return this.timeline.killTweensOf(s,n,Sr&&Sr.vars.overwrite!==!0)._first||Yn(this),this.parent&&o!==this.timeline.totalDuration()&&js(this,this._dur*this.timeline._tDur/o,0,1),this}var a=this._targets,h=s?He(s):a,l=this._ptLookup,c=this._pt,u,d,f,p,m,g,y;if((!n||n==="all")&&NS(a,h))return n==="all"&&(this._pt=0),Yn(this);for(u=this._op=this._op||[],n!=="all"&&(ie(n)&&(m={},ve(n,function(x){return m[x]=1}),n=m),n=oC(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)&&Wa(this,g,"_pt"),delete d[m]),f!=="all"&&(f[m]=1)}return this._initted&&!this._pt&&c&&Yn(this),this},t.to=function(s,n){return new t(s,n,arguments[2])},t.from=function(s,n){return Vn(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 Vn(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 kt.killTweensOf(s,n,o)},t}(Jn);Ze(Kt.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),ve("staggerTo,staggerFrom,staggerFromTo",function(r){Kt[r]=function(){var t=new ge,e=qc.call(arguments,0);return e.splice(r==="staggerFromTo"?5:4,0,0),t[r].apply(t,e)}});var hu=function(t,e,i){return t[e]=i},tg=function(t,e,i){return t[e](i)},hC=function(t,e,i,s){return t[e](s.fp,i)},lC=function(t,e,i){return t.setAttribute(e,i)},lu=function(t,e){return Ot(t[e])?tg:Uc(t[e])&&t.setAttribute?lC:hu},eg=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e6)/1e6,e)},cC=function(t,e){return e.set(e.t,e.p,!!(e.s+e.c*t),e)},ig=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)},cu=function(t,e){for(var i=e._pt;i;)i.r(t,i.d),i=i._next},uC=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},dC=function(t){for(var e=this._pt,i,s;e;)s=e._next,e.p===t&&!e.op||e.op===t?Wa(this,e,"_pt"):e.dep||(i=1),e=s;return!i},fC=function(t,e,i,s){s.mSet(t,e,s.m.call(s.tween,i,s.mt),s)},rg=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},we=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||eg,this.d=h||this,this.set=l||hu,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=fC,this.m=i,this.mt=n,this.tween=s},r}();ve(jc+"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 Kc[r]=1}),Pe.TweenMax=Pe.TweenLite=Kt,Pe.TimelineLite=Pe.TimelineMax=ge,kt=new ge({sortChildren:!1,defaults:Hs,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),Re.stringFilter=Km;var ns=[],Ka={},pC=[],sg=0,mC=0,uu=function(t){return(Ka[t]||pC).map(function(e){return e()})},du=function(){var t=Date.now(),e=[];t-sg>2&&(uu("matchMediaInit"),ns.forEach(function(i){var s=i.queries,n=i.conditions,o,a,h,l;for(a in s)o=Si.matchMedia(s[a]).matches,o&&(h=1),o!==n[a]&&(n[a]=o,l=1);l&&(i.revert(),h&&e.push(i))}),uu("matchMediaRevert"),e.forEach(function(i){return i.onMatch(i,function(s){return i.add(null,s)})}),sg=t,uu("matchMedia"))},ng=function(){function r(e,i){this.selector=i&&tu(i),this.data=[],this._r=[],this.isReverted=!1,this.id=mC++,e&&this.add(e)}var t=r.prototype;return t.add=function(i,s,n){Ot(i)&&(n=s,s=i,i=Ot);var o=this,a=function(){var l=Mt,c=o.selector,u;return l&&l!==o&&l.data.push(o),n&&(o.selector=tu(n)),Mt=o,u=s.apply(o,arguments),Ot(u)&&o._r.push(u),Mt=l,o.selector=c,o.isReverted=!1,u};return o.last=a,i===Ot?a(o,function(h){return o.add(null,h)}):i?o[i]=a:a},t.ignore=function(i){var s=Mt;Mt=null,i(this),Mt=s},t.getTweens=function(){var i=[];return this.data.forEach(function(s){return s instanceof r?i.push.apply(i,s.getTweens()):s instanceof Kt&&!(s.parent&&s.parent.data==="nested")&&i.push(s)}),i},t.clear=function(){this._r.length=this.data.length=0},t.kill=function(i,s){var n=this;if(i?function(){for(var 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 ge?l.data!=="nested"&&(l.scrollTrigger&&l.scrollTrigger.revert(),l.kill()):!(l instanceof Kt)&&l.revert&&l.revert(i);n._r.forEach(function(c){return c(i,n)}),n.isReverted=!0}():this.data.forEach(function(a){return a.kill&&a.kill()}),this.clear(),s)for(var o=ns.length;o--;)ns[o].id===this.id&&ns.splice(o,1)},t.revert=function(i){this.kill(i||{})},r}(),gC=function(){function r(e){this.contexts=[],this.scope=e,Mt&&Mt.data.push(this)}var t=r.prototype;return t.add=function(i,s,n){Ti(i)||(i={matches:i});var o=new ng(0,n||this.scope),a=o.conditions={},h,l,c;Mt&&!o.selector&&(o.selector=Mt.selector),this.contexts.push(o),s=o.add("onMatch",s),o.queries=i;for(l in i)l==="all"?c=1:(h=Si.matchMedia(i[l]),h&&(ns.indexOf(o)<0&&ns.push(o),(a[l]=h.matches)&&(c=1),h.addListener?h.addListener(du):h.addEventListener("change",du)));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}(),Ya={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 Wm(s)})},timeline:function(t){return new ge(t)},getTweensOf:function(t,e){return kt.getTweensOf(t,e)},getProperty:function(t,e,i,s){ie(t)&&(t=He(t)[0]);var n=ts(t||{}).get,o=i?Cm:Sm;return i==="native"&&(i=""),t&&(e?o((Le[e]&&Le[e].get||n)(t,e,i,s)):function(a,h,l){return o((Le[a]&&Le[a].get||n)(t,a,h,l))})},quickSetter:function(t,e,i){if(t=He(t),t.length>1){var s=t.map(function(c){return Te.quickSetter(c,e,i)}),n=s.length;return function(c){for(var u=n;u--;)s[u](c)}}t=t[0]||{};var o=Le[e],a=ts(t),h=a.harness&&(a.harness.aliases||{})[e]||e,l=o?function(c){var u=new o;Js._pt=0,u.init(t,i?c+i:c,Js,0,[t]),u.render(1,u),Js._pt&&cu(1,Js)}: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=Te.to(t,es((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 kt.getTweensOf(t,!0).length>0},defaults:function(t){return t&&t.ease&&(t.ease=rs(t.ease,Hs.ease)),Em(Hs,t||{})},config:function(t){return Em(Re,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&&!Le[a]&&!Pe[a]&&Xn(e+" effect requires "+a+" plugin.")}),zc[e]=function(a,h,l){return i(He(a),Ze(h||{},n),l)},o&&(ge.prototype[e]=function(a,h,l){return this.add(zc[e](a,Ti(h)?h:(l=h)&&{},this),l)})},registerEase:function(t,e){xt[t]=rs(e)},parseEase:function(t,e){return arguments.length?rs(t,e):xt},getById:function(t){return kt.getById(t)},exportRoot:function(t,e){t===void 0&&(t={});var i=new ge(t),s,n;for(i.smoothChildTiming=_e(t.smoothChildTiming),kt.remove(i),i._dp=0,i._time=i._tTime=kt._time,s=kt._first;s;)n=s._next,(e||!(!s._dur&&s instanceof Kt&&s.vars.onComplete===s._targets[0]))&&Ci(i,s,s._start-s._delay),s=n;return Ci(kt,i,0),i},context:function(t,e){return t?new ng(t,e):Mt},matchMedia:function(t){return new gC(t)},matchMediaRefresh:function(){return ns.forEach(function(t){var e=t.conditions,i,s;for(s in e)e[s]&&(e[s]=!1,i=1);i&&t.revert()})||du()},addEventListener:function(t,e){var i=Ka[t]||(Ka[t]=[]);~i.indexOf(e)||i.push(e)},removeEventListener:function(t,e){var i=Ka[t],s=i&&i.indexOf(e);s>=0&&i.splice(s,1)},utils:{wrap:zS,wrapYoyo:jS,distribute:Fm,random:Dm,snap:Nm,normalize:YS,getUnit:de,clamp:ZS,splitColor:Zm,toArray:He,selector:tu,mapRange:Um,pipe:HS,unitize:KS,interpolate:JS,shuffle:km},install:bm,effects:zc,ticker:ke,updateRoot:ge.updateRoot,plugins:Le,globalTimeline:kt,core:{PropTween:we,globals:xm,Tween:Kt,Timeline:ge,Animation:Jn,getCache:ts,_removeLinkedListItem:Wa,reverting:function(){return ce},context:function(t){return t&&Mt&&(Mt.data.push(t),t._ctx=Mt),Mt},suppressOverwrites:function(t){return Dc=t}}};ve("to,from,fromTo,delayedCall,set,killTweensOf",function(r){return Ya[r]=Kt[r]}),ke.add(ge.updateRoot),Js=Ya.to({},{duration:0});var yC=function(t,e){for(var i=t._pt;i&&i.p!==e&&i.op!==e&&i.fp!==e;)i=i._next;return i},bC=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=yC(o,s)),o&&o.modifier&&o.modifier(e[s],t,i[n],s))},fu=function(t,e){return{name:t,rawVars:1,init:function(s,n,o){o._onInit=function(a){var h,l;if(ie(n)&&(h={},ve(n,function(c){return h[c]=1}),n=h),e){h={};for(l in n)h[l]=e(n[l]);n=h}bC(a,n)}}}},Te=Ya.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;)ce?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)}},fu("roundProps",eu),fu("modifiers"),fu("snap",Nm))||Ya;Kt.version=ge.version=Te.version="3.12.5",ym=1,Bc()&&$s(),xt.Power0,xt.Power1,xt.Power2,xt.Power3,xt.Power4,xt.Linear,xt.Quad,xt.Cubic,xt.Quart,xt.Quint,xt.Strong,xt.Elastic,xt.Back,xt.SteppedEase,xt.Bounce,xt.Sine,xt.Expo,xt.Circ;/*!
1167
+ */var Re={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},Hs={duration:.5,overwrite:!1,delay:0},Dc,ce,Mt,We=1e8,Ct=1/We,Oc=Math.PI*2,IS=Oc/4,AS=0,dm=Math.sqrt,MS=Math.cos,RS=Math.sin,ie=function(t){return typeof t=="string"},Ot=function(t){return typeof t=="function"},Yi=function(t){return typeof t=="number"},Bc=function(t){return typeof t>"u"},Ti=function(t){return typeof t=="object"},_e=function(t){return t!==!1},Uc=function(){return typeof window<"u"},Na=function(t){return Ot(t)||ie(t)},fm=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},ue=Array.isArray,Xc=/(?:-?\.?\d|\.)+/gi,pm=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,Ks=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,Wc=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,mm=/[+-]=-?[.\d]+/,gm=/[^,'"\[\]\s]+/gi,PS=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,kt,Si,Zc,Vc,Pe={},Da={},ym,bm=function(t){return(Da=es(t,Pe))&&Te},Hc=function(t,e){return console.warn("Invalid property",t,"set to",e,"Missing plugin? gsap.registerPlugin()")},Xn=function(t,e){return!e&&console.warn(t)},xm=function(t,e){return t&&(Pe[t]=e)&&Da&&(Da[t]=e)||Pe},Wn=function(){return 0},LS={suppressEvents:!0,isStart:!0,kill:!1},Oa={suppressEvents:!0,kill:!1},GS={suppressEvents:!0},Kc={},_r=[],Yc={},_m,Le={},zc={},vm=30,Ba=[],jc="",Jc=function(t){var e=t[0],i,s;if(Ti(e)||Ot(e)||(t=[t]),!(i=(e._gsap||{}).harness)){for(s=Ba.length;s--&&!Ba[s].targetTest(e););i=Ba[s]}for(s=t.length;s--;)t[s]&&(t[s]._gsap||(t[s]._gsap=new Jm(t[s],i)))||t.splice(s,1);return t},ts=function(t){return t._gsap||Jc(He(t))[0]._gsap},wm=function(t,e,i){return(i=t[e])&&Ot(i)?t[e]():Bc(i)&&t.getAttribute&&t.getAttribute(e)||i},ve=function(t,e){return(t=t.split(",")).forEach(e)||t},Wt=function(t){return Math.round(t*1e5)/1e5||0},re=function(t){return Math.round(t*1e7)/1e7||0},Ys=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},kS=function(t,e){for(var i=e.length,s=0;t.indexOf(e[s])<0&&++s<i;);return s<i},Ua=function(){var t=_r.length,e=_r.slice(0),i,s;for(Yc={},_r.length=0,i=0;i<t;i++)s=e[i],s&&s._lazy&&(s.render(s._lazy[0],s._lazy[1],!0)._lazy=0)},Tm=function(t,e,i,s){_r.length&&!ce&&Ua(),t.render(e,i,ce&&e<0&&(t._initted||t._startAt)),_r.length&&!ce&&Ua()},Sm=function(t){var e=parseFloat(t);return(e||e===0)&&(t+"").match(gm).length<2?e:ie(t)?t.trim():t},Cm=function(t){return t},Ze=function(t,e){for(var i in e)i in t||(t[i]=e[i]);return t},FS=function(t){return function(e,i){for(var s in i)s in e||s==="duration"&&t||s==="ease"||(e[s]=i[s])}},es=function(t,e){for(var i in e)t[i]=e[i];return t},Em=function r(t,e){for(var i in e)i!=="__proto__"&&i!=="constructor"&&i!=="prototype"&&(t[i]=Ti(e[i])?r(t[i]||(t[i]={}),e[i]):e[i]);return t},Xa=function(t,e){var i={},s;for(s in t)s in e||(i[s]=t[s]);return i},Zn=function(t){var e=t.parent||kt,i=t.keyframes?FS(ue(t.keyframes)):Ze;if(_e(t.inherit))for(;e;)i(t,e.vars.defaults),e=e.parent||e._dp;return t},NS=function(t,e){for(var i=t.length,s=i===e.length;s&&i--&&t[i]===e[i];);return i<0},Im=function(t,e,i,s,n){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},Wa=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},vr=function(t,e){t.parent&&(!e||t.parent.autoRemoveChildren)&&t.parent.remove&&t.parent.remove(t),t._act=0},is=function(t,e){if(t&&(!e||e._end>t._dur||e._start<0))for(var i=t;i;)i._dirty=1,i=i.parent;return t},DS=function(t){for(var e=t.parent;e&&e.parent;)e._dirty=1,e.totalDuration(),e=e.parent;return t},$c=function(t,e,i,s){return t._startAt&&(ce?t._startAt.revert(Oa):t.vars.immediateRender&&!t.vars.autoRevert||t._startAt.render(e,!0,s))},OS=function r(t){return!t||t._ts&&r(t.parent)},Am=function(t){return t._repeat?zs(t._tTime,t=t.duration()+t._rDelay)*t:0},zs=function(t,e){var i=Math.floor(t/=e);return t&&i===t?i-1:i},Za=function(t,e){return(t-e._start)*e._ts+(e._ts>=0?0:e._dirty?e.totalDuration():e._tDur)},Va=function(t){return t._end=re(t._start+(t._tDur/Math.abs(t._ts||t._rts||Ct)||0))},Ha=function(t,e){var i=t._dp;return i&&i.smoothChildTiming&&t._ts&&(t._start=re(i._time-(t._ts>0?e/t._ts:((t._dirty?t.totalDuration():t._tDur)-e)/-t._ts)),Va(t),i._dirty||is(i,t)),t},Mm=function(t,e){var i;if((e._time||!e._dur&&e._initted||e._start<t._time&&(e._dur||!e.add))&&(i=Za(t.rawTime(),e),(!e._dur||Hn(0,e.totalDuration(),i)-e._tTime>Ct)&&e.render(i,!0)),is(t,e)._dp&&t._initted&&t._time>=t._dur&&t._ts){if(t._dur<t.duration())for(i=t;i._dp;)i.rawTime()>=0&&i.totalTime(i._tTime),i=i._dp;t._zTime=-Ct}},Ci=function(t,e,i,s){return e.parent&&vr(e),e._start=re((Yi(i)?i:i||t!==kt?Ve(t,i,e):t._time)+e._delay),e._end=re(e._start+(e.totalDuration()/Math.abs(e.timeScale())||0)),Im(t,e,"_first","_last",t._sort?"_start":0),Qc(e)||(t._recent=e),s||Mm(t,e),t._ts<0&&Ha(t,t._tTime),t},Rm=function(t,e){return(Pe.ScrollTrigger||Hc("scrollTrigger",e))&&Pe.ScrollTrigger.create(e,t)},Pm=function(t,e,i,s,n){if(au(t,e,n),!t._initted)return 1;if(!i&&t._pt&&!ce&&(t._dur&&t.vars.lazy!==!1||!t._dur&&t.vars.lazy)&&_m!==ke.frame)return _r.push(t),t._lazy=[n,s],1},BS=function r(t){var e=t.parent;return e&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||r(e))},Qc=function(t){var e=t.data;return e==="isFromStart"||e==="isStart"},US=function(t,e,i,s){var n=t.ratio,o=e<0||!e&&(!t._start&&BS(t)&&!(!t._initted&&Qc(t))||(t._ts<0||t._dp._ts<0)&&!Qc(t))?0:1,a=t._rDelay,h=0,l,c,u;if(a&&t._repeat&&(h=Hn(0,t._tDur,e),c=zs(h,a),t._yoyo&&c&1&&(o=1-o),c!==zs(t._tTime,a)&&(n=1-o,t.vars.repeatRefresh&&t._initted&&t.invalidate())),o!==n||ce||s||t._zTime===Ct||!e&&t._zTime){if(!t._initted&&Pm(t,e,s,i,h))return;for(u=t._zTime,t._zTime=e||(i?Ct: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&&$c(t,e,i,!0),t._onUpdate&&!i&&Ge(t,"onUpdate"),h&&t._repeat&&!i&&t.parent&&Ge(t,"onRepeat"),(e>=t._tDur||e<0)&&t.ratio===o&&(o&&vr(t,1),!i&&!ce&&(Ge(t,o?"onComplete":"onReverseComplete",!0),t._prom&&t._prom()))}else t._zTime||(t._zTime=e)},XS=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}},js=function(t,e,i,s){var n=t._repeat,o=re(e)||0,a=t._tTime/t._tDur;return a&&!s&&(t._time*=o/t._dur),t._dur=o,t._tDur=n?n<0?1e10:re(o*(n+1)+t._rDelay*n):o,a>0&&!s&&Ha(t,t._tTime=t._tDur*a),t.parent&&Va(t),i||is(t.parent,t),t},Lm=function(t){return t instanceof ge?is(t):js(t,t._dur)},WS={_start:0,endTime:Wn,totalDuration:Wn},Ve=function r(t,e,i){var s=t.labels,n=t._recent||WS,o=t.duration()>=We?n.endTime(!1):t._dur,a,h,l;return ie(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*(ue(i)?i[0]:i).totalDuration()),a>1?r(t,e.substr(0,a-1),i)+h:o+h)):e==null?o:+e},Vn=function(t,e,i){var s=Yi(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=_e(h.vars.inherit)&&h.parent;o.immediateRender=_e(a.immediateRender),t<2?o.runBackwards=1:o.startAt=e[n-1]}return new Kt(e[0],o,e[n+1])},wr=function(t,e){return t||t===0?e(t):e},Hn=function(t,e,i){return i<t?t:i>e?e:i},de=function(t,e){return!ie(t)||!(e=PS.exec(t))?"":e[1]},ZS=function(t,e,i){return wr(i,function(s){return Hn(t,e,s)})},qc=[].slice,Gm=function(t,e){return t&&Ti(t)&&"length"in t&&(!e&&!t.length||t.length-1 in t&&Ti(t[0]))&&!t.nodeType&&t!==Si},VS=function(t,e,i){return i===void 0&&(i=[]),t.forEach(function(s){var n;return ie(s)&&!e||Gm(s,1)?(n=i).push.apply(n,He(s)):i.push(s)})||i},He=function(t,e,i){return Mt&&!e&&Mt.selector?Mt.selector(t):ie(t)&&!i&&(Zc||!$s())?qc.call((e||Vc).querySelectorAll(t),0):ue(t)?VS(t,i):Gm(t)?qc.call(t,0):t?[t]:[]},tu=function(t){return t=He(t)[0]||Xn("Invalid scope")||{},function(e){var i=t.current||t.nativeElement||t;return He(e,i.querySelectorAll?i:i===t?Xn("Invalid scope")||Vc.createElement("div"):t)}},km=function(t){return t.sort(function(){return .5-Math.random()})},Fm=function(t){if(Ot(t))return t;var e=Ti(t)?t:{each:t},i=rs(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 ie(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,T,C,E,I;if(!g){if(I=e.grid==="auto"?0:(e.grid||[1,We])[1],!I){for(C=-We;C<(C=p[I++].getBoundingClientRect().left)&&I<m;);I<m&&I--}for(g=o[m]=[],y=h?Math.min(I,m)*c-.5:s%I,x=I===We?0:h?m*u/I-.5:s/I|0,C=0,E=We,T=0;T<m;T++)b=T%I-y,_=x-(T/I|0),g[T]=v=l?Math.abs(l==="y"?_:b):dm(b*b+_*_),v>C&&(C=v),v<E&&(E=v);s==="random"&&km(g),g.max=C-E,g.min=E,g.v=m=(parseFloat(e.amount)||parseFloat(e.each)*(I>m?m-1:l?l==="y"?m/I:I:Math.max(I,m/I))||0)*(s==="edges"?-1:1),g.b=m<0?n-m:n,g.u=de(e.amount||e.each)||0,i=i&&m<0?Ym(i):i}return m=(g[d]-g.min)/g.max||0,re(g.b+(i?i(m):m)*g.v)+g.u}},eu=function(t){var e=Math.pow(10,((t+"").split(".")[1]||"").length);return function(i){var s=re(Math.round(parseFloat(i)/t)*t*e);return(s-s%1)/e+(Yi(i)?0:de(i))}},Nm=function(t,e){var i=ue(t),s,n;return!i&&Ti(t)&&(s=i=t.radius||We,t.values?(t=He(t.values),(n=!Yi(t[0]))&&(s*=s)):t=eu(t.increment)),wr(e,i?Ot(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=We,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||Yi(o)?c:c+de(o)}:eu(t))},Dm=function(t,e,i,s){return wr(ue(t)?!e:i===!0?!!(i=0):!s,function(){return ue(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})},HS=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)}},KS=function(t,e){return function(i){return t(parseFloat(i))+(e||de(i))}},YS=function(t,e,i){return Bm(t,e,0,1,i)},Om=function(t,e,i){return wr(i,function(s){return t[~~e(s)]})},zS=function r(t,e,i){var s=e-t;return ue(t)?Om(t,r(0,t.length),e):wr(i,function(n){return(s+(n-t)%s)%s+t})},jS=function r(t,e,i){var s=e-t,n=s*2;return ue(t)?Om(t,r(0,t.length-1),e):wr(i,function(o){return o=(n+(o-t)%n)%n||0,t+(o>s?n-o:o)})},Kn=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?gm:Xc),i+=t.substr(e,s-e)+Dm(a?n:+n[0],a?0:+n[1],+n[2]||1e-5),e=o+1;return i+t.substr(e,t.length-e)},Bm=function(t,e,i,s,n){var o=e-t,a=s-i;return wr(n,function(h){return i+((h-t)/o*a||0)})},JS=function r(t,e,i,s){var n=isNaN(t+e)?0:function(f){return(1-f)*t+f*e};if(!n){var o=ie(t),a={},h,l,c,u,d;if(i===!0&&(s=1)&&(i=null),o)t={p:t},e={p:e};else if(ue(t)&&!ue(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=es(ue(t)?[]:{},t));if(!c){for(h in e)nu.call(a,t,h,"get",e[h]);n=function(p){return cu(p,a)||(o?t.p:t)}}}return wr(i,n)},Um=function(t,e,i){var s=t.labels,n=We,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},Ge=function(t,e,i){var s=t.vars,n=s[e],o=Mt,a=t._ctx,h,l,c;if(n)return h=s[e+"Params"],l=s.callbackScope||t,i&&_r.length&&Ua(),a&&(Mt=a),c=h?n.apply(l,h):n.call(l),Mt=o,c},Yn=function(t){return vr(t),t.scrollTrigger&&t.scrollTrigger.kill(!!ce),t.progress()<1&&Ge(t,"onInterrupt"),t},Js,Xm=[],Wm=function(t){if(t)if(t=!t.name&&t.default||t,Uc()||t.headless){var e=t.name,i=Ot(t),s=e&&!i&&t.init?function(){this._props=[]}:t,n={init:Wn,render:cu,add:nu,kill:dC,modifier:uC,rawVars:0},o={targetTest:0,get:0,getSetter:lu,aliases:{},register:0};if($s(),t!==s){if(Le[e])return;Ze(s,Ze(Xa(t,n),o)),es(s.prototype,es(n,Xa(t,o))),Le[s.prop=e]=s,t.targetTest&&(Ba.push(s),Kc[e]=1),e=(e==="css"?"CSS":e.charAt(0).toUpperCase()+e.substr(1))+"Plugin"}xm(e,s),t.register&&t.register(Te,s,we)}else Xm.push(t)},St=255,zn={aqua:[0,St,St],lime:[0,St,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,St],navy:[0,0,128],white:[St,St,St],olive:[128,128,0],yellow:[St,St,0],orange:[St,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[St,0,0],pink:[St,192,203],cyan:[0,St,St],transparent:[St,St,St,0]},iu=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)*St+.5|0},Zm=function(t,e,i){var s=t?Yi(t)?[t>>16,t>>8&St,t&St]:0:zn.black,n,o,a,h,l,c,u,d,f,p;if(!s){if(t.substr(-1)===","&&(t=t.substr(0,t.length-1)),zn[t])s=zn[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&St,s&St,parseInt(t.substr(7),16)/255];t=parseInt(t.substr(1),16),s=[t>>16,t>>8&St,t&St]}else if(t.substr(0,3)==="hsl"){if(s=p=t.match(Xc),!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]=iu(h+1/3,n,o),s[1]=iu(h,n,o),s[2]=iu(h-1/3,n,o);else if(~t.indexOf("="))return s=t.match(pm),i&&s.length<4&&(s[3]=1),s}else s=t.match(Xc)||zn.transparent;s=s.map(Number)}return e&&!p&&(n=s[0]/St,o=s[1]/St,a=s[2]/St,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},Vm=function(t){var e=[],i=[],s=-1;return t.split(Tr).forEach(function(n){var o=n.match(Ks)||[];e.push.apply(e,o),i.push(s+=o.length+1)}),e.c=i,e},Hm=function(t,e,i){var s="",n=(t+s).match(Tr),o=e?"hsla(":"rgba(",a=0,h,l,c,u;if(!n)return t;if(n=n.map(function(d){return(d=Zm(d,e,1))&&o+(e?d[0]+","+d[1]+"%,"+d[2]+"%,"+d[3]:d.join(","))+")"}),i&&(c=Vm(t),h=i.c,h.join(s)!==c.c.join(s)))for(l=t.replace(Tr,"1").split(Ks),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(Tr),u=l.length-1;a<u;a++)s+=l[a]+n[a];return s+l[u]},Tr=function(){var r="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b",t;for(t in zn)r+="|"+t+"\\b";return new RegExp(r+")","gi")}(),$S=/hsl[a]?\(/,Km=function(t){var e=t.join(" "),i;if(Tr.lastIndex=0,Tr.test(e))return i=$S.test(e),t[1]=Hm(t[1],i),t[0]=Hm(t[0],i,Vm(t[1])),!0},jn,ke=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,T;if((y>t||y<0)&&(i+=y-e),s+=y,v=s-i,b=v-o,(b>0||x)&&(T=++u.frame,d=v-u.time*1e3,u.time=v=v/1e3,o+=b+(b>=n?4:n-b),_=1),x||(h=l(m)),_)for(f=0;f<a.length;f++)a[f](v,d,T,g)};return u={time:0,frame:0,tick:function(){p(!0)},deltaRatio:function(g){return d/(1e3/(g||60))},wake:function(){ym&&(!Zc&&Uc()&&(Si=Zc=window,Vc=Si.document||{},Pe.gsap=Te,(Si.gsapVersions||(Si.gsapVersions=[])).push(Te.version),bm(Da||Si.GreenSockGlobals||!Si.gsap&&Si||{}),Xm.forEach(Wm)),c=typeof requestAnimationFrame<"u"&&requestAnimationFrame,h&&u.sleep(),l=c||function(g){return setTimeout(g,o-u.time*1e3+1|0)},jn=1,p(2))},sleep:function(){(c?cancelAnimationFrame:clearTimeout)(h),jn=0,l=Wn},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,T,C){g(_,v,T,C),u.remove(b)}:g;return u.remove(g),a[x?"unshift":"push"](b),$s(),b},remove:function(g,y){~(y=a.indexOf(g))&&a.splice(y,1)&&f>=y&&f--},_listeners:a},u}(),$s=function(){return!jn&&ke.wake()},bt={},QS=/^[\d.\-M][\d.\-,\s]/,qS=/["']/g,tC=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(qS,"").trim():+l,s=h.substr(a+1).trim();return e},eC=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)},iC=function(t){var e=(t+"").split("("),i=bt[e[0]];return i&&e.length>1&&i.config?i.config.apply(null,~t.indexOf("{")?[tC(e[1])]:eC(t).split(",").map(Sm)):bt._CE&&QS.test(t)?bt._CE("",t):i},Ym=function(t){return function(e){return 1-t(1-e)}},zm=function r(t,e){for(var i=t._first,s;i;)i instanceof ge?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},rs=function(t,e){return t&&(Ot(t)?t:bt[t]||iC(t))||e},ss=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 ve(t,function(a){bt[a]=Pe[a]=n,bt[o=a.toLowerCase()]=i;for(var h in n)bt[o+(h==="easeIn"?".in":h==="easeOut"?".out":".inOut")]=bt[a+"."+h]=n[h]}),n},jm=function(t){return function(e){return e<.5?(1-t(1-e*2))/2:.5+t((e-.5)*2)/2}},ru=function r(t,e,i){var s=e>=1?e:1,n=(i||(t?.3:.45))/(e<1?e:1),o=n/Oc*(Math.asin(1/s)||0),a=function(c){return c===1?1:s*Math.pow(2,-10*c)*RS((c-o)*n)+1},h=t==="out"?a:t==="in"?function(l){return 1-a(1-l)}:jm(a);return n=Oc/n,h.config=function(l,c){return r(t,l,c)},h},su=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)}:jm(i);return s.config=function(n){return r(t,n)},s};ve("Linear,Quad,Cubic,Quart,Quint,Strong",function(r,t){var e=t<5?t+1:t;ss(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})}),bt.Linear.easeNone=bt.none=bt.Linear.easeIn,ss("Elastic",ru("in"),ru("out"),ru()),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};ss("Bounce",function(o){return 1-n(1-o)},n)}(7.5625,2.75),ss("Expo",function(r){return r?Math.pow(2,10*(r-1)):0}),ss("Circ",function(r){return-(dm(1-r*r)-1)}),ss("Sine",function(r){return r===1?1:-MS(r*IS)+1}),ss("Back",su("in"),su("out"),su()),bt.SteppedEase=bt.steps=Pe.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-Ct;return function(a){return((s*Hn(0,o,a)|0)+n)*i}}},Hs.ease=bt["quad.out"],ve("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",function(r){return jc+=r+","+r+"Params,"});var Jm=function(t,e){this.id=AS++,t._gsap=this,this.target=t,this.harness=e,this.get=e?e.get:wm,this.set=e?e.getSetter:lu},Jn=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,js(this,+e.duration,1,1),this.data=e.data,Mt&&(this._ctx=Mt,Mt.data.push(this)),jn||ke.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,js(this,this._repeat<0?i:(i-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},t.totalTime=function(i,s){if($s(),!arguments.length)return this._tTime;var n=this._dp;if(n&&n.smoothChildTiming&&this._ts){for(Ha(this,i),!n._dp||n.parent||Mm(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)&&Ci(this._dp,this,this._start-this._delay)}return(this._tTime!==i||!this._dur&&!s||this._initted&&Math.abs(this._zTime)===Ct||!i&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=i),Tm(this,i,s)),this},t.time=function(i,s){return arguments.length?this.totalTime(Math.min(this.totalDuration(),i+Am(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)+Am(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?zs(this._tTime,n)+1:1},t.timeScale=function(i,s){if(!arguments.length)return this._rts===-Ct?0:this._rts;if(this._rts===i)return this;var n=this.parent&&this._ts?Za(this.parent._time,this):this._tTime;return this._rts=+i||0,this._ts=this._ps||i===-Ct?0:this._rts,this.totalTime(Hn(-Math.abs(this._delay),this._tDur,n),s!==!1),Va(this),DS(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):($s(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,this.progress()===1&&Math.abs(this._zTime)!==Ct&&(this._tTime-=Ct)))),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)&&Ci(s,this,i-this._delay),this}return this._start},t.endTime=function(i){return this._start+(_e(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?Za(s.rawTime(i),this):this._tTime:this._tTime},t.revert=function(i){i===void 0&&(i=GS);var s=ce;return ce=i,(this._initted||this._startAt)&&(this.timeline&&this.timeline.revert(i),this.totalTime(-.01,i.suppressEvents)),this.data!=="nested"&&i.kill!==!1&&this.kill(),ce=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,Lm(this)):this._repeat===-2?1/0:this._repeat},t.repeatDelay=function(i){if(arguments.length){var s=this._time;return this._rDelay=i,Lm(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(Ve(this,i),_e(s))},t.restart=function(i,s){return this.play().totalTime(i?-this._delay:0,_e(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?-Ct:0)),this):this._rts<0},t.invalidate=function(){return this._initted=this._act=0,this._zTime=-Ct,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)-Ct)},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=Ot(i)?i:Cm,a=function(){var l=s.then;s.then=null,Ot(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(){Yn(this)},r}();Ze(Jn.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:-Ct,_prom:0,_ps:!1,_rts:1});var ge=function(r){um(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=_e(i.sortChildren),kt&&Ci(i.parent||kt,Ki(n),s),i.reversed&&n.reverse(),i.paused&&n.paused(!0),i.scrollTrigger&&Rm(Ki(n),i.scrollTrigger),n}var e=t.prototype;return e.to=function(s,n,o){return Vn(0,arguments,this),this},e.from=function(s,n,o){return Vn(1,arguments,this),this},e.fromTo=function(s,n,o,a){return Vn(2,arguments,this),this},e.set=function(s,n,o){return n.duration=0,n.parent=this,Zn(n).repeatDelay||(n.repeat=0),n.immediateRender=!!n.immediateRender,new Kt(s,n,Ve(this,o),1),this},e.call=function(s,n,o){return Ci(this,Kt.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 Kt(s,o,Ve(this,h)),this},e.staggerFrom=function(s,n,o,a,h,l,c){return o.runBackwards=1,Zn(o).immediateRender=_e(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,Zn(a).immediateRender=_e(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:re(s),u=this._zTime<0!=s<0&&(this._initted||!l),d,f,p,m,g,y,x,b,_,v,T,C;if(this!==kt&&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,_=this._start,b=this._ts,y=!b,u&&(l||(a=this._zTime),(s||!n)&&(this._zTime=s)),this._repeat){if(T=this._yoyo,g=l+this._rDelay,this._repeat<-1&&s<0)return this.totalTime(g*100+s,n,o);if(d=re(c%g),c===h?(m=this._repeat,d=l):(m=~~(c/g),m&&m===c/g&&(d=l,m--),d>l&&(d=l)),v=zs(this._tTime,g),!a&&this._tTime&&v!==m&&this._tTime-v*g-this._dur<=0&&(v=m),T&&m&1&&(d=l-d,C=1),m!==v&&!this._lock){var E=T&&v&1,I=E===(T&&m&1);if(m<v&&(E=!E),a=E?0:c%l?l:c,this._lock=1,this.render(a||(C?0:re(m*g)),n,!l)._lock=0,this._tTime=c,!n&&this.parent&&Ge(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,I&&(this._lock=2,a=E?l:-1e-4,this.render(a,!0),this.vars.repeatRefresh&&!C&&this.invalidate()),this._lock=0,!this._ts&&!y)return this;zm(this,C)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(x=XS(this,re(a),re(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&&(Ge(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=-Ct);break}}f=p}else{f=this._last;for(var k=s<0?s:d;f;){if(p=f._prev,(f._act||k<=f._end)&&f._ts&&x!==f){if(f.parent!==this)return this.render(s,n,o);if(f.render(f._ts>0?(k-f._start)*f._ts:(f._dirty?f.totalDuration():f._tDur)+(k-f._start)*f._ts,n,o||ce&&(f._initted||f._startAt)),d!==this._time||!this._ts&&!y){x=0,p&&(c+=this._zTime=k?-Ct:Ct);break}}f=p}}if(x&&!n&&(this.pause(),x.render(d>=a?0:-Ct)._zTime=d>=a?1:-1,this._ts))return this._start=_,Va(this),this.render(s,n,o);this._onUpdate&&!n&&Ge(this,"onUpdate",!0),(c===h&&this._tTime>=this.totalDuration()||!c&&a)&&(_===this._start||Math.abs(b)!==Math.abs(this._ts))&&(this._lock||((s||!l)&&(c===h&&this._ts>0||!c&&this._ts<0)&&vr(this,1),!n&&!(s<0&&!a)&&(c||a||!h)&&(Ge(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(Yi(n)||(n=Ve(this,n,s)),!(s instanceof Jn)){if(ue(s))return s.forEach(function(a){return o.add(a,n)}),this;if(ie(s))return this.addLabel(s,n);if(Ot(s))s=Kt.delayedCall(0,s);else return this}return this!==s?Ci(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=-We);for(var h=[],l=this._first;l;)l._start>=a&&(l instanceof Kt?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 ie(s)?this.removeLabel(s):Ot(s)?this.killTweensOf(s):(Wa(this,s),s===this._recent&&(this._recent=this._last),is(this))},e.totalTime=function(s,n){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=re(ke.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]=Ve(this,n),this},e.removeLabel=function(s){return delete this.labels[s],this},e.addPause=function(s,n,o){var a=Kt.delayedCall(0,n||Wn,o);return a.data="isPause",this._hasPause=1,Ci(this,a,Ve(this,s))},e.removePause=function(s){var n=this._first;for(s=Ve(this,s);n;)n._start===s&&n.data==="isPause"&&vr(n),n=n._next},e.killTweensOf=function(s,n,o){for(var a=this.getTweensOf(s,o),h=a.length;h--;)Sr!==a[h]&&a[h].kill(s,n);return this},e.getTweensOf=function(s,n){for(var o=[],a=He(s),h=this._first,l=Yi(n),c;h;)h instanceof Kt?kS(h._targets,a)&&(l?(!Sr||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=Ve(o,s),h=n,l=h.startAt,c=h.onStart,u=h.onStartParams,d=h.immediateRender,f,p=Kt.to(o,Ze({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())||Ct,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&&js(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,Ze({startAt:{time:Ve(this,s)}},o))},e.recent=function(){return this._recent},e.nextLabel=function(s){return s===void 0&&(s=this._time),Um(this,Ve(this,s))},e.previousLabel=function(s){return s===void 0&&(s=this._time),Um(this,Ve(this,s),1)},e.currentLabel=function(s){return arguments.length?this.seek(s,!0):this.previousLabel(this._time+Ct)},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 is(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={}),is(this)},e.totalDuration=function(s){var n=0,o=this,a=o._last,h=We,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,Ci(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;js(o,o===kt&&o._time>n?o._time:n,1,1),o._dirty=0}return o._tDur},t.updateRoot=function(s){if(kt._ts&&(Tm(kt,Za(s,kt)),_m=ke.frame),ke.frame>=vm){vm+=Re.autoSleep||120;var n=kt._first;if((!n||!n._ts)&&Re.autoSleep&&ke._listeners.length<2){for(;n&&!n._ts;)n=n._next;n||ke.sleep()}}},t}(Jn);Ze(ge.prototype,{_lock:0,_hasPause:0,_forcing:0});var rC=function(t,e,i,s,n,o,a){var h=new we(this._pt,t,e,0,1,ig,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=Kn(s)),o&&(x=[i,s],o(x,t,e),i=x[0],s=x[1]),d=i.match(Wc)||[];u=Wc.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)==="="?Ys(g,p)-g:parseFloat(p)-g,m:f&&f<4?Math.round:0},l=Wc.lastIndex);return h.c=l<s.length?s.substring(l,s.length):"",h.fp=a,(mm.test(s)||y)&&(h.e=0),this._pt=h,h},nu=function(t,e,i,s,n,o,a,h,l,c){Ot(s)&&(s=s(n||0,t,o));var u=t[e],d=i!=="get"?i:Ot(u)?l?t[e.indexOf("set")||!Ot(t["get"+e.substr(3)])?e:"get"+e.substr(3)](l):t[e]():u,f=Ot(u)?l?hC:tg:hu,p;if(ie(s)&&(~s.indexOf("random(")&&(s=Kn(s)),s.charAt(1)==="="&&(p=Ys(d,s)+(de(d)||0),(p||p===0)&&(s=p))),!c||d!==s||ou)return!isNaN(d*s)&&s!==""?(p=new we(this._pt,t,e,+d||0,s-(d||0),typeof u=="boolean"?cC:eg,0,f),l&&(p.fp=l),a&&p.modifier(a,this,t),this._pt=p):(!u&&!(e in t)&&Hc(e,s),rC.call(this,t,e,d,s,f,h||Re.stringFilter,l))},sC=function(t,e,i,s,n){if(Ot(t)&&(t=$n(t,n,e,i,s)),!Ti(t)||t.style&&t.nodeType||ue(t)||fm(t))return ie(t)?$n(t,n,e,i,s):t;var o={},a;for(a in t)o[a]=$n(t[a],n,e,i,s);return o},$m=function(t,e,i,s,n,o){var a,h,l,c;if(Le[t]&&(a=new Le[t]).init(n,a.rawVars?e[t]:sC(e[t],s,n,o,i),i,s,o)!==!1&&(i._pt=h=new we(i._pt,n,t,0,1,a.render,a,0,a.priority),i!==Js))for(l=i._ptLookup[i._targets.indexOf(n)],c=a._props.length;c--;)l[a._props[c]]=h;return a},Sr,ou,au=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"&&!Dc,_=t.timeline,v,T,C,E,I,k,L,P,S,R,F,O,U;if(_&&(!d||!n)&&(n="none"),t._ease=rs(n,Hs.ease),t._yEase=u?Ym(rs(u===!0?n:u,Hs.ease)):0,u&&t._yoyo&&!t._repeat&&(u=t._yEase,t._yEase=t._ease,t._ease=u),t._from=!_&&!!s.runBackwards,!_||d&&!s.stagger){if(P=g[0]?ts(g[0]).harness:0,O=P&&s[P.prop],v=Xa(s,Kc),m&&(m._zTime<0&&m.progress(1),e<0&&c&&a&&!f?m.render(-1,!0):m.revert(c&&p?Oa:LS),m._lazy=0),o){if(vr(t._startAt=Kt.set(g,Ze({data:"isStart",overwrite:!1,parent:y,immediateRender:!0,lazy:!m&&_e(h),startAt:null,delay:0,onUpdate:l&&function(){return Ge(t,"onUpdate")},stagger:0},o))),t._startAt._dp=0,t._startAt._sat=t,e<0&&(ce||!a&&!f)&&t._startAt.revert(Oa),a&&p&&e<=0&&i<=0){e&&(t._zTime=e);return}}else if(c&&p&&!m){if(e&&(a=!1),C=Ze({overwrite:!1,data:"isFromStart",lazy:a&&!m&&_e(h),immediateRender:a,stagger:0,parent:y},v),O&&(C[P.prop]=O),vr(t._startAt=Kt.set(g,C)),t._startAt._dp=0,t._startAt._sat=t,e<0&&(ce?t._startAt.revert(Oa):t._startAt.render(-1,!0)),t._zTime=e,!a)r(t._startAt,Ct,Ct);else if(!e)return}for(t._pt=t._ptCache=0,h=p&&_e(h)||h&&!p,T=0;T<g.length;T++){if(I=g[T],L=I._gsap||Jc(g)[T]._gsap,t._ptLookup[T]=R={},Yc[L.id]&&_r.length&&Ua(),F=x===g?T:x.indexOf(I),P&&(S=new P).init(I,O||v,t,F,x)!==!1&&(t._pt=E=new we(t._pt,I,S.name,0,1,S.render,S,0,S.priority),S._props.forEach(function(Z){R[Z]=E}),S.priority&&(k=1)),!P||O)for(C in v)Le[C]&&(S=$m(C,v,t,F,I,x))?S.priority&&(k=1):R[C]=E=nu.call(t,I,C,"get",v[C],F,x,0,s.stringFilter);t._op&&t._op[T]&&t.kill(I,t._op[T]),b&&t._pt&&(Sr=t,kt.killTweensOf(I,R,t.globalTime(e)),U=!t.parent,Sr=0),t._pt&&h&&(Yc[L.id]=1)}k&&rg(t),t._onInit&&t._onInit(t)}t._onUpdate=l,t._initted=(!t._op||t._pt)&&!U,d&&e<=0&&_.render(We,!0,!0)},nC=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 ou=1,t.vars[e]="+=0",au(t,a),ou=0,h?Xn(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=Wt(i)+de(u.e)),u.b&&(u.b=c.s+de(u.b))},oC=function(t,e){var i=t[0]?ts(t[0]).harness:0,s=i&&i.aliases,n,o,a,h;if(!s)return e;n=es({},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},aC=function(t,e,i,s){var n=e.ease||s||"power1.inOut",o,a;if(ue(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})},$n=function(t,e,i,s,n){return Ot(t)?t.call(e,i,s,n):ie(t)&&~t.indexOf("random(")?Kn(t):t},Qm=jc+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert",qm={};ve(Qm+",id,stagger,delay,duration,paused,scrollTrigger",function(r){return qm[r]=1});var Kt=function(r){um(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:Zn(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||kt,b=(ue(i)||fm(i)?Yi(i[0]):"length"in s)?[i]:He(i),_,v,T,C,E,I,k,L;if(a._targets=b.length?Jc(b):Xn("GSAP target "+i+" not found. https://gsap.com",!Re.nullTargetWarn)||[],a._ptLookup=[],a._overwrite=f,p||d||Na(l)||Na(c)){if(s=a.vars,_=a.timeline=new ge({data:"nested",defaults:m||{},targets:x&&x.data==="nested"?x.vars.targets:b}),_.kill(),_.parent=_._dp=Ki(a),_._start=0,d||Na(l)||Na(c)){if(C=b.length,k=d&&Fm(d),Ti(d))for(E in d)~Qm.indexOf(E)&&(L||(L={}),L[E]=d[E]);for(v=0;v<C;v++)T=Xa(s,qm),T.stagger=0,y&&(T.yoyoEase=y),L&&es(T,L),I=b[v],T.duration=+$n(l,Ki(a),v,I,b),T.delay=(+$n(c,Ki(a),v,I,b)||0)-a._delay,!d&&C===1&&T.delay&&(a._delay=c=T.delay,a._start+=c,T.delay=0),_.to(I,T,k?k(v,I,b):0),_._ease=bt.none;_.duration()?l=c=0:a.timeline=0}else if(p){Zn(Ze(_.vars.defaults,{ease:"none"})),_._ease=rs(p.ease||s.ease||"none");var P=0,S,R,F;if(ue(p))p.forEach(function(O){return _.to(b,O,">")}),_.duration();else{T={};for(E in p)E==="ease"||E==="easeEach"||aC(E,p[E],T,p.easeEach);for(E in T)for(S=T[E].sort(function(O,U){return O.t-U.t}),P=0,v=0;v<S.length;v++)R=S[v],F={ease:R.e,duration:(R.t-(v?S[v-1].t:0))/100*l},F[E]=R.v,_.to(b,F,P),P+=F.duration;_.duration()<l&&_.to({},{duration:l-_.duration()})}}l||a.duration(l=_.duration())}else a.timeline=0;return f===!0&&!Dc&&(Sr=Ki(a),kt.killTweensOf(b),Sr=0),Ci(x,Ki(a),n),s.reversed&&a.reverse(),s.paused&&a.paused(!0),(u||!l&&!p&&a._start===re(x._time)&&_e(u)&&OS(Ki(a))&&x.data!=="nested")&&(a._tTime=-Ct,a.render(Math.max(0,-c)||0)),g&&Rm(Ki(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-Ct&&!c?h:s<Ct?0:s,d,f,p,m,g,y,x,b,_;if(!l)US(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=re(u%m),u===h?(p=this._repeat,d=l):(p=~~(u/m),p&&p===re(u/m)&&(d=l,p--),d>l&&(d=l)),y=this._yoyo&&p&1,y&&(_=this._yEase,d=l-d),g=zs(this._tTime,m),d===a&&!o&&this._initted&&p===g)return this._tTime=u,this;p!==g&&(b&&this._yEase&&zm(b,y),this.vars.repeatRefresh&&!y&&!this._lock&&this._time!==m&&this._initted&&(this._lock=o=1,this.render(re(m*p),!0).invalidate()._lock=0))}if(!this._initted){if(Pm(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=(_||this._ease)(d/l),this._from&&(this.ratio=x=1-x),d&&!a&&!n&&!p&&(Ge(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&&$c(this,s,n,o),Ge(this,"onUpdate")),this._repeat&&p!==g&&this.vars.onRepeat&&!n&&this.parent&&Ge(this,"onRepeat"),(u===this._tDur||!u)&&this._tTime===u&&(c&&!this._onUpdate&&$c(this,s,!0,!0),(s||!l)&&(u===this._tDur&&this._ts>0||!u&&this._ts<0)&&vr(this,1),!n&&!(c&&!a)&&(u||a||y)&&(Ge(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){jn||ke.wake(),this._ts||this.play();var l=Math.min(this._dur,(this._dp._time-this._start)*this._ts),c;return this._initted||au(this,l),c=this._ease(l/this._dur),nC(this,s,n,o,a,c,l,h)?this.resetTo(s,n,o,a,1):(Ha(this,0),this.parent||Im(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?Yn(this):this;if(this.timeline){var o=this.timeline.totalDuration();return this.timeline.killTweensOf(s,n,Sr&&Sr.vars.overwrite!==!0)._first||Yn(this),this.parent&&o!==this.timeline.totalDuration()&&js(this,this._dur*this.timeline._tDur/o,0,1),this}var a=this._targets,h=s?He(s):a,l=this._ptLookup,c=this._pt,u,d,f,p,m,g,y;if((!n||n==="all")&&NS(a,h))return n==="all"&&(this._pt=0),Yn(this);for(u=this._op=this._op||[],n!=="all"&&(ie(n)&&(m={},ve(n,function(x){return m[x]=1}),n=m),n=oC(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)&&Wa(this,g,"_pt"),delete d[m]),f!=="all"&&(f[m]=1)}return this._initted&&!this._pt&&c&&Yn(this),this},t.to=function(s,n){return new t(s,n,arguments[2])},t.from=function(s,n){return Vn(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 Vn(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 kt.killTweensOf(s,n,o)},t}(Jn);Ze(Kt.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),ve("staggerTo,staggerFrom,staggerFromTo",function(r){Kt[r]=function(){var t=new ge,e=qc.call(arguments,0);return e.splice(r==="staggerFromTo"?5:4,0,0),t[r].apply(t,e)}});var hu=function(t,e,i){return t[e]=i},tg=function(t,e,i){return t[e](i)},hC=function(t,e,i,s){return t[e](s.fp,i)},lC=function(t,e,i){return t.setAttribute(e,i)},lu=function(t,e){return Ot(t[e])?tg:Bc(t[e])&&t.setAttribute?lC:hu},eg=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e6)/1e6,e)},cC=function(t,e){return e.set(e.t,e.p,!!(e.s+e.c*t),e)},ig=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)},cu=function(t,e){for(var i=e._pt;i;)i.r(t,i.d),i=i._next},uC=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},dC=function(t){for(var e=this._pt,i,s;e;)s=e._next,e.p===t&&!e.op||e.op===t?Wa(this,e,"_pt"):e.dep||(i=1),e=s;return!i},fC=function(t,e,i,s){s.mSet(t,e,s.m.call(s.tween,i,s.mt),s)},rg=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},we=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||eg,this.d=h||this,this.set=l||hu,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=fC,this.m=i,this.mt=n,this.tween=s},r}();ve(jc+"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 Kc[r]=1}),Pe.TweenMax=Pe.TweenLite=Kt,Pe.TimelineLite=Pe.TimelineMax=ge,kt=new ge({sortChildren:!1,defaults:Hs,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),Re.stringFilter=Km;var ns=[],Ka={},pC=[],sg=0,mC=0,uu=function(t){return(Ka[t]||pC).map(function(e){return e()})},du=function(){var t=Date.now(),e=[];t-sg>2&&(uu("matchMediaInit"),ns.forEach(function(i){var s=i.queries,n=i.conditions,o,a,h,l;for(a in s)o=Si.matchMedia(s[a]).matches,o&&(h=1),o!==n[a]&&(n[a]=o,l=1);l&&(i.revert(),h&&e.push(i))}),uu("matchMediaRevert"),e.forEach(function(i){return i.onMatch(i,function(s){return i.add(null,s)})}),sg=t,uu("matchMedia"))},ng=function(){function r(e,i){this.selector=i&&tu(i),this.data=[],this._r=[],this.isReverted=!1,this.id=mC++,e&&this.add(e)}var t=r.prototype;return t.add=function(i,s,n){Ot(i)&&(n=s,s=i,i=Ot);var o=this,a=function(){var l=Mt,c=o.selector,u;return l&&l!==o&&l.data.push(o),n&&(o.selector=tu(n)),Mt=o,u=s.apply(o,arguments),Ot(u)&&o._r.push(u),Mt=l,o.selector=c,o.isReverted=!1,u};return o.last=a,i===Ot?a(o,function(h){return o.add(null,h)}):i?o[i]=a:a},t.ignore=function(i){var s=Mt;Mt=null,i(this),Mt=s},t.getTweens=function(){var i=[];return this.data.forEach(function(s){return s instanceof r?i.push.apply(i,s.getTweens()):s instanceof Kt&&!(s.parent&&s.parent.data==="nested")&&i.push(s)}),i},t.clear=function(){this._r.length=this.data.length=0},t.kill=function(i,s){var n=this;if(i?function(){for(var 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 ge?l.data!=="nested"&&(l.scrollTrigger&&l.scrollTrigger.revert(),l.kill()):!(l instanceof Kt)&&l.revert&&l.revert(i);n._r.forEach(function(c){return c(i,n)}),n.isReverted=!0}():this.data.forEach(function(a){return a.kill&&a.kill()}),this.clear(),s)for(var o=ns.length;o--;)ns[o].id===this.id&&ns.splice(o,1)},t.revert=function(i){this.kill(i||{})},r}(),gC=function(){function r(e){this.contexts=[],this.scope=e,Mt&&Mt.data.push(this)}var t=r.prototype;return t.add=function(i,s,n){Ti(i)||(i={matches:i});var o=new ng(0,n||this.scope),a=o.conditions={},h,l,c;Mt&&!o.selector&&(o.selector=Mt.selector),this.contexts.push(o),s=o.add("onMatch",s),o.queries=i;for(l in i)l==="all"?c=1:(h=Si.matchMedia(i[l]),h&&(ns.indexOf(o)<0&&ns.push(o),(a[l]=h.matches)&&(c=1),h.addListener?h.addListener(du):h.addEventListener("change",du)));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}(),Ya={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 Wm(s)})},timeline:function(t){return new ge(t)},getTweensOf:function(t,e){return kt.getTweensOf(t,e)},getProperty:function(t,e,i,s){ie(t)&&(t=He(t)[0]);var n=ts(t||{}).get,o=i?Cm:Sm;return i==="native"&&(i=""),t&&(e?o((Le[e]&&Le[e].get||n)(t,e,i,s)):function(a,h,l){return o((Le[a]&&Le[a].get||n)(t,a,h,l))})},quickSetter:function(t,e,i){if(t=He(t),t.length>1){var s=t.map(function(c){return Te.quickSetter(c,e,i)}),n=s.length;return function(c){for(var u=n;u--;)s[u](c)}}t=t[0]||{};var o=Le[e],a=ts(t),h=a.harness&&(a.harness.aliases||{})[e]||e,l=o?function(c){var u=new o;Js._pt=0,u.init(t,i?c+i:c,Js,0,[t]),u.render(1,u),Js._pt&&cu(1,Js)}: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=Te.to(t,es((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 kt.getTweensOf(t,!0).length>0},defaults:function(t){return t&&t.ease&&(t.ease=rs(t.ease,Hs.ease)),Em(Hs,t||{})},config:function(t){return Em(Re,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&&!Le[a]&&!Pe[a]&&Xn(e+" effect requires "+a+" plugin.")}),zc[e]=function(a,h,l){return i(He(a),Ze(h||{},n),l)},o&&(ge.prototype[e]=function(a,h,l){return this.add(zc[e](a,Ti(h)?h:(l=h)&&{},this),l)})},registerEase:function(t,e){bt[t]=rs(e)},parseEase:function(t,e){return arguments.length?rs(t,e):bt},getById:function(t){return kt.getById(t)},exportRoot:function(t,e){t===void 0&&(t={});var i=new ge(t),s,n;for(i.smoothChildTiming=_e(t.smoothChildTiming),kt.remove(i),i._dp=0,i._time=i._tTime=kt._time,s=kt._first;s;)n=s._next,(e||!(!s._dur&&s instanceof Kt&&s.vars.onComplete===s._targets[0]))&&Ci(i,s,s._start-s._delay),s=n;return Ci(kt,i,0),i},context:function(t,e){return t?new ng(t,e):Mt},matchMedia:function(t){return new gC(t)},matchMediaRefresh:function(){return ns.forEach(function(t){var e=t.conditions,i,s;for(s in e)e[s]&&(e[s]=!1,i=1);i&&t.revert()})||du()},addEventListener:function(t,e){var i=Ka[t]||(Ka[t]=[]);~i.indexOf(e)||i.push(e)},removeEventListener:function(t,e){var i=Ka[t],s=i&&i.indexOf(e);s>=0&&i.splice(s,1)},utils:{wrap:zS,wrapYoyo:jS,distribute:Fm,random:Dm,snap:Nm,normalize:YS,getUnit:de,clamp:ZS,splitColor:Zm,toArray:He,selector:tu,mapRange:Bm,pipe:HS,unitize:KS,interpolate:JS,shuffle:km},install:bm,effects:zc,ticker:ke,updateRoot:ge.updateRoot,plugins:Le,globalTimeline:kt,core:{PropTween:we,globals:xm,Tween:Kt,Timeline:ge,Animation:Jn,getCache:ts,_removeLinkedListItem:Wa,reverting:function(){return ce},context:function(t){return t&&Mt&&(Mt.data.push(t),t._ctx=Mt),Mt},suppressOverwrites:function(t){return Dc=t}}};ve("to,from,fromTo,delayedCall,set,killTweensOf",function(r){return Ya[r]=Kt[r]}),ke.add(ge.updateRoot),Js=Ya.to({},{duration:0});var yC=function(t,e){for(var i=t._pt;i&&i.p!==e&&i.op!==e&&i.fp!==e;)i=i._next;return i},bC=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=yC(o,s)),o&&o.modifier&&o.modifier(e[s],t,i[n],s))},fu=function(t,e){return{name:t,rawVars:1,init:function(s,n,o){o._onInit=function(a){var h,l;if(ie(n)&&(h={},ve(n,function(c){return h[c]=1}),n=h),e){h={};for(l in n)h[l]=e(n[l]);n=h}bC(a,n)}}}},Te=Ya.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;)ce?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)}},fu("roundProps",eu),fu("modifiers"),fu("snap",Nm))||Ya;Kt.version=ge.version=Te.version="3.12.5",ym=1,Uc()&&$s(),bt.Power0,bt.Power1,bt.Power2,bt.Power3,bt.Power4,bt.Linear,bt.Quad,bt.Cubic,bt.Quart,bt.Quint,bt.Strong,bt.Elastic,bt.Back,bt.SteppedEase,bt.Bounce,bt.Sine,bt.Expo,bt.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 og,Cr,Qs,pu,os,ag,mu,xC=function(){return typeof window<"u"},zi={},as=180/Math.PI,qs=Math.PI/180,tn=Math.atan2,hg=1e8,gu=/([A-Z])/g,_C=/(left|right|width|margin|padding|x)/i,vC=/[\s,\(]\S/,Ei={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},yu=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},wC=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)},TC=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)},SC=function(t,e){var i=e.s+e.c*t;e.set(e.t,e.p,~~(i+(i<0?-.5:.5))+e.u,e)},lg=function(t,e){return e.set(e.t,e.p,t?e.e:e.b,e)},cg=function(t,e){return e.set(e.t,e.p,t!==1?e.b:e.e,e)},CC=function(t,e,i){return t.style[e]=i},EC=function(t,e,i){return t.style.setProperty(e,i)},IC=function(t,e,i){return t._gsap[e]=i},AC=function(t,e,i){return t._gsap.scaleX=t._gsap.scaleY=i},MC=function(t,e,i,s,n){var o=t._gsap;o.scaleX=o.scaleY=i,o.renderTransform(n,o)},RC=function(t,e,i,s,n){var o=t._gsap;o[e]=i,o.renderTransform(n,o)},Ft="transform",Se=Ft+"Origin",PC=function r(t,e){var i=this,s=this.target,n=s.style,o=s._gsap;if(t in zi&&n){if(this.tfm=this.tfm||{},t!=="transform")t=Ei[t]||t,~t.indexOf(",")?t.split(",").forEach(function(a){return i.tfm[a]=ji(s,a)}):this.tfm[t]=o.x?o[t]:ji(s,t),t===Se&&(this.tfm.zOrigin=o.zOrigin);else return Ei.transform.split(",").forEach(function(a){return r.call(i,a,e)});if(this.props.indexOf(Ft)>=0)return;o.svg&&(this.svgo=s.getAttribute("data-svg-origin"),this.props.push(Se,e,"")),t=Ft}(n||e)&&this.props.push(t,e,n[t])},ug=function(t){t.translate&&(t.removeProperty("translate"),t.removeProperty("scale"),t.removeProperty("rotate"))},LC=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(gu,"-$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=mu(),(!n||!n.isStart)&&!i[Ft]&&(ug(i),s.zOrigin&&i[Se]&&(i[Se]+=" "+s.zOrigin+"px",s.zOrigin=0,s.renderTransform()),s.uncache=1)}},dg=function(t,e){var i={target:t,props:[],revert:LC,save:PC};return t._gsap||Te.core.getCache(t),e&&e.split(",").forEach(function(s){return i.save(s)}),i},fg,bu=function(t,e){var i=Cr.createElementNS?Cr.createElementNS((e||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),t):Cr.createElement(t);return i&&i.style?i:Cr.createElement(t)},Ii=function r(t,e,i){var s=getComputedStyle(t);return s[e]||s.getPropertyValue(e.replace(gu,"-$1").toLowerCase())||s.getPropertyValue(e)||!i&&r(t,en(e)||e,1)||""},pg="O,Moz,ms,Ms,Webkit".split(","),en=function(t,e,i){var s=e||os,n=s.style,o=5;if(t in n&&!i)return t;for(t=t.charAt(0).toUpperCase()+t.substr(1);o--&&!(pg[o]+t in n););return o<0?null:(o===3?"ms":o>=0?pg[o]:"")+t},xu=function(){xC()&&window.document&&(og=window,Cr=og.document,Qs=Cr.documentElement,os=bu("div")||{style:{}},bu("div"),Ft=en(Ft),Se=Ft+"Origin",os.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",fg=!!en("perspective"),mu=Te.core.reverting,pu=1)},_u=function r(t){var e=bu("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(Qs.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)),Qs.removeChild(e),this.style.cssText=n,o},mg=function(t,e){for(var i=e.length;i--;)if(t.hasAttribute(e[i]))return t.getAttribute(e[i])},gg=function(t){var e;try{e=t.getBBox()}catch{e=_u.call(t,!0)}return e&&(e.width||e.height)||t.getBBox===_u||(e=_u.call(t,!0)),e&&!e.width&&!e.x&&!e.y?{x:+mg(t,["x","cx","x1"])||0,y:+mg(t,["y","cy","y1"])||0,width:0,height:0}:e},yg=function(t){return!!(t.getCTM&&(!t.parentNode||t.ownerSVGElement)&&gg(t))},hs=function(t,e){if(e){var i=t.style,s;e in zi&&e!==Se&&(e=Ft),i.removeProperty?(s=e.substr(0,2),(s==="ms"||e.substr(0,6)==="webkit")&&(e="-"+e),i.removeProperty(s==="--"?e:e.replace(gu,"-$1").toLowerCase())):i.removeAttribute(e)}},Er=function(t,e,i,s,n,o){var a=new we(t._pt,e,i,0,1,o?cg:lg);return t._pt=a,a.b=s,a.e=n,t._props.push(i),a},bg={deg:1,rad:1,turn:1},GC={grid:1,flex:1},Ir=function r(t,e,i,s){var n=parseFloat(i)||0,o=(i+"").trim().substr((n+"").length)||"px",a=os.style,h=_C.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||bg[s]||bg[o])return n;if(o!=="px"&&!d&&(n=r(t,e,i,"px")),y=t.getCTM&&yg(t),(f||o==="%")&&(zi[e]||~e.indexOf("adius")))return p=y?t.getBBox()[h?"width":"height"]:t[c],Wt(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===Cr||!m.appendChild)&&(m=Cr.body),g=m._gsap,g&&f&&g.width&&h&&g.time===ke.time&&!g.uncache)return Wt(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:hs(t,e)}else(f||o==="%")&&!GC[Ii(m,"display")]&&(a.position=Ii(t,"position")),m===t&&(a.position="static"),m.appendChild(os),p=os[c],m.removeChild(os),a.position="absolute";return h&&f&&(g=ts(m),g.time=ke.time,g.width=m[c]),Wt(d?p*n/u:p&&n?u/p*n:0)},ji=function(t,e,i,s){var n;return pu||xu(),e in Ei&&e!=="transform"&&(e=Ei[e],~e.indexOf(",")&&(e=e.split(",")[0])),zi[e]&&e!=="transform"?(n=qn(t,s),n=e!=="transformOrigin"?n[e]:n.svg?n.origin:ja(Ii(t,Se))+" "+n.zOrigin+"px"):(n=t.style[e],(!n||n==="auto"||s||~(n+"").indexOf("calc("))&&(n=za[e]&&za[e](t,e,i)||Ii(t,e)||wm(t,e)||(e==="opacity"?1:0))),i&&!~(n+"").trim().indexOf(" ")?Ir(t,e,n,i)+i:n},kC=function(t,e,i,s){if(!i||i==="none"){var n=en(e,t,1),o=n&&Ii(t,n,1);o&&o!==i?(e=n,i=o):e==="borderColor"&&(i=Ii(t,"borderTopColor"))}var a=new we(this._pt,t.style,e,0,1,ig),h=0,l=0,c,u,d,f,p,m,g,y,x,b,_,v;if(a.b=i,a.e=s,i+="",s+="",s==="auto"&&(m=t.style[e],t.style[e]=s,s=Ii(t,e)||s,m?t.style[e]=m:hs(t,e)),c=[i,s],Km(c),i=c[0],s=c[1],d=i.match(Ks)||[],v=s.match(Ks)||[],v.length){for(;u=Ks.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,_=m.substr((f+"").length),g.charAt(1)==="="&&(g=Ys(f,g)+_),y=parseFloat(g),b=g.substr((y+"").length),h=Ks.lastIndex-b.length,b||(b=b||Re.units[e]||_,h===s.length&&(s+=b,a.e+=b)),_!==b&&(f=Ir(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"?cg:lg;return mm.test(s)&&(a.e=0),this._pt=a,a},xg={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},FC=function(t){var e=t.split(" "),i=e[0],s=e[1]||"50%";return(i==="top"||i==="bottom"||s==="left"||s==="right")&&(t=i,i=s,s=t),e[0]=xg[i]||i,e[1]=xg[s]||s,e.join(" ")},NC=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],zi[a]&&(h=1,a=a==="transformOrigin"?Se:Ft),hs(i,a);h&&(hs(i,Ft),o&&(o.svg&&i.removeAttribute("transform"),qn(i,1),o.uncache=1,ug(s)))}},za={clearProps:function(t,e,i,s,n){if(n.data!=="isFromStart"){var o=t._pt=new we(t._pt,e,i,0,0,NC);return o.u=s,o.pr=-10,o.tween=n,t._props.push(i),1}}},Qn=[1,0,0,1,0,0],_g={},vg=function(t){return t==="matrix(1, 0, 0, 1, 0, 0)"||t==="none"||!t},wg=function(t){var e=Ii(t,Ft);return vg(e)?Qn:e.substr(7).match(pm).map(Wt)},vu=function(t,e){var i=t._gsap||ts(t),s=t.style,n=wg(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"?Qn:n):(n===Qn&&!t.offsetParent&&t!==Qs&&!i.svg&&(h=s.display,s.display="block",o=t.parentNode,(!o||!t.offsetParent)&&(l=1,a=t.nextElementSibling,Qs.appendChild(t)),n=wg(t),h?s.display=h:hs(t,"display"),l&&(a?o.insertBefore(t,a):o?o.appendChild(t):Qs.removeChild(t))),e&&n.length>6?[n[0],n[1],n[4],n[5],n[12],n[13]]:n)},wu=function(t,e,i,s,n,o){var a=t._gsap,h=n||vu(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(" "),_=parseFloat(b[0])||0,v=parseFloat(b[1])||0,T,C,E,I;i?h!==Qn&&(C=f*g-p*m)&&(E=_*(g/C)+v*(-m/C)+(m*x-g*y)/C,I=_*(-p/C)+v*(f/C)-(f*x-p*y)/C,_=E,v=I):(T=gg(t),_=T.x+(~b[0].indexOf("%")?_/100*T.width:_),v=T.y+(~(b[1]||b[0]).indexOf("%")?v/100*T.height:v)),s||s!==!1&&a.smooth?(y=_-l,x=v-c,a.xOffset=u+(y*f+x*m)-y,a.yOffset=d+(y*p+x*g)-x):a.xOffset=a.yOffset=0,a.xOrigin=_,a.yOrigin=v,a.smooth=!!s,a.origin=e,a.originIsAbsolute=!!i,t.style[Se]="0px 0px",o&&(Er(o,a,"xOrigin",l,_),Er(o,a,"yOrigin",c,v),Er(o,a,"xOffset",u,a.xOffset),Er(o,a,"yOffset",d,a.yOffset)),t.setAttribute("data-svg-origin",_+" "+v)},qn=function(t,e){var i=t._gsap||new Jm(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=Ii(t,Se)||"0",c,u,d,f,p,m,g,y,x,b,_,v,T,C,E,I,k,L,P,S,R,F,O,B,Z,st,X,M,D,V,J,j;return c=u=d=m=g=y=x=b=_=0,f=p=1,i.svg=!!(t.getCTM&&yg(t)),h.translate&&((h.translate!=="none"||h.scale!=="none"||h.rotate!=="none")&&(s[Ft]=(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[Ft]!=="none"?h[Ft]:"")),s.scale=s.rotate=s.translate="none"),C=vu(t,i.svg),i.svg&&(i.uncache?(Z=t.getBBox(),l=i.xOrigin-Z.x+"px "+(i.yOrigin-Z.y)+"px",B=""):B=!e&&t.getAttribute("data-svg-origin"),wu(t,B||l,!!B||i.originIsAbsolute,i.smooth!==!1,C)),v=i.xOrigin||0,T=i.yOrigin||0,C!==Qn&&(L=C[0],P=C[1],S=C[2],R=C[3],c=F=C[4],u=O=C[5],C.length===6?(f=Math.sqrt(L*L+P*P),p=Math.sqrt(R*R+S*S),m=L||P?tn(P,L)*as:0,x=S||R?tn(S,R)*as+m:0,x&&(p*=Math.abs(Math.cos(x*qs))),i.svg&&(c-=v-(v*L+T*S),u-=T-(v*P+T*R))):(j=C[6],V=C[7],X=C[8],M=C[9],D=C[10],J=C[11],c=C[12],u=C[13],d=C[14],E=tn(j,D),g=E*as,E&&(I=Math.cos(-E),k=Math.sin(-E),B=F*I+X*k,Z=O*I+M*k,st=j*I+D*k,X=F*-k+X*I,M=O*-k+M*I,D=j*-k+D*I,J=V*-k+J*I,F=B,O=Z,j=st),E=tn(-S,D),y=E*as,E&&(I=Math.cos(-E),k=Math.sin(-E),B=L*I-X*k,Z=P*I-M*k,st=S*I-D*k,J=R*k+J*I,L=B,P=Z,S=st),E=tn(P,L),m=E*as,E&&(I=Math.cos(E),k=Math.sin(E),B=L*I+P*k,Z=F*I+O*k,P=P*I-L*k,O=O*I-F*k,L=B,F=Z),g&&Math.abs(g)+Math.abs(m)>359.9&&(g=m=0,y=180-y),f=Wt(Math.sqrt(L*L+P*P+S*S)),p=Wt(Math.sqrt(O*O+j*j)),E=tn(F,O),x=Math.abs(E)>2e-4?E*as:0,_=J?1/(J<0?-J:J):0),i.svg&&(B=t.getAttribute("transform"),i.forceCSS=t.setAttribute("transform","")||!vg(Ii(t,Ft)),B&&t.setAttribute("transform",B))),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=Wt(f),i.scaleY=Wt(p),i.rotation=Wt(m)+a,i.rotationX=Wt(g)+a,i.rotationY=Wt(y)+a,i.skewX=x+a,i.skewY=b+a,i.transformPerspective=_+o,(i.zOrigin=parseFloat(l.split(" ")[2])||!e&&i.zOrigin||0)&&(s[Se]=ja(l)),i.xOffset=i.yOffset=0,i.force3D=Re.force3D,i.renderTransform=i.svg?OC:fg?Tg:DC,i.uncache=0,i},ja=function(t){return(t=t.split(" "))[0]+" "+t[1]},Tu=function(t,e,i){var s=de(e);return Wt(parseFloat(e)+parseFloat(Ir(t,"x",i+"px",s)))+s},DC=function(t,e){e.z="0px",e.rotationY=e.rotationX="0deg",e.force3D=0,Tg(t,e)},ls="0deg",to="0px",cs=") ",Tg=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=y==="auto"&&t&&t!==1||y===!0;if(b&&(u!==ls||c!==ls)){var T=parseFloat(c)*qs,C=Math.sin(T),E=Math.cos(T),I;T=parseFloat(u)*qs,I=Math.cos(T),o=Tu(x,o,C*I*-b),a=Tu(x,a,-Math.sin(T)*-b),h=Tu(x,h,E*I*-b+b)}g!==to&&(_+="perspective("+g+cs),(s||n)&&(_+="translate("+s+"%, "+n+"%) "),(v||o!==to||a!==to||h!==to)&&(_+=h!==to||v?"translate3d("+o+", "+a+", "+h+") ":"translate("+o+", "+a+cs),l!==ls&&(_+="rotate("+l+cs),c!==ls&&(_+="rotateY("+c+cs),u!==ls&&(_+="rotateX("+u+cs),(d!==ls||f!==ls)&&(_+="skew("+d+", "+f+cs),(p!==1||m!==1)&&(_+="scale("+p+", "+m+cs),x.style[Ft]=_||"translate(0, 0)"},OC=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),_=parseFloat(a),v,T,C,E,I;h=parseFloat(h),l=parseFloat(l),c=parseFloat(c),c&&(c=parseFloat(c),l+=c,h+=c),h||l?(h*=qs,l*=qs,v=Math.cos(h)*u,T=Math.sin(h)*u,C=Math.sin(h-l)*-d,E=Math.cos(h-l)*d,l&&(c*=qs,I=Math.tan(l-c),I=Math.sqrt(1+I*I),C*=I,E*=I,c&&(I=Math.tan(c),I=Math.sqrt(1+I*I),v*=I,T*=I)),v=Wt(v),T=Wt(T),C=Wt(C),E=Wt(E)):(v=u,E=d,T=C=0),(b&&!~(o+"").indexOf("px")||_&&!~(a+"").indexOf("px"))&&(b=Ir(f,"x",o,"px"),_=Ir(f,"y",a,"px")),(p||m||g||y)&&(b=Wt(b+p-(p*v+m*C)+g),_=Wt(_+m-(p*T+m*E)+y)),(s||n)&&(I=f.getBBox(),b=Wt(b+s/100*I.width),_=Wt(_+n/100*I.height)),I="matrix("+v+","+T+","+C+","+E+","+b+","+_+")",f.setAttribute("transform",I),x&&(f.style[Ft]=I)},UC=function(t,e,i,s,n){var o=360,a=ie(n),h=parseFloat(n)*(a&&~n.indexOf("rad")?as: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*hg)%o-~~(l/o)*o:u==="ccw"&&l>0&&(l=(l-o*hg)%o-~~(l/o)*o)),t._pt=d=new we(t._pt,e,i,s,l,wC),d.e=c,d.u="deg",t._props.push(i),d},Sg=function(t,e){for(var i in e)t[i]=e[i];return t},BC=function(t,e,i){var s=Sg({},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[Ft]=e,a=qn(i,1),hs(i,Ft),i.setAttribute("transform",l)):(l=getComputedStyle(i)[Ft],o[Ft]=e,a=qn(i,1),o[Ft]=l);for(h in zi)l=s[h],c=a[h],l!==c&&n.indexOf(h)<0&&(f=de(l),p=de(c),u=f!==p?Ir(i,h,l,p):parseFloat(l),d=parseFloat(c),t._pt=new we(t._pt,a,h,u,d-u,yu),t._pt.u=p||0,t._props.push(h));Sg(a,s)};ve("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});za[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 ji(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 Cg={name:"css",register:xu,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,T,C,E;pu||xu(),this.styles=this.styles||dg(t),E=this.styles.props,this.tween=i;for(m in e)if(m!=="autoRound"&&(c=e[m],!(Le[m]&&$m(m,e,i,s,t,n)))){if(f=typeof c,p=za[m],f==="function"&&(c=c.call(i,s,t,n),f=typeof c),f==="string"&&~c.indexOf("random(")&&(c=Kn(c)),p)p(this,t,m,c,i)&&(C=1);else if(m.substr(0,2)==="--")l=(getComputedStyle(t).getPropertyValue(m)+"").trim(),c+="",Tr.lastIndex=0,Tr.test(l)||(g=de(l),y=de(c)),y?g!==y&&(l=Ir(t,m,l,y)+y):g&&(c+=g),this.add(a,"setProperty",l,c,s,n,0,0,m),o.push(m),E.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],ie(l)&&~l.indexOf("random(")&&(l=Kn(l)),de(l+"")||l==="auto"||(l+=Re.units[m]||de(ji(t,m))||""),(l+"").charAt(1)==="="&&(l=ji(t,m))):l=ji(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 Ei&&(m==="autoAlpha"&&(d===1&&ji(t,"visibility")==="hidden"&&u&&(d=0),E.push("visibility",0,a.visibility),Er(this,a,"visibility",d?"inherit":"hidden",u?"inherit":"hidden",!u)),m!=="scale"&&m!=="transform"&&(m=Ei[m],~m.indexOf(",")&&(m=m.split(",")[0]))),b=m in zi,b){if(this.styles.save(m),_||(v=t._gsap,v.renderTransform&&!e.parseTransform||qn(t,e.parseTransform),T=e.smoothOrigin!==!1&&v.smooth,_=this._pt=new we(this._pt,a,Ft,0,1,v.renderTransform,v,0,-1),_.dep=1),m==="scale")this._pt=new we(this._pt,v,"scaleY",v.scaleY,(x?Ys(v.scaleY,x+u):u)-v.scaleY||0,yu),this._pt.u=0,o.push("scaleY",m),m+="X";else if(m==="transformOrigin"){E.push(Se,0,a[Se]),c=FC(c),v.svg?wu(t,c,0,T,0,this):(y=parseFloat(c.split(" ")[2])||0,y!==v.zOrigin&&Er(this,v,"zOrigin",v.zOrigin,y),Er(this,a,m,ja(l),ja(c)));continue}else if(m==="svgOrigin"){wu(t,c,1,T,0,this);continue}else if(m in _g){UC(this,v,m,d,x?Ys(d,x+c):c);continue}else if(m==="smoothOrigin"){Er(this,v,"smooth",v.smooth,c);continue}else if(m==="force3D"){v[m]=c;continue}else if(m==="transform"){BC(this,c,t);continue}}else m in a||(m=en(m)||m);if(b||(u||u===0)&&(d||d===0)&&!vC.test(c)&&m in a)g=(l+"").substr((d+"").length),u||(u=0),y=de(c)||(m in Re.units?Re.units[m]:g),g!==y&&(d=Ir(t,m,l,y)),this._pt=new we(this._pt,b?v:a,m,d,(x?Ys(d,x+u):u)-d,!b&&(y==="px"||m==="zIndex")&&e.autoRound!==!1?SC:yu),this._pt.u=y||0,g!==y&&y!=="%"&&(this._pt.b=l,this._pt.r=TC);else if(m in a)kC.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"){Hc(m,c);continue}b||(m in a?E.push(m,0,a[m]):E.push(m,1,l||t[m])),o.push(m)}}C&&rg(this)},render:function(t,e){if(e.tween._time||!mu())for(var i=e._pt;i;)i.r(t,i.d),i=i._next;else e.styles.revert()},get:ji,aliases:Ei,getSetter:function(t,e,i){var s=Ei[e];return s&&s.indexOf(",")<0&&(e=s),e in zi&&e!==Se&&(t._gsap.x||ji(t,"x"))?i&&ag===i?e==="scale"?AC:IC:(ag=i||{})&&(e==="scale"?MC:RC):t.style&&!Uc(t.style[e])?CC:~e.indexOf("-")?EC:lu(t,e)},core:{_removeProperty:hs,_getMatrix:vu}};Te.utils.checkPrefix=en,Te.core.getStyleSaver=dg,function(r,t,e,i){var s=ve(r+","+t+","+e,function(n){zi[n]=1});ve(t,function(n){Re.units[n]="deg",_g[n]=1}),Ei[s[13]]=r+","+t,ve(i,function(n){var o=n.split(":");Ei[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"),ve("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(r){Re.units[r]="px"}),Te.registerPlugin(Cg);var Eg=Te.registerPlugin(Cg)||Te;Eg.core.Tween;function Ig(r,t){return typeof r=="function"?r(t):r&&typeof r=="object"&&lm in r?r[lm](t):r instanceof Date?new r.constructor(t):new Date(t)}function Su(r,t){return Ig(r,r)}function XC(r,t,e){return Ig(r,+Su(r)+t)}function WC(r,t,e){return XC(r,t*1e3)}function ZC(r){return t=>{const e=Math.trunc,i=e(t);return i===0?0:i}}function Ag(r,t){return+Su(r)-+Su(t)}function VC(r,t,e){const i=Ag(r,t)/1e3;return ZC()(i)}const HC=r=>({rowGap:24,columnGap:32,textDefault:r==="dark"?"#ffffff":"#161618",textInverse:r==="dark"?"#161618":"#ffffff",selectedBorderColor:r==="dark"?"#3fa2c3":"#297f9c",selectedBorderWidth:2,selectedBorderOffset:4,selectedBorderRadius:9,nodesPadding:16,nodeHeight:32,nodePadding:4,nodeRadius:6,nodeBorderRadius:9,nodeToggleSize:28,nodeToggleBgColor:"#35363C",nodeToggleBorderRadius:6,nodeToggleBorderColor:r==="dark"?"#4d4f56":"#bbbec9",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:r==="dark"?"#adadad":"#737682",guideLineWidth:1,guideLineColor:r==="dark"?"#4d4f56":"#bbbec9",guideTextTopPadding:8,guideTextLeftPadding:8,guideTextSize:12,guideTextColor:r==="dark"?"#adadad":"#737682",playheadWidth:2,playheadColor:"#6272FF",node:()=>({background:"#ffffff"}),state:()=>({background:"#ffffff"})});let us=null;async function KC(){const r=await Me();us=Mg(r),K.emit("stylesCreated",us),K.on("configUpdated",t=>{us=Mg(t),K.emit("stylesUpdated",us)})}function YC(){us=null}async function Ut(){return us||await be("stylesCreated")}function Mg(r){var t;return{...HC(r.theme),...(t=r.styles)==null?void 0:t.call(r,r.theme)}}function zC(r){let t=0;for(const[,{children:e}]of r)t+=e.length;return t}function jC({start_time:r,end_time:t,nodes:e},i,s){const n=Math.max(VC(t??new Date,r),1),o=i.nodeHeight+i.rowGap;return(e.size>0?e.size*o*.5:o*4)*s/(n*kh)}async function JC(){const r=await Ri(),t=await Me(),e=await Ut(),i=await Ht(),s=i.view.width/i.view.height,n=jC(r,e,s);Eu(n,!0),r.nodes.size>t.disableAnimationsThreshold&&(et.disableAnimations=!0),zC(r.nodes)>t.disableEdgesThreshold&&(et.disableEdges=!0)}function $C(){et.horizontal="temporal",et.vertical="nearest-parent",et.horizontalScaleMultiplierDefault=0,et.horizontalScaleMultiplier=0,et.disableAnimations=!1,et.disableGuides=!1,et.disableEdges=!1,et.disableArtifacts=!1,et.disableEvents=!1}const et={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 Yt(){return Iu()?et:await be("layoutSettingsCreated")}function Cu(){return et.isDependency()?Ld:kh*et.horizontalScaleMultiplier}function QC(){return[0,Cu()]}function qC(r){if(et.isDependency())return[0,1];const t=r,e=WC(t,Pd);return[t,e]}function Eu(r,t=!1){if(et.horizontalScaleMultiplier===r)return;const e=rn();et.horizontalScaleMultiplier=r,t&&(et.horizontalScaleMultiplierDefault=r),e()}function tE(){Eu(et.horizontalScaleMultiplierDefault)}function eE(r){if(et.horizontal===r)return;const t=rn();et.horizontal=r,et.disableGuides=et.isDependency()||et.isLeftAligned(),t()}function iE(r){if(et.vertical===r)return;const t=rn();et.vertical=r,t()}function rE(r){if(et.disableEdges===r)return;const t=rn();et.disableEdges=r,t()}function sE(r){if(et.disableArtifacts===r)return;const t=rn();et.disableArtifacts=r,t()}function nE(r){if(et.disableEvents===r)return;const t=rn();et.disableEvents=r,t()}function rn(){const r=Iu()?"layoutSettingsUpdated":"layoutSettingsCreated",{horizontal:t,vertical:e}=et;return()=>{Iu()&&K.emit(r,et),(t!==et.horizontal||e!==et.vertical)&&K.emit("layoutUpdated")}}function Iu(){return et.horizontalScaleMultiplier!==0}async function Rg(){const r=await Yt(),t=await Me();function e(i,s,n){const a=r.disableAnimations||n?0:t.animationDuration/1e3;return Eg.to(i,{...s,duration:a,ease:"power1.out",onUpdate:()=>{go()}})}return{animate:e}}async function oE({size:r,stroke:t=1,radius:e=0}){const i=await Ht(),s=new mr;return s.lineStyle(t,"#fff",1,0),s.drawRoundedRect(0,0,r*2,r*2,e),i.renderer.generateTexture(s,{region:new ct(0,0,r,r),resolution:10})}async function eo(r){return await Un(oE,[r])}var Ja=(r=>(r[r.Up=0]="Up",r[r.Down=180]="Down",r[r.Left=270]="Left",r[r.Right=90]="Right",r))(Ja||{});function Pg(){const r=new Vt;async function t(e){const{rotate:i=0}=e,s={size:e.size,radius:e.radius,stroke:e.stroke},n=await eo(s);return r.texture=n,r.anchor.set(.5,.5),r.angle=45+i,r}return{element:r,render:t}}async function aE(){const r=await Ht(),t=new mr;return t.beginFill("#fff"),t.drawRect(0,0,1,1),t.endFill(),r.renderer.generateTexture(t,{wrapMode:ui.REPEAT})}async function Au(){return await Un(aE,[])}function Mu(r,t){return Array.from({length:r},(e,i)=>t(i))}const hE=8,lE=2;async function cE(){const r=await Ut(),t=await r1(),e=await KM(),{animate:i}=await Rg(),s=new yt,{element:n,render:o}=await Pg(),a=await Au(),h=Mu(Dh,()=>new at),l=new sT(a,h);let c=!1;s.name=Rd,s.addChild(n),s.addChild(l),t.addAll([n,l]),e.add(s);async function u(){return await o({size:10,rotate:Ja.Right}),n.tint=r.edgeColor,l.tint=r.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:_}=g[y];i(x,{x:b,y:_},!c)}i(s,{x:p.x,y:p.y},!c),i(n,{x:m.x-hE,y:m.y},!c),c=!0}function f({x:p,y:m}){const g=[],y={x:0,y:0},x={x:p-lE,y:m},b={x:Lg(y.x,{source:y,target:x}),y:y.y},_={x:Lg(x.x,{source:y,target:x},!0),y:x.y};for(const[v]of h.entries()){if(v===h.length-1){g[v]=x;continue}const T=uE(v,{source:y,target:x,sourceBezier:b,targetBezier:_});g[v]=T}return g}return{element:s,render:u,setPosition:d}}function Lg(r,{source:t,target:e},i){const s=(e.x-t.x)/2;return r+(s>Oh?s:Oh)*(i?-1:1)}function uE(r,t){const e=r/Dh,{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 dE({height:r,radius:t}){const e=await Ht(),i=new mr;return i.beginFill("#fff"),i.drawRoundedRect(0,0,t*2,r,t),i.endFill(),e.renderer.generateTexture(i,{region:new ct(0,0,t,r),resolution:Fh})}async function fE(r){return await Un(dE,[r])}function pE(){const r=new Vt,t=new Vt;async function e(i){const s=await fE(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 Ji(){const r=await Au();return new Vt(r)}async function Ru(){const r=new yt,t=await Ji(),{left:e,right:i,render:s}=await pE();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 $a(){const r=new yt,t=new Vt,e=new Vt,i=new Vt,s=new Vt,n=new Vt,o=new Vt,a=new Vt,h=new Vt;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,_=typeof m=="number",v={topLeft:c(_?m:m[0],x,b),topRight:c(_?m:m[1],x,b),bottomLeft:c(_?m:m[2],x,b),bottomRight:c(_?m:m[3],x,b)};return await u({width:x,height:b,stroke:y,cornerSizes:v}),await d({width:x,height:b,stroke:y,cornerSizes:v}),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:_,bottomRight:v}=y,[T,C,E,I]=await Promise.all([eo({...x,stroke:g}),eo({...b,stroke:g}),eo({..._,stroke:g}),eo({...v,stroke:g})]);t.texture=T,e.texture=C,i.texture=I,s.texture=E,t.position.set(0,0),e.position.set(p-b.size,0),i.position.set(0,m-_.size),s.position.set(p-v.size,m-v.size)}async function d({width:p,height:m,stroke:g,cornerSizes:y}){const x=await Au(),{topLeft:b,topRight:_,bottomLeft:v,bottomRight:T}=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-v.size,0),n.width=g,o.position.set(p-g,_.size),o.height=Math.max(m-_.size-T.size,0),o.width=g,a.position.set(b.size,0),a.width=Math.max(p-b.size-_.size,0),a.height=g,h.position.set(v.size,m-g),h.width=Math.max(p-v.size-T.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 Qa(){const r=await Ut(),t=new yt,{element:e,render:i}=await $a();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;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 mE(){const r=await Ut(),t=new yt,{element:e,render:i}=await Ru(),{element:s,render:n}=await Qa();t.addChild(e),t.addChild(s);async function o({selected:a,width:h,height:l}){const{artifactBgColor:c,artifactBorderRadius:u}=r,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}}var gE=Object.defineProperty,yE=(r,t,e)=>t in r?gE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,io=(r,t,e)=>(yE(r,typeof t!="symbol"?t+"":t,e),e);class bE extends yt{constructor(t){super(),io(this,"_progress",0),io(this,"options"),io(this,"bgCircle",new mr),io(this,"fillCircle",new mr),io(this,"innerView",new yt),this.options=t,this.addChild(this.innerView),this.innerView.addChild(this.bgCircle,this.fillCircle),this.addBackground(),t.value&&(this.progress=t.value)}addBackground(){const{backgroundColor:t,lineWidth:e,radius:i,backgroundAlpha:s}=this.options;let n=1;s>0&&(n=s),t===void 0&&(n=1e-6),this.bgCircle.lineStyle({width:e,color:t,alpha:n}).drawCircle(0,0,i)}set progress(t){t>100&&(t=100),t<0&&(t=0),this._progress=t;const{lineWidth:e,radius:i,fillColor:s,fillAlpha:n,cap:o}=this.options;if(t===0&&n===0){this.fillCircle.clear();return}const a=0,h=360/100*t;this.fillCircle.clear().lineStyle({width:e,color:s,cap:o,alpha:n}).arc(0,0,i,(-90+a)*Vl,(-90+a+h)*Vl)}get progress(){return this._progress}}async function xE(r={}){const t=await n1(),e=new bE({fillColor:16777215,cullAtZoomThreshold:!0,backgroundColor:0,backgroundAlpha:1,value:50,cap:"round",fillAlpha:1,lineWidth:20,radius:50,...r});r.cullAtZoomThreshold&&t.add(e);function i(s){e.progress=s.value??0;const n=(s.radius+s.lineWidth)*2;return e.width=n,e.height=n,e.position.set(n/2),e}return{element:e,render:i}}const _E=Object.freeze(Object.defineProperty({__proto__:null,Artifact:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_7_19)'%3e%3cmask%20id='mask0_7_19'%20style='mask-type:luminance'%20maskUnits='userSpaceOnUse'%20x='-1'%20y='-1'%20width='22'%20height='22'%3e%3cpath%20d='M20.9091%20-0.909058H-0.909088V20.9091H20.9091V-0.909058Z'%20fill='white'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_7_19)'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M0%2010C0%204.47715%204.47715%200%2010%200C15.5228%200%2020%204.47715%2020%2010C20%2015.5228%2015.5228%2020%2010%2020C4.47715%2020%200%2015.5228%200%2010ZM10%201.81818C5.4813%201.81818%201.81818%205.4813%201.81818%2010C1.81818%2014.5187%205.48131%2018.1818%2010%2018.1818C14.5187%2018.1818%2018.1818%2014.5187%2018.1818%2010C18.1818%205.48131%2014.5187%201.81818%2010%201.81818Z'%20fill='white'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M5.68182%205.63634C5.68182%205.15937%206.06849%204.77271%206.54546%204.77271H13.4546C13.9316%204.77271%2014.3182%205.15937%2014.3182%205.63634V14.2512C14.3182%2014.8932%2013.6426%2015.3108%2013.0683%2015.0237L11.8182%2014.3986L10.3863%2015.1146C10.1431%2015.2362%209.85691%2015.2362%209.61373%2015.1146L8.18182%2014.3986L6.93169%2015.0237C6.35746%2015.3108%205.68182%2014.8932%205.68182%2014.2512V5.63634ZM7.04546%206.13634V13.4423L7.7956%2013.0672C8.03873%2012.9456%208.32491%2012.9456%208.5681%2013.0672L10%2013.7832L11.4319%2013.0672C11.6751%2012.9456%2011.9613%2012.9456%2012.2045%2013.0672L12.9546%2013.4423V6.13634H7.04546Z'%20fill='white'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M6.36365%208.63631C6.36365%208.38531%206.56716%208.18176%206.81819%208.18176H6.98566C7.23669%208.18176%207.4402%208.38531%207.4402%208.63631C7.4402%208.88731%207.23669%209.09085%206.98566%209.09085H6.81819C6.56716%209.09085%206.36365%208.88731%206.36365%208.63631ZM7.78709%208.63631C7.78709%208.38531%207.9906%208.18176%208.24165%208.18176H8.57656C8.82765%208.18176%209.0311%208.38531%209.0311%208.63631C9.0311%208.88731%208.82765%209.09085%208.57656%209.09085H8.24165C7.9906%209.09085%207.78709%208.88731%207.78709%208.63631ZM9.37801%208.63631C9.37801%208.38531%209.58147%208.18176%209.83256%208.18176H10.1675C10.4186%208.18176%2010.622%208.38531%2010.622%208.63631C10.622%208.88731%2010.4186%209.09085%2010.1675%209.09085H9.83256C9.58147%209.09085%209.37801%208.88731%209.37801%208.63631ZM10.9689%208.63631C10.9689%208.38531%2011.1724%208.18176%2011.4235%208.18176H11.7584C12.0095%208.18176%2012.2129%208.38531%2012.2129%208.63631C12.2129%208.88731%2012.0095%209.09085%2011.7584%209.09085H11.4235C11.1724%209.09085%2010.9689%208.88731%2010.9689%208.63631ZM12.5598%208.63631C12.5598%208.38531%2012.7633%208.18176%2013.0144%208.18176H13.1818C13.4328%208.18176%2013.6364%208.38531%2013.6364%208.63631C13.6364%208.88731%2013.4328%209.09085%2013.1818%209.09085H13.0144C12.7633%209.09085%2012.5598%208.88731%2012.5598%208.63631Z'%20fill='white'/%3e%3c/g%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_7_19'%3e%3crect%20width='20'%20height='20'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",ArtifactImage:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_7_36)'%3e%3cmask%20id='mask0_7_36'%20style='mask-type:luminance'%20maskUnits='userSpaceOnUse'%20x='-1'%20y='-1'%20width='22'%20height='22'%3e%3cpath%20d='M20.9091%20-0.909058H-0.909088V20.9091H20.9091V-0.909058Z'%20fill='white'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_7_36)'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M0%2010C0%204.47715%204.47715%200%2010%200C15.5228%200%2020%204.47715%2020%2010C20%2015.5228%2015.5228%2020%2010%2020C4.47715%2020%200%2015.5228%200%2010ZM10%201.81818C5.4813%201.81818%201.81818%205.4813%201.81818%2010C1.81818%2014.5187%205.48131%2018.1818%2010%2018.1818C14.5187%2018.1818%2018.1818%2014.5187%2018.1818%2010C18.1818%205.48131%2014.5187%201.81818%2010%201.81818Z'%20fill='white'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M11.4718%2010.0244C11.2567%209.97354%2011.0304%2010.0028%2010.8353%2010.1067L2.29995%2014.6522C1.8568%2014.8882%201.68886%2015.4387%201.92486%2015.8818C2.16086%2016.325%202.71143%2016.4929%203.15458%2016.2569L11.3872%2011.8727L17.9726%2013.4302C18.4612%2013.5457%2018.951%2013.2433%2019.0665%2012.7546C19.1821%2012.2661%2018.8796%2011.7764%2018.3911%2011.6607L11.4718%2010.0244Z'%20fill='white'/%3e%3cpath%20d='M6.07329%209.09092C5.32016%209.09092%204.70966%208.48037%204.70966%207.72728C4.70966%206.97417%205.32016%206.36365%206.07329%206.36365C6.82643%206.36365%207.43693%206.97417%207.43693%207.72728C7.43693%208.48037%206.82643%209.09092%206.07329%209.09092Z'%20fill='white'/%3e%3c/g%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_7_36'%3e%3crect%20width='20'%20height='20'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",ArtifactMarkdown:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_7_27)'%3e%3cmask%20id='mask0_7_27'%20style='mask-type:luminance'%20maskUnits='userSpaceOnUse'%20x='-1'%20y='-1'%20width='22'%20height='22'%3e%3cpath%20d='M20.9091%20-0.909058H-0.909088V20.9091H20.9091V-0.909058Z'%20fill='white'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_7_27)'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M0%2010C0%204.47715%204.47715%200%2010%200C15.5228%200%2020%204.47715%2020%2010C20%2015.5228%2015.5228%2020%2010%2020C4.47715%2020%200%2015.5228%200%2010ZM10%201.81818C5.4813%201.81818%201.81818%205.4813%201.81818%2010C1.81818%2014.5187%205.48131%2018.1818%2010%2018.1818C14.5187%2018.1818%2018.1818%2014.5187%2018.1818%2010C18.1818%205.48131%2014.5187%201.81818%2010%201.81818Z'%20fill='white'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M6.36365%2010C6.36365%209.49794%206.77067%209.09094%207.27274%209.09094H12.7273C13.2294%209.09094%2013.6364%209.49794%2013.6364%2010C13.6364%2010.5021%2013.2294%2010.9091%2012.7273%2010.9091H7.27274C6.77067%2010.9091%206.36365%2010.5021%206.36365%2010Z'%20fill='white'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M6.36365%2013.6364C6.36365%2013.1343%206.77067%2012.7273%207.27274%2012.7273H9.09092C9.59301%2012.7273%2010%2013.1343%2010%2013.6364C10%2014.1385%209.59301%2014.5455%209.09092%2014.5455H7.27274C6.77067%2014.5455%206.36365%2014.1385%206.36365%2013.6364Z'%20fill='white'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M6.36365%206.36368C6.36365%205.86161%206.77067%205.45459%207.27274%205.45459H11.8182C12.3203%205.45459%2012.7273%205.86161%2012.7273%206.36368C12.7273%206.86575%2012.3203%207.27277%2011.8182%207.27277H7.27274C6.77067%207.27277%206.36365%206.86575%206.36365%206.36368Z'%20fill='white'/%3e%3c/g%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_7_27'%3e%3crect%20width='20'%20height='20'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",ArtifactProgress:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_7_2)'%3e%3cmask%20id='mask0_7_2'%20style='mask-type:luminance'%20maskUnits='userSpaceOnUse'%20x='-1'%20y='-1'%20width='22'%20height='22'%3e%3cpath%20d='M20.9091%20-0.909058H-0.909088V20.9091H20.9091V-0.909058Z'%20fill='white'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_7_2)'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M8.04937%200.190318C8.681%200.0653727%209.33327%200%2010%200C10.6667%200%2011.319%200.0653727%2011.9506%200.190318L11.5978%201.97394C11.0817%201.87185%2010.5475%201.81818%2010%201.81818C9.45245%201.81818%208.91827%201.87185%208.40218%201.97394L8.04937%200.190318ZM15.5568%201.68489C16.6469%202.41471%2017.5853%203.35308%2018.3151%204.4432L16.8043%205.45469C16.2066%204.56206%2015.4379%203.79335%2014.5453%203.19574L15.5568%201.68489ZM1.68489%204.4432C2.41471%203.35308%203.35308%202.41471%204.4432%201.68489L5.45469%203.19574C4.56206%203.79335%203.79335%204.56206%203.19574%205.45469L1.68489%204.4432ZM19.8096%208.04937C19.9346%208.681%2020%209.33327%2020%2010C20%2010.6667%2019.9346%2011.319%2019.8096%2011.9506L18.0261%2011.5978C18.1282%2011.0817%2018.1818%2010.5475%2018.1818%2010C18.1818%209.45245%2018.1282%208.91827%2018.0261%208.40218L19.8096%208.04937ZM0%2010C0%209.33327%200.0653727%208.681%200.190318%208.04937L1.97394%208.40218C1.87185%208.91827%201.81818%209.45245%201.81818%2010C1.81818%2010.5475%201.87185%2011.0817%201.97394%2011.5978L0.190318%2011.9506C0.0653727%2011.319%200%2010.6667%200%2010ZM18.3151%2015.5568C17.5853%2016.6469%2016.6469%2017.5853%2015.5568%2018.3151L14.5453%2016.8043C15.4379%2016.2066%2016.2066%2015.4379%2016.8043%2014.5453L18.3151%2015.5568ZM4.4432%2018.3151C3.35308%2017.5853%202.41471%2016.6469%201.68489%2015.5568L3.19574%2014.5453C3.79335%2015.4379%204.56206%2016.2066%205.45469%2016.8043L4.4432%2018.3151ZM10%2020C9.33327%2020%208.681%2019.9346%208.04937%2019.8096L8.40218%2018.0261C8.91827%2018.1282%209.45245%2018.1818%2010%2018.1818C10.5475%2018.1818%2011.0817%2018.1282%2011.5978%2018.0261L11.9506%2019.8096C11.319%2019.9346%2010.6667%2020%2010%2020Z'%20fill='white'/%3e%3cpath%20d='M10%2011.8181C8.99582%2011.8181%208.18182%2011.0041%208.18182%209.99994C8.18182%208.99576%208.99582%208.18176%2010%208.18176C11.0042%208.18176%2011.8182%208.99576%2011.8182%209.99994C11.8182%2011.0041%2011.0042%2011.8181%2010%2011.8181Z'%20fill='white'/%3e%3c/g%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_7_2'%3e%3crect%20width='20'%20height='20'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",ArtifactResult:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_7_19)'%3e%3cmask%20id='mask0_7_19'%20style='mask-type:luminance'%20maskUnits='userSpaceOnUse'%20x='-1'%20y='-1'%20width='22'%20height='22'%3e%3cpath%20d='M20.9091%20-0.909058H-0.909088V20.9091H20.9091V-0.909058Z'%20fill='white'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_7_19)'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M0%2010C0%204.47715%204.47715%200%2010%200C15.5228%200%2020%204.47715%2020%2010C20%2015.5228%2015.5228%2020%2010%2020C4.47715%2020%200%2015.5228%200%2010ZM10%201.81818C5.4813%201.81818%201.81818%205.4813%201.81818%2010C1.81818%2014.5187%205.48131%2018.1818%2010%2018.1818C14.5187%2018.1818%2018.1818%2014.5187%2018.1818%2010C18.1818%205.48131%2014.5187%201.81818%2010%201.81818Z'%20fill='white'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M5.68182%205.63634C5.68182%205.15937%206.06849%204.77271%206.54546%204.77271H13.4546C13.9316%204.77271%2014.3182%205.15937%2014.3182%205.63634V14.2512C14.3182%2014.8932%2013.6426%2015.3108%2013.0683%2015.0237L11.8182%2014.3986L10.3863%2015.1146C10.1431%2015.2362%209.85691%2015.2362%209.61373%2015.1146L8.18182%2014.3986L6.93169%2015.0237C6.35746%2015.3108%205.68182%2014.8932%205.68182%2014.2512V5.63634ZM7.04546%206.13634V13.4423L7.7956%2013.0672C8.03873%2012.9456%208.32491%2012.9456%208.5681%2013.0672L10%2013.7832L11.4319%2013.0672C11.6751%2012.9456%2011.9613%2012.9456%2012.2045%2013.0672L12.9546%2013.4423V6.13634H7.04546Z'%20fill='white'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M6.36365%208.63631C6.36365%208.38531%206.56716%208.18176%206.81819%208.18176H6.98566C7.23669%208.18176%207.4402%208.38531%207.4402%208.63631C7.4402%208.88731%207.23669%209.09085%206.98566%209.09085H6.81819C6.56716%209.09085%206.36365%208.88731%206.36365%208.63631ZM7.78709%208.63631C7.78709%208.38531%207.9906%208.18176%208.24165%208.18176H8.57656C8.82765%208.18176%209.0311%208.38531%209.0311%208.63631C9.0311%208.88731%208.82765%209.09085%208.57656%209.09085H8.24165C7.9906%209.09085%207.78709%208.88731%207.78709%208.63631ZM9.37801%208.63631C9.37801%208.38531%209.58147%208.18176%209.83256%208.18176H10.1675C10.4186%208.18176%2010.622%208.38531%2010.622%208.63631C10.622%208.88731%2010.4186%209.09085%2010.1675%209.09085H9.83256C9.58147%209.09085%209.37801%208.88731%209.37801%208.63631ZM10.9689%208.63631C10.9689%208.38531%2011.1724%208.18176%2011.4235%208.18176H11.7584C12.0095%208.18176%2012.2129%208.38531%2012.2129%208.63631C12.2129%208.88731%2012.0095%209.09085%2011.7584%209.09085H11.4235C11.1724%209.09085%2010.9689%208.88731%2010.9689%208.63631ZM12.5598%208.63631C12.5598%208.38531%2012.7633%208.18176%2013.0144%208.18176H13.1818C13.4328%208.18176%2013.6364%208.38531%2013.6364%208.63631C13.6364%208.88731%2013.4328%209.09085%2013.1818%209.09085H13.0144C12.7633%209.09085%2012.5598%208.88731%2012.5598%208.63631Z'%20fill='white'/%3e%3c/g%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_7_19'%3e%3crect%20width='20'%20height='20'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",ArtifactTable:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_7_9)'%3e%3cmask%20id='mask0_7_9'%20style='mask-type:luminance'%20maskUnits='userSpaceOnUse'%20x='-1'%20y='-1'%20width='22'%20height='22'%3e%3cpath%20d='M20.9091%20-0.909058H-0.909088V20.9091H20.9091V-0.909058Z'%20fill='white'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_7_9)'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M0%2010C0%204.47715%204.47715%200%2010%200C15.5228%200%2020%204.47715%2020%2010C20%2015.5228%2015.5228%2020%2010%2020C4.47715%2020%200%2015.5228%200%2010ZM10%201.81818C5.4813%201.81818%201.81818%205.4813%201.81818%2010C1.81818%2014.5187%205.48131%2018.1818%2010%2018.1818C14.5187%2018.1818%2018.1818%2014.5187%2018.1818%2010C18.1818%205.48131%2014.5187%201.81818%2010%201.81818Z'%20fill='white'/%3e%3cpath%20d='M8.18183%205.45459H6.36365C5.86157%205.45459%205.45456%205.8616%205.45456%206.36368V8.18186C5.45456%208.68394%205.86157%209.09095%206.36365%209.09095H8.18183C8.68391%209.09095%209.09092%208.68394%209.09092%208.18186V6.36368C9.09092%205.8616%208.68391%205.45459%208.18183%205.45459Z'%20fill='white'/%3e%3cpath%20d='M13.6364%205.45459H11.8182C11.3161%205.45459%2010.9091%205.8616%2010.9091%206.36368V8.18186C10.9091%208.68394%2011.3161%209.09095%2011.8182%209.09095H13.6364C14.1384%209.09095%2014.5455%208.68394%2014.5455%208.18186V6.36368C14.5455%205.8616%2014.1384%205.45459%2013.6364%205.45459Z'%20fill='white'/%3e%3cpath%20d='M13.6364%2010.9091H11.8182C11.3161%2010.9091%2010.9091%2011.3161%2010.9091%2011.8181V13.6363C10.9091%2014.1384%2011.3161%2014.5454%2011.8182%2014.5454H13.6364C14.1384%2014.5454%2014.5455%2014.1384%2014.5455%2013.6363V11.8181C14.5455%2011.3161%2014.1384%2010.9091%2013.6364%2010.9091Z'%20fill='white'/%3e%3cpath%20d='M8.18183%2010.9091H6.36365C5.86157%2010.9091%205.45456%2011.3161%205.45456%2011.8181V13.6363C5.45456%2014.1384%205.86157%2014.5454%206.36365%2014.5454H8.18183C8.68391%2014.5454%209.09092%2014.1384%209.09092%2013.6363V11.8181C9.09092%2011.3161%208.68391%2010.9091%208.18183%2010.9091Z'%20fill='white'/%3e%3c/g%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_7_9'%3e%3crect%20width='20'%20height='20'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e"},Symbol.toStringTag,{value:"Module"}));function vE(r){const t={resolution:Nh};return rt.from(_E[r],t)}async function wE(r){return await Un(vE,[r])}async function TE({cullAtZoomThreshold:r=!0}={}){const t=await n1(),e=new Vt;r&&t.add(e);async function i(s){const n=await wE(s);return e.texture=n,e}return{element:e,render:i}}var Gg={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,_=g||3e3,v=new Date().getTime();return new Promise(function(T,C){if(f(y.context)&&!d(y.context)){var E=new Promise(function(k,L){function P(){new Date().getTime()-v>=_?L(Error(""+_+"ms timeout exceeded")):y.context.document.fonts.load(p(y,'"'+y.family+'"'),x).then(function(S){1<=S.length?k():setTimeout(P,25)},L)}P()}),I=new Promise(function(k,L){b=setTimeout(function(){L(Error(""+_+"ms timeout exceeded"))},_)});Promise.race([I,E]).then(function(){clearTimeout(b),T(y)},C)}else e(function(){function k(){var D;(D=F!=-1&&O!=-1||F!=-1&&B!=-1||O!=-1&&B!=-1)&&((D=F!=O&&F!=B&&O!=B)||(h===null&&(D=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),h=!!D&&(536>parseInt(D[1],10)||parseInt(D[1],10)===536&&11>=parseInt(D[2],10))),D=h&&(F==Z&&O==Z&&B==Z||F==st&&O==st&&B==st||F==X&&O==X&&B==X)),D=!D),D&&(M.parentNode!==null&&M.parentNode.removeChild(M),clearTimeout(b),T(y))}function L(){if(new Date().getTime()-v>=_)M.parentNode!==null&&M.parentNode.removeChild(M),C(Error(""+_+"ms timeout exceeded"));else{var D=y.context.document.hidden;(D===!0||D===void 0)&&(F=P.g.offsetWidth,O=S.g.offsetWidth,B=R.g.offsetWidth,k()),b=setTimeout(L,50)}}var P=new i(x),S=new i(x),R=new i(x),F=-1,O=-1,B=-1,Z=-1,st=-1,X=-1,M=document.createElement("div");M.dir="ltr",s(P,p(y,"sans-serif")),s(S,p(y,"serif")),s(R,p(y,"monospace")),M.appendChild(P.g),M.appendChild(S.g),M.appendChild(R.g),y.context.document.body.appendChild(M),Z=P.g.offsetWidth,st=S.g.offsetWidth,X=R.g.offsetWidth,L(),o(P,function(D){F=D,k()}),s(P,p(y,'"'+y.family+'",sans-serif')),o(S,function(D){O=D,k()}),s(S,p(y,'"'+y.family+'",serif')),o(R,function(D){B=D,k()}),s(R,p(y,'"'+y.family+'",monospace'))})})},r.exports=a})()})(Gg);var SE=Gg.exports;const CE=xn(SE),kg={inter:{fontFamily:"Inter Variable",fontSize:16,lineHeight:20,fill:16777215}},Fg={resolution:Nh,chars:ni.ASCII},Ng="sans-serif",Dg={inter:ME(kg.inter)};let Pu=!1;async function EE(){const r=Object.values(kg);await Promise.all(r.map(t=>IE(t))),Pu=!0,K.emit("fontsLoaded",Dg)}async function IE(r){const{fontFamily:t,...e}=r,i=new CE(t);try{await i.load()}catch(s){console.error(s),console.warn(`fonts: font ${t} failed to load, falling back to ${Ng}`),ni.from(t,{fontFamily:Ng,...e},Fg);return}ni.from(t,r,Fg)}function AE(){Pu=!1}async function Og(){return Pu?Dg:await be("fontsLoaded")}function ME(r){const{fontFamily:t,...e}=r,i={fontName:t,...e};return s=>new LT(s,i)}async function qa({cullAtZoomThreshold:r=!0}={}){const{inter:t}=await Og(),e=await s1(),i=t("");r&&e.add(i);async function s(n){return i.text=n,await i}return{element:i,render:s}}async function Ug({cullAtZoomThreshold:r}){const t=await Ut(),e=new yt,i=new yt,{element:s,render:n}=await TE({cullAtZoomThreshold:r}),{element:o,render:a}=await xE(),{element:h,render:l}=await qa({cullAtZoomThreshold:r}),{element:c,render:u}=await mE();let d=!1,f=null,p;i.addChild(h),e.addChild(c),e.addChild(i);async function m(_){const{selected:v,name:T,type:C}=_;return d=v??d,f=T??f,p=C,p==="progress"?i.addChild(o):i.addChild(s),_.type==="progress"?await Promise.all([y(_.data),x()]):await Promise.all([g(),x()]),await b(),e}async function g(){if(p==="progress")return s;const _=Gr[p],{artifactIconSize:v,artifactIconColor:T,artifactPaddingLeft:C,artifactPaddingY:E}=t,I=await n(_);return I.position={x:C,y:E},I.width=v,I.height=v,I.tint=T,I}async function y(_){const{artifactPaddingLeft:v,artifactPaddingRight:T,artifactPaddingY:C,artifactIconSize:E}=t,I=20,k=(E-I*2)/2,L=a({value:_,radius:k,lineWidth:I});return f?L.position.x+=v:L.position.x+=(v+T)/2,L.position.y+=C,o}async function x(){if(!f)return h.visible=!1,h;await l(f);const{artifactPaddingLeft:_,artifactPaddingY:v,artifactTextColor:T,artifactIconSize:C,artifactContentGap:E}=t,I=f?E:0,k=_+C+I,L=v;return h.tint=T,h.scale.set(.75),h.position={x:k,y:L},h.visible=!0,h}async function b(){const{artifactPaddingLeft:_,artifactPaddingRight:v,artifactPaddingY:T}=t,C={selected:d,width:i.width+_+v,height:i.height+T*2};return await u(C)}return{element:e,render:m}}let Nt=null,th=!1;async function RE(){const r=await zt();r.on("click",()=>Ai(null)),r.on("drag-start",()=>{th=!0}),r.on("drag-end",()=>{setTimeout(()=>{th=!1})})}function PE(){Nt=null,th=!1}function Ai(r){if(!th&&!(!r&&!Nt||r&&$i(r))){if(Nt=r,r===null){K.emit("itemSelected",null);return}K.emit("itemSelected",r)}}function $i(r){if(Nt===null)return!1;const{kind:t}=r;switch(t){case"task-run":return Io(Nt)&&Nt.id===r.id;case"flow-run":return Io(Nt)&&Nt.id===r.id;case"artifact":return Sd(Nt)&&Nt.id===r.id;case"artifacts":return Cd(Nt)&&Nt.ids.length===r.ids.length&&Nt.ids.every(i=>r.ids.includes(i));case"state":return Ed(Nt)&&Nt.id===r.id;case"event":return Id(Nt)&&Nt.id===r.id;case"events":return Ad(Nt)&&Nt.ids.length===r.ids.length&&Nt.ids.every(i=>r.ids.includes(i));default:const e=t;throw new Error(`switch does not have case for value: ${e}`)}}function LE(){return Nt&&Io(Nt)?Nt:null}async function Lu(r,{cullAtZoomThreshold:t=!0,enableLocalClickHandling:e=!1}={}){const{element:i,render:s}=await Ug({cullAtZoomThreshold:t});let n=!1,o=r;i.eventMode="static",i.cursor="pointer",e&&i.on("click",u=>{u.stopPropagation(),Ai({kind:"artifact",id:o.id})}),K.on("itemSelected",()=>{const u=$i({kind:"artifact",id:o.id});u!==n&&(n=u,a(o))});async function a(u){o=u,await s({selected:n,name:o.key,...o})}function h(){return n}function l(){return o.created}function c(){return o.id}return{isArtifact:!0,element:i,render:a,getSelected:h,getDate:l,getId:c}}function Bg(r){return r.isArtifact===!0}function GE(r){return typeof r=="function"}function eh(r){return GE(r)?r():r}async function Xg(r,t){const e=await Ri(),i=await Me();let s,n=null;async function o(){try{n=await i.fetchEvents(eh(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 Wg(){const r=await Ut(),t=await s1(),e=new yt,{element:i,render:s}=await Pg(),{element:n,render:o}=await Ru(),{element:a,render:h}=await $a();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?Ja.Up:Ja.Down},g=await s(m),y={width:r.nodeToggleSize,height:r.nodeToggleSize,background:r.nodeToggleBgColor,radius:r.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.nodeToggleBorderColor});b.alpha=f?0:1;const _={y:x.height/2,x:x.width/2},v=m.size/4;return g.x=_.x,g.y=p?_.y+v:_.y-v,e}function u(){n.alpha=l?.5:1}function d(){n.alpha=l?0:.5}return{element:e,render:c}}async function Zg(){const r=await Ut(),t=await Yt(),e=new yt,{element:i,render:s}=await Ru(),{element:n,render:o}=await Qa();e.addChild(i),e.addChild(n);async function a(l){const{background:c="#fff"}=r.node(l),{nodeHeight:u,nodeRadius:d}=r,f=$i({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=Cu();if(et.isTemporal()||et.isLeftAligned()){const d=l.start_time,f=l.end_time??new Date,m=Ag(f,d)/Fa*u;return Math.max(m,c*2)}return u}return{element:e,render:a}}var Vg="Expected a function",Hg=NaN,kE="[object Symbol]",FE=/^\s+|\s+$/g,NE=/^[-+]0x[0-9a-f]+$/i,DE=/^0b[01]+$/i,OE=/^0o[0-7]+$/i,UE=parseInt,BE=typeof $e=="object"&&$e&&$e.Object===Object&&$e,XE=typeof self=="object"&&self&&self.Object===Object&&self,WE=BE||XE||Function("return this")(),ZE=Object.prototype,VE=ZE.toString,HE=Math.max,KE=Math.min,Gu=function(){return WE.Date.now()};function YE(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(Vg);t=Kg(t)||0,ih(e)&&(c=!!e.leading,u="maxWait"in e,n=u?HE(Kg(e.maxWait)||0,t):n,d="trailing"in e?!!e.trailing:d);function f(T){var C=i,E=s;return i=s=void 0,l=T,o=r.apply(E,C),o}function p(T){return l=T,a=setTimeout(y,t),c?f(T):o}function m(T){var C=T-h,E=T-l,I=t-C;return u?KE(I,n-E):I}function g(T){var C=T-h,E=T-l;return h===void 0||C>=t||C<0||u&&E>=n}function y(){var T=Gu();if(g(T))return x(T);a=setTimeout(y,m(T))}function x(T){return a=void 0,d&&i?f(T):(i=s=void 0,o)}function b(){a!==void 0&&clearTimeout(a),l=0,i=h=s=a=void 0}function _(){return a===void 0?o:x(Gu())}function v(){var T=Gu(),C=g(T);if(i=arguments,s=this,h=T,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 v.cancel=b,v.flush=_,v}function zE(r,t,e){var i=!0,s=!0;if(typeof r!="function")throw new TypeError(Vg);return ih(e)&&(i="leading"in e?!!e.leading:i,s="trailing"in e?!!e.trailing:s),YE(r,t,{leading:i,maxWait:t,trailing:s})}function ih(r){var t=typeof r;return!!r&&(t=="object"||t=="function")}function jE(r){return!!r&&typeof r=="object"}function JE(r){return typeof r=="symbol"||jE(r)&&VE.call(r)==kE}function Kg(r){if(typeof r=="number")return r;if(JE(r))return Hg;if(ih(r)){var t=typeof r.valueOf=="function"?r.valueOf():r;r=ih(t)?t+"":t}if(typeof r!="string")return r===0?r:+r;r=r.replace(FE,"");var e=DE.test(r);return e||OE.test(r)?UE(r.slice(2),e?2:8):NE.test(r)?Hg:+r}var $E=zE;const Yg=xn($E);async function zg(){const{element:r,render:t}=await Ug({cullAtZoomThreshold:!1});let e=null,i=[],s=!1;r.eventMode="static",r.cursor="pointer",K.on("itemSelected",()=>{const l=$i({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{isArtifactCluster:!0,element:r,render:n,getSelected:o,getDate:a,getIds:h,isCluster:!0}}async function QE({radius:r}){const t=await Ht(),e=new mr;return e.beginFill("#fff"),e.drawCircle(0,0,r),e.endFill(),t.renderer.generateTexture(e,{resolution:Fh})}async function qE(r){return await Un(QE,[r])}async function jg(r){const t=await qE(r);return new Vt(t)}async function Jg(r){const t=new yt,e=await Ut(),i=await Ji(),s=await jg({radius:e.eventRadiusDefault}),{element:n,render:o}=await Qa();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)}),K.on("itemSelected",()=>{const u=$i({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;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 $g(){const r=new yt,t=await Ut(),e=await Ji(),i=await jg({radius:t.eventClusterRadiusDefault}),{element:s,render:n}=await Qa(),{element:o,render:a}=await qa({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)}),K.on("itemSelected",()=>{const x=$i({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:_}=x;h=_,l=b,d(),f(),m(),await p(b.length.toString()),r.visible=!0}function d(){const{eventTargetSize:x}=t;e.alpha=0,e.width=x,e.height=x}function f(){const{eventClusterColor:x,eventTargetSize:b}=t;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,_=-1;o.scale.set(.6),o.anchor.set(.5),o.position.set(b/2,b/2+_),await a(x)}function m(){const{eventSelectedBorderInset:x,eventTargetSize:b}=t;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 rh(r,t){return r==null||t==null?NaN:r<t?-1:r>t?1:r>=t?0:NaN}function tI(r,t){return r==null||t==null?NaN:t<r?-1:t>r?1:t>=r?0:NaN}function ku(r){let t,e,i;r.length!==2?(t=rh,e=(a,h)=>rh(r(a),h),i=(a,h)=>r(a)-h):(t=r===rh||r===tI?r:eI,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 eI(){return 0}function iI(r){return r===null?NaN:+r}const rI=ku(rh).right;ku(iI).center;const sI=Math.sqrt(50),nI=Math.sqrt(10),oI=Math.sqrt(2);function sh(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>=sI?10:n>=nI?5:n>=oI?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?sh(r,t,e*2):[a,h,l]}function aI(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?sh(t,r,e):sh(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 Fu(r,t,e){return t=+t,r=+r,e=+e,sh(r,t,e)[2]}function Nu(r,t,e){t=+t,r=+r,e=+e;const i=t<r,s=i?Fu(t,r,e):Fu(r,t,e);return(i?-1:1)*(s<0?1/-s:s)}function Du(r,t,e){r.prototype=t.prototype=e,e.constructor=r}function Qg(r,t){var e=Object.create(r.prototype);for(var i in t)e[i]=t[i];return e}function ro(){}var so=.7,nh=1/so,sn="\\s*([+-]?\\d+)\\s*",no="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Mi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",hI=/^#([0-9a-f]{3,8})$/,lI=new RegExp(`^rgb\\(${sn},${sn},${sn}\\)$`),cI=new RegExp(`^rgb\\(${Mi},${Mi},${Mi}\\)$`),uI=new RegExp(`^rgba\\(${sn},${sn},${sn},${no}\\)$`),dI=new RegExp(`^rgba\\(${Mi},${Mi},${Mi},${no}\\)$`),fI=new RegExp(`^hsl\\(${no},${Mi},${Mi}\\)$`),pI=new RegExp(`^hsla\\(${no},${Mi},${Mi},${no}\\)$`),qg={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};Du(ro,oo,{copy(r){return Object.assign(new this.constructor,this,r)},displayable(){return this.rgb().displayable()},hex:ty,formatHex:ty,formatHex8:mI,formatHsl:gI,formatRgb:ey,toString:ey});function ty(){return this.rgb().formatHex()}function mI(){return this.rgb().formatHex8()}function gI(){return oy(this).formatHsl()}function ey(){return this.rgb().formatRgb()}function oo(r){var t,e;return r=(r+"").trim().toLowerCase(),(t=hI.exec(r))?(e=t[1].length,t=parseInt(t[1],16),e===6?iy(t):e===3?new Ce(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):e===8?oh(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):e===4?oh(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=lI.exec(r))?new Ce(t[1],t[2],t[3],1):(t=cI.exec(r))?new Ce(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=uI.exec(r))?oh(t[1],t[2],t[3],t[4]):(t=dI.exec(r))?oh(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=fI.exec(r))?ny(t[1],t[2]/100,t[3]/100,1):(t=pI.exec(r))?ny(t[1],t[2]/100,t[3]/100,t[4]):qg.hasOwnProperty(r)?iy(qg[r]):r==="transparent"?new Ce(NaN,NaN,NaN,0):null}function iy(r){return new Ce(r>>16&255,r>>8&255,r&255,1)}function oh(r,t,e,i){return i<=0&&(r=t=e=NaN),new Ce(r,t,e,i)}function yI(r){return r instanceof ro||(r=oo(r)),r?(r=r.rgb(),new Ce(r.r,r.g,r.b,r.opacity)):new Ce}function Ou(r,t,e,i){return arguments.length===1?yI(r):new Ce(r,t,e,i??1)}function Ce(r,t,e,i){this.r=+r,this.g=+t,this.b=+e,this.opacity=+i}Du(Ce,Ou,Qg(ro,{brighter(r){return r=r==null?nh:Math.pow(nh,r),new Ce(this.r*r,this.g*r,this.b*r,this.opacity)},darker(r){return r=r==null?so:Math.pow(so,r),new Ce(this.r*r,this.g*r,this.b*r,this.opacity)},rgb(){return this},clamp(){return new Ce(ds(this.r),ds(this.g),ds(this.b),ah(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:bI,formatRgb:sy,toString:sy}));function ry(){return`#${fs(this.r)}${fs(this.g)}${fs(this.b)}`}function bI(){return`#${fs(this.r)}${fs(this.g)}${fs(this.b)}${fs((isNaN(this.opacity)?1:this.opacity)*255)}`}function sy(){const r=ah(this.opacity);return`${r===1?"rgb(":"rgba("}${ds(this.r)}, ${ds(this.g)}, ${ds(this.b)}${r===1?")":`, ${r})`}`}function ah(r){return isNaN(r)?1:Math.max(0,Math.min(1,r))}function ds(r){return Math.max(0,Math.min(255,Math.round(r)||0))}function fs(r){return r=ds(r),(r<16?"0":"")+r.toString(16)}function ny(r,t,e,i){return i<=0?r=t=e=NaN:e<=0||e>=1?r=t=NaN:t<=0&&(r=NaN),new oi(r,t,e,i)}function oy(r){if(r instanceof oi)return new oi(r.h,r.s,r.l,r.opacity);if(r instanceof ro||(r=oo(r)),!r)return new oi;if(r instanceof oi)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 oi(o,a,h,r.opacity)}function xI(r,t,e,i){return arguments.length===1?oy(r):new oi(r,t,e,i??1)}function oi(r,t,e,i){this.h=+r,this.s=+t,this.l=+e,this.opacity=+i}Du(oi,xI,Qg(ro,{brighter(r){return r=r==null?nh:Math.pow(nh,r),new oi(this.h,this.s,this.l*r,this.opacity)},darker(r){return r=r==null?so:Math.pow(so,r),new oi(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 Ce(Uu(r>=240?r-240:r+120,s,i),Uu(r,s,i),Uu(r<120?r+240:r-120,s,i),this.opacity)},clamp(){return new oi(ay(this.h),hh(this.s),hh(this.l),ah(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=ah(this.opacity);return`${r===1?"hsl(":"hsla("}${ay(this.h)}, ${hh(this.s)*100}%, ${hh(this.l)*100}%${r===1?")":`, ${r})`}`}}));function ay(r){return r=(r||0)%360,r<0?r+360:r}function hh(r){return Math.max(0,Math.min(1,r||0))}function Uu(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 Bu=r=>()=>r;function _I(r,t){return function(e){return r+e*t}}function vI(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 wI(r){return(r=+r)==1?hy:function(t,e){return e-t?vI(t,e,r):Bu(isNaN(t)?e:t)}}function hy(r,t){var e=t-r;return e?_I(r,e):Bu(isNaN(r)?t:r)}const ly=function r(t){var e=wI(t);function i(s,n){var o=e((s=Ou(s)).r,(n=Ou(n)).r),a=e(s.g,n.g),h=e(s.b,n.b),l=hy(s.opacity,n.opacity);return function(c){return s.r=o(c),s.g=a(c),s.b=h(c),s.opacity=l(c),s+""}}return i.gamma=r,i}(1);function TI(r,t){t||(t=[]);var e=r?Math.min(t.length,r.length):0,i=t.slice(),s;return function(n){for(s=0;s<e;++s)i[s]=r[s]*(1-n)+t[s]*n;return i}}function SI(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function CI(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]=Zu(r[o],t[o]);for(;o<e;++o)n[o]=t[o];return function(a){for(o=0;o<i;++o)n[o]=s[o](a);return n}}function EI(r,t){var e=new Date;return r=+r,t=+t,function(i){return e.setTime(r*(1-i)+t*i),e}}function lh(r,t){return r=+r,t=+t,function(e){return r*(1-e)+t*e}}function II(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]=Zu(r[s],t[s]):i[s]=t[s];return function(n){for(s in e)i[s]=e[s](n);return i}}var Xu=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Wu=new RegExp(Xu.source,"g");function AI(r){return function(){return r}}function MI(r){return function(t){return r(t)+""}}function RI(r,t){var e=Xu.lastIndex=Wu.lastIndex=0,i,s,n,o=-1,a=[],h=[];for(r=r+"",t=t+"";(i=Xu.exec(r))&&(s=Wu.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:lh(i,s)})),e=Wu.lastIndex;return e<t.length&&(n=t.slice(e),a[o]?a[o]+=n:a[++o]=n),a.length<2?h[0]?MI(h[0].x):AI(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 Zu(r,t){var e=typeof t,i;return t==null||e==="boolean"?Bu(t):(e==="number"?lh:e==="string"?(i=oo(t))?(t=i,ly):RI:t instanceof oo?ly:t instanceof Date?EI:SI(t)?TI:Array.isArray(t)?CI:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?II:lh)(r,t)}function PI(r,t){return r=+r,t=+t,function(e){return Math.round(r*(1-e)+t*e)}}function LI(r){return Math.abs(r=Math.round(r))>=1e21?r.toLocaleString("en").replace(/,/g,""):r.toString(10)}function ch(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 nn(r){return r=ch(Math.abs(r)),r?r[1]:NaN}function GI(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 kI(r){return function(t){return t.replace(/[0-9]/g,function(e){return r[+e]})}}var FI=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function uh(r){if(!(t=FI.exec(r)))throw new Error("invalid format: "+r);var t;return new Vu({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]})}uh.prototype=Vu.prototype;function Vu(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+""}Vu.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function NI(r){t:for(var t=r.length,e=1,i=-1,s;e<t;++e)switch(r[e]){case".":i=s=e;break;case"0":i===0&&(i=e),s=e;break;default:if(!+r[e])break t;i>0&&(i=0);break}return i>0?r.slice(0,i)+r.slice(s+1):r}var cy;function DI(r,t){var e=ch(r,t);if(!e)return r+"";var i=e[0],s=e[1],n=s-(cy=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")+ch(r,Math.max(0,t+n-1))[0]}function uy(r,t){var e=ch(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 dy={"%":(r,t)=>(r*100).toFixed(t),b:r=>Math.round(r).toString(2),c:r=>r+"",d:LI,e:(r,t)=>r.toExponential(t),f:(r,t)=>r.toFixed(t),g:(r,t)=>r.toPrecision(t),o:r=>Math.round(r).toString(8),p:(r,t)=>uy(r*100,t),r:uy,s:DI,X:r=>Math.round(r).toString(16).toUpperCase(),x:r=>Math.round(r).toString(16)};function fy(r){return r}var py=Array.prototype.map,my=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function OI(r){var t=r.grouping===void 0||r.thousands===void 0?fy:GI(py.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?fy:kI(py.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=uh(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,_=u.trim,v=u.type;v==="n"?(x=!0,v="g"):dy[v]||(b===void 0&&(b=12),_=!0,v="g"),(g||d==="0"&&f==="=")&&(g=!0,d="0",f="=");var T=m==="$"?e:m==="#"&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",C=m==="$"?i:/[%p]/.test(v)?o:"",E=dy[v],I=/[defgprs%]/.test(v);b=b===void 0?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b));function k(L){var P=T,S=C,R,F,O;if(v==="c")S=E(L)+S,L="";else{L=+L;var B=L<0||1/L<0;if(L=isNaN(L)?h:E(Math.abs(L),b),_&&(L=NI(L)),B&&+L==0&&p!=="+"&&(B=!1),P=(B?p==="("?p:a:p==="-"||p==="("?"":p)+P,S=(v==="s"?my[8+cy/3]:"")+S+(B&&p==="("?")":""),I){for(R=-1,F=L.length;++R<F;)if(O=L.charCodeAt(R),48>O||O>57){S=(O===46?s+L.slice(R+1):L.slice(R))+S,L=L.slice(0,R);break}}}x&&!g&&(L=t(L,1/0));var Z=P.length+L.length+S.length,st=Z<y?new Array(y-Z+1).join(d):"";switch(x&&g&&(L=t(st+L,st.length?y-S.length:1/0),st=""),f){case"<":L=P+L+S+st;break;case"=":L=P+st+L+S;break;case"^":L=st.slice(0,Z=st.length>>1)+P+L+S+st.slice(Z);break;default:L=st+P+L+S;break}return n(L)}return k.toString=function(){return u+""},k}function c(u,d){var f=l((u=uh(u),u.type="f",u)),p=Math.max(-8,Math.min(8,Math.floor(nn(d)/3)))*3,m=Math.pow(10,-p),g=my[8+p/3];return function(y){return f(m*y)+g}}return{format:l,formatPrefix:c}}var dh,gy,yy;UI({thousands:",",grouping:[3],currency:["$",""]});function UI(r){return dh=OI(r),gy=dh.format,yy=dh.formatPrefix,dh}function BI(r){return Math.max(0,-nn(Math.abs(r)))}function XI(r,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(nn(t)/3)))*3-nn(Math.abs(r)))}function WI(r,t){return r=Math.abs(r),t=Math.abs(t)-r,Math.max(0,nn(t)-nn(r))+1}function by(r,t){switch(arguments.length){case 0:break;case 1:this.range(r);break;default:this.range(t).domain(r);break}return this}function ZI(r){return function(){return r}}function VI(r){return+r}var xy=[0,1];function on(r){return r}function Hu(r,t){return(t-=r=+r)?function(e){return(e-r)/t}:ZI(isNaN(t)?NaN:.5)}function HI(r,t){var e;return r>t&&(e=r,r=t,t=e),function(i){return Math.max(r,Math.min(t,i))}}function KI(r,t,e){var i=r[0],s=r[1],n=t[0],o=t[1];return s<i?(i=Hu(s,i),n=e(o,n)):(i=Hu(i,s),n=e(n,o)),function(a){return n(i(a))}}function YI(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]=Hu(r[o],r[o+1]),n[o]=e(t[o],t[o+1]);return function(a){var h=rI(r,a,1,i)-1;return n[h](s[h](a))}}function _y(r,t){return t.domain(r.domain()).range(r.range()).interpolate(r.interpolate()).clamp(r.clamp()).unknown(r.unknown())}function zI(){var r=xy,t=xy,e=Zu,i,s,n,o=on,a,h,l;function c(){var d=Math.min(r.length,t.length);return o!==on&&(o=HI(r[0],r[d-1])),a=d>2?YI:KI,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),lh)))(d)))},u.domain=function(d){return arguments.length?(r=Array.from(d,VI),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=PI,c()},u.clamp=function(d){return arguments.length?(o=d?!0:on,c()):o!==on},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 vy(){return zI()(on,on)}function jI(r,t,e,i){var s=Nu(r,t,e),n;switch(i=uh(i??",f"),i.type){case"s":{var o=Math.max(Math.abs(r),Math.abs(t));return i.precision==null&&!isNaN(n=XI(s,o))&&(i.precision=n),yy(i,o)}case"":case"e":case"g":case"p":case"r":{i.precision==null&&!isNaN(n=WI(s,Math.max(Math.abs(r),Math.abs(t))))&&(i.precision=n-(i.type==="e"));break}case"f":case"%":{i.precision==null&&!isNaN(n=BI(s))&&(i.precision=n-(i.type==="%")*2);break}}return gy(i)}function JI(r){var t=r.domain;return r.ticks=function(e){var i=t();return aI(i[0],i[i.length-1],e??10)},r.tickFormat=function(e,i){var s=t();return jI(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=Fu(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 wy(){var r=vy();return r.copy=function(){return _y(r,wy())},by.apply(r,arguments),JI(r)}function $I(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 Ku=new Date,Yu=new Date;function $t(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=>$t(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)=>(Ku.setTime(+n),Yu.setTime(+o),r(Ku),r(Yu),Math.floor(e(Ku,Yu))),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 fh=$t(()=>{},(r,t)=>{r.setTime(+r+t)},(r,t)=>t-r);fh.every=r=>(r=Math.floor(r),!isFinite(r)||!(r>0)?null:r>1?$t(t=>{t.setTime(Math.floor(t/r)*r)},(t,e)=>{t.setTime(+t+e*r)},(t,e)=>(e-t)/r):fh),fh.range;const Qi=1e3,Ke=Qi*60,qi=Ke*60,tr=qi*24,zu=tr*7,Ty=tr*30,ju=tr*365,an=$t(r=>{r.setTime(r-r.getMilliseconds())},(r,t)=>{r.setTime(+r+t*Qi)},(r,t)=>(t-r)/Qi,r=>r.getUTCSeconds());an.range;const Ju=$t(r=>{r.setTime(r-r.getMilliseconds()-r.getSeconds()*Qi)},(r,t)=>{r.setTime(+r+t*Ke)},(r,t)=>(t-r)/Ke,r=>r.getMinutes());Ju.range,$t(r=>{r.setUTCSeconds(0,0)},(r,t)=>{r.setTime(+r+t*Ke)},(r,t)=>(t-r)/Ke,r=>r.getUTCMinutes()).range;const $u=$t(r=>{r.setTime(r-r.getMilliseconds()-r.getSeconds()*Qi-r.getMinutes()*Ke)},(r,t)=>{r.setTime(+r+t*qi)},(r,t)=>(t-r)/qi,r=>r.getHours());$u.range,$t(r=>{r.setUTCMinutes(0,0,0)},(r,t)=>{r.setTime(+r+t*qi)},(r,t)=>(t-r)/qi,r=>r.getUTCHours()).range;const ao=$t(r=>r.setHours(0,0,0,0),(r,t)=>r.setDate(r.getDate()+t),(r,t)=>(t-r-(t.getTimezoneOffset()-r.getTimezoneOffset())*Ke)/tr,r=>r.getDate()-1);ao.range;const Qu=$t(r=>{r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCDate(r.getUTCDate()+t)},(r,t)=>(t-r)/tr,r=>r.getUTCDate()-1);Qu.range,$t(r=>{r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCDate(r.getUTCDate()+t)},(r,t)=>(t-r)/tr,r=>Math.floor(r/tr)).range;function ps(r){return $t(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())*Ke)/zu)}const ph=ps(0),mh=ps(1),QI=ps(2),qI=ps(3),hn=ps(4),tA=ps(5),eA=ps(6);ph.range,mh.range,QI.range,qI.range,hn.range,tA.range,eA.range;function ms(r){return $t(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)/zu)}const Sy=ms(0),gh=ms(1),iA=ms(2),rA=ms(3),ln=ms(4),sA=ms(5),nA=ms(6);Sy.range,gh.range,iA.range,rA.range,ln.range,sA.range,nA.range;const qu=$t(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());qu.range,$t(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 er=$t(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());er.every=r=>!isFinite(r=Math.floor(r))||!(r>0)?null:$t(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)}),er.range;const gs=$t(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());gs.every=r=>!isFinite(r=Math.floor(r))||!(r>0)?null:$t(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)}),gs.range;function oA(r,t,e,i,s,n){const o=[[an,1,Qi],[an,5,5*Qi],[an,15,15*Qi],[an,30,30*Qi],[n,1,Ke],[n,5,5*Ke],[n,15,15*Ke],[n,30,30*Ke],[s,1,qi],[s,3,3*qi],[s,6,6*qi],[s,12,12*qi],[i,1,tr],[i,2,2*tr],[e,1,zu],[t,1,Ty],[t,3,3*Ty],[r,1,ju]];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=ku(([,,g])=>g).right(o,d);if(f===o.length)return r.every(Nu(l/ju,c/ju,u));if(f===0)return fh.every(Math.max(Nu(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[aA,hA]=oA(er,qu,ph,ao,$u,Ju);function td(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 ed(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 ho(r,t,e){return{y:r,m:t,d:e,H:0,M:0,S:0,L:0}}function lA(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=lo(s),c=co(s),u=lo(n),d=co(n),f=lo(o),p=co(o),m=lo(a),g=co(a),y=lo(h),x=co(h),b={a:B,A:Z,b:st,B:X,c:null,d:Ry,e:Ry,f:LA,g:WA,G:VA,H:MA,I:RA,j:PA,L:Py,m:GA,M:kA,p:M,q:D,Q:Dy,s:Oy,S:FA,u:NA,U:DA,V:OA,w:UA,W:BA,x:null,X:null,y:XA,Y:ZA,Z:HA,"%":Ny},_={a:V,A:J,b:j,B:mt,c:null,d:Gy,e:Gy,f:jA,g:nM,G:aM,H:KA,I:YA,j:zA,L:ky,m:JA,M:$A,p:Tt,q:bt,Q:Dy,s:Oy,S:QA,u:qA,U:tM,V:eM,w:iM,W:rM,x:null,X:null,y:sM,Y:oM,Z:hM,"%":Ny},v={a:k,A:L,b:P,B:S,c:R,d:Ay,e:Ay,f:CA,g:Iy,G:Ey,H:My,I:My,j:vA,L:SA,m:_A,M:wA,p:I,q:xA,Q:IA,s:AA,S:TA,u:pA,U:mA,V:gA,w:fA,W:yA,x:F,X:O,y:Iy,Y:Ey,Z:bA,"%":EA};b.x=T(e,b),b.X=T(i,b),b.c=T(t,b),_.x=T(e,_),_.X=T(i,_),_.c=T(t,_);function T(N,Y){return function(H){var G=[],ut=-1,ht=0,wt=N.length,Rt,Fe,Gi;for(H instanceof Date||(H=new Date(+H));++ut<wt;)N.charCodeAt(ut)===37&&(G.push(N.slice(ht,ut)),(Fe=Cy[Rt=N.charAt(++ut)])!=null?Rt=N.charAt(++ut):Fe=Rt==="e"?" ":"0",(Gi=Y[Rt])&&(Rt=Gi(H,Fe)),G.push(Rt),ht=ut+1);return G.push(N.slice(ht,ut)),G.join("")}}function C(N,Y){return function(H){var G=ho(1900,void 0,1),ut=E(G,N,H+="",0),ht,wt;if(ut!=H.length)return null;if("Q"in G)return new Date(G.Q);if("s"in G)return new Date(G.s*1e3+("L"in G?G.L:0));if(Y&&!("Z"in G)&&(G.Z=0),"p"in G&&(G.H=G.H%12+G.p*12),G.m===void 0&&(G.m="q"in G?G.q:0),"V"in G){if(G.V<1||G.V>53)return null;"w"in G||(G.w=1),"Z"in G?(ht=ed(ho(G.y,0,1)),wt=ht.getUTCDay(),ht=wt>4||wt===0?gh.ceil(ht):gh(ht),ht=Qu.offset(ht,(G.V-1)*7),G.y=ht.getUTCFullYear(),G.m=ht.getUTCMonth(),G.d=ht.getUTCDate()+(G.w+6)%7):(ht=td(ho(G.y,0,1)),wt=ht.getDay(),ht=wt>4||wt===0?mh.ceil(ht):mh(ht),ht=ao.offset(ht,(G.V-1)*7),G.y=ht.getFullYear(),G.m=ht.getMonth(),G.d=ht.getDate()+(G.w+6)%7)}else("W"in G||"U"in G)&&("w"in G||(G.w="u"in G?G.u%7:"W"in G?1:0),wt="Z"in G?ed(ho(G.y,0,1)).getUTCDay():td(ho(G.y,0,1)).getDay(),G.m=0,G.d="W"in G?(G.w+6)%7+G.W*7-(wt+5)%7:G.w+G.U*7-(wt+6)%7);return"Z"in G?(G.H+=G.Z/100|0,G.M+=G.Z%100,ed(G)):td(G)}}function E(N,Y,H,G){for(var ut=0,ht=Y.length,wt=H.length,Rt,Fe;ut<ht;){if(G>=wt)return-1;if(Rt=Y.charCodeAt(ut++),Rt===37){if(Rt=Y.charAt(ut++),Fe=v[Rt in Cy?Y.charAt(ut++):Rt],!Fe||(G=Fe(N,H,G))<0)return-1}else if(Rt!=H.charCodeAt(G++))return-1}return G}function I(N,Y,H){var G=l.exec(Y.slice(H));return G?(N.p=c.get(G[0].toLowerCase()),H+G[0].length):-1}function k(N,Y,H){var G=f.exec(Y.slice(H));return G?(N.w=p.get(G[0].toLowerCase()),H+G[0].length):-1}function L(N,Y,H){var G=u.exec(Y.slice(H));return G?(N.w=d.get(G[0].toLowerCase()),H+G[0].length):-1}function P(N,Y,H){var G=y.exec(Y.slice(H));return G?(N.m=x.get(G[0].toLowerCase()),H+G[0].length):-1}function S(N,Y,H){var G=m.exec(Y.slice(H));return G?(N.m=g.get(G[0].toLowerCase()),H+G[0].length):-1}function R(N,Y,H){return E(N,t,Y,H)}function F(N,Y,H){return E(N,e,Y,H)}function O(N,Y,H){return E(N,i,Y,H)}function B(N){return o[N.getDay()]}function Z(N){return n[N.getDay()]}function st(N){return h[N.getMonth()]}function X(N){return a[N.getMonth()]}function M(N){return s[+(N.getHours()>=12)]}function D(N){return 1+~~(N.getMonth()/3)}function V(N){return o[N.getUTCDay()]}function J(N){return n[N.getUTCDay()]}function j(N){return h[N.getUTCMonth()]}function mt(N){return a[N.getUTCMonth()]}function Tt(N){return s[+(N.getUTCHours()>=12)]}function bt(N){return 1+~~(N.getUTCMonth()/3)}return{format:function(N){var Y=T(N+="",b);return Y.toString=function(){return N},Y},parse:function(N){var Y=C(N+="",!1);return Y.toString=function(){return N},Y},utcFormat:function(N){var Y=T(N+="",_);return Y.toString=function(){return N},Y},utcParse:function(N){var Y=C(N+="",!0);return Y.toString=function(){return N},Y}}}var Cy={"-":"",_:" ",0:"0"},se=/^\s*\d+/,cA=/^%/,uA=/[\\^$*+?|[\]().{}]/g;function vt(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 dA(r){return r.replace(uA,"\\$&")}function lo(r){return new RegExp("^(?:"+r.map(dA).join("|")+")","i")}function co(r){return new Map(r.map((t,e)=>[t.toLowerCase(),e]))}function fA(r,t,e){var i=se.exec(t.slice(e,e+1));return i?(r.w=+i[0],e+i[0].length):-1}function pA(r,t,e){var i=se.exec(t.slice(e,e+1));return i?(r.u=+i[0],e+i[0].length):-1}function mA(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.U=+i[0],e+i[0].length):-1}function gA(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.V=+i[0],e+i[0].length):-1}function yA(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.W=+i[0],e+i[0].length):-1}function Ey(r,t,e){var i=se.exec(t.slice(e,e+4));return i?(r.y=+i[0],e+i[0].length):-1}function Iy(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.y=+i[0]+(+i[0]>68?1900:2e3),e+i[0].length):-1}function bA(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 xA(r,t,e){var i=se.exec(t.slice(e,e+1));return i?(r.q=i[0]*3-3,e+i[0].length):-1}function _A(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.m=i[0]-1,e+i[0].length):-1}function Ay(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.d=+i[0],e+i[0].length):-1}function vA(r,t,e){var i=se.exec(t.slice(e,e+3));return i?(r.m=0,r.d=+i[0],e+i[0].length):-1}function My(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.H=+i[0],e+i[0].length):-1}function wA(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.M=+i[0],e+i[0].length):-1}function TA(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.S=+i[0],e+i[0].length):-1}function SA(r,t,e){var i=se.exec(t.slice(e,e+3));return i?(r.L=+i[0],e+i[0].length):-1}function CA(r,t,e){var i=se.exec(t.slice(e,e+6));return i?(r.L=Math.floor(i[0]/1e3),e+i[0].length):-1}function EA(r,t,e){var i=cA.exec(t.slice(e,e+1));return i?e+i[0].length:-1}function IA(r,t,e){var i=se.exec(t.slice(e));return i?(r.Q=+i[0],e+i[0].length):-1}function AA(r,t,e){var i=se.exec(t.slice(e));return i?(r.s=+i[0],e+i[0].length):-1}function Ry(r,t){return vt(r.getDate(),t,2)}function MA(r,t){return vt(r.getHours(),t,2)}function RA(r,t){return vt(r.getHours()%12||12,t,2)}function PA(r,t){return vt(1+ao.count(er(r),r),t,3)}function Py(r,t){return vt(r.getMilliseconds(),t,3)}function LA(r,t){return Py(r,t)+"000"}function GA(r,t){return vt(r.getMonth()+1,t,2)}function kA(r,t){return vt(r.getMinutes(),t,2)}function FA(r,t){return vt(r.getSeconds(),t,2)}function NA(r){var t=r.getDay();return t===0?7:t}function DA(r,t){return vt(ph.count(er(r)-1,r),t,2)}function Ly(r){var t=r.getDay();return t>=4||t===0?hn(r):hn.ceil(r)}function OA(r,t){return r=Ly(r),vt(hn.count(er(r),r)+(er(r).getDay()===4),t,2)}function UA(r){return r.getDay()}function BA(r,t){return vt(mh.count(er(r)-1,r),t,2)}function XA(r,t){return vt(r.getFullYear()%100,t,2)}function WA(r,t){return r=Ly(r),vt(r.getFullYear()%100,t,2)}function ZA(r,t){return vt(r.getFullYear()%1e4,t,4)}function VA(r,t){var e=r.getDay();return r=e>=4||e===0?hn(r):hn.ceil(r),vt(r.getFullYear()%1e4,t,4)}function HA(r){var t=r.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+vt(t/60|0,"0",2)+vt(t%60,"0",2)}function Gy(r,t){return vt(r.getUTCDate(),t,2)}function KA(r,t){return vt(r.getUTCHours(),t,2)}function YA(r,t){return vt(r.getUTCHours()%12||12,t,2)}function zA(r,t){return vt(1+Qu.count(gs(r),r),t,3)}function ky(r,t){return vt(r.getUTCMilliseconds(),t,3)}function jA(r,t){return ky(r,t)+"000"}function JA(r,t){return vt(r.getUTCMonth()+1,t,2)}function $A(r,t){return vt(r.getUTCMinutes(),t,2)}function QA(r,t){return vt(r.getUTCSeconds(),t,2)}function qA(r){var t=r.getUTCDay();return t===0?7:t}function tM(r,t){return vt(Sy.count(gs(r)-1,r),t,2)}function Fy(r){var t=r.getUTCDay();return t>=4||t===0?ln(r):ln.ceil(r)}function eM(r,t){return r=Fy(r),vt(ln.count(gs(r),r)+(gs(r).getUTCDay()===4),t,2)}function iM(r){return r.getUTCDay()}function rM(r,t){return vt(gh.count(gs(r)-1,r),t,2)}function sM(r,t){return vt(r.getUTCFullYear()%100,t,2)}function nM(r,t){return r=Fy(r),vt(r.getUTCFullYear()%100,t,2)}function oM(r,t){return vt(r.getUTCFullYear()%1e4,t,4)}function aM(r,t){var e=r.getUTCDay();return r=e>=4||e===0?ln(r):ln.ceil(r),vt(r.getUTCFullYear()%1e4,t,4)}function hM(){return"+0000"}function Ny(){return"%"}function Dy(r){return+r}function Oy(r){return Math.floor(+r/1e3)}var cn,Uy;lM({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 lM(r){return cn=lA(r),Uy=cn.format,cn.parse,cn.utcFormat,cn.utcParse,cn}function cM(r){return new Date(r)}function uM(r){return r instanceof Date?+r:+new Date(+r)}function By(r,t,e,i,s,n,o,a,h,l){var c=vy(),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"),_=l("%Y");function v(T){return(h(T)<T?f:a(T)<T?p:o(T)<T?m:n(T)<T?g:i(T)<T?s(T)<T?y:x:e(T)<T?b:_)(T)}return c.invert=function(T){return new Date(u(T))},c.domain=function(T){return arguments.length?d(Array.from(T,uM)):d().map(cM)},c.ticks=function(T){var C=d();return r(C[0],C[C.length-1],T??10)},c.tickFormat=function(T,C){return C==null?v:l(C)},c.nice=function(T){var C=d();return(!T||typeof T.range!="function")&&(T=t(C[0],C[C.length-1],T??10)),T?d($I(C,T)):c},c.copy=function(){return _y(c,By(r,t,e,i,s,n,o,a,h,l))},c}function dM(){return by.apply(By(aA,hA,er,qu,ph,ao,$u,Ju,an,Uy).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function uo(r,t,e){this.k=r,this.x=t,this.y=e}uo.prototype={constructor:uo,scale:function(r){return r===1?this:new uo(this.k*r,this.x,this.y)},translate:function(r,t){return r===0&t===0?this:new uo(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+")"}},uo.prototype;function Xy(r){return r.mode==="temporal"||r.mode==="left-aligned"?fM(r):pM(r)}function fM({domain:r,range:t}){return dM().domain(r).range(t)}function pM({domain:r,range:t}){return wy().domain(r).range(t)}function id(r){return{mode:et.horizontal,range:QC(),domain:qC(r)}}function mM(){return{mode:et.vertical}}let un=null;async function gM(){const r=await Ri(),t=new Date(r.start_time);Wy(t),K.on("layoutSettingsUpdated",()=>Wy(t))}function yM(){un=null}async function Ye(){return un||await be("scaleCreated")}async function Wy(r){await Yt();const t=un?"scaleUpdated":"scaleCreated",e=id(r);un=Xy(e),K.emit(t,un)}function Ar(r){return"getIds"in r}async function Zy({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=Ar(o)?o.getIds():[o.getId()],u=Ar(a)?a.getIds():[a.getId()];if(!h||!l)return console.error("flowRunArtifacts: visible item is missing date"),null;let d;Ar(o)?d=o:Ar(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 Vy(r){const t=await Ht(),e=await zt(),i=await Ut(),s=await Yt();let n=await Ye();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=Ar(o)?{kind:"events",ids:o.getIds(),occurred:o.getDate(),position:d}:{kind:"event",id:o.getId(),occurred:o.getDate(),position:d};Ai(f)}),K.on("scaleUpdated",c=>{n=c,l()}),K.on("viewportMoved",()=>l());async function a(c){await o.render(c),l()}async function h(){return r.type==="event"?await Jg(r.event):await $g()}function l(){const c=o.getDate();if(!c||s.disableEvents||!et.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.eventBottomMargin;u.position.set(f,p)}return{...o,render:a}}async function Hy(r){const t=await zt(),e=await Yt();let i=await Ye();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=Ar(s)?{kind:"events",ids:s.getIds(),occurred:s.getDate(),position:u}:{kind:"event",id:s.getId(),occurred:s.getDate(),position:u};Ai(d)}),K.on("scaleUpdated",h=>{i=h,a()});async function n(h){await s.render(h),a()}async function o(){return r.type==="event"?await Jg(r.event):await $g()}function a(){const h=s.getDate(),{parentStartDate:l}=r;if(!h||e.disableEvents||!et.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 Ky({isRoot:r,parentStartDate:t}={}){const e=await Yt(),i=new Map,s=new Map,n=[];let o=[];const a=new yt;let h=null;K.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 Vy({type:"event",event:p}):await Hy({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||!et.isTemporal()||d()}const d=Yg(async()=>{o=[...n],await Zy({items:i,createCluster:f});for(const p of o)p.render()},Bh);async function f(){if(o.length>0)return o.pop();const p=r?await Vy({type:"cluster"}):await Hy({type:"cluster",parentStartDate:t});return a.addChild(p.element),n.push(p),p}return{element:a,render:l,update:u}}let fo=null,dn=null;async function bM(){const r=await Ht(),t=await Me(),e=await Yt(),i=await Ri(),{element:s,render:n,update:o}=await Ky({isRoot:!0});s.zIndex=Ud;async function a(l){if(!et.isTemporal()||e.disableEvents){r.stage.removeChild(s);return}r.stage.addChild(s),await n(l)}const h=await Xg(()=>({nodeId:t.runId,since:new Date(i.start_time),until:i.end_time?new Date(i.end_time):new Date}),l=>{const c=dn?"eventDataUpdated":"eventDataCreated";dn=l,K.emit(c,dn),a(l)});K.on("configUpdated",()=>a()),K.on("viewportMoved",()=>o()),K.on("layoutSettingsUpdated",()=>a()),fo=h.stop,h.start()}function xM(){fo==null||fo(),fo=null,dn=null}async function _M(){return dn||await be("eventDataCreated")}async function Yy(r){const t=await Ht(),e=await zt(),i=await Ut(),s=await Yt(),n=await _M();let o=await Ye(),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=Ar(h)?{kind:"artifacts",ids:h.getIds(),position:m}:{kind:"artifact",id:h.getId()};Ai(g)}),K.on("scaleUpdated",d=>{o=d,u()}),K.on("viewportMoved",()=>u()),K.on("eventDataCreated",d=>{a=d.length>0,u()}),K.on("eventDataUpdated",d=>{a=d.length>0,u()});async function l(d){if(Bg(h)){if(r.type!=="artifact")throw new Error(`ArtifactFactory attempted to render a ${r.type}`);await h.render(r.artifact)}else await h.render(d);u()}async function c(){return r.type==="artifact"?await Lu(r.artifact,{cullAtZoomThreshold:!1}):await zg()}function u(){const d=h.getDate();if(!d||!et.isTemporal()||s.disableArtifacts)return;const f=h.getSelected(),{element:p}=h,{eventTargetSize:m,flowStateSelectedBarHeight:g}=i;let y=0;if(f){const{selectedBorderOffset:T,selectedBorderWidth:C}=i;y=T+C*2}const b=o(d)*e.scale._x+e.worldTransform.tx-(p.width-y)/2,_=a&&!s.disableEvents?m:g,v=t.screen.height-(p.height-y)-_;p.position.set(b,v)}return{...h,render:l}}async function zy(r){const t=await zt(),e=await Ut(),i=await Yt();let s=await Ye();const n=await a();n.element.on("click",l=>{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=Ar(n)?{kind:"artifacts",ids:n.getIds(),position:d}:{kind:"artifact",id:n.getId()};Ai(f)}),K.on("scaleUpdated",l=>{s=l,h()});async function o(l){if(Bg(n)){if(r.type!=="artifact")throw new Error(`ArtifactFactory attempted to render a ${r.type}`);await n.render(r.artifact)}else await n.render(l);h()}async function a(){return r.type==="artifact"?await Lu(r.artifact):await zg()}function h(){const l=n.getDate(),{parentStartDate:c}=r;if(!l||!et.isTemporal()||i.disableArtifacts||!c)return;const u=n.getSelected(),{element:d}=n;let f=0;if(u){const{selectedBorderOffset:y,selectedBorderWidth:x}=e;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 jy({isRoot:r,parentStartDate:t}={}){const e=await Yt(),i=new Map,s=new Map,n=[];let o=[];const a=new yt;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(p);s.has(p.id)&&await s.get(p.id);const m=(async()=>{const g=r?await Yy({type:"artifact",artifact:p}):await zy({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(p)}function u(){if(!(e.disableArtifacts||!et.isTemporal())){if(!et.isTemporal()){a.visible=!1;return}a.visible=!0,a.position.x=0,d()}}const d=Yg(async()=>{o=[...n],await Zy({items:i,createCluster:f});for(const p of o)p.render()},Bh);async function f(){if(o.length>0)return o.pop();const p=r?await Yy({type:"cluster"}):await zy({type:"cluster",parentStartDate:t});return a.addChild(p.element),n.push(p),p}return{element:a,render:l,update:u}}async function vM(r){const t=await Ht(),e=await zt(),i=await Ut(),s=await Ri();let n=await Ye();const o=new yt,a=await Ji(),h=await Ji();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};Ai({...r,kind:"state",position:b})}),K.on("viewportMoved",()=>d()),K.on("scaleUpdated",b=>{n=b,d()}),K.on("itemSelected",()=>{const b=$i({kind:"state",...r});b!==u&&(u=b,c=!1,d())}),r.type==="RUNNING"&&!s.end_time&&g();function d(b){const{end:_}=b??{};if(_&&(l=_),s.end_time&&y(),!et.isTemporal()){h.visible=!1,o.visible=!1;return}const v=f();p(v),m(v),h.visible=!0,o.visible=!0}function f(){const{background:b="#fff"}=i.state(r),_=Math.max(n(r.timestamp)*e.scale._x+e.worldTransform.tx,0);let v=0;return r.type==="RUNNING"&&!s.end_time?v=n(new Date)*e.scale._x+e.worldTransform.tx-_:l?v=n(l)*e.scale._x+e.worldTransform.tx-_:v=t.screen.width-_,{x:_,width:Math.max(v,0),background:b}}function p({x:b,width:_,background:v}){const{flowStateBarHeight:T,flowStateSelectedBarHeight:C}=i,E=c||u?C:T;a.x=b,a.y=t.screen.height-E,a.width=_,a.height=E,a.tint=v}function m({x:b,width:_,background:v}){if(r.type==="RUNNING"){h.visible=!1;return}const{flowStateBarHeight:T,flowStateAreaAlpha:C}=i;h.x=b,h.y=0,h.width=_,h.height=t.screen.height-T,h.tint=v,h.alpha=C}function g(){t.ticker.add(x)}function y(){t.ticker.remove(x)}function x(){d()}return{element:o,render:d}}function wM(r){return"isNodesFlowRunStateFactory"in r}async function TM(r){const t=await Ht(),e=await zt(),i=await Ut(),s=await Ri();let n=await Ye();const o=new yt,a=await Ji(),h=await Ji();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",T=>{T.stopPropagation();const C=a.getGlobalPosition(),E={x:C.x,y:C.y,width:a.width*e.scale.x,height:a.height*e.scale.y};Ai({...r,kind:"state",position:E})}),h.eventMode="none",h.cursor="default",K.on("scaleUpdated",T=>{n=T,m()}),K.on("itemSelected",()=>{const T=$i({kind:"state",...r});T!==p&&(p=T,f=!1,m())}),r.type==="RUNNING"&&!s.end_time&&b();function m(T){const{end:C,parentStartDate:E,width:I,height:k}=T??{};if(C&&(l=C),E&&(c=E),I&&(u=I),k&&(d=k),s.end_time&&_(),!et.isTemporal()){o.visible=!1;return}if(!c||u<=0){o.visible=!1;return}const L=g();if(L.width<=0){o.visible=!1;return}y(L),x(L),o.visible=!0}function g(){const{background:T="#fff"}=i.state(r);if(!c)return{x:0,width:0,background:T};const C=n(c);let E=n(r.timestamp)-C;if(E>=u)return{x:u,width:0,background:T};E<0&&(E=0);let I=n(l??new Date)-C;I>u&&(I=u);const k=Math.max(I-E,0);return{x:E,width:k,background:T}}function y({x:T,width:C,background:E}){const{flowStateBarHeight:I,flowStateSelectedBarHeight:k}=i,L=f||p?k:I;a.x=T,a.y=d-L,a.width=C,a.height=L,a.tint=E}function x({x:T,width:C,background:E}){const{flowStateBarHeight:I,flowStateAreaAlpha:k,nodeHeight:L}=i,P=L/2;h.x=T,h.y=P,h.width=C,h.height=d-I-P,h.tint=E,h.alpha=k}function b(){t.ticker.add(v)}function _(){t.ticker.remove(v)}function v(){m()}return{element:o,render:m,isNodesFlowRunStateFactory:!0}}function Jy({isRoot:r}={}){const t=new yt,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 vM(a):await TM(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)}wM(d)?await d.render({end:u,...l}):await d.render(u?{end:u}:void 0)}return{element:t,render:n}}class $y extends yt{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 SM(r){const t=new $y,e=await Me(),i=await Ut(),s=await Yt(),{element:n,render:o}=await Zg(),{element:a,render:h}=await qa(),{element:l,render:c}=await Wg(),{element:u,render:d}=await $a(),{element:f,render:p,getSize:m,stopWorker:g}=await rd(),{element:y,render:x}=await Jy(),{element:b,render:_,update:v}=await Ky({parentStartDate:new Date(r.start_time)}),{element:T,render:C,update:E}=await jy({parentStartDate:new Date(r.start_time)});let I=!1,k=!1,L=r,P=!1;t.sortableChildren=!0,u.zIndex=Xh,n.zIndex=Zh,a.zIndex=bn,l.zIndex=bn,f.zIndex=Wh,b.zIndex=Wd,y.zIndex=Zd,T.zIndex=Vd,u.eventMode="none",u.cursor="default";const{start:S,stop:R}=await cm(L.id,N=>{k=!!N.artifacts&&N.artifacts.length>0,p(N),X(N.states),D(N.artifacts),st()}),{start:F,stop:O}=await Xg(()=>({nodeId:L.id,since:new Date(L.start_time),until:L.end_time?new Date(L.end_time):new Date}),N=>{I=N.length>0,M(N)});t.addChild(n),t.addChild(a),t.addChild(l),l.on("click",N=>{N.stopPropagation(),Z()}),f.position={x:0,y:i.nodeHeight+i.nodesPadding},f.on("rendered",()=>{go(),Tt()});async function B(N){return L=N,await o(N),await j(),await mt(),P&&(await X(),await M(),await D(),await st()),t}async function Z(){P?await J():await V()}async function st(){const{background:N="#fff"}=i.node(L),{width:Y,height:H}=m(),{height:G}=bt(),{nodeBorderRadius:ut}=i,ht=2;u.position={x:-ht,y:-ht};const wt=et.isTemporal()?G+ht*2:H+ht*2;await d({width:Y+ht*2,height:wt,stroke:ht,radius:[ut,ut,0,0],color:N})}async function X(N){const{height:Y}=bt(),{width:H}=n;await x(N??void 0,{parentStartDate:new Date(L.start_time),width:H,height:Y})}async function M(N){if(!P||!et.isTemporal()||s.disableEvents){t.removeChild(b);return}t.addChild(b);const{height:Y}=bt();if(b.position={x:0,y:Y-i.eventBottomMargin},N){await _(N);return}await v()}async function D(N){if(!P||!et.isTemporal()||s.disableArtifacts){t.removeChild(T);return}t.addChild(T);const{eventTargetSize:Y,flowStateSelectedBarHeight:H}=i,{height:G}=bt(),ut=G-(I&&!s.disableEvents?Y:H);if(T.position={x:0,y:ut},N){await C(N);return}await E()}async function V(){P=!0,t.addChild(y),t.addChild(f),t.addChild(u),await Promise.all([S(),F(),B(L)]),Tt()}async function J(){P=!1,t.removeChild(y),t.removeChild(f),t.removeChild(u),t.removeChild(b),t.removeChild(T),g(),await Promise.all([R(),O(),B(L)]),Tt()}async function j(){const N=i.nodeToggleSize,Y=i.nodeHeight-N,H=n.width>N,G=await c({inside:H,isOpen:P});return G.x=H?Y/2:n.width+i.nodePadding,G.y=Y/2,G}async function mt(){const N=await h(L.label),Y=e.theme==="dark"?i.textDefault:i.textInverse,H=i.nodePadding,G=l.x+l.width+H,ut=n.width+H,ht=n.width>G+N.width+H,wt=i.nodeHeight/2-N.height/2,Rt=ht?G:Math.max(ut,G);return N.position={x:Rt,y:wt},N.tint=ht?Y:i.textDefault,N}function Tt(){P&&(X(),M(),D(),st());const N=bt();t.emit("resized",N)}function bt(){const N=m(),{nodeHeight:Y,nodesPadding:H,eventTargetSize:G,eventBottomMargin:ut,artifactPaddingY:ht,artifactIconSize:wt}=i,Fe=k&&et.isTemporal()&&!s.disableArtifacts?wt+ht*2:0,od=I&&et.isTemporal()&&!s.disableEvents?G+ut:0,ad=P?N.height+Fe+od+H*2:0,hd=P?N.width:0;return{height:Y+ad,width:Math.max(hd,t.width)}}return{kind:"flow-run",element:t,bar:n,render:B}}async function CM(r,t){const e=await Me(),i=await Ut(),s=new $y,{element:n,render:o}=await qa(),{element:a,render:h}=await $a(),{element:l,render:c}=await Zg(),{element:u,render:d}=await Wg(),{element:f,render:p,getSize:m,stopWorker:g}=await rd();s.addChild(l),s.addChild(n);let y=!1,x=r,b=t;s.sortableChildren=!0,a.zIndex=Xh,l.zIndex=Zh,n.zIndex=bn,u.zIndex=bn,f.zIndex=Wh,a.eventMode="none",a.cursor="default",f.position={x:0,y:i.nodeHeight+i.nodesPadding},f.on("rendered",()=>{go(),P()}),u.on("click",S=>{S.stopPropagation(),E()});async function _(S,R){return x=S,b=R,R&&s.addChild(u),await c(S),R&&await v(),y&&(R&&p(R),await C()),await T(),s}async function v(){const S=i.nodeToggleSize,R=i.nodeHeight-S,F=l.width>S,O=await d({inside:F,isOpen:y});return O.x=F?R/2:l.width+i.nodePadding,O.y=R/2,O}async function T(){const S=await o(x.label),R=e.theme==="dark"?i.textDefault:i.textInverse,F=i.nodePadding,O=u.x+u.width+F,B=l.width+F,Z=l.width>O+S.width+F,st=i.nodeHeight/2-S.height/2,X=Z?O:Math.max(B,O);return S.position={x:X,y:st},S.tint=Z?R:i.textDefault,S}async function C(){const{background:S="#fff"}=i.node(x),{width:R,height:F}=m(),{height:O}=L(),{nodeBorderRadius:B}=i,Z=2;a.position={x:-Z,y:-Z};const st=et.isTemporal()?O+Z*2:F+Z*2;await h({width:R+Z*2,height:st,stroke:Z,radius:[B,B,0,0],color:S})}async function E(){y?await k():await I()}async function I(){if(y=!0,s.addChild(f),s.addChild(a),!b)throw new Error("Attempted to open without nested graph data");await Promise.all([p(b),_(x,b)]),P()}async function k(){y=!1,s.removeChild(f),s.removeChild(a),g(),await _(x,b),P()}function L(){const S=m(),{nodeHeight:R,nodesPadding:F}=i,O=y?S.height+F*2:0,B=y?S.width:0;return{height:R+O,width:Math.max(B,s.width)}}function P(){y&&C();const S=L();s.emit("resized",S)}return{kind:"task-run",element:s,render:_,bar:l}}async function EM(r,t){const e=await Me(),i=await Ut(),s=await Ht(),n=await r1(),o=await Yt();let a=null;const h=new Map,{animate:l}=await Rg(),{element:c,render:u,bar:d}=await k(r,t);let f=r,p=t,m=null,g=!1,y=!1;n.add(c),c.eventMode="static",c.cursor="pointer",c.name=Md,c.on("click",S=>{S.stopPropagation(),Ai({kind:f.kind,id:f.id})}),f.end_time||C(),K.on("itemSelected",()=>{const S=$i({kind:f.kind,id:f.id});S!==g&&(g=S,u(f,p))});async function x(S,R){f=S,p=R;const F=L(S);return F===m||(m=F,await Promise.all([u(S,R),b(S.artifacts)]),S.end_time&&E()),c}async function b(S){if(!S||(v(),o.disableArtifacts||!et.isTemporal()))return;const R=[];for(const F of S)R.push(_(F));await Promise.all(R),T()}async function _(S){if(h.has(S.id))return h.get(S.id).render(S);const R=await Lu(S,{enableLocalClickHandling:!0});return h.set(S.id,R),a.addChild(R.element),R.render(S)}function v(){if(et.isTemporal()&&!o.disableArtifacts){a||(a=new yt),c.addChild(a);return}a&&c.removeChild(a)}function T(){if(!a)return;const{artifactsGap:S,artifactsNodeOverlap:R}=i;let F=0;for(const O of h.values())O.element.position.x=F,F+=O.element.width+S;a.position.y=-a.height+R,a.width<d.width&&(a.position.x=d.width-a.width)}function C(){s.ticker.add(I)}function E(){s.ticker.remove(I)}function I(){x(f,p)}async function k(S,R){const{kind:F}=S;switch(F){case"task-run":return await CM(S,R);case"flow-run":return await SM(S);default:const O=F;throw new Error(`switch does not have case for value: ${O}`)}}function L(S){var Z;const R=S.end_time?new Date(S.end_time):new Date,F=(Z=S.artifacts)==null?void 0:Z.map(st=>st.type==="progress"?`${st.id}-${st.data}`:st.id).join("|"),O=!!p;return[S.state_type,R.getTime(),et.horizontal,et.horizontalScaleMultiplier,e.theme,o.disableArtifacts||F,O].join("-")}function P({x:S,y:R}){l(c,{x:S,y:R},!y),y=!0}return{element:c,render:x,bar:d,setPosition:P}}function Qy({gap:r=0,minimum:t=0}={}){const e=new Map;function i(c){const u=e.get(c)??[];return Math.max(...u.values(),eh(t))+eh(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)-eh(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}}function IM(r){throw new Error(`switch does not have case for value: ${r}`)}const qy="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIEtlKG4pe3Rocm93IG5ldyBFcnJvcihgc3dpdGNoIGRvZXMgbm90IGhhdmUgY2FzZSBmb3IgdmFsdWU6ICR7bn1gKX1mdW5jdGlvbiBDbihuLGUpe3JldHVybiBuPT1udWxsfHxlPT1udWxsP05hTjpuPGU/LTE6bj5lPzE6bj49ZT8wOk5hTn1mdW5jdGlvbiBudChuLGUpe3JldHVybiBuPT1udWxsfHxlPT1udWxsP05hTjplPG4/LTE6ZT5uPzE6ZT49bj8wOk5hTn1mdW5jdGlvbiBSbihuKXtsZXQgZSx0LHI7bi5sZW5ndGghPT0yPyhlPUNuLHQ9KHUsbCk9PkNuKG4odSksbCkscj0odSxsKT0+bih1KS1sKTooZT1uPT09Q258fG49PT1udD9uOmV0LHQ9bixyPW4pO2Z1bmN0aW9uIG8odSxsLGY9MCxnPXUubGVuZ3RoKXtpZihmPGcpe2lmKGUobCxsKSE9PTApcmV0dXJuIGc7ZG97Y29uc3QgbT1mK2c+Pj4xO3QodVttXSxsKTwwP2Y9bSsxOmc9bX13aGlsZShmPGcpfXJldHVybiBmfWZ1bmN0aW9uIGkodSxsLGY9MCxnPXUubGVuZ3RoKXtpZihmPGcpe2lmKGUobCxsKSE9PTApcmV0dXJuIGc7ZG97Y29uc3QgbT1mK2c+Pj4xO3QodVttXSxsKTw9MD9mPW0rMTpnPW19d2hpbGUoZjxnKX1yZXR1cm4gZn1mdW5jdGlvbiBhKHUsbCxmPTAsZz11Lmxlbmd0aCl7Y29uc3QgbT1vKHUsbCxmLGctMSk7cmV0dXJuIG0+ZiYmcih1W20tMV0sbCk+LXIodVttXSxsKT9tLTE6bX1yZXR1cm57bGVmdDpvLGNlbnRlcjphLHJpZ2h0Oml9fWZ1bmN0aW9uIGV0KCl7cmV0dXJuIDB9ZnVuY3Rp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tjYXNlImxheW91dCI6a28obik7cmV0dXJuO2RlZmF1bHQ6S2UoZSl9fWZ1bmN0aW9uIFVvKG4pe3Bvc3RNZXNzYWdlKG4pfWFzeW5jIGZ1bmN0aW9uIGtvKG4pe2NvbnN0e2RhdGE6ZX09bix0PXBvKG4pLHI9YXdhaXQgVG8obix0KSxvPW5ldyBNYXA7bGV0IGk9MCxhPTA7Zm9yKGNvbnN0W3UsbF1vZiBlLm5vZGVzKXtjb25zdCBmPXQuZ2V0KHUpLGc9ci5nZXQodSk7aWYoZj09PXZvaWQgMCl7Y29uc29sZS53YXJuKGBOb2RlSWQgbm90IGZvdW5kIGluIGhvcml6b250YWwgbGF5b3V0OiBTa2lwcGluZyAke2wubGFiZWx9YCk7Y29udGludWV9aWYoZz09PXZvaWQgMCl7Y29uc29sZS53YXJuKGBOb2RlSWQgbm90IGZvdW5kIGluIHZlcnRpY2FsIGxheW91dDogU2tpcHBpbmcgJHtsLmxhYmVsfWApO2NvbnRpbnVlfWk9TWF0aC5tYXgoaSxnKSxhPU1hdGgubWF4KGEsZi5jb2x1bW4pLG8uc2V0KHUsey4uLmYseTpnLHJvdzpnfSl9VW8oe3R5cGU6ImxheW91dCIsbGF5b3V0OnttYXhSb3c6aSxtYXhDb2x1bW46YSxwb3NpdGlvbnM6b319KX19KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1ydW5HcmFwaC53b3JrZXItd2pueUpGdHAuanMubWFwCg==",AM=r=>Uint8Array.from(atob(r),t=>t.charCodeAt(0)),t1=typeof self<"u"&&self.Blob&&new Blob([AM(qy)],{type:"text/javascript;charset=utf-8"});function MM(r){let t;try{if(t=t1&&(self.URL||self.webkitURL).createObjectURL(t1),!t)throw"";const e=new Worker(t,{name:r==null?void 0:r.name});return e.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),e}catch{return new Worker("data:text/javascript;base64,"+qy,{name:r==null?void 0:r.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}function RM(r){const t=new MM;return t.onmessage=r,t}async function rd(){const r=new Map,t=new Map,e=new Map,i=new yt,s=new yt,n=await Ut();let o=null;const a=Qy({gap:()=>n.rowGap,minimum:()=>n.nodeHeight}),h=Qy({gap:()=>n.columnGap,minimum:()=>Cu()});let l=null,c=null;i.name=Gh,K.on("layoutUpdated",()=>{a.clear(),h.clear()}),K.on("layoutSettingsUpdated",()=>{c&&i.parent&&u(c),F()}),K.on("itemSelected",()=>{F()});async function u(M){d(),c=M,l=null,await Promise.all([p(M),g(M)]),x(M)}function d(){o||(o=RM(S))}function f(){o&&(o.terminate(),o=null)}async function p(M){const D=[];for(const V of M.nodes.values())D.push(m(V));await Promise.all(D)}async function m(M){const{render:D}=await v(M),V=C(M.id);return await D(M,V)}async function g(M){if((await Yt()).disableEdges){i.removeChild(s);return}i.addChildAt(s,0);const V=[];for(const[J,{children:j}]of M.nodes)for(const{id:mt}of j)V.push(y(J,mt));await Promise.all(V)}async function y(M,D){const V=`${M}_${D}`;if(e.has(V))return;const J=await cE();e.has(V)||(e.set(V,J),s.addChild(J.element))}function x(M){if(!o)throw new Error("Layout worker not initialized");const D=new Map;for(const[V,{element:J}]of t)D.set(V,J.width);o.postMessage({type:"layout",data:M,widths:D,horizontalSettings:id(new Date(M.start_time)),verticalSettings:mM()})}function b(){if(l)for(const[M,D]of e){const[V,J]=M.split("_"),j=l.positions.get(V),mt=l.positions.get(J),Tt=t.get(V);if(!j||!mt){console.warn(`Could not find edge in layout: Skipping ${M}`);continue}if(!Tt){console.warn(`Could not find parent node in nodes: Skipping ${V}`);continue}const bt=Tt.bar.width,N=E(j),Y={x:N.x+bt,y:N.y+n.nodeHeight/2},H=E(mt),G={x:H.x-Y.x,y:H.y-Y.y+n.nodeHeight/2};D.setPosition(Y,G)}}function _(){if(l){for(const[M,D]of t){const V=l.positions.get(M);if(!V){console.warn(`Could not find node in layout: Skipping ${M}`);continue}const J=E(V);D.setPosition(J),a.updateNodeAxis({nodeId:M,axis:V.y}),h.updateNodeAxis({nodeId:M,axis:V.column})}b(),i.emit("rendered"),i.emit("resized",P())}}async function v(M){const D=r.get(M.id);if(D)return D;const V=C(M.id),J=EM(M,V);r.set(M.id,J);const j=await J;return j.element.on("resized",mt=>T(M.id,mt)),i.addChild(j.element),t.set(M.id,j),j}function T(M,D){if(!l)return;const V=t.get(M),J=l.positions.get(M);!V||!J||(a.setOffset({nodeId:M,axis:J.y,offset:D.height}),h.setOffset({nodeId:M,axis:J.column,offset:D.width}),_())}function C(M){var D;return(D=c==null?void 0:c.nested_task_run_graphs)==null?void 0:D.get(M)}function E(M){const D=a.getTotalOffset(M.y);return{x:I(M),y:D}}function I(M){return et.isDependency()?h.getTotalOffset(M.column):M.x}function k(){return l?a.getTotalValue(l.maxRow):0}function L(){if(!l||!c)return 0;if(et.isDependency())return h.getTotalValue(l.maxColumn);const M=new Date(c.start_time),D=c.end_time?new Date(c.end_time):new Date,V=id(M),J=Xy(V),j=J(D),mt=J(M);return j-mt}function P(){return{width:L(),height:k()}}function S({data:M}){const{type:D}=M;switch(D){case"layout":R(M);return;default:IM(D)}}function R(M){l=M.layout,_()}async function F(){const M=await Yt(),D=LE();if(M.disableEdges||!D||!(c!=null&&c.nodes.has(D.id))){O([]);return}const V=st(D.id);O(V)}function O(M){B(M),Z(M)}function B(M){for(const[D,{element:V}]of t){if(M.length===0||M.includes(D)){V.alpha=1;continue}V.alpha=n.nodeUnselectedAlpha}}function Z(M){for(const[D,{element:V}]of e){const[J,j]=D.split("_");if(M.length===0||M.includes(J)&&M.includes(j)){V.alpha=1;continue}V.alpha=n.nodeUnselectedAlpha}}function st(M){const D=X(M,"parents"),V=X(M,"children");return[M,...D,...V]}function X(M,D){const V=c==null?void 0:c.nodes.get(M);if(!V)return[];const J=[];for(const{id:j}of V[D])J.push(j),J.push(...X(j,D));return J}return{element:i,stopWorker:f,getSize:P,render:u}}let po=null,Mr=null,ys=null;async function PM(){const r=await zt(),t=await Me(),{element:e,render:i}=await rd();r.addChild(e),e.alpha=0;const s=await cm(t.runId,async n=>{const o=Mr?"runDataUpdated":"runDataCreated";Mr=n,K.emit(o,Mr),await Yt(),i(n)});K.on("configUpdated",()=>{Mr&&i(Mr)}),ys=e,po=s.stop,ys.once("rendered",()=>GM()),K.on("layoutUpdated",()=>kM()),s.start()}function LM(){po==null||po(),po=null,ys=null,Mr=null}async function Ri(){return Mr||await be("runDataCreated")}function GM(){nd(),me.shared.addOnce(()=>{ys&&(ys.alpha=1)})}async function kM(){if(!ys)return;const r=await Me();ys.once("rendered",()=>{setTimeout(()=>{nd({animate:!0})},r.animationDuration)})}let Ee=null,sd=null;async function FM(){const r=await Ht(),t=await Nc();Ee=new CS({screenHeight:t.clientHeight,screenWidth:t.clientWidth,events:r.renderer.events,passiveWheel:!1}),Ee.zIndex=Od,Ee.drag().pinch().wheel({trackpadPinch:!0}).decelerate({friction:.9}).clampZoom({minWidth:t.clientWidth/2}),Ee.on("moved",()=>{K.emit("viewportMoved",null)}).on("moved-end",()=>{K.emit("viewportMoved",null)}),r.stage.addChild(Ee),K.emit("viewportCreated",Ee),K.on("applicationResized",WM),K.on("scaleUpdated",()=>mo()),BM()}function NM(){Ee=null,sd=null}async function nd({animate:r}={}){const e=(await zt()).getChildByName(Gh);if(!e)throw new Error("Nodes container not found");HM();const{x:i,y:s,width:n,height:o}=e.getLocalBounds();if(!n||!o){OM({animate:r});return}DM({x:i,y:s,width:n,height:o,animate:r})}async function DM({x:r,y:t,width:e,height:i,animate:s}){const n=await Me(),o=await Ut(),a=await zt(),{guideTextSize:h,guideTextTopPadding:l,columnGap:c,rowGap:u,eventTargetSize:d}=o,f=h+l,p=e+c*2,m=i+u*4+f+d,g=a.findFit(p,m);a.animate({position:{x:r+e/2,y:t+i/2+f},scale:Math.min(g,1),time:s?n.animationDuration:0,ease:"easeInOutQuad",removeOnInterrupt:!0,callbackOnComplete:()=>{go(),mo()}})}async function OM({animate:r}){const t=await Ri(),e=await Me(),i=await Ut(),s=await zt(),n=await Ye(),o=new Date(t.start_time),a=t.end_time?new Date(t.end_time):new Date;let h=n(o)-i.columnGap,l=n(a)+i.columnGap;if(h>l){const f=h;h=l,l=f}const c=l-h,u=h+c/2,d=s.findFit(c,0);s.animate({position:{x:u,y:0},scale:d,time:r?e.animationDuration:0,ease:"easeInOutQuad",removeOnInterrupt:!0,callbackOnComplete:()=>{go(),mo()}})}async function zt(){return Ee||await be("viewportCreated")}function e1(r){om(sd,r)||(sd=r,K.emit("viewportDateRangeUpdated",r))}function UM({xOffset:r,yOffset:t}){if(!Ee)return;const{x:e,y:i}=Ee.transform.position;Ee.setTransform(e+r,i+t,Ee.transform.scale.x,Ee.transform.scale.y)}async function BM(){const r=await zt();mo(),r.on("moved",()=>mo())}async function mo(){const r=await i1();r&&e1(r)}async function i1(){const r=await zt(),t=await Ye(),e=t.invert(r.left),i=t.invert(r.right);return e instanceof Date&&i instanceof Date?[e,i]:null}async function XM(r){const t=await i1(),e=await Yt();if(r===void 0||e.isDependency()||om(r,t))return;const i=await zt(),s=await Ye(),[n,o]=r,a=s(n),h=s(o),l=a+(h-a)/2;e1(r),i.fitWidth(h-a,!0),i.moveCenter(l,i.center.y)}async function WM(){const r=await Ht(),t=await zt(),e=await Nc(),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),UM({xOffset:a,yOffset:h})}class yh{constructor(){gd(this,"status","visible");gd(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 Pi=null,ze=null,Li=null,ir=null,ai=null;async function ZM(){const r=await zt(),t=await Ht();Pi=new YT({toggle:"renderable"}),ze=new yh,Li=new yh,ai=new yh,ir=new yh,t.ticker.add(()=>{if(r.dirty){const e=r.scale.x>Nd,i=r.scale.x>Gd,s=r.scale.x>kd,n=r.scale.x>Fd;ai==null||ai.toggle(e),ze==null||ze.toggle(i),Li==null||Li.toggle(s),ir==null||ir.toggle(n),Pi==null||Pi.cull(t.renderer.screen),r.dirty=!1}}),K.emit("cullCreated",Pi),K.emit("labelCullCreated",ze),K.emit("iconCullCreated",ze),K.emit("edgeCullCreated",ai),K.emit("toggleCullCreated",ir)}function VM(){Pi=null,ze==null||ze.clear(),ze=null,Li==null||Li.clear(),Li=null,ai==null||ai.clear(),ai=null,ir==null||ir.clear(),ir=null}async function go(){const r=await zt();r.dirty=!0}function HM(){Pi&&Pi.uncull()}async function r1(){return Pi||await be("cullCreated")}async function KM(){return ai||await be("edgeCullCreated")}async function s1(){return ze||await be("labelCullCreated")}async function n1(){return Li||await be("iconCullCreated")}async function YM(){const r=await Ht(),t=await Ri(),e=await Yt(),{element:i,render:s,update:n}=await jy({isRoot:!0});i.zIndex=Xd;function o(a){if(et.isTemporal()&&!e.disableArtifacts){r.stage.addChild(i),s(a==null?void 0:a.artifacts);return}r.stage.removeChild(i)}t.artifacts&&o(t),K.on("viewportMoved",()=>n()),K.on("runDataCreated",a=>o(a)),K.on("runDataUpdated",a=>o(a)),K.on("configUpdated",()=>o()),K.on("layoutSettingsUpdated",()=>o())}function CP(){}async function zM(){const r=await Ht(),t=await Ri(),{element:e,render:i}=await Jy({isRoot:!0});e.zIndex=Bd,r.stage.addChild(e);function s(n){i(n==null?void 0:n.states)}t.states&&s(t),K.on("runDataUpdated",n=>s(n)),K.on("configUpdated",()=>s()),K.on("layoutSettingsUpdated",()=>s())}function EP(){}async function jM(){const r=await Ht(),t=await zt(),e=await Yt(),i=await Ut(),{inter:s}=await Og(),n=new yt,o=await Ji();n.addChild(o);const a=s("");n.addChild(a);let h=await Ye(),l,c;K.on("scaleUpdated",m=>{h=m,p()}),K.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.guideLineWidth,o.height=r.screen.height,o.tint=i.guideLineColor}function f(m){a.text=c(m),a.fontSize=i.guideTextSize,a.tint=i.guideTextColor,a.position.set(i.guideTextLeftPadding,i.guideTextTopPadding)}function p(){l!==void 0&&(n.position.x=h(l)*t.scale._x+t.worldTransform.tx)}return{element:n,render:u}}class o1 extends Error{constructor(){super("Layout is not temporal")}}function JM(r){return r.toLocaleTimeString()}function a1(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?`${bh.date(r)}
1176
- ${a1(r)}`:a1(r)}const bh={timeBySeconds:JM,timeByMinutesWithDates:QM,date:$M},Qt={seconds:"seconds",minutes:"minutes",date:"date"},yo={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()}},_t={second:1e3,minute:1e3*60,hour:1e3*60*60,day:1e3*60*60*24,week:1e3*60*60*24*7},h1=[{ceiling:_t.second*4,increment:_t.second,labelFormat:Qt.seconds},{ceiling:_t.second*8,increment:_t.second*5,labelFormat:Qt.seconds},{ceiling:_t.second*13,increment:_t.second*10,labelFormat:Qt.seconds},{ceiling:_t.second*20,increment:_t.second*15,labelFormat:Qt.seconds},{ceiling:_t.second*45,increment:_t.second*30,labelFormat:Qt.seconds},{ceiling:_t.minute*4,increment:_t.minute,labelFormat:Qt.minutes},{ceiling:_t.minute*8,increment:_t.minute*5,labelFormat:Qt.minutes},{ceiling:_t.minute*13,increment:_t.minute*10,labelFormat:Qt.minutes},{ceiling:_t.minute*28,increment:_t.minute*15,labelFormat:Qt.minutes},{ceiling:_t.hour*1.24,increment:_t.minute*30,labelFormat:Qt.minutes},{ceiling:_t.hour*3,increment:_t.hour,labelFormat:Qt.minutes},{ceiling:_t.hour*8,increment:_t.hour*2,getAnchor:yo.day,labelFormat:Qt.minutes},{ceiling:_t.hour*13,increment:_t.hour*6,getAnchor:yo.day,labelFormat:Qt.minutes},{ceiling:_t.hour*22,increment:_t.hour*12,getAnchor:yo.day,labelFormat:Qt.minutes},{ceiling:_t.day*4,increment:_t.day,getAnchor:yo.day,labelFormat:Qt.date},{ceiling:_t.week*2,increment:_t.week,getAnchor:yo.week,labelFormat:Qt.date},{ceiling:1/0,increment:_t.week*4,labelFormat:Qt.date}],qM=300;async function tR(){const r=await zt(),t=await Yt(),e=new yt,i=new Map;let s=await Ye();K.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 o1)return;console.error(d)}}async function o(){const d=[];Mu(Uh,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+Dd/r.scale.x);if(!(f instanceof Date)||!(p instanceof Date))throw new o1;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=h1.find(p=>p.ceiling>d)??h1[0];return f.getAnchor||(f.getAnchor=p=>Math.floor(p.getTime()/f.increment)*f.increment),f}function l(d){switch(d){case Qt.minutes:return bh.timeByMinutesWithDates;case Qt.date:return bh.date;default:return bh.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 Mu(Uh,p=>d+f*p)}return{element:e,render:n}}async function eR(){const r=await Ht(),{element:t,render:e}=await tR();r.stage.addChild(t),e(),K.on("viewportDateRangeUpdated",()=>e()),K.on("layoutSettingsUpdated",()=>e()),K.on("configUpdated",()=>e())}function IP(){}const iR=80;async function rR(){const r=await Ht(),t=await zt(),e=await Yt(),i=await Ut(),s=await Ji();let n=await Ye();K.on("scaleUpdated",h=>n=h);function o(){if(!e.isTemporal()){s.visible=!1;return}s.width=i.playheadWidth,s.height=r.stage.height,s.tint=i.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 Ht(),t=await Ri(),{element:e,render:i}=await rR();t.end_time||(r.stage.addChild(e),r.ticker.add(i)),K.on("runDataUpdated",({end_time:s})=>{s&&(r.ticker.remove(i),r.stage.removeChild(e))})}function AP(){}function nR({stage:r,config:t}){OT(),FM(),gM(),eR(),PM(),YM(),bM(),zM(),sR(),EE(),NT(r),HT(t),KC(),ZM(),JC(),RE()}function oR(){K.clear();try{UT(),NM(),yM(),DT(),LM(),xM(),KT(),YC(),AE(),VM(),$C(),PE(),WT()}catch(r){console.error(r)}}q.DEFAULT_EDGE_CONTAINER_NAME=Rd,q.DEFAULT_EDGE_CULLING_THRESHOLD=Nd,q.DEFAULT_EDGE_MINIMUM_BEZIER=Oh,q.DEFAULT_EDGE_POINTS=Dh,q.DEFAULT_GUIDES_COUNT=Uh,q.DEFAULT_GUIDES_MIN_GAP=Dd,q.DEFAULT_HORIZONTAL_SCALE=D1,q.DEFAULT_HORIZONTAL_SCALE_MULTIPLIER=N1,q.DEFAULT_ICON_CULLING_THRESHOLD=kd,q.DEFAULT_LABEL_CULLING_THRESHOLD=Gd,q.DEFAULT_LINEAR_COLUMN_SIZE_PIXELS=Ld,q.DEFAULT_NESTED_GRAPH_BORDER_Z_INDEX=Xh,q.DEFAULT_NESTED_GRAPH_NODES_Z_INDEX=Wh,q.DEFAULT_NESTED_GRAPH_NODE_Z_INDEX=Zh,q.DEFAULT_NODES_CONTAINER_NAME=Gh,q.DEFAULT_NODE_CONTAINER_NAME=Md,q.DEFAULT_NODE_LABEL_Z_INDEX=bn,q.DEFAULT_ROOT_ARTIFACT_Z_INDEX=Xd,q.DEFAULT_ROOT_COLLISION_THROTTLE=Bh,q.DEFAULT_ROOT_EVENT_Z_INDEX=Ud,q.DEFAULT_ROOT_FLOW_STATE_Z_INDEX=Bd,q.DEFAULT_SUBFLOW_ARTIFACT_Z_INDEX=Vd,q.DEFAULT_SUBFLOW_EVENT_Z_INDEX=Wd,q.DEFAULT_SUBFLOW_STATE_Z_INDEX=Zd,q.DEFAULT_TEXTURE_RESOLUTION=Fh,q.DEFAULT_TEXT_RESOLUTION=Nh,q.DEFAULT_TIME_COLUMN_SIZE_PIXELS=kh,q.DEFAULT_TIME_COLUMN_SPAN_SECONDS=Pd,q.DEFAULT_TOGGLE_CULLING_THRESHOLD=Fd,q.DEFAULT_VIEWPORT_Z_INDEX=Od,q.artifactTypeIconMap=Gr,q.artifactTypes=Ie,q.centerViewport=nd,q.emitter=K,q.isArtifactSelection=Sd,q.isArtifactsSelection=Cd,q.isEventSelection=Id,q.isEventsSelection=Ad,q.isHorizontalMode=F1,q.isNodeSelection=Io,q.isRunGraphNodeType=L1,q.isStateSelection=Ed,q.isVerticalMode=k1,q.layout=et,q.resetHorizontalScaleMultiplier=tE,q.runGraphNodeKinds=Lh,q.selectItem=Ai,q.setConfig=nm,q.setDisabledArtifacts=sE,q.setDisabledEdges=rE,q.setDisabledEvents=nE,q.setHorizontalMode=eE,q.setHorizontalScaleMultiplier=Eu,q.setVerticalMode=iE,q.start=nR,q.stateType=G1,q.stop=oR,q.updateViewportFromDateRange=XM,Object.defineProperty(q,Symbol.toStringTag,{value:"Module"})});
1175
+ */var og,Cr,Qs,pu,os,ag,mu,xC=function(){return typeof window<"u"},zi={},as=180/Math.PI,qs=Math.PI/180,tn=Math.atan2,hg=1e8,gu=/([A-Z])/g,_C=/(left|right|width|margin|padding|x)/i,vC=/[\s,\(]\S/,Ei={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},yu=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},wC=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)},TC=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)},SC=function(t,e){var i=e.s+e.c*t;e.set(e.t,e.p,~~(i+(i<0?-.5:.5))+e.u,e)},lg=function(t,e){return e.set(e.t,e.p,t?e.e:e.b,e)},cg=function(t,e){return e.set(e.t,e.p,t!==1?e.b:e.e,e)},CC=function(t,e,i){return t.style[e]=i},EC=function(t,e,i){return t.style.setProperty(e,i)},IC=function(t,e,i){return t._gsap[e]=i},AC=function(t,e,i){return t._gsap.scaleX=t._gsap.scaleY=i},MC=function(t,e,i,s,n){var o=t._gsap;o.scaleX=o.scaleY=i,o.renderTransform(n,o)},RC=function(t,e,i,s,n){var o=t._gsap;o[e]=i,o.renderTransform(n,o)},Ft="transform",Se=Ft+"Origin",PC=function r(t,e){var i=this,s=this.target,n=s.style,o=s._gsap;if(t in zi&&n){if(this.tfm=this.tfm||{},t!=="transform")t=Ei[t]||t,~t.indexOf(",")?t.split(",").forEach(function(a){return i.tfm[a]=ji(s,a)}):this.tfm[t]=o.x?o[t]:ji(s,t),t===Se&&(this.tfm.zOrigin=o.zOrigin);else return Ei.transform.split(",").forEach(function(a){return r.call(i,a,e)});if(this.props.indexOf(Ft)>=0)return;o.svg&&(this.svgo=s.getAttribute("data-svg-origin"),this.props.push(Se,e,"")),t=Ft}(n||e)&&this.props.push(t,e,n[t])},ug=function(t){t.translate&&(t.removeProperty("translate"),t.removeProperty("scale"),t.removeProperty("rotate"))},LC=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(gu,"-$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=mu(),(!n||!n.isStart)&&!i[Ft]&&(ug(i),s.zOrigin&&i[Se]&&(i[Se]+=" "+s.zOrigin+"px",s.zOrigin=0,s.renderTransform()),s.uncache=1)}},dg=function(t,e){var i={target:t,props:[],revert:LC,save:PC};return t._gsap||Te.core.getCache(t),e&&e.split(",").forEach(function(s){return i.save(s)}),i},fg,bu=function(t,e){var i=Cr.createElementNS?Cr.createElementNS((e||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),t):Cr.createElement(t);return i&&i.style?i:Cr.createElement(t)},Ii=function r(t,e,i){var s=getComputedStyle(t);return s[e]||s.getPropertyValue(e.replace(gu,"-$1").toLowerCase())||s.getPropertyValue(e)||!i&&r(t,en(e)||e,1)||""},pg="O,Moz,ms,Ms,Webkit".split(","),en=function(t,e,i){var s=e||os,n=s.style,o=5;if(t in n&&!i)return t;for(t=t.charAt(0).toUpperCase()+t.substr(1);o--&&!(pg[o]+t in n););return o<0?null:(o===3?"ms":o>=0?pg[o]:"")+t},xu=function(){xC()&&window.document&&(og=window,Cr=og.document,Qs=Cr.documentElement,os=bu("div")||{style:{}},bu("div"),Ft=en(Ft),Se=Ft+"Origin",os.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",fg=!!en("perspective"),mu=Te.core.reverting,pu=1)},_u=function r(t){var e=bu("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(Qs.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)),Qs.removeChild(e),this.style.cssText=n,o},mg=function(t,e){for(var i=e.length;i--;)if(t.hasAttribute(e[i]))return t.getAttribute(e[i])},gg=function(t){var e;try{e=t.getBBox()}catch{e=_u.call(t,!0)}return e&&(e.width||e.height)||t.getBBox===_u||(e=_u.call(t,!0)),e&&!e.width&&!e.x&&!e.y?{x:+mg(t,["x","cx","x1"])||0,y:+mg(t,["y","cy","y1"])||0,width:0,height:0}:e},yg=function(t){return!!(t.getCTM&&(!t.parentNode||t.ownerSVGElement)&&gg(t))},hs=function(t,e){if(e){var i=t.style,s;e in zi&&e!==Se&&(e=Ft),i.removeProperty?(s=e.substr(0,2),(s==="ms"||e.substr(0,6)==="webkit")&&(e="-"+e),i.removeProperty(s==="--"?e:e.replace(gu,"-$1").toLowerCase())):i.removeAttribute(e)}},Er=function(t,e,i,s,n,o){var a=new we(t._pt,e,i,0,1,o?cg:lg);return t._pt=a,a.b=s,a.e=n,t._props.push(i),a},bg={deg:1,rad:1,turn:1},GC={grid:1,flex:1},Ir=function r(t,e,i,s){var n=parseFloat(i)||0,o=(i+"").trim().substr((n+"").length)||"px",a=os.style,h=_C.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||bg[s]||bg[o])return n;if(o!=="px"&&!d&&(n=r(t,e,i,"px")),y=t.getCTM&&yg(t),(f||o==="%")&&(zi[e]||~e.indexOf("adius")))return p=y?t.getBBox()[h?"width":"height"]:t[c],Wt(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===Cr||!m.appendChild)&&(m=Cr.body),g=m._gsap,g&&f&&g.width&&h&&g.time===ke.time&&!g.uncache)return Wt(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:hs(t,e)}else(f||o==="%")&&!GC[Ii(m,"display")]&&(a.position=Ii(t,"position")),m===t&&(a.position="static"),m.appendChild(os),p=os[c],m.removeChild(os),a.position="absolute";return h&&f&&(g=ts(m),g.time=ke.time,g.width=m[c]),Wt(d?p*n/u:p&&n?u/p*n:0)},ji=function(t,e,i,s){var n;return pu||xu(),e in Ei&&e!=="transform"&&(e=Ei[e],~e.indexOf(",")&&(e=e.split(",")[0])),zi[e]&&e!=="transform"?(n=qn(t,s),n=e!=="transformOrigin"?n[e]:n.svg?n.origin:ja(Ii(t,Se))+" "+n.zOrigin+"px"):(n=t.style[e],(!n||n==="auto"||s||~(n+"").indexOf("calc("))&&(n=za[e]&&za[e](t,e,i)||Ii(t,e)||wm(t,e)||(e==="opacity"?1:0))),i&&!~(n+"").trim().indexOf(" ")?Ir(t,e,n,i)+i:n},kC=function(t,e,i,s){if(!i||i==="none"){var n=en(e,t,1),o=n&&Ii(t,n,1);o&&o!==i?(e=n,i=o):e==="borderColor"&&(i=Ii(t,"borderTopColor"))}var a=new we(this._pt,t.style,e,0,1,ig),h=0,l=0,c,u,d,f,p,m,g,y,x,b,_,v;if(a.b=i,a.e=s,i+="",s+="",s==="auto"&&(m=t.style[e],t.style[e]=s,s=Ii(t,e)||s,m?t.style[e]=m:hs(t,e)),c=[i,s],Km(c),i=c[0],s=c[1],d=i.match(Ks)||[],v=s.match(Ks)||[],v.length){for(;u=Ks.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,_=m.substr((f+"").length),g.charAt(1)==="="&&(g=Ys(f,g)+_),y=parseFloat(g),b=g.substr((y+"").length),h=Ks.lastIndex-b.length,b||(b=b||Re.units[e]||_,h===s.length&&(s+=b,a.e+=b)),_!==b&&(f=Ir(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"?cg:lg;return mm.test(s)&&(a.e=0),this._pt=a,a},xg={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},FC=function(t){var e=t.split(" "),i=e[0],s=e[1]||"50%";return(i==="top"||i==="bottom"||s==="left"||s==="right")&&(t=i,i=s,s=t),e[0]=xg[i]||i,e[1]=xg[s]||s,e.join(" ")},NC=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],zi[a]&&(h=1,a=a==="transformOrigin"?Se:Ft),hs(i,a);h&&(hs(i,Ft),o&&(o.svg&&i.removeAttribute("transform"),qn(i,1),o.uncache=1,ug(s)))}},za={clearProps:function(t,e,i,s,n){if(n.data!=="isFromStart"){var o=t._pt=new we(t._pt,e,i,0,0,NC);return o.u=s,o.pr=-10,o.tween=n,t._props.push(i),1}}},Qn=[1,0,0,1,0,0],_g={},vg=function(t){return t==="matrix(1, 0, 0, 1, 0, 0)"||t==="none"||!t},wg=function(t){var e=Ii(t,Ft);return vg(e)?Qn:e.substr(7).match(pm).map(Wt)},vu=function(t,e){var i=t._gsap||ts(t),s=t.style,n=wg(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"?Qn:n):(n===Qn&&!t.offsetParent&&t!==Qs&&!i.svg&&(h=s.display,s.display="block",o=t.parentNode,(!o||!t.offsetParent)&&(l=1,a=t.nextElementSibling,Qs.appendChild(t)),n=wg(t),h?s.display=h:hs(t,"display"),l&&(a?o.insertBefore(t,a):o?o.appendChild(t):Qs.removeChild(t))),e&&n.length>6?[n[0],n[1],n[4],n[5],n[12],n[13]]:n)},wu=function(t,e,i,s,n,o){var a=t._gsap,h=n||vu(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(" "),_=parseFloat(b[0])||0,v=parseFloat(b[1])||0,T,C,E,I;i?h!==Qn&&(C=f*g-p*m)&&(E=_*(g/C)+v*(-m/C)+(m*x-g*y)/C,I=_*(-p/C)+v*(f/C)-(f*x-p*y)/C,_=E,v=I):(T=gg(t),_=T.x+(~b[0].indexOf("%")?_/100*T.width:_),v=T.y+(~(b[1]||b[0]).indexOf("%")?v/100*T.height:v)),s||s!==!1&&a.smooth?(y=_-l,x=v-c,a.xOffset=u+(y*f+x*m)-y,a.yOffset=d+(y*p+x*g)-x):a.xOffset=a.yOffset=0,a.xOrigin=_,a.yOrigin=v,a.smooth=!!s,a.origin=e,a.originIsAbsolute=!!i,t.style[Se]="0px 0px",o&&(Er(o,a,"xOrigin",l,_),Er(o,a,"yOrigin",c,v),Er(o,a,"xOffset",u,a.xOffset),Er(o,a,"yOffset",d,a.yOffset)),t.setAttribute("data-svg-origin",_+" "+v)},qn=function(t,e){var i=t._gsap||new Jm(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=Ii(t,Se)||"0",c,u,d,f,p,m,g,y,x,b,_,v,T,C,E,I,k,L,P,S,R,F,O,U,Z,st,X,M,D,V,Q,j;return c=u=d=m=g=y=x=b=_=0,f=p=1,i.svg=!!(t.getCTM&&yg(t)),h.translate&&((h.translate!=="none"||h.scale!=="none"||h.rotate!=="none")&&(s[Ft]=(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[Ft]!=="none"?h[Ft]:"")),s.scale=s.rotate=s.translate="none"),C=vu(t,i.svg),i.svg&&(i.uncache?(Z=t.getBBox(),l=i.xOrigin-Z.x+"px "+(i.yOrigin-Z.y)+"px",U=""):U=!e&&t.getAttribute("data-svg-origin"),wu(t,U||l,!!U||i.originIsAbsolute,i.smooth!==!1,C)),v=i.xOrigin||0,T=i.yOrigin||0,C!==Qn&&(L=C[0],P=C[1],S=C[2],R=C[3],c=F=C[4],u=O=C[5],C.length===6?(f=Math.sqrt(L*L+P*P),p=Math.sqrt(R*R+S*S),m=L||P?tn(P,L)*as:0,x=S||R?tn(S,R)*as+m:0,x&&(p*=Math.abs(Math.cos(x*qs))),i.svg&&(c-=v-(v*L+T*S),u-=T-(v*P+T*R))):(j=C[6],V=C[7],X=C[8],M=C[9],D=C[10],Q=C[11],c=C[12],u=C[13],d=C[14],E=tn(j,D),g=E*as,E&&(I=Math.cos(-E),k=Math.sin(-E),U=F*I+X*k,Z=O*I+M*k,st=j*I+D*k,X=F*-k+X*I,M=O*-k+M*I,D=j*-k+D*I,Q=V*-k+Q*I,F=U,O=Z,j=st),E=tn(-S,D),y=E*as,E&&(I=Math.cos(-E),k=Math.sin(-E),U=L*I-X*k,Z=P*I-M*k,st=S*I-D*k,Q=R*k+Q*I,L=U,P=Z,S=st),E=tn(P,L),m=E*as,E&&(I=Math.cos(E),k=Math.sin(E),U=L*I+P*k,Z=F*I+O*k,P=P*I-L*k,O=O*I-F*k,L=U,F=Z),g&&Math.abs(g)+Math.abs(m)>359.9&&(g=m=0,y=180-y),f=Wt(Math.sqrt(L*L+P*P+S*S)),p=Wt(Math.sqrt(O*O+j*j)),E=tn(F,O),x=Math.abs(E)>2e-4?E*as:0,_=Q?1/(Q<0?-Q:Q):0),i.svg&&(U=t.getAttribute("transform"),i.forceCSS=t.setAttribute("transform","")||!vg(Ii(t,Ft)),U&&t.setAttribute("transform",U))),Math.abs(x)>90&&Math.abs(x)<270&&(n?(f*=-1,x+=m<=0?180:-180,m+=m<=0?180:-180):(p*=-1,x+=x<=0?180:-180)),e=e||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=Wt(f),i.scaleY=Wt(p),i.rotation=Wt(m)+a,i.rotationX=Wt(g)+a,i.rotationY=Wt(y)+a,i.skewX=x+a,i.skewY=b+a,i.transformPerspective=_+o,(i.zOrigin=parseFloat(l.split(" ")[2])||!e&&i.zOrigin||0)&&(s[Se]=ja(l)),i.xOffset=i.yOffset=0,i.force3D=Re.force3D,i.renderTransform=i.svg?OC:fg?Tg:DC,i.uncache=0,i},ja=function(t){return(t=t.split(" "))[0]+" "+t[1]},Tu=function(t,e,i){var s=de(e);return Wt(parseFloat(e)+parseFloat(Ir(t,"x",i+"px",s)))+s},DC=function(t,e){e.z="0px",e.rotationY=e.rotationX="0deg",e.force3D=0,Tg(t,e)},ls="0deg",to="0px",cs=") ",Tg=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=y==="auto"&&t&&t!==1||y===!0;if(b&&(u!==ls||c!==ls)){var T=parseFloat(c)*qs,C=Math.sin(T),E=Math.cos(T),I;T=parseFloat(u)*qs,I=Math.cos(T),o=Tu(x,o,C*I*-b),a=Tu(x,a,-Math.sin(T)*-b),h=Tu(x,h,E*I*-b+b)}g!==to&&(_+="perspective("+g+cs),(s||n)&&(_+="translate("+s+"%, "+n+"%) "),(v||o!==to||a!==to||h!==to)&&(_+=h!==to||v?"translate3d("+o+", "+a+", "+h+") ":"translate("+o+", "+a+cs),l!==ls&&(_+="rotate("+l+cs),c!==ls&&(_+="rotateY("+c+cs),u!==ls&&(_+="rotateX("+u+cs),(d!==ls||f!==ls)&&(_+="skew("+d+", "+f+cs),(p!==1||m!==1)&&(_+="scale("+p+", "+m+cs),x.style[Ft]=_||"translate(0, 0)"},OC=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),_=parseFloat(a),v,T,C,E,I;h=parseFloat(h),l=parseFloat(l),c=parseFloat(c),c&&(c=parseFloat(c),l+=c,h+=c),h||l?(h*=qs,l*=qs,v=Math.cos(h)*u,T=Math.sin(h)*u,C=Math.sin(h-l)*-d,E=Math.cos(h-l)*d,l&&(c*=qs,I=Math.tan(l-c),I=Math.sqrt(1+I*I),C*=I,E*=I,c&&(I=Math.tan(c),I=Math.sqrt(1+I*I),v*=I,T*=I)),v=Wt(v),T=Wt(T),C=Wt(C),E=Wt(E)):(v=u,E=d,T=C=0),(b&&!~(o+"").indexOf("px")||_&&!~(a+"").indexOf("px"))&&(b=Ir(f,"x",o,"px"),_=Ir(f,"y",a,"px")),(p||m||g||y)&&(b=Wt(b+p-(p*v+m*C)+g),_=Wt(_+m-(p*T+m*E)+y)),(s||n)&&(I=f.getBBox(),b=Wt(b+s/100*I.width),_=Wt(_+n/100*I.height)),I="matrix("+v+","+T+","+C+","+E+","+b+","+_+")",f.setAttribute("transform",I),x&&(f.style[Ft]=I)},BC=function(t,e,i,s,n){var o=360,a=ie(n),h=parseFloat(n)*(a&&~n.indexOf("rad")?as: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*hg)%o-~~(l/o)*o:u==="ccw"&&l>0&&(l=(l-o*hg)%o-~~(l/o)*o)),t._pt=d=new we(t._pt,e,i,s,l,wC),d.e=c,d.u="deg",t._props.push(i),d},Sg=function(t,e){for(var i in e)t[i]=e[i];return t},UC=function(t,e,i){var s=Sg({},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[Ft]=e,a=qn(i,1),hs(i,Ft),i.setAttribute("transform",l)):(l=getComputedStyle(i)[Ft],o[Ft]=e,a=qn(i,1),o[Ft]=l);for(h in zi)l=s[h],c=a[h],l!==c&&n.indexOf(h)<0&&(f=de(l),p=de(c),u=f!==p?Ir(i,h,l,p):parseFloat(l),d=parseFloat(c),t._pt=new we(t._pt,a,h,u,d-u,yu),t._pt.u=p||0,t._props.push(h));Sg(a,s)};ve("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});za[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 ji(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 Cg={name:"css",register:xu,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,T,C,E;pu||xu(),this.styles=this.styles||dg(t),E=this.styles.props,this.tween=i;for(m in e)if(m!=="autoRound"&&(c=e[m],!(Le[m]&&$m(m,e,i,s,t,n)))){if(f=typeof c,p=za[m],f==="function"&&(c=c.call(i,s,t,n),f=typeof c),f==="string"&&~c.indexOf("random(")&&(c=Kn(c)),p)p(this,t,m,c,i)&&(C=1);else if(m.substr(0,2)==="--")l=(getComputedStyle(t).getPropertyValue(m)+"").trim(),c+="",Tr.lastIndex=0,Tr.test(l)||(g=de(l),y=de(c)),y?g!==y&&(l=Ir(t,m,l,y)+y):g&&(c+=g),this.add(a,"setProperty",l,c,s,n,0,0,m),o.push(m),E.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],ie(l)&&~l.indexOf("random(")&&(l=Kn(l)),de(l+"")||l==="auto"||(l+=Re.units[m]||de(ji(t,m))||""),(l+"").charAt(1)==="="&&(l=ji(t,m))):l=ji(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 Ei&&(m==="autoAlpha"&&(d===1&&ji(t,"visibility")==="hidden"&&u&&(d=0),E.push("visibility",0,a.visibility),Er(this,a,"visibility",d?"inherit":"hidden",u?"inherit":"hidden",!u)),m!=="scale"&&m!=="transform"&&(m=Ei[m],~m.indexOf(",")&&(m=m.split(",")[0]))),b=m in zi,b){if(this.styles.save(m),_||(v=t._gsap,v.renderTransform&&!e.parseTransform||qn(t,e.parseTransform),T=e.smoothOrigin!==!1&&v.smooth,_=this._pt=new we(this._pt,a,Ft,0,1,v.renderTransform,v,0,-1),_.dep=1),m==="scale")this._pt=new we(this._pt,v,"scaleY",v.scaleY,(x?Ys(v.scaleY,x+u):u)-v.scaleY||0,yu),this._pt.u=0,o.push("scaleY",m),m+="X";else if(m==="transformOrigin"){E.push(Se,0,a[Se]),c=FC(c),v.svg?wu(t,c,0,T,0,this):(y=parseFloat(c.split(" ")[2])||0,y!==v.zOrigin&&Er(this,v,"zOrigin",v.zOrigin,y),Er(this,a,m,ja(l),ja(c)));continue}else if(m==="svgOrigin"){wu(t,c,1,T,0,this);continue}else if(m in _g){BC(this,v,m,d,x?Ys(d,x+c):c);continue}else if(m==="smoothOrigin"){Er(this,v,"smooth",v.smooth,c);continue}else if(m==="force3D"){v[m]=c;continue}else if(m==="transform"){UC(this,c,t);continue}}else m in a||(m=en(m)||m);if(b||(u||u===0)&&(d||d===0)&&!vC.test(c)&&m in a)g=(l+"").substr((d+"").length),u||(u=0),y=de(c)||(m in Re.units?Re.units[m]:g),g!==y&&(d=Ir(t,m,l,y)),this._pt=new we(this._pt,b?v:a,m,d,(x?Ys(d,x+u):u)-d,!b&&(y==="px"||m==="zIndex")&&e.autoRound!==!1?SC:yu),this._pt.u=y||0,g!==y&&y!=="%"&&(this._pt.b=l,this._pt.r=TC);else if(m in a)kC.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"){Hc(m,c);continue}b||(m in a?E.push(m,0,a[m]):E.push(m,1,l||t[m])),o.push(m)}}C&&rg(this)},render:function(t,e){if(e.tween._time||!mu())for(var i=e._pt;i;)i.r(t,i.d),i=i._next;else e.styles.revert()},get:ji,aliases:Ei,getSetter:function(t,e,i){var s=Ei[e];return s&&s.indexOf(",")<0&&(e=s),e in zi&&e!==Se&&(t._gsap.x||ji(t,"x"))?i&&ag===i?e==="scale"?AC:IC:(ag=i||{})&&(e==="scale"?MC:RC):t.style&&!Bc(t.style[e])?CC:~e.indexOf("-")?EC:lu(t,e)},core:{_removeProperty:hs,_getMatrix:vu}};Te.utils.checkPrefix=en,Te.core.getStyleSaver=dg,function(r,t,e,i){var s=ve(r+","+t+","+e,function(n){zi[n]=1});ve(t,function(n){Re.units[n]="deg",_g[n]=1}),Ei[s[13]]=r+","+t,ve(i,function(n){var o=n.split(":");Ei[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"),ve("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(r){Re.units[r]="px"}),Te.registerPlugin(Cg);var Eg=Te.registerPlugin(Cg)||Te;Eg.core.Tween;function Ig(r,t){return typeof r=="function"?r(t):r&&typeof r=="object"&&lm in r?r[lm](t):r instanceof Date?new r.constructor(t):new Date(t)}function Su(r,t){return Ig(r,r)}function XC(r,t,e){return Ig(r,+Su(r)+t)}function WC(r,t,e){return XC(r,t*1e3)}function ZC(r){return t=>{const e=Math.trunc,i=e(t);return i===0?0:i}}function Ag(r,t){return+Su(r)-+Su(t)}function VC(r,t,e){const i=Ag(r,t)/1e3;return ZC()(i)}const HC=r=>({rowGap:24,columnGap:32,textDefault:r==="dark"?"#ffffff":"#161618",textInverse:r==="dark"?"#161618":"#ffffff",selectedBorderColor:r==="dark"?"#3fa2c3":"#297f9c",selectedBorderWidth:2,selectedBorderOffset:4,selectedBorderRadius:9,nodesPadding:16,nodeHeight:32,nodePadding:4,nodeRadius:6,nodeBorderRadius:9,nodeToggleSize:28,nodeToggleBgColor:"#35363C",nodeToggleBorderRadius:6,nodeToggleBorderColor:r==="dark"?"#4d4f56":"#bbbec9",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:r==="dark"?"#adadad":"#737682",guideLineWidth:1,guideLineColor:r==="dark"?"#4d4f56":"#bbbec9",guideTextTopPadding:8,guideTextLeftPadding:8,guideTextSize:12,guideTextColor:r==="dark"?"#adadad":"#737682",playheadWidth:2,playheadColor:"#6272FF",node:()=>({background:"#ffffff"}),state:()=>({background:"#ffffff"})});let us=null;async function KC(){const r=await Me();us=Mg(r),K.emit("stylesCreated",us),K.on("configUpdated",t=>{us=Mg(t),K.emit("stylesUpdated",us)})}function YC(){us=null}async function Bt(){return us||await be("stylesCreated")}function Mg(r){var t;return{...HC(r.theme),...(t=r.styles)==null?void 0:t.call(r,r.theme)}}function zC(r){let t=0;for(const[,{children:e}]of r)t+=e.length;return t}function jC({start_time:r,end_time:t,nodes:e},i,s){const n=Math.max(VC(t??new Date,r),1),o=i.nodeHeight+i.rowGap;return(e.size>0?e.size*o*.5:o*4)*s/(n*kh)}async function JC(){const r=await Ri(),t=await Me(),e=await Bt(),i=await Ht(),s=i.view.width/i.view.height,n=jC(r,e,s);Eu(n,!0),r.nodes.size>t.disableAnimationsThreshold&&(et.disableAnimations=!0),zC(r.nodes)>t.disableEdgesThreshold&&(et.disableEdges=!0)}function $C(){et.horizontal="temporal",et.vertical="nearest-parent",et.horizontalScaleMultiplierDefault=0,et.horizontalScaleMultiplier=0,et.disableAnimations=!1,et.disableGuides=!1,et.disableEdges=!1,et.disableArtifacts=!1,et.disableEvents=!1}const et={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 Yt(){return Iu()?et:await be("layoutSettingsCreated")}function Cu(){return et.isDependency()?Ld:kh*et.horizontalScaleMultiplier}function QC(){return[0,Cu()]}function qC(r){if(et.isDependency())return[0,1];const t=r,e=WC(t,Pd);return[t,e]}function Eu(r,t=!1){if(et.horizontalScaleMultiplier===r)return;const e=rn();et.horizontalScaleMultiplier=r,t&&(et.horizontalScaleMultiplierDefault=r),e()}function tE(){Eu(et.horizontalScaleMultiplierDefault)}function eE(r){if(et.horizontal===r)return;const t=rn();et.horizontal=r,et.disableGuides=et.isDependency()||et.isLeftAligned(),t()}function iE(r){if(et.vertical===r)return;const t=rn();et.vertical=r,t()}function rE(r){if(et.disableEdges===r)return;const t=rn();et.disableEdges=r,t()}function sE(r){if(et.disableArtifacts===r)return;const t=rn();et.disableArtifacts=r,t()}function nE(r){if(et.disableEvents===r)return;const t=rn();et.disableEvents=r,t()}function rn(){const r=Iu()?"layoutSettingsUpdated":"layoutSettingsCreated",{horizontal:t,vertical:e}=et;return()=>{Iu()&&K.emit(r,et),(t!==et.horizontal||e!==et.vertical)&&K.emit("layoutUpdated")}}function Iu(){return et.horizontalScaleMultiplier!==0}async function Rg(){const r=await Yt(),t=await Me();function e(i,s,n){const a=r.disableAnimations||n?0:t.animationDuration/1e3;return Eg.to(i,{...s,duration:a,ease:"power1.out",onUpdate:()=>{go()}})}return{animate:e}}async function oE({size:r,stroke:t=1,radius:e=0}){const i=await Ht(),s=new mr;return s.lineStyle(t,"#fff",1,0),s.drawRoundedRect(0,0,r*2,r*2,e),i.renderer.generateTexture(s,{region:new ct(0,0,r,r),resolution:10})}async function eo(r){return await Bn(oE,[r])}var Ja=(r=>(r[r.Up=0]="Up",r[r.Down=180]="Down",r[r.Left=270]="Left",r[r.Right=90]="Right",r))(Ja||{});function Pg(){const r=new Vt;async function t(e){const{rotate:i=0}=e,s={size:e.size,radius:e.radius,stroke:e.stroke},n=await eo(s);return r.texture=n,r.anchor.set(.5,.5),r.angle=45+i,r}return{element:r,render:t}}async function aE(){const r=await Ht(),t=new mr;return t.beginFill("#fff"),t.drawRect(0,0,1,1),t.endFill(),r.renderer.generateTexture(t,{wrapMode:ui.REPEAT})}async function Au(){return await Bn(aE,[])}function Mu(r,t){return Array.from({length:r},(e,i)=>t(i))}const hE=8,lE=2;async function cE(){const r=await Bt(),t=await r1(),e=await KM(),{animate:i}=await Rg(),s=new gt,{element:n,render:o}=await Pg(),a=await Au(),h=Mu(Dh,()=>new at),l=new sT(a,h);let c=!1;s.name=Rd,s.addChild(n),s.addChild(l),t.addAll([n,l]),e.add(s);async function u(){return await o({size:10,rotate:Ja.Right}),n.tint=r.edgeColor,l.tint=r.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:_}=g[y];i(x,{x:b,y:_},!c)}i(s,{x:p.x,y:p.y},!c),i(n,{x:m.x-hE,y:m.y},!c),c=!0}function f({x:p,y:m}){const g=[],y={x:0,y:0},x={x:p-lE,y:m},b={x:Lg(y.x,{source:y,target:x}),y:y.y},_={x:Lg(x.x,{source:y,target:x},!0),y:x.y};for(const[v]of h.entries()){if(v===h.length-1){g[v]=x;continue}const T=uE(v,{source:y,target:x,sourceBezier:b,targetBezier:_});g[v]=T}return g}return{element:s,render:u,setPosition:d}}function Lg(r,{source:t,target:e},i){const s=(e.x-t.x)/2;return r+(s>Oh?s:Oh)*(i?-1:1)}function uE(r,t){const e=r/Dh,{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 dE({height:r,radius:t}){const e=await Ht(),i=new mr;return i.beginFill("#fff"),i.drawRoundedRect(0,0,t*2,r,t),i.endFill(),e.renderer.generateTexture(i,{region:new ct(0,0,t,r),resolution:Fh})}async function fE(r){return await Bn(dE,[r])}function pE(){const r=new Vt,t=new Vt;async function e(i){const s=await fE(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 Ji(){const r=await Au();return new Vt(r)}async function Ru(){const r=new gt,t=await Ji(),{left:e,right:i,render:s}=await pE();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 $a(){const r=new gt,t=new Vt,e=new Vt,i=new Vt,s=new Vt,n=new Vt,o=new Vt,a=new Vt,h=new Vt;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,_=typeof m=="number",v={topLeft:c(_?m:m[0],x,b),topRight:c(_?m:m[1],x,b),bottomLeft:c(_?m:m[2],x,b),bottomRight:c(_?m:m[3],x,b)};return await u({width:x,height:b,stroke:y,cornerSizes:v}),await d({width:x,height:b,stroke:y,cornerSizes:v}),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:_,bottomRight:v}=y,[T,C,E,I]=await Promise.all([eo({...x,stroke:g}),eo({...b,stroke:g}),eo({..._,stroke:g}),eo({...v,stroke:g})]);t.texture=T,e.texture=C,i.texture=I,s.texture=E,t.position.set(0,0),e.position.set(p-b.size,0),i.position.set(0,m-_.size),s.position.set(p-v.size,m-v.size)}async function d({width:p,height:m,stroke:g,cornerSizes:y}){const x=await Au(),{topLeft:b,topRight:_,bottomLeft:v,bottomRight:T}=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-v.size,0),n.width=g,o.position.set(p-g,_.size),o.height=Math.max(m-_.size-T.size,0),o.width=g,a.position.set(b.size,0),a.width=Math.max(p-b.size-_.size,0),a.height=g,h.position.set(v.size,m-g),h.width=Math.max(p-v.size-T.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 Qa(){const r=await Bt(),t=new gt,{element:e,render:i}=await $a();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;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 mE(){const r=await Bt(),t=new gt,{element:e,render:i}=await Ru(),{element:s,render:n}=await Qa();t.addChild(e),t.addChild(s);async function o({selected:a,width:h,height:l}){const{artifactBgColor:c,artifactBorderRadius:u}=r,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}}var gE=Object.defineProperty,yE=(r,t,e)=>t in r?gE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,io=(r,t,e)=>(yE(r,typeof t!="symbol"?t+"":t,e),e);class bE extends gt{constructor(t){super(),io(this,"_progress",0),io(this,"options"),io(this,"bgCircle",new mr),io(this,"fillCircle",new mr),io(this,"innerView",new gt),this.options=t,this.addChild(this.innerView),this.innerView.addChild(this.bgCircle,this.fillCircle),this.addBackground(),t.value&&(this.progress=t.value)}addBackground(){const{backgroundColor:t,lineWidth:e,radius:i,backgroundAlpha:s}=this.options;let n=1;s>0&&(n=s),t===void 0&&(n=1e-6),this.bgCircle.lineStyle({width:e,color:t,alpha:n}).drawCircle(0,0,i)}set progress(t){t>100&&(t=100),t<0&&(t=0),this._progress=t;const{lineWidth:e,radius:i,fillColor:s,fillAlpha:n,cap:o}=this.options;if(t===0&&n===0){this.fillCircle.clear();return}const a=0,h=360/100*t;this.fillCircle.clear().lineStyle({width:e,color:s,cap:o,alpha:n}).arc(0,0,i,(-90+a)*Vl,(-90+a+h)*Vl)}get progress(){return this._progress}}async function xE(r={}){const t=await n1(),e=new bE({fillColor:16777215,cullAtZoomThreshold:!0,backgroundColor:0,backgroundAlpha:1,value:50,cap:"round",fillAlpha:1,lineWidth:20,radius:50,...r});r.cullAtZoomThreshold&&t.add(e);function i(s){e.progress=s.value??0;const n=(s.radius+s.lineWidth)*2;return e.width=n,e.height=n,e.position.set(n/2),e}return{element:e,render:i}}const _E=Object.freeze(Object.defineProperty({__proto__:null,Artifact:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_7_19)'%3e%3cmask%20id='mask0_7_19'%20style='mask-type:luminance'%20maskUnits='userSpaceOnUse'%20x='-1'%20y='-1'%20width='22'%20height='22'%3e%3cpath%20d='M20.9091%20-0.909058H-0.909088V20.9091H20.9091V-0.909058Z'%20fill='white'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_7_19)'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M0%2010C0%204.47715%204.47715%200%2010%200C15.5228%200%2020%204.47715%2020%2010C20%2015.5228%2015.5228%2020%2010%2020C4.47715%2020%200%2015.5228%200%2010ZM10%201.81818C5.4813%201.81818%201.81818%205.4813%201.81818%2010C1.81818%2014.5187%205.48131%2018.1818%2010%2018.1818C14.5187%2018.1818%2018.1818%2014.5187%2018.1818%2010C18.1818%205.48131%2014.5187%201.81818%2010%201.81818Z'%20fill='white'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M5.68182%205.63634C5.68182%205.15937%206.06849%204.77271%206.54546%204.77271H13.4546C13.9316%204.77271%2014.3182%205.15937%2014.3182%205.63634V14.2512C14.3182%2014.8932%2013.6426%2015.3108%2013.0683%2015.0237L11.8182%2014.3986L10.3863%2015.1146C10.1431%2015.2362%209.85691%2015.2362%209.61373%2015.1146L8.18182%2014.3986L6.93169%2015.0237C6.35746%2015.3108%205.68182%2014.8932%205.68182%2014.2512V5.63634ZM7.04546%206.13634V13.4423L7.7956%2013.0672C8.03873%2012.9456%208.32491%2012.9456%208.5681%2013.0672L10%2013.7832L11.4319%2013.0672C11.6751%2012.9456%2011.9613%2012.9456%2012.2045%2013.0672L12.9546%2013.4423V6.13634H7.04546Z'%20fill='white'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M6.36365%208.63631C6.36365%208.38531%206.56716%208.18176%206.81819%208.18176H6.98566C7.23669%208.18176%207.4402%208.38531%207.4402%208.63631C7.4402%208.88731%207.23669%209.09085%206.98566%209.09085H6.81819C6.56716%209.09085%206.36365%208.88731%206.36365%208.63631ZM7.78709%208.63631C7.78709%208.38531%207.9906%208.18176%208.24165%208.18176H8.57656C8.82765%208.18176%209.0311%208.38531%209.0311%208.63631C9.0311%208.88731%208.82765%209.09085%208.57656%209.09085H8.24165C7.9906%209.09085%207.78709%208.88731%207.78709%208.63631ZM9.37801%208.63631C9.37801%208.38531%209.58147%208.18176%209.83256%208.18176H10.1675C10.4186%208.18176%2010.622%208.38531%2010.622%208.63631C10.622%208.88731%2010.4186%209.09085%2010.1675%209.09085H9.83256C9.58147%209.09085%209.37801%208.88731%209.37801%208.63631ZM10.9689%208.63631C10.9689%208.38531%2011.1724%208.18176%2011.4235%208.18176H11.7584C12.0095%208.18176%2012.2129%208.38531%2012.2129%208.63631C12.2129%208.88731%2012.0095%209.09085%2011.7584%209.09085H11.4235C11.1724%209.09085%2010.9689%208.88731%2010.9689%208.63631ZM12.5598%208.63631C12.5598%208.38531%2012.7633%208.18176%2013.0144%208.18176H13.1818C13.4328%208.18176%2013.6364%208.38531%2013.6364%208.63631C13.6364%208.88731%2013.4328%209.09085%2013.1818%209.09085H13.0144C12.7633%209.09085%2012.5598%208.88731%2012.5598%208.63631Z'%20fill='white'/%3e%3c/g%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_7_19'%3e%3crect%20width='20'%20height='20'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",ArtifactImage:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_7_36)'%3e%3cmask%20id='mask0_7_36'%20style='mask-type:luminance'%20maskUnits='userSpaceOnUse'%20x='-1'%20y='-1'%20width='22'%20height='22'%3e%3cpath%20d='M20.9091%20-0.909058H-0.909088V20.9091H20.9091V-0.909058Z'%20fill='white'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_7_36)'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M0%2010C0%204.47715%204.47715%200%2010%200C15.5228%200%2020%204.47715%2020%2010C20%2015.5228%2015.5228%2020%2010%2020C4.47715%2020%200%2015.5228%200%2010ZM10%201.81818C5.4813%201.81818%201.81818%205.4813%201.81818%2010C1.81818%2014.5187%205.48131%2018.1818%2010%2018.1818C14.5187%2018.1818%2018.1818%2014.5187%2018.1818%2010C18.1818%205.48131%2014.5187%201.81818%2010%201.81818Z'%20fill='white'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M11.4718%2010.0244C11.2567%209.97354%2011.0304%2010.0028%2010.8353%2010.1067L2.29995%2014.6522C1.8568%2014.8882%201.68886%2015.4387%201.92486%2015.8818C2.16086%2016.325%202.71143%2016.4929%203.15458%2016.2569L11.3872%2011.8727L17.9726%2013.4302C18.4612%2013.5457%2018.951%2013.2433%2019.0665%2012.7546C19.1821%2012.2661%2018.8796%2011.7764%2018.3911%2011.6607L11.4718%2010.0244Z'%20fill='white'/%3e%3cpath%20d='M6.07329%209.09092C5.32016%209.09092%204.70966%208.48037%204.70966%207.72728C4.70966%206.97417%205.32016%206.36365%206.07329%206.36365C6.82643%206.36365%207.43693%206.97417%207.43693%207.72728C7.43693%208.48037%206.82643%209.09092%206.07329%209.09092Z'%20fill='white'/%3e%3c/g%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_7_36'%3e%3crect%20width='20'%20height='20'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",ArtifactMarkdown:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_7_27)'%3e%3cmask%20id='mask0_7_27'%20style='mask-type:luminance'%20maskUnits='userSpaceOnUse'%20x='-1'%20y='-1'%20width='22'%20height='22'%3e%3cpath%20d='M20.9091%20-0.909058H-0.909088V20.9091H20.9091V-0.909058Z'%20fill='white'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_7_27)'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M0%2010C0%204.47715%204.47715%200%2010%200C15.5228%200%2020%204.47715%2020%2010C20%2015.5228%2015.5228%2020%2010%2020C4.47715%2020%200%2015.5228%200%2010ZM10%201.81818C5.4813%201.81818%201.81818%205.4813%201.81818%2010C1.81818%2014.5187%205.48131%2018.1818%2010%2018.1818C14.5187%2018.1818%2018.1818%2014.5187%2018.1818%2010C18.1818%205.48131%2014.5187%201.81818%2010%201.81818Z'%20fill='white'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M6.36365%2010C6.36365%209.49794%206.77067%209.09094%207.27274%209.09094H12.7273C13.2294%209.09094%2013.6364%209.49794%2013.6364%2010C13.6364%2010.5021%2013.2294%2010.9091%2012.7273%2010.9091H7.27274C6.77067%2010.9091%206.36365%2010.5021%206.36365%2010Z'%20fill='white'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M6.36365%2013.6364C6.36365%2013.1343%206.77067%2012.7273%207.27274%2012.7273H9.09092C9.59301%2012.7273%2010%2013.1343%2010%2013.6364C10%2014.1385%209.59301%2014.5455%209.09092%2014.5455H7.27274C6.77067%2014.5455%206.36365%2014.1385%206.36365%2013.6364Z'%20fill='white'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M6.36365%206.36368C6.36365%205.86161%206.77067%205.45459%207.27274%205.45459H11.8182C12.3203%205.45459%2012.7273%205.86161%2012.7273%206.36368C12.7273%206.86575%2012.3203%207.27277%2011.8182%207.27277H7.27274C6.77067%207.27277%206.36365%206.86575%206.36365%206.36368Z'%20fill='white'/%3e%3c/g%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_7_27'%3e%3crect%20width='20'%20height='20'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",ArtifactProgress:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_7_2)'%3e%3cmask%20id='mask0_7_2'%20style='mask-type:luminance'%20maskUnits='userSpaceOnUse'%20x='-1'%20y='-1'%20width='22'%20height='22'%3e%3cpath%20d='M20.9091%20-0.909058H-0.909088V20.9091H20.9091V-0.909058Z'%20fill='white'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_7_2)'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M8.04937%200.190318C8.681%200.0653727%209.33327%200%2010%200C10.6667%200%2011.319%200.0653727%2011.9506%200.190318L11.5978%201.97394C11.0817%201.87185%2010.5475%201.81818%2010%201.81818C9.45245%201.81818%208.91827%201.87185%208.40218%201.97394L8.04937%200.190318ZM15.5568%201.68489C16.6469%202.41471%2017.5853%203.35308%2018.3151%204.4432L16.8043%205.45469C16.2066%204.56206%2015.4379%203.79335%2014.5453%203.19574L15.5568%201.68489ZM1.68489%204.4432C2.41471%203.35308%203.35308%202.41471%204.4432%201.68489L5.45469%203.19574C4.56206%203.79335%203.79335%204.56206%203.19574%205.45469L1.68489%204.4432ZM19.8096%208.04937C19.9346%208.681%2020%209.33327%2020%2010C20%2010.6667%2019.9346%2011.319%2019.8096%2011.9506L18.0261%2011.5978C18.1282%2011.0817%2018.1818%2010.5475%2018.1818%2010C18.1818%209.45245%2018.1282%208.91827%2018.0261%208.40218L19.8096%208.04937ZM0%2010C0%209.33327%200.0653727%208.681%200.190318%208.04937L1.97394%208.40218C1.87185%208.91827%201.81818%209.45245%201.81818%2010C1.81818%2010.5475%201.87185%2011.0817%201.97394%2011.5978L0.190318%2011.9506C0.0653727%2011.319%200%2010.6667%200%2010ZM18.3151%2015.5568C17.5853%2016.6469%2016.6469%2017.5853%2015.5568%2018.3151L14.5453%2016.8043C15.4379%2016.2066%2016.2066%2015.4379%2016.8043%2014.5453L18.3151%2015.5568ZM4.4432%2018.3151C3.35308%2017.5853%202.41471%2016.6469%201.68489%2015.5568L3.19574%2014.5453C3.79335%2015.4379%204.56206%2016.2066%205.45469%2016.8043L4.4432%2018.3151ZM10%2020C9.33327%2020%208.681%2019.9346%208.04937%2019.8096L8.40218%2018.0261C8.91827%2018.1282%209.45245%2018.1818%2010%2018.1818C10.5475%2018.1818%2011.0817%2018.1282%2011.5978%2018.0261L11.9506%2019.8096C11.319%2019.9346%2010.6667%2020%2010%2020Z'%20fill='white'/%3e%3cpath%20d='M10%2011.8181C8.99582%2011.8181%208.18182%2011.0041%208.18182%209.99994C8.18182%208.99576%208.99582%208.18176%2010%208.18176C11.0042%208.18176%2011.8182%208.99576%2011.8182%209.99994C11.8182%2011.0041%2011.0042%2011.8181%2010%2011.8181Z'%20fill='white'/%3e%3c/g%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_7_2'%3e%3crect%20width='20'%20height='20'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",ArtifactResult:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_7_19)'%3e%3cmask%20id='mask0_7_19'%20style='mask-type:luminance'%20maskUnits='userSpaceOnUse'%20x='-1'%20y='-1'%20width='22'%20height='22'%3e%3cpath%20d='M20.9091%20-0.909058H-0.909088V20.9091H20.9091V-0.909058Z'%20fill='white'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_7_19)'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M0%2010C0%204.47715%204.47715%200%2010%200C15.5228%200%2020%204.47715%2020%2010C20%2015.5228%2015.5228%2020%2010%2020C4.47715%2020%200%2015.5228%200%2010ZM10%201.81818C5.4813%201.81818%201.81818%205.4813%201.81818%2010C1.81818%2014.5187%205.48131%2018.1818%2010%2018.1818C14.5187%2018.1818%2018.1818%2014.5187%2018.1818%2010C18.1818%205.48131%2014.5187%201.81818%2010%201.81818Z'%20fill='white'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M5.68182%205.63634C5.68182%205.15937%206.06849%204.77271%206.54546%204.77271H13.4546C13.9316%204.77271%2014.3182%205.15937%2014.3182%205.63634V14.2512C14.3182%2014.8932%2013.6426%2015.3108%2013.0683%2015.0237L11.8182%2014.3986L10.3863%2015.1146C10.1431%2015.2362%209.85691%2015.2362%209.61373%2015.1146L8.18182%2014.3986L6.93169%2015.0237C6.35746%2015.3108%205.68182%2014.8932%205.68182%2014.2512V5.63634ZM7.04546%206.13634V13.4423L7.7956%2013.0672C8.03873%2012.9456%208.32491%2012.9456%208.5681%2013.0672L10%2013.7832L11.4319%2013.0672C11.6751%2012.9456%2011.9613%2012.9456%2012.2045%2013.0672L12.9546%2013.4423V6.13634H7.04546Z'%20fill='white'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M6.36365%208.63631C6.36365%208.38531%206.56716%208.18176%206.81819%208.18176H6.98566C7.23669%208.18176%207.4402%208.38531%207.4402%208.63631C7.4402%208.88731%207.23669%209.09085%206.98566%209.09085H6.81819C6.56716%209.09085%206.36365%208.88731%206.36365%208.63631ZM7.78709%208.63631C7.78709%208.38531%207.9906%208.18176%208.24165%208.18176H8.57656C8.82765%208.18176%209.0311%208.38531%209.0311%208.63631C9.0311%208.88731%208.82765%209.09085%208.57656%209.09085H8.24165C7.9906%209.09085%207.78709%208.88731%207.78709%208.63631ZM9.37801%208.63631C9.37801%208.38531%209.58147%208.18176%209.83256%208.18176H10.1675C10.4186%208.18176%2010.622%208.38531%2010.622%208.63631C10.622%208.88731%2010.4186%209.09085%2010.1675%209.09085H9.83256C9.58147%209.09085%209.37801%208.88731%209.37801%208.63631ZM10.9689%208.63631C10.9689%208.38531%2011.1724%208.18176%2011.4235%208.18176H11.7584C12.0095%208.18176%2012.2129%208.38531%2012.2129%208.63631C12.2129%208.88731%2012.0095%209.09085%2011.7584%209.09085H11.4235C11.1724%209.09085%2010.9689%208.88731%2010.9689%208.63631ZM12.5598%208.63631C12.5598%208.38531%2012.7633%208.18176%2013.0144%208.18176H13.1818C13.4328%208.18176%2013.6364%208.38531%2013.6364%208.63631C13.6364%208.88731%2013.4328%209.09085%2013.1818%209.09085H13.0144C12.7633%209.09085%2012.5598%208.88731%2012.5598%208.63631Z'%20fill='white'/%3e%3c/g%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_7_19'%3e%3crect%20width='20'%20height='20'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",ArtifactTable:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_7_9)'%3e%3cmask%20id='mask0_7_9'%20style='mask-type:luminance'%20maskUnits='userSpaceOnUse'%20x='-1'%20y='-1'%20width='22'%20height='22'%3e%3cpath%20d='M20.9091%20-0.909058H-0.909088V20.9091H20.9091V-0.909058Z'%20fill='white'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_7_9)'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M0%2010C0%204.47715%204.47715%200%2010%200C15.5228%200%2020%204.47715%2020%2010C20%2015.5228%2015.5228%2020%2010%2020C4.47715%2020%200%2015.5228%200%2010ZM10%201.81818C5.4813%201.81818%201.81818%205.4813%201.81818%2010C1.81818%2014.5187%205.48131%2018.1818%2010%2018.1818C14.5187%2018.1818%2018.1818%2014.5187%2018.1818%2010C18.1818%205.48131%2014.5187%201.81818%2010%201.81818Z'%20fill='white'/%3e%3cpath%20d='M8.18183%205.45459H6.36365C5.86157%205.45459%205.45456%205.8616%205.45456%206.36368V8.18186C5.45456%208.68394%205.86157%209.09095%206.36365%209.09095H8.18183C8.68391%209.09095%209.09092%208.68394%209.09092%208.18186V6.36368C9.09092%205.8616%208.68391%205.45459%208.18183%205.45459Z'%20fill='white'/%3e%3cpath%20d='M13.6364%205.45459H11.8182C11.3161%205.45459%2010.9091%205.8616%2010.9091%206.36368V8.18186C10.9091%208.68394%2011.3161%209.09095%2011.8182%209.09095H13.6364C14.1384%209.09095%2014.5455%208.68394%2014.5455%208.18186V6.36368C14.5455%205.8616%2014.1384%205.45459%2013.6364%205.45459Z'%20fill='white'/%3e%3cpath%20d='M13.6364%2010.9091H11.8182C11.3161%2010.9091%2010.9091%2011.3161%2010.9091%2011.8181V13.6363C10.9091%2014.1384%2011.3161%2014.5454%2011.8182%2014.5454H13.6364C14.1384%2014.5454%2014.5455%2014.1384%2014.5455%2013.6363V11.8181C14.5455%2011.3161%2014.1384%2010.9091%2013.6364%2010.9091Z'%20fill='white'/%3e%3cpath%20d='M8.18183%2010.9091H6.36365C5.86157%2010.9091%205.45456%2011.3161%205.45456%2011.8181V13.6363C5.45456%2014.1384%205.86157%2014.5454%206.36365%2014.5454H8.18183C8.68391%2014.5454%209.09092%2014.1384%209.09092%2013.6363V11.8181C9.09092%2011.3161%208.68391%2010.9091%208.18183%2010.9091Z'%20fill='white'/%3e%3c/g%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_7_9'%3e%3crect%20width='20'%20height='20'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e"},Symbol.toStringTag,{value:"Module"}));function vE(r){const t={resolution:Nh};return rt.from(_E[r],t)}async function wE(r){return await Bn(vE,[r])}async function TE({cullAtZoomThreshold:r=!0}={}){const t=await n1(),e=new Vt;r&&t.add(e);async function i(s){const n=await wE(s);return e.texture=n,e}return{element:e,render:i}}var Gg={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,_=g||3e3,v=new Date().getTime();return new Promise(function(T,C){if(f(y.context)&&!d(y.context)){var E=new Promise(function(k,L){function P(){new Date().getTime()-v>=_?L(Error(""+_+"ms timeout exceeded")):y.context.document.fonts.load(p(y,'"'+y.family+'"'),x).then(function(S){1<=S.length?k():setTimeout(P,25)},L)}P()}),I=new Promise(function(k,L){b=setTimeout(function(){L(Error(""+_+"ms timeout exceeded"))},_)});Promise.race([I,E]).then(function(){clearTimeout(b),T(y)},C)}else e(function(){function k(){var D;(D=F!=-1&&O!=-1||F!=-1&&U!=-1||O!=-1&&U!=-1)&&((D=F!=O&&F!=U&&O!=U)||(h===null&&(D=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),h=!!D&&(536>parseInt(D[1],10)||parseInt(D[1],10)===536&&11>=parseInt(D[2],10))),D=h&&(F==Z&&O==Z&&U==Z||F==st&&O==st&&U==st||F==X&&O==X&&U==X)),D=!D),D&&(M.parentNode!==null&&M.parentNode.removeChild(M),clearTimeout(b),T(y))}function L(){if(new Date().getTime()-v>=_)M.parentNode!==null&&M.parentNode.removeChild(M),C(Error(""+_+"ms timeout exceeded"));else{var D=y.context.document.hidden;(D===!0||D===void 0)&&(F=P.g.offsetWidth,O=S.g.offsetWidth,U=R.g.offsetWidth,k()),b=setTimeout(L,50)}}var P=new i(x),S=new i(x),R=new i(x),F=-1,O=-1,U=-1,Z=-1,st=-1,X=-1,M=document.createElement("div");M.dir="ltr",s(P,p(y,"sans-serif")),s(S,p(y,"serif")),s(R,p(y,"monospace")),M.appendChild(P.g),M.appendChild(S.g),M.appendChild(R.g),y.context.document.body.appendChild(M),Z=P.g.offsetWidth,st=S.g.offsetWidth,X=R.g.offsetWidth,L(),o(P,function(D){F=D,k()}),s(P,p(y,'"'+y.family+'",sans-serif')),o(S,function(D){O=D,k()}),s(S,p(y,'"'+y.family+'",serif')),o(R,function(D){U=D,k()}),s(R,p(y,'"'+y.family+'",monospace'))})})},r.exports=a})()})(Gg);var SE=Gg.exports;const CE=xn(SE),kg={inter:{fontFamily:"Inter Variable",fontSize:16,lineHeight:20,fill:16777215}},Fg={resolution:Nh,chars:ni.ASCII},Ng="sans-serif",Dg={inter:ME(kg.inter)};let Pu=!1;async function EE(){const r=Object.values(kg);await Promise.all(r.map(t=>IE(t))),Pu=!0,K.emit("fontsLoaded",Dg)}async function IE(r){const{fontFamily:t,...e}=r,i=new CE(t);try{await i.load()}catch(s){console.error(s),console.warn(`fonts: font ${t} failed to load, falling back to ${Ng}`),ni.from(t,{fontFamily:Ng,...e},Fg);return}ni.from(t,r,Fg)}function AE(){Pu=!1}async function Og(){return Pu?Dg:await be("fontsLoaded")}function ME(r){const{fontFamily:t,...e}=r,i={fontName:t,...e};return s=>new LT(s,i)}async function qa({cullAtZoomThreshold:r=!0}={}){const{inter:t}=await Og(),e=await s1(),i=t("");r&&e.add(i);async function s(n){return i.text=n,await i}return{element:i,render:s}}async function Bg({cullAtZoomThreshold:r}){const t=await Bt(),e=new gt,i=new gt,{element:s,render:n}=await TE({cullAtZoomThreshold:r}),{element:o,render:a}=await xE(),{element:h,render:l}=await qa({cullAtZoomThreshold:r}),{element:c,render:u}=await mE();let d=!1,f=null,p;i.addChild(h),e.addChild(c),e.addChild(i);async function m(_){const{selected:v,name:T,type:C}=_;return d=v??d,f=T??f,p=C,p==="progress"?i.addChild(o):i.addChild(s),_.type==="progress"?await Promise.all([y(_.data),x()]):await Promise.all([g(),x()]),await b(),e}async function g(){if(p==="progress")return s;const _=Gr[p],{artifactIconSize:v,artifactIconColor:T,artifactPaddingLeft:C,artifactPaddingY:E}=t,I=await n(_);return I.position={x:C,y:E},I.width=v,I.height=v,I.tint=T,I}async function y(_){const{artifactPaddingLeft:v,artifactPaddingRight:T,artifactPaddingY:C,artifactIconSize:E}=t,I=20,k=(E-I*2)/2,L=a({value:_,radius:k,lineWidth:I});return f?L.position.x+=v:L.position.x+=(v+T)/2,L.position.y+=C,o}async function x(){if(!f)return h.visible=!1,h;await l(f);const{artifactPaddingLeft:_,artifactPaddingY:v,artifactTextColor:T,artifactIconSize:C,artifactContentGap:E}=t,I=f?E:0,k=_+C+I,L=v;return h.tint=T,h.scale.set(.75),h.position={x:k,y:L},h.visible=!0,h}async function b(){const{artifactPaddingLeft:_,artifactPaddingRight:v,artifactPaddingY:T}=t,C={selected:d,width:i.width+_+v,height:i.height+T*2};return await u(C)}return{element:e,render:m}}let Nt=null,th=!1;async function RE(){const r=await zt();r.on("click",()=>Ai(null)),r.on("drag-start",()=>{th=!0}),r.on("drag-end",()=>{setTimeout(()=>{th=!1})})}function PE(){Nt=null,th=!1}function Ai(r){if(!th&&!(!r&&!Nt||r&&$i(r))){if(Nt=r,r===null){K.emit("itemSelected",null);return}K.emit("itemSelected",r)}}function $i(r){if(Nt===null)return!1;const{kind:t}=r;switch(t){case"task-run":return Io(Nt)&&Nt.id===r.id;case"flow-run":return Io(Nt)&&Nt.id===r.id;case"artifact":return Sd(Nt)&&Nt.id===r.id;case"artifacts":return Cd(Nt)&&Nt.ids.length===r.ids.length&&Nt.ids.every(i=>r.ids.includes(i));case"state":return Ed(Nt)&&Nt.id===r.id;case"event":return Id(Nt)&&Nt.id===r.id;case"events":return Ad(Nt)&&Nt.ids.length===r.ids.length&&Nt.ids.every(i=>r.ids.includes(i));default:const e=t;throw new Error(`switch does not have case for value: ${e}`)}}function LE(){return Nt&&Io(Nt)?Nt:null}async function Lu(r,{cullAtZoomThreshold:t=!0,enableLocalClickHandling:e=!1}={}){const{element:i,render:s}=await Bg({cullAtZoomThreshold:t});let n=!1,o=r;i.eventMode="static",i.cursor="pointer",e&&i.on("click",u=>{u.stopPropagation(),Ai({kind:"artifact",id:o.id})}),K.on("itemSelected",()=>{const u=$i({kind:"artifact",id:o.id});u!==n&&(n=u,a(o))});async function a(u){o=u,await s({selected:n,name:o.key,...o})}function h(){return n}function l(){return o.created}function c(){return o.id}return{isArtifact:!0,element:i,render:a,getSelected:h,getDate:l,getId:c}}function Ug(r){return r.isArtifact===!0}function GE(r){return typeof r=="function"}function eh(r){return GE(r)?r():r}async function Xg(r,t){const e=await Ri(),i=await Me();let s,n=null;async function o(){try{n=await i.fetchEvents(eh(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 Wg(){const r=await Bt(),t=await s1(),e=new gt,{element:i,render:s}=await Pg(),{element:n,render:o}=await Ru(),{element:a,render:h}=await $a();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?Ja.Up:Ja.Down},g=await s(m),y={width:r.nodeToggleSize,height:r.nodeToggleSize,background:r.nodeToggleBgColor,radius:r.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.nodeToggleBorderColor});b.alpha=f?0:1;const _={y:x.height/2,x:x.width/2},v=m.size/4;return g.x=_.x,g.y=p?_.y+v:_.y-v,e}function u(){n.alpha=l?.5:1}function d(){n.alpha=l?0:.5}return{element:e,render:c}}async function Zg(){const r=await Bt(),t=await Yt(),e=new gt,{element:i,render:s}=await Ru(),{element:n,render:o}=await Qa();e.addChild(i),e.addChild(n);async function a(l){const{background:c="#fff"}=r.node(l),{nodeHeight:u,nodeRadius:d}=r,f=$i({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=Cu();if(et.isTemporal()||et.isLeftAligned()){const d=l.start_time,f=l.end_time??new Date,m=Ag(f,d)/Fa*u;return Math.max(m,c*2)}return u}return{element:e,render:a}}var Vg="Expected a function",Hg=NaN,kE="[object Symbol]",FE=/^\s+|\s+$/g,NE=/^[-+]0x[0-9a-f]+$/i,DE=/^0b[01]+$/i,OE=/^0o[0-7]+$/i,BE=parseInt,UE=typeof $e=="object"&&$e&&$e.Object===Object&&$e,XE=typeof self=="object"&&self&&self.Object===Object&&self,WE=UE||XE||Function("return this")(),ZE=Object.prototype,VE=ZE.toString,HE=Math.max,KE=Math.min,Gu=function(){return WE.Date.now()};function YE(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(Vg);t=Kg(t)||0,ih(e)&&(c=!!e.leading,u="maxWait"in e,n=u?HE(Kg(e.maxWait)||0,t):n,d="trailing"in e?!!e.trailing:d);function f(T){var C=i,E=s;return i=s=void 0,l=T,o=r.apply(E,C),o}function p(T){return l=T,a=setTimeout(y,t),c?f(T):o}function m(T){var C=T-h,E=T-l,I=t-C;return u?KE(I,n-E):I}function g(T){var C=T-h,E=T-l;return h===void 0||C>=t||C<0||u&&E>=n}function y(){var T=Gu();if(g(T))return x(T);a=setTimeout(y,m(T))}function x(T){return a=void 0,d&&i?f(T):(i=s=void 0,o)}function b(){a!==void 0&&clearTimeout(a),l=0,i=h=s=a=void 0}function _(){return a===void 0?o:x(Gu())}function v(){var T=Gu(),C=g(T);if(i=arguments,s=this,h=T,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 v.cancel=b,v.flush=_,v}function zE(r,t,e){var i=!0,s=!0;if(typeof r!="function")throw new TypeError(Vg);return ih(e)&&(i="leading"in e?!!e.leading:i,s="trailing"in e?!!e.trailing:s),YE(r,t,{leading:i,maxWait:t,trailing:s})}function ih(r){var t=typeof r;return!!r&&(t=="object"||t=="function")}function jE(r){return!!r&&typeof r=="object"}function JE(r){return typeof r=="symbol"||jE(r)&&VE.call(r)==kE}function Kg(r){if(typeof r=="number")return r;if(JE(r))return Hg;if(ih(r)){var t=typeof r.valueOf=="function"?r.valueOf():r;r=ih(t)?t+"":t}if(typeof r!="string")return r===0?r:+r;r=r.replace(FE,"");var e=DE.test(r);return e||OE.test(r)?BE(r.slice(2),e?2:8):NE.test(r)?Hg:+r}var $E=zE;const Yg=xn($E);async function zg(){const{element:r,render:t}=await Bg({cullAtZoomThreshold:!1});let e=null,i=[],s=!1;r.eventMode="static",r.cursor="pointer",K.on("itemSelected",()=>{const l=$i({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{isArtifactCluster:!0,element:r,render:n,getSelected:o,getDate:a,getIds:h,isCluster:!0}}async function QE({radius:r}){const t=await Ht(),e=new mr;return e.beginFill("#fff"),e.drawCircle(0,0,r),e.endFill(),t.renderer.generateTexture(e,{resolution:Fh})}async function qE(r){return await Bn(QE,[r])}async function jg(r){const t=await qE(r);return new Vt(t)}async function Jg(r){const t=new gt,e=await Bt(),i=await Ji(),s=await jg({radius:e.eventRadiusDefault}),{element:n,render:o}=await Qa();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)}),K.on("itemSelected",()=>{const u=$i({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;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 $g(){const r=new gt,t=await Bt(),e=await Ji(),i=await jg({radius:t.eventClusterRadiusDefault}),{element:s,render:n}=await Qa(),{element:o,render:a}=await qa({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)}),K.on("itemSelected",()=>{const x=$i({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:_}=x;h=_,l=b,d(),f(),m(),await p(b.length.toString()),r.visible=!0}function d(){const{eventTargetSize:x}=t;e.alpha=0,e.width=x,e.height=x}function f(){const{eventClusterColor:x,eventTargetSize:b}=t;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,_=-1;o.scale.set(.6),o.anchor.set(.5),o.position.set(b/2,b/2+_),await a(x)}function m(){const{eventSelectedBorderInset:x,eventTargetSize:b}=t;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 rh(r,t){return r==null||t==null?NaN:r<t?-1:r>t?1:r>=t?0:NaN}function tI(r,t){return r==null||t==null?NaN:t<r?-1:t>r?1:t>=r?0:NaN}function ku(r){let t,e,i;r.length!==2?(t=rh,e=(a,h)=>rh(r(a),h),i=(a,h)=>r(a)-h):(t=r===rh||r===tI?r:eI,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 eI(){return 0}function iI(r){return r===null?NaN:+r}const rI=ku(rh).right;ku(iI).center;const sI=Math.sqrt(50),nI=Math.sqrt(10),oI=Math.sqrt(2);function sh(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>=sI?10:n>=nI?5:n>=oI?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?sh(r,t,e*2):[a,h,l]}function aI(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?sh(t,r,e):sh(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 Fu(r,t,e){return t=+t,r=+r,e=+e,sh(r,t,e)[2]}function Nu(r,t,e){t=+t,r=+r,e=+e;const i=t<r,s=i?Fu(t,r,e):Fu(r,t,e);return(i?-1:1)*(s<0?1/-s:s)}function Du(r,t,e){r.prototype=t.prototype=e,e.constructor=r}function Qg(r,t){var e=Object.create(r.prototype);for(var i in t)e[i]=t[i];return e}function ro(){}var so=.7,nh=1/so,sn="\\s*([+-]?\\d+)\\s*",no="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Mi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",hI=/^#([0-9a-f]{3,8})$/,lI=new RegExp(`^rgb\\(${sn},${sn},${sn}\\)$`),cI=new RegExp(`^rgb\\(${Mi},${Mi},${Mi}\\)$`),uI=new RegExp(`^rgba\\(${sn},${sn},${sn},${no}\\)$`),dI=new RegExp(`^rgba\\(${Mi},${Mi},${Mi},${no}\\)$`),fI=new RegExp(`^hsl\\(${no},${Mi},${Mi}\\)$`),pI=new RegExp(`^hsla\\(${no},${Mi},${Mi},${no}\\)$`),qg={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};Du(ro,oo,{copy(r){return Object.assign(new this.constructor,this,r)},displayable(){return this.rgb().displayable()},hex:ty,formatHex:ty,formatHex8:mI,formatHsl:gI,formatRgb:ey,toString:ey});function ty(){return this.rgb().formatHex()}function mI(){return this.rgb().formatHex8()}function gI(){return oy(this).formatHsl()}function ey(){return this.rgb().formatRgb()}function oo(r){var t,e;return r=(r+"").trim().toLowerCase(),(t=hI.exec(r))?(e=t[1].length,t=parseInt(t[1],16),e===6?iy(t):e===3?new Ce(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):e===8?oh(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):e===4?oh(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=lI.exec(r))?new Ce(t[1],t[2],t[3],1):(t=cI.exec(r))?new Ce(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=uI.exec(r))?oh(t[1],t[2],t[3],t[4]):(t=dI.exec(r))?oh(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=fI.exec(r))?ny(t[1],t[2]/100,t[3]/100,1):(t=pI.exec(r))?ny(t[1],t[2]/100,t[3]/100,t[4]):qg.hasOwnProperty(r)?iy(qg[r]):r==="transparent"?new Ce(NaN,NaN,NaN,0):null}function iy(r){return new Ce(r>>16&255,r>>8&255,r&255,1)}function oh(r,t,e,i){return i<=0&&(r=t=e=NaN),new Ce(r,t,e,i)}function yI(r){return r instanceof ro||(r=oo(r)),r?(r=r.rgb(),new Ce(r.r,r.g,r.b,r.opacity)):new Ce}function Ou(r,t,e,i){return arguments.length===1?yI(r):new Ce(r,t,e,i??1)}function Ce(r,t,e,i){this.r=+r,this.g=+t,this.b=+e,this.opacity=+i}Du(Ce,Ou,Qg(ro,{brighter(r){return r=r==null?nh:Math.pow(nh,r),new Ce(this.r*r,this.g*r,this.b*r,this.opacity)},darker(r){return r=r==null?so:Math.pow(so,r),new Ce(this.r*r,this.g*r,this.b*r,this.opacity)},rgb(){return this},clamp(){return new Ce(ds(this.r),ds(this.g),ds(this.b),ah(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:bI,formatRgb:sy,toString:sy}));function ry(){return`#${fs(this.r)}${fs(this.g)}${fs(this.b)}`}function bI(){return`#${fs(this.r)}${fs(this.g)}${fs(this.b)}${fs((isNaN(this.opacity)?1:this.opacity)*255)}`}function sy(){const r=ah(this.opacity);return`${r===1?"rgb(":"rgba("}${ds(this.r)}, ${ds(this.g)}, ${ds(this.b)}${r===1?")":`, ${r})`}`}function ah(r){return isNaN(r)?1:Math.max(0,Math.min(1,r))}function ds(r){return Math.max(0,Math.min(255,Math.round(r)||0))}function fs(r){return r=ds(r),(r<16?"0":"")+r.toString(16)}function ny(r,t,e,i){return i<=0?r=t=e=NaN:e<=0||e>=1?r=t=NaN:t<=0&&(r=NaN),new oi(r,t,e,i)}function oy(r){if(r instanceof oi)return new oi(r.h,r.s,r.l,r.opacity);if(r instanceof ro||(r=oo(r)),!r)return new oi;if(r instanceof oi)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 oi(o,a,h,r.opacity)}function xI(r,t,e,i){return arguments.length===1?oy(r):new oi(r,t,e,i??1)}function oi(r,t,e,i){this.h=+r,this.s=+t,this.l=+e,this.opacity=+i}Du(oi,xI,Qg(ro,{brighter(r){return r=r==null?nh:Math.pow(nh,r),new oi(this.h,this.s,this.l*r,this.opacity)},darker(r){return r=r==null?so:Math.pow(so,r),new oi(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 Ce(Bu(r>=240?r-240:r+120,s,i),Bu(r,s,i),Bu(r<120?r+240:r-120,s,i),this.opacity)},clamp(){return new oi(ay(this.h),hh(this.s),hh(this.l),ah(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=ah(this.opacity);return`${r===1?"hsl(":"hsla("}${ay(this.h)}, ${hh(this.s)*100}%, ${hh(this.l)*100}%${r===1?")":`, ${r})`}`}}));function ay(r){return r=(r||0)%360,r<0?r+360:r}function hh(r){return Math.max(0,Math.min(1,r||0))}function Bu(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 Uu=r=>()=>r;function _I(r,t){return function(e){return r+e*t}}function vI(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 wI(r){return(r=+r)==1?hy:function(t,e){return e-t?vI(t,e,r):Uu(isNaN(t)?e:t)}}function hy(r,t){var e=t-r;return e?_I(r,e):Uu(isNaN(r)?t:r)}const ly=function r(t){var e=wI(t);function i(s,n){var o=e((s=Ou(s)).r,(n=Ou(n)).r),a=e(s.g,n.g),h=e(s.b,n.b),l=hy(s.opacity,n.opacity);return function(c){return s.r=o(c),s.g=a(c),s.b=h(c),s.opacity=l(c),s+""}}return i.gamma=r,i}(1);function TI(r,t){t||(t=[]);var e=r?Math.min(t.length,r.length):0,i=t.slice(),s;return function(n){for(s=0;s<e;++s)i[s]=r[s]*(1-n)+t[s]*n;return i}}function SI(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function CI(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]=Zu(r[o],t[o]);for(;o<e;++o)n[o]=t[o];return function(a){for(o=0;o<i;++o)n[o]=s[o](a);return n}}function EI(r,t){var e=new Date;return r=+r,t=+t,function(i){return e.setTime(r*(1-i)+t*i),e}}function lh(r,t){return r=+r,t=+t,function(e){return r*(1-e)+t*e}}function II(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]=Zu(r[s],t[s]):i[s]=t[s];return function(n){for(s in e)i[s]=e[s](n);return i}}var Xu=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Wu=new RegExp(Xu.source,"g");function AI(r){return function(){return r}}function MI(r){return function(t){return r(t)+""}}function RI(r,t){var e=Xu.lastIndex=Wu.lastIndex=0,i,s,n,o=-1,a=[],h=[];for(r=r+"",t=t+"";(i=Xu.exec(r))&&(s=Wu.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:lh(i,s)})),e=Wu.lastIndex;return e<t.length&&(n=t.slice(e),a[o]?a[o]+=n:a[++o]=n),a.length<2?h[0]?MI(h[0].x):AI(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 Zu(r,t){var e=typeof t,i;return t==null||e==="boolean"?Uu(t):(e==="number"?lh:e==="string"?(i=oo(t))?(t=i,ly):RI:t instanceof oo?ly:t instanceof Date?EI:SI(t)?TI:Array.isArray(t)?CI:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?II:lh)(r,t)}function PI(r,t){return r=+r,t=+t,function(e){return Math.round(r*(1-e)+t*e)}}function LI(r){return Math.abs(r=Math.round(r))>=1e21?r.toLocaleString("en").replace(/,/g,""):r.toString(10)}function ch(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 nn(r){return r=ch(Math.abs(r)),r?r[1]:NaN}function GI(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 kI(r){return function(t){return t.replace(/[0-9]/g,function(e){return r[+e]})}}var FI=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function uh(r){if(!(t=FI.exec(r)))throw new Error("invalid format: "+r);var t;return new Vu({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]})}uh.prototype=Vu.prototype;function Vu(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+""}Vu.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function NI(r){t:for(var t=r.length,e=1,i=-1,s;e<t;++e)switch(r[e]){case".":i=s=e;break;case"0":i===0&&(i=e),s=e;break;default:if(!+r[e])break t;i>0&&(i=0);break}return i>0?r.slice(0,i)+r.slice(s+1):r}var cy;function DI(r,t){var e=ch(r,t);if(!e)return r+"";var i=e[0],s=e[1],n=s-(cy=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")+ch(r,Math.max(0,t+n-1))[0]}function uy(r,t){var e=ch(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 dy={"%":(r,t)=>(r*100).toFixed(t),b:r=>Math.round(r).toString(2),c:r=>r+"",d:LI,e:(r,t)=>r.toExponential(t),f:(r,t)=>r.toFixed(t),g:(r,t)=>r.toPrecision(t),o:r=>Math.round(r).toString(8),p:(r,t)=>uy(r*100,t),r:uy,s:DI,X:r=>Math.round(r).toString(16).toUpperCase(),x:r=>Math.round(r).toString(16)};function fy(r){return r}var py=Array.prototype.map,my=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function OI(r){var t=r.grouping===void 0||r.thousands===void 0?fy:GI(py.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?fy:kI(py.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=uh(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,_=u.trim,v=u.type;v==="n"?(x=!0,v="g"):dy[v]||(b===void 0&&(b=12),_=!0,v="g"),(g||d==="0"&&f==="=")&&(g=!0,d="0",f="=");var T=m==="$"?e:m==="#"&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",C=m==="$"?i:/[%p]/.test(v)?o:"",E=dy[v],I=/[defgprs%]/.test(v);b=b===void 0?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b));function k(L){var P=T,S=C,R,F,O;if(v==="c")S=E(L)+S,L="";else{L=+L;var U=L<0||1/L<0;if(L=isNaN(L)?h:E(Math.abs(L),b),_&&(L=NI(L)),U&&+L==0&&p!=="+"&&(U=!1),P=(U?p==="("?p:a:p==="-"||p==="("?"":p)+P,S=(v==="s"?my[8+cy/3]:"")+S+(U&&p==="("?")":""),I){for(R=-1,F=L.length;++R<F;)if(O=L.charCodeAt(R),48>O||O>57){S=(O===46?s+L.slice(R+1):L.slice(R))+S,L=L.slice(0,R);break}}}x&&!g&&(L=t(L,1/0));var Z=P.length+L.length+S.length,st=Z<y?new Array(y-Z+1).join(d):"";switch(x&&g&&(L=t(st+L,st.length?y-S.length:1/0),st=""),f){case"<":L=P+L+S+st;break;case"=":L=P+st+L+S;break;case"^":L=st.slice(0,Z=st.length>>1)+P+L+S+st.slice(Z);break;default:L=st+P+L+S;break}return n(L)}return k.toString=function(){return u+""},k}function c(u,d){var f=l((u=uh(u),u.type="f",u)),p=Math.max(-8,Math.min(8,Math.floor(nn(d)/3)))*3,m=Math.pow(10,-p),g=my[8+p/3];return function(y){return f(m*y)+g}}return{format:l,formatPrefix:c}}var dh,gy,yy;BI({thousands:",",grouping:[3],currency:["$",""]});function BI(r){return dh=OI(r),gy=dh.format,yy=dh.formatPrefix,dh}function UI(r){return Math.max(0,-nn(Math.abs(r)))}function XI(r,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(nn(t)/3)))*3-nn(Math.abs(r)))}function WI(r,t){return r=Math.abs(r),t=Math.abs(t)-r,Math.max(0,nn(t)-nn(r))+1}function by(r,t){switch(arguments.length){case 0:break;case 1:this.range(r);break;default:this.range(t).domain(r);break}return this}function ZI(r){return function(){return r}}function VI(r){return+r}var xy=[0,1];function on(r){return r}function Hu(r,t){return(t-=r=+r)?function(e){return(e-r)/t}:ZI(isNaN(t)?NaN:.5)}function HI(r,t){var e;return r>t&&(e=r,r=t,t=e),function(i){return Math.max(r,Math.min(t,i))}}function KI(r,t,e){var i=r[0],s=r[1],n=t[0],o=t[1];return s<i?(i=Hu(s,i),n=e(o,n)):(i=Hu(i,s),n=e(n,o)),function(a){return n(i(a))}}function YI(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]=Hu(r[o],r[o+1]),n[o]=e(t[o],t[o+1]);return function(a){var h=rI(r,a,1,i)-1;return n[h](s[h](a))}}function _y(r,t){return t.domain(r.domain()).range(r.range()).interpolate(r.interpolate()).clamp(r.clamp()).unknown(r.unknown())}function zI(){var r=xy,t=xy,e=Zu,i,s,n,o=on,a,h,l;function c(){var d=Math.min(r.length,t.length);return o!==on&&(o=HI(r[0],r[d-1])),a=d>2?YI:KI,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),lh)))(d)))},u.domain=function(d){return arguments.length?(r=Array.from(d,VI),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=PI,c()},u.clamp=function(d){return arguments.length?(o=d?!0:on,c()):o!==on},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 vy(){return zI()(on,on)}function jI(r,t,e,i){var s=Nu(r,t,e),n;switch(i=uh(i??",f"),i.type){case"s":{var o=Math.max(Math.abs(r),Math.abs(t));return i.precision==null&&!isNaN(n=XI(s,o))&&(i.precision=n),yy(i,o)}case"":case"e":case"g":case"p":case"r":{i.precision==null&&!isNaN(n=WI(s,Math.max(Math.abs(r),Math.abs(t))))&&(i.precision=n-(i.type==="e"));break}case"f":case"%":{i.precision==null&&!isNaN(n=UI(s))&&(i.precision=n-(i.type==="%")*2);break}}return gy(i)}function JI(r){var t=r.domain;return r.ticks=function(e){var i=t();return aI(i[0],i[i.length-1],e??10)},r.tickFormat=function(e,i){var s=t();return jI(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=Fu(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 wy(){var r=vy();return r.copy=function(){return _y(r,wy())},by.apply(r,arguments),JI(r)}function $I(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 Ku=new Date,Yu=new Date;function $t(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=>$t(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)=>(Ku.setTime(+n),Yu.setTime(+o),r(Ku),r(Yu),Math.floor(e(Ku,Yu))),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 fh=$t(()=>{},(r,t)=>{r.setTime(+r+t)},(r,t)=>t-r);fh.every=r=>(r=Math.floor(r),!isFinite(r)||!(r>0)?null:r>1?$t(t=>{t.setTime(Math.floor(t/r)*r)},(t,e)=>{t.setTime(+t+e*r)},(t,e)=>(e-t)/r):fh),fh.range;const Qi=1e3,Ke=Qi*60,qi=Ke*60,tr=qi*24,zu=tr*7,Ty=tr*30,ju=tr*365,an=$t(r=>{r.setTime(r-r.getMilliseconds())},(r,t)=>{r.setTime(+r+t*Qi)},(r,t)=>(t-r)/Qi,r=>r.getUTCSeconds());an.range;const Ju=$t(r=>{r.setTime(r-r.getMilliseconds()-r.getSeconds()*Qi)},(r,t)=>{r.setTime(+r+t*Ke)},(r,t)=>(t-r)/Ke,r=>r.getMinutes());Ju.range,$t(r=>{r.setUTCSeconds(0,0)},(r,t)=>{r.setTime(+r+t*Ke)},(r,t)=>(t-r)/Ke,r=>r.getUTCMinutes()).range;const $u=$t(r=>{r.setTime(r-r.getMilliseconds()-r.getSeconds()*Qi-r.getMinutes()*Ke)},(r,t)=>{r.setTime(+r+t*qi)},(r,t)=>(t-r)/qi,r=>r.getHours());$u.range,$t(r=>{r.setUTCMinutes(0,0,0)},(r,t)=>{r.setTime(+r+t*qi)},(r,t)=>(t-r)/qi,r=>r.getUTCHours()).range;const ao=$t(r=>r.setHours(0,0,0,0),(r,t)=>r.setDate(r.getDate()+t),(r,t)=>(t-r-(t.getTimezoneOffset()-r.getTimezoneOffset())*Ke)/tr,r=>r.getDate()-1);ao.range;const Qu=$t(r=>{r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCDate(r.getUTCDate()+t)},(r,t)=>(t-r)/tr,r=>r.getUTCDate()-1);Qu.range,$t(r=>{r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCDate(r.getUTCDate()+t)},(r,t)=>(t-r)/tr,r=>Math.floor(r/tr)).range;function ps(r){return $t(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())*Ke)/zu)}const ph=ps(0),mh=ps(1),QI=ps(2),qI=ps(3),hn=ps(4),tA=ps(5),eA=ps(6);ph.range,mh.range,QI.range,qI.range,hn.range,tA.range,eA.range;function ms(r){return $t(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)/zu)}const Sy=ms(0),gh=ms(1),iA=ms(2),rA=ms(3),ln=ms(4),sA=ms(5),nA=ms(6);Sy.range,gh.range,iA.range,rA.range,ln.range,sA.range,nA.range;const qu=$t(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());qu.range,$t(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 er=$t(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());er.every=r=>!isFinite(r=Math.floor(r))||!(r>0)?null:$t(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)}),er.range;const gs=$t(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());gs.every=r=>!isFinite(r=Math.floor(r))||!(r>0)?null:$t(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)}),gs.range;function oA(r,t,e,i,s,n){const o=[[an,1,Qi],[an,5,5*Qi],[an,15,15*Qi],[an,30,30*Qi],[n,1,Ke],[n,5,5*Ke],[n,15,15*Ke],[n,30,30*Ke],[s,1,qi],[s,3,3*qi],[s,6,6*qi],[s,12,12*qi],[i,1,tr],[i,2,2*tr],[e,1,zu],[t,1,Ty],[t,3,3*Ty],[r,1,ju]];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=ku(([,,g])=>g).right(o,d);if(f===o.length)return r.every(Nu(l/ju,c/ju,u));if(f===0)return fh.every(Math.max(Nu(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[aA,hA]=oA(er,qu,ph,ao,$u,Ju);function td(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 ed(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 ho(r,t,e){return{y:r,m:t,d:e,H:0,M:0,S:0,L:0}}function lA(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=lo(s),c=co(s),u=lo(n),d=co(n),f=lo(o),p=co(o),m=lo(a),g=co(a),y=lo(h),x=co(h),b={a:U,A:Z,b:st,B:X,c:null,d:Ry,e:Ry,f:LA,g:WA,G:VA,H:MA,I:RA,j:PA,L:Py,m:GA,M:kA,p:M,q:D,Q:Dy,s:Oy,S:FA,u:NA,U:DA,V:OA,w:BA,W:UA,x:null,X:null,y:XA,Y:ZA,Z:HA,"%":Ny},_={a:V,A:Q,b:j,B:xt,c:null,d:Gy,e:Gy,f:jA,g:nM,G:aM,H:KA,I:YA,j:zA,L:ky,m:JA,M:$A,p:Tt,q:yt,Q:Dy,s:Oy,S:QA,u:qA,U:tM,V:eM,w:iM,W:rM,x:null,X:null,y:sM,Y:oM,Z:hM,"%":Ny},v={a:k,A:L,b:P,B:S,c:R,d:Ay,e:Ay,f:CA,g:Iy,G:Ey,H:My,I:My,j:vA,L:SA,m:_A,M:wA,p:I,q:xA,Q:IA,s:AA,S:TA,u:pA,U:mA,V:gA,w:fA,W:yA,x:F,X:O,y:Iy,Y:Ey,Z:bA,"%":EA};b.x=T(e,b),b.X=T(i,b),b.c=T(t,b),_.x=T(e,_),_.X=T(i,_),_.c=T(t,_);function T(N,Y){return function(H){var G=[],ut=-1,ht=0,wt=N.length,Rt,Fe,Gi;for(H instanceof Date||(H=new Date(+H));++ut<wt;)N.charCodeAt(ut)===37&&(G.push(N.slice(ht,ut)),(Fe=Cy[Rt=N.charAt(++ut)])!=null?Rt=N.charAt(++ut):Fe=Rt==="e"?" ":"0",(Gi=Y[Rt])&&(Rt=Gi(H,Fe)),G.push(Rt),ht=ut+1);return G.push(N.slice(ht,ut)),G.join("")}}function C(N,Y){return function(H){var G=ho(1900,void 0,1),ut=E(G,N,H+="",0),ht,wt;if(ut!=H.length)return null;if("Q"in G)return new Date(G.Q);if("s"in G)return new Date(G.s*1e3+("L"in G?G.L:0));if(Y&&!("Z"in G)&&(G.Z=0),"p"in G&&(G.H=G.H%12+G.p*12),G.m===void 0&&(G.m="q"in G?G.q:0),"V"in G){if(G.V<1||G.V>53)return null;"w"in G||(G.w=1),"Z"in G?(ht=ed(ho(G.y,0,1)),wt=ht.getUTCDay(),ht=wt>4||wt===0?gh.ceil(ht):gh(ht),ht=Qu.offset(ht,(G.V-1)*7),G.y=ht.getUTCFullYear(),G.m=ht.getUTCMonth(),G.d=ht.getUTCDate()+(G.w+6)%7):(ht=td(ho(G.y,0,1)),wt=ht.getDay(),ht=wt>4||wt===0?mh.ceil(ht):mh(ht),ht=ao.offset(ht,(G.V-1)*7),G.y=ht.getFullYear(),G.m=ht.getMonth(),G.d=ht.getDate()+(G.w+6)%7)}else("W"in G||"U"in G)&&("w"in G||(G.w="u"in G?G.u%7:"W"in G?1:0),wt="Z"in G?ed(ho(G.y,0,1)).getUTCDay():td(ho(G.y,0,1)).getDay(),G.m=0,G.d="W"in G?(G.w+6)%7+G.W*7-(wt+5)%7:G.w+G.U*7-(wt+6)%7);return"Z"in G?(G.H+=G.Z/100|0,G.M+=G.Z%100,ed(G)):td(G)}}function E(N,Y,H,G){for(var ut=0,ht=Y.length,wt=H.length,Rt,Fe;ut<ht;){if(G>=wt)return-1;if(Rt=Y.charCodeAt(ut++),Rt===37){if(Rt=Y.charAt(ut++),Fe=v[Rt in Cy?Y.charAt(ut++):Rt],!Fe||(G=Fe(N,H,G))<0)return-1}else if(Rt!=H.charCodeAt(G++))return-1}return G}function I(N,Y,H){var G=l.exec(Y.slice(H));return G?(N.p=c.get(G[0].toLowerCase()),H+G[0].length):-1}function k(N,Y,H){var G=f.exec(Y.slice(H));return G?(N.w=p.get(G[0].toLowerCase()),H+G[0].length):-1}function L(N,Y,H){var G=u.exec(Y.slice(H));return G?(N.w=d.get(G[0].toLowerCase()),H+G[0].length):-1}function P(N,Y,H){var G=y.exec(Y.slice(H));return G?(N.m=x.get(G[0].toLowerCase()),H+G[0].length):-1}function S(N,Y,H){var G=m.exec(Y.slice(H));return G?(N.m=g.get(G[0].toLowerCase()),H+G[0].length):-1}function R(N,Y,H){return E(N,t,Y,H)}function F(N,Y,H){return E(N,e,Y,H)}function O(N,Y,H){return E(N,i,Y,H)}function U(N){return o[N.getDay()]}function Z(N){return n[N.getDay()]}function st(N){return h[N.getMonth()]}function X(N){return a[N.getMonth()]}function M(N){return s[+(N.getHours()>=12)]}function D(N){return 1+~~(N.getMonth()/3)}function V(N){return o[N.getUTCDay()]}function Q(N){return n[N.getUTCDay()]}function j(N){return h[N.getUTCMonth()]}function xt(N){return a[N.getUTCMonth()]}function Tt(N){return s[+(N.getUTCHours()>=12)]}function yt(N){return 1+~~(N.getUTCMonth()/3)}return{format:function(N){var Y=T(N+="",b);return Y.toString=function(){return N},Y},parse:function(N){var Y=C(N+="",!1);return Y.toString=function(){return N},Y},utcFormat:function(N){var Y=T(N+="",_);return Y.toString=function(){return N},Y},utcParse:function(N){var Y=C(N+="",!0);return Y.toString=function(){return N},Y}}}var Cy={"-":"",_:" ",0:"0"},se=/^\s*\d+/,cA=/^%/,uA=/[\\^$*+?|[\]().{}]/g;function vt(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 dA(r){return r.replace(uA,"\\$&")}function lo(r){return new RegExp("^(?:"+r.map(dA).join("|")+")","i")}function co(r){return new Map(r.map((t,e)=>[t.toLowerCase(),e]))}function fA(r,t,e){var i=se.exec(t.slice(e,e+1));return i?(r.w=+i[0],e+i[0].length):-1}function pA(r,t,e){var i=se.exec(t.slice(e,e+1));return i?(r.u=+i[0],e+i[0].length):-1}function mA(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.U=+i[0],e+i[0].length):-1}function gA(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.V=+i[0],e+i[0].length):-1}function yA(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.W=+i[0],e+i[0].length):-1}function Ey(r,t,e){var i=se.exec(t.slice(e,e+4));return i?(r.y=+i[0],e+i[0].length):-1}function Iy(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.y=+i[0]+(+i[0]>68?1900:2e3),e+i[0].length):-1}function bA(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 xA(r,t,e){var i=se.exec(t.slice(e,e+1));return i?(r.q=i[0]*3-3,e+i[0].length):-1}function _A(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.m=i[0]-1,e+i[0].length):-1}function Ay(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.d=+i[0],e+i[0].length):-1}function vA(r,t,e){var i=se.exec(t.slice(e,e+3));return i?(r.m=0,r.d=+i[0],e+i[0].length):-1}function My(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.H=+i[0],e+i[0].length):-1}function wA(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.M=+i[0],e+i[0].length):-1}function TA(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.S=+i[0],e+i[0].length):-1}function SA(r,t,e){var i=se.exec(t.slice(e,e+3));return i?(r.L=+i[0],e+i[0].length):-1}function CA(r,t,e){var i=se.exec(t.slice(e,e+6));return i?(r.L=Math.floor(i[0]/1e3),e+i[0].length):-1}function EA(r,t,e){var i=cA.exec(t.slice(e,e+1));return i?e+i[0].length:-1}function IA(r,t,e){var i=se.exec(t.slice(e));return i?(r.Q=+i[0],e+i[0].length):-1}function AA(r,t,e){var i=se.exec(t.slice(e));return i?(r.s=+i[0],e+i[0].length):-1}function Ry(r,t){return vt(r.getDate(),t,2)}function MA(r,t){return vt(r.getHours(),t,2)}function RA(r,t){return vt(r.getHours()%12||12,t,2)}function PA(r,t){return vt(1+ao.count(er(r),r),t,3)}function Py(r,t){return vt(r.getMilliseconds(),t,3)}function LA(r,t){return Py(r,t)+"000"}function GA(r,t){return vt(r.getMonth()+1,t,2)}function kA(r,t){return vt(r.getMinutes(),t,2)}function FA(r,t){return vt(r.getSeconds(),t,2)}function NA(r){var t=r.getDay();return t===0?7:t}function DA(r,t){return vt(ph.count(er(r)-1,r),t,2)}function Ly(r){var t=r.getDay();return t>=4||t===0?hn(r):hn.ceil(r)}function OA(r,t){return r=Ly(r),vt(hn.count(er(r),r)+(er(r).getDay()===4),t,2)}function BA(r){return r.getDay()}function UA(r,t){return vt(mh.count(er(r)-1,r),t,2)}function XA(r,t){return vt(r.getFullYear()%100,t,2)}function WA(r,t){return r=Ly(r),vt(r.getFullYear()%100,t,2)}function ZA(r,t){return vt(r.getFullYear()%1e4,t,4)}function VA(r,t){var e=r.getDay();return r=e>=4||e===0?hn(r):hn.ceil(r),vt(r.getFullYear()%1e4,t,4)}function HA(r){var t=r.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+vt(t/60|0,"0",2)+vt(t%60,"0",2)}function Gy(r,t){return vt(r.getUTCDate(),t,2)}function KA(r,t){return vt(r.getUTCHours(),t,2)}function YA(r,t){return vt(r.getUTCHours()%12||12,t,2)}function zA(r,t){return vt(1+Qu.count(gs(r),r),t,3)}function ky(r,t){return vt(r.getUTCMilliseconds(),t,3)}function jA(r,t){return ky(r,t)+"000"}function JA(r,t){return vt(r.getUTCMonth()+1,t,2)}function $A(r,t){return vt(r.getUTCMinutes(),t,2)}function QA(r,t){return vt(r.getUTCSeconds(),t,2)}function qA(r){var t=r.getUTCDay();return t===0?7:t}function tM(r,t){return vt(Sy.count(gs(r)-1,r),t,2)}function Fy(r){var t=r.getUTCDay();return t>=4||t===0?ln(r):ln.ceil(r)}function eM(r,t){return r=Fy(r),vt(ln.count(gs(r),r)+(gs(r).getUTCDay()===4),t,2)}function iM(r){return r.getUTCDay()}function rM(r,t){return vt(gh.count(gs(r)-1,r),t,2)}function sM(r,t){return vt(r.getUTCFullYear()%100,t,2)}function nM(r,t){return r=Fy(r),vt(r.getUTCFullYear()%100,t,2)}function oM(r,t){return vt(r.getUTCFullYear()%1e4,t,4)}function aM(r,t){var e=r.getUTCDay();return r=e>=4||e===0?ln(r):ln.ceil(r),vt(r.getUTCFullYear()%1e4,t,4)}function hM(){return"+0000"}function Ny(){return"%"}function Dy(r){return+r}function Oy(r){return Math.floor(+r/1e3)}var cn,By;lM({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 lM(r){return cn=lA(r),By=cn.format,cn.parse,cn.utcFormat,cn.utcParse,cn}function cM(r){return new Date(r)}function uM(r){return r instanceof Date?+r:+new Date(+r)}function Uy(r,t,e,i,s,n,o,a,h,l){var c=vy(),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"),_=l("%Y");function v(T){return(h(T)<T?f:a(T)<T?p:o(T)<T?m:n(T)<T?g:i(T)<T?s(T)<T?y:x:e(T)<T?b:_)(T)}return c.invert=function(T){return new Date(u(T))},c.domain=function(T){return arguments.length?d(Array.from(T,uM)):d().map(cM)},c.ticks=function(T){var C=d();return r(C[0],C[C.length-1],T??10)},c.tickFormat=function(T,C){return C==null?v:l(C)},c.nice=function(T){var C=d();return(!T||typeof T.range!="function")&&(T=t(C[0],C[C.length-1],T??10)),T?d($I(C,T)):c},c.copy=function(){return _y(c,Uy(r,t,e,i,s,n,o,a,h,l))},c}function dM(){return by.apply(Uy(aA,hA,er,qu,ph,ao,$u,Ju,an,By).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function uo(r,t,e){this.k=r,this.x=t,this.y=e}uo.prototype={constructor:uo,scale:function(r){return r===1?this:new uo(this.k*r,this.x,this.y)},translate:function(r,t){return r===0&t===0?this:new uo(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+")"}},uo.prototype;function Xy(r){return r.mode==="temporal"||r.mode==="left-aligned"?fM(r):pM(r)}function fM({domain:r,range:t}){return dM().domain(r).range(t)}function pM({domain:r,range:t}){return wy().domain(r).range(t)}function id(r){return{mode:et.horizontal,range:QC(),domain:qC(r)}}function mM(){return{mode:et.vertical}}let un=null;async function gM(){const r=await Ri();Wy(r.start_time),K.on("layoutSettingsUpdated",()=>Wy(r.start_time))}function yM(){un=null}async function Ye(){return un||await be("scaleCreated")}async function Wy(r){await Yt();const t=un?"scaleUpdated":"scaleCreated",e=id(r);un=Xy(e),K.emit(t,un)}function Ar(r){return"getIds"in r}async function Zy({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=Ar(o)?o.getIds():[o.getId()],u=Ar(a)?a.getIds():[a.getId()];if(!h||!l)return console.error("flowRunArtifacts: visible item is missing date"),null;let d;Ar(o)?d=o:Ar(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 Vy(r){const t=await Ht(),e=await zt(),i=await Bt(),s=await Yt();let n=await Ye();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=Ar(o)?{kind:"events",ids:o.getIds(),occurred:o.getDate(),position:d}:{kind:"event",id:o.getId(),occurred:o.getDate(),position:d};Ai(f)}),K.on("scaleUpdated",c=>{n=c,l()}),K.on("viewportMoved",()=>l());async function a(c){await o.render(c),l()}async function h(){return r.type==="event"?await Jg(r.event):await $g()}function l(){const c=o.getDate();if(!c||s.disableEvents||!et.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.eventBottomMargin;u.position.set(f,p)}return{...o,render:a}}async function Hy(r){const t=await zt(),e=await Yt();let i=await Ye();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=Ar(s)?{kind:"events",ids:s.getIds(),occurred:s.getDate(),position:u}:{kind:"event",id:s.getId(),occurred:s.getDate(),position:u};Ai(d)}),K.on("scaleUpdated",h=>{i=h,a()});async function n(h){await s.render(h),a()}async function o(){return r.type==="event"?await Jg(r.event):await $g()}function a(){const h=s.getDate(),{parentStartDate:l}=r;if(!h||e.disableEvents||!et.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 Ky({isRoot:r,parentStartDate:t}={}){const e=await Yt(),i=new Map,s=new Map,n=[];let o=[];const a=new gt;let h=null;K.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 Vy({type:"event",event:p}):await Hy({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||!et.isTemporal()||d()}const d=Yg(async()=>{o=[...n],await Zy({items:i,createCluster:f});for(const p of o)p.render()},Uh);async function f(){if(o.length>0)return o.pop();const p=r?await Vy({type:"cluster"}):await Hy({type:"cluster",parentStartDate:t});return a.addChild(p.element),n.push(p),p}return{element:a,render:l,update:u}}let fo=null,dn=null;async function bM(){const r=await Ht(),t=await Me(),e=await Yt(),i=await Ri(),{element:s,render:n,update:o}=await Ky({isRoot:!0});s.zIndex=Bd;async function a(l){if(!et.isTemporal()||e.disableEvents){r.stage.removeChild(s);return}r.stage.addChild(s),await n(l)}const h=await Xg(()=>({nodeId:t.runId,since:i.start_time,until:i.end_time??new Date}),l=>{const c=dn?"eventDataUpdated":"eventDataCreated";dn=l,K.emit(c,dn),a(l)});K.on("configUpdated",()=>a()),K.on("viewportMoved",()=>o()),K.on("layoutSettingsUpdated",()=>a()),fo=h.stop,h.start()}function xM(){fo==null||fo(),fo=null,dn=null}async function _M(){return dn||await be("eventDataCreated")}async function Yy(r){const t=await Ht(),e=await zt(),i=await Bt(),s=await Yt(),n=await _M();let o=await Ye(),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=Ar(h)?{kind:"artifacts",ids:h.getIds(),position:m}:{kind:"artifact",id:h.getId()};Ai(g)}),K.on("scaleUpdated",d=>{o=d,u()}),K.on("viewportMoved",()=>u()),K.on("eventDataCreated",d=>{a=d.length>0,u()}),K.on("eventDataUpdated",d=>{a=d.length>0,u()});async function l(d){if(Ug(h)){if(r.type!=="artifact")throw new Error(`ArtifactFactory attempted to render a ${r.type}`);await h.render(r.artifact)}else await h.render(d);u()}async function c(){return r.type==="artifact"?await Lu(r.artifact,{cullAtZoomThreshold:!1}):await zg()}function u(){const d=h.getDate();if(!d||!et.isTemporal()||s.disableArtifacts)return;const f=h.getSelected(),{element:p}=h,{eventTargetSize:m,flowStateSelectedBarHeight:g}=i;let y=0;if(f){const{selectedBorderOffset:T,selectedBorderWidth:C}=i;y=T+C*2}const b=o(d)*e.scale._x+e.worldTransform.tx-(p.width-y)/2,_=a&&!s.disableEvents?m:g,v=t.screen.height-(p.height-y)-_;p.position.set(b,v)}return{...h,render:l}}async function zy(r){const t=await zt(),e=await Bt(),i=await Yt();let s=await Ye();const n=await a();n.element.on("click",l=>{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=Ar(n)?{kind:"artifacts",ids:n.getIds(),position:d}:{kind:"artifact",id:n.getId()};Ai(f)}),K.on("scaleUpdated",l=>{s=l,h()});async function o(l){if(Ug(n)){if(r.type!=="artifact")throw new Error(`ArtifactFactory attempted to render a ${r.type}`);await n.render(r.artifact)}else await n.render(l);h()}async function a(){return r.type==="artifact"?await Lu(r.artifact):await zg()}function h(){const l=n.getDate(),{parentStartDate:c}=r;if(!l||!et.isTemporal()||i.disableArtifacts||!c)return;const u=n.getSelected(),{element:d}=n;let f=0;if(u){const{selectedBorderOffset:y,selectedBorderWidth:x}=e;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 jy({isRoot:r,parentStartDate:t}={}){const e=await Yt(),i=new Map,s=new Map,n=[];let o=[];const a=new gt;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(p);s.has(p.id)&&await s.get(p.id);const m=(async()=>{const g=r?await Yy({type:"artifact",artifact:p}):await zy({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(p)}function u(){if(!(e.disableArtifacts||!et.isTemporal())){if(!et.isTemporal()){a.visible=!1;return}a.visible=!0,a.position.x=0,d()}}const d=Yg(async()=>{o=[...n],await Zy({items:i,createCluster:f});for(const p of o)p.render()},Uh);async function f(){if(o.length>0)return o.pop();const p=r?await Yy({type:"cluster"}):await zy({type:"cluster",parentStartDate:t});return a.addChild(p.element),n.push(p),p}return{element:a,render:l,update:u}}async function vM(r){const t=await Ht(),e=await zt(),i=await Bt(),s=await Ri();let n=await Ye();const o=new gt,a=await Ji(),h=await Ji();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};Ai({...r,kind:"state",position:b})}),K.on("viewportMoved",()=>d()),K.on("scaleUpdated",b=>{n=b,d()}),K.on("itemSelected",()=>{const b=$i({kind:"state",...r});b!==u&&(u=b,c=!1,d())}),r.type==="RUNNING"&&!s.end_time&&g();function d(b){const{end:_}=b??{};if(_&&(l=_),s.end_time&&y(),!et.isTemporal()){h.visible=!1,o.visible=!1;return}const v=f();p(v),m(v),h.visible=!0,o.visible=!0}function f(){const{background:b="#fff"}=i.state(r),_=Math.max(n(r.timestamp)*e.scale._x+e.worldTransform.tx,0);let v=0;return r.type==="RUNNING"&&!s.end_time?v=n(new Date)*e.scale._x+e.worldTransform.tx-_:l?v=n(l)*e.scale._x+e.worldTransform.tx-_:v=t.screen.width-_,{x:_,width:Math.max(v,0),background:b}}function p({x:b,width:_,background:v}){const{flowStateBarHeight:T,flowStateSelectedBarHeight:C}=i,E=c||u?C:T;a.x=b,a.y=t.screen.height-E,a.width=_,a.height=E,a.tint=v}function m({x:b,width:_,background:v}){if(r.type==="RUNNING"){h.visible=!1;return}const{flowStateBarHeight:T,flowStateAreaAlpha:C}=i;h.x=b,h.y=0,h.width=_,h.height=t.screen.height-T,h.tint=v,h.alpha=C}function g(){t.ticker.add(x)}function y(){t.ticker.remove(x)}function x(){d()}return{element:o,render:d}}function wM(r){return"isNodesFlowRunStateFactory"in r}async function TM(r){const t=await Ht(),e=await zt(),i=await Bt(),s=await Ri();let n=await Ye();const o=new gt,a=await Ji(),h=await Ji();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",T=>{T.stopPropagation();const C=a.getGlobalPosition(),E={x:C.x,y:C.y,width:a.width*e.scale.x,height:a.height*e.scale.y};Ai({...r,kind:"state",position:E})}),h.eventMode="none",h.cursor="default",K.on("scaleUpdated",T=>{n=T,m()}),K.on("itemSelected",()=>{const T=$i({kind:"state",...r});T!==p&&(p=T,f=!1,m())}),r.type==="RUNNING"&&!s.end_time&&b();function m(T){const{end:C,parentStartDate:E,width:I,height:k}=T??{};if(C&&(l=C),E&&(c=E),I&&(u=I),k&&(d=k),s.end_time&&_(),!et.isTemporal()){o.visible=!1;return}if(!c||u<=0){o.visible=!1;return}const L=g();if(L.width<=0){o.visible=!1;return}y(L),x(L),o.visible=!0}function g(){const{background:T="#fff"}=i.state(r);if(!c)return{x:0,width:0,background:T};const C=n(c);let E=n(r.timestamp)-C;if(E>=u)return{x:u,width:0,background:T};E<0&&(E=0);let I=n(l??new Date)-C;I>u&&(I=u);const k=Math.max(I-E,0);return{x:E,width:k,background:T}}function y({x:T,width:C,background:E}){const{flowStateBarHeight:I,flowStateSelectedBarHeight:k}=i,L=f||p?k:I;a.x=T,a.y=d-L,a.width=C,a.height=L,a.tint=E}function x({x:T,width:C,background:E}){const{flowStateBarHeight:I,flowStateAreaAlpha:k,nodeHeight:L}=i,P=L/2;h.x=T,h.y=P,h.width=C,h.height=d-I-P,h.tint=E,h.alpha=k}function b(){t.ticker.add(v)}function _(){t.ticker.remove(v)}function v(){m()}return{element:o,render:m,isNodesFlowRunStateFactory:!0}}function Jy({isRoot:r}={}){const t=new gt,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 vM(a):await TM(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)}wM(d)?await d.render({end:u,...l}):await d.render(u?{end:u}:void 0)}return{element:t,render:n}}class $y extends gt{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 SM(r){const t=new $y,e=await Me(),i=await Bt(),s=await Yt(),{element:n,render:o}=await Zg(),{element:a,render:h}=await qa(),{element:l,render:c}=await Wg(),{element:u,render:d}=await $a(),{element:f,render:p,getSize:m,stopWorker:g}=await rd(),{element:y,render:x}=await Jy(),{element:b,render:_,update:v}=await Ky({parentStartDate:r.start_time}),{element:T,render:C,update:E}=await jy({parentStartDate:r.start_time});let I=!1,k=!1,L=r,P=!1;t.sortableChildren=!0,u.zIndex=Xh,n.zIndex=Zh,a.zIndex=bn,l.zIndex=bn,f.zIndex=Wh,b.zIndex=Wd,y.zIndex=Zd,T.zIndex=Vd,u.eventMode="none",u.cursor="default";const{start:S,stop:R}=await cm(L.id,N=>{k=!!N.artifacts&&N.artifacts.length>0,p(N),X(N.states),D(N.artifacts),st()}),{start:F,stop:O}=await Xg(()=>({nodeId:L.id,since:L.start_time,until:L.end_time??new Date}),N=>{I=N.length>0,M(N)});t.addChild(n),t.addChild(a),t.addChild(l),l.on("click",N=>{N.stopPropagation(),Z()}),f.position={x:0,y:i.nodeHeight+i.nodesPadding},f.on("rendered",()=>{go(),Tt()});async function U(N){return L=N,await o(N),await j(),await xt(),P&&(await X(),await M(),await D(),await st()),t}async function Z(){P?await Q():await V()}async function st(){const{background:N="#fff"}=i.node(L),{width:Y,height:H}=m(),{height:G}=yt(),{nodeBorderRadius:ut}=i,ht=2;u.position={x:-ht,y:-ht};const wt=et.isTemporal()?G+ht*2:H+ht*2;await d({width:Y+ht*2,height:wt,stroke:ht,radius:[ut,ut,0,0],color:N})}async function X(N){const{height:Y}=yt(),{width:H}=n;await x(N??void 0,{parentStartDate:L.start_time,width:H,height:Y})}async function M(N){if(!P||!et.isTemporal()||s.disableEvents){t.removeChild(b);return}t.addChild(b);const{height:Y}=yt();if(b.position={x:0,y:Y-i.eventBottomMargin},N){await _(N);return}await v()}async function D(N){if(!P||!et.isTemporal()||s.disableArtifacts){t.removeChild(T);return}t.addChild(T);const{eventTargetSize:Y,flowStateSelectedBarHeight:H}=i,{height:G}=yt(),ut=G-(I&&!s.disableEvents?Y:H);if(T.position={x:0,y:ut},N){await C(N);return}await E()}async function V(){P=!0,t.addChild(y),t.addChild(f),t.addChild(u),await Promise.all([S(),F(),U(L)]),Tt()}async function Q(){P=!1,t.removeChild(y),t.removeChild(f),t.removeChild(u),t.removeChild(b),t.removeChild(T),g(),await Promise.all([R(),O(),U(L)]),Tt()}async function j(){const N=i.nodeToggleSize,Y=i.nodeHeight-N,H=n.width>N,G=await c({inside:H,isOpen:P});return G.x=H?Y/2:n.width+i.nodePadding,G.y=Y/2,G}async function xt(){const N=await h(L.label),Y=e.theme==="dark"?i.textDefault:i.textInverse,H=i.nodePadding,G=l.x+l.width+H,ut=n.width+H,ht=n.width>G+N.width+H,wt=i.nodeHeight/2-N.height/2,Rt=ht?G:Math.max(ut,G);return N.position={x:Rt,y:wt},N.tint=ht?Y:i.textDefault,N}function Tt(){P&&(X(),M(),D(),st());const N=yt();t.emit("resized",N)}function yt(){const N=m(),{nodeHeight:Y,nodesPadding:H,eventTargetSize:G,eventBottomMargin:ut,artifactPaddingY:ht,artifactIconSize:wt}=i,Fe=k&&et.isTemporal()&&!s.disableArtifacts?wt+ht*2:0,od=I&&et.isTemporal()&&!s.disableEvents?G+ut:0,ad=P?N.height+Fe+od+H*2:0,hd=P?N.width:0;return{height:Y+ad,width:Math.max(hd,t.width)}}return{kind:"flow-run",element:t,bar:n,render:U}}async function CM(r,t){const e=await Me(),i=await Bt(),s=new $y,{element:n,render:o}=await qa(),{element:a,render:h}=await $a(),{element:l,render:c}=await Zg(),{element:u,render:d}=await Wg(),{element:f,render:p,getSize:m,stopWorker:g}=await rd();s.addChild(l),s.addChild(n);let y=!1,x=r,b=t;s.sortableChildren=!0,a.zIndex=Xh,l.zIndex=Zh,n.zIndex=bn,u.zIndex=bn,f.zIndex=Wh,a.eventMode="none",a.cursor="default",f.position={x:0,y:i.nodeHeight+i.nodesPadding},f.on("rendered",()=>{go(),P()}),u.on("click",S=>{S.stopPropagation(),E()});async function _(S,R){return x=S,b=R,R&&s.addChild(u),await c(S),R&&await v(),y&&(R&&p(R),await C()),await T(),s}async function v(){const S=i.nodeToggleSize,R=i.nodeHeight-S,F=l.width>S,O=await d({inside:F,isOpen:y});return O.x=F?R/2:l.width+i.nodePadding,O.y=R/2,O}async function T(){const S=await o(x.label),R=e.theme==="dark"?i.textDefault:i.textInverse,F=i.nodePadding,O=u.x+u.width+F,U=l.width+F,Z=l.width>O+S.width+F,st=i.nodeHeight/2-S.height/2,X=Z?O:Math.max(U,O);return S.position={x:X,y:st},S.tint=Z?R:i.textDefault,S}async function C(){const{background:S="#fff"}=i.node(x),{width:R,height:F}=m(),{height:O}=L(),{nodeBorderRadius:U}=i,Z=2;a.position={x:-Z,y:-Z};const st=et.isTemporal()?O+Z*2:F+Z*2;await h({width:R+Z*2,height:st,stroke:Z,radius:[U,U,0,0],color:S})}async function E(){y?await k():await I()}async function I(){if(y=!0,s.addChild(f),s.addChild(a),!b)throw new Error("Attempted to open without nested graph data");await Promise.all([p(b),_(x,b)]),P()}async function k(){y=!1,s.removeChild(f),s.removeChild(a),g(),await _(x,b),P()}function L(){const S=m(),{nodeHeight:R,nodesPadding:F}=i,O=y?S.height+F*2:0,U=y?S.width:0;return{height:R+O,width:Math.max(U,s.width)}}function P(){y&&C();const S=L();s.emit("resized",S)}return{kind:"task-run",element:s,render:_,bar:l}}async function EM(r,t){const e=await Me(),i=await Bt(),s=await Ht(),n=await r1(),o=await Yt();let a=null;const h=new Map,{animate:l}=await Rg(),{element:c,render:u,bar:d}=await k(r,t);let f=r,p=t,m=null,g=!1,y=!1;n.add(c),c.eventMode="static",c.cursor="pointer",c.name=Md,c.on("click",S=>{S.stopPropagation(),Ai({kind:f.kind,id:f.id})}),f.end_time||C(),K.on("itemSelected",()=>{const S=$i({kind:f.kind,id:f.id});S!==g&&(g=S,u(f,p))});async function x(S,R){f=S,p=R;const F=L(S);return F===m||(m=F,await Promise.all([u(S,R),b(S.artifacts)]),S.end_time&&E()),c}async function b(S){if(!S||(v(),o.disableArtifacts||!et.isTemporal()))return;const R=[];for(const F of S)R.push(_(F));await Promise.all(R),T()}async function _(S){if(h.has(S.id))return h.get(S.id).render(S);const R=await Lu(S,{enableLocalClickHandling:!0});return h.set(S.id,R),a.addChild(R.element),R.render(S)}function v(){if(et.isTemporal()&&!o.disableArtifacts){a||(a=new gt),c.addChild(a);return}a&&c.removeChild(a)}function T(){if(!a)return;const{artifactsGap:S,artifactsNodeOverlap:R}=i;let F=0;for(const O of h.values())O.element.position.x=F,F+=O.element.width+S;a.position.y=-a.height+R,a.width<d.width&&(a.position.x=d.width-a.width)}function C(){s.ticker.add(I)}function E(){s.ticker.remove(I)}function I(){x(f,p)}async function k(S,R){const{kind:F}=S;switch(F){case"task-run":return await CM(S,R);case"flow-run":return await SM(S);default:const O=F;throw new Error(`switch does not have case for value: ${O}`)}}function L(S){var Z;const R=S.end_time??new Date,F=(Z=S.artifacts)==null?void 0:Z.map(st=>st.type==="progress"?`${st.id}-${st.data}`:st.id).join("|"),O=!!p;return[S.state_type,R.getTime(),et.horizontal,et.horizontalScaleMultiplier,e.theme,o.disableArtifacts||F,O].join("-")}function P({x:S,y:R}){l(c,{x:S,y:R},!y),y=!0}return{element:c,render:x,bar:d,setPosition:P}}function Qy({gap:r=0,minimum:t=0}={}){const e=new Map;function i(c){const u=e.get(c)??[];return Math.max(...u.values(),eh(t))+eh(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)-eh(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}}function IM(r){throw new Error(`switch does not have case for value: ${r}`)}const qy="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIEtlKG4pe3Rocm93IG5ldyBFcnJvcihgc3dpdGNoIGRvZXMgbm90IGhhdmUgY2FzZSBmb3IgdmFsdWU6ICR7bn1gKX1mdW5jdGlvbiBDbihuLGUpe3JldHVybiBuPT1udWxsfHxlPT1udWxsP05hTjpuPGU/LTE6bj5lPzE6bj49ZT8wOk5hTn1mdW5jdGlvbiBudChuLGUpe3JldHVybiBuPT1udWxsfHxlPT1udWxsP05hTjplPG4/LTE6ZT5uPzE6ZT49bj8wOk5hTn1mdW5jdGlvbiBSbihuKXtsZXQgZSx0LHI7bi5sZW5ndGghPT0yPyhlPUNuLHQ9KHUsbCk9PkNuKG4odSksbCkscj0odSxsKT0+bih1KS1sKTooZT1uPT09Q258fG49PT1udD9uOmV0LHQ9bixyPW4pO2Z1bmN0aW9uIG8odSxsLGY9MCxnPXUubGVuZ3RoKXtpZihmPGcpe2lmKGUobCxsKSE9PTApcmV0dXJuIGc7ZG97Y29uc3QgbT1mK2c+Pj4xO3QodVttXSxsKTwwP2Y9bSsxOmc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jMjBKZ3UuanMubWFwCg==",AM=r=>Uint8Array.from(atob(r),t=>t.charCodeAt(0)),t1=typeof self<"u"&&self.Blob&&new Blob([AM(qy)],{type:"text/javascript;charset=utf-8"});function MM(r){let t;try{if(t=t1&&(self.URL||self.webkitURL).createObjectURL(t1),!t)throw"";const e=new Worker(t,{name:r==null?void 0:r.name});return e.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),e}catch{return new Worker("data:text/javascript;base64,"+qy,{name:r==null?void 0:r.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}function RM(r){const t=new MM;return t.onmessage=r,t}async function rd(){const r=new Map,t=new Map,e=new Map,i=new gt,s=new gt,n=await Bt();let o=null;const a=Qy({gap:()=>n.rowGap,minimum:()=>n.nodeHeight}),h=Qy({gap:()=>n.columnGap,minimum:()=>Cu()});let l=null,c=null;i.name=Gh,K.on("layoutUpdated",()=>{a.clear(),h.clear()}),K.on("layoutSettingsUpdated",()=>{c&&i.parent&&u(c),F()}),K.on("itemSelected",()=>{F()});async function u(M){d(),c=M,l=null,await Promise.all([p(M),g(M)]),x(M)}function d(){o||(o=RM(S))}function f(){o&&(o.terminate(),o=null)}async function p(M){const D=[];for(const V of M.nodes.values())D.push(m(V));await Promise.all(D)}async function m(M){const{render:D}=await v(M),V=C(M.id);return await D(M,V)}async function g(M){if((await Yt()).disableEdges){i.removeChild(s);return}i.addChildAt(s,0);const V=[];for(const[Q,{children:j}]of M.nodes)for(const{id:xt}of j)V.push(y(Q,xt));await Promise.all(V)}async function y(M,D){const V=`${M}_${D}`;if(e.has(V))return;const Q=await cE();e.has(V)||(e.set(V,Q),s.addChild(Q.element))}function x(M){if(!o)throw new Error("Layout worker not initialized");const D=new Map;for(const[V,{element:Q}]of t)D.set(V,Q.width);o.postMessage({type:"layout",data:M,widths:D,horizontalSettings:id(M.start_time),verticalSettings:mM()})}function b(){if(l)for(const[M,D]of e){const[V,Q]=M.split("_"),j=l.positions.get(V),xt=l.positions.get(Q),Tt=t.get(V);if(!j||!xt){console.warn(`Could not find edge in layout: Skipping ${M}`);continue}if(!Tt){console.warn(`Could not find parent node in nodes: Skipping ${V}`);continue}const yt=Tt.bar.width,N=E(j),Y={x:N.x+yt,y:N.y+n.nodeHeight/2},H=E(xt),G={x:H.x-Y.x,y:H.y-Y.y+n.nodeHeight/2};D.setPosition(Y,G)}}function _(){if(l){for(const[M,D]of t){const V=l.positions.get(M);if(!V){console.warn(`Could not find node in layout: Skipping ${M}`);continue}const Q=E(V);D.setPosition(Q),a.updateNodeAxis({nodeId:M,axis:V.y}),h.updateNodeAxis({nodeId:M,axis:V.column})}b(),i.emit("rendered"),i.emit("resized",P())}}async function v(M){const D=r.get(M.id);if(D)return D;const V=C(M.id),Q=EM(M,V);r.set(M.id,Q);const j=await Q;return j.element.on("resized",xt=>T(M.id,xt)),i.addChild(j.element),t.set(M.id,j),j}function T(M,D){if(!l)return;const V=t.get(M),Q=l.positions.get(M);!V||!Q||(a.setOffset({nodeId:M,axis:Q.y,offset:D.height}),h.setOffset({nodeId:M,axis:Q.column,offset:D.width}),_())}function C(M){var D;return(D=c==null?void 0:c.nested_task_run_graphs)==null?void 0:D.get(M)}function E(M){const D=a.getTotalOffset(M.y);return{x:I(M),y:D}}function I(M){return et.isDependency()?h.getTotalOffset(M.column):M.x}function k(){return l?a.getTotalValue(l.maxRow):0}function L(){if(!l||!c)return 0;if(et.isDependency())return h.getTotalValue(l.maxColumn);const M=id(c.start_time),D=Xy(M),V=D(c.end_time??new Date),Q=D(c.start_time);return V-Q}function P(){return{width:L(),height:k()}}function S({data:M}){const{type:D}=M;switch(D){case"layout":R(M);return;default:IM(D)}}function R(M){l=M.layout,_()}async function F(){const M=await Yt(),D=LE();if(M.disableEdges||!D||!(c!=null&&c.nodes.has(D.id))){O([]);return}const V=st(D.id);O(V)}function O(M){U(M),Z(M)}function U(M){for(const[D,{element:V}]of t){if(M.length===0||M.includes(D)){V.alpha=1;continue}V.alpha=n.nodeUnselectedAlpha}}function Z(M){for(const[D,{element:V}]of e){const[Q,j]=D.split("_");if(M.length===0||M.includes(Q)&&M.includes(j)){V.alpha=1;continue}V.alpha=n.nodeUnselectedAlpha}}function st(M){const D=X(M,"parents"),V=X(M,"children");return[M,...D,...V]}function X(M,D){const V=c==null?void 0:c.nodes.get(M);if(!V)return[];const Q=[];for(const{id:j}of V[D])Q.push(j),Q.push(...X(j,D));return Q}return{element:i,stopWorker:f,getSize:P,render:u}}let po=null,Mr=null,ys=null;async function PM(){const r=await zt(),t=await Me(),{element:e,render:i}=await rd();r.addChild(e),e.alpha=0;const s=await cm(t.runId,async n=>{const o=Mr?"runDataUpdated":"runDataCreated";Mr=n,K.emit(o,Mr),await Yt(),i(n)});K.on("configUpdated",()=>{Mr&&i(Mr)}),ys=e,po=s.stop,ys.once("rendered",()=>GM()),K.on("layoutUpdated",()=>kM()),s.start()}function LM(){po==null||po(),po=null,ys=null,Mr=null}async function Ri(){return Mr||await be("runDataCreated")}function GM(){nd(),me.shared.addOnce(()=>{ys&&(ys.alpha=1)})}async function kM(){if(!ys)return;const r=await Me();ys.once("rendered",()=>{setTimeout(()=>{nd({animate:!0})},r.animationDuration)})}let Ee=null,sd=null;async function FM(){const r=await Ht(),t=await Nc();Ee=new CS({screenHeight:t.clientHeight,screenWidth:t.clientWidth,events:r.renderer.events,passiveWheel:!1}),Ee.zIndex=Od,Ee.drag().pinch().wheel({trackpadPinch:!0}).decelerate({friction:.9}).clampZoom({minWidth:t.clientWidth/2}),Ee.on("moved",()=>{K.emit("viewportMoved",null)}).on("moved-end",()=>{K.emit("viewportMoved",null)}),r.stage.addChild(Ee),K.emit("viewportCreated",Ee),K.on("applicationResized",WM),K.on("scaleUpdated",()=>mo()),UM()}function NM(){Ee=null,sd=null}async function nd({animate:r}={}){const e=(await zt()).getChildByName(Gh);if(!e)throw new Error("Nodes container not found");HM();const{x:i,y:s,width:n,height:o}=e.getLocalBounds();if(!n||!o){OM({animate:r});return}DM({x:i,y:s,width:n,height:o,animate:r})}async function DM({x:r,y:t,width:e,height:i,animate:s}){const n=await Me(),o=await Bt(),a=await zt(),{guideTextSize:h,guideTextTopPadding:l,columnGap:c,rowGap:u,eventTargetSize:d}=o,f=h+l,p=e+c*2,m=i+u*4+f+d,g=a.findFit(p,m);a.animate({position:{x:r+e/2,y:t+i/2+f},scale:Math.min(g,1),time:s?n.animationDuration:0,ease:"easeInOutQuad",removeOnInterrupt:!0,callbackOnComplete:()=>{go(),mo()}})}async function OM({animate:r}){const t=await Ri(),e=await Me(),i=await Bt(),s=await zt(),n=await Ye();let o=n(t.start_time)-i.columnGap,a=n(t.end_time??new Date)+i.columnGap;if(o>a){const u=o;o=a,a=u}const h=a-o,l=o+h/2,c=s.findFit(h,0);s.animate({position:{x:l,y:0},scale:c,time:r?e.animationDuration:0,ease:"easeInOutQuad",removeOnInterrupt:!0,callbackOnComplete:()=>{go(),mo()}})}async function zt(){return Ee||await be("viewportCreated")}function e1(r){om(sd,r)||(sd=r,K.emit("viewportDateRangeUpdated",r))}function BM({xOffset:r,yOffset:t}){if(!Ee)return;const{x:e,y:i}=Ee.transform.position;Ee.setTransform(e+r,i+t,Ee.transform.scale.x,Ee.transform.scale.y)}async function UM(){const r=await zt();mo(),r.on("moved",()=>mo())}async function mo(){const r=await i1();r&&e1(r)}async function i1(){const r=await zt(),t=await Ye(),e=t.invert(r.left),i=t.invert(r.right);return e instanceof Date&&i instanceof Date?[e,i]:null}async function XM(r){const t=await i1(),e=await Yt();if(r===void 0||e.isDependency()||om(r,t))return;const i=await zt(),s=await Ye(),[n,o]=r,a=s(n),h=s(o),l=a+(h-a)/2;e1(r),i.fitWidth(h-a,!0),i.moveCenter(l,i.center.y)}async function WM(){const r=await Ht(),t=await zt(),e=await Nc(),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),BM({xOffset:a,yOffset:h})}class yh{constructor(){gd(this,"status","visible");gd(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 Pi=null,ze=null,Li=null,ir=null,ai=null;async function ZM(){const r=await zt(),t=await Ht();Pi=new YT({toggle:"renderable"}),ze=new yh,Li=new yh,ai=new yh,ir=new yh,t.ticker.add(()=>{if(r.dirty){const e=r.scale.x>Nd,i=r.scale.x>Gd,s=r.scale.x>kd,n=r.scale.x>Fd;ai==null||ai.toggle(e),ze==null||ze.toggle(i),Li==null||Li.toggle(s),ir==null||ir.toggle(n),Pi==null||Pi.cull(t.renderer.screen),r.dirty=!1}}),K.emit("cullCreated",Pi),K.emit("labelCullCreated",ze),K.emit("iconCullCreated",ze),K.emit("edgeCullCreated",ai),K.emit("toggleCullCreated",ir)}function VM(){Pi=null,ze==null||ze.clear(),ze=null,Li==null||Li.clear(),Li=null,ai==null||ai.clear(),ai=null,ir==null||ir.clear(),ir=null}async function go(){const r=await zt();r.dirty=!0}function HM(){Pi&&Pi.uncull()}async function r1(){return Pi||await be("cullCreated")}async function KM(){return ai||await be("edgeCullCreated")}async function s1(){return ze||await be("labelCullCreated")}async function n1(){return Li||await be("iconCullCreated")}async function YM(){const r=await Ht(),t=await Ri(),e=await Yt(),{element:i,render:s,update:n}=await jy({isRoot:!0});i.zIndex=Xd;function o(a){if(et.isTemporal()&&!e.disableArtifacts){r.stage.addChild(i),s(a==null?void 0:a.artifacts);return}r.stage.removeChild(i)}t.artifacts&&o(t),K.on("viewportMoved",()=>n()),K.on("runDataCreated",a=>o(a)),K.on("runDataUpdated",a=>o(a)),K.on("configUpdated",()=>o()),K.on("layoutSettingsUpdated",()=>o())}function CP(){}async function zM(){const r=await Ht(),t=await Ri(),{element:e,render:i}=await Jy({isRoot:!0});e.zIndex=Ud,r.stage.addChild(e);function s(n){i(n==null?void 0:n.states)}t.states&&s(t),K.on("runDataUpdated",n=>s(n)),K.on("configUpdated",()=>s()),K.on("layoutSettingsUpdated",()=>s())}function EP(){}async function jM(){const r=await Ht(),t=await zt(),e=await Yt(),i=await Bt(),{inter:s}=await Og(),n=new gt,o=await Ji();n.addChild(o);const a=s("");n.addChild(a);let h=await Ye(),l,c;K.on("scaleUpdated",m=>{h=m,p()}),K.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.guideLineWidth,o.height=r.screen.height,o.tint=i.guideLineColor}function f(m){a.text=c(m),a.fontSize=i.guideTextSize,a.tint=i.guideTextColor,a.position.set(i.guideTextLeftPadding,i.guideTextTopPadding)}function p(){l!==void 0&&(n.position.x=h(l)*t.scale._x+t.worldTransform.tx)}return{element:n,render:u}}class o1 extends Error{constructor(){super("Layout is not temporal")}}function JM(r){return r.toLocaleTimeString()}function a1(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?`${bh.date(r)}
1176
+ ${a1(r)}`:a1(r)}const bh={timeBySeconds:JM,timeByMinutesWithDates:QM,date:$M},Qt={seconds:"seconds",minutes:"minutes",date:"date"},yo={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()}},_t={second:1e3,minute:1e3*60,hour:1e3*60*60,day:1e3*60*60*24,week:1e3*60*60*24*7},h1=[{ceiling:_t.second*4,increment:_t.second,labelFormat:Qt.seconds},{ceiling:_t.second*8,increment:_t.second*5,labelFormat:Qt.seconds},{ceiling:_t.second*13,increment:_t.second*10,labelFormat:Qt.seconds},{ceiling:_t.second*20,increment:_t.second*15,labelFormat:Qt.seconds},{ceiling:_t.second*45,increment:_t.second*30,labelFormat:Qt.seconds},{ceiling:_t.minute*4,increment:_t.minute,labelFormat:Qt.minutes},{ceiling:_t.minute*8,increment:_t.minute*5,labelFormat:Qt.minutes},{ceiling:_t.minute*13,increment:_t.minute*10,labelFormat:Qt.minutes},{ceiling:_t.minute*28,increment:_t.minute*15,labelFormat:Qt.minutes},{ceiling:_t.hour*1.24,increment:_t.minute*30,labelFormat:Qt.minutes},{ceiling:_t.hour*3,increment:_t.hour,labelFormat:Qt.minutes},{ceiling:_t.hour*8,increment:_t.hour*2,getAnchor:yo.day,labelFormat:Qt.minutes},{ceiling:_t.hour*13,increment:_t.hour*6,getAnchor:yo.day,labelFormat:Qt.minutes},{ceiling:_t.hour*22,increment:_t.hour*12,getAnchor:yo.day,labelFormat:Qt.minutes},{ceiling:_t.day*4,increment:_t.day,getAnchor:yo.day,labelFormat:Qt.date},{ceiling:_t.week*2,increment:_t.week,getAnchor:yo.week,labelFormat:Qt.date},{ceiling:1/0,increment:_t.week*4,labelFormat:Qt.date}],qM=300;async function tR(){const r=await zt(),t=await Yt(),e=new gt,i=new Map;let s=await Ye();K.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 o1)return;console.error(d)}}async function o(){const d=[];Mu(Bh,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+Dd/r.scale.x);if(!(f instanceof Date)||!(p instanceof Date))throw new o1;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=h1.find(p=>p.ceiling>d)??h1[0];return f.getAnchor||(f.getAnchor=p=>Math.floor(p.getTime()/f.increment)*f.increment),f}function l(d){switch(d){case Qt.minutes:return bh.timeByMinutesWithDates;case Qt.date:return bh.date;default:return bh.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 Mu(Bh,p=>d+f*p)}return{element:e,render:n}}async function eR(){const r=await Ht(),{element:t,render:e}=await tR();r.stage.addChild(t),e(),K.on("viewportDateRangeUpdated",()=>e()),K.on("layoutSettingsUpdated",()=>e()),K.on("configUpdated",()=>e())}function IP(){}const iR=80;async function rR(){const r=await Ht(),t=await zt(),e=await Yt(),i=await Bt(),s=await Ji();let n=await Ye();K.on("scaleUpdated",h=>n=h);function o(){if(!e.isTemporal()){s.visible=!1;return}s.width=i.playheadWidth,s.height=r.stage.height,s.tint=i.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 Ht(),t=await Ri(),{element:e,render:i}=await rR();t.end_time||(r.stage.addChild(e),r.ticker.add(i)),K.on("runDataUpdated",({end_time:s})=>{s&&(r.ticker.remove(i),r.stage.removeChild(e))})}function AP(){}function nR({stage:r,config:t}){OT(),FM(),gM(),eR(),PM(),YM(),bM(),zM(),sR(),EE(),NT(r),HT(t),KC(),ZM(),JC(),RE()}function oR(){K.clear();try{BT(),NM(),yM(),DT(),LM(),xM(),KT(),YC(),AE(),VM(),$C(),PE(),WT()}catch(r){console.error(r)}}q.DEFAULT_EDGE_CONTAINER_NAME=Rd,q.DEFAULT_EDGE_CULLING_THRESHOLD=Nd,q.DEFAULT_EDGE_MINIMUM_BEZIER=Oh,q.DEFAULT_EDGE_POINTS=Dh,q.DEFAULT_GUIDES_COUNT=Bh,q.DEFAULT_GUIDES_MIN_GAP=Dd,q.DEFAULT_HORIZONTAL_SCALE=D1,q.DEFAULT_HORIZONTAL_SCALE_MULTIPLIER=N1,q.DEFAULT_ICON_CULLING_THRESHOLD=kd,q.DEFAULT_LABEL_CULLING_THRESHOLD=Gd,q.DEFAULT_LINEAR_COLUMN_SIZE_PIXELS=Ld,q.DEFAULT_NESTED_GRAPH_BORDER_Z_INDEX=Xh,q.DEFAULT_NESTED_GRAPH_NODES_Z_INDEX=Wh,q.DEFAULT_NESTED_GRAPH_NODE_Z_INDEX=Zh,q.DEFAULT_NODES_CONTAINER_NAME=Gh,q.DEFAULT_NODE_CONTAINER_NAME=Md,q.DEFAULT_NODE_LABEL_Z_INDEX=bn,q.DEFAULT_ROOT_ARTIFACT_Z_INDEX=Xd,q.DEFAULT_ROOT_COLLISION_THROTTLE=Uh,q.DEFAULT_ROOT_EVENT_Z_INDEX=Bd,q.DEFAULT_ROOT_FLOW_STATE_Z_INDEX=Ud,q.DEFAULT_SUBFLOW_ARTIFACT_Z_INDEX=Vd,q.DEFAULT_SUBFLOW_EVENT_Z_INDEX=Wd,q.DEFAULT_SUBFLOW_STATE_Z_INDEX=Zd,q.DEFAULT_TEXTURE_RESOLUTION=Fh,q.DEFAULT_TEXT_RESOLUTION=Nh,q.DEFAULT_TIME_COLUMN_SIZE_PIXELS=kh,q.DEFAULT_TIME_COLUMN_SPAN_SECONDS=Pd,q.DEFAULT_TOGGLE_CULLING_THRESHOLD=Fd,q.DEFAULT_VIEWPORT_Z_INDEX=Od,q.artifactTypeIconMap=Gr,q.artifactTypes=Ie,q.centerViewport=nd,q.emitter=K,q.isArtifactSelection=Sd,q.isArtifactsSelection=Cd,q.isEventSelection=Id,q.isEventsSelection=Ad,q.isHorizontalMode=F1,q.isNodeSelection=Io,q.isRunGraphNodeType=L1,q.isStateSelection=Ed,q.isVerticalMode=k1,q.layout=et,q.resetHorizontalScaleMultiplier=tE,q.runGraphNodeKinds=Lh,q.selectItem=Ai,q.setConfig=nm,q.setDisabledArtifacts=sE,q.setDisabledEdges=rE,q.setDisabledEvents=nE,q.setHorizontalMode=eE,q.setHorizontalScaleMultiplier=Eu,q.setVerticalMode=iE,q.start=nR,q.stateType=G1,q.stop=oR,q.updateViewportFromDateRange=XM,Object.defineProperty(q,Symbol.toStringTag,{value:"Module"})});
1177
1177
  //# sourceMappingURL=graphs.umd.js.map