=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=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=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=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"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;Ax||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"u"&&(O=new Promise(F=>{R=F})),A||(A=0),C||(C=0),Cp?.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;CA.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;geY+(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,'$&')}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())?`#${he}
`:`#${he}
`).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?``:"",fe=document.createElement("a");fe.classList.add("result-card"),fe.id=ee,fe.href=N(ee).toString(),fe.innerHTML=`
${j}
${te}
${he}
`,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=`
No results.
Try another search term?
`: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;itnew 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;etde!=="").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{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=.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{}),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;e0?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{"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;a0&&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=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{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{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{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.y&&r=c&&e<=f&&r>=d&&r<=_&&!(e>v&&ey&&re.right?e.right:this.right)<=ne)return!1;let ue=this.ye.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.y&&i=this.x&&n=this.y&&s{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_&&(_=m),y>v&&(v=y),m=a*i+l*r+u,y=o*i+h*r+c,m_&&(_=m),y>v&&(v=y),m=a*e+l*n+u,y=o*e+h*n+c,m_&&(_=m),y>v&&(v=y),m=a*i+l*n+u,y=o*i+h*n+c,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.maxXthis.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=fthis.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=fthis.maxX?f:this.maxX,this.maxY=d>this.maxY?d:this.maxY}fit(e){return this.minXe.right&&(this.maxX=e.right),this.minYe.bottom&&(this.maxY=e.bottom),this}fitBounds(e,r,i,n){return this.minXr&&(this.maxX=r),this.minYn&&(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;vo?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{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{Ke(),ge()});function fe(t,e){let r=t.children;for(let i=0;i{"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{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{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-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;r0}addOnRender(t){this._onRenderContainers.push(t)}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1)}runOnRender(t){for(let e=0;e{"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;n1){for(let n=0;n-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{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=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 title : ${e.title} 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{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{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=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=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;r0&&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{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;i0&&(r=e.composedPath()[0]);let i=r!==this.domElement?"outside":"",n=this._normalizeToPointerData(e);for(let s=0,a=n.length;s"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{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{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(o2){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;r0)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{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._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;en.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{this._batchIndex*ga.BATCH_SIZE{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{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{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>>=0;return eh[i]||Hx(t,e,i,r)}function Hx(t,e,r,i){let n={},s=0;for(let o=0;o{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;r0&&(e+=`
else `),r{"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;t0?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;ethis.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=_||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{"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{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;fo&&(o=d),_>l&&(l=_),d{"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":"float32x2","vec3":"float32x3","vec4":"float32x4",vec2f:"float32x2",vec3f:"float32x3",vec4f:"float32x4",i32:"sint32","vec2":"sint32x2","vec3":"sint32x3","vec4":"sint32x4",u32:"uint32","vec2":"uint32x2","vec3":"uint32x3","vec4":"uint32x4",bool:"uint32","vec2":"uint32x2","vec3":"uint32x3","vec4":"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]==="",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{p0()});function _0({groups:t}){let e=[];for(let r=0;r{"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;
@in aUV: vec2;
@out @builtin(position) vPosition: vec4;
@out vUV : vec2;
@out vColor : vec4;
{{header}}
struct VSOutput {
{{struct}}
};
@vertex
fn main( {{in}} ) -> VSOutput {
var worldTransformMatrix = globalUniforms.uWorldTransformMatrix;
var modelMatrix = mat3x3(
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(1., 1., 1., 1.);
{{main}}
vUV = uv;
var modelViewProjectionMatrix = globalUniforms.uProjectionMatrix * worldTransformMatrix * modelMatrix;
vPosition = vec4((modelViewProjectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
vColor *= globalUniforms.uWorldColorAlpha;
{{end}}
{{return}}
};
`,jf=`
@in vUV : vec2;
@in vColor : vec4;
{{header}}
@fragment
fn main(
{{in}}
) -> @location(0) vec4 {
{{start}}
var outColor:vec4;
{{main}}
var finalColor:vec4 = 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,
uWorldTransformMatrix:mat3x3,
uWorldColorAlpha: vec4,
uResolution: vec2,
}
@group(0) @binding(0) var 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;
`,main:`
vColor *= vec4(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;"),e.push("@group(1) @binding(1) var textureSampler1: sampler;");else{let r=0;for(let i=0;i;`),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;
@out @interpolate(flat) vTextureId : u32;
`,main:`
vTextureId = aTextureIdAndRound.y;
`,end:`
if(aTextureIdAndRound.x == 1)
{
vPosition = vec4(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;r0&&e.push("else"),r{"use strict";Wa={},$a={}}),Vn,jn,vn=g(()=>{"use strict";Vn={name:"round-pixels-bit",vertex:{header:`
fn roundPixels(position: vec2, targetSize: vec2) -> vec2
{
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","vec3","vec4","mat2x2","mat3x3","mat4x4","mat3x2","mat4x2","mat2x3","mat4x3","mat2x4","mat3x4","vec2","vec3","vec4"],qf=ch.reduce((t,e)=>(t[e]=!0,t),{})});function L0(t,e){switch(t){case"f32":return 0;case"vec2":return new Float32Array(2*e);case"vec3":return new Float32Array(3*e);case"vec4":return new Float32Array(4*e);case"mat2x2":return new Float32Array([1,0,0,1]);case"mat3x3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4":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{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{"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{"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;T0&&(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{"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&&uc&&(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=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{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){});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;fu&&(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=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=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.x&&r.x>=l&&i!==r.x&&ap(na.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;h0||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=(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{}),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{mb()}),fp,pp,_b=g(()=>{X(),dp(),fp=[],pp={extension:{type:M.ShapeBuilder,name:"polygon"},build(t,e){for(let r=0;r{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{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{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{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{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<>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{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{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"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},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{"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,
uColor:vec4,
uResolution:vec2,
uRoundPixels:f32,
};
@group(0) @binding(0) var uniforms: ParticleUniforms;
@group(1) @binding(0) var uTexture: texture_2d;
@group(1) @binding(1) var uSampler : sampler;
struct VSOutput {
@builtin(position) position: vec4,
@location(0) uv : vec2,
@location(1) color : vec4,
};
@vertex
fn mainVertex(
@location(0) aVertex: vec2,
@location(1) aPosition: vec2,
@location(2) aUV: vec2,
@location(3) aColor: vec4,
@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,
@location(1) color: vec4,
@builtin(position) position: vec4,
) -> @location(0) vec4 {
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"},uColor:{value:new le(16777215),type:"vec4"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2"}}}})}}}),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"},uColor:{value:new Float32Array(4),type:"vec4"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2"}}),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.length0&&(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;nr!=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;un?h:n,s=ua?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:em-h&&rm-h&&r>y-h&&Is(e,r,m-h,y-h,h,c,u)||ey-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=c&&(Be=2*c-Be),Ze>=c&&(Ze=2*c-Ze),Be+ZeKi){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=c&&(Be=2*c-Be),BeKi){l.push(r,i);return}}}else if(oe>Os){if(oe*oe<=h*(ne*ne+ue*ue)){if(bn=c&&(Be=2*c-Be),BeKi){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=h&&(P=2*h-P),P{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{"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{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;a0&&(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{"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;n1){let n=null;for(let s=i;s=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{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{"use strict"});function f1(t,e){let r=t.querySelectorAll("defs");for(let i=0;i{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{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;aparseInt(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{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{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(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{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;v0)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_)if(a!==""&&(o+=Le._addLine(a),a="",s=0),Le.canBreakWords(y,r.breakWords)){let P=Le.wordWrapSplit(y);for(let T=0;T_&&(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{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){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{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,
uTransformMatrix:mat3x3,
uDistance: f32,
uRound:f32,
}
@group(2) @binding(0) var 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,
uTransformMatrix:mat3x3,
uDistance: f32
}
@group(2) @binding(0) var localUniforms : LocalUniforms;
`,main:`
outColor = vec4(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, shapeColor:vec4, 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(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"},uTransformMatrix:{value:new ve,type:"mat3x3"},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