mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-20 11:24:05 -06:00
1100 lines
651 KiB
JavaScript
1100 lines
651 KiB
JavaScript
(function(){var Ut='<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg>',vt='<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true"><path fill-rule="evenodd" fill="rgb(63, 185, 80)" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg>';document.addEventListener("nav",()=>{let Gt=document.getElementsByTagName("pre");for(let Tt=0;Tt<Gt.length;Tt++){let St=Gt[Tt].getElementsByTagName("code")[0];if(St){let g=function(){navigator.clipboard.writeText(cr).then(()=>{It.blur(),It.innerHTML=vt,setTimeout(()=>{It.innerHTML=Ut,It.style.borderColor=""},2e3)},Vr=>console.error(Vr))};var yt=g;let cr=(St.dataset.clipboard?JSON.parse(St.dataset.clipboard):St.innerText).replace(/\n\n/g,`
|
|
`),It=document.createElement("button");It.className="clipboard-button",It.type="button",It.innerHTML=Ut,It.ariaLabel="Copy source",It.addEventListener("click",g),window.addCleanup(()=>It.removeEventListener("click",g)),Gt[Tt].prepend(It)}}})})(),function(){var Ut=Object.create,vt=Object.defineProperty,Gt=Object.getOwnPropertyDescriptor,yt=Object.getOwnPropertyNames,Tt=Object.getPrototypeOf,St=Object.prototype.hasOwnProperty,g=(p,x)=>()=>(x||p((x={exports:{}}).exports,x),x.exports),cr=(p,x,w,C)=>{if(x&&typeof x=="object"||typeof x=="function")for(let A of yt(x))!St.call(p,A)&&A!==w&&vt(p,A,{get:()=>x[A],enumerable:!(C=Gt(x,A))||C.enumerable});return p},It=(p,x,w)=>(w=p!=null?Ut(Tt(p)):{},cr(x||!p||!p.__esModule?vt(w,"default",{value:p,enumerable:!0}):w,p)),Vr=g(()=>{}),nr=g((p,x)=>{"use strict";x.exports=C;function w(R){return R instanceof Buffer?Buffer.from(R):new R.constructor(R.buffer.slice(),R.byteOffset,R.length)}function C(R){if(R=R||{},R.circles)return A(R);let O=new Map;if(O.set(Date,ae=>new Date(ae)),O.set(Map,(ae,ge)=>new Map($(Array.from(ae),ge))),O.set(Set,(ae,ge)=>new Set($(Array.from(ae),ge))),R.constructorHandlers)for(let ae of R.constructorHandlers)O.set(ae[0],ae[1]);let F=null;return R.proto?xe:se;function $(ae,ge){let Z=Object.keys(ae),Y=new Array(Z.length);for(let Pe=0;Pe<Z.length;Pe++){let b=Z[Pe],E=ae[b];typeof E!="object"||E===null?Y[b]=E:E.constructor!==Object&&(F=O.get(E.constructor))?Y[b]=F(E,ge):ArrayBuffer.isView(E)?Y[b]=w(E):Y[b]=ge(E)}return Y}function se(ae){if(typeof ae!="object"||ae===null)return ae;if(Array.isArray(ae))return $(ae,se);if(ae.constructor!==Object&&(F=O.get(ae.constructor)))return F(ae,se);let ge={};for(let Z in ae){if(Object.hasOwnProperty.call(ae,Z)===!1)continue;let Y=ae[Z];typeof Y!="object"||Y===null?ge[Z]=Y:Y.constructor!==Object&&(F=O.get(Y.constructor))?ge[Z]=F(Y,se):ArrayBuffer.isView(Y)?ge[Z]=w(Y):ge[Z]=se(Y)}return ge}function xe(ae){if(typeof ae!="object"||ae===null)return ae;if(Array.isArray(ae))return $(ae,xe);if(ae.constructor!==Object&&(F=O.get(ae.constructor)))return F(ae,xe);let ge={};for(let Z in ae){let Y=ae[Z];typeof Y!="object"||Y===null?ge[Z]=Y:Y.constructor!==Object&&(F=O.get(Y.constructor))?ge[Z]=F(Y,xe):ArrayBuffer.isView(Y)?ge[Z]=w(Y):ge[Z]=xe(Y)}return ge}}function A(R){let O=[],F=[],$=new Map;if($.set(Date,Z=>new Date(Z)),$.set(Map,(Z,Y)=>new Map(xe(Array.from(Z),Y))),$.set(Set,(Z,Y)=>new Set(xe(Array.from(Z),Y))),R.constructorHandlers)for(let Z of R.constructorHandlers)$.set(Z[0],Z[1]);let se=null;return R.proto?ge:ae;function xe(Z,Y){let Pe=Object.keys(Z),b=new Array(Pe.length);for(let E=0;E<Pe.length;E++){let k=Pe[E],B=Z[k];if(typeof B!="object"||B===null)b[k]=B;else if(B.constructor!==Object&&(se=$.get(B.constructor)))b[k]=se(B,Y);else if(ArrayBuffer.isView(B))b[k]=w(B);else{let N=O.indexOf(B);N!==-1?b[k]=F[N]:b[k]=Y(B)}}return b}function ae(Z){if(typeof Z!="object"||Z===null)return Z;if(Array.isArray(Z))return xe(Z,ae);if(Z.constructor!==Object&&(se=$.get(Z.constructor)))return se(Z,ae);let Y={};O.push(Z),F.push(Y);for(let Pe in Z){if(Object.hasOwnProperty.call(Z,Pe)===!1)continue;let b=Z[Pe];if(typeof b!="object"||b===null)Y[Pe]=b;else if(b.constructor!==Object&&(se=$.get(b.constructor)))Y[Pe]=se(b,ae);else if(ArrayBuffer.isView(b))Y[Pe]=w(b);else{let E=O.indexOf(b);E!==-1?Y[Pe]=F[E]:Y[Pe]=ae(b)}}return O.pop(),F.pop(),Y}function ge(Z){if(typeof Z!="object"||Z===null)return Z;if(Array.isArray(Z))return xe(Z,ge);if(Z.constructor!==Object&&(se=$.get(Z.constructor)))return se(Z,ge);let Y={};O.push(Z),F.push(Y);for(let Pe in Z){let b=Z[Pe];if(typeof b!="object"||b===null)Y[Pe]=b;else if(b.constructor!==Object&&(se=$.get(b.constructor)))Y[Pe]=se(b,ge);else if(ArrayBuffer.isView(b))Y[Pe]=w(b);else{let E=O.indexOf(b);E!==-1?Y[Pe]=F[E]:Y[Pe]=ge(b)}}return O.pop(),F.pop(),Y}}}),M;function sr(p){return typeof p<"u"?p:!0}function Nt(p){let x=Array(p);for(let w=0;w<p;w++)x[w]=we();return x}function we(){return Object.create(null)}function X(p,x){return x.length-p.length}function At(p){return typeof p=="string"}function Zt(p){return typeof p=="object"}function st(p){return typeof p=="function"}function kt(p,x){var w=Rr;if(p&&(x&&(p=lt(p,x)),this.H&&(p=lt(p,this.H)),this.J&&1<p.length&&(p=lt(p,this.J)),w||w==="")){if(x=p.split(w),this.filter){p=this.filter,w=x.length;let C=[];for(let A=0,R=0;A<w;A++){let O=x[A];O&&!p[O]&&(C[R++]=O)}p=C}else p=x;return p}return p}var Rr=/[\p{Z}\p{S}\p{P}\p{C}]+/u,Lt=/[\u0300-\u036f]/g;function Pt(p,x){let w=Object.keys(p),C=w.length,A=[],R="",O=0;for(let F=0,$,se;F<C;F++)$=w[F],(se=p[$])?(A[O++]=pt(x?"(?!\\b)"+$+"(\\b|_)":$),A[O++]=se):R+=(R?"|":"")+$;return R&&(A[O++]=pt(x?"(?!\\b)("+R+")(\\b|_)":"("+R+")"),A[O]=""),A}function lt(p,x){for(let w=0,C=x.length;w<C&&(p=p.replace(x[w],x[w+1]),p);w+=2);return p}function pt(p){return new RegExp(p,"g")}function kr(p){let x="",w="";for(let C=0,A=p.length,R;C<A;C++)(R=p[C])!==w&&(x+=w=R);return x}var Br={encode:Gr,F:!1,G:""};function Gr(p){return kt.call(this,(""+p).toLowerCase(),!1)}var ce={},V={};function de(p){Ve(p,"add"),Ve(p,"append"),Ve(p,"search"),Ve(p,"update"),Ve(p,"remove")}function Ve(p,x){p[x+"Async"]=function(){let w=this,C=arguments;var A=C[C.length-1];let R;return st(A)&&(R=A,delete C[C.length-1]),A=new Promise(function(O){setTimeout(function(){w.async=!0;let F=w[x].apply(w,C);w.async=!1,O(F)})}),R?(A.then(R),this):A}}function Qe(p,x,w,C){let A=p.length,R=[],O,F,$=0;C&&(C=[]);for(let se=A-1;0<=se;se--){let xe=p[se],ae=xe.length,ge=we(),Z=!O;for(let Y=0;Y<ae;Y++){let Pe=xe[Y],b=Pe.length;if(b)for(let E=0,k,B;E<b;E++)if(B=Pe[E],O){if(O[B]){if(!se){if(w)w--;else if(R[$++]=B,$===x)return R}(se||C)&&(ge[B]=1),Z=!0}if(C&&(k=(F[B]||0)+1,F[B]=k,k<A)){let N=C[k-2]||(C[k-2]=[]);N[N.length]=B}}else ge[B]=1}if(C)O||(F=ge);else if(!Z)return[];O=ge}if(C)for(let se=C.length-1,xe,ae;0<=se;se--){xe=C[se],ae=xe.length;for(let ge=0,Z;ge<ae;ge++)if(Z=xe[ge],!O[Z]){if(w)w--;else if(R[$++]=Z,$===x)return R;O[Z]=1}}return R}function rt(p,x){let w=we(),C=we(),A=[];for(let R=0;R<p.length;R++)w[p[R]]=1;for(let R=0,O;R<x.length;R++){O=x[R];for(let F=0,$;F<O.length;F++)$=O[F],w[$]&&!C[$]&&(C[$]=1,A[A.length]=$)}return A}function We(p){this.l=p!==!0&&p,this.cache=we(),this.h=[]}function ft(p,x,w){Zt(p)&&(p=p.query);let C=this.cache.get(p);return C||(C=this.search(p,x,w),this.cache.set(p,C)),C}We.prototype.set=function(p,x){if(!this.cache[p]){var w=this.h.length;for(w===this.l?delete this.cache[this.h[w-1]]:w++,--w;0<w;w--)this.h[w]=this.h[w-1];this.h[0]=p}this.cache[p]=x},We.prototype.get=function(p){let x=this.cache[p];if(this.l&&x&&(p=this.h.indexOf(p))){let w=this.h[p-1];this.h[p-1]=this.h[p],this.h[p]=w}return x};var xt={memory:{charset:"latin:extra",D:3,B:4,m:!1},performance:{D:3,B:3,s:!1,context:{depth:2,D:1}},match:{charset:"latin:extra",G:"reverse"},score:{charset:"latin:advanced",D:20,B:3,context:{depth:3,D:9}},default:{}};function ht(p,x,w,C,A,R,O,F){setTimeout(function(){let $=p(w?w+"."+C:C,JSON.stringify(O));$&&$.then?$.then(function(){x.export(p,x,w,A,R+1,F)}):x.export(p,x,w,A,R+1,F)})}function at(p,x){if(!(this instanceof at))return new at(p);var w;if(p){At(p)?p=xt[p]:(w=p.preset)&&(p=Object.assign({},w[w],p)),w=p.charset;var C=p.lang;At(w)&&(w.indexOf(":")===-1&&(w+=":default"),w=V[w]),At(C)&&(C=ce[C])}else p={};let A,R,O=p.context||{};if(this.encode=p.encode||w&&w.encode||Gr,this.register=x||we(),this.D=A=p.resolution||9,this.G=x=w&&w.G||p.tokenize||"strict",this.depth=x==="strict"&&O.depth,this.l=sr(O.bidirectional),this.s=R=sr(p.optimize),this.m=sr(p.fastupdate),this.B=p.minlength||1,this.C=p.boost,this.map=R?Nt(A):we(),this.A=A=O.resolution||1,this.h=R?Nt(A):we(),this.F=w&&w.F||p.rtl,this.H=(x=p.matcher||C&&C.H)&&Pt(x,!1),this.J=(x=p.stemmer||C&&C.J)&&Pt(x,!0),w=x=p.filter||C&&C.filter){w=x,C=we();for(let F=0,$=w.length;F<$;F++)C[w[F]]=1;w=C}this.filter=w,this.cache=(x=p.cache)&&new We(x)}M=at.prototype,M.append=function(p,x){return this.add(p,x,!0)},M.add=function(p,x,w,C){if(x&&(p||p===0)){if(!C&&!w&&this.register[p])return this.update(p,x);if(x=this.encode(x),C=x.length){let se=we(),xe=we(),ae=this.depth,ge=this.D;for(let Z=0;Z<C;Z++){let Y=x[this.F?C-1-Z:Z];var A=Y.length;if(Y&&A>=this.B&&(ae||!xe[Y])){var R=ke(ge,C,Z),O="";switch(this.G){case"full":if(2<A){for(R=0;R<A;R++)for(var F=A;F>R;F--)if(F-R>=this.B){var $=ke(ge,C,Z,A,R);O=Y.substring(R,F),Ne(this,xe,O,$,p,w)}break}case"reverse":if(1<A){for(F=A-1;0<F;F--)O=Y[F]+O,O.length>=this.B&&Ne(this,xe,O,ke(ge,C,Z,A,F),p,w);O=""}case"forward":if(1<A){for(F=0;F<A;F++)O+=Y[F],O.length>=this.B&&Ne(this,xe,O,R,p,w);break}default:if(this.C&&(R=Math.min(R/this.C(x,Y,Z)|0,ge-1)),Ne(this,xe,Y,R,p,w),ae&&1<C&&Z<C-1){for(A=we(),O=this.A,R=Y,F=Math.min(ae+1,C-Z),A[R]=1,$=1;$<F;$++)if((Y=x[this.F?C-1-Z-$:Z+$])&&Y.length>=this.B&&!A[Y]){A[Y]=1;let Pe=this.l&&Y>R;Ne(this,se,Pe?R:Y,ke(O+(C/2>O?0:1),C,Z,F-1,$-1),p,w,Pe?Y:R)}}}}}this.m||(this.register[p]=1)}}return this};function ke(p,x,w,C,A){return w&&1<p?x+(C||0)<=p?w+(A||0):(p-1)/(x+(C||0))*(w+(A||0))+1|0:0}function Ne(p,x,w,C,A,R,O){let F=O?p.h:p.map;(!x[w]||O&&!x[w][O])&&(p.s&&(F=F[C]),O?(x=x[w]||(x[w]=we()),x[O]=1,F=F[O]||(F[O]=we())):x[w]=1,F=F[w]||(F[w]=[]),p.s||(F=F[C]||(F[C]=[])),R&&F.includes(A)||(F[F.length]=A,p.m&&(p=p.register[A]||(p.register[A]=[]),p[p.length]=F)))}M.search=function(p,x,w){w||(!x&&Zt(p)?(w=p,p=w.query):Zt(x)&&(w=x));let C=[],A,R,O=0;if(w){p=w.query||p,x=w.limit,O=w.offset||0;var F=w.context;R=w.suggest}if(p&&(p=this.encode(""+p),A=p.length,1<A)){w=we();var $=[];for(let xe=0,ae=0,ge;xe<A;xe++)if((ge=p[xe])&&ge.length>=this.B&&!w[ge])if(this.s||R||this.map[ge])$[ae++]=ge,w[ge]=1;else return C;p=$,A=p.length}if(!A)return C;x||(x=100),F=this.depth&&1<A&&F!==!1,w=0;let se;F?(se=p[0],w=1):1<A&&p.sort(X);for(let xe,ae;w<A;w++){if(ae=p[w],F?(xe=Te(this,C,R,x,O,A===2,ae,se),R&&xe===!1&&C.length||(se=ae)):xe=Te(this,C,R,x,O,A===1,ae),xe)return xe;if(R&&w===A-1){if($=C.length,!$){if(F){F=0,w=-1;continue}return C}if($===1)return Re(C[0],x,O)}}return Qe(C,x,O,R)};function Te(p,x,w,C,A,R,O,F){let $=[],se=F?p.h:p.map;if(p.s||(se=it(se,O,F,p.l)),se){let xe=0,ae=Math.min(se.length,F?p.A:p.D);for(let ge=0,Z=0,Y,Pe;ge<ae&&!((Y=se[ge])&&(p.s&&(Y=it(Y,O,F,p.l)),A&&Y&&R&&(Pe=Y.length,Pe<=A?(A-=Pe,Y=null):(Y=Y.slice(A),A=0)),Y&&($[xe++]=Y,R&&(Z+=Y.length,Z>=C))));ge++);if(xe){if(R)return Re($,C,0);x[x.length]=$;return}}return!w&&$}function Re(p,x,w){return p=p.length===1?p[0]:[].concat.apply([],p),w||p.length>x?p.slice(w,w+x):p}function it(p,x,w,C){return w?(C=C&&x>w,p=(p=p[C?x:w])&&p[C?w:x]):p=p[x],p}M.contain=function(p){return!!this.register[p]},M.update=function(p,x){return this.remove(p).add(p,x)},M.remove=function(p,x){let w=this.register[p];if(w){if(this.m)for(let C=0,A;C<w.length;C++)A=w[C],A.splice(A.indexOf(p),1);else Ae(this.map,p,this.D,this.s),this.depth&&Ae(this.h,p,this.A,this.s);if(x||delete this.register[p],this.cache){x=this.cache;for(let C=0,A,R;C<x.h.length;C++)R=x.h[C],A=x.cache[R],A.includes(p)&&(x.h.splice(C--,1),delete x.cache[R])}}return this};function Ae(p,x,w,C,A){let R=0;if(p.constructor===Array)if(A)x=p.indexOf(x),x!==-1?1<p.length&&(p.splice(x,1),R++):R++;else{A=Math.min(p.length,w);for(let O=0,F;O<A;O++)(F=p[O])&&(R=Ae(F,x,w,C,A),C||R||delete p[O])}else for(let O in p)(R=Ae(p[O],x,w,C,A))||delete p[O];return R}M.searchCache=ft,M.export=function(p,x,w,C,A,R){let O=!0;typeof R>"u"&&(O=new Promise(se=>{R=se}));let F,$;switch(A||(A=0)){case 0:if(F="reg",this.m){$=we();for(let se in this.register)$[se]=1}else $=this.register;break;case 1:F="cfg",$={doc:0,opt:this.s?1:0};break;case 2:F="map",$=this.map;break;case 3:F="ctx",$=this.h;break;default:typeof w>"u"&&R&&R();return}return ht(p,x||this,w,F,C,A,$,R),O},M.import=function(p,x){if(x)switch(At(x)&&(x=JSON.parse(x)),p){case"cfg":this.s=!!x.opt;break;case"reg":this.m=!1,this.register=x;break;case"map":this.map=x;break;case"ctx":this.h=x}},de(at.prototype);function et(p){p=p.data;var x=self._index;let w=p.args;var C=p.task;switch(C){case"init":C=p.options||{},p=p.factory,x=C.encode,C.cache=!1,x&&x.indexOf("function")===0&&(C.encode=Function("return "+x)()),p?(Function("return "+p)()(self),self._index=new self.FlexSearch.Index(C),delete self.FlexSearch):self._index=new at(C);break;default:p=p.id,x=x[C].apply(x,w),postMessage(C==="search"?{id:p,msg:x}:{id:p})}}var Bt=0;function G(p){if(!(this instanceof G))return new G(p);var x;p?st(x=p.encode)&&(p.encode=x.toString()):p={},(x=(self||window)._factory)&&(x=x.toString());let w=typeof window>"u"&&self.exports,C=this;this.o=pe(x,w,p.worker),this.h=we(),this.o&&(w?this.o.on("message",function(A){C.h[A.id](A.msg),delete C.h[A.id]}):this.o.onmessage=function(A){A=A.data,C.h[A.id](A.msg),delete C.h[A.id]},this.o.postMessage({task:"init",factory:x,options:p}))}W("add"),W("append"),W("search"),W("update"),W("remove");function W(p){G.prototype[p]=G.prototype[p+"Async"]=function(){let x=this,w=[].slice.call(arguments);var C=w[w.length-1];let A;return st(C)&&(A=C,w.splice(w.length-1,1)),C=new Promise(function(R){setTimeout(function(){x.h[++Bt]=R,x.o.postMessage({task:p,id:Bt,args:w})})}),A?(C.then(A),this):C}}function pe(p,x,w){let C;try{C=x?new(Vr()).Worker(__dirname+"/node/node.js"):p?new Worker(URL.createObjectURL(new Blob(["onmessage="+et.toString()],{type:"text/javascript"}))):new Worker(At(w)?w:"worker/worker.js",{type:"module"})}catch{}return C}function Ie(p){if(!(this instanceof Ie))return new Ie(p);var x=p.document||p.doc||p,w;this.K=[],this.h=[],this.A=[],this.register=we(),this.key=(w=x.key||x.id)&&Oe(w,this.A)||"id",this.m=sr(p.fastupdate),this.C=(w=x.store)&&w!==!0&&[],this.store=w&&we(),this.I=(w=x.tag)&&Oe(w,this.A),this.l=w&&we(),this.cache=(w=p.cache)&&new We(w),p.cache=!1,this.o=p.worker,this.async=!1,w=we();let C=x.index||x.field||x;At(C)&&(C=[C]);for(let A=0,R,O;A<C.length;A++)R=C[A],At(R)||(O=R,R=R.field),O=Zt(O)?Object.assign({},p,O):p,this.o&&(w[R]=new G(O),w[R].o||(this.o=!1)),this.o||(w[R]=new at(O,this.register)),this.K[A]=Oe(R,this.A),this.h[A]=R;if(this.C)for(p=x.store,At(p)&&(p=[p]),x=0;x<p.length;x++)this.C[x]=Oe(p[x],this.A);this.index=w}function Oe(p,x){let w=p.split(":"),C=0;for(let A=0;A<w.length;A++)p=w[A],0<=p.indexOf("[]")&&(p=p.substring(0,p.length-2))&&(x[C]=!0),p&&(w[C++]=p);return C<w.length&&(w.length=C),1<C?w:w[0]}function Ee(p,x){if(At(x))p=p[x];else for(let w=0;p&&w<x.length;w++)p=p[x[w]];return p}function le(p,x,w,C,A){if(p=p[A],C===w.length-1)x[A]=p;else if(p)if(p.constructor===Array)for(x=x[A]=Array(p.length),A=0;A<p.length;A++)le(p,x,w,C,A);else x=x[A]||(x[A]=we()),A=w[++C],le(p,x,w,C,A)}function ze(p,x,w,C,A,R,O,F){if(p=p[O])if(C===x.length-1){if(p.constructor===Array){if(w[C]){for(x=0;x<p.length;x++)A.add(R,p[x],!0,!0);return}p=p.join(" ")}A.add(R,p,F,!0)}else if(p.constructor===Array)for(O=0;O<p.length;O++)ze(p,x,w,C,A,R,O,F);else O=x[++C],ze(p,x,w,C,A,R,O,F)}M=Ie.prototype,M.add=function(p,x,w){if(Zt(p)&&(x=p,p=Ee(x,this.key)),x&&(p||p===0)){if(!w&&this.register[p])return this.update(p,x);for(let C=0,A,R;C<this.h.length;C++)R=this.h[C],A=this.K[C],At(A)&&(A=[A]),ze(x,A,this.A,0,this.index[R],p,A[0],w);if(this.I){let C=Ee(x,this.I),A=we();At(C)&&(C=[C]);for(let R=0,O,F;R<C.length;R++)if(O=C[R],!A[O]&&(A[O]=1,F=this.l[O]||(this.l[O]=[]),!w||!F.includes(p))&&(F[F.length]=p,this.m)){let $=this.register[p]||(this.register[p]=[]);$[$.length]=F}}if(this.store&&(!w||!this.store[p])){let C;if(this.C){C=we();for(let A=0,R;A<this.C.length;A++)R=this.C[A],At(R)?C[R]=x[R]:le(x,C,R,0,R[0])}this.store[p]=C||x}}return this},M.append=function(p,x){return this.add(p,x,!0)},M.update=function(p,x){return this.remove(p).add(p,x)},M.remove=function(p){if(Zt(p)&&(p=Ee(p,this.key)),this.register[p]){for(var x=0;x<this.h.length&&(this.index[this.h[x]].remove(p,!this.o),!this.m);x++);if(this.I&&!this.m)for(let w in this.l){x=this.l[w];let C=x.indexOf(p);C!==-1&&(1<x.length?x.splice(C,1):delete this.l[w])}this.store&&delete this.store[p],delete this.register[p]}return this},M.search=function(p,x,w,C){w||(!x&&Zt(p)?(w=p,p=""):Zt(x)&&(w=x,x=0));let A=[],R=[],O,F,$,se,xe,ae,ge=0;if(w)if(w.constructor===Array)$=w,w=null;else{if(p=w.query||p,$=(O=w.pluck)||w.index||w.field,se=w.tag,F=this.store&&w.enrich,xe=w.bool==="and",x=w.limit||x||100,ae=w.offset||0,se&&(At(se)&&(se=[se]),!p)){for(let Y=0,Pe;Y<se.length;Y++)(Pe=gt.call(this,se[Y],x,ae,F))&&(A[A.length]=Pe,ge++);return ge?A:[]}At($)&&($=[$])}$||($=this.h),xe=xe&&(1<$.length||se&&1<se.length);let Z=!C&&(this.o||this.async)&&[];for(let Y=0,Pe,b,E;Y<$.length;Y++){let k;if(b=$[Y],At(b)||(k=b,b=k.field,p=k.query||p,x=k.limit||x,F=k.enrich||F),Z)Z[Y]=this.index[b].searchAsync(p,x,k||w);else{if(C?Pe=C[Y]:Pe=this.index[b].search(p,x,k||w),E=Pe&&Pe.length,se&&E){let B=[],N=0;xe&&(B[0]=[Pe]);for(let H=0,Q,ie;H<se.length;H++)Q=se[H],(E=(ie=this.l[Q])&&ie.length)&&(N++,B[B.length]=xe?[ie]:ie);N&&(Pe=xe?Qe(B,x||100,ae||0):rt(Pe,B),E=Pe.length)}if(E)R[ge]=b,A[ge++]=Pe;else if(xe)return[]}}if(Z){let Y=this;return new Promise(function(Pe){Promise.all(Z).then(function(b){Pe(Y.search(p,x,w,b))})})}if(!ge)return[];if(O&&(!F||!this.store))return A[0];for(let Y=0,Pe;Y<R.length;Y++){if(Pe=A[Y],Pe.length&&F&&(Pe=Vt.call(this,Pe)),O)return Pe;A[Y]={field:R[Y],result:Pe}}return A};function gt(p,x,w,C){let A=this.l[p],R=A&&A.length-w;if(R&&0<R)return(R>x||w)&&(A=A.slice(w,w+x)),C&&(A=Vt.call(this,A)),{tag:p,result:A}}function Vt(p){let x=Array(p.length);for(let w=0,C;w<p.length;w++)C=p[w],x[w]={id:C,doc:this.store[C]};return x}M.contain=function(p){return!!this.register[p]},M.get=function(p){return this.store[p]},M.set=function(p,x){return this.store[p]=x,this},M.searchCache=ft,M.export=function(p,x,w,C,A,R){let O;if(typeof R>"u"&&(O=new Promise(F=>{R=F})),A||(A=0),C||(C=0),C<this.h.length){let F=this.h[C],$=this.index[F];x=this,setTimeout(function(){$.export(p,x,A?F:"",C,A++,R)||(C++,A=1,x.export(p,x,F,C,A,R))})}else{let F,$;switch(A){case 1:F="tag",$=this.l,w=null;break;case 2:F="store",$=this.store,w=null;break;default:R();return}ht(p,this,w,F,C,A,$,R)}return O},M.import=function(p,x){if(x)switch(At(x)&&(x=JSON.parse(x)),p){case"tag":this.l=x;break;case"reg":this.m=!1,this.register=x;for(let C=0,A;C<this.h.length;C++)A=this.index[this.h[C]],A.register=x,A.m=!1;break;case"store":this.store=x;break;default:p=p.split(".");let w=p[0];p=p[1],w&&p&&this.index[w].import(p,x)}},de(Ie.prototype);var ar={encode:ut,F:!1,G:""},$e=[pt("[\xE0\xE1\xE2\xE3\xE4\xE5]"),"a",pt("[\xE8\xE9\xEA\xEB]"),"e",pt("[\xEC\xED\xEE\xEF]"),"i",pt("[\xF2\xF3\xF4\xF5\xF6\u0151]"),"o",pt("[\xF9\xFA\xFB\xFC\u0171]"),"u",pt("[\xFD\u0177\xFF]"),"y",pt("\xF1"),"n",pt("[\xE7c]"),"k",pt("\xDF"),"s",pt(" & ")," and "];function ut(p){var x=p=""+p;return x.normalize&&(x=x.normalize("NFD").replace(Lt,"")),kt.call(this,x.toLowerCase(),!p.normalize&&$e)}var Ge={encode:He,F:!1,G:"strict"},ye=/[^a-z0-9]+/,bt={b:"p",v:"f",w:"f",z:"s",x:"s",\u00DF:"s",d:"t",n:"m",c:"k",g:"k",j:"k",q:"k",i:"e",y:"e",u:"o"};function He(p){p=ut.call(this,p).join(" ");let x=[];if(p){let w=p.split(ye),C=w.length;for(let A=0,R,O=0;A<C;A++)if((p=w[A])&&(!this.filter||!this.filter[p])){R=p[0];let F=bt[R]||R,$=F;for(let se=1;se<p.length;se++){R=p[se];let xe=bt[R]||R;xe&&xe!==$&&(F+=xe,$=xe)}x[O++]=F}}return x}var ve={encode:rr,F:!1,G:""},fr=[pt("ae"),"a",pt("oe"),"o",pt("sh"),"s",pt("th"),"t",pt("ph"),"f",pt("pf"),"f",pt("(?![aeo])h(?![aeo])"),"",pt("(?!^[aeo])h(?!^[aeo])"),""];function rr(p,x){return p&&(p=He.call(this,p).join(" "),2<p.length&&(p=lt(p,fr)),x||(1<p.length&&(p=kr(p)),p&&(p=p.split(" ")))),p||[]}var Ke={encode:ri,F:!1,G:""},Et=pt("(?!\\b)[aeo]");function ri(p){return p&&(p=rr.call(this,p,!0),1<p.length&&(p=p.replace(Et,"")),1<p.length&&(p=kr(p)),p&&(p=p.split(" "))),p||[]}V["latin:default"]=Br,V["latin:simple"]=ar,V["latin:balance"]=Ge,V["latin:advanced"]=ve,V["latin:extra"]=Ke;var ot={Index:at,Document:Ie,Worker:G,registerCharset:function(p,x){V[p]=x},registerLanguage:function(p,x){ce[p]=x}};function bi(p,x){if(!p)return;function w(A){A.target===this&&(A.preventDefault(),A.stopPropagation(),x())}function C(A){A.key.startsWith("Esc")&&(A.preventDefault(),x())}p?.addEventListener("click",w),window.addCleanup(()=>p?.removeEventListener("click",w)),document.addEventListener("keydown",C),window.addCleanup(()=>document.removeEventListener("keydown",C))}function Ot(p){for(;p.firstChild;)p.removeChild(p.firstChild)}var Xe=Object.hasOwnProperty,Di=It(nr(),1),nt=(0,Di.default)();function jr(p){let x=rn(Cn(p,"index"),!0);return x.length===0?"/":x}var Mt=(p,x,w)=>{let C=new URL(p.getAttribute(x),w);p.setAttribute(x,C.pathname+C.hash)};function Ye(p,x){p.querySelectorAll('[href=""], [href^="./"], [href^="../"]').forEach(w=>Mt(w,"href",x)),p.querySelectorAll('[src=""], [src^="./"], [src^="../"]').forEach(w=>Mt(w,"src",x))}function Ui(p){let x=p.split("/").filter(w=>w!=="").slice(0,-1).map(w=>"..").join("/");return x.length===0&&(x="."),x}function Wr(p,x){return wt(Ui(p),jr(x))}function wt(...p){if(p.length===0)return"";let x=p.filter(w=>w!==""&&w!=="/").map(w=>rn(w)).join("/");return p[0].startsWith("/")&&(x="/"+x),p[p.length-1].endsWith("/")&&(x=x+"/"),x}function wi(p,x){return p===x||p.endsWith("/"+x)}function Cn(p,x){return wi(p,x)&&(p=p.slice(0,-x.length)),p}function rn(p,x){return p.startsWith("/")&&(p=p.substring(1)),!x&&p.endsWith("/")&&(p=p.slice(0,-1)),p}var Rt="basic",zt="",An=p=>p.toLowerCase().split(/([^a-z]|[^\x00-\x7F])/),Ti=new ot.Document({charset:"latin:extra",encode:An,document:{id:"id",tag:"tags",index:[{field:"title",tokenize:"forward"},{field:"content",tokenize:"forward"},{field:"tags",tokenize:"forward"}]}}),nn=new DOMParser,Si=new Map,Ei=30,Li=8,Pn=5,Mn=p=>{let x=p.split(/\s+/).filter(C=>C.trim()!==""),w=x.length;if(w>1)for(let C=1;C<w;C++)x.push(x.slice(0,C+1).join(" "));return x.sort((C,A)=>A.length-C.length)};function Ir(p,x,w){let C=Mn(p),A=x.split(/\s+/).filter($=>$!==""),R=0,O=A.length-1;if(w){let $=ge=>C.some(Z=>ge.toLowerCase().startsWith(Z.toLowerCase())),se=A.map($),xe=0,ae=0;for(let ge=0;ge<Math.max(A.length-Ei,0);ge++){let Z=se.slice(ge,ge+Ei).reduce((Y,Pe)=>Y+(Pe?1:0),0);Z>=xe&&(xe=Z,ae=ge)}R=Math.max(ae-Ei,0),O=Math.min(R+2*Ei,A.length-1),A=A.slice(R,O)}let F=A.map($=>{for(let se of C)if($.toLowerCase().includes(se.toLowerCase())){let xe=new RegExp(se.toLowerCase(),"gi");return $.replace(xe,'<span class="highlight">$&</span>')}return $}).join(" ");return`${R===0?"":"..."}${F}${O===A.length-1?"":"..."}`}function Ni(p,x){let w=new DOMParser,C=Mn(p),A=w.parseFromString(x.innerHTML,"text/html"),R=F=>{let $=document.createElement("span");return $.className="highlight",$.textContent=F,$},O=(F,$)=>{if(F.nodeType===Node.TEXT_NODE){let se=F.nodeValue??"",xe=new RegExp($.toLowerCase(),"gi"),ae=se.match(xe);if(!ae||ae.length===0)return;let ge=document.createElement("span"),Z=0;for(let Y of ae){let Pe=se.indexOf(Y,Z);ge.appendChild(document.createTextNode(se.slice(Z,Pe))),ge.appendChild(R(Y)),Z=Pe+Y.length}ge.appendChild(document.createTextNode(se.slice(Z))),F.parentNode?.replaceChild(ge,F)}else if(F.nodeType===Node.ELEMENT_NODE){if(F.classList.contains("highlight"))return;Array.from(F.childNodes).forEach(se=>O(se,$))}};for(let F of C)O(A.body,F);return A.body}async function sn(p,x,w){let C=p.querySelector(".search-container");if(!C)return;let A=C.closest(".sidebar"),R=p.querySelector(".search-button");if(!R)return;let O=p.querySelector(".search-bar");if(!O)return;let F=p.querySelector(".search-layout");if(!F)return;let $=Object.keys(w),se=ee=>{F.appendChild(ee)},xe=F.dataset.preview==="true",ae,ge,Z=document.createElement("div");Z.className="results-container",se(Z),xe&&(ae=document.createElement("div"),ae.className="preview-container",se(ae));function Y(){C.classList.remove("active"),O.value="",A&&(A.style.zIndex=""),Ot(Z),ae&&Ot(ae),F.classList.remove("display-results"),Rt="basic",R.focus()}function Pe(ee){Rt=ee,A&&(A.style.zIndex="1"),C.classList.add("active"),O.focus()}let b=null;async function E(ee){if(ee.key==="k"&&(ee.ctrlKey||ee.metaKey)&&!ee.shiftKey){ee.preventDefault(),C.classList.contains("active")?Y():Pe("basic");return}else if(ee.shiftKey&&(ee.ctrlKey||ee.metaKey)&&ee.key.toLowerCase()==="k"){ee.preventDefault(),C.classList.contains("active")?Y():Pe("tags"),O.value="#";return}if(b&&b.classList.remove("focus"),!!C.classList.contains("active")){if(ee.key==="Enter"&&!ee.isComposing)if(Z.contains(document.activeElement)){let j=document.activeElement;if(j.classList.contains("no-match"))return;await be(j),j.click()}else{let j=document.getElementsByClassName("result-card")[0];if(!j||j.classList.contains("no-match"))return;await be(j),j.click()}else if(ee.key==="ArrowUp"||ee.shiftKey&&ee.key==="Tab"){if(ee.preventDefault(),Z.contains(document.activeElement)){let j=b||document.activeElement,he=j?.previousElementSibling;j?.classList.remove("focus"),he?.focus(),he&&(b=he),await be(he)}}else if((ee.key==="ArrowDown"||ee.key==="Tab")&&(ee.preventDefault(),document.activeElement===O||b!==null)){let j=b||document.getElementsByClassName("result-card")[0],he=j?.nextElementSibling;j?.classList.remove("focus"),he?.focus(),he&&(b=he),await be(he)}}}let k=(ee,j)=>{let he=$[j];return{id:j,slug:he,title:Rt==="tags"?w[he].title:Ir(ee,w[he].title??""),content:Ir(ee,w[he].content??"",!0),tags:B(ee.substring(1),w[he].tags)}};function B(ee,j){return!j||Rt!=="tags"?[]:j.map(he=>he.toLowerCase().includes(ee.toLowerCase())?`<li><p class="match-tag">#${he}</p></li>`:`<li><p>#${he}</p></li>`).slice(0,Pn)}function N(ee){return new URL(Wr(x,ee),location.toString())}let H=({slug:ee,title:j,content:he,tags:K})=>{let te=K.length>0?`<ul class="tags">${K.join("")}</ul>`:"",fe=document.createElement("a");fe.classList.add("result-card"),fe.id=ee,fe.href=N(ee).toString(),fe.innerHTML=`
|
|
<h3 class="card-title">${j}</h3>
|
|
${te}
|
|
<p class="card-description">${he}</p>
|
|
`,fe.addEventListener("click",qe=>{qe.altKey||qe.ctrlKey||qe.metaKey||qe.shiftKey||Y()});let _e=qe=>{qe.altKey||qe.ctrlKey||qe.metaKey||qe.shiftKey||Y()};async function Ue(qe){if(!qe.target)return;let tt=qe.target;await be(tt)}return fe.addEventListener("mouseenter",Ue),window.addCleanup(()=>fe.removeEventListener("mouseenter",Ue)),fe.addEventListener("click",_e),window.addCleanup(()=>fe.removeEventListener("click",_e)),fe};async function Q(ee){if(Ot(Z),ee.length===0?Z.innerHTML=`<a class="result-card no-match">
|
|
<h3>No results.</h3>
|
|
<p>Try another search term?</p>
|
|
</a>`:Z.append(...ee.map(H)),ee.length===0&&ae)Ot(ae);else{let j=Z.firstElementChild;j.classList.add("focus"),b=j,await be(j)}}async function ie(ee){if(Si.has(ee))return Si.get(ee);let j=N(ee).toString(),he=await fetch(j).then(K=>K.text()).then(K=>{if(K===void 0)throw new Error(`Could not fetch ${j}`);let te=nn.parseFromString(K??"","text/html");return Ye(te,j),[...te.getElementsByClassName("popover-hint")]});return Si.set(ee,he),he}async function be(ee){if(!F||!xe||!ee||!ae)return;let j=ee.id,he=await ie(j).then(K=>K.flatMap(te=>[...Ni(zt,te).children]));ge=document.createElement("div"),ge.classList.add("preview-inner"),ge.append(...he),ae.replaceChildren(ge),[...ae.getElementsByClassName("highlight")].sort((K,te)=>te.innerHTML.length-K.innerHTML.length)[0]?.scrollIntoView({block:"start"})}async function Ce(ee){if(!F||!Ti)return;zt=ee.target.value,F.classList.toggle("display-results",zt!==""),Rt=zt.startsWith("#")?"tags":"basic";let j;if(Rt==="tags"){zt=zt.substring(1).trim();let te=zt.indexOf(" ");if(te!=-1){let fe=zt.substring(0,te),_e=zt.substring(te+1).trim();j=await Ti.searchAsync({query:_e,limit:Math.max(Li,1e4),index:["title","content"],tag:fe});for(let Ue of j)Ue.result=Ue.result.slice(0,Li);Rt="basic",zt=_e}else j=await Ti.searchAsync({query:zt,limit:Li,index:["tags"]})}else Rt==="basic"&&(j=await Ti.searchAsync({query:zt,limit:Li,index:["title","content"]}));let he=te=>{let fe=j.filter(_e=>_e.field===te);return fe.length===0?[]:[...fe[0].result]},K=[...new Set([...he("title"),...he("content"),...he("tags")])].map(te=>k(zt,te));await Q(K)}document.addEventListener("keydown",E),window.addCleanup(()=>document.removeEventListener("keydown",E)),R.addEventListener("click",()=>Pe("basic")),window.addCleanup(()=>R.removeEventListener("click",()=>Pe("basic"))),O.addEventListener("input",Ce),window.addCleanup(()=>O.removeEventListener("input",Ce)),bi(C,Y),await as(w)}var Ci=!1;async function as(p){if(Ci)return;let x=0,w=[];for(let[C,A]of Object.entries(p))w.push(Ti.addAsync(x++,{id:x,slug:C,title:A.title,content:A.content,tags:A.tags}));await Promise.all(w),Ci=!0}document.addEventListener("nav",async p=>{let x=p.detail.url,w=await fetchData,C=document.getElementsByClassName("search");for(let A of C)await sn(A,x,w)})}(),function(){var Ut=Object.create,vt=Object.defineProperty,Gt=Object.getOwnPropertyDescriptor,yt=Object.getOwnPropertyNames,Tt=Object.getPrototypeOf,St=Object.prototype.hasOwnProperty,g=(ce,V)=>()=>(V||ce((V={exports:{}}).exports,V),V.exports),cr=(ce,V,de,Ve)=>{if(V&&typeof V=="object"||typeof V=="function")for(let Qe of yt(V))!St.call(ce,Qe)&&Qe!==de&&vt(ce,Qe,{get:()=>V[Qe],enumerable:!(Ve=Gt(V,Qe))||Ve.enumerable});return ce},It=(ce,V,de)=>(de=ce!=null?Ut(Tt(ce)):{},cr(V||!ce||!ce.__esModule?vt(de,"default",{value:ce,enumerable:!0}):de,ce)),Vr=g((ce,V)=>{"use strict";V.exports=Ve;function de(rt){return rt instanceof Buffer?Buffer.from(rt):new rt.constructor(rt.buffer.slice(),rt.byteOffset,rt.length)}function Ve(rt){if(rt=rt||{},rt.circles)return Qe(rt);let We=new Map;if(We.set(Date,ke=>new Date(ke)),We.set(Map,(ke,Ne)=>new Map(xt(Array.from(ke),Ne))),We.set(Set,(ke,Ne)=>new Set(xt(Array.from(ke),Ne))),rt.constructorHandlers)for(let ke of rt.constructorHandlers)We.set(ke[0],ke[1]);let ft=null;return rt.proto?at:ht;function xt(ke,Ne){let Te=Object.keys(ke),Re=new Array(Te.length);for(let it=0;it<Te.length;it++){let Ae=Te[it],et=ke[Ae];typeof et!="object"||et===null?Re[Ae]=et:et.constructor!==Object&&(ft=We.get(et.constructor))?Re[Ae]=ft(et,Ne):ArrayBuffer.isView(et)?Re[Ae]=de(et):Re[Ae]=Ne(et)}return Re}function ht(ke){if(typeof ke!="object"||ke===null)return ke;if(Array.isArray(ke))return xt(ke,ht);if(ke.constructor!==Object&&(ft=We.get(ke.constructor)))return ft(ke,ht);let Ne={};for(let Te in ke){if(Object.hasOwnProperty.call(ke,Te)===!1)continue;let Re=ke[Te];typeof Re!="object"||Re===null?Ne[Te]=Re:Re.constructor!==Object&&(ft=We.get(Re.constructor))?Ne[Te]=ft(Re,ht):ArrayBuffer.isView(Re)?Ne[Te]=de(Re):Ne[Te]=ht(Re)}return Ne}function at(ke){if(typeof ke!="object"||ke===null)return ke;if(Array.isArray(ke))return xt(ke,at);if(ke.constructor!==Object&&(ft=We.get(ke.constructor)))return ft(ke,at);let Ne={};for(let Te in ke){let Re=ke[Te];typeof Re!="object"||Re===null?Ne[Te]=Re:Re.constructor!==Object&&(ft=We.get(Re.constructor))?Ne[Te]=ft(Re,at):ArrayBuffer.isView(Re)?Ne[Te]=de(Re):Ne[Te]=at(Re)}return Ne}}function Qe(rt){let We=[],ft=[],xt=new Map;if(xt.set(Date,Te=>new Date(Te)),xt.set(Map,(Te,Re)=>new Map(at(Array.from(Te),Re))),xt.set(Set,(Te,Re)=>new Set(at(Array.from(Te),Re))),rt.constructorHandlers)for(let Te of rt.constructorHandlers)xt.set(Te[0],Te[1]);let ht=null;return rt.proto?Ne:ke;function at(Te,Re){let it=Object.keys(Te),Ae=new Array(it.length);for(let et=0;et<it.length;et++){let Bt=it[et],G=Te[Bt];if(typeof G!="object"||G===null)Ae[Bt]=G;else if(G.constructor!==Object&&(ht=xt.get(G.constructor)))Ae[Bt]=ht(G,Re);else if(ArrayBuffer.isView(G))Ae[Bt]=de(G);else{let W=We.indexOf(G);W!==-1?Ae[Bt]=ft[W]:Ae[Bt]=Re(G)}}return Ae}function ke(Te){if(typeof Te!="object"||Te===null)return Te;if(Array.isArray(Te))return at(Te,ke);if(Te.constructor!==Object&&(ht=xt.get(Te.constructor)))return ht(Te,ke);let Re={};We.push(Te),ft.push(Re);for(let it in Te){if(Object.hasOwnProperty.call(Te,it)===!1)continue;let Ae=Te[it];if(typeof Ae!="object"||Ae===null)Re[it]=Ae;else if(Ae.constructor!==Object&&(ht=xt.get(Ae.constructor)))Re[it]=ht(Ae,ke);else if(ArrayBuffer.isView(Ae))Re[it]=de(Ae);else{let et=We.indexOf(Ae);et!==-1?Re[it]=ft[et]:Re[it]=ke(Ae)}}return We.pop(),ft.pop(),Re}function Ne(Te){if(typeof Te!="object"||Te===null)return Te;if(Array.isArray(Te))return at(Te,Ne);if(Te.constructor!==Object&&(ht=xt.get(Te.constructor)))return ht(Te,Ne);let Re={};We.push(Te),ft.push(Re);for(let it in Te){let Ae=Te[it];if(typeof Ae!="object"||Ae===null)Re[it]=Ae;else if(Ae.constructor!==Object&&(ht=xt.get(Ae.constructor)))Re[it]=ht(Ae,Ne);else if(ArrayBuffer.isView(Ae))Re[it]=de(Ae);else{let et=We.indexOf(Ae);et!==-1?Re[it]=ft[et]:Re[it]=Ne(Ae)}}return We.pop(),ft.pop(),Re}}}),nr=Object.hasOwnProperty,M=It(Vr(),1),sr=(0,M.default)();function Nt(ce){let V=kt(st(ce,"index"),!0);return V.length===0?"/":V}function we(ce){let V=ce.split("/").filter(de=>de!=="").slice(0,-1).map(de=>"..").join("/");return V.length===0&&(V="."),V}function X(ce,V){return At(we(ce),Nt(V))}function At(...ce){if(ce.length===0)return"";let V=ce.filter(de=>de!==""&&de!=="/").map(de=>kt(de)).join("/");return ce[0].startsWith("/")&&(V="/"+V),ce[ce.length-1].endsWith("/")&&(V=V+"/"),V}function Zt(ce,V){return ce===V||ce.endsWith("/"+V)}function st(ce,V){return Zt(ce,V)&&(ce=ce.slice(0,-V.length)),ce}function kt(ce,V){return ce.startsWith("/")&&(ce=ce.substring(1)),!V&&ce.endsWith("/")&&(ce=ce.slice(0,-1)),ce}var Rr=class od{isFolder;children;slugSegments;fileSegmentHint;displayNameOverride;data;constructor(V,de){this.children=[],this.slugSegments=V,this.data=de??null,this.isFolder=!1,this.displayNameOverride=void 0}get displayName(){let V=this.data?.title==="index"?void 0:this.data?.title;return this.displayNameOverride??V??this.fileSegmentHint??this.slugSegment??""}set displayName(V){this.displayNameOverride=V}get slug(){let V=At(...this.slugSegments);return this.isFolder?At(V,"index"):V}get slugSegment(){return this.slugSegments[this.slugSegments.length-1]}makeChild(V,de){let Ve=[...this.slugSegments,V[0]],Qe=new od(Ve,de);return this.children.push(Qe),Qe}insert(V,de){if(V.length===0)throw new Error("path is empty");this.isFolder=!0;let Ve=V[0];if(V.length===1)Ve==="index"?this.data??=de:this.makeChild(V,de);else if(V.length>1){let Qe=this.children.find(We=>We.slugSegment===Ve)??this.makeChild(V,void 0),rt=de.filePath.split("/");Qe.fileSegmentHint=rt.at(-V.length),Qe.insert(V.slice(1),de)}}add(V){this.insert(V.slug.split("/"),V)}findNode(V){return V.length===0||V.length===1&&V[0]==="index"?this:this.children.find(de=>de.slugSegment===V[0])?.findNode(V.slice(1))}ancestryChain(V){if(V.length===0||V.length===1&&V[0]==="index")return[this];let de=this.children.find(Qe=>Qe.slugSegment===V[0]);if(!de)return;let Ve=de.ancestryChain(V.slice(1));if(Ve)return[this,...Ve]}filter(V){this.children=this.children.filter(V),this.children.forEach(de=>de.filter(V))}map(V){V(this),this.children.forEach(de=>de.map(V))}sort(V){this.children=this.children.sort(V),this.children.forEach(de=>de.sort(V))}static fromEntries(V){let de=new od([]);return V.forEach(([,Ve])=>de.add(Ve)),de}entries(){let V=de=>[[de.slug,de]].concat(...de.children.map(V));return V(this)}getFolderPaths(){return this.entries().filter(([V,de])=>de.isFolder).map(([V,de])=>V)}},Lt;function Pt(){let ce=this.closest(".explorer");if(!ce)return;let V=ce.classList.toggle("collapsed");ce.setAttribute("aria-expanded",ce.getAttribute("aria-expanded")==="true"?"false":"true"),V?document.documentElement.classList.remove("mobile-no-scroll"):document.documentElement.classList.add("mobile-no-scroll")}function lt(ce){ce.stopPropagation();let V=ce.target;if(!V)return;let de=V.nodeName==="svg"?V.parentElement:V.parentElement?.parentElement;if(!de)return;let Ve=de.nextElementSibling;if(!Ve)return;Ve.classList.toggle("open");let Qe=!Ve.classList.contains("open");Gr(Ve,Qe);let rt=Lt.find(ft=>ft.path===de.dataset.folderpath);rt?rt.collapsed=Qe:Lt.push({path:de.dataset.folderpath,collapsed:Qe});let We=JSON.stringify(Lt);localStorage.setItem("fileTree",We)}function pt(ce,V){let de=document.getElementById("template-file").content.cloneNode(!0).querySelector("li"),Ve=de.querySelector("a");return Ve.href=X(ce,V.slug),Ve.dataset.for=V.slug,Ve.textContent=V.displayName,ce===V.slug&&Ve.classList.add("active"),de}function kr(ce,V,de){let Ve=document.getElementById("template-folder").content.cloneNode(!0).querySelector("li"),Qe=Ve.querySelector(".folder-container"),rt=Qe.querySelector("div"),We=Ve.querySelector(".folder-outer"),ft=We.querySelector("ul"),xt=V.slug;if(Qe.dataset.folderpath=xt,de.folderClickBehavior==="link"){let Ne=rt.querySelector(".folder-button"),Te=document.createElement("a");Te.href=X(ce,xt),Te.dataset.for=xt,Te.className="folder-title",Te.textContent=V.displayName,Ne.replaceWith(Te)}else{let Ne=rt.querySelector(".folder-title");Ne.textContent=V.displayName}let ht=Lt.find(Ne=>Ne.path===xt)?.collapsed??de.folderDefaultState==="collapsed",at=Nt(xt),ke=at===ce.slice(0,at.length);(!ht||ke)&&We.classList.add("open");for(let Ne of V.children){let Te=Ne.isFolder?kr(ce,Ne,de):pt(ce,Ne);ft.appendChild(Te)}return Ve}async function Br(ce){let V=document.querySelectorAll("div.explorer");for(let de of V){let Ve=JSON.parse(de.dataset.dataFns||"{}"),Qe={folderClickBehavior:de.dataset.behavior||"collapse",folderDefaultState:de.dataset.collapsed||"collapsed",useSavedState:de.dataset.savestate==="true",order:Ve.order||["filter","map","sort"],sortFn:new Function("return "+(Ve.sortFn||"undefined"))(),filterFn:new Function("return "+(Ve.filterFn||"undefined"))(),mapFn:new Function("return "+(Ve.mapFn||"undefined"))()},rt=localStorage.getItem("fileTree"),We=rt&&Qe.useSavedState?JSON.parse(rt):[],ft=new Map(We.map(Ae=>[Ae.path,Ae.collapsed])),xt=await fetchData,ht=[...Object.entries(xt)],at=Rr.fromEntries(ht);for(let Ae of Qe.order)switch(Ae){case"filter":Qe.filterFn&&at.filter(Qe.filterFn);break;case"map":Qe.mapFn&&at.map(Qe.mapFn);break;case"sort":Qe.sortFn&&at.sort(Qe.sortFn);break}Lt=at.getFolderPaths().map(Ae=>{let et=ft.get(Ae);return{path:Ae,collapsed:et===void 0?Qe.folderDefaultState==="collapsed":et}});let ke=de.querySelector(".explorer-ul");if(!ke)continue;let Ne=document.createDocumentFragment();for(let Ae of at.children){let et=Ae.isFolder?kr(ce,Ae,Qe):pt(ce,Ae);Ne.appendChild(et)}ke.insertBefore(Ne,ke.firstChild);let Te=sessionStorage.getItem("explorerScrollTop");if(Te)ke.scrollTop=parseInt(Te);else{let Ae=ke.querySelector(".active");Ae&&Ae.scrollIntoView({behavior:"smooth"})}let Re=de.getElementsByClassName("explorer-toggle");for(let Ae of Re)Ae.addEventListener("click",Pt),window.addCleanup(()=>Ae.removeEventListener("click",Pt));if(Qe.folderClickBehavior==="collapse"){let Ae=de.getElementsByClassName("folder-button");for(let et of Ae)et.addEventListener("click",lt),window.addCleanup(()=>et.removeEventListener("click",lt))}let it=de.getElementsByClassName("folder-icon");for(let Ae of it)Ae.addEventListener("click",lt),window.addCleanup(()=>Ae.removeEventListener("click",lt))}}document.addEventListener("prenav",async()=>{let ce=document.querySelector(".explorer-ul");ce&&sessionStorage.setItem("explorerScrollTop",ce.scrollTop.toString())}),document.addEventListener("nav",async ce=>{let V=ce.detail.url;await Br(V);for(let de of document.getElementsByClassName("explorer")){let Ve=de.querySelector(".mobile-explorer");if(!Ve)return;Ve.checkVisibility()&&(de.classList.add("collapsed"),de.setAttribute("aria-expanded","false"),document.documentElement.classList.remove("mobile-no-scroll")),Ve.classList.remove("hide-until-loaded")}}),window.addEventListener("resize",function(){let ce=document.querySelector(".explorer");if(ce&&!ce.classList.contains("collapsed")){document.documentElement.classList.add("mobile-no-scroll");return}});function Gr(ce,V){return V?ce.classList.remove("open"):ce.classList.add("open")}}(),function(){document.addEventListener("nav",Ut=>{const vt=new IntersectionObserver(Tt=>{for(const St of Tt){const g=St.target.parentElement;if(!g)return;St.isIntersecting?g.classList.remove("gradient-active"):g.classList.add("gradient-active")}}),Gt=document.getElementById("list-0");if(!Gt)return;const yt=Gt.querySelector(".overflow-end");yt&&(vt.observe(yt),window.addCleanup(()=>vt.disconnect()))})}(),function(){var Ut=Object.create,vt=Object.defineProperty,Gt=Object.getOwnPropertyDescriptor,yt=Object.getOwnPropertyNames,Tt=Object.getPrototypeOf,St=Object.prototype.hasOwnProperty,g=(t,e)=>()=>(t&&(e=t(t=0)),e),cr=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),It=(t,e)=>{for(var r in e)vt(t,r,{get:e[r],enumerable:!0})},Vr=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of yt(e))!St.call(t,n)&&n!==r&&vt(t,n,{get:()=>e[n],enumerable:!(i=Gt(e,n))||i.enumerable});return t},nr=(t,e,r)=>(r=t!=null?Ut(Tt(t)):{},Vr(e||!t||!t.__esModule?vt(r,"default",{value:t,enumerable:!0}):r,t)),M,sr,Nt,we,X=g(()=>{"use strict";M=(t=>(t.Application="application",t.WebGLPipes="webgl-pipes",t.WebGLPipesAdaptor="webgl-pipes-adaptor",t.WebGLSystem="webgl-system",t.WebGPUPipes="webgpu-pipes",t.WebGPUPipesAdaptor="webgpu-pipes-adaptor",t.WebGPUSystem="webgpu-system",t.CanvasSystem="canvas-system",t.CanvasPipesAdaptor="canvas-pipes-adaptor",t.CanvasPipes="canvas-pipes",t.Asset="asset",t.LoadParser="load-parser",t.ResolveParser="resolve-parser",t.CacheParser="cache-parser",t.DetectionParser="detection-parser",t.MaskEffect="mask-effect",t.BlendMode="blend-mode",t.TextureSource="texture-source",t.Environment="environment",t.ShapeBuilder="shape-builder",t.Batcher="batcher",t))(M||{}),sr=t=>{if(typeof t=="function"||typeof t=="object"&&t.extension){if(!t.extension)throw new Error("Extension class must have an extension object");t={...typeof t.extension!="object"?{type:t.extension}:t.extension,ref:t}}if(typeof t=="object")t={...t};else throw new Error("Invalid extension type");return typeof t.type=="string"&&(t.type=[t.type]),t},Nt=(t,e)=>sr(t).priority??e,we={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...t){return t.map(sr).forEach(e=>{e.type.forEach(r=>this._removeHandlers[r]?.(e))}),this},add(...t){return t.map(sr).forEach(e=>{e.type.forEach(r=>{let i=this._addHandlers,n=this._queue;i[r]?i[r]?.(e):(n[r]=n[r]||[],n[r]?.push(e))})}),this},handle(t,e,r){let i=this._addHandlers,n=this._removeHandlers;if(i[t]||n[t])throw new Error(`Extension type ${t} already has a handler`);i[t]=e,n[t]=r;let s=this._queue;return s[t]&&(s[t]?.forEach(a=>e(a)),delete s[t]),this},handleByMap(t,e){return this.handle(t,r=>{r.name&&(e[r.name]=r.ref)},r=>{r.name&&delete e[r.name]})},handleByNamedList(t,e,r=-1){return this.handle(t,i=>{e.findIndex(n=>n.name===i.name)>=0||(e.push({name:i.name,value:i.ref}),e.sort((n,s)=>Nt(s.value,r)-Nt(n.value,r)))},i=>{let n=e.findIndex(s=>s.name===i.name);n!==-1&&e.splice(n,1)})},handleByList(t,e,r=-1){return this.handle(t,i=>{e.includes(i.ref)||(e.push(i.ref),e.sort((n,s)=>Nt(s,r)-Nt(n,r)))},i=>{let n=e.indexOf(i.ref);n!==-1&&e.splice(n,1)})},mixin(t,...e){for(let r of e)Object.defineProperties(t.prototype,Object.getOwnPropertyDescriptors(r))}}}),At=cr((t,e)=>{"use strict";var r=Object.prototype.hasOwnProperty,i="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(i=!1));function s(h,u,c){this.fn=h,this.context=u,this.once=c||!1}function a(h,u,c,f,d){if(typeof c!="function")throw new TypeError("The listener must be a function");var _=new s(c,f||h,d),v=i?i+u:u;return h._events[v]?h._events[v].fn?h._events[v]=[h._events[v],_]:h._events[v].push(_):(h._events[v]=_,h._eventsCount++),h}function o(h,u){--h._eventsCount===0?h._events=new n:delete h._events[u]}function l(){this._events=new n,this._eventsCount=0}l.prototype.eventNames=function(){var h=[],u,c;if(this._eventsCount===0)return h;for(c in u=this._events)r.call(u,c)&&h.push(i?c.slice(1):c);return Object.getOwnPropertySymbols?h.concat(Object.getOwnPropertySymbols(u)):h},l.prototype.listeners=function(h){var u=i?i+h:h,c=this._events[u];if(!c)return[];if(c.fn)return[c.fn];for(var f=0,d=c.length,_=new Array(d);f<d;f++)_[f]=c[f].fn;return _},l.prototype.listenerCount=function(h){var u=i?i+h:h,c=this._events[u];return c?c.fn?1:c.length:0},l.prototype.emit=function(h,u,c,f,d,_){var v=i?i+h:h;if(!this._events[v])return!1;var m=this._events[v],y=arguments.length,S,P;if(m.fn){switch(m.once&&this.removeListener(h,m.fn,void 0,!0),y){case 1:return m.fn.call(m.context),!0;case 2:return m.fn.call(m.context,u),!0;case 3:return m.fn.call(m.context,u,c),!0;case 4:return m.fn.call(m.context,u,c,f),!0;case 5:return m.fn.call(m.context,u,c,f,d),!0;case 6:return m.fn.call(m.context,u,c,f,d,_),!0}for(P=1,S=new Array(y-1);P<y;P++)S[P-1]=arguments[P];m.fn.apply(m.context,S)}else{var T=m.length,z;for(P=0;P<T;P++)switch(m[P].once&&this.removeListener(h,m[P].fn,void 0,!0),y){case 1:m[P].fn.call(m[P].context);break;case 2:m[P].fn.call(m[P].context,u);break;case 3:m[P].fn.call(m[P].context,u,c);break;case 4:m[P].fn.call(m[P].context,u,c,f);break;default:if(!S)for(z=1,S=new Array(y-1);z<y;z++)S[z-1]=arguments[z];m[P].fn.apply(m[P].context,S)}}return!0},l.prototype.on=function(h,u,c){return a(this,h,u,c,!1)},l.prototype.once=function(h,u,c){return a(this,h,u,c,!0)},l.prototype.removeListener=function(h,u,c,f){var d=i?i+h:h;if(!this._events[d])return this;if(!u)return o(this,d),this;var _=this._events[d];if(_.fn)_.fn===u&&(!f||_.once)&&(!c||_.context===c)&&o(this,d);else{for(var v=0,m=[],y=_.length;v<y;v++)(_[v].fn!==u||f&&!_[v].once||c&&_[v].context!==c)&&m.push(_[v]);m.length?this._events[d]=m.length===1?m[0]:m:o(this,d)}return this},l.prototype.removeAllListeners=function(h){var u;return h?(u=i?i+h:h,this._events[u]&&o(this,u)):(this._events=new n,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=i,l.EventEmitter=l,typeof e<"u"&&(e.exports=l)}),Zt,st,kt=g(()=>{Zt=nr(At(),1),st=Zt.default}),Rr,Lt,Pt,lt,pt,kr,Br,Gr,ce,V,de,Ve,Qe,rt,We,ft,xt,ht,at,ke,Ne,Te,Re,it,Ae,et,Bt,G,W,pe=g(()=>{Rr={grad:.9,turn:360,rad:360/(2*Math.PI)},Lt=function(t){return typeof t=="string"?t.length>0:typeof t=="number"},Pt=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=Math.pow(10,e)),Math.round(r*t)/r+0},lt=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=1),t>r?r:t>e?t:e},pt=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},kr=function(t){return{r:lt(t.r,0,255),g:lt(t.g,0,255),b:lt(t.b,0,255),a:lt(t.a)}},Br=function(t){return{r:Pt(t.r),g:Pt(t.g),b:Pt(t.b),a:Pt(t.a,3)}},Gr=/^#([0-9a-f]{3,8})$/i,ce=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},V=function(t){var e=t.r,r=t.g,i=t.b,n=t.a,s=Math.max(e,r,i),a=s-Math.min(e,r,i),o=a?s===e?(r-i)/a:s===r?2+(i-e)/a:4+(e-r)/a:0;return{h:60*(o<0?o+6:o),s:s?a/s*100:0,v:s/255*100,a:n}},de=function(t){var e=t.h,r=t.s,i=t.v,n=t.a;e=e/360*6,r/=100,i/=100;var s=Math.floor(e),a=i*(1-r),o=i*(1-(e-s)*r),l=i*(1-(1-e+s)*r),h=s%6;return{r:255*[i,o,a,a,l,i][h],g:255*[l,i,i,o,a,a][h],b:255*[a,a,l,i,i,o][h],a:n}},Ve=function(t){return{h:pt(t.h),s:lt(t.s,0,100),l:lt(t.l,0,100),a:lt(t.a)}},Qe=function(t){return{h:Pt(t.h),s:Pt(t.s),l:Pt(t.l),a:Pt(t.a,3)}},rt=function(t){return de((r=(e=t).s,{h:e.h,s:(r*=((i=e.l)<50?i:100-i)/100)>0?2*r/(i+r)*100:0,v:i+r,a:e.a}));var e,r,i},We=function(t){return{h:(e=V(t)).h,s:(n=(200-(r=e.s))*(i=e.v)/100)>0&&n<200?r*i/100/(n<=100?n:200-n)*100:0,l:n/2,a:e.a};var e,r,i,n},ft=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,xt=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ht=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,at=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ke={string:[[function(t){var e=Gr.exec(t);return e?(t=e[1]).length<=4?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?Pt(parseInt(t[3]+t[3],16)/255,2):1}:t.length===6||t.length===8?{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16),a:t.length===8?Pt(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=ht.exec(t)||at.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:kr({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(t){var e=ft.exec(t)||xt.exec(t);if(!e)return null;var r,i,n=Ve({h:(r=e[1],i=e[2],i===void 0&&(i="deg"),Number(r)*(Rr[i]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return rt(n)},"hsl"]],object:[[function(t){var e=t.r,r=t.g,i=t.b,n=t.a,s=n===void 0?1:n;return Lt(e)&&Lt(r)&&Lt(i)?kr({r:Number(e),g:Number(r),b:Number(i),a:Number(s)}):null},"rgb"],[function(t){var e=t.h,r=t.s,i=t.l,n=t.a,s=n===void 0?1:n;if(!Lt(e)||!Lt(r)||!Lt(i))return null;var a=Ve({h:Number(e),s:Number(r),l:Number(i),a:Number(s)});return rt(a)},"hsl"],[function(t){var e=t.h,r=t.s,i=t.v,n=t.a,s=n===void 0?1:n;if(!Lt(e)||!Lt(r)||!Lt(i))return null;var a=function(o){return{h:pt(o.h),s:lt(o.s,0,100),v:lt(o.v,0,100),a:lt(o.a)}}({h:Number(e),s:Number(r),v:Number(i),a:Number(s)});return de(a)},"hsv"]]},Ne=function(t,e){for(var r=0;r<e.length;r++){var i=e[r][0](t);if(i)return[i,e[r][1]]}return[null,void 0]},Te=function(t){return typeof t=="string"?Ne(t.trim(),ke.string):typeof t=="object"&&t!==null?Ne(t,ke.object):[null,void 0]},Re=function(t,e){var r=We(t);return{h:r.h,s:lt(r.s+100*e,0,100),l:r.l,a:r.a}},it=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},Ae=function(t,e){var r=We(t);return{h:r.h,s:r.s,l:lt(r.l+100*e,0,100),a:r.a}},et=function(){function t(e){this.parsed=Te(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return t.prototype.isValid=function(){return this.parsed!==null},t.prototype.brightness=function(){return Pt(it(this.rgba),2)},t.prototype.isDark=function(){return it(this.rgba)<.5},t.prototype.isLight=function(){return it(this.rgba)>=.5},t.prototype.toHex=function(){return e=Br(this.rgba),r=e.r,i=e.g,n=e.b,a=(s=e.a)<1?ce(Pt(255*s)):"","#"+ce(r)+ce(i)+ce(n)+a;var e,r,i,n,s,a},t.prototype.toRgb=function(){return Br(this.rgba)},t.prototype.toRgbString=function(){return e=Br(this.rgba),r=e.r,i=e.g,n=e.b,(s=e.a)<1?"rgba("+r+", "+i+", "+n+", "+s+")":"rgb("+r+", "+i+", "+n+")";var e,r,i,n,s},t.prototype.toHsl=function(){return Qe(We(this.rgba))},t.prototype.toHslString=function(){return e=Qe(We(this.rgba)),r=e.h,i=e.s,n=e.l,(s=e.a)<1?"hsla("+r+", "+i+"%, "+n+"%, "+s+")":"hsl("+r+", "+i+"%, "+n+"%)";var e,r,i,n,s},t.prototype.toHsv=function(){return e=V(this.rgba),{h:Pt(e.h),s:Pt(e.s),v:Pt(e.v),a:Pt(e.a,3)};var e},t.prototype.invert=function(){return Bt({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},t.prototype.saturate=function(e){return e===void 0&&(e=.1),Bt(Re(this.rgba,e))},t.prototype.desaturate=function(e){return e===void 0&&(e=.1),Bt(Re(this.rgba,-e))},t.prototype.grayscale=function(){return Bt(Re(this.rgba,-1))},t.prototype.lighten=function(e){return e===void 0&&(e=.1),Bt(Ae(this.rgba,e))},t.prototype.darken=function(e){return e===void 0&&(e=.1),Bt(Ae(this.rgba,-e))},t.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},t.prototype.alpha=function(e){return typeof e=="number"?Bt({r:(r=this.rgba).r,g:r.g,b:r.b,a:e}):Pt(this.rgba.a,3);var r},t.prototype.hue=function(e){var r=We(this.rgba);return typeof e=="number"?Bt({h:e,s:r.s,l:r.l,a:r.a}):Pt(r.h)},t.prototype.isEqual=function(e){return this.toHex()===Bt(e).toHex()},t}(),Bt=function(t){return t instanceof et?t:new et(t)},G=[],W=function(t){t.forEach(function(e){G.indexOf(e)<0&&(e(et,ke),G.push(e))})}});function Ie(t,e){var r={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 n in r)i[r[n]]=n;var s={};t.prototype.toName=function(a){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var o,l,h=i[this.toHex()];if(h)return h;if(a?.closest){var u=this.toRgb(),c=1/0,f="black";if(!s.length)for(var d in r)s[d]=new t(r[d]).toRgb();for(var _ in r){var v=(o=u,l=s[_],Math.pow(o.r-l.r,2)+Math.pow(o.g-l.g,2)+Math.pow(o.b-l.b,2));v<c&&(c=v,f=_)}return f}},e.string.push([function(a){var o=a.toLowerCase(),l=o==="transparent"?"#0000":r[o];return l?new t(l).toRgb():null},"name"])}var Oe=g(()=>{}),Ee,le,ze=g(()=>{pe(),Oe(),W([Ie]),Ee=class pa{constructor(e=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=e}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(e){return this.value=e,this}set value(e){if(e instanceof pa)this._value=this._cloneSource(e._value),this._int=e._int,this._components.set(e._components);else{if(e===null)throw new Error("Cannot set Color#value to null");(this._value===null||!this._isSourceEqual(this._value,e))&&(this._value=this._cloneSource(e),this._normalize(this._value))}}get value(){return this._value}_cloneSource(e){return typeof e=="string"||typeof e=="number"||e instanceof Number||e===null?e:Array.isArray(e)||ArrayBuffer.isView(e)?e.slice(0):typeof e=="object"&&e!==null?{...e}:e}_isSourceEqual(e,r){let i=typeof e;if(i!==typeof r)return!1;if(i==="number"||i==="string"||e instanceof Number)return e===r;if(Array.isArray(e)&&Array.isArray(r)||ArrayBuffer.isView(e)&&ArrayBuffer.isView(r))return e.length!==r.length?!1:e.every((n,s)=>n===r[s]);if(e!==null&&r!==null){let n=Object.keys(e),s=Object.keys(r);return n.length!==s.length?!1:n.every(a=>e[a]===r[a])}return e===r}toRgba(){let[e,r,i,n]=this._components;return{r:e,g:r,b:i,a:n}}toRgb(){let[e,r,i]=this._components;return{r:e,g:r,b:i}}toRgbaString(){let[e,r,i]=this.toUint8RgbArray();return`rgba(${e},${r},${i},${this.alpha})`}toUint8RgbArray(e){let[r,i,n]=this._components;return this._arrayRgb||(this._arrayRgb=[]),e||(e=this._arrayRgb),e[0]=Math.round(r*255),e[1]=Math.round(i*255),e[2]=Math.round(n*255),e}toArray(e){this._arrayRgba||(this._arrayRgba=[]),e||(e=this._arrayRgba);let[r,i,n,s]=this._components;return e[0]=r,e[1]=i,e[2]=n,e[3]=s,e}toRgbArray(e){this._arrayRgb||(this._arrayRgb=[]),e||(e=this._arrayRgb);let[r,i,n]=this._components;return e[0]=r,e[1]=i,e[2]=n,e}toNumber(){return this._int}toBgrNumber(){let[e,r,i]=this.toUint8RgbArray();return(i<<16)+(r<<8)+e}toLittleEndianNumber(){let e=this._int;return(e>>16)+(e&65280)+((e&255)<<16)}multiply(e){let[r,i,n,s]=pa._temp.setValue(e)._components;return this._components[0]*=r,this._components[1]*=i,this._components[2]*=n,this._components[3]*=s,this._refreshInt(),this._value=null,this}premultiply(e,r=!0){return r&&(this._components[0]*=e,this._components[1]*=e,this._components[2]*=e),this._components[3]=e,this._refreshInt(),this._value=null,this}toPremultiplied(e,r=!0){if(e===1)return(255<<24)+this._int;if(e===0)return r?0:this._int;let i=this._int>>16&255,n=this._int>>8&255,s=this._int&255;return r&&(i=i*e+.5|0,n=n*e+.5|0,s=s*e+.5|0),(e*255<<24)+(i<<16)+(n<<8)+s}toHex(){let e=this._int.toString(16);return`#${"000000".substring(0,6-e.length)+e}`}toHexa(){let e=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-e.length)+e}setAlpha(e){return this._components[3]=this._clamp(e),this}_normalize(e){let r,i,n,s;if((typeof e=="number"||e instanceof Number)&&e>=0&&e<=16777215){let a=e;r=(a>>16&255)/255,i=(a>>8&255)/255,n=(a&255)/255,s=1}else if((Array.isArray(e)||e instanceof Float32Array)&&e.length>=3&&e.length<=4)e=this._clamp(e),[r,i,n,s=1]=e;else if((e instanceof Uint8Array||e instanceof Uint8ClampedArray)&&e.length>=3&&e.length<=4)e=this._clamp(e,0,255),[r,i,n,s=255]=e,r/=255,i/=255,n/=255,s/=255;else if(typeof e=="string"||typeof e=="object"){if(typeof e=="string"){let o=pa.HEX_PATTERN.exec(e);o&&(e=`#${o[2]}`)}let a=Bt(e);a.isValid()&&({r,g:i,b:n,a:s}=a.rgba,r/=255,i/=255,n/=255)}if(r!==void 0)this._components[0]=r,this._components[1]=i,this._components[2]=n,this._components[3]=s,this._refreshInt();else throw new Error(`Unable to convert color ${e}`)}_refreshInt(){this._clamp(this._components);let[e,r,i]=this._components;this._int=(e*255<<16)+(r*255<<8)+(i*255|0)}_clamp(e,r=0,i=1){return typeof e=="number"?Math.min(Math.max(e,r),i):(e.forEach((n,s)=>{e[s]=Math.min(Math.max(n,r),i)}),e)}static isColorLike(e){return typeof e=="number"||typeof e=="string"||e instanceof Number||e instanceof pa||Array.isArray(e)||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Float32Array||e.r!==void 0&&e.g!==void 0&&e.b!==void 0||e.r!==void 0&&e.g!==void 0&&e.b!==void 0&&e.a!==void 0||e.h!==void 0&&e.s!==void 0&&e.l!==void 0||e.h!==void 0&&e.s!==void 0&&e.l!==void 0&&e.a!==void 0||e.h!==void 0&&e.s!==void 0&&e.v!==void 0||e.h!==void 0&&e.s!==void 0&&e.v!==void 0&&e.a!==void 0}},Ee.shared=new Ee,Ee._temp=new Ee,Ee.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i,le=Ee}),gt,Vt=g(()=>{"use strict";gt={cullArea:null,cullable:!1,cullableChildren:!0}}),ar,$e,ut,Ge=g(()=>{"use strict";ar=Math.PI*2,$e=180/Math.PI,ut=Math.PI/180}),ye,bt,He=g(()=>{"use strict";ye=class vy{constructor(e=0,r=0){this.x=0,this.y=0,this.x=e,this.y=r}clone(){return new vy(this.x,this.y)}copyFrom(e){return this.set(e.x,e.y),this}copyTo(e){return e.set(this.x,this.y),e}equals(e){return e.x===this.x&&e.y===this.y}set(e=0,r=e){return this.x=e,this.y=r,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return bt.x=0,bt.y=0,bt}},bt=new ye}),ve,fr,rr,Ke=g(()=>{Ge(),He(),ve=class yy{constructor(e=1,r=0,i=0,n=1,s=0,a=0){this.array=null,this.a=e,this.b=r,this.c=i,this.d=n,this.tx=s,this.ty=a}fromArray(e){this.a=e[0],this.b=e[1],this.c=e[3],this.d=e[4],this.tx=e[2],this.ty=e[5]}set(e,r,i,n,s,a){return this.a=e,this.b=r,this.c=i,this.d=n,this.tx=s,this.ty=a,this}toArray(e,r){this.array||(this.array=new Float32Array(9));let i=r||this.array;return e?(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(e,r){r=r||new ye;let i=e.x,n=e.y;return r.x=this.a*i+this.c*n+this.tx,r.y=this.b*i+this.d*n+this.ty,r}applyInverse(e,r){r=r||new ye;let i=this.a,n=this.b,s=this.c,a=this.d,o=this.tx,l=this.ty,h=1/(i*a+s*-n),u=e.x,c=e.y;return r.x=a*h*u+-s*h*c+(l*s-o*a)*h,r.y=i*h*c+-n*h*u+(-l*i+o*n)*h,r}translate(e,r){return this.tx+=e,this.ty+=r,this}scale(e,r){return this.a*=e,this.d*=r,this.c*=e,this.b*=r,this.tx*=e,this.ty*=r,this}rotate(e){let r=Math.cos(e),i=Math.sin(e),n=this.a,s=this.c,a=this.tx;return this.a=n*r-this.b*i,this.b=n*i+this.b*r,this.c=s*r-this.d*i,this.d=s*i+this.d*r,this.tx=a*r-this.ty*i,this.ty=a*i+this.ty*r,this}append(e){let r=this.a,i=this.b,n=this.c,s=this.d;return this.a=e.a*r+e.b*n,this.b=e.a*i+e.b*s,this.c=e.c*r+e.d*n,this.d=e.c*i+e.d*s,this.tx=e.tx*r+e.ty*n+this.tx,this.ty=e.tx*i+e.ty*s+this.ty,this}appendFrom(e,r){let i=e.a,n=e.b,s=e.c,a=e.d,o=e.tx,l=e.ty,h=r.a,u=r.b,c=r.c,f=r.d;return this.a=i*h+n*c,this.b=i*u+n*f,this.c=s*h+a*c,this.d=s*u+a*f,this.tx=o*h+l*c+r.tx,this.ty=o*u+l*f+r.ty,this}setTransform(e,r,i,n,s,a,o,l,h){return this.a=Math.cos(o+h)*s,this.b=Math.sin(o+h)*s,this.c=-Math.sin(o-l)*a,this.d=Math.cos(o-l)*a,this.tx=e-(i*this.a+n*this.c),this.ty=r-(i*this.b+n*this.d),this}prepend(e){let r=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){let i=this.a,n=this.c;this.a=i*e.a+this.b*e.c,this.b=i*e.b+this.b*e.d,this.c=n*e.a+this.d*e.c,this.d=n*e.b+this.d*e.d}return this.tx=r*e.a+this.ty*e.c+e.tx,this.ty=r*e.b+this.ty*e.d+e.ty,this}decompose(e){let r=this.a,i=this.b,n=this.c,s=this.d,a=e.pivot,o=-Math.atan2(-n,s),l=Math.atan2(i,r),h=Math.abs(o+l);return h<1e-5||Math.abs(ar-h)<1e-5?(e.rotation=l,e.skew.x=e.skew.y=0):(e.rotation=0,e.skew.x=o,e.skew.y=l),e.scale.x=Math.sqrt(r*r+i*i),e.scale.y=Math.sqrt(n*n+s*s),e.position.x=this.tx+(a.x*r+a.y*n),e.position.y=this.ty+(a.x*i+a.y*s),e}invert(){let e=this.a,r=this.b,i=this.c,n=this.d,s=this.tx,a=e*n-r*i;return this.a=n/a,this.b=-r/a,this.c=-i/a,this.d=e/a,this.tx=(i*this.ty-n*s)/a,this.ty=-(e*this.ty-r*s)/a,this}isIdentity(){return this.a===1&&this.b===0&&this.c===0&&this.d===1&&this.tx===0&&this.ty===0}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){let e=new yy;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyTo(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyFrom(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this}equals(e){return e.a===this.a&&e.b===this.b&&e.c===this.c&&e.d===this.d&&e.tx===this.tx&&e.ty===this.ty}toString(){return`[pixi.js:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}static get IDENTITY(){return rr.identity()}static get shared(){return fr.identity()}},fr=new ve,rr=new ve}),Et,ri=g(()=>{"use strict";Et=class xy{constructor(e,r,i){this._x=r||0,this._y=i||0,this._observer=e}clone(e){return new xy(e??this._observer,this._x,this._y)}set(e=0,r=e){return(this._x!==e||this._y!==r)&&(this._x=e,this._y=r,this._observer._onUpdate(this)),this}copyFrom(e){return(this._x!==e.x||this._y!==e.y)&&(this._x=e.x,this._y=e.y,this._observer._onUpdate(this)),this}copyTo(e){return e.set(this._x,this._y),e}equals(e){return e.x===this._x&&e.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=${this._x} y=${this._y} scope=${this._observer}]`}get x(){return this._x}set x(e){this._x!==e&&(this._x=e,this._observer._onUpdate(this))}get y(){return this._y}set y(e){this._y!==e&&(this._y=e,this._observer._onUpdate(this))}}});function ot(t="default"){return bi[t]===void 0&&(bi[t]=-1),++bi[t]}var bi,Ot=g(()=>{"use strict";bi={default:-1}});function Xe(t,e,r=3){if(Di[e])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${e}
|
|
Deprecated since v${t}`):(i=i.split(`
|
|
`).splice(r).join(`
|
|
`),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${e}
|
|
Deprecated since v${t}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${e}
|
|
Deprecated since v${t}`),console.warn(i))),Di[e]=!0}var Di,nt,jr,Mt=g(()=>{"use strict";Di={},nt="8.0.0",jr="8.3.4"});function Ye(...t){Ui!==Wr&&(Ui++,Ui===Wr?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...t))}var Ui,Wr,wt=g(()=>{"use strict";Ui=0,Wr=500}),wi,Cn=g(()=>{"use strict";wi=class{constructor(t,e){this._pool=[],this._count=0,this._index=0,this._classType=t,e&&this.prepopulate(e)}prepopulate(t){for(let e=0;e<t;e++)this._pool[this._index++]=new this._classType;this._count+=t}get(t){let e;return this._index>0?e=this._pool[--this._index]:e=new this._classType,e.init?.(t),e}return(t){t.reset?.(),this._pool[this._index++]=t}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}clear(){this._pool.length=0,this._index=0}}}),rn,Rt,zt=g(()=>{Cn(),rn=class{constructor(){this._poolsByClass=new Map}prepopulate(t,e){this.getPool(t).prepopulate(e)}get(t,e){return this.getPool(t).get(e)}return(t){this.getPool(t.constructor).return(t)}getPool(t){return this._poolsByClass.has(t)||this._poolsByClass.set(t,new wi(t)),this._poolsByClass.get(t)}stats(){let t={};return this._poolsByClass.forEach(e=>{let r=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[r]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}}),t}},Rt=new rn}),An,Ti=g(()=>{Mt(),An={get isCachedAsTexture(){return!!this.renderGroup?.isCachedAsTexture},cacheAsTexture(t){typeof t=="boolean"&&t===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(t===!0?{}:t))},updateCacheTexture(){this.renderGroup?.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(t){Xe("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(t)}}});function nn(t,e,r){let i=t.length,n;if(e>=i||r===0)return;r=e+r>i?i-e:r;let s=i-r;for(n=e;n<s;++n)t[n]=t[n+r];t.length=s}var Si=g(()=>{"use strict"}),Ei,Li=g(()=>{Si(),Mt(),Ei={allowChildren:!0,removeChildren(t=0,e){let r=e??this.children.length,i=r-t,n=[];if(i>0&&i<=r){for(let a=r-1;a>=t;a--){let o=this.children[a];o&&(n.push(o),o.parent=null)}nn(this.children,t,r);let s=this.renderGroup||this.parentRenderGroup;s&&s.removeChildren(n);for(let a=0;a<n.length;++a){let o=n[a];o.parentRenderLayer?.detach(o),this.emit("childRemoved",o,this,a),n[a].emit("removed",this)}return n.length>0&&this._didViewChangeTick++,n}else if(i===0&&this.children.length===0)return n;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(t){let e=this.getChildAt(t);return this.removeChild(e)},getChildAt(t){if(t<0||t>=this.children.length)throw new Error(`getChildAt: Index (${t}) does not exist.`);return this.children[t]},setChildIndex(t,e){if(e<0||e>=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);this.getChildIndex(t),this.addChildAt(t,e)},getChildIndex(t){let e=this.children.indexOf(t);if(e===-1)throw new Error("The supplied Container must be a child of the caller");return e},addChildAt(t,e){this.allowChildren||Xe(nt,"addChildAt: Only Containers will be allowed to add children in v8.0.0");let{children:r}=this;if(e<0||e>r.length)throw new Error(`${t}addChildAt: The index ${e} supplied is out of bounds ${r.length}`);if(t.parent){let n=t.parent.children.indexOf(t);if(t.parent===this&&n===e)return t;n!==-1&&t.parent.children.splice(n,1)}e===r.length?r.push(t):r.splice(e,0,t),t.parent=this,t.didChange=!0,t._updateFlags=15;let i=this.renderGroup||this.parentRenderGroup;return i&&i.addChild(t),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",t,this,e),t.emit("added",this),t},swapChildren(t,e){if(t===e)return;let r=this.getChildIndex(t),i=this.getChildIndex(e);this.children[r]=e,this.children[i]=t;let n=this.renderGroup||this.parentRenderGroup;n&&(n.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...t){return t.length===1?this.reparentChildAt(t[0],this.children.length):(t.forEach(e=>this.reparentChildAt(e,this.children.length)),t[0])},reparentChildAt(t,e){if(t.parent===this)return this.setChildIndex(t,e),t;let r=t.worldTransform.clone();t.removeFromParent(),this.addChildAt(t,e);let i=this.worldTransform.clone();return i.invert(),r.prepend(i),t.setFromMatrix(r),t},replaceChild(t,e){t.updateLocalTransform(),this.addChildAt(e,this.getChildIndex(t)),e.setFromMatrix(t.localTransform),e.updateLocalTransform(),this.removeChild(t)}}}),Pn,Mn=g(()=>{"use strict";Pn={collectRenderables(t,e,r){this.parentRenderLayer&&this.parentRenderLayer!==r||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(t,e,r):this.renderGroup?e.renderPipes.renderGroup.addRenderGroup(this.renderGroup,t):this.collectRenderablesWithEffects(t,e,r))},collectRenderablesSimple(t,e,r){let i=this.children,n=i.length;for(let s=0;s<n;s++)i[s].collectRenderables(t,e,r)},collectRenderablesWithEffects(t,e,r){let{renderPipes:i}=e;for(let n=0;n<this.effects.length;n++){let s=this.effects[n];i[s.pipe].push(s,this,t)}this.collectRenderablesSimple(t,e,r);for(let n=this.effects.length-1;n>=0;n--){let s=this.effects[n];i[s.pipe].pop(s,this,t)}}}}),Ir,Ni=g(()=>{"use strict";Ir=class{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let t=0;t<this.filters.length;t++)this.filters[t].destroy();this.filters=null,this.filterArea=null}}}),sn,Ci,as=g(()=>{X(),zt(),sn=class{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach(t=>{this.add({test:t.test,maskClass:t})}))}add(t){this._tests.push(t)}getMaskEffect(t){this._initialized||this.init();for(let e=0;e<this._tests.length;e++){let r=this._tests[e];if(r.test(t))return Rt.get(r.maskClass,t)}return t}returnMaskEffect(t){Rt.return(t)}},Ci=new sn,we.handleByList(M.MaskEffect,Ci._effectClasses)}),p,x=g(()=>{Ni(),as(),p={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){let t=this.renderGroup||this.parentRenderGroup;t&&(t.structureDidChange=!0)},addEffect(t){this.effects.indexOf(t)===-1&&(this.effects.push(t),this.effects.sort((e,r)=>e.priority-r.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(t){let e=this.effects.indexOf(t);e!==-1&&(this.effects.splice(e,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(t){let e=this._maskEffect;e?.mask!==t&&(e&&(this.removeEffect(e),Ci.returnMaskEffect(e),this._maskEffect=null),t!=null&&(this._maskEffect=Ci.getMaskEffect(t),this.addEffect(this._maskEffect)))},get mask(){return this._maskEffect?.mask},setMask(t){this._maskOptions={...this._maskOptions,...t},t.mask&&(this.mask=t.mask),this._markStructureAsChanged()},set filters(t){!Array.isArray(t)&&t&&(t=[t]);let e=this._filterEffect||(this._filterEffect=new Ir);t=t;let r=t?.length>0,i=e.filters?.length>0,n=r!==i;t=Array.isArray(t)?t.slice(0):t,e.filters=Object.freeze(t),n&&(r?this.addEffect(e):(this.removeEffect(e),e.filters=t??null))},get filters(){return this._filterEffect?.filters},set filterArea(t){this._filterEffect||(this._filterEffect=new Ir),this._filterEffect.filterArea=t},get filterArea(){return this._filterEffect?.filterArea}}}),w,C=g(()=>{Mt(),w={label:null,get name(){return Xe(nt,"Container.name property has been removed, use Container.label instead"),this.label},set name(t){Xe(nt,"Container.name property has been removed, use Container.label instead"),this.label=t},getChildByName(t,e=!1){return this.getChildByLabel(t,e)},getChildByLabel(t,e=!1){let r=this.children;for(let i=0;i<r.length;i++){let n=r[i];if(n.label===t||t instanceof RegExp&&t.test(n.label))return n}if(e)for(let i=0;i<r.length;i++){let n=r[i].getChildByLabel(t,!0);if(n)return n}return null},getChildrenByLabel(t,e=!1,r=[]){let i=this.children;for(let n=0;n<i.length;n++){let s=i[n];(s.label===t||t instanceof RegExp&&t.test(s.label))&&r.push(s)}if(e)for(let n=0;n<i.length;n++)i[n].getChildrenByLabel(t,!0,r);return r}}}),A,R,O=g(()=>{He(),A=[new ye,new ye,new ye,new ye],R=class cl{constructor(e=0,r=0,i=0,n=0){this.type="rectangle",this.x=Number(e),this.y=Number(r),this.width=Number(i),this.height=Number(n)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new cl(0,0,0,0)}clone(){return new cl(this.x,this.y,this.width,this.height)}copyFromBounds(e){return this.x=e.minX,this.y=e.minY,this.width=e.maxX-e.minX,this.height=e.maxY-e.minY,this}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.copyFrom(this),e}contains(e,r){return this.width<=0||this.height<=0?!1:e>=this.x&&e<this.x+this.width&&r>=this.y&&r<this.y+this.height}strokeContains(e,r,i,n=.5){let{width:s,height:a}=this;if(s<=0||a<=0)return!1;let o=this.x,l=this.y,h=i*(1-n),u=i-h,c=o-h,f=o+s+h,d=l-h,_=l+a+h,v=o+u,m=o+s-u,y=l+u,S=l+a-u;return e>=c&&e<=f&&r>=d&&r<=_&&!(e>v&&e<m&&r>y&&r<S)}intersects(e,r){if(!r){let ne=this.x<e.x?e.x:this.x;if((this.right>e.right?e.right:this.right)<=ne)return!1;let ue=this.y<e.y?e.y:this.y;return(this.bottom>e.bottom?e.bottom:this.bottom)>ue}let i=this.left,n=this.right,s=this.top,a=this.bottom;if(n<=i||a<=s)return!1;let o=A[0].set(e.left,e.top),l=A[1].set(e.left,e.bottom),h=A[2].set(e.right,e.top),u=A[3].set(e.right,e.bottom);if(h.x<=o.x||l.y<=o.y)return!1;let c=Math.sign(r.a*r.d-r.b*r.c);if(c===0||(r.apply(o,o),r.apply(l,l),r.apply(h,h),r.apply(u,u),Math.max(o.x,l.x,h.x,u.x)<=i||Math.min(o.x,l.x,h.x,u.x)>=n||Math.max(o.y,l.y,h.y,u.y)<=s||Math.min(o.y,l.y,h.y,u.y)>=a))return!1;let f=c*(l.y-o.y),d=c*(o.x-l.x),_=f*i+d*s,v=f*n+d*s,m=f*i+d*a,y=f*n+d*a;if(Math.max(_,v,m,y)<=f*o.x+d*o.y||Math.min(_,v,m,y)>=f*u.x+d*u.y)return!1;let S=c*(o.y-h.y),P=c*(h.x-o.x),T=S*i+P*s,z=S*n+P*s,D=S*i+P*a,L=S*n+P*a;return!(Math.max(T,z,D,L)<=S*o.x+P*o.y||Math.min(T,z,D,L)>=S*u.x+P*u.y)}pad(e=0,r=e){return this.x-=e,this.y-=r,this.width+=e*2,this.height+=r*2,this}fit(e){let r=Math.max(this.x,e.x),i=Math.min(this.x+this.width,e.x+e.width),n=Math.max(this.y,e.y),s=Math.min(this.y+this.height,e.y+e.height);return this.x=r,this.width=Math.max(i-r,0),this.y=n,this.height=Math.max(s-n,0),this}ceil(e=1,r=.001){let i=Math.ceil((this.x+this.width-r)*e)/e,n=Math.ceil((this.y+this.height-r)*e)/e;return this.x=Math.floor((this.x+r)*e)/e,this.y=Math.floor((this.y+r)*e)/e,this.width=i-this.x,this.height=n-this.y,this}enlarge(e){let r=Math.min(this.x,e.x),i=Math.max(this.x+this.width,e.x+e.width),n=Math.min(this.y,e.y),s=Math.max(this.y+this.height,e.y+e.height);return this.x=r,this.width=i-r,this.y=n,this.height=s-n,this}getBounds(e){return e||(e=new cl),e.copyFrom(this),e}containsRect(e){if(this.width<=0||this.height<=0)return!1;let r=e.x,i=e.y,n=e.x+e.width,s=e.y+e.height;return r>=this.x&&r<this.x+this.width&&i>=this.y&&i<this.y+this.height&&n>=this.x&&n<this.x+this.width&&s>=this.y&&s<this.y+this.height}set(e,r,i,n){return this.x=e,this.y=r,this.width=i,this.height=n,this}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}}),F,$,se=g(()=>{Ke(),O(),F=new ve,$=class by{constructor(e=1/0,r=1/0,i=-1/0,n=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=F,this.minX=e,this.minY=r,this.maxX=i,this.maxY=n}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new R);let e=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(e.x=0,e.y=0,e.width=0,e.height=0):e.copyFromBounds(this),e}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=F,this}set(e,r,i,n){this.minX=e,this.minY=r,this.maxX=i,this.maxY=n}addFrame(e,r,i,n,s){s||(s=this.matrix);let a=s.a,o=s.b,l=s.c,h=s.d,u=s.tx,c=s.ty,f=this.minX,d=this.minY,_=this.maxX,v=this.maxY,m=a*e+l*r+u,y=o*e+h*r+c;m<f&&(f=m),y<d&&(d=y),m>_&&(_=m),y>v&&(v=y),m=a*i+l*r+u,y=o*i+h*r+c,m<f&&(f=m),y<d&&(d=y),m>_&&(_=m),y>v&&(v=y),m=a*e+l*n+u,y=o*e+h*n+c,m<f&&(f=m),y<d&&(d=y),m>_&&(_=m),y>v&&(v=y),m=a*i+l*n+u,y=o*i+h*n+c,m<f&&(f=m),y<d&&(d=y),m>_&&(_=m),y>v&&(v=y),this.minX=f,this.minY=d,this.maxX=_,this.maxY=v}addRect(e,r){this.addFrame(e.x,e.y,e.x+e.width,e.y+e.height,r)}addBounds(e,r){this.addFrame(e.minX,e.minY,e.maxX,e.maxY,r)}addBoundsMask(e){this.minX=this.minX>e.minX?this.minX:e.minX,this.minY=this.minY>e.minY?this.minY:e.minY,this.maxX=this.maxX<e.maxX?this.maxX:e.maxX,this.maxY=this.maxY<e.maxY?this.maxY:e.maxY}applyMatrix(e){let r=this.minX,i=this.minY,n=this.maxX,s=this.maxY,{a,b:o,c:l,d:h,tx:u,ty:c}=e,f=a*r+l*i+u,d=o*r+h*i+c;this.minX=f,this.minY=d,this.maxX=f,this.maxY=d,f=a*n+l*i+u,d=o*n+h*i+c,this.minX=f<this.minX?f:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=f>this.maxX?f:this.maxX,this.maxY=d>this.maxY?d:this.maxY,f=a*r+l*s+u,d=o*r+h*s+c,this.minX=f<this.minX?f:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=f>this.maxX?f:this.maxX,this.maxY=d>this.maxY?d:this.maxY,f=a*n+l*s+u,d=o*n+h*s+c,this.minX=f<this.minX?f:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=f>this.maxX?f:this.maxX,this.maxY=d>this.maxY?d:this.maxY}fit(e){return this.minX<e.left&&(this.minX=e.left),this.maxX>e.right&&(this.maxX=e.right),this.minY<e.top&&(this.minY=e.top),this.maxY>e.bottom&&(this.maxY=e.bottom),this}fitBounds(e,r,i,n){return this.minX<e&&(this.minX=e),this.maxX>r&&(this.maxX=r),this.minY<i&&(this.minY=i),this.maxY>n&&(this.maxY=n),this}pad(e,r=e){return this.minX-=e,this.maxX+=e,this.minY-=r,this.maxY+=r,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new by(this.minX,this.minY,this.maxX,this.maxY)}scale(e,r=e){return this.minX*=e,this.minY*=r,this.maxX*=e,this.maxY*=r,this}get x(){return this.minX}set x(e){let r=this.maxX-this.minX;this.minX=e,this.maxX=e+r}get y(){return this.minY}set y(e){let r=this.maxY-this.minY;this.minY=e,this.maxY=e+r}get width(){return this.maxX-this.minX}set width(e){this.maxX=this.minX+e}get height(){return this.maxY-this.minY}set height(e){this.maxY=this.minY+e}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(e,r,i,n){let s=this.minX,a=this.minY,o=this.maxX,l=this.maxY;n||(n=this.matrix);let h=n.a,u=n.b,c=n.c,f=n.d,d=n.tx,_=n.ty;for(let v=r;v<i;v+=2){let m=e[v],y=e[v+1],S=h*m+c*y+d,P=u*m+f*y+_;s=S<s?S:s,a=P<a?P:a,o=S>o?S:o,l=P>l?P:l}this.minX=s,this.minY=a,this.maxX=o,this.maxY=l}containsPoint(e,r){return this.minX<=e&&this.minY<=r&&this.maxX>=e&&this.maxY>=r}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(e){return this.minX=e.minX,this.minY=e.minY,this.maxX=e.maxX,this.maxY=e.maxY,this}}}),xe,ae,ge=g(()=>{Ke(),Cn(),se(),xe=new wi(ve),ae=new wi($)}),Z,Y,Pe=g(()=>{Ke(),se(),ge(),Z=new ve,Y={getFastGlobalBounds(t,e){e||(e=new $),e.clear(),this._getGlobalBoundsRecursive(!!t,e,this.parentRenderLayer),e.isValid||e.set(0,0,0,0);let r=this.renderGroup||this.parentRenderGroup;return e.applyMatrix(r.worldTransform),e},_getGlobalBoundsRecursive(t,e,r){let i=e;if(t&&this.parentRenderLayer&&this.parentRenderLayer!==r||this.localDisplayStatus!==7||!this.measurable)return;let n=!!this.effects.length;if((this.renderGroup||n)&&(i=ae.get().clear()),this.boundsArea)e.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){let a=this.bounds;i.addFrame(a.minX,a.minY,a.maxX,a.maxY,this.groupTransform)}let s=this.children;for(let a=0;a<s.length;a++)s[a]._getGlobalBoundsRecursive(t,i,r)}if(n){let s=!1,a=this.renderGroup||this.parentRenderGroup;for(let o=0;o<this.effects.length;o++)this.effects[o].addBounds&&(s||(s=!0,i.applyMatrix(a.worldTransform)),this.effects[o].addBounds(i,!0));s&&(i.applyMatrix(a.worldTransform.copyTo(Z).invert()),e.addBounds(i,this.relativeGroupTransform)),e.addBounds(i),ae.return(i)}else this.renderGroup&&(e.addBounds(i,this.relativeGroupTransform),ae.return(i))}}});function b(t,e,r){r.clear();let i,n;return t.parent?e?i=t.parent.worldTransform:(n=xe.get().identity(),i=k(t,n)):i=ve.IDENTITY,E(t,r,i,e),n&&xe.return(n),r.isValid||r.set(0,0,0,0),r}function E(t,e,r,i){if(!t.visible||!t.measurable)return;let n;i?n=t.worldTransform:(t.updateLocalTransform(),n=xe.get(),n.appendFrom(t.localTransform,r));let s=e,a=!!t.effects.length;if(a&&(e=ae.get().clear()),t.boundsArea)e.addRect(t.boundsArea,n);else{t.bounds&&(e.matrix=n,e.addBounds(t.bounds));for(let o=0;o<t.children.length;o++)E(t.children[o],e,n,i)}if(a){for(let o=0;o<t.effects.length;o++)t.effects[o].addBounds?.(e);s.addBounds(e,ve.IDENTITY),ae.return(e)}i||xe.return(n)}function k(t,e){let r=t.parent;return r&&(k(r,e),r.updateLocalTransform(),e.append(r.localTransform)),e}var B=g(()=>{Ke(),ge()});function N(t,e){if(t===16777215||!e)return e;if(e===16777215||!t)return t;let r=t>>16&255,i=t>>8&255,n=t&255,s=e>>16&255,a=e>>8&255,o=e&255,l=r*s/255|0,h=i*a/255|0,u=n*o/255|0;return(l<<16)+(h<<8)+u}var H=g(()=>{"use strict"});function Q(t,e){return t===ie?e:e===ie?t:N(t,e)}var ie,be=g(()=>{H(),ie=16777215});function Ce(t){return((t&255)<<16)+(t&65280)+(t>>16&255)}var ee,j=g(()=>{B(),ge(),be(),ee={getGlobalAlpha(t){if(t)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let e=this.alpha,r=this.parent;for(;r;)e*=r.alpha,r=r.parent;return e},getGlobalTransform(t,e){if(e)return t.copyFrom(this.worldTransform);this.updateLocalTransform();let r=k(this,xe.get().identity());return t.appendFrom(this.localTransform,r),xe.return(r),t},getGlobalTint(t){if(t)return this.renderGroup?Ce(this.renderGroup.worldColor):this.parentRenderGroup?Ce(Q(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let e=this.localColor,r=this.parent;for(;r;)e=Q(e,r.localColor),r=r.parent;return Ce(e)}}});function he(t,e,r){return e.clear(),r||(r=ve.IDENTITY),K(t,e,r,t,!0),e.isValid||e.set(0,0,0,0),e}function K(t,e,r,i,n){let s;if(n)s=xe.get(),s=r.copyTo(s);else{if(!t.visible||!t.measurable)return;t.updateLocalTransform();let l=t.localTransform;s=xe.get(),s.appendFrom(l,r)}let a=e,o=!!t.effects.length;if(o&&(e=ae.get().clear()),t.boundsArea)e.addRect(t.boundsArea,s);else{t.renderPipeId&&(e.matrix=s,e.addBounds(t.bounds));let l=t.children;for(let h=0;h<l.length;h++)K(l[h],e,s,i,!1)}if(o){for(let l=0;l<t.effects.length;l++)t.effects[l].addLocalBounds?.(e,i);a.addBounds(e,ve.IDENTITY),ae.return(e)}xe.return(s)}var te=g(()=>{Ke(),ge()});function fe(t,e){let r=t.children;for(let i=0;i<r.length;i++){let n=r[i],s=n.uid,a=(n._didViewChangeTick&65535)<<16|n._didContainerChangeTick&65535,o=e.index;(e.data[o]!==s||e.data[o+1]!==a)&&(e.data[e.index]=s,e.data[e.index+1]=a,e.didChange=!0),e.index=o+2,n.children.length&&fe(n,e)}return e.didChange}var _e=g(()=>{"use strict"}),Ue,qe,tt=g(()=>{Ke(),se(),B(),te(),_e(),Ue=new ve,qe={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(t,e){let r=Math.sign(this.scale.x)||1;e!==0?this.scale.x=t/e*r:this.scale.x=r},_setHeight(t,e){let r=Math.sign(this.scale.y)||1;e!==0?this.scale.y=t/e*r:this.scale.y=r},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new $});let t=this._localBoundsCacheData;return t.index=1,t.didChange=!1,t.data[0]!==this._didViewChangeTick&&(t.didChange=!0,t.data[0]=this._didViewChangeTick),fe(this,t),t.didChange&&he(this,t.localBounds,Ue),t.localBounds},getBounds(t,e){return b(this,t,e||new $)}}}),jt,pr=g(()=>{"use strict";jt={_onRender:null,set onRender(t){let e=this.renderGroup||this.parentRenderGroup;if(!t){this._onRender&&e?.removeOnRender(this),this._onRender=null;return}this._onRender||e?.addOnRender(this),this._onRender=t},get onRender(){return this._onRender}}});function zi(t,e){return t._zIndex-e._zIndex}var an,on=g(()=>{"use strict";an={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(t){this._zIndex!==t&&(this._zIndex=t,this.depthOfChildModified())},depthOfChildModified(){this.parent&&(this.parent.sortableChildren=!0,this.parent.sortDirty=!0),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0)},sortChildren(){this.sortDirty&&(this.sortDirty=!1,this.children.sort(zi))}}}),Ai,er=g(()=>{He(),ge(),Ai={getGlobalPosition(t=new ye,e=!1){return this.parent?this.parent.toGlobal(this._position,t,e):(t.x=this._position.x,t.y=this._position.y),t},toGlobal(t,e,r=!1){let i=this.getGlobalTransform(xe.get(),r);return e=i.apply(t,e),xe.return(i),e},toLocal(t,e,r,i){e&&(t=e.toGlobal(t,r,i));let n=this.getGlobalTransform(xe.get(),i);return r=n.applyInverse(t,r),xe.return(n),r}}}),ii,Hi=g(()=>{Ot(),ii=class{constructor(){this.uid=ot("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.gcTick=0}reset(){this.instructionSize=0}add(t){this.instructions[this.instructionSize++]=t}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}});function Cr(t){return t+=t===0?1:0,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t+1}function Ar(t){return!(t&t-1)&&!!t}var Or=g(()=>{"use strict"});function $r(t){let e={};for(let r in t)t[r]!==void 0&&(e[r]=t[r]);return e}var yr=g(()=>{"use strict"});function Fr(t){let e=Dr[t];return e===void 0&&(Dr[t]=ot("resource")),e}var Dr,os,ni,Rn=g(()=>{kt(),Ot(),Mt(),Dr=Object.create(null),os=class wy extends st{constructor(e={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,e={...wy.defaultOptions,...e},this.addressMode=e.addressMode,this.addressModeU=e.addressModeU??this.addressModeU,this.addressModeV=e.addressModeV??this.addressModeV,this.addressModeW=e.addressModeW??this.addressModeW,this.scaleMode=e.scaleMode,this.magFilter=e.magFilter??this.magFilter,this.minFilter=e.minFilter??this.minFilter,this.mipmapFilter=e.mipmapFilter??this.mipmapFilter,this.lodMinClamp=e.lodMinClamp,this.lodMaxClamp=e.lodMaxClamp,this.compare=e.compare,this.maxAnisotropy=e.maxAnisotropy??1}set addressMode(e){this.addressModeU=e,this.addressModeV=e,this.addressModeW=e}get addressMode(){return this.addressModeU}set wrapMode(e){Xe(nt,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=e}get wrapMode(){return this.addressMode}set scaleMode(e){this.magFilter=e,this.minFilter=e,this.mipmapFilter=e}get scaleMode(){return this.magFilter}set maxAnisotropy(e){this._maxAnisotropy=Math.min(e,16),this._maxAnisotropy>1&&(this.scaleMode="linear")}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this.emit("change",this),this._sharedResourceId=null}_generateResourceId(){let e=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=Fr(e),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}},os.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"},ni=os}),dl,Qt,xr=g(()=>{kt(),Or(),yr(),Ot(),Rn(),dl=class Ty extends st{constructor(e={}){super(),this.options=e,this.uid=ot("textureSource"),this._resourceType="textureSource",this._resourceId=ot("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=!1,this.format="rgba8unorm",this.dimension="2d",this.antialias=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,e={...Ty.defaultOptions,...e},this.label=e.label??"",this.resource=e.resource,this.autoGarbageCollect=e.autoGarbageCollect,this._resolution=e.resolution,e.width?this.pixelWidth=e.width*this._resolution:this.pixelWidth=this.resource?this.resourceWidth??1:1,e.height?this.pixelHeight=e.height*this._resolution:this.pixelHeight=this.resource?this.resourceHeight??1:1,this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=e.format,this.dimension=e.dimensions,this.mipLevelCount=e.mipLevelCount,this.autoGenerateMipmaps=e.autoGenerateMipmaps,this.sampleCount=e.sampleCount,this.antialias=e.antialias,this.alphaMode=e.alphaMode,this.style=new ni($r(e)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(e){this.style!==e&&(this._style?.off("change",this._onStyleChange,this),this._style=e,this._style?.on("change",this._onStyleChange,this),this._onStyleChange())}get addressMode(){return this._style.addressMode}set addressMode(e){this._style.addressMode=e}get repeatMode(){return this._style.addressMode}set repeatMode(e){this._style.addressMode=e}get magFilter(){return this._style.magFilter}set magFilter(e){this._style.magFilter=e}get minFilter(){return this._style.minFilter}set minFilter(e){this._style.minFilter=e}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(e){this._style.mipmapFilter=e}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(e){this._style.lodMinClamp=e}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(e){this._style.lodMaxClamp=e}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){let e=this._resolution;if(this.resize(this.resourceWidth/e,this.resourceHeight/e))return}this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){this._resourceId=ot("resource"),this.emit("change",this),this.emit("unload",this)}get resourceWidth(){let{resource:e}=this;return e.naturalWidth||e.videoWidth||e.displayWidth||e.width}get resourceHeight(){let{resource:e}=this;return e.naturalHeight||e.videoHeight||e.displayHeight||e.height}get resolution(){return this._resolution}set resolution(e){this._resolution!==e&&(this._resolution=e,this.width=this.pixelWidth/e,this.height=this.pixelHeight/e)}resize(e,r,i){i||(i=this._resolution),e||(e=this.width),r||(r=this.height);let n=Math.round(e*i),s=Math.round(r*i);return this.width=n/i,this.height=s/i,this._resolution=i,this.pixelWidth===n&&this.pixelHeight===s?!1:(this._refreshPOT(),this.pixelWidth=n,this.pixelHeight=s,this.emit("resize",this),this._resourceId=ot("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(e){this._style.wrapMode=e}get wrapMode(){return this._style.wrapMode}set scaleMode(e){this._style.scaleMode=e}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=Ar(this.pixelWidth)&&Ar(this.pixelHeight)}static test(e){throw new Error("Unimplemented")}},dl.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1},Qt=dl});function tx(){for(let t=0;t<16;t++){let e=[];ma.push(e);for(let r=0;r<16;r++){let i=ls(Vi[t]*Vi[r]+Wi[t]*ji[r]),n=ls(ji[t]*Vi[r]+$i[t]*ji[r]),s=ls(Vi[t]*Wi[r]+Wi[t]*$i[r]),a=ls(ji[t]*Wi[r]+$i[t]*$i[r]);for(let o=0;o<16;o++)if(Vi[o]===i&&ji[o]===n&&Wi[o]===s&&$i[o]===a){e.push(o);break}}}for(let t=0;t<16;t++){let e=new ve;e.set(Vi[t],ji[t],Wi[t],$i[t],0,0),fl.push(e)}}var Vi,ji,Wi,$i,ma,fl,ls,Ht,rx=g(()=>{Ke(),Vi=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],ji=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Wi=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],$i=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],ma=[],fl=[],ls=Math.sign,tx(),Ht={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:t=>Vi[t],uY:t=>ji[t],vX:t=>Wi[t],vY:t=>$i[t],inv:t=>t&8?t&15:-t&7,add:(t,e)=>ma[t][e],sub:(t,e)=>ma[t][Ht.inv(e)],rotate180:t=>t^4,isVertical:t=>(t&3)===2,byDirection:(t,e)=>Math.abs(t)*2<=Math.abs(e)?e>=0?Ht.S:Ht.N:Math.abs(e)*2<=Math.abs(t)?t>0?Ht.E:Ht.W:e>0?t>0?Ht.SE:Ht.SW:t>0?Ht.NE:Ht.NW,matrixAppendRotationInv:(t,e,r=0,i=0)=>{let n=fl[Ht.inv(e)];n.tx=r,n.ty=i,t.append(n)}}}),pl,ix=g(()=>{"use strict";pl=()=>{}}),_a,_d=g(()=>{X(),xr(),_a=class extends Qt{constructor(t){let e=t.resource||new Float32Array(t.width*t.height*4),r=t.format;r||(e instanceof Float32Array?r="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?r="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?r="rgba16uint":(e instanceof Int8Array,r="bgra8unorm")),super({...t,resource:e,format:r}),this.uploadMethodId="buffer"}static test(t){return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}},_a.extension=M.TextureSource}),gl,ml,vd=g(()=>{Ke(),gl=new ve,ml=class{constructor(t,e){this.mapCoord=new ve,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof e>"u"?this.clampMargin=t.width<10?0:.5:this.clampMargin=e,this.isSimple=!1,this.texture=t}get texture(){return this._texture}set texture(t){this.texture!==t&&(this._texture?.removeListener("update",this.update,this),this._texture=t,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(t,e){e===void 0&&(e=t);let r=this.mapCoord;for(let i=0;i<t.length;i+=2){let n=t[i],s=t[i+1];e[i]=n*r.a+s*r.c+r.tx,e[i+1]=n*r.b+s*r.d+r.ty}return e}update(){let t=this._texture;this._updateID++;let e=t.uvs;this.mapCoord.set(e.x1-e.x0,e.y1-e.y0,e.x3-e.x0,e.y3-e.y0,e.x0,e.y0);let r=t.orig,i=t.trim;i&&(gl.set(r.width/i.width,0,0,r.height/i.height,-i.x/i.width,-i.y/i.height),this.mapCoord.append(gl));let n=t.source,s=this.uClampFrame,a=this.clampMargin/n._resolution,o=this.clampOffset/n._resolution;return s[0]=(t.frame.x+a+o)/n.width,s[1]=(t.frame.y+a+o)/n.height,s[2]=(t.frame.x+t.frame.width-a+o)/n.width,s[3]=(t.frame.y+t.frame.height-a+o)/n.height,this.uClampOffset[0]=this.clampOffset/n.pixelWidth,this.uClampOffset[1]=this.clampOffset/n.pixelHeight,this.isSimple=t.frame.width===n.width&&t.frame.height===n.height&&t.rotate===0,!0}}}),Fe,Ft=g(()=>{kt(),rx(),O(),Ot(),Mt(),ix(),_d(),xr(),vd(),Fe=class extends st{constructor({source:t,label:e,frame:r,orig:i,trim:n,defaultAnchor:s,defaultBorders:a,rotate:o,dynamic:l}={}){if(super(),this.uid=ot("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new R,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=t?.source??new Qt,this.noFrame=!r,r)this.frame.copyFrom(r);else{let{width:h,height:u}=this._source;this.frame.width=h,this.frame.height=u}this.orig=i||this.frame,this.trim=n,this.rotate=o??0,this.defaultAnchor=s,this.defaultBorders=a,this.destroyed=!1,this.dynamic=l||!1,this.updateUvs()}set source(t){this._source&&this._source.off("resize",this.update,this),this._source=t,t.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new ml(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){let{uvs:t,frame:e}=this,{width:r,height:i}=this._source,n=e.x/r,s=e.y/i,a=e.width/r,o=e.height/i,l=this.rotate;if(l){let h=a/2,u=o/2,c=n+h,f=s+u;l=Ht.add(l,Ht.NW),t.x0=c+h*Ht.uX(l),t.y0=f+u*Ht.uY(l),l=Ht.add(l,2),t.x1=c+h*Ht.uX(l),t.y1=f+u*Ht.uY(l),l=Ht.add(l,2),t.x2=c+h*Ht.uX(l),t.y2=f+u*Ht.uY(l),l=Ht.add(l,2),t.x3=c+h*Ht.uX(l),t.y3=f+u*Ht.uY(l)}else t.x0=n,t.y0=s,t.x1=n+a,t.y1=s,t.x2=n+a,t.y2=s+o,t.x3=n,t.y3=s+o}destroy(t=!1){this._source&&t&&(this._source.destroy(),this._source=null),this._textureMatrix=null,this.destroyed=!0,this.emit("destroy",this),this.removeAllListeners()}update(){this.noFrame&&(this.frame.width=this._source.width,this.frame.height=this._source.height),this.updateUvs(),this.emit("update",this)}get baseTexture(){return Xe(nt,"Texture.baseTexture is now Texture.source"),this._source}},Fe.EMPTY=new Fe({label:"EMPTY",source:new Qt({label:"EMPTY"})}),Fe.EMPTY.destroy=pl,Fe.WHITE=new Fe({source:new _a({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"}),Fe.WHITE.destroy=pl}),yd,xd,or,ln=g(()=>{Or(),xr(),Ft(),Rn(),yd=0,xd=class{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this.textureStyle=new ni(this.textureOptions)}createTexture(t,e,r){let i=new Qt({...this.textureOptions,width:t,height:e,resolution:1,antialias:r,autoGarbageCollect:!1});return new Fe({source:i,label:`texturePool_${yd++}`})}getOptimalTexture(t,e,r=1,i){let n=Math.ceil(t*r-1e-6),s=Math.ceil(e*r-1e-6);n=Cr(n),s=Cr(s);let a=(n<<17)+(s<<1)+(i?1:0);this._texturePool[a]||(this._texturePool[a]=[]);let o=this._texturePool[a].pop();return o||(o=this.createTexture(n,s,i)),o.source._resolution=r,o.source.width=n/r,o.source.height=s/r,o.source.pixelWidth=n,o.source.pixelHeight=s,o.frame.x=0,o.frame.y=0,o.frame.width=t,o.frame.height=e,o.updateUvs(),this._poolKeyHash[o.uid]=a,o}getSameSizeTexture(t,e=!1){let r=t.source;return this.getOptimalTexture(t.width,t.height,r._resolution,e)}returnTexture(t,e=!1){let r=this._poolKeyHash[t.uid];e&&(t.source.style=this.textureStyle),this._texturePool[r].push(t)}clear(t){if(t=t!==!1,t)for(let e in this._texturePool){let r=this._texturePool[e];if(r)for(let i=0;i<r.length;i++)r[i].destroy(!0)}this._texturePool={}}},or=new xd}),bd,nx=g(()=>{Ke(),Hi(),ln(),bd=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new ve,this.worldColorAlpha=4294967295,this.worldColor=16777215,this.worldAlpha=1,this.childrenToUpdate=Object.create(null),this.updateTick=0,this.gcTick=0,this.childrenRenderablesToUpdate={list:[],index:0},this.structureDidChange=!0,this.instructionSet=new ii,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(t){this.root=t,t._onRender&&this.addOnRender(t),t.didChange=!0;let e=t.children;for(let r=0;r<e.length;r++){let i=e[r];i._updateFlags=15,this.addChild(i)}}enableCacheAsTexture(t={}){this.textureOptions=t,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(or.returnTexture(this.texture),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0}reset(){this.renderGroupChildren.length=0;for(let t in this.childrenToUpdate){let e=this.childrenToUpdate[t];e.list.fill(null),e.index=0}this.childrenRenderablesToUpdate.index=0,this.childrenRenderablesToUpdate.list.fill(null),this.root=null,this.updateTick=0,this.structureDidChange=!0,this._onRenderContainers.length=0,this.renderGroupParent=null,this.disableCacheAsTexture()}get localTransform(){return this.root.localTransform}addRenderGroupChild(t){t.renderGroupParent&&t.renderGroupParent._removeRenderGroupChild(t),t.renderGroupParent=this,this.renderGroupChildren.push(t)}_removeRenderGroupChild(t){let e=this.renderGroupChildren.indexOf(t);e>-1&&this.renderGroupChildren.splice(e,1),t.renderGroupParent=null}addChild(t){if(this.structureDidChange=!0,t.parentRenderGroup=this,t.updateTick=-1,t.parent===this.root?t.relativeRenderGroupDepth=1:t.relativeRenderGroupDepth=t.parent.relativeRenderGroupDepth+1,t.didChange=!0,this.onChildUpdate(t),t.renderGroup){this.addRenderGroupChild(t.renderGroup);return}t._onRender&&this.addOnRender(t);let e=t.children;for(let r=0;r<e.length;r++)this.addChild(e[r])}removeChild(t){if(this.structureDidChange=!0,t._onRender&&(t.renderGroup||this.removeOnRender(t)),t.parentRenderGroup=null,t.renderGroup){this._removeRenderGroupChild(t.renderGroup);return}let e=t.children;for(let r=0;r<e.length;r++)this.removeChild(e[r])}removeChildren(t){for(let e=0;e<t.length;e++)this.removeChild(t[e])}onChildUpdate(t){let e=this.childrenToUpdate[t.relativeRenderGroupDepth];e||(e=this.childrenToUpdate[t.relativeRenderGroupDepth]={index:0,list:[]}),e.list[e.index++]=t}updateRenderable(t){t.globalDisplayStatus<7||(this.instructionSet.renderPipes[t.renderPipeId].updateRenderable(t),t.didViewUpdate=!1)}onChildViewUpdate(t){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=t}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(t){this._onRenderContainers.push(t)}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1)}runOnRender(t){for(let e=0;e<this._onRenderContainers.length;e++)this._onRenderContainers[e]._onRender(t)}destroy(){this.disableCacheAsTexture(),this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null}getChildren(t=[]){let e=this.root.children;for(let r=0;r<e.length;r++)this._getChildren(e[r],t);return t}_getChildren(t,e=[]){if(e.push(t),t.renderGroup)return e;let r=t.children;for(let i=0;i<r.length;i++)this._getChildren(r[i],e);return e}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return(this._matrixDirty&1)===0?this._inverseWorldTransform:(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new ve),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new ve),this._textureOffsetInverseTransform.copyFrom(this.inverseWorldTransform).translate(-this._textureBounds.x,-this._textureBounds.y))}get inverseParentTextureTransform(){if((this._matrixDirty&4)===0)return this._inverseParentTextureTransform;this._matrixDirty&=-5;let t=this._parentCacheAsTextureRenderGroup;return t?(this._inverseParentTextureTransform||(this._inverseParentTextureTransform=new ve),this._inverseParentTextureTransform.copyFrom(this.worldTransform).prepend(t.inverseWorldTransform).translate(-t._textureBounds.x,-t._textureBounds.y)):this.worldTransform}get cacheToLocalTransform(){return this._parentCacheAsTextureRenderGroup?this._parentCacheAsTextureRenderGroup.textureOffsetInverseTransform:null}}});function sx(t,e,r={}){for(let i in e)!r[i]&&e[i]!==void 0&&(t[i]=e[i])}var ax=g(()=>{"use strict"}),va,hs,ya,us,cs,xa,kn,gr,si=g(()=>{kt(),ze(),Vt(),X(),Ke(),Ge(),ri(),Ot(),Mt(),wt(),zt(),Ti(),Li(),Mn(),x(),C(),Pe(),j(),tt(),pr(),on(),er(),nx(),ax(),va=new Et(null),hs=new Et(null),ya=new Et(null,1,1),us=new Et(null),cs=1,xa=2,kn=4,gr=class Sy extends st{constructor(e={}){super(),this.uid=ot("renderable"),this._updateFlags=15,this.renderGroup=null,this.parentRenderGroup=null,this.parentRenderGroupIndex=0,this.didChange=!1,this.didViewUpdate=!1,this.relativeRenderGroupDepth=0,this.children=[],this.parent=null,this.includeInBuild=!0,this.measurable=!0,this.isSimple=!0,this.updateTick=-1,this.localTransform=new ve,this.relativeGroupTransform=new ve,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new Et(this,0,0),this._scale=ya,this._pivot=hs,this._origin=us,this._skew=va,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._rotation=0,this.localColor=16777215,this.localAlpha=1,this.groupAlpha=1,this.groupColor=16777215,this.groupColorAlpha=4294967295,this.localBlendMode="inherit",this.groupBlendMode="normal",this.localDisplayStatus=7,this.globalDisplayStatus=7,this._didContainerChangeTick=0,this._didViewChangeTick=0,this._didLocalTransformChangeId=-1,this.effects=[],sx(this,e,{children:!0,parent:!0,effects:!0}),e.children?.forEach(r=>this.addChild(r)),e.parent?.addChild(this)}static mixin(e){Xe("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),we.mixin(Sy,e)}set _didChangeId(e){this._didViewChangeTick=e>>12&4095,this._didContainerChangeTick=e&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...e){if(this.allowChildren||Xe(nt,"addChild: Only Containers will be allowed to add children in v8.0.0"),e.length>1){for(let n=0;n<e.length;n++)this.addChild(e[n]);return e[0]}let r=e[0],i=this.renderGroup||this.parentRenderGroup;return r.parent===this?(this.children.splice(this.children.indexOf(r),1),this.children.push(r),i&&(i.structureDidChange=!0),r):(r.parent&&r.parent.removeChild(r),this.children.push(r),this.sortableChildren&&(this.sortDirty=!0),r.parent=this,r.didChange=!0,r._updateFlags=15,i&&i.addChild(r),this.emit("childAdded",r,this,this.children.length-1),r.emit("added",this),this._didViewChangeTick++,r._zIndex!==0&&r.depthOfChildModified(),r)}removeChild(...e){if(e.length>1){for(let n=0;n<e.length;n++)this.removeChild(e[n]);return e[0]}let r=e[0],i=this.children.indexOf(r);return i>-1&&(this._didViewChangeTick++,this.children.splice(i,1),this.renderGroup?this.renderGroup.removeChild(r):this.parentRenderGroup&&this.parentRenderGroup.removeChild(r),r.parentRenderLayer&&r.parentRenderLayer.detach(r),r.parent=null,this.emit("childRemoved",r,this,i),r.emit("removed",this)),r}_onUpdate(e){e&&e===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(e){!!this.renderGroup!==e&&(e?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;let e=this.parentRenderGroup;e?.removeChild(this),this.renderGroup=Rt.get(bd,this),this.groupTransform=ve.IDENTITY,e?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let e=this.parentRenderGroup;e?.removeChild(this),Rt.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,e?.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new ve),this.renderGroup?this._worldTransform.copyFrom(this.renderGroup.worldTransform):this.parentRenderGroup&&this._worldTransform.appendFrom(this.relativeGroupTransform,this.parentRenderGroup.worldTransform),this._worldTransform}get x(){return this._position.x}set x(e){this._position.x=e}get y(){return this._position.y}set y(e){this._position.y=e}get position(){return this._position}set position(e){this._position.copyFrom(e)}get rotation(){return this._rotation}set rotation(e){this._rotation!==e&&(this._rotation=e,this._onUpdate(this._skew))}get angle(){return this.rotation*$e}set angle(e){this.rotation=e*ut}get pivot(){return this._pivot===hs&&(this._pivot=new Et(this,0,0)),this._pivot}set pivot(e){this._pivot===hs&&(this._pivot=new Et(this,0,0),this._origin!==us&&Ye("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),typeof e=="number"?this._pivot.set(e):this._pivot.copyFrom(e)}get skew(){return this._skew===va&&(this._skew=new Et(this,0,0)),this._skew}set skew(e){this._skew===va&&(this._skew=new Et(this,0,0)),this._skew.copyFrom(e)}get scale(){return this._scale===ya&&(this._scale=new Et(this,1,1)),this._scale}set scale(e){this._scale===ya&&(this._scale=new Et(this,0,0)),typeof e=="string"&&(e=parseFloat(e)),typeof e=="number"?this._scale.set(e):this._scale.copyFrom(e)}get origin(){return this._origin===us&&(this._origin=new Et(this,0,0)),this._origin}set origin(e){this._origin===us&&(this._origin=new Et(this,0,0),this._pivot!==hs&&Ye("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),typeof e=="number"?this._origin.set(e):this._origin.copyFrom(e)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(e){let r=this.getLocalBounds().width;this._setWidth(e,r)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(e){let r=this.getLocalBounds().height;this._setHeight(e,r)}getSize(e){e||(e={});let r=this.getLocalBounds();return e.width=Math.abs(this.scale.x*r.width),e.height=Math.abs(this.scale.y*r.height),e}setSize(e,r){let i=this.getLocalBounds();typeof e=="object"?(r=e.height??e.width,e=e.width):r??(r=e),e!==void 0&&this._setWidth(e,i.width),r!==void 0&&this._setHeight(r,i.height)}_updateSkew(){let e=this._rotation,r=this._skew;this._cx=Math.cos(e+r._y),this._sx=Math.sin(e+r._y),this._cy=-Math.sin(e-r._x),this._sy=Math.cos(e-r._x)}updateTransform(e){return this.position.set(typeof e.x=="number"?e.x:this.position.x,typeof e.y=="number"?e.y:this.position.y),this.scale.set(typeof e.scaleX=="number"?e.scaleX||1:this.scale.x,typeof e.scaleY=="number"?e.scaleY||1:this.scale.y),this.rotation=typeof e.rotation=="number"?e.rotation:this.rotation,this.skew.set(typeof e.skewX=="number"?e.skewX:this.skew.x,typeof e.skewY=="number"?e.skewY:this.skew.y),this.pivot.set(typeof e.pivotX=="number"?e.pivotX:this.pivot.x,typeof e.pivotY=="number"?e.pivotY:this.pivot.y),this.origin.set(typeof e.originX=="number"?e.originX:this.origin.x,typeof e.originY=="number"?e.originY:this.origin.y),this}setFromMatrix(e){e.decompose(this)}updateLocalTransform(){let e=this._didContainerChangeTick;if(this._didLocalTransformChangeId===e)return;this._didLocalTransformChangeId=e;let r=this.localTransform,i=this._scale,n=this._pivot,s=this._origin,a=this._position,o=i._x,l=i._y,h=n._x,u=n._y,c=-s._x,f=-s._y;r.a=this._cx*o,r.b=this._sx*o,r.c=this._cy*l,r.d=this._sy*l,r.tx=a._x-(h*r.a+u*r.c)+(c*r.a+f*r.c)-c*o,r.ty=a._y-(h*r.b+u*r.d)+(c*r.b+f*r.d)-f*l}set alpha(e){e!==this.localAlpha&&(this.localAlpha=e,this._updateFlags|=cs,this._onUpdate())}get alpha(){return this.localAlpha}set tint(e){let r=le.shared.setValue(e??16777215).toBgrNumber();r!==this.localColor&&(this.localColor=r,this._updateFlags|=cs,this._onUpdate())}get tint(){return Ce(this.localColor)}set blendMode(e){this.localBlendMode!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=xa,this.localBlendMode=e,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(e){let r=e?2:0;(this.localDisplayStatus&2)!==r&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=kn,this.localDisplayStatus^=2,this._onUpdate())}get culled(){return!(this.localDisplayStatus&4)}set culled(e){let r=e?0:4;(this.localDisplayStatus&4)!==r&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=kn,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(e){let r=e?1:0;(this.localDisplayStatus&1)!==r&&(this._updateFlags|=kn,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(e=!1){if(this.destroyed)return;this.destroyed=!0;let r;if(this.children.length&&(r=this.removeChildren(0,this.children.length)),this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._origin=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),(typeof e=="boolean"?e:e?.children)&&r)for(let i=0;i<r.length;++i)r[i].destroy(e);this.renderGroup?.destroy(),this.renderGroup=null}},we.mixin(gr,Ei,Y,Ai,jt,qe,p,w,an,gt,An,ee,Pn)}),ba,_l=g(()=>{He(),ba=class Ey{constructor(e){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=Ey.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new ye,this.page=new ye,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=e}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(e,r,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(e,r,i,n,s){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}});function ox(t){return function(e){return e.test(t)}}function wd(t){var e={userAgent:"",platform:"",maxTouchPoints:0};!t&&typeof navigator<"u"?e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof t=="string"?e.userAgent=t:t&&t.userAgent&&(e={userAgent:t.userAgent,platform:t.platform,maxTouchPoints:t.maxTouchPoints||0});var r=e.userAgent,i=r.split("[FBAN");typeof i[1]<"u"&&(r=i[0]),i=r.split("Twitter"),typeof i[1]<"u"&&(r=i[0]);var n=ox(r),s={apple:{phone:n(wa)&&!n(ai),ipod:n(vl),tablet:!n(wa)&&(n(yl)||Pl(e))&&!n(ai),universal:n(xl),device:(n(wa)||n(vl)||n(yl)||n(xl)||Pl(e))&&!n(ai)},amazon:{phone:n(hn),tablet:!n(hn)&&n(ds),device:n(hn)||n(ds)},android:{phone:!n(ai)&&n(hn)||!n(ai)&&n(Ta),tablet:!n(ai)&&!n(hn)&&!n(Ta)&&(n(ds)||n(bl)),device:!n(ai)&&(n(hn)||n(ds)||n(Ta)||n(bl))||n(/\bokhttp\b/i)},windows:{phone:n(ai),tablet:n(wl),device:n(ai)||n(wl)},other:{blackberry:n(Tl),blackberry10:n(Sl),opera:n(El),firefox:n(Al),chrome:n(Cl),device:n(Tl)||n(Sl)||n(El)||n(Al)||n(Cl)},any:!1,phone:!1,tablet:!1};return s.any=s.apple.device||s.android.device||s.windows.device||s.other.device,s.phone=s.apple.phone||s.android.phone||s.windows.phone,s.tablet=s.apple.tablet||s.android.tablet||s.windows.tablet,s}var wa,vl,yl,xl,Ta,bl,hn,ds,ai,wl,Tl,Sl,El,Cl,Al,Pl,Td=g(()=>{wa=/iPhone/i,vl=/iPod/i,yl=/iPad/i,xl=/\biOS-universal(?:.+)Mac\b/i,Ta=/\bAndroid(?:.+)Mobile\b/i,bl=/Android/i,hn=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,ds=/Silk/i,ai=/Windows Phone/i,wl=/\bWindows(?:.+)ARM\b/i,Tl=/BlackBerry/i,Sl=/BB10/i,El=/Opera Mini/i,Cl=/\b(CriOS|Chrome)(?:.+)Mobile/i,Al=/Mobile(?:.+)Firefox\b/i,Pl=function(t){return typeof t<"u"&&t.platform==="MacIntel"&&typeof t.maxTouchPoints=="number"&&t.maxTouchPoints>1&&typeof MSStream>"u"}}),lx=g(()=>{Td(),Td()}),Sd,Ed,hx=g(()=>{lx(),Sd=wd.default??wd,Ed=Sd(globalThis.navigator)}),Cd,fs,Ad,Pd,Ml,Rl,Md,Rd,kd,Sa,Bd,ux=g(()=>{_l(),X(),hx(),Si(),Cd=9,fs=100,Ad=0,Pd=0,Ml=2,Rl=1,Md=-1e3,Rd=-1e3,kd=2,Sa=class Cy{constructor(e,r=Ed){this._mobileInfo=r,this.debug=!1,this._activateOnTab=!0,this._deactivateOnMouseMove=!0,this._isActive=!1,this._isMobileAccessibility=!1,this._div=null,this._pool=[],this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._hookDiv=null,(r.tablet||r.phone)&&this._createTouchHook(),this._renderer=e}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}_createTouchHook(){let e=document.createElement("button");e.style.width=`${Rl}px`,e.style.height=`${Rl}px`,e.style.position="absolute",e.style.top=`${Md}px`,e.style.left=`${Rd}px`,e.style.zIndex=kd.toString(),e.style.backgroundColor="#FF0000",e.title="select to enable accessibility for this content",e.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(e),this._hookDiv=e}_destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}_activate(){if(this._isActive)return;this._isActive=!0,this._div||(this._div=document.createElement("div"),this._div.style.width=`${fs}px`,this._div.style.height=`${fs}px`,this._div.style.position="absolute",this._div.style.top=`${Ad}px`,this._div.style.left=`${Pd}px`,this._div.style.zIndex=Ml.toString(),this._div.style.pointerEvents="none"),this._activateOnTab&&(this._onKeyDown=this._onKeyDown.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)),this._deactivateOnMouseMove&&(this._onMouseMove=this._onMouseMove.bind(this),globalThis.document.addEventListener("mousemove",this._onMouseMove,!0));let e=this._renderer.view.canvas;if(e.parentNode)e.parentNode.appendChild(this._div),this._initAccessibilitySetup();else{let r=new MutationObserver(()=>{e.parentNode&&(e.parentNode.appendChild(this._div),r.disconnect(),this._initAccessibilitySetup())});r.observe(document.body,{childList:!0,subtree:!0})}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered)}_deactivate(){if(!(!this._isActive||this._isMobileAccessibility)){this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),this._activateOnTab&&globalThis.addEventListener("keydown",this._onKeyDown,!1),this._renderer.runners.postrender.remove(this);for(let e of this._children)e._accessibleDiv&&e._accessibleDiv.parentNode&&(e._accessibleDiv.parentNode.removeChild(e._accessibleDiv),e._accessibleDiv=null),e._accessibleActive=!1;this._pool.forEach(e=>{e.parentNode&&e.parentNode.removeChild(e)}),this._div&&this._div.parentNode&&this._div.parentNode.removeChild(this._div),this._pool=[],this._children=[]}}_updateAccessibleObjects(e){if(!e.visible||!e.accessibleChildren)return;e.accessible&&(e._accessibleActive||this._addChild(e),e._renderId=this._renderId);let r=e.children;if(r)for(let i=0;i<r.length;i++)this._updateAccessibleObjects(r[i])}init(e){let r={accessibilityOptions:{...Cy.defaultOptions,...e?.accessibilityOptions||{}}};this.debug=r.accessibilityOptions.debug,this._activateOnTab=r.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=r.accessibilityOptions.deactivateOnMouseMove,r.accessibilityOptions.enabledByDefault?this._activate():this._activateOnTab&&(this._onKeyDown=this._onKeyDown.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)),this._renderer.runners.postrender.remove(this)}postrender(){let e=performance.now();if(this._mobileInfo.android.device&&e<this._androidUpdateCount||(this._androidUpdateCount=e+this._androidUpdateFrequency,!this._renderer.renderingToScreen||!this._renderer.view.canvas))return;let r=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(let i of this._children)i._renderId===this._renderId&&r.add(this._children.indexOf(i))}for(let i=this._children.length-1;i>=0;i--){let n=this._children[i];r.has(i)||(n._accessibleDiv&&n._accessibleDiv.parentNode&&(n._accessibleDiv.parentNode.removeChild(n._accessibleDiv),this._pool.push(n._accessibleDiv),n._accessibleDiv=null),n._accessibleActive=!1,nn(this._children,i,1))}if(this._renderer.renderingToScreen){let{x:i,y:n,width:s,height:a}=this._renderer.screen,o=this._div;o.style.left=`${i}px`,o.style.top=`${n}px`,o.style.width=`${s}px`,o.style.height=`${a}px`}for(let i=0;i<this._children.length;i++){let n=this._children[i];if(!n._accessibleActive||!n._accessibleDiv)continue;let s=n._accessibleDiv,a=n.hitArea||n.getBounds().rectangle;if(n.hitArea){let o=n.worldTransform,l=this._renderer.resolution,h=this._renderer.resolution;s.style.left=`${(o.tx+a.x*o.a)*l}px`,s.style.top=`${(o.ty+a.y*o.d)*h}px`,s.style.width=`${a.width*o.a*l}px`,s.style.height=`${a.height*o.d*h}px`}else{this._capHitArea(a);let o=this._renderer.resolution,l=this._renderer.resolution;s.style.left=`${a.x*o}px`,s.style.top=`${a.y*l}px`,s.style.width=`${a.width*o}px`,s.style.height=`${a.height*l}px`}}this._renderId++}_updateDebugHTML(e){e.innerHTML=`type: ${e.type}</br> title : ${e.title}</br> tabIndex: ${e.tabIndex}`}_capHitArea(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);let{width:r,height:i}=this._renderer;e.x+e.width>r&&(e.width=r-e.x),e.y+e.height>i&&(e.height=i-e.y)}_addChild(e){let r=this._pool.pop();r||(e.accessibleType==="button"?r=document.createElement("button"):(r=document.createElement(e.accessibleType),r.style.cssText=`
|
|
color: transparent;
|
|
pointer-events: none;
|
|
padding: 0;
|
|
margin: 0;
|
|
border: 0;
|
|
outline: 0;
|
|
background: transparent;
|
|
box-sizing: border-box;
|
|
user-select: none;
|
|
-webkit-user-select: none;
|
|
-moz-user-select: none;
|
|
-ms-user-select: none;
|
|
`,e.accessibleText&&(r.innerText=e.accessibleText)),r.style.width=`${fs}px`,r.style.height=`${fs}px`,r.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",r.style.position="absolute",r.style.zIndex=Ml.toString(),r.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?r.setAttribute("aria-live","off"):r.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?r.setAttribute("aria-relevant","additions"):r.setAttribute("aria-relevant","text"),r.addEventListener("click",this._onClick.bind(this)),r.addEventListener("focus",this._onFocus.bind(this)),r.addEventListener("focusout",this._onFocusOut.bind(this))),r.style.pointerEvents=e.accessiblePointerEvents,r.type=e.accessibleType,e.accessibleTitle&&e.accessibleTitle!==null?r.title=e.accessibleTitle:(!e.accessibleHint||e.accessibleHint===null)&&(r.title=`container ${e.tabIndex}`),e.accessibleHint&&e.accessibleHint!==null&&r.setAttribute("aria-label",e.accessibleHint),this.debug&&this._updateDebugHTML(r),e._accessibleActive=!0,e._accessibleDiv=r,r.container=e,this._children.push(e),this._div.appendChild(e._accessibleDiv),e.interactive&&(e._accessibleDiv.tabIndex=e.tabIndex)}_dispatchEvent(e,r){let{container:i}=e.target,n=this._renderer.events.rootBoundary,s=Object.assign(new ba(n),{target:i});n.rootTarget=this._renderer.lastObjectRendered,r.forEach(a=>n.dispatchEvent(s,a))}_onClick(e){this._dispatchEvent(e,["click","pointertap","tap"])}_onFocus(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","assertive"),this._dispatchEvent(e,["mouseover"])}_onFocusOut(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","polite"),this._dispatchEvent(e,["mouseout"])}_onKeyDown(e){e.keyCode!==Cd||!this._activateOnTab||this._activate()}_onMouseMove(e){e.movementX===0&&e.movementY===0||this._deactivate()}destroy(){this._deactivate(),this._destroyTouchHook(),this._div=null,this._pool=null,this._children=null,this._renderer=null,this._activateOnTab&&globalThis.removeEventListener("keydown",this._onKeyDown)}setAccessibilityEnabled(e){e?this._activate():this._deactivate()}},Sa.extension={type:[M.WebGLSystem,M.WebGPUSystem],name:"accessibility"},Sa.defaultOptions={enabledByDefault:!1,debug:!1,activateOnTab:!0,deactivateOnMouseMove:!0},Bd=Sa}),Gd,cx=g(()=>{"use strict";Gd={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:!0,_accessibleActive:!1,_accessibleDiv:null,_renderId:-1}}),dx=g(()=>{X(),si(),ux(),cx(),we.add(Bd),we.mixin(gr,Gd)}),kl,fx=g(()=>{X(),kl=class{static init(t){Object.defineProperty(this,"resizeTo",{set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this._cancelResize();let e,r;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,r=globalThis.innerHeight;else{let{clientWidth:i,clientHeight:n}=this._resizeTo;e=i,r=n}this.renderer.resize(e,r),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}},kl.extension=M.Application}),Bn,Bl=g(()=>{"use strict";Bn=(t=>(t[t.INTERACTION=50]="INTERACTION",t[t.HIGH=25]="HIGH",t[t.NORMAL=0]="NORMAL",t[t.LOW=-25]="LOW",t[t.UTILITY=-50]="UTILITY",t))(Bn||{})}),Ea,px=g(()=>{"use strict";Ea=class{constructor(t,e=null,r=0,i=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=r,this._once=i}match(t,e=null){return this._fn===t&&this._context===e}emit(t){this._fn&&(this._context?this._fn.call(this._context,t):this._fn(t));let 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);let e=this.next;return this.next=t?null:e,this.previous=null,e}}}),Gl,Xr,Ca=g(()=>{Bl(),px(),Gl=class Mr{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 Ea(null,null,1/0),this.deltaMS=1/Mr.targetFPMS,this.elapsedMS=1/Mr.targetFPMS,this._tick=e=>{this._requestId=null,this.started&&(this.update(e),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(e,r,i=Bn.NORMAL){return this._addListener(new Ea(e,r,i))}addOnce(e,r,i=Bn.NORMAL){return this._addListener(new Ea(e,r,i,!0))}_addListener(e){let r=this._head.next,i=this._head;if(!r)e.connect(i);else{for(;r;){if(e.priority>r.priority){e.connect(i);break}i=r,r=r.next}e.previous||e.connect(i)}return this._startIfPossible(),this}remove(e,r){let i=this._head.next;for(;i;)i.match(e,r)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let e=0,r=this._head;for(;r=r.next;)e++;return e}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let e=this._head.next;for(;e;)e=e.destroy(!0);this._head.destroy(),this._head=null}}update(e=performance.now()){let r;if(e>this.lastTime){if(r=this.elapsedMS=e-this.lastTime,r>this._maxElapsedMS&&(r=this._maxElapsedMS),r*=this.speed,this._minElapsedMS){let s=e-this._lastFrame|0;if(s<this._minElapsedMS)return;this._lastFrame=e-s%this._minElapsedMS}this.deltaMS=r,this.deltaTime=this.deltaMS*Mr.targetFPMS;let i=this._head,n=i.next;for(;n;)n=n.emit(this);i.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=e}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(e){let r=Math.min(this.maxFPS,e),i=Math.min(Math.max(0,r)/1e3,Mr.targetFPMS);this._maxElapsedMS=1/i}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(e){if(e===0)this._minElapsedMS=0;else{let r=Math.max(this.minFPS,e);this._minElapsedMS=1/(r/1e3)}}static get shared(){if(!Mr._shared){let e=Mr._shared=new Mr;e.autoStart=!0,e._protected=!0}return Mr._shared}static get system(){if(!Mr._system){let e=Mr._system=new Mr;e.autoStart=!0,e._protected=!0}return Mr._system}},Gl.targetFPMS=.06,Xr=Gl}),Il,gx=g(()=>{X(),Bl(),Ca(),Il=class{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,Bn.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?Xr.shared:new Xr,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}},Il.extension=M.Application}),Id=g(()=>{X(),fx(),gx(),we.add(kl),we.add(Il)}),Od,Pi,Fd=g(()=>{Bl(),Ca(),Od=class{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||(Xr.system.add(this._tickerUpdate,this,Bn.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(Xr.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}let t=this.events._rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||globalThis.document.dispatchEvent(this.events.supportsPointerEvents?new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType,pointerId:t.pointerId}):new MouseEvent("mousemove",{clientX:t.clientX,clientY:t.clientY}))}_tickerUpdate(t){this._deltaTime+=t.deltaTime,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this._update())}},Pi=new Od}),ps,Ol=g(()=>{He(),_l(),ps=class extends ba{constructor(){super(...arguments),this.client=new ye,this.movement=new ye,this.offset=new ye,this.global=new ye,this.screen=new ye}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(t,e,r){return t.worldTransform.applyInverse(r||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,r,i,n,s,a,o,l,h,u,c,f,d,_){throw new Error("Method not implemented.")}}}),Ur,Dd=g(()=>{Ol(),Ur=class extends ps{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!")}}}),un,Ud=g(()=>{Ol(),un=class extends ps{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}},un.DOM_DELTA_PIXEL=0,un.DOM_DELTA_LINE=1,un.DOM_DELTA_PAGE=2}),Ld,Nd,Gn,zd,mx=g(()=>{kt(),He(),wt(),Fd(),Ol(),Dd(),Ud(),Ld=2048,Nd=new ye,Gn=new ye,zd=class{constructor(t){this.dispatch=new st,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((r,i)=>r.priority-i.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(!this.rootTarget)return;let e=this.mappingTable[t.type];if(e)for(let r=0,i=e.length;r<i;r++)e[r].fn(t);else Ye(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){Pi.pauseUpdate=!0;let r=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",i=this[r](this.rootTarget,this.rootTarget.eventMode,Nd.set(t,e),this.hitTestFn,this.hitPruneFn);return i&&i[0]}propagate(t,e){if(!t.target)return;let r=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let i=0,n=r.length-1;i<n;i++)if(t.currentTarget=r[i],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!(t.propagationStopped||t.propagationImmediatelyStopped)){t.eventPhase=t.BUBBLING_PHASE;for(let i=r.length-2;i>=0;i--)if(t.currentTarget=r[i],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,r=this._allInteractiveElements){if(r.length===0)return;t.eventPhase=t.BUBBLING_PHASE;let i=Array.isArray(e)?e:[e];for(let n=r.length-1;n>=0;n--)i.forEach(s=>{t.currentTarget=r[n],this.notifyTarget(t,s)})}propagationPath(t){let e=[t];for(let r=0;r<Ld&&t!==this.rootTarget&&t.parent;r++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}hitTestMoveRecursive(t,e,r,i,n,s=!1){let a=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Pi.pauseUpdate=!1),t.interactiveChildren&&t.children){let h=t.children;for(let u=h.length-1;u>=0;u--){let c=h[u],f=this.hitTestMoveRecursive(c,this._isInteractive(e)?e:c.eventMode,r,i,n,s||n(t,r));if(f){if(f.length>0&&!f[f.length-1].parent)continue;let d=t.isInteractive();(f.length>0||d)&&(d&&this._allInteractiveElements.push(t),f.push(t)),this._hitElements.length===0&&(this._hitElements=f),a=!0}}}let o=this._isInteractive(e),l=t.isInteractive();return l&&l&&this._allInteractiveElements.push(t),s||this._hitElements.length>0?null:a?this._hitElements:o&&!n(t,r)&&i(t,r)?l?[t]:[]:null}hitTestRecursive(t,e,r,i,n){if(this._interactivePrune(t)||n(t,r))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Pi.pauseUpdate=!1),t.interactiveChildren&&t.children){let o=t.children,l=r;for(let h=o.length-1;h>=0;h--){let u=o[h],c=this.hitTestRecursive(u,this._isInteractive(e)?e:u.eventMode,l,i,n);if(c){if(c.length>0&&!c[c.length-1].parent)continue;let f=t.isInteractive();return(c.length>0||f)&&c.push(t),c}}}let s=this._isInteractive(e),a=t.isInteractive();return s&&i(t,r)?a?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return!t||!t.visible||!t.renderable||!t.measurable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren}hitPruneFn(t,e){if(t.hitArea&&(t.worldTransform.applyInverse(e,Gn),!t.hitArea.contains(Gn.x,Gn.y)))return!0;if(t.effects&&t.effects.length)for(let r=0;r<t.effects.length;r++){let i=t.effects[r];if(i.containsPoint&&!i.containsPoint(e,this.hitTestFn))return!0}return!1}hitTestFn(t,e){return t.hitArea?!0:t?.containsPoint?(t.worldTransform.applyInverse(e,Gn),t.containsPoint(Gn)):!1}notifyTarget(t,e){if(!t.currentTarget.isInteractive())return;e??(e=t.type);let r=`on${e}`;t.currentTarget[r]?.(t);let i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this._notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this._notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof Ur)){Ye("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),e.pointerType==="touch")this.dispatchEvent(e,"touchstart");else if(e.pointerType==="mouse"||e.pointerType==="pen"){let i=e.button===2;this.dispatchEvent(e,i?"rightdown":"mousedown")}let r=this.trackingData(t.pointerId);r.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){if(!(t instanceof Ur)){Ye("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;let e=this.createPointerEvent(t);this._isPointerMoveEvent=!1;let r=e.pointerType==="mouse"||e.pointerType==="pen",i=this.trackingData(t.pointerId),n=this.findMountedTarget(i.overTargets);if(i.overTargets?.length>0&&n!==e.target){let o=t.type==="mousemove"?"mouseout":"pointerout",l=this.createPointerEvent(t,o,n);if(this.dispatchEvent(l,"pointerout"),r&&this.dispatchEvent(l,"mouseout"),!e.composedPath().includes(n)){let h=this.createPointerEvent(t,"pointerleave",n);for(h.eventPhase=h.AT_TARGET;h.target&&!e.composedPath().includes(h.target);)h.currentTarget=h.target,this.notifyTarget(h),r&&this.notifyTarget(h,"mouseleave"),h.target=h.target.parent;this.freeEvent(h)}this.freeEvent(l)}if(n!==e.target){let o=t.type==="mousemove"?"mouseover":"pointerover",l=this.clonePointerEvent(e,o);this.dispatchEvent(l,"pointerover"),r&&this.dispatchEvent(l,"mouseover");let h=n?.parent;for(;h&&h!==this.rootTarget.parent&&h!==e.target;)h=h.parent;if(!h||h===this.rootTarget.parent){let u=this.clonePointerEvent(e,"pointerenter");for(u.eventPhase=u.AT_TARGET;u.target&&u.target!==n&&u.target!==this.rootTarget.parent;)u.currentTarget=u.target,this.notifyTarget(u),r&&this.notifyTarget(u,"mouseenter"),u.target=u.target.parent;this.freeEvent(u)}this.freeEvent(l)}let s=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?s.push("pointermove"):this.dispatchEvent(e,"pointermove"),a&&s.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?s.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),a&&s.push("globaltouchmove")),r&&(this.moveOnAll?s.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),a&&s.push("globalmousemove"),this.cursor=e.target?.cursor),s.length>0&&this.all(e,s),this._allInteractiveElements.length=0,this._hitElements.length=0,i.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){if(!(t instanceof Ur)){Ye("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),r=this.createPointerEvent(t),i=r.pointerType==="mouse"||r.pointerType==="pen";this.dispatchEvent(r,"pointerover"),i&&this.dispatchEvent(r,"mouseover"),r.pointerType==="mouse"&&(this.cursor=r.target?.cursor);let n=this.clonePointerEvent(r,"pointerenter");for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),i&&this.notifyTarget(n,"mouseenter"),n.target=n.target.parent;e.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(n)}mapPointerOut(t){if(!(t instanceof Ur)){Ye("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId);if(e.overTargets){let r=t.pointerType==="mouse"||t.pointerType==="pen",i=this.findMountedTarget(e.overTargets),n=this.createPointerEvent(t,"pointerout",i);this.dispatchEvent(n),r&&this.dispatchEvent(n,"mouseout");let s=this.createPointerEvent(t,"pointerleave",i);for(s.eventPhase=s.AT_TARGET;s.target&&s.target!==this.rootTarget.parent;)s.currentTarget=s.target,this.notifyTarget(s),r&&this.notifyTarget(s,"mouseleave"),s.target=s.target.parent;e.overTargets=null,this.freeEvent(n),this.freeEvent(s)}this.cursor=null}mapPointerUp(t){if(!(t instanceof Ur)){Ye("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=performance.now(),r=this.createPointerEvent(t);if(this.dispatchEvent(r,"pointerup"),r.pointerType==="touch")this.dispatchEvent(r,"touchend");else if(r.pointerType==="mouse"||r.pointerType==="pen"){let a=r.button===2;this.dispatchEvent(r,a?"rightup":"mouseup")}let i=this.trackingData(t.pointerId),n=this.findMountedTarget(i.pressTargetsByButton[t.button]),s=n;if(n&&!r.composedPath().includes(n)){let a=n;for(;a&&!r.composedPath().includes(a);){if(r.currentTarget=a,this.notifyTarget(r,"pointerupoutside"),r.pointerType==="touch")this.notifyTarget(r,"touchendoutside");else if(r.pointerType==="mouse"||r.pointerType==="pen"){let o=r.button===2;this.notifyTarget(r,o?"rightupoutside":"mouseupoutside")}a=a.parent}delete i.pressTargetsByButton[t.button],s=a}if(s){let a=this.clonePointerEvent(r,"click");a.target=s,a.path=null,i.clicksByButton[t.button]||(i.clicksByButton[t.button]={clickCount:0,target:a.target,timeStamp:e});let o=i.clicksByButton[t.button];if(o.target===a.target&&e-o.timeStamp<200?++o.clickCount:o.clickCount=1,o.target=a.target,o.timeStamp=e,a.detail=o.clickCount,a.pointerType==="mouse"){let 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(r)}mapPointerUpOutside(t){if(!(t instanceof Ur)){Ye("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),r=this.findMountedTarget(e.pressTargetsByButton[t.button]),i=this.createPointerEvent(t);if(r){let n=r;for(;n;)i.currentTarget=n,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch"?this.notifyTarget(i,"touchendoutside"):(i.pointerType==="mouse"||i.pointerType==="pen")&&this.notifyTarget(i,i.button===2?"rightupoutside":"mouseupoutside"),n=n.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(i)}mapWheel(t){if(!(t instanceof un)){Ye("EventBoundary cannot map a non-wheel event as a wheel event");return}let e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let r=1;r<t.length&&t[r].parent===e;r++)e=t[r];return e}createPointerEvent(t,e,r){let i=this.allocateEvent(Ur);return this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.nativeEvent=t.nativeEvent,i.originalEvent=t,i.target=r??this.hitTest(i.global.x,i.global.y)??this._hitElements[0],typeof e=="string"&&(i.type=e),i}createWheelEvent(t){let e=this.allocateEvent(un);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){let r=this.allocateEvent(Ur);return r.nativeEvent=t.nativeEvent,r.originalEvent=t.originalEvent,this.copyPointerData(t,r),this.copyMouseData(t,r),this.copyData(t,r),r.target=t.target,r.path=t.composedPath().slice(),r.type=e??r.type,r}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof Ur&&e instanceof Ur&&(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 ps&&e instanceof ps&&(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,[]);let e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.defaultPrevented=!1,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!");let e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)}_notifyListeners(t,e){let r=t.currentTarget._events[e];if(r)if("fn"in r)r.once&&t.currentTarget.removeListener(e,r.fn,void 0,!0),r.fn.call(r.context,t);else for(let i=0,n=r.length;i<n&&!t.propagationImmediatelyStopped;i++)r[i].once&&t.currentTarget.removeListener(e,r[i].fn,void 0,!0),r[i].fn.call(r[i].context,t)}}}),Hd,Vd,Aa,Fl,jd=g(()=>{X(),mx(),Fd(),Dd(),Ud(),Hd=1,Vd={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Aa=class ld{constructor(e){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=e,this.rootBoundary=new zd(null),Pi.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new Ur(null),this._rootWheelEvent=new un(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...ld.defaultEventFeatures},{set:(r,i,n)=>(i==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=n),r[i]=n,!0)}),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onPointerOverOut=this._onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(e){let{canvas:r,resolution:i}=this.renderer;this.setTargetElement(r),this.resolution=i,ld._defaultEventMode=e.eventMode??"passive",Object.assign(this.features,e.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(e){this.resolution=e}destroy(){this.setTargetElement(null),this.renderer=null,this._currentCursor=null}setCursor(e){e||(e="default");let r=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(r=!1),this._currentCursor===e)return;this._currentCursor=e;let i=this.cursorStyles[e];if(i)switch(typeof i){case"string":r&&(this.domElement.style.cursor=i);break;case"function":i(e);break;case"object":r&&Object.assign(this.domElement.style,i);break}else r&&typeof e=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,e)&&(this.domElement.style.cursor=e)}get pointer(){return this._rootPointerEvent}_onPointerDown(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let r=this._normalizeToPointerData(e);this.autoPreventDefault&&r[0].isNormalized&&(e.cancelable||!("cancelable"in e))&&e.preventDefault();for(let i=0,n=r.length;i<n;i++){let s=r[i],a=this._bootstrapEvent(this._rootPointerEvent,s);this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}_onPointerMove(e){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,Pi.pointerMoved();let r=this._normalizeToPointerData(e);for(let i=0,n=r.length;i<n;i++){let s=this._bootstrapEvent(this._rootPointerEvent,r[i]);this.rootBoundary.mapEvent(s)}this.setCursor(this.rootBoundary.cursor)}_onPointerUp(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let r=e.target;e.composedPath&&e.composedPath().length>0&&(r=e.composedPath()[0]);let i=r!==this.domElement?"outside":"",n=this._normalizeToPointerData(e);for(let s=0,a=n.length;s<a;s++){let o=this._bootstrapEvent(this._rootPointerEvent,n[s]);o.type+=i,this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}_onPointerOverOut(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let r=this._normalizeToPointerData(e);for(let i=0,n=r.length;i<n;i++){let s=this._bootstrapEvent(this._rootPointerEvent,r[i]);this.rootBoundary.mapEvent(s)}this.setCursor(this.rootBoundary.cursor)}onWheel(e){if(!this.features.wheel)return;let r=this.normalizeWheelEvent(e);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(r)}setTargetElement(e){this._removeEvents(),this.domElement=e,Pi.domElement=e,this._addEvents()}_addEvents(){if(this._eventsAdded||!this.domElement)return;Pi.addTickerListener();let e=this.domElement.style;e&&(globalThis.navigator.msPointerEnabled?(e.msContentZooming="none",e.msTouchAction="none"):this.supportsPointerEvents&&(e.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;Pi.removeTickerListener();let e=this.domElement.style;e&&(globalThis.navigator.msPointerEnabled?(e.msContentZooming="",e.msTouchAction=""):this.supportsPointerEvents&&(e.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(e,r,i){let n=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},s=1/this.resolution;e.x=(r-n.left)*(this.domElement.width/n.width)*s,e.y=(i-n.top)*(this.domElement.height/n.height)*s}_normalizeToPointerData(e){let r=[];if(this.supportsTouchEvents&&e instanceof TouchEvent)for(let i=0,n=e.changedTouches.length;i<n;i++){let s=e.changedTouches[i];typeof s.button>"u"&&(s.button=0),typeof s.buttons>"u"&&(s.buttons=1),typeof s.isPrimary>"u"&&(s.isPrimary=e.touches.length===1&&e.type==="touchstart"),typeof s.width>"u"&&(s.width=s.radiusX||1),typeof s.height>"u"&&(s.height=s.radiusY||1),typeof s.tiltX>"u"&&(s.tiltX=0),typeof s.tiltY>"u"&&(s.tiltY=0),typeof s.pointerType>"u"&&(s.pointerType="touch"),typeof s.pointerId>"u"&&(s.pointerId=s.identifier||0),typeof s.pressure>"u"&&(s.pressure=s.force||.5),typeof s.twist>"u"&&(s.twist=0),typeof s.tangentialPressure>"u"&&(s.tangentialPressure=0),typeof s.layerX>"u"&&(s.layerX=s.offsetX=s.clientX),typeof s.layerY>"u"&&(s.layerY=s.offsetY=s.clientY),s.isNormalized=!0,s.type=e.type,r.push(s)}else if(!globalThis.MouseEvent||e instanceof MouseEvent&&(!this.supportsPointerEvents||!(e instanceof globalThis.PointerEvent))){let i=e;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=Hd),typeof i.pressure>"u"&&(i.pressure=.5),typeof i.twist>"u"&&(i.twist=0),typeof i.tangentialPressure>"u"&&(i.tangentialPressure=0),i.isNormalized=!0,r.push(i)}else r.push(e);return r}normalizeWheelEvent(e){let r=this._rootWheelEvent;return this._transferMouseData(r,e),r.deltaX=e.deltaX,r.deltaY=e.deltaY,r.deltaZ=e.deltaZ,r.deltaMode=e.deltaMode,this.mapPositionToPoint(r.screen,e.clientX,e.clientY),r.global.copyFrom(r.screen),r.offset.copyFrom(r.screen),r.nativeEvent=e,r.type=e.type,r}_bootstrapEvent(e,r){return e.originalEvent=null,e.nativeEvent=r,e.pointerId=r.pointerId,e.width=r.width,e.height=r.height,e.isPrimary=r.isPrimary,e.pointerType=r.pointerType,e.pressure=r.pressure,e.tangentialPressure=r.tangentialPressure,e.tiltX=r.tiltX,e.tiltY=r.tiltY,e.twist=r.twist,this._transferMouseData(e,r),this.mapPositionToPoint(e.screen,r.clientX,r.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.isTrusted=r.isTrusted,e.type==="pointerleave"&&(e.type="pointerout"),e.type.startsWith("mouse")&&(e.type=e.type.replace("mouse","pointer")),e.type.startsWith("touch")&&(e.type=Vd[e.type]||e.type),e}_transferMouseData(e,r){e.isTrusted=r.isTrusted,e.srcElement=r.srcElement,e.timeStamp=performance.now(),e.type=r.type,e.altKey=r.altKey,e.button=r.button,e.buttons=r.buttons,e.client.x=r.clientX,e.client.y=r.clientY,e.ctrlKey=r.ctrlKey,e.metaKey=r.metaKey,e.movement.x=r.movementX,e.movement.y=r.movementY,e.page.x=r.pageX,e.page.y=r.pageY,e.relatedTarget=null,e.shiftKey=r.shiftKey}},Aa.extension={name:"events",type:[M.WebGLSystem,M.CanvasSystem,M.WebGPUSystem],priority:-1},Aa.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0},Fl=Aa}),Wd,_x=g(()=>{jd(),_l(),Wd={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,get interactive(){return this.eventMode==="dynamic"||this.eventMode==="static"},set interactive(t){this.eventMode=t?"static":"passive"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??Fl.defaultEventMode},set eventMode(t){this._internalEventMode=t},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(t,e,r){let i=typeof r=="boolean"&&r||typeof r=="object"&&r.capture,n=typeof r=="object"?r.signal:void 0,s=typeof r=="object"?r.once===!0:!1,a=typeof e=="function"?void 0:e;t=i?`${t}capture`:t;let o=typeof e=="function"?e:e.handleEvent,l=this;n&&n.addEventListener("abort",()=>{l.off(t,o,a)}),s?l.once(t,o,a):l.on(t,o,a)},removeEventListener(t,e,r){let i=typeof r=="boolean"&&r||typeof r=="object"&&r.capture,n=typeof e=="function"?void 0:e;t=i?`${t}capture`:t,e=typeof e=="function"?e:e.handleEvent,this.off(t,e,n)},dispatchEvent(t){if(!(t instanceof ba))throw new Error("Container cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=null,t.target=this,t.manager.dispatchEvent(t),!t.defaultPrevented}}}),vx=g(()=>{X(),si(),jd(),_x(),we.add(Fl),we.mixin(gr,Wd)}),Dl,yx=g(()=>{X(),Dl=class{constructor(t){this._attachedDomElements=[],this._renderer=t,this._renderer.runners.postrender.add(this),this._domElement=document.createElement("div"),this._domElement.style.position="absolute",this._domElement.style.top="0",this._domElement.style.left="0",this._domElement.style.pointerEvents="none",this._domElement.style.zIndex="1000"}addRenderable(t,e){this._attachedDomElements.includes(t)||this._attachedDomElements.push(t)}updateRenderable(t){}validateRenderable(t){return!0}postrender(){let t=this._attachedDomElements;if(t.length===0){this._domElement.remove();return}let e=this._renderer.view.canvas;this._domElement.parentNode!==e.parentNode&&e.parentNode?.appendChild(this._domElement);let r=parseFloat(e.style.width)/e.width*this._renderer.resolution,i=parseFloat(e.style.height)/e.height*this._renderer.resolution;this._domElement.style.transform=`translate(${e.offsetLeft}px, ${e.offsetTop}px) scale(${r}, ${i})`;for(let n=0;n<t.length;n++){let s=t[n],a=s.element;if(!s.parent||s.globalDisplayStatus<7)a?.remove(),t.splice(n,1),n--;else{this._domElement.contains(a)||(a.style.position="absolute",a.style.pointerEvents="auto",this._domElement.appendChild(a));let o=s.worldTransform,l=s._anchor,h=s.width*l.x,u=s.height*l.y;a.style.transformOrigin=`${h}px ${u}px`,a.style.transform=`matrix(${o.a}, ${o.b}, ${o.c}, ${o.d}, ${o.tx-h}, ${o.ty-u})`,a.style.opacity=s.groupAlpha.toString()}}}destroy(){this._renderer.runners.postrender.remove(this);for(let t=0;t<this._attachedDomElements.length;t++)this._attachedDomElements[t].element?.remove();this._attachedDomElements.length=0,this._domElement.remove(),this._renderer=null}},Dl.extension={type:[M.WebGLPipes,M.WebGPUPipes,M.CanvasPipes],name:"dom"}}),Pa,Ul=g(()=>{se(),si(),Pa=class extends gr{constructor(t){super(t),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=-1,this._gpuData=Object.create(null),this._bounds=new $(0,1,0,0),this._boundsDirty=!0}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=!1,this._bounds):this._bounds}get roundPixels(){return!!this._roundPixels}set roundPixels(t){this._roundPixels=t?1:0}containsPoint(t){let e=this.bounds,{x:r,y:i}=t;return r>=e.minX&&r<=e.maxX&&i>=e.minY&&i<=e.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;let t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}destroy(t){super.destroy(t),this._bounds=null;for(let e in this._gpuData)this._gpuData[e].destroy?.();this._gpuData=null}collectRenderablesSimple(t,e,r){let{renderPipes:i}=e;i.blendMode.setBlendMode(this,this.groupBlendMode,t),i[this.renderPipeId].addRenderable(this,t),this.didViewUpdate=!1;let n=this.children,s=n.length;for(let a=0;a<s;a++)n[a].collectRenderables(t,e,r)}}}),xx=g(()=>{X(),yx(),we.add(Dl)}),Ll,bx=g(()=>{"use strict";Ll=(t=>(t[t.Low=0]="Low",t[t.Normal=1]="Normal",t[t.High=2]="High",t))(Ll||{})}),$d,wx=g(()=>{"use strict";$d={createCanvas:(t,e)=>{let r=document.createElement("canvas");return r.width=t,r.height=e,r},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(t,e)=>fetch(t,e),parseXML:t=>new DOMParser().parseFromString(t,"text/xml")}}),Nl,Dt,Jt=g(()=>{wx(),Nl=$d,Dt={get(){return Nl},set(t){Nl=t}}});function Yr(t){if(typeof t!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(t)}`)}function gs(t){return t.split("?")[0].split("#")[0]}function Tx(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Sx(t,e,r){return t.replace(new RegExp(Tx(e),"g"),r)}function Ex(t,e){let r="",i=0,n=-1,s=0,a=-1;for(let o=0;o<=t.length;++o){if(o<t.length)a=t.charCodeAt(o);else{if(a===47)break;a=47}if(a===47){if(!(n===o-1||s===1))if(n!==o-1&&s===2){if(r.length<2||i!==2||r.charCodeAt(r.length-1)!==46||r.charCodeAt(r.length-2)!==46){if(r.length>2){let l=r.lastIndexOf("/");if(l!==r.length-1){l===-1?(r="",i=0):(r=r.slice(0,l),i=r.length-1-r.lastIndexOf("/")),n=o,s=0;continue}}else if(r.length===2||r.length===1){r="",i=0,n=o,s=0;continue}}e&&(r.length>0?r+="/..":r="..",i=2)}else r.length>0?r+=`/${t.slice(n+1,o)}`:r=t.slice(n+1,o),i=o-n-1;n=o,s=0}else a===46&&s!==-1?++s:s=-1}return r}var In,Xd=g(()=>{Jt(),In={toPosix(t){return Sx(t,"\\","/")},isUrl(t){return/^https?:/.test(this.toPosix(t))},isDataUrl(t){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(t)},isBlobUrl(t){return t.startsWith("blob:")},hasProtocol(t){return/^[^/:]+:/.test(this.toPosix(t))},getProtocol(t){Yr(t),t=this.toPosix(t);let e=/^file:\/\/\//.exec(t);if(e)return e[0];let r=/^[^/:]+:\/{0,2}/.exec(t);return r?r[0]:""},toAbsolute(t,e,r){if(Yr(t),this.isDataUrl(t)||this.isBlobUrl(t))return t;let i=gs(this.toPosix(e??Dt.get().getBaseUrl())),n=gs(this.toPosix(r??this.rootname(i)));return t=this.toPosix(t),t.startsWith("/")?In.join(n,t.slice(1)):this.isAbsolute(t)?t:this.join(i,t)},normalize(t){if(Yr(t),t.length===0)return".";if(this.isDataUrl(t)||this.isBlobUrl(t))return t;t=this.toPosix(t);let e="",r=t.startsWith("/");this.hasProtocol(t)&&(e=this.rootname(t),t=t.slice(e.length));let i=t.endsWith("/");return t=Ex(t,!1),t.length>0&&i&&(t+="/"),r?`/${t}`:e+t},isAbsolute(t){return Yr(t),t=this.toPosix(t),this.hasProtocol(t)?!0:t.startsWith("/")},join(...t){if(t.length===0)return".";let e;for(let r=0;r<t.length;++r){let i=t[r];if(Yr(i),i.length>0)if(e===void 0)e=i;else{let n=t[r-1]??"";this.joinExtensions.includes(this.extname(n).toLowerCase())?e+=`/../${i}`:e+=`/${i}`}}return e===void 0?".":this.normalize(e)},dirname(t){if(Yr(t),t.length===0)return".";t=this.toPosix(t);let e=t.charCodeAt(0),r=e===47,i=-1,n=!0,s=this.getProtocol(t),a=t;t=t.slice(s.length);for(let o=t.length-1;o>=1;--o)if(e=t.charCodeAt(o),e===47){if(!n){i=o;break}}else n=!1;return i===-1?r?"/":this.isUrl(a)?s+t:s:r&&i===1?"//":s+t.slice(0,i)},rootname(t){Yr(t),t=this.toPosix(t);let e="";if(t.startsWith("/")?e="/":e=this.getProtocol(t),this.isUrl(t)){let r=t.indexOf("/",e.length);r!==-1?e=t.slice(0,r):e=t,e.endsWith("/")||(e+="/")}return e},basename(t,e){Yr(t),e&&Yr(e),t=gs(this.toPosix(t));let r=0,i=-1,n=!0,s;if(e!==void 0&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";let a=e.length-1,o=-1;for(s=t.length-1;s>=0;--s){let l=t.charCodeAt(s);if(l===47){if(!n){r=s+1;break}}else o===-1&&(n=!1,o=s+1),a>=0&&(l===e.charCodeAt(a)?--a===-1&&(i=s):(a=-1,i=o))}return r===i?i=o:i===-1&&(i=t.length),t.slice(r,i)}for(s=t.length-1;s>=0;--s)if(t.charCodeAt(s)===47){if(!n){r=s+1;break}}else i===-1&&(n=!1,i=s+1);return i===-1?"":t.slice(r,i)},extname(t){Yr(t),t=gs(this.toPosix(t));let e=-1,r=0,i=-1,n=!0,s=0;for(let a=t.length-1;a>=0;--a){let o=t.charCodeAt(a);if(o===47){if(!n){r=a+1;break}continue}i===-1&&(n=!1,i=a+1),o===46?e===-1?e=a:s!==1&&(s=1):e!==-1&&(s=-1)}return e===-1||i===-1||s===0||s===1&&e===i-1&&e===r+1?"":t.slice(e,i)},parse(t){Yr(t);let e={root:"",dir:"",base:"",ext:"",name:""};if(t.length===0)return e;t=gs(this.toPosix(t));let r=t.charCodeAt(0),i=this.isAbsolute(t),n,s="";e.root=this.rootname(t),i||this.hasProtocol(t)?n=1:n=0;let a=-1,o=0,l=-1,h=!0,u=t.length-1,c=0;for(;u>=n;--u){if(r=t.charCodeAt(u),r===47){if(!h){o=u+1;break}continue}l===-1&&(h=!1,l=u+1),r===46?a===-1?a=u:c!==1&&(c=1):a!==-1&&(c=-1)}return a===-1||l===-1||c===0||c===1&&a===l-1&&a===o+1?l!==-1&&(o===0&&i?e.base=e.name=t.slice(1,l):e.base=e.name=t.slice(o,l)):(o===0&&i?(e.name=t.slice(1,a),e.base=t.slice(1,l)):(e.name=t.slice(o,a),e.base=t.slice(o,l)),e.ext=t.slice(a,l)),e.dir=this.dirname(t),s&&(e.dir=s+e.dir),e},sep:"/",delimiter:":",joinExtensions:[".html"]}}),cn,Yd=g(()=>{"use strict";cn=(t,e,r=!1)=>(Array.isArray(t)||(t=[t]),e?t.map(i=>typeof i=="string"||r?e(i):i):t)});function qd(t,e,r,i,n){let s=e[r];for(let a=0;a<s.length;a++){let o=s[a];r<e.length-1?qd(t.replace(i[r],o),e,r+1,i,n):n.push(t.replace(i[r],o))}}function Cx(t){let e=/\{(.*?)\}/g,r=t.match(e),i=[];if(r){let n=[];r.forEach(s=>{let a=s.substring(1,s.length-1).split(",");n.push(a)}),qd(t,n,0,r,i)}else i.push(t);return i}var Ax=g(()=>{"use strict"}),zl,Px=g(()=>{"use strict";zl=t=>!Array.isArray(t)});function Mx(t){return t.split(".").pop().split("?").shift().split("#").shift()}var Hl,Rx=g(()=>{wt(),Xd(),Yd(),Ax(),Px(),Hl=class{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{let e=t;this._defaultSearchParams=Object.keys(e).map(r=>`${encodeURIComponent(r)}=${encodeURIComponent(e[r])}`).join("&")}}getAlias(t){let{alias:e,src:r}=t;return cn(e||r,i=>typeof i=="string"?i:Array.isArray(i)?i.map(n=>n?.src??n):i?.src?i.src:i,!0)}addManifest(t){this._manifest&&Ye("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){let r=[],i=e;Array.isArray(e)||(i=Object.entries(e).map(([n,s])=>typeof s=="string"||Array.isArray(s)?{alias:n,src:s}:{alias:n,...s})),i.forEach(n=>{let s=n.src,a=n.alias,o;if(typeof a=="string"){let l=this._createBundleAssetId(t,a);r.push(l),o=[a,l]}else{let l=a.map(h=>this._createBundleAssetId(t,h));r.push(...l),o=[...a,...l]}this.add({...n,alias:o,src:s})}),this._bundles[t]=r}add(t){let e=[];Array.isArray(t)?e.push(...t):e.push(t);let r;r=i=>{this.hasKey(i)&&Ye(`[Resolver] already has key: ${i} overwriting`)},cn(e).forEach(i=>{let{src:n}=i,{data:s,format:a,loadParser:o}=i,l=cn(n).map(c=>typeof c=="string"?Cx(c):Array.isArray(c)?c:[c]),h=this.getAlias(i);Array.isArray(h)?h.forEach(r):r(h);let u=[];l.forEach(c=>{c.forEach(f=>{let d={};if(typeof f!="object"){d.src=f;for(let _=0;_<this._parsers.length;_++){let v=this._parsers[_];if(v.test(f)){d=v.parse(f);break}}}else s=f.data??s,a=f.format??a,o=f.loadParser??o,d={...d,...f};if(!h)throw new Error(`[Resolver] alias is undefined for this asset: ${d.src}`);d=this._buildResolvedAsset(d,{aliases:h,data:s,format:a,loadParser:o}),u.push(d)})}),h.forEach(c=>{this._assetMap[c]=u})})}resolveBundle(t){let e=zl(t);t=cn(t);let r={};return t.forEach(i=>{let n=this._bundles[i];if(n){let s=this.resolve(n),a={};for(let o in s){let l=s[o];a[this._extractAssetIdFromBundle(i,o)]=l}r[i]=a}}),e?r[t[0]]:r}resolveUrl(t){let e=this.resolve(t);if(typeof t!="string"){let r={};for(let i in e)r[i]=e[i].src;return r}return e.src}resolve(t){let e=zl(t);t=cn(t);let r={};return t.forEach(i=>{if(!this._resolverHash[i])if(this._assetMap[i]){let n=this._assetMap[i],s=this._getPreferredOrder(n);s?.priority.forEach(a=>{s.params[a].forEach(o=>{let l=n.filter(h=>h[a]?h[a]===o:!1);l.length&&(n=l)})}),this._resolverHash[i]=n[0]}else this._resolverHash[i]=this._buildResolvedAsset({alias:[i],src:i},{});r[i]=this._resolverHash[i]}),e?r[t[0]]:r}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){let r=t[e],i=this._preferredOrder.find(n=>n.params.format.includes(r.format));if(i)return i}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;let e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){let{aliases:r,data:i,loadParser:n,format:s}=e;return(this._basePath||this._rootPath)&&(t.src=In.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=r??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...i||{},...t.data},t.loadParser=n??t.loadParser,t.format=s??t.format??Mx(t.src),t}},Hl.RETINA_PREFIX=/@([0-9\.]+)x/}),Vl,kx=g(()=>{"use strict";Vl=(t,e)=>{let r=e.split("?")[1];return r&&(t+=`?${r}`),t}}),jl,Wl,Bx=g(()=>{O(),xr(),Ft(),jl=class ga{constructor(e,r){this.linkedSheets=[];let i=e;e?.source instanceof Qt&&(i={texture:e,data:r});let{texture:n,data:s,cachePrefix:a=""}=i;this.cachePrefix=a,this._texture=n instanceof Fe?n:null,this.textureSource=n.source,this.textures={},this.animations={},this.data=s;let o=parseFloat(s.meta.scale);o?(this.resolution=o,n.source.resolution=this.resolution):this.resolution=n.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise(e=>{this._callback=e,this._batchIndex=0,this._frameKeys.length<=ga.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(e){let r=e,i=ga.BATCH_SIZE;for(;r-e<i&&r<this._frameKeys.length;){let n=this._frameKeys[r],s=this._frames[n],a=s.frame;if(a){let o=null,l=null,h=s.trimmed!==!1&&s.sourceSize?s.sourceSize:s.frame,u=new R(0,0,Math.floor(h.w)/this.resolution,Math.floor(h.h)/this.resolution);s.rotated?o=new R(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.h)/this.resolution,Math.floor(a.w)/this.resolution):o=new R(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution),s.trimmed!==!1&&s.spriteSourceSize&&(l=new R(Math.floor(s.spriteSourceSize.x)/this.resolution,Math.floor(s.spriteSourceSize.y)/this.resolution,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution)),this.textures[n]=new Fe({source:this.textureSource,frame:o,orig:u,trim:l,rotate:s.rotated?2:0,defaultAnchor:s.anchor,defaultBorders:s.borders,label:n.toString()})}r++}}_processAnimations(){let e=this.data.animations||{};for(let r in e){this.animations[r]=[];for(let i=0;i<e[r].length;i++){let n=e[r][i];this.animations[r].push(this.textures[n])}}}_parseComplete(){let e=this._callback;this._callback=null,this._batchIndex=0,e.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*ga.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*ga.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(e=!1){for(let r in this.textures)this.textures[r].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,e&&(this._texture?.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[]}},jl.BATCH_SIZE=1e3,Wl=jl});function Kd(t,e,r){let i={};if(t.forEach(n=>{i[n]=e}),Object.keys(e.textures).forEach(n=>{i[`${e.cachePrefix}${n}`]=e.textures[n]}),!r){let n=In.dirname(t[0]);e.linkedSheets.forEach((s,a)=>{let o=Kd([`${n}/${e.data.meta.related_multi_packs[a]}`],s,!0);Object.assign(i,o)})}return i}var Zd,Qd,Gx=g(()=>{bx(),Rx(),kx(),X(),Ft(),Xd(),Bx(),Zd=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"],Qd={extension:M.Asset,cache:{test:t=>t instanceof Wl,getCacheableAssets:(t,e)=>Kd(t,e,!1)},resolver:{extension:{type:M.ResolveParser,name:"resolveSpritesheet"},test:t=>{let e=t.split("?")[0].split("."),r=e.pop(),i=e.pop();return r==="json"&&Zd.includes(i)},parse:t=>{let e=t.split(".");return{resolution:parseFloat(Hl.RETINA_PREFIX.exec(t)?.[1]??"1"),format:e[e.length-2],src:t}}},loader:{name:"spritesheetLoader",extension:{type:M.LoadParser,priority:Ll.Normal,name:"spritesheetLoader"},async testParse(t,e){return In.extname(e.src).toLowerCase()===".json"&&!!t.frames},async parse(t,e,r){let{texture:i,imageFilename:n,textureOptions:s,cachePrefix:a}=e?.data??{},o=In.dirname(e.src);o&&o.lastIndexOf("/")!==o.length-1&&(o+="/");let l;if(i instanceof Fe)l=i;else{let c=Vl(o+(n??t.meta.image),e.src);l=(await r.load([{src:c,data:s}]))[c]}let h=new Wl({texture:l.source,data:t,cachePrefix:a});await h.parse();let u=t?.meta?.related_multi_packs;if(Array.isArray(u)){let c=[];for(let d of u){if(typeof d!="string")continue;let _=o+d;e.data?.ignoreMultiPack||(_=Vl(_,e.src),c.push(r.load({src:_,data:{textureOptions:s,ignoreMultiPack:!0}})))}let f=await Promise.all(c);h.linkedSheets=f,f.forEach(d=>{d.linkedSheets=[h].concat(h.linkedSheets.filter(_=>_!==d))})}return h},async unload(t,e,r){await r.unload(t.textureSource._sourceOrigin),t.destroy(!1)}}}}),$l=g(()=>{X(),Gx(),we.add(Qd)});function Jd(t,e,r){let{width:i,height:n}=r.orig,s=r.trim;if(s){let a=s.width,o=s.height;t.minX=s.x-e._x*i,t.maxX=t.minX+a,t.minY=s.y-e._y*n,t.maxY=t.minY+o}else t.minX=-e._x*i,t.maxX=t.minX+i,t.minY=-e._y*n,t.maxY=t.minY+n}var ef=g(()=>{"use strict"}),Ma,tf=g(()=>{ri(),Ft(),ef(),Mt(),Ul(),Ma=class hd extends Pa{constructor(e=Fe.EMPTY){e instanceof Fe&&(e={texture:e});let{texture:r=Fe.EMPTY,anchor:i,roundPixels:n,width:s,height:a,...o}=e;super({label:"Sprite",...o}),this.renderPipeId="sprite",this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new Et({_onUpdate:()=>{this.onViewUpdate()}}),i?this.anchor=i:r.defaultAnchor&&(this.anchor=r.defaultAnchor),this.texture=r,this.allowChildren=!1,this.roundPixels=n??!1,s!==void 0&&(this.width=s),a!==void 0&&(this.height=a)}static from(e,r=!1){return e instanceof Fe?new hd(e):new hd(Fe.from(e,r))}set texture(e){e||(e=Fe.EMPTY);let r=this._texture;r!==e&&(r&&r.dynamic&&r.off("update",this.onViewUpdate,this),e.dynamic&&e.on("update",this.onViewUpdate,this),this._texture=e,this._width&&this._setWidth(this._width,this._texture.orig.width),this._height&&this._setHeight(this._height,this._texture.orig.height),this.onViewUpdate())}get texture(){return this._texture}get visualBounds(){return Jd(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return Xe("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){let e=this._anchor,r=this._texture,i=this._bounds,{width:n,height:s}=r.orig;i.minX=-e._x*n,i.maxX=i.minX+n,i.minY=-e._y*s,i.maxY=i.minY+s}destroy(e=!1){if(super.destroy(e),typeof e=="boolean"?e:e?.texture){let r=typeof e=="boolean"?e:e?.textureSource;this._texture.destroy(r)}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null,this._gpuData=null}get anchor(){return this._anchor}set anchor(e){typeof e=="number"?this._anchor.set(e):this._anchor.copyFrom(e)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(e){this._setWidth(e,this._texture.orig.width),this._width=e}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(e){this._setHeight(e,this._texture.orig.height),this._height=e}getSize(e){return e||(e={}),e.width=Math.abs(this.scale.x)*this._texture.orig.width,e.height=Math.abs(this.scale.y)*this._texture.orig.height,e}setSize(e,r){typeof e=="object"?(r=e.height??e.width,e=e.width):r??(r=e),e!==void 0&&this._setWidth(e,this._texture.orig.width),r!==void 0&&this._setHeight(r,this._texture.orig.height)}}});function rf(t,e,r){let i=nf;t.measurable=!0,b(t,r,i),e.addBoundsMask(i),t.measurable=!1}var nf,sf=g(()=>{se(),B(),nf=new $});function af(t,e,r){let i=ae.get();t.measurable=!0;let n=xe.get().identity(),s=of(t,r,n);he(t,i,s),t.measurable=!1,e.addBoundsMask(i),xe.return(n),ae.return(i)}function of(t,e,r){return t?(t!==e&&(of(t.parent,e,r),t.updateLocalTransform(),r.append(t.localTransform)),r):(Ye("Mask bounds, renderable is not inside the root container"),r)}var lf=g(()=>{te(),ge(),wt()}),Xl,Ix=g(()=>{X(),tf(),sf(),lf(),Xl=class{constructor(t){this.priority=0,this.inverse=!1,this.pipe="alphaMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof Ma),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask=null}addBounds(t,e){this.inverse||rf(this.mask,t,e)}addLocalBounds(t,e){af(this.mask,t,e)}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset()}static test(t){return t instanceof Ma}},Xl.extension=M.MaskEffect}),Yl,Ox=g(()=>{X(),Yl=class{constructor(t){this.priority=0,this.pipe="colorMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t}destroy(){}static test(t){return typeof t=="number"}},Yl.extension=M.MaskEffect}),ql,Fx=g(()=>{X(),si(),sf(),lf(),ql=class{constructor(t){this.priority=0,this.pipe="stencilMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null}addBounds(t,e){rf(this.mask,t,e)}addLocalBounds(t,e){af(this.mask,t,e)}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset()}static test(t){return t instanceof gr}},ql.extension=M.MaskEffect}),oi,ms=g(()=>{Jt(),X(),xr(),oi=class extends Qt{constructor(t){t.resource||(t.resource=Dt.get().createCanvas()),t.width||(t.width=t.resource.width,t.autoDensity||(t.width/=t.resolution)),t.height||(t.height=t.resource.height,t.autoDensity||(t.height/=t.resolution)),super(t),this.uploadMethodId="image",this.autoDensity=t.autoDensity,this.resizeCanvas(),this.transparent=!!t.transparent}resizeCanvas(){this.autoDensity&&"style"in this.resource&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(t=this.width,e=this.height,r=this._resolution){let i=super.resize(t,e,r);return i&&this.resizeCanvas(),i}static test(t){return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&t instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}},oi.extension=M.TextureSource}),On,Kl=g(()=>{X(),xr(),On=class extends Qt{constructor(t){super(t),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(t){return globalThis.HTMLImageElement&&t instanceof HTMLImageElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||globalThis.VideoFrame&&t instanceof VideoFrame}},On.extension=M.TextureSource});async function Dx(){return Zl??(Zl=(async()=>{let t=document.createElement("canvas").getContext("webgl");if(!t)return"premultiply-alpha-on-upload";let e=await new Promise(s=>{let a=document.createElement("video");a.onloadeddata=()=>s(a),a.onerror=()=>s(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(!e)return"premultiply-alpha-on-upload";let r=t.createTexture();t.bindTexture(t.TEXTURE_2D,r);let i=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,i),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);let n=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,n),t.deleteFramebuffer(i),t.deleteTexture(r),t.getExtension("WEBGL_lose_context")?.loseContext(),n[0]<=n[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),Zl}var Zl,Ux=g(()=>{"use strict"}),_s,hf,Lx=g(()=>{X(),Ca(),Ux(),xr(),_s=class Ay extends Qt{constructor(e){super(e),this.isReady=!1,this.uploadMethodId="video",e={...Ay.defaultOptions,...e},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=e.autoPlay!==!1,this.alphaMode=e.alphaMode??"premultiply-alpha-on-upload",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._onCanPlayThrough=this._onCanPlayThrough.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()}updateFrame(){if(!this.destroyed){if(this._updateFPS){let e=Xr.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!this._updateFPS||this._msToNextUpdate<=0)&&(this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0),this.isValid&&this.update()}}_videoFrameRequestCallback(){this.updateFrame(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback)}get isValid(){return!!this.resource.videoWidth&&!!this.resource.videoHeight}async load(){if(this._load)return this._load;let e=this.resource,r=this.options;return(e.readyState===e.HAVE_ENOUGH_DATA||e.readyState===e.HAVE_FUTURE_DATA)&&e.width&&e.height&&(e.complete=!0),e.addEventListener("play",this._onPlayStart),e.addEventListener("pause",this._onPlayStop),e.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(r.preload||e.addEventListener("canplay",this._onCanPlay),e.addEventListener("canplaythrough",this._onCanPlayThrough),e.addEventListener("error",this._onError,!0)),this.alphaMode=await Dx(),this._load=new Promise((i,n)=>{this.isValid?i(this):(this._resolve=i,this._reject=n,r.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${r.preloadTimeoutMs}ms`))})),e.load())}),this._load}_onError(e){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",e),this._reject&&(this._reject(e),this._reject=null,this._resolve=null)}_isSourcePlaying(){let e=this.resource;return!e.paused&&!e.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){let e=this.resource;this.isValid&&(this.isReady=!0,this.resize(e.videoWidth,e.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();let e=this.resource;e&&(e.removeEventListener("play",this._onPlayStart),e.removeEventListener("pause",this._onPlayStop),e.removeEventListener("seeked",this._onSeeked),e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlayThrough),e.removeEventListener("error",this._onError,!0),e.pause(),e.src="",e.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e!==this._autoUpdate&&(this._autoUpdate=e,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(e){e!==this._updateFPS&&(this._updateFPS=e,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(Xr.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(Xr.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Xr.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement}},_s.extension=M.TextureSource,_s.defaultOptions={...Qt.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1},_s.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"},hf=_s}),uf,lr,Ra=g(()=>{wt(),Yd(),uf=class{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){let e=this._cache.get(t);return e||Ye(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){let r=cn(t),i;for(let o=0;o<this.parsers.length;o++){let l=this.parsers[o];if(l.test(e)){i=l.getCacheableAssets(r,e);break}}let n=new Map(Object.entries(i||{}));i||r.forEach(o=>{n.set(o,e)});let s=[...n.keys()],a={cacheKeys:s,keys:r};r.forEach(o=>{this._cacheMap.set(o,a)}),s.forEach(o=>{let l=i?i[o]:e;this._cache.has(o)&&this._cache.get(o)!==l&&Ye("[Cache] already has key:",o),this._cache.set(o,n.get(o))})}remove(t){if(!this._cacheMap.has(t)){Ye(`[Assets] Asset id ${t} was not found in the Cache`);return}let e=this._cacheMap.get(t);e.cacheKeys.forEach(r=>{this._cache.delete(r)}),e.keys.forEach(r=>{this._cacheMap.delete(r)})}get parsers(){return this._parsers}},lr=new uf});function cf(t={}){let e=t&&t.resource,r=e?t.resource:t,i=e?t:{resource:t};for(let n=0;n<ka.length;n++){let s=ka[n];if(s.test(r))return new s(i)}throw new Error(`Could not find a source type for resource: ${i.resource}`)}function Nx(t={},e=!1){let r=t&&t.resource,i=r?t.resource:t,n=r?t:{resource:t};if(!e&&lr.has(i))return lr.get(i);let s=new Fe({source:cf(n)});return s.on("destroy",()=>{lr.has(i)&&lr.remove(i)}),e||lr.set(i,s),s}function zx(t,e=!1){return typeof t=="string"?lr.get(t):t instanceof Qt?new Fe({source:t}):Nx(t,e)}var ka,df=g(()=>{Ra(),X(),xr(),Ft(),ka=[],we.handleByList(M.TextureSource,ka),Fe.from=zx,Qt.from=cf}),Ql=g(()=>{X(),Ix(),Ox(),Fx(),_d(),ms(),Kl(),Lx(),df(),we.add(Xl,Yl,ql,hf,On,oi,_a)}),li,dn=g(()=>{"use strict";li=class{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(let r in t){let i=t[r];this.setResource(i,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;let t=[],e=0;for(let r in this.resources)t[e++]=this.resources[r]._resourceId;this._key=t.join("|")}setResource(t,e){let r=this.resources[e];t!==r&&(r&&t.off?.("change",this.onResourceChange,this),t.on?.("change",this.onResourceChange,this),this.resources[e]=t,this._dirty=!0)}getResource(t){return this.resources[t]}_touch(t){let e=this.resources;for(let r in e)e[r]._touched=t}destroy(){let t=this.resources;for(let e in t)t[e].off?.("change",this.onResourceChange,this);this.resources=null}onResourceChange(t){if(this._dirty=!0,t.destroyed){let e=this.resources;for(let r in e)e[r]===t&&(e[r]=null)}else this._updateKey()}}});function Jl(t,e,r){let i=2166136261;for(let n=0;n<e;n++)i^=t[n].uid,i=Math.imul(i,16777619),i>>>=0;return eh[i]||Hx(t,e,i,r)}function Hx(t,e,r,i){let n={},s=0;for(let o=0;o<i;o++){let l=o<e?t[o]:Fe.EMPTY.source;n[s++]=l.source,n[s++]=l.style}let a=new li(n);return eh[r]=a,a}var eh,th=g(()=>{dn(),Ft(),eh={}}),fn,ff=g(()=>{"use strict";fn=class{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),this.size=this.rawBinaryData.byteLength}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 int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}get float64View(){return this._float64Array||(this._float64Array=new Float64Array(this.rawBinaryData)),this._float64Array}get bigUint64View(){return this._bigUint64Array||(this._bigUint64Array=new BigUint64Array(this.rawBinaryData)),this._bigUint64Array}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`)}}}});function rh(t,e){let r=t.byteLength/8|0,i=new Float64Array(t,0,r);new Float64Array(e,0,r).set(i);let n=t.byteLength-r*8;if(n>0){let s=new Uint8Array(t,r*8,n);new Uint8Array(e,r*8,n).set(s)}}var pf=g(()=>{"use strict"}),gf,$t,Fn=g(()=>{"use strict";gf={normal:"normal-npm",add:"add-npm",screen:"screen-npm"},$t=(t=>(t[t.DISABLED=0]="DISABLED",t[t.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",t[t.MASK_ACTIVE=2]="MASK_ACTIVE",t[t.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",t[t.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",t[t.NONE=5]="NONE",t))($t||{})});function vs(t,e){return e.alphaMode==="no-premultiply-alpha"&&gf[t]||t}var Ba=g(()=>{Fn()});function mf(){return(!Ga||Ga?.isContextLost())&&(Ga=Dt.get().createCanvas().getContext("webgl",{})),Ga}var Ga,_f=g(()=>{Jt()});function Vx(t){let e="";for(let r=0;r<t;++r)r>0&&(e+=`
|
|
else `),r<t-1&&(e+=`if(test == ${r}.0){}`);return e}function vf(t,e){if(t===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");let r=e.createShader(e.FRAGMENT_SHADER);try{for(;;){let i=yf.replace(/%forloop%/gi,Vx(t));if(e.shaderSource(r,i),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS))t=t/2|0;else break}}finally{e.deleteShader(r)}return t}var yf,xf=g(()=>{"use strict";yf=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
`)});function jx(){if(pn)return pn;let t=mf();return pn=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),pn=vf(pn,t),t.getExtension("WEBGL_lose_context")?.loseContext(),pn}var pn,Wx=g(()=>{_f(),xf(),pn=null}),bf,$x=g(()=>{"use strict";bf=class{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let t=0;t<this.count;t++){let e=this.textures[t];this.textures[t]=null,this.ids[e.uid]=null}this.count=0}}});function wf(){return Ia>0?ih[--Ia]:new Sf}function Tf(t){ih[Ia++]=t}var Sf,ih,Ia,Dn,nh,Ef,Xx=g(()=>{Ot(),ff(),Mt(),pf(),Ba(),Wx(),$x(),Sf=class{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new bf,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null}},ih=[],Ia=0,Dn=0,nh=class Py{constructor(e){this.uid=ot("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],e={...Py.defaultOptions,...e},e.maxTextures||(Xe("v8.8.0","maxTextures is a required option for Batcher now, please pass it in the options"),e.maxTextures=jx());let{maxTextures:r,attributesInitialSize:i,indicesInitialSize:n}=e;this.attributeBuffer=new fn(i*4),this.indexBuffer=new Uint16Array(n),this.maxTextures=r}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let e=0;e<this.batchIndex;e++)Tf(this.batches[e]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=!0}add(e){this._elements[this.elementSize++]=e,e._indexStart=this.indexSize,e._attributeStart=this.attributeSize,e._batcher=this,this.indexSize+=e.indexSize,this.attributeSize+=e.attributeSize*this.vertexSize}checkAndUpdateTexture(e,r){let i=e._batch.textures.ids[r._source.uid];return!i&&i!==0?!1:(e._textureId=i,e.texture=r,!0)}updateElement(e){this.dirty=!0;let r=this.attributeBuffer;e.packAsQuad?this.packQuadAttributes(e,r.float32View,r.uint32View,e._attributeStart,e._textureId):this.packAttributes(e,r.float32View,r.uint32View,e._attributeStart,e._textureId)}break(e){let r=this._elements;if(!r[this.elementStart])return;let i=wf(),n=i.textures;n.clear();let s=r[this.elementStart],a=vs(s.blendMode,s.texture._source),o=s.topology;this.attributeSize*4>this.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);let l=this.attributeBuffer.float32View,h=this.attributeBuffer.uint32View,u=this.indexBuffer,c=this._batchIndexSize,f=this._batchIndexStart,d="startBatch",_=this.maxTextures;for(let v=this.elementStart;v<this.elementSize;++v){let m=r[v];r[v]=null;let y=m.texture._source,S=vs(m.blendMode,y),P=a!==S||o!==m.topology;if(y._batchTick===Dn&&!P){m._textureId=y._textureBindLocation,c+=m.indexSize,m.packAsQuad?(this.packQuadAttributes(m,l,h,m._attributeStart,m._textureId),this.packQuadIndex(u,m._indexStart,m._attributeStart/this.vertexSize)):(this.packAttributes(m,l,h,m._attributeStart,m._textureId),this.packIndex(m,u,m._indexStart,m._attributeStart/this.vertexSize)),m._batch=i;continue}y._batchTick=Dn,(n.count>=_||P)&&(this._finishBatch(i,f,c-f,n,a,o,e,d),d="renderBatch",f=c,a=S,o=m.topology,i=wf(),n=i.textures,n.clear(),++Dn),m._textureId=y._textureBindLocation=n.count,n.ids[y.uid]=n.count,n.textures[n.count++]=y,m._batch=i,c+=m.indexSize,m.packAsQuad?(this.packQuadAttributes(m,l,h,m._attributeStart,m._textureId),this.packQuadIndex(u,m._indexStart,m._attributeStart/this.vertexSize)):(this.packAttributes(m,l,h,m._attributeStart,m._textureId),this.packIndex(m,u,m._indexStart,m._attributeStart/this.vertexSize))}n.count>0&&(this._finishBatch(i,f,c-f,n,a,o,e,d),f=c,++Dn),this.elementStart=this.elementSize,this._batchIndexStart=f,this._batchIndexSize=c}_finishBatch(e,r,i,n,s,a,o,l){e.gpuBindGroup=null,e.bindGroup=null,e.action=l,e.batcher=this,e.textures=n,e.blendMode=s,e.topology=a,e.start=r,e.size=i,++Dn,this.batches[this.batchIndex++]=e,o.add(e)}finish(e){this.break(e)}ensureAttributeBuffer(e){e*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(e*4)}ensureIndexBuffer(e){e<=this.indexBuffer.length||this._resizeIndexBuffer(e)}_resizeAttributeBuffer(e){let r=Math.max(e,this.attributeBuffer.size*2),i=new fn(r);rh(this.attributeBuffer.rawBinaryData,i.rawBinaryData),this.attributeBuffer=i}_resizeIndexBuffer(e){let r=this.indexBuffer,i=Math.max(e,r.length*1.5);i+=i%2;let n=i>65535?new Uint32Array(i):new Uint16Array(i);if(n.BYTES_PER_ELEMENT!==r.BYTES_PER_ELEMENT)for(let s=0;s<r.length;s++)n[s]=r[s];else rh(r.buffer,n.buffer);this.indexBuffer=n}packQuadIndex(e,r,i){e[r]=i+0,e[r+1]=i+1,e[r+2]=i+2,e[r+3]=i+0,e[r+4]=i+2,e[r+5]=i+3}packIndex(e,r,i,n){let s=e.indices,a=e.indexSize,o=e.indexOffset,l=e.attributeOffset;for(let h=0;h<a;h++)r[i++]=n+s[h+o]-l}destroy(){for(let e=0;e<this.batches.length;e++)Tf(this.batches[e]);this.batches=null;for(let e=0;e<this._elements.length;e++)this._elements[e]._batch=null;this._elements=null,this.indexBuffer=null,this.attributeBuffer.destroy(),this.attributeBuffer=null}},nh.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6},Ef=nh}),ct,Xi=g(()=>{"use strict";ct=(t=>(t[t.MAP_READ=1]="MAP_READ",t[t.MAP_WRITE=2]="MAP_WRITE",t[t.COPY_SRC=4]="COPY_SRC",t[t.COPY_DST=8]="COPY_DST",t[t.INDEX=16]="INDEX",t[t.VERTEX=32]="VERTEX",t[t.UNIFORM=64]="UNIFORM",t[t.STORAGE=128]="STORAGE",t[t.INDIRECT=256]="INDIRECT",t[t.QUERY_RESOLVE=512]="QUERY_RESOLVE",t[t.STATIC=1024]="STATIC",t))(ct||{})}),br,gn=g(()=>{kt(),Ot(),Xi(),br=class extends st{constructor(t){let{data:e,size:r}=t,{usage:i,label:n,shrinkToFit:s}=t;super(),this.uid=ot("buffer"),this._resourceType="buffer",this._resourceId=ot("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=!0,this.destroyed=!1,e instanceof Array&&(e=new Float32Array(e)),this._data=e,r??(r=e?.byteLength);let a=!!e;this.descriptor={size:r,usage:i,mappedAtCreation:a,label:n},this.shrinkToFit=s??!0}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,!0)}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return!!(this.descriptor.usage&ct.STATIC)}set static(t){t?this.descriptor.usage|=ct.STATIC:this.descriptor.usage&=~ct.STATIC}setDataWithSize(t,e,r){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){r&&this.emit("update",this);return}let i=this._data;if(this._data=t,this._dataInt32=null,!i||i.length!==t.length){!this.shrinkToFit&&i&&t.byteLength<i.byteLength?r&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=ot("resource"),this.emit("change",this));return}r&&this.emit("update",this)}update(t){this._updateSize=t??this._updateSize,this._updateID++,this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners()}}});function Cf(t,e){if(!(t instanceof br)){let r=e?ct.INDEX:ct.VERTEX;t instanceof Array&&(e?(t=new Uint32Array(t),r=ct.INDEX|ct.COPY_DST):(t=new Float32Array(t),r=ct.VERTEX|ct.COPY_DST)),t=new br({data:t,label:e?"index-mesh-buffer":"vertex-mesh-buffer",usage:r})}return t}var Yx=g(()=>{gn(),Xi()});function qx(t,e,r){let i=t.getAttribute(e);if(!i)return r.minX=0,r.minY=0,r.maxX=0,r.maxY=0,r;let n=i.buffer.data,s=1/0,a=1/0,o=-1/0,l=-1/0,h=n.BYTES_PER_ELEMENT,u=(i.offset||0)/h,c=(i.stride||8)/h;for(let f=u;f<n.length;f+=c){let d=n[f],_=n[f+1];d>o&&(o=d),_>l&&(l=_),d<s&&(s=d),_<a&&(a=_)}return r.minX=s,r.minY=a,r.maxX=o,r.maxY=l,r}var Kx=g(()=>{"use strict"});function Zx(t){return(t instanceof br||Array.isArray(t)||t.BYTES_PER_ELEMENT)&&(t={buffer:t}),t.buffer=Cf(t.buffer,!1),t}var Un,ys=g(()=>{kt(),se(),Ot(),gn(),Yx(),Kx(),Un=class extends st{constructor(t={}){super(),this.uid=ot("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new $,this._boundsDirty=!0;let{attributes:e,indexBuffer:r,topology:i}=t;if(this.buffers=[],this.attributes={},e)for(let n in e)this.addAttribute(n,e[n]);this.instanceCount=t.instanceCount??1,r&&this.addIndex(r),this.topology=i||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this.emit("update",this)}getAttribute(t){return this.attributes[t]}getIndex(){return this.indexBuffer}getBuffer(t){return this.getAttribute(t).buffer}getSize(){for(let t in this.attributes){let e=this.attributes[t];return e.buffer.data.length/(e.stride/4||e.size)}return 0}addAttribute(t,e){let r=Zx(e);this.buffers.indexOf(r.buffer)===-1&&(this.buffers.push(r.buffer),r.buffer.on("update",this.onBufferUpdate,this),r.buffer.on("change",this.onBufferUpdate,this)),this.attributes[t]=r}addIndex(t){this.indexBuffer=Cf(t,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,qx(this,"aPosition",this._bounds)):this._bounds}destroy(t=!1){this.emit("destroy",this),this.removeAllListeners(),t&&this.buffers.forEach(e=>e.destroy()),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}}),Af,Pf,Mf,Qx=g(()=>{gn(),Xi(),ys(),Af=new Float32Array(1),Pf=new Uint32Array(1),Mf=class extends Un{constructor(){let t=new br({data:Af,label:"attribute-batch-buffer",usage:ct.VERTEX|ct.COPY_DST,shrinkToFit:!1}),e=new br({data:Pf,label:"index-batch-buffer",usage:ct.INDEX|ct.COPY_DST,shrinkToFit:!1}),r=24;super({attributes:{aPosition:{buffer:t,format:"float32x2",stride:r,offset:0},aUV:{buffer:t,format:"float32x2",stride:r,offset:8},aColor:{buffer:t,format:"unorm8x4",stride:r,offset:16},aTextureIdAndRound:{buffer:t,format:"uint16x2",stride:r,offset:20}},indexBuffer:e})}}});function xs(t,e){let r=sh[t];return r===void 0&&(Oa[e]===void 0&&(Oa[e]=1),sh[t]=r=Oa[e]++),r}var Oa,sh,Fa=g(()=>{"use strict";Oa=Object.create(null),sh=Object.create(null)});function Jx(){if(!Da){Da="mediump";let t=mf();t&&t.getShaderPrecisionFormat&&(Da=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision?"highp":"mediump")}return Da}var Da,e0=g(()=>{_f()});function t0(t,e,r){return e?t:r?(t=t.replace("out vec4 finalColor;",""),`
|
|
|
|
#ifdef GL_ES // This checks if it is WebGL1
|
|
#define in varying
|
|
#define finalColor gl_FragColor
|
|
#define texture texture2D
|
|
#endif
|
|
${t}
|
|
`):`
|
|
|
|
#ifdef GL_ES // This checks if it is WebGL1
|
|
#define in attribute
|
|
#define out varying
|
|
#endif
|
|
${t}
|
|
`}var r0=g(()=>{"use strict"});function i0(t,e,r){let i=r?e.maxSupportedFragmentPrecision:e.maxSupportedVertexPrecision;if(t.substring(0,9)!=="precision"){let n=r?e.requestedFragmentPrecision:e.requestedVertexPrecision;return n==="highp"&&i!=="highp"&&(n="mediump"),`precision ${n} float;
|
|
${t}`}else if(i!=="highp"&&t.substring(0,15)==="precision highp")return t.replace("precision highp","precision mediump");return t}var n0=g(()=>{"use strict"});function s0(t,e){return e?`#version 300 es
|
|
${t}`:t}var a0=g(()=>{"use strict"});function o0(t,{name:e="pixi-program"},r=!0){e=e.replace(/\s+/g,"-"),e+=r?"-fragment":"-vertex";let i=r?Rf:kf;return i[e]?(i[e]++,e+=`-${i[e]}`):i[e]=1,t.indexOf("#define SHADER_NAME")!==-1?t:`${`#define SHADER_NAME ${e}`}
|
|
${t}`}var Rf,kf,l0=g(()=>{"use strict";Rf={},kf={}});function h0(t,e){return e?t.replace("#version 300 es",""):t}var u0=g(()=>{"use strict"}),Ua,La,ah,mn,Ln=g(()=>{Fa(),e0(),r0(),n0(),a0(),l0(),u0(),Ua={stripVersion:h0,ensurePrecision:i0,addProgramDefines:t0,setProgramName:o0,insertVersion:s0},La=Object.create(null),ah=class ud{constructor(e){e={...ud.defaultOptions,...e};let r=e.fragment.indexOf("#version 300 es")!==-1,i={stripVersion:r,ensurePrecision:{requestedFragmentPrecision:e.preferredFragmentPrecision,requestedVertexPrecision:e.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:Jx()},setProgramName:{name:e.name},addProgramDefines:r,insertVersion:r},n=e.fragment,s=e.vertex;Object.keys(Ua).forEach(a=>{let o=i[a];n=Ua[a](n,o,!0),s=Ua[a](s,o,!1)}),this.fragment=n,this.vertex=s,this.transformFeedbackVaryings=e.transformFeedbackVaryings,this._key=xs(`${this.vertex}:${this.fragment}`,"gl-program")}destroy(){this.fragment=null,this.vertex=null,this._attributeData=null,this._uniformData=null,this._uniformBlockData=null,this.transformFeedbackVaryings=null}static from(e){let r=`${e.vertex}:${e.fragment}`;return La[r]||(La[r]=new ud(e)),La[r]}},ah.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"},mn=ah});function Yi(t){return oh[t]??oh.float32}var oh,Nn=g(()=>{"use strict";oh={uint8x2:{size:2,stride:2,normalised:!1},uint8x4:{size:4,stride:4,normalised:!1},sint8x2:{size:2,stride:2,normalised:!1},sint8x4:{size:4,stride:4,normalised:!1},unorm8x2:{size:2,stride:2,normalised:!0},unorm8x4:{size:4,stride:4,normalised:!0},snorm8x2:{size:2,stride:2,normalised:!0},snorm8x4:{size:4,stride:4,normalised:!0},uint16x2:{size:2,stride:4,normalised:!1},uint16x4:{size:4,stride:8,normalised:!1},sint16x2:{size:2,stride:4,normalised:!1},sint16x4:{size:4,stride:8,normalised:!1},unorm16x2:{size:2,stride:4,normalised:!0},unorm16x4:{size:4,stride:8,normalised:!0},snorm16x2:{size:2,stride:4,normalised:!0},snorm16x4:{size:4,stride:8,normalised:!0},float16x2:{size:2,stride:4,normalised:!1},float16x4:{size:4,stride:8,normalised:!1},float32:{size:1,stride:4,normalised:!1},float32x2:{size:2,stride:8,normalised:!1},float32x3:{size:3,stride:12,normalised:!1},float32x4:{size:4,stride:16,normalised:!1},uint32:{size:1,stride:4,normalised:!1},uint32x2:{size:2,stride:8,normalised:!1},uint32x3:{size:3,stride:12,normalised:!1},uint32x4:{size:4,stride:16,normalised:!1},sint32:{size:1,stride:4,normalised:!1},sint32x2:{size:2,stride:8,normalised:!1},sint32x3:{size:3,stride:12,normalised:!1},sint32x4:{size:4,stride:16,normalised:!1}}});function c0({source:t,entryPoint:e}){let r={},i=t.indexOf(`fn ${e}`);if(i!==-1){let n=t.indexOf("->",i);if(n!==-1){let s=t.substring(i,n),a=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|$)/g,o;for(;(o=a.exec(s))!==null;){let l=Bf[o[3]]??"float32";r[o[2]]={location:parseInt(o[1],10),format:l,stride:Yi(l).stride,offset:0,instance:!1,start:0}}}}return r}var Bf,d0=g(()=>{Nn(),Bf={f32:"float32","vec2<f32>":"float32x2","vec3<f32>":"float32x3","vec4<f32>":"float32x4",vec2f:"float32x2",vec3f:"float32x3",vec4f:"float32x4",i32:"sint32","vec2<i32>":"sint32x2","vec3<i32>":"sint32x3","vec4<i32>":"sint32x4",u32:"uint32","vec2<u32>":"uint32x2","vec3<u32>":"uint32x3","vec4<u32>":"uint32x4",bool:"uint32","vec2<bool>":"uint32x2","vec3<bool>":"uint32x3","vec4<bool>":"uint32x4"}});function lh(t){let e=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,r=/@group\((\d+)\)/,i=/@binding\((\d+)\)/,n=/var(<[^>]+>)? (\w+)/,s=/:\s*(\w+)/,a=/struct\s+(\w+)\s*{([^}]+)}/g,o=/(\w+)\s*:\s*([\w\<\>]+)/g,l=/struct\s+(\w+)/,h=t.match(e)?.map(c=>({group:parseInt(c.match(r)[1],10),binding:parseInt(c.match(i)[1],10),name:c.match(n)[2],isUniform:c.match(n)[1]==="<uniform>",type:c.match(s)[1]}));if(!h)return{groups:[],structs:[]};let u=t.match(a)?.map(c=>{let f=c.match(l)[1],d=c.match(o).reduce((_,v)=>{let[m,y]=v.split(":");return _[m.trim()]=y.trim(),_},{});return d?{name:f,members:d}:null}).filter(({name:c})=>h.some(f=>f.type===c))??[];return{groups:h,structs:u}}var f0=g(()=>{"use strict"}),zn,p0=g(()=>{"use strict";zn=(t=>(t[t.VERTEX=1]="VERTEX",t[t.FRAGMENT=2]="FRAGMENT",t[t.COMPUTE=4]="COMPUTE",t))(zn||{})});function g0({groups:t}){let e=[];for(let r=0;r<t.length;r++){let i=t[r];e[i.group]||(e[i.group]=[]),i.isUniform?e[i.group].push({binding:i.binding,visibility:zn.VERTEX|zn.FRAGMENT,buffer:{type:"uniform"}}):i.type==="sampler"?e[i.group].push({binding:i.binding,visibility:zn.FRAGMENT,sampler:{type:"filtering"}}):i.type==="texture_2d"&&e[i.group].push({binding:i.binding,visibility:zn.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:!1}})}return e}var m0=g(()=>{p0()});function _0({groups:t}){let e=[];for(let r=0;r<t.length;r++){let i=t[r];e[i.group]||(e[i.group]={}),e[i.group][i.name]=i.binding}return e}var v0=g(()=>{"use strict"});function y0(t,e){let r=new Set,i=new Set,n=[...t.structs,...e.structs].filter(a=>r.has(a.name)?!1:(r.add(a.name),!0)),s=[...t.groups,...e.groups].filter(a=>{let o=`${a.name}-${a.binding}`;return i.has(o)?!1:(i.add(o),!0)});return{structs:n,groups:s}}var x0=g(()=>{"use strict"}),Na,Hn,bs=g(()=>{Fa(),d0(),f0(),m0(),v0(),x0(),Na=Object.create(null),Hn=class My{constructor(e){this._layoutKey=0,this._attributeLocationsKey=0;let{fragment:r,vertex:i,layout:n,gpuLayout:s,name:a}=e;if(this.name=a,this.fragment=r,this.vertex=i,r.source===i.source){let o=lh(r.source);this.structsAndGroups=o}else{let o=lh(i.source),l=lh(r.source);this.structsAndGroups=y0(o,l)}this.layout=n??_0(this.structsAndGroups),this.gpuLayout=s??g0(this.structsAndGroups),this.autoAssignGlobalUniforms=this.layout[0]?.globalUniforms!==void 0,this.autoAssignLocalUniforms=this.layout[1]?.localUniforms!==void 0,this._generateProgramKey()}_generateProgramKey(){let{vertex:e,fragment:r}=this,i=e.source+r.source+e.entryPoint+r.entryPoint;this._layoutKey=xs(i,"program")}get attributeData(){return this._attributeData??(this._attributeData=c0(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null}static from(e){let r=`${e.vertex.source}:${e.fragment.source}:${e.fragment.entryPoint}:${e.vertex.entryPoint}`;return Na[r]||(Na[r]=new My(e)),Na[r]}}});function Gf(t,e,r){if(t)for(let i in t){let n=i.toLocaleLowerCase(),s=e[n];if(s){let a=t[i];i==="header"&&(a=a.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),r&&s.push(`//----${r}----//`),s.push(a)}else Ye(`${i} placement hook does not exist in shader`)}}var b0=g(()=>{wt()});function If(t){let e={};return(t.match(Of)?.map(r=>r.replace(/[{()}]/g,""))??[]).forEach(r=>{e[r]=[]}),e}var Of,w0=g(()=>{"use strict";Of=/\{\{(.*?)\}\}/g});function Ff(t,e){let r,i=/@in\s+([^;]+);/g;for(;(r=i.exec(t))!==null;)e.push(r[1])}function Df(t,e,r=!1){let i=[];Ff(e,i),t.forEach(o=>{o.header&&Ff(o.header,i)});let n=i;r&&n.sort();let s=n.map((o,l)=>` @location(${l}) ${o},`).join(`
|
|
`),a=e.replace(/@in\s+[^;]+;\s*/g,"");return a=a.replace("{{in}}",`
|
|
${s}
|
|
`),a}var T0=g(()=>{"use strict"});function Uf(t,e){let r,i=/@out\s+([^;]+);/g;for(;(r=i.exec(t))!==null;)e.push(r[1])}function S0(t){let e=/\b(\w+)\s*:/g.exec(t);return e?e[1]:""}function E0(t){let e=/@.*?\s+/g;return t.replace(e,"")}function C0(t,e){let r=[];Uf(e,r),t.forEach(l=>{l.header&&Uf(l.header,r)});let i=0,n=r.sort().map(l=>l.indexOf("builtin")>-1?l:`@location(${i++}) ${l}`).join(`,
|
|
`),s=r.sort().map(l=>` var ${E0(l)};`).join(`
|
|
`),a=`return VSOutput(
|
|
${r.sort().map(l=>` ${S0(l)}`).join(`,
|
|
`)});`,o=e.replace(/@out\s+[^;]+;\s*/g,"");return o=o.replace("{{struct}}",`
|
|
${n}
|
|
`),o=o.replace("{{start}}",`
|
|
${s}
|
|
`),o=o.replace("{{return}}",`
|
|
${a}
|
|
`),o}var A0=g(()=>{"use strict"});function Lf(t,e){let r=t;for(let i in e){let n=e[i];n.join(`
|
|
`).length?r=r.replace(`{{${i}}}`,`//-----${i} START-----//
|
|
${n.join(`
|
|
`)}
|
|
//----${i} FINISH----//`):r=r.replace(`{{${i}}}`,"")}return r}var P0=g(()=>{"use strict"});function M0({template:t,bits:e}){let r=Nf(t,e);if(qi[r])return qi[r];let{vertex:i,fragment:n}=k0(t,e);return qi[r]=zf(i,n,e),qi[r]}function R0({template:t,bits:e}){let r=Nf(t,e);return qi[r]||(qi[r]=zf(t.vertex,t.fragment,e)),qi[r]}function k0(t,e){let r=e.map(a=>a.vertex).filter(a=>!!a),i=e.map(a=>a.fragment).filter(a=>!!a),n=Df(r,t.vertex,!0);n=C0(r,n);let s=Df(i,t.fragment,!0);return{vertex:n,fragment:s}}function Nf(t,e){return e.map(r=>(za.has(r)||za.set(r,Hf++),za.get(r))).sort((r,i)=>r-i).join("-")+t.vertex+t.fragment}function zf(t,e,r){let i=If(t),n=If(e);return r.forEach(s=>{Gf(s.vertex,i,s.name),Gf(s.fragment,n,s.name)}),{vertex:Lf(t,i),fragment:Lf(e,n)}}var qi,za,Hf,B0=g(()=>{b0(),w0(),T0(),A0(),P0(),qi=Object.create(null),za=new Map,Hf=0}),Vf,jf,Wf,$f,G0=g(()=>{"use strict";Vf=`
|
|
@in aPosition: vec2<f32>;
|
|
@in aUV: vec2<f32>;
|
|
|
|
@out @builtin(position) vPosition: vec4<f32>;
|
|
@out vUV : vec2<f32>;
|
|
@out vColor : vec4<f32>;
|
|
|
|
{{header}}
|
|
|
|
struct VSOutput {
|
|
{{struct}}
|
|
};
|
|
|
|
@vertex
|
|
fn main( {{in}} ) -> VSOutput {
|
|
|
|
var worldTransformMatrix = globalUniforms.uWorldTransformMatrix;
|
|
var modelMatrix = mat3x3<f32>(
|
|
1.0, 0.0, 0.0,
|
|
0.0, 1.0, 0.0,
|
|
0.0, 0.0, 1.0
|
|
);
|
|
var position = aPosition;
|
|
var uv = aUV;
|
|
|
|
{{start}}
|
|
|
|
vColor = vec4<f32>(1., 1., 1., 1.);
|
|
|
|
{{main}}
|
|
|
|
vUV = uv;
|
|
|
|
var modelViewProjectionMatrix = globalUniforms.uProjectionMatrix * worldTransformMatrix * modelMatrix;
|
|
|
|
vPosition = vec4<f32>((modelViewProjectionMatrix * vec3<f32>(position, 1.0)).xy, 0.0, 1.0);
|
|
|
|
vColor *= globalUniforms.uWorldColorAlpha;
|
|
|
|
{{end}}
|
|
|
|
{{return}}
|
|
};
|
|
`,jf=`
|
|
@in vUV : vec2<f32>;
|
|
@in vColor : vec4<f32>;
|
|
|
|
{{header}}
|
|
|
|
@fragment
|
|
fn main(
|
|
{{in}}
|
|
) -> @location(0) vec4<f32> {
|
|
|
|
{{start}}
|
|
|
|
var outColor:vec4<f32>;
|
|
|
|
{{main}}
|
|
|
|
var finalColor:vec4<f32> = outColor * vColor;
|
|
|
|
{{end}}
|
|
|
|
return finalColor;
|
|
};
|
|
`,Wf=`
|
|
in vec2 aPosition;
|
|
in vec2 aUV;
|
|
|
|
out vec4 vColor;
|
|
out vec2 vUV;
|
|
|
|
{{header}}
|
|
|
|
void main(void){
|
|
|
|
mat3 worldTransformMatrix = uWorldTransformMatrix;
|
|
mat3 modelMatrix = mat3(
|
|
1.0, 0.0, 0.0,
|
|
0.0, 1.0, 0.0,
|
|
0.0, 0.0, 1.0
|
|
);
|
|
vec2 position = aPosition;
|
|
vec2 uv = aUV;
|
|
|
|
{{start}}
|
|
|
|
vColor = vec4(1.);
|
|
|
|
{{main}}
|
|
|
|
vUV = uv;
|
|
|
|
mat3 modelViewProjectionMatrix = uProjectionMatrix * worldTransformMatrix * modelMatrix;
|
|
|
|
gl_Position = vec4((modelViewProjectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
|
|
|
|
vColor *= uWorldColorAlpha;
|
|
|
|
{{end}}
|
|
}
|
|
`,$f=`
|
|
|
|
in vec4 vColor;
|
|
in vec2 vUV;
|
|
|
|
out vec4 finalColor;
|
|
|
|
{{header}}
|
|
|
|
void main(void) {
|
|
|
|
{{start}}
|
|
|
|
vec4 outColor;
|
|
|
|
{{main}}
|
|
|
|
finalColor = outColor * vColor;
|
|
|
|
{{end}}
|
|
}
|
|
`}),Xf,Yf,I0=g(()=>{"use strict";Xf={name:"global-uniforms-bit",vertex:{header:`
|
|
struct GlobalUniforms {
|
|
uProjectionMatrix:mat3x3<f32>,
|
|
uWorldTransformMatrix:mat3x3<f32>,
|
|
uWorldColorAlpha: vec4<f32>,
|
|
uResolution: vec2<f32>,
|
|
}
|
|
|
|
@group(0) @binding(0) var<uniform> globalUniforms : GlobalUniforms;
|
|
`}},Yf={name:"global-uniforms-bit",vertex:{header:`
|
|
uniform mat3 uProjectionMatrix;
|
|
uniform mat3 uWorldTransformMatrix;
|
|
uniform vec4 uWorldColorAlpha;
|
|
uniform vec2 uResolution;
|
|
`}}});function ws({bits:t,name:e}){let r=M0({template:{fragment:jf,vertex:Vf},bits:[Xf,...t]});return Hn.from({name:e,vertex:{source:r.vertex,entryPoint:"main"},fragment:{source:r.fragment,entryPoint:"main"}})}function Ts({bits:t,name:e}){return new mn({name:e,...R0({template:{vertex:Wf,fragment:$f},bits:[Yf,...t]})})}var _n=g(()=>{Ln(),bs(),B0(),G0(),I0()}),Ha,Va,ja=g(()=>{"use strict";Ha={name:"color-bit",vertex:{header:`
|
|
@in aColor: vec4<f32>;
|
|
`,main:`
|
|
vColor *= vec4<f32>(aColor.rgb * aColor.a, aColor.a);
|
|
`}},Va={name:"color-bit",vertex:{header:`
|
|
in vec4 aColor;
|
|
`,main:`
|
|
vColor *= vec4(aColor.rgb * aColor.a, aColor.a);
|
|
`}}});function O0(t){let e=[];if(t===1)e.push("@group(1) @binding(0) var textureSource1: texture_2d<f32>;"),e.push("@group(1) @binding(1) var textureSampler1: sampler;");else{let r=0;for(let i=0;i<t;i++)e.push(`@group(1) @binding(${r++}) var textureSource${i+1}: texture_2d<f32>;`),e.push(`@group(1) @binding(${r++}) var textureSampler${i+1}: sampler;`)}return e.join(`
|
|
`)}function F0(t){let e=[];if(t===1)e.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{e.push("switch vTextureId {");for(let r=0;r<t;r++)r===t-1?e.push(" default:{"):e.push(` case ${r}:{`),e.push(` outColor = textureSampleGrad(textureSource${r+1}, textureSampler${r+1}, vUV, uvDx, uvDy);`),e.push(" break;}");e.push("}")}return e.join(`
|
|
`)}function hh(t){return Wa[t]||(Wa[t]={name:"texture-batch-bit",vertex:{header:`
|
|
@in aTextureIdAndRound: vec2<u32>;
|
|
@out @interpolate(flat) vTextureId : u32;
|
|
`,main:`
|
|
vTextureId = aTextureIdAndRound.y;
|
|
`,end:`
|
|
if(aTextureIdAndRound.x == 1)
|
|
{
|
|
vPosition = vec4<f32>(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
|
|
}
|
|
`},fragment:{header:`
|
|
@in @interpolate(flat) vTextureId: u32;
|
|
|
|
${O0(t)}
|
|
`,main:`
|
|
var uvDx = dpdx(vUV);
|
|
var uvDy = dpdy(vUV);
|
|
|
|
${F0(t)}
|
|
`}}),Wa[t]}function D0(t){let e=[];for(let r=0;r<t;r++)r>0&&e.push("else"),r<t-1&&e.push(`if(vTextureId < ${r}.5)`),e.push("{"),e.push(` outColor = texture(uTextures[${r}], vUV);`),e.push("}");return e.join(`
|
|
`)}function uh(t){return $a[t]||($a[t]={name:"texture-batch-bit",vertex:{header:`
|
|
in vec2 aTextureIdAndRound;
|
|
out float vTextureId;
|
|
|
|
`,main:`
|
|
vTextureId = aTextureIdAndRound.y;
|
|
`,end:`
|
|
if(aTextureIdAndRound.x == 1.)
|
|
{
|
|
gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
|
|
}
|
|
`},fragment:{header:`
|
|
in float vTextureId;
|
|
|
|
uniform sampler2D uTextures[${t}];
|
|
|
|
`,main:`
|
|
|
|
${D0(t)}
|
|
`}}),$a[t]}var Wa,$a,Xa=g(()=>{"use strict";Wa={},$a={}}),Vn,jn,vn=g(()=>{"use strict";Vn={name:"round-pixels-bit",vertex:{header:`
|
|
fn roundPixels(position: vec2<f32>, targetSize: vec2<f32>) -> vec2<f32>
|
|
{
|
|
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
|
|
}
|
|
`}},jn={name:"round-pixels-bit",vertex:{header:`
|
|
vec2 roundPixels(vec2 position, vec2 targetSize)
|
|
{
|
|
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
|
|
}
|
|
`}}}),ch,qf,U0=g(()=>{"use strict";ch=["f32","i32","vec2<f32>","vec3<f32>","vec4<f32>","mat2x2<f32>","mat3x3<f32>","mat4x4<f32>","mat3x2<f32>","mat4x2<f32>","mat2x3<f32>","mat4x3<f32>","mat2x4<f32>","mat3x4<f32>","vec2<i32>","vec3<i32>","vec4<i32>"],qf=ch.reduce((t,e)=>(t[e]=!0,t),{})});function L0(t,e){switch(t){case"f32":return 0;case"vec2<f32>":return new Float32Array(2*e);case"vec3<f32>":return new Float32Array(3*e);case"vec4<f32>":return new Float32Array(4*e);case"mat2x2<f32>":return new Float32Array([1,0,0,1]);case"mat3x3<f32>":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4<f32>":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var N0=g(()=>{"use strict"}),dh,dr,wr=g(()=>{Ot(),Fa(),U0(),N0(),dh=class Ry{constructor(e,r){this._touched=0,this.uid=ot("uniform"),this._resourceType="uniformGroup",this._resourceId=ot("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,r={...Ry.defaultOptions,...r},this.uniformStructures=e;let i={};for(let n in e){let s=e[n];if(s.name=n,s.size=s.size??1,!qf[s.type])throw new Error(`Uniform type ${s.type} is not supported. Supported uniform types are: ${ch.join(", ")}`);s.value??(s.value=L0(s.type,s.size)),i[n]=s.value}this.uniforms=i,this._dirtyId=1,this.ubo=r.ubo,this.isStatic=r.isStatic,this._signature=xs(Object.keys(i).map(n=>`${n}-${e[n].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}},dh.defaultOptions={ubo:!1,isStatic:!1},dr=dh});function fh(t){let e=ph[t];if(e)return e;let r=new Int32Array(t);for(let i=0;i<t;i++)r[i]=i;return e=ph[t]=new dr({uTextures:{value:r,type:"i32",size:t}},{isStatic:!0}),e}var ph,gh=g(()=>{wr(),ph={}}),Lr,Mi=g(()=>{"use strict";Lr=(t=>(t[t.WEBGL=1]="WEBGL",t[t.WEBGPU=2]="WEBGPU",t[t.BOTH=3]="BOTH",t))(Lr||{})}),qr,hi=g(()=>{kt(),Ot(),Ln(),dn(),bs(),Mi(),wr(),qr=class ky extends st{constructor(e){super(),this.uid=ot("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:r,glProgram:i,groups:n,resources:s,compatibleRenderers:a,groupMap:o}=e;this.gpuProgram=r,this.glProgram=i,a===void 0&&(a=0,r&&(a|=Lr.WEBGPU),i&&(a|=Lr.WEBGL)),this.compatibleRenderers=a;let l={};if(!s&&!n&&(s={}),s&&n)throw new Error("[Shader] Cannot have both resources and groups");if(!r&&n&&!o)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!r&&n&&o)for(let h in o)for(let u in o[h]){let c=o[h][u];l[c]={group:h,binding:u,name:c}}else if(r&&n&&!o){let h=r.structsAndGroups.groups;o={},h.forEach(u=>{o[u.group]=o[u.group]||{},o[u.group][u.binding]=u.name,l[u.name]=u})}else if(s){n={},o={},r&&r.structsAndGroups.groups.forEach(u=>{o[u.group]=o[u.group]||{},o[u.group][u.binding]=u.name,l[u.name]=u});let h=0;for(let u in s)l[u]||(n[99]||(n[99]=new li,this._ownedBindGroups.push(n[99])),l[u]={group:99,binding:h,name:u},o[99]=o[99]||{},o[99][h]=u,h++);for(let u in s){let c=u,f=s[u];!f.source&&!f._resourceType&&(f=new dr(f));let d=l[c];d&&(n[d.group]||(n[d.group]=new li,this._ownedBindGroups.push(n[d.group])),n[d.group].setResource(f,d.binding))}}this.groups=n,this._uniformBindMap=o,this.resources=this._buildResourceAccessor(n,l)}addResource(e,r,i){var n,s;(n=this._uniformBindMap)[r]||(n[r]={}),(s=this._uniformBindMap[r])[i]||(s[i]=e),this.groups[r]||(this.groups[r]=new li,this._ownedBindGroups.push(this.groups[r]))}_buildResourceAccessor(e,r){let i={};for(let n in r){let s=r[n];Object.defineProperty(i,s.name,{get(){return e[s.group].getResource(s.binding)},set(a){e[s.group].setResource(a,s.binding)}})}return i}destroy(e=!1){this.emit("destroy",this),e&&(this.gpuProgram?.destroy(),this.glProgram?.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(r=>{r.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null}static from(e){let{gpu:r,gl:i,...n}=e,s,a;return r&&(s=Hn.from(r)),i&&(a=mn.from(i)),new ky({gpuProgram:s,glProgram:a,...n})}}}),Kf,z0=g(()=>{_n(),ja(),Xa(),vn(),gh(),hi(),Kf=class extends qr{constructor(t){let e=Ts({name:"batch",bits:[Va,uh(t),jn]}),r=ws({name:"batch",bits:[Ha,hh(t),Vn]});super({glProgram:e,gpuProgram:r,resources:{batchSamplers:fh(t)}})}}}),Ya,mh,qa,Zf=g(()=>{X(),Xx(),Qx(),z0(),Ya=null,mh=class By extends Ef{constructor(e){super(e),this.geometry=new Mf,this.name=By.extension.name,this.vertexSize=6,Ya??(Ya=new Kf(e.maxTextures)),this.shader=Ya}packAttributes(e,r,i,n,s){let a=s<<16|e.roundPixels&65535,o=e.transform,l=o.a,h=o.b,u=o.c,c=o.d,f=o.tx,d=o.ty,{positions:_,uvs:v}=e,m=e.color,y=e.attributeOffset,S=y+e.attributeSize;for(let P=y;P<S;P++){let T=P*2,z=_[T],D=_[T+1];r[n++]=l*z+u*D+f,r[n++]=c*D+h*z+d,r[n++]=v[T],r[n++]=v[T+1],i[n++]=m,i[n++]=a}}packQuadAttributes(e,r,i,n,s){let a=e.texture,o=e.transform,l=o.a,h=o.b,u=o.c,c=o.d,f=o.tx,d=o.ty,_=e.bounds,v=_.maxX,m=_.minX,y=_.maxY,S=_.minY,P=a.uvs,T=e.color,z=s<<16|e.roundPixels&65535;r[n+0]=l*m+u*S+f,r[n+1]=c*S+h*m+d,r[n+2]=P.x0,r[n+3]=P.y0,i[n+4]=T,i[n+5]=z,r[n+6]=l*v+u*S+f,r[n+7]=c*S+h*v+d,r[n+8]=P.x1,r[n+9]=P.y1,i[n+10]=T,i[n+11]=z,r[n+12]=l*v+u*y+f,r[n+13]=c*y+h*v+d,r[n+14]=P.x2,r[n+15]=P.y2,i[n+16]=T,i[n+17]=z,r[n+18]=l*m+u*y+f,r[n+19]=c*y+h*m+d,r[n+20]=P.x3,r[n+21]=P.y3,i[n+22]=T,i[n+23]=z}},mh.extension={type:[M.Batcher],name:"default"},qa=mh});function H0(t,e,r,i,n,s,a,o=null){let l=0;r*=e,n*=s;let h=o.a,u=o.b,c=o.c,f=o.d,d=o.tx,_=o.ty;for(;l<a;){let v=t[r],m=t[r+1];i[n]=h*v+c*m+d,i[n+1]=u*v+f*m+_,n+=s,r+=e,l++}}function V0(t,e,r,i){let n=0;for(e*=r;n<i;)t[e]=0,t[e+1]=0,e+=r,n++}var j0=g(()=>{"use strict"});function Qf(t,e,r,i,n){let s=e.a,a=e.b,o=e.c,l=e.d,h=e.tx,u=e.ty;r||(r=0),i||(i=2),n||(n=t.length/i-r);let c=r*i;for(let f=0;f<n;f++){let d=t[c],_=t[c+1];t[c]=s*d+o*_+h,t[c+1]=a*d+l*_+u,c+=i}}var W0=g(()=>{"use strict"}),Jf,Ka,ep=g(()=>{Ke(),H(),Jf=new ve,Ka=class{constructor(){this.packAsQuad=!1,this.batcherName="default",this.topology="triangle-list",this.applyTransform=!0,this.roundPixels=0,this._batcher=null,this._batch=null}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.renderable&&this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){let t=this.baseColor,e=t>>16|t&65280|(t&255)<<16,r=this.renderable;return r?N(e,r.groupColor)+(this.alpha*r.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||Jf}copyTo(t){t.indexOffset=this.indexOffset,t.indexSize=this.indexSize,t.attributeOffset=this.attributeOffset,t.attributeSize=this.attributeSize,t.baseColor=this.baseColor,t.alpha=this.alpha,t.texture=this.texture,t.geometryData=this.geometryData,t.topology=this.topology}reset(){this.applyTransform=!0,this.renderable=null,this.topology="triangle-list"}}}),Wn,tp,rp,$0=g(()=>{X(),Wn={extension:{type:M.ShapeBuilder,name:"circle"},build(t,e){let r,i,n,s,a,o;if(t.type==="circle"){let T=t;if(a=o=T.radius,a<=0)return!1;r=T.x,i=T.y,n=s=0}else if(t.type==="ellipse"){let T=t;if(a=T.halfWidth,o=T.halfHeight,a<=0||o<=0)return!1;r=T.x,i=T.y,n=s=0}else{let T=t,z=T.width/2,D=T.height/2;r=T.x+z,i=T.y+D,a=o=Math.max(0,Math.min(T.radius,Math.min(z,D))),n=z-a,s=D-o}if(n<0||s<0)return!1;let l=Math.ceil(2.3*Math.sqrt(a+o)),h=l*8+(n?4:0)+(s?4:0);if(h===0)return!1;if(l===0)return e[0]=e[6]=r+n,e[1]=e[3]=i+s,e[2]=e[4]=r-n,e[5]=e[7]=i-s,!0;let u=0,c=l*4+(n?2:0)+2,f=c,d=h,_=n+a,v=s,m=r+_,y=r-_,S=i+v;if(e[u++]=m,e[u++]=S,e[--c]=S,e[--c]=y,s){let T=i-v;e[f++]=y,e[f++]=T,e[--d]=T,e[--d]=m}for(let T=1;T<l;T++){let z=Math.PI/2*(T/l),D=n+Math.cos(z)*a,L=s+Math.sin(z)*o,ne=r+D,ue=r-D,re=i+L,oe=i-L;e[u++]=ne,e[u++]=re,e[--c]=re,e[--c]=ue,e[f++]=ue,e[f++]=oe,e[--d]=oe,e[--d]=ne}_=n,v=s+o,m=r+_,y=r-_,S=i+v;let P=i-v;return e[u++]=m,e[u++]=S,e[--d]=P,e[--d]=m,n&&(e[u++]=y,e[u++]=S,e[--d]=P,e[--d]=y),!0},triangulate(t,e,r,i,n,s){if(t.length===0)return;let a=0,o=0;for(let u=0;u<t.length;u+=2)a+=t[u],o+=t[u+1];a/=t.length/2,o/=t.length/2;let l=i;e[l*r]=a,e[l*r+1]=o;let h=l++;for(let u=0;u<t.length;u+=2)e[l*r]=t[u],e[l*r+1]=t[u+1],u>0&&(n[s++]=l,n[s++]=h,n[s++]=l-1),l++;n[s++]=h+1,n[s++]=h,n[s++]=l-1}},tp={...Wn,extension:{...Wn.extension,name:"ellipse"}},rp={...Wn,extension:{...Wn.extension,name:"roundedRectangle"}}});function X0(t){let e=t.length;if(e<6)return 1;let r=0;for(let i=0,n=t[e-2],s=t[e-1];i<e;i+=2){let a=t[i],o=t[i+1];r+=(a-n)*(o+s),n=a,s=o}return r<0?-1:1}var Y0=g(()=>{"use strict"});function ip(t,e,r,i,n,s,a,o){let l=t-r*n,h=e-i*n,u=t+r*s,c=e+i*s,f,d;a?(f=i,d=-r):(f=-i,d=r);let _=l+f,v=h+d,m=u+f,y=c+d;return o.push(_,v),o.push(m,y),2}function yn(t,e,r,i,n,s,a,o){let l=r-t,h=i-e,u=Math.atan2(l,h),c=Math.atan2(n-t,s-e);o&&u<c?u+=Math.PI*2:!o&&u>c&&(c+=Math.PI*2);let f=u,d=c-u,_=Math.abs(d),v=Math.sqrt(l*l+h*h),m=(15*_*Math.sqrt(v)/Math.PI>>0)+1,y=d/m;if(f+=y,o){a.push(t,e),a.push(r,i);for(let S=1,P=f;S<m;S++,P+=y)a.push(t,e),a.push(t+Math.sin(P)*v,e+Math.cos(P)*v);a.push(t,e),a.push(n,s)}else{a.push(r,i),a.push(t,e);for(let S=1,P=f;S<m;S++,P+=y)a.push(t+Math.sin(P)*v,e+Math.cos(P)*v),a.push(t,e);a.push(n,s),a.push(t,e)}return m*2}function q0(t,e,r,i,n,s){let a=1e-4;if(t.length===0)return;let o=e,l=o.alignment;if(e.alignment!==.5){let Se=X0(t);r&&(Se*=-1),l=(l-.5)*Se+.5}let h=new ye(t[0],t[1]),u=new ye(t[t.length-2],t[t.length-1]),c=i,f=Math.abs(h.x-u.x)<a&&Math.abs(h.y-u.y)<a;if(c){t=t.slice(),f&&(t.pop(),t.pop(),u.set(t[t.length-2],t[t.length-1]));let Se=(h.x+u.x)*.5,De=(u.y+h.y)*.5;t.unshift(Se,De),t.push(Se,De)}let d=n,_=t.length/2,v=t.length,m=d.length/2,y=o.width/2,S=y*y,P=o.miterLimit*o.miterLimit,T=t[0],z=t[1],D=t[2],L=t[3],ne=0,ue=0,re=-(z-L),oe=T-D,Be=0,Ze=0,I=Math.sqrt(re*re+oe*oe);re/=I,oe/=I,re*=y,oe*=y;let Me=l,U=(1-Me)*2,J=Me*2;c||(o.cap==="round"?v+=yn(T-re*(U-J)*.5,z-oe*(U-J)*.5,T-re*U,z-oe*U,T+re*J,z+oe*J,d,!0)+2:o.cap==="square"&&(v+=ip(T,z,re,oe,U,J,!0,d))),d.push(T-re*U,z-oe*U),d.push(T+re*J,z+oe*J);for(let Se=1;Se<_-1;++Se){T=t[(Se-1)*2],z=t[(Se-1)*2+1],D=t[Se*2],L=t[Se*2+1],ne=t[(Se+1)*2],ue=t[(Se+1)*2+1],re=-(z-L),oe=T-D,I=Math.sqrt(re*re+oe*oe),re/=I,oe/=I,re*=y,oe*=y,Be=-(L-ue),Ze=D-ne,I=Math.sqrt(Be*Be+Ze*Ze),Be/=I,Ze/=I,Be*=y,Ze*=y;let De=D-T,dt=z-L,Ct=D-ne,qt=ue-L,Yt=De*Ct+dt*qt,ir=dt*Ct-qt*De,hr=ir<0;if(Math.abs(ir)<.001*Math.abs(Yt)){d.push(D-re*U,L-oe*U),d.push(D+re*J,L+oe*J),Yt>=0&&(o.join==="round"?v+=yn(D,L,D-re*U,L-oe*U,D-Be*U,L-Ze*U,d,!1)+4:v+=2,d.push(D-Be*J,L-Ze*J),d.push(D+Be*U,L+Ze*U));continue}let ur=(-re+T)*(-oe+L)-(-re+D)*(-oe+z),Kt=(-Be+ne)*(-Ze+L)-(-Be+D)*(-Ze+ue),Er=(De*Kt-Ct*ur)/ir,tn=(qt*ur-dt*Kt)/ir,ns=(Er-D)*(Er-D)+(tn-L)*(tn-L),_i=D+(Er-D)*U,ti=L+(tn-L)*U,vi=D-(Er-D)*J,yi=L-(tn-L)*J,q=Math.min(De*De+dt*dt,Ct*Ct+qt*qt),me=hr?U:J,Je=q+me*me*S;ns<=Je?o.join==="bevel"||ns/S>P?(hr?(d.push(_i,ti),d.push(D+re*J,L+oe*J),d.push(_i,ti),d.push(D+Be*J,L+Ze*J)):(d.push(D-re*U,L-oe*U),d.push(vi,yi),d.push(D-Be*U,L-Ze*U),d.push(vi,yi)),v+=2):o.join==="round"?hr?(d.push(_i,ti),d.push(D+re*J,L+oe*J),v+=yn(D,L,D+re*J,L+oe*J,D+Be*J,L+Ze*J,d,!0)+4,d.push(_i,ti),d.push(D+Be*J,L+Ze*J)):(d.push(D-re*U,L-oe*U),d.push(vi,yi),v+=yn(D,L,D-re*U,L-oe*U,D-Be*U,L-Ze*U,d,!1)+4,d.push(D-Be*U,L-Ze*U),d.push(vi,yi)):(d.push(_i,ti),d.push(vi,yi)):(d.push(D-re*U,L-oe*U),d.push(D+re*J,L+oe*J),o.join==="round"?hr?v+=yn(D,L,D+re*J,L+oe*J,D+Be*J,L+Ze*J,d,!0)+2:v+=yn(D,L,D-re*U,L-oe*U,D-Be*U,L-Ze*U,d,!1)+2:o.join==="miter"&&ns/S<=P&&(hr?(d.push(vi,yi),d.push(vi,yi)):(d.push(_i,ti),d.push(_i,ti)),v+=2),d.push(D-Be*U,L-Ze*U),d.push(D+Be*J,L+Ze*J),v+=2)}T=t[(_-2)*2],z=t[(_-2)*2+1],D=t[(_-1)*2],L=t[(_-1)*2+1],re=-(z-L),oe=T-D,I=Math.sqrt(re*re+oe*oe),re/=I,oe/=I,re*=y,oe*=y,d.push(D-re*U,L-oe*U),d.push(D+re*J,L+oe*J),c||(o.cap==="round"?v+=yn(D-re*(U-J)*.5,L-oe*(U-J)*.5,D-re*U,L-oe*U,D+re*J,L+oe*J,d,!1)+2:o.cap==="square"&&(v+=ip(D,L,re,oe,U,J,!1,d)));let je=1e-4*1e-4;for(let Se=m;Se<v+m-2;++Se)T=d[Se*2],z=d[Se*2+1],D=d[(Se+1)*2],L=d[(Se+1)*2+1],ne=d[(Se+2)*2],ue=d[(Se+2)*2+1],!(Math.abs(T*(L-ue)+D*(ue-z)+ne*(z-L))<je)&&s.push(Se,Se+1,Se+2)}var K0=g(()=>{He(),Y0()});function Z0(t,e,r,i){let n=1e-4;if(t.length===0)return;let s=t[0],a=t[1],o=t[t.length-2],l=t[t.length-1],h=e||Math.abs(s-o)<n&&Math.abs(a-l)<n,u=r,c=t.length/2,f=u.length/2;for(let d=0;d<c;d++)u.push(t[d*2]),u.push(t[d*2+1]);for(let d=0;d<c-1;d++)i.push(f+d,f+d+1);h&&i.push(f+c-1,f)}var Q0=g(()=>{});function np(t,e,r=2){let i=e&&e.length,n=i?e[0]*r:t.length,s=sp(t,0,n,r,!0),a=[];if(!s||s.next===s.prev)return a;let o,l,h;if(i&&(s=ib(t,e,s,r)),t.length>80*r){o=t[0],l=t[1];let u=o,c=l;for(let f=r;f<n;f+=r){let d=t[f],_=t[f+1];d<o&&(o=d),_<l&&(l=_),d>u&&(u=d),_>c&&(c=_)}h=Math.max(u-o,c-l),h=h!==0?32767/h:0}return Ss(s,a,r,o,l,h,0),a}function sp(t,e,r,i,n){let s;if(n===pb(t,e,r,i)>0)for(let a=e;a<r;a+=i)s=hp(a/i|0,t[a],t[a+1],s);else for(let a=r-i;a>=e;a-=i)s=hp(a/i|0,t[a],t[a+1],s);return s&&$n(s,s.next)&&(As(s),s=s.next),s}function xn(t,e){if(!t)return t;e||(e=t);let r=t,i;do if(i=!1,!r.steiner&&($n(r,r.next)||Wt(r.prev,r,r.next)===0)){if(As(r),r=e=r.prev,r===r.next)break;i=!0}else r=r.next;while(i||r!==e);return e}function Ss(t,e,r,i,n,s,a){if(!t)return;!a&&s&&lb(t,i,n,s);let o=t;for(;t.prev!==t.next;){let l=t.prev,h=t.next;if(s?eb(t,i,n,s):J0(t)){e.push(l.i,t.i,h.i),As(t),t=h.next,o=h.next;continue}if(t=h,t===o){a?a===1?(t=tb(xn(t),e),Ss(t,e,r,i,n,s,2)):a===2&&rb(t,e,r,i,n,s):Ss(xn(t),e,r,i,n,s,1);break}}}function J0(t){let e=t.prev,r=t,i=t.next;if(Wt(e,r,i)>=0)return!1;let n=e.x,s=r.x,a=i.x,o=e.y,l=r.y,h=i.y,u=Math.min(n,s,a),c=Math.min(o,l,h),f=Math.max(n,s,a),d=Math.max(o,l,h),_=i.next;for(;_!==e;){if(_.x>=u&&_.x<=f&&_.y>=c&&_.y<=d&&Es(n,o,s,l,a,h,_.x,_.y)&&Wt(_.prev,_,_.next)>=0)return!1;_=_.next}return!0}function eb(t,e,r,i){let n=t.prev,s=t,a=t.next;if(Wt(n,s,a)>=0)return!1;let o=n.x,l=s.x,h=a.x,u=n.y,c=s.y,f=a.y,d=Math.min(o,l,h),_=Math.min(u,c,f),v=Math.max(o,l,h),m=Math.max(u,c,f),y=_h(d,_,e,r,i),S=_h(v,m,e,r,i),P=t.prevZ,T=t.nextZ;for(;P&&P.z>=y&&T&&T.z<=S;){if(P.x>=d&&P.x<=v&&P.y>=_&&P.y<=m&&P!==n&&P!==a&&Es(o,u,l,c,h,f,P.x,P.y)&&Wt(P.prev,P,P.next)>=0||(P=P.prevZ,T.x>=d&&T.x<=v&&T.y>=_&&T.y<=m&&T!==n&&T!==a&&Es(o,u,l,c,h,f,T.x,T.y)&&Wt(T.prev,T,T.next)>=0))return!1;T=T.nextZ}for(;P&&P.z>=y;){if(P.x>=d&&P.x<=v&&P.y>=_&&P.y<=m&&P!==n&&P!==a&&Es(o,u,l,c,h,f,P.x,P.y)&&Wt(P.prev,P,P.next)>=0)return!1;P=P.prevZ}for(;T&&T.z<=S;){if(T.x>=d&&T.x<=v&&T.y>=_&&T.y<=m&&T!==n&&T!==a&&Es(o,u,l,c,h,f,T.x,T.y)&&Wt(T.prev,T,T.next)>=0)return!1;T=T.nextZ}return!0}function tb(t,e){let r=t;do{let i=r.prev,n=r.next.next;!$n(i,n)&&op(i,r,r.next,n)&&Cs(i,n)&&Cs(n,i)&&(e.push(i.i,r.i,n.i),As(r),As(r.next),r=t=n),r=r.next}while(r!==t);return xn(r)}function rb(t,e,r,i,n,s){let a=t;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&cb(a,o)){let l=lp(a,o);a=xn(a,a.next),l=xn(l,l.next),Ss(a,e,r,i,n,s,0),Ss(l,e,r,i,n,s,0);return}o=o.next}a=a.next}while(a!==t)}function ib(t,e,r,i){let n=[];for(let s=0,a=e.length;s<a;s++){let o=e[s]*i,l=s<a-1?e[s+1]*i:t.length,h=sp(t,o,l,i,!1);h===h.next&&(h.steiner=!0),n.push(ub(h))}n.sort(nb);for(let s=0;s<n.length;s++)r=sb(n[s],r);return r}function nb(t,e){let r=t.x-e.x;if(r===0&&(r=t.y-e.y,r===0)){let i=(t.next.y-t.y)/(t.next.x-t.x),n=(e.next.y-e.y)/(e.next.x-e.x);r=i-n}return r}function sb(t,e){let r=ab(t,e);if(!r)return e;let i=lp(r,t);return xn(i,i.next),xn(r,r.next)}function ab(t,e){let r=e,i=t.x,n=t.y,s=-1/0,a;if($n(t,r))return r;do{if($n(t,r.next))return r.next;if(n<=r.y&&n>=r.next.y&&r.next.y!==r.y){let c=r.x+(n-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(c<=i&&c>s&&(s=c,a=r.x<r.next.x?r:r.next,c===i))return a}r=r.next}while(r!==e);if(!a)return null;let o=a,l=a.x,h=a.y,u=1/0;r=a;do{if(i>=r.x&&r.x>=l&&i!==r.x&&ap(n<h?i:s,n,l,h,n<h?s:i,n,r.x,r.y)){let c=Math.abs(n-r.y)/(i-r.x);Cs(r,t)&&(c<u||c===u&&(r.x>a.x||r.x===a.x&&ob(a,r)))&&(a=r,u=c)}r=r.next}while(r!==o);return a}function ob(t,e){return Wt(t.prev,t,e.prev)<0&&Wt(e.next,t,t.next)<0}function lb(t,e,r,i){let n=t;do n.z===0&&(n.z=_h(n.x,n.y,e,r,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,hb(n)}function hb(t){let e,r=1;do{let i=t,n;t=null;let s=null;for(e=0;i;){e++;let a=i,o=0;for(let h=0;h<r&&(o++,a=a.nextZ,!!a);h++);let l=r;for(;o>0||l>0&&a;)o!==0&&(l===0||!a||i.z<=a.z)?(n=i,i=i.nextZ,o--):(n=a,a=a.nextZ,l--),s?s.nextZ=n:t=n,n.prevZ=s,s=n;i=a}s.nextZ=null,r*=2}while(e>1);return t}function _h(t,e,r,i,n){return t=(t-r)*n|0,e=(e-i)*n|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function ub(t){let e=t,r=t;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==t);return r}function ap(t,e,r,i,n,s,a,o){return(n-a)*(e-o)>=(t-a)*(s-o)&&(t-a)*(i-o)>=(r-a)*(e-o)&&(r-a)*(s-o)>=(n-a)*(i-o)}function Es(t,e,r,i,n,s,a,o){return!(t===a&&e===o)&&ap(t,e,r,i,n,s,a,o)}function cb(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!db(t,e)&&(Cs(t,e)&&Cs(e,t)&&fb(t,e)&&(Wt(t.prev,t,e.prev)||Wt(t,e.prev,e))||$n(t,e)&&Wt(t.prev,t,t.next)>0&&Wt(e.prev,e,e.next)>0)}function Wt(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function $n(t,e){return t.x===e.x&&t.y===e.y}function op(t,e,r,i){let n=Qa(Wt(t,e,r)),s=Qa(Wt(t,e,i)),a=Qa(Wt(r,i,t)),o=Qa(Wt(r,i,e));return!!(n!==s&&a!==o||n===0&&Za(t,r,e)||s===0&&Za(t,i,e)||a===0&&Za(r,t,i)||o===0&&Za(r,e,i))}function Za(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function Qa(t){return t>0?1:t<0?-1:0}function db(t,e){let r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&op(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}function Cs(t,e){return Wt(t.prev,t,t.next)<0?Wt(t,e,t.next)>=0&&Wt(t,t.prev,e)>=0:Wt(t,e,t.prev)<0||Wt(t,t.next,e)<0}function fb(t,e){let r=t,i=!1,n=(t.x+e.x)/2,s=(t.y+e.y)/2;do r.y>s!=r.next.y>s&&r.next.y!==r.y&&n<(r.next.x-r.x)*(s-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next;while(r!==t);return i}function lp(t,e){let r=vh(t.i,t.x,t.y),i=vh(e.i,e.x,e.y),n=t.next,s=e.prev;return t.next=e,e.prev=t,r.next=n,n.prev=r,i.next=r,r.prev=i,s.next=i,i.prev=s,i}function hp(t,e,r,i){let n=vh(t,e,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function As(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function vh(t,e,r){return{i:t,x:e,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function pb(t,e,r,i){let n=0;for(let s=e,a=r-i;s<r;s+=i)n+=(t[a]-t[s])*(t[s+1]+t[a+1]),a=s;return n}var gb=g(()=>{}),up,mb=g(()=>{gb(),kt(),up=np.default||np});function cp(t,e,r,i,n,s,a){let o=up(t,e,2);if(!o)return;for(let h=0;h<o.length;h+=3)s[a++]=o[h]+n,s[a++]=o[h+1]+n,s[a++]=o[h+2]+n;let l=n*i;for(let h=0;h<t.length;h+=2)r[l]=t[h],r[l+1]=t[h+1],l+=i}var dp=g(()=>{mb()}),fp,pp,_b=g(()=>{X(),dp(),fp=[],pp={extension:{type:M.ShapeBuilder,name:"polygon"},build(t,e){for(let r=0;r<t.points.length;r++)e[r]=t.points[r];return!0},triangulate(t,e,r,i,n,s){cp(t,fp,e,r,i,n,s)}}}),gp,vb=g(()=>{X(),gp={extension:{type:M.ShapeBuilder,name:"rectangle"},build(t,e){let r=t,i=r.x,n=r.y,s=r.width,a=r.height;return s>0&&a>0?(e[0]=i,e[1]=n,e[2]=i+s,e[3]=n,e[4]=i+s,e[5]=n+a,e[6]=i,e[7]=n+a,!0):!1},triangulate(t,e,r,i,n,s){let a=0;i*=r,e[i+a]=t[0],e[i+a+1]=t[1],a+=r,e[i+a]=t[2],e[i+a+1]=t[3],a+=r,e[i+a]=t[6],e[i+a+1]=t[7],a+=r,e[i+a]=t[4],e[i+a+1]=t[5],a+=r;let o=i/r;n[s++]=o,n[s++]=o+1,n[s++]=o+2,n[s++]=o+1,n[s++]=o+3,n[s++]=o+2}}}),mp,yb=g(()=>{X(),mp={extension:{type:M.ShapeBuilder,name:"triangle"},build(t,e){return e[0]=t.x,e[1]=t.y,e[2]=t.x2,e[3]=t.y2,e[4]=t.x3,e[5]=t.y3,!0},triangulate(t,e,r,i,n,s){let a=0;i*=r,e[i+a]=t[0],e[i+a+1]=t[1],a+=r,e[i+a]=t[2],e[i+a+1]=t[3],a+=r,e[i+a]=t[4],e[i+a+1]=t[5];let o=i/r;n[s++]=o,n[s++]=o+1,n[s++]=o+2}}});function _p(t,e){for(let r=0;r<e.length;r++){let i=e[r];t.addColorStop(i.offset,i.color)}}function vp(t,e){let r=Dt.get().createCanvas(t,e),i=r.getContext("2d");return{canvas:r,context:i}}function xb(t){let e=t[0]??{};return(typeof e=="number"||t[1])&&(Xe("8.5.2","use options object instead"),e={type:"linear",start:{x:t[0],y:t[1]},end:{x:t[2],y:t[3]},textureSpace:t[4],textureSize:t[5]??ui.defaultLinearOptions.textureSize}),e}var yh,Ja,ui,Ps=g(()=>{ze(),Jt(),Ke(),Kl(),Ft(),Ot(),Mt(),yr(),yh=[{offset:0,color:"white"},{offset:1,color:"black"}],Ja=class cd{constructor(...e){this.uid=ot("fillGradient"),this.type="linear",this.colorStops=[];let r=xb(e);r={...r.type==="radial"?cd.defaultRadialOptions:cd.defaultLinearOptions,...$r(r)},this._textureSize=r.textureSize,this._wrapMode=r.wrapMode,r.type==="radial"?(this.center=r.center,this.outerCenter=r.outerCenter??this.center,this.innerRadius=r.innerRadius,this.outerRadius=r.outerRadius,this.scale=r.scale,this.rotation=r.rotation):(this.start=r.start,this.end=r.end),this.textureSpace=r.textureSpace,this.type=r.type,r.colorStops.forEach(i=>{this.addColorStop(i.offset,i.color)})}addColorStop(e,r){return this.colorStops.push({offset:e,color:le.shared.setValue(r).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:e,y:r}=this.start,{x:i,y:n}=this.end,s=i-e,a=n-r,o=s<0||a<0;if(this._wrapMode==="clamp-to-edge"){if(s<0){let m=e;e=i,i=m,s*=-1}if(a<0){let m=r;r=n,n=m,a*=-1}}let l=this.colorStops.length?this.colorStops:yh,h=this._textureSize,{canvas:u,context:c}=vp(h,1),f=o?c.createLinearGradient(this._textureSize,0,0,0):c.createLinearGradient(0,0,this._textureSize,0);_p(f,l),c.fillStyle=f,c.fillRect(0,0,h,1),this.texture=new Fe({source:new On({resource:u,addressMode:this._wrapMode})});let d=Math.sqrt(s*s+a*a),_=Math.atan2(a,s),v=new ve;v.scale(d/h,1),v.rotate(_),v.translate(e,r),this.textureSpace==="local"&&v.scale(h,h),this.transform=v}buildGradient(){this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;let e=this.colorStops.length?this.colorStops:yh,r=this._textureSize,{canvas:i,context:n}=vp(r,r),{x:s,y:a}=this.center,{x:o,y:l}=this.outerCenter,h=this.innerRadius,u=this.outerRadius,c=o-u,f=l-u,d=r/(u*2),_=(s-c)*d,v=(a-f)*d,m=n.createRadialGradient(_,v,h*d,(o-c)*d,(l-f)*d,u*d);_p(m,e),n.fillStyle=e[e.length-1].color,n.fillRect(0,0,r,r),n.fillStyle=m,n.translate(_,v),n.rotate(this.rotation),n.scale(1,this.scale),n.translate(-_,-v),n.fillRect(0,0,r,r),this.texture=new Fe({source:new On({resource:i,addressMode:this._wrapMode})});let y=new ve;y.scale(1/d,1/d),y.translate(c,f),this.textureSpace==="local"&&y.scale(r,r),this.transform=y}get styleKey(){return this.uid}destroy(){this.texture?.destroy(!0),this.texture=null}},Ja.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"},Ja.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"},ui=Ja});function bb(t,e,r,i){let n=e.matrix?t.copyFrom(e.matrix).invert():t.identity();if(e.textureSpace==="local"){let a=r.getBounds(xp);e.width&&a.pad(e.width);let{x:o,y:l}=a,h=1/a.width,u=1/a.height,c=-o*h,f=-l*u,d=n.a,_=n.b,v=n.c,m=n.d;n.a*=h,n.b*=h,n.c*=u,n.d*=u,n.tx=c*d+f*v+n.tx,n.ty=c*_+f*m+n.ty}else n.translate(e.texture.frame.x,e.texture.frame.y),n.scale(1/e.texture.source.width,1/e.texture.source.height);let s=e.texture.source.style;return!(e.fill instanceof ui)&&s.addressMode==="clamp-to-edge"&&(s.addressMode="repeat",s.update()),i&&n.append(yp.copyFrom(i).invert()),n}var yp,xp,wb=g(()=>{Ke(),O(),Ps(),yp=new ve,xp=new R});function Tb(t,e){let{geometryData:r,batches:i}=e;i.length=0,r.indices.length=0,r.vertices.length=0,r.uvs.length=0;for(let n=0;n<t.instructions.length;n++){let s=t.instructions[n];if(s.action==="texture")Sb(s.data,i,r);else if(s.action==="fill"||s.action==="stroke"){let a=s.action==="stroke",o=s.data.path.shapePath,l=s.data.style,h=s.data.hole;a&&h&&bp(h.shapePath,l,!0,i,r),h&&(o.shapePrimitives[o.shapePrimitives.length-1].holes=h.shapePath.shapePrimitives),bp(o,l,a,i,r)}}}function Sb(t,e,r){let i=[],n=Ms.rectangle,s=wp;s.x=t.dx,s.y=t.dy,s.width=t.dw,s.height=t.dh;let a=t.transform;if(!n.build(s,i))return;let{vertices:o,uvs:l,indices:h}=r,u=h.length,c=o.length/2;a&&Qf(i,a),n.triangulate(i,o,2,c,h,u);let f=t.image,d=f.uvs;l.push(d.x0,d.y0,d.x1,d.y1,d.x3,d.y3,d.x2,d.y2);let _=Rt.get(Ka);_.indexOffset=u,_.indexSize=h.length-u,_.attributeOffset=c,_.attributeSize=o.length/2-c,_.baseColor=t.style,_.alpha=t.alpha,_.texture=f,_.geometryData=r,e.push(_)}function bp(t,e,r,i,n){let{vertices:s,uvs:a,indices:o}=n;t.shapePrimitives.forEach(({shape:l,transform:h,holes:u})=>{let c=[],f=Ms[l.type];if(!f.build(l,c))return;let d=o.length,_=s.length/2,v="triangle-list";if(h&&Qf(c,h),r){let P=l.closePath??!0,T=e;T.pixelLine?(Z0(c,P,s,o),v="line-list"):q0(c,T,!1,P,s,o)}else if(u){let P=[],T=c.slice();Eb(u).forEach(z=>{P.push(T.length/2),T.push(...z)}),cp(T,P,s,2,_,o,d)}else f.triangulate(c,s,2,_,o,d);let m=a.length/2,y=e.texture;if(y!==Fe.WHITE){let P=bb(Tp,e,l,h);H0(s,2,_,a,m,2,s.length/2-_,P)}else V0(a,m,2,s.length/2-_);let S=Rt.get(Ka);S.indexOffset=d,S.indexSize=o.length-d,S.attributeOffset=_,S.attributeSize=s.length/2-_,S.baseColor=e.color,S.alpha=e.alpha,S.texture=y,S.geometryData=n,S.topology=v,i.push(S)})}function Eb(t){let e=[];for(let r=0;r<t.length;r++){let i=t[r].shape,n=[];Ms[i.type].build(i,n)&&e.push(n)}return e}var Ms,wp,Tp,Cb=g(()=>{X(),Ke(),O(),j0(),W0(),Ft(),zt(),ep(),$0(),K0(),Q0(),_b(),vb(),yb(),wb(),dp(),Ms={},we.handleByMap(M.ShapeBuilder,Ms),we.add(gp,pp,mp,Wn,tp,rp),wp=new R,Tp=new ve}),Sp,Ep,eo,to,xh=g(()=>{X(),th(),Zf(),Hi(),Mt(),zt(),Cb(),Sp=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}},Ep=class{constructor(){this.instructions=new ii}init(t){this.batcher=new qa({maxTextures:t}),this.instructions.reset()}get geometry(){return Xe(jr,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},eo=class dd{constructor(e){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),this._renderer=e,e.renderableGC.addManagedHash(this,"_gpuContextHash"),e.renderableGC.addManagedHash(this,"_graphicsDataContextHash")}init(e){dd.defaultOptions.bezierSmoothness=e?.bezierSmoothness??dd.defaultOptions.bezierSmoothness}getContextRenderData(e){return this._graphicsDataContextHash[e.uid]||this._initContextRenderData(e)}updateGpuContext(e){let r=this._gpuContextHash[e.uid]||this._initContext(e);if(e.dirty){r?this._cleanGraphicsContextData(e):r=this._initContext(e),Tb(e,r);let i=e.batchMode;e.customShader||i==="no-batch"?r.isBatchable=!1:i==="auto"?r.isBatchable=r.geometryData.vertices.length<400:r.isBatchable=!0,e.dirty=!1}return r}getGpuContext(e){return this._gpuContextHash[e.uid]||this._initContext(e)}_initContextRenderData(e){let r=Rt.get(Ep,{maxTextures:this._renderer.limits.maxBatchableTextures}),{batches:i,geometryData:n}=this._gpuContextHash[e.uid],s=n.vertices.length,a=n.indices.length;for(let u=0;u<i.length;u++)i[u].applyTransform=!1;let o=r.batcher;o.ensureAttributeBuffer(s),o.ensureIndexBuffer(a),o.begin();for(let u=0;u<i.length;u++){let c=i[u];o.add(c)}o.finish(r.instructions);let l=o.geometry;l.indexBuffer.setDataWithSize(o.indexBuffer,o.indexSize,!0),l.buffers[0].setDataWithSize(o.attributeBuffer.float32View,o.attributeSize,!0);let h=o.batches;for(let u=0;u<h.length;u++){let c=h[u];c.bindGroup=Jl(c.textures.textures,c.textures.count,this._renderer.limits.maxBatchableTextures)}return this._graphicsDataContextHash[e.uid]=r,r}_initContext(e){let r=new Sp;return r.context=e,this._gpuContextHash[e.uid]=r,e.on("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[e.uid]}onGraphicsContextDestroy(e){this._cleanGraphicsContextData(e),e.off("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[e.uid]=null}_cleanGraphicsContextData(e){let r=this._gpuContextHash[e.uid];r.isBatchable||this._graphicsDataContextHash[e.uid]&&(Rt.return(this.getContextRenderData(e)),this._graphicsDataContextHash[e.uid]=null),r.batches&&r.batches.forEach(i=>{Rt.return(i)})}destroy(){for(let e in this._gpuContextHash)this._gpuContextHash[e]&&this.onGraphicsContextDestroy(this._gpuContextHash[e].context)}},eo.extension={type:[M.WebGLSystem,M.WebGPUSystem,M.CanvasSystem],name:"graphicsContext"},eo.defaultOptions={bezierSmoothness:.5},to=eo}),Cp,ro,io,no,so,ao,oo,lo,Nr,ci=g(()=>{"use strict";Cp={normal:0,add:1,multiply:2,screen:3,overlay:4,erase:5,"normal-npm":6,"add-npm":7,"screen-npm":8,min:9,max:10},ro=0,io=1,no=2,so=3,ao=4,oo=5,lo=class Gy{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<ro)}set blend(e){!!(this.data&1<<ro)!==e&&(this.data^=1<<ro)}get offsets(){return!!(this.data&1<<io)}set offsets(e){!!(this.data&1<<io)!==e&&(this.data^=1<<io)}set cullMode(e){if(e==="none"){this.culling=!1;return}this.culling=!0,this.clockwiseFrontFace=e==="front"}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return!!(this.data&1<<no)}set culling(e){!!(this.data&1<<no)!==e&&(this.data^=1<<no)}get depthTest(){return!!(this.data&1<<so)}set depthTest(e){!!(this.data&1<<so)!==e&&(this.data^=1<<so)}get depthMask(){return!!(this.data&1<<oo)}set depthMask(e){!!(this.data&1<<oo)!==e&&(this.data^=1<<oo)}get clockwiseFrontFace(){return!!(this.data&1<<ao)}set clockwiseFrontFace(e){!!(this.data&1<<ao)!==e&&(this.data^=1<<ao)}get blendMode(){return this._blendMode}set blendMode(e){this.blend=e!=="none",this._blendMode=e,this._blendModeId=Cp[e]||0}get polygonOffset(){return this._polygonOffset}set polygonOffset(e){this.offsets=!!e,this._polygonOffset=e}toString(){return`[pixi.js/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`}static for2d(){let e=new Gy;return e.depthTest=!1,e.blend=!0,e}},lo.default2d=lo.for2d(),Nr=lo});function Rs(t,e,r){let i=(t>>24&255)/255;e[r++]=(t&255)/255*i,e[r++]=(t>>8&255)/255*i,e[r++]=(t>>16&255)/255*i,e[r++]=i}var ks=g(()=>{"use strict"}),Ap,bh,Ab=g(()=>{X(),ci(),zt(),ks(),ep(),Ap=class{constructor(){this.batches=[],this.batched=!1}destroy(){this.batches.forEach(t=>{Rt.return(t)}),this.batches.length=0}},bh=class{constructor(t,e){this.state=Nr.for2d(),this.renderer=t,this._adaptor=e,this.renderer.runners.contextChange.add(this)}contextChange(){this._adaptor.contextChange(this.renderer)}validateRenderable(t){let e=t.context,r=!!t._gpuData,i=this.renderer.graphicsContext.updateGpuContext(e);return!!(i.isBatchable||r!==i.isBatchable)}addRenderable(t,e){let r=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),r.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t))}updateRenderable(t){let e=this._getGpuDataForRenderable(t).batches;for(let r=0;r<e.length;r++){let i=e[r];i._batcher.updateElement(i)}}execute(t){if(!t.isRenderable)return;let e=this.renderer,r=t.context;if(!e.graphicsContext.getGpuContext(r).batches.length)return;let i=r.customShader||this._adaptor.shader;this.state.blendMode=t.groupBlendMode;let n=i.resources.localUniforms.uniforms;n.uTransformMatrix=t.groupTransform,n.uRound=e._roundPixels|t._roundPixels,Rs(t.groupColorAlpha,n.uColor,0),this._adaptor.execute(this,t)}_rebuild(t){let e=this._getGpuDataForRenderable(t),r=this.renderer.graphicsContext.updateGpuContext(t.context);e.destroy(),r.isBatchable&&this._updateBatchesForRenderable(t,e)}_addToBatcher(t,e){let r=this.renderer.renderPipes.batch,i=this._getGpuDataForRenderable(t).batches;for(let n=0;n<i.length;n++){let s=i[n];r.addToBatch(s,e)}}_getGpuDataForRenderable(t){return t._gpuData[this.renderer.uid]||this._initGpuDataForRenderable(t)}_initGpuDataForRenderable(t){let e=new Ap;return t._gpuData[this.renderer.uid]=e,e}_updateBatchesForRenderable(t,e){let r=t.context,i=this.renderer.graphicsContext.getGpuContext(r),n=this.renderer._roundPixels|t._roundPixels;e.batches=i.batches.map(s=>{let a=Rt.get(Ka);return s.copyTo(a),a.renderable=t,a.roundPixels=n,a})}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null}},bh.extension={type:[M.WebGLPipes,M.WebGPUPipes,M.CanvasPipes],name:"graphics"}}),Pp=g(()=>{X(),xh(),Ab(),we.add(bh),we.add(to)}),ho,wh=g(()=>{"use strict";ho=class{constructor(){this.batcherName="default",this.packAsQuad=!1,this.indexOffset=0,this.attributeOffset=0,this.roundPixels=0,this._batcher=null,this._batch=null,this._textureMatrixUpdateId=-1,this._uvUpdateId=-1}get blendMode(){return this.renderable.groupBlendMode}get topology(){return this._topology||this.geometry.topology}set topology(t){this._topology=t}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.geometry=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}setTexture(t){this.texture!==t&&(this.texture=t,this._textureMatrixUpdateId=-1)}get uvs(){let t=this.geometry.getBuffer("aUV"),e=t.data,r=e,i=this.texture.textureMatrix;return i.isSimple||(r=this._transformedUvs,(this._textureMatrixUpdateId!==i._updateID||this._uvUpdateId!==t._updateID)&&((!r||r.length<e.length)&&(r=this._transformedUvs=new Float32Array(e.length)),this._textureMatrixUpdateId=i._updateID,this._uvUpdateId=t._updateID,i.multiplyUvs(e,r))),r}get positions(){return this.geometry.positions}get indices(){return this.geometry.indices}get color(){return this.renderable.groupColorAlpha}get groupTransform(){return this.renderable.groupTransform}get attributeSize(){return this.geometry.positions.length/2}get indexSize(){return this.geometry.indices.length}}}),Th,Sh,Pb=g(()=>{X(),Ke(),dn(),wr(),Ba(),ks(),wh(),Th=class{destroy(){}},Sh=class{constructor(t,e){this.localUniforms=new dr({uTransformMatrix:{value:new ve,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new li({0:this.localUniforms}),this.renderer=t,this._adaptor=e,this._adaptor.init()}validateRenderable(t){let e=this._getMeshData(t),r=e.batched,i=t.batched;if(e.batched=i,r!==i)return!0;if(i){let n=t._geometry;if(n.indices.length!==e.indexSize||n.positions.length!==e.vertexSize)return e.indexSize=n.indices.length,e.vertexSize=n.positions.length,!0;let s=this._getBatchableMesh(t);return s.texture.uid!==t._texture.uid&&(s._textureMatrixUpdateId=-1),!s._batcher.checkAndUpdateTexture(s,t._texture)}return!1}addRenderable(t,e){let r=this.renderer.renderPipes.batch,{batched:i}=this._getMeshData(t);if(i){let n=this._getBatchableMesh(t);n.setTexture(t._texture),n.geometry=t._geometry,r.addToBatch(n,e)}else r.break(e),e.add(t)}updateRenderable(t){if(t.batched){let e=this._getBatchableMesh(t);e.setTexture(t._texture),e.geometry=t._geometry,e._batcher.updateElement(e)}}execute(t){if(!t.isRenderable)return;t.state.blendMode=vs(t.groupBlendMode,t.texture._source);let e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),Rs(t.groupColorAlpha,e.uniforms.uColor,0),this._adaptor.execute(this,t)}_getMeshData(t){var e,r;return(e=t._gpuData)[r=this.renderer.uid]||(e[r]=new Th),t._gpuData[this.renderer.uid].meshData||this._initMeshData(t)}_initMeshData(t){return t._gpuData[this.renderer.uid].meshData={batched:t.batched,indexSize:t._geometry.indices?.length,vertexSize:t._geometry.positions?.length},t._gpuData[this.renderer.uid].meshData}_getBatchableMesh(t){var e,r;return(e=t._gpuData)[r=this.renderer.uid]||(e[r]=new Th),t._gpuData[this.renderer.uid].batchableMesh||this._initBatchableMesh(t)}_initBatchableMesh(t){let e=new ho;return e.renderable=t,e.setTexture(t._texture),e.transform=t.groupTransform,e.roundPixels=this.renderer._roundPixels|t._roundPixels,t._gpuData[this.renderer.uid].batchableMesh=e,e}destroy(){this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null}},Sh.extension={type:[M.WebGLPipes,M.WebGPUPipes,M.CanvasPipes],name:"mesh"}}),Mp=g(()=>{X(),Pb(),we.add(Sh)}),Rp,Mb=g(()=>{"use strict";Rp=class{execute(t,e){let r=t.state,i=t.renderer,n=e.shader||t.defaultShader;n.resources.uTexture=e.texture._source,n.resources.uniforms=t.localUniforms;let s=i.gl,a=t.getBuffers(e);i.shader.bind(n),i.state.set(r),i.geometry.bind(a.geometry,n.glProgram);let o=a.geometry.indexBuffer.data.BYTES_PER_ELEMENT===2?s.UNSIGNED_SHORT:s.UNSIGNED_INT;s.drawElements(s.TRIANGLES,e.particleChildren.length*6,o,0)}}});function kp(t,e=null){let r=t*6;if(r>65535?e||(e=new Uint32Array(r)):e||(e=new Uint16Array(r)),e.length!==r)throw new Error(`Out buffer length is incorrect, got ${e.length} and expected ${r}`);for(let i=0,n=0;i<r;i+=6,n+=4)e[i+0]=n+0,e[i+1]=n+1,e[i+2]=n+2,e[i+3]=n+0,e[i+4]=n+2,e[i+5]=n+3;return e}var Rb=g(()=>{"use strict"});function kb(t){return{dynamicUpdate:Bp(t,!0),staticUpdate:Bp(t,!1)}}function Bp(t,e){let r=[];r.push(`
|
|
|
|
var index = 0;
|
|
|
|
for (let i = 0; i < ps.length; ++i)
|
|
{
|
|
const p = ps[i];
|
|
|
|
`);let i=0;for(let s in t){let a=t[s];if(e!==a.dynamic)continue;r.push(`offset = index + ${i}`),r.push(a.code);let o=Yi(a.format);i+=o.stride/4}r.push(`
|
|
index += stride * 4;
|
|
}
|
|
`),r.unshift(`
|
|
var stride = ${i};
|
|
`);let n=r.join(`
|
|
`);return new Function("ps","f32v","u32v",n)}var Bb=g(()=>{Nn()});function Gb(t){let e=[];for(let r in t){let i=t[r];e.push(r,i.code,i.dynamic?"d":"s")}return e.join("_")}var Gp,Ib=g(()=>{gn(),Xi(),ys(),Nn(),ff(),Rb(),Bb(),Gp=class{constructor(t){this._size=0,this._generateParticleUpdateCache={};let e=this._size=t.size??1e3,r=t.properties,i=0,n=0;for(let h in r){let u=r[h],c=Yi(u.format);u.dynamic?n+=c.stride:i+=c.stride}this._dynamicStride=n/4,this._staticStride=i/4,this.staticAttributeBuffer=new fn(e*4*i),this.dynamicAttributeBuffer=new fn(e*4*n),this.indexBuffer=kp(e);let s=new Un,a=0,o=0;this._staticBuffer=new br({data:new Float32Array(1),label:"static-particle-buffer",shrinkToFit:!1,usage:ct.VERTEX|ct.COPY_DST}),this._dynamicBuffer=new br({data:new Float32Array(1),label:"dynamic-particle-buffer",shrinkToFit:!1,usage:ct.VERTEX|ct.COPY_DST});for(let h in r){let u=r[h],c=Yi(u.format);u.dynamic?(s.addAttribute(u.attributeName,{buffer:this._dynamicBuffer,stride:this._dynamicStride*4,offset:a*4,format:u.format}),a+=c.size):(s.addAttribute(u.attributeName,{buffer:this._staticBuffer,stride:this._staticStride*4,offset:o*4,format:u.format}),o+=c.size)}s.addIndex(this.indexBuffer);let l=this.getParticleUpdate(r);this._dynamicUpload=l.dynamicUpdate,this._staticUpload=l.staticUpdate,this.geometry=s}getParticleUpdate(t){let e=Gb(t);return this._generateParticleUpdateCache[e]?this._generateParticleUpdateCache[e]:(this._generateParticleUpdateCache[e]=this.generateParticleUpdate(t),this._generateParticleUpdateCache[e])}generateParticleUpdate(t){return kb(t)}update(t,e){t.length>this._size&&(e=!0,this._size=Math.max(t.length,this._size*1.5|0),this.staticAttributeBuffer=new fn(this._size*this._staticStride*4*4),this.dynamicAttributeBuffer=new fn(this._size*this._dynamicStride*4*4),this.indexBuffer=kp(this._size),this.geometry.indexBuffer.setDataWithSize(this.indexBuffer,this.indexBuffer.byteLength,!0));let r=this.dynamicAttributeBuffer;if(this._dynamicUpload(t,r.float32View,r.uint32View),this._dynamicBuffer.setDataWithSize(this.dynamicAttributeBuffer.float32View,t.length*this._dynamicStride*4,!0),e){let i=this.staticAttributeBuffer;this._staticUpload(t,i.float32View,i.uint32View),this._staticBuffer.setDataWithSize(i.float32View,t.length*this._staticStride*4,!0)}}destroy(){this._staticBuffer.destroy(),this._dynamicBuffer.destroy(),this.geometry.destroy()}}}),Ip,Ob=g(()=>{Ip=`varying vec2 vUV;
|
|
varying vec4 vColor;
|
|
|
|
uniform sampler2D uTexture;
|
|
|
|
void main(void){
|
|
vec4 color = texture2D(uTexture, vUV) * vColor;
|
|
gl_FragColor = color;
|
|
}`}),Op,Fb=g(()=>{Op=`attribute vec2 aVertex;
|
|
attribute vec2 aUV;
|
|
attribute vec4 aColor;
|
|
|
|
attribute vec2 aPosition;
|
|
attribute float aRotation;
|
|
|
|
uniform mat3 uTranslationMatrix;
|
|
uniform float uRound;
|
|
uniform vec2 uResolution;
|
|
uniform vec4 uColor;
|
|
|
|
varying vec2 vUV;
|
|
varying vec4 vColor;
|
|
|
|
vec2 roundPixels(vec2 position, vec2 targetSize)
|
|
{
|
|
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
|
|
}
|
|
|
|
void main(void){
|
|
float cosRotation = cos(aRotation);
|
|
float sinRotation = sin(aRotation);
|
|
float x = aVertex.x * cosRotation - aVertex.y * sinRotation;
|
|
float y = aVertex.x * sinRotation + aVertex.y * cosRotation;
|
|
|
|
vec2 v = vec2(x, y);
|
|
v = v + aPosition;
|
|
|
|
gl_Position = vec4((uTranslationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);
|
|
|
|
if(uRound == 1.0)
|
|
{
|
|
gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
|
|
}
|
|
|
|
vUV = aUV;
|
|
vColor = vec4(aColor.rgb * aColor.a, aColor.a) * uColor;
|
|
}
|
|
`}),Eh,Db=g(()=>{Eh=`
|
|
struct ParticleUniforms {
|
|
uProjectionMatrix:mat3x3<f32>,
|
|
uColor:vec4<f32>,
|
|
uResolution:vec2<f32>,
|
|
uRoundPixels:f32,
|
|
};
|
|
|
|
@group(0) @binding(0) var<uniform> uniforms: ParticleUniforms;
|
|
|
|
@group(1) @binding(0) var uTexture: texture_2d<f32>;
|
|
@group(1) @binding(1) var uSampler : sampler;
|
|
|
|
struct VSOutput {
|
|
@builtin(position) position: vec4<f32>,
|
|
@location(0) uv : vec2<f32>,
|
|
@location(1) color : vec4<f32>,
|
|
};
|
|
@vertex
|
|
fn mainVertex(
|
|
@location(0) aVertex: vec2<f32>,
|
|
@location(1) aPosition: vec2<f32>,
|
|
@location(2) aUV: vec2<f32>,
|
|
@location(3) aColor: vec4<f32>,
|
|
@location(4) aRotation: f32,
|
|
) -> VSOutput {
|
|
|
|
let v = vec2(
|
|
aVertex.x * cos(aRotation) - aVertex.y * sin(aRotation),
|
|
aVertex.x * sin(aRotation) + aVertex.y * cos(aRotation)
|
|
) + aPosition;
|
|
|
|
let position = vec4((uniforms.uProjectionMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);
|
|
|
|
let vColor = vec4(aColor.rgb * aColor.a, aColor.a) * uniforms.uColor;
|
|
|
|
return VSOutput(
|
|
position,
|
|
aUV,
|
|
vColor,
|
|
);
|
|
}
|
|
|
|
@fragment
|
|
fn mainFragment(
|
|
@location(0) uv: vec2<f32>,
|
|
@location(1) color: vec4<f32>,
|
|
@builtin(position) position: vec4<f32>,
|
|
) -> @location(0) vec4<f32> {
|
|
|
|
var sample = textureSample(uTexture, uSampler, uv) * color;
|
|
|
|
return sample;
|
|
}`}),Fp,Ub=g(()=>{ze(),Ke(),Ln(),bs(),hi(),Ft(),Rn(),Ob(),Fb(),Db(),Fp=class extends qr{constructor(){let t=mn.from({vertex:Op,fragment:Ip}),e=Hn.from({fragment:{source:Eh,entryPoint:"mainFragment"},vertex:{source:Eh,entryPoint:"mainVertex"}});super({glProgram:t,gpuProgram:e,resources:{uTexture:Fe.WHITE.source,uSampler:new ni({}),uniforms:{uTranslationMatrix:{value:new ve,type:"mat3x3<f32>"},uColor:{value:new le(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}})}}}),Ch,Dp=g(()=>{Ke(),wr(),Ba(),ci(),ks(),Ib(),Ub(),Ch=class{constructor(t,e){this.state=Nr.for2d(),this.localUniforms=new dr({uTranslationMatrix:{value:new ve,type:"mat3x3<f32>"},uColor:{value:new Float32Array(4),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}),this.renderer=t,this.adaptor=e,this.defaultShader=new Fp,this.state=Nr.for2d()}validateRenderable(t){return!1}addRenderable(t,e){this.renderer.renderPipes.batch.break(e),e.add(t)}getBuffers(t){return t._gpuData[this.renderer.uid]||this._initBuffer(t)}_initBuffer(t){return t._gpuData[this.renderer.uid]=new Gp({size:t.particleChildren.length,properties:t._properties}),t._gpuData[this.renderer.uid]}updateRenderable(t){}execute(t){let e=t.particleChildren;if(e.length===0)return;let r=this.renderer,i=this.getBuffers(t);t.texture||(t.texture=e[0].texture);let n=this.state;i.update(e,t._childrenDirty),t._childrenDirty=!1,n.blendMode=vs(t.blendMode,t.texture._source);let s=this.localUniforms.uniforms,a=s.uTranslationMatrix;t.worldTransform.copyTo(a),a.prepend(r.globalUniforms.globalUniformData.projectionMatrix),s.uResolution=r.globalUniforms.globalUniformData.resolution,s.uRound=r._roundPixels|t._roundPixels,Rs(t.groupColorAlpha,s.uColor,0),this.adaptor.execute(this,t)}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}}),Ah,Lb=g(()=>{X(),Mb(),Dp(),Ah=class extends Ch{constructor(t){super(t,new Rp)}},Ah.extension={type:[M.WebGLPipes],name:"particle"}}),Up,Nb=g(()=>{"use strict";Up=class{execute(t,e){let r=t.renderer,i=e.shader||t.defaultShader;i.groups[0]=r.renderPipes.uniformBatch.getUniformBindGroup(t.localUniforms,!0),i.groups[1]=r.texture.getTextureBindGroup(e.texture);let n=t.state,s=t.getBuffers(e);r.encoder.draw({geometry:s.geometry,shader:e.shader||t.defaultShader,state:n,size:e.particleChildren.length*6})}}}),Ph,zb=g(()=>{X(),Nb(),Dp(),Ph=class extends Ch{constructor(t){super(t,new Up)}},Ph.extension={type:[M.WebGPUPipes],name:"particle"}}),Lp=g(()=>{X(),Lb(),zb(),we.add(Ah),we.add(Ph)});function Mh(t,e){let{texture:r,bounds:i}=t,n=e._style._getFinalPadding();Jd(i,e._anchor,r);let s=e._anchor._x*n*2,a=e._anchor._y*n*2;i.minX-=n-s,i.minY-=n-a,i.maxX-=n-s,i.maxY-=n-a}var Np=g(()=>{ef()}),Bs,uo=g(()=>{"use strict";Bs=class{constructor(){this.batcherName="default",this.topology="triangle-list",this.attributeSize=4,this.indexSize=6,this.packAsQuad=!0,this.roundPixels=0,this._attributeStart=0,this._batcher=null,this._batch=null}get blendMode(){return this.renderable.groupBlendMode}get color(){return this.renderable.groupColorAlpha}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.bounds=null}destroy(){}}}),zp,Hb=g(()=>{uo(),zp=class extends Bs{constructor(t){super(),this._renderer=t,t.runners.resolutionChange.add(this)}resolutionChange(){let t=this.renderable;t._autoResolution&&t.onViewUpdate()}destroy(){this._renderer.canvasText.returnTexture(this.texture),this._renderer=null}}}),Rh,Vb=g(()=>{X(),Np(),Hb(),Rh=class{constructor(t){this._renderer=t}validateRenderable(t){return t._didTextUpdate}addRenderable(t,e){let r=this._getGpuText(t);t._didTextUpdate&&(this._updateGpuText(t),t._didTextUpdate=!1),this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){let e=this._getGpuText(t);e._batcher.updateElement(e)}_updateGpuText(t){let e=this._getGpuText(t);e.texture&&this._renderer.canvasText.returnTexture(e.texture),t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,e.texture=e.texture=this._renderer.canvasText.getTexture(t),Mh(e,t)}_getGpuText(t){return t._gpuData[this._renderer.uid]||this.initGpuText(t)}initGpuText(t){let e=new zp(this._renderer);return e.renderable=t,e.transform=t.groupTransform,e.bounds={minX:0,maxX:1,minY:0,maxY:0},e.roundPixels=this._renderer._roundPixels|t._roundPixels,t._gpuData[this._renderer.uid]=e,e}destroy(){this._renderer=null}},Rh.extension={type:[M.WebGLPipes,M.WebGPUPipes,M.CanvasPipes],name:"text"}}),kh,Gs,Bh=g(()=>{Ke(),Ot(),kh={repeat:{addressModeU:"repeat",addressModeV:"repeat"},"repeat-x":{addressModeU:"repeat",addressModeV:"clamp-to-edge"},"repeat-y":{addressModeU:"clamp-to-edge",addressModeV:"repeat"},"no-repeat":{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}},Gs=class{constructor(t,e){this.uid=ot("fillPattern"),this.transform=new ve,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=kh[e].addressModeU,t.source.style.addressModeV=kh[e].addressModeV)}setTransform(t){let e=this.texture;this.transform.copyFrom(t),this.transform.invert(),this.transform.scale(1/e.frame.width,1/e.frame.height),this._styleKey=null}get styleKey(){return this._styleKey?this._styleKey:(this._styleKey=`fill-pattern-${this.uid}-${this.texture.uid}-${this.transform.toArray().join("-")}`,this._styleKey)}}}),jb=cr((t,e)=>{e.exports=n;var r={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},i=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function n(o){var l=[];return o.replace(i,function(h,u,c){var f=u.toLowerCase();for(c=a(c),f=="m"&&c.length>2&&(l.push([u].concat(c.splice(0,2))),f="l",u=u=="m"?"l":"L");;){if(c.length==r[f])return c.unshift(u),l.push(c);if(c.length<r[f])throw new Error("malformed path data");l.push([u].concat(c.splice(0,r[f])))}}),l}var s=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function a(o){var l=o.match(s);return l?l.map(Number):[]}});function Wb(t,e){let r=(0,Hp.default)(t),i=[],n=null,s=0,a=0;for(let o=0;o<r.length;o++){let l=r[o],h=l[0],u=l;switch(h){case"M":s=u[1],a=u[2],e.moveTo(s,a);break;case"m":s+=u[1],a+=u[2],e.moveTo(s,a);break;case"H":s=u[1],e.lineTo(s,a);break;case"h":s+=u[1],e.lineTo(s,a);break;case"V":a=u[1],e.lineTo(s,a);break;case"v":a+=u[1],e.lineTo(s,a);break;case"L":s=u[1],a=u[2],e.lineTo(s,a);break;case"l":s+=u[1],a+=u[2],e.lineTo(s,a);break;case"C":s=u[5],a=u[6],e.bezierCurveTo(u[1],u[2],u[3],u[4],s,a);break;case"c":e.bezierCurveTo(s+u[1],a+u[2],s+u[3],a+u[4],s+u[5],a+u[6]),s+=u[5],a+=u[6];break;case"S":s=u[3],a=u[4],e.bezierCurveToShort(u[1],u[2],s,a);break;case"s":e.bezierCurveToShort(s+u[1],a+u[2],s+u[3],a+u[4]),s+=u[3],a+=u[4];break;case"Q":s=u[3],a=u[4],e.quadraticCurveTo(u[1],u[2],s,a);break;case"q":e.quadraticCurveTo(s+u[1],a+u[2],s+u[3],a+u[4]),s+=u[3],a+=u[4];break;case"T":s=u[1],a=u[2],e.quadraticCurveToShort(s,a);break;case"t":s+=u[1],a+=u[2],e.quadraticCurveToShort(s,a);break;case"A":s=u[6],a=u[7],e.arcToSvg(u[1],u[2],u[3],u[4],u[5],s,a);break;case"a":s+=u[6],a+=u[7],e.arcToSvg(u[1],u[2],u[3],u[4],u[5],s,a);break;case"Z":case"z":e.closePath(),i.length>0&&(n=i.pop(),n?(s=n.startX,a=n.startY):(s=0,a=0)),n=null;break;default:Ye(`Unknown SVG path command: ${h}`)}h!=="Z"&&h!=="z"&&n===null&&(n={startX:s,startY:a},i.push(n))}return e}var Hp,$b=g(()=>{Hp=nr(jb(),1),wt()}),Gh,Vp=g(()=>{O(),Gh=class Iy{constructor(e=0,r=0,i=0){this.type="circle",this.x=e,this.y=r,this.radius=i}clone(){return new Iy(this.x,this.y,this.radius)}contains(e,r){if(this.radius<=0)return!1;let i=this.radius*this.radius,n=this.x-e,s=this.y-r;return n*=n,s*=s,n+s<=i}strokeContains(e,r,i,n=.5){if(this.radius===0)return!1;let s=this.x-e,a=this.y-r,o=this.radius,l=(1-n)*i,h=Math.sqrt(s*s+a*a);return h<=o+l&&h>o-(i-l)}getBounds(e){return e||(e=new R),e.x=this.x-this.radius,e.y=this.y-this.radius,e.width=this.radius*2,e.height=this.radius*2,e}copyFrom(e){return this.x=e.x,this.y=e.y,this.radius=e.radius,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}}),jp,Xb=g(()=>{O(),jp=class Oy{constructor(e=0,r=0,i=0,n=0){this.type="ellipse",this.x=e,this.y=r,this.halfWidth=i,this.halfHeight=n}clone(){return new Oy(this.x,this.y,this.halfWidth,this.halfHeight)}contains(e,r){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let i=(e-this.x)/this.halfWidth,n=(r-this.y)/this.halfHeight;return i*=i,n*=n,i+n<=1}strokeContains(e,r,i,n=.5){let{halfWidth:s,halfHeight:a}=this;if(s<=0||a<=0)return!1;let o=i*(1-n),l=i-o,h=s-l,u=a-l,c=s+o,f=a+o,d=e-this.x,_=r-this.y,v=d*d/(h*h)+_*_/(u*u),m=d*d/(c*c)+_*_/(f*f);return v>1&&m<=1}getBounds(e){return e||(e=new R),e.x=this.x-this.halfWidth,e.y=this.y-this.halfHeight,e.width=this.halfWidth*2,e.height=this.halfHeight*2,e}copyFrom(e){return this.x=e.x,this.y=e.y,this.halfWidth=e.halfWidth,this.halfHeight=e.halfHeight,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}});function Yb(t,e,r,i,n,s){let a=t-r,o=e-i,l=n-r,h=s-i,u=a*l+o*h,c=l*l+h*h,f=-1;c!==0&&(f=u/c);let d,_;f<0?(d=r,_=i):f>1?(d=n,_=s):(d=r+f*l,_=i+f*h);let v=t-d,m=e-_;return v*v+m*m}var qb=g(()=>{"use strict"}),Kb,Zb,co,Qb=g(()=>{Mt(),qb(),O(),co=class Fy{constructor(...e){this.type="polygon";let r=Array.isArray(e[0])?e[0]:e;if(typeof r[0]!="number"){let i=[];for(let n=0,s=r.length;n<s;n++)i.push(r[n].x,r[n].y);r=i}this.points=r,this.closePath=!0}isClockwise(){let e=0,r=this.points,i=r.length;for(let n=0;n<i;n+=2){let s=r[n],a=r[n+1],o=r[(n+2)%i],l=r[(n+3)%i];e+=(o-s)*(l+a)}return e<0}containsPolygon(e){let r=this.getBounds(Kb),i=e.getBounds(Zb);if(!r.containsRect(i))return!1;let n=e.points;for(let s=0;s<n.length;s+=2){let a=n[s],o=n[s+1];if(!this.contains(a,o))return!1}return!0}clone(){let e=this.points.slice(),r=new Fy(e);return r.closePath=this.closePath,r}contains(e,r){let i=!1,n=this.points.length/2;for(let s=0,a=n-1;s<n;a=s++){let o=this.points[s*2],l=this.points[s*2+1],h=this.points[a*2],u=this.points[a*2+1];l>r!=u>r&&e<(h-o)*((r-l)/(u-l))+o&&(i=!i)}return i}strokeContains(e,r,i,n=.5){let s=i*i,a=s*(1-n),o=s-a,{points:l}=this,h=l.length-(this.closePath?0:2);for(let u=0;u<h;u+=2){let c=l[u],f=l[u+1],d=l[(u+2)%l.length],_=l[(u+3)%l.length],v=Yb(e,r,c,f,d,_),m=Math.sign((d-c)*(r-f)-(_-f)*(e-c));if(v<=(m<0?o:a))return!0}return!1}getBounds(e){e||(e=new R);let r=this.points,i=1/0,n=-1/0,s=1/0,a=-1/0;for(let o=0,l=r.length;o<l;o+=2){let h=r[o],u=r[o+1];i=h<i?h:i,n=h>n?h:n,s=u<s?u:s,a=u>a?u:a}return e.x=i,e.width=n-i,e.y=s,e.height=a-s,e}copyFrom(e){return this.points=e.points.slice(),this.closePath=e.closePath,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((e,r)=>`${e}, ${r}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return Xe("8.11.0","Polygon.lastX is deprecated, please use Polygon.lastX instead."),this.points[this.points.length-2]}get y(){return Xe("8.11.0","Polygon.y is deprecated, please use Polygon.lastY instead."),this.points[this.points.length-1]}get startX(){return this.points[0]}get startY(){return this.points[1]}}}),Is,Wp,Jb=g(()=>{O(),Is=(t,e,r,i,n,s,a)=>{let o=t-r,l=e-i,h=Math.sqrt(o*o+l*l);return h>=n-s&&h<=n+a},Wp=class Dy{constructor(e=0,r=0,i=0,n=0,s=20){this.type="roundedRectangle",this.x=e,this.y=r,this.width=i,this.height=n,this.radius=s}getBounds(e){return e||(e=new R),e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e}clone(){return new Dy(this.x,this.y,this.width,this.height,this.radius)}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.copyFrom(this),e}contains(e,r){if(this.width<=0||this.height<=0)return!1;if(e>=this.x&&e<=this.x+this.width&&r>=this.y&&r<=this.y+this.height){let i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(r>=this.y+i&&r<=this.y+this.height-i||e>=this.x+i&&e<=this.x+this.width-i)return!0;let n=e-(this.x+i),s=r-(this.y+i),a=i*i;if(n*n+s*s<=a||(n=e-(this.x+this.width-i),n*n+s*s<=a)||(s=r-(this.y+this.height-i),n*n+s*s<=a)||(n=e-(this.x+i),n*n+s*s<=a))return!0}return!1}strokeContains(e,r,i,n=.5){let{x:s,y:a,width:o,height:l,radius:h}=this,u=i*(1-n),c=i-u,f=s+h,d=a+h,_=o-h*2,v=l-h*2,m=s+o,y=a+l;return(e>=s-u&&e<=s+c||e>=m-c&&e<=m+u)&&r>=d&&r<=d+v||(r>=a-u&&r<=a+c||r>=y-c&&r<=y+u)&&e>=f&&e<=f+_?!0:e<f&&r<d&&Is(e,r,f,d,h,c,u)||e>m-h&&r<d&&Is(e,r,m-h,d,h,c,u)||e>m-h&&r>y-h&&Is(e,r,m-h,y-h,h,c,u)||e<f&&r>y-h&&Is(e,r,f,y-h,h,c,u)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}});function $p(t,e,r,i,n,s,a,o,l,h){let u=Math.min(.99,Math.max(0,h??to.defaultOptions.bezierSmoothness)),c=(Yp-u)/1;return c*=c,e1(e,r,i,n,s,a,o,l,t,c),t}function e1(t,e,r,i,n,s,a,o,l,h){Ih(t,e,r,i,n,s,a,o,l,h,0),l.push(a,o)}function Ih(t,e,r,i,n,s,a,o,l,h,u){if(u>Xp)return;let c=Math.PI,f=(t+r)/2,d=(e+i)/2,_=(r+n)/2,v=(i+s)/2,m=(n+a)/2,y=(s+o)/2,S=(f+_)/2,P=(d+v)/2,T=(_+m)/2,z=(v+y)/2,D=(S+T)/2,L=(P+z)/2;if(u>0){let ne=a-t,ue=o-e,re=Math.abs((r-a)*ue-(i-o)*ne),oe=Math.abs((n-a)*ue-(s-o)*ne),Be,Ze;if(re>Os&&oe>Os){if((re+oe)*(re+oe)<=h*(ne*ne+ue*ue)){if(bn<fo){l.push(D,L);return}let I=Math.atan2(s-i,n-r);if(Be=Math.abs(I-Math.atan2(i-e,r-t)),Ze=Math.abs(Math.atan2(o-s,a-n)-I),Be>=c&&(Be=2*c-Be),Ze>=c&&(Ze=2*c-Ze),Be+Ze<bn){l.push(D,L);return}if(Ki!==0){if(Be>Ki){l.push(r,i);return}if(Ze>Ki){l.push(n,s);return}}}}else if(re>Os){if(re*re<=h*(ne*ne+ue*ue)){if(bn<fo){l.push(D,L);return}if(Be=Math.abs(Math.atan2(s-i,n-r)-Math.atan2(i-e,r-t)),Be>=c&&(Be=2*c-Be),Be<bn){l.push(r,i),l.push(n,s);return}if(Ki!==0&&Be>Ki){l.push(r,i);return}}}else if(oe>Os){if(oe*oe<=h*(ne*ne+ue*ue)){if(bn<fo){l.push(D,L);return}if(Be=Math.abs(Math.atan2(o-s,a-n)-Math.atan2(s-i,n-r)),Be>=c&&(Be=2*c-Be),Be<bn){l.push(r,i),l.push(n,s);return}if(Ki!==0&&Be>Ki){l.push(n,s);return}}}else if(ne=D-(t+a)/2,ue=L-(e+o)/2,ne*ne+ue*ue<=h){l.push(D,L);return}}Ih(t,e,f,d,S,P,D,L,l,h,u+1),Ih(D,L,T,z,m,y,a,o,l,h,u+1)}var Xp,Os,Yp,fo,bn,Ki,qp=g(()=>{xh(),Xp=8,Os=11920929e-14,Yp=1,fo=.01,bn=0,Ki=0});function t1(t,e,r,i,n,s,a,o){let l=Math.min(.99,Math.max(0,o??to.defaultOptions.bezierSmoothness)),h=(Qp-l)/1;return h*=h,r1(e,r,i,n,s,a,t,h),t}function r1(t,e,r,i,n,s,a,o){Oh(a,t,e,r,i,n,s,o,0),a.push(n,s)}function Oh(t,e,r,i,n,s,a,o,l){if(l>Kp)return;let h=Math.PI,u=(e+i)/2,c=(r+n)/2,f=(i+s)/2,d=(n+a)/2,_=(u+f)/2,v=(c+d)/2,m=s-e,y=a-r,S=Math.abs((i-s)*y-(n-a)*m);if(S>Zp){if(S*S<=o*(m*m+y*y)){if(Fh<Jp){t.push(_,v);return}let P=Math.abs(Math.atan2(a-n,s-i)-Math.atan2(n-r,i-e));if(P>=h&&(P=2*h-P),P<Fh){t.push(_,v);return}}}else if(m=_-(e+s)/2,y=v-(r+a)/2,m*m+y*y<=o){t.push(_,v);return}Oh(t,e,r,u,c,_,v,o,l+1),Oh(t,_,v,f,d,s,a,o,l+1)}var Kp,Zp,Qp,Jp,Fh,i1=g(()=>{xh(),Kp=8,Zp=11920929e-14,Qp=1,Jp=.01,Fh=0});function eg(t,e,r,i,n,s,a,o){let l=Math.abs(n-s);(!a&&n>s||a&&s>n)&&(l=2*Math.PI-l),o||(o=Math.max(6,Math.floor(6*Math.pow(i,1/3)*(l/Math.PI)))),o=Math.max(o,3);let h=l/o,u=n;h*=a?-1:1;for(let c=0;c<o+1;c++){let f=Math.cos(u),d=Math.sin(u),_=e+f*i,v=r+d*i;t.push(_,v),u+=h}}var tg=g(()=>{"use strict"});function n1(t,e,r,i,n,s){let a=t[t.length-2],o=t[t.length-1]-r,l=a-e,h=n-r,u=i-e,c=Math.abs(o*u-l*h);if(c<1e-8||s===0){(t[t.length-2]!==e||t[t.length-1]!==r)&&t.push(e,r);return}let f=o*o+l*l,d=h*h+u*u,_=o*h+l*u,v=s*Math.sqrt(f)/c,m=s*Math.sqrt(d)/c,y=v*_/f,S=m*_/d,P=v*u+m*l,T=v*h+m*o,z=l*(m+y),D=o*(m+y),L=u*(v+S),ne=h*(v+S),ue=Math.atan2(D-T,z-P),re=Math.atan2(ne-T,L-P);eg(t,P+e,T+r,s,ue,re,l*h>u*o)}var s1=g(()=>{tg()});function a1(t,e){let r=e===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(e/4),i=e===1.5707963267948966?.551915024494:r,n=Math.cos(t),s=Math.sin(t),a=Math.cos(t+e),o=Math.sin(t+e);return[{x:n-s*i,y:s+n*i},{x:a+o*i,y:o-a*i},{x:a,y:o}]}function o1(t,e,r,i,n,s,a,o=0,l=0,h=0){if(s===0||a===0)return;let u=Math.sin(o*Xn/360),c=Math.cos(o*Xn/360),f=c*(e-i)/2+u*(r-n)/2,d=-u*(e-i)/2+c*(r-n)/2;if(f===0&&d===0)return;s=Math.abs(s),a=Math.abs(a);let _=Math.pow(f,2)/Math.pow(s,2)+Math.pow(d,2)/Math.pow(a,2);_>1&&(s*=Math.sqrt(_),a*=Math.sqrt(_)),rg(e,r,i,n,s,a,l,h,u,c,f,d,po);let{ang1:v,ang2:m}=po,{centerX:y,centerY:S}=po,P=Math.abs(m)/(Xn/4);Math.abs(1-P)<1e-7&&(P=1);let T=Math.max(Math.ceil(P),1);m/=T;let z=t[t.length-2],D=t[t.length-1],L={x:0,y:0};for(let ne=0;ne<T;ne++){let ue=a1(v,m),{x:re,y:oe}=go(ue[0],s,a,c,u,y,S,L),{x:Be,y:Ze}=go(ue[1],s,a,c,u,y,S,L),{x:I,y:Me}=go(ue[2],s,a,c,u,y,S,L);$p(t,z,D,re,oe,Be,Ze,I,Me),z=I,D=Me,v+=m}}var Xn,po,go,Dh,rg,l1=g(()=>{qp(),Xn=Math.PI*2,po={centerX:0,centerY:0,ang1:0,ang2:0},go=({x:t,y:e},r,i,n,s,a,o,l)=>{t*=r,e*=i;let h=n*t-s*e,u=s*t+n*e;return l.x=h+a,l.y=u+o,l},Dh=(t,e,r,i)=>{let n=t*i-e*r<0?-1:1,s=t*r+e*i;return s>1&&(s=1),s<-1&&(s=-1),n*Math.acos(s)},rg=(t,e,r,i,n,s,a,o,l,h,u,c,f)=>{let d=Math.pow(n,2),_=Math.pow(s,2),v=Math.pow(u,2),m=Math.pow(c,2),y=d*_-d*m-_*v;y<0&&(y=0),y/=d*m+_*v,y=Math.sqrt(y)*(a===o?-1:1);let S=y*n/s*c,P=y*-s/n*u,T=h*S-l*P+(t+r)/2,z=l*S+h*P+(e+i)/2,D=(u-S)/n,L=(c-P)/s,ne=(-u-S)/n,ue=(-c-P)/s,re=Dh(1,0,D,L),oe=Dh(D,L,ne,ue);o===0&&oe>0&&(oe-=Xn),o===1&&oe<0&&(oe+=Xn),f.centerX=T,f.centerY=z,f.ang1=re,f.ang2=oe}});function h1(t,e,r){let i=(a,o)=>{let l=o.x-a.x,h=o.y-a.y,u=Math.sqrt(l*l+h*h),c=l/u,f=h/u;return{len:u,nx:c,ny:f}},n=(a,o)=>{a===0?t.moveTo(o.x,o.y):t.lineTo(o.x,o.y)},s=e[e.length-1];for(let a=0;a<e.length;a++){let o=e[a%e.length],l=o.radius??r;if(l<=0){n(a,o),s=o;continue}let h=e[(a+1)%e.length],u=i(o,s),c=i(o,h);if(u.len<1e-4||c.len<1e-4){n(a,o),s=o;continue}let f=Math.asin(u.nx*c.ny-u.ny*c.nx),d=1,_=!1;u.nx*c.nx-u.ny*-c.ny<0?f<0?f=Math.PI+f:(f=Math.PI-f,d=-1,_=!0):f>0&&(d=-1,_=!0);let v=f/2,m,y=Math.abs(Math.cos(v)*l/Math.sin(v));y>Math.min(u.len/2,c.len/2)?(y=Math.min(u.len/2,c.len/2),m=Math.abs(y*Math.sin(v)/Math.cos(v))):m=l;let S=o.x+c.nx*y+-c.ny*m*d,P=o.y+c.ny*y+c.nx*m*d,T=Math.atan2(u.ny,u.nx)+Math.PI/2*d,z=Math.atan2(c.ny,c.nx)-Math.PI/2*d;a===0&&t.moveTo(S+Math.cos(T)*m,P+Math.sin(T)*m),t.arc(S,P,m,T,z,_),s=o}}function u1(t,e,r,i){let n=(o,l)=>Math.sqrt((o.x-l.x)**2+(o.y-l.y)**2),s=(o,l,h)=>({x:o.x+(l.x-o.x)*h,y:o.y+(l.y-o.y)*h}),a=e.length;for(let o=0;o<a;o++){let l=e[(o+1)%a],h=l.radius??r;if(h<=0){o===0?t.moveTo(l.x,l.y):t.lineTo(l.x,l.y);continue}let u=e[o],c=e[(o+2)%a],f=n(u,l),d;if(f<1e-4)d=l;else{let m=Math.min(f/2,h);d=s(l,u,m/f)}let _=n(c,l),v;if(_<1e-4)v=l;else{let m=Math.min(_/2,h);v=s(l,c,m/_)}o===0?t.moveTo(d.x,d.y):t.lineTo(d.x,d.y),t.quadraticCurveTo(l.x,l.y,v.x,v.y,i)}}var c1=g(()=>{"use strict"}),ig,ng,d1=g(()=>{Vp(),Xb(),Qb(),O(),Jb(),se(),qp(),i1(),tg(),s1(),l1(),c1(),ig=new R,ng=class{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new $,this._graphicsPath2D=t,this.signed=t.checkForHoles}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();let r=this._currentPoly.points,i=r[r.length-2],n=r[r.length-1];return(i!==t||n!==e)&&r.push(t,e),this}arc(t,e,r,i,n,s){this._ensurePoly(!1);let a=this._currentPoly.points;return eg(a,t,e,r,i,n,s),this}arcTo(t,e,r,i,n){this._ensurePoly();let s=this._currentPoly.points;return n1(s,t,e,r,i,n),this}arcToSvg(t,e,r,i,n,s,a){let o=this._currentPoly.points;return o1(o,this._currentPoly.lastX,this._currentPoly.lastY,s,a,t,e,r,i,n),this}bezierCurveTo(t,e,r,i,n,s,a){this._ensurePoly();let o=this._currentPoly;return $p(this._currentPoly.points,o.lastX,o.lastY,t,e,r,i,n,s,a),this}quadraticCurveTo(t,e,r,i,n){this._ensurePoly();let s=this._currentPoly;return t1(this._currentPoly.points,s.lastX,s.lastY,t,e,r,i,n),this}closePath(){return this.endPoly(!0),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(!0),t.transform(e));let r=this.shapePrimitives,i=r.length;for(let n=0;n<t.instructions.length;n++){let s=t.instructions[n];this[s.action](...s.data)}if(t.checkForHoles&&r.length-i>1){let n=null;for(let s=i;s<r.length;s++){let a=r[s];if(a.shape.type==="polygon"){let o=a.shape,l=n?.shape;l&&l.containsPolygon(o)?(n.holes||(n.holes=[]),n.holes.push(a),r.copyWithin(s,s+1),r.length--,s--):n=a}}}return this}finish(t=!1){this.endPoly(t)}rect(t,e,r,i,n){return this.drawShape(new R(t,e,r,i),n),this}circle(t,e,r,i){return this.drawShape(new Gh(t,e,r),i),this}poly(t,e,r){let i=new co(t);return i.closePath=e,this.drawShape(i,r),this}regularPoly(t,e,r,i,n=0,s){i=Math.max(i|0,3);let a=-1*Math.PI/2+n,o=Math.PI*2/i,l=[];for(let h=0;h<i;h++){let u=a-h*o;l.push(t+r*Math.cos(u),e+r*Math.sin(u))}return this.poly(l,!0,s),this}roundPoly(t,e,r,i,n,s=0,a){if(i=Math.max(i|0,3),n<=0)return this.regularPoly(t,e,r,i,s);let o=r*Math.sin(Math.PI/i)-.001;n=Math.min(n,o);let l=-1*Math.PI/2+s,h=Math.PI*2/i,u=(i-2)*Math.PI/i/2;for(let c=0;c<i;c++){let f=c*h+l,d=t+r*Math.cos(f),_=e+r*Math.sin(f),v=f+Math.PI+u,m=f-Math.PI-u,y=d+n*Math.cos(v),S=_+n*Math.sin(v),P=d+n*Math.cos(m),T=_+n*Math.sin(m);c===0?this.moveTo(y,S):this.lineTo(y,S),this.quadraticCurveTo(d,_,P,T,a)}return this.closePath()}roundShape(t,e,r=!1,i){return t.length<3?this:(r?u1(this,t,e,i):h1(this,t,e),this.closePath())}filletRect(t,e,r,i,n){if(n===0)return this.rect(t,e,r,i);let s=Math.min(r,i)/2,a=Math.min(s,Math.max(-s,n)),o=t+r,l=e+i,h=a<0?-a:0,u=Math.abs(a);return this.moveTo(t,e+u).arcTo(t+h,e+h,t+u,e,u).lineTo(o-u,e).arcTo(o-h,e+h,o,e+u,u).lineTo(o,l-u).arcTo(o-h,l-h,t+r-u,l,u).lineTo(t+u,l).arcTo(t+h,l-h,t,l-u,u).closePath()}chamferRect(t,e,r,i,n,s){if(n<=0)return this.rect(t,e,r,i);let a=Math.min(n,Math.min(r,i)/2),o=t+r,l=e+i,h=[t+a,e,o-a,e,o,e+a,o,l-a,o-a,l,t+a,l,t,l-a,t,e+a];for(let u=h.length-1;u>=2;u-=2)h[u]===h[u-2]&&h[u-1]===h[u-3]&&h.splice(u-1,2);return this.poly(h,!0,s)}ellipse(t,e,r,i,n){return this.drawShape(new jp(t,e,r,i),n),this}roundRect(t,e,r,i,n,s){return this.drawShape(new Wp(t,e,r,i,n),s),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let r=this._currentPoly;return r&&this.endPoly(),r=new co,r.points.push(t,e),this._currentPoly=r,this}endPoly(t=!1){let e=this._currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this._currentPoly=null,this}_ensurePoly(t=!0){if(!this._currentPoly&&(this._currentPoly=new co,t)){let e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let r=e.shape.x,i=e.shape.y;if(e.transform&&!e.transform.isIdentity()){let n=e.transform,s=r;r=n.a*r+n.c*i+n.tx,i=n.b*s+n.d*i+n.ty}this._currentPoly.points.push(r,i)}else this._currentPoly.points.push(0,0)}}buildPath(){let t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;e<t.instructions.length;e++){let r=t.instructions[e];this[r.action](...r.data)}this.finish()}get bounds(){let t=this._bounds;t.clear();let e=this.shapePrimitives;for(let r=0;r<e.length;r++){let i=e[r],n=i.shape.getBounds(ig);i.transform?t.addRect(n,i.transform):t.addRect(n)}return t}}});function Fs(t,e){return t?t.prepend(e):e.clone()}var Ds,sg=g(()=>{He(),Ot(),wt(),$b(),d1(),Ds=class Uy{constructor(e,r=!1){this.instructions=[],this.uid=ot("graphicsPath"),this._dirty=!0,this.checkForHoles=r,typeof e=="string"?Wb(e,this):this.instructions=e?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new ng(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(e,r){return e=e.clone(),this.instructions.push({action:"addPath",data:[e,r]}),this._dirty=!0,this}arc(...e){return this.instructions.push({action:"arc",data:e}),this._dirty=!0,this}arcTo(...e){return this.instructions.push({action:"arcTo",data:e}),this._dirty=!0,this}arcToSvg(...e){return this.instructions.push({action:"arcToSvg",data:e}),this._dirty=!0,this}bezierCurveTo(...e){return this.instructions.push({action:"bezierCurveTo",data:e}),this._dirty=!0,this}bezierCurveToShort(e,r,i,n,s){let a=this.instructions[this.instructions.length-1],o=this.getLastPoint(ye.shared),l=0,h=0;if(!a||a.action!=="bezierCurveTo")l=o.x,h=o.y;else{l=a.data[2],h=a.data[3];let u=o.x,c=o.y;l=u+(u-l),h=c+(c-h)}return this.instructions.push({action:"bezierCurveTo",data:[l,h,e,r,i,n,s]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...e){return this.instructions.push({action:"ellipse",data:e}),this._dirty=!0,this}lineTo(...e){return this.instructions.push({action:"lineTo",data:e}),this._dirty=!0,this}moveTo(...e){return this.instructions.push({action:"moveTo",data:e}),this}quadraticCurveTo(...e){return this.instructions.push({action:"quadraticCurveTo",data:e}),this._dirty=!0,this}quadraticCurveToShort(e,r,i){let n=this.instructions[this.instructions.length-1],s=this.getLastPoint(ye.shared),a=0,o=0;if(!n||n.action!=="quadraticCurveTo")a=s.x,o=s.y;else{a=n.data[0],o=n.data[1];let l=s.x,h=s.y;a=l+(l-a),o=h+(h-o)}return this.instructions.push({action:"quadraticCurveTo",data:[a,o,e,r,i]}),this._dirty=!0,this}rect(e,r,i,n,s){return this.instructions.push({action:"rect",data:[e,r,i,n,s]}),this._dirty=!0,this}circle(e,r,i,n){return this.instructions.push({action:"circle",data:[e,r,i,n]}),this._dirty=!0,this}roundRect(...e){return this.instructions.push({action:"roundRect",data:e}),this._dirty=!0,this}poly(...e){return this.instructions.push({action:"poly",data:e}),this._dirty=!0,this}regularPoly(...e){return this.instructions.push({action:"regularPoly",data:e}),this._dirty=!0,this}roundPoly(...e){return this.instructions.push({action:"roundPoly",data:e}),this._dirty=!0,this}roundShape(...e){return this.instructions.push({action:"roundShape",data:e}),this._dirty=!0,this}filletRect(...e){return this.instructions.push({action:"filletRect",data:e}),this._dirty=!0,this}chamferRect(...e){return this.instructions.push({action:"chamferRect",data:e}),this._dirty=!0,this}star(e,r,i,n,s,a,o){s||(s=n/2);let l=-1*Math.PI/2+a,h=i*2,u=Math.PI*2/h,c=[];for(let f=0;f<h;f++){let d=f%2?s:n,_=f*u+l;c.push(e+d*Math.cos(_),r+d*Math.sin(_))}return this.poly(c,!0,o),this}clone(e=!1){let r=new Uy;if(r.checkForHoles=this.checkForHoles,!e)r.instructions=this.instructions.slice();else for(let i=0;i<this.instructions.length;i++){let n=this.instructions[i];r.instructions.push({action:n.action,data:n.data.slice()})}return r}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(e){if(e.isIdentity())return this;let r=e.a,i=e.b,n=e.c,s=e.d,a=e.tx,o=e.ty,l=0,h=0,u=0,c=0,f=0,d=0,_=0,v=0;for(let m=0;m<this.instructions.length;m++){let y=this.instructions[m],S=y.data;switch(y.action){case"moveTo":case"lineTo":l=S[0],h=S[1],S[0]=r*l+n*h+a,S[1]=i*l+s*h+o;break;case"bezierCurveTo":u=S[0],c=S[1],f=S[2],d=S[3],l=S[4],h=S[5],S[0]=r*u+n*c+a,S[1]=i*u+s*c+o,S[2]=r*f+n*d+a,S[3]=i*f+s*d+o,S[4]=r*l+n*h+a,S[5]=i*l+s*h+o;break;case"quadraticCurveTo":u=S[0],c=S[1],l=S[2],h=S[3],S[0]=r*u+n*c+a,S[1]=i*u+s*c+o,S[2]=r*l+n*h+a,S[3]=i*l+s*h+o;break;case"arcToSvg":l=S[5],h=S[6],_=S[0],v=S[1],S[0]=r*_+n*v,S[1]=i*_+s*v,S[5]=r*l+n*h+a,S[6]=i*l+s*h+o;break;case"circle":S[4]=Fs(S[3],e);break;case"rect":S[4]=Fs(S[4],e);break;case"ellipse":S[8]=Fs(S[8],e);break;case"roundRect":S[5]=Fs(S[5],e);break;case"addPath":S[0].transform(e);break;case"poly":S[2]=Fs(S[2],e);break;default:Ye("unknown transform action",y.action);break}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(e){let r=this.instructions.length-1,i=this.instructions[r];if(!i)return e.x=0,e.y=0,e;for(;i.action==="closePath";){if(r--,r<0)return e.x=0,e.y=0,e;i=this.instructions[r]}switch(i.action){case"moveTo":case"lineTo":e.x=i.data[0],e.y=i.data[1];break;case"quadraticCurveTo":e.x=i.data[2],e.y=i.data[3];break;case"bezierCurveTo":e.x=i.data[4],e.y=i.data[5];break;case"arc":case"arcToSvg":e.x=i.data[5],e.y=i.data[6];break;case"addPath":i.data[0].getLastPoint(e);break}return e}}});function Xt(t,e,r){let i=t.getAttribute(e);return i?Number(i):r}var ag=g(()=>{"use strict"});function f1(t,e){let r=t.querySelectorAll("defs");for(let i=0;i<r.length;i++){let n=r[i];for(let s=0;s<n.children.length;s++){let a=n.children[s];switch(a.nodeName.toLowerCase()){case"lineargradient":e.defs[a.id]=p1(a);break;case"radialgradient":e.defs[a.id]=g1(a);break;default:break}}}}function p1(t){let e=Xt(t,"x1",0),r=Xt(t,"y1",0),i=Xt(t,"x2",1),n=Xt(t,"y2",0),s=t.getAttribute("gradientUnits")||"objectBoundingBox",a=new ui(e,r,i,n,s==="objectBoundingBox"?"local":"global");for(let o=0;o<t.children.length;o++){let l=t.children[o],h=Xt(l,"offset",0),u=le.shared.setValue(l.getAttribute("stop-color")).toNumber();a.addColorStop(h,u)}return a}function g1(t){return Ye("[SVG Parser] Radial gradients are not yet supported"),new ui(0,0,1,0)}var m1=g(()=>{ze(),wt(),Ps(),ag()});function og(t){let e=t.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return e?e[1]:""}var _1=g(()=>{"use strict"});function lg(t,e){let r=t.getAttribute("style"),i={},n={},s={strokeStyle:i,fillStyle:n,useFill:!1,useStroke:!1};for(let a in Uh){let o=t.getAttribute(a);o&&hg(e,s,a,o.trim())}if(r){let a=r.split(";");for(let o=0;o<a.length;o++){let l=a[o].trim(),[h,u]=l.split(":");Uh[h]&&hg(e,s,h,u.trim())}}return{strokeStyle:s.useStroke?i:null,fillStyle:s.useFill?n:null,useFill:s.useFill,useStroke:s.useStroke}}function hg(t,e,r,i){switch(r){case"stroke":if(i!=="none"){if(i.startsWith("url(")){let n=og(i);e.strokeStyle.fill=t.defs[n]}else e.strokeStyle.color=le.shared.setValue(i).toNumber();e.useStroke=!0}break;case"stroke-width":e.strokeStyle.width=Number(i);break;case"fill":if(i!=="none"){if(i.startsWith("url(")){let n=og(i);e.fillStyle.fill=t.defs[n]}else e.fillStyle.color=le.shared.setValue(i).toNumber();e.useFill=!0}break;case"fill-opacity":e.fillStyle.alpha=Number(i);break;case"stroke-opacity":e.strokeStyle.alpha=Number(i);break;case"opacity":e.fillStyle.alpha=Number(i),e.strokeStyle.alpha=Number(i);break}}var Uh,v1=g(()=>{ze(),_1(),Uh={fill:{type:"paint",default:0},"fill-opacity":{type:"number",default:1},stroke:{type:"paint",default:0},"stroke-width":{type:"number",default:1},"stroke-opacity":{type:"number",default:1},"stroke-linecap":{type:"string",default:"butt"},"stroke-linejoin":{type:"string",default:"miter"},"stroke-miterlimit":{type:"number",default:10},"stroke-dasharray":{type:"string",default:"none"},"stroke-dashoffset":{type:"number",default:0},opacity:{type:"number",default:1}}});function y1(t,e){if(typeof t=="string"){let a=document.createElement("div");a.innerHTML=t.trim(),t=a.querySelector("svg")}let r={context:e,defs:{},path:new Ds};f1(t,r);let i=t.children,{fillStyle:n,strokeStyle:s}=lg(t,r);for(let a=0;a<i.length;a++){let o=i[a];o.nodeName.toLowerCase()!=="defs"&&ug(o,r,n,s)}return e}function ug(t,e,r,i){let n=t.children,{fillStyle:s,strokeStyle:a}=lg(t,e);s&&r?r={...r,...s}:s&&(r=s),a&&i?i={...i,...a}:a&&(i=a);let o=!r&&!i;o&&(r={color:0});let l,h,u,c,f,d,_,v,m,y,S,P,T,z,D,L,ne;switch(t.nodeName.toLowerCase()){case"path":z=t.getAttribute("d"),t.getAttribute("fill-rule")==="evenodd"&&Ye("SVG Evenodd fill rule not supported, your svg may render incorrectly"),D=new Ds(z,!0),e.context.path(D),r&&e.context.fill(r),i&&e.context.stroke(i);break;case"circle":_=Xt(t,"cx",0),v=Xt(t,"cy",0),m=Xt(t,"r",0),e.context.ellipse(_,v,m,m),r&&e.context.fill(r),i&&e.context.stroke(i);break;case"rect":l=Xt(t,"x",0),h=Xt(t,"y",0),L=Xt(t,"width",0),ne=Xt(t,"height",0),y=Xt(t,"rx",0),S=Xt(t,"ry",0),y||S?e.context.roundRect(l,h,L,ne,y||S):e.context.rect(l,h,L,ne),r&&e.context.fill(r),i&&e.context.stroke(i);break;case"ellipse":_=Xt(t,"cx",0),v=Xt(t,"cy",0),y=Xt(t,"rx",0),S=Xt(t,"ry",0),e.context.beginPath(),e.context.ellipse(_,v,y,S),r&&e.context.fill(r),i&&e.context.stroke(i);break;case"line":u=Xt(t,"x1",0),c=Xt(t,"y1",0),f=Xt(t,"x2",0),d=Xt(t,"y2",0),e.context.beginPath(),e.context.moveTo(u,c),e.context.lineTo(f,d),i&&e.context.stroke(i);break;case"polygon":T=t.getAttribute("points"),P=T.match(/\d+/g).map(ue=>parseInt(ue,10)),e.context.poly(P,!0),r&&e.context.fill(r),i&&e.context.stroke(i);break;case"polyline":T=t.getAttribute("points"),P=T.match(/\d+/g).map(ue=>parseInt(ue,10)),e.context.poly(P,!1),i&&e.context.stroke(i);break;case"g":case"svg":break;default:{Ye(`[SVG parser] <${t.nodeName}> elements unsupported`);break}}o&&(r=null);for(let ue=0;ue<n.length;ue++)ug(n[ue],e,r,i)}var x1=g(()=>{wt(),sg(),m1(),ag(),v1()});function b1(t){return le.isColorLike(t)}function cg(t){return t instanceof Gs}function dg(t){return t instanceof ui}function w1(t){return t instanceof Fe}function T1(t,e,r){let i=le.shared.setValue(e??0);return t.color=i.toNumber(),t.alpha=i.alpha===1?r.alpha:i.alpha,t.texture=Fe.WHITE,{...r,...t}}function S1(t,e,r){return t.texture=e,{...r,...t}}function fg(t,e,r){return t.fill=e,t.color=16777215,t.texture=e.texture,t.matrix=e.transform,{...r,...t}}function pg(t,e,r){return e.buildGradient(),t.fill=e,t.color=16777215,t.texture=e.texture,t.matrix=e.transform,t.textureSpace=e.textureSpace,{...r,...t}}function E1(t,e){let r={...e,...t},i=le.shared.setValue(r.color);return r.alpha*=i.alpha,r.color=i.toNumber(),r}function wn(t,e){if(t==null)return null;let r={},i=t;return b1(t)?T1(r,t,e):w1(t)?S1(r,t,e):cg(t)?fg(r,t,e):dg(t)?pg(r,t,e):i.fill&&cg(i.fill)?fg(i,i.fill,e):i.fill&&dg(i.fill)?pg(i,i.fill,e):E1(i,e)}function mo(t,e){let{width:r,alignment:i,miterLimit:n,cap:s,join:a,pixelLine:o,...l}=e,h=wn(t,l);return h?{width:r,alignment:i,miterLimit:n,cap:s,join:a,pixelLine:o,...h}:null}var gg=g(()=>{ze(),Ft(),Ps(),Bh()}),mg,Lh,_o,zr,_g=g(()=>{kt(),ze(),Ke(),He(),Ft(),Ot(),Mt(),se(),sg(),x1(),gg(),mg=new ye,Lh=new ve,_o=class xi extends st{constructor(){super(...arguments),this.uid=ot("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new Ds,this._transform=new ve,this._fillStyle={...xi.defaultFillStyle},this._strokeStyle={...xi.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new $,this._boundsDirty=!0}clone(){let e=new xi;return e.batchMode=this.batchMode,e.instructions=this.instructions.slice(),e._activePath=this._activePath.clone(),e._transform=this._transform.clone(),e._fillStyle={...this._fillStyle},e._strokeStyle={...this._strokeStyle},e._stateStack=this._stateStack.slice(),e._bounds=this._bounds.clone(),e._boundsDirty=!0,e}get fillStyle(){return this._fillStyle}set fillStyle(e){this._fillStyle=wn(e,xi.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(e){this._strokeStyle=mo(e,xi.defaultStrokeStyle)}setFillStyle(e){return this._fillStyle=wn(e,xi.defaultFillStyle),this}setStrokeStyle(e){return this._strokeStyle=wn(e,xi.defaultStrokeStyle),this}texture(e,r,i,n,s,a){return this.instructions.push({action:"texture",data:{image:e,dx:i||0,dy:n||0,dw:s||e.frame.width,dh:a||e.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:r?le.shared.setValue(r).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new Ds,this}fill(e,r){let i,n=this.instructions[this.instructions.length-1];return this._tick===0&&n&&n.action==="stroke"?i=n.data.path:i=this._activePath.clone(),i?(e!=null&&(r!==void 0&&typeof e=="number"&&(Xe(nt,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),e={color:e,alpha:r}),this._fillStyle=wn(e,xi.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:i}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){let{x:e,y:r}=this._activePath.getLastPoint(ye.shared);this._activePath.clear(),this._activePath.moveTo(e,r)}stroke(e){let r,i=this.instructions[this.instructions.length-1];return this._tick===0&&i&&i.action==="fill"?r=i.data.path:r=this._activePath.clone(),r?(e!=null&&(this._strokeStyle=mo(e,xi.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:r}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let e=0;e<2;e++){let r=this.instructions[this.instructions.length-1-e],i=this._activePath.clone();if(r&&(r.action==="stroke"||r.action==="fill"))if(r.data.hole)r.data.hole.addPath(i);else{r.data.hole=i;break}}return this._initNextPathLocation(),this}arc(e,r,i,n,s,a){this._tick++;let o=this._transform;return this._activePath.arc(o.a*e+o.c*r+o.tx,o.b*e+o.d*r+o.ty,i,n,s,a),this}arcTo(e,r,i,n,s){this._tick++;let a=this._transform;return this._activePath.arcTo(a.a*e+a.c*r+a.tx,a.b*e+a.d*r+a.ty,a.a*i+a.c*n+a.tx,a.b*i+a.d*n+a.ty,s),this}arcToSvg(e,r,i,n,s,a,o){this._tick++;let l=this._transform;return this._activePath.arcToSvg(e,r,i,n,s,l.a*a+l.c*o+l.tx,l.b*a+l.d*o+l.ty),this}bezierCurveTo(e,r,i,n,s,a,o){this._tick++;let l=this._transform;return this._activePath.bezierCurveTo(l.a*e+l.c*r+l.tx,l.b*e+l.d*r+l.ty,l.a*i+l.c*n+l.tx,l.b*i+l.d*n+l.ty,l.a*s+l.c*a+l.tx,l.b*s+l.d*a+l.ty,o),this}closePath(){return this._tick++,this._activePath?.closePath(),this}ellipse(e,r,i,n){return this._tick++,this._activePath.ellipse(e,r,i,n,this._transform.clone()),this}circle(e,r,i){return this._tick++,this._activePath.circle(e,r,i,this._transform.clone()),this}path(e){return this._tick++,this._activePath.addPath(e,this._transform.clone()),this}lineTo(e,r){this._tick++;let i=this._transform;return this._activePath.lineTo(i.a*e+i.c*r+i.tx,i.b*e+i.d*r+i.ty),this}moveTo(e,r){this._tick++;let i=this._transform,n=this._activePath.instructions,s=i.a*e+i.c*r+i.tx,a=i.b*e+i.d*r+i.ty;return n.length===1&&n[0].action==="moveTo"?(n[0].data[0]=s,n[0].data[1]=a,this):(this._activePath.moveTo(s,a),this)}quadraticCurveTo(e,r,i,n,s){this._tick++;let a=this._transform;return this._activePath.quadraticCurveTo(a.a*e+a.c*r+a.tx,a.b*e+a.d*r+a.ty,a.a*i+a.c*n+a.tx,a.b*i+a.d*n+a.ty,s),this}rect(e,r,i,n){return this._tick++,this._activePath.rect(e,r,i,n,this._transform.clone()),this}roundRect(e,r,i,n,s){return this._tick++,this._activePath.roundRect(e,r,i,n,s,this._transform.clone()),this}poly(e,r){return this._tick++,this._activePath.poly(e,r,this._transform.clone()),this}regularPoly(e,r,i,n,s=0,a){return this._tick++,this._activePath.regularPoly(e,r,i,n,s,a),this}roundPoly(e,r,i,n,s,a){return this._tick++,this._activePath.roundPoly(e,r,i,n,s,a),this}roundShape(e,r,i,n){return this._tick++,this._activePath.roundShape(e,r,i,n),this}filletRect(e,r,i,n,s){return this._tick++,this._activePath.filletRect(e,r,i,n,s),this}chamferRect(e,r,i,n,s,a){return this._tick++,this._activePath.chamferRect(e,r,i,n,s,a),this}star(e,r,i,n,s=0,a=0){return this._tick++,this._activePath.star(e,r,i,n,s,a,this._transform.clone()),this}svg(e){return this._tick++,y1(e,this),this}restore(){let e=this._stateStack.pop();return e&&(this._transform=e.transform,this._fillStyle=e.fillStyle,this._strokeStyle=e.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:{...this._fillStyle},strokeStyle:{...this._strokeStyle}}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(e){return this._transform.rotate(e),this}scale(e,r=e){return this._transform.scale(e,r),this}setTransform(e,r,i,n,s,a){return e instanceof ve?(this._transform.set(e.a,e.b,e.c,e.d,e.tx,e.ty),this):(this._transform.set(e,r,i,n,s,a),this)}transform(e,r,i,n,s,a){return e instanceof ve?(this._transform.append(e),this):(Lh.set(e,r,i,n,s,a),this._transform.append(Lh),this)}translate(e,r=e){return this._transform.translate(e,r),this}clear(){return this._activePath.clear(),this.instructions.length=0,this.resetTransform(),this.onUpdate(),this}onUpdate(){this.dirty||(this.emit("update",this,16),this.dirty=!0,this._boundsDirty=!0)}get bounds(){if(!this._boundsDirty)return this._bounds;let e=this._bounds;e.clear();for(let r=0;r<this.instructions.length;r++){let i=this.instructions[r],n=i.action;if(n==="fill"){let s=i.data;e.addBounds(s.path.bounds)}else if(n==="texture"){let s=i.data;e.addFrame(s.dx,s.dy,s.dx+s.dw,s.dy+s.dh,s.transform)}if(n==="stroke"){let s=i.data,a=s.style.alignment,o=s.style.width*(1-a),l=s.path.bounds;e.addFrame(l.minX-o,l.minY-o,l.maxX+o,l.maxY+o)}}return e}containsPoint(e){if(!this.bounds.containsPoint(e.x,e.y))return!1;let r=this.instructions,i=!1;for(let n=0;n<r.length;n++){let s=r[n],a=s.data,o=a.path;if(!s.action||!o)continue;let l=a.style,h=o.shapePath.shapePrimitives;for(let u=0;u<h.length;u++){let c=h[u].shape;if(!l||!c)continue;let f=h[u].transform,d=f?f.applyInverse(e,mg):e;if(s.action==="fill")i=c.contains(d.x,d.y);else{let v=l;i=c.strokeContains(d.x,d.y,v.width,v.alignment)}let _=a.hole;if(_){let v=_.shapePath?.shapePrimitives;if(v)for(let m=0;m<v.length;m++)v[m].shape.contains(d.x,d.y)&&(i=!1)}if(i)return!0}}return i}destroy(e=!1){if(this._stateStack.length=0,this._transform=null,this.emit("destroy",this),this.removeAllListeners(),typeof e=="boolean"?e:e?.texture){let r=typeof e=="boolean"?e:e?.textureSource;this._fillStyle.texture&&this._fillStyle.texture.destroy(r),this._strokeStyle.texture&&this._strokeStyle.texture.destroy(r)}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}},_o.defaultFillStyle={color:16777215,alpha:1,texture:Fe.WHITE,matrix:null,fill:null,textureSpace:"local"},_o.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:Fe.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1},zr=_o});function C1(t){let e=[],r=0;for(let i=0;i<Nh.length;i++){let n=`_${Nh[i]}`;e[r++]=t[n]}return r=vg(t._fill,e,r),r=P1(t._stroke,e,r),r=M1(t.dropShadow,e,r),r=A1(t.filters,e,r),e.join("-")}function A1(t,e,r){if(!t)return r;for(let i of t)e[r++]=i.uid;return r}function vg(t,e,r){return t&&(e[r++]=t.color,e[r++]=t.alpha,e[r++]=t.fill?.styleKey),r}function P1(t,e,r){return t&&(r=vg(t,e,r),e[r++]=t.width,e[r++]=t.alignment,e[r++]=t.cap,e[r++]=t.join,e[r++]=t.miterLimit),r}function M1(t,e,r){return t&&(e[r++]=t.alpha,e[r++]=t.angle,e[r++]=t.blur,e[r++]=t.distance,e[r++]=le.shared.setValue(t.color).toNumber()),r}var Nh,R1=g(()=>{ze(),Nh=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"]});function k1(t){let e=t;if(typeof e.dropShadow=="boolean"&&e.dropShadow){let r=di.defaultDropShadow;t.dropShadow={alpha:e.dropShadowAlpha??r.alpha,angle:e.dropShadowAngle??r.angle,blur:e.dropShadowBlur??r.blur,color:e.dropShadowColor??r.color,distance:e.dropShadowDistance??r.distance}}if(e.strokeThickness!==void 0){Xe(nt,"strokeThickness is now a part of stroke");let r=e.stroke,i={};if(le.isColorLike(r))i.color=r;else if(r instanceof ui||r instanceof Gs)i.fill=r;else if(Object.hasOwnProperty.call(r,"color")||Object.hasOwnProperty.call(r,"fill"))i=r;else throw new Error("Invalid stroke value.");t.stroke={...i,width:e.strokeThickness}}if(Array.isArray(e.fillGradientStops)){Xe(nt,"gradient fill is now a fill pattern: `new FillGradient(...)`");let r;t.fontSize==null?t.fontSize=di.defaultTextStyle.fontSize:typeof t.fontSize=="string"?r=parseInt(t.fontSize,10):r=t.fontSize;let i=new ui({start:{x:0,y:0},end:{x:0,y:(r||0)*1.7}}),n=e.fillGradientStops.map(s=>le.shared.setValue(s).toNumber());n.forEach((s,a)=>{let o=a/(n.length-1);i.addColorStop(o,s)}),t.fill={fill:i}}}var vo,di,Us=g(()=>{kt(),ze(),Mt(),Ps(),Bh(),_g(),gg(),R1(),vo=class ss extends st{constructor(e={}){super(),k1(e);let r={...ss.defaultTextStyle,...e};for(let i in r){let n=i;this[n]=r[i]}this.update()}get align(){return this._align}set align(e){this._align=e,this.update()}get breakWords(){return this._breakWords}set breakWords(e){this._breakWords=e,this.update()}get dropShadow(){return this._dropShadow}set dropShadow(e){e!==null&&typeof e=="object"?this._dropShadow=this._createProxy({...ss.defaultDropShadow,...e}):this._dropShadow=e?this._createProxy({...ss.defaultDropShadow}):null,this.update()}get fontFamily(){return this._fontFamily}set fontFamily(e){this._fontFamily=e,this.update()}get fontSize(){return this._fontSize}set fontSize(e){typeof e=="string"?this._fontSize=parseInt(e,10):this._fontSize=e,this.update()}get fontStyle(){return this._fontStyle}set fontStyle(e){this._fontStyle=e.toLowerCase(),this.update()}get fontVariant(){return this._fontVariant}set fontVariant(e){this._fontVariant=e,this.update()}get fontWeight(){return this._fontWeight}set fontWeight(e){this._fontWeight=e,this.update()}get leading(){return this._leading}set leading(e){this._leading=e,this.update()}get letterSpacing(){return this._letterSpacing}set letterSpacing(e){this._letterSpacing=e,this.update()}get lineHeight(){return this._lineHeight}set lineHeight(e){this._lineHeight=e,this.update()}get padding(){return this._padding}set padding(e){this._padding=e,this.update()}get filters(){return this._filters}set filters(e){this._filters=e,this.update()}get trim(){return this._trim}set trim(e){this._trim=e,this.update()}get textBaseline(){return this._textBaseline}set textBaseline(e){this._textBaseline=e,this.update()}get whiteSpace(){return this._whiteSpace}set whiteSpace(e){this._whiteSpace=e,this.update()}get wordWrap(){return this._wordWrap}set wordWrap(e){this._wordWrap=e,this.update()}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(e){this._wordWrapWidth=e,this.update()}get fill(){return this._originalFill}set fill(e){e!==this._originalFill&&(this._originalFill=e,this._isFillStyle(e)&&(this._originalFill=this._createProxy({...zr.defaultFillStyle,...e},()=>{this._fill=wn({...this._originalFill},zr.defaultFillStyle)})),this._fill=wn(e===0?"black":e,zr.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(e){e!==this._originalStroke&&(this._originalStroke=e,this._isFillStyle(e)&&(this._originalStroke=this._createProxy({...zr.defaultStrokeStyle,...e},()=>{this._stroke=mo({...this._originalStroke},zr.defaultStrokeStyle)})),this._stroke=mo(e,zr.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=C1(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){let e=ss.defaultTextStyle;for(let r in e)this[r]=e[r]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new ss({align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,textBaseline:this.textBaseline,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,filters:this._filters?[...this._filters]:void 0})}_getFinalPadding(){let e=0;if(this._filters)for(let r=0;r<this._filters.length;r++)e+=this._filters[r].padding;return Math.max(this._padding,e)}destroy(e=!1){if(this.removeAllListeners(),typeof e=="boolean"?e:e?.texture){let r=typeof e=="boolean"?e:e?.textureSource;this._fill?.texture&&this._fill.texture.destroy(r),this._originalFill?.texture&&this._originalFill.texture.destroy(r),this._stroke?.texture&&this._stroke.texture.destroy(r),this._originalStroke?.texture&&this._originalStroke.texture.destroy(r)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(e,r){return new Proxy(e,{set:(i,n,s)=>(i[n]=s,r?.(n,s),this.update(),!0)})}_isFillStyle(e){return(e??null)!==null&&!(le.isColorLike(e)||e instanceof ui||e instanceof Gs)}},vo.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5},vo.defaultTextStyle={align:"left",breakWords:!1,dropShadow:null,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,padding:0,stroke:null,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100},di=vo});function yg(t,e,r,i){let n=xg;n.minX=0,n.minY=0,n.maxX=t.width/i|0,n.maxY=t.height/i|0;let s=or.getOptimalTexture(n.width,n.height,i,!1);return s.source.uploadMethodId="image",s.source.resource=t,s.source.alphaMode="premultiply-alpha-on-upload",s.frame.width=e/i,s.frame.height=r/i,s.source.emit("update",s.source),s.updateUvs(),s}var xg,bg=g(()=>{ln(),se(),xg=new $}),wg,Ri,Ls=g(()=>{Jt(),Or(),wg=class{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){let r=Dt.get().createCanvas();r.width=t,r.height=e;let i=r.getContext("2d");return{canvas:r,context:i}}getOptimalCanvasAndContext(t,e,r=1){t=Math.ceil(t*r-1e-6),e=Math.ceil(e*r-1e-6),t=Cr(t),e=Cr(e);let i=(t<<17)+(e<<1);this._canvasPool[i]||(this._canvasPool[i]=[]);let n=this._canvasPool[i].pop();return n||(n=this._createCanvasAndContext(t,e)),n}returnCanvasAndContext(t){let e=t.canvas,{width:r,height:i}=e,n=(r<<17)+(i<<1);t.context.resetTransform(),t.context.clearRect(0,0,r,i),this._canvasPool[n].push(t)}clear(){this._canvasPool={}}},Ri=new wg});function B1(t,e){Zi||(Zi=Dt.get().createCanvas(256,128),fi=Zi.getContext("2d",{willReadFrequently:!0}),fi.globalCompositeOperation="copy",fi.globalAlpha=1),(Zi.width<t||Zi.height<e)&&(Zi.width=Cr(t),Zi.height=Cr(e))}function Tg(t,e,r){for(let i=0,n=4*r*e;i<e;++i,n+=4)if(t[n+3]!==0)return!1;return!0}function Sg(t,e,r,i,n){let s=4*e;for(let a=i,o=i*s+4*r;a<=n;++a,o+=s)if(t[o+3]!==0)return!1;return!0}function G1(...t){let e=t[0];e.canvas||(e={canvas:t[0],resolution:t[1]});let{canvas:r}=e,i=Math.min(e.resolution??1,1),n=e.width??r.width,s=e.height??r.height,a=e.output;if(B1(n,s),!fi)throw new TypeError("Failed to get canvas 2D context");fi.drawImage(r,0,0,n,s,0,0,n*i,s*i);let o=fi.getImageData(0,0,n,s).data,l=0,h=0,u=n-1,c=s-1;for(;h<s&&Tg(o,n,h);)++h;if(h===s)return R.EMPTY;for(;Tg(o,n,c);)--c;for(;Sg(o,n,l,h,c);)++l;for(;Sg(o,n,u,h,c);)--u;return++u,++c,fi.globalCompositeOperation="source-over",fi.strokeRect(l,h,u-l,c-h),fi.globalCompositeOperation="copy",a??(a=new R),a.set(l/i,h/i,(u-l)/i,(c-h)/i),a}var Zi,fi,I1=g(()=>{Jt(),Or(),O(),Zi=null,fi=null});function yo(t){let e=typeof t.fontSize=="number"?`${t.fontSize}px`:t.fontSize,r=t.fontFamily;Array.isArray(t.fontFamily)||(r=t.fontFamily.split(","));for(let i=r.length-1;i>=0;i--){let n=r[i].trim();!/([\"\'])[^\'\"]+\1/.test(n)&&!Eg.includes(n)&&(n=`"${n}"`),r[i]=n}return`${t.fontStyle} ${t.fontVariant} ${t.fontWeight} ${e} ${r.join(",")}`}var Eg,zh=g(()=>{"use strict";Eg=["serif","sans-serif","monospace","cursive","fantasy","system-ui"]}),xo,Kr,Hr,Ns=g(()=>{Jt(),zh(),xo={willReadFrequently:!0},Kr=class Le{static get experimentalLetterSpacingSupported(){let e=Le._experimentalLetterSpacingSupported;if(e===void 0){let r=Dt.get().getCanvasRenderingContext2D().prototype;e=Le._experimentalLetterSpacingSupported="letterSpacing"in r||"textLetterSpacing"in r}return e}constructor(e,r,i,n,s,a,o,l,h){this.text=e,this.style=r,this.width=i,this.height=n,this.lines=s,this.lineWidths=a,this.lineHeight=o,this.maxLineWidth=l,this.fontProperties=h}static measureText(e=" ",r,i=Le._canvas,n=r.wordWrap){let s=yo(r),a=Le.measureFont(s);a.fontSize===0&&(a.fontSize=r.fontSize,a.ascent=r.fontSize);let o=Le.__context;o.font=s;let l=(n?Le._wordWrap(e,r,i):e).split(/(?:\r\n|\r|\n)/),h=new Array(l.length),u=0;for(let v=0;v<l.length;v++){let m=Le._measureText(l[v],r.letterSpacing,o);h[v]=m,u=Math.max(u,m)}let c=r._stroke?.width||0,f=u+c;r.dropShadow&&(f+=r.dropShadow.distance);let d=r.lineHeight||a.fontSize,_=Math.max(d,a.fontSize+c)+(l.length-1)*(d+r.leading);return r.dropShadow&&(_+=r.dropShadow.distance),new Le(e,r,f,_,l,h,d+r.leading,u,a)}static _measureText(e,r,i){let n=!1;Le.experimentalLetterSpacingSupported&&(Le.experimentalLetterSpacing?(i.letterSpacing=`${r}px`,i.textLetterSpacing=`${r}px`,n=!0):(i.letterSpacing="0px",i.textLetterSpacing="0px"));let s=i.measureText(e),a=s.width,o=-s.actualBoundingBoxLeft,l=s.actualBoundingBoxRight-o;if(a>0)if(n)a-=r,l-=r;else{let h=(Le.graphemeSegmenter(e).length-1)*r;a+=h,l+=h}return Math.max(a,l)}static _wordWrap(e,r,i=Le._canvas){let n=i.getContext("2d",xo),s=0,a="",o="",l=Object.create(null),{letterSpacing:h,whiteSpace:u}=r,c=Le._collapseSpaces(u),f=Le._collapseNewlines(u),d=!c,_=r.wordWrapWidth+h,v=Le._tokenize(e);for(let m=0;m<v.length;m++){let y=v[m];if(Le._isNewline(y)){if(!f){o+=Le._addLine(a),d=!c,a="",s=0;continue}y=" "}if(c){let P=Le.isBreakingSpace(y),T=Le.isBreakingSpace(a[a.length-1]);if(P&&T)continue}let S=Le._getFromCache(y,h,l,n);if(S>_)if(a!==""&&(o+=Le._addLine(a),a="",s=0),Le.canBreakWords(y,r.breakWords)){let P=Le.wordWrapSplit(y);for(let T=0;T<P.length;T++){let z=P[T],D=z,L=1;for(;P[T+L];){let ue=P[T+L];if(!Le.canBreakChars(D,ue,y,T,r.breakWords))z+=ue;else break;D=ue,L++}T+=L-1;let ne=Le._getFromCache(z,h,l,n);ne+s>_&&(o+=Le._addLine(a),d=!1,a="",s=0),a+=z,s+=ne}}else{a.length>0&&(o+=Le._addLine(a),a="",s=0);let P=m===v.length-1;o+=Le._addLine(y,!P),d=!1,a="",s=0}else S+s>_&&(d=!1,o+=Le._addLine(a),a="",s=0),(a.length>0||!Le.isBreakingSpace(y)||d)&&(a+=y,s+=S)}return o+=Le._addLine(a,!1),o}static _addLine(e,r=!0){return e=Le._trimRight(e),e=r?`${e}
|
|
`:e,e}static _getFromCache(e,r,i,n){let s=i[e];return typeof s!="number"&&(s=Le._measureText(e,r,n)+r,i[e]=s),s}static _collapseSpaces(e){return e==="normal"||e==="pre-line"}static _collapseNewlines(e){return e==="normal"}static _trimRight(e){if(typeof e!="string")return"";for(let r=e.length-1;r>=0;r--){let i=e[r];if(!Le.isBreakingSpace(i))break;e=e.slice(0,-1)}return e}static _isNewline(e){return typeof e!="string"?!1:Le._newlines.includes(e.charCodeAt(0))}static isBreakingSpace(e,r){return typeof e!="string"?!1:Le._breakingSpaces.includes(e.charCodeAt(0))}static _tokenize(e){let r=[],i="";if(typeof e!="string")return r;for(let n=0;n<e.length;n++){let s=e[n],a=e[n+1];if(Le.isBreakingSpace(s,a)||Le._isNewline(s)){i!==""&&(r.push(i),i=""),s==="\r"&&a===`
|
|
`?(r.push(`\r
|
|
`),n++):r.push(s);continue}i+=s}return i!==""&&r.push(i),r}static canBreakWords(e,r){return r}static canBreakChars(e,r,i,n,s){return!0}static wordWrapSplit(e){return Le.graphemeSegmenter(e)}static measureFont(e){if(Le._fonts[e])return Le._fonts[e];let r=Le._context;r.font=e;let i=r.measureText(Le.METRICS_STRING+Le.BASELINE_SYMBOL),n={ascent:i.actualBoundingBoxAscent,descent:i.actualBoundingBoxDescent,fontSize:i.actualBoundingBoxAscent+i.actualBoundingBoxDescent};return Le._fonts[e]=n,n}static clearMetrics(e=""){e?delete Le._fonts[e]:Le._fonts={}}static get _canvas(){if(!Le.__canvas){let e;try{let r=new OffscreenCanvas(0,0);if(r.getContext("2d",xo)?.measureText)return Le.__canvas=r,r;e=Dt.get().createCanvas()}catch{e=Dt.get().createCanvas()}e.width=e.height=10,Le.__canvas=e}return Le.__canvas}static get _context(){return Le.__context||(Le.__context=Le._canvas.getContext("2d",xo)),Le.__context}},Kr.METRICS_STRING="|\xC9q\xC5",Kr.BASELINE_SYMBOL="M",Kr.BASELINE_MULTIPLIER=1.4,Kr.HEIGHT_MULTIPLIER=2,Kr.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter=="function"){let t=new Intl.Segmenter;return e=>{let r=t.segment(e),i=[],n=0;for(let s of r)i[n++]=s.segment;return i}}return t=>[...t]})(),Kr.experimentalLetterSpacing=!1,Kr._fonts={},Kr._newlines=[10,13],Kr._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288],Hr=Kr});function bo(t,e,r,i=0){if(t.texture===Fe.WHITE&&!t.fill)return le.shared.setValue(t.color).setAlpha(t.alpha??1).toHexa();if(t.fill){if(t.fill instanceof Gs){let n=t.fill,s=e.createPattern(n.texture.source.resource,"repeat"),a=n.transform.copyTo(ve.shared);return a.scale(n.texture.frame.width,n.texture.frame.height),s.setTransform(a),s}else if(t.fill instanceof ui){let n=t.fill,s=n.type==="linear",a=n.textureSpace==="local",o=1,l=1;a&&r&&(o=r.width+i,l=r.height+i);let h,u=!1;if(s){let{start:c,end:f}=n;h=e.createLinearGradient(c.x*o,c.y*l,f.x*o,f.y*l),u=Math.abs(f.x-c.x)<Math.abs((f.y-c.y)*.1)}else{let{center:c,innerRadius:f,outerCenter:d,outerRadius:_}=n;h=e.createRadialGradient(c.x*o,c.y*l,f*o,d.x*o,d.y*l,_*o)}if(u&&a&&r){let c=r.lineHeight/l;for(let f=0;f<r.lines.length;f++){let d=(f*r.lineHeight+i/2)/l;n.colorStops.forEach(_=>{let v=d+_.offset*c;h.addColorStop(Math.floor(v*Hh)/Hh,le.shared.setValue(_.color).toHex())})}}else n.colorStops.forEach(c=>{h.addColorStop(c.offset,le.shared.setValue(c.color).toHex())});return h}}else{let n=e.createPattern(t.texture.source.resource,"repeat"),s=t.matrix.copyTo(ve.shared);return s.scale(t.texture.frame.width,t.texture.frame.height),n.setTransform(s),n}return Ye("FillStyle not recognised",t),"red"}var Hh,Cg=g(()=>{ze(),Ke(),Ft(),wt(),Ps(),Bh(),Hh=1e5}),Vh,Ag,Yn,Pg=g(()=>{ze(),O(),Ls(),I1(),Ns(),zh(),Cg(),Vh=new R,Ag=class{getCanvasAndContext(t){let{text:e,style:r,resolution:i=1}=t,n=r._getFinalPadding(),s=Hr.measureText(e||" ",r),a=Math.ceil(Math.ceil(Math.max(1,s.width)+n*2)*i),o=Math.ceil(Math.ceil(Math.max(1,s.height)+n*2)*i),l=Ri.getOptimalCanvasAndContext(a,o);this._renderTextToCanvas(e,r,n,i,l);let h=r.trim?G1({canvas:l.canvas,width:a,height:o,resolution:1,output:Vh}):Vh.set(0,0,a,o);return{canvasAndContext:l,frame:h}}returnCanvasAndContext(t){Ri.returnCanvasAndContext(t)}_renderTextToCanvas(t,e,r,i,n){let{canvas:s,context:a}=n,o=yo(e),l=Hr.measureText(t||" ",e),h=l.lines,u=l.lineHeight,c=l.lineWidths,f=l.maxLineWidth,d=l.fontProperties,_=s.height;if(a.resetTransform(),a.scale(i,i),a.textBaseline=e.textBaseline,e._stroke?.width){let S=e._stroke;a.lineWidth=S.width,a.miterLimit=S.miterLimit,a.lineJoin=S.join,a.lineCap=S.cap}a.font=o;let v,m,y=e.dropShadow?2:1;for(let S=0;S<y;++S){let P=e.dropShadow&&S===0,T=P?Math.ceil(Math.max(1,_)+r*2):0,z=T*i;if(P){a.fillStyle="black",a.strokeStyle="black";let ne=e.dropShadow,ue=ne.color,re=ne.alpha;a.shadowColor=le.shared.setValue(ue).setAlpha(re).toRgbaString();let oe=ne.blur*i,Be=ne.distance*i;a.shadowBlur=oe,a.shadowOffsetX=Math.cos(ne.angle)*Be,a.shadowOffsetY=Math.sin(ne.angle)*Be+z}else{if(a.fillStyle=e._fill?bo(e._fill,a,l):null,e._stroke?.width){let ne=e._stroke.width*e._stroke.alignment;a.strokeStyle=bo(e._stroke,a,l,ne)}a.shadowColor="black"}let D=(u-d.fontSize)/2;u-d.fontSize<0&&(D=0);let L=e._stroke?.width??0;for(let ne=0;ne<h.length;ne++)v=L/2,m=L/2+ne*u+d.ascent+D,e.align==="right"?v+=f-c[ne]:e.align==="center"&&(v+=(f-c[ne])/2),e._stroke?.width&&this._drawLetterSpacing(h[ne],e,n,v+r,m+r-T,!0),e._fill!==void 0&&this._drawLetterSpacing(h[ne],e,n,v+r,m+r-T)}}_drawLetterSpacing(t,e,r,i,n,s=!1){let{context:a}=r,o=e.letterSpacing,l=!1;if(Hr.experimentalLetterSpacingSupported&&(Hr.experimentalLetterSpacing?(a.letterSpacing=`${o}px`,a.textLetterSpacing=`${o}px`,l=!0):(a.letterSpacing="0px",a.textLetterSpacing="0px")),o===0||l){s?a.strokeText(t,i,n):a.fillText(t,i,n);return}let h=i,u=Hr.graphemeSegmenter(t),c=a.measureText(t).width,f=0;for(let d=0;d<u.length;++d){let _=u[d];s?a.strokeText(_,h,n):a.fillText(_,h,n);let v="";for(let m=d+1;m<u.length;++m)v+=u[m];f=a.measureText(v).width,h+=c-f+o,c=f}}},Yn=new Ag}),jh,O1=g(()=>{X(),ln(),Rn(),Mt(),Us(),bg(),Pg(),jh=class{constructor(t){this._renderer=t}getTexture(t,e,r,i){typeof t=="string"&&(Xe("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:r,resolution:e}),t.style instanceof di||(t.style=new di(t.style)),t.textureStyle instanceof ni||(t.textureStyle=new ni(t.textureStyle)),typeof t.text!="string"&&(t.text=t.text.toString());let{text:n,style:s,textureStyle:a}=t,o=t.resolution??this._renderer.resolution,{frame:l,canvasAndContext:h}=Yn.getCanvasAndContext({text:n,style:s,resolution:o}),u=yg(h.canvas,l.width,l.height,o);if(a&&(u.source.style=a),s.trim&&(l.pad(s.padding),u.frame.copyFrom(l),u.updateUvs()),s.filters){let c=this._applyFilters(u,s.filters);return this.returnTexture(u),Yn.returnCanvasAndContext(h),c}return this._renderer.texture.initSource(u._source),Yn.returnCanvasAndContext(h),u}returnTexture(t){let e=t.source;e.resource=null,e.uploadMethodId="unknown",e.alphaMode="no-premultiply-alpha",or.returnTexture(t,!0)}renderTextToCanvas(){Xe("8.10.0","CanvasTextSystem.renderTextToCanvas: no longer supported, use CanvasTextSystem.getTexture instead")}_applyFilters(t,e){let r=this._renderer.renderTarget.renderTarget,i=this._renderer.filter.generateFilteredTexture({texture:t,filters:e});return this._renderer.renderTarget.bind(r,!1),i}destroy(){this._renderer=null}},jh.extension={type:[M.WebGLSystem,M.WebGPUSystem,M.CanvasSystem],name:"canvasText"}}),Mg=g(()=>{X(),Vb(),O1(),we.add(jh),we.add(Rh)}),wo,Rg=g(()=>{Mt(),Ul(),_g(),wo=class fd extends Pa{constructor(e){e instanceof zr&&(e={context:e});let{context:r,roundPixels:i,...n}=e||{};super({label:"Graphics",...n}),this.renderPipeId="graphics",r?this._context=r:this._context=this._ownedContext=new zr,this._context.on("update",this.onViewUpdate,this),this.didViewUpdate=!0,this.allowChildren=!1,this.roundPixels=i??!1}set context(e){e!==this._context&&(this._context.off("update",this.onViewUpdate,this),this._context=e,this._context.on("update",this.onViewUpdate,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}updateBounds(){}containsPoint(e){return this._context.containsPoint(e)}destroy(e){this._ownedContext&&!e?this._ownedContext.destroy(e):(e===!0||e?.context===!0)&&this._context.destroy(e),this._ownedContext=null,this._context=null,super.destroy(e)}_callContextMethod(e,r){return this.context[e](...r),this}setFillStyle(...e){return this._callContextMethod("setFillStyle",e)}setStrokeStyle(...e){return this._callContextMethod("setStrokeStyle",e)}fill(...e){return this._callContextMethod("fill",e)}stroke(...e){return this._callContextMethod("stroke",e)}texture(...e){return this._callContextMethod("texture",e)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...e){return this._callContextMethod("arc",e)}arcTo(...e){return this._callContextMethod("arcTo",e)}arcToSvg(...e){return this._callContextMethod("arcToSvg",e)}bezierCurveTo(...e){return this._callContextMethod("bezierCurveTo",e)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...e){return this._callContextMethod("ellipse",e)}circle(...e){return this._callContextMethod("circle",e)}path(...e){return this._callContextMethod("path",e)}lineTo(...e){return this._callContextMethod("lineTo",e)}moveTo(...e){return this._callContextMethod("moveTo",e)}quadraticCurveTo(...e){return this._callContextMethod("quadraticCurveTo",e)}rect(...e){return this._callContextMethod("rect",e)}roundRect(...e){return this._callContextMethod("roundRect",e)}poly(...e){return this._callContextMethod("poly",e)}regularPoly(...e){return this._callContextMethod("regularPoly",e)}roundPoly(...e){return this._callContextMethod("roundPoly",e)}roundShape(...e){return this._callContextMethod("roundShape",e)}filletRect(...e){return this._callContextMethod("filletRect",e)}chamferRect(...e){return this._callContextMethod("chamferRect",e)}star(...e){return this._callContextMethod("star",e)}svg(...e){return this._callContextMethod("svg",e)}restore(...e){return this._callContextMethod("restore",e)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...e){return this._callContextMethod("rotate",e)}scaleTransform(...e){return this._callContextMethod("scale",e)}setTransform(...e){return this._callContextMethod("setTransform",e)}transform(...e){return this._callContextMethod("transform",e)}translateTransform(...e){return this._callContextMethod("translate",e)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(e){this._context.fillStyle=e}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(e){this._context.strokeStyle=e}clone(e=!1){return e?new fd(this._context.clone()):(this._ownedContext=null,new fd(this._context))}lineStyle(e,r,i){Xe(nt,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");let n={};return e&&(n.width=e),r&&(n.color=r),i&&(n.alpha=i),this.context.strokeStyle=n,this}beginFill(e,r){Xe(nt,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");let i={};return e!==void 0&&(i.color=e),r!==void 0&&(i.alpha=r),this.context.fillStyle=i,this}endFill(){Xe(nt,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();let e=this.context.strokeStyle;return(e.width!==zr.defaultStrokeStyle.width||e.color!==zr.defaultStrokeStyle.color||e.alpha!==zr.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...e){return Xe(nt,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",e)}drawEllipse(...e){return Xe(nt,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",e)}drawPolygon(...e){return Xe(nt,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",e)}drawRect(...e){return Xe(nt,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",e)}drawRoundedRect(...e){return Xe(nt,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",e)}drawStar(...e){return Xe(nt,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",e)}}}),kg,Bg,F1=g(()=>{"use strict";kg={name:"local-uniform-msdf-bit",vertex:{header:`
|
|
struct LocalUniforms {
|
|
uColor:vec4<f32>,
|
|
uTransformMatrix:mat3x3<f32>,
|
|
uDistance: f32,
|
|
uRound:f32,
|
|
}
|
|
|
|
@group(2) @binding(0) var<uniform> localUniforms : LocalUniforms;
|
|
`,main:`
|
|
vColor *= localUniforms.uColor;
|
|
modelMatrix *= localUniforms.uTransformMatrix;
|
|
`,end:`
|
|
if(localUniforms.uRound == 1)
|
|
{
|
|
vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
|
|
}
|
|
`},fragment:{header:`
|
|
struct LocalUniforms {
|
|
uColor:vec4<f32>,
|
|
uTransformMatrix:mat3x3<f32>,
|
|
uDistance: f32
|
|
}
|
|
|
|
@group(2) @binding(0) var<uniform> localUniforms : LocalUniforms;
|
|
`,main:`
|
|
outColor = vec4<f32>(calculateMSDFAlpha(outColor, localUniforms.uColor, localUniforms.uDistance));
|
|
`}},Bg={name:"local-uniform-msdf-bit",vertex:{header:`
|
|
uniform mat3 uTransformMatrix;
|
|
uniform vec4 uColor;
|
|
uniform float uRound;
|
|
`,main:`
|
|
vColor *= uColor;
|
|
modelMatrix *= uTransformMatrix;
|
|
`,end:`
|
|
if(uRound == 1.)
|
|
{
|
|
gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
|
|
}
|
|
`},fragment:{header:`
|
|
uniform float uDistance;
|
|
`,main:`
|
|
outColor = vec4(calculateMSDFAlpha(outColor, vColor, uDistance));
|
|
`}}}),Gg,Ig,D1=g(()=>{"use strict";Gg={name:"msdf-bit",fragment:{header:`
|
|
fn calculateMSDFAlpha(msdfColor:vec4<f32>, shapeColor:vec4<f32>, distance:f32) -> f32 {
|
|
|
|
// MSDF
|
|
var median = msdfColor.r + msdfColor.g + msdfColor.b -
|
|
min(msdfColor.r, min(msdfColor.g, msdfColor.b)) -
|
|
max(msdfColor.r, max(msdfColor.g, msdfColor.b));
|
|
|
|
// SDF
|
|
median = min(median, msdfColor.a);
|
|
|
|
var screenPxDistance = distance * (median - 0.5);
|
|
var alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);
|
|
if (median < 0.01) {
|
|
alpha = 0.0;
|
|
} else if (median > 0.99) {
|
|
alpha = 1.0;
|
|
}
|
|
|
|
// Gamma correction for coverage-like alpha
|
|
var luma: f32 = dot(shapeColor.rgb, vec3<f32>(0.299, 0.587, 0.114));
|
|
var gamma: f32 = mix(1.0, 1.0 / 2.2, luma);
|
|
var coverage: f32 = pow(shapeColor.a * alpha, gamma);
|
|
|
|
return coverage;
|
|
|
|
}
|
|
`}},Ig={name:"msdf-bit",fragment:{header:`
|
|
float calculateMSDFAlpha(vec4 msdfColor, vec4 shapeColor, float distance) {
|
|
|
|
// MSDF
|
|
float median = msdfColor.r + msdfColor.g + msdfColor.b -
|
|
min(msdfColor.r, min(msdfColor.g, msdfColor.b)) -
|
|
max(msdfColor.r, max(msdfColor.g, msdfColor.b));
|
|
|
|
// SDF
|
|
median = min(median, msdfColor.a);
|
|
|
|
float screenPxDistance = distance * (median - 0.5);
|
|
float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);
|
|
|
|
if (median < 0.01) {
|
|
alpha = 0.0;
|
|
} else if (median > 0.99) {
|
|
alpha = 1.0;
|
|
}
|
|
|
|
// Gamma correction for coverage-like alpha
|
|
float luma = dot(shapeColor.rgb, vec3(0.299, 0.587, 0.114));
|
|
float gamma = mix(1.0, 1.0 / 2.2, luma);
|
|
float coverage = pow(shapeColor.a * alpha, gamma);
|
|
|
|
return coverage;
|
|
}
|
|
`}}}),Wh,$h,Og,U1=g(()=>{Ke(),_n(),ja(),Xa(),vn(),gh(),hi(),wr(),F1(),D1(),Og=class extends qr{constructor(t){let e=new dr({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new ve,type:"mat3x3<f32>"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}});Wh??(Wh=ws({name:"sdf-shader",bits:[Ha,hh(t),kg,Gg,Vn]})),$h??($h=Ts({name:"sdf-shader",bits:[Va,uh(t),Bg,Ig,jn]})),super({glProgram:$h,gpuProgram:Wh,resources:{localUniforms:e,batchSamplers:fh(t)}})}}}),Fg,L1=g(()=>{kt(),Mt(),Fg=class extends st{constructor(){super(...arguments),this.chars=Object.create(null),this.lineHeight=0,this.fontFamily="",this.fontMetrics={fontSize:0,ascent:0,descent:0},this.baseLineOffset=0,this.distanceField={type:"none",range:0},this.pages=[],this.applyFillAsTint=!0,this.baseMeasurementFontSize=100,this.baseRenderedFontSize=100}get font(){return Xe(nt,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return Xe(nt,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return Xe(nt,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return Xe(nt,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return Xe(nt,"BitmapFont.distanceFieldType is deprecated, please use BitmapFont.distanceField.type instead."),this.distanceField.type}destroy(t=!1){this.emit("destroy",this),this.removeAllListeners();for(let e in this.chars)this.chars[e].texture?.destroy();this.chars=null,t&&(this.pages.forEach(e=>e.texture.destroy(!0)),this.pages=null)}}}),Xh,Yh,N1=g(()=>{ze(),O(),Ls(),Kl(),Ft(),Rn(),Mt(),Ns(),zh(),Cg(),Us(),L1(),Xh=class Ly extends Fg{constructor(e){super(),this.resolution=1,this.pages=[],this._padding=0,this._measureCache=Object.create(null),this._currentChars=[],this._currentX=0,this._currentY=0,this._currentMaxCharHeight=0,this._currentPageIndex=-1,this._skipKerning=!1;let r={...Ly.defaultOptions,...e};this._textureSize=r.textureSize,this._mipmap=r.mipmap;let i=r.style.clone();r.overrideFill&&(i._fill.color=16777215,i._fill.alpha=1,i._fill.texture=Fe.WHITE,i._fill.fill=null),this.applyFillAsTint=r.overrideFill;let n=i.fontSize;i.fontSize=this.baseMeasurementFontSize;let s=yo(i);r.overrideSize?i._stroke&&(i._stroke.width*=this.baseRenderedFontSize/n):i.fontSize=this.baseRenderedFontSize=n,this._style=i,this._skipKerning=r.skipKerning??!1,this.resolution=r.resolution??1,this._padding=r.padding??4,r.textureStyle&&(this._textureStyle=r.textureStyle instanceof ni?r.textureStyle:new ni(r.textureStyle)),this.fontMetrics=Hr.measureFont(s),this.lineHeight=i.lineHeight||this.fontMetrics.fontSize||i.fontSize}ensureCharacters(e){let r=Hr.graphemeSegmenter(e).filter(m=>!this._currentChars.includes(m)).filter((m,y,S)=>S.indexOf(m)===y);if(!r.length)return;this._currentChars=[...this._currentChars,...r];let i;this._currentPageIndex===-1?i=this._nextPage():i=this.pages[this._currentPageIndex];let{canvas:n,context:s}=i.canvasAndContext,a=i.texture.source,o=this._style,l=this._currentX,h=this._currentY,u=this._currentMaxCharHeight,c=this.baseRenderedFontSize/this.baseMeasurementFontSize,f=this._padding*c,d=!1,_=n.width/this.resolution,v=n.height/this.resolution;for(let m=0;m<r.length;m++){let y=r[m],S=Hr.measureText(y,o,n,!1);S.lineHeight=S.height;let P=S.width*c,T=Math.ceil((o.fontStyle==="italic"?2:1)*P),z=S.height*c,D=T+f*2,L=z+f*2;if(d=!1,y!==`
|
|
`&&y!=="\r"&&y!==" "&&y!==" "&&(d=!0,u=Math.ceil(Math.max(L,u))),l+D>_&&(h+=u,u=L,l=0,h+u>v)){a.update();let ue=this._nextPage();n=ue.canvasAndContext.canvas,s=ue.canvasAndContext.context,a=ue.texture.source,l=0,h=0,u=0}let ne=P/c-(o.dropShadow?.distance??0)-(o._stroke?.width??0);if(this.chars[y]={id:y.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:ne,kerning:{}},d){this._drawGlyph(s,S,l+f,h+f,c,o);let ue=a.width*c,re=a.height*c,oe=new R(l/ue*a.width,h/re*a.height,D/ue*a.width,L/re*a.height);this.chars[y].texture=new Fe({source:a,frame:oe}),l+=Math.ceil(D)}}a.update(),this._currentX=l,this._currentY=h,this._currentMaxCharHeight=u,this._skipKerning&&this._applyKerning(r,s)}get pageTextures(){return Xe(nt,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(e,r){let i=this._measureCache;for(let n=0;n<e.length;n++){let s=e[n];for(let a=0;a<this._currentChars.length;a++){let o=this._currentChars[a],l=i[s];l||(l=i[s]=r.measureText(s).width);let h=i[o];h||(h=i[o]=r.measureText(o).width);let u=r.measureText(s+o).width,c=u-(l+h);c&&(this.chars[s].kerning[o]=c),u=r.measureText(s+o).width,c=u-(l+h),c&&(this.chars[o].kerning[s]=c)}}}_nextPage(){this._currentPageIndex++;let e=this.resolution,r=Ri.getOptimalCanvasAndContext(this._textureSize,this._textureSize,e);this._setupContext(r.context,this._style,e);let i=e*(this.baseRenderedFontSize/this.baseMeasurementFontSize),n=new Fe({source:new On({resource:r.canvas,resolution:i,alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:this._mipmap})});this._textureStyle&&(n.source.style=this._textureStyle);let s={canvasAndContext:r,texture:n};return this.pages[this._currentPageIndex]=s,s}_setupContext(e,r,i){r.fontSize=this.baseRenderedFontSize,e.scale(i,i),e.font=yo(r),r.fontSize=this.baseMeasurementFontSize,e.textBaseline=r.textBaseline;let n=r._stroke,s=n?.width??0;if(n&&(e.lineWidth=s,e.lineJoin=n.join,e.miterLimit=n.miterLimit,e.strokeStyle=bo(n,e)),r._fill&&(e.fillStyle=bo(r._fill,e)),r.dropShadow){let a=r.dropShadow,o=le.shared.setValue(a.color).toArray(),l=a.blur*i,h=a.distance*i;e.shadowColor=`rgba(${o[0]*255},${o[1]*255},${o[2]*255},${a.alpha})`,e.shadowBlur=l,e.shadowOffsetX=Math.cos(a.angle)*h,e.shadowOffsetY=Math.sin(a.angle)*h}else e.shadowColor="black",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0}_drawGlyph(e,r,i,n,s,a){let o=r.text,l=r.fontProperties,h=(a._stroke?.width??0)*s,u=i+h/2,c=n-h/2,f=l.descent*s,d=r.lineHeight*s,_=!1;a.stroke&&h&&(_=!0,e.strokeText(o,u,c+d-f));let{shadowBlur:v,shadowOffsetX:m,shadowOffsetY:y}=e;a._fill&&(_&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),e.fillText(o,u,c+d-f)),_&&(e.shadowBlur=v,e.shadowOffsetX=m,e.shadowOffsetY=y)}destroy(){super.destroy();for(let e=0;e<this.pages.length;e++){let{canvasAndContext:r,texture:i}=this.pages[e];Ri.returnCanvasAndContext(r),i.destroy(!0)}this.pages=null}},Xh.defaultOptions={textureSize:512,style:new di,mipmap:!0},Yh=Xh});function Dg(t,e,r,i){let n={width:0,height:0,offsetY:0,scale:e.fontSize/r.baseMeasurementFontSize,lines:[{width:0,charPositions:[],spaceWidth:0,spacesIndex:[],chars:[]}]};n.offsetY=r.baseLineOffset;let s=n.lines[0],a=null,o=!0,l={spaceWord:!1,width:0,start:0,index:0,positions:[],chars:[]},h=m=>{let y=s.width;for(let S=0;S<l.index;S++){let P=m.positions[S];s.chars.push(m.chars[S]),s.charPositions.push(P+y)}s.width+=m.width,o=!1,l.width=0,l.index=0,l.chars.length=0},u=()=>{let m=s.chars.length-1;if(i){let y=s.chars[m];for(;y===" ";)s.width-=r.chars[y].xAdvance,y=s.chars[--m]}n.width=Math.max(n.width,s.width),s={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},o=!0,n.lines.push(s),n.height+=r.lineHeight},c=r.baseMeasurementFontSize/e.fontSize,f=e.letterSpacing*c,d=e.wordWrapWidth*c,_=e.wordWrap&&e.breakWords,v=m=>m-f>d;for(let m=0;m<t.length+1;m++){let y,S=m===t.length;S||(y=t[m]);let P=r.chars[y]||r.chars[" "];if(/(?:\s)/.test(y)||y==="\r"||y===`
|
|
`||S){if(!o&&e.wordWrap&&v(s.width+l.width)?(u(),h(l),S||s.charPositions.push(0)):(l.start=s.width,h(l),S||s.charPositions.push(0)),y==="\r"||y===`
|
|
`)s.width!==0&&u();else if(!S){let T=P.xAdvance+(P.kerning[a]||0)+f;s.width+=T,s.spaceWidth=T,s.spacesIndex.push(s.charPositions.length),s.chars.push(y)}}else{let T=P.kerning[a]||0,z=P.xAdvance+T+f;_&&v(s.width+l.width+z)&&(h(l),u()),l.positions[l.index++]=l.width+T,l.chars.push(y),l.width+=z}a=y}return u(),e.align==="center"?z1(n):e.align==="right"?H1(n):e.align==="justify"&&V1(n),n}function z1(t){for(let e=0;e<t.lines.length;e++){let r=t.lines[e],i=t.width/2-r.width/2;for(let n=0;n<r.charPositions.length;n++)r.charPositions[n]+=i}}function H1(t){for(let e=0;e<t.lines.length;e++){let r=t.lines[e],i=t.width-r.width;for(let n=0;n<r.charPositions.length;n++)r.charPositions[n]+=i}}function V1(t){let e=t.width;for(let r=0;r<t.lines.length;r++){let i=t.lines[r],n=0,s=i.spacesIndex[n++],a=0,o=i.spacesIndex.length,l=(e-i.width)/o;for(let h=0;h<i.charPositions.length;h++)h===s&&(s=i.spacesIndex[n++],a+=l),i.charPositions[h]+=a}}var Ug=g(()=>{"use strict"});function j1(t){if(t==="")return[];typeof t=="string"&&(t=[t]);let e=[];for(let r=0,i=t.length;r<i;r++){let n=t[r];if(Array.isArray(n)){if(n.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${n.length}.`);if(n[0].length===0||n[1].length===0)throw new Error("[BitmapFont]: Invalid character delimiter.");let s=n[0].charCodeAt(0),a=n[1].charCodeAt(0);if(a<s)throw new Error("[BitmapFont]: Invalid character range.");for(let o=s,l=a;o<=l;o++)e.push(String.fromCharCode(o))}else e.push(...Array.from(n))}if(e.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return e}var W1=g(()=>{"use strict"}),zs,Lg,Ng,$1=g(()=>{Ra(),Mt(),wt(),Ns(),Us(),N1(),Ug(),W1(),zs=0,Lg=class{constructor(){this.ALPHA=[["a","z"],["A","Z"]," "],this.NUMERIC=[["0","9"]],this.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],this.ASCII=[[" ","~"]],this.defaultOptions={chars:this.ALPHANUMERIC,resolution:1,padding:4,skipKerning:!1,textureStyle:null}}getFont(t,e){let r=`${e.fontFamily}-bitmap`,i=!0;if(e._fill.fill&&!e._stroke)r+=e._fill.fill.styleKey,i=!1;else if(e._stroke||e.dropShadow){let s=e.styleKey;s=s.substring(0,s.lastIndexOf("-")),r=`${s}-bitmap`,i=!1}if(!lr.has(r)){let s=new Yh({style:e,overrideFill:i,overrideSize:!0,...this.defaultOptions});zs++,zs>50&&Ye("BitmapText",`You have dynamically created ${zs} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),s.once("destroy",()=>{zs--,lr.remove(r)}),lr.set(r,s)}let n=lr.get(r);return n.ensureCharacters?.(t),n}getLayout(t,e,r=!0){let i=this.getFont(t,e),n=Hr.graphemeSegmenter(t);return Dg(n,e,i,r)}measureText(t,e,r=!0){return this.getLayout(t,e,r)}install(...t){let e=t[0];typeof e=="string"&&(e={name:e,style:t[1],chars:t[2]?.chars,resolution:t[2]?.resolution,padding:t[2]?.padding,skipKerning:t[2]?.skipKerning},Xe(nt,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));let r=e?.name;if(!r)throw new Error("[BitmapFontManager] Property `name` is required.");e={...this.defaultOptions,...e};let i=e.style,n=i instanceof di?i:new di(i),s=n._fill.fill!==null&&n._fill.fill!==void 0,a=new Yh({style:n,overrideFill:s,skipKerning:e.skipKerning,padding:e.padding,resolution:e.resolution,overrideSize:!1,textureStyle:e.textureStyle}),o=j1(e.chars);return a.ensureCharacters(o.join("")),lr.set(`${r}-bitmap`,a),a.once("destroy",()=>lr.remove(`${r}-bitmap`)),a}uninstall(t){let e=`${t}-bitmap`,r=lr.get(e);r&&r.destroy()}},Ng=new Lg});function zg(t,e){e.groupTransform=t.groupTransform,e.groupColorAlpha=t.groupColorAlpha,e.groupColor=t.groupColor,e.groupBlendMode=t.groupBlendMode,e.globalDisplayStatus=t.globalDisplayStatus,e.groupTransform=t.groupTransform,e.localDisplayStatus=t.localDisplayStatus,e.groupAlpha=t.groupAlpha,e._roundPixels=t._roundPixels}var Hg,qh,X1=g(()=>{Ra(),X(),Rg(),Ns(),U1(),$1(),Ug(),Hg=class extends wo{destroy(){this.context.customShader&&this.context.customShader.destroy(),super.destroy()}},qh=class{constructor(t){this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuBitmapText")}validateRenderable(t){let e=this._getGpuBitmapText(t);return t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,e)),this._renderer.renderPipes.graphics.validateRenderable(e)}addRenderable(t,e){let r=this._getGpuBitmapText(t);zg(t,r),t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,r)),this._renderer.renderPipes.graphics.addRenderable(r,e),r.context.customShader&&this._updateDistanceField(t)}updateRenderable(t){let e=this._getGpuBitmapText(t);zg(t,e),this._renderer.renderPipes.graphics.updateRenderable(e),e.context.customShader&&this._updateDistanceField(t)}_updateContext(t,e){let{context:r}=e,i=Ng.getFont(t.text,t._style);r.clear(),i.distanceField.type!=="none"&&(r.customShader||(r.customShader=new Og(this._renderer.limits.maxBatchableTextures)));let n=Hr.graphemeSegmenter(t.text),s=t._style,a=i.baseLineOffset,o=Dg(n,s,i,!0),l=s.padding,h=o.scale,u=o.width,c=o.height+o.offsetY;s._stroke&&(u+=s._stroke.width/h,c+=s._stroke.width/h),r.translate(-t._anchor._x*u-l,-t._anchor._y*c-l).scale(h,h);let f=i.applyFillAsTint?s._fill.color:16777215;for(let d=0;d<o.lines.length;d++){let _=o.lines[d];for(let v=0;v<_.charPositions.length;v++){let m=_.chars[v],y=i.chars[m];y?.texture&&r.texture(y.texture,f||"black",Math.round(_.charPositions[v]+y.xOffset),Math.round(a+y.yOffset))}a+=i.lineHeight}}_getGpuBitmapText(t){return t._gpuData[this._renderer.uid]||this.initGpuText(t)}initGpuText(t){let e=new Hg;return t._gpuData[this._renderer.uid]=e,this._updateContext(t,e),e}_updateDistanceField(t){let e=this._getGpuBitmapText(t).context,r=t._style.fontFamily,i=lr.get(`${r}-bitmap`),{a:n,b:s,c:a,d:o}=t.groupTransform,l=Math.sqrt(n*n+s*s),h=Math.sqrt(a*a+o*o),u=(Math.abs(l)+Math.abs(h))/2,c=i.baseRenderedFontSize/t._style.fontSize,f=u*i.distanceField.range*(1/c);e.customShader.resources.localUniforms.uniforms.uDistance=f}destroy(){this._renderer=null}},qh.extension={type:[M.WebGLPipes,M.WebGPUPipes,M.CanvasPipes],name:"bitmapText"}}),Vg=g(()=>{X(),X1(),we.add(qh)}),jg,Y1=g(()=>{uo(),jg=class extends Bs{constructor(t){super(),this.generatingTexture=!1,this._renderer=t,t.runners.resolutionChange.add(this)}resolutionChange(){let t=this.renderable;t._autoResolution&&t.onViewUpdate()}destroy(){this._renderer.htmlText.returnTexturePromise(this.texturePromise),this.texturePromise=null,this._renderer=null}}}),Kh,q1=g(()=>{X(),Ft(),Np(),Y1(),Kh=class{constructor(t){this._renderer=t}validateRenderable(t){return t._didTextUpdate}addRenderable(t,e){let r=this._getGpuText(t);t._didTextUpdate&&(this._updateGpuText(t).catch(i=>{console.error(i)}),t._didTextUpdate=!1,Mh(r,t)),this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){let e=this._getGpuText(t);e._batcher.updateElement(e)}async _updateGpuText(t){t._didTextUpdate=!1;let e=this._getGpuText(t);if(e.generatingTexture)return;e.texturePromise&&(this._renderer.htmlText.returnTexturePromise(e.texturePromise),e.texturePromise=null),e.generatingTexture=!0,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;let r=this._renderer.htmlText.getTexturePromise(t);e.texturePromise=r,e.texture=await r;let i=t.renderGroup||t.parentRenderGroup;i&&(i.structureDidChange=!0),e.generatingTexture=!1,Mh(e,t)}_getGpuText(t){return t._gpuData[this._renderer.uid]||this.initGpuText(t)}initGpuText(t){let e=new jg(this._renderer);return e.renderable=t,e.transform=t.groupTransform,e.texture=Fe.EMPTY,e.bounds={minX:0,maxX:1,minY:0,maxY:0},e.roundPixels=this._renderer._roundPixels|t._roundPixels,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,t._gpuData[this._renderer.uid]=e,e}destroy(){this._renderer=null}},Kh.extension={type:[M.WebGLPipes,M.WebGPUPipes,M.CanvasPipes],name:"htmlText"}});function K1(){let{userAgent:t}=Dt.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(t)}var Z1=g(()=>{Jt()}),Zh,Qh,Jh,Wg=g(()=>{"use strict";Zh="http://www.w3.org/2000/svg",Qh="http://www.w3.org/1999/xhtml",Jh=class{constructor(){this.svgRoot=document.createElementNS(Zh,"svg"),this.foreignObject=document.createElementNS(Zh,"foreignObject"),this.domElement=document.createElementNS(Qh,"div"),this.styleElement=document.createElementNS(Qh,"style"),this.image=new Image;let{foreignObject:t,svgRoot:e,styleElement:r,domElement:i}=this;t.setAttribute("width","10000"),t.setAttribute("height","10000"),t.style.overflow="hidden",e.appendChild(t),t.appendChild(r),t.appendChild(i)}}});function Q1(t){let e=t._stroke,r=t._fill,i=[`div { ${[`color: ${le.shared.setValue(r.color).toHex()}`,`font-size: ${t.fontSize}px`,`font-family: ${t.fontFamily}`,`font-weight: ${t.fontWeight}`,`font-style: ${t.fontStyle}`,`font-variant: ${t.fontVariant}`,`letter-spacing: ${t.letterSpacing}px`,`text-align: ${t.align}`,`padding: ${t.padding}px`,`white-space: ${t.whiteSpace==="pre"&&t.wordWrap?"pre-wrap":t.whiteSpace}`,...t.lineHeight?[`line-height: ${t.lineHeight}px`]:[],...t.wordWrap?[`word-wrap: ${t.breakWords?"break-all":"break-word"}`,`max-width: ${t.wordWrapWidth}px`]:[],...e?[Xg(e)]:[],...t.dropShadow?[$g(t.dropShadow)]:[],...t.cssOverrides].join(";")} }`];return J1(t.tagStyles,i),i.join(" ")}function $g(t){let e=le.shared.setValue(t.color).setAlpha(t.alpha).toHexa(),r=Math.round(Math.cos(t.angle)*t.distance),i=Math.round(Math.sin(t.angle)*t.distance),n=`${r}px ${i}px`;return t.blur>0?`text-shadow: ${n} ${t.blur}px ${e}`:`text-shadow: ${n} ${e}`}function Xg(t){return[`-webkit-text-stroke-width: ${t.width}px`,`-webkit-text-stroke-color: ${le.shared.setValue(t.color).toHex()}`,`text-stroke-width: ${t.width}px`,`text-stroke-color: ${le.shared.setValue(t.color).toHex()}`,"paint-order: stroke"].join(";")}function J1(t,e){for(let r in t){let i=t[r],n=[];for(let s in i)tu[s]?n.push(tu[s](i[s])):eu[s]&&n.push(eu[s].replace("{{VALUE}}",i[s]));e.push(`${r} { ${n.join(";")} }`)}}var eu,tu,ew=g(()=>{ze(),eu={fontSize:"font-size: {{VALUE}}px",fontFamily:"font-family: {{VALUE}}",fontWeight:"font-weight: {{VALUE}}",fontStyle:"font-style: {{VALUE}}",fontVariant:"font-variant: {{VALUE}}",letterSpacing:"letter-spacing: {{VALUE}}px",align:"text-align: {{VALUE}}",padding:"padding: {{VALUE}}px",whiteSpace:"white-space: {{VALUE}}",lineHeight:"line-height: {{VALUE}}px",wordWrapWidth:"max-width: {{VALUE}}px"},tu={fill:t=>`color: ${le.shared.setValue(t).toHex()}`,breakWords:t=>`word-wrap: ${t?"break-all":"break-word"}`,stroke:Xg,dropShadow:$g}}),Yg,tw=g(()=>{wt(),Us(),ew(),Yg=class Ny extends di{constructor(e={}){super(e),this._cssOverrides=[],this.cssOverrides=e.cssOverrides??[],this.tagStyles=e.tagStyles??{}}set cssOverrides(e){this._cssOverrides=e instanceof Array?e:[e],this.update()}get cssOverrides(){return this._cssOverrides}update(){this._cssStyle=null,super.update()}clone(){return new Ny({align:this.align,breakWords:this.breakWords,dropShadow:this.dropShadow?{...this.dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,cssOverrides:this.cssOverrides,tagStyles:{...this.tagStyles}})}get cssStyle(){return this._cssStyle||(this._cssStyle=Q1(this)),this._cssStyle}addOverride(...e){let r=e.filter(i=>!this.cssOverrides.includes(i));r.length>0&&(this.cssOverrides.push(...r),this.update())}removeOverride(...e){let r=e.filter(i=>this.cssOverrides.includes(i));r.length>0&&(this.cssOverrides=this.cssOverrides.filter(i=>!r.includes(i)),this.update())}set fill(e){typeof e!="string"&&typeof e!="number"&&Ye("[HTMLTextStyle] only color fill is not supported by HTMLText"),super.fill=e}set stroke(e){e&&typeof e!="string"&&typeof e!="number"&&Ye("[HTMLTextStyle] only color stroke is not supported by HTMLText"),super.stroke=e}}});function rw(t,e){let r=e.fontFamily,i=[],n={},s=/font-family:([^;"\s]+)/g,a=t.match(s);function o(l){n[l]||(i.push(l),n[l]=!0)}if(Array.isArray(r))for(let l=0;l<r.length;l++)o(r[l]);else o(r);a&&a.forEach(l=>{let h=l.split(":")[1].trim();o(h)});for(let l in e.tagStyles){let h=e.tagStyles[l].fontFamily;o(h)}return i}var iw=g(()=>{"use strict"});async function nw(t){let e=await(await Dt.get().fetch(t)).blob(),r=new FileReader;return await new Promise((i,n)=>{r.onloadend=()=>i(r.result),r.onerror=n,r.readAsDataURL(e)})}var sw=g(()=>{Jt()});async function qg(t,e){let r=await nw(e);return`@font-face {
|
|
font-family: "${t.fontFamily}";
|
|
src: url('${r}');
|
|
font-weight: ${t.fontWeight};
|
|
font-style: ${t.fontStyle};
|
|
}`}var aw=g(()=>{sw()});async function ow(t,e,r){let i=t.filter(n=>lr.has(`${n}-and-url`)).map((n,s)=>{if(!Hs.has(n)){let{url:a}=lr.get(`${n}-and-url`);s===0?Hs.set(n,qg({fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:n},a)):Hs.set(n,qg({fontWeight:r.fontWeight,fontStyle:r.fontStyle,fontFamily:n},a))}return Hs.get(n)});return(await Promise.all(i)).join(`
|
|
`)}var Hs,lw=g(()=>{Ra(),aw(),Hs=new Map});function hw(t,e,r,i,n){let{domElement:s,styleElement:a,svgRoot:o}=n;s.innerHTML=`<style>${e.cssStyle}</style><div style='padding:0;'>${t}</div>`,s.setAttribute("style",`transform: scale(${r});transform-origin: top left; display: inline-block`),a.textContent=i;let{width:l,height:h}=n.image;return o.setAttribute("width",l.toString()),o.setAttribute("height",h.toString()),new XMLSerializer().serializeToString(o)}var uw=g(()=>{"use strict"});function cw(t,e){let r=Ri.getOptimalCanvasAndContext(t.width,t.height,e),{context:i}=r;return i.clearRect(0,0,t.width,t.height),i.drawImage(t,0,0),r}var dw=g(()=>{Ls()});function fw(t,e,r){return new Promise(async i=>{r&&await new Promise(n=>setTimeout(n,100)),t.onload=()=>{i()},t.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(e)}`,t.crossOrigin="anonymous"})}var pw=g(()=>{"use strict"});function gw(t,e,r,i){i||(i=Kg||(Kg=new Jh));let{domElement:n,styleElement:s,svgRoot:a}=i;n.innerHTML=`<style>${e.cssStyle};</style><div style='padding:0'>${t}</div>`,n.setAttribute("style","transform-origin: top left; display: inline-block"),r&&(s.textContent=r),document.body.appendChild(a);let o=n.getBoundingClientRect();a.remove();let l=e.padding*2;return{width:o.width-l,height:o.height-l}}var Kg,mw=g(()=>{Wg()}),ru,_w=g(()=>{X(),Ls(),ln(),Mi(),Z1(),wt(),zt(),bg(),Wg(),tw(),iw(),lw(),uw(),dw(),pw(),mw(),ru=class{constructor(t){this._renderer=t,this._createCanvas=t.type===Lr.WEBGPU}getTexture(t){return this.getTexturePromise(t)}getTexturePromise(t){return this._buildTexturePromise(t)}async _buildTexturePromise(t){let{text:e,style:r,resolution:i,textureStyle:n}=t,s=Rt.get(Jh),a=rw(e,r),o=await ow(a,r,Yg.defaultTextStyle),l=gw(e,r,o,s),h=Math.ceil(Math.ceil(Math.max(1,l.width)+r.padding*2)*i),u=Math.ceil(Math.ceil(Math.max(1,l.height)+r.padding*2)*i),c=s.image,f=2;c.width=(h|0)+f,c.height=(u|0)+f;let d=hw(e,r,i,o,s);await fw(c,d,K1()&&a.length>0);let _=c,v;this._createCanvas&&(v=cw(c,i));let m=yg(v?v.canvas:_,c.width-f,c.height-f,i);return n&&(m.source.style=n),this._createCanvas&&(this._renderer.texture.initSource(m.source),Ri.returnCanvasAndContext(v)),Rt.return(s),m}returnTexturePromise(t){t.then(e=>{this._cleanUp(e)}).catch(()=>{Ye("HTMLTextSystem: Failed to clean texture")})}_cleanUp(t){or.returnTexture(t,!0),t.source.resource=null,t.source.uploadMethodId="unknown"}destroy(){this._renderer=null}},ru.extension={type:[M.WebGLSystem,M.WebGPUSystem,M.CanvasSystem],name:"htmlText"}}),Zg=g(()=>{X(),q1(),_w(),we.add(ru),we.add(Kh)}),iu,To,nu=g(()=>{gn(),Xi(),ys(),Mt(),iu=class zy extends Un{constructor(...e){let r=e[0]??{};r instanceof Float32Array&&(Xe(nt,"use new MeshGeometry({ positions, uvs, indices }) instead"),r={positions:r,uvs:e[1],indices:e[2]}),r={...zy.defaultOptions,...r};let i=r.positions||new Float32Array([0,0,1,0,1,1,0,1]),n=r.uvs;n||(r.positions?n=new Float32Array(i.length):n=new Float32Array([0,0,1,0,1,1,0,1]));let s=r.indices||new Uint32Array([0,1,2,0,2,3]),a=r.shrinkBuffersToFit,o=new br({data:i,label:"attribute-mesh-positions",shrinkToFit:a,usage:ct.VERTEX|ct.COPY_DST}),l=new br({data:n,label:"attribute-mesh-uvs",shrinkToFit:a,usage:ct.VERTEX|ct.COPY_DST}),h=new br({data:s,label:"index-mesh-buffer",shrinkToFit:a,usage:ct.INDEX|ct.COPY_DST});super({attributes:{aPosition:{buffer:o,format:"float32x2",stride:8,offset:0},aUV:{buffer:l,format:"float32x2",stride:8,offset:0}},indexBuffer:h,topology:r.topology}),this.batchMode="auto"}get positions(){return this.attributes.aPosition.buffer.data}set positions(e){this.attributes.aPosition.buffer.data=e}get uvs(){return this.attributes.aUV.buffer.data}set uvs(e){this.attributes.aUV.buffer.data=e}get indices(){return this.indexBuffer.data}set indices(e){this.indexBuffer.data=e}},iu.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:!1},To=iu}),qn,Qg,So,Vs=g(()=>{"use strict";qn={name:"local-uniform-bit",vertex:{header:`
|
|
|
|
struct LocalUniforms {
|
|
uTransformMatrix:mat3x3<f32>,
|
|
uColor:vec4<f32>,
|
|
uRound:f32,
|
|
}
|
|
|
|
@group(1) @binding(0) var<uniform> localUniforms : LocalUniforms;
|
|
`,main:`
|
|
vColor *= localUniforms.uColor;
|
|
modelMatrix *= localUniforms.uTransformMatrix;
|
|
`,end:`
|
|
if(localUniforms.uRound == 1)
|
|
{
|
|
vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
|
|
}
|
|
`}},Qg={...qn,vertex:{...qn.vertex,header:qn.vertex.header.replace("group(1)","group(2)")}},So={name:"local-uniform-bit",vertex:{header:`
|
|
|
|
uniform mat3 uTransformMatrix;
|
|
uniform vec4 uColor;
|
|
uniform float uRound;
|
|
`,main:`
|
|
vColor *= uColor;
|
|
modelMatrix = uTransformMatrix;
|
|
`,end:`
|
|
if(uRound == 1.)
|
|
{
|
|
gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
|
|
}
|
|
`}}}),Jg,em,vw=g(()=>{"use strict";Jg={name:"tiling-bit",vertex:{header:`
|
|
struct TilingUniforms {
|
|
uMapCoord:mat3x3<f32>,
|
|
uClampFrame:vec4<f32>,
|
|
uClampOffset:vec2<f32>,
|
|
uTextureTransform:mat3x3<f32>,
|
|
uSizeAnchor:vec4<f32>
|
|
};
|
|
|
|
@group(2) @binding(0) var<uniform> tilingUniforms: TilingUniforms;
|
|
@group(2) @binding(1) var uTexture: texture_2d<f32>;
|
|
@group(2) @binding(2) var uSampler: sampler;
|
|
`,main:`
|
|
uv = (tilingUniforms.uTextureTransform * vec3(uv, 1.0)).xy;
|
|
|
|
position = (position - tilingUniforms.uSizeAnchor.zw) * tilingUniforms.uSizeAnchor.xy;
|
|
`},fragment:{header:`
|
|
struct TilingUniforms {
|
|
uMapCoord:mat3x3<f32>,
|
|
uClampFrame:vec4<f32>,
|
|
uClampOffset:vec2<f32>,
|
|
uTextureTransform:mat3x3<f32>,
|
|
uSizeAnchor:vec4<f32>
|
|
};
|
|
|
|
@group(2) @binding(0) var<uniform> tilingUniforms: TilingUniforms;
|
|
@group(2) @binding(1) var uTexture: texture_2d<f32>;
|
|
@group(2) @binding(2) var uSampler: sampler;
|
|
`,main:`
|
|
|
|
var coord = vUV + ceil(tilingUniforms.uClampOffset - vUV);
|
|
coord = (tilingUniforms.uMapCoord * vec3(coord, 1.0)).xy;
|
|
var unclamped = coord;
|
|
coord = clamp(coord, tilingUniforms.uClampFrame.xy, tilingUniforms.uClampFrame.zw);
|
|
|
|
var bias = 0.;
|
|
|
|
if(unclamped.x == coord.x && unclamped.y == coord.y)
|
|
{
|
|
bias = -32.;
|
|
}
|
|
|
|
outColor = textureSampleBias(uTexture, uSampler, coord, bias);
|
|
`}},em={name:"tiling-bit",vertex:{header:`
|
|
uniform mat3 uTextureTransform;
|
|
uniform vec4 uSizeAnchor;
|
|
|
|
`,main:`
|
|
uv = (uTextureTransform * vec3(aUV, 1.0)).xy;
|
|
|
|
position = (position - uSizeAnchor.zw) * uSizeAnchor.xy;
|
|
`},fragment:{header:`
|
|
uniform sampler2D uTexture;
|
|
uniform mat3 uMapCoord;
|
|
uniform vec4 uClampFrame;
|
|
uniform vec2 uClampOffset;
|
|
`,main:`
|
|
|
|
vec2 coord = vUV + ceil(uClampOffset - vUV);
|
|
coord = (uMapCoord * vec3(coord, 1.0)).xy;
|
|
vec2 unclamped = coord;
|
|
coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
|
|
|
|
outColor = texture(uTexture, coord, unclamped == coord ? 0.0 : -32.0);// lod-bias very negative to force lod 0
|
|
|
|
`}}}),su,au,tm,yw=g(()=>{Ke(),_n(),Vs(),vn(),hi(),wr(),Ft(),vw(),tm=class extends qr{constructor(){su??(su=ws({name:"tiling-sprite-shader",bits:[qn,Jg,Vn]})),au??(au=Ts({name:"tiling-sprite-shader",bits:[So,em,jn]}));let t=new dr({uMapCoord:{value:new ve,type:"mat3x3<f32>"},uClampFrame:{value:new Float32Array([0,0,1,1]),type:"vec4<f32>"},uClampOffset:{value:new Float32Array([0,0]),type:"vec2<f32>"},uTextureTransform:{value:new ve,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:au,gpuProgram:su,resources:{localUniforms:new dr({uTransformMatrix:{value:new ve,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:Fe.EMPTY.source,uSampler:Fe.EMPTY.source.style}})}updateUniforms(t,e,r,i,n,s){let a=this.resources.tilingUniforms,o=s.width,l=s.height,h=s.textureMatrix,u=a.uniforms.uTextureTransform;u.set(r.a*o/t,r.b*o/e,r.c*l/t,r.d*l/e,r.tx/t,r.ty/e),u.invert(),a.uniforms.uMapCoord=h.mapCoord,a.uniforms.uClampFrame=h.uClampFrame,a.uniforms.uClampOffset=h.uClampOffset,a.uniforms.uTextureTransform=u,a.uniforms.uSizeAnchor[0]=t,a.uniforms.uSizeAnchor[1]=e,a.uniforms.uSizeAnchor[2]=i,a.uniforms.uSizeAnchor[3]=n,s&&(this.resources.uTexture=s.source,this.resources.uSampler=s.source.style)}}}),rm,xw=g(()=>{nu(),rm=class extends To{constructor(){super({positions:new Float32Array([0,0,1,0,1,1,0,1]),uvs:new Float32Array([0,0,1,0,1,1,0,1]),indices:new Uint32Array([0,1,2,0,2,3])})}}});function bw(t,e){let r=t.anchor.x,i=t.anchor.y;e[0]=-r*t.width,e[1]=-i*t.height,e[2]=(1-r)*t.width,e[3]=-i*t.height,e[4]=(1-r)*t.width,e[5]=(1-i)*t.height,e[6]=-r*t.width,e[7]=(1-i)*t.height}var ww=g(()=>{"use strict"});function Tw(t,e,r,i){let n=0,s=t.length/(e||2),a=i.a,o=i.b,l=i.c,h=i.d,u=i.tx,c=i.ty;for(r*=e;n<s;){let f=t[r],d=t[r+1];t[r]=a*f+l*d+u,t[r+1]=o*f+h*d+c,r+=e,n++}}var Sw=g(()=>{"use strict"});function Ew(t,e){let r=t.texture,i=r.frame.width,n=r.frame.height,s=0,a=0;t.applyAnchorToTexture&&(s=t.anchor.x,a=t.anchor.y),e[0]=e[6]=-s,e[2]=e[4]=1-s,e[1]=e[3]=-a,e[5]=e[7]=1-a;let o=ve.shared;o.copyFrom(t._tileTransform.matrix),o.tx/=t.width,o.ty/=t.height,o.invert(),o.scale(t.width/i,t.height/n),Tw(e,2,0,o)}var Cw=g(()=>{Ke(),Sw()}),js,im,ou,Aw=g(()=>{X(),Ba(),ci(),Mi(),ks(),wh(),nu(),yw(),xw(),ww(),Cw(),js=new rm,im=class{constructor(){this.canBatch=!0,this.geometry=new To({indices:js.indices.slice(),positions:js.positions.slice(),uvs:js.uvs.slice()})}destroy(){this.geometry.destroy(),this.shader?.destroy()}},ou=class{constructor(t){this._state=Nr.default2d,this._renderer=t}validateRenderable(t){let e=this._getTilingSpriteData(t),r=e.canBatch;this._updateCanBatch(t);let i=e.canBatch;if(i&&i===r){let{batchableMesh:n}=e;return!n._batcher.checkAndUpdateTexture(n,t.texture)}return r!==i}addRenderable(t,e){let r=this._renderer.renderPipes.batch;this._updateCanBatch(t);let i=this._getTilingSpriteData(t),{geometry:n,canBatch:s}=i;if(s){i.batchableMesh||(i.batchableMesh=new ho);let a=i.batchableMesh;t.didViewUpdate&&(this._updateBatchableMesh(t),a.geometry=n,a.renderable=t,a.transform=t.groupTransform,a.setTexture(t._texture)),a.roundPixels=this._renderer._roundPixels|t._roundPixels,r.addToBatch(a,e)}else r.break(e),i.shader||(i.shader=new tm),this.updateRenderable(t),e.add(t)}execute(t){let{shader:e}=this._getTilingSpriteData(t);e.groups[0]=this._renderer.globalUniforms.bindGroup;let r=e.resources.localUniforms.uniforms;r.uTransformMatrix=t.groupTransform,r.uRound=this._renderer._roundPixels|t._roundPixels,Rs(t.groupColorAlpha,r.uColor,0),this._state.blendMode=vs(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:js,shader:e,state:this._state})}updateRenderable(t){let e=this._getTilingSpriteData(t),{canBatch:r}=e;if(r){let{batchableMesh:i}=e;t.didViewUpdate&&this._updateBatchableMesh(t),i._batcher.updateElement(i)}else if(t.didViewUpdate){let{shader:i}=e;i.updateUniforms(t.width,t.height,t._tileTransform.matrix,t.anchor.x,t.anchor.y,t.texture)}}_getTilingSpriteData(t){return t._gpuData[this._renderer.uid]||this._initTilingSpriteData(t)}_initTilingSpriteData(t){let e=new im;return e.renderable=t,t._gpuData[this._renderer.uid]=e,e}_updateBatchableMesh(t){let e=this._getTilingSpriteData(t),{geometry:r}=e,i=t.texture.source.style;i.addressMode!=="repeat"&&(i.addressMode="repeat",i.update()),Ew(t,r.uvs),bw(t,r.positions)}destroy(){this._renderer=null}_updateCanBatch(t){let e=this._getTilingSpriteData(t),r=t.texture,i=!0;return this._renderer.type===Lr.WEBGL&&(i=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=r.textureMatrix.isSimple&&(i||r.source.isPowerOfTwo),e.canBatch}},ou.extension={type:[M.WebGLPipes,M.WebGPUPipes,M.CanvasPipes],name:"tilingSprite"}}),nm=g(()=>{X(),Aw(),we.add(ou)}),lu,sm,Pw=g(()=>{Mt(),nu(),lu=class Hy extends To{constructor(...e){super({});let r=e[0]??{};typeof r=="number"&&(Xe(nt,"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"),r={width:r,height:e[1],verticesX:e[2],verticesY:e[3]}),this.build(r)}build(e){e={...Hy.defaultOptions,...e},this.verticesX=this.verticesX??e.verticesX,this.verticesY=this.verticesY??e.verticesY,this.width=this.width??e.width,this.height=this.height??e.height;let r=this.verticesX*this.verticesY,i=[],n=[],s=[],a=this.verticesX-1,o=this.verticesY-1,l=this.width/a,h=this.height/o;for(let c=0;c<r;c++){let f=c%this.verticesX,d=c/this.verticesX|0;i.push(f*l,d*h),n.push(f/a,d/o)}let u=a*o;for(let c=0;c<u;c++){let f=c%a,d=c/a|0,_=d*this.verticesX+f,v=d*this.verticesX+f+1,m=(d+1)*this.verticesX+f,y=(d+1)*this.verticesX+f+1;s.push(_,v,m,v,y,m)}this.buffers[0].data=new Float32Array(i),this.buffers[1].data=new Float32Array(n),this.indexBuffer.data=new Uint32Array(s),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()}},lu.defaultOptions={width:100,height:100,verticesX:10,verticesY:10},sm=lu}),hu,am,Mw=g(()=>{Pw(),hu=class Vy extends sm{constructor(e={}){e={...Vy.defaultOptions,...e},super({width:e.width,height:e.height,verticesX:4,verticesY:4}),this.update(e)}update(e){this.width=e.width??this.width,this.height=e.height??this.height,this._originalWidth=e.originalWidth??this._originalWidth,this._originalHeight=e.originalHeight??this._originalHeight,this._leftWidth=e.leftWidth??this._leftWidth,this._rightWidth=e.rightWidth??this._rightWidth,this._topHeight=e.topHeight??this._topHeight,this._bottomHeight=e.bottomHeight??this._bottomHeight,this._anchorX=e.anchor?.x,this._anchorY=e.anchor?.y,this.updateUvs(),this.updatePositions()}updatePositions(){let e=this.positions,{width:r,height:i,_leftWidth:n,_rightWidth:s,_topHeight:a,_bottomHeight:o,_anchorX:l,_anchorY:h}=this,u=n+s,c=r>u?1:r/u,f=a+o,d=i>f?1:i/f,_=Math.min(c,d),v=l*r,m=h*i;e[0]=e[8]=e[16]=e[24]=-v,e[2]=e[10]=e[18]=e[26]=n*_-v,e[4]=e[12]=e[20]=e[28]=r-s*_-v,e[6]=e[14]=e[22]=e[30]=r-v,e[1]=e[3]=e[5]=e[7]=-m,e[9]=e[11]=e[13]=e[15]=a*_-m,e[17]=e[19]=e[21]=e[23]=i-o*_-m,e[25]=e[27]=e[29]=e[31]=i-m,this.getBuffer("aPosition").update()}updateUvs(){let e=this.uvs;e[0]=e[8]=e[16]=e[24]=0,e[1]=e[3]=e[5]=e[7]=0,e[6]=e[14]=e[22]=e[30]=1,e[25]=e[27]=e[29]=e[31]=1;let r=1/this._originalWidth,i=1/this._originalHeight;e[2]=e[10]=e[18]=e[26]=r*this._leftWidth,e[9]=e[11]=e[13]=e[15]=i*this._topHeight,e[4]=e[12]=e[20]=e[28]=1-r*this._rightWidth,e[17]=e[19]=e[21]=e[23]=1-i*this._bottomHeight,this.getBuffer("aUV").update()}},hu.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100},am=hu}),om,uu,Rw=g(()=>{X(),wh(),Mw(),om=class extends ho{constructor(){super(),this.geometry=new am}destroy(){this.geometry.destroy()}},uu=class{constructor(t){this._renderer=t}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){let e=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}_updateBatchableSprite(t,e){e.geometry.update(t),e.setTexture(t._texture)}_getGpuSprite(t){return t._gpuData[this._renderer.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=t._gpuData[this._renderer.uid]=new om,r=e;return r.renderable=t,r.transform=t.groupTransform,r.texture=t._texture,r.roundPixels=this._renderer._roundPixels|t._roundPixels,t.didViewUpdate||this._updateBatchableSprite(t,r),e}destroy(){this._renderer=null}},uu.extension={type:[M.WebGLPipes,M.WebGPUPipes,M.CanvasPipes],name:"nineSliceSprite"}}),lm=g(()=>{X(),Rw(),we.add(uu)}),cu,kw=g(()=>{X(),cu=class{constructor(t){this._renderer=t}push(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:e,filterEffect:t})}pop(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}execute(t){t.action==="pushFilter"?this._renderer.filter.push(t):t.action==="popFilter"&&this._renderer.filter.pop()}destroy(){this._renderer=null}},cu.extension={type:[M.WebGLPipes,M.WebGPUPipes,M.CanvasPipes],name:"filter"}});function Bw(t,e){e.clear();let r=e.matrix;for(let i=0;i<t.length;i++){let n=t[i];n.globalDisplayStatus<7||(e.matrix=n.worldTransform,e.addBounds(n.bounds))}return e.matrix=r,e}var Gw=g(()=>{"use strict"}),hm,um,du,Iw=g(()=>{X(),Ke(),dn(),ys(),wr(),Ft(),ln(),Mi(),se(),Gw(),wt(),hm=new Un({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:"float32x2",stride:8,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])}),um=class{constructor(){this.skip=!1,this.inputTexture=null,this.backTexture=null,this.filters=null,this.bounds=new $,this.container=null,this.blendRequired=!1,this.outputRenderSurface=null,this.globalFrame={x:0,y:0,width:0,height:0}}},du=class{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new dr({uInputSize:{value:new Float32Array(4),type:"vec4<f32>"},uInputPixel:{value:new Float32Array(4),type:"vec4<f32>"},uInputClamp:{value:new Float32Array(4),type:"vec4<f32>"},uOutputFrame:{value:new Float32Array(4),type:"vec4<f32>"},uGlobalFrame:{value:new Float32Array(4),type:"vec4<f32>"},uOutputTexture:{value:new Float32Array(4),type:"vec4<f32>"}}),this._globalFilterBindGroup=new li({}),this.renderer=t}get activeBackTexture(){return this._activeFilterData?.backTexture}push(t){let e=this.renderer,r=t.filterEffect.filters,i=this._pushFilterData();i.skip=!1,i.filters=r,i.container=t.container,i.outputRenderSurface=e.renderTarget.renderSurface;let n=e.renderTarget.renderTarget.colorTexture.source,s=n.resolution,a=n.antialias;if(r.length===0){i.skip=!0;return}let o=i.bounds;if(this._calculateFilterArea(t,o),this._calculateFilterBounds(i,e.renderTarget.rootViewPort,a,s,1),i.skip)return;let l=this._getPreviousFilterData(),h=this._findFilterResolution(s),u=0,c=0;l&&(u=l.bounds.minX,c=l.bounds.minY),this._calculateGlobalFrame(i,u,c,h,n.width,n.height),this._setupFilterTextures(i,o,e,l)}generateFilteredTexture({texture:t,filters:e}){let r=this._pushFilterData();this._activeFilterData=r,r.skip=!1,r.filters=e;let i=t.source,n=i.resolution,s=i.antialias;if(e.length===0)return r.skip=!0,t;let a=r.bounds;if(a.addRect(t.frame),this._calculateFilterBounds(r,a.rectangle,s,n,0),r.skip)return t;let o=n;this._calculateGlobalFrame(r,0,0,o,i.width,i.height),r.outputRenderSurface=or.getOptimalTexture(a.width,a.height,r.resolution,r.antialias),r.backTexture=Fe.EMPTY,r.inputTexture=t,this.renderer.renderTarget.finishRenderPass(),this._applyFiltersToTexture(r,!0);let l=r.outputRenderSurface;return l.source.alphaMode="premultiplied-alpha",l}pop(){let t=this.renderer,e=this._popFilterData();e.skip||(t.globalUniforms.pop(),t.renderTarget.finishRenderPass(),this._activeFilterData=e,this._applyFiltersToTexture(e,!1),e.blendRequired&&or.returnTexture(e.backTexture),or.returnTexture(e.inputTexture))}getBackTexture(t,e,r){let i=t.colorTexture.source._resolution,n=or.getOptimalTexture(e.width,e.height,i,!1),s=e.minX,a=e.minY;r&&(s-=r.minX,a-=r.minY),s=Math.floor(s*i),a=Math.floor(a*i);let o=Math.ceil(e.width*i),l=Math.ceil(e.height*i);return this.renderer.renderTarget.copyToTexture(t,n,{x:s,y:a},{width:o,height:l},{x:0,y:0}),n}applyFilter(t,e,r,i){let n=this.renderer,s=this._activeFilterData,a=s.outputRenderSurface===r,o=n.renderTarget.rootRenderTarget.colorTexture.source._resolution,l=this._findFilterResolution(o),h=0,u=0;if(a){let c=this._findPreviousFilterOffset();h=c.x,u=c.y}this._updateFilterUniforms(e,r,s,h,u,l,a,i),this._setupBindGroupsAndRender(t,e,n)}calculateSpriteMatrix(t,e){let r=this._activeFilterData,i=t.set(r.inputTexture._source.width,0,0,r.inputTexture._source.height,r.bounds.minX,r.bounds.minY),n=e.worldTransform.copyTo(ve.shared),s=e.renderGroup||e.parentRenderGroup;return s&&s.cacheToLocalTransform&&n.prepend(s.cacheToLocalTransform),n.invert(),i.prepend(n),i.scale(1/e.texture.frame.width,1/e.texture.frame.height),i.translate(e.anchor.x,e.anchor.y),i}destroy(){}_setupBindGroupsAndRender(t,e,r){if(r.renderPipes.uniformBatch){let i=r.renderPipes.uniformBatch.getUboResource(this._filterGlobalUniforms);this._globalFilterBindGroup.setResource(i,0)}else this._globalFilterBindGroup.setResource(this._filterGlobalUniforms,0);this._globalFilterBindGroup.setResource(e.source,1),this._globalFilterBindGroup.setResource(e.source.style,2),t.groups[0]=this._globalFilterBindGroup,r.encoder.draw({geometry:hm,shader:t,state:t._state,topology:"triangle-list"}),r.type===Lr.WEBGL&&r.renderTarget.finishRenderPass()}_setupFilterTextures(t,e,r,i){if(t.backTexture=Fe.EMPTY,t.blendRequired){r.renderTarget.finishRenderPass();let n=r.renderTarget.getRenderTarget(t.outputRenderSurface);t.backTexture=this.getBackTexture(n,e,i?.bounds)}t.inputTexture=or.getOptimalTexture(e.width,e.height,t.resolution,t.antialias),r.renderTarget.bind(t.inputTexture,!0),r.globalUniforms.push({offset:e})}_calculateGlobalFrame(t,e,r,i,n,s){let a=t.globalFrame;a.x=e*i,a.y=r*i,a.width=n*i,a.height=s*i}_updateFilterUniforms(t,e,r,i,n,s,a,o){let l=this._filterGlobalUniforms.uniforms,h=l.uOutputFrame,u=l.uInputSize,c=l.uInputPixel,f=l.uInputClamp,d=l.uGlobalFrame,_=l.uOutputTexture;a?(h[0]=r.bounds.minX-i,h[1]=r.bounds.minY-n):(h[0]=0,h[1]=0),h[2]=t.frame.width,h[3]=t.frame.height,u[0]=t.source.width,u[1]=t.source.height,u[2]=1/u[0],u[3]=1/u[1],c[0]=t.source.pixelWidth,c[1]=t.source.pixelHeight,c[2]=1/c[0],c[3]=1/c[1],f[0]=.5*c[2],f[1]=.5*c[3],f[2]=t.frame.width*u[2]-.5*c[2],f[3]=t.frame.height*u[3]-.5*c[3];let v=this.renderer.renderTarget.rootRenderTarget.colorTexture;d[0]=i*s,d[1]=n*s,d[2]=v.source.width*s,d[3]=v.source.height*s,e instanceof Fe&&(e.source.resource=null);let m=this.renderer.renderTarget.getRenderTarget(e);this.renderer.renderTarget.bind(e,!!o),e instanceof Fe?(_[0]=e.frame.width,_[1]=e.frame.height):(_[0]=m.width,_[1]=m.height),_[2]=m.isRoot?-1:1,this._filterGlobalUniforms.update()}_findFilterResolution(t){let e=this._filterStackIndex-1;for(;e>0&&this._filterStack[e].skip;)--e;return e>0&&this._filterStack[e].inputTexture?this._filterStack[e].inputTexture.source._resolution:t}_findPreviousFilterOffset(){let t=0,e=0,r=this._filterStackIndex;for(;r>0;){r--;let i=this._filterStack[r];if(!i.skip){t=i.bounds.minX,e=i.bounds.minY;break}}return{x:t,y:e}}_calculateFilterArea(t,e){if(t.renderables?Bw(t.renderables,e):t.filterEffect.filterArea?(e.clear(),e.addRect(t.filterEffect.filterArea),e.applyMatrix(t.container.worldTransform)):t.container.getFastGlobalBounds(!0,e),t.container){let r=(t.container.renderGroup||t.container.parentRenderGroup).cacheToLocalTransform;r&&e.applyMatrix(r)}}_applyFiltersToTexture(t,e){let r=t.inputTexture,i=t.bounds,n=t.filters;if(this._globalFilterBindGroup.setResource(r.source.style,2),this._globalFilterBindGroup.setResource(t.backTexture.source,3),n.length===1)n[0].apply(this,r,t.outputRenderSurface,e);else{let s=t.inputTexture,a=or.getOptimalTexture(i.width,i.height,s.source._resolution,!1),o=a,l=0;for(l=0;l<n.length-1;++l){n[l].apply(this,s,o,!0);let h=s;s=o,o=h}n[l].apply(this,s,t.outputRenderSurface,e),or.returnTexture(a)}}_calculateFilterBounds(t,e,r,i,n){let s=this.renderer,a=t.bounds,o=t.filters,l=1/0,h=0,u=!0,c=!1,f=!1,d=!0;for(let _=0;_<o.length;_++){let v=o[_];if(l=Math.min(l,v.resolution==="inherit"?i:v.resolution),h+=v.padding,v.antialias==="off"?u=!1:v.antialias==="inherit"&&u&&(u=r),v.clipToViewport||(d=!1),!(v.compatibleRenderers&s.type)){f=!1;break}if(v.blendRequired&&!(s.backBuffer?.useBackBuffer??!0)){Ye("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),f=!1;break}f=v.enabled||f,c||(c=v.blendRequired)}if(!f){t.skip=!0;return}if(d&&a.fitBounds(0,e.width/i,0,e.height/i),a.scale(l).ceil().scale(1/l).pad((h|0)*n),!a.isPositive){t.skip=!0;return}t.antialias=u,t.resolution=l,t.blendRequired=c}_popFilterData(){return this._filterStackIndex--,this._filterStack[this._filterStackIndex]}_getPreviousFilterData(){let t,e=this._filterStackIndex-1;for(;e>1&&(e--,t=this._filterStack[e],!!t.skip););return t}_pushFilterData(){let t=this._filterStack[this._filterStackIndex];return t||(t=this._filterStack[this._filterStackIndex]=new um),this._filterStackIndex++,t}},du.extension={type:[M.WebGLSystem,M.WebGPUSystem],name:"filter"}}),cm=g(()=>{X(),kw(),Iw(),we.add(du),we.add(cu)}),Ow={},Fw=g(()=>{dx(),Id(),vx(),xx(),$l(),Ql(),Pp(),Mp(),Lp(),Mg(),Vg(),Zg(),nm(),lm(),cm()}),Dw={},Uw=g(()=>{Id(),$l(),Ql(),Pp(),Mp(),Lp(),Mg(),Vg(),Zg(),nm(),lm(),cm()}),fu,dm,Lw=g(()=>{Ln(),bs(),hi(),ci(),fu=class pd extends qr{constructor(e){e={...pd.defaultOptions,...e},super(e),this.enabled=!0,this._state=Nr.for2d(),this.blendMode=e.blendMode,this.padding=e.padding,typeof e.antialias=="boolean"?this.antialias=e.antialias?"on":"off":this.antialias=e.antialias,this.resolution=e.resolution,this.blendRequired=e.blendRequired,this.clipToViewport=e.clipToViewport,this.addResource("uTexture",0,1)}apply(e,r,i,n){e.applyFilter(this,r,i,n)}get blendMode(){return this._state.blendMode}set blendMode(e){this._state.blendMode=e}static from(e){let{gpu:r,gl:i,...n}=e,s,a;return r&&(s=Hn.from(r)),i&&(a=mn.from(i)),new pd({gpuProgram:s,glProgram:a,...n})}},fu.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0},dm=fu});async function Nw(t){if(!t)for(let e=0;e<Eo.length;e++){let r=Eo[e];if(r.value.test()){await r.value.load();return}}}var Eo,zw=g(()=>{X(),Eo=[],we.handleByNamedList(M.Environment,Eo)});function fm(){if(typeof Ws=="boolean")return Ws;try{Ws=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{Ws=!1}return Ws}var Ws,pm=g(()=>{"use strict"}),Tr,$s=g(()=>{"use strict";Tr=(t=>(t[t.NONE=0]="NONE",t[t.COLOR=16384]="COLOR",t[t.STENCIL=1024]="STENCIL",t[t.DEPTH=256]="DEPTH",t[t.COLOR_DEPTH=16640]="COLOR_DEPTH",t[t.COLOR_STENCIL=17408]="COLOR_STENCIL",t[t.DEPTH_STENCIL=1280]="DEPTH_STENCIL",t[t.ALL=17664]="ALL",t))(Tr||{})}),pu,gm=g(()=>{"use strict";pu=class{constructor(t){this.items=[],this._name=t}emit(t,e,r,i,n,s,a,o){let{name:l,items:h}=this;for(let u=0,c=h.length;u<c;u++)h[u][l](t,e,r,i,n,s,a,o);return this}add(t){return t[this._name]&&(this.remove(t),this.items.push(t)),this}remove(t){let e=this.items.indexOf(t);return e!==-1&&this.items.splice(e,1),this}contains(t){return this.items.indexOf(t)!==-1}removeAll(){return 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}}}),mm,gu,Xs,Co=g(()=>{ze(),zw(),si(),pm(),Ot(),Mt(),$s(),gm(),kt(),mm=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],gu=class jy extends st{constructor(e){super(),this.uid=ot("renderer"),this.runners=Object.create(null),this.renderPipes=Object.create(null),this._initOptions={},this._systemsHash=Object.create(null),this.type=e.type,this.name=e.name,this.config=e;let r=[...mm,...this.config.runners??[]];this._addRunners(...r),this._unsafeEvalCheck()}async init(e={}){let r=e.skipExtensionImports===!0?!0:e.manageImports===!1;await Nw(r),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(let i in this._systemsHash)e={...this._systemsHash[i].constructor.defaultOptions,...e};e={...jy.defaultOptions,...e},this._roundPixels=e.roundPixels?1:0;for(let i=0;i<this.runners.init.items.length;i++)await this.runners.init.items[i].init(e);this._initOptions=e}render(e,r){let i=e;if(i instanceof gr&&(i={container:i},r&&(Xe(nt,"passing a second argument is deprecated, please use render options instead"),i.target=r.renderTexture)),i.target||(i.target=this.view.renderTarget),i.target===this.view.renderTarget&&(this._lastObjectRendered=i.container,i.clearColor??(i.clearColor=this.background.colorRgba),i.clear??(i.clear=this.background.clearBeforeRender)),i.clearColor){let n=Array.isArray(i.clearColor)&&i.clearColor.length===4;i.clearColor=n?i.clearColor:le.shared.setValue(i.clearColor).toArray()}i.transform||(i.container.updateLocalTransform(),i.transform=i.container.localTransform),i.container.enableRenderGroup(),this.runners.prerender.emit(i),this.runners.renderStart.emit(i),this.runners.render.emit(i),this.runners.renderEnd.emit(i),this.runners.postrender.emit(i)}resize(e,r,i){let n=this.view.resolution;this.view.resize(e,r,i),this.emit("resize",this.view.screen.width,this.view.screen.height,this.view.resolution),i!==void 0&&i!==n&&this.runners.resolutionChange.emit(i)}clear(e={}){let r=this;e.target||(e.target=r.renderTarget.renderTarget),e.clearColor||(e.clearColor=this.background.colorRgba),e.clear??(e.clear=Tr.ALL);let{clear:i,clearColor:n,target:s}=e;le.shared.setValue(n??this.background.colorRgba),r.renderTarget.clear(s,i,le.shared.toArray())}get resolution(){return this.view.resolution}set resolution(e){this.view.resolution=e,this.runners.resolutionChange.emit(e)}get width(){return this.view.texture.frame.width}get height(){return this.view.texture.frame.height}get canvas(){return this.view.canvas}get lastObjectRendered(){return this._lastObjectRendered}get renderingToScreen(){return this.renderTarget.renderingToScreen}get screen(){return this.view.screen}_addRunners(...e){e.forEach(r=>{this.runners[r]=new pu(r)})}_addSystems(e){let r;for(r in e){let i=e[r];this._addSystem(i.value,i.name)}}_addSystem(e,r){let i=new e(this);if(this[r])throw new Error(`Whoops! The name "${r}" is already in use`);this[r]=i,this._systemsHash[r]=i;for(let n in this.runners)this.runners[n].add(i);return this}_addPipes(e,r){let i=r.reduce((n,s)=>(n[s.name]=s.value,n),{});e.forEach(n=>{let s=n.value,a=n.name,o=i[a];this.renderPipes[a]=new s(this,o?new o:null)})}destroy(e=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(e),Object.values(this.runners).forEach(r=>{r.destroy()}),this._systemsHash=null,this.renderPipes=null}generateTexture(e){return this.textureGenerator.generateTexture(e)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!fm())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}resetState(){this.runners.resetState.emit()}},gu.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1},Xs=gu}),mu,Hw=g(()=>{X(),Ke(),th(),_n(),ja(),Xa(),Vs(),vn(),hi(),wr(),mu=class{constructor(){this._maxTextures=0}contextChange(t){let e=new dr({uTransformMatrix:{value:new ve,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}});this._maxTextures=t.limits.maxBatchableTextures;let r=ws({name:"graphics",bits:[Ha,hh(this._maxTextures),Qg,Vn]});this.shader=new qr({gpuProgram:r,resources:{localUniforms:e}})}execute(t,e){let r=e.context,i=r.customShader||this.shader,n=t.renderer,s=n.graphicsContext,{batcher:a,instructions:o}=s.getContextRenderData(r),l=n.encoder;l.setGeometry(a.geometry,i.gpuProgram);let h=n.globalUniforms.bindGroup;l.setBindGroup(0,h,i.gpuProgram);let u=n.renderPipes.uniformBatch.getUniformBindGroup(i.resources.localUniforms,!0);l.setBindGroup(2,u,i.gpuProgram);let c=o.instructions,f=null;for(let d=0;d<o.instructionSize;d++){let _=c[d];if(_.topology!==f&&(f=_.topology,l.setPipelineFromGeometryProgramAndState(a.geometry,i.gpuProgram,t.state,_.topology)),i.groups[1]=_.bindGroup,!_.gpuBindGroup){let v=_.textures;_.bindGroup=Jl(v.textures,v.count,this._maxTextures),_.gpuBindGroup=n.bindGroup.getBindGroup(_.bindGroup,i.gpuProgram,1)}l.setBindGroup(1,_.bindGroup,i.gpuProgram),l.renderPassEncoder.drawIndexed(_.size,1,_.start)}}destroy(){this.shader.destroy(!0),this.shader=null}},mu.extension={type:[M.WebGPUPipesAdaptor],name:"graphics"}}),_m,vm,ym=g(()=>{"use strict";_m={name:"texture-bit",vertex:{header:`
|
|
|
|
struct TextureUniforms {
|
|
uTextureMatrix:mat3x3<f32>,
|
|
}
|
|
|
|
@group(2) @binding(2) var<uniform> textureUniforms : TextureUniforms;
|
|
`,main:`
|
|
uv = (textureUniforms.uTextureMatrix * vec3(uv, 1.0)).xy;
|
|
`},fragment:{header:`
|
|
@group(2) @binding(0) var uTexture: texture_2d<f32>;
|
|
@group(2) @binding(1) var uSampler: sampler;
|
|
|
|
|
|
`,main:`
|
|
outColor = textureSample(uTexture, uSampler, vUV);
|
|
`}},vm={name:"texture-bit",vertex:{header:`
|
|
uniform mat3 uTextureMatrix;
|
|
`,main:`
|
|
uv = (uTextureMatrix * vec3(uv, 1.0)).xy;
|
|
`},fragment:{header:`
|
|
uniform sampler2D uTexture;
|
|
|
|
|
|
`,main:`
|
|
outColor = texture(uTexture, vUV);
|
|
`}}}),_u,Vw=g(()=>{X(),Ke(),_n(),Vs(),vn(),ym(),hi(),Ft(),wt(),_u=class{init(){let t=ws({name:"mesh",bits:[qn,_m,Vn]});this._shader=new qr({gpuProgram:t,resources:{uTexture:Fe.EMPTY._source,uSampler:Fe.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new ve}}}})}execute(t,e){let r=t.renderer,i=e._shader;if(!i)i=this._shader,i.groups[2]=r.texture.getTextureBindGroup(e.texture);else if(!i.gpuProgram){Ye("Mesh shader has no gpuProgram",e.shader);return}let n=i.gpuProgram;if(n.autoAssignGlobalUniforms&&(i.groups[0]=r.globalUniforms.bindGroup),n.autoAssignLocalUniforms){let s=t.localUniforms;i.groups[1]=r.renderPipes.uniformBatch.getUniformBindGroup(s,!0)}r.encoder.draw({geometry:e._geometry,shader:i,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}},_u.extension={type:[M.WebGPUPipesAdaptor],name:"mesh"}}),Ys,vu,jw=g(()=>{X(),ci(),th(),Ys=Nr.for2d(),vu=class{start(t,e,r){let i=t.renderer,n=i.encoder,s=r.gpuProgram;this._shader=r,this._geometry=e,n.setGeometry(e,s),Ys.blendMode="normal",i.pipeline.getPipeline(e,s,Ys);let a=i.globalUniforms.bindGroup;n.resetBindGroup(1),n.setBindGroup(0,a,s)}execute(t,e){let r=this._shader.gpuProgram,i=t.renderer,n=i.encoder;if(!e.bindGroup){let o=e.textures;e.bindGroup=Jl(o.textures,o.count,i.limits.maxBatchableTextures)}Ys.blendMode=e.blendMode;let s=i.bindGroup.getBindGroup(e.bindGroup,r,1),a=i.pipeline.getPipeline(this._geometry,r,Ys,e.topology);e.bindGroup._touch(i.textureGC.count),n.setPipeline(a),n.renderPassEncoder.setBindGroup(1,s),n.renderPassEncoder.drawIndexed(e.size,1,e.start)}},vu.extension={type:[M.WebGPUPipesAdaptor],name:"batch"}}),yu,Ww=g(()=>{X(),yu=class{constructor(t){this._renderer=t}updateRenderable(){}destroyRenderable(){}validateRenderable(){return!1}addRenderable(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}execute(t){t.isRenderable&&t.render(this._renderer)}destroy(){this._renderer=null}},yu.extension={type:[M.WebGLPipes,M.WebGPUPipes,M.CanvasPipes],name:"customRender"}});function xu(t,e){let r=t.instructionSet,i=r.instructions;for(let n=0;n<r.instructionSize;n++){let s=i[n];e[s.renderPipeId].execute(s)}}var xm=g(()=>{"use strict"}),bm,bu,$w=g(()=>{X(),Ke(),zt(),uo(),xm(),bm=new ve,bu=class{constructor(t){this._renderer=t}addRenderGroup(t,e){t.isCachedAsTexture?this._addRenderableCacheAsTexture(t,e):this._addRenderableDirect(t,e)}execute(t){t.isRenderable&&(t.isCachedAsTexture?this._executeCacheAsTexture(t):this._executeDirect(t))}destroy(){this._renderer=null}_addRenderableDirect(t,e){this._renderer.renderPipes.batch.break(e),t._batchableRenderGroup&&(Rt.return(t._batchableRenderGroup),t._batchableRenderGroup=null),e.add(t)}_addRenderableCacheAsTexture(t,e){let r=t._batchableRenderGroup??(t._batchableRenderGroup=Rt.get(Bs));r.renderable=t.root,r.transform=t.root.relativeGroupTransform,r.texture=t.texture,r.bounds=t._textureBounds,e.add(t),this._renderer.renderPipes.batch.addToBatch(r,e)}_executeCacheAsTexture(t){if(t.textureNeedsUpdate){t.textureNeedsUpdate=!1;let e=bm.identity().translate(-t._textureBounds.x,-t._textureBounds.y);this._renderer.renderTarget.push(t.texture,!0,null,t.texture.frame),this._renderer.globalUniforms.push({worldTransformMatrix:e,worldColor:4294967295}),xu(t,this._renderer.renderPipes),this._renderer.renderTarget.finishRenderPass(),this._renderer.renderTarget.pop(),this._renderer.globalUniforms.pop()}t._batchableRenderGroup._batcher.updateElement(t._batchableRenderGroup),t._batchableRenderGroup._batcher.geometry.buffers[0].update()}_executeDirect(t){this._renderer.globalUniforms.push({worldTransformMatrix:t.inverseParentTextureTransform,worldColor:t.worldColorAlpha}),xu(t,this._renderer.renderPipes),this._renderer.globalUniforms.pop()}},bu.extension={type:[M.WebGLPipes,M.WebGPUPipes,M.CanvasPipes],name:"renderGroup"}});function wu(t,e){e||(e=0);for(let r=e;r<t.length&&t[r];r++)t[r]=null}var wm=g(()=>{"use strict"});function Tm(t,e=!1){Xw(t);let r=t.childrenToUpdate,i=t.updateTick++;for(let n in r){let s=Number(n),a=r[n],o=a.list,l=a.index;for(let h=0;h<l;h++){let u=o[h];u.parentRenderGroup===t&&u.relativeRenderGroupDepth===s&&Sm(u,i,0)}wu(o,l),a.index=0}if(e)for(let n=0;n<t.renderGroupChildren.length;n++)Tm(t.renderGroupChildren[n],e)}function Xw(t){let e=t.root,r;if(t.renderGroupParent){let i=t.renderGroupParent;t.worldTransform.appendFrom(e.relativeGroupTransform,i.worldTransform),t.worldColor=Q(e.groupColor,i.worldColor),r=e.groupAlpha*i.worldAlpha}else t.worldTransform.copyFrom(e.localTransform),t.worldColor=e.localColor,r=e.localAlpha;r=r<0?0:r>1?1:r,t.worldAlpha=r,t.worldColorAlpha=t.worldColor+((r*255|0)<<24)}function Sm(t,e,r){if(e===t.updateTick)return;t.updateTick=e,t.didChange=!1;let i=t.localTransform;t.updateLocalTransform();let n=t.parent;if(n&&!n.renderGroup?(r|=t._updateFlags,t.relativeGroupTransform.appendFrom(i,n.relativeGroupTransform),r&Tu&&Em(t,n,r)):(r=t._updateFlags,t.relativeGroupTransform.copyFrom(i),r&Tu&&Em(t,Cm,r)),!t.renderGroup){let s=t.children,a=s.length;for(let h=0;h<a;h++)Sm(s[h],e,r);let o=t.parentRenderGroup,l=t;l.renderPipeId&&!o.structureDidChange&&o.updateRenderable(l)}}function Em(t,e,r){if(r&cs){t.groupColor=Q(t.localColor,e.groupColor);let i=t.localAlpha*e.groupAlpha;i=i<0?0:i>1?1:i,t.groupAlpha=i,t.groupColorAlpha=t.groupColor+((i*255|0)<<24)}r&xa&&(t.groupBlendMode=t.localBlendMode==="inherit"?e.groupBlendMode:t.localBlendMode),r&kn&&(t.globalDisplayStatus=t.localDisplayStatus&e.globalDisplayStatus),t._updateFlags=0}var Cm,Tu,Yw=g(()=>{si(),wm(),be(),Cm=new gr,Tu=kn|cs|xa});function qw(t,e){let{list:r,index:i}=t.childrenRenderablesToUpdate,n=!1;for(let s=0;s<i;s++){let a=r[s];if(n=e[a.renderPipeId].validateRenderable(a),n)break}return t.structureDidChange=n,n}var Kw=g(()=>{"use strict"}),Am,Su,Zw=g(()=>{X(),Ke(),ln(),se(),wm(),xm(),Yw(),Kw(),Am=new ve,Su=class{constructor(t){this._renderer=t}render({container:t,transform:e}){let r=t.parent,i=t.renderGroup.renderGroupParent;t.parent=null,t.renderGroup.renderGroupParent=null;let n=this._renderer,s=Am;e&&(s=s.copyFrom(t.renderGroup.localTransform),t.renderGroup.localTransform.copyFrom(e));let a=n.renderPipes;this._updateCachedRenderGroups(t.renderGroup,null),this._updateRenderGroups(t.renderGroup),n.globalUniforms.start({worldTransformMatrix:e?t.renderGroup.localTransform:t.renderGroup.worldTransform,worldColor:t.renderGroup.worldColorAlpha}),xu(t.renderGroup,a),a.uniformBatch&&a.uniformBatch.renderEnd(),e&&t.renderGroup.localTransform.copyFrom(s),t.parent=r,t.renderGroup.renderGroupParent=i}destroy(){this._renderer=null}_updateCachedRenderGroups(t,e){if(t.isCachedAsTexture){if(!t.updateCacheTexture)return;e=t}t._parentCacheAsTextureRenderGroup=e;for(let r=t.renderGroupChildren.length-1;r>=0;r--)this._updateCachedRenderGroups(t.renderGroupChildren[r],e);if(t.invalidateMatrices(),t.isCachedAsTexture){if(t.textureNeedsUpdate){let r=t.root.getLocalBounds();r.ceil();let i=t.texture;t.texture&&or.returnTexture(t.texture);let n=this._renderer,s=t.textureOptions.resolution||n.view.resolution,a=t.textureOptions.antialias??n.view.antialias;t.texture=or.getOptimalTexture(r.width,r.height,s,a),t._textureBounds||(t._textureBounds=new $),t._textureBounds.copyFrom(r),i!==t.texture&&t.renderGroupParent&&(t.renderGroupParent.structureDidChange=!0)}}else t.texture&&(or.returnTexture(t.texture),t.texture=null)}_updateRenderGroups(t){let e=this._renderer,r=e.renderPipes;if(t.runOnRender(e),t.instructionSet.renderPipes=r,t.structureDidChange?wu(t.childrenRenderablesToUpdate.list,0):qw(t,r),Tm(t),t.structureDidChange?(t.structureDidChange=!1,this._buildInstructions(t,e)):this._updateRenderables(t),t.childrenRenderablesToUpdate.index=0,e.renderPipes.batch.upload(t.instructionSet),!(t.isCachedAsTexture&&!t.textureNeedsUpdate))for(let i=0;i<t.renderGroupChildren.length;i++)this._updateRenderGroups(t.renderGroupChildren[i])}_updateRenderables(t){let{list:e,index:r}=t.childrenRenderablesToUpdate;for(let i=0;i<r;i++){let n=e[i];n.didViewUpdate&&t.updateRenderable(n)}wu(e,r)}_buildInstructions(t,e){let r=t.root,i=t.instructionSet;i.reset();let n=e.renderPipes?e:e.batch.renderer,s=n.renderPipes;s.batch.buildStart(i),s.blendMode.buildStart(),s.colorMask.buildStart(),r.sortableChildren&&r.sortChildren(),r.collectRenderablesWithEffects(i,n,null),s.batch.buildEnd(i),s.blendMode.buildEnd(i)}},Su.extension={type:[M.WebGLSystem,M.WebGPUSystem,M.CanvasSystem],name:"renderGroup"}}),Eu,Qw=g(()=>{X(),uo(),Eu=class{constructor(t){this._renderer=t}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){let e=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}_updateBatchableSprite(t,e){e.bounds=t.visualBounds,e.texture=t._texture}_getGpuSprite(t){return t._gpuData[this._renderer.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=new Bs;return e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.bounds=t.visualBounds,e.roundPixels=this._renderer._roundPixels|t._roundPixels,t._gpuData[this._renderer.uid]=e,e}destroy(){this._renderer=null}},Eu.extension={type:[M.WebGLPipes,M.WebGPUPipes,M.CanvasPipes],name:"sprite"}}),qs,Pm=g(()=>{kt(),qs="8.11.0"}),Cu,Au,Mm=g(()=>{X(),Pm(),Cu=class{static init(){globalThis.__PIXI_APP_INIT__?.(this,qs)}static destroy(){}},Cu.extension=M.Application,Au=class{constructor(t){this._renderer=t}init(){globalThis.__PIXI_RENDERER_INIT__?.(this._renderer,qs)}destroy(){this._renderer=null}},Au.extension={type:[M.WebGLSystem,M.WebGPUSystem],name:"initHook",priority:-10}}),Ao,Pu,Jw=g(()=>{X(),ci(),Zf(),Ao=class Wy{constructor(e,r){this.state=Nr.for2d(),this._batchersByInstructionSet=Object.create(null),this._activeBatches=Object.create(null),this.renderer=e,this._adaptor=r,this._adaptor.init?.(this)}static getBatcher(e){return new this._availableBatchers[e]}buildStart(e){let r=this._batchersByInstructionSet[e.uid];r||(r=this._batchersByInstructionSet[e.uid]=Object.create(null),r.default||(r.default=new qa({maxTextures:this.renderer.limits.maxBatchableTextures}))),this._activeBatches=r,this._activeBatch=this._activeBatches.default;for(let i in this._activeBatches)this._activeBatches[i].begin()}addToBatch(e,r){if(this._activeBatch.name!==e.batcherName){this._activeBatch.break(r);let i=this._activeBatches[e.batcherName];i||(i=this._activeBatches[e.batcherName]=Wy.getBatcher(e.batcherName),i.begin()),this._activeBatch=i}this._activeBatch.add(e)}break(e){this._activeBatch.break(e)}buildEnd(e){this._activeBatch.break(e);let r=this._activeBatches;for(let i in r){let n=r[i],s=n.geometry;s.indexBuffer.setDataWithSize(n.indexBuffer,n.indexSize,!0),s.buffers[0].setDataWithSize(n.attributeBuffer.float32View,n.attributeSize,!1)}}upload(e){let r=this._batchersByInstructionSet[e.uid];for(let i in r){let n=r[i],s=n.geometry;n.dirty&&(n.dirty=!1,s.buffers[0].update(n.attributeSize*4))}}execute(e){if(e.action==="startBatch"){let r=e.batcher,i=r.geometry,n=r.shader;this._adaptor.start(this,i,n)}this._adaptor.execute(this,e)}destroy(){this.state=null,this.renderer=null,this._adaptor=null;for(let e in this._activeBatches)this._activeBatches[e].destroy();this._activeBatches=null}},Ao.extension={type:[M.WebGLPipes,M.WebGPUPipes,M.CanvasPipes],name:"batch"},Ao._availableBatchers=Object.create(null),Pu=Ao,we.handleByMap(M.Batcher,Pu._availableBatchers),we.add(qa)}),Rm,eT=g(()=>{Rm=`in vec2 vMaskCoord;
|
|
in vec2 vTextureCoord;
|
|
|
|
uniform sampler2D uTexture;
|
|
uniform sampler2D uMaskTexture;
|
|
|
|
uniform float uAlpha;
|
|
uniform vec4 uMaskClamp;
|
|
uniform float uInverse;
|
|
|
|
out vec4 finalColor;
|
|
|
|
void main(void)
|
|
{
|
|
float clip = step(3.5,
|
|
step(uMaskClamp.x, vMaskCoord.x) +
|
|
step(uMaskClamp.y, vMaskCoord.y) +
|
|
step(vMaskCoord.x, uMaskClamp.z) +
|
|
step(vMaskCoord.y, uMaskClamp.w));
|
|
|
|
// TODO look into why this is needed
|
|
float npmAlpha = uAlpha;
|
|
vec4 original = texture(uTexture, vTextureCoord);
|
|
vec4 masky = texture(uMaskTexture, vMaskCoord);
|
|
float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);
|
|
|
|
float a = alphaMul * masky.r * npmAlpha * clip;
|
|
|
|
if (uInverse == 1.0) {
|
|
a = 1.0 - a;
|
|
}
|
|
|
|
finalColor = original * a;
|
|
}
|
|
`}),km,tT=g(()=>{km=`in vec2 aPosition;
|
|
|
|
out vec2 vTextureCoord;
|
|
out vec2 vMaskCoord;
|
|
|
|
|
|
uniform vec4 uInputSize;
|
|
uniform vec4 uOutputFrame;
|
|
uniform vec4 uOutputTexture;
|
|
uniform mat3 uFilterMatrix;
|
|
|
|
vec4 filterVertexPosition( vec2 aPosition )
|
|
{
|
|
vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;
|
|
|
|
position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;
|
|
position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;
|
|
|
|
return vec4(position, 0.0, 1.0);
|
|
}
|
|
|
|
vec2 filterTextureCoord( vec2 aPosition )
|
|
{
|
|
return aPosition * (uOutputFrame.zw * uInputSize.zw);
|
|
}
|
|
|
|
vec2 getFilterCoord( vec2 aPosition )
|
|
{
|
|
return ( uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy;
|
|
}
|
|
|
|
void main(void)
|
|
{
|
|
gl_Position = filterVertexPosition(aPosition);
|
|
vTextureCoord = filterTextureCoord(aPosition);
|
|
vMaskCoord = getFilterCoord(aPosition);
|
|
}
|
|
`}),Mu,rT=g(()=>{Mu=`struct GlobalFilterUniforms {
|
|
uInputSize:vec4<f32>,
|
|
uInputPixel:vec4<f32>,
|
|
uInputClamp:vec4<f32>,
|
|
uOutputFrame:vec4<f32>,
|
|
uGlobalFrame:vec4<f32>,
|
|
uOutputTexture:vec4<f32>,
|
|
};
|
|
|
|
struct MaskUniforms {
|
|
uFilterMatrix:mat3x3<f32>,
|
|
uMaskClamp:vec4<f32>,
|
|
uAlpha:f32,
|
|
uInverse:f32,
|
|
};
|
|
|
|
@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;
|
|
@group(0) @binding(1) var uTexture: texture_2d<f32>;
|
|
@group(0) @binding(2) var uSampler : sampler;
|
|
|
|
@group(1) @binding(0) var<uniform> filterUniforms : MaskUniforms;
|
|
@group(1) @binding(1) var uMaskTexture: texture_2d<f32>;
|
|
|
|
struct VSOutput {
|
|
@builtin(position) position: vec4<f32>,
|
|
@location(0) uv : vec2<f32>,
|
|
@location(1) filterUv : vec2<f32>,
|
|
};
|
|
|
|
fn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>
|
|
{
|
|
var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
|
|
|
|
position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
|
|
position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
|
|
|
|
return vec4(position, 0.0, 1.0);
|
|
}
|
|
|
|
fn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
|
|
{
|
|
return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
|
|
}
|
|
|
|
fn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
|
|
{
|
|
return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw);
|
|
}
|
|
|
|
fn getFilterCoord(aPosition:vec2<f32> ) -> vec2<f32>
|
|
{
|
|
return ( filterUniforms.uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy;
|
|
}
|
|
|
|
fn getSize() -> vec2<f32>
|
|
{
|
|
return gfu.uGlobalFrame.zw;
|
|
}
|
|
|
|
@vertex
|
|
fn mainVertex(
|
|
@location(0) aPosition : vec2<f32>,
|
|
) -> VSOutput {
|
|
return VSOutput(
|
|
filterVertexPosition(aPosition),
|
|
filterTextureCoord(aPosition),
|
|
getFilterCoord(aPosition)
|
|
);
|
|
}
|
|
|
|
@fragment
|
|
fn mainFragment(
|
|
@location(0) uv: vec2<f32>,
|
|
@location(1) filterUv: vec2<f32>,
|
|
@builtin(position) position: vec4<f32>
|
|
) -> @location(0) vec4<f32> {
|
|
|
|
var maskClamp = filterUniforms.uMaskClamp;
|
|
var uAlpha = filterUniforms.uAlpha;
|
|
|
|
var clip = step(3.5,
|
|
step(maskClamp.x, filterUv.x) +
|
|
step(maskClamp.y, filterUv.y) +
|
|
step(filterUv.x, maskClamp.z) +
|
|
step(filterUv.y, maskClamp.w));
|
|
|
|
var mask = textureSample(uMaskTexture, uSampler, filterUv);
|
|
var source = textureSample(uTexture, uSampler, uv);
|
|
var alphaMul = 1.0 - uAlpha * (1.0 - mask.a);
|
|
|
|
var a: f32 = alphaMul * mask.r * uAlpha * clip;
|
|
|
|
if (filterUniforms.uInverse == 1.0) {
|
|
a = 1.0 - a;
|
|
}
|
|
|
|
return source * a;
|
|
}
|
|
`}),Bm,iT=g(()=>{Ke(),Ln(),bs(),wr(),vd(),Lw(),eT(),tT(),rT(),Bm=class extends dm{constructor(t){let{sprite:e,...r}=t,i=new ml(e.texture),n=new dr({uFilterMatrix:{value:new ve,type:"mat3x3<f32>"},uMaskClamp:{value:i.uClampFrame,type:"vec4<f32>"},uAlpha:{value:1,type:"f32"},uInverse:{value:t.inverse?1:0,type:"f32"}}),s=Hn.from({vertex:{source:Mu,entryPoint:"mainVertex"},fragment:{source:Mu,entryPoint:"mainFragment"}}),a=mn.from({vertex:km,fragment:Rm,name:"mask-filter"});super({...r,gpuProgram:s,glProgram:a,resources:{filterUniforms:n,uMaskTexture:e.texture.source}}),this.sprite=e,this._textureMatrix=i}set inverse(t){this.resources.filterUniforms.uniforms.uInverse=t?1:0}get inverse(){return this.resources.filterUniforms.uniforms.uInverse===1}apply(t,e,r,i){this._textureMatrix.texture=this.sprite.texture,t.calculateSpriteMatrix(this.resources.filterUniforms.uniforms.uFilterMatrix,this.sprite).prepend(this._textureMatrix.mapCoord),this.resources.uMaskTexture=this.sprite.texture.source,t.applyFilter(this,e,r,i)}}}),Gm,Im,Ru,nT=g(()=>{X(),Ni(),iT(),se(),B(),tf(),zt(),Ft(),ln(),Mi(),Gm=new $,Im=class extends Ir{constructor(){super(),this.filters=[new Bm({sprite:new Ma(Fe.EMPTY),inverse:!1,resolution:"inherit",antialias:"inherit"})]}get sprite(){return this.filters[0].sprite}set sprite(t){this.filters[0].sprite=t}get inverse(){return this.filters[0].inverse}set inverse(t){this.filters[0].inverse=t}},Ru=class{constructor(t){this._activeMaskStage=[],this._renderer=t}push(t,e,r){let i=this._renderer;if(i.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1,maskedContainer:e}),t.inverse=e._maskOptions.inverse,t.renderMaskToTexture){let n=t.mask;n.includeInBuild=!0,n.collectRenderables(r,i,null),n.includeInBuild=!1}i.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:t,maskedContainer:e,inverse:e._maskOptions.inverse,canBundle:!1})}pop(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1})}execute(t){let e=this._renderer,r=t.mask.renderMaskToTexture;if(t.action==="pushMaskBegin"){let i=Rt.get(Im);if(i.inverse=t.inverse,r){t.mask.mask.measurable=!0;let n=b(t.mask.mask,!0,Gm);t.mask.mask.measurable=!1,n.ceil();let s=e.renderTarget.renderTarget.colorTexture.source,a=or.getOptimalTexture(n.width,n.height,s._resolution,s.antialias);e.renderTarget.push(a,!0),e.globalUniforms.push({offset:n,worldColor:4294967295});let o=i.sprite;o.texture=a,o.worldTransform.tx=n.minX,o.worldTransform.ty=n.minY,this._activeMaskStage.push({filterEffect:i,maskedContainer:t.maskedContainer,filterTexture:a})}else i.sprite=t.mask.mask,this._activeMaskStage.push({filterEffect:i,maskedContainer:t.maskedContainer})}else if(t.action==="pushMaskEnd"){let i=this._activeMaskStage[this._activeMaskStage.length-1];r&&(e.type===Lr.WEBGL&&e.renderTarget.finishRenderPass(),e.renderTarget.pop(),e.globalUniforms.pop()),e.filter.push({renderPipeId:"filter",action:"pushFilter",container:i.maskedContainer,filterEffect:i.filterEffect,canBundle:!1})}else if(t.action==="popMaskEnd"){e.filter.pop();let i=this._activeMaskStage.pop();r&&or.returnTexture(i.filterTexture),Rt.return(i.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}},Ru.extension={type:[M.WebGLPipes,M.WebGPUPipes,M.CanvasPipes],name:"alphaMask"}}),ku,sT=g(()=>{X(),ku=class{constructor(t){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=t}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(t,e,r){this._renderer.renderPipes.batch.break(r);let i=this._colorStack;i[this._colorStackIndex]=i[this._colorStackIndex-1]&t.mask;let n=this._colorStack[this._colorStackIndex];n!==this._currentColor&&(this._currentColor=n,r.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1})),this._colorStackIndex++}pop(t,e,r){this._renderer.renderPipes.batch.break(r);let i=this._colorStack;this._colorStackIndex--;let n=i[this._colorStackIndex-1];n!==this._currentColor&&(this._currentColor=n,r.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1}))}execute(t){this._renderer.colorMask.setMask(t.colorMask)}destroy(){this._colorStack=null}},ku.extension={type:[M.WebGLPipes,M.WebGPUPipes,M.CanvasPipes],name:"colorMask"}}),Bu,aT=g(()=>{X(),$s(),Fn(),Bu=class{constructor(t){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=t}push(t,e,r){var i;let n=t,s=this._renderer;s.renderPipes.batch.break(r),s.renderPipes.blendMode.setBlendMode(n.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});let a=n.mask;a.includeInBuild=!0,this._maskHash.has(n)||this._maskHash.set(n,{instructionsStart:0,instructionsLength:0});let o=this._maskHash.get(n);o.instructionsStart=r.instructionSize,a.collectRenderables(r,s,null),a.includeInBuild=!1,s.renderPipes.batch.break(r),r.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});let l=r.instructionSize-o.instructionsStart-1;o.instructionsLength=l;let h=s.renderTarget.renderTarget.uid;(i=this._maskStackHash)[h]??(i[h]=0)}pop(t,e,r){let i=t,n=this._renderer;n.renderPipes.batch.break(r),n.renderPipes.blendMode.setBlendMode(i.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"popMaskBegin",inverse:e._maskOptions.inverse,canBundle:!1});let s=this._maskHash.get(t);for(let a=0;a<s.instructionsLength;a++)r.instructions[r.instructionSize++]=r.instructions[s.instructionsStart++];r.add({renderPipeId:"stencilMask",action:"popMaskEnd",canBundle:!1})}execute(t){var e;let r=this._renderer,i=r.renderTarget.renderTarget.uid,n=(e=this._maskStackHash)[i]??(e[i]=0);t.action==="pushMaskBegin"?(r.renderTarget.ensureDepthStencil(),r.stencil.setStencilMode($t.RENDERING_MASK_ADD,n),n++,r.colorMask.setMask(0)):t.action==="pushMaskEnd"?(t.inverse?r.stencil.setStencilMode($t.INVERSE_MASK_ACTIVE,n):r.stencil.setStencilMode($t.MASK_ACTIVE,n),r.colorMask.setMask(15)):t.action==="popMaskBegin"?(r.colorMask.setMask(0),n!==0?r.stencil.setStencilMode($t.RENDERING_MASK_REMOVE,n):(r.renderTarget.clear(null,Tr.STENCIL),r.stencil.setStencilMode($t.DISABLED,n)),n--):t.action==="popMaskEnd"&&(t.inverse?r.stencil.setStencilMode($t.INVERSE_MASK_ACTIVE,n):r.stencil.setStencilMode($t.MASK_ACTIVE,n),r.colorMask.setMask(15)),this._maskStackHash[i]=n}destroy(){this._renderer=null,this._maskStackHash=null,this._maskHash=null}},Bu.extension={type:[M.WebGLPipes,M.WebGPUPipes,M.CanvasPipes],name:"stencilMask"}}),Po,Om,oT=g(()=>{ze(),X(),wt(),Po=class $y{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new le(0),this.color=this._backgroundColor,this.alpha=1}init(e){e={...$y.defaultOptions,...e},this.clearBeforeRender=e.clearBeforeRender,this.color=e.background||e.backgroundColor||this._backgroundColor,this.alpha=e.backgroundAlpha,this._backgroundColor.setAlpha(e.backgroundAlpha)}get color(){return this._backgroundColor}set color(e){le.shared.setValue(e).alpha<1&&this._backgroundColor.alpha===1&&Ye("Cannot set a transparent background on an opaque canvas. To enable transparency, set backgroundAlpha < 1 when initializing your Application."),this._backgroundColor.setValue(e)}get alpha(){return this._backgroundColor.alpha}set alpha(e){this._backgroundColor.setAlpha(e)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}},Po.extension={type:[M.WebGLSystem,M.WebGPUSystem,M.CanvasSystem],name:"background",priority:0},Po.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},Om=Po}),Kn,Gu,lT=g(()=>{X(),Ni(),wt(),Kn={},we.handle(M.BlendMode,t=>{if(!t.name)throw new Error("BlendMode extension must have a name property");Kn[t.name]=t.ref},t=>{delete Kn[t.name]}),Gu=class{constructor(t){this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=t,this._renderer.runners.prerender.add(this)}prerender(){this._activeBlendMode="normal",this._isAdvanced=!1}setBlendMode(t,e,r){if(this._activeBlendMode===e){this._isAdvanced&&this._renderableList.push(t);return}this._activeBlendMode=e,this._isAdvanced&&this._endAdvancedBlendMode(r),this._isAdvanced=!!Kn[e],this._isAdvanced&&(this._beginAdvancedBlendMode(r),this._renderableList.push(t))}_beginAdvancedBlendMode(t){this._renderer.renderPipes.batch.break(t);let e=this._activeBlendMode;if(!Kn[e]){Ye(`Unable to assign BlendMode: '${e}'. You may want to include: import 'pixi.js/advanced-blend-modes'`);return}let r=this._filterHash[e];r||(r=this._filterHash[e]=new Ir,r.filters=[new Kn[e]]);let i={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:r,canBundle:!1};this._renderableList=i.renderables,t.add(i)}_endAdvancedBlendMode(t){this._renderableList=null,this._renderer.renderPipes.batch.break(t),t.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(t){this._isAdvanced&&this._endAdvancedBlendMode(t)}destroy(){this._renderer=null,this._renderableList=null;for(let t in this._filterHash)this._filterHash[t].destroy();this._filterHash=null}},Gu.extension={type:[M.WebGLPipes,M.WebGPUPipes,M.CanvasPipes],name:"blendMode"}}),Mo,Ro,Fm,hT=g(()=>{X(),si(),Ft(),Mo={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},Ro=class Xy{constructor(e){this._renderer=e}_normalizeOptions(e,r={}){return e instanceof gr||e instanceof Fe?{target:e,...r}:{...r,...e}}async image(e){let r=new Image;return r.src=await this.base64(e),r}async base64(e){e=this._normalizeOptions(e,Xy.defaultImageOptions);let{format:r,quality:i}=e,n=this.canvas(e);if(n.toBlob!==void 0)return new Promise((s,a)=>{n.toBlob(o=>{if(!o){a(new Error("ICanvas.toBlob failed!"));return}let l=new FileReader;l.onload=()=>s(l.result),l.onerror=a,l.readAsDataURL(o)},Mo[r],i)});if(n.toDataURL!==void 0)return n.toDataURL(Mo[r],i);if(n.convertToBlob!==void 0){let s=await n.convertToBlob({type:Mo[r],quality:i});return new Promise((a,o)=>{let l=new FileReader;l.onload=()=>a(l.result),l.onerror=o,l.readAsDataURL(s)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(e){e=this._normalizeOptions(e);let r=e.target,i=this._renderer;if(r instanceof Fe)return i.texture.generateCanvas(r);let n=i.textureGenerator.generateTexture(e),s=i.texture.generateCanvas(n);return n.destroy(!0),s}pixels(e){e=this._normalizeOptions(e);let r=e.target,i=this._renderer,n=r instanceof Fe?r:i.textureGenerator.generateTexture(e),s=i.texture.getPixels(n);return r instanceof gr&&n.destroy(!0),s}texture(e){return e=this._normalizeOptions(e),e.target instanceof Fe?e.target:this._renderer.textureGenerator.generateTexture(e)}download(e){e=this._normalizeOptions(e);let r=this.canvas(e),i=document.createElement("a");i.download=e.filename??"image.png",i.href=r.toDataURL("image/png"),document.body.appendChild(i),i.click(),document.body.removeChild(i)}log(e){let r=e.width??200;e=this._normalizeOptions(e);let i=this.canvas(e),n=i.toDataURL();console.log(`[Pixi Texture] ${i.width}px ${i.height}px`);let s=["font-size: 1px;",`padding: ${r}px 300px;`,`background: url(${n}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",s)}destroy(){this._renderer=null}},Ro.extension={type:[M.WebGLSystem,M.WebGPUSystem],name:"extract"},Ro.defaultImageOptions={format:"png",quality:1},Fm=Ro}),Dm,uT=g(()=>{xr(),Ft(),Dm=class Yy extends Fe{static create(e){return new Yy({source:new Qt(e)})}resize(e,r,i){return this.source.resize(e,r,i),this}}}),Um,Lm,Nm,Iu,cT=g(()=>{ze(),X(),Ke(),O(),se(),te(),si(),uT(),Um=new R,Lm=new $,Nm=[0,0,0,0],Iu=class{constructor(t){this._renderer=t}generateTexture(t){t instanceof gr&&(t={target:t,frame:void 0,textureSourceOptions:{},resolution:void 0});let e=t.resolution||this._renderer.resolution,r=t.antialias||this._renderer.view.antialias,i=t.target,n=t.clearColor;n?n=Array.isArray(n)&&n.length===4?n:le.shared.setValue(n).toArray():n=Nm;let s=t.frame?.copyTo(Um)||he(i,Lm).rectangle;s.width=Math.max(s.width,1/e)|0,s.height=Math.max(s.height,1/e)|0;let a=Dm.create({...t.textureSourceOptions,width:s.width,height:s.height,resolution:e,antialias:r}),o=ve.shared.translate(-s.x,-s.y);return this._renderer.render({container:i,transform:o,target:a,clearColor:n}),a.source.updateMipmaps(),a}destroy(){this._renderer=null}},Iu.extension={type:[M.WebGLSystem,M.WebGPUSystem],name:"textureGenerator"}}),Ou,dT=g(()=>{X(),Ke(),He(),ks(),dn(),Mi(),wr(),Ou=class{constructor(t){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=t}reset(){this._stackIndex=0;for(let t=0;t<this._activeUniforms.length;t++)this._uniformsPool.push(this._activeUniforms[t]);for(let t=0;t<this._activeBindGroups.length;t++)this._bindGroupPool.push(this._activeBindGroups[t]);this._activeUniforms.length=0,this._activeBindGroups.length=0}start(t){this.reset(),this.push(t)}bind({size:t,projectionMatrix:e,worldTransformMatrix:r,worldColor:i,offset:n}){let s=this._renderer.renderTarget.renderTarget,a=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{projectionData:s,worldTransformMatrix:new ve,worldColor:4294967295,offset:new ye},o={projectionMatrix:e||this._renderer.renderTarget.projectionMatrix,resolution:t||s.size,worldTransformMatrix:r||a.worldTransformMatrix,worldColor:i||a.worldColor,offset:n||a.offset,bindGroup:null},l=this._uniformsPool.pop()||this._createUniforms();this._activeUniforms.push(l);let h=l.uniforms;h.uProjectionMatrix=o.projectionMatrix,h.uResolution=o.resolution,h.uWorldTransformMatrix.copyFrom(o.worldTransformMatrix),h.uWorldTransformMatrix.tx-=o.offset.x,h.uWorldTransformMatrix.ty-=o.offset.y,Rs(o.worldColor,h.uWorldColorAlpha,0),l.update();let u;this._renderer.renderPipes.uniformBatch?u=this._renderer.renderPipes.uniformBatch.getUniformBindGroup(l,!1):(u=this._bindGroupPool.pop()||new li,this._activeBindGroups.push(u),u.setResource(l,0)),o.bindGroup=u,this._currentGlobalUniformData=o}push(t){this.bind(t),this._globalUniformDataStack[this._stackIndex++]=this._currentGlobalUniformData}pop(){this._currentGlobalUniformData=this._globalUniformDataStack[--this._stackIndex-1],this._renderer.type===Lr.WEBGL&&this._currentGlobalUniformData.bindGroup.resources[0].update()}get bindGroup(){return this._currentGlobalUniformData.bindGroup}get globalUniformData(){return this._currentGlobalUniformData}get uniformGroup(){return this._currentGlobalUniformData.bindGroup.resources[0]}_createUniforms(){return new dr({uProjectionMatrix:{value:new ve,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new ve,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null}},Ou.extension={type:[M.WebGLSystem,M.WebGPUSystem,M.CanvasSystem],name:"globalUniforms"}}),zm,Fu,fT=g(()=>{X(),Ca(),zm=1,Fu=class{constructor(){this._tasks=[],this._offset=0}init(){Xr.system.add(this._update,this)}repeat(t,e,r=!0){let i=zm++,n=0;return r&&(this._offset+=1e3,n=this._offset),this._tasks.push({func:t,duration:e,start:performance.now(),offset:n,last:performance.now(),repeat:!0,id:i}),i}cancel(t){for(let e=0;e<this._tasks.length;e++)if(this._tasks[e].id===t){this._tasks.splice(e,1);return}}_update(){let t=performance.now();for(let e=0;e<this._tasks.length;e++){let r=this._tasks[e];if(t-r.offset-r.last>=r.duration){let i=t-r.start;r.func(i),r.last=t}}}destroy(){Xr.system.remove(this._update,this),this._tasks.length=0}},Fu.extension={type:[M.WebGLSystem,M.WebGPUSystem,M.CanvasSystem],name:"scheduler",priority:0}});function pT(t){if(!Du){if(Dt.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){let e=[`%c %c %c %c %c PixiJS %c v${qs} (${t}) http://www.pixijs.com/
|
|
|
|
`,"background: #E72264; padding:5px 0;","background: #6CA2EA; padding:5px 0;","background: #B5D33D; padding:5px 0;","background: #FED23F; padding:5px 0;","color: #FFFFFF; background: #E72264; padding:5px 0;","color: #E72264; background: #FFFFFF; padding:5px 0;"];globalThis.console.log(...e)}else globalThis.console&&globalThis.console.log(`PixiJS ${qs} - ${t} - http://www.pixijs.com/`);Du=!0}}var Du,gT=g(()=>{Jt(),Pm(),Du=!1}),ko,mT=g(()=>{X(),gT(),Mi(),ko=class{constructor(t){this._renderer=t}init(t){if(t.hello){let e=this._renderer.name;this._renderer.type===Lr.WEBGL&&(e+=` ${this._renderer.context.webGLVersion}`),pT(e)}}},ko.extension={type:[M.WebGLSystem,M.WebGPUSystem,M.CanvasSystem],name:"hello",priority:-2},ko.defaultOptions={hello:!1}});function _T(t){let e=!1;for(let i in t)if(t[i]==null){e=!0;break}if(!e)return t;let r=Object.create(null);for(let i in t){let n=t[i];n&&(r[i]=n)}return r}function vT(t){let e=0;for(let r=0;r<t.length;r++)t[r]==null?e++:t[r-e]=t[r];return t.length-=e,t}var yT=g(()=>{"use strict"}),Hm,Bo,Vm,xT=g(()=>{X(),yT(),Hm=0,Bo=class qy{constructor(e){this._managedRenderables=[],this._managedHashes=[],this._managedArrays=[],this._renderer=e}init(e){e={...qy.defaultOptions,...e},this.maxUnusedTime=e.renderableGCMaxUnusedTime,this._frequency=e.renderableGCFrequency,this.enabled=e.renderableGCActive}get enabled(){return!!this._handler}set enabled(e){this.enabled!==e&&(e?(this._handler=this._renderer.scheduler.repeat(()=>this.run(),this._frequency,!1),this._hashHandler=this._renderer.scheduler.repeat(()=>{for(let r of this._managedHashes)r.context[r.hash]=_T(r.context[r.hash])},this._frequency),this._arrayHandler=this._renderer.scheduler.repeat(()=>{for(let r of this._managedArrays)vT(r.context[r.hash])},this._frequency)):(this._renderer.scheduler.cancel(this._handler),this._renderer.scheduler.cancel(this._hashHandler),this._renderer.scheduler.cancel(this._arrayHandler)))}addManagedHash(e,r){this._managedHashes.push({context:e,hash:r})}addManagedArray(e,r){this._managedArrays.push({context:e,hash:r})}prerender({container:e}){this._now=performance.now(),e.renderGroup.gcTick=Hm++,this._updateInstructionGCTick(e.renderGroup,e.renderGroup.gcTick)}addRenderable(e){this.enabled&&(e._lastUsed===-1&&(this._managedRenderables.push(e),e.once("destroyed",this._removeRenderable,this)),e._lastUsed=this._now)}run(){let e=this._now,r=this._managedRenderables,i=this._renderer.renderPipes,n=0;for(let s=0;s<r.length;s++){let a=r[s];if(a===null){n++;continue}let o=a.renderGroup??a.parentRenderGroup,l=o?.instructionSet?.gcTick??-1;if((o?.gcTick??0)===l&&(a._lastUsed=e),e-a._lastUsed>this.maxUnusedTime){if(!a.destroyed){let h=i;o&&(o.structureDidChange=!0),h[a.renderPipeId].destroyRenderable(a)}a._lastUsed=-1,n++,a.off("destroyed",this._removeRenderable,this)}else r[s-n]=a}r.length-=n}destroy(){this.enabled=!1,this._renderer=null,this._managedRenderables.length=0,this._managedHashes.length=0,this._managedArrays.length=0}_removeRenderable(e){let r=this._managedRenderables.indexOf(e);r>=0&&(e.off("destroyed",this._removeRenderable,this),this._managedRenderables[r]=null)}_updateInstructionGCTick(e,r){e.instructionSet.gcTick=r;for(let i of e.renderGroupChildren)this._updateInstructionGCTick(i,r)}},Bo.extension={type:[M.WebGLSystem,M.WebGPUSystem],name:"renderableGC",priority:0},Bo.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4},Vm=Bo}),Go,jm,bT=g(()=>{X(),Go=class Ky{constructor(e){this._renderer=e,this.count=0,this.checkCount=0}init(e){e={...Ky.defaultOptions,...e},this.checkCountMax=e.textureGCCheckCountMax,this.maxIdle=e.textureGCAMaxIdle??e.textureGCMaxIdle,this.active=e.textureGCActive}postrender(){this._renderer.renderingToScreen&&(this.count++,this.active&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let e=this._renderer.texture.managedTextures;for(let r=0;r<e.length;r++){let i=e[r];i.autoGarbageCollect&&i.resource&&i._touched>-1&&this.count-i._touched>this.maxIdle&&(i._touched=-1,i.unload())}}destroy(){this._renderer=null}},Go.extension={type:[M.WebGLSystem,M.WebGPUSystem],name:"textureGC"},Go.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:3600,textureGCCheckCountMax:600},jm=Go}),Uu,Io,Wm=g(()=>{Ot(),xr(),Ft(),Uu=class Zy{constructor(e={}){if(this.uid=ot("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,e={...Zy.defaultOptions,...e},this.stencil=e.stencil,this.depth=e.depth,this.isRoot=e.isRoot,typeof e.colorTextures=="number"){this._managedColorTextures=!0;for(let r=0;r<e.colorTextures;r++)this.colorTextures.push(new Qt({width:e.width,height:e.height,resolution:e.resolution,antialias:e.antialias}))}else{this.colorTextures=[...e.colorTextures.map(i=>i.source)];let r=this.colorTexture.source;this.resize(r.width,r.height,r._resolution)}this.colorTexture.source.on("resize",this.onSourceResize,this),(e.depthStencilTexture||this.stencil)&&(e.depthStencilTexture instanceof Fe||e.depthStencilTexture instanceof Qt?this.depthStencilTexture=e.depthStencilTexture.source:this.ensureDepthStencilTexture())}get size(){let e=this._size;return e[0]=this.pixelWidth,e[1]=this.pixelHeight,e}get width(){return this.colorTexture.source.width}get height(){return this.colorTexture.source.height}get pixelWidth(){return this.colorTexture.source.pixelWidth}get pixelHeight(){return this.colorTexture.source.pixelHeight}get resolution(){return this.colorTexture.source._resolution}get colorTexture(){return this.colorTextures[0]}onSourceResize(e){this.resize(e.width,e.height,e._resolution,!0)}ensureDepthStencilTexture(){this.depthStencilTexture||(this.depthStencilTexture=new Qt({width:this.width,height:this.height,resolution:this.resolution,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1}))}resize(e,r,i=this.resolution,n=!1){this.dirtyId++,this.colorTextures.forEach((s,a)=>{n&&a===0||s.source.resize(e,r,i)}),this.depthStencilTexture&&this.depthStencilTexture.source.resize(e,r,i)}destroy(){this.colorTexture.source.off("resize",this.onSourceResize,this),this._managedColorTextures&&this.colorTextures.forEach(e=>{e.destroy()}),this.depthStencilTexture&&(this.depthStencilTexture.destroy(),delete this.depthStencilTexture)}},Uu.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1},Io=Uu});function $m(t,e){if(!Zn.has(t)){let r=new Fe({source:new oi({resource:t,...e})}),i=()=>{Zn.get(t)===r&&Zn.delete(t)};r.once("destroy",i),r.source.once("destroy",i),Zn.set(t,r)}return Zn.get(t)}var Zn,Xm=g(()=>{ms(),Ft(),Zn=new Map}),Oo,Ym,wT=g(()=>{Jt(),X(),O(),Mt(),Wm(),Xm(),Oo=class Qy{get autoDensity(){return this.texture.source.autoDensity}set autoDensity(e){this.texture.source.autoDensity=e}get resolution(){return this.texture.source._resolution}set resolution(e){this.texture.source.resize(this.texture.source.width,this.texture.source.height,e)}init(e){e={...Qy.defaultOptions,...e},e.view&&(Xe(nt,"ViewSystem.view has been renamed to ViewSystem.canvas"),e.canvas=e.view),this.screen=new R(0,0,e.width,e.height),this.canvas=e.canvas||Dt.get().createCanvas(),this.antialias=!!e.antialias,this.texture=$m(this.canvas,e),this.renderTarget=new Io({colorTextures:[this.texture],depth:!!e.depth,isRoot:!0}),this.texture.source.transparent=e.backgroundAlpha<1,this.resolution=e.resolution}resize(e,r,i){this.texture.source.resize(e,r,i),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height}destroy(e=!1){(typeof e=="boolean"?e:e?.removeView)&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}},Oo.extension={type:[M.WebGLSystem,M.WebGPUSystem,M.CanvasSystem],name:"view",priority:0},Oo.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1},Ym=Oo}),Lu,Nu,qm=g(()=>{Ww(),$w(),Zw(),Qw(),Mm(),Jw(),nT(),sT(),aT(),oT(),lT(),hT(),cT(),dT(),fT(),mT(),xT(),bT(),wT(),Lu=[Om,Ou,ko,Ym,Su,jm,Iu,Fm,Au,Vm,Fu],Nu=[Gu,Pu,Eu,bu,Ru,Bu,ku,yu]}),zu,TT=g(()=>{X(),zu=class{constructor(t){this._hash=Object.create(null),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_hash")}contextChange(t){this._gpu=t}getBindGroup(t,e,r){return t._updateKey(),this._hash[t._key]||this._createBindGroup(t,e,r)}_createBindGroup(t,e,r){let i=this._gpu.device,n=e.layout[r],s=[],a=this._renderer;for(let h in n){let u=t.resources[h]??t.resources[n[h]],c;if(u._resourceType==="uniformGroup"){let f=u;a.ubo.updateUniformGroup(f);let d=f.buffer;c={buffer:a.buffer.getGPUBuffer(d),offset:0,size:d.descriptor.size}}else if(u._resourceType==="buffer"){let f=u;c={buffer:a.buffer.getGPUBuffer(f),offset:0,size:f.descriptor.size}}else if(u._resourceType==="bufferResource"){let f=u;c={buffer:a.buffer.getGPUBuffer(f.buffer),offset:f.offset,size:f.size}}else if(u._resourceType==="textureSampler"){let f=u;c=a.texture.getGpuSampler(f)}else if(u._resourceType==="textureSource"){let f=u;c=a.texture.getGpuSource(f).createView({})}s.push({binding:n[h],resource:c})}let o=a.shader.getProgramData(e).bindGroups[r],l=i.createBindGroup({layout:o,entries:s});return this._hash[t._key]=l,l}destroy(){for(let t of Object.keys(this._hash))this._hash[t]=null;this._hash=null,this._renderer=null}},zu.extension={type:[M.WebGPUSystem],name:"bindGroup"}}),Hu,ST=g(()=>{X(),pf(),Hu=class{constructor(t){this._gpuBuffers=Object.create(null),this._managedBuffers=[],t.renderableGC.addManagedHash(this,"_gpuBuffers")}contextChange(t){this._gpu=t}getGPUBuffer(t){return this._gpuBuffers[t.uid]||this.createGPUBuffer(t)}updateBuffer(t){let e=this._gpuBuffers[t.uid]||this.createGPUBuffer(t),r=t.data;return t._updateID&&r&&(t._updateID=0,this._gpu.device.queue.writeBuffer(e,0,r.buffer,0,(t._updateSize||r.byteLength)+3&-4)),e}destroyAll(){for(let t in this._gpuBuffers)this._gpuBuffers[t].destroy();this._gpuBuffers={}}createGPUBuffer(t){this._gpuBuffers[t.uid]||(t.on("update",this.updateBuffer,this),t.on("change",this.onBufferChange,this),t.on("destroy",this.onBufferDestroy,this),this._managedBuffers.push(t));let e=this._gpu.device.createBuffer(t.descriptor);return t._updateID=0,t.data&&(rh(t.data.buffer,e.getMappedRange()),e.unmap()),this._gpuBuffers[t.uid]=e,e}onBufferChange(t){this._gpuBuffers[t.uid].destroy(),t._updateID=0,this._gpuBuffers[t.uid]=this.createGPUBuffer(t)}onBufferDestroy(t){this._managedBuffers.splice(this._managedBuffers.indexOf(t),1),this._destroyBuffer(t)}destroy(){this._managedBuffers.forEach(t=>this._destroyBuffer(t)),this._managedBuffers=null,this._gpuBuffers=null}_destroyBuffer(t){this._gpuBuffers[t.uid].destroy(),t.off("update",this.updateBuffer,this),t.off("change",this.onBufferChange,this),t.off("destroy",this.onBufferDestroy,this),this._gpuBuffers[t.uid]=null}},Hu.extension={type:[M.WebGPUSystem],name:"buffer"}}),Vu,ET=g(()=>{X(),Vu=class{constructor(t){this._colorMaskCache=15,this._renderer=t}setMask(t){this._colorMaskCache!==t&&(this._colorMaskCache=t,this._renderer.pipeline.setColorMask(t))}destroy(){this._renderer=null,this._colorMaskCache=null}},Vu.extension={type:[M.WebGPUSystem],name:"colorMask"}}),Fo,CT=g(()=>{Jt(),X(),Fo=class{constructor(t){this._renderer=t}async init(t){return this._initPromise?this._initPromise:(this._initPromise=this._createDeviceAndAdaptor(t).then(e=>{this.gpu=e,this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(t){this._renderer.gpu=t}async _createDeviceAndAdaptor(t){let e=await Dt.get().getNavigator().gpu.requestAdapter({powerPreference:t.powerPreference,forceFallbackAdapter:t.forceFallbackAdapter}),r=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(n=>e.features.has(n)),i=await e.requestDevice({requiredFeatures:r});return{adapter:e,device:i}}destroy(){this.gpu=null,this._renderer=null}},Fo.extension={type:[M.WebGPUSystem],name:"device"},Fo.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1}}),ju,AT=g(()=>{X(),ju=class{constructor(t){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=t}renderStart(){this.commandFinished=new Promise(t=>{this._resolveCommandFinished=t}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(t){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(t.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(t){this.renderPassEncoder.setViewport(t.x,t.y,t.width,t.height,0,1)}setPipelineFromGeometryProgramAndState(t,e,r,i){let n=this._renderer.pipeline.getPipeline(t,e,r,i);this.setPipeline(n)}setPipeline(t){this._boundPipeline!==t&&(this._boundPipeline=t,this.renderPassEncoder.setPipeline(t))}_setVertexBuffer(t,e){this._boundVertexBuffer[t]!==e&&(this._boundVertexBuffer[t]=e,this.renderPassEncoder.setVertexBuffer(t,this._renderer.buffer.updateBuffer(e)))}_setIndexBuffer(t){if(this._boundIndexBuffer===t)return;this._boundIndexBuffer=t;let e=t.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(t),e)}resetBindGroup(t){this._boundBindGroup[t]=null}setBindGroup(t,e,r){if(this._boundBindGroup[t]===e)return;this._boundBindGroup[t]=e,e._touch(this._renderer.textureGC.count);let i=this._renderer.bindGroup.getBindGroup(e,r,t);this.renderPassEncoder.setBindGroup(t,i)}setGeometry(t,e){let r=this._renderer.pipeline.getBufferNamesToBind(t,e);for(let i in r)this._setVertexBuffer(i,t.attributes[r[i]].buffer);t.indexBuffer&&this._setIndexBuffer(t.indexBuffer)}_setShaderBindGroups(t,e){for(let r in t.groups){let i=t.groups[r];e||this._syncBindGroup(i),this.setBindGroup(r,i,t.gpuProgram)}}_syncBindGroup(t){for(let e in t.resources){let r=t.resources[e];r.isUniformGroup&&this._renderer.ubo.updateUniformGroup(r)}}draw(t){let{geometry:e,shader:r,state:i,topology:n,size:s,start:a,instanceCount:o,skipSync:l}=t;this.setPipelineFromGeometryProgramAndState(e,r.gpuProgram,i,n),this.setGeometry(e,r.gpuProgram),this._setShaderBindGroups(r,l),e.indexBuffer?this.renderPassEncoder.drawIndexed(s||e.indexBuffer.data.length,o??e.instanceCount,a||0):this.renderPassEncoder.draw(s||e.getSize(),o??e.instanceCount,a||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){let t=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1]);this.renderPassEncoder=this.commandEncoder.beginRenderPass(t);let e=this._boundPipeline,r={...this._boundVertexBuffer},i=this._boundIndexBuffer,n={...this._boundBindGroup};this._clearCache();let s=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(s.x,s.y,s.width,s.height,0,1),this.setPipeline(e);for(let a in r)this._setVertexBuffer(a,r[a]);for(let a in n)this.setBindGroup(a,n[a],null);this._setIndexBuffer(i)}_clearCache(){for(let t=0;t<16;t++)this._boundBindGroup[t]=null,this._boundVertexBuffer[t]=null;this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null}contextChange(t){this._gpu=t}},ju.extension={type:[M.WebGPUSystem],name:"encoder",priority:1}}),Wu,PT=g(()=>{X(),Wu=class{constructor(t){this._renderer=t}contextChange(){this.maxTextures=this._renderer.device.gpu.device.limits.maxSampledTexturesPerShaderStage,this.maxBatchableTextures=this.maxTextures}destroy(){}},Wu.extension={type:[M.WebGPUSystem],name:"limits"}}),$u,MT=g(()=>{X(),Fn(),$u=class{constructor(t){this._renderTargetStencilState=Object.create(null),this._renderer=t,t.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){let e=this._renderTargetStencilState[t.uid];e||(e=this._renderTargetStencilState[t.uid]={stencilMode:$t.DISABLED,stencilReference:0}),this._activeRenderTarget=t,this.setStencilMode(e.stencilMode,e.stencilReference)}setStencilMode(t,e){let r=this._renderTargetStencilState[this._activeRenderTarget.uid];r.stencilMode=t,r.stencilReference=e;let i=this._renderer;i.pipeline.setStencilMode(t),i.encoder.renderPassEncoder.setStencilReference(e)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}},$u.extension={type:[M.WebGPUSystem],name:"stencil"}}),Xu,Km=g(()=>{pm(),gn(),Xi(),Xu=class{constructor(t){this._syncFunctionHash=Object.create(null),this._adaptor=t,this._systemCheck()}_systemCheck(){if(!fm())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}ensureUniformGroup(t){let e=this.getUniformGroupData(t);t.buffer||(t.buffer=new br({data:new Float32Array(e.layout.size/4),usage:ct.UNIFORM|ct.COPY_DST}))}getUniformGroupData(t){return this._syncFunctionHash[t._signature]||this._initUniformGroup(t)}_initUniformGroup(t){let e=t._signature,r=this._syncFunctionHash[e];if(!r){let i=Object.keys(t.uniformStructures).map(a=>t.uniformStructures[a]),n=this._adaptor.createUboElements(i),s=this._generateUboSync(n.uboElements);r=this._syncFunctionHash[e]={layout:n,syncFunction:s}}return this._syncFunctionHash[e]}_generateUboSync(t){return this._adaptor.generateUboSync(t)}syncUniformGroup(t,e,r){let i=this.getUniformGroupData(t);t.buffer||(t.buffer=new br({data:new Float32Array(i.layout.size/4),usage:ct.UNIFORM|ct.COPY_DST}));let n=null;return e||(e=t.buffer.data,n=t.buffer.dataInt32),r||(r=0),i.syncFunction(t.uniforms,e,n,r),!0}updateUniformGroup(t){if(t.isStatic&&!t._dirtyId)return!1;t._dirtyId=0;let e=this.syncUniformGroup(t);return t.buffer.update(),e}destroy(){this._syncFunctionHash=null}}});function RT(t){let e=t.map(i=>({data:i,offset:0,size:0})),r=0;for(let i=0;i<e.length;i++){let n=e[i],s=Ks[n.data.type].size,a=Ks[n.data.type].align;if(!Ks[n.data.type])throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${n.data.type}`);n.data.size>1&&(s=Math.max(s,a)*n.data.size),r=Math.ceil(r/a)*a,n.size=s,n.offset=r,r+=s}return r=Math.ceil(r/16)*16,{uboElements:e,size:r}}var Ks,Zm=g(()=>{"use strict";Ks={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2<i32>":{align:8,size:8},"vec2<u32>":{align:8,size:8},"vec2<f32>":{align:8,size:8},"vec2<f16>":{align:4,size:4},"vec3<i32>":{align:16,size:12},"vec3<u32>":{align:16,size:12},"vec3<f32>":{align:16,size:12},"vec3<f16>":{align:8,size:6},"vec4<i32>":{align:16,size:16},"vec4<u32>":{align:16,size:16},"vec4<f32>":{align:16,size:16},"vec4<f16>":{align:8,size:8},"mat2x2<f32>":{align:8,size:16},"mat2x2<f16>":{align:4,size:8},"mat3x2<f32>":{align:8,size:24},"mat3x2<f16>":{align:4,size:12},"mat4x2<f32>":{align:8,size:32},"mat4x2<f16>":{align:4,size:16},"mat2x3<f32>":{align:16,size:32},"mat2x3<f16>":{align:8,size:16},"mat3x3<f32>":{align:16,size:48},"mat3x3<f16>":{align:8,size:24},"mat4x3<f32>":{align:16,size:64},"mat4x3<f16>":{align:8,size:32},"mat2x4<f32>":{align:16,size:32},"mat2x4<f16>":{align:8,size:16},"mat3x4<f32>":{align:16,size:48},"mat3x4<f16>":{align:8,size:24},"mat4x4<f32>":{align:16,size:64},"mat4x4<f16>":{align:8,size:32}}}),Qi,Qm=g(()=>{"use strict";Qi=[{type:"mat3x3<f32>",test:t=>t.value.a!==void 0,ubo:`
|
|
var matrix = uv[name].toArray(true);
|
|
data[offset] = matrix[0];
|
|
data[offset + 1] = matrix[1];
|
|
data[offset + 2] = matrix[2];
|
|
data[offset + 4] = matrix[3];
|
|
data[offset + 5] = matrix[4];
|
|
data[offset + 6] = matrix[5];
|
|
data[offset + 8] = matrix[6];
|
|
data[offset + 9] = matrix[7];
|
|
data[offset + 10] = matrix[8];
|
|
`,uniform:`
|
|
gl.uniformMatrix3fv(ud[name].location, false, uv[name].toArray(true));
|
|
`},{type:"vec4<f32>",test:t=>t.type==="vec4<f32>"&&t.size===1&&t.value.width!==void 0,ubo:`
|
|
v = uv[name];
|
|
data[offset] = v.x;
|
|
data[offset + 1] = v.y;
|
|
data[offset + 2] = v.width;
|
|
data[offset + 3] = v.height;
|
|
`,uniform:`
|
|
cv = ud[name].value;
|
|
v = uv[name];
|
|
if (cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height) {
|
|
cv[0] = v.x;
|
|
cv[1] = v.y;
|
|
cv[2] = v.width;
|
|
cv[3] = v.height;
|
|
gl.uniform4f(ud[name].location, v.x, v.y, v.width, v.height);
|
|
}
|
|
`},{type:"vec2<f32>",test:t=>t.type==="vec2<f32>"&&t.size===1&&t.value.x!==void 0,ubo:`
|
|
v = uv[name];
|
|
data[offset] = v.x;
|
|
data[offset + 1] = v.y;
|
|
`,uniform:`
|
|
cv = ud[name].value;
|
|
v = uv[name];
|
|
if (cv[0] !== v.x || cv[1] !== v.y) {
|
|
cv[0] = v.x;
|
|
cv[1] = v.y;
|
|
gl.uniform2f(ud[name].location, v.x, v.y);
|
|
}
|
|
`},{type:"vec4<f32>",test:t=>t.type==="vec4<f32>"&&t.size===1&&t.value.red!==void 0,ubo:`
|
|
v = uv[name];
|
|
data[offset] = v.red;
|
|
data[offset + 1] = v.green;
|
|
data[offset + 2] = v.blue;
|
|
data[offset + 3] = v.alpha;
|
|
`,uniform:`
|
|
cv = ud[name].value;
|
|
v = uv[name];
|
|
if (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha) {
|
|
cv[0] = v.red;
|
|
cv[1] = v.green;
|
|
cv[2] = v.blue;
|
|
cv[3] = v.alpha;
|
|
gl.uniform4f(ud[name].location, v.red, v.green, v.blue, v.alpha);
|
|
}
|
|
`},{type:"vec3<f32>",test:t=>t.type==="vec3<f32>"&&t.size===1&&t.value.red!==void 0,ubo:`
|
|
v = uv[name];
|
|
data[offset] = v.red;
|
|
data[offset + 1] = v.green;
|
|
data[offset + 2] = v.blue;
|
|
`,uniform:`
|
|
cv = ud[name].value;
|
|
v = uv[name];
|
|
if (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue) {
|
|
cv[0] = v.red;
|
|
cv[1] = v.green;
|
|
cv[2] = v.blue;
|
|
gl.uniform3f(ud[name].location, v.red, v.green, v.blue);
|
|
}
|
|
`}]});function Jm(t,e,r,i){let n=[`
|
|
var v = null;
|
|
var v2 = null;
|
|
var t = 0;
|
|
var index = 0;
|
|
var name = null;
|
|
var arrayOffset = null;
|
|
`],s=0;for(let o=0;o<t.length;o++){let l=t[o],h=l.data.name,u=!1,c=0;for(let f=0;f<Qi.length;f++)if(Qi[f].test(l.data)){c=l.offset/4,n.push(`name = "${h}";`,`offset += ${c-s};`,Qi[f][e]||Qi[f].ubo),u=!0;break}if(!u)if(l.data.size>1)c=l.offset/4,n.push(r(l,c-s));else{let f=i[l.data.type];c=l.offset/4,n.push(`
|
|
v = uv.${h};
|
|
offset += ${c-s};
|
|
${f};
|
|
`)}s=c}let a=n.join(`
|
|
`);return new Function("uv","data","dataInt32","offset",a)}var e_=g(()=>{Qm()});function Qn(t,e){return`
|
|
for (let i = 0; i < ${t*e}; i++) {
|
|
data[offset + (((i / ${t})|0) * 4) + (i % ${t})] = v[i];
|
|
}
|
|
`}var Yu,t_,r_=g(()=>{"use strict";Yu={f32:`
|
|
data[offset] = v;`,i32:`
|
|
dataInt32[offset] = v;`,"vec2<f32>":`
|
|
data[offset] = v[0];
|
|
data[offset + 1] = v[1];`,"vec3<f32>":`
|
|
data[offset] = v[0];
|
|
data[offset + 1] = v[1];
|
|
data[offset + 2] = v[2];`,"vec4<f32>":`
|
|
data[offset] = v[0];
|
|
data[offset + 1] = v[1];
|
|
data[offset + 2] = v[2];
|
|
data[offset + 3] = v[3];`,"vec2<i32>":`
|
|
dataInt32[offset] = v[0];
|
|
dataInt32[offset + 1] = v[1];`,"vec3<i32>":`
|
|
dataInt32[offset] = v[0];
|
|
dataInt32[offset + 1] = v[1];
|
|
dataInt32[offset + 2] = v[2];`,"vec4<i32>":`
|
|
dataInt32[offset] = v[0];
|
|
dataInt32[offset + 1] = v[1];
|
|
dataInt32[offset + 2] = v[2];
|
|
dataInt32[offset + 3] = v[3];`,"mat2x2<f32>":`
|
|
data[offset] = v[0];
|
|
data[offset + 1] = v[1];
|
|
data[offset + 4] = v[2];
|
|
data[offset + 5] = v[3];`,"mat3x3<f32>":`
|
|
data[offset] = v[0];
|
|
data[offset + 1] = v[1];
|
|
data[offset + 2] = v[2];
|
|
data[offset + 4] = v[3];
|
|
data[offset + 5] = v[4];
|
|
data[offset + 6] = v[5];
|
|
data[offset + 8] = v[6];
|
|
data[offset + 9] = v[7];
|
|
data[offset + 10] = v[8];`,"mat4x4<f32>":`
|
|
for (let i = 0; i < 16; i++) {
|
|
data[offset + i] = v[i];
|
|
}`,"mat3x2<f32>":Qn(3,2),"mat4x2<f32>":Qn(4,2),"mat2x3<f32>":Qn(2,3),"mat4x3<f32>":Qn(4,3),"mat2x4<f32>":Qn(2,4),"mat3x4<f32>":Qn(3,4)},t_={...Yu,"mat2x2<f32>":`
|
|
data[offset] = v[0];
|
|
data[offset + 1] = v[1];
|
|
data[offset + 2] = v[2];
|
|
data[offset + 3] = v[3];
|
|
`}});function kT(t,e){let{size:r,align:i}=Ks[t.data.type],n=(i-r)/4,s=t.data.type.indexOf("i32")>=0?"dataInt32":"data";return`
|
|
v = uv.${t.data.name};
|
|
${e!==0?`offset += ${e};`:""}
|
|
|
|
arrayOffset = offset;
|
|
|
|
t = 0;
|
|
|
|
for(var i=0; i < ${t.data.size*(r/4)}; i++)
|
|
{
|
|
for(var j = 0; j < ${r/4}; j++)
|
|
{
|
|
${s}[arrayOffset++] = v[t++];
|
|
}
|
|
${n!==0?`arrayOffset += ${n};`:""}
|
|
}
|
|
`}var BT=g(()=>{Zm()});function GT(t){return Jm(t,"uboWgsl",kT,t_)}var IT=g(()=>{e_(),r_(),BT()}),qu,OT=g(()=>{X(),Km(),Zm(),IT(),qu=class extends Xu{constructor(){super({createUboElements:RT,generateUboSync:GT})}},qu.extension={type:[M.WebGPUSystem],name:"ubo"}}),Do,Ku=g(()=>{kt(),Ot(),Do=class extends st{constructor({buffer:t,offset:e,size:r}){super(),this.uid=ot("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=ot("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=t,this.offset=e|0,this.size=r,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=ot("resource"),this.emit("change",this)}destroy(t=!1){this.destroyed=!0,t&&this.buffer.destroy(),this.emit("change",this),this.buffer=null}}}),i_,FT=g(()=>{"use strict";i_=class{constructor({minUniformOffsetAlignment:t}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=t,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(t){if(t>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${t*4}`);let e=this.byteIndex,r=e+t*4;if(r=Math.ceil(r/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,r>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=r,e}addGroup(t){let e=this.addEmptyGroup(t.length);for(let r=0;r<t.length;r++)this.data[e/4+r]=t[r];return e}destroy(){this.data=null}}}),ki,Zu,DT=g(()=>{X(),gn(),Ku(),Xi(),FT(),dn(),ki=128,Zu=class{constructor(t){this._bindGroupHash=Object.create(null),this._buffers=[],this._bindGroups=[],this._bufferResources=[],this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_bindGroupHash"),this._batchBuffer=new i_({minUniformOffsetAlignment:ki});let e=256/ki;for(let r=0;r<e;r++){let i=ct.UNIFORM|ct.COPY_DST;r===0&&(i|=ct.COPY_SRC),this._buffers.push(new br({data:this._batchBuffer.data,usage:i}))}}renderEnd(){this._uploadBindGroups(),this._resetBindGroups()}_resetBindGroups(){for(let t in this._bindGroupHash)this._bindGroupHash[t]=null;this._batchBuffer.clear()}getUniformBindGroup(t,e){if(!e&&this._bindGroupHash[t.uid])return this._bindGroupHash[t.uid];this._renderer.ubo.ensureUniformGroup(t);let r=t.buffer.data,i=this._batchBuffer.addEmptyGroup(r.length);return this._renderer.ubo.syncUniformGroup(t,this._batchBuffer.data,i/4),this._bindGroupHash[t.uid]=this._getBindGroup(i/ki),this._bindGroupHash[t.uid]}getUboResource(t){this._renderer.ubo.updateUniformGroup(t);let e=t.buffer.data,r=this._batchBuffer.addGroup(e);return this._getBufferResource(r/ki)}getArrayBindGroup(t){let e=this._batchBuffer.addGroup(t);return this._getBindGroup(e/ki)}getArrayBufferResource(t){let e=this._batchBuffer.addGroup(t)/ki;return this._getBufferResource(e)}_getBufferResource(t){if(!this._bufferResources[t]){let e=this._buffers[t%2];this._bufferResources[t]=new Do({buffer:e,offset:(t/2|0)*256,size:ki})}return this._bufferResources[t]}_getBindGroup(t){if(!this._bindGroups[t]){let e=new li({0:this._getBufferResource(t)});this._bindGroups[t]=e}return this._bindGroups[t]}_uploadBindGroups(){let t=this._renderer.buffer,e=this._buffers[0];e.update(this._batchBuffer.byteIndex),t.updateBuffer(e);let r=this._renderer.gpu.device.createCommandEncoder();for(let i=1;i<this._buffers.length;i++){let n=this._buffers[i];r.copyBufferToBuffer(t.getGPUBuffer(e),ki,t.getGPUBuffer(n),0,this._batchBuffer.byteIndex)}this._renderer.gpu.device.queue.submit([r.finish()])}destroy(){for(let t=0;t<this._bindGroups.length;t++)this._bindGroups[t].destroy();this._bindGroups=null,this._bindGroupHash=null;for(let t=0;t<this._buffers.length;t++)this._buffers[t].destroy();this._buffers=null;for(let t=0;t<this._bufferResources.length;t++)this._bufferResources[t].destroy();this._bufferResources=null,this._batchBuffer.destroy(),this._bindGroupHash=null,this._renderer=null}},Zu.extension={type:[M.WebGPUPipes],name:"uniformBatch"}});function n_(t,e){for(let r in t.attributes){let i=t.attributes[r],n=e[r];n?(i.format??(i.format=n.format),i.offset??(i.offset=n.offset),i.instance??(i.instance=n.instance)):Ye(`Attribute ${r} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}UT(t)}function UT(t){let{buffers:e,attributes:r}=t,i={},n={};for(let s in e){let a=e[s];i[a.uid]=0,n[a.uid]=0}for(let s in r){let a=r[s];i[a.buffer.uid]+=Yi(a.format).stride}for(let s in r){let a=r[s];a.stride??(a.stride=i[a.buffer.uid]),a.start??(a.start=n[a.buffer.uid]),n[a.buffer.uid]+=Yi(a.format).stride}}var s_=g(()=>{wt(),Nn()}),Bi,a_=g(()=>{Fn(),Bi=[],Bi[$t.NONE]=void 0,Bi[$t.DISABLED]={stencilWriteMask:0,stencilReadMask:0},Bi[$t.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}},Bi[$t.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}},Bi[$t.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}},Bi[$t.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"keep"},stencilBack:{compare:"not-equal",passOp:"keep"}}});function LT(t,e,r,i,n){return t<<24|e<<16|r<<10|i<<5|n}function NT(t,e,r,i){return r<<6|t<<3|i<<1|e}var o_,Qu,zT=g(()=>{X(),wt(),s_(),Fn(),Fa(),a_(),o_={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4},Qu=class{constructor(t){this._moduleCache=Object.create(null),this._bufferLayoutsCache=Object.create(null),this._bindingNamesCache=Object.create(null),this._pipeCache=Object.create(null),this._pipeStateCaches=Object.create(null),this._colorMask=15,this._multisampleCount=1,this._renderer=t}contextChange(t){this._gpu=t,this.setStencilMode($t.DISABLED),this._updatePipeHash()}setMultisampleCount(t){this._multisampleCount!==t&&(this._multisampleCount=t,this._updatePipeHash())}setRenderTarget(t){this._multisampleCount=t.msaaSamples,this._depthStencilAttachment=t.descriptor.depthStencilAttachment?1:0,this._updatePipeHash()}setColorMask(t){this._colorMask!==t&&(this._colorMask=t,this._updatePipeHash())}setStencilMode(t){this._stencilMode!==t&&(this._stencilMode=t,this._stencilState=Bi[t],this._updatePipeHash())}setPipeline(t,e,r,i){let n=this.getPipeline(t,e,r);i.setPipeline(n)}getPipeline(t,e,r,i){t._layoutKey||(n_(t,e.attributeData),this._generateBufferKey(t)),i||(i=t.topology);let n=LT(t._layoutKey,e._layoutKey,r.data,r._blendModeId,o_[i]);return this._pipeCache[n]?this._pipeCache[n]:(this._pipeCache[n]=this._createPipeline(t,e,r,i),this._pipeCache[n])}_createPipeline(t,e,r,i){let n=this._gpu.device,s=this._createVertexBufferLayouts(t,e),a=this._renderer.state.getColorTargets(r);a[0].writeMask=this._stencilMode===$t.RENDERING_MASK_ADD?0:this._colorMask;let o=this._renderer.shader.getProgramData(e).pipeline,l={vertex:{module:this._getModule(e.vertex.source),entryPoint:e.vertex.entryPoint,buffers:s},fragment:{module:this._getModule(e.fragment.source),entryPoint:e.fragment.entryPoint,targets:a},primitive:{topology:i,cullMode:r.cullMode},layout:o,multisample:{count:this._multisampleCount},label:"PIXI Pipeline"};return this._depthStencilAttachment&&(l.depthStencil={...this._stencilState,format:"depth24plus-stencil8",depthWriteEnabled:r.depthTest,depthCompare:r.depthTest?"less":"always"}),n.createRenderPipeline(l)}_getModule(t){return this._moduleCache[t]||this._createModule(t)}_createModule(t){let e=this._gpu.device;return this._moduleCache[t]=e.createShaderModule({code:t}),this._moduleCache[t]}_generateBufferKey(t){let e=[],r=0,i=Object.keys(t.attributes).sort();for(let s=0;s<i.length;s++){let a=t.attributes[i[s]];e[r++]=a.offset,e[r++]=a.format,e[r++]=a.stride,e[r++]=a.instance}let n=e.join("|");return t._layoutKey=xs(n,"geometry"),t._layoutKey}_generateAttributeLocationsKey(t){let e=[],r=0,i=Object.keys(t.attributeData).sort();for(let s=0;s<i.length;s++){let a=t.attributeData[i[s]];e[r++]=a.location}let n=e.join("|");return t._attributeLocationsKey=xs(n,"programAttributes"),t._attributeLocationsKey}getBufferNamesToBind(t,e){let r=t._layoutKey<<16|e._attributeLocationsKey;if(this._bindingNamesCache[r])return this._bindingNamesCache[r];let i=this._createVertexBufferLayouts(t,e),n=Object.create(null),s=e.attributeData;for(let a=0;a<i.length;a++){let o=Object.values(i[a].attributes)[0].shaderLocation;for(let l in s)if(s[l].location===o){n[a]=l;break}}return this._bindingNamesCache[r]=n,n}_createVertexBufferLayouts(t,e){e._attributeLocationsKey||this._generateAttributeLocationsKey(e);let r=t._layoutKey<<16|e._attributeLocationsKey;if(this._bufferLayoutsCache[r])return this._bufferLayoutsCache[r];let i=[];return t.buffers.forEach(n=>{let s={arrayStride:0,stepMode:"vertex",attributes:[]},a=s.attributes;for(let o in e.attributeData){let l=t.attributes[o];(l.divisor??1)!==1&&Ye(`Attribute ${o} has an invalid divisor value of '${l.divisor}'. WebGPU only supports a divisor value of 1`),l.buffer===n&&(s.arrayStride=l.stride,s.stepMode=l.instance?"instance":"vertex",a.push({shaderLocation:e.attributeData[o].location,offset:l.offset,format:l.format}))}a.length&&i.push(s)}),this._bufferLayoutsCache[r]=i,i}_updatePipeHash(){let t=NT(this._stencilMode,this._multisampleCount,this._colorMask,this._depthStencilAttachment);this._pipeStateCaches[t]||(this._pipeStateCaches[t]=Object.create(null)),this._pipeCache=this._pipeStateCaches[t]}destroy(){this._renderer=null,this._bufferLayoutsCache=null}},Qu.extension={type:[M.WebGPUSystem],name:"pipeline"}});function HT(t,e,r,i,n,s){let a=s?1:-1;return t.identity(),t.a=1/i*2,t.d=a*(1/n*2),t.tx=-1-e*t.a,t.ty=-a-r*t.d,t}var VT=g(()=>{"use strict"});function jT(t){let e=t.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement&&document.body.contains(e)}var WT=g(()=>{"use strict"}),Ju,l_=g(()=>{Ke(),O(),$s(),VT(),gm(),ms(),xr(),Ft(),Xm(),WT(),Wm(),Ju=class{constructor(t){this.rootViewPort=new R,this.viewport=new R,this.onRenderTargetChange=new pu("onRenderTargetChange"),this.projectionMatrix=new ve,this.defaultClearColor=[0,0,0,0],this._renderSurfaceToRenderTargetHash=new Map,this._gpuRenderTargetHash=Object.create(null),this._renderTargetStack=[],this._renderer=t,t.renderableGC.addManagedHash(this,"_gpuRenderTargetHash")}finishRenderPass(){this.adaptor.finishRenderPass(this.renderTarget)}renderStart({target:t,clear:e,clearColor:r,frame:i}){this._renderTargetStack.length=0,this.push(t,e,r,i),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=jT(this.rootRenderTarget),this.adaptor.prerender?.(this.rootRenderTarget)}postrender(){this.adaptor.postrender?.(this.rootRenderTarget)}bind(t,e=!0,r,i){let n=this.getRenderTarget(t),s=this.renderTarget!==n;this.renderTarget=n,this.renderSurface=t;let a=this.getGpuRenderTarget(n);(n.pixelWidth!==a.width||n.pixelHeight!==a.height)&&(this.adaptor.resizeGpuRenderTarget(n),a.width=n.pixelWidth,a.height=n.pixelHeight);let o=n.colorTexture,l=this.viewport,h=o.pixelWidth,u=o.pixelHeight;if(!i&&t instanceof Fe&&(i=t.frame),i){let c=o._resolution;l.x=i.x*c+.5|0,l.y=i.y*c+.5|0,l.width=i.width*c+.5|0,l.height=i.height*c+.5|0}else l.x=0,l.y=0,l.width=h,l.height=u;return HT(this.projectionMatrix,0,0,l.width/o.resolution,l.height/o.resolution,!n.isRoot),this.adaptor.startRenderPass(n,e,r,l),s&&this.onRenderTargetChange.emit(n),n}clear(t,e=Tr.ALL,r){e&&(t&&(t=this.getRenderTarget(t)),this.adaptor.clear(t||this.renderTarget,e,r,this.viewport))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(t,e=Tr.ALL,r,i){let n=this.bind(t,e,r,i);return this._renderTargetStack.push({renderTarget:n,frame:i}),n}pop(){this._renderTargetStack.pop();let t=this._renderTargetStack[this._renderTargetStack.length-1];this.bind(t.renderTarget,!1,null,t.frame)}getRenderTarget(t){return t.isTexture&&(t=t.source),this._renderSurfaceToRenderTargetHash.get(t)??this._initRenderTarget(t)}copyToTexture(t,e,r,i,n){r.x<0&&(i.width+=r.x,n.x-=r.x,r.x=0),r.y<0&&(i.height+=r.y,n.y-=r.y,r.y=0);let{pixelWidth:s,pixelHeight:a}=t;return i.width=Math.min(i.width,s-r.x),i.height=Math.min(i.height,a-r.y),this.adaptor.copyToTexture(t,e,r,i,n)}ensureDepthStencil(){this.renderTarget.stencil||(this.renderTarget.stencil=!0,this.adaptor.startRenderPass(this.renderTarget,!1,null,this.viewport))}destroy(){this._renderer=null,this._renderSurfaceToRenderTargetHash.forEach((t,e)=>{t!==e&&t.destroy()}),this._renderSurfaceToRenderTargetHash.clear(),this._gpuRenderTargetHash=Object.create(null)}_initRenderTarget(t){let e=null;return oi.test(t)&&(t=$m(t).source),t instanceof Io?e=t:t instanceof Qt&&(e=new Io({colorTextures:[t]}),t.source instanceof oi&&(e.isRoot=!0),t.once("destroy",()=>{e.destroy(),this._renderSurfaceToRenderTargetHash.delete(t);let r=this._gpuRenderTargetHash[e.uid];r&&(this._gpuRenderTargetHash[e.uid]=null,this.adaptor.destroyGpuRenderTarget(r))})),this._renderSurfaceToRenderTargetHash.set(t,e),e}getGpuRenderTarget(t){return this._gpuRenderTargetHash[t.uid]||(this._gpuRenderTargetHash[t.uid]=this.adaptor.initGpuRenderTarget(t))}resetState(){this.renderTarget=null,this.renderSurface=null}}}),h_,$T=g(()=>{"use strict";h_=class{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}}),u_,XT=g(()=>{$s(),ms(),xr(),$T(),u_=class{init(t,e){this._renderer=t,this._renderTargetSystem=e}copyToTexture(t,e,r,i,n){let s=this._renderer,a=this._getGpuColorTexture(t),o=s.texture.getGpuSource(e.source);return s.encoder.commandEncoder.copyTextureToTexture({texture:a,origin:r},{texture:o,origin:n},i),e}startRenderPass(t,e=!0,r,i){let n=this._renderTargetSystem.getGpuRenderTarget(t),s=this.getDescriptor(t,e,r);n.descriptor=s,this._renderer.pipeline.setRenderTarget(n),this._renderer.encoder.beginRenderPass(n),this._renderer.encoder.setViewport(i)}finishRenderPass(){this._renderer.encoder.endRenderPass()}_getGpuColorTexture(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);return e.contexts[0]?e.contexts[0].getCurrentTexture():this._renderer.texture.getGpuSource(t.colorTextures[0].source)}getDescriptor(t,e,r){typeof e=="boolean"&&(e=e?Tr.ALL:Tr.NONE);let i=this._renderTargetSystem,n=i.getGpuRenderTarget(t),s=t.colorTextures.map((o,l)=>{let h=n.contexts[l],u,c;h?u=h.getCurrentTexture().createView():u=this._renderer.texture.getGpuSource(o).createView({mipLevelCount:1}),n.msaaTextures[l]&&(c=u,u=this._renderer.texture.getTextureView(n.msaaTextures[l]));let f=e&Tr.COLOR?"clear":"load";return r??(r=i.defaultClearColor),{view:u,resolveTarget:c,clearValue:r,storeOp:"store",loadOp:f}}),a;if((t.stencil||t.depth)&&!t.depthStencilTexture&&(t.ensureDepthStencilTexture(),t.depthStencilTexture.source.sampleCount=n.msaa?4:1),t.depthStencilTexture){let o=e&Tr.STENCIL?"clear":"load",l=e&Tr.DEPTH?"clear":"load";a={view:this._renderer.texture.getGpuSource(t.depthStencilTexture.source).createView(),stencilStoreOp:"store",stencilLoadOp:o,depthClearValue:1,depthLoadOp:l,depthStoreOp:"store"}}return{colorAttachments:s,depthStencilAttachment:a}}clear(t,e=!0,r,i){if(!e)return;let{gpu:n,encoder:s}=this._renderer,a=n.device;if(s.commandEncoder===null){let o=a.createCommandEncoder(),l=this.getDescriptor(t,e,r),h=o.beginRenderPass(l);h.setViewport(i.x,i.y,i.width,i.height,0,1),h.end();let u=o.finish();a.queue.submit([u])}else this.startRenderPass(t,e,r,i)}initGpuRenderTarget(t){t.isRoot=!0;let e=new h_;return t.colorTextures.forEach((r,i)=>{if(r instanceof oi){let n=r.resource.getContext("webgpu"),s=r.transparent?"premultiplied":"opaque";try{n.configure({device:this._renderer.gpu.device,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,format:"bgra8unorm",alphaMode:s})}catch(a){console.error(a)}e.contexts[i]=n}if(e.msaa=r.source.antialias,r.source.antialias){let n=new Qt({width:0,height:0,sampleCount:4});e.msaaTextures[i]=n}}),e.msaa&&(e.msaaSamples=4,t.depthStencilTexture&&(t.depthStencilTexture.source.sampleCount=4)),e}destroyGpuRenderTarget(t){t.contexts.forEach(e=>{e.unconfigure()}),t.msaaTextures.forEach(e=>{e.destroy()}),t.msaaTextures.length=0,t.contexts.length=0}ensureDepthStencilTexture(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);t.depthStencilTexture&&e.msaa&&(t.depthStencilTexture.source.sampleCount=4)}resizeGpuRenderTarget(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);e.width=t.width,e.height=t.height,e.msaa&&t.colorTextures.forEach((r,i)=>{e.msaaTextures[i]?.resize(r.source.width,r.source.height,r.source._resolution)})}}}),ec,YT=g(()=>{X(),l_(),XT(),ec=class extends Ju{constructor(t){super(t),this.adaptor=new u_,this.adaptor.init(t,this)}},ec.extension={type:[M.WebGPUSystem],name:"renderTarget"}}),tc,qT=g(()=>{X(),tc=class{constructor(){this._gpuProgramData=Object.create(null)}contextChange(t){this._gpu=t}getProgramData(t){return this._gpuProgramData[t._layoutKey]||this._createGPUProgramData(t)}_createGPUProgramData(t){let e=this._gpu.device,r=t.gpuLayout.map(n=>e.createBindGroupLayout({entries:n})),i={bindGroupLayouts:r};return this._gpuProgramData[t._layoutKey]={bindGroups:r,pipeline:e.createPipelineLayout(i)},this._gpuProgramData[t._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}},tc.extension={type:[M.WebGPUSystem],name:"shader"}}),mr,KT=g(()=>{"use strict";mr={},mr.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}},mr.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}},mr.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}},mr.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}},mr.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}},mr.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}},mr["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}},mr["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}},mr["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}},mr.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}},mr.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}},mr.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}}}),rc,ZT=g(()=>{X(),ci(),KT(),rc=class{constructor(){this.defaultState=new Nr,this.defaultState.blend=!0}contextChange(t){this.gpu=t}getColorTargets(t){return[{format:"bgra8unorm",writeMask:0,blend:mr[t.blendMode]||mr.normal}]}destroy(){this.gpu=null}},rc.extension={type:[M.WebGPUSystem],name:"state"}}),c_,QT=g(()=>{"use strict";c_={type:"image",upload(t,e,r){let i=t.resource,n=(t.pixelWidth|0)*(t.pixelHeight|0),s=i.byteLength/n;r.device.queue.writeTexture({texture:e},i,{offset:0,rowsPerImage:t.pixelHeight,bytesPerRow:t.pixelHeight*s},{width:t.pixelWidth,height:t.pixelHeight,depthOrArrayLayers:1})}}}),ic,d_,f_,JT=g(()=>{"use strict";ic={"bc1-rgba-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"bc2-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc3-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc7-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"etc1-rgb-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"etc2-rgba8unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"astc-4x4-unorm":{blockBytes:16,blockWidth:4,blockHeight:4}},d_={blockBytes:4,blockWidth:1,blockHeight:1},f_={type:"compressed",upload(t,e,r){let i=t.pixelWidth,n=t.pixelHeight,s=ic[t.format]||d_;for(let a=0;a<t.resource.length;a++){let o=t.resource[a],l=Math.ceil(i/s.blockWidth)*s.blockBytes;r.device.queue.writeTexture({texture:e,mipLevel:a},o,{offset:0,bytesPerRow:l},{width:Math.ceil(i/s.blockWidth)*s.blockWidth,height:Math.ceil(n/s.blockHeight)*s.blockHeight,depthOrArrayLayers:1}),i=Math.max(i>>1,1),n=Math.max(n>>1,1)}}}}),nc,p_=g(()=>{Jt(),wt(),nc={type:"image",upload(t,e,r){let i=t.resource;if(!i)return;if(globalThis.HTMLImageElement&&i instanceof HTMLImageElement){let o=Dt.get().createCanvas(i.width,i.height);o.getContext("2d").drawImage(i,0,0,i.width,i.height),t.resource=o,Ye("ImageSource: Image element passed, converting to canvas and replacing resource.")}let n=Math.min(e.width,t.resourceWidth||t.pixelWidth),s=Math.min(e.height,t.resourceHeight||t.pixelHeight),a=t.alphaMode==="premultiply-alpha-on-upload";r.device.queue.copyExternalImageToTexture({source:i},{texture:e,premultipliedAlpha:a},{width:n,height:s})}}}),g_,eS=g(()=>{p_(),g_={type:"video",upload(t,e,r){nc.upload(t,e,r)}}}),m_,tS=g(()=>{"use strict";m_=class{constructor(t){this.device=t,this.sampler=t.createSampler({minFilter:"linear"}),this.pipelines={}}_getMipmapPipeline(t){let e=this.pipelines[t];return e||(this.mipmapShaderModule||(this.mipmapShaderModule=this.device.createShaderModule({code:`
|
|
var<private> pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
|
|
vec2<f32>(-1.0, -1.0), vec2<f32>(-1.0, 3.0), vec2<f32>(3.0, -1.0));
|
|
|
|
struct VertexOutput {
|
|
@builtin(position) position : vec4<f32>,
|
|
@location(0) texCoord : vec2<f32>,
|
|
};
|
|
|
|
@vertex
|
|
fn vertexMain(@builtin(vertex_index) vertexIndex : u32) -> VertexOutput {
|
|
var output : VertexOutput;
|
|
output.texCoord = pos[vertexIndex] * vec2<f32>(0.5, -0.5) + vec2<f32>(0.5);
|
|
output.position = vec4<f32>(pos[vertexIndex], 0.0, 1.0);
|
|
return output;
|
|
}
|
|
|
|
@group(0) @binding(0) var imgSampler : sampler;
|
|
@group(0) @binding(1) var img : texture_2d<f32>;
|
|
|
|
@fragment
|
|
fn fragmentMain(@location(0) texCoord : vec2<f32>) -> @location(0) vec4<f32> {
|
|
return textureSample(img, imgSampler, texCoord);
|
|
}
|
|
`})),e=this.device.createRenderPipeline({layout:"auto",vertex:{module:this.mipmapShaderModule,entryPoint:"vertexMain"},fragment:{module:this.mipmapShaderModule,entryPoint:"fragmentMain",targets:[{format:t}]}}),this.pipelines[t]=e),e}generateMipmap(t){let e=this._getMipmapPipeline(t.format);if(t.dimension==="3d"||t.dimension==="1d")throw new Error("Generating mipmaps for non-2d textures is currently unsupported!");let r=t,i=t.depthOrArrayLayers||1,n=t.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!n){let o={size:{width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:i},format:t.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:t.mipLevelCount-1};r=this.device.createTexture(o)}let s=this.device.createCommandEncoder({}),a=e.getBindGroupLayout(0);for(let o=0;o<i;++o){let l=t.createView({baseMipLevel:0,mipLevelCount:1,dimension:"2d",baseArrayLayer:o,arrayLayerCount:1}),h=n?1:0;for(let u=1;u<t.mipLevelCount;++u){let c=r.createView({baseMipLevel:h++,mipLevelCount:1,dimension:"2d",baseArrayLayer:o,arrayLayerCount:1}),f=s.beginRenderPass({colorAttachments:[{view:c,storeOp:"store",loadOp:"clear",clearValue:{r:0,g:0,b:0,a:0}}]}),d=this.device.createBindGroup({layout:a,entries:[{binding:0,resource:this.sampler},{binding:1,resource:l}]});f.setPipeline(e),f.setBindGroup(0,d),f.draw(3,1,0,0),f.end(),l=c}}if(!n){let o={width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:i};for(let l=1;l<t.mipLevelCount;++l)s.copyTextureToTexture({texture:r,mipLevel:l-1},{texture:t,mipLevel:l},o),o.width=Math.ceil(o.width/2),o.height=Math.ceil(o.height/2)}return this.device.queue.submit([s.finish()]),n||r.destroy(),t}}}),sc,rS=g(()=>{Jt(),X(),wr(),Ls(),dn(),QT(),JT(),p_(),eS(),tS(),sc=class{constructor(t){this.managedTextures=[],this._gpuSources=Object.create(null),this._gpuSamplers=Object.create(null),this._bindGroupHash=Object.create(null),this._textureViewHash=Object.create(null),this._uploads={image:nc,buffer:c_,video:g_,compressed:f_},this._renderer=t,t.renderableGC.addManagedHash(this,"_gpuSources"),t.renderableGC.addManagedHash(this,"_gpuSamplers"),t.renderableGC.addManagedHash(this,"_bindGroupHash"),t.renderableGC.addManagedHash(this,"_textureViewHash")}contextChange(t){this._gpu=t}initSource(t){if(t.autoGenerateMipmaps){let o=Math.max(t.pixelWidth,t.pixelHeight);t.mipLevelCount=Math.floor(Math.log2(o))+1}let e=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST;t.uploadMethodId!=="compressed"&&(e|=GPUTextureUsage.RENDER_ATTACHMENT,e|=GPUTextureUsage.COPY_SRC);let r=ic[t.format]||{blockBytes:4,blockWidth:1,blockHeight:1},i=Math.ceil(t.pixelWidth/r.blockWidth)*r.blockWidth,n=Math.ceil(t.pixelHeight/r.blockHeight)*r.blockHeight,s={label:t.label,size:{width:i,height:n},format:t.format,sampleCount:t.sampleCount,mipLevelCount:t.mipLevelCount,dimension:t.dimension,usage:e},a=this._gpu.device.createTexture(s);return this._gpuSources[t.uid]=a,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceResize,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),a}onSourceUpdate(t){let e=this.getGpuSource(t);e&&(this._uploads[t.uploadMethodId]&&this._uploads[t.uploadMethodId].upload(t,e,this._gpu),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t))}onSourceUnload(t){let e=this._gpuSources[t.uid];e&&(this._gpuSources[t.uid]=null,e.destroy())}onUpdateMipmaps(t){this._mipmapGenerator||(this._mipmapGenerator=new m_(this._gpu.device));let e=this.getGpuSource(t);this._mipmapGenerator.generateMipmap(e)}onSourceDestroy(t){t.off("update",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("destroy",this.onSourceDestroy,this),t.off("resize",this.onSourceResize,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}onSourceResize(t){let e=this._gpuSources[t.uid];e?(e.width!==t.pixelWidth||e.height!==t.pixelHeight)&&(this._textureViewHash[t.uid]=null,this._bindGroupHash[t.uid]=null,this.onSourceUnload(t),this.initSource(t)):this.initSource(t)}_initSampler(t){return this._gpuSamplers[t._resourceId]=this._gpu.device.createSampler(t),this._gpuSamplers[t._resourceId]}getGpuSampler(t){return this._gpuSamplers[t._resourceId]||this._initSampler(t)}getGpuSource(t){return this._gpuSources[t.uid]||this.initSource(t)}getTextureBindGroup(t){return this._bindGroupHash[t.uid]??this._createTextureBindGroup(t)}_createTextureBindGroup(t){let e=t.source;return this._bindGroupHash[t.uid]=new li({0:e,1:e.style,2:new dr({uTextureMatrix:{type:"mat3x3<f32>",value:t.textureMatrix.mapCoord}})}),this._bindGroupHash[t.uid]}getTextureView(t){let e=t.source;return this._textureViewHash[e.uid]??this._createTextureView(e)}_createTextureView(t){return this._textureViewHash[t.uid]=this.getGpuSource(t).createView(),this._textureViewHash[t.uid]}generateCanvas(t){let e=this._renderer,r=e.gpu.device.createCommandEncoder(),i=Dt.get().createCanvas();i.width=t.source.pixelWidth,i.height=t.source.pixelHeight;let n=i.getContext("webgpu");return n.configure({device:e.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:Dt.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),r.copyTextureToTexture({texture:e.texture.getGpuSource(t.source),origin:{x:0,y:0}},{texture:n.getCurrentTexture()},{width:i.width,height:i.height}),e.gpu.device.queue.submit([r.finish()]),i}getPixels(t){let e=this.generateCanvas(t),r=Ri.getOptimalCanvasAndContext(e.width,e.height),i=r.context;i.drawImage(e,0,0);let{width:n,height:s}=e,a=i.getImageData(0,0,n,s),o=new Uint8ClampedArray(a.data.buffer);return Ri.returnCanvasAndContext(r),{pixels:o,width:n,height:s}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null;for(let t of Object.keys(this._bindGroupHash)){let e=Number(t);this._bindGroupHash[e]?.destroy(),this._bindGroupHash[e]=null}this._gpu=null,this._mipmapGenerator=null,this._gpuSources=null,this._bindGroupHash=null,this._textureViewHash=null,this._gpuSamplers=null}},sc.extension={type:[M.WebGPUSystem],name:"texture"}}),__={};It(__,{WebGPURenderer:()=>b_});var v_,y_,x_,ac,oc,lc,b_,iS=g(()=>{X(),Hw(),Vw(),jw(),Co(),qm(),Mi(),TT(),ST(),ET(),CT(),AT(),PT(),MT(),OT(),DT(),zT(),YT(),qT(),ZT(),rS(),v_=[...Lu,qu,ju,Fo,Wu,Hu,sc,ec,tc,rc,Qu,Vu,$u,zu],y_=[...Nu,Zu],x_=[vu,_u,mu],ac=[],oc=[],lc=[],we.handleByNamedList(M.WebGPUSystem,ac),we.handleByNamedList(M.WebGPUPipes,oc),we.handleByNamedList(M.WebGPUPipesAdaptor,lc),we.add(...v_,...y_,...x_),b_=class extends Xs{constructor(){let t={name:"webgpu",type:Lr.WEBGPU,systems:ac,renderPipes:oc,renderPipeAdaptors:lc};super(t)}}}),hc,nS=g(()=>{X(),Ke(),_n(),ja(),Xa(),Vs(),vn(),gh(),hi(),wr(),hc=class{contextChange(t){let e=new dr({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new ve,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),r=t.limits.maxBatchableTextures,i=Ts({name:"graphics",bits:[Va,uh(r),So,jn]});this.shader=new qr({glProgram:i,resources:{localUniforms:e,batchSamplers:fh(r)}})}execute(t,e){let r=e.context,i=r.customShader||this.shader,n=t.renderer,s=n.graphicsContext,{batcher:a,instructions:o}=s.getContextRenderData(r);i.groups[0]=n.globalUniforms.bindGroup,n.state.set(t.state),n.shader.bind(i),n.geometry.bind(a.geometry,i.glProgram);let l=o.instructions;for(let h=0;h<o.instructionSize;h++){let u=l[h];if(u.size){for(let c=0;c<u.textures.count;c++)n.texture.bind(u.textures.textures[c],c);n.geometry.draw(u.topology,u.size,u.start)}}}destroy(){this.shader.destroy(!0),this.shader=null}},hc.extension={type:[M.WebGLPipesAdaptor],name:"graphics"}}),uc,sS=g(()=>{X(),Ke(),_n(),Vs(),vn(),ym(),hi(),Ft(),wt(),uc=class{init(){let t=Ts({name:"mesh",bits:[So,vm,jn]});this._shader=new qr({glProgram:t,resources:{uTexture:Fe.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new ve}}}})}execute(t,e){let r=t.renderer,i=e._shader;if(i){if(!i.glProgram){Ye("Mesh shader has no glProgram",e.shader);return}}else{i=this._shader;let n=e.texture,s=n.source;i.resources.uTexture=s,i.resources.uSampler=s.style,i.resources.textureUniforms.uniforms.uTextureMatrix=n.textureMatrix.mapCoord}i.groups[100]=r.globalUniforms.bindGroup,i.groups[101]=t.localUniformsBindGroup,r.encoder.draw({geometry:e._geometry,shader:i,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}},uc.extension={type:[M.WebGLPipesAdaptor],name:"mesh"}}),cc,aS=g(()=>{X(),ci(),cc=class{constructor(){this._tempState=Nr.for2d(),this._didUploadHash={}}init(t){t.renderer.runners.contextChange.add(this)}contextChange(){this._didUploadHash={}}start(t,e,r){let i=t.renderer,n=this._didUploadHash[r.uid];i.shader.bind(r,n),n||(this._didUploadHash[r.uid]=!0),i.shader.updateUniformGroup(i.globalUniforms.uniformGroup),i.geometry.bind(e,r.glProgram)}execute(t,e){let r=t.renderer;this._tempState.blendMode=e.blendMode,r.state.set(this._tempState);let i=e.textures.textures;for(let n=0;n<e.textures.count;n++)r.texture.bind(i[n],n);r.geometry.draw(e.topology,e.size,e.start)}},cc.extension={type:[M.WebGLPipesAdaptor],name:"batch"}}),Zs,oS=g(()=>{"use strict";Zs=(t=>(t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",t))(Zs||{})}),w_,lS=g(()=>{"use strict";w_=class{constructor(t,e){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.type=e}}}),dc,hS=g(()=>{X(),Xi(),oS(),lS(),dc=class{constructor(t){this._gpuBuffers=Object.create(null),this._boundBufferBases=Object.create(null),this._minBaseLocation=0,this._nextBindBaseIndex=this._minBaseLocation,this._bindCallId=0,this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuBuffers")}destroy(){this._renderer=null,this._gl=null,this._gpuBuffers=null,this._boundBufferBases=null}contextChange(){this._gl=this._renderer.gl,this._gpuBuffers=Object.create(null),this._maxBindings=this._renderer.limits.maxUniformBindings}getGlBuffer(t){return this._gpuBuffers[t.uid]||this.createGLBuffer(t)}bind(t){let{_gl:e}=this,r=this.getGlBuffer(t);e.bindBuffer(r.type,r.buffer)}bindBufferBase(t,e){let{_gl:r}=this;this._boundBufferBases[e]!==t&&(this._boundBufferBases[e]=t,t._lastBindBaseLocation=e,r.bindBufferBase(r.UNIFORM_BUFFER,e,t.buffer))}nextBindBase(t){this._bindCallId++,this._minBaseLocation=0,t&&(this._boundBufferBases[0]=null,this._minBaseLocation=1,this._nextBindBaseIndex<1&&(this._nextBindBaseIndex=1))}freeLocationForBufferBase(t){let e=this.getLastBindBaseLocation(t);if(e>=this._minBaseLocation)return t._lastBindCallId=this._bindCallId,e;let r=0,i=this._nextBindBaseIndex;for(;r<2;){i>=this._maxBindings&&(i=this._minBaseLocation,r++);let n=this._boundBufferBases[i];if(n&&n._lastBindCallId===this._bindCallId){i++;continue}break}return e=i,this._nextBindBaseIndex=i+1,r>=2?-1:(t._lastBindCallId=this._bindCallId,this._boundBufferBases[e]=null,e)}getLastBindBaseLocation(t){let e=t._lastBindBaseLocation;return this._boundBufferBases[e]===t?e:-1}bindBufferRange(t,e,r,i){let{_gl:n}=this;r||(r=0),e||(e=0),this._boundBufferBases[e]=null,n.bindBufferRange(n.UNIFORM_BUFFER,e||0,t.buffer,r*256,i||256)}updateBuffer(t){let{_gl:e}=this,r=this.getGlBuffer(t);if(t._updateID===r.updateID)return r;r.updateID=t._updateID,e.bindBuffer(r.type,r.buffer);let i=t.data,n=t.descriptor.usage&ct.STATIC?e.STATIC_DRAW:e.DYNAMIC_DRAW;return i?r.byteLength>=i.byteLength?e.bufferSubData(r.type,0,i,0,t._updateSize/i.BYTES_PER_ELEMENT):(r.byteLength=i.byteLength,e.bufferData(r.type,i,n)):(r.byteLength=t.descriptor.size,e.bufferData(r.type,r.byteLength,n)),r}destroyAll(){let t=this._gl;for(let e in this._gpuBuffers)t.deleteBuffer(this._gpuBuffers[e].buffer);this._gpuBuffers=Object.create(null)}onBufferDestroy(t,e){let r=this._gpuBuffers[t.uid],i=this._gl;e||i.deleteBuffer(r.buffer),this._gpuBuffers[t.uid]=null}createGLBuffer(t){let{_gl:e}=this,r=Zs.ARRAY_BUFFER;t.descriptor.usage&ct.INDEX?r=Zs.ELEMENT_ARRAY_BUFFER:t.descriptor.usage&ct.UNIFORM&&(r=Zs.UNIFORM_BUFFER);let i=new w_(e.createBuffer(),r);return this._gpuBuffers[t.uid]=i,t.on("destroy",this.onBufferDestroy,this),i}resetState(){this._boundBufferBases=Object.create(null)}},dc.extension={type:[M.WebGLSystem],name:"buffer"}}),Uo,T_,uS=g(()=>{Jt(),X(),wt(),Uo=class Jy{constructor(e){this.supports={uint32Indices:!0,uniformBufferObject:!0,vertexArrayObject:!0,srgbTextures:!0,nonPowOf2wrapping:!0,msaa:!0,nonPowOf2mipmaps:!0},this._renderer=e,this.extensions=Object.create(null),this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(e){this.gl=e,this._renderer.gl=e}init(e){e={...Jy.defaultOptions,...e};let r=this.multiView=e.multiView;if(e.context&&r&&(Ye("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),r=!1),r?this.canvas=Dt.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,e.context)this.initFromContext(e.context);else{let i=this._renderer.background.alpha<1,n=e.premultipliedAlpha??!0,s=e.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(e.preferWebGLVersion,{alpha:i,premultipliedAlpha:n,antialias:s,stencil:!0,preserveDrawingBuffer:e.preserveDrawingBuffer,powerPreference:e.powerPreference??"default"})}}ensureCanvasSize(e){if(!this.multiView){e!==this.canvas&&Ye("multiView is disabled, but targetCanvas is not the main canvas");return}let{canvas:r}=this;(r.width<e.width||r.height<e.height)&&(r.width=Math.max(e.width,e.width),r.height=Math.max(e.height,e.height))}initFromContext(e){this.gl=e,this.webGLVersion=e instanceof Dt.get().getWebGLRenderingContext()?1:2,this.getExtensions(),this.validateContext(e),this._renderer.runners.contextChange.emit(e);let r=this._renderer.view.canvas;r.addEventListener("webglcontextlost",this.handleContextLost,!1),r.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}createContext(e,r){let i,n=this.canvas;if(e===2&&(i=n.getContext("webgl2",r)),!i&&(i=n.getContext("webgl",r),!i))throw new Error("This browser does not support WebGL. Try using the canvas renderer");this.gl=i,this.initFromContext(this.gl)}getExtensions(){let{gl:e}=this,r={anisotropicFiltering:e.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),s3tc:e.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:e.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:e.getExtension("WEBGL_compressed_texture_etc"),etc1:e.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:e.getExtension("WEBGL_compressed_texture_atc"),astc:e.getExtension("WEBGL_compressed_texture_astc"),bptc:e.getExtension("EXT_texture_compression_bptc"),rgtc:e.getExtension("EXT_texture_compression_rgtc"),loseContext:e.getExtension("WEBGL_lose_context")};if(this.webGLVersion===1)this.extensions={...r,drawBuffers:e.getExtension("WEBGL_draw_buffers"),depthTexture:e.getExtension("WEBGL_depth_texture"),vertexArrayObject:e.getExtension("OES_vertex_array_object")||e.getExtension("MOZ_OES_vertex_array_object")||e.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:e.getExtension("OES_element_index_uint"),floatTexture:e.getExtension("OES_texture_float"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),textureHalfFloat:e.getExtension("OES_texture_half_float"),textureHalfFloatLinear:e.getExtension("OES_texture_half_float_linear"),vertexAttribDivisorANGLE:e.getExtension("ANGLE_instanced_arrays"),srgb:e.getExtension("EXT_sRGB")};else{this.extensions={...r,colorBufferFloat:e.getExtension("EXT_color_buffer_float")};let i=e.getExtension("WEBGL_provoking_vertex");i&&i.provokingVertexWEBGL(i.FIRST_VERTEX_CONVENTION_WEBGL)}}handleContextLost(e){e.preventDefault(),this._contextLossForced&&(this._contextLossForced=!1,setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext?.restoreContext()},0))}handleContextRestored(){this.getExtensions(),this._renderer.runners.contextChange.emit(this.gl)}destroy(){let e=this._renderer.view.canvas;this._renderer=null,e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext?.loseContext()}forceContextLoss(){this.extensions.loseContext?.loseContext(),this._contextLossForced=!0}validateContext(e){let r=e.getContextAttributes();r&&!r.stencil&&Ye("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let i=this.supports,n=this.webGLVersion===2,s=this.extensions;i.uint32Indices=n||!!s.uint32ElementIndex,i.uniformBufferObject=n,i.vertexArrayObject=n||!!s.vertexArrayObject,i.srgbTextures=n||!!s.srgb,i.nonPowOf2wrapping=n,i.nonPowOf2mipmaps=n,i.msaa=n,i.uint32Indices||Ye("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}},Uo.extension={type:[M.WebGLSystem],name:"context"},Uo.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1},T_=Uo}),Lo,fc,mt,S_=g(()=>{"use strict";Lo=(t=>(t[t.RGBA=6408]="RGBA",t[t.RGB=6407]="RGB",t[t.RG=33319]="RG",t[t.RED=6403]="RED",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.ALPHA=6406]="ALPHA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t))(Lo||{}),fc=(t=>(t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",t))(fc||{}),mt=(t=>(t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.BYTE=5120]="BYTE",t[t.SHORT=5122]="SHORT",t[t.INT=5124]="INT",t[t.FLOAT=5126]="FLOAT",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",t[t.HALF_FLOAT=36193]="HALF_FLOAT",t))(mt||{})});function cS(t){return pc[t]??pc.float32}var pc,dS=g(()=>{S_(),pc={uint8x2:mt.UNSIGNED_BYTE,uint8x4:mt.UNSIGNED_BYTE,sint8x2:mt.BYTE,sint8x4:mt.BYTE,unorm8x2:mt.UNSIGNED_BYTE,unorm8x4:mt.UNSIGNED_BYTE,snorm8x2:mt.BYTE,snorm8x4:mt.BYTE,uint16x2:mt.UNSIGNED_SHORT,uint16x4:mt.UNSIGNED_SHORT,sint16x2:mt.SHORT,sint16x4:mt.SHORT,unorm16x2:mt.UNSIGNED_SHORT,unorm16x4:mt.UNSIGNED_SHORT,snorm16x2:mt.SHORT,snorm16x4:mt.SHORT,float16x2:mt.HALF_FLOAT,float16x4:mt.HALF_FLOAT,float32:mt.FLOAT,float32x2:mt.FLOAT,float32x3:mt.FLOAT,float32x4:mt.FLOAT,uint32:mt.UNSIGNED_INT,uint32x2:mt.UNSIGNED_INT,uint32x3:mt.UNSIGNED_INT,uint32x4:mt.UNSIGNED_INT,sint32:mt.INT,sint32x2:mt.INT,sint32x3:mt.INT,sint32x4:mt.INT}}),E_,gc,fS=g(()=>{X(),Nn(),s_(),dS(),E_={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5},gc=class{constructor(t){this._geometryVaoHash=Object.create(null),this._renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this._renderer.renderableGC.addManagedHash(this,"_geometryVaoHash")}contextChange(){let t=this.gl=this._renderer.gl;if(!this._renderer.context.supports.vertexArrayObject)throw new Error("[PixiJS] Vertex Array Objects are not supported on this device");let e=this._renderer.context.extensions.vertexArrayObject;e&&(t.createVertexArray=()=>e.createVertexArrayOES(),t.bindVertexArray=i=>e.bindVertexArrayOES(i),t.deleteVertexArray=i=>e.deleteVertexArrayOES(i));let r=this._renderer.context.extensions.vertexAttribDivisorANGLE;r&&(t.drawArraysInstanced=(i,n,s,a)=>{r.drawArraysInstancedANGLE(i,n,s,a)},t.drawElementsInstanced=(i,n,s,a,o)=>{r.drawElementsInstancedANGLE(i,n,s,a,o)},t.vertexAttribDivisor=(i,n)=>r.vertexAttribDivisorANGLE(i,n)),this._activeGeometry=null,this._activeVao=null,this._geometryVaoHash=Object.create(null)}bind(t,e){let r=this.gl;this._activeGeometry=t;let i=this.getVao(t,e);this._activeVao!==i&&(this._activeVao=i,r.bindVertexArray(i)),this.updateBuffers()}resetState(){this.unbind()}updateBuffers(){let t=this._activeGeometry,e=this._renderer.buffer;for(let r=0;r<t.buffers.length;r++){let i=t.buffers[r];e.updateBuffer(i)}}checkCompatibility(t,e){let r=t.attributes,i=e._attributeData;for(let n in i)if(!r[n])throw new Error(`shader and geometry incompatible, geometry missing the "${n}" attribute`)}getSignature(t,e){let r=t.attributes,i=e._attributeData,n=["g",t.uid];for(let s in r)i[s]&&n.push(s,i[s].location);return n.join("-")}getVao(t,e){return this._geometryVaoHash[t.uid]?.[e._key]||this.initGeometryVao(t,e)}initGeometryVao(t,e,r=!0){let i=this._renderer.gl,n=this._renderer.buffer;this._renderer.shader._getProgramData(e),this.checkCompatibility(t,e);let s=this.getSignature(t,e);this._geometryVaoHash[t.uid]||(this._geometryVaoHash[t.uid]=Object.create(null),t.on("destroy",this.onGeometryDestroy,this));let a=this._geometryVaoHash[t.uid],o=a[s];if(o)return a[e._key]=o,o;n_(t,e._attributeData);let l=t.buffers;o=i.createVertexArray(),i.bindVertexArray(o);for(let h=0;h<l.length;h++){let u=l[h];n.bind(u)}return this.activateVao(t,e),a[e._key]=o,a[s]=o,i.bindVertexArray(null),o}onGeometryDestroy(t,e){let r=this._geometryVaoHash[t.uid],i=this.gl;if(r){if(e)for(let n in r)this._activeVao!==r[n]&&this.unbind(),i.deleteVertexArray(r[n]);this._geometryVaoHash[t.uid]=null}}destroyAll(t=!1){let e=this.gl;for(let r in this._geometryVaoHash){if(t)for(let i in this._geometryVaoHash[r]){let n=this._geometryVaoHash[r];this._activeVao!==n&&this.unbind(),e.deleteVertexArray(n[i])}this._geometryVaoHash[r]=null}}activateVao(t,e){let r=this._renderer.gl,i=this._renderer.buffer,n=t.attributes;t.indexBuffer&&i.bind(t.indexBuffer);let s=null;for(let a in n){let o=n[a],l=o.buffer,h=i.getGlBuffer(l),u=e._attributeData[a];if(u){s!==h&&(i.bind(l),s=h);let c=u.location;r.enableVertexAttribArray(c);let f=Yi(o.format),d=cS(o.format);if(u.format?.substring(1,4)==="int"?r.vertexAttribIPointer(c,f.size,d,o.stride,o.offset):r.vertexAttribPointer(c,f.size,d,f.normalised,o.stride,o.offset),o.instance)if(this.hasInstance){let _=o.divisor??1;r.vertexAttribDivisor(c,_)}else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,r,i){let{gl:n}=this._renderer,s=this._activeGeometry,a=E_[t||s.topology];if(i??(i=s.instanceCount),s.indexBuffer){let o=s.indexBuffer.data.BYTES_PER_ELEMENT,l=o===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;i>1?n.drawElementsInstanced(a,e||s.indexBuffer.data.length,l,(r||0)*o,i):n.drawElements(a,e||s.indexBuffer.data.length,l,(r||0)*o)}else i>1?n.drawArraysInstanced(a,r||0,e||s.getSize(),i):n.drawArrays(a,r||0,e||s.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this._renderer=null,this.gl=null,this._activeVao=null,this._activeGeometry=null}},gc.extension={type:[M.WebGLSystem],name:"geometry"}}),C_,No,A_,pS=g(()=>{X(),wt(),ys(),hi(),ci(),xr(),Ft(),Ln(),C_=new Un({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),No=class ex{constructor(e){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=e}init(e={}){let{useBackBuffer:r,antialias:i}={...ex.defaultOptions,...e};this.useBackBuffer=r,this._antialias=i,this._renderer.context.supports.msaa||(Ye("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=Nr.for2d();let n=new mn({vertex:`
|
|
attribute vec2 aPosition;
|
|
out vec2 vUv;
|
|
|
|
void main() {
|
|
gl_Position = vec4(aPosition, 0.0, 1.0);
|
|
|
|
vUv = (aPosition + 1.0) / 2.0;
|
|
|
|
// flip dem UVs
|
|
vUv.y = 1.0 - vUv.y;
|
|
}`,fragment:`
|
|
in vec2 vUv;
|
|
out vec4 finalColor;
|
|
|
|
uniform sampler2D uTexture;
|
|
|
|
void main() {
|
|
finalColor = texture(uTexture, vUv);
|
|
}`,name:"big-triangle"});this._bigTriangleShader=new qr({glProgram:n,resources:{uTexture:Fe.WHITE.source}})}renderStart(e){let r=this._renderer.renderTarget.getRenderTarget(e.target);if(this._useBackBufferThisRender=this.useBackBuffer&&!!r.isRoot,this._useBackBufferThisRender){let i=this._renderer.renderTarget.getRenderTarget(e.target);this._targetTexture=i.colorTexture,e.target=this._getBackBufferTexture(i.colorTexture)}}renderEnd(){this._presentBackBuffer()}_presentBackBuffer(){let e=this._renderer;e.renderTarget.finishRenderPass(),this._useBackBufferThisRender&&(e.renderTarget.bind(this._targetTexture,!1),this._bigTriangleShader.resources.uTexture=this._backBufferTexture.source,e.encoder.draw({geometry:C_,shader:this._bigTriangleShader,state:this._state}))}_getBackBufferTexture(e){return this._backBufferTexture=this._backBufferTexture||new Fe({source:new Qt({width:e.width,height:e.height,resolution:e._resolution,antialias:this._antialias})}),this._backBufferTexture.source.resize(e.width,e.height,e._resolution),this._backBufferTexture}destroy(){this._backBufferTexture&&(this._backBufferTexture.destroy(),this._backBufferTexture=null)}},No.extension={type:[M.WebGLSystem],name:"backBuffer",priority:1},No.defaultOptions={useBackBuffer:!1},A_=No}),mc,gS=g(()=>{X(),mc=class{constructor(t){this._colorMaskCache=15,this._renderer=t}setMask(t){this._colorMaskCache!==t&&(this._colorMaskCache=t,this._renderer.gl.colorMask(!!(t&8),!!(t&4),!!(t&2),!!(t&1)))}},mc.extension={type:[M.WebGLSystem],name:"colorMask"}}),_c,mS=g(()=>{X(),_c=class{constructor(t){this.commandFinished=Promise.resolve(),this._renderer=t}setGeometry(t,e){this._renderer.geometry.bind(t,e.glProgram)}finishRenderPass(){}draw(t){let e=this._renderer,{geometry:r,shader:i,state:n,skipSync:s,topology:a,size:o,start:l,instanceCount:h}=t;e.shader.bind(i,s),e.geometry.bind(r,e.shader._activeProgram),n&&e.state.set(n),e.geometry.draw(a,o,l,h??r.instanceCount)}destroy(){this._renderer=null}},_c.extension={type:[M.WebGLSystem],name:"encoder"}}),vc,_S=g(()=>{X(),xf(),vc=class{constructor(t){this._renderer=t}contextChange(){let t=this._renderer.gl;this.maxTextures=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),this.maxBatchableTextures=vf(this.maxTextures,t),this.maxUniformBindings=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS)}destroy(){}},vc.extension={type:[M.WebGLSystem],name:"limits"}}),yc,vS=g(()=>{X(),a_(),Fn(),yc=class{constructor(t){this._stencilCache={enabled:!1,stencilReference:0,stencilMode:$t.NONE},this._renderTargetStencilState=Object.create(null),t.renderTarget.onRenderTargetChange.add(this)}contextChange(t){this._gl=t,this._comparisonFuncMapping={always:t.ALWAYS,never:t.NEVER,equal:t.EQUAL,"not-equal":t.NOTEQUAL,less:t.LESS,"less-equal":t.LEQUAL,greater:t.GREATER,"greater-equal":t.GEQUAL},this._stencilOpsMapping={keep:t.KEEP,zero:t.ZERO,replace:t.REPLACE,invert:t.INVERT,"increment-clamp":t.INCR,"decrement-clamp":t.DECR,"increment-wrap":t.INCR_WRAP,"decrement-wrap":t.DECR_WRAP},this.resetState()}onRenderTargetChange(t){if(this._activeRenderTarget===t)return;this._activeRenderTarget=t;let e=this._renderTargetStencilState[t.uid];e||(e=this._renderTargetStencilState[t.uid]={stencilMode:$t.DISABLED,stencilReference:0}),this.setStencilMode(e.stencilMode,e.stencilReference)}resetState(){this._stencilCache.enabled=!1,this._stencilCache.stencilMode=$t.NONE,this._stencilCache.stencilReference=0}setStencilMode(t,e){let r=this._renderTargetStencilState[this._activeRenderTarget.uid],i=this._gl,n=Bi[t],s=this._stencilCache;if(r.stencilMode=t,r.stencilReference=e,t===$t.DISABLED){this._stencilCache.enabled&&(this._stencilCache.enabled=!1,i.disable(i.STENCIL_TEST));return}this._stencilCache.enabled||(this._stencilCache.enabled=!0,i.enable(i.STENCIL_TEST)),(t!==s.stencilMode||s.stencilReference!==e)&&(s.stencilMode=t,s.stencilReference=e,i.stencilFunc(this._comparisonFuncMapping[n.stencilBack.compare],e,255),i.stencilOp(i.KEEP,i.KEEP,this._stencilOpsMapping[n.stencilBack.passOp]))}},yc.extension={type:[M.WebGLSystem],name:"stencil"}});function yS(t){let e=t.map(s=>({data:s,offset:0,size:0})),r=16,i=0,n=0;for(let s=0;s<e.length;s++){let a=e[s];if(i=xc[a.data.type],!i)throw new Error(`Unknown type ${a.data.type}`);a.data.size>1&&(i=Math.max(i,r)*a.data.size);let o=i===12?16:i;a.size=i;let l=n%r;l>0&&r-l<o?n+=(r-l)%16:n+=(i-l%i)%i,a.offset=n,n+=i}return n=Math.ceil(n/16)*16,{uboElements:e,size:n}}var xc,P_=g(()=>{"use strict";xc={f32:4,i32:4,"vec2<f32>":8,"vec3<f32>":12,"vec4<f32>":16,"vec2<i32>":8,"vec3<i32>":12,"vec4<i32>":16,"mat2x2<f32>":32,"mat3x3<f32>":48,"mat4x4<f32>":64}});function xS(t,e){let r=Math.max(xc[t.data.type]/16,1),i=t.data.value.length/t.data.size,n=(4-i%4)%4,s=t.data.type.indexOf("i32")>=0?"dataInt32":"data";return`
|
|
v = uv.${t.data.name};
|
|
offset += ${e};
|
|
|
|
arrayOffset = offset;
|
|
|
|
t = 0;
|
|
|
|
for(var i=0; i < ${t.data.size*r}; i++)
|
|
{
|
|
for(var j = 0; j < ${i}; j++)
|
|
{
|
|
${s}[arrayOffset++] = v[t++];
|
|
}
|
|
${n!==0?`arrayOffset += ${n};`:""}
|
|
}
|
|
`}var bS=g(()=>{P_()});function wS(t){return Jm(t,"uboStd40",xS,Yu)}var TS=g(()=>{e_(),r_(),bS()}),bc,SS=g(()=>{X(),Km(),P_(),TS(),bc=class extends Xu{constructor(){super({createUboElements:yS,generateUboSync:wS})}},bc.extension={type:[M.WebGLSystem],name:"ubo"}}),M_,ES=g(()=>{"use strict";M_=class{constructor(){this.width=-1,this.height=-1,this.msaa=!1,this.msaaRenderBuffer=[]}}}),R_,CS=g(()=>{O(),wt(),ms(),$s(),ES(),R_=class{constructor(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new R}init(t,e){this._renderer=t,this._renderTargetSystem=e,t.runners.contextChange.add(this)}contextChange(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new R}copyToTexture(t,e,r,i,n){let s=this._renderTargetSystem,a=this._renderer,o=s.getGpuRenderTarget(t),l=a.gl;return this.finishRenderPass(t),l.bindFramebuffer(l.FRAMEBUFFER,o.resolveTargetFramebuffer),a.texture.bind(e,0),l.copyTexSubImage2D(l.TEXTURE_2D,0,n.x,n.y,r.x,r.y,i.width,i.height),e}startRenderPass(t,e=!0,r,i){let n=this._renderTargetSystem,s=t.colorTexture,a=n.getGpuRenderTarget(t),o=i.y;t.isRoot&&(o=s.pixelHeight-i.height),t.colorTextures.forEach(u=>{this._renderer.texture.unbind(u)});let l=this._renderer.gl;l.bindFramebuffer(l.FRAMEBUFFER,a.framebuffer);let h=this._viewPortCache;(h.x!==i.x||h.y!==o||h.width!==i.width||h.height!==i.height)&&(h.x=i.x,h.y=o,h.width=i.width,h.height=i.height,l.viewport(i.x,o,i.width,i.height)),!a.depthStencilRenderBuffer&&(t.stencil||t.depth)&&this._initStencil(a),this.clear(t,e,r)}finishRenderPass(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);if(!e.msaa)return;let r=this._renderer.gl;r.bindFramebuffer(r.FRAMEBUFFER,e.resolveTargetFramebuffer),r.bindFramebuffer(r.READ_FRAMEBUFFER,e.framebuffer),r.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,r.COLOR_BUFFER_BIT,r.NEAREST),r.bindFramebuffer(r.FRAMEBUFFER,e.framebuffer)}initGpuRenderTarget(t){let e=this._renderer.gl,r=new M_;return t.colorTexture instanceof oi?(this._renderer.context.ensureCanvasSize(t.colorTexture.resource),r.framebuffer=null,r):(this._initColor(t,r),e.bindFramebuffer(e.FRAMEBUFFER,null),r)}destroyGpuRenderTarget(t){let e=this._renderer.gl;t.framebuffer&&(e.deleteFramebuffer(t.framebuffer),t.framebuffer=null),t.resolveTargetFramebuffer&&(e.deleteFramebuffer(t.resolveTargetFramebuffer),t.resolveTargetFramebuffer=null),t.depthStencilRenderBuffer&&(e.deleteRenderbuffer(t.depthStencilRenderBuffer),t.depthStencilRenderBuffer=null),t.msaaRenderBuffer.forEach(r=>{e.deleteRenderbuffer(r)}),t.msaaRenderBuffer=null}clear(t,e,r){if(!e)return;let i=this._renderTargetSystem;typeof e=="boolean"&&(e=e?Tr.ALL:Tr.NONE);let n=this._renderer.gl;if(e&Tr.COLOR){r??(r=i.defaultClearColor);let s=this._clearColorCache,a=r;(s[0]!==a[0]||s[1]!==a[1]||s[2]!==a[2]||s[3]!==a[3])&&(s[0]=a[0],s[1]=a[1],s[2]=a[2],s[3]=a[3],n.clearColor(a[0],a[1],a[2],a[3]))}n.clear(e)}resizeGpuRenderTarget(t){if(t.isRoot)return;let e=this._renderTargetSystem.getGpuRenderTarget(t);this._resizeColor(t,e),(t.stencil||t.depth)&&this._resizeStencil(e)}_initColor(t,e){let r=this._renderer,i=r.gl,n=i.createFramebuffer();if(e.resolveTargetFramebuffer=n,i.bindFramebuffer(i.FRAMEBUFFER,n),e.width=t.colorTexture.source.pixelWidth,e.height=t.colorTexture.source.pixelHeight,t.colorTextures.forEach((s,a)=>{let o=s.source;o.antialias&&(r.context.supports.msaa?e.msaa=!0:Ye("[RenderTexture] Antialiasing on textures is not supported in WebGL1")),r.texture.bindSource(o,0);let l=r.texture.getGlSource(o).texture;i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+a,3553,l,0)}),e.msaa){let s=i.createFramebuffer();e.framebuffer=s,i.bindFramebuffer(i.FRAMEBUFFER,s),t.colorTextures.forEach((a,o)=>{let l=i.createRenderbuffer();e.msaaRenderBuffer[o]=l})}else e.framebuffer=n;this._resizeColor(t,e)}_resizeColor(t,e){let r=t.colorTexture.source;if(e.width=r.pixelWidth,e.height=r.pixelHeight,t.colorTextures.forEach((i,n)=>{n!==0&&i.source.resize(r.width,r.height,r._resolution)}),e.msaa){let i=this._renderer,n=i.gl,s=e.framebuffer;n.bindFramebuffer(n.FRAMEBUFFER,s),t.colorTextures.forEach((a,o)=>{let l=a.source;i.texture.bindSource(l,0);let h=i.texture.getGlSource(l).internalFormat,u=e.msaaRenderBuffer[o];n.bindRenderbuffer(n.RENDERBUFFER,u),n.renderbufferStorageMultisample(n.RENDERBUFFER,4,h,l.pixelWidth,l.pixelHeight),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+o,n.RENDERBUFFER,u)})}}_initStencil(t){if(t.framebuffer===null)return;let e=this._renderer.gl,r=e.createRenderbuffer();t.depthStencilRenderBuffer=r,e.bindRenderbuffer(e.RENDERBUFFER,r),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,r),this._resizeStencil(t)}_resizeStencil(t){let e=this._renderer.gl;e.bindRenderbuffer(e.RENDERBUFFER,t.depthStencilRenderBuffer),t.msaa?e.renderbufferStorageMultisample(e.RENDERBUFFER,4,e.DEPTH24_STENCIL8,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,this._renderer.context.webGLVersion===2?e.DEPTH24_STENCIL8:e.DEPTH_STENCIL,t.width,t.height)}prerender(t){let e=t.colorTexture.resource;this._renderer.context.multiView&&oi.test(e)&&this._renderer.context.ensureCanvasSize(e)}postrender(t){if(this._renderer.context.multiView&&oi.test(t.colorTexture.resource)){let e=this._renderer.context.canvas,r=t.colorTexture;r.context2D.drawImage(e,0,r.pixelHeight-e.height)}}}}),wc,AS=g(()=>{X(),l_(),CS(),wc=class extends Ju{constructor(t){super(t),this.adaptor=new R_,this.adaptor.init(t,this)}},wc.extension={type:[M.WebGLSystem],name:"renderTarget"}});function PS(t,e){let r=[],i=[`
|
|
var g = s.groups;
|
|
var sS = r.shader;
|
|
var p = s.glProgram;
|
|
var ugS = r.uniformGroup;
|
|
var resources;
|
|
`],n=!1,s=0,a=e._getProgramData(t.glProgram);for(let l in t.groups){let h=t.groups[l];r.push(`
|
|
resources = g[${l}].resources;
|
|
`);for(let u in h.resources){let c=h.resources[u];if(c instanceof dr)if(c.ubo){let f=t._uniformBindMap[l][Number(u)];r.push(`
|
|
sS.bindUniformBlock(
|
|
resources[${u}],
|
|
'${f}',
|
|
${t.glProgram._uniformBlockData[f].index}
|
|
);
|
|
`)}else r.push(`
|
|
ugS.updateUniformGroup(resources[${u}], p, sD);
|
|
`);else if(c instanceof Do){let f=t._uniformBindMap[l][Number(u)];r.push(`
|
|
sS.bindUniformBlock(
|
|
resources[${u}],
|
|
'${f}',
|
|
${t.glProgram._uniformBlockData[f].index}
|
|
);
|
|
`)}else if(c instanceof Qt){let f=t._uniformBindMap[l][u],d=a.uniformData[f];d&&(n||(n=!0,i.push(`
|
|
var tS = r.texture;
|
|
`)),e._gl.uniform1i(d.location,s),r.push(`
|
|
tS.bind(resources[${u}], ${s});
|
|
`),s++)}}}let o=[...i,...r].join(`
|
|
`);return new Function("r","s","sD",o)}var MS=g(()=>{Ku(),wr(),xr()}),k_,RS=g(()=>{"use strict";k_=class{constructor(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBlockBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBlockBindings=null,this.program=null}}});function B_(t,e,r){let i=t.createShader(e);return t.shaderSource(i,r),t.compileShader(i),i}var kS=g(()=>{"use strict"});function Tc(t){let e=new Array(t);for(let r=0;r<e.length;r++)e[r]=!1;return e}function G_(t,e){switch(t){case"float":return 0;case"vec2":return new Float32Array(2*e);case"vec3":return new Float32Array(3*e);case"vec4":return new Float32Array(4*e);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*e);case"ivec3":return new Int32Array(3*e);case"ivec4":return new Int32Array(4*e);case"uvec2":return new Uint32Array(2*e);case"uvec3":return new Uint32Array(3*e);case"uvec4":return new Uint32Array(4*e);case"bool":return!1;case"bvec2":return Tc(2*e);case"bvec3":return Tc(3*e);case"bvec4":return Tc(4*e);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var I_=g(()=>{"use strict"});function O_(t,e){if(!Qs){let r=Object.keys(Sc);Qs={};for(let i=0;i<r.length;++i){let n=r[i];Qs[t[n]]=Sc[n]}}return Qs[e]}function BS(t,e){let r=O_(t,e);return F_[r]||"float32"}var Qs,Sc,F_,D_=g(()=>{"use strict";Qs=null,Sc={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"},F_={float:"float32",vec2:"float32x2",vec3:"float32x3",vec4:"float32x4",int:"sint32",ivec2:"sint32x2",ivec3:"sint32x3",ivec4:"sint32x4",uint:"uint32",uvec2:"uint32x2",uvec3:"uint32x3",uvec4:"uint32x4",bool:"uint32",bvec2:"uint32x2",bvec3:"uint32x3",bvec4:"uint32x4"}});function GS(t,e,r=!1){let i={},n=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let a=0;a<n;a++){let o=e.getActiveAttrib(t,a);if(o.name.startsWith("gl_"))continue;let l=BS(e,o.type);i[o.name]={location:0,format:l,stride:Yi(l).stride,offset:0,instance:!1,start:0}}let s=Object.keys(i);if(r){s.sort((a,o)=>a>o?1:-1);for(let a=0;a<s.length;a++)i[s[a]].location=a,e.bindAttribLocation(t,a,s[a]);e.linkProgram(t)}else for(let a=0;a<s.length;a++)i[s[a]].location=e.getAttribLocation(t,s[a]);return i}var IS=g(()=>{Nn(),D_()});function OS(t,e){if(!e.ACTIVE_UNIFORM_BLOCKS)return{};let r={},i=e.getProgramParameter(t,e.ACTIVE_UNIFORM_BLOCKS);for(let n=0;n<i;n++){let s=e.getActiveUniformBlockName(t,n),a=e.getUniformBlockIndex(t,s),o=e.getActiveUniformBlockParameter(t,n,e.UNIFORM_BLOCK_DATA_SIZE);r[s]={name:s,index:a,size:o}}return r}var FS=g(()=>{"use strict"});function DS(t,e){let r={},i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let n=0;n<i;n++){let s=e.getActiveUniform(t,n),a=s.name.replace(/\[.*?\]$/,""),o=!!s.name.match(/\[.*?\]$/),l=O_(e,s.type);r[a]={name:a,index:n,type:l,size:s.size,isArray:o,value:G_(l,s.size)}}return r}var US=g(()=>{I_(),D_()});function U_(t,e){let r=t.getShaderSource(e).split(`
|
|
`).map((h,u)=>`${u}: ${h}`),i=t.getShaderInfoLog(e),n=i.split(`
|
|
`),s={},a=n.map(h=>parseFloat(h.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(h=>h&&!s[h]?(s[h]=!0,!0):!1),o=[""];a.forEach(h=>{r[h-1]=`%c${r[h-1]}%c`,o.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});let l=r.join(`
|
|
`);o[0]=l,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...o),console.groupEnd()}function LS(t,e,r,i){t.getProgramParameter(e,t.LINK_STATUS)||(t.getShaderParameter(r,t.COMPILE_STATUS)||U_(t,r),t.getShaderParameter(i,t.COMPILE_STATUS)||U_(t,i),console.error("PixiJS Error: Could not initialize shader."),t.getProgramInfoLog(e)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",t.getProgramInfoLog(e)))}var NS=g(()=>{"use strict"});function zS(t,e){let r=B_(t,t.VERTEX_SHADER,e.vertex),i=B_(t,t.FRAGMENT_SHADER,e.fragment),n=t.createProgram();t.attachShader(n,r),t.attachShader(n,i);let s=e.transformFeedbackVaryings;s&&(typeof t.transformFeedbackVaryings!="function"?Ye("TransformFeedback is not supported but TransformFeedbackVaryings are given."):t.transformFeedbackVaryings(n,s.names,s.bufferMode==="separate"?t.SEPARATE_ATTRIBS:t.INTERLEAVED_ATTRIBS)),t.linkProgram(n),t.getProgramParameter(n,t.LINK_STATUS)||LS(t,n,r,i),e._attributeData=GS(n,t,!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(e.vertex)),e._uniformData=DS(n,t),e._uniformBlockData=OS(n,t),t.deleteShader(r),t.deleteShader(i);let a={};for(let o in e._uniformData){let l=e._uniformData[o];a[o]={location:t.getUniformLocation(n,o),value:G_(l.type,l.size)}}return new k_(n,a)}var HS=g(()=>{wt(),RS(),kS(),I_(),IS(),FS(),US(),NS()}),Js,Ec,VS=g(()=>{X(),MS(),HS(),Js={textureCount:0,blockIndex:0},Ec=class{constructor(t){this._activeProgram=null,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_programDataHash")}contextChange(t){this._gl=t,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._activeProgram=null}bind(t,e){if(this._setProgram(t.glProgram),e)return;Js.textureCount=0,Js.blockIndex=0;let r=this._shaderSyncFunctions[t.glProgram._key];r||(r=this._shaderSyncFunctions[t.glProgram._key]=this._generateShaderSync(t,this)),this._renderer.buffer.nextBindBase(!!t.glProgram.transformFeedbackVaryings),r(this._renderer,t,Js)}updateUniformGroup(t){this._renderer.uniformGroup.updateUniformGroup(t,this._activeProgram,Js)}bindUniformBlock(t,e,r=0){let i=this._renderer.buffer,n=this._getProgramData(this._activeProgram),s=t._bufferResource;s||this._renderer.ubo.updateUniformGroup(t);let a=t.buffer,o=i.updateBuffer(a),l=i.freeLocationForBufferBase(o);if(s){let{offset:u,size:c}=t;u===0&&c===a.data.byteLength?i.bindBufferBase(o,l):i.bindBufferRange(o,l,u)}else i.getLastBindBaseLocation(o)!==l&&i.bindBufferBase(o,l);let h=this._activeProgram._uniformBlockData[e].index;n.uniformBlockBindings[r]!==l&&(n.uniformBlockBindings[r]=l,this._renderer.gl.uniformBlockBinding(n.program,h,l))}_setProgram(t){if(this._activeProgram===t)return;this._activeProgram=t;let e=this._getProgramData(t);this._gl.useProgram(e.program)}_getProgramData(t){return this._programDataHash[t._key]||this._createProgramData(t)}_createProgramData(t){let e=t._key;return this._programDataHash[e]=zS(this._gl,t),this._programDataHash[e]}destroy(){for(let t of Object.keys(this._programDataHash))this._programDataHash[t].destroy(),this._programDataHash[t]=null;this._programDataHash=null}_generateShaderSync(t,e){return PS(t,e)}resetState(){this._activeProgram=null}},Ec.extension={type:[M.WebGLSystem],name:"shader"}}),L_,N_,jS=g(()=>{"use strict";L_={f32:`if (cv !== v) {
|
|
cu.value = v;
|
|
gl.uniform1f(location, v);
|
|
}`,"vec2<f32>":`if (cv[0] !== v[0] || cv[1] !== v[1]) {
|
|
cv[0] = v[0];
|
|
cv[1] = v[1];
|
|
gl.uniform2f(location, v[0], v[1]);
|
|
}`,"vec3<f32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
|
|
cv[0] = v[0];
|
|
cv[1] = v[1];
|
|
cv[2] = v[2];
|
|
gl.uniform3f(location, v[0], v[1], v[2]);
|
|
}`,"vec4<f32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
|
|
cv[0] = v[0];
|
|
cv[1] = v[1];
|
|
cv[2] = v[2];
|
|
cv[3] = v[3];
|
|
gl.uniform4f(location, v[0], v[1], v[2], v[3]);
|
|
}`,i32:`if (cv !== v) {
|
|
cu.value = v;
|
|
gl.uniform1i(location, v);
|
|
}`,"vec2<i32>":`if (cv[0] !== v[0] || cv[1] !== v[1]) {
|
|
cv[0] = v[0];
|
|
cv[1] = v[1];
|
|
gl.uniform2i(location, v[0], v[1]);
|
|
}`,"vec3<i32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
|
|
cv[0] = v[0];
|
|
cv[1] = v[1];
|
|
cv[2] = v[2];
|
|
gl.uniform3i(location, v[0], v[1], v[2]);
|
|
}`,"vec4<i32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
|
|
cv[0] = v[0];
|
|
cv[1] = v[1];
|
|
cv[2] = v[2];
|
|
cv[3] = v[3];
|
|
gl.uniform4i(location, v[0], v[1], v[2], v[3]);
|
|
}`,u32:`if (cv !== v) {
|
|
cu.value = v;
|
|
gl.uniform1ui(location, v);
|
|
}`,"vec2<u32>":`if (cv[0] !== v[0] || cv[1] !== v[1]) {
|
|
cv[0] = v[0];
|
|
cv[1] = v[1];
|
|
gl.uniform2ui(location, v[0], v[1]);
|
|
}`,"vec3<u32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
|
|
cv[0] = v[0];
|
|
cv[1] = v[1];
|
|
cv[2] = v[2];
|
|
gl.uniform3ui(location, v[0], v[1], v[2]);
|
|
}`,"vec4<u32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
|
|
cv[0] = v[0];
|
|
cv[1] = v[1];
|
|
cv[2] = v[2];
|
|
cv[3] = v[3];
|
|
gl.uniform4ui(location, v[0], v[1], v[2], v[3]);
|
|
}`,bool:`if (cv !== v) {
|
|
cu.value = v;
|
|
gl.uniform1i(location, v);
|
|
}`,"vec2<bool>":`if (cv[0] !== v[0] || cv[1] !== v[1]) {
|
|
cv[0] = v[0];
|
|
cv[1] = v[1];
|
|
gl.uniform2i(location, v[0], v[1]);
|
|
}`,"vec3<bool>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
|
|
cv[0] = v[0];
|
|
cv[1] = v[1];
|
|
cv[2] = v[2];
|
|
gl.uniform3i(location, v[0], v[1], v[2]);
|
|
}`,"vec4<bool>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
|
|
cv[0] = v[0];
|
|
cv[1] = v[1];
|
|
cv[2] = v[2];
|
|
cv[3] = v[3];
|
|
gl.uniform4i(location, v[0], v[1], v[2], v[3]);
|
|
}`,"mat2x2<f32>":"gl.uniformMatrix2fv(location, false, v);","mat3x3<f32>":"gl.uniformMatrix3fv(location, false, v);","mat4x4<f32>":"gl.uniformMatrix4fv(location, false, v);"},N_={f32:"gl.uniform1fv(location, v);","vec2<f32>":"gl.uniform2fv(location, v);","vec3<f32>":"gl.uniform3fv(location, v);","vec4<f32>":"gl.uniform4fv(location, v);","mat2x2<f32>":"gl.uniformMatrix2fv(location, false, v);","mat3x3<f32>":"gl.uniformMatrix3fv(location, false, v);","mat4x4<f32>":"gl.uniformMatrix4fv(location, false, v);",i32:"gl.uniform1iv(location, v);","vec2<i32>":"gl.uniform2iv(location, v);","vec3<i32>":"gl.uniform3iv(location, v);","vec4<i32>":"gl.uniform4iv(location, v);",u32:"gl.uniform1iv(location, v);","vec2<u32>":"gl.uniform2iv(location, v);","vec3<u32>":"gl.uniform3iv(location, v);","vec4<u32>":"gl.uniform4iv(location, v);",bool:"gl.uniform1iv(location, v);","vec2<bool>":"gl.uniform2iv(location, v);","vec3<bool>":"gl.uniform3iv(location, v);","vec4<bool>":"gl.uniform4iv(location, v);"}});function WS(t,e){let r=[`
|
|
var v = null;
|
|
var cv = null;
|
|
var cu = null;
|
|
var t = 0;
|
|
var gl = renderer.gl;
|
|
var name = null;
|
|
`];for(let i in t.uniforms){if(!e[i]){t.uniforms[i]instanceof dr?t.uniforms[i].ubo?r.push(`
|
|
renderer.shader.bindUniformBlock(uv.${i}, "${i}");
|
|
`):r.push(`
|
|
renderer.shader.updateUniformGroup(uv.${i});
|
|
`):t.uniforms[i]instanceof Do&&r.push(`
|
|
renderer.shader.bindBufferResource(uv.${i}, "${i}");
|
|
`);continue}let n=t.uniformStructures[i],s=!1;for(let a=0;a<Qi.length;a++){let o=Qi[a];if(n.type===o.type&&o.test(n)){r.push(`name = "${i}";`,Qi[a].uniform),s=!0;break}}if(!s){let a=(n.size===1?L_:N_)[n.type].replace("location",`ud["${i}"].location`);r.push(`
|
|
cu = ud["${i}"];
|
|
cv = cu.value;
|
|
v = uv["${i}"];
|
|
${a};`)}}return new Function("ud","uv","renderer","syncData",r.join(`
|
|
`))}var $S=g(()=>{Ku(),wr(),Qm(),jS()}),Cc,XS=g(()=>{X(),$S(),Cc=class{constructor(t){this._cache={},this._uniformGroupSyncHash={},this._renderer=t,this.gl=null,this._cache={}}contextChange(t){this.gl=t}updateUniformGroup(t,e,r){let i=this._renderer.shader._getProgramData(e);(!t.isStatic||t._dirtyId!==i.uniformDirtyGroups[t.uid])&&(i.uniformDirtyGroups[t.uid]=t._dirtyId,this._getUniformSyncFunction(t,e)(i.uniformData,t.uniforms,this._renderer,r))}_getUniformSyncFunction(t,e){return this._uniformGroupSyncHash[t._signature]?.[e._key]||this._createUniformSyncFunction(t,e)}_createUniformSyncFunction(t,e){let r=this._uniformGroupSyncHash[t._signature]||(this._uniformGroupSyncHash[t._signature]={}),i=this._getSignature(t,e._uniformData,"u");return this._cache[i]||(this._cache[i]=this._generateUniformsSync(t,e._uniformData)),r[e._key]=this._cache[i],r[e._key]}_generateUniformsSync(t,e){return WS(t,e)}_getSignature(t,e,r){let i=t.uniforms,n=[`${r}-`];for(let s in i)n.push(s),e[s]&&n.push(e[s].type);return n.join("-")}destroy(){this._renderer=null,this._cache=null}},Cc.extension={type:[M.WebGLSystem],name:"uniformGroup"}});function YS(t){let e={};if(e.normal=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.add=[t.ONE,t.ONE],e.multiply=[t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e.screen=[t.ONE,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_ALPHA],e.none=[0,0],e["normal-npm"]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e["add-npm"]=[t.SRC_ALPHA,t.ONE,t.ONE,t.ONE],e["screen-npm"]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_ALPHA],e.erase=[t.ZERO,t.ONE_MINUS_SRC_ALPHA],!(t instanceof Dt.get().getWebGLRenderingContext()))e.min=[t.ONE,t.ONE,t.ONE,t.ONE,t.MIN,t.MIN],e.max=[t.ONE,t.ONE,t.ONE,t.ONE,t.MAX,t.MAX];else{let r=t.getExtension("EXT_blend_minmax");r&&(e.min=[t.ONE,t.ONE,t.ONE,t.ONE,r.MIN_EXT,r.MIN_EXT],e.max=[t.ONE,t.ONE,t.ONE,t.ONE,r.MAX_EXT,r.MAX_EXT])}return e}var qS=g(()=>{Jt()}),z_,H_,V_,j_,W_,$_,Ac,X_,KS=g(()=>{X(),ci(),qS(),z_=0,H_=1,V_=2,j_=3,W_=4,$_=5,Ac=class gd{constructor(e){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[z_]=this.setBlend,this.map[H_]=this.setOffset,this.map[V_]=this.setCullFace,this.map[j_]=this.setDepthTest,this.map[W_]=this.setFrontFace,this.map[$_]=this.setDepthMask,this.checks=[],this.defaultState=Nr.for2d(),e.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(e){this._invertFrontFace=!e.isRoot,this._cullFace?this.setFrontFace(this._frontFace):this._frontFaceDirty=!0}contextChange(e){this.gl=e,this.blendModesMap=YS(e),this.resetState()}set(e){if(e||(e=this.defaultState),this.stateId!==e.data){let r=this.stateId^e.data,i=0;for(;r;)r&1&&this.map[i].call(this,!!(e.data&1<<i)),r>>=1,i++;this.stateId=e.data}for(let r=0;r<this.checks.length;r++)this.checks[r](this,e)}forceState(e){e||(e=this.defaultState);for(let r=0;r<this.map.length;r++)this.map[r].call(this,!!(e.data&1<<r));for(let r=0;r<this.checks.length;r++)this.checks[r](this,e);this.stateId=e.data}setBlend(e){this._updateCheck(gd._checkBlendMode,e),this.gl[e?"enable":"disable"](this.gl.BLEND)}setOffset(e){this._updateCheck(gd._checkPolygonOffset,e),this.gl[e?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(e){this.gl[e?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(e){this.gl.depthMask(e)}setCullFace(e){this._cullFace=e,this.gl[e?"enable":"disable"](this.gl.CULL_FACE),this._cullFace&&this._frontFaceDirty&&this.setFrontFace(this._frontFace)}setFrontFace(e){this._frontFace=e,this._frontFaceDirty=!1;let r=this._invertFrontFace?!e:e;this._glFrontFace!==r&&(this._glFrontFace=r,this.gl.frontFace(this.gl[r?"CW":"CCW"]))}setBlendMode(e){if(this.blendModesMap[e]||(e="normal"),e===this.blendMode)return;this.blendMode=e;let r=this.blendModesMap[e],i=this.gl;r.length===2?i.blendFunc(r[0],r[1]):i.blendFuncSeparate(r[0],r[1],r[2],r[3]),r.length===6?(this._blendEq=!0,i.blendEquationSeparate(r[4],r[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}setPolygonOffset(e,r){this.gl.polygonOffset(e,r)}resetState(){this._glFrontFace=!1,this._frontFace=!1,this._cullFace=!1,this._frontFaceDirty=!1,this._invertFrontFace=!1,this.gl.frontFace(this.gl.CCW),this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode="",this.setBlendMode("normal")}_updateCheck(e,r){let i=this.checks.indexOf(e);r&&i===-1?this.checks.push(e):!r&&i!==-1&&this.checks.splice(i,1)}static _checkBlendMode(e,r){e.setBlendMode(r.blendMode)}static _checkPolygonOffset(e,r){e.setPolygonOffset(1,r.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}},Ac.extension={type:[M.WebGLSystem],name:"state"},X_=Ac}),Y_,ZS=g(()=>{S_(),Y_=class{constructor(t){this.target=fc.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=mt.UNSIGNED_BYTE,this.internalFormat=Lo.RGBA,this.format=Lo.RGBA,this.samplerType=0}}}),q_,QS=g(()=>{"use strict";q_={id:"buffer",upload(t,e,r){e.width===t.width||e.height===t.height?r.texSubImage2D(r.TEXTURE_2D,0,0,0,t.width,t.height,e.format,e.type,t.resource):r.texImage2D(e.target,0,e.internalFormat,t.width,t.height,0,e.format,e.type,t.resource),e.width=t.width,e.height=t.height}}}),K_,Z_,JS=g(()=>{"use strict";K_={"bc1-rgba-unorm":!0,"bc1-rgba-unorm-srgb":!0,"bc2-rgba-unorm":!0,"bc2-rgba-unorm-srgb":!0,"bc3-rgba-unorm":!0,"bc3-rgba-unorm-srgb":!0,"bc4-r-unorm":!0,"bc4-r-snorm":!0,"bc5-rg-unorm":!0,"bc5-rg-snorm":!0,"bc6h-rgb-ufloat":!0,"bc6h-rgb-float":!0,"bc7-rgba-unorm":!0,"bc7-rgba-unorm-srgb":!0,"etc2-rgb8unorm":!0,"etc2-rgb8unorm-srgb":!0,"etc2-rgb8a1unorm":!0,"etc2-rgb8a1unorm-srgb":!0,"etc2-rgba8unorm":!0,"etc2-rgba8unorm-srgb":!0,"eac-r11unorm":!0,"eac-r11snorm":!0,"eac-rg11unorm":!0,"eac-rg11snorm":!0,"astc-4x4-unorm":!0,"astc-4x4-unorm-srgb":!0,"astc-5x4-unorm":!0,"astc-5x4-unorm-srgb":!0,"astc-5x5-unorm":!0,"astc-5x5-unorm-srgb":!0,"astc-6x5-unorm":!0,"astc-6x5-unorm-srgb":!0,"astc-6x6-unorm":!0,"astc-6x6-unorm-srgb":!0,"astc-8x5-unorm":!0,"astc-8x5-unorm-srgb":!0,"astc-8x6-unorm":!0,"astc-8x6-unorm-srgb":!0,"astc-8x8-unorm":!0,"astc-8x8-unorm-srgb":!0,"astc-10x5-unorm":!0,"astc-10x5-unorm-srgb":!0,"astc-10x6-unorm":!0,"astc-10x6-unorm-srgb":!0,"astc-10x8-unorm":!0,"astc-10x8-unorm-srgb":!0,"astc-10x10-unorm":!0,"astc-10x10-unorm-srgb":!0,"astc-12x10-unorm":!0,"astc-12x10-unorm-srgb":!0,"astc-12x12-unorm":!0,"astc-12x12-unorm-srgb":!0},Z_={id:"compressed",upload(t,e,r){r.pixelStorei(r.UNPACK_ALIGNMENT,4);let i=t.pixelWidth,n=t.pixelHeight,s=!!K_[t.format];for(let a=0;a<t.resource.length;a++){let o=t.resource[a];s?r.compressedTexImage2D(r.TEXTURE_2D,a,e.internalFormat,i,n,0,o):r.texImage2D(r.TEXTURE_2D,a,e.internalFormat,i,n,0,e.format,e.type,o),i=Math.max(i>>1,1),n=Math.max(n>>1,1)}}}}),Pc,Q_=g(()=>{"use strict";Pc={id:"image",upload(t,e,r,i){let n=e.width,s=e.height,a=t.pixelWidth,o=t.pixelHeight,l=t.resourceWidth,h=t.resourceHeight;l<a||h<o?((n!==a||s!==o)&&r.texImage2D(e.target,0,e.internalFormat,a,o,0,e.format,e.type,null),i===2?r.texSubImage2D(r.TEXTURE_2D,0,0,0,l,h,e.format,e.type,t.resource):r.texSubImage2D(r.TEXTURE_2D,0,0,0,e.format,e.type,t.resource)):n===a&&s===o?r.texSubImage2D(r.TEXTURE_2D,0,0,0,e.format,e.type,t.resource):i===2?r.texImage2D(e.target,0,e.internalFormat,a,o,0,e.format,e.type,t.resource):r.texImage2D(e.target,0,e.internalFormat,e.format,e.type,t.resource),e.width=a,e.height=o}}}),J_,eE=g(()=>{Q_(),J_={id:"video",upload(t,e,r,i){if(!t.isValid){r.texImage2D(e.target,0,e.internalFormat,1,1,0,e.format,e.type,null);return}Pc.upload(t,e,r,i)}}}),Mc,ev,zo,tv,tE=g(()=>{"use strict";Mc={linear:9729,nearest:9728},ev={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},zo={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},tv={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function rv(t,e,r,i,n,s,a,o){let l=s;if(!o||t.addressModeU!=="repeat"||t.addressModeV!=="repeat"||t.addressModeW!=="repeat"){let h=zo[a?"clamp-to-edge":t.addressModeU],u=zo[a?"clamp-to-edge":t.addressModeV],c=zo[a?"clamp-to-edge":t.addressModeW];e[n](l,e.TEXTURE_WRAP_S,h),e[n](l,e.TEXTURE_WRAP_T,u),e.TEXTURE_WRAP_R&&e[n](l,e.TEXTURE_WRAP_R,c)}if((!o||t.magFilter!=="linear")&&e[n](l,e.TEXTURE_MAG_FILTER,Mc[t.magFilter]),r){if(!o||t.mipmapFilter!=="linear"){let h=ev[t.minFilter][t.mipmapFilter];e[n](l,e.TEXTURE_MIN_FILTER,h)}}else e[n](l,e.TEXTURE_MIN_FILTER,Mc[t.minFilter]);if(i&&t.maxAnisotropy>1){let h=Math.min(t.maxAnisotropy,e.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT));e[n](l,i.TEXTURE_MAX_ANISOTROPY_EXT,h)}t.compare&&e[n](l,e.TEXTURE_COMPARE_FUNC,tv[t.compare])}var rE=g(()=>{tE()});function iE(t){return{r8unorm:t.RED,r8snorm:t.RED,r8uint:t.RED,r8sint:t.RED,r16uint:t.RED,r16sint:t.RED,r16float:t.RED,rg8unorm:t.RG,rg8snorm:t.RG,rg8uint:t.RG,rg8sint:t.RG,r32uint:t.RED,r32sint:t.RED,r32float:t.RED,rg16uint:t.RG,rg16sint:t.RG,rg16float:t.RG,rgba8unorm:t.RGBA,"rgba8unorm-srgb":t.RGBA,rgba8snorm:t.RGBA,rgba8uint:t.RGBA,rgba8sint:t.RGBA,bgra8unorm:t.RGBA,"bgra8unorm-srgb":t.RGBA,rgb9e5ufloat:t.RGB,rgb10a2unorm:t.RGBA,rg11b10ufloat:t.RGB,rg32uint:t.RG,rg32sint:t.RG,rg32float:t.RG,rgba16uint:t.RGBA,rgba16sint:t.RGBA,rgba16float:t.RGBA,rgba32uint:t.RGBA,rgba32sint:t.RGBA,rgba32float:t.RGBA,stencil8:t.STENCIL_INDEX8,depth16unorm:t.DEPTH_COMPONENT,depth24plus:t.DEPTH_COMPONENT,"depth24plus-stencil8":t.DEPTH_STENCIL,depth32float:t.DEPTH_COMPONENT,"depth32float-stencil8":t.DEPTH_STENCIL}}var nE=g(()=>{"use strict"});function sE(t,e){let r={},i=t.RGBA;return t instanceof Dt.get().getWebGLRenderingContext()?e.srgb&&(r={"rgba8unorm-srgb":e.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":e.srgb.SRGB8_ALPHA8_EXT}):(r={"rgba8unorm-srgb":t.SRGB8_ALPHA8,"bgra8unorm-srgb":t.SRGB8_ALPHA8},i=t.RGBA8),{r8unorm:t.R8,r8snorm:t.R8_SNORM,r8uint:t.R8UI,r8sint:t.R8I,r16uint:t.R16UI,r16sint:t.R16I,r16float:t.R16F,rg8unorm:t.RG8,rg8snorm:t.RG8_SNORM,rg8uint:t.RG8UI,rg8sint:t.RG8I,r32uint:t.R32UI,r32sint:t.R32I,r32float:t.R32F,rg16uint:t.RG16UI,rg16sint:t.RG16I,rg16float:t.RG16F,rgba8unorm:t.RGBA,...r,rgba8snorm:t.RGBA8_SNORM,rgba8uint:t.RGBA8UI,rgba8sint:t.RGBA8I,bgra8unorm:i,rgb9e5ufloat:t.RGB9_E5,rgb10a2unorm:t.RGB10_A2,rg11b10ufloat:t.R11F_G11F_B10F,rg32uint:t.RG32UI,rg32sint:t.RG32I,rg32float:t.RG32F,rgba16uint:t.RGBA16UI,rgba16sint:t.RGBA16I,rgba16float:t.RGBA16F,rgba32uint:t.RGBA32UI,rgba32sint:t.RGBA32I,rgba32float:t.RGBA32F,stencil8:t.STENCIL_INDEX8,depth16unorm:t.DEPTH_COMPONENT16,depth24plus:t.DEPTH_COMPONENT24,"depth24plus-stencil8":t.DEPTH24_STENCIL8,depth32float:t.DEPTH_COMPONENT32F,"depth32float-stencil8":t.DEPTH32F_STENCIL8,...e.s3tc?{"bc1-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{},...e.s3tc_sRGB?{"bc1-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{},...e.rgtc?{"bc4-r-unorm":e.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":e.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":e.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":e.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{},...e.bptc?{"bc6h-rgb-float":e.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":e.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":e.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":e.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{},...e.etc?{"etc2-rgb8unorm":e.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":e.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":e.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":e.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":e.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":e.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":e.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":e.etc.COMPRESSED_SIGNED_RG11_EAC}:{},...e.astc?{"astc-4x4-unorm":e.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":e.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":e.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":e.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{}}}var aE=g(()=>{Jt()});function oE(t){return{r8unorm:t.UNSIGNED_BYTE,r8snorm:t.BYTE,r8uint:t.UNSIGNED_BYTE,r8sint:t.BYTE,r16uint:t.UNSIGNED_SHORT,r16sint:t.SHORT,r16float:t.HALF_FLOAT,rg8unorm:t.UNSIGNED_BYTE,rg8snorm:t.BYTE,rg8uint:t.UNSIGNED_BYTE,rg8sint:t.BYTE,r32uint:t.UNSIGNED_INT,r32sint:t.INT,r32float:t.FLOAT,rg16uint:t.UNSIGNED_SHORT,rg16sint:t.SHORT,rg16float:t.HALF_FLOAT,rgba8unorm:t.UNSIGNED_BYTE,"rgba8unorm-srgb":t.UNSIGNED_BYTE,rgba8snorm:t.BYTE,rgba8uint:t.UNSIGNED_BYTE,rgba8sint:t.BYTE,bgra8unorm:t.UNSIGNED_BYTE,"bgra8unorm-srgb":t.UNSIGNED_BYTE,rgb9e5ufloat:t.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:t.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:t.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:t.UNSIGNED_INT,rg32sint:t.INT,rg32float:t.FLOAT,rgba16uint:t.UNSIGNED_SHORT,rgba16sint:t.SHORT,rgba16float:t.HALF_FLOAT,rgba32uint:t.UNSIGNED_INT,rgba32sint:t.INT,rgba32float:t.FLOAT,stencil8:t.UNSIGNED_BYTE,depth16unorm:t.UNSIGNED_SHORT,depth24plus:t.UNSIGNED_INT,"depth24plus-stencil8":t.UNSIGNED_INT_24_8,depth32float:t.FLOAT,"depth32float-stencil8":t.FLOAT_32_UNSIGNED_INT_24_8_REV}}var lE=g(()=>{"use strict"}),iv,Rc,hE=g(()=>{Jt(),X(),Ft(),ZS(),QS(),JS(),Q_(),eE(),rE(),nE(),aE(),lE(),iv=4,Rc=class{constructor(t){this.managedTextures=[],this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._uploads={image:Pc,buffer:q_,video:J_,compressed:Z_},this._premultiplyAlpha=!1,this._useSeparateSamplers=!1,this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_glTextures"),this._renderer.renderableGC.addManagedHash(this,"_glSamplers")}contextChange(t){this._gl=t,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=sE(t,this._renderer.context.extensions),this._mapFormatToType=oE(t),this._mapFormatToFormat=iE(t)),this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1;for(let e=0;e<16;e++)this.bind(Fe.EMPTY,e)}initSource(t){this.bind(t)}bind(t,e=0){let r=t.source;t?(this.bindSource(r,e),this._useSeparateSamplers&&this._bindSampler(r.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){let r=this._gl;if(t._touched=this._renderer.textureGC.count,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t||(t=Fe.EMPTY.source);let i=this.getGlSource(t);r.bindTexture(i.target,i.texture)}}_bindSampler(t,e=0){let r=this._gl;if(!t){this._boundSamplers[e]=null,r.bindSampler(e,null);return}let i=this._getGlSampler(t);this._boundSamplers[e]!==i&&(this._boundSamplers[e]=i,r.bindSampler(e,i))}unbind(t){let e=t.source,r=this._boundTextures,i=this._gl;for(let n=0;n<r.length;n++)if(r[n]===e){this._activateLocation(n);let s=this.getGlSource(e);i.bindTexture(s.target,null),r[n]=null}}_activateLocation(t){this._activeTextureLocation!==t&&(this._activeTextureLocation=t,this._gl.activeTexture(this._gl.TEXTURE0+t))}_initSource(t){let e=this._gl,r=new Y_(e.createTexture());if(r.type=this._mapFormatToType[t.format],r.internalFormat=this._mapFormatToInternalFormat[t.format],r.format=this._mapFormatToFormat[t.format],t.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||t.isPowerOfTwo)){let i=Math.max(t.width,t.height);t.mipLevelCount=Math.floor(Math.log2(i))+1}return this._glTextures[t.uid]=r,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceUpdate,this),t.on("styleChange",this.onStyleChange,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),this.updateStyle(t,!1),r}onStyleChange(t){this.updateStyle(t,!1)}updateStyle(t,e){let r=this._gl,i=this.getGlSource(t);r.bindTexture(r.TEXTURE_2D,i.texture),this._boundTextures[this._activeTextureLocation]=t,rv(t.style,r,t.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",r.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!t.isPowerOfTwo,e)}onSourceUnload(t){let e=this._glTextures[t.uid];e&&(this.unbind(t),this._glTextures[t.uid]=null,this._gl.deleteTexture(e.texture))}onSourceUpdate(t){let e=this._gl,r=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,r.texture),this._boundTextures[this._activeTextureLocation]=t;let i=t.alphaMode==="premultiply-alpha-on-upload";this._premultiplyAlpha!==i&&(this._premultiplyAlpha=i,e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i)),this._uploads[t.uploadMethodId]?this._uploads[t.uploadMethodId].upload(t,r,e,this._renderer.context.webGLVersion):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t.pixelWidth,t.pixelHeight,0,e.RGBA,e.UNSIGNED_BYTE,null),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t,!1)}onUpdateMipmaps(t,e=!0){e&&this.bindSource(t,0);let r=this.getGlSource(t);this._gl.generateMipmap(r.target)}onSourceDestroy(t){t.off("destroy",this.onSourceDestroy,this),t.off("update",this.onSourceUpdate,this),t.off("resize",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("styleChange",this.onStyleChange,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}_initSampler(t){let e=this._gl,r=this._gl.createSampler();return this._glSamplers[t._resourceId]=r,rv(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",r,!1,!0),this._glSamplers[t._resourceId]}_getGlSampler(t){return this._glSamplers[t._resourceId]||this._initSampler(t)}getGlSource(t){return this._glTextures[t.uid]||this._initSource(t)}generateCanvas(t){let{pixels:e,width:r,height:i}=this.getPixels(t),n=Dt.get().createCanvas();n.width=r,n.height=i;let s=n.getContext("2d");if(s){let a=s.createImageData(r,i);a.data.set(e),s.putImageData(a,0,0)}return n}getPixels(t){let e=t.source.resolution,r=t.frame,i=Math.max(Math.round(r.width*e),1),n=Math.max(Math.round(r.height*e),1),s=new Uint8Array(iv*i*n),a=this._renderer,o=a.renderTarget.getRenderTarget(t),l=a.renderTarget.getGpuRenderTarget(o),h=a.gl;return h.bindFramebuffer(h.FRAMEBUFFER,l.resolveTargetFramebuffer),h.readPixels(Math.round(r.x*e),Math.round(r.y*e),i,n,h.RGBA,h.UNSIGNED_BYTE,s),{pixels:new Uint8ClampedArray(s.buffer),width:i,height:n}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null,this._renderer=null}resetState(){this._activeTextureLocation=-1,this._boundTextures.fill(Fe.EMPTY.source),this._boundSamplers=Object.create(null);let t=this._gl;this._premultiplyAlpha=!1,t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}},Rc.extension={type:[M.WebGLSystem],name:"texture"}}),nv={};It(nv,{WebGLRenderer:()=>lv});var sv,av,ov,kc,Bc,Gc,lv,uE=g(()=>{X(),nS(),sS(),aS(),Co(),qm(),Mi(),hS(),uS(),fS(),pS(),gS(),mS(),_S(),vS(),SS(),AS(),VS(),XS(),KS(),hE(),sv=[...Lu,bc,A_,T_,vc,dc,Rc,wc,gc,Cc,Ec,_c,X_,yc,mc],av=[...Nu],ov=[cc,uc,hc],kc=[],Bc=[],Gc=[],we.handleByNamedList(M.WebGLSystem,kc),we.handleByNamedList(M.WebGLPipes,Bc),we.handleByNamedList(M.WebGLPipesAdaptor,Gc),we.add(...sv,...av,...ov),lv=class extends Xs{constructor(){let t={name:"webgl",type:Lr.WEBGL,systems:kc,renderPipes:Bc,renderPipeAdaptors:Gc};super(t)}}}),cE=cr((t,e)=>{"use strict";e.exports=i;function r(s){return s instanceof Buffer?Buffer.from(s):new s.constructor(s.buffer.slice(),s.byteOffset,s.length)}function i(s){if(s=s||{},s.circles)return n(s);let a=new Map;if(a.set(Date,c=>new Date(c)),a.set(Map,(c,f)=>new Map(l(Array.from(c),f))),a.set(Set,(c,f)=>new Set(l(Array.from(c),f))),s.constructorHandlers)for(let c of s.constructorHandlers)a.set(c[0],c[1]);let o=null;return s.proto?u:h;function l(c,f){let d=Object.keys(c),_=new Array(d.length);for(let v=0;v<d.length;v++){let m=d[v],y=c[m];typeof y!="object"||y===null?_[m]=y:y.constructor!==Object&&(o=a.get(y.constructor))?_[m]=o(y,f):ArrayBuffer.isView(y)?_[m]=r(y):_[m]=f(y)}return _}function h(c){if(typeof c!="object"||c===null)return c;if(Array.isArray(c))return l(c,h);if(c.constructor!==Object&&(o=a.get(c.constructor)))return o(c,h);let f={};for(let d in c){if(Object.hasOwnProperty.call(c,d)===!1)continue;let _=c[d];typeof _!="object"||_===null?f[d]=_:_.constructor!==Object&&(o=a.get(_.constructor))?f[d]=o(_,h):ArrayBuffer.isView(_)?f[d]=r(_):f[d]=h(_)}return f}function u(c){if(typeof c!="object"||c===null)return c;if(Array.isArray(c))return l(c,u);if(c.constructor!==Object&&(o=a.get(c.constructor)))return o(c,u);let f={};for(let d in c){let _=c[d];typeof _!="object"||_===null?f[d]=_:_.constructor!==Object&&(o=a.get(_.constructor))?f[d]=o(_,u):ArrayBuffer.isView(_)?f[d]=r(_):f[d]=u(_)}return f}}function n(s){let a=[],o=[],l=new Map;if(l.set(Date,d=>new Date(d)),l.set(Map,(d,_)=>new Map(u(Array.from(d),_))),l.set(Set,(d,_)=>new Set(u(Array.from(d),_))),s.constructorHandlers)for(let d of s.constructorHandlers)l.set(d[0],d[1]);let h=null;return s.proto?f:c;function u(d,_){let v=Object.keys(d),m=new Array(v.length);for(let y=0;y<v.length;y++){let S=v[y],P=d[S];if(typeof P!="object"||P===null)m[S]=P;else if(P.constructor!==Object&&(h=l.get(P.constructor)))m[S]=h(P,_);else if(ArrayBuffer.isView(P))m[S]=r(P);else{let T=a.indexOf(P);T!==-1?m[S]=o[T]:m[S]=_(P)}}return m}function c(d){if(typeof d!="object"||d===null)return d;if(Array.isArray(d))return u(d,c);if(d.constructor!==Object&&(h=l.get(d.constructor)))return h(d,c);let _={};a.push(d),o.push(_);for(let v in d){if(Object.hasOwnProperty.call(d,v)===!1)continue;let m=d[v];if(typeof m!="object"||m===null)_[v]=m;else if(m.constructor!==Object&&(h=l.get(m.constructor)))_[v]=h(m,c);else if(ArrayBuffer.isView(m))_[v]=r(m);else{let y=a.indexOf(m);y!==-1?_[v]=o[y]:_[v]=c(m)}}return a.pop(),o.pop(),_}function f(d){if(typeof d!="object"||d===null)return d;if(Array.isArray(d))return u(d,f);if(d.constructor!==Object&&(h=l.get(d.constructor)))return h(d,f);let _={};a.push(d),o.push(_);for(let v in d){let m=d[v];if(typeof m!="object"||m===null)_[v]=m;else if(m.constructor!==Object&&(h=l.get(m.constructor)))_[v]=h(m,f);else if(ArrayBuffer.isView(m))_[v]=r(m);else{let y=a.indexOf(m);y!==-1?_[v]=o[y]:_[v]=f(m)}}return a.pop(),o.pop(),_}}}),dE={value:()=>{}};function hv(){for(var t=0,e=arguments.length,r={},i;t<e;++t){if(!(i=arguments[t]+"")||i in r||/[\s.]/.test(i))throw new Error("illegal type: "+i);r[i]=[]}return new Ho(r)}function Ho(t){this._=t}function fE(t,e){return t.trim().split(/^|\s+/).map(function(r){var i="",n=r.indexOf(".");if(n>=0&&(i=r.slice(n+1),r=r.slice(0,n)),r&&!e.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:i}})}Ho.prototype=hv.prototype={constructor:Ho,on:function(t,e){var r=this._,i=fE(t+"",r),n,s=-1,a=i.length;if(arguments.length<2){for(;++s<a;)if((n=(t=i[s]).type)&&(n=pE(r[n],t.name)))return n;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++s<a;)if(n=(t=i[s]).type)r[n]=uv(r[n],t.name,e);else if(e==null)for(n in r)r[n]=uv(r[n],t.name,null);return this},copy:function(){var t={},e=this._;for(var r in e)t[r]=e[r].slice();return new Ho(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var r=new Array(n),i=0,n,s;i<n;++i)r[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(s=this._[t],i=0,n=s.length;i<n;++i)s[i].value.apply(e,r)},apply:function(t,e,r){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],n=0,s=i.length;n<s;++n)i[n].value.apply(e,r)}};function pE(t,e){for(var r=0,i=t.length,n;r<i;++r)if((n=t[r]).name===e)return n.value}function uv(t,e,r){for(var i=0,n=t.length;i<n;++i)if(t[i].name===e){t[i]=dE,t=t.slice(0,i).concat(t.slice(i+1));break}return r!=null&&t.push({name:e,value:r}),t}var Vo=hv,Ic="http://www.w3.org/1999/xhtml",cv={svg:"http://www.w3.org/2000/svg",xhtml:Ic,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function jo(t){var e=t+="",r=e.indexOf(":");return r>=0&&(e=t.slice(0,r))!=="xmlns"&&(t=t.slice(r+1)),cv.hasOwnProperty(e)?{space:cv[e],local:t}:t}function gE(t){return function(){var e=this.ownerDocument,r=this.namespaceURI;return r===Ic&&e.documentElement.namespaceURI===Ic?e.createElement(t):e.createElementNS(r,t)}}function mE(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function dv(t){var e=jo(t);return(e.local?mE:gE)(e)}function _E(){}function Oc(t){return t==null?_E:function(){return this.querySelector(t)}}function vE(t){typeof t!="function"&&(t=Oc(t));for(var e=this._groups,r=e.length,i=new Array(r),n=0;n<r;++n)for(var s=e[n],a=s.length,o=i[n]=new Array(a),l,h,u=0;u<a;++u)(l=s[u])&&(h=t.call(l,l.__data__,u,s))&&("__data__"in l&&(h.__data__=l.__data__),o[u]=h);return new Pr(i,this._parents)}function yE(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function xE(){return[]}function fv(t){return t==null?xE:function(){return this.querySelectorAll(t)}}function bE(t){return function(){return yE(t.apply(this,arguments))}}function wE(t){typeof t=="function"?t=bE(t):t=fv(t);for(var e=this._groups,r=e.length,i=[],n=[],s=0;s<r;++s)for(var a=e[s],o=a.length,l,h=0;h<o;++h)(l=a[h])&&(i.push(t.call(l,l.__data__,h,a)),n.push(l));return new Pr(i,n)}function pv(t){return function(){return this.matches(t)}}function gv(t){return function(e){return e.matches(t)}}var TE=Array.prototype.find;function SE(t){return function(){return TE.call(this.children,t)}}function EE(){return this.firstElementChild}function CE(t){return this.select(t==null?EE:SE(typeof t=="function"?t:gv(t)))}var AE=Array.prototype.filter;function PE(){return Array.from(this.children)}function ME(t){return function(){return AE.call(this.children,t)}}function RE(t){return this.selectAll(t==null?PE:ME(typeof t=="function"?t:gv(t)))}function kE(t){typeof t!="function"&&(t=pv(t));for(var e=this._groups,r=e.length,i=new Array(r),n=0;n<r;++n)for(var s=e[n],a=s.length,o=i[n]=[],l,h=0;h<a;++h)(l=s[h])&&t.call(l,l.__data__,h,s)&&o.push(l);return new Pr(i,this._parents)}function mv(t){return new Array(t.length)}function BE(){return new Pr(this._enter||this._groups.map(mv),this._parents)}function Wo(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}Wo.prototype={constructor:Wo,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function GE(t){return function(){return t}}function IE(t,e,r,i,n,s){for(var a=0,o,l=e.length,h=s.length;a<h;++a)(o=e[a])?(o.__data__=s[a],i[a]=o):r[a]=new Wo(t,s[a]);for(;a<l;++a)(o=e[a])&&(n[a]=o)}function OE(t,e,r,i,n,s,a){var o,l,h=new Map,u=e.length,c=s.length,f=new Array(u),d;for(o=0;o<u;++o)(l=e[o])&&(f[o]=d=a.call(l,l.__data__,o,e)+"",h.has(d)?n[o]=l:h.set(d,l));for(o=0;o<c;++o)d=a.call(t,s[o],o,s)+"",(l=h.get(d))?(i[o]=l,l.__data__=s[o],h.delete(d)):r[o]=new Wo(t,s[o]);for(o=0;o<u;++o)(l=e[o])&&h.get(f[o])===l&&(n[o]=l)}function FE(t){return t.__data__}function DE(t,e){if(!arguments.length)return Array.from(this,FE);var r=e?OE:IE,i=this._parents,n=this._groups;typeof t!="function"&&(t=GE(t));for(var s=n.length,a=new Array(s),o=new Array(s),l=new Array(s),h=0;h<s;++h){var u=i[h],c=n[h],f=c.length,d=UE(t.call(u,u&&u.__data__,h,i)),_=d.length,v=o[h]=new Array(_),m=a[h]=new Array(_),y=l[h]=new Array(f);r(u,c,v,m,y,d,e);for(var S=0,P=0,T,z;S<_;++S)if(T=v[S]){for(S>=P&&(P=S+1);!(z=m[P])&&++P<_;);T._next=z||null}}return a=new Pr(a,i),a._enter=o,a._exit=l,a}function UE(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function LE(){return new Pr(this._exit||this._groups.map(mv),this._parents)}function NE(t,e,r){var i=this.enter(),n=this,s=this.exit();return typeof t=="function"?(i=t(i),i&&(i=i.selection())):i=i.append(t+""),e!=null&&(n=e(n),n&&(n=n.selection())),r==null?s.remove():r(s),i&&n?i.merge(n).order():n}function zE(t){for(var e=t.selection?t.selection():t,r=this._groups,i=e._groups,n=r.length,s=i.length,a=Math.min(n,s),o=new Array(n),l=0;l<a;++l)for(var h=r[l],u=i[l],c=h.length,f=o[l]=new Array(c),d,_=0;_<c;++_)(d=h[_]||u[_])&&(f[_]=d);for(;l<n;++l)o[l]=r[l];return new Pr(o,this._parents)}function HE(){for(var t=this._groups,e=-1,r=t.length;++e<r;)for(var i=t[e],n=i.length-1,s=i[n],a;--n>=0;)(a=i[n])&&(s&&a.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(a,s),s=a);return this}function VE(t){t||(t=jE);function e(c,f){return c&&f?t(c.__data__,f.__data__):!c-!f}for(var r=this._groups,i=r.length,n=new Array(i),s=0;s<i;++s){for(var a=r[s],o=a.length,l=n[s]=new Array(o),h,u=0;u<o;++u)(h=a[u])&&(l[u]=h);l.sort(e)}return new Pr(n,this._parents).order()}function jE(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function WE(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function $E(){return Array.from(this)}function XE(){for(var t=this._groups,e=0,r=t.length;e<r;++e)for(var i=t[e],n=0,s=i.length;n<s;++n){var a=i[n];if(a)return a}return null}function YE(){let t=0;for(let e of this)++t;return t}function qE(){return!this.node()}function KE(t){for(var e=this._groups,r=0,i=e.length;r<i;++r)for(var n=e[r],s=0,a=n.length,o;s<a;++s)(o=n[s])&&t.call(o,o.__data__,s,n);return this}function ZE(t){return function(){this.removeAttribute(t)}}function QE(t){return function(){this.removeAttributeNS(t.space,t.local)}}function JE(t,e){return function(){this.setAttribute(t,e)}}function e2(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function t2(t,e){return function(){var r=e.apply(this,arguments);r==null?this.removeAttribute(t):this.setAttribute(t,r)}}function r2(t,e){return function(){var r=e.apply(this,arguments);r==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,r)}}function i2(t,e){var r=jo(t);if(arguments.length<2){var i=this.node();return r.local?i.getAttributeNS(r.space,r.local):i.getAttribute(r)}return this.each((e==null?r.local?QE:ZE:typeof e=="function"?r.local?r2:t2:r.local?e2:JE)(r,e))}function _v(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function n2(t){return function(){this.style.removeProperty(t)}}function s2(t,e,r){return function(){this.style.setProperty(t,e,r)}}function a2(t,e,r){return function(){var i=e.apply(this,arguments);i==null?this.style.removeProperty(t):this.style.setProperty(t,i,r)}}function o2(t,e,r){return arguments.length>1?this.each((e==null?n2:typeof e=="function"?a2:s2)(t,e,r??"")):Jn(this.node(),t)}function Jn(t,e){return t.style.getPropertyValue(e)||_v(t).getComputedStyle(t,null).getPropertyValue(e)}function l2(t){return function(){delete this[t]}}function h2(t,e){return function(){this[t]=e}}function u2(t,e){return function(){var r=e.apply(this,arguments);r==null?delete this[t]:this[t]=r}}function c2(t,e){return arguments.length>1?this.each((e==null?l2:typeof e=="function"?u2:h2)(t,e)):this.node()[t]}function vv(t){return t.trim().split(/^|\s+/)}function Fc(t){return t.classList||new yv(t)}function yv(t){this._node=t,this._names=vv(t.getAttribute("class")||"")}yv.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function xv(t,e){for(var r=Fc(t),i=-1,n=e.length;++i<n;)r.add(e[i])}function bv(t,e){for(var r=Fc(t),i=-1,n=e.length;++i<n;)r.remove(e[i])}function d2(t){return function(){xv(this,t)}}function f2(t){return function(){bv(this,t)}}function p2(t,e){return function(){(e.apply(this,arguments)?xv:bv)(this,t)}}function g2(t,e){var r=vv(t+"");if(arguments.length<2){for(var i=Fc(this.node()),n=-1,s=r.length;++n<s;)if(!i.contains(r[n]))return!1;return!0}return this.each((typeof e=="function"?p2:e?d2:f2)(r,e))}function m2(){this.textContent=""}function _2(t){return function(){this.textContent=t}}function v2(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function y2(t){return arguments.length?this.each(t==null?m2:(typeof t=="function"?v2:_2)(t)):this.node().textContent}function x2(){this.innerHTML=""}function b2(t){return function(){this.innerHTML=t}}function w2(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function T2(t){return arguments.length?this.each(t==null?x2:(typeof t=="function"?w2:b2)(t)):this.node().innerHTML}function S2(){this.nextSibling&&this.parentNode.appendChild(this)}function E2(){return this.each(S2)}function C2(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function A2(){return this.each(C2)}function P2(t){var e=typeof t=="function"?t:dv(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function M2(){return null}function R2(t,e){var r=typeof t=="function"?t:dv(t),i=e==null?M2:typeof e=="function"?e:Oc(e);return this.select(function(){return this.insertBefore(r.apply(this,arguments),i.apply(this,arguments)||null)})}function k2(){var t=this.parentNode;t&&t.removeChild(this)}function B2(){return this.each(k2)}function G2(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function I2(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function O2(t){return this.select(t?I2:G2)}function F2(t){return arguments.length?this.property("__data__",t):this.node().__data__}function D2(t){return function(e){t.call(this,e,this.__data__)}}function U2(t){return t.trim().split(/^|\s+/).map(function(e){var r="",i=e.indexOf(".");return i>=0&&(r=e.slice(i+1),e=e.slice(0,i)),{type:e,name:r}})}function L2(t){return function(){var e=this.__on;if(e){for(var r=0,i=-1,n=e.length,s;r<n;++r)s=e[r],(!t.type||s.type===t.type)&&s.name===t.name?this.removeEventListener(s.type,s.listener,s.options):e[++i]=s;++i?e.length=i:delete this.__on}}}function N2(t,e,r){return function(){var i=this.__on,n,s=D2(e);if(i){for(var a=0,o=i.length;a<o;++a)if((n=i[a]).type===t.type&&n.name===t.name){this.removeEventListener(n.type,n.listener,n.options),this.addEventListener(n.type,n.listener=s,n.options=r),n.value=e;return}}this.addEventListener(t.type,s,r),n={type:t.type,name:t.name,value:e,listener:s,options:r},i?i.push(n):this.__on=[n]}}function z2(t,e,r){var i=U2(t+""),n,s=i.length,a;if(arguments.length<2){var o=this.node().__on;if(o){for(var l=0,h=o.length,u;l<h;++l)for(n=0,u=o[l];n<s;++n)if((a=i[n]).type===u.type&&a.name===u.name)return u.value}return}for(o=e?N2:L2,n=0;n<s;++n)this.each(o(i[n],e,r));return this}function wv(t,e,r){var i=_v(t),n=i.CustomEvent;typeof n=="function"?n=new n(e,r):(n=i.document.createEvent("Event"),r?(n.initEvent(e,r.bubbles,r.cancelable),n.detail=r.detail):n.initEvent(e,!1,!1)),t.dispatchEvent(n)}function H2(t,e){return function(){return wv(this,t,e)}}function V2(t,e){return function(){return wv(this,t,e.apply(this,arguments))}}function j2(t,e){return this.each((typeof e=="function"?V2:H2)(t,e))}function*W2(){for(var t=this._groups,e=0,r=t.length;e<r;++e)for(var i=t[e],n=0,s=i.length,a;n<s;++n)(a=i[n])&&(yield a)}var Tv=[null];function Pr(t,e){this._groups=t,this._parents=e}function Sv(){return new Pr([[document.documentElement]],Tv)}function $2(){return this}Pr.prototype=Sv.prototype={constructor:Pr,select:vE,selectAll:wE,selectChild:CE,selectChildren:RE,filter:kE,data:DE,enter:BE,exit:LE,join:NE,merge:zE,selection:$2,order:HE,sort:VE,call:WE,nodes:$E,node:XE,size:YE,empty:qE,each:KE,attr:i2,style:o2,property:c2,classed:g2,text:y2,html:T2,raise:E2,lower:A2,append:P2,insert:R2,remove:B2,clone:O2,datum:F2,on:z2,dispatch:j2,[Symbol.iterator]:W2};var ea=Sv;function Zr(t){return typeof t=="string"?new Pr([[document.querySelector(t)]],[document.documentElement]):new Pr([[t]],Tv)}function X2(t){let e;for(;e=t.sourceEvent;)t=e;return t}function Gi(t,e){if(t=X2(t),e===void 0&&(e=t.currentTarget),e){var r=e.ownerSVGElement||e;if(r.createSVGPoint){var i=r.createSVGPoint();return i.x=t.clientX,i.y=t.clientY,i=i.matrixTransform(e.getScreenCTM().inverse()),[i.x,i.y]}if(e.getBoundingClientRect){var n=e.getBoundingClientRect();return[t.clientX-n.left-e.clientLeft,t.clientY-n.top-e.clientTop]}}return[t.pageX,t.pageY]}var Y2={passive:!1},ta={capture:!0,passive:!1};function Dc(t){t.stopImmediatePropagation()}function es(t){t.preventDefault(),t.stopImmediatePropagation()}function Ev(t){var e=t.document.documentElement,r=Zr(t).on("dragstart.drag",es,ta);"onselectstart"in e?r.on("selectstart.drag",es,ta):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function Cv(t,e){var r=t.document.documentElement,i=Zr(t).on("dragstart.drag",null);e&&(i.on("click.drag",es,ta),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in r?i.on("selectstart.drag",null):(r.style.MozUserSelect=r.__noselect,delete r.__noselect)}var $o=t=>()=>t;function Uc(t,{sourceEvent:e,subject:r,target:i,identifier:n,active:s,x:a,y:o,dx:l,dy:h,dispatch:u}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:n,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:o,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:h,enumerable:!0,configurable:!0},_:{value:u}})}Uc.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function q2(t){return!t.ctrlKey&&!t.button}function K2(){return this.parentNode}function Z2(t,e){return e??{x:t.x,y:t.y}}function Q2(){return navigator.maxTouchPoints||"ontouchstart"in this}function J2(){var t=q2,e=K2,r=Z2,i=Q2,n={},s=Vo("start","drag","end"),a=0,o,l,h,u,c=0;function f(T){T.on("mousedown.drag",d).filter(i).on("touchstart.drag",m).on("touchmove.drag",y,Y2).on("touchend.drag touchcancel.drag",S).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function d(T,z){if(!(u||!t.call(this,T,z))){var D=P(this,e.call(this,T,z),T,z,"mouse");D&&(Zr(T.view).on("mousemove.drag",_,ta).on("mouseup.drag",v,ta),Ev(T.view),Dc(T),h=!1,o=T.clientX,l=T.clientY,D("start",T))}}function _(T){if(es(T),!h){var z=T.clientX-o,D=T.clientY-l;h=z*z+D*D>c}n.mouse("drag",T)}function v(T){Zr(T.view).on("mousemove.drag mouseup.drag",null),Cv(T.view,h),es(T),n.mouse("end",T)}function m(T,z){if(t.call(this,T,z)){var D=T.changedTouches,L=e.call(this,T,z),ne=D.length,ue,re;for(ue=0;ue<ne;++ue)(re=P(this,L,T,z,D[ue].identifier,D[ue]))&&(Dc(T),re("start",T,D[ue]))}}function y(T){var z=T.changedTouches,D=z.length,L,ne;for(L=0;L<D;++L)(ne=n[z[L].identifier])&&(es(T),ne("drag",T,z[L]))}function S(T){var z=T.changedTouches,D=z.length,L,ne;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),L=0;L<D;++L)(ne=n[z[L].identifier])&&(Dc(T),ne("end",T,z[L]))}function P(T,z,D,L,ne,ue){var re=s.copy(),oe=Gi(ue||D,z),Be,Ze,I;if((I=r.call(T,new Uc("beforestart",{sourceEvent:D,target:f,identifier:ne,active:a,x:oe[0],y:oe[1],dx:0,dy:0,dispatch:re}),L))!=null)return Be=I.x-oe[0]||0,Ze=I.y-oe[1]||0,function Me(U,J,je){var Se=oe,De;switch(U){case"start":n[ne]=Me,De=a++;break;case"end":delete n[ne],--a;case"drag":oe=Gi(je||J,z),De=a;break}re.call(U,T,new Uc(U,{sourceEvent:J,subject:I,target:f,identifier:ne,active:De,x:oe[0]+Be,y:oe[1]+Ze,dx:oe[0]-Se[0],dy:oe[1]-Se[1],dispatch:re}),L)}}return f.filter=function(T){return arguments.length?(t=typeof T=="function"?T:$o(!!T),f):t},f.container=function(T){return arguments.length?(e=typeof T=="function"?T:$o(T),f):e},f.subject=function(T){return arguments.length?(r=typeof T=="function"?T:$o(T),f):r},f.touchable=function(T){return arguments.length?(i=typeof T=="function"?T:$o(!!T),f):i},f.on=function(){var T=s.on.apply(s,arguments);return T===s?f:T},f.clickDistance=function(T){return arguments.length?(c=(T=+T)*T,f):Math.sqrt(c)},f}function Lc(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function Av(t,e){var r=Object.create(t.prototype);for(var i in e)r[i]=e[i];return r}function ra(){}var ia=.7,Xo=1/ia,ts="\\s*([+-]?\\d+)\\s*",na="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",pi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",eC=/^#([0-9a-f]{3,8})$/,tC=new RegExp(`^rgb\\(${ts},${ts},${ts}\\)$`),rC=new RegExp(`^rgb\\(${pi},${pi},${pi}\\)$`),iC=new RegExp(`^rgba\\(${ts},${ts},${ts},${na}\\)$`),nC=new RegExp(`^rgba\\(${pi},${pi},${pi},${na}\\)$`),sC=new RegExp(`^hsl\\(${na},${pi},${pi}\\)$`),aC=new RegExp(`^hsla\\(${na},${pi},${pi},${na}\\)$`),Pv={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};Lc(ra,sa,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Mv,formatHex:Mv,formatHex8:oC,formatHsl:lC,formatRgb:Rv,toString:Rv});function Mv(){return this.rgb().formatHex()}function oC(){return this.rgb().formatHex8()}function lC(){return Ov(this).formatHsl()}function Rv(){return this.rgb().formatRgb()}function sa(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=eC.exec(t))?(r=e[1].length,e=parseInt(e[1],16),r===6?kv(e):r===3?new Sr(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):r===8?Yo(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):r===4?Yo(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=tC.exec(t))?new Sr(e[1],e[2],e[3],1):(e=rC.exec(t))?new Sr(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=iC.exec(t))?Yo(e[1],e[2],e[3],e[4]):(e=nC.exec(t))?Yo(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=sC.exec(t))?Iv(e[1],e[2]/100,e[3]/100,1):(e=aC.exec(t))?Iv(e[1],e[2]/100,e[3]/100,e[4]):Pv.hasOwnProperty(t)?kv(Pv[t]):t==="transparent"?new Sr(NaN,NaN,NaN,0):null}function kv(t){return new Sr(t>>16&255,t>>8&255,t&255,1)}function Yo(t,e,r,i){return i<=0&&(t=e=r=NaN),new Sr(t,e,r,i)}function hC(t){return t instanceof ra||(t=sa(t)),t?(t=t.rgb(),new Sr(t.r,t.g,t.b,t.opacity)):new Sr}function qo(t,e,r,i){return arguments.length===1?hC(t):new Sr(t,e,r,i??1)}function Sr(t,e,r,i){this.r=+t,this.g=+e,this.b=+r,this.opacity=+i}Lc(Sr,qo,Av(ra,{brighter(t){return t=t==null?Xo:Math.pow(Xo,t),new Sr(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?ia:Math.pow(ia,t),new Sr(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Sr(Tn(this.r),Tn(this.g),Tn(this.b),Ko(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:Bv,formatHex:Bv,formatHex8:uC,formatRgb:Gv,toString:Gv}));function Bv(){return`#${Sn(this.r)}${Sn(this.g)}${Sn(this.b)}`}function uC(){return`#${Sn(this.r)}${Sn(this.g)}${Sn(this.b)}${Sn((isNaN(this.opacity)?1:this.opacity)*255)}`}function Gv(){let t=Ko(this.opacity);return`${t===1?"rgb(":"rgba("}${Tn(this.r)}, ${Tn(this.g)}, ${Tn(this.b)}${t===1?")":`, ${t})`}`}function Ko(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Tn(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Sn(t){return t=Tn(t),(t<16?"0":"")+t.toString(16)}function Iv(t,e,r,i){return i<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new Qr(t,e,r,i)}function Ov(t){if(t instanceof Qr)return new Qr(t.h,t.s,t.l,t.opacity);if(t instanceof ra||(t=sa(t)),!t)return new Qr;if(t instanceof Qr)return t;t=t.rgb();var e=t.r/255,r=t.g/255,i=t.b/255,n=Math.min(e,r,i),s=Math.max(e,r,i),a=NaN,o=s-n,l=(s+n)/2;return o?(e===s?a=(r-i)/o+(r<i)*6:r===s?a=(i-e)/o+2:a=(e-r)/o+4,o/=l<.5?s+n:2-s-n,a*=60):o=l>0&&l<1?0:a,new Qr(a,o,l,t.opacity)}function cC(t,e,r,i){return arguments.length===1?Ov(t):new Qr(t,e,r,i??1)}function Qr(t,e,r,i){this.h=+t,this.s=+e,this.l=+r,this.opacity=+i}Lc(Qr,cC,Av(ra,{brighter(t){return t=t==null?Xo:Math.pow(Xo,t),new Qr(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?ia:Math.pow(ia,t),new Qr(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,i=r+(r<.5?r:1-r)*e,n=2*r-i;return new Sr(Nc(t>=240?t-240:t+120,n,i),Nc(t,n,i),Nc(t<120?t+240:t-120,n,i),this.opacity)},clamp(){return new Qr(Fv(this.h),Zo(this.s),Zo(this.l),Ko(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(){let t=Ko(this.opacity);return`${t===1?"hsl(":"hsla("}${Fv(this.h)}, ${Zo(this.s)*100}%, ${Zo(this.l)*100}%${t===1?")":`, ${t})`}`}}));function Fv(t){return t=(t||0)%360,t<0?t+360:t}function Zo(t){return Math.max(0,Math.min(1,t||0))}function Nc(t,e,r){return(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)*255}function Dv(t,e,r,i,n){var s=t*t,a=s*t;return((1-3*t+3*s-a)*e+(4-6*s+3*a)*r+(1+3*t+3*s-3*a)*i+a*n)/6}function dC(t){var e=t.length-1;return function(r){var i=r<=0?r=0:r>=1?(r=1,e-1):Math.floor(r*e),n=t[i],s=t[i+1],a=i>0?t[i-1]:2*n-s,o=i<e-1?t[i+2]:2*s-n;return Dv((r-i/e)*e,a,n,s,o)}}function fC(t){var e=t.length;return function(r){var i=Math.floor(((r%=1)<0?++r:r)*e),n=t[(i+e-1)%e],s=t[i%e],a=t[(i+1)%e],o=t[(i+2)%e];return Dv((r-i/e)*e,n,s,a,o)}}var Uv=t=>()=>t;function pC(t,e){return function(r){return t+r*e}}function gC(t,e,r){return t=Math.pow(t,r),e=Math.pow(e,r)-t,r=1/r,function(i){return Math.pow(t+i*e,r)}}function mC(t){return(t=+t)==1?Lv:function(e,r){return r-e?gC(e,r,t):Uv(isNaN(e)?r:e)}}function Lv(t,e){var r=e-t;return r?pC(t,r):Uv(isNaN(t)?e:t)}var Nv=function t(e){var r=mC(e);function i(n,s){var a=r((n=qo(n)).r,(s=qo(s)).r),o=r(n.g,s.g),l=r(n.b,s.b),h=Lv(n.opacity,s.opacity);return function(u){return n.r=a(u),n.g=o(u),n.b=l(u),n.opacity=h(u),n+""}}return i.gamma=t,i}(1);function zv(t){return function(e){var r=e.length,i=new Array(r),n=new Array(r),s=new Array(r),a,o;for(a=0;a<r;++a)o=qo(e[a]),i[a]=o.r||0,n[a]=o.g||0,s[a]=o.b||0;return i=t(i),n=t(n),s=t(s),o.opacity=1,function(l){return o.r=i(l),o.g=n(l),o.b=s(l),o+""}}}var jP=zv(dC),WP=zv(fC);function Ji(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}var zc=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Hc=new RegExp(zc.source,"g");function _C(t){return function(){return t}}function vC(t){return function(e){return t(e)+""}}function yC(t,e){var r=zc.lastIndex=Hc.lastIndex=0,i,n,s,a=-1,o=[],l=[];for(t=t+"",e=e+"";(i=zc.exec(t))&&(n=Hc.exec(e));)(s=n.index)>r&&(s=e.slice(r,s),o[a]?o[a]+=s:o[++a]=s),(i=i[0])===(n=n[0])?o[a]?o[a]+=n:o[++a]=n:(o[++a]=null,l.push({i:a,x:Ji(i,n)})),r=Hc.lastIndex;return r<e.length&&(s=e.slice(r),o[a]?o[a]+=s:o[++a]=s),o.length<2?l[0]?vC(l[0].x):_C(e):(e=l.length,function(h){for(var u=0,c;u<e;++u)o[(c=l[u]).i]=c.x(h);return o.join("")})}var Hv=180/Math.PI,Vc={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Vv(t,e,r,i,n,s){var a,o,l;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(l=t*r+e*i)&&(r-=t*l,i-=e*l),(o=Math.sqrt(r*r+i*i))&&(r/=o,i/=o,l/=o),t*i<e*r&&(t=-t,e=-e,l=-l,a=-a),{translateX:n,translateY:s,rotate:Math.atan2(e,t)*Hv,skewX:Math.atan(l)*Hv,scaleX:a,scaleY:o}}var Qo;function xC(t){let e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Vc:Vv(e.a,e.b,e.c,e.d,e.e,e.f)}function bC(t){return t==null?Vc:(Qo||(Qo=document.createElementNS("http://www.w3.org/2000/svg","g")),Qo.setAttribute("transform",t),(t=Qo.transform.baseVal.consolidate())?(t=t.matrix,Vv(t.a,t.b,t.c,t.d,t.e,t.f)):Vc)}function jv(t,e,r,i){function n(h){return h.length?h.pop()+" ":""}function s(h,u,c,f,d,_){if(h!==c||u!==f){var v=d.push("translate(",null,e,null,r);_.push({i:v-4,x:Ji(h,c)},{i:v-2,x:Ji(u,f)})}else(c||f)&&d.push("translate("+c+e+f+r)}function a(h,u,c,f){h!==u?(h-u>180?u+=360:u-h>180&&(h+=360),f.push({i:c.push(n(c)+"rotate(",null,i)-2,x:Ji(h,u)})):u&&c.push(n(c)+"rotate("+u+i)}function o(h,u,c,f){h!==u?f.push({i:c.push(n(c)+"skewX(",null,i)-2,x:Ji(h,u)}):u&&c.push(n(c)+"skewX("+u+i)}function l(h,u,c,f,d,_){if(h!==c||u!==f){var v=d.push(n(d)+"scale(",null,",",null,")");_.push({i:v-4,x:Ji(h,c)},{i:v-2,x:Ji(u,f)})}else(c!==1||f!==1)&&d.push(n(d)+"scale("+c+","+f+")")}return function(h,u){var c=[],f=[];return h=t(h),u=t(u),s(h.translateX,h.translateY,u.translateX,u.translateY,c,f),a(h.rotate,u.rotate,c,f),o(h.skewX,u.skewX,c,f),l(h.scaleX,h.scaleY,u.scaleX,u.scaleY,c,f),h=u=null,function(d){for(var _=-1,v=f.length,m;++_<v;)c[(m=f[_]).i]=m.x(d);return c.join("")}}}var wC=jv(xC,"px, ","px)","deg)"),TC=jv(bC,", ",")",")"),SC=1e-12;function Wv(t){return((t=Math.exp(t))+1/t)/2}function EC(t){return((t=Math.exp(t))-1/t)/2}function CC(t){return((t=Math.exp(2*t))-1)/(t+1)}var AC=function t(e,r,i){function n(s,a){var o=s[0],l=s[1],h=s[2],u=a[0],c=a[1],f=a[2],d=u-o,_=c-l,v=d*d+_*_,m,y;if(v<SC)y=Math.log(f/h)/e,m=function(L){return[o+L*d,l+L*_,h*Math.exp(e*L*y)]};else{var S=Math.sqrt(v),P=(f*f-h*h+i*v)/(2*h*r*S),T=(f*f-h*h-i*v)/(2*f*r*S),z=Math.log(Math.sqrt(P*P+1)-P),D=Math.log(Math.sqrt(T*T+1)-T);y=(D-z)/e,m=function(L){var ne=L*y,ue=Wv(z),re=h/(r*S)*(ue*CC(e*ne+z)-EC(z));return[o+re*d,l+re*_,h*ue/Wv(e*ne+z)]}}return m.duration=y*1e3*e/Math.SQRT2,m}return n.rho=function(s){var a=Math.max(.001,+s),o=a*a,l=o*o;return t(a,o,l)},n}(Math.SQRT2,2,4),rs=0,aa=0,oa=0,$v=1e3,Jo,la,el=0,En=0,tl=0,ha=typeof performance=="object"&&performance.now?performance:Date,Xv=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function jc(){return En||(Xv(PC),En=ha.now()+tl)}function PC(){En=0}function rl(){this._call=this._time=this._next=null}rl.prototype=Wc.prototype={constructor:rl,restart:function(t,e,r){if(typeof t!="function")throw new TypeError("callback is not a function");r=(r==null?jc():+r)+(e==null?0:+e),!this._next&&la!==this&&(la?la._next=this:Jo=this,la=this),this._call=t,this._time=r,$c()},stop:function(){this._call&&(this._call=null,this._time=1/0,$c())}};function Wc(t,e,r){var i=new rl;return i.restart(t,e,r),i}function MC(){jc(),++rs;for(var t=Jo,e;t;)(e=En-t._time)>=0&&t._call.call(void 0,e),t=t._next;--rs}function Yv(){En=(el=ha.now())+tl,rs=aa=0;try{MC()}finally{rs=0,kC(),En=0}}function RC(){var t=ha.now(),e=t-el;e>$v&&(tl-=e,el=t)}function kC(){for(var t,e=Jo,r,i=1/0;e;)e._call?(i>e._time&&(i=e._time),t=e,e=e._next):(r=e._next,e._next=null,e=t?t._next=r:Jo=r);la=t,$c(i)}function $c(t){if(!rs){aa&&(aa=clearTimeout(aa));var e=t-En;e>24?(t<1/0&&(aa=setTimeout(Yv,t-ha.now()-tl)),oa&&(oa=clearInterval(oa))):(oa||(el=ha.now(),oa=setInterval(RC,$v)),rs=1,Xv(Yv))}}function qv(t,e,r){var i=new rl;return e=e==null?0:+e,i.restart(n=>{i.stop(),t(n+e)},e,r),i}var BC=Vo("start","end","cancel","interrupt"),GC=[],Kv=0,Zv=1,Xc=2,il=3,Qv=4,Yc=5,nl=6;function sl(t,e,r,i,n,s){var a=t.__transition;if(!a)t.__transition={};else if(r in a)return;IC(t,r,{name:e,index:i,group:n,on:BC,tween:GC,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:Kv})}function qc(t,e){var r=Jr(t,e);if(r.state>Kv)throw new Error("too late; already scheduled");return r}function gi(t,e){var r=Jr(t,e);if(r.state>il)throw new Error("too late; already running");return r}function Jr(t,e){var r=t.__transition;if(!r||!(r=r[e]))throw new Error("transition not found");return r}function IC(t,e,r){var i=t.__transition,n;i[e]=r,r.timer=Wc(s,0,r.time);function s(h){r.state=Zv,r.timer.restart(a,r.delay,r.time),r.delay<=h&&a(h-r.delay)}function a(h){var u,c,f,d;if(r.state!==Zv)return l();for(u in i)if(d=i[u],d.name===r.name){if(d.state===il)return qv(a);d.state===Qv?(d.state=nl,d.timer.stop(),d.on.call("interrupt",t,t.__data__,d.index,d.group),delete i[u]):+u<e&&(d.state=nl,d.timer.stop(),d.on.call("cancel",t,t.__data__,d.index,d.group),delete i[u])}if(qv(function(){r.state===il&&(r.state=Qv,r.timer.restart(o,r.delay,r.time),o(h))}),r.state=Xc,r.on.call("start",t,t.__data__,r.index,r.group),r.state===Xc){for(r.state=il,n=new Array(f=r.tween.length),u=0,c=-1;u<f;++u)(d=r.tween[u].value.call(t,t.__data__,r.index,r.group))&&(n[++c]=d);n.length=c+1}}function o(h){for(var u=h<r.duration?r.ease.call(null,h/r.duration):(r.timer.restart(l),r.state=Yc,1),c=-1,f=n.length;++c<f;)n[c].call(t,u);r.state===Yc&&(r.on.call("end",t,t.__data__,r.index,r.group),l())}function l(){r.state=nl,r.timer.stop(),delete i[e];for(var h in i)return;delete t.__transition}}function al(t,e){var r=t.__transition,i,n,s=!0,a;if(r){e=e==null?null:e+"";for(a in r){if((i=r[a]).name!==e){s=!1;continue}n=i.state>Xc&&i.state<Yc,i.state=nl,i.timer.stop(),i.on.call(n?"interrupt":"cancel",t,t.__data__,i.index,i.group),delete r[a]}s&&delete t.__transition}}function OC(t){return this.each(function(){al(this,t)})}function FC(t,e){var r,i;return function(){var n=gi(this,t),s=n.tween;if(s!==r){i=r=s;for(var a=0,o=i.length;a<o;++a)if(i[a].name===e){i=i.slice(),i.splice(a,1);break}}n.tween=i}}function DC(t,e,r){var i,n;if(typeof r!="function")throw new Error;return function(){var s=gi(this,t),a=s.tween;if(a!==i){n=(i=a).slice();for(var o={name:e,value:r},l=0,h=n.length;l<h;++l)if(n[l].name===e){n[l]=o;break}l===h&&n.push(o)}s.tween=n}}function UC(t,e){var r=this._id;if(t+="",arguments.length<2){for(var i=Jr(this.node(),r).tween,n=0,s=i.length,a;n<s;++n)if((a=i[n]).name===t)return a.value;return null}return this.each((e==null?FC:DC)(r,t,e))}function Kc(t,e,r){var i=t._id;return t.each(function(){var n=gi(this,i);(n.value||(n.value={}))[e]=r.apply(this,arguments)}),function(n){return Jr(n,i).value[e]}}function Jv(t,e){var r;return(typeof e=="number"?Ji:e instanceof sa?Nv:(r=sa(e))?(e=r,Nv):yC)(t,e)}function LC(t){return function(){this.removeAttribute(t)}}function NC(t){return function(){this.removeAttributeNS(t.space,t.local)}}function zC(t,e,r){var i,n=r+"",s;return function(){var a=this.getAttribute(t);return a===n?null:a===i?s:s=e(i=a,r)}}function HC(t,e,r){var i,n=r+"",s;return function(){var a=this.getAttributeNS(t.space,t.local);return a===n?null:a===i?s:s=e(i=a,r)}}function VC(t,e,r){var i,n,s;return function(){var a,o=r(this),l;return o==null?void this.removeAttribute(t):(a=this.getAttribute(t),l=o+"",a===l?null:a===i&&l===n?s:(n=l,s=e(i=a,o)))}}function jC(t,e,r){var i,n,s;return function(){var a,o=r(this),l;return o==null?void this.removeAttributeNS(t.space,t.local):(a=this.getAttributeNS(t.space,t.local),l=o+"",a===l?null:a===i&&l===n?s:(n=l,s=e(i=a,o)))}}function WC(t,e){var r=jo(t),i=r==="transform"?TC:Jv;return this.attrTween(t,typeof e=="function"?(r.local?jC:VC)(r,i,Kc(this,"attr."+t,e)):e==null?(r.local?NC:LC)(r):(r.local?HC:zC)(r,i,e))}function $C(t,e){return function(r){this.setAttribute(t,e.call(this,r))}}function XC(t,e){return function(r){this.setAttributeNS(t.space,t.local,e.call(this,r))}}function YC(t,e){var r,i;function n(){var s=e.apply(this,arguments);return s!==i&&(r=(i=s)&&XC(t,s)),r}return n._value=e,n}function qC(t,e){var r,i;function n(){var s=e.apply(this,arguments);return s!==i&&(r=(i=s)&&$C(t,s)),r}return n._value=e,n}function KC(t,e){var r="attr."+t;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!="function")throw new Error;var i=jo(t);return this.tween(r,(i.local?YC:qC)(i,e))}function ZC(t,e){return function(){qc(this,t).delay=+e.apply(this,arguments)}}function QC(t,e){return e=+e,function(){qc(this,t).delay=e}}function JC(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?ZC:QC)(e,t)):Jr(this.node(),e).delay}function eA(t,e){return function(){gi(this,t).duration=+e.apply(this,arguments)}}function tA(t,e){return e=+e,function(){gi(this,t).duration=e}}function rA(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?eA:tA)(e,t)):Jr(this.node(),e).duration}function iA(t,e){if(typeof e!="function")throw new Error;return function(){gi(this,t).ease=e}}function nA(t){var e=this._id;return arguments.length?this.each(iA(e,t)):Jr(this.node(),e).ease}function sA(t,e){return function(){var r=e.apply(this,arguments);if(typeof r!="function")throw new Error;gi(this,t).ease=r}}function aA(t){if(typeof t!="function")throw new Error;return this.each(sA(this._id,t))}function oA(t){typeof t!="function"&&(t=pv(t));for(var e=this._groups,r=e.length,i=new Array(r),n=0;n<r;++n)for(var s=e[n],a=s.length,o=i[n]=[],l,h=0;h<a;++h)(l=s[h])&&t.call(l,l.__data__,h,s)&&o.push(l);return new Ii(i,this._parents,this._name,this._id)}function lA(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,r=t._groups,i=e.length,n=r.length,s=Math.min(i,n),a=new Array(i),o=0;o<s;++o)for(var l=e[o],h=r[o],u=l.length,c=a[o]=new Array(u),f,d=0;d<u;++d)(f=l[d]||h[d])&&(c[d]=f);for(;o<i;++o)a[o]=e[o];return new Ii(a,this._parents,this._name,this._id)}function hA(t){return(t+"").trim().split(/^|\s+/).every(function(e){var r=e.indexOf(".");return r>=0&&(e=e.slice(0,r)),!e||e==="start"})}function uA(t,e,r){var i,n,s=hA(e)?qc:gi;return function(){var a=s(this,t),o=a.on;o!==i&&(n=(i=o).copy()).on(e,r),a.on=n}}function cA(t,e){var r=this._id;return arguments.length<2?Jr(this.node(),r).on.on(t):this.each(uA(r,t,e))}function dA(t){return function(){var e=this.parentNode;for(var r in this.__transition)if(+r!==t)return;e&&e.removeChild(this)}}function fA(){return this.on("end.remove",dA(this._id))}function pA(t){var e=this._name,r=this._id;typeof t!="function"&&(t=Oc(t));for(var i=this._groups,n=i.length,s=new Array(n),a=0;a<n;++a)for(var o=i[a],l=o.length,h=s[a]=new Array(l),u,c,f=0;f<l;++f)(u=o[f])&&(c=t.call(u,u.__data__,f,o))&&("__data__"in u&&(c.__data__=u.__data__),h[f]=c,sl(h[f],e,r,f,h,Jr(u,r)));return new Ii(s,this._parents,e,r)}function gA(t){var e=this._name,r=this._id;typeof t!="function"&&(t=fv(t));for(var i=this._groups,n=i.length,s=[],a=[],o=0;o<n;++o)for(var l=i[o],h=l.length,u,c=0;c<h;++c)if(u=l[c]){for(var f=t.call(u,u.__data__,c,l),d,_=Jr(u,r),v=0,m=f.length;v<m;++v)(d=f[v])&&sl(d,e,r,v,f,_);s.push(f),a.push(u)}return new Ii(s,a,e,r)}var mA=ea.prototype.constructor;function _A(){return new mA(this._groups,this._parents)}function vA(t,e){var r,i,n;return function(){var s=Jn(this,t),a=(this.style.removeProperty(t),Jn(this,t));return s===a?null:s===r&&a===i?n:n=e(r=s,i=a)}}function ey(t){return function(){this.style.removeProperty(t)}}function yA(t,e,r){var i,n=r+"",s;return function(){var a=Jn(this,t);return a===n?null:a===i?s:s=e(i=a,r)}}function xA(t,e,r){var i,n,s;return function(){var a=Jn(this,t),o=r(this),l=o+"";return o==null&&(l=o=(this.style.removeProperty(t),Jn(this,t))),a===l?null:a===i&&l===n?s:(n=l,s=e(i=a,o))}}function bA(t,e){var r,i,n,s="style."+e,a="end."+s,o;return function(){var l=gi(this,t),h=l.on,u=l.value[s]==null?o||(o=ey(e)):void 0;(h!==r||n!==u)&&(i=(r=h).copy()).on(a,n=u),l.on=i}}function wA(t,e,r){var i=(t+="")=="transform"?wC:Jv;return e==null?this.styleTween(t,vA(t,i)).on("end.style."+t,ey(t)):typeof e=="function"?this.styleTween(t,xA(t,i,Kc(this,"style."+t,e))).each(bA(this._id,t)):this.styleTween(t,yA(t,i,e),r).on("end.style."+t,null)}function TA(t,e,r){return function(i){this.style.setProperty(t,e.call(this,i),r)}}function SA(t,e,r){var i,n;function s(){var a=e.apply(this,arguments);return a!==n&&(i=(n=a)&&TA(t,a,r)),i}return s._value=e,s}function EA(t,e,r){var i="style."+(t+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(e==null)return this.tween(i,null);if(typeof e!="function")throw new Error;return this.tween(i,SA(t,e,r??""))}function CA(t){return function(){this.textContent=t}}function AA(t){return function(){var e=t(this);this.textContent=e??""}}function PA(t){return this.tween("text",typeof t=="function"?AA(Kc(this,"text",t)):CA(t==null?"":t+""))}function MA(t){return function(e){this.textContent=t.call(this,e)}}function RA(t){var e,r;function i(){var n=t.apply(this,arguments);return n!==r&&(e=(r=n)&&MA(n)),e}return i._value=t,i}function kA(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,RA(t))}function BA(){for(var t=this._name,e=this._id,r=ty(),i=this._groups,n=i.length,s=0;s<n;++s)for(var a=i[s],o=a.length,l,h=0;h<o;++h)if(l=a[h]){var u=Jr(l,e);sl(l,t,r,h,a,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Ii(i,this._parents,t,r)}function GA(){var t,e,r=this,i=r._id,n=r.size();return new Promise(function(s,a){var o={value:a},l={value:function(){--n===0&&s()}};r.each(function(){var h=gi(this,i),u=h.on;u!==t&&(e=(t=u).copy(),e._.cancel.push(o),e._.interrupt.push(o),e._.end.push(l)),h.on=e}),n===0&&s()})}var IA=0;function Ii(t,e,r,i){this._groups=t,this._parents=e,this._name=r,this._id=i}function OA(t){return ea().transition(t)}function ty(){return++IA}var Oi=ea.prototype;Ii.prototype=OA.prototype={constructor:Ii,select:pA,selectAll:gA,selectChild:Oi.selectChild,selectChildren:Oi.selectChildren,filter:oA,merge:lA,selection:_A,transition:BA,call:Oi.call,nodes:Oi.nodes,node:Oi.node,size:Oi.size,empty:Oi.empty,each:Oi.each,on:cA,attr:WC,attrTween:KC,style:wA,styleTween:EA,text:PA,textTween:kA,remove:fA,tween:UC,delay:JC,duration:rA,ease:nA,easeVarying:aA,end:GA,[Symbol.iterator]:Oi[Symbol.iterator]};function FA(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var DA={time:null,delay:0,duration:250,ease:FA};function UA(t,e){for(var r;!(r=t.__transition)||!(r=r[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return r}function LA(t){var e,r;t instanceof Ii?(e=t._id,t=t._name):(e=ty(),(r=DA).time=jc(),t=t==null?null:t+"");for(var i=this._groups,n=i.length,s=0;s<n;++s)for(var a=i[s],o=a.length,l,h=0;h<o;++h)(l=a[h])&&sl(l,t,e,h,a,r||UA(l,e));return new Ii(i,this._parents,t,e)}ea.prototype.interrupt=OC,ea.prototype.transition=LA;var{abs:$P,max:XP,min:YP}=Math;function ry(t){return[+t[0],+t[1]]}function NA(t){return[ry(t[0]),ry(t[1])]}var qP={name:"x",handles:["w","e"].map(Zc),input:function(t,e){return t==null?null:[[+t[0],e[0][1]],[+t[1],e[1][1]]]},output:function(t){return t&&[t[0][0],t[1][0]]}},KP={name:"y",handles:["n","s"].map(Zc),input:function(t,e){return t==null?null:[[e[0][0],+t[0]],[e[1][0],+t[1]]]},output:function(t){return t&&[t[0][1],t[1][1]]}},ZP={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(Zc),input:function(t){return t==null?null:NA(t)},output:function(t){return t}};function Zc(t){return{type:t}}function zA(t,e){var r,i=1;t==null&&(t=0),e==null&&(e=0);function n(){var s,a=r.length,o,l=0,h=0;for(s=0;s<a;++s)o=r[s],l+=o.x,h+=o.y;for(l=(l/a-t)*i,h=(h/a-e)*i,s=0;s<a;++s)o=r[s],o.x-=l,o.y-=h}return n.initialize=function(s){r=s},n.x=function(s){return arguments.length?(t=+s,n):t},n.y=function(s){return arguments.length?(e=+s,n):e},n.strength=function(s){return arguments.length?(i=+s,n):i},n}function HA(t){let e=+this._x.call(null,t),r=+this._y.call(null,t);return iy(this.cover(e,r),e,r,t)}function iy(t,e,r,i){if(isNaN(e)||isNaN(r))return t;var n,s=t._root,a={data:i},o=t._x0,l=t._y0,h=t._x1,u=t._y1,c,f,d,_,v,m,y,S;if(!s)return t._root=a,t;for(;s.length;)if((v=e>=(c=(o+h)/2))?o=c:h=c,(m=r>=(f=(l+u)/2))?l=f:u=f,n=s,!(s=s[y=m<<1|v]))return n[y]=a,t;if(d=+t._x.call(null,s.data),_=+t._y.call(null,s.data),e===d&&r===_)return a.next=s,n?n[y]=a:t._root=a,t;do n=n?n[y]=new Array(4):t._root=new Array(4),(v=e>=(c=(o+h)/2))?o=c:h=c,(m=r>=(f=(l+u)/2))?l=f:u=f;while((y=m<<1|v)===(S=(_>=f)<<1|d>=c));return n[S]=s,n[y]=a,t}function VA(t){var e,r,i=t.length,n,s,a=new Array(i),o=new Array(i),l=1/0,h=1/0,u=-1/0,c=-1/0;for(r=0;r<i;++r)isNaN(n=+this._x.call(null,e=t[r]))||isNaN(s=+this._y.call(null,e))||(a[r]=n,o[r]=s,n<l&&(l=n),n>u&&(u=n),s<h&&(h=s),s>c&&(c=s));if(l>u||h>c)return this;for(this.cover(l,h).cover(u,c),r=0;r<i;++r)iy(this,a[r],o[r],t[r]);return this}function jA(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var r=this._x0,i=this._y0,n=this._x1,s=this._y1;if(isNaN(r))n=(r=Math.floor(t))+1,s=(i=Math.floor(e))+1;else{for(var a=n-r||1,o=this._root,l,h;r>t||t>=n||i>e||e>=s;)switch(h=(e<i)<<1|t<r,l=new Array(4),l[h]=o,o=l,a*=2,h){case 0:n=r+a,s=i+a;break;case 1:r=n-a,s=i+a;break;case 2:n=r+a,i=s-a;break;case 3:r=n-a,i=s-a;break}this._root&&this._root.length&&(this._root=o)}return this._x0=r,this._y0=i,this._x1=n,this._y1=s,this}function WA(){var t=[];return this.visit(function(e){if(!e.length)do t.push(e.data);while(e=e.next)}),t}function $A(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function _r(t,e,r,i,n){this.node=t,this.x0=e,this.y0=r,this.x1=i,this.y1=n}function XA(t,e,r){var i,n=this._x0,s=this._y0,a,o,l,h,u=this._x1,c=this._y1,f=[],d=this._root,_,v;for(d&&f.push(new _r(d,n,s,u,c)),r==null?r=1/0:(n=t-r,s=e-r,u=t+r,c=e+r,r*=r);_=f.pop();)if(!(!(d=_.node)||(a=_.x0)>u||(o=_.y0)>c||(l=_.x1)<n||(h=_.y1)<s))if(d.length){var m=(a+l)/2,y=(o+h)/2;f.push(new _r(d[3],m,y,l,h),new _r(d[2],a,y,m,h),new _r(d[1],m,o,l,y),new _r(d[0],a,o,m,y)),(v=(e>=y)<<1|t>=m)&&(_=f[f.length-1],f[f.length-1]=f[f.length-1-v],f[f.length-1-v]=_)}else{var S=t-+this._x.call(null,d.data),P=e-+this._y.call(null,d.data),T=S*S+P*P;if(T<r){var z=Math.sqrt(r=T);n=t-z,s=e-z,u=t+z,c=e+z,i=d.data}}return i}function YA(t){if(isNaN(u=+this._x.call(null,t))||isNaN(c=+this._y.call(null,t)))return this;var e,r=this._root,i,n,s,a=this._x0,o=this._y0,l=this._x1,h=this._y1,u,c,f,d,_,v,m,y;if(!r)return this;if(r.length)for(;;){if((_=u>=(f=(a+l)/2))?a=f:l=f,(v=c>=(d=(o+h)/2))?o=d:h=d,e=r,!(r=r[m=v<<1|_]))return this;if(!r.length)break;(e[m+1&3]||e[m+2&3]||e[m+3&3])&&(i=e,y=m)}for(;r.data!==t;)if(n=r,!(r=r.next))return this;return(s=r.next)&&delete r.next,n?(s?n.next=s:delete n.next,this):e?(s?e[m]=s:delete e[m],(r=e[0]||e[1]||e[2]||e[3])&&r===(e[3]||e[2]||e[1]||e[0])&&!r.length&&(i?i[y]=r:this._root=r),this):(this._root=s,this)}function qA(t){for(var e=0,r=t.length;e<r;++e)this.remove(t[e]);return this}function KA(){return this._root}function ZA(){var t=0;return this.visit(function(e){if(!e.length)do++t;while(e=e.next)}),t}function QA(t){var e=[],r,i=this._root,n,s,a,o,l;for(i&&e.push(new _r(i,this._x0,this._y0,this._x1,this._y1));r=e.pop();)if(!t(i=r.node,s=r.x0,a=r.y0,o=r.x1,l=r.y1)&&i.length){var h=(s+o)/2,u=(a+l)/2;(n=i[3])&&e.push(new _r(n,h,u,o,l)),(n=i[2])&&e.push(new _r(n,s,u,h,l)),(n=i[1])&&e.push(new _r(n,h,a,o,u)),(n=i[0])&&e.push(new _r(n,s,a,h,u))}return this}function JA(t){var e=[],r=[],i;for(this._root&&e.push(new _r(this._root,this._x0,this._y0,this._x1,this._y1));i=e.pop();){var n=i.node;if(n.length){var s,a=i.x0,o=i.y0,l=i.x1,h=i.y1,u=(a+l)/2,c=(o+h)/2;(s=n[0])&&e.push(new _r(s,a,o,u,c)),(s=n[1])&&e.push(new _r(s,u,o,l,c)),(s=n[2])&&e.push(new _r(s,a,c,u,h)),(s=n[3])&&e.push(new _r(s,u,c,l,h))}r.push(i)}for(;i=r.pop();)t(i.node,i.x0,i.y0,i.x1,i.y1);return this}function eP(t){return t[0]}function tP(t){return arguments.length?(this._x=t,this):this._x}function rP(t){return t[1]}function iP(t){return arguments.length?(this._y=t,this):this._y}function Qc(t,e,r){var i=new Jc(e??eP,r??rP,NaN,NaN,NaN,NaN);return t==null?i:i.addAll(t)}function Jc(t,e,r,i,n,s){this._x=t,this._y=e,this._x0=r,this._y0=i,this._x1=n,this._y1=s,this._root=void 0}function ny(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}var vr=Qc.prototype=Jc.prototype;vr.copy=function(){var t=new Jc(this._x,this._y,this._x0,this._y0,this._x1,this._y1),e=this._root,r,i;if(!e)return t;if(!e.length)return t._root=ny(e),t;for(r=[{source:e,target:t._root=new Array(4)}];e=r.pop();)for(var n=0;n<4;++n)(i=e.source[n])&&(i.length?r.push({source:i,target:e.target[n]=new Array(4)}):e.target[n]=ny(i));return t},vr.add=HA,vr.addAll=VA,vr.cover=jA,vr.data=WA,vr.extent=$A,vr.find=XA,vr.remove=YA,vr.removeAll=qA,vr.root=KA,vr.size=ZA,vr.visit=QA,vr.visitAfter=JA,vr.x=tP,vr.y=iP;function ei(t){return function(){return t}}function en(t){return(t()-.5)*1e-6}function nP(t){return t.x+t.vx}function sP(t){return t.y+t.vy}function aP(t){var e,r,i,n=1,s=1;typeof t!="function"&&(t=ei(t==null?1:+t));function a(){for(var h,u=e.length,c,f,d,_,v,m,y=0;y<s;++y)for(c=Qc(e,nP,sP).visitAfter(o),h=0;h<u;++h)f=e[h],v=r[f.index],m=v*v,d=f.x+f.vx,_=f.y+f.vy,c.visit(S);function S(P,T,z,D,L){var ne=P.data,ue=P.r,re=v+ue;if(ne){if(ne.index>f.index){var oe=d-ne.x-ne.vx,Be=_-ne.y-ne.vy,Ze=oe*oe+Be*Be;Ze<re*re&&(oe===0&&(oe=en(i),Ze+=oe*oe),Be===0&&(Be=en(i),Ze+=Be*Be),Ze=(re-(Ze=Math.sqrt(Ze)))/Ze*n,f.vx+=(oe*=Ze)*(re=(ue*=ue)/(m+ue)),f.vy+=(Be*=Ze)*re,ne.vx-=oe*(re=1-re),ne.vy-=Be*re)}return}return T>d+re||D<d-re||z>_+re||L<_-re}}function o(h){if(h.data)return h.r=r[h.data.index];for(var u=h.r=0;u<4;++u)h[u]&&h[u].r>h.r&&(h.r=h[u].r)}function l(){if(e){var h,u=e.length,c;for(r=new Array(u),h=0;h<u;++h)c=e[h],r[c.index]=+t(c,h,e)}}return a.initialize=function(h,u){e=h,i=u,l()},a.iterations=function(h){return arguments.length?(s=+h,a):s},a.strength=function(h){return arguments.length?(n=+h,a):n},a.radius=function(h){return arguments.length?(t=typeof h=="function"?h:ei(+h),l(),a):t},a}function oP(t){return t.index}function sy(t,e){var r=t.get(e);if(!r)throw new Error("node not found: "+e);return r}function lP(t){var e=oP,r=c,i,n=ei(30),s,a,o,l,h,u=1;t==null&&(t=[]);function c(m){return 1/Math.min(o[m.source.index],o[m.target.index])}function f(m){for(var y=0,S=t.length;y<u;++y)for(var P=0,T,z,D,L,ne,ue,re;P<S;++P)T=t[P],z=T.source,D=T.target,L=D.x+D.vx-z.x-z.vx||en(h),ne=D.y+D.vy-z.y-z.vy||en(h),ue=Math.sqrt(L*L+ne*ne),ue=(ue-s[P])/ue*m*i[P],L*=ue,ne*=ue,D.vx-=L*(re=l[P]),D.vy-=ne*re,z.vx+=L*(re=1-re),z.vy+=ne*re}function d(){if(a){var m,y=a.length,S=t.length,P=new Map(a.map((z,D)=>[e(z,D,a),z])),T;for(m=0,o=new Array(y);m<S;++m)T=t[m],T.index=m,typeof T.source!="object"&&(T.source=sy(P,T.source)),typeof T.target!="object"&&(T.target=sy(P,T.target)),o[T.source.index]=(o[T.source.index]||0)+1,o[T.target.index]=(o[T.target.index]||0)+1;for(m=0,l=new Array(S);m<S;++m)T=t[m],l[m]=o[T.source.index]/(o[T.source.index]+o[T.target.index]);i=new Array(S),_(),s=new Array(S),v()}}function _(){if(a)for(var m=0,y=t.length;m<y;++m)i[m]=+r(t[m],m,t)}function v(){if(a)for(var m=0,y=t.length;m<y;++m)s[m]=+n(t[m],m,t)}return f.initialize=function(m,y){a=m,h=y,d()},f.links=function(m){return arguments.length?(t=m,d(),f):t},f.id=function(m){return arguments.length?(e=m,f):e},f.iterations=function(m){return arguments.length?(u=+m,f):u},f.strength=function(m){return arguments.length?(r=typeof m=="function"?m:ei(+m),_(),f):r},f.distance=function(m){return arguments.length?(n=typeof m=="function"?m:ei(+m),v(),f):n},f}function hP(){let t=1;return()=>(t=(1664525*t+1013904223)%4294967296)/4294967296}function uP(t){return t.x}function cP(t){return t.y}var dP=10,fP=Math.PI*(3-Math.sqrt(5));function pP(t){var e,r=1,i=.001,n=1-Math.pow(i,1/300),s=0,a=.6,o=new Map,l=Wc(c),h=Vo("tick","end"),u=hP();t==null&&(t=[]);function c(){f(),h.call("tick",e),r<i&&(l.stop(),h.call("end",e))}function f(v){var m,y=t.length,S;v===void 0&&(v=1);for(var P=0;P<v;++P)for(r+=(s-r)*n,o.forEach(function(T){T(r)}),m=0;m<y;++m)S=t[m],S.fx==null?S.x+=S.vx*=a:(S.x=S.fx,S.vx=0),S.fy==null?S.y+=S.vy*=a:(S.y=S.fy,S.vy=0);return e}function d(){for(var v=0,m=t.length,y;v<m;++v){if(y=t[v],y.index=v,y.fx!=null&&(y.x=y.fx),y.fy!=null&&(y.y=y.fy),isNaN(y.x)||isNaN(y.y)){var S=dP*Math.sqrt(.5+v),P=v*fP;y.x=S*Math.cos(P),y.y=S*Math.sin(P)}(isNaN(y.vx)||isNaN(y.vy))&&(y.vx=y.vy=0)}}function _(v){return v.initialize&&v.initialize(t,u),v}return d(),e={tick:f,restart:function(){return l.restart(c),e},stop:function(){return l.stop(),e},nodes:function(v){return arguments.length?(t=v,d(),o.forEach(_),e):t},alpha:function(v){return arguments.length?(r=+v,e):r},alphaMin:function(v){return arguments.length?(i=+v,e):i},alphaDecay:function(v){return arguments.length?(n=+v,e):+n},alphaTarget:function(v){return arguments.length?(s=+v,e):s},velocityDecay:function(v){return arguments.length?(a=1-v,e):1-a},randomSource:function(v){return arguments.length?(u=v,o.forEach(_),e):u},force:function(v,m){return arguments.length>1?(m==null?o.delete(v):o.set(v,_(m)),e):o.get(v)},find:function(v,m,y){var S=0,P=t.length,T,z,D,L,ne;for(y==null?y=1/0:y*=y,S=0;S<P;++S)L=t[S],T=v-L.x,z=m-L.y,D=T*T+z*z,D<y&&(ne=L,y=D);return ne},on:function(v,m){return arguments.length>1?(h.on(v,m),e):h.on(v)}}}function gP(){var t,e,r,i,n=ei(-30),s,a=1,o=1/0,l=.81;function h(d){var _,v=t.length,m=Qc(t,uP,cP).visitAfter(c);for(i=d,_=0;_<v;++_)e=t[_],m.visit(f)}function u(){if(t){var d,_=t.length,v;for(s=new Array(_),d=0;d<_;++d)v=t[d],s[v.index]=+n(v,d,t)}}function c(d){var _=0,v,m,y=0,S,P,T;if(d.length){for(S=P=T=0;T<4;++T)(v=d[T])&&(m=Math.abs(v.value))&&(_+=v.value,y+=m,S+=m*v.x,P+=m*v.y);d.x=S/y,d.y=P/y}else{v=d,v.x=v.data.x,v.y=v.data.y;do _+=s[v.data.index];while(v=v.next)}d.value=_}function f(d,_,v,m){if(!d.value)return!0;var y=d.x-e.x,S=d.y-e.y,P=m-_,T=y*y+S*S;if(P*P/l<T)return T<o&&(y===0&&(y=en(r),T+=y*y),S===0&&(S=en(r),T+=S*S),T<a&&(T=Math.sqrt(a*T)),e.vx+=y*d.value*i/T,e.vy+=S*d.value*i/T),!0;if(!(d.length||T>=o)){(d.data!==e||d.next)&&(y===0&&(y=en(r),T+=y*y),S===0&&(S=en(r),T+=S*S),T<a&&(T=Math.sqrt(a*T)));do d.data!==e&&(P=s[d.data.index]*i/T,e.vx+=y*P,e.vy+=S*P);while(d=d.next)}}return h.initialize=function(d,_){t=d,r=_,u()},h.strength=function(d){return arguments.length?(n=typeof d=="function"?d:ei(+d),u(),h):n},h.distanceMin=function(d){return arguments.length?(a=d*d,h):Math.sqrt(a)},h.distanceMax=function(d){return arguments.length?(o=d*d,h):Math.sqrt(o)},h.theta=function(d){return arguments.length?(l=d*d,h):Math.sqrt(l)},h}function mP(t,e,r){var i,n=ei(.1),s,a;typeof t!="function"&&(t=ei(+t)),e==null&&(e=0),r==null&&(r=0);function o(h){for(var u=0,c=i.length;u<c;++u){var f=i[u],d=f.x-e||1e-6,_=f.y-r||1e-6,v=Math.sqrt(d*d+_*_),m=(a[u]-v)*s[u]*h/v;f.vx+=d*m,f.vy+=_*m}}function l(){if(i){var h,u=i.length;for(s=new Array(u),a=new Array(u),h=0;h<u;++h)a[h]=+t(i[h],h,i),s[h]=isNaN(a[h])?0:+n(i[h],h,i)}}return o.initialize=function(h){i=h,l()},o.strength=function(h){return arguments.length?(n=typeof h=="function"?h:ei(+h),l(),o):n},o.radius=function(h){return arguments.length?(t=typeof h=="function"?h:ei(+h),l(),o):t},o.x=function(h){return arguments.length?(e=+h,o):e},o.y=function(h){return arguments.length?(r=+h,o):r},o}var ol=t=>()=>t;function _P(t,{sourceEvent:e,target:r,transform:i,dispatch:n}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:n}})}function Fi(t,e,r){this.k=t,this.x=e,this.y=r}Fi.prototype={constructor:Fi,scale:function(t){return t===1?this:new Fi(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new Fi(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var ll=new Fi(1,0,0);vP.prototype=Fi.prototype;function vP(t){for(;!t.__zoom;)if(!(t=t.parentNode))return ll;return t.__zoom}function ed(t){t.stopImmediatePropagation()}function ua(t){t.preventDefault(),t.stopImmediatePropagation()}function yP(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function xP(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function ay(){return this.__zoom||ll}function bP(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function wP(){return navigator.maxTouchPoints||"ontouchstart"in this}function TP(t,e,r){var i=t.invertX(e[0][0])-r[0][0],n=t.invertX(e[1][0])-r[1][0],s=t.invertY(e[0][1])-r[0][1],a=t.invertY(e[1][1])-r[1][1];return t.translate(n>i?(i+n)/2:Math.min(0,i)||Math.max(0,n),a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a))}function SP(){var t=yP,e=xP,r=TP,i=bP,n=wP,s=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],o=250,l=AC,h=Vo("start","zoom","end"),u,c,f,d=500,_=150,v=0,m=10;function y(I){I.property("__zoom",ay).on("wheel.zoom",ne,{passive:!1}).on("mousedown.zoom",ue).on("dblclick.zoom",re).filter(n).on("touchstart.zoom",oe).on("touchmove.zoom",Be).on("touchend.zoom touchcancel.zoom",Ze).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(I,Me,U,J){var je=I.selection?I.selection():I;je.property("__zoom",ay),I!==je?z(I,Me,U,J):je.interrupt().each(function(){D(this,arguments).event(J).start().zoom(null,typeof Me=="function"?Me.apply(this,arguments):Me).end()})},y.scaleBy=function(I,Me,U,J){y.scaleTo(I,function(){var je=this.__zoom.k,Se=typeof Me=="function"?Me.apply(this,arguments):Me;return je*Se},U,J)},y.scaleTo=function(I,Me,U,J){y.transform(I,function(){var je=e.apply(this,arguments),Se=this.__zoom,De=U==null?T(je):typeof U=="function"?U.apply(this,arguments):U,dt=Se.invert(De),Ct=typeof Me=="function"?Me.apply(this,arguments):Me;return r(P(S(Se,Ct),De,dt),je,a)},U,J)},y.translateBy=function(I,Me,U,J){y.transform(I,function(){return r(this.__zoom.translate(typeof Me=="function"?Me.apply(this,arguments):Me,typeof U=="function"?U.apply(this,arguments):U),e.apply(this,arguments),a)},null,J)},y.translateTo=function(I,Me,U,J,je){y.transform(I,function(){var Se=e.apply(this,arguments),De=this.__zoom,dt=J==null?T(Se):typeof J=="function"?J.apply(this,arguments):J;return r(ll.translate(dt[0],dt[1]).scale(De.k).translate(typeof Me=="function"?-Me.apply(this,arguments):-Me,typeof U=="function"?-U.apply(this,arguments):-U),Se,a)},J,je)};function S(I,Me){return Me=Math.max(s[0],Math.min(s[1],Me)),Me===I.k?I:new Fi(Me,I.x,I.y)}function P(I,Me,U){var J=Me[0]-U[0]*I.k,je=Me[1]-U[1]*I.k;return J===I.x&&je===I.y?I:new Fi(I.k,J,je)}function T(I){return[(+I[0][0]+ +I[1][0])/2,(+I[0][1]+ +I[1][1])/2]}function z(I,Me,U,J){I.on("start.zoom",function(){D(this,arguments).event(J).start()}).on("interrupt.zoom end.zoom",function(){D(this,arguments).event(J).end()}).tween("zoom",function(){var je=this,Se=arguments,De=D(je,Se).event(J),dt=e.apply(je,Se),Ct=U==null?T(dt):typeof U=="function"?U.apply(je,Se):U,qt=Math.max(dt[1][0]-dt[0][0],dt[1][1]-dt[0][1]),Yt=je.__zoom,ir=typeof Me=="function"?Me.apply(je,Se):Me,hr=l(Yt.invert(Ct).concat(qt/Yt.k),ir.invert(Ct).concat(qt/ir.k));return function(ur){if(ur===1)ur=ir;else{var Kt=hr(ur),Er=qt/Kt[2];ur=new Fi(Er,Ct[0]-Kt[0]*Er,Ct[1]-Kt[1]*Er)}De.zoom(null,ur)}})}function D(I,Me,U){return!U&&I.__zooming||new L(I,Me)}function L(I,Me){this.that=I,this.args=Me,this.active=0,this.sourceEvent=null,this.extent=e.apply(I,Me),this.taps=0}L.prototype={event:function(I){return I&&(this.sourceEvent=I),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(I,Me){return this.mouse&&I!=="mouse"&&(this.mouse[1]=Me.invert(this.mouse[0])),this.touch0&&I!=="touch"&&(this.touch0[1]=Me.invert(this.touch0[0])),this.touch1&&I!=="touch"&&(this.touch1[1]=Me.invert(this.touch1[0])),this.that.__zoom=Me,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(I){var Me=Zr(this.that).datum();h.call(I,this.that,new _P(I,{sourceEvent:this.sourceEvent,target:y,type:I,transform:this.that.__zoom,dispatch:h}),Me)}};function ne(I,...Me){if(!t.apply(this,arguments))return;var U=D(this,Me).event(I),J=this.__zoom,je=Math.max(s[0],Math.min(s[1],J.k*Math.pow(2,i.apply(this,arguments)))),Se=Gi(I);if(U.wheel)(U.mouse[0][0]!==Se[0]||U.mouse[0][1]!==Se[1])&&(U.mouse[1]=J.invert(U.mouse[0]=Se)),clearTimeout(U.wheel);else{if(J.k===je)return;U.mouse=[Se,J.invert(Se)],al(this),U.start()}ua(I),U.wheel=setTimeout(De,_),U.zoom("mouse",r(P(S(J,je),U.mouse[0],U.mouse[1]),U.extent,a));function De(){U.wheel=null,U.end()}}function ue(I,...Me){if(f||!t.apply(this,arguments))return;var U=I.currentTarget,J=D(this,Me,!0).event(I),je=Zr(I.view).on("mousemove.zoom",Ct,!0).on("mouseup.zoom",qt,!0),Se=Gi(I,U),De=I.clientX,dt=I.clientY;Ev(I.view),ed(I),J.mouse=[Se,this.__zoom.invert(Se)],al(this),J.start();function Ct(Yt){if(ua(Yt),!J.moved){var ir=Yt.clientX-De,hr=Yt.clientY-dt;J.moved=ir*ir+hr*hr>v}J.event(Yt).zoom("mouse",r(P(J.that.__zoom,J.mouse[0]=Gi(Yt,U),J.mouse[1]),J.extent,a))}function qt(Yt){je.on("mousemove.zoom mouseup.zoom",null),Cv(Yt.view,J.moved),ua(Yt),J.event(Yt).end()}}function re(I,...Me){if(t.apply(this,arguments)){var U=this.__zoom,J=Gi(I.changedTouches?I.changedTouches[0]:I,this),je=U.invert(J),Se=U.k*(I.shiftKey?.5:2),De=r(P(S(U,Se),J,je),e.apply(this,Me),a);ua(I),o>0?Zr(this).transition().duration(o).call(z,De,J,I):Zr(this).call(y.transform,De,J,I)}}function oe(I,...Me){if(t.apply(this,arguments)){var U=I.touches,J=U.length,je=D(this,Me,I.changedTouches.length===J).event(I),Se,De,dt,Ct;for(ed(I),De=0;De<J;++De)dt=U[De],Ct=Gi(dt,this),Ct=[Ct,this.__zoom.invert(Ct),dt.identifier],je.touch0?!je.touch1&&je.touch0[2]!==Ct[2]&&(je.touch1=Ct,je.taps=0):(je.touch0=Ct,Se=!0,je.taps=1+!!u);u&&(u=clearTimeout(u)),Se&&(je.taps<2&&(c=Ct[0],u=setTimeout(function(){u=null},d)),al(this),je.start())}}function Be(I,...Me){if(this.__zooming){var U=D(this,Me).event(I),J=I.changedTouches,je=J.length,Se,De,dt,Ct;for(ua(I),Se=0;Se<je;++Se)De=J[Se],dt=Gi(De,this),U.touch0&&U.touch0[2]===De.identifier?U.touch0[0]=dt:U.touch1&&U.touch1[2]===De.identifier&&(U.touch1[0]=dt);if(De=U.that.__zoom,U.touch1){var qt=U.touch0[0],Yt=U.touch0[1],ir=U.touch1[0],hr=U.touch1[1],ur=(ur=ir[0]-qt[0])*ur+(ur=ir[1]-qt[1])*ur,Kt=(Kt=hr[0]-Yt[0])*Kt+(Kt=hr[1]-Yt[1])*Kt;De=S(De,Math.sqrt(ur/Kt)),dt=[(qt[0]+ir[0])/2,(qt[1]+ir[1])/2],Ct=[(Yt[0]+hr[0])/2,(Yt[1]+hr[1])/2]}else if(U.touch0)dt=U.touch0[0],Ct=U.touch0[1];else return;U.zoom("touch",r(P(De,dt,Ct),U.extent,a))}}function Ze(I,...Me){if(this.__zooming){var U=D(this,Me).event(I),J=I.changedTouches,je=J.length,Se,De;for(ed(I),f&&clearTimeout(f),f=setTimeout(function(){f=null},d),Se=0;Se<je;++Se)De=J[Se],U.touch0&&U.touch0[2]===De.identifier?delete U.touch0:U.touch1&&U.touch1[2]===De.identifier&&delete U.touch1;if(U.touch1&&!U.touch0&&(U.touch0=U.touch1,delete U.touch1),U.touch0)U.touch0[1]=this.__zoom.invert(U.touch0[0]);else if(U.end(),U.taps===2&&(De=Gi(De,this),Math.hypot(c[0]-De[0],c[1]-De[1])<m)){var dt=Zr(this).on("dblclick.zoom");dt&&dt.apply(this,arguments)}}}return y.wheelDelta=function(I){return arguments.length?(i=typeof I=="function"?I:ol(+I),y):i},y.filter=function(I){return arguments.length?(t=typeof I=="function"?I:ol(!!I),y):t},y.touchable=function(I){return arguments.length?(n=typeof I=="function"?I:ol(!!I),y):n},y.extent=function(I){return arguments.length?(e=typeof I=="function"?I:ol([[+I[0][0],+I[0][1]],[+I[1][0],+I[1][1]]]),y):e},y.scaleExtent=function(I){return arguments.length?(s[0]=+I[0],s[1]=+I[1],y):[s[0],s[1]]},y.translateExtent=function(I){return arguments.length?(a[0][0]=+I[0][0],a[1][0]=+I[1][0],a[0][1]=+I[0][1],a[1][1]=+I[1][1],y):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},y.constrain=function(I){return arguments.length?(r=I,y):r},y.duration=function(I){return arguments.length?(o=+I,y):o},y.interpolate=function(I){return arguments.length?(l=I,y):l},y.on=function(){var I=h.on.apply(h,arguments);return I===h?y:I},y.clickDistance=function(I){return arguments.length?(v=(I=+I)*I,y):Math.sqrt(v)},y.tapDistance=function(I){return arguments.length?(m=+I,y):m},y}X();var EP={extension:{type:M.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(()=>(Fw(),Ow))}};X();var CP={extension:{type:M.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(Uw(),Dw))}};X(),Ql(),$l(),X(),Jt(),Co();var td;function AP(t){return td!==void 0||(td=(()=>{let e={stencil:!0,failIfMajorPerformanceCaveat:t??Xs.defaultOptions.failIfMajorPerformanceCaveat};try{if(!Dt.get().getWebGLRenderingContext())return!1;let r=Dt.get().createCanvas().getContext("webgl",e),i=!!r?.getContextAttributes()?.stencil;if(r){let n=r.getExtension("WEBGL_lose_context");n&&n.loseContext()}return r=null,i}catch{return!1}})()),td}Jt();var rd;async function PP(t={}){return rd!==void 0||(rd=await(async()=>{let e=Dt.get().getNavigator().gpu;if(!e)return!1;try{return await(await e.requestAdapter(t)).requestDevice(),!0}catch{return!1}})()),rd}Co();var oy=["webgl","webgpu","canvas"];async function MP(t){let e=[];t.preference?(e.push(t.preference),oy.forEach(s=>{s!==t.preference&&e.push(s)})):e=oy.slice();let r,i={};for(let s=0;s<e.length;s++){let a=e[s];if(a==="webgpu"&&await PP()){let{WebGPURenderer:o}=await Promise.resolve().then(()=>(iS(),__));r=o,i={...t,...t.webgpu};break}else if(a==="webgl"&&AP(t.failIfMajorPerformanceCaveat??Xs.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:o}=await Promise.resolve().then(()=>(uE(),nv));r=o,i={...t,...t.webgl};break}else if(a==="canvas")throw i={...t},new Error("CanvasRenderer is not yet implemented")}if(delete i.webgpu,delete i.webgl,!r)throw new Error("No available renderer for the current environment");let n=new r;return await n.init(i),n}si(),Mm(),Mt();var ly=class md{constructor(...e){this.stage=new gr,e[0]!==void 0&&Xe(nt,"Application constructor options are deprecated, please use Application.init() instead.")}async init(e){e={...e},this.renderer=await MP(e),md._plugins.forEach(r=>{r.init.call(this,e)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return Xe(nt,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(e=!1,r=!1){let i=md._plugins.slice(0);i.reverse(),i.forEach(n=>{n.destroy.call(this)}),this.stage.destroy(r),this.stage=null,this.renderer.destroy(e),this.renderer=null}};ly._plugins=[];var hy=ly;we.handleByList(M.Application,hy._plugins),we.add(Cu),Rn(),ri(),Mt(),Ul();var RP=class extends Pa{constructor(t,e){let{text:r,resolution:i,style:n,anchor:s,width:a,height:o,roundPixels:l,...h}=t;super({...h}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=r??"",this.style=n,this.resolution=i??null,this.allowChildren=!1,this._anchor=new Et({_onUpdate:()=>{this.onViewUpdate()}}),s&&(this.anchor=s),this.roundPixels=l??!1,a!==void 0&&(this.width=a),o!==void 0&&(this.height=o)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate())}get text(){return this._text}set resolution(t){this._autoResolution=t===null,this._resolution=t,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(t){t||(t={}),this._style?.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height)}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this.bounds.width),e!==void 0&&this._setHeight(e,this.bounds.height)}containsPoint(t){let e=this.bounds.width,r=this.bounds.height,i=-e*this.anchor.x,n=0;return t.x>=i&&t.x<=i+e&&(n=-r*this.anchor.y,t.y>=n&&t.y<=n+r)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t?.style)&&this._style.destroy(t),this._style=null,this._text=null}};function kP(t,e){let r=t[0]??{};return(typeof r=="string"||t[1])&&(Xe(nt,`use new ${e}({ text: "hi!", style }) instead`),r={text:r,style:t[1]}),r}Pg(),Ns(),Us();var BP=class extends RP{constructor(...t){let e=kP(t,"Text");super(e,di),this.renderPipeId="text",e.textureStyle&&(this.textureStyle=e.textureStyle instanceof ni?e.textureStyle:new ni(e.textureStyle))}updateBounds(){let t=this._bounds,e=this._anchor,r=0,i=0;if(this._style.trim){let{frame:n,canvasAndContext:s}=Yn.getCanvasAndContext({text:this.text,style:this._style,resolution:1});Yn.returnCanvasAndContext(s),r=n.width,i=n.height}else{let n=Hr.measureText(this._text,this._style);r=n.width,i=n.height}t.minX=-e._x*r,t.maxX=t.minX+r,t.minY=-e._y*i,t.maxY=t.minY+i}};Vp(),df(),si(),Rg(),kt(),we.add(EP,CP);var ca=Object.freeze({Linear:Object.freeze({None:function(t){return t},In:function(t){return t},Out:function(t){return t},InOut:function(t){return t}}),Quadratic:Object.freeze({In:function(t){return t*t},Out:function(t){return t*(2-t)},InOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}}),Cubic:Object.freeze({In:function(t){return t*t*t},Out:function(t){return--t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}}),Quartic:Object.freeze({In:function(t){return t*t*t*t},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}}),Quintic:Object.freeze({In:function(t){return t*t*t*t*t},Out:function(t){return--t*t*t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}}),Sinusoidal:Object.freeze({In:function(t){return 1-Math.sin((1-t)*Math.PI/2)},Out:function(t){return Math.sin(t*Math.PI/2)},InOut:function(t){return .5*(1-Math.sin(Math.PI*(.5-t)))}}),Exponential:Object.freeze({In:function(t){return t===0?0:Math.pow(1024,t-1)},Out:function(t){return t===1?1:1-Math.pow(2,-10*t)},InOut:function(t){return t===0?0:t===1?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(-Math.pow(2,-10*(t-1))+2)}}),Circular:Object.freeze({In:function(t){return 1-Math.sqrt(1-t*t)},Out:function(t){return Math.sqrt(1- --t*t)},InOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}}),Elastic:Object.freeze({In:function(t){return t===0?0:t===1?1:-Math.pow(2,10*(t-1))*Math.sin((t-1.1)*5*Math.PI)},Out:function(t){return t===0?0:t===1?1:Math.pow(2,-10*t)*Math.sin((t-.1)*5*Math.PI)+1},InOut:function(t){return t===0?0:t===1?1:(t*=2,t<1?-.5*Math.pow(2,10*(t-1))*Math.sin((t-1.1)*5*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin((t-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(t){var e=1.70158;return t===1?1:t*t*((e+1)*t-e)},Out:function(t){var e=1.70158;return t===0?0:--t*t*((e+1)*t+e)+1},InOut:function(t){var e=2.5949095;return(t*=2)<1?.5*(t*t*((e+1)*t-e)):.5*((t-=2)*t*((e+1)*t+e)+2)}}),Bounce:Object.freeze({In:function(t){return 1-ca.Bounce.Out(1-t)},Out:function(t){return t<.36363636363636365?7.5625*t*t:t<.7272727272727273?7.5625*(t-=.5454545454545454)*t+.75:t<.9090909090909091?7.5625*(t-=.8181818181818182)*t+.9375:7.5625*(t-=.9545454545454546)*t+.984375},InOut:function(t){return t<.5?ca.Bounce.In(t*2)*.5:ca.Bounce.Out(t*2-1)*.5+.5}}),generatePow:function(t){return t===void 0&&(t=4),t=t<Number.EPSILON?Number.EPSILON:t,t=t>1e4?1e4:t,{In:function(e){return Math.pow(e,t)},Out:function(e){return 1-Math.pow(1-e,t)},InOut:function(e){return e<.5?Math.pow(e*2,t)/2:(1-Math.pow(2-e*2,t))/2+.5}}}}),da=function(){return performance.now()},hl=function(){function t(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,e)}return t.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map(function(r){return e._tweens[r]})},t.prototype.removeAll=function(){this._tweens={}},t.prototype.add=function(){for(var e,r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];for(var n=0,s=r;n<s.length;n++){var a=s[n];(e=a._group)===null||e===void 0||e.remove(a),a._group=this,this._tweens[a.getId()]=a,this._tweensAddedDuringUpdate[a.getId()]=a}},t.prototype.remove=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];for(var i=0,n=e;i<n.length;i++){var s=n[i];s._group=void 0,delete this._tweens[s.getId()],delete this._tweensAddedDuringUpdate[s.getId()]}},t.prototype.allStopped=function(){return this.getAll().every(function(e){return!e.isPlaying()})},t.prototype.update=function(e,r){e===void 0&&(e=da()),r===void 0&&(r=!0);var i=Object.keys(this._tweens);if(i.length!==0)for(;i.length>0;){this._tweensAddedDuringUpdate={};for(var n=0;n<i.length;n++){var s=this._tweens[i[n]],a=!r;s&&s.update(e,a)===!1&&!r&&this.remove(s)}i=Object.keys(this._tweensAddedDuringUpdate)}},t}(),is={Linear:function(t,e){var r=t.length-1,i=r*e,n=Math.floor(i),s=is.Utils.Linear;return e<0?s(t[0],t[1],i):e>1?s(t[r],t[r-1],r-i):s(t[n],t[n+1>r?r:n+1],i-n)},Bezier:function(t,e){for(var r=0,i=t.length-1,n=Math.pow,s=is.Utils.Bernstein,a=0;a<=i;a++)r+=n(1-e,i-a)*n(e,a)*t[a]*s(i,a);return r},CatmullRom:function(t,e){var r=t.length-1,i=r*e,n=Math.floor(i),s=is.Utils.CatmullRom;return t[0]===t[r]?(e<0&&(n=Math.floor(i=r*(1+e))),s(t[(n-1+r)%r],t[n],t[(n+1)%r],t[(n+2)%r],i-n)):e<0?t[0]-(s(t[0],t[0],t[1],t[1],-i)-t[0]):e>1?t[r]-(s(t[r],t[r],t[r-1],t[r-1],i-r)-t[r]):s(t[n?n-1:0],t[n],t[r<n+1?r:n+1],t[r<n+2?r:n+2],i-n)},Utils:{Linear:function(t,e,r){return(e-t)*r+t},Bernstein:function(t,e){var r=is.Utils.Factorial;return r(t)/r(e)/r(t-e)},Factorial:function(){var t=[1];return function(e){var r=1;if(t[e])return t[e];for(var i=e;i>1;i--)r*=i;return t[e]=r,r}}(),CatmullRom:function(t,e,r,i,n){var s=(r-t)*.5,a=(i-e)*.5,o=n*n,l=n*o;return(2*e-2*r+s+a)*l+(-3*e+3*r-2*s-a)*o+s*n+e}}},uy=function(){function t(){}return t.nextId=function(){return t._nextId++},t._nextId=0,t}(),id=new hl,ul=function(){function t(e,r){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=ca.Linear.None,this._interpolationFunction=is.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=uy.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=e,typeof r=="object"?(this._group=r,r.add(this)):r===!0&&(this._group=id,id.add(this))}return t.prototype.getId=function(){return this._id},t.prototype.isPlaying=function(){return this._isPlaying},t.prototype.isPaused=function(){return this._isPaused},t.prototype.getDuration=function(){return this._duration},t.prototype.to=function(e,r){if(r===void 0&&(r=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=e,this._propertiesAreSetUp=!1,this._duration=r<0?0:r,this},t.prototype.duration=function(e){return e===void 0&&(e=1e3),this._duration=e<0?0:e,this},t.prototype.dynamic=function(e){return e===void 0&&(e=!1),this._isDynamic=e,this},t.prototype.start=function(e,r){if(e===void 0&&(e=da()),r===void 0&&(r=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var i in this._valuesStartRepeat)this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e,this._startTime+=this._delayTime,!this._propertiesAreSetUp||r){if(this._propertiesAreSetUp=!0,!this._isDynamic){var n={};for(var s in this._valuesEnd)n[s]=this._valuesEnd[s];this._valuesEnd=n}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,r)}return this},t.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},t.prototype._setupProperties=function(e,r,i,n,s){for(var a in i){var o=e[a],l=Array.isArray(o),h=l?"array":typeof o,u=!l&&Array.isArray(i[a]);if(!(h==="undefined"||h==="function")){if(u){var c=i[a];if(c.length===0)continue;for(var f=[o],d=0,_=c.length;d<_;d+=1){var v=this._handleRelativeValue(o,c[d]);if(isNaN(v)){u=!1,console.warn("Found invalid interpolation list. Skipping.");break}f.push(v)}u&&(i[a]=f)}if((h==="object"||l)&&o&&!u){r[a]=l?[]:{};var m=o;for(var y in m)r[a][y]=m[y];n[a]=l?[]:{};var c=i[a];if(!this._isDynamic){var S={};for(var y in c)S[y]=c[y];i[a]=c=S}this._setupProperties(m,r[a],c,n[a],s)}else(typeof r[a]>"u"||s)&&(r[a]=o),l||(r[a]*=1),u?n[a]=i[a].slice().reverse():n[a]=r[a]||0}}},t.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},t.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},t.prototype.pause=function(e){return e===void 0&&(e=da()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this)},t.prototype.resume=function(e){return e===void 0&&(e=da()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this)},t.prototype.stopChainedTweens=function(){for(var e=0,r=this._chainedTweens.length;e<r;e++)this._chainedTweens[e].stop();return this},t.prototype.group=function(e){return e?(e.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},t.prototype.remove=function(){var e;return(e=this._group)===null||e===void 0||e.remove(this),this},t.prototype.delay=function(e){return e===void 0&&(e=0),this._delayTime=e,this},t.prototype.repeat=function(e){return e===void 0&&(e=0),this._initialRepeat=e,this._repeat=e,this},t.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},t.prototype.yoyo=function(e){return e===void 0&&(e=!1),this._yoyo=e,this},t.prototype.easing=function(e){return e===void 0&&(e=ca.Linear.None),this._easingFunction=e,this},t.prototype.interpolation=function(e){return e===void 0&&(e=is.Linear),this._interpolationFunction=e,this},t.prototype.chain=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return this._chainedTweens=e,this},t.prototype.onStart=function(e){return this._onStartCallback=e,this},t.prototype.onEveryStart=function(e){return this._onEveryStartCallback=e,this},t.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},t.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},t.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},t.prototype.onStop=function(e){return this._onStopCallback=e,this},t.prototype.update=function(e,r){var i=this,n;if(e===void 0&&(e=da()),r===void 0&&(r=t.autoStartOnUpdate),this._isPaused)return!0;var s;if(!this._goToEnd&&!this._isPlaying)if(r)this.start(e,!0);else return!1;if(this._goToEnd=!1,e<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var a=e-this._startTime,o=this._duration+((n=this._repeatDelayTime)!==null&&n!==void 0?n:this._delayTime),l=this._duration+this._repeat*o,h=function(){if(i._duration===0||a>l)return 1;var v=Math.trunc(a/o),m=a-v*o,y=Math.min(m/i._duration,1);return y===0&&a===i._duration?1:y},u=h(),c=this._easingFunction(u);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,c),this._onUpdateCallback&&this._onUpdateCallback(this._object,u),this._duration===0||a>=this._duration)if(this._repeat>0){var f=Math.min(Math.trunc((a-this._duration)/o)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=f);for(s in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[s]=="string"&&(this._valuesStartRepeat[s]=this._valuesStartRepeat[s]+parseFloat(this._valuesEnd[s])),this._yoyo&&this._swapEndStartRepeatValues(s),this._valuesStart[s]=this._valuesStartRepeat[s];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=o*f,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var d=0,_=this._chainedTweens.length;d<_;d++)this._chainedTweens[d].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},t.prototype._updateProperties=function(e,r,i,n){for(var s in i)if(r[s]!==void 0){var a=r[s]||0,o=i[s],l=Array.isArray(e[s]),h=Array.isArray(o),u=!l&&h;u?e[s]=this._interpolationFunction(o,n):typeof o=="object"&&o?this._updateProperties(e[s],a,o,n):(o=this._handleRelativeValue(a,o),typeof o=="number"&&(e[s]=a+(o-a)*n))}},t.prototype._handleRelativeValue=function(e,r){return typeof r!="string"?r:r.charAt(0)==="+"||r.charAt(0)==="-"?e+parseFloat(r):parseFloat(r)},t.prototype._swapEndStartRepeatValues=function(e){var r=this._valuesStartRepeat[e],i=this._valuesEnd[e];typeof i=="string"?this._valuesStartRepeat[e]=this._valuesStartRepeat[e]+parseFloat(i):this._valuesStartRepeat[e]=this._valuesEnd[e],this._valuesEnd[e]=r},t.autoStartOnUpdate=!1,t}(),QP=uy.nextId,mi=id,JP=mi.getAll.bind(mi),eM=mi.removeAll.bind(mi),tM=mi.add.bind(mi),rM=mi.remove.bind(mi),iM=mi.update.bind(mi);function GP(t,e){if(!t)return;function r(n){n.target===this&&(n.preventDefault(),n.stopPropagation(),e())}function i(n){n.key.startsWith("Esc")&&(n.preventDefault(),e())}t?.addEventListener("click",r),window.addCleanup(()=>t?.removeEventListener("click",r)),document.addEventListener("keydown",i),window.addCleanup(()=>document.removeEventListener("keydown",i))}function IP(t){for(;t.firstChild;)t.removeChild(t.firstChild)}var nM=Object.hasOwnProperty,OP=nr(cE(),1),sM=(0,OP.default)();function FP(t){return t.document.body.dataset.slug}function fa(t){let e=dy(NP(t,"index"),!0);return e.length===0?"/":e}function DP(t){let e=t.split("/").filter(r=>r!=="").slice(0,-1).map(r=>"..").join("/");return e.length===0&&(e="."),e}function cy(t,e){return UP(DP(t),fa(e))}function UP(...t){if(t.length===0)return"";let e=t.filter(r=>r!==""&&r!=="/").map(r=>dy(r)).join("/");return t[0].startsWith("/")&&(e="/"+e),t[t.length-1].endsWith("/")&&(e=e+"/"),e}function LP(t,e){return t===e||t.endsWith("/"+e)}function NP(t,e){return LP(t,e)&&(t=t.slice(0,-e.length)),t}function dy(t,e){return t.startsWith("/")&&(t=t.substring(1)),!e&&t.endsWith("/")&&(t=t.slice(0,-1)),t}var fy="graph-visited";function py(){return new Set(JSON.parse(localStorage.getItem(fy)??"[]"))}function zP(t){let e=py();e.add(t),localStorage.setItem(fy,JSON.stringify([...e]))}async function gy(t,e){let r=fa(e),i=py();IP(t);let{drag:n,zoom:s,depth:a,scale:o,repelForce:l,centerForce:h,linkDistance:u,fontSize:c,opacityScale:f,removeTags:d,showTags:_,focusOnHover:v,enableRadial:m}=JSON.parse(t.dataset.cfg),y=new Map(Object.entries(await fetchData).map(([q,me])=>[fa(q),me])),S=[],P=[],T=new Set(y.keys()),z=new Map;for(let[q,me]of y.entries()){let Je=me.links??[];for(let _t of Je)T.has(_t)&&S.push({source:q,target:_t});if(_){let _t=me.tags.filter(tr=>!d.includes(tr)).map(tr=>fa("tags/"+tr));P.push(..._t.filter(tr=>!P.includes(tr)));for(let tr of _t)S.push({source:q,target:tr})}}let D=new Set,L=[r,"__SENTINEL"];if(a>=0)for(;a>=0&&L.length>0;){let q=L.shift();if(q==="__SENTINEL")a--,L.push("__SENTINEL");else{D.add(q);let me=S.filter(_t=>_t.source===q),Je=S.filter(_t=>_t.target===q);L.push(...me.map(_t=>_t.target),...Je.map(_t=>_t.source))}}else T.forEach(q=>D.add(q)),_&&P.forEach(q=>D.add(q));let ne=[...D].map(q=>{let me=q.startsWith("tags/")?"#"+q.substring(5):y.get(q)?.title??q;return{id:q,text:me,tags:y.get(q)?.tags??[]}}),ue={nodes:ne,links:S.filter(q=>D.has(q.source)&&D.has(q.target)).map(q=>({source:ne.find(me=>me.id===q.source),target:ne.find(me=>me.id===q.target)}))},re=t.offsetWidth,oe=Math.max(t.offsetHeight,250),Be=pP(ue.nodes).force("charge",gP().strength(-100*l)).force("center",zA().strength(h)).force("link",lP(ue.links).distance(u)).force("collide",aP(q=>U(q)).iterations(3)),Ze=Math.min(re,oe)/2*.8;m&&Be.force("radial",mP(Ze).strength(.2));let I=["--secondary","--tertiary","--gray","--light","--lightgray","--dark","--darkgray","--bodyFont"].reduce((q,me)=>(q[me]=getComputedStyle(document.documentElement).getPropertyValue(me),q),{}),Me=q=>q.id===r?I["--secondary"]:i.has(q.id)||q.id.startsWith("tags/")?I["--tertiary"]:I["--gray"];function U(q){let me=ue.links.filter(Je=>Je.source.id===q.id||Je.target.id===q.id).length;return 2+Math.sqrt(me)}let J=null,je=new Set,Se=[],De=[];function dt(q){if(J=q,q===null){je=new Set;for(let me of De)me.active=!1;for(let me of Se)me.active=!1}else{je=new Set;for(let me of Se){let Je=me.simulationData;(Je.source.id===q||Je.target.id===q)&&(je.add(Je.source.id),je.add(Je.target.id)),me.active=Je.source.id===q||Je.target.id===q}for(let me of De)me.active=je.has(me.simulationData.id)}}let Ct=0,qt=!1;function Yt(){z.get("link")?.stop();let q=new hl;for(let me of Se){let Je=1;J&&(Je=me.active?1:.2),me.color=me.active?I["--gray"]:I["--lightgray"],q.add(new ul(me).to({alpha:Je},200))}q.getAll().forEach(me=>me.start()),z.set("link",{update:q.update.bind(q),stop(){q.getAll().forEach(me=>me.stop())}})}function ir(){z.get("label")?.stop();let q=new hl,me=1/o,Je=me*1.1;for(let _t of De){let tr=_t.simulationData.id;J===tr?q.add(new ul(_t.label).to({alpha:1,scale:{x:Je,y:Je}},100)):q.add(new ul(_t.label).to({alpha:_t.label.alpha,scale:{x:me,y:me}},100))}q.getAll().forEach(_t=>_t.start()),z.set("label",{update:q.update.bind(q),stop(){q.getAll().forEach(_t=>_t.stop())}})}function hr(){z.get("hover")?.stop();let q=new hl;for(let me of De){let Je=1;J!==null&&v&&(Je=me.active?1:.2),q.add(new ul(me.gfx,q).to({alpha:Je},200))}q.getAll().forEach(me=>me.start()),z.set("hover",{update:q.update.bind(q),stop(){q.getAll().forEach(me=>me.stop())}})}function ur(){hr(),Yt(),ir()}z.forEach(q=>q.stop()),z.clear();let Kt=new hy;await Kt.init({width:re,height:oe,antialias:!0,autoStart:!1,autoDensity:!0,backgroundAlpha:0,preference:"webgpu",resolution:window.devicePixelRatio,eventMode:"static"}),t.appendChild(Kt.canvas);let Er=Kt.stage;Er.interactive=!1;let tn=new gr({zIndex:3,isRenderGroup:!0}),ns=new gr({zIndex:2,isRenderGroup:!0}),_i=new gr({zIndex:1,isRenderGroup:!0});Er.addChild(ns,tn,_i);for(let q of ue.nodes){let me=q.id,Je=new BP({interactive:!1,eventMode:"none",text:q.text,alpha:0,anchor:{x:.5,y:1.2},style:{fontSize:c*15,fill:I["--dark"],fontFamily:I["--bodyFont"]},resolution:window.devicePixelRatio*4});Je.scale.set(1/o);let _t=0,tr=me.startsWith("tags/"),ad=new wo({interactive:!0,label:me,eventMode:"static",hitArea:new Gh(0,0,U(q)),cursor:"pointer"}).circle(0,0,U(q)).fill({color:tr?I["--light"]:Me(q)}).on("pointerover",VP=>{dt(VP.target.label),_t=Je.alpha,qt||ur()}).on("pointerleave",()=>{dt(null),Je.alpha=_t,qt||ur()});tr&&ad.stroke({width:2,color:I["--tertiary"]}),ns.addChild(ad),tn.addChild(Je);let HP={simulationData:q,gfx:ad,label:Je,color:Me(q),alpha:1,active:!1};De.push(HP)}for(let q of ue.links){let me=new wo({interactive:!1,eventMode:"none"});_i.addChild(me);let Je={simulationData:q,gfx:me,color:I["--lightgray"],alpha:1,active:!1};Se.push(Je)}let ti=ll;if(n)Zr(Kt.canvas).call(J2().container(()=>Kt.canvas).subject(()=>ue.nodes.find(q=>q.id===J)).on("start",function(q){q.active||Be.alphaTarget(1).restart(),q.subject.fx=q.subject.x,q.subject.fy=q.subject.y,q.subject.__initialDragPos={x:q.subject.x,y:q.subject.y,fx:q.subject.fx,fy:q.subject.fy},Ct=Date.now(),qt=!0}).on("drag",function(q){let me=q.subject.__initialDragPos;q.subject.fx=me.x+(q.x-me.x)/ti.k,q.subject.fy=me.y+(q.y-me.y)/ti.k}).on("end",function(q){if(q.active||Be.alphaTarget(0),q.subject.fx=null,q.subject.fy=null,qt=!1,Date.now()-Ct<500){let me=ue.nodes.find(_t=>_t.id===q.subject.id),Je=cy(e,me.id);window.spaNavigate(new URL(Je,window.location.toString()))}}));else for(let q of De)q.gfx.on("click",()=>{let me=cy(e,q.simulationData.id);window.spaNavigate(new URL(me,window.location.toString()))});s&&Zr(Kt.canvas).call(SP().extent([[0,0],[re,oe]]).scaleExtent([.25,4]).on("zoom",({transform:q})=>{ti=q,Er.scale.set(q.k,q.k),Er.position.set(q.x,q.y);let me=q.k*f,Je=Math.max((me-1)/3.75,0),_t=De.filter(tr=>tr.active).flatMap(tr=>tr.label);for(let tr of tn.children)_t.includes(tr)||(tr.alpha=Je)}));let vi=!1;function yi(q){if(!vi){for(let me of De){let{x:Je,y:_t}=me.simulationData;!Je||!_t||(me.gfx.position.set(Je+re/2,_t+oe/2),me.label&&me.label.position.set(Je+re/2,_t+oe/2))}for(let me of Se){let Je=me.simulationData;me.gfx.clear(),me.gfx.moveTo(Je.source.x+re/2,Je.source.y+oe/2),me.gfx.lineTo(Je.target.x+re/2,Je.target.y+oe/2).stroke({alpha:me.alpha,width:1,color:me.color})}z.forEach(me=>me.update(q)),Kt.renderer.render(Er),requestAnimationFrame(yi)}}return requestAnimationFrame(yi),()=>{vi=!0,Kt.destroy()}}var nd=[],sd=[];function my(){for(let t of nd)t();nd=[]}function _y(){for(let t of sd)t();sd=[]}document.addEventListener("nav",async t=>{let e=t.detail.url;zP(fa(e));async function r(){my();let h=document.getElementsByClassName("graph-container");for(let u of h)nd.push(await gy(u,e))}await r();let i=()=>{r()};document.addEventListener("themechange",i),window.addCleanup(()=>{document.removeEventListener("themechange",i)});let n=[...document.getElementsByClassName("global-graph-outer")];async function s(){let h=FP(window);for(let u of n){u.classList.add("active");let c=u.closest(".sidebar");c&&(c.style.zIndex="1");let f=u.querySelector(".global-graph-container");GP(u,a),f&&sd.push(await gy(f,h))}}function a(){_y();for(let h of n){h.classList.remove("active");let u=h.closest(".sidebar");u&&(u.style.zIndex="")}}async function o(h){h.key==="g"&&(h.ctrlKey||h.metaKey)&&!h.shiftKey&&(h.preventDefault(),n.some(u=>u.classList.contains("active"))?a():s())}let l=document.getElementsByClassName("global-graph-icon");Array.from(l).forEach(h=>{h.addEventListener("click",s),window.addCleanup(()=>h.removeEventListener("click",s))}),document.addEventListener("keydown",o),window.addCleanup(()=>{document.removeEventListener("keydown",o),my(),_y()})})}(),function(){var Ut=new IntersectionObserver(yt=>{for(let Tt of yt){let St=Tt.target.id,g=document.querySelectorAll(`a[data-for="${St}"]`),cr=Tt.rootBounds?.height;cr&&g.length>0&&(Tt.boundingClientRect.y<cr?g.forEach(It=>It.classList.add("in-view")):g.forEach(It=>It.classList.remove("in-view")))}});function vt(){this.classList.toggle("collapsed"),this.setAttribute("aria-expanded",this.getAttribute("aria-expanded")==="true"?"false":"true");let yt=this.nextElementSibling;yt&&yt.classList.toggle("collapsed")}function Gt(){for(let yt of document.getElementsByClassName("toc")){let Tt=yt.querySelector(".toc-header"),St=yt.querySelector(".toc-content");if(!Tt||!St)return;Tt.addEventListener("click",vt),window.addCleanup(()=>Tt.removeEventListener("click",vt))}}document.addEventListener("nav",()=>{Gt(),Ut.disconnect(),document.querySelectorAll("h1[id], h2[id], h3[id], h4[id], h5[id], h6[id]").forEach(yt=>Ut.observe(yt))})}(),function(){document.addEventListener("nav",Ut=>{const vt=new IntersectionObserver(Tt=>{for(const St of Tt){const g=St.target.parentElement;if(!g)return;St.isIntersecting?g.classList.remove("gradient-active"):g.classList.add("gradient-active")}}),Gt=document.getElementById("list-1");if(!Gt)return;const yt=Gt.querySelector(".overflow-end");yt&&(vt.observe(yt),window.addCleanup(()=>vt.disconnect()))})}(),function(){document.addEventListener("nav",Ut=>{const vt=new IntersectionObserver(Tt=>{for(const St of Tt){const g=St.target.parentElement;if(!g)return;St.isIntersecting?g.classList.remove("gradient-active"):g.classList.add("gradient-active")}}),Gt=document.getElementById("list-2");if(!Gt)return;const yt=Gt.querySelector(".overflow-end");yt&&(vt.observe(yt),window.addCleanup(()=>vt.disconnect()))})}(),function(){document.addEventListener("nav",Ut=>{const vt=new IntersectionObserver(Tt=>{for(const St of Tt){const g=St.target.parentElement;if(!g)return;St.isIntersecting?g.classList.remove("gradient-active"):g.classList.add("gradient-active")}}),Gt=document.getElementById("list-3");if(!Gt)return;const yt=Gt.querySelector(".overflow-end");yt&&(vt.observe(yt),window.addCleanup(()=>vt.disconnect()))})}(),function(){var Ut=Object.create,vt=Object.defineProperty,Gt=Object.getOwnPropertyDescriptor,yt=Object.getOwnPropertyNames,Tt=Object.getPrototypeOf,St=Object.prototype.hasOwnProperty,g=(b,E)=>()=>(E||b((E={exports:{}}).exports,E),E.exports),cr=(b,E,k,B)=>{if(E&&typeof E=="object"||typeof E=="function")for(let N of yt(E))!St.call(b,N)&&N!==k&&vt(b,N,{get:()=>E[N],enumerable:!(B=Gt(E,N))||B.enumerable});return b},It=(b,E,k)=>(k=b!=null?Ut(Tt(b)):{},cr(E||!b||!b.__esModule?vt(k,"default",{value:b,enumerable:!0}):k,b)),Vr=g((b,E)=>{"use strict";E.exports=B;function k(H){return H instanceof Buffer?Buffer.from(H):new H.constructor(H.buffer.slice(),H.byteOffset,H.length)}function B(H){if(H=H||{},H.circles)return N(H);let Q=new Map;if(Q.set(Date,j=>new Date(j)),Q.set(Map,(j,he)=>new Map(be(Array.from(j),he))),Q.set(Set,(j,he)=>new Set(be(Array.from(j),he))),H.constructorHandlers)for(let j of H.constructorHandlers)Q.set(j[0],j[1]);let ie=null;return H.proto?ee:Ce;function be(j,he){let K=Object.keys(j),te=new Array(K.length);for(let fe=0;fe<K.length;fe++){let _e=K[fe],Ue=j[_e];typeof Ue!="object"||Ue===null?te[_e]=Ue:Ue.constructor!==Object&&(ie=Q.get(Ue.constructor))?te[_e]=ie(Ue,he):ArrayBuffer.isView(Ue)?te[_e]=k(Ue):te[_e]=he(Ue)}return te}function Ce(j){if(typeof j!="object"||j===null)return j;if(Array.isArray(j))return be(j,Ce);if(j.constructor!==Object&&(ie=Q.get(j.constructor)))return ie(j,Ce);let he={};for(let K in j){if(Object.hasOwnProperty.call(j,K)===!1)continue;let te=j[K];typeof te!="object"||te===null?he[K]=te:te.constructor!==Object&&(ie=Q.get(te.constructor))?he[K]=ie(te,Ce):ArrayBuffer.isView(te)?he[K]=k(te):he[K]=Ce(te)}return he}function ee(j){if(typeof j!="object"||j===null)return j;if(Array.isArray(j))return be(j,ee);if(j.constructor!==Object&&(ie=Q.get(j.constructor)))return ie(j,ee);let he={};for(let K in j){let te=j[K];typeof te!="object"||te===null?he[K]=te:te.constructor!==Object&&(ie=Q.get(te.constructor))?he[K]=ie(te,ee):ArrayBuffer.isView(te)?he[K]=k(te):he[K]=ee(te)}return he}}function N(H){let Q=[],ie=[],be=new Map;if(be.set(Date,K=>new Date(K)),be.set(Map,(K,te)=>new Map(ee(Array.from(K),te))),be.set(Set,(K,te)=>new Set(ee(Array.from(K),te))),H.constructorHandlers)for(let K of H.constructorHandlers)be.set(K[0],K[1]);let Ce=null;return H.proto?he:j;function ee(K,te){let fe=Object.keys(K),_e=new Array(fe.length);for(let Ue=0;Ue<fe.length;Ue++){let qe=fe[Ue],tt=K[qe];if(typeof tt!="object"||tt===null)_e[qe]=tt;else if(tt.constructor!==Object&&(Ce=be.get(tt.constructor)))_e[qe]=Ce(tt,te);else if(ArrayBuffer.isView(tt))_e[qe]=k(tt);else{let jt=Q.indexOf(tt);jt!==-1?_e[qe]=ie[jt]:_e[qe]=te(tt)}}return _e}function j(K){if(typeof K!="object"||K===null)return K;if(Array.isArray(K))return ee(K,j);if(K.constructor!==Object&&(Ce=be.get(K.constructor)))return Ce(K,j);let te={};Q.push(K),ie.push(te);for(let fe in K){if(Object.hasOwnProperty.call(K,fe)===!1)continue;let _e=K[fe];if(typeof _e!="object"||_e===null)te[fe]=_e;else if(_e.constructor!==Object&&(Ce=be.get(_e.constructor)))te[fe]=Ce(_e,j);else if(ArrayBuffer.isView(_e))te[fe]=k(_e);else{let Ue=Q.indexOf(_e);Ue!==-1?te[fe]=ie[Ue]:te[fe]=j(_e)}}return Q.pop(),ie.pop(),te}function he(K){if(typeof K!="object"||K===null)return K;if(Array.isArray(K))return ee(K,he);if(K.constructor!==Object&&(Ce=be.get(K.constructor)))return Ce(K,he);let te={};Q.push(K),ie.push(te);for(let fe in K){let _e=K[fe];if(typeof _e!="object"||_e===null)te[fe]=_e;else if(_e.constructor!==Object&&(Ce=be.get(_e.constructor)))te[fe]=Ce(_e,he);else if(ArrayBuffer.isView(_e))te[fe]=k(_e);else{let Ue=Q.indexOf(_e);Ue!==-1?te[fe]=ie[Ue]:te[fe]=he(_e)}}return Q.pop(),ie.pop(),te}}}),nr=Math.min,M=Math.max,sr=Math.round,Nt=b=>({x:b,y:b}),we={left:"right",right:"left",bottom:"top",top:"bottom"},X={start:"end",end:"start"};function At(b,E,k){return M(b,nr(E,k))}function Zt(b,E){return typeof b=="function"?b(E):b}function st(b){return b.split("-")[0]}function kt(b){return b.split("-")[1]}function Rr(b){return b==="x"?"y":"x"}function Lt(b){return b==="y"?"height":"width"}var Pt=new Set(["top","bottom"]);function lt(b){return Pt.has(st(b))?"y":"x"}function pt(b){return Rr(lt(b))}function kr(b,E,k){k===void 0&&(k=!1);let B=kt(b),N=pt(b),H=Lt(N),Q=N==="x"?B===(k?"end":"start")?"right":"left":B==="start"?"bottom":"top";return E.reference[H]>E.floating[H]&&(Q=We(Q)),[Q,We(Q)]}function Br(b){let E=We(b);return[Gr(b),E,Gr(E)]}function Gr(b){return b.replace(/start|end/g,E=>X[E])}var ce=["left","right"],V=["right","left"],de=["top","bottom"],Ve=["bottom","top"];function Qe(b,E,k){switch(b){case"top":case"bottom":return k?E?V:ce:E?ce:V;case"left":case"right":return E?de:Ve;default:return[]}}function rt(b,E,k,B){let N=kt(b),H=Qe(st(b),k==="start",B);return N&&(H=H.map(Q=>Q+"-"+N),E&&(H=H.concat(H.map(Gr)))),H}function We(b){return b.replace(/left|right|bottom|top/g,E=>we[E])}function ft(b){return{top:0,right:0,bottom:0,left:0,...b}}function xt(b){return typeof b!="number"?ft(b):{top:b,right:b,bottom:b,left:b}}function ht(b){let{x:E,y:k,width:B,height:N}=b;return{width:B,height:N,top:k,left:E,right:E+B,bottom:k+N,x:E,y:k}}function at(b,E,k){let{reference:B,floating:N}=b,H=lt(E),Q=pt(E),ie=Lt(Q),be=st(E),Ce=H==="y",ee=B.x+B.width/2-N.width/2,j=B.y+B.height/2-N.height/2,he=B[ie]/2-N[ie]/2,K;switch(be){case"top":K={x:ee,y:B.y-N.height};break;case"bottom":K={x:ee,y:B.y+B.height};break;case"right":K={x:B.x+B.width,y:j};break;case"left":K={x:B.x-N.width,y:j};break;default:K={x:B.x,y:B.y}}switch(kt(E)){case"start":K[Q]-=he*(k&&Ce?-1:1);break;case"end":K[Q]+=he*(k&&Ce?-1:1);break}return K}var ke=async(b,E,k)=>{let{placement:B="bottom",strategy:N="absolute",middleware:H=[],platform:Q}=k,ie=H.filter(Boolean),be=await(Q.isRTL==null?void 0:Q.isRTL(E)),Ce=await Q.getElementRects({reference:b,floating:E,strategy:N}),{x:ee,y:j}=at(Ce,B,be),he=B,K={},te=0;for(let fe=0;fe<ie.length;fe++){let{name:_e,fn:Ue}=ie[fe],{x:qe,y:tt,data:jt,reset:pr}=await Ue({x:ee,y:j,initialPlacement:B,placement:he,strategy:N,middlewareData:K,rects:Ce,platform:Q,elements:{reference:b,floating:E}});ee=qe??ee,j=tt??j,K={...K,[_e]:{...K[_e],...jt}},pr&&te<=50&&(te++,typeof pr=="object"&&(pr.placement&&(he=pr.placement),pr.rects&&(Ce=pr.rects===!0?await Q.getElementRects({reference:b,floating:E,strategy:N}):pr.rects),{x:ee,y:j}=at(Ce,he,be)),fe=-1)}return{x:ee,y:j,placement:he,strategy:N,middlewareData:K}};async function Ne(b,E){var k;E===void 0&&(E={});let{x:B,y:N,platform:H,rects:Q,elements:ie,strategy:be}=b,{boundary:Ce="clippingAncestors",rootBoundary:ee="viewport",elementContext:j="floating",altBoundary:he=!1,padding:K=0}=Zt(E,b),te=xt(K),fe=ie[he?j==="floating"?"reference":"floating":j],_e=ht(await H.getClippingRect({element:(k=await(H.isElement==null?void 0:H.isElement(fe)))==null||k?fe:fe.contextElement||await(H.getDocumentElement==null?void 0:H.getDocumentElement(ie.floating)),boundary:Ce,rootBoundary:ee,strategy:be})),Ue=j==="floating"?{x:B,y:N,width:Q.floating.width,height:Q.floating.height}:Q.reference,qe=await(H.getOffsetParent==null?void 0:H.getOffsetParent(ie.floating)),tt=await(H.isElement==null?void 0:H.isElement(qe))?await(H.getScale==null?void 0:H.getScale(qe))||{x:1,y:1}:{x:1,y:1},jt=ht(H.convertOffsetParentRelativeRectToViewportRelativeRect?await H.convertOffsetParentRelativeRectToViewportRelativeRect({elements:ie,rect:Ue,offsetParent:qe,strategy:be}):Ue);return{top:(_e.top-jt.top+te.top)/tt.y,bottom:(jt.bottom-_e.bottom+te.bottom)/tt.y,left:(_e.left-jt.left+te.left)/tt.x,right:(jt.right-_e.right+te.right)/tt.x}}var Te=function(b){return b===void 0&&(b={}),{name:"flip",options:b,async fn(E){var k,B;let{placement:N,middlewareData:H,rects:Q,initialPlacement:ie,platform:be,elements:Ce}=E,{mainAxis:ee=!0,crossAxis:j=!0,fallbackPlacements:he,fallbackStrategy:K="bestFit",fallbackAxisSideDirection:te="none",flipAlignment:fe=!0,..._e}=Zt(b,E);if((k=H.arrow)!=null&&k.alignmentOffset)return{};let Ue=st(N),qe=lt(ie),tt=st(ie)===ie,jt=await(be.isRTL==null?void 0:be.isRTL(Ce.floating)),pr=he||(tt||!fe?[We(ie)]:Br(ie)),zi=te!=="none";!he&&zi&&pr.push(...rt(ie,fe,te,jt));let an=[ie,...pr],on=await Ne(E,_e),Ai=[],er=((B=H.flip)==null?void 0:B.overflows)||[];if(ee&&Ai.push(on[Ue]),j){let Ar=kr(N,Q,jt);Ai.push(on[Ar[0]],on[Ar[1]])}if(er=[...er,{placement:N,overflows:Ai}],!Ai.every(Ar=>Ar<=0)){var ii,Hi;let Ar=(((ii=H.flip)==null?void 0:ii.index)||0)+1,Or=an[Ar];if(Or&&(!(j==="alignment"&&qe!==lt(Or))||er.every(yr=>yr.overflows[0]>0&<(yr.placement)===qe)))return{data:{index:Ar,overflows:er},reset:{placement:Or}};let $r=(Hi=er.filter(yr=>yr.overflows[0]<=0).sort((yr,Fr)=>yr.overflows[1]-Fr.overflows[1])[0])==null?void 0:Hi.placement;if(!$r)switch(K){case"bestFit":{var Cr;let yr=(Cr=er.filter(Fr=>{if(zi){let Dr=lt(Fr.placement);return Dr===qe||Dr==="y"}return!0}).map(Fr=>[Fr.placement,Fr.overflows.filter(Dr=>Dr>0).reduce((Dr,os)=>Dr+os,0)]).sort((Fr,Dr)=>Fr[1]-Dr[1])[0])==null?void 0:Cr[0];yr&&($r=yr);break}case"initialPlacement":$r=ie;break}if(N!==$r)return{reset:{placement:$r}}}return{}}}};function Re(b){let E=nr(...b.map(H=>H.left)),k=nr(...b.map(H=>H.top)),B=M(...b.map(H=>H.right)),N=M(...b.map(H=>H.bottom));return{x:E,y:k,width:B-E,height:N-k}}function it(b){let E=b.slice().sort((N,H)=>N.y-H.y),k=[],B=null;for(let N=0;N<E.length;N++){let H=E[N];!B||H.y-B.y>B.height/2?k.push([H]):k[k.length-1].push(H),B=H}return k.map(N=>ht(Re(N)))}var Ae=function(b){return b===void 0&&(b={}),{name:"inline",options:b,async fn(E){let{placement:k,elements:B,rects:N,platform:H,strategy:Q}=E,{padding:ie=2,x:be,y:Ce}=Zt(b,E),ee=Array.from(await(H.getClientRects==null?void 0:H.getClientRects(B.reference))||[]),j=it(ee),he=ht(Re(ee)),K=xt(ie);function te(){if(j.length===2&&j[0].left>j[1].right&&be!=null&&Ce!=null)return j.find(_e=>be>_e.left-K.left&&be<_e.right+K.right&&Ce>_e.top-K.top&&Ce<_e.bottom+K.bottom)||he;if(j.length>=2){if(lt(k)==="y"){let er=j[0],ii=j[j.length-1],Hi=st(k)==="top",Cr=er.top,Ar=ii.bottom,Or=Hi?er.left:ii.left,$r=Hi?er.right:ii.right,yr=$r-Or,Fr=Ar-Cr;return{top:Cr,bottom:Ar,left:Or,right:$r,width:yr,height:Fr,x:Or,y:Cr}}let _e=st(k)==="left",Ue=M(...j.map(er=>er.right)),qe=nr(...j.map(er=>er.left)),tt=j.filter(er=>_e?er.left===qe:er.right===Ue),jt=tt[0].top,pr=tt[tt.length-1].bottom,zi=qe,an=Ue,on=an-zi,Ai=pr-jt;return{top:jt,bottom:pr,left:zi,right:an,width:on,height:Ai,x:zi,y:jt}}return he}let fe=await H.getElementRects({reference:{getBoundingClientRect:te},floating:B.floating,strategy:Q});return N.reference.x!==fe.reference.x||N.reference.y!==fe.reference.y||N.reference.width!==fe.reference.width||N.reference.height!==fe.reference.height?{reset:{rects:fe}}:{}}}},et=function(b){return b===void 0&&(b={}),{name:"shift",options:b,async fn(E){let{x:k,y:B,placement:N}=E,{mainAxis:H=!0,crossAxis:Q=!1,limiter:ie={fn:_e=>{let{x:Ue,y:qe}=_e;return{x:Ue,y:qe}}},...be}=Zt(b,E),Ce={x:k,y:B},ee=await Ne(E,be),j=lt(st(N)),he=Rr(j),K=Ce[he],te=Ce[j];if(H){let _e=he==="y"?"top":"left",Ue=he==="y"?"bottom":"right",qe=K+ee[_e],tt=K-ee[Ue];K=At(qe,K,tt)}if(Q){let _e=j==="y"?"top":"left",Ue=j==="y"?"bottom":"right",qe=te+ee[_e],tt=te-ee[Ue];te=At(qe,te,tt)}let fe=ie.fn({...E,[he]:K,[j]:te});return{...fe,data:{x:fe.x-k,y:fe.y-B,enabled:{[he]:H,[j]:Q}}}}}};function Bt(){return typeof window<"u"}function G(b){return Ie(b)?(b.nodeName||"").toLowerCase():"#document"}function W(b){var E;return(b==null||(E=b.ownerDocument)==null?void 0:E.defaultView)||window}function pe(b){var E;return(E=(Ie(b)?b.ownerDocument:b.document)||window.document)==null?void 0:E.documentElement}function Ie(b){return Bt()?b instanceof Node||b instanceof W(b).Node:!1}function Oe(b){return Bt()?b instanceof Element||b instanceof W(b).Element:!1}function Ee(b){return Bt()?b instanceof HTMLElement||b instanceof W(b).HTMLElement:!1}function le(b){return!Bt()||typeof ShadowRoot>"u"?!1:b instanceof ShadowRoot||b instanceof W(b).ShadowRoot}var ze=new Set(["inline","contents"]);function gt(b){let{overflow:E,overflowX:k,overflowY:B,display:N}=Et(b);return/auto|scroll|overlay|hidden|clip/.test(E+B+k)&&!ze.has(N)}var Vt=new Set(["table","td","th"]);function ar(b){return Vt.has(G(b))}var $e=[":popover-open",":modal"];function ut(b){return $e.some(E=>{try{return b.matches(E)}catch{return!1}})}var Ge=["transform","translate","scale","rotate","perspective"],ye=["transform","translate","scale","rotate","perspective","filter"],bt=["paint","layout","strict","content"];function He(b){let E=fr(),k=Oe(b)?Et(b):b;return Ge.some(B=>k[B]?k[B]!=="none":!1)||(k.containerType?k.containerType!=="normal":!1)||!E&&(k.backdropFilter?k.backdropFilter!=="none":!1)||!E&&(k.filter?k.filter!=="none":!1)||ye.some(B=>(k.willChange||"").includes(B))||bt.some(B=>(k.contain||"").includes(B))}function ve(b){let E=ot(b);for(;Ee(E)&&!Ke(E);){if(He(E))return E;if(ut(E))return null;E=ot(E)}return null}function fr(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}var rr=new Set(["html","body","#document"]);function Ke(b){return rr.has(G(b))}function Et(b){return W(b).getComputedStyle(b)}function ri(b){return Oe(b)?{scrollLeft:b.scrollLeft,scrollTop:b.scrollTop}:{scrollLeft:b.scrollX,scrollTop:b.scrollY}}function ot(b){if(G(b)==="html")return b;let E=b.assignedSlot||b.parentNode||le(b)&&b.host||pe(b);return le(E)?E.host:E}function bi(b){let E=ot(b);return Ke(E)?b.ownerDocument?b.ownerDocument.body:b.body:Ee(E)&>(E)?E:bi(E)}function Ot(b,E,k){var B;E===void 0&&(E=[]),k===void 0&&(k=!0);let N=bi(b),H=N===((B=b.ownerDocument)==null?void 0:B.body),Q=W(N);if(H){let ie=Xe(Q);return E.concat(Q,Q.visualViewport||[],gt(N)?N:[],ie&&k?Ot(ie):[])}return E.concat(N,Ot(N,[],k))}function Xe(b){return b.parent&&Object.getPrototypeOf(b.parent)?b.frameElement:null}function Di(b){let E=Et(b),k=parseFloat(E.width)||0,B=parseFloat(E.height)||0,N=Ee(b),H=N?b.offsetWidth:k,Q=N?b.offsetHeight:B,ie=sr(k)!==H||sr(B)!==Q;return ie&&(k=H,B=Q),{width:k,height:B,$:ie}}function nt(b){return Oe(b)?b:b.contextElement}function jr(b){let E=nt(b);if(!Ee(E))return Nt(1);let k=E.getBoundingClientRect(),{width:B,height:N,$:H}=Di(E),Q=(H?sr(k.width):k.width)/B,ie=(H?sr(k.height):k.height)/N;return(!Q||!Number.isFinite(Q))&&(Q=1),(!ie||!Number.isFinite(ie))&&(ie=1),{x:Q,y:ie}}var Mt=Nt(0);function Ye(b){let E=W(b);return!fr()||!E.visualViewport?Mt:{x:E.visualViewport.offsetLeft,y:E.visualViewport.offsetTop}}function Ui(b,E,k){return E===void 0&&(E=!1),!k||E&&k!==W(b)?!1:E}function Wr(b,E,k,B){E===void 0&&(E=!1),k===void 0&&(k=!1);let N=b.getBoundingClientRect(),H=nt(b),Q=Nt(1);E&&(B?Oe(B)&&(Q=jr(B)):Q=jr(b));let ie=Ui(H,k,B)?Ye(H):Nt(0),be=(N.left+ie.x)/Q.x,Ce=(N.top+ie.y)/Q.y,ee=N.width/Q.x,j=N.height/Q.y;if(H){let he=W(H),K=B&&Oe(B)?W(B):B,te=he,fe=Xe(te);for(;fe&&B&&K!==te;){let _e=jr(fe),Ue=fe.getBoundingClientRect(),qe=Et(fe),tt=Ue.left+(fe.clientLeft+parseFloat(qe.paddingLeft))*_e.x,jt=Ue.top+(fe.clientTop+parseFloat(qe.paddingTop))*_e.y;be*=_e.x,Ce*=_e.y,ee*=_e.x,j*=_e.y,be+=tt,Ce+=jt,te=W(fe),fe=Xe(te)}}return ht({width:ee,height:j,x:be,y:Ce})}function wt(b,E){let k=ri(b).scrollLeft;return E?E.left+k:Wr(pe(b)).left+k}function wi(b,E,k){k===void 0&&(k=!1);let B=b.getBoundingClientRect(),N=B.left+E.scrollLeft-(k?0:wt(b,B)),H=B.top+E.scrollTop;return{x:N,y:H}}function Cn(b){let{elements:E,rect:k,offsetParent:B,strategy:N}=b,H=N==="fixed",Q=pe(B),ie=E?ut(E.floating):!1;if(B===Q||ie&&H)return k;let be={scrollLeft:0,scrollTop:0},Ce=Nt(1),ee=Nt(0),j=Ee(B);if((j||!j&&!H)&&((G(B)!=="body"||gt(Q))&&(be=ri(B)),Ee(B))){let K=Wr(B);Ce=jr(B),ee.x=K.x+B.clientLeft,ee.y=K.y+B.clientTop}let he=Q&&!j&&!H?wi(Q,be,!0):Nt(0);return{width:k.width*Ce.x,height:k.height*Ce.y,x:k.x*Ce.x-be.scrollLeft*Ce.x+ee.x+he.x,y:k.y*Ce.y-be.scrollTop*Ce.y+ee.y+he.y}}function rn(b){return Array.from(b.getClientRects())}function Rt(b){let E=pe(b),k=ri(b),B=b.ownerDocument.body,N=M(E.scrollWidth,E.clientWidth,B.scrollWidth,B.clientWidth),H=M(E.scrollHeight,E.clientHeight,B.scrollHeight,B.clientHeight),Q=-k.scrollLeft+wt(b),ie=-k.scrollTop;return Et(B).direction==="rtl"&&(Q+=M(E.clientWidth,B.clientWidth)-N),{width:N,height:H,x:Q,y:ie}}function zt(b,E){let k=W(b),B=pe(b),N=k.visualViewport,H=B.clientWidth,Q=B.clientHeight,ie=0,be=0;if(N){H=N.width,Q=N.height;let Ce=fr();(!Ce||Ce&&E==="fixed")&&(ie=N.offsetLeft,be=N.offsetTop)}return{width:H,height:Q,x:ie,y:be}}var An=new Set(["absolute","fixed"]);function Ti(b,E){let k=Wr(b,!0,E==="fixed"),B=k.top+b.clientTop,N=k.left+b.clientLeft,H=Ee(b)?jr(b):Nt(1),Q=b.clientWidth*H.x,ie=b.clientHeight*H.y,be=N*H.x,Ce=B*H.y;return{width:Q,height:ie,x:be,y:Ce}}function nn(b,E,k){let B;if(E==="viewport")B=zt(b,k);else if(E==="document")B=Rt(pe(b));else if(Oe(E))B=Ti(E,k);else{let N=Ye(b);B={x:E.x-N.x,y:E.y-N.y,width:E.width,height:E.height}}return ht(B)}function Si(b,E){let k=ot(b);return k===E||!Oe(k)||Ke(k)?!1:Et(k).position==="fixed"||Si(k,E)}function Ei(b,E){let k=E.get(b);if(k)return k;let B=Ot(b,[],!1).filter(ie=>Oe(ie)&&G(ie)!=="body"),N=null,H=Et(b).position==="fixed",Q=H?ot(b):b;for(;Oe(Q)&&!Ke(Q);){let ie=Et(Q),be=He(Q);!be&&ie.position==="fixed"&&(N=null),(H?!be&&!N:!be&&ie.position==="static"&&N&&An.has(N.position)||gt(Q)&&!be&&Si(b,Q))?B=B.filter(Ce=>Ce!==Q):N=ie,Q=ot(Q)}return E.set(b,B),B}function Li(b){let{element:E,boundary:k,rootBoundary:B,strategy:N}=b,H=[...k==="clippingAncestors"?ut(E)?[]:Ei(E,this._c):[].concat(k),B],Q=H[0],ie=H.reduce((be,Ce)=>{let ee=nn(E,Ce,N);return be.top=M(ee.top,be.top),be.right=nr(ee.right,be.right),be.bottom=nr(ee.bottom,be.bottom),be.left=M(ee.left,be.left),be},nn(E,Q,N));return{width:ie.right-ie.left,height:ie.bottom-ie.top,x:ie.left,y:ie.top}}function Pn(b){let{width:E,height:k}=Di(b);return{width:E,height:k}}function Mn(b,E,k){let B=Ee(E),N=pe(E),H=k==="fixed",Q=Wr(b,!0,H,E),ie={scrollLeft:0,scrollTop:0},be=Nt(0);function Ce(){be.x=wt(N)}if(B||!B&&!H)if((G(E)!=="body"||gt(N))&&(ie=ri(E)),B){let K=Wr(E,!0,H,E);be.x=K.x+E.clientLeft,be.y=K.y+E.clientTop}else N&&Ce();H&&!B&&N&&Ce();let ee=N&&!B&&!H?wi(N,ie):Nt(0),j=Q.left+ie.scrollLeft-be.x-ee.x,he=Q.top+ie.scrollTop-be.y-ee.y;return{x:j,y:he,width:Q.width,height:Q.height}}function Ir(b){return Et(b).position==="static"}function Ni(b,E){if(!Ee(b)||Et(b).position==="fixed")return null;if(E)return E(b);let k=b.offsetParent;return pe(b)===k&&(k=k.ownerDocument.body),k}function sn(b,E){let k=W(b);if(ut(b))return k;if(!Ee(b)){let N=ot(b);for(;N&&!Ke(N);){if(Oe(N)&&!Ir(N))return N;N=ot(N)}return k}let B=Ni(b,E);for(;B&&ar(B)&&Ir(B);)B=Ni(B,E);return B&&Ke(B)&&Ir(B)&&!He(B)?k:B||ve(b)||k}var Ci=async function(b){let E=this.getOffsetParent||sn,k=this.getDimensions,B=await k(b.floating);return{reference:Mn(b.reference,await E(b.floating),b.strategy),floating:{x:0,y:0,width:B.width,height:B.height}}};function as(b){return Et(b).direction==="rtl"}var p={convertOffsetParentRelativeRectToViewportRelativeRect:Cn,getDocumentElement:pe,getClippingRect:Li,getOffsetParent:sn,getElementRects:Ci,getClientRects:rn,getDimensions:Pn,getScale:jr,isElement:Oe,isRTL:as},x=et,w=Te,C=Ae,A=(b,E,k)=>{let B=new Map,N={platform:p,...k},H={...N.platform,_c:B};return ke(b,E,{...N,platform:H})},R=Object.hasOwnProperty,O=It(Vr(),1),F=(0,O.default)(),$=(b,E,k)=>{let B=new URL(b.getAttribute(E),k);b.setAttribute(E,B.pathname+B.hash)};function se(b,E){b.querySelectorAll('[href=""], [href^="./"], [href^="../"]').forEach(k=>$(k,"href",E)),b.querySelectorAll('[src=""], [src^="./"], [src^="../"]').forEach(k=>$(k,"src",E))}var xe=/<link rel="canonical" href="([^"]*)">/;async function ae(b){let E=await fetch(`${b}`);if(!E.headers.get("content-type")?.startsWith("text/html"))return E;let k=await E.clone().text(),[B,N]=k.match(xe)??[];return N?fetch(`${new URL(N,b)}`):E}var ge=new DOMParser,Z=null;async function Y({clientX:b,clientY:E}){let k=Z=this;if(k.dataset.noPopover==="true")return;async function B(fe){let{x:_e,y:Ue}=await A(k,fe,{strategy:"fixed",middleware:[C({x:b,y:E}),x(),w()]});Object.assign(fe.style,{transform:`translate(${_e.toFixed()}px, ${Ue.toFixed()}px)`})}function N(fe){if(Pe(),fe.classList.add("active-popover"),B(fe),Q!==""){let _e=`#popover-internal-${Q.slice(1)}`,Ue=te.querySelector(_e);Ue&&te.scroll({top:Ue.offsetTop-12,behavior:"instant"})}}let H=new URL(k.href),Q=decodeURIComponent(H.hash);H.hash="",H.search="";let ie=`popover-${k.pathname}`,be=document.getElementById(ie);if(document.getElementById(ie)){N(be);return}let Ce=await ae(H).catch(fe=>{console.error(fe)});if(!Ce)return;let[ee]=Ce.headers.get("Content-Type").split(";"),[j,he]=ee.split("/"),K=document.createElement("div");K.id=ie,K.classList.add("popover");let te=document.createElement("div");switch(te.classList.add("popover-inner"),te.dataset.contentType=ee??void 0,K.appendChild(te),j){case"image":let fe=document.createElement("img");fe.src=H.toString(),fe.alt=H.pathname,te.appendChild(fe);break;case"application":switch(he){case"pdf":let tt=document.createElement("iframe");tt.src=H.toString(),te.appendChild(tt);break;default:break}break;default:let _e=await Ce.text(),Ue=ge.parseFromString(_e,"text/html");se(Ue,H),Ue.querySelectorAll("[id]").forEach(tt=>{let jt=`popover-internal-${tt.id}`;tt.id=jt});let qe=[...Ue.getElementsByClassName("popover-hint")];if(qe.length===0)return;qe.forEach(tt=>te.appendChild(tt))}document.getElementById(ie)||(document.body.appendChild(K),Z===this&&N(K))}function Pe(){Z=null,document.querySelectorAll(".popover").forEach(b=>b.classList.remove("active-popover"))}document.addEventListener("nav",()=>{let b=[...document.querySelectorAll("a.internal")];for(let E of b)E.addEventListener("mouseenter",Y),E.addEventListener("mouseleave",Pe),window.addCleanup(()=>{E.removeEventListener("mouseenter",Y),E.removeEventListener("mouseleave",Pe)})})}(),function(){const Ut=document.createElement("script");Ut.src="https://plausible.io/js/script.manual.js",Ut.setAttribute("data-domain",location.hostname),Ut.defer=!0,Ut.onload=()=>{window.plausible=window.plausible||function(){(window.plausible.q=window.plausible.q||[]).push(arguments)},plausible("pageview"),document.addEventListener("nav",()=>{plausible("pageview")})},document.head.appendChild(Ut)}(),function(){var Ut=Object.create,vt=Object.defineProperty,Gt=Object.getOwnPropertyDescriptor,yt=Object.getOwnPropertyNames,Tt=Object.getPrototypeOf,St=Object.prototype.hasOwnProperty,g=(G,W)=>()=>(W||G((W={exports:{}}).exports,W),W.exports),cr=(G,W,pe,Ie)=>{if(W&&typeof W=="object"||typeof W=="function")for(let Oe of yt(W))!St.call(G,Oe)&&Oe!==pe&&vt(G,Oe,{get:()=>W[Oe],enumerable:!(Ie=Gt(W,Oe))||Ie.enumerable});return G},It=(G,W,pe)=>(pe=G!=null?Ut(Tt(G)):{},cr(W||!G||!G.__esModule?vt(pe,"default",{value:G,enumerable:!0}):pe,G)),Vr=g((G,W)=>{"use strict";W.exports=Ie;function pe(Ee){return Ee instanceof Buffer?Buffer.from(Ee):new Ee.constructor(Ee.buffer.slice(),Ee.byteOffset,Ee.length)}function Ie(Ee){if(Ee=Ee||{},Ee.circles)return Oe(Ee);let le=new Map;if(le.set(Date,$e=>new Date($e)),le.set(Map,($e,ut)=>new Map(gt(Array.from($e),ut))),le.set(Set,($e,ut)=>new Set(gt(Array.from($e),ut))),Ee.constructorHandlers)for(let $e of Ee.constructorHandlers)le.set($e[0],$e[1]);let ze=null;return Ee.proto?ar:Vt;function gt($e,ut){let Ge=Object.keys($e),ye=new Array(Ge.length);for(let bt=0;bt<Ge.length;bt++){let He=Ge[bt],ve=$e[He];typeof ve!="object"||ve===null?ye[He]=ve:ve.constructor!==Object&&(ze=le.get(ve.constructor))?ye[He]=ze(ve,ut):ArrayBuffer.isView(ve)?ye[He]=pe(ve):ye[He]=ut(ve)}return ye}function Vt($e){if(typeof $e!="object"||$e===null)return $e;if(Array.isArray($e))return gt($e,Vt);if($e.constructor!==Object&&(ze=le.get($e.constructor)))return ze($e,Vt);let ut={};for(let Ge in $e){if(Object.hasOwnProperty.call($e,Ge)===!1)continue;let ye=$e[Ge];typeof ye!="object"||ye===null?ut[Ge]=ye:ye.constructor!==Object&&(ze=le.get(ye.constructor))?ut[Ge]=ze(ye,Vt):ArrayBuffer.isView(ye)?ut[Ge]=pe(ye):ut[Ge]=Vt(ye)}return ut}function ar($e){if(typeof $e!="object"||$e===null)return $e;if(Array.isArray($e))return gt($e,ar);if($e.constructor!==Object&&(ze=le.get($e.constructor)))return ze($e,ar);let ut={};for(let Ge in $e){let ye=$e[Ge];typeof ye!="object"||ye===null?ut[Ge]=ye:ye.constructor!==Object&&(ze=le.get(ye.constructor))?ut[Ge]=ze(ye,ar):ArrayBuffer.isView(ye)?ut[Ge]=pe(ye):ut[Ge]=ar(ye)}return ut}}function Oe(Ee){let le=[],ze=[],gt=new Map;if(gt.set(Date,Ge=>new Date(Ge)),gt.set(Map,(Ge,ye)=>new Map(ar(Array.from(Ge),ye))),gt.set(Set,(Ge,ye)=>new Set(ar(Array.from(Ge),ye))),Ee.constructorHandlers)for(let Ge of Ee.constructorHandlers)gt.set(Ge[0],Ge[1]);let Vt=null;return Ee.proto?ut:$e;function ar(Ge,ye){let bt=Object.keys(Ge),He=new Array(bt.length);for(let ve=0;ve<bt.length;ve++){let fr=bt[ve],rr=Ge[fr];if(typeof rr!="object"||rr===null)He[fr]=rr;else if(rr.constructor!==Object&&(Vt=gt.get(rr.constructor)))He[fr]=Vt(rr,ye);else if(ArrayBuffer.isView(rr))He[fr]=pe(rr);else{let Ke=le.indexOf(rr);Ke!==-1?He[fr]=ze[Ke]:He[fr]=ye(rr)}}return He}function $e(Ge){if(typeof Ge!="object"||Ge===null)return Ge;if(Array.isArray(Ge))return ar(Ge,$e);if(Ge.constructor!==Object&&(Vt=gt.get(Ge.constructor)))return Vt(Ge,$e);let ye={};le.push(Ge),ze.push(ye);for(let bt in Ge){if(Object.hasOwnProperty.call(Ge,bt)===!1)continue;let He=Ge[bt];if(typeof He!="object"||He===null)ye[bt]=He;else if(He.constructor!==Object&&(Vt=gt.get(He.constructor)))ye[bt]=Vt(He,$e);else if(ArrayBuffer.isView(He))ye[bt]=pe(He);else{let ve=le.indexOf(He);ve!==-1?ye[bt]=ze[ve]:ye[bt]=$e(He)}}return le.pop(),ze.pop(),ye}function ut(Ge){if(typeof Ge!="object"||Ge===null)return Ge;if(Array.isArray(Ge))return ar(Ge,ut);if(Ge.constructor!==Object&&(Vt=gt.get(Ge.constructor)))return Vt(Ge,ut);let ye={};le.push(Ge),ze.push(ye);for(let bt in Ge){let He=Ge[bt];if(typeof He!="object"||He===null)ye[bt]=He;else if(He.constructor!==Object&&(Vt=gt.get(He.constructor)))ye[bt]=Vt(He,ut);else if(ArrayBuffer.isView(He))ye[bt]=pe(He);else{let ve=le.indexOf(He);ve!==-1?ye[bt]=ze[ve]:ye[bt]=ut(He)}}return le.pop(),ze.pop(),ye}}}),nr=G=>(W,pe)=>W[`node${G}`]===pe[`node${G}`],M=nr("Name"),sr=nr("Type"),Nt=nr("Value");function we(G,W){if(G.attributes.length===0&&W.attributes.length===0)return[];let pe=[],Ie=new Map,Oe=new Map;for(let Ee of G.attributes)Ie.set(Ee.name,Ee.value);for(let Ee of W.attributes){let le=Ie.get(Ee.name);Ee.value===le?Ie.delete(Ee.name):(typeof le<"u"&&Ie.delete(Ee.name),Oe.set(Ee.name,Ee.value))}for(let Ee of Ie.keys())pe.push({type:5,name:Ee});for(let[Ee,le]of Oe.entries())pe.push({type:4,name:Ee,value:le});return pe}function X(G,W=!0){let pe=`${G.localName}`;for(let{name:Ie,value:Oe}of G.attributes)W&&Ie.startsWith("data-")||(pe+=`[${Ie}=${Oe}]`);return pe+=G.innerHTML,pe}function At(G){switch(G.tagName){case"BASE":case"TITLE":return G.localName;case"META":{if(G.hasAttribute("name"))return`meta[name="${G.getAttribute("name")}"]`;if(G.hasAttribute("property"))return`meta[name="${G.getAttribute("property")}"]`;break}case"LINK":{if(G.hasAttribute("rel")&&G.hasAttribute("href"))return`link[rel="${G.getAttribute("rel")}"][href="${G.getAttribute("href")}"]`;if(G.hasAttribute("href"))return`link[href="${G.getAttribute("href")}"]`;break}}return X(G)}function Zt(G){let[W,pe=""]=G.split("?");return`${W}?t=${Date.now()}&${pe.replace(/t=\d+/g,"")}`}function st(G){if(G.nodeType===1&&G.hasAttribute("data-persist"))return G;if(G.nodeType===1&&G.localName==="script"){let W=document.createElement("script");for(let{name:pe,value:Ie}of G.attributes)pe==="src"&&(Ie=Zt(Ie)),W.setAttribute(pe,Ie);return W.innerHTML=G.innerHTML,W}return G.cloneNode(!0)}function kt(G,W){if(G.children.length===0&&W.children.length===0)return[];let pe=[],Ie=new Map,Oe=new Map,Ee=new Map;for(let le of G.children)Ie.set(At(le),le);for(let le of W.children){let ze=At(le),gt=Ie.get(ze);gt?X(le,!1)!==X(gt,!1)&&Oe.set(ze,st(le)):Ee.set(ze,st(le)),Ie.delete(ze)}for(let le of G.childNodes){if(le.nodeType===1){let ze=At(le);if(Ie.has(ze)){pe.push({type:1});continue}else if(Oe.has(ze)){let gt=Oe.get(ze);pe.push({type:3,attributes:we(le,gt),children:Rr(le,gt)});continue}}pe.push(void 0)}for(let le of Ee.values())pe.push({type:0,node:st(le)});return pe}function Rr(G,W){let pe=[],Ie=Math.max(G.childNodes.length,W.childNodes.length);for(let Oe=0;Oe<Ie;Oe++){let Ee=G.childNodes.item(Oe),le=W.childNodes.item(Oe);pe[Oe]=Lt(Ee,le)}return pe}function Lt(G,W){if(!G)return{type:0,node:st(W)};if(!W)return{type:1};if(sr(G,W)){if(G.nodeType===3){let pe=G.nodeValue,Ie=W.nodeValue;if(pe.trim().length===0&&Ie.trim().length===0)return}if(G.nodeType===1){if(M(G,W)){let pe=G.tagName==="HEAD"?kt:Rr;return{type:3,attributes:we(G,W),children:pe(G,W)}}return{type:2,node:st(W)}}else return G.nodeType===9?Lt(G.documentElement,W.documentElement):Nt(G,W)?void 0:{type:2,value:W.nodeValue}}return{type:2,node:st(W)}}function Pt(G,W){if(W.length!==0)for(let{type:pe,name:Ie,value:Oe}of W)pe===5?G.removeAttribute(Ie):pe===4&&G.setAttribute(Ie,Oe)}async function lt(G,W,pe){if(!W)return;let Ie;switch(G.nodeType===9?(G=G.documentElement,Ie=G):pe?Ie=pe:Ie=G,W.type){case 0:{let{node:Oe}=W;G.appendChild(Oe);return}case 1:{if(!Ie)return;G.removeChild(Ie);return}case 2:{if(!Ie)return;let{node:Oe,value:Ee}=W;if(typeof Ee=="string"){Ie.nodeValue=Ee;return}Ie.replaceWith(Oe);return}case 3:{if(!Ie)return;let{attributes:Oe,children:Ee}=W;Pt(Ie,Oe);let le=Array.from(Ie.childNodes);await Promise.all(Ee.map((ze,gt)=>lt(Ie,ze,le[gt])));return}}}function pt(G,W){let pe=Lt(G,W);return lt(G,pe)}var kr=Object.hasOwnProperty,Br=It(Vr(),1),Gr=(0,Br.default)();function ce(G){return G.document.body.dataset.slug}var V=(G,W,pe)=>{let Ie=new URL(G.getAttribute(W),pe);G.setAttribute(W,Ie.pathname+Ie.hash)};function de(G,W){G.querySelectorAll('[href=""], [href^="./"], [href^="../"]').forEach(pe=>V(pe,"href",W)),G.querySelectorAll('[src=""], [src^="./"], [src^="../"]').forEach(pe=>V(pe,"src",W))}var Ve=/<link rel="canonical" href="([^"]*)">/;async function Qe(G){let W=await fetch(`${G}`);if(!W.headers.get("content-type")?.startsWith("text/html"))return W;let pe=await W.clone().text(),[Ie,Oe]=pe.match(Ve)??[];return Oe?fetch(`${new URL(Oe,G)}`):W}var rt=1,We=document.createElement("route-announcer"),ft=G=>G?.nodeType===rt,xt=G=>{try{let W=new URL(G);if(window.location.origin===W.origin)return!0}catch{}return!1},ht=G=>{let W=G.origin===window.location.origin,pe=G.pathname===window.location.pathname;return W&&pe},at=({target:G})=>{if(!ft(G)||G.attributes.getNamedItem("target")?.value==="_blank")return;let W=G.closest("a");if(!W||"routerIgnore"in W.dataset)return;let{href:pe}=W;if(xt(pe))return{url:new URL(pe),scroll:"routerNoscroll"in W.dataset?!1:void 0}};function ke(G){let W=new CustomEvent("nav",{detail:{url:G}});document.dispatchEvent(W)}var Ne=new Set;window.addCleanup=G=>Ne.add(G);function Te(){let G=document.createElement("div");G.className="navigation-progress",G.style.width="0",document.body.contains(G)||document.body.appendChild(G),setTimeout(()=>{G.style.width="80%"},100)}var Re=!1,it;async function Ae(G,W=!1){Re=!0,Te(),it=it||new DOMParser;let pe=await Qe(G).then(le=>{if(le.headers.get("content-type")?.startsWith("text/html"))return le.text();window.location.assign(G)}).catch(()=>{window.location.assign(G)});if(!pe)return;let Ie=new CustomEvent("prenav",{detail:{}});document.dispatchEvent(Ie),Ne.forEach(le=>le()),Ne.clear();let Oe=it.parseFromString(pe,"text/html");de(Oe,G);let Ee=Oe.querySelector("title")?.textContent;if(Ee)document.title=Ee;else{let le=document.querySelector("h1");Ee=le?.innerText??le?.textContent??G.pathname}We.textContent!==Ee&&(We.textContent=Ee),We.dataset.persist="",Oe.body.appendChild(We),pt(document.body,Oe.body),W||(G.hash?document.getElementById(decodeURIComponent(G.hash.substring(1)))?.scrollIntoView():window.scrollTo({top:0})),document.head.querySelectorAll(":not([spa-preserve])").forEach(le=>le.remove()),Oe.head.querySelectorAll(":not([spa-preserve])").forEach(le=>document.head.appendChild(le)),W||history.pushState({},"",G),ke(ce(window)),delete We.dataset.persist}async function et(G,W=!1){if(!Re){Re=!0;try{await Ae(G,W)}catch(pe){console.error(pe),window.location.assign(G)}finally{Re=!1}}}window.spaNavigate=et;function Bt(){return typeof window<"u"&&(window.addEventListener("click",async G=>{let{url:W}=at(G)??{};if(!(!W||G.ctrlKey||G.metaKey)){if(G.preventDefault(),ht(W)&&W.hash){document.getElementById(decodeURIComponent(W.hash.substring(1)))?.scrollIntoView(),history.pushState({},"",W);return}et(W,!1)}}),window.addEventListener("popstate",G=>{let{url:W}=at(G)??{};window.location.hash&&window.location.pathname===W?.pathname||et(new URL(window.location.toString()),!0)})),new class{go(G){let W=new URL(G,window.location.toString());return et(W,!1)}back(){return window.history.back()}forward(){return window.history.forward()}}}if(Bt(),ke(ce(window)),!customElements.get("route-announcer")){let G={"aria-live":"assertive","aria-atomic":"true",style:"position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"};customElements.define("route-announcer",class extends HTMLElement{constructor(){super()}connectedCallback(){for(let[W,pe]of Object.entries(G))this.setAttribute(W,pe)}})}}();
|