(function(){var Dt='',Rt='';document.addEventListener("nav",()=>{let Xt=document.getElementsByTagName("pre");for(let kt=0;kt{$e.blur(),$e.innerHTML=Rt,setTimeout(()=>{$e.innerHTML=Dt,$e.style.borderColor=""},2e3)},Bt=>console.error(Bt))};var ft=_;let Ve=(Yt.dataset.clipboard?JSON.parse(Yt.dataset.clipboard):Yt.innerText).replace(/\n\n/g,` `),$e=document.createElement("button");$e.className="clipboard-button",$e.type="button",$e.innerHTML=Dt,$e.ariaLabel="Copy source",$e.addEventListener("click",_),window.addCleanup(()=>$e.removeEventListener("click",_)),Xt[kt].prepend($e)}}})})(),function(){var Dt=Object.create,Rt=Object.defineProperty,Xt=Object.getOwnPropertyDescriptor,ft=Object.getOwnPropertyNames,kt=Object.getPrototypeOf,Yt=Object.prototype.hasOwnProperty,_=(g,b)=>()=>(b||g((b={exports:{}}).exports,b),b.exports),Ve=(g,b,E,p)=>{if(b&&typeof b=="object"||typeof b=="function")for(let m of ft(b))!Yt.call(g,m)&&m!==E&&Rt(g,m,{get:()=>b[m],enumerable:!(p=Xt(b,m))||p.enumerable});return g},$e=(g,b,E)=>(E=g!=null?Dt(kt(g)):{},Ve(b||!g||!g.__esModule?Rt(E,"default",{value:g,enumerable:!0}):E,g)),Bt=_(()=>{}),ct=_((g,b)=>{"use strict";b.exports=p;function E(T){return T instanceof Buffer?Buffer.from(T):new T.constructor(T.buffer.slice(),T.byteOffset,T.length)}function p(T){if(T=T||{},T.circles)return m(T);let S=new Map;if(S.set(Date,V=>new Date(V)),S.set(Map,(V,Y)=>new Map(k(Array.from(V),Y))),S.set(Set,(V,Y)=>new Set(k(Array.from(V),Y))),T.constructorHandlers)for(let V of T.constructorHandlers)S.set(V[0],V[1]);let C=null;return T.proto?W:D;function k(V,Y){let H=Object.keys(V),G=new Array(H.length);for(let K=0;Knew Date(H)),k.set(Map,(H,G)=>new Map(W(Array.from(H),G))),k.set(Set,(H,G)=>new Set(W(Array.from(H),G))),T.constructorHandlers)for(let H of T.constructorHandlers)k.set(H[0],H[1]);let D=null;return T.proto?Y:V;function W(H,G){let K=Object.keys(H),L=new Array(K.length);for(let J=0;J=this.B&&(V||!W[G])){var T=hr(Y,p,H),S="";switch(this.G){case"full":if(2T;C--)if(C-T>=this.B){var k=hr(Y,p,H,m,T);S=G.substring(T,C),ir(this,W,S,k,g,E)}break}case"reverse":if(1=this.B&&ir(this,W,S,hr(Y,p,H,m,C),g,E);S=""}case"forward":if(1=this.B&&ir(this,W,S,T,g,E);break}default:if(this.C&&(T=Math.min(T/this.C(b,G,H)|0,Y-1)),ir(this,W,G,T,g,E),V&&1=this.B&&!m[G]){m[G]=1;let K=this.l&&G>T;ir(this,D,K?T:G,hr(S+(p/2>S?0:1),p,H,C-1,k-1),g,E,K?G:T)}}}}}this.m||(this.register[g]=1)}}return this};function hr(g,b,E,p,m){return E&&1=this.B&&!E[Y])if(this.s||T||this.map[Y])k[V++]=Y,E[Y]=1;else return p;g=k,m=g.length}if(!m)return p;b||(b=100),C=this.depth&&1=p))));Y++);if(W){if(T)return Wt(k,p,0);b[b.length]=k;return}}return!E&&k}function Wt(g,b,E){return g=g.length===1?g[0]:[].concat.apply([],g),E||g.length>b?g.slice(E,E+b):g}function pt(g,b,E,p){return E?(p=p&&b>E,g=(g=g[p?b:E])&&g[p?E:b]):g=g[b],g}I.contain=function(g){return!!this.register[g]},I.update=function(g,b){return this.remove(g).add(g,b)},I.remove=function(g,b){let E=this.register[g];if(E){if(this.m)for(let p=0,m;p"u"&&(S=new Promise(D=>{T=D}));let C,k;switch(m||(m=0)){case 0:if(C="reg",this.m){k=fe();for(let D in this.register)k[D]=1}else k=this.register;break;case 1:C="cfg",k={doc:0,opt:this.s?1:0};break;case 2:C="map",k=this.map;break;case 3:C="ctx",k=this.h;break;default:typeof E>"u"&&T&&T();return}return Fr(g,b||this,E,C,p,m,k,T),S},I.import=function(g,b){if(b)switch(_t(b)&&(b=JSON.parse(b)),g){case"cfg":this.s=!!b.opt;break;case"reg":this.m=!1,this.register=b;break;case"map":this.map=b;break;case"ctx":this.h=b}},Or(rr.prototype);function X(g){g=g.data;var b=self._index;let E=g.args;var p=g.task;switch(p){case"init":p=g.options||{},g=g.factory,b=p.encode,p.cache=!1,b&&b.indexOf("function")===0&&(p.encode=Function("return "+b)()),g?(Function("return "+g)()(self),self._index=new self.FlexSearch.Index(p),delete self.FlexSearch):self._index=new rr(p);break;default:g=g.id,b=b[p].apply(b,E),postMessage(p==="search"?{id:g,msg:b}:{id:g})}}var Q=0;function he(g){if(!(this instanceof he))return new he(g);var b;g?et(b=g.encode)&&(g.encode=b.toString()):g={},(b=(self||window)._factory)&&(b=b.toString());let E=typeof window>"u"&&self.exports,p=this;this.o=De(b,E,g.worker),this.h=fe(),this.o&&(E?this.o.on("message",function(m){p.h[m.id](m.msg),delete p.h[m.id]}):this.o.onmessage=function(m){m=m.data,p.h[m.id](m.msg),delete p.h[m.id]},this.o.postMessage({task:"init",factory:b,options:g}))}we("add"),we("append"),we("search"),we("update"),we("remove");function we(g){he.prototype[g]=he.prototype[g+"Async"]=function(){let b=this,E=[].slice.call(arguments);var p=E[E.length-1];let m;return et(p)&&(m=p,E.splice(E.length-1,1)),p=new Promise(function(T){setTimeout(function(){b.h[++Q]=T,b.o.postMessage({task:g,id:Q,args:E})})}),m?(p.then(m),this):p}}function De(g,b,E){let p;try{p=b?new(Bt()).Worker(__dirname+"/node/node.js"):g?new Worker(URL.createObjectURL(new Blob(["onmessage="+X.toString()],{type:"text/javascript"}))):new Worker(_t(E)?E:"worker/worker.js",{type:"module"})}catch{}return p}function Te(g){if(!(this instanceof Te))return new Te(g);var b=g.document||g.doc||g,E;this.K=[],this.h=[],this.A=[],this.register=fe(),this.key=(E=b.key||b.id)&&Ge(E,this.A)||"id",this.m=It(g.fastupdate),this.C=(E=b.store)&&E!==!0&&[],this.store=E&&fe(),this.I=(E=b.tag)&&Ge(E,this.A),this.l=E&&fe(),this.cache=(E=g.cache)&&new Lt(E),g.cache=!1,this.o=g.worker,this.async=!1,E=fe();let p=b.index||b.field||b;_t(p)&&(p=[p]);for(let m=0,T,S;mb||E)&&(m=m.slice(E,E+b)),p&&(m=Pe.call(this,m)),{tag:g,result:m}}function Pe(g){let b=Array(g.length);for(let E=0,p;E"u"&&(S=new Promise(C=>{T=C})),m||(m=0),p||(p=0),pg?.removeEventListener("click",E)),document.addEventListener("keydown",p),window.addCleanup(()=>document.removeEventListener("keydown",p))}function At(g){for(;g.firstChild;)g.removeChild(g.firstChild)}var We=Object.hasOwnProperty,ki=$e(ct(),1),Qe=(0,ki.default)();function Bi(g){let b=tn(Ii(g,"index"),!0);return b.length===0?"/":b}var dt=(g,b,E)=>{let p=new URL(g.getAttribute(b),E);g.setAttribute(b,p.pathname+p.hash)};function yi(g,b){g.querySelectorAll('[href^="./"], [href^="../"]').forEach(E=>dt(E,"href",b)),g.querySelectorAll('[src^="./"], [src^="../"]').forEach(E=>dt(E,"src",b))}function Ji(g){let b=g.split("/").filter(E=>E!=="").slice(0,-1).map(E=>"..").join("/");return b.length===0&&(b="."),b}function en(g,b){return He(Ji(g),Bi(b))}function He(...g){return g.filter(b=>b!=="").join("/").replace(/\/\/+/g,"/")}function Ot(g,b){return g===b||g.endsWith("/"+b)}function Ii(g,b){return Ot(g,b)&&(g=g.slice(0,-b.length)),g}function tn(g,b){return g.startsWith("/")&&(g=g.substring(1)),!b&&g.endsWith("/")&&(g=g.slice(0,-1)),g}var mr="basic",jt="",rn=g=>g.toLowerCase().split(/([^a-z]|[^\x00-\x7F])/),ri=new ut.Document({charset:"latin:extra",encode:rn,document:{id:"id",tag:"tags",index:[{field:"title",tokenize:"forward"},{field:"content",tokenize:"forward"},{field:"tags",tokenize:"forward"}]}}),ii=new DOMParser,ni=new Map,si=30,Lr=8,On=5,nn=g=>{let b=g.split(/\s+/).filter(p=>p.trim()!==""),E=b.length;if(E>1)for(let p=1;pm.length-p.length)};function Gi(g,b,E){let p=nn(g),m=b.split(/\s+/).filter(k=>k!==""),T=0,S=m.length-1;if(E){let k=Y=>p.some(H=>Y.toLowerCase().startsWith(H.toLowerCase())),D=m.map(k),W=0,V=0;for(let Y=0;YG+(K?1:0),0);H>=W&&(W=H,V=Y)}T=Math.max(V-si,0),S=Math.min(T+2*si,m.length-1),m=m.slice(T,S)}let C=m.map(k=>{for(let D of p)if(k.toLowerCase().includes(D.toLowerCase())){let W=new RegExp(D.toLowerCase(),"gi");return k.replace(W,'$&')}return k}).join(" ");return`${T===0?"":"..."}${C}${S===m.length-1?"":"..."}`}function sn(g,b){let E=new DOMParser,p=nn(g),m=E.parseFromString(b.innerHTML,"text/html"),T=C=>{let k=document.createElement("span");return k.className="highlight",k.textContent=C,k},S=(C,k)=>{if(C.nodeType===Node.TEXT_NODE){let D=C.nodeValue??"",W=new RegExp(k.toLowerCase(),"gi"),V=D.match(W);if(!V||V.length===0)return;let Y=document.createElement("span"),H=0;for(let G of V){let K=D.indexOf(G,H);Y.appendChild(document.createTextNode(D.slice(H,K))),Y.appendChild(T(G)),H=K+G.length}Y.appendChild(document.createTextNode(D.slice(H))),C.parentNode?.replaceChild(Y,C)}else if(C.nodeType===Node.ELEMENT_NODE){if(C.classList.contains("highlight"))return;Array.from(C.childNodes).forEach(D=>S(D,k))}};for(let C of p)S(m.body,C);return m.body}document.addEventListener("nav",async g=>{let b=g.detail.url,E=await fetchData,p=document.getElementById("search-container"),m=p?.closest(".sidebar"),T=document.getElementById("search-button"),S=document.getElementById("search-bar"),C=document.getElementById("search-layout"),k=Object.keys(E),D=Ae=>{C?.querySelector(`#${Ae.id}`)===null&&C?.appendChild(Ae)},W=C?.dataset?.preview==="true",V,Y,H=document.createElement("div");H.id="results-container",D(H),W&&(V=document.createElement("div"),V.id="preview-container",D(V));function G(){p?.classList.remove("active"),S&&(S.value=""),m&&(m.style.zIndex=""),H&&At(H),V&&At(V),C&&C.classList.remove("display-results"),mr="basic",T?.focus()}function K(Ae){mr=Ae,m&&(m.style.zIndex="1"),p?.classList.add("active"),S?.focus()}let L=null;async function J(Ae){if(Ae.key==="k"&&(Ae.ctrlKey||Ae.metaKey)&&!Ae.shiftKey){Ae.preventDefault(),p?.classList.contains("active")?G():K("basic");return}else if(Ae.shiftKey&&(Ae.ctrlKey||Ae.metaKey)&&Ae.key.toLowerCase()==="k"){Ae.preventDefault(),p?.classList.contains("active")?G():K("tags"),S&&(S.value="#");return}if(L&&L.classList.remove("focus"),!!p?.classList.contains("active")){if(Ae.key==="Enter")if(H?.contains(document.activeElement)){let Oe=document.activeElement;if(Oe.classList.contains("no-match"))return;await Fe(Oe),Oe.click()}else{let Oe=document.getElementsByClassName("result-card")[0];if(!Oe||Oe?.classList.contains("no-match"))return;await Fe(Oe),Oe.click()}else if(Ae.key==="ArrowUp"||Ae.shiftKey&&Ae.key==="Tab"){if(Ae.preventDefault(),H?.contains(document.activeElement)){let Oe=L||document.activeElement,Ye=Oe?.previousElementSibling;Oe?.classList.remove("focus"),Ye?.focus(),Ye&&(L=Ye),await Fe(Ye)}}else if((Ae.key==="ArrowDown"||Ae.key==="Tab")&&(Ae.preventDefault(),document.activeElement===S||L!==null)){let Oe=L||document.getElementsByClassName("result-card")[0],Ye=Oe?.nextElementSibling;Oe?.classList.remove("focus"),Ye?.focus(),Ye&&(L=Ye),await Fe(Ye)}}}let ue=(Ae,Oe)=>{let Ye=k[Oe];return{id:Oe,slug:Ye,title:mr==="tags"?E[Ye].title:Gi(Ae,E[Ye].title??""),content:Gi(Ae,E[Ye].content??"",!0),tags:ne(Ae.substring(1),E[Ye].tags)}};function ne(Ae,Oe){return!Oe||mr!=="tags"?[]:Oe.map(Ye=>Ye.toLowerCase().includes(Ae.toLowerCase())?`
  • #${Ye}

  • `:`
  • #${Ye}

  • `).slice(0,On)}function Be(Ae){return new URL(en(b,Ae),location.toString())}let ge=({slug:Ae,title:Oe,content:Ye,tags:lt})=>{let gt=lt.length>0?`
      ${lt.join("")}
    `:"",ht=document.createElement("a");ht.classList.add("result-card"),ht.id=Ae,ht.href=Be(Ae).toString(),ht.innerHTML=`

    ${Oe}

    ${gt}${W&&window.innerWidth>600?"":`

    ${Ye}

    `}`,ht.addEventListener("click",vt=>{vt.altKey||vt.ctrlKey||vt.metaKey||vt.shiftKey||G()});let Qt=vt=>{vt.altKey||vt.ctrlKey||vt.metaKey||vt.shiftKey||G()};async function qt(vt){if(!vt.target)return;let _r=vt.target;await Fe(_r)}return ht.addEventListener("mouseenter",qt),window.addCleanup(()=>ht.removeEventListener("mouseenter",qt)),ht.addEventListener("click",Qt),window.addCleanup(()=>ht.removeEventListener("click",Qt)),ht};async function ze(Ae){if(H)if(At(H),Ae.length===0?H.innerHTML=`

    No results.

    Try another search term?

    `:H.append(...Ae.map(ge)),Ae.length===0&&V)At(V);else{let Oe=H.firstElementChild;Oe.classList.add("focus"),L=Oe,await Fe(Oe)}}async function ot(Ae){if(ni.has(Ae))return ni.get(Ae);let Oe=Be(Ae).toString(),Ye=await fetch(Oe).then(lt=>lt.text()).then(lt=>{if(lt===void 0)throw new Error(`Could not fetch ${Oe}`);let gt=ii.parseFromString(lt??"","text/html");return yi(gt,Oe),[...gt.getElementsByClassName("popover-hint")]});return ni.set(Ae,Ye),Ye}async function Fe(Ae){if(!C||!W||!Ae||!V)return;let Oe=Ae.id,Ye=await ot(Oe).then(lt=>lt.flatMap(gt=>[...sn(jt,gt).children]));Y=document.createElement("div"),Y.classList.add("preview-inner"),Y.append(...Ye),V.replaceChildren(Y),[...V.querySelectorAll(".highlight")].sort((lt,gt)=>gt.innerHTML.length-lt.innerHTML.length)[0]?.scrollIntoView({block:"start"})}async function ur(Ae){if(!C||!ri)return;jt=Ae.target.value,C.classList.toggle("display-results",jt!==""),mr=jt.startsWith("#")?"tags":"basic";let Oe;if(mr==="tags"){jt=jt.substring(1).trim();let gt=jt.indexOf(" ");if(gt!=-1){let ht=jt.substring(0,gt),Qt=jt.substring(gt+1).trim();Oe=await ri.searchAsync({query:Qt,limit:Math.max(Lr,1e4),index:["title","content"],tag:ht});for(let qt of Oe)qt.result=qt.result.slice(0,Lr);mr="basic",jt=Qt}else Oe=await ri.searchAsync({query:jt,limit:Lr,index:["tags"]})}else mr==="basic"&&(Oe=await ri.searchAsync({query:jt,limit:Lr,index:["title","content"]}));let Ye=gt=>{let ht=Oe.filter(Qt=>Qt.field===gt);return ht.length===0?[]:[...ht[0].result]},lt=[...new Set([...Ye("title"),...Ye("content"),...Ye("tags")])].map(gt=>ue(jt,gt));await ze(lt)}document.addEventListener("keydown",J),window.addCleanup(()=>document.removeEventListener("keydown",J)),T?.addEventListener("click",()=>K("basic")),window.addCleanup(()=>T?.removeEventListener("click",()=>K("basic"))),S?.addEventListener("input",ur),window.addCleanup(()=>S?.removeEventListener("input",ur)),vi(p,G),await Dn(E)});async function Dn(g){let b=0,E=[];for(let[p,m]of Object.entries(g))E.push(ri.addAsync(b++,{id:b,slug:p,title:m.title,content:m.content,tags:m.tags}));return await Promise.all(E)}}(),function(){var Dt,Rt=new IntersectionObserver(Ve=>{let $e=document.getElementById("explorer-ul");if($e)for(let Bt of Ve)Bt.isIntersecting?$e.classList.add("no-background"):$e.classList.remove("no-background")});function Xt(){this.classList.toggle("collapsed"),this.setAttribute("aria-expanded",this.getAttribute("aria-expanded")==="true"?"false":"true");let Ve=this.nextElementSibling;Ve&&Ve.classList.toggle("collapsed")}function ft(Ve){Ve.stopPropagation();let $e=Ve.target;if(!$e)return;let Bt=$e.nodeName==="svg",ct=Bt?$e.parentElement?.nextSibling:$e.parentElement?.parentElement?.nextElementSibling,I=Bt?$e.nextElementSibling:$e.parentElement;if(!(ct&&I))return;ct.classList.toggle("open");let It=ct.classList.contains("open");Yt(ct,!It);let Xe=I.dataset.folderpath;_(Dt,Xe);let fe=JSON.stringify(Dt);localStorage.setItem("fileTree",fe)}function kt(){let Ve=document.getElementById("explorer");if(!Ve)return;if(Ve.dataset.behavior==="collapse")for(let Xe of document.getElementsByClassName("folder-button"))Xe.addEventListener("click",ft),window.addCleanup(()=>Xe.removeEventListener("click",ft));Ve.addEventListener("click",Xt),window.addCleanup(()=>Ve.removeEventListener("click",Xt));for(let Xe of document.getElementsByClassName("folder-icon"))Xe.addEventListener("click",ft),window.addCleanup(()=>Xe.removeEventListener("click",ft));let $e=localStorage.getItem("fileTree"),Bt=Ve?.dataset.savestate==="true",ct=$e&&Bt?JSON.parse($e):[],I=new Map(ct.map(Xe=>[Xe.path,Xe.collapsed])),It=Ve.dataset.tree?JSON.parse(Ve.dataset.tree):[];Dt=[];for(let{path:Xe,collapsed:fe}of It)Dt.push({path:Xe,collapsed:I.get(Xe)??fe});Dt.map(Xe=>{let fe=document.querySelector(`[data-folderpath='${Xe.path}']`)?.parentElement?.nextElementSibling;fe&&Yt(fe,Xe.collapsed)})}window.addEventListener("resize",kt),document.addEventListener("nav",()=>{kt(),Rt.disconnect();let Ve=document.getElementById("explorer-end");Ve&&Rt.observe(Ve)});function Yt(Ve,$e){return $e?Ve.classList.remove("open"):Ve.classList.add("open")}function _(Ve,$e){let Bt=Ve.find(ct=>ct.path===$e);Bt&&(Bt.collapsed=!Bt.collapsed)}}(),function(){var Dt=Object.create,Rt=Object.defineProperty,Xt=Object.getOwnPropertyDescriptor,ft=Object.getOwnPropertyNames,kt=Object.getPrototypeOf,Yt=Object.prototype.hasOwnProperty,_=(e,t)=>()=>(e&&(t=e(e=0)),t),Ve=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),$e=(e,t)=>{for(var r in t)Rt(e,r,{get:t[r],enumerable:!0})},Bt=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ft(t))!Yt.call(e,n)&&n!==r&&Rt(e,n,{get:()=>t[n],enumerable:!(i=Xt(t,n))||i.enumerable});return e},ct=(e,t,r)=>(r=e!=null?Dt(kt(e)):{},Bt(t||!e||!e.__esModule?Rt(r,"default",{value:e,enumerable:!0}):r,e)),I,It,Xe,fe,re=_(()=>{"use strict";I=(e=>(e.Application="application",e.WebGLPipes="webgl-pipes",e.WebGLPipesAdaptor="webgl-pipes-adaptor",e.WebGLSystem="webgl-system",e.WebGPUPipes="webgpu-pipes",e.WebGPUPipesAdaptor="webgpu-pipes-adaptor",e.WebGPUSystem="webgpu-system",e.CanvasSystem="canvas-system",e.CanvasPipesAdaptor="canvas-pipes-adaptor",e.CanvasPipes="canvas-pipes",e.Asset="asset",e.LoadParser="load-parser",e.ResolveParser="resolve-parser",e.CacheParser="cache-parser",e.DetectionParser="detection-parser",e.MaskEffect="mask-effect",e.BlendMode="blend-mode",e.TextureSource="texture-source",e.Environment="environment",e.ShapeBuilder="shape-builder",e.Batcher="batcher",e))(I||{}),It=e=>{if(typeof e=="function"||typeof e=="object"&&e.extension){if(!e.extension)throw new Error("Extension class must have an extension object");e={...typeof e.extension!="object"?{type:e.extension}:e.extension,ref:e}}if(typeof e=="object")e={...e};else throw new Error("Invalid extension type");return typeof e.type=="string"&&(e.type=[e.type]),e},Xe=(e,t)=>It(e).priority??t,fe={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...e){return e.map(It).forEach(t=>{t.type.forEach(r=>this._removeHandlers[r]?.(t))}),this},add(...e){return e.map(It).forEach(t=>{t.type.forEach(r=>{let i=this._addHandlers,n=this._queue;i[r]?i[r]?.(t):(n[r]=n[r]||[],n[r]?.push(t))})}),this},handle(e,t,r){let i=this._addHandlers,n=this._removeHandlers;if(i[e]||n[e])throw new Error(`Extension type ${e} already has a handler`);i[e]=t,n[e]=r;let s=this._queue;return s[e]&&(s[e]?.forEach(a=>t(a)),delete s[e]),this},handleByMap(e,t){return this.handle(e,r=>{r.name&&(t[r.name]=r.ref)},r=>{r.name&&delete t[r.name]})},handleByNamedList(e,t,r=-1){return this.handle(e,i=>{t.findIndex(n=>n.name===i.name)>=0||(t.push({name:i.name,value:i.ref}),t.sort((n,s)=>Xe(s.value,r)-Xe(n.value,r)))},i=>{let n=t.findIndex(s=>s.name===i.name);n!==-1&&t.splice(n,1)})},handleByList(e,t,r=-1){return this.handle(e,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((n,s)=>Xe(s,r)-Xe(n,r)))},i=>{let n=t.indexOf(i.ref);n!==-1&&t.splice(n,1)})}}}),_t=Ve((e,t)=>{"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 y=new s(c,f||h,d),x=i?i+u:u;return h._events[x]?h._events[x].fn?h._events[x]=[h._events[x],y]:h._events[x].push(y):(h._events[x]=y,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,y=new Array(d);f{Vt=ct(_t(),1),et=Vt.default}),Gr,Ut,st,bt,at,Jr,br,gi,gr,Ft,Or,lr,tr,Dr,Lt,Ur,mi,Fr,rr,hr,ir,wr,Wt,pt,Gt,X,Q,he,we,De=_(()=>{Gr={grad:.9,turn:360,rad:360/(2*Math.PI)},Ut=function(e){return typeof e=="string"?e.length>0:typeof e=="number"},st=function(e,t,r){return t===void 0&&(t=0),r===void 0&&(r=Math.pow(10,t)),Math.round(r*e)/r+0},bt=function(e,t,r){return t===void 0&&(t=0),r===void 0&&(r=1),e>r?r:e>t?e:t},at=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},Jr=function(e){return{r:bt(e.r,0,255),g:bt(e.g,0,255),b:bt(e.b,0,255),a:bt(e.a)}},br=function(e){return{r:st(e.r),g:st(e.g),b:st(e.b),a:st(e.a,3)}},gi=/^#([0-9a-f]{3,8})$/i,gr=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},Ft=function(e){var t=e.r,r=e.g,i=e.b,n=e.a,s=Math.max(t,r,i),a=s-Math.min(t,r,i),o=a?s===t?(r-i)/a:s===r?2+(i-t)/a:4+(t-r)/a:0;return{h:60*(o<0?o+6:o),s:s?a/s*100:0,v:s/255*100,a:n}},Or=function(e){var t=e.h,r=e.s,i=e.v,n=e.a;t=t/360*6,r/=100,i/=100;var s=Math.floor(t),a=i*(1-r),o=i*(1-(t-s)*r),l=i*(1-(1-t+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}},lr=function(e){return{h:at(e.h),s:bt(e.s,0,100),l:bt(e.l,0,100),a:bt(e.a)}},tr=function(e){return{h:st(e.h),s:st(e.s),l:st(e.l),a:st(e.a,3)}},Dr=function(e){return Or((r=(t=e).s,{h:t.h,s:(r*=((i=t.l)<50?i:100-i)/100)>0?2*r/(i+r)*100:0,v:i+r,a:t.a}));var t,r,i},Lt=function(e){return{h:(t=Ft(e)).h,s:(n=(200-(r=t.s))*(i=t.v)/100)>0&&n<200?r*i/100/(n<=100?n:200-n)*100:0,l:n/2,a:t.a};var t,r,i,n},Ur=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,mi=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Fr=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,rr=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,hr={string:[[function(e){var t=gi.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:e.length===4?st(parseInt(e[3]+e[3],16)/255,2):1}:e.length===6||e.length===8?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:e.length===8?st(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=Fr.exec(e)||rr.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:Jr({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(e){var t=Ur.exec(e)||mi.exec(e);if(!t)return null;var r,i,n=lr({h:(r=t[1],i=t[2],i===void 0&&(i="deg"),Number(r)*(Gr[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Dr(n)},"hsl"]],object:[[function(e){var t=e.r,r=e.g,i=e.b,n=e.a,s=n===void 0?1:n;return Ut(t)&&Ut(r)&&Ut(i)?Jr({r:Number(t),g:Number(r),b:Number(i),a:Number(s)}):null},"rgb"],[function(e){var t=e.h,r=e.s,i=e.l,n=e.a,s=n===void 0?1:n;if(!Ut(t)||!Ut(r)||!Ut(i))return null;var a=lr({h:Number(t),s:Number(r),l:Number(i),a:Number(s)});return Dr(a)},"hsl"],[function(e){var t=e.h,r=e.s,i=e.v,n=e.a,s=n===void 0?1:n;if(!Ut(t)||!Ut(r)||!Ut(i))return null;var a=function(o){return{h:at(o.h),s:bt(o.s,0,100),v:bt(o.v,0,100),a:bt(o.a)}}({h:Number(t),s:Number(r),v:Number(i),a:Number(s)});return Or(a)},"hsv"]]},ir=function(e,t){for(var r=0;r=.5},e.prototype.toHex=function(){return t=br(this.rgba),r=t.r,i=t.g,n=t.b,a=(s=t.a)<1?gr(st(255*s)):"","#"+gr(r)+gr(i)+gr(n)+a;var t,r,i,n,s,a},e.prototype.toRgb=function(){return br(this.rgba)},e.prototype.toRgbString=function(){return t=br(this.rgba),r=t.r,i=t.g,n=t.b,(s=t.a)<1?"rgba("+r+", "+i+", "+n+", "+s+")":"rgb("+r+", "+i+", "+n+")";var t,r,i,n,s},e.prototype.toHsl=function(){return tr(Lt(this.rgba))},e.prototype.toHslString=function(){return t=tr(Lt(this.rgba)),r=t.h,i=t.s,n=t.l,(s=t.a)<1?"hsla("+r+", "+i+"%, "+n+"%, "+s+")":"hsl("+r+", "+i+"%, "+n+"%)";var t,r,i,n,s},e.prototype.toHsv=function(){return t=Ft(this.rgba),{h:st(t.h),s:st(t.s),v:st(t.v),a:st(t.a,3)};var t},e.prototype.invert=function(){return Q({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},e.prototype.saturate=function(t){return t===void 0&&(t=.1),Q(Wt(this.rgba,t))},e.prototype.desaturate=function(t){return t===void 0&&(t=.1),Q(Wt(this.rgba,-t))},e.prototype.grayscale=function(){return Q(Wt(this.rgba,-1))},e.prototype.lighten=function(t){return t===void 0&&(t=.1),Q(Gt(this.rgba,t))},e.prototype.darken=function(t){return t===void 0&&(t=.1),Q(Gt(this.rgba,-t))},e.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},e.prototype.alpha=function(t){return typeof t=="number"?Q({r:(r=this.rgba).r,g:r.g,b:r.b,a:t}):st(this.rgba.a,3);var r},e.prototype.hue=function(t){var r=Lt(this.rgba);return typeof t=="number"?Q({h:t,s:r.s,l:r.l,a:r.a}):st(r.h)},e.prototype.isEqual=function(t){return this.toHex()===Q(t).toHex()},e}(),Q=function(e){return e instanceof X?e:new X(e)},he=[],we=function(e){e.forEach(function(t){he.indexOf(t)<0&&(t(X,hr),he.push(t))})}});function Te(e,t){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={};e.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 e(r[d]).toRgb();for(var y in r){var x=(o=u,l=s[y],Math.pow(o.r-l.r,2)+Math.pow(o.g-l.g,2)+Math.pow(o.b-l.b,2));x{}),Ue,Ce,Ne=_(()=>{De(),Ge(),we([Te]),Ue=class Us{constructor(t=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=t}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(t){return this.value=t,this}set value(t){if(t instanceof Us)this._value=this._cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set Color#value to null");(this._value===null||!this._isSourceEqual(this._value,t))&&(this._value=this._cloneSource(t),this._normalize(this._value))}}get value(){return this._value}_cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?{...t}:t}_isSourceEqual(t,r){let i=typeof t;if(i!==typeof r)return!1;if(i==="number"||i==="string"||t instanceof Number)return t===r;if(Array.isArray(t)&&Array.isArray(r)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(r))return t.length!==r.length?!1:t.every((n,s)=>n===r[s]);if(t!==null&&r!==null){let n=Object.keys(t),s=Object.keys(r);return n.length!==s.length?!1:n.every(a=>t[a]===r[a])}return t===r}toRgba(){let[t,r,i,n]=this._components;return{r:t,g:r,b:i,a:n}}toRgb(){let[t,r,i]=this._components;return{r:t,g:r,b:i}}toRgbaString(){let[t,r,i]=this.toUint8RgbArray();return`rgba(${t},${r},${i},${this.alpha})`}toUint8RgbArray(t){let[r,i,n]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb),t[0]=Math.round(r*255),t[1]=Math.round(i*255),t[2]=Math.round(n*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t||(t=this._arrayRgba);let[r,i,n,s]=this._components;return t[0]=r,t[1]=i,t[2]=n,t[3]=s,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb);let[r,i,n]=this._components;return t[0]=r,t[1]=i,t[2]=n,t}toNumber(){return this._int}toBgrNumber(){let[t,r,i]=this.toUint8RgbArray();return(i<<16)+(r<<8)+t}toLittleEndianNumber(){let t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){let[r,i,n,s]=Us._temp.setValue(t)._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(t,r=!0){return r&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this._refreshInt(),this._value=null,this}toPremultiplied(t,r=!0){if(t===1)return(255<<24)+this._int;if(t===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*t+.5|0,n=n*t+.5|0,s=s*t+.5|0),(t*255<<24)+(i<<16)+(n<<8)+s}toHex(){let t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){let t=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this}_normalize(t){let r,i,n,s;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){let a=t;r=(a>>16&255)/255,i=(a>>8&255)/255,n=(a&255)/255,s=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[r,i,n,s=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[r,i,n,s=255]=t,r/=255,i/=255,n/=255,s/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){let o=Us.HEX_PATTERN.exec(t);o&&(t=`#${o[2]}`)}let a=Q(t);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 ${t}`)}_refreshInt(){this._clamp(this._components);let[t,r,i]=this._components;this._int=(t*255<<16)+(r*255<<8)+(i*255|0)}_clamp(t,r=0,i=1){return typeof t=="number"?Math.min(Math.max(t,r),i):(t.forEach((n,s)=>{t[s]=Math.min(Math.max(n,r),i)}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof Us||Array.isArray(t)||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Float32Array||t.r!==void 0&&t.g!==void 0&&t.b!==void 0||t.r!==void 0&&t.g!==void 0&&t.b!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0&&t.a!==void 0}},Ue.shared=new Ue,Ue._temp=new Ue,Ue.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i,Ce=Ue}),Ct,Pe=_(()=>{"use strict";Ct={cullArea:null,cullable:!1,cullableChildren:!0}}),tt,ye,Re,it=_(()=>{"use strict";tt=Math.PI*2,ye=180/Math.PI,Re=Math.PI/180}),xe,nt,wt=_(()=>{"use strict";xe=class vv{constructor(t=0,r=0){this.x=0,this.y=0,this.x=t,this.y=r}clone(){return new vv(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,r=t){return this.x=t,this.y=r,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return nt.x=0,nt.y=0,nt}},nt=new xe}),_e,ei,_i,Ze=_(()=>{it(),wt(),_e=class yv{constructor(t=1,r=0,i=0,n=1,s=0,a=0){this.array=null,this.a=t,this.b=r,this.c=i,this.d=n,this.tx=s,this.ty=a}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,r,i,n,s,a){return this.a=t,this.b=r,this.c=i,this.d=n,this.tx=s,this.ty=a,this}toArray(t,r){this.array||(this.array=new Float32Array(9));let i=r||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,r){r=r||new xe;let i=t.x,n=t.y;return r.x=this.a*i+this.c*n+this.tx,r.y=this.b*i+this.d*n+this.ty,r}applyInverse(t,r){r=r||new xe;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=t.x,c=t.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(t,r){return this.tx+=t,this.ty+=r,this}scale(t,r){return this.a*=t,this.d*=r,this.c*=t,this.b*=r,this.tx*=t,this.ty*=r,this}rotate(t){let r=Math.cos(t),i=Math.sin(t),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(t){let r=this.a,i=this.b,n=this.c,s=this.d;return this.a=t.a*r+t.b*n,this.b=t.a*i+t.b*s,this.c=t.c*r+t.d*n,this.d=t.c*i+t.d*s,this.tx=t.tx*r+t.ty*n+this.tx,this.ty=t.tx*i+t.ty*s+this.ty,this}appendFrom(t,r){let i=t.a,n=t.b,s=t.c,a=t.d,o=t.tx,l=t.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(t,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=t-(i*this.a+n*this.c),this.ty=r-(i*this.b+n*this.d),this}prepend(t){let r=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){let i=this.a,n=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=n*t.a+this.d*t.c,this.d=n*t.b+this.d*t.d}return this.tx=r*t.a+this.ty*t.c+t.tx,this.ty=r*t.b+this.ty*t.d+t.ty,this}decompose(t){let r=this.a,i=this.b,n=this.c,s=this.d,a=t.pivot,o=-Math.atan2(-n,s),l=Math.atan2(i,r),h=Math.abs(o+l);return h<1e-5||Math.abs(tt-h)<1e-5?(t.rotation=l,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=o,t.skew.y=l),t.scale.x=Math.sqrt(r*r+i*i),t.scale.y=Math.sqrt(n*n+s*s),t.position.x=this.tx+(a.x*r+a.y*n),t.position.y=this.ty+(a.x*i+a.y*s),t}invert(){let t=this.a,r=this.b,i=this.c,n=this.d,s=this.tx,a=t*n-r*i;return this.a=n/a,this.b=-r/a,this.c=-i/a,this.d=t/a,this.tx=(i*this.ty-n*s)/a,this.ty=-(t*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 t=new yv;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}equals(t){return t.a===this.a&&t.b===this.b&&t.c===this.c&&t.d===this.d&&t.tx===this.tx&&t.ty===this.ty}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 _i.identity()}static get shared(){return ei.identity()}},ei=new _e,_i=new _e}),Pt,ti=_(()=>{"use strict";Pt=class xv{constructor(t,r,i){this._x=r||0,this._y=i||0,this._observer=t}clone(t){return new xv(t??this._observer,this._x,this._y)}set(t=0,r=t){return(this._x!==t||this._y!==r)&&(this._x=t,this._y=r,this._observer._onUpdate(this)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this._observer._onUpdate(this)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=0 y=0 scope=${this._observer}]`}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this._observer._onUpdate(this))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._observer._onUpdate(this))}}});function ut(e="default"){return vi[e]===void 0&&(vi[e]=-1),++vi[e]}var vi,At=_(()=>{"use strict";vi={default:-1}});function We(e,t,r=3){if(ki[t])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${t} Deprecated since v${e}`):(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",`${t} Deprecated since v${e}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t} Deprecated since v${e}`),console.warn(i))),ki[t]=!0}var ki,Qe,Bi,dt=_(()=>{"use strict";ki={},Qe="8.0.0",Bi="8.3.4"}),yi,Ji=_(()=>{"use strict";yi=class{constructor(e,t){this._pool=[],this._count=0,this._index=0,this._classType=e,t&&this.prepopulate(t)}prepopulate(e){for(let t=0;t0?t=this._pool[--this._index]:t=new this._classType,t.init?.(e),t}return(e){e.reset?.(),this._pool[this._index++]=e}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}}}),en,He,Ot=_(()=>{Ji(),en=class{constructor(){this._poolsByClass=new Map}prepopulate(e,t){this.getPool(e).prepopulate(t)}get(e,t){return this.getPool(e).get(t)}return(e){this.getPool(e.constructor).return(e)}getPool(e){return this._poolsByClass.has(e)||this._poolsByClass.set(e,new yi(e)),this._poolsByClass.get(e)}stats(){let e={};return this._poolsByClass.forEach(t=>{let r=e[t._classType.name]?t._classType.name+t._classType.ID:t._classType.name;e[r]={free:t.totalFree,used:t.totalUsed,size:t.totalSize}}),e}},He=new en}),Ii,tn=_(()=>{dt(),Ii={get isCachedAsTexture(){return!!this.renderGroup?.isCachedAsTexture},cacheAsTexture(e){typeof e=="boolean"&&e===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(e===!0?{}:e))},updateCacheTexture(){this.renderGroup?.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(e){We("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(e)}}});function mr(e,t,r){let i=e.length,n;if(t>=i||r===0)return;r=t+r>i?i-t:r;let s=i-r;for(n=t;n{"use strict"}),rn,ri=_(()=>{jt(),dt(),rn={allowChildren:!0,removeChildren(e=0,t){let r=t??this.children.length,i=r-e,n=[];if(i>0&&i<=r){for(let a=r-1;a>=e;a--){let o=this.children[a];o&&(n.push(o),o.parent=null)}mr(this.children,e,r);let s=this.renderGroup||this.parentRenderGroup;s&&s.removeChildren(n);for(let a=0;a=this.children.length)throw new Error(`getChildAt: Index (${e}) does not exist.`);return this.children[e]},setChildIndex(e,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(e),this.addChildAt(e,t)},getChildIndex(e){let t=this.children.indexOf(e);if(t===-1)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(e,t){this.allowChildren||We(Qe,"addChildAt: Only Containers will be allowed to add children in v8.0.0");let{children:r}=this;if(t<0||t>r.length)throw new Error(`${e}addChildAt: The index ${t} supplied is out of bounds ${r.length}`);if(e.parent){let n=e.parent.children.indexOf(e);if(e.parent===this&&n===t)return e;n!==-1&&e.parent.children.splice(n,1)}t===r.length?r.push(e):r.splice(t,0,e),e.parent=this,e.didChange=!0,e._updateFlags=15;let i=this.renderGroup||this.parentRenderGroup;return i&&i.addChild(e),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",e,this,t),e.emit("added",this),e},swapChildren(e,t){if(e===t)return;let r=this.getChildIndex(e),i=this.getChildIndex(t);this.children[r]=t,this.children[i]=e;let n=this.renderGroup||this.parentRenderGroup;n&&(n.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...e){return e.length===1?this.reparentChildAt(e[0],this.children.length):(e.forEach(t=>this.reparentChildAt(t,this.children.length)),e[0])},reparentChildAt(e,t){if(e.parent===this)return this.setChildIndex(e,t),e;let r=e.worldTransform.clone();e.removeFromParent(),this.addChildAt(e,t);let i=this.worldTransform.clone();return i.invert(),r.prepend(i),e.setFromMatrix(r),e}}}),ii,ni=_(()=>{"use strict";ii=class{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let e=0;e{re(),Ot(),si=class{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach(e=>{this.add({test:e.test,maskClass:e})}))}add(e){this._tests.push(e)}getMaskEffect(e){this._initialized||this.init();for(let t=0;t{ni(),On(),nn={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){let e=this.renderGroup||this.parentRenderGroup;e&&(e.structureDidChange=!0)},addEffect(e){this.effects.indexOf(e)===-1&&(this.effects.push(e),this.effects.sort((t,r)=>t.priority-r.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(e){let t=this.effects.indexOf(e);t!==-1&&(this.effects.splice(t,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(e){let t=this._maskEffect;t?.mask!==e&&(t&&(this.removeEffect(t),Lr.returnMaskEffect(t),this._maskEffect=null),e!=null&&(this._maskEffect=Lr.getMaskEffect(e),this.addEffect(this._maskEffect)))},setMask(e){this._maskOptions={...this._maskOptions,...e},e.mask&&(this.mask=e.mask),this._markStructureAsChanged()},get mask(){return this._maskEffect?.mask},set filters(e){!Array.isArray(e)&&e&&(e=[e]);let t=this._filterEffect||(this._filterEffect=new ii);e=e;let r=e?.length>0,i=t.filters?.length>0,n=r!==i;e=Array.isArray(e)?e.slice(0):e,t.filters=Object.freeze(e),n&&(r?this.addEffect(t):(this.removeEffect(t),t.filters=e??null))},get filters(){return this._filterEffect?.filters},set filterArea(e){this._filterEffect||(this._filterEffect=new ii),this._filterEffect.filterArea=e},get filterArea(){return this._filterEffect?.filterArea}}}),sn,Dn=_(()=>{dt(),sn={label:null,get name(){return We(Qe,"Container.name property has been removed, use Container.label instead"),this.label},set name(e){We(Qe,"Container.name property has been removed, use Container.label instead"),this.label=e},getChildByName(e,t=!1){return this.getChildByLabel(e,t)},getChildByLabel(e,t=!1){let r=this.children;for(let i=0;i{wt(),g=[new xe,new xe,new xe,new xe],b=class Oo{constructor(t=0,r=0,i=0,n=0){this.type="rectangle",this.x=Number(t),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 Oo(0,0,0,0)}clone(){return new Oo(this.x,this.y,this.width,this.height)}copyFromBounds(t){return this.x=t.minX,this.y=t.minY,this.width=t.maxX-t.minX,this.height=t.maxY-t.minY,this}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,r){return this.width<=0||this.height<=0?!1:t>=this.x&&t=this.y&&r=c&&t<=f&&r>=d&&r<=y&&!(t>x&&tw&&rt.right?t.right:this.right)<=oe)return!1;let ce=this.yt.bottom?t.bottom:this.bottom)>ce}let i=this.left,n=this.right,s=this.top,a=this.bottom;if(n<=i||a<=s)return!1;let o=g[0].set(t.left,t.top),l=g[1].set(t.left,t.bottom),h=g[2].set(t.right,t.top),u=g[3].set(t.right,t.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),y=f*i+d*s,x=f*n+d*s,v=f*i+d*a,w=f*n+d*a;if(Math.max(y,x,v,w)<=f*o.x+d*o.y||Math.min(y,x,v,w)>=f*u.x+d*u.y)return!1;let M=c*(o.y-h.y),O=c*(h.x-o.x),P=M*i+O*s,U=M*n+O*s,F=M*i+O*a,N=M*n+O*a;return!(Math.max(P,U,F,N)<=M*o.x+O*o.y||Math.min(P,U,F,N)>=M*u.x+O*u.y)}pad(t=0,r=t){return this.x-=t,this.y-=r,this.width+=t*2,this.height+=r*2,this}fit(t){let r=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),n=Math.max(this.y,t.y),s=Math.min(this.y+this.height,t.y+t.height);return this.x=r,this.width=Math.max(i-r,0),this.y=n,this.height=Math.max(s-n,0),this}ceil(t=1,r=.001){let i=Math.ceil((this.x+this.width-r)*t)/t,n=Math.ceil((this.y+this.height-r)*t)/t;return this.x=Math.floor((this.x+r)*t)/t,this.y=Math.floor((this.y+r)*t)/t,this.width=i-this.x,this.height=n-this.y,this}enlarge(t){let r=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),n=Math.min(this.y,t.y),s=Math.max(this.y+this.height,t.y+t.height);return this.x=r,this.width=i-r,this.y=n,this.height=s-n,this}getBounds(t){return t||(t=new Oo),t.copyFrom(this),t}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}}),p,m,T=_(()=>{Ze(),E(),p=new _e,m=class bv{constructor(t=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=p,this.minX=t,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 b);let t=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(t.x=0,t.y=0,t.width=0,t.height=0):t.copyFromBounds(this),t}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=p,this}set(t,r,i,n){this.minX=t,this.minY=r,this.maxX=i,this.maxY=n}addFrame(t,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,y=this.maxX,x=this.maxY,v=a*t+l*r+u,w=o*t+h*r+c;vy&&(y=v),w>x&&(x=w),v=a*i+l*r+u,w=o*i+h*r+c,vy&&(y=v),w>x&&(x=w),v=a*t+l*n+u,w=o*t+h*n+c,vy&&(y=v),w>x&&(x=w),v=a*i+l*n+u,w=o*i+h*n+c,vy&&(y=v),w>x&&(x=w),this.minX=f,this.minY=d,this.maxX=y,this.maxY=x}addRect(t,r){this.addFrame(t.x,t.y,t.x+t.width,t.y+t.height,r)}addBounds(t,r){this.addFrame(t.minX,t.minY,t.maxX,t.maxY,r)}addBoundsMask(t){this.minX=this.minX>t.minX?this.minX:t.minX,this.minY=this.minY>t.minY?this.minY:t.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(t){return this.minXt.right&&(this.maxX=t.right),this.minYt.bottom&&(this.maxY=t.bottom),this}fitBounds(t,r,i,n){return this.minXr&&(this.maxX=r),this.minYn&&(this.maxY=n),this}pad(t,r=t){return this.minX-=t,this.maxX+=t,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 bv(this.minX,this.minY,this.maxX,this.maxY)}scale(t,r=t){return this.minX*=t,this.minY*=r,this.maxX*=t,this.maxY*=r,this}get x(){return this.minX}set x(t){let r=this.maxX-this.minX;this.minX=t,this.maxX=t+r}get y(){return this.minY}set y(t){let r=this.maxY-this.minY;this.minY=t,this.maxY=t+r}get width(){return this.maxX-this.minX}set width(t){this.maxX=this.minX+t}get height(){return this.maxY-this.minY}set height(t){this.maxY=this.minY+t}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(t,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,y=n.ty;for(let x=r;xo?M:o,l=O>l?O:l}this.minX=s,this.minY=a,this.maxX=o,this.maxY=l}containsPoint(t,r){return this.minX<=t&&this.minY<=r&&this.maxX>=t&&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(t){return this.minX=t.minX,this.minY=t.minY,this.maxX=t.maxX,this.maxY=t.maxY,this}}}),S,C,k=_(()=>{Ze(),Ji(),T(),S=new yi(_e),C=new yi(m)});function D(e,t,r){r.clear();let i,n;return e.parent?t?i=e.parent.worldTransform:(n=S.get().identity(),i=V(e,n)):i=_e.IDENTITY,W(e,r,i,t),n&&S.return(n),r.isValid||r.set(0,0,0,0),r}function W(e,t,r,i){if(!e.visible||!e.measurable)return;let n;i?n=e.worldTransform:(e.updateLocalTransform(),n=S.get(),n.appendFrom(e.localTransform,r));let s=t,a=!!e.effects.length;if(a&&(t=C.get().clear()),e.boundsArea)t.addRect(e.boundsArea,n);else{e.bounds&&(t.matrix=n,t.addBounds(e.bounds));for(let o=0;o{Ze(),k()});function H(e,t){if(e===16777215||!t)return t;if(t===16777215||!e)return e;let r=e>>16&255,i=e>>8&255,n=e&255,s=t>>16&255,a=t>>8&255,o=t&255,l=r*s/255|0,h=i*a/255|0,u=n*o/255|0;return(l<<16)+(h<<8)+u}var G=_(()=>{"use strict"});function K(e,t){return e===L?t:t===L?e:H(e,t)}var L,J=_(()=>{G(),L=16777215});function ue(e){return((e&255)<<16)+(e&65280)+(e>>16&255)}var ne,Be=_(()=>{Y(),k(),J(),ne={getGlobalAlpha(e){if(e)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let t=this.alpha,r=this.parent;for(;r;)t*=r.alpha,r=r.parent;return t},getGlobalTransform(e,t){if(t)return e.copyFrom(this.worldTransform);this.updateLocalTransform();let r=V(this,S.get().identity());return e.appendFrom(this.localTransform,r),S.return(r),e},getGlobalTint(e){if(e)return this.renderGroup?ue(this.renderGroup.worldColor):this.parentRenderGroup?ue(K(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,r=this.parent;for(;r;)t=K(t,r.localColor),r=r.parent;return ue(t)}}});function ge(...e){ze!==ot&&(ze++,ze===ot?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...e))}var ze,ot,Fe=_(()=>{"use strict";ze=0,ot=500});function ur(e,t,r){return t.clear(),r||(r=_e.IDENTITY),Ae(e,t,r,e,!0),t.isValid||t.set(0,0,0,0),t}function Ae(e,t,r,i,n){let s;if(n)s=S.get(),s=r.copyTo(s);else{if(!e.visible||!e.measurable)return;e.updateLocalTransform();let l=e.localTransform;s=S.get(),s.appendFrom(l,r)}let a=t,o=!!e.effects.length;if(o&&(t=C.get().clear()),e.boundsArea)t.addRect(e.boundsArea,s);else{e.renderPipeId&&(t.matrix=s,t.addBounds(e.bounds));let l=e.children;for(let h=0;h{Ze(),k()});function Ye(e,t){let r=e.children;for(let i=0;i{"use strict"}),gt,ht,Qt=_(()=>{Ze(),T(),Y(),Oe(),lt(),gt=new _e,ht={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(e,t){let r=Math.sign(this.scale.x)||1;t!==0?this.scale.x=e/t*r:this.scale.x=r},_setHeight(e,t){let r=Math.sign(this.scale.y)||1;t!==0?this.scale.y=e/t*r:this.scale.y=r},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new m});let e=this._localBoundsCacheData;return e.index=1,e.didChange=!1,e.data[0]!==this._didViewChangeTick&&(e.didChange=!0,e.data[0]=this._didViewChangeTick),Ye(this,e),e.didChange&&ur(this,e.localBounds,gt),e.localBounds},getBounds(e,t){return D(this,e,t||new m)}}}),qt,vt=_(()=>{"use strict";qt={_onRender:null,set onRender(e){let t=this.renderGroup||this.parentRenderGroup;if(!e){this._onRender&&t?.removeOnRender(this),this._onRender=null;return}this._onRender||t?.addOnRender(this),this._onRender=e},get onRender(){return this._onRender}}});function _r(e,t){return e._zIndex-t._zIndex}var Nr,Un=_(()=>{"use strict";Nr={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(e){this._zIndex!==e&&(this._zIndex=e,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(_r))}}}),Fc,Jv=_(()=>{wt(),k(),Fc={getGlobalPosition(e=new xe,t=!1){return this.parent?this.parent.toGlobal(this._position,e,t):(e.x=this._position.x,e.y=this._position.y),e},toGlobal(e,t,r=!1){let i=this.getGlobalTransform(S.get(),r);return t=i.apply(e,t),S.return(i),t},toLocal(e,t,r,i){t&&(e=t.toGlobal(e,r,i));let n=this.getGlobalTransform(S.get(),i);return r=n.applyInverse(e,r),S.return(n),r}}}),Uo,Lc=_(()=>{At(),Uo=class{constructor(){this.uid=ut("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.gcTick=0}reset(){this.instructionSize=0}add(e){this.instructions[this.instructionSize++]=e}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}});function an(e){return e+=e===0?1:0,--e,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e+1}function Nc(e){return!(e&e-1)&&!!e}var Ls=_(()=>{"use strict"});function ey(e){let t={};for(let r in e)e[r]!==void 0&&(t[r]=e[r]);return t}var ty=_(()=>{"use strict"});function ry(e){let t=Fo[e];return t===void 0&&(Fo[e]=ut("resource")),t}var Fo,Lo,No,Hc=_(()=>{xt(),At(),dt(),Fo=Object.create(null),Lo=class wv extends et{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...wv.defaultOptions,...t},this.addressMode=t.addressMode,this.addressModeU=t.addressModeU??this.addressModeU,this.addressModeV=t.addressModeV??this.addressModeV,this.addressModeW=t.addressModeW??this.addressModeW,this.scaleMode=t.scaleMode,this.magFilter=t.magFilter??this.magFilter,this.minFilter=t.minFilter??this.minFilter,this.mipmapFilter=t.mipmapFilter??this.mipmapFilter,this.lodMinClamp=t.lodMinClamp,this.lodMaxClamp=t.lodMaxClamp,this.compare=t.compare,this.maxAnisotropy=t.maxAnisotropy??1}set addressMode(t){this.addressModeU=t,this.addressModeV=t,this.addressModeW=t}get addressMode(){return this.addressModeU}set wrapMode(t){We(Qe,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=t}get wrapMode(){return this.addressMode}set scaleMode(t){this.magFilter=t,this.minFilter=t,this.mipmapFilter=t}get scaleMode(){return this.magFilter}set maxAnisotropy(t){this._maxAnisotropy=Math.min(t,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 t=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=ry(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}},Lo.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"},No=Lo}),Ho,Nt,vr=_(()=>{xt(),Ls(),ty(),At(),Hc(),Ho=class Tv extends et{constructor(t={}){super(),this.options=t,this.uid=ut("textureSource"),this._resourceType="textureSource",this._resourceId=ut("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,t={...Tv.defaultOptions,...t},this.label=t.label??"",this.resource=t.resource,this.autoGarbageCollect=t.autoGarbageCollect,this._resolution=t.resolution,t.width?this.pixelWidth=t.width*this._resolution:this.pixelWidth=this.resource?this.resourceWidth??1:1,t.height?this.pixelHeight=t.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=t.format,this.dimension=t.dimensions,this.mipLevelCount=t.mipLevelCount,this.autoGenerateMipmaps=t.autoGenerateMipmaps,this.sampleCount=t.sampleCount,this.antialias=t.antialias,this.alphaMode=t.alphaMode,this.style=new No(ey(t)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(t){this.style!==t&&(this._style?.off("change",this._onStyleChange,this),this._style=t,this._style?.on("change",this._onStyleChange,this),this._onStyleChange())}get addressMode(){return this._style.addressMode}set addressMode(t){this._style.addressMode=t}get repeatMode(){return this._style.addressMode}set repeatMode(t){this._style.addressMode=t}get magFilter(){return this._style.magFilter}set magFilter(t){this._style.magFilter=t}get minFilter(){return this._style.minFilter}set minFilter(t){this._style.minFilter=t}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(t){this._style.mipmapFilter=t}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(t){this._style.lodMinClamp=t}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(t){this._style.lodMaxClamp=t}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){let t=this._resolution;if(this.resize(this.resourceWidth/t,this.resourceHeight/t))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=ut("resource"),this.emit("change",this),this.emit("unload",this)}get resourceWidth(){let{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){let{resource:t}=this;return t.naturalHeight||t.videoHeight||t.displayHeight||t.height}get resolution(){return this._resolution}set resolution(t){this._resolution!==t&&(this._resolution=t,this.width=this.pixelWidth/t,this.height=this.pixelHeight/t)}resize(t,r,i){i||(i=this._resolution),t||(t=this.width),r||(r=this.height);let n=Math.round(t*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=ut("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(t){this._style.wrapMode=t}get wrapMode(){return this._style.wrapMode}set scaleMode(t){this._style.scaleMode=t}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=Nc(this.pixelWidth)&&Nc(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}},Ho.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1},Nt=Ho});function iy(){for(let e=0;e<16;e++){let t=[];Ns.push(t);for(let r=0;r<16;r++){let i=Fn(xi[e]*xi[r]+wi[e]*bi[r]),n=Fn(bi[e]*xi[r]+Ti[e]*bi[r]),s=Fn(xi[e]*wi[r]+wi[e]*Ti[r]),a=Fn(bi[e]*wi[r]+Ti[e]*Ti[r]);for(let o=0;o<16;o++)if(xi[o]===i&&bi[o]===n&&wi[o]===s&&Ti[o]===a){t.push(o);break}}}for(let e=0;e<16;e++){let t=new _e;t.set(xi[e],bi[e],wi[e],Ti[e],0,0),zo.push(t)}}var xi,bi,wi,Ti,Ns,zo,Fn,Tt,ny=_(()=>{Ze(),xi=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],bi=[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],Ti=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Ns=[],zo=[],Fn=Math.sign,iy(),Tt={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:e=>xi[e],uY:e=>bi[e],vX:e=>wi[e],vY:e=>Ti[e],inv:e=>e&8?e&15:-e&7,add:(e,t)=>Ns[e][t],sub:(e,t)=>Ns[e][Tt.inv(t)],rotate180:e=>e^4,isVertical:e=>(e&3)===2,byDirection:(e,t)=>Math.abs(e)*2<=Math.abs(t)?t>=0?Tt.S:Tt.N:Math.abs(t)*2<=Math.abs(e)?e>0?Tt.E:Tt.W:t>0?e>0?Tt.SE:Tt.SW:e>0?Tt.NE:Tt.NW,matrixAppendRotationInv:(e,t,r=0,i=0)=>{let n=zo[Tt.inv(t)];n.tx=r,n.ty=i,e.append(n)}}}),Vo,sy=_(()=>{"use strict";Vo=()=>{}}),Hs,zc=_(()=>{re(),vr(),Hs=class extends Nt{constructor(e){let t=e.resource||new Float32Array(e.width*e.height*4),r=e.format;r||(t instanceof Float32Array?r="rgba32float":t instanceof Int32Array||t instanceof Uint32Array?r="rgba32uint":t instanceof Int16Array||t instanceof Uint16Array?r="rgba16uint":(t instanceof Int8Array,r="bgra8unorm")),super({...e,resource:t,format:r}),this.uploadMethodId="buffer"}static test(e){return e instanceof Int8Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array}},Hs.extension=I.TextureSource}),Wo,jo,Vc=_(()=>{Ze(),Wo=new _e,jo=class{constructor(e,t){this.mapCoord=new _e,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof t>"u"?this.clampMargin=e.width<10?0:.5:this.clampMargin=t,this.isSimple=!1,this.texture=e}get texture(){return this._texture}set texture(e){this.texture!==e&&(this._texture?.removeListener("update",this.update,this),this._texture=e,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(e,t){t===void 0&&(t=e);let r=this.mapCoord;for(let i=0;i{xt(),ny(),E(),At(),dt(),sy(),zc(),vr(),Vc(),Ie=class extends et{constructor({source:e,label:t,frame:r,orig:i,trim:n,defaultAnchor:s,defaultBorders:a,rotate:o,dynamic:l}={}){if(super(),this.uid=ut("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new b,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=t,this.source=e?.source??new Nt,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(e){this._source&&this._source.off("resize",this.update,this),this._source=e,e.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new jo(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){let{uvs:e,frame:t}=this,{width:r,height:i}=this._source,n=t.x/r,s=t.y/i,a=t.width/r,o=t.height/i,l=this.rotate;if(l){let h=a/2,u=o/2,c=n+h,f=s+u;l=Tt.add(l,Tt.NW),e.x0=c+h*Tt.uX(l),e.y0=f+u*Tt.uY(l),l=Tt.add(l,2),e.x1=c+h*Tt.uX(l),e.y1=f+u*Tt.uY(l),l=Tt.add(l,2),e.x2=c+h*Tt.uX(l),e.y2=f+u*Tt.uY(l),l=Tt.add(l,2),e.x3=c+h*Tt.uX(l),e.y3=f+u*Tt.uY(l)}else e.x0=n,e.y0=s,e.x1=n+a,e.y1=s,e.x2=n+a,e.y2=s+o,e.x3=n,e.y3=s+o}destroy(e=!1){this._source&&e&&(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 We(Qe,"Texture.baseTexture is now Texture.source"),this._source}},Ie.EMPTY=new Ie({label:"EMPTY",source:new Nt({label:"EMPTY"})}),Ie.EMPTY.destroy=Vo,Ie.WHITE=new Ie({source:new Hs({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"}),Ie.WHITE.destroy=Vo}),Wc,jc,Kt,Oi=_(()=>{Ls(),vr(),mt(),Wc=0,jc=class{constructor(e){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1}createTexture(e,t,r){let i=new Nt({...this.textureOptions,width:e,height:t,resolution:1,antialias:r,autoGarbageCollect:!0});return new Ie({source:i,label:`texturePool_${Wc++}`})}getOptimalTexture(e,t,r=1,i){let n=Math.ceil(e*r-1e-6),s=Math.ceil(t*r-1e-6);n=an(n),s=an(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=e,o.frame.height=t,o.updateUvs(),this._poolKeyHash[o.uid]=a,o}getSameSizeTexture(e,t=!1){let r=e.source;return this.getOptimalTexture(e.width,e.height,r._resolution,t)}returnTexture(e){let t=this._poolKeyHash[e.uid];this._texturePool[t].push(e)}clear(e){if(e=e!==!1,e)for(let t in this._texturePool){let r=this._texturePool[t];if(r)for(let i=0;i{Ze(),Lc(),Oi(),$c=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new _e,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 Uo,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(e){this.root=e,e._onRender&&this.addOnRender(e),e.didChange=!0;let t=e.children;for(let r=0;r-1&&this.renderGroupChildren.splice(t,1),e.renderGroupParent=null}addChild(e){if(this.structureDidChange=!0,e.parentRenderGroup=this,e.updateTick=-1,e.parent===this.root?e.relativeRenderGroupDepth=1:e.relativeRenderGroupDepth=e.parent.relativeRenderGroupDepth+1,e.didChange=!0,this.onChildUpdate(e),e.renderGroup){this.addRenderGroupChild(e.renderGroup);return}e._onRender&&this.addOnRender(e);let t=e.children;for(let r=0;r0}addOnRender(e){this._onRenderContainers.push(e)}removeOnRender(e){this._onRenderContainers.splice(this._onRenderContainers.indexOf(e),1)}runOnRender(){for(let e=0;e{"use strict"}),zs,Vs,Ws,Ln,js,on,St,Hr=_(()=>{xt(),Ne(),Pe(),Ze(),it(),ti(),At(),dt(),Ot(),tn(),ri(),Gi(),Dn(),Be(),Qt(),vt(),Un(),Jv(),ay(),ly(),zs=new Pt(null),Vs=new Pt(null),Ws=new Pt(null,1,1),Ln=1,js=2,on=4,St=class Sv extends et{constructor(t={}){super(),this.uid=ut("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 _e,this.relativeGroupTransform=new _e,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new Pt(this,0,0),this._scale=Ws,this._pivot=Vs,this._skew=zs,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=[],oy(this,t,{children:!0,parent:!0,effects:!0}),t.children?.forEach(r=>this.addChild(r)),t.parent?.addChild(this)}static mixin(t){Object.defineProperties(Sv.prototype,Object.getOwnPropertyDescriptors(t))}set _didChangeId(t){this._didViewChangeTick=t>>12&4095,this._didContainerChangeTick=t&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...t){if(this.allowChildren||We(Qe,"addChild: Only Containers will be allowed to add children in v8.0.0"),t.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.parent=null,this.emit("childRemoved",r,this,i),r.emit("removed",this)),r}_onUpdate(t){t&&t===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(t){!!this.renderGroup!==t&&(t?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),this.renderGroup=He.get($c,this),this.groupTransform=_e.IDENTITY,t?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),He.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,t?.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new _e),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(t){this._position.x=t}get y(){return this._position.y}set y(t){this._position.y=t}get position(){return this._position}set position(t){this._position.copyFrom(t)}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this._onUpdate(this._skew))}get angle(){return this.rotation*ye}set angle(t){this.rotation=t*Re}get pivot(){return this._pivot===Vs&&(this._pivot=new Pt(this,0,0)),this._pivot}set pivot(t){this._pivot===Vs&&(this._pivot=new Pt(this,0,0)),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===zs&&(this._skew=new Pt(this,0,0)),this._skew}set skew(t){this._skew===zs&&(this._skew=new Pt(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===Ws&&(this._scale=new Pt(this,1,1)),this._scale}set scale(t){this._scale===Ws&&(this._scale=new Pt(this,0,0)),typeof t=="number"?this._scale.set(t):this._scale.copyFrom(t)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(t){let r=this.getLocalBounds().width;this._setWidth(t,r)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){let r=this.getLocalBounds().height;this._setHeight(t,r)}getSize(t){t||(t={});let r=this.getLocalBounds();return t.width=Math.abs(this.scale.x*r.width),t.height=Math.abs(this.scale.y*r.height),t}setSize(t,r){let i=this.getLocalBounds();typeof t=="object"?(r=t.height??t.width,t=t.width):r??(r=t),t!==void 0&&this._setWidth(t,i.width),r!==void 0&&this._setHeight(r,i.height)}_updateSkew(){let t=this._rotation,r=this._skew;this._cx=Math.cos(t+r._y),this._sx=Math.sin(t+r._y),this._cy=-Math.sin(t-r._x),this._sy=Math.cos(t-r._x)}updateTransform(t){return this.position.set(typeof t.x=="number"?t.x:this.position.x,typeof t.y=="number"?t.y:this.position.y),this.scale.set(typeof t.scaleX=="number"?t.scaleX||1:this.scale.x,typeof t.scaleY=="number"?t.scaleY||1:this.scale.y),this.rotation=typeof t.rotation=="number"?t.rotation:this.rotation,this.skew.set(typeof t.skewX=="number"?t.skewX:this.skew.x,typeof t.skewY=="number"?t.skewY:this.skew.y),this.pivot.set(typeof t.pivotX=="number"?t.pivotX:this.pivot.x,typeof t.pivotY=="number"?t.pivotY:this.pivot.y),this}setFromMatrix(t){t.decompose(this)}updateLocalTransform(){let t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;let r=this.localTransform,i=this._scale,n=this._pivot,s=this._position,a=i._x,o=i._y,l=n._x,h=n._y;r.a=this._cx*a,r.b=this._sx*a,r.c=this._cy*o,r.d=this._sy*o,r.tx=s._x-(l*r.a+h*r.c),r.ty=s._y-(l*r.b+h*r.d)}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=Ln,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){let r=Ce.shared.setValue(t??16777215).toBgrNumber();r!==this.localColor&&(this.localColor=r,this._updateFlags|=Ln,this._onUpdate())}get tint(){return ue(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=js,this.localBlendMode=t,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(t){let r=t?2:0;(this.localDisplayStatus&2)!==r&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=on,this.localDisplayStatus^=2,this._onUpdate())}get culled(){return!(this.localDisplayStatus&4)}set culled(t){let r=t?0:4;(this.localDisplayStatus&4)!==r&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=on,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(t){let r=t?1:0;(this.localDisplayStatus&1)!==r&&(this._updateFlags|=on,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(t=!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._skew=null,this.emit("destroyed",this),this.removeAllListeners(),(typeof t=="boolean"?t:t?.children)&&r)for(let i=0;i{wt(),$s=class Ev{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=Ev.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new xe,this.page=new xe,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(t,r,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,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 hy(e){return function(t){return t.test(e)}}function Xc(e){var t={userAgent:"",platform:"",maxTouchPoints:0};!e&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof e=="string"?t.userAgent=e:e&&e.userAgent&&(t={userAgent:e.userAgent,platform:e.platform,maxTouchPoints:e.maxTouchPoints||0});var r=t.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=hy(r),s={apple:{phone:n(Xs)&&!n(zr),ipod:n(Xo),tablet:!n(Xs)&&(n(Yo)||il(t))&&!n(zr),universal:n(qo),device:(n(Xs)||n(Xo)||n(Yo)||n(qo)||il(t))&&!n(zr)},amazon:{phone:n(Di),tablet:!n(Di)&&n(Nn),device:n(Di)||n(Nn)},android:{phone:!n(zr)&&n(Di)||!n(zr)&&n(Ys),tablet:!n(zr)&&!n(Di)&&!n(Ys)&&(n(Nn)||n(Ko)),device:!n(zr)&&(n(Di)||n(Nn)||n(Ys)||n(Ko))||n(/\bokhttp\b/i)},windows:{phone:n(zr),tablet:n(Zo),device:n(zr)||n(Zo)},other:{blackberry:n(Qo),blackberry10:n(Jo),opera:n(el),firefox:n(rl),chrome:n(tl),device:n(Qo)||n(Jo)||n(el)||n(rl)||n(tl)},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 Xs,Xo,Yo,qo,Ys,Ko,Di,Nn,zr,Zo,Qo,Jo,el,tl,rl,il,Yc=_(()=>{Xs=/iPhone/i,Xo=/iPod/i,Yo=/iPad/i,qo=/\biOS-universal(?:.+)Mac\b/i,Ys=/\bAndroid(?:.+)Mobile\b/i,Ko=/Android/i,Di=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Nn=/Silk/i,zr=/Windows Phone/i,Zo=/\bWindows(?:.+)ARM\b/i,Qo=/BlackBerry/i,Jo=/BB10/i,el=/Opera Mini/i,tl=/\b(CriOS|Chrome)(?:.+)Mobile/i,rl=/Mobile(?:.+)Firefox\b/i,il=function(e){return typeof e<"u"&&e.platform==="MacIntel"&&typeof e.maxTouchPoints=="number"&&e.maxTouchPoints>1&&typeof MSStream>"u"}}),uy=_(()=>{Yc(),Yc()}),qc,Kc,cy=_(()=>{uy(),qc=Xc.default??Xc,Kc=qc(globalThis.navigator)}),Zc,Hn,Qc,Jc,nl,sl,ed,td,rd,al,dy=_(()=>{$o(),re(),cy(),jt(),Zc=9,Hn=100,Qc=0,Jc=0,nl=2,sl=1,ed=-1e3,td=-1e3,rd=2,al=class{constructor(e,t=Kc){this._mobileInfo=t,this.debug=!1,this._isActive=!1,this._isMobileAccessibility=!1,this._pool=[],this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._hookDiv=null,(t.tablet||t.phone)&&this._createTouchHook();let r=document.createElement("div");r.style.width=`${Hn}px`,r.style.height=`${Hn}px`,r.style.position="absolute",r.style.top=`${Qc}px`,r.style.left=`${Jc}px`,r.style.zIndex=nl.toString(),this._div=r,this._renderer=e,this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}_createTouchHook(){let e=document.createElement("button");e.style.width=`${sl}px`,e.style.height=`${sl}px`,e.style.position="absolute",e.style.top=`${ed}px`,e.style.left=`${td}px`,e.style.zIndex=rd.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(){this._isActive||(this._isActive=!0,globalThis.document.addEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown,!1),this._renderer.runners.postrender.add(this),this._renderer.view.canvas.parentNode?.appendChild(this._div))}_deactivate(){!this._isActive||this._isMobileAccessibility||(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.addEventListener("keydown",this._onKeyDown,!1),this._renderer.runners.postrender.remove(this),this._div.parentNode?.removeChild(this._div))}_updateAccessibleObjects(e){if(!e.visible||!e.accessibleChildren)return;e.accessible&&e.isInteractive()&&(e._accessibleActive||this._addChild(e),e._renderId=this._renderId);let t=e.children;if(t)for(let r=0;r 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:t,height:r}=this._renderer;e.x+e.width>t&&(e.width=t-e.x),e.y+e.height>r&&(e.height=r-e.y)}_addChild(e){let t=this._pool.pop();t||(t=document.createElement("button"),t.style.width=`${Hn}px`,t.style.height=`${Hn}px`,t.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",t.style.position="absolute",t.style.zIndex=nl.toString(),t.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?t.setAttribute("aria-live","off"):t.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?t.setAttribute("aria-relevant","additions"):t.setAttribute("aria-relevant","text"),t.addEventListener("click",this._onClick.bind(this)),t.addEventListener("focus",this._onFocus.bind(this)),t.addEventListener("focusout",this._onFocusOut.bind(this))),t.style.pointerEvents=e.accessiblePointerEvents,t.type=e.accessibleType,e.accessibleTitle&&e.accessibleTitle!==null?t.title=e.accessibleTitle:(!e.accessibleHint||e.accessibleHint===null)&&(t.title=`container ${e.tabIndex}`),e.accessibleHint&&e.accessibleHint!==null&&t.setAttribute("aria-label",e.accessibleHint),this.debug&&this._updateDebugHTML(t),e._accessibleActive=!0,e._accessibleDiv=t,t.container=e,this._children.push(e),this._div.appendChild(e._accessibleDiv),e._accessibleDiv.tabIndex=e.tabIndex}_dispatchEvent(e,t){let{container:r}=e.target,i=this._renderer.events.rootBoundary,n=Object.assign(new $s(i),{target:r});i.rootTarget=this._renderer.lastObjectRendered,t.forEach(s=>i.dispatchEvent(n,s))}_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===Zc&&this._activate()}_onMouseMove(e){e.movementX===0&&e.movementY===0||this._deactivate()}destroy(){this._destroyTouchHook(),this._div=null,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown),this._pool=null,this._children=null,this._renderer=null}},al.extension={type:[I.WebGLSystem,I.WebGPUSystem],name:"accessibility"}}),id,fy=_(()=>{"use strict";id={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,_renderId:-1}}),py=_(()=>{re(),Hr(),dy(),fy(),fe.add(al),St.mixin(id)}),ol,gy=_(()=>{re(),ol=class{static init(e){Object.defineProperty(this,"resizeTo",{set(t){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=t,t&&(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 t,r;if(this._resizeTo===globalThis.window)t=globalThis.innerWidth,r=globalThis.innerHeight;else{let{clientWidth:i,clientHeight:n}=this._resizeTo;t=i,r=n}this.renderer.resize(t,r),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=e.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}},ol.extension=I.Application}),ln,ll=_(()=>{"use strict";ln=(e=>(e[e.INTERACTION=50]="INTERACTION",e[e.HIGH=25]="HIGH",e[e.NORMAL=0]="NORMAL",e[e.LOW=-25]="LOW",e[e.UTILITY=-50]="UTILITY",e))(ln||{})}),qs,my=_(()=>{"use strict";qs=class{constructor(e,t=null,r=0,i=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=e,this._context=t,this.priority=r,this._once=i}match(e,t=null){return this._fn===e&&this._context===t}emit(e){this._fn&&(this._context?this._fn.call(this._context,e):this._fn(e));let t=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),t}connect(e){this.previous=e,e.next&&(e.next.previous=this),this.next=e.next,e.next=this}destroy(e=!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 t=this.next;return this.next=e?null:t,this.previous=null,t}}}),hl,Mr,Ks=_(()=>{ll(),my(),hl=class xr{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 qs(null,null,1/0),this.deltaMS=1/xr.targetFPMS,this.elapsedMS=1/xr.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,r,i=ln.NORMAL){return this._addListener(new qs(t,r,i))}addOnce(t,r,i=ln.NORMAL){return this._addListener(new qs(t,r,i,!0))}_addListener(t){let r=this._head.next,i=this._head;if(!r)t.connect(i);else{for(;r;){if(t.priority>r.priority){t.connect(i);break}i=r,r=r.next}t.previous||t.connect(i)}return this._startIfPossible(),this}remove(t,r){let i=this._head.next;for(;i;)i.match(t,r)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,r=this._head;for(;r=r.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let r;if(t>this.lastTime){if(r=this.elapsedMS=t-this.lastTime,r>this._maxElapsedMS&&(r=this._maxElapsedMS),r*=this.speed,this._minElapsedMS){let s=t-this._lastFrame|0;if(s{re(),ll(),Ks(),ul=class{static init(e){e=Object.assign({autoStart:!0,sharedTicker:!1},e),Object.defineProperty(this,"ticker",{set(t){this._ticker&&this._ticker.remove(this.render,this),this._ticker=t,t&&t.add(this.render,this,ln.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?Mr.shared:new Mr,e.autoStart&&this.start()}static destroy(){if(this._ticker){let e=this._ticker;this.ticker=null,e.destroy()}}},ul.extension=I.Application}),nd=_(()=>{re(),gy(),_y(),fe.add(ol),fe.add(ul)}),sd,ai,ad=_(()=>{ll(),Ks(),sd=class{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}init(e){this.removeTickerListener(),this.events=e,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(e){this._pauseUpdate=e}addTickerListener(){this._tickerAdded||!this.domElement||(Mr.system.add(this._tickerUpdate,this,ln.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(Mr.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 e=this.events._rootPointerEvent;this.events.supportsTouchEvents&&e.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType,pointerId:e.pointerId}))}_tickerUpdate(e){this._deltaTime+=e.deltaTime,!(this._deltaTime{wt(),$o(),zn=class extends $s{constructor(){super(...arguments),this.client=new xe,this.movement=new xe,this.offset=new xe,this.global=new xe,this.screen=new xe}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(e,t,r){return e.worldTransform.applyInverse(r||this.global,t)}getModifierState(e){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(e)}initMouseEvent(e,t,r,i,n,s,a,o,l,h,u,c,f,d,y){throw new Error("Method not implemented.")}}}),Tr,od=_(()=>{cl(),Tr=class extends zn{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!")}}}),Ui,ld=_(()=>{cl(),Ui=class extends zn{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}},Ui.DOM_DELTA_PIXEL=0,Ui.DOM_DELTA_LINE=1,Ui.DOM_DELTA_PAGE=2}),hd,ud,hn,cd,vy=_(()=>{xt(),wt(),Fe(),ad(),cl(),od(),ld(),hd=2048,ud=new xe,hn=new xe,cd=class{constructor(e){this.dispatch=new et,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=e,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(e,t){this.mappingTable[e]||(this.mappingTable[e]=[]),this.mappingTable[e].push({fn:t,priority:0}),this.mappingTable[e].sort((r,i)=>r.priority-i.priority)}dispatchEvent(e,t){e.propagationStopped=!1,e.propagationImmediatelyStopped=!1,this.propagate(e,t),this.dispatch.emit(t||e.type,e)}mapEvent(e){if(!this.rootTarget)return;let t=this.mappingTable[e.type];if(t)for(let r=0,i=t.length;r=0;i--)if(e.currentTarget=r[i],this.notifyTarget(e,t),e.propagationStopped||e.propagationImmediatelyStopped)return}}all(e,t,r=this._allInteractiveElements){if(r.length===0)return;e.eventPhase=e.BUBBLING_PHASE;let i=Array.isArray(t)?t:[t];for(let n=r.length-1;n>=0;n--)i.forEach(s=>{e.currentTarget=r[n],this.notifyTarget(e,s)})}propagationPath(e){let t=[e];for(let r=0;r=0;u--){let c=h[u],f=this.hitTestMoveRecursive(c,this._isInteractive(t)?t:c.eventMode,r,i,n,s||n(e,r));if(f){if(f.length>0&&!f[f.length-1].parent)continue;let d=e.isInteractive();(f.length>0||d)&&(d&&this._allInteractiveElements.push(e),f.push(e)),this._hitElements.length===0&&(this._hitElements=f),a=!0}}}let o=this._isInteractive(t),l=e.isInteractive();return l&&l&&this._allInteractiveElements.push(e),s||this._hitElements.length>0?null:a?this._hitElements:o&&!n(e,r)&&i(e,r)?l?[e]:[]:null}hitTestRecursive(e,t,r,i,n){if(this._interactivePrune(e)||n(e,r))return null;if((e.eventMode==="dynamic"||t==="dynamic")&&(ai.pauseUpdate=!1),e.interactiveChildren&&e.children){let o=e.children,l=r;for(let h=o.length-1;h>=0;h--){let u=o[h],c=this.hitTestRecursive(u,this._isInteractive(t)?t:u.eventMode,l,i,n);if(c){if(c.length>0&&!c[c.length-1].parent)continue;let f=e.isInteractive();return(c.length>0||f)&&c.push(e),c}}}let s=this._isInteractive(t),a=e.isInteractive();return s&&i(e,r)?a?[e]:[]:null}_isInteractive(e){return e==="static"||e==="dynamic"}_interactivePrune(e){return!e||!e.visible||!e.renderable||!e.measurable||e.eventMode==="none"||e.eventMode==="passive"&&!e.interactiveChildren}hitPruneFn(e,t){if(e.hitArea&&(e.worldTransform.applyInverse(t,hn),!e.hitArea.contains(hn.x,hn.y)))return!0;if(e.effects&&e.effects.length)for(let r=0;r0&&n!==t.target){let o=e.type==="mousemove"?"mouseout":"pointerout",l=this.createPointerEvent(e,o,n);if(this.dispatchEvent(l,"pointerout"),r&&this.dispatchEvent(l,"mouseout"),!t.composedPath().includes(n)){let h=this.createPointerEvent(e,"pointerleave",n);for(h.eventPhase=h.AT_TARGET;h.target&&!t.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!==t.target){let o=e.type==="mousemove"?"mouseover":"pointerover",l=this.clonePointerEvent(t,o);this.dispatchEvent(l,"pointerover"),r&&this.dispatchEvent(l,"mouseover");let h=n?.parent;for(;h&&h!==this.rootTarget.parent&&h!==t.target;)h=h.parent;if(!h||h===this.rootTarget.parent){let u=this.clonePointerEvent(t,"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(t,"pointermove"),a&&s.push("globalpointermove"),t.pointerType==="touch"&&(this.moveOnAll?s.splice(1,0,"touchmove"):this.dispatchEvent(t,"touchmove"),a&&s.push("globaltouchmove")),r&&(this.moveOnAll?s.splice(1,0,"mousemove"):this.dispatchEvent(t,"mousemove"),a&&s.push("globalmousemove"),this.cursor=t.target?.cursor),s.length>0&&this.all(t,s),this._allInteractiveElements.length=0,this._hitElements.length=0,i.overTargets=t.composedPath(),this.freeEvent(t)}mapPointerOver(e){if(!(e instanceof Tr)){ge("EventBoundary cannot map a non-pointer event as a pointer event");return}let t=this.trackingData(e.pointerId),r=this.createPointerEvent(e),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;t.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(n)}mapPointerOut(e){if(!(e instanceof Tr)){ge("EventBoundary cannot map a non-pointer event as a pointer event");return}let t=this.trackingData(e.pointerId);if(t.overTargets){let r=e.pointerType==="mouse"||e.pointerType==="pen",i=this.findMountedTarget(t.overTargets),n=this.createPointerEvent(e,"pointerout",i);this.dispatchEvent(n),r&&this.dispatchEvent(n,"mouseout");let s=this.createPointerEvent(e,"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;t.overTargets=null,this.freeEvent(n),this.freeEvent(s)}this.cursor=null}mapPointerUp(e){if(!(e instanceof Tr)){ge("EventBoundary cannot map a non-pointer event as a pointer event");return}let t=performance.now(),r=this.createPointerEvent(e);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(e.pointerId),n=this.findMountedTarget(i.pressTargetsByButton[e.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[e.button],s=a}if(s){let a=this.clonePointerEvent(r,"click");a.target=s,a.path=null,i.clicksByButton[e.button]||(i.clicksByButton[e.button]={clickCount:0,target:a.target,timeStamp:t});let o=i.clicksByButton[e.button];if(o.target===a.target&&t-o.timeStamp<200?++o.clickCount:o.clickCount=1,o.target=a.target,o.timeStamp=t,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(e){if(!(e instanceof Tr)){ge("EventBoundary cannot map a non-pointer event as a pointer event");return}let t=this.trackingData(e.pointerId),r=this.findMountedTarget(t.pressTargetsByButton[e.button]),i=this.createPointerEvent(e);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 t.pressTargetsByButton[e.button]}this.freeEvent(i)}mapWheel(e){if(!(e instanceof Ui)){ge("EventBoundary cannot map a non-wheel event as a wheel event");return}let t=this.createWheelEvent(e);this.dispatchEvent(t),this.freeEvent(t)}findMountedTarget(e){if(!e)return null;let t=e[0];for(let r=1;r{re(),vy(),ad(),od(),ld(),dd=1,fd={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Zs=class Pc{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new cd(null),ai.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new Tr(null),this._rootWheelEvent=new Ui(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...Pc.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(t){let{canvas:r,resolution:i}=this.renderer;this.setTargetElement(r),this.resolution=i,Pc._defaultEventMode=t.eventMode??"passive",Object.assign(this.features,t.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(t){this.resolution=t}destroy(){this.setTargetElement(null),this.renderer=null,this._currentCursor=null}setCursor(t){t||(t="default");let r=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(r=!1),this._currentCursor===t)return;this._currentCursor=t;let i=this.cursorStyles[t];if(i)switch(typeof i){case"string":r&&(this.domElement.style.cursor=i);break;case"function":i(t);break;case"object":r&&Object.assign(this.domElement.style,i);break}else r&&typeof t=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t)}get pointer(){return this._rootPointerEvent}_onPointerDown(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let r=this._normalizeToPointerData(t);this.autoPreventDefault&&r[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let i=0,n=r.length;i0&&(r=t.composedPath()[0]);let i=r!==this.domElement?"outside":"",n=this._normalizeToPointerData(t);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=t.touches.length===1&&t.type==="touchstart"),typeof s.width>"u"&&(s.width=s.radiusX||1),typeof s.height>"u"&&(s.height=s.radiusY||1),typeof s.tiltX>"u"&&(s.tiltX=0),typeof s.tiltY>"u"&&(s.tiltY=0),typeof s.pointerType>"u"&&(s.pointerType="touch"),typeof s.pointerId>"u"&&(s.pointerId=s.identifier||0),typeof s.pressure>"u"&&(s.pressure=s.force||.5),typeof s.twist>"u"&&(s.twist=0),typeof s.tangentialPressure>"u"&&(s.tangentialPressure=0),typeof s.layerX>"u"&&(s.layerX=s.offsetX=s.clientX),typeof s.layerY>"u"&&(s.layerY=s.offsetY=s.clientY),s.isNormalized=!0,s.type=t.type,r.push(s)}else if(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent))){let i=t;typeof i.isPrimary>"u"&&(i.isPrimary=!0),typeof i.width>"u"&&(i.width=1),typeof i.height>"u"&&(i.height=1),typeof i.tiltX>"u"&&(i.tiltX=0),typeof i.tiltY>"u"&&(i.tiltY=0),typeof i.pointerType>"u"&&(i.pointerType="mouse"),typeof i.pointerId>"u"&&(i.pointerId=dd),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(t);return r}normalizeWheelEvent(t){let r=this._rootWheelEvent;return this._transferMouseData(r,t),r.deltaX=t.deltaX,r.deltaY=t.deltaY,r.deltaZ=t.deltaZ,r.deltaMode=t.deltaMode,this.mapPositionToPoint(r.screen,t.clientX,t.clientY),r.global.copyFrom(r.screen),r.offset.copyFrom(r.screen),r.nativeEvent=t,r.type=t.type,r}_bootstrapEvent(t,r){return t.originalEvent=null,t.nativeEvent=r,t.pointerId=r.pointerId,t.width=r.width,t.height=r.height,t.isPrimary=r.isPrimary,t.pointerType=r.pointerType,t.pressure=r.pressure,t.tangentialPressure=r.tangentialPressure,t.tiltX=r.tiltX,t.tiltY=r.tiltY,t.twist=r.twist,this._transferMouseData(t,r),this.mapPositionToPoint(t.screen,r.clientX,r.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.isTrusted=r.isTrusted,t.type==="pointerleave"&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=fd[t.type]||t.type),t}_transferMouseData(t,r){t.isTrusted=r.isTrusted,t.srcElement=r.srcElement,t.timeStamp=performance.now(),t.type=r.type,t.altKey=r.altKey,t.button=r.button,t.buttons=r.buttons,t.client.x=r.clientX,t.client.y=r.clientY,t.ctrlKey=r.ctrlKey,t.metaKey=r.metaKey,t.movement.x=r.movementX,t.movement.y=r.movementY,t.page.x=r.pageX,t.page.y=r.pageY,t.relatedTarget=null,t.shiftKey=r.shiftKey}},Zs.extension={name:"events",type:[I.WebGLSystem,I.CanvasSystem,I.WebGPUSystem],priority:-1},Zs.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0},dl=Zs}),gd,yy=_(()=>{pd(),$o(),gd={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(e){this.eventMode=e?"static":"passive"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??dl.defaultEventMode},set eventMode(e){this._internalEventMode=e},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(e,t,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 t=="function"?void 0:t;e=i?`${e}capture`:e;let o=typeof t=="function"?t:t.handleEvent,l=this;n&&n.addEventListener("abort",()=>{l.off(e,o,a)}),s?l.once(e,o,a):l.on(e,o,a)},removeEventListener(e,t,r){let i=typeof r=="boolean"&&r||typeof r=="object"&&r.capture,n=typeof t=="function"?void 0:t;e=i?`${e}capture`:e,t=typeof t=="function"?t:t.handleEvent,this.off(e,t,n)},dispatchEvent(e){if(!(e instanceof $s))throw new Error("Container cannot propagate events outside of the Federated Events API");return e.defaultPrevented=!1,e.path=null,e.target=this,e.manager.dispatchEvent(e),!e.defaultPrevented}}}),xy=_(()=>{re(),Hr(),pd(),yy(),fe.add(dl),St.mixin(gd)}),fl,by=_(()=>{"use strict";fl=(e=>(e[e.Low=0]="Low",e[e.Normal=1]="Normal",e[e.High=2]="High",e))(fl||{})}),md,wy=_(()=>{"use strict";md={createCanvas:(e,t)=>{let r=document.createElement("canvas");return r.width=e,r.height=t,r},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(e,t)=>fetch(e,t),parseXML:e=>new DOMParser().parseFromString(e,"text/xml")}}),pl,yt,Ht=_(()=>{wy(),pl=md,yt={get(){return pl},set(e){pl=e}}});function Pr(e){if(typeof e!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(e)}`)}function Vn(e){return e.split("?")[0].split("#")[0]}function Ty(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Sy(e,t,r){return e.replace(new RegExp(Ty(t),"g"),r)}function Ey(e,t){let r="",i=0,n=-1,s=0,a=-1;for(let o=0;o<=e.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}}t&&(r.length>0?r+="/..":r="..",i=2)}else r.length>0?r+=`/${e.slice(n+1,o)}`:r=e.slice(n+1,o),i=o-n-1;n=o,s=0}else a===46&&s!==-1?++s:s=-1}return r}var un,_d=_(()=>{Ht(),un={toPosix(e){return Sy(e,"\\","/")},isUrl(e){return/^https?:/.test(this.toPosix(e))},isDataUrl(e){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(e)},isBlobUrl(e){return e.startsWith("blob:")},hasProtocol(e){return/^[^/:]+:/.test(this.toPosix(e))},getProtocol(e){Pr(e),e=this.toPosix(e);let t=/^file:\/\/\//.exec(e);if(t)return t[0];let r=/^[^/:]+:\/{0,2}/.exec(e);return r?r[0]:""},toAbsolute(e,t,r){if(Pr(e),this.isDataUrl(e)||this.isBlobUrl(e))return e;let i=Vn(this.toPosix(t??yt.get().getBaseUrl())),n=Vn(this.toPosix(r??this.rootname(i)));return e=this.toPosix(e),e.startsWith("/")?un.join(n,e.slice(1)):this.isAbsolute(e)?e:this.join(i,e)},normalize(e){if(Pr(e),e.length===0)return".";if(this.isDataUrl(e)||this.isBlobUrl(e))return e;e=this.toPosix(e);let t="",r=e.startsWith("/");this.hasProtocol(e)&&(t=this.rootname(e),e=e.slice(t.length));let i=e.endsWith("/");return e=Ey(e,!1),e.length>0&&i&&(e+="/"),r?`/${e}`:t+e},isAbsolute(e){return Pr(e),e=this.toPosix(e),this.hasProtocol(e)?!0:e.startsWith("/")},join(...e){if(e.length===0)return".";let t;for(let r=0;r0)if(t===void 0)t=i;else{let n=e[r-1]??"";this.joinExtensions.includes(this.extname(n).toLowerCase())?t+=`/../${i}`:t+=`/${i}`}}return t===void 0?".":this.normalize(t)},dirname(e){if(Pr(e),e.length===0)return".";e=this.toPosix(e);let t=e.charCodeAt(0),r=t===47,i=-1,n=!0,s=this.getProtocol(e),a=e;e=e.slice(s.length);for(let o=e.length-1;o>=1;--o)if(t=e.charCodeAt(o),t===47){if(!n){i=o;break}}else n=!1;return i===-1?r?"/":this.isUrl(a)?s+e:s:r&&i===1?"//":s+e.slice(0,i)},rootname(e){Pr(e),e=this.toPosix(e);let t="";if(e.startsWith("/")?t="/":t=this.getProtocol(e),this.isUrl(e)){let r=e.indexOf("/",t.length);r!==-1?t=e.slice(0,r):t=e,t.endsWith("/")||(t+="/")}return t},basename(e,t){Pr(e),t&&Pr(t),e=Vn(this.toPosix(e));let r=0,i=-1,n=!0,s;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";let a=t.length-1,o=-1;for(s=e.length-1;s>=0;--s){let l=e.charCodeAt(s);if(l===47){if(!n){r=s+1;break}}else o===-1&&(n=!1,o=s+1),a>=0&&(l===t.charCodeAt(a)?--a===-1&&(i=s):(a=-1,i=o))}return r===i?i=o:i===-1&&(i=e.length),e.slice(r,i)}for(s=e.length-1;s>=0;--s)if(e.charCodeAt(s)===47){if(!n){r=s+1;break}}else i===-1&&(n=!1,i=s+1);return i===-1?"":e.slice(r,i)},extname(e){Pr(e),e=Vn(this.toPosix(e));let t=-1,r=0,i=-1,n=!0,s=0;for(let a=e.length-1;a>=0;--a){let o=e.charCodeAt(a);if(o===47){if(!n){r=a+1;break}continue}i===-1&&(n=!1,i=a+1),o===46?t===-1?t=a:s!==1&&(s=1):t!==-1&&(s=-1)}return t===-1||i===-1||s===0||s===1&&t===i-1&&t===r+1?"":e.slice(t,i)},parse(e){Pr(e);let t={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return t;e=Vn(this.toPosix(e));let r=e.charCodeAt(0),i=this.isAbsolute(e),n,s="";t.root=this.rootname(e),i||this.hasProtocol(e)?n=1:n=0;let a=-1,o=0,l=-1,h=!0,u=e.length-1,c=0;for(;u>=n;--u){if(r=e.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?t.base=t.name=e.slice(1,l):t.base=t.name=e.slice(o,l)):(o===0&&i?(t.name=e.slice(1,a),t.base=e.slice(1,l)):(t.name=e.slice(o,a),t.base=e.slice(o,l)),t.ext=e.slice(a,l)),t.dir=this.dirname(e),s&&(t.dir=s+t.dir),t},sep:"/",delimiter:":",joinExtensions:[".html"]}}),Fi,vd=_(()=>{"use strict";Fi=(e,t,r=!1)=>(Array.isArray(e)||(e=[e]),t?e.map(i=>typeof i=="string"||r?t(i):i):e)});function yd(e,t,r,i,n){let s=t[r];for(let a=0;a{let a=s.substring(1,s.length-1).split(",");n.push(a)}),yd(e,n,0,r,i)}else i.push(e);return i}var Ay=_(()=>{"use strict"}),gl,My=_(()=>{"use strict";gl=e=>!Array.isArray(e)});function Py(e){return e.split(".").pop().split("?").shift().split("#").shift()}var ml,Ry=_(()=>{Fe(),_d(),vd(),Ay(),My(),ml=class{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(e,t)=>`${e}${this._bundleIdConnector}${t}`,extractAssetIdFromBundle:(e,t)=>t.replace(`${e}${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(e){if(this._bundleIdConnector=e.connector??this._bundleIdConnector,this._createBundleAssetId=e.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=e.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...e){e.forEach(t=>{this._preferredOrder.push(t),t.priority||(t.priority=Object.keys(t.params))}),this._resolverHash={}}set basePath(e){this._basePath=e}get basePath(){return this._basePath}set rootPath(e){this._rootPath=e}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(e){if(typeof e=="string")this._defaultSearchParams=e;else{let t=e;this._defaultSearchParams=Object.keys(t).map(r=>`${encodeURIComponent(r)}=${encodeURIComponent(t[r])}`).join("&")}}getAlias(e){let{alias:t,src:r}=e;return Fi(t||r,i=>typeof i=="string"?i:Array.isArray(i)?i.map(n=>n?.src??n):i?.src?i.src:i,!0)}addManifest(e){this._manifest&&ge("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=e,e.bundles.forEach(t=>{this.addBundle(t.name,t.assets)})}addBundle(e,t){let r=[],i=t;Array.isArray(t)||(i=Object.entries(t).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(e,a);r.push(l),o=[a,l]}else{let l=a.map(h=>this._createBundleAssetId(e,h));r.push(...l),o=[...a,...l]}this.add({...n,alias:o,src:s})}),this._bundles[e]=r}add(e){let t=[];Array.isArray(e)?t.push(...e):t.push(e);let r;r=i=>{this.hasKey(i)&&ge(`[Resolver] already has key: ${i} overwriting`)},Fi(t).forEach(i=>{let{src:n}=i,{data:s,format:a,loadParser:o}=i,l=Fi(n).map(c=>typeof c=="string"?Cy(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 y=0;y{this._assetMap[c]=u})})}resolveBundle(e){let t=gl(e);e=Fi(e);let r={};return e.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}}),t?r[e[0]]:r}resolveUrl(e){let t=this.resolve(e);if(typeof e!="string"){let r={};for(let i in t)r[i]=t[i].src;return r}return t.src}resolve(e){let t=gl(e);e=Fi(e);let r={};return e.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]}),t?r[e[0]]:r}hasKey(e){return!!this._assetMap[e]}hasBundle(e){return!!this._bundles[e]}_getPreferredOrder(e){for(let t=0;tn.params.format.includes(r.format));if(i)return i}return this._preferredOrder[0]}_appendDefaultSearchParams(e){if(!this._defaultSearchParams)return e;let t=/\?/.test(e)?"&":"?";return`${e}${t}${this._defaultSearchParams}`}_buildResolvedAsset(e,t){let{aliases:r,data:i,loadParser:n,format:s}=t;return(this._basePath||this._rootPath)&&(e.src=un.toAbsolute(e.src,this._basePath,this._rootPath)),e.alias=r??e.alias??[e.src],e.src=this._appendDefaultSearchParams(e.src),e.data={...i||{},...e.data},e.loadParser=n??e.loadParser,e.format=s??e.format??Py(e.src),e}},ml.RETINA_PREFIX=/@([0-9\.]+)x/}),_l,ky=_(()=>{"use strict";_l=(e,t)=>{let r=t.split("?")[1];return r&&(e+=`?${r}`),e}}),vl,yl,By=_(()=>{E(),mt(),vl=class Fs{constructor(t,r){this.linkedSheets=[],this._texture=t instanceof Ie?t:null,this.textureSource=t.source,this.textures={},this.animations={},this.data=r;let i=parseFloat(r.meta.scale);i?(this.resolution=i,t.source.resolution=this.resolution):this.resolution=t.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=Fs.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let r=t,i=Fs.BATCH_SIZE;for(;r-t{this._batchIndex*Fs.BATCH_SIZE{i[n]=t}),Object.keys(t.textures).forEach(n=>{i[n]=t.textures[n]}),!r){let n=un.dirname(e[0]);t.linkedSheets.forEach((s,a)=>{let o=xd([`${n}/${t.data.meta.related_multi_packs[a]}`],s,!0);Object.assign(i,o)})}return i}var bd,wd,Iy=_(()=>{by(),Ry(),ky(),re(),mt(),_d(),By(),bd=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"],wd={extension:I.Asset,cache:{test:e=>e instanceof yl,getCacheableAssets:(e,t)=>xd(e,t,!1)},resolver:{extension:{type:I.ResolveParser,name:"resolveSpritesheet"},test:e=>{let t=e.split("?")[0].split("."),r=t.pop(),i=t.pop();return r==="json"&&bd.includes(i)},parse:e=>{let t=e.split(".");return{resolution:parseFloat(ml.RETINA_PREFIX.exec(e)?.[1]??"1"),format:t[t.length-2],src:e}}},loader:{name:"spritesheetLoader",extension:{type:I.LoadParser,priority:fl.Normal,name:"spritesheetLoader"},async testParse(e,t){return un.extname(t.src).toLowerCase()===".json"&&!!e.frames},async parse(e,t,r){let{texture:i,imageFilename:n}=t?.data??{},s=un.dirname(t.src);s&&s.lastIndexOf("/")!==s.length-1&&(s+="/");let a;if(i instanceof Ie)a=i;else{let h=_l(s+(n??e.meta.image),t.src);a=(await r.load([h]))[h]}let o=new yl(a.source,e);await o.parse();let l=e?.meta?.related_multi_packs;if(Array.isArray(l)){let h=[];for(let c of l){if(typeof c!="string")continue;let f=s+c;t.data?.ignoreMultiPack||(f=_l(f,t.src),h.push(r.load({src:f,data:{ignoreMultiPack:!0}})))}let u=await Promise.all(h);o.linkedSheets=u,u.forEach(c=>{c.linkedSheets=[o].concat(o.linkedSheets.filter(f=>f!==c))})}return o},async unload(e,t,r){await r.unload(e.textureSource._sourceOrigin),e.destroy(!1)}}}}),xl=_(()=>{re(),Iy(),fe.add(wd)});function Qs(e,t,r,i){let{width:n,height:s}=r.orig,a=r.trim;if(a){let o=a.width,l=a.height;e.minX=a.x-t._x*n-i,e.maxX=e.minX+o,e.minY=a.y-t._y*s-i,e.maxY=e.minY+l}else e.minX=-t._x*n-i,e.maxX=e.minX+n,e.minY=-t._y*s-i,e.maxY=e.minY+s}var bl=_(()=>{"use strict"}),Js,wl=_(()=>{T(),Hr(),Js=class extends St{constructor(){super(...arguments),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=-1,this._bounds=new m(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(e){this._roundPixels=e?1:0}containsPoint(e){let t=this.bounds,{x:r,y:i}=e;return r>=t.minX&&r<=t.maxX&&i>=t.minY&&i<=t.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;let e=this.renderGroup||this.parentRenderGroup;e&&e.onChildViewUpdate(this)}destroy(e){super.destroy(e),this._bounds=null}}}),ea,Td=_(()=>{ti(),mt(),bl(),dt(),wl(),ea=class Rc extends Js{constructor(t=Ie.EMPTY){t instanceof Ie&&(t={texture:t});let{texture:r=Ie.EMPTY,anchor:i,roundPixels:n,width:s,height:a,...o}=t;super({label:"Sprite",...o}),this.renderPipeId="sprite",this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new Pt({_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(t,r=!1){return t instanceof Ie?new Rc(t):new Rc(Ie.from(t,r))}set texture(t){t||(t=Ie.EMPTY);let r=this._texture;r!==t&&(r&&r.dynamic&&r.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,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 Qs(this._visualBounds,this._anchor,this._texture,0),this._visualBounds}get sourceBounds(){return We("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){let t=this._anchor,r=this._texture,i=this._bounds,{width:n,height:s}=r.orig;i.minX=-t._x*n,i.maxX=i.minX+n,i.minY=-t._y*s,i.maxY=i.minY+s}destroy(t=!1){if(super.destroy(t),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._texture.destroy(r)}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this._setWidth(t,this._texture.orig.width),this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this._setHeight(t,this._texture.orig.height),this._height=t}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this._texture.orig.width,t.height=Math.abs(this.scale.y)*this._texture.orig.height,t}setSize(t,r){typeof t=="object"?(r=t.height??t.width,t=t.width):r??(r=t),t!==void 0&&this._setWidth(t,this._texture.orig.width),r!==void 0&&this._setHeight(r,this._texture.orig.height)}}});function Sd(e,t,r){let i=Ed;e.measurable=!0,D(e,r,i),t.addBoundsMask(i),e.measurable=!1}var Ed,Cd=_(()=>{T(),Y(),Ed=new m});function Ad(e,t,r){let i=C.get();e.measurable=!0;let n=S.get().identity(),s=Md(e,r,n);ur(e,i,s),e.measurable=!1,t.addBoundsMask(i),S.return(n),C.return(i)}function Md(e,t,r){return e?(e!==t&&(Md(e.parent,t,r),e.updateLocalTransform(),r.append(e.localTransform)),r):(ge("Mask bounds, renderable is not inside the root container"),r)}var Pd=_(()=>{Oe(),k(),Fe()}),Tl,Gy=_(()=>{re(),Td(),Cd(),Pd(),Tl=class{constructor(e){this.priority=0,this.inverse=!1,this.pipe="alphaMask",e?.mask&&this.init(e.mask)}init(e){this.mask=e,this.renderMaskToTexture=!(e instanceof ea),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask=null}addBounds(e,t){this.inverse||Sd(this.mask,e,t)}addLocalBounds(e,t){Ad(this.mask,e,t)}containsPoint(e,t){let r=this.mask;return t(r,e)}destroy(){this.reset()}static test(e){return e instanceof ea}},Tl.extension=I.MaskEffect}),Sl,Oy=_(()=>{re(),Sl=class{constructor(e){this.priority=0,this.pipe="colorMask",e?.mask&&this.init(e.mask)}init(e){this.mask=e}destroy(){}static test(e){return typeof e=="number"}},Sl.extension=I.MaskEffect}),El,Dy=_(()=>{re(),Hr(),Cd(),Pd(),El=class{constructor(e){this.priority=0,this.pipe="stencilMask",e?.mask&&this.init(e.mask)}init(e){this.mask=e,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null}addBounds(e,t){Sd(this.mask,e,t)}addLocalBounds(e,t){Ad(this.mask,e,t)}containsPoint(e,t){let r=this.mask;return t(r,e)}destroy(){this.reset()}static test(e){return e instanceof St}},El.extension=I.MaskEffect}),oi,Wn=_(()=>{Ht(),re(),vr(),oi=class extends Nt{constructor(e){e.resource||(e.resource=yt.get().createCanvas()),e.width||(e.width=e.resource.width,e.autoDensity||(e.width/=e.resolution)),e.height||(e.height=e.resource.height,e.autoDensity||(e.height/=e.resolution)),super(e),this.uploadMethodId="image",this.autoDensity=e.autoDensity,this.resizeCanvas(),this.transparent=!!e.transparent}resizeCanvas(){this.autoDensity&&(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(e=this.width,t=this.height,r=this._resolution){let i=super.resize(e,t,r);return i&&this.resizeCanvas(),i}static test(e){return globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&e instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}},oi.extension=I.TextureSource}),jn,Cl=_(()=>{Ht(),re(),Fe(),vr(),jn=class extends Nt{constructor(e){if(e.resource&&globalThis.HTMLImageElement&&e.resource instanceof HTMLImageElement){let t=yt.get().createCanvas(e.resource.width,e.resource.height);t.getContext("2d").drawImage(e.resource,0,0,e.resource.width,e.resource.height),e.resource=t,ge("ImageSource: Image element passed, converting to canvas. Use CanvasSource instead.")}super(e),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(e){return globalThis.HTMLImageElement&&e instanceof HTMLImageElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||globalThis.VideoFrame&&e instanceof VideoFrame}},jn.extension=I.TextureSource});async function Uy(){return Al??(Al=(async()=>{let e=document.createElement("canvas").getContext("webgl");if(!e)return"premultiply-alpha-on-upload";let t=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(!t)return"premultiply-alpha-on-upload";let r=e.createTexture();e.bindTexture(e.TEXTURE_2D,r);let i=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,i),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,r,0),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t);let n=new Uint8Array(4);return e.readPixels(0,0,1,1,e.RGBA,e.UNSIGNED_BYTE,n),e.deleteFramebuffer(i),e.deleteTexture(r),e.getExtension("WEBGL_lose_context")?.loseContext(),n[0]<=n[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),Al}var Al,Fy=_(()=>{"use strict"}),$n,Rd,Ly=_(()=>{re(),Ks(),Fy(),vr(),$n=class Cv extends Nt{constructor(t){super(t),this.isReady=!1,this.uploadMethodId="video",t={...Cv.defaultOptions,...t},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==!1,this.alphaMode=t.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),t.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){let t=Mr.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t)}(!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 t=this.resource,r=this.options;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(r.preload||t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlayThrough),t.addEventListener("error",this._onError,!0)),this.alphaMode=await Uy(),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`))})),t.load())}),this._load}_onError(t){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){let t=this.resource;return!t.paused&&!t.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 t=this.resource;this.isValid&&(this.isReady=!0,this.resize(t.videoWidth,t.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 t=this.resource;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlayThrough),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(Mr.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||(Mr.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Mr.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}},$n.extension=I.TextureSource,$n.defaultOptions={...Nt.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1},$n.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"},Rd=$n}),kd,Zt,ta=_(()=>{Fe(),vd(),kd=class{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(e){return this._cache.has(e)}get(e){let t=this._cache.get(e);return t||ge(`[Assets] Asset id ${e} was not found in the Cache`),t}set(e,t){let r=Fi(e),i;for(let o=0;o{n.set(o,t)});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]:t;this._cache.has(o)&&this._cache.get(o)!==l&&ge("[Cache] already has key:",o),this._cache.set(o,n.get(o))})}remove(e){if(!this._cacheMap.has(e)){ge(`[Assets] Asset id ${e} was not found in the Cache`);return}let t=this._cacheMap.get(e);t.cacheKeys.forEach(r=>{this._cache.delete(r)}),t.keys.forEach(r=>{this._cacheMap.delete(r)})}get parsers(){return this._parsers}},Zt=new kd});function Bd(e={}){let t=e&&e.resource,r=t?e.resource:e,i=t?e:{resource:e};for(let n=0;n{Zt.has(i)&&Zt.remove(i)}),t||Zt.set(i,s),s}function Hy(e,t=!1){return typeof e=="string"?Zt.get(e):e instanceof Nt?new Ie({source:e}):Ny(e,t)}var ra,Id=_(()=>{ta(),re(),vr(),mt(),ra=[],fe.handleByList(I.TextureSource,ra),Ie.from=Hy,Nt.from=Bd}),Ml=_(()=>{re(),Gy(),Oy(),Dy(),zc(),Wn(),Cl(),Ly(),Id(),fe.add(Tl,Sl,El,Rd,jn,oi,Hs)}),Vr,Li=_(()=>{"use strict";Vr=class{constructor(e){this.resources=Object.create(null),this._dirty=!0;let t=0;for(let r in e){let i=e[r];this.setResource(i,t++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;let e=[],t=0;for(let r in this.resources)e[t++]=this.resources[r]._resourceId;this._key=e.join("|")}setResource(e,t){let r=this.resources[t];e!==r&&(r&&e.off?.("change",this.onResourceChange,this),e.on?.("change",this.onResourceChange,this),this.resources[t]=e,this._dirty=!0)}getResource(e){return this.resources[e]}_touch(e){let t=this.resources;for(let r in t)t[r]._touched=e}destroy(){let e=this.resources;for(let t in e)e[t].off?.("change",this.onResourceChange,this);this.resources=null}onResourceChange(e){if(this._dirty=!0,e.destroyed){let t=this.resources;for(let r in t)t[r]===e&&(t[r]=null)}else this._updateKey()}}});function Gd(){return(!ia||ia?.isContextLost())&&(ia=yt.get().createCanvas().getContext("webgl",{})),ia}var ia,Od=_(()=>{Ht()});function zy(e){let t="";for(let r=0;r0&&(t+=` else `),r{"use strict";Dd=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(` `)});function cn(){if(Ni)return Ni;let e=Gd();return Ni=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),Ni=Vy(Ni,e),e.getExtension("WEBGL_lose_context")?.loseContext(),Ni}var Ni,dn=_(()=>{Od(),Wy(),Ni=null});function Pl(e,t){let r=2166136261;for(let i=0;i>>=0;return Rl[r]||jy(e,t,r)}function jy(e,t,r){let i={},n=0;na||(na=cn());for(let a=0;a{Li(),mt(),dn(),Rl={},na=0}),Hi,Ud=_(()=>{"use strict";Hi=class{constructor(e){typeof e=="number"?this.rawBinaryData=new ArrayBuffer(e):e instanceof Uint8Array?this.rawBinaryData=e.buffer:this.rawBinaryData=e,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(e){return this[`${e}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(e){switch(e){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${e} isn't a valid view type`)}}}});function Bl(e,t){let r=e.byteLength/8|0,i=new Float64Array(e,0,r);new Float64Array(t,0,r).set(i);let n=e.byteLength-r*8;if(n>0){let s=new Uint8Array(e,r*8,n);new Uint8Array(t,r*8,n).set(s)}}var Fd=_(()=>{"use strict"}),Ld,Mt,fn=_(()=>{"use strict";Ld={normal:"normal-npm",add:"add-npm",screen:"screen-npm"},Mt=(e=>(e[e.DISABLED=0]="DISABLED",e[e.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",e[e.MASK_ACTIVE=2]="MASK_ACTIVE",e[e.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",e[e.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",e[e.NONE=5]="NONE",e))(Mt||{})});function Xn(e,t){return t.alphaMode==="no-premultiply-alpha"&&Ld[e]||e}var sa=_(()=>{fn()}),Nd,$y=_(()=>{"use strict";Nd=class{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let e=0;e0?Il[--aa]:new Vd}function zd(e){Il[aa++]=e}var Vd,Il,aa,pn,Gl,Wd,Xy=_(()=>{At(),Ud(),Fd(),sa(),dn(),$y(),Vd=class{constructor(){this.renderPipeId="batch",this.action="proxy.php?url=https%3A%2F%2Faminmasoudi.github.io%2FstartBatch",this.start=0,this.size=0,this.textures=new Nd,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null}},Il=[],aa=0,pn=0,Gl=class Do{constructor(t={}){this.uid=ut("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],Do.defaultOptions.maxTextures=Do.defaultOptions.maxTextures??cn(),t={...Do.defaultOptions,...t};let{maxTextures:r,attributesInitialSize:i,indicesInitialSize:n}=t;this.attributeBuffer=new Hi(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 t=0;tthis.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",y=this.maxTextures;for(let x=this.elementStart;x=y||O)&&(this._finishBatch(i,f,c-f,n,a,o,t,d),d="renderBatch",f=c,a=M,o=v.topology,i=Hd(),n=i.textures,n.clear(),++pn),v._textureId=w._textureBindLocation=n.count,n.ids[w.uid]=n.count,n.textures[n.count++]=w,v._batch=i,c+=v.indexSize,v.packAsQuad?(this.packQuadAttributes(v,l,h,v._attributeStart,v._textureId),this.packQuadIndex(u,v._indexStart,v._attributeStart/this.vertexSize)):(this.packAttributes(v,l,h,v._attributeStart,v._textureId),this.packIndex(v,u,v._indexStart,v._attributeStart/this.vertexSize))}n.count>0&&(this._finishBatch(i,f,c-f,n,a,o,t,d),f=c,++pn),this.elementStart=this.elementSize,this._batchIndexStart=f,this._batchIndexSize=c}_finishBatch(t,r,i,n,s,a,o,l){t.gpuBindGroup=null,t.bindGroup=null,t.action=l,t.batcher=this,t.textures=n,t.blendMode=s,t.topology=a,t.start=r,t.size=i,++pn,this.batches[this.batchIndex++]=t,o.add(t)}finish(t){this.break(t)}ensureAttributeBuffer(t){t*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(t*4)}ensureIndexBuffer(t){t<=this.indexBuffer.length||this._resizeIndexBuffer(t)}_resizeAttributeBuffer(t){let r=Math.max(t,this.attributeBuffer.size*2),i=new Hi(r);Bl(this.attributeBuffer.rawBinaryData,i.rawBinaryData),this.attributeBuffer=i}_resizeIndexBuffer(t){let r=this.indexBuffer,i=Math.max(t,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";Je=(e=>(e[e.MAP_READ=1]="MAP_READ",e[e.MAP_WRITE=2]="MAP_WRITE",e[e.COPY_SRC=4]="COPY_SRC",e[e.COPY_DST=8]="COPY_DST",e[e.INDEX=16]="INDEX",e[e.VERTEX=32]="VERTEX",e[e.UNIFORM=64]="UNIFORM",e[e.STORAGE=128]="STORAGE",e[e.INDIRECT=256]="INDIRECT",e[e.QUERY_RESOLVE=512]="QUERY_RESOLVE",e[e.STATIC=1024]="STATIC",e))(Je||{})}),cr,zi=_(()=>{xt(),At(),Si(),cr=class extends et{constructor(e){let{data:t,size:r}=e,{usage:i,label:n,shrinkToFit:s}=e;super(),this.uid=ut("buffer"),this._resourceType="buffer",this._resourceId=ut("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=!0,this.destroyed=!1,t instanceof Array&&(t=new Float32Array(t)),this._data=t,r??(r=t?.byteLength);let a=!!t;this.descriptor={size:r,usage:i,mappedAtCreation:a,label:n},this.shrinkToFit=s??!0}get data(){return this._data}set data(e){this.setDataWithSize(e,e.length,!0)}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return!!(this.descriptor.usage&Je.STATIC)}set static(e){e?this.descriptor.usage|=Je.STATIC:this.descriptor.usage&=~Je.STATIC}setDataWithSize(e,t,r){if(this._updateID++,this._updateSize=t*e.BYTES_PER_ELEMENT,this._data===e){r&&this.emit("update",this);return}let i=this._data;if(this._data=e,this._dataInt32=null,!i||i.length!==e.length){!this.shrinkToFit&&i&&e.byteLength{zi(),Si()});function qy(e,t,r){let i=e.getAttribute(t);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||2*4)/h;for(let f=u;fo&&(o=d),y>l&&(l=y),d{"use strict"});function Zy(e){return(e instanceof cr||Array.isArray(e)||e.BYTES_PER_ELEMENT)&&(e={buffer:e}),e.buffer=jd(e.buffer,!1),e}var gn,Yn=_(()=>{xt(),T(),At(),zi(),Yy(),Ky(),gn=class extends et{constructor(e={}){super(),this.uid=ut("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new m,this._boundsDirty=!0;let{attributes:t,indexBuffer:r,topology:i}=e;if(this.buffers=[],this.attributes={},t)for(let n in t)this.addAttribute(n,t[n]);this.instanceCount=e.instanceCount??1,r&&this.addIndex(r),this.topology=i||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this.emit("update",this)}getAttribute(e){return this.attributes[e]}getIndex(){return this.indexBuffer}getBuffer(e){return this.getAttribute(e).buffer}getSize(){for(let e in this.attributes){let t=this.attributes[e];return t.buffer.data.length/(t.stride/4||t.size)}return 0}addAttribute(e,t){let r=Zy(t);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[e]=r}addIndex(e){this.indexBuffer=jd(e,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,qy(this,"aPosition",this._bounds)):this._bounds}destroy(e=!1){this.emit("destroy",this),this.removeAllListeners(),e&&this.buffers.forEach(t=>t.destroy()),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}}),$d,Xd,Yd,Qy=_(()=>{zi(),Si(),Yn(),$d=new Float32Array(1),Xd=new Uint32Array(1),Yd=class extends gn{constructor(){let e=new cr({data:$d,label:"attribute-batch-buffer",usage:Je.VERTEX|Je.COPY_DST,shrinkToFit:!1}),t=new cr({data:Xd,label:"index-batch-buffer",usage:Je.INDEX|Je.COPY_DST,shrinkToFit:!1}),r=6*4;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:r,offset:0},aUV:{buffer:e,format:"float32x2",stride:r,offset:2*4},aColor:{buffer:e,format:"unorm8x4",stride:r,offset:4*4},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:r,offset:5*4}},indexBuffer:t})}}});function qn(e,t){let r=Ol[e];return r===void 0&&(oa[t]===void 0&&(oa[t]=1),Ol[e]=r=oa[t]++),r}var oa,Ol,la=_(()=>{"use strict";oa=Object.create(null),Ol=Object.create(null)});function Jy(){if(!ha){ha="mediump";let e=Gd();e&&e.getShaderPrecisionFormat&&(ha=e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision?"highp":"mediump")}return ha}var ha,ex=_(()=>{Od()});function tx(e,t,r){return t?e:r?(e=e.replace("out vec4 finalColor;",""),` #ifdef GL_ES // This checks if it is WebGL1 #define in varying #define finalColor gl_FragColor #define texture texture2D #endif ${e} `):` #ifdef GL_ES // This checks if it is WebGL1 #define in attribute #define out varying #endif ${e} `}var rx=_(()=>{"use strict"});function ix(e,t,r){let i=r?t.maxSupportedFragmentPrecision:t.maxSupportedVertexPrecision;if(e.substring(0,9)!=="precision"){let n=r?t.requestedFragmentPrecision:t.requestedVertexPrecision;return n==="highp"&&i!=="highp"&&(n="mediump"),`precision ${n} float; ${e}`}else if(i!=="highp"&&e.substring(0,15)==="precision highp")return e.replace("precision highp","precision mediump");return e}var nx=_(()=>{"use strict"});function sx(e,t){return t?`#version 300 es ${e}`:e}var ax=_(()=>{"use strict"});function ox(e,{name:t="pixi-program"},r=!0){t=t.replace(/\s+/g,"-"),t+=r?"-fragment":"-vertex";let i=r?qd:Kd;return i[t]?(i[t]++,t+=`-${i[t]}`):i[t]=1,e.indexOf("#define SHADER_NAME")!==-1?e:`${`#define SHADER_NAME ${t}`} ${e}`}var qd,Kd,lx=_(()=>{"use strict";qd={},Kd={}});function hx(e,t){return t?e.replace("#version 300 es",""):e}var ux=_(()=>{"use strict"}),ua,ca,Dl,Vi,mn=_(()=>{la(),ex(),rx(),nx(),ax(),lx(),ux(),ua={stripVersion:hx,ensurePrecision:ix,addProgramDefines:tx,setProgramName:ox,insertVersion:sx},ca=Object.create(null),Dl=class kc{constructor(t){t={...kc.defaultOptions,...t};let r=t.fragment.indexOf("#version 300 es")!==-1,i={stripVersion:r,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:Jy()},setProgramName:{name:t.name},addProgramDefines:r,insertVersion:r},n=t.fragment,s=t.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=t.transformFeedbackVaryings,this._key=qn(`${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(t){let r=`${t.vertex}:${t.fragment}`;return ca[r]||(ca[r]=new kc(t)),ca[r]}},Dl.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"},Vi=Dl});function Ei(e){return Ul[e]??Ul.float32}var Ul,_n=_(()=>{"use strict";Ul={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 cx({source:e,entryPoint:t}){let r={},i=e.indexOf(`fn ${t}`);if(i!==-1){let n=e.indexOf("->",i);if(n!==-1){let s=e.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=Zd[o[3]]??"float32";r[o[2]]={location:parseInt(o[1],10),format:l,stride:Ei(l).stride,offset:0,instance:!1,start:0}}}}return r}var Zd,dx=_(()=>{_n(),Zd={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 Fl(e){let t=/(^|[^/])@(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=e.match(t)?.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=e.match(a)?.map(c=>{let f=c.match(l)[1],d=c.match(o).reduce((y,x)=>{let[v,w]=x.split(":");return y[v.trim()]=w.trim(),y},{});return d?{name:f,members:d}:null}).filter(({name:c})=>h.some(f=>f.type===c))??[];return{groups:h,structs:u}}var fx=_(()=>{"use strict"}),vn,px=_(()=>{"use strict";vn=(e=>(e[e.VERTEX=1]="VERTEX",e[e.FRAGMENT=2]="FRAGMENT",e[e.COMPUTE=4]="COMPUTE",e))(vn||{})});function gx({groups:e}){let t=[];for(let r=0;r{px()});function _x({groups:e}){let t=[];for(let r=0;r{"use strict"});function yx(e,t){let r=new Set,i=new Set,n=[...e.structs,...t.structs].filter(a=>r.has(a.name)?!1:(r.add(a.name),!0)),s=[...e.groups,...t.groups].filter(a=>{let o=`${a.name}-${a.binding}`;return i.has(o)?!1:(i.add(o),!0)});return{structs:n,groups:s}}var xx=_(()=>{"use strict"}),da,yn,Kn=_(()=>{la(),dx(),fx(),mx(),vx(),xx(),da=Object.create(null),yn=class Av{constructor(t){this._layoutKey=0,this._attributeLocationsKey=0;let{fragment:r,vertex:i,layout:n,gpuLayout:s,name:a}=t;if(this.name=a,this.fragment=r,this.vertex=i,r.source===i.source){let o=Fl(r.source);this.structsAndGroups=o}else{let o=Fl(i.source),l=Fl(r.source);this.structsAndGroups=yx(o,l)}this.layout=n??_x(this.structsAndGroups),this.gpuLayout=s??gx(this.structsAndGroups),this.autoAssignGlobalUniforms=this.layout[0]?.globalUniforms!==void 0,this.autoAssignLocalUniforms=this.layout[1]?.localUniforms!==void 0,this._generateProgramKey()}_generateProgramKey(){let{vertex:t,fragment:r}=this,i=t.source+r.source+t.entryPoint+r.entryPoint;this._layoutKey=qn(i,"program")}get attributeData(){return this._attributeData??(this._attributeData=cx(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null}static from(t){let r=`${t.vertex.source}:${t.fragment.source}:${t.fragment.entryPoint}:${t.vertex.entryPoint}`;return da[r]||(da[r]=new Av(t)),da[r]}}});function Qd(e,t,r){if(e)for(let i in e){let n=i.toLocaleLowerCase(),s=t[n];if(s){let a=e[i];i==="header"&&(a=a.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),r&&s.push(`//----${r}----//`),s.push(a)}else ge(`${i} placement hook does not exist in shader`)}}var bx=_(()=>{Fe()});function Jd(e){let t={};return(e.match(ef)?.map(r=>r.replace(/[{()}]/g,""))??[]).forEach(r=>{t[r]=[]}),t}var ef,wx=_(()=>{"use strict";ef=/\{\{(.*?)\}\}/g});function tf(e,t){let r,i=/@in\s+([^;]+);/g;for(;(r=i.exec(e))!==null;)t.push(r[1])}function rf(e,t,r=!1){let i=[];tf(t,i),e.forEach(o=>{o.header&&tf(o.header,i)});let n=i;r&&n.sort();let s=n.map((o,l)=>` @location(${l}) ${o},`).join(` `),a=t.replace(/@in\s+[^;]+;\s*/g,"");return a=a.replace("{{in}}",` ${s} `),a}var Tx=_(()=>{"use strict"});function nf(e,t){let r,i=/@out\s+([^;]+);/g;for(;(r=i.exec(e))!==null;)t.push(r[1])}function Sx(e){let t=/\b(\w+)\s*:/g.exec(e);return t?t[1]:""}function Ex(e){let t=/@.*?\s+/g;return e.replace(t,"")}function Cx(e,t){let r=[];nf(t,r),e.forEach(l=>{l.header&&nf(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 ${Ex(l)};`).join(` `),a=`return VSOutput( ${r.sort().map(l=>` ${Sx(l)}`).join(`, `)});`,o=t.replace(/@out\s+[^;]+;\s*/g,"");return o=o.replace("{{struct}}",` ${n} `),o=o.replace("{{start}}",` ${s} `),o=o.replace("{{return}}",` ${a} `),o}var Ax=_(()=>{"use strict"});function sf(e,t){let r=e;for(let i in t){let n=t[i];n.join(` `).length?r=r.replace(`{{${i}}}`,`//-----${i} START-----// ${n.join(` `)} //----${i} FINISH----//`):r=r.replace(`{{${i}}}`,"")}return r}var Mx=_(()=>{"use strict"});function Px({template:e,bits:t}){let r=af(e,t);if(Ci[r])return Ci[r];let{vertex:i,fragment:n}=kx(e,t);return Ci[r]=of(i,n,t),Ci[r]}function Rx({template:e,bits:t}){let r=af(e,t);return Ci[r]||(Ci[r]=of(e.vertex,e.fragment,t)),Ci[r]}function kx(e,t){let r=t.map(a=>a.vertex).filter(a=>!!a),i=t.map(a=>a.fragment).filter(a=>!!a),n=rf(r,e.vertex,!0);n=Cx(r,n);let s=rf(i,e.fragment,!0);return{vertex:n,fragment:s}}function af(e,t){return t.map(r=>(fa.has(r)||fa.set(r,lf++),fa.get(r))).sort((r,i)=>r-i).join("-")+e.vertex+e.fragment}function of(e,t,r){let i=Jd(e),n=Jd(t);return r.forEach(s=>{Qd(s.vertex,i,s.name),Qd(s.fragment,n,s.name)}),{vertex:sf(e,i),fragment:sf(t,n)}}var Ci,fa,lf,Bx=_(()=>{bx(),wx(),Tx(),Ax(),Mx(),Ci=Object.create(null),fa=new Map,lf=0}),hf,uf,cf,df,Ix=_(()=>{"use strict";hf=` @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}} }; `,uf=` @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; }; `,cf=` 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}} } `,df=` in vec4 vColor; in vec2 vUV; out vec4 finalColor; {{header}} void main(void) { {{start}} vec4 outColor; {{main}} finalColor = outColor * vColor; {{end}} } `}),ff,pf,Gx=_(()=>{"use strict";ff={name:"global-uniforms-bit",vertex:{header:` struct GlobalUniforms { uProjectionMatrix:mat3x3, uWorldTransformMatrix:mat3x3, uWorldColorAlpha: vec4, uResolution: vec2, } @group(0) @binding(0) var globalUniforms : GlobalUniforms; `}},pf={name:"global-uniforms-bit",vertex:{header:` uniform mat3 uProjectionMatrix; uniform mat3 uWorldTransformMatrix; uniform vec4 uWorldColorAlpha; uniform vec2 uResolution; `}}});function Zn({bits:e,name:t}){let r=Px({template:{fragment:uf,vertex:hf},bits:[ff,...e]});return yn.from({name:t,vertex:{source:r.vertex,entryPoint:"main"},fragment:{source:r.fragment,entryPoint:"main"}})}function Qn({bits:e,name:t}){return new Vi({name:t,...Rx({template:{vertex:cf,fragment:df},bits:[pf,...e]})})}var Wi=_(()=>{mn(),Kn(),Bx(),Ix(),Gx()}),pa,ga,ma=_(()=>{"use strict";pa={name:"color-bit",vertex:{header:` @in aColor: vec4; `,main:` vColor *= vec4(aColor.rgb * aColor.a, aColor.a); `}},ga={name:"color-bit",vertex:{header:` in vec4 aColor; `,main:` vColor *= vec4(aColor.rgb * aColor.a, aColor.a); `}}});function Ox(e){let t=[];if(e===1)t.push("@group(1) @binding(0) var textureSource1: texture_2d;"),t.push("@group(1) @binding(1) var textureSampler1: sampler;");else{let r=0;for(let i=0;i;`),t.push(`@group(1) @binding(${r++}) var textureSampler${i+1}: sampler;`)}return t.join(` `)}function Dx(e){let t=[];if(e===1)t.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{t.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; ${Ox(e)} `,main:` var uvDx = dpdx(vUV); var uvDy = dpdy(vUV); ${Dx(e)} `}}),_a[e]}function Ux(e){let t=[];for(let r=0;r0&&t.push("else"),r{"use strict";_a={},va={}}),xn,bn,ji=_(()=>{"use strict";xn={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; } `}},bn={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; } `}}}),Hl,gf,Fx=_(()=>{"use strict";Hl=["f32","i32","vec2","vec3","vec4","mat2x2","mat3x3","mat4x4","mat3x2","mat4x2","mat2x3","mat4x3","mat2x4","mat3x4","vec2","vec3","vec4"],gf=Hl.reduce((e,t)=>(e[t]=!0,e),{})});function Lx(e,t){switch(e){case"f32":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);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 Nx=_(()=>{"use strict"}),zl,Jt,dr=_(()=>{At(),la(),Fx(),Nx(),zl=class Mv{constructor(t,r){this._touched=0,this.uid=ut("uniform"),this._resourceType="uniformGroup",this._resourceId=ut("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,r={...Mv.defaultOptions,...r},this.uniformStructures=t;let i={};for(let n in t){let s=t[n];if(s.name=n,s.size=s.size??1,!gf[s.type])throw new Error(`Uniform type ${s.type} is not supported. Supported uniform types are: ${Hl.join(", ")}`);s.value??(s.value=Lx(s.type,s.size)),i[n]=s.value}this.uniforms=i,this._dirtyId=1,this.ubo=r.ubo,this.isStatic=r.isStatic,this._signature=qn(Object.keys(i).map(n=>`${n}-${t[n].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}},zl.defaultOptions={ubo:!1,isStatic:!1},Jt=zl});function Vl(e){let t=Wl[e];if(t)return t;let r=new Int32Array(e);for(let i=0;i{dr(),Wl={}}),Sr,li=_(()=>{"use strict";Sr=(e=>(e[e.WEBGL=1]="WEBGL",e[e.WEBGPU=2]="WEBGPU",e[e.BOTH=3]="BOTH",e))(Sr||{})}),Rr,Wr=_(()=>{xt(),mn(),Li(),Kn(),li(),dr(),Rr=class Pv extends et{constructor(t){super(),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:r,glProgram:i,groups:n,resources:s,compatibleRenderers:a,groupMap:o}=t;this.gpuProgram=r,this.glProgram=i,a===void 0&&(a=0,r&&(a|=Sr.WEBGPU),i&&(a|=Sr.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 Vr,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 Jt(f));let d=l[c];d&&(n[d.group]||(n[d.group]=new Vr,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(t,r,i){var n,s;(n=this._uniformBindMap)[r]||(n[r]={}),(s=this._uniformBindMap[r])[i]||(s[i]=t),this.groups[r]||(this.groups[r]=new Vr,this._ownedBindGroups.push(this.groups[r]))}_buildResourceAccessor(t,r){let i={};for(let n in r){let s=r[n];Object.defineProperty(i,s.name,{get(){return t[s.group].getResource(s.binding)},set(a){t[s.group].setResource(a,s.binding)}})}return i}destroy(t=!1){this.emit("destroy",this),t&&(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(t){let{gpu:r,gl:i,...n}=t,s,a;return r&&(s=yn.from(r)),i&&(a=Vi.from(i)),new Pv({gpuProgram:s,glProgram:a,...n})}}}),mf,Hx=_(()=>{Wi(),ma(),ya(),ji(),jl(),Wr(),mf=class extends Rr{constructor(e){let t=Qn({name:"batch",bits:[ga,Nl(e),bn]}),r=Zn({name:"batch",bits:[pa,Ll(e),xn]});super({glProgram:t,gpuProgram:r,resources:{batchSamplers:Vl(e)}})}}}),$l,Xl,xa,_f=_(()=>{re(),Xy(),Qy(),Hx(),$l=null,Xl=class Rv extends Wd{constructor(){super(...arguments),this.geometry=new Yd,this.shader=$l||($l=new mf(this.maxTextures)),this.name=Rv.extension.name,this.vertexSize=6}packAttributes(t,r,i,n,s){let a=s<<16|t.roundPixels&65535,o=t.transform,l=o.a,h=o.b,u=o.c,c=o.d,f=o.tx,d=o.ty,{positions:y,uvs:x}=t,v=t.color,w=t.attributeOffset,M=w+t.attributeSize;for(let O=w;O{"use strict"});function vf(e,t,r,i,n){let s=t.a,a=t.b,o=t.c,l=t.d,h=t.tx,u=t.ty;r||(r=0),i||(i=2),n||(n=e.length/i-r);let c=r*i;for(let f=0;f{"use strict"}),yf,ba,xf=_(()=>{Ze(),G(),yf=new _e,ba=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.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){let e=this.baseColor,t=e>>16|e&65280|(e&255)<<16,r=this.renderable;return r?H(t,r.groupColor)+(this.alpha*r.groupAlpha*255<<24):t+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||yf}copyTo(e){e.indexOffset=this.indexOffset,e.indexSize=this.indexSize,e.attributeOffset=this.attributeOffset,e.attributeSize=this.attributeSize,e.baseColor=this.baseColor,e.alpha=this.alpha,e.texture=this.texture,e.geometryData=this.geometryData,e.topology=this.topology}reset(){this.applyTransform=!0,this.renderable=null,this.topology="triangle-list"}}}),wn,bf,wf,$x=_(()=>{re(),wn={extension:{type:I.ShapeBuilder,name:"circle"},build(e,t){let r,i,n,s,a,o;if(e.type==="circle"){let P=e;r=P.x,i=P.y,a=o=P.radius,n=s=0}else if(e.type==="ellipse"){let P=e;r=P.x,i=P.y,a=P.halfWidth,o=P.halfHeight,n=s=0}else{let P=e,U=P.width/2,F=P.height/2;r=P.x+U,i=P.y+F,a=o=Math.max(0,Math.min(P.radius,Math.min(U,F))),n=U-a,s=F-o}if(!(a>=0&&o>=0&&n>=0&&s>=0))return t;let l=Math.ceil(2.3*Math.sqrt(a+o)),h=l*8+(n?4:0)+(s?4:0);if(h===0)return t;if(l===0)return t[0]=t[6]=r+n,t[1]=t[3]=i+s,t[2]=t[4]=r-n,t[5]=t[7]=i-s,t;let u=0,c=l*4+(n?2:0)+2,f=c,d=h,y=n+a,x=s,v=r+y,w=r-y,M=i+x;if(t[u++]=v,t[u++]=M,t[--c]=M,t[--c]=w,s){let P=i-x;t[f++]=w,t[f++]=P,t[--d]=P,t[--d]=v}for(let P=1;P0&&(n[s++]=l,n[s++]=h,n[s++]=l-1),l++;n[s++]=h+1,n[s++]=h,n[s++]=l-1}},bf={...wn,extension:{...wn.extension,name:"ellipse"}},wf={...wn,extension:{...wn.extension,name:"roundedRectangle"}}});function Xx(e){let t=e.length;if(t<6)return 1;let r=0;for(let i=0,n=e[t-2],s=e[t-1];i{"use strict"});function Tf(e,t,r,i,n,s,a,o){let l=e-r*n,h=t-i*n,u=e+r*s,c=t+i*s,f,d;a?(f=i,d=-r):(f=-i,d=r);let y=l+f,x=h+d,v=u+f,w=c+d;return o.push(y,x),o.push(v,w),2}function $i(e,t,r,i,n,s,a,o){let l=r-e,h=i-t,u=Math.atan2(l,h),c=Math.atan2(n-e,s-t);o&&uc&&(c+=Math.PI*2);let f=u,d=c-u,y=Math.abs(d),x=Math.sqrt(l*l+h*h),v=(15*y*Math.sqrt(x)/Math.PI>>0)+1,w=d/v;if(f+=w,o){a.push(e,t),a.push(r,i);for(let M=1,O=f;M=0&&(o.join==="round"?x+=$i(F,N,F-ae*j,N-se*j,F-Se*j,N-ke*j,d,!1)+4:x+=2,d.push(F-Se*ie,N-ke*ie),d.push(F+Se*j,N+ke*j));continue}let ve=(-ae+P)*(-se+N)-(-ae+F)*(-se+U),Le=(-Se+oe)*(-ke+N)-(-Se+F)*(-ke+ce),je=(R*Le-q*ve)/le,qe=(te*ve-$*Le)/le,Et=(je-F)*(je-F)+(qe-N)*(qe-N),Ke=F+(je-F)*j,er=N+(qe-N)*j,or=F-(je-F)*ie,Z=N-(qe-N)*ie,de=Math.min(R*R+$*$,q*q+te*te),pe=Ee?j:ie,be=de+pe*pe*M;Et<=be?o.join==="bevel"||Et/M>O?(Ee?(d.push(Ke,er),d.push(F+ae*ie,N+se*ie),d.push(Ke,er),d.push(F+Se*ie,N+ke*ie)):(d.push(F-ae*j,N-se*j),d.push(or,Z),d.push(F-Se*j,N-ke*j),d.push(or,Z)),x+=2):o.join==="round"?Ee?(d.push(Ke,er),d.push(F+ae*ie,N+se*ie),x+=$i(F,N,F+ae*ie,N+se*ie,F+Se*ie,N+ke*ie,d,!0)+4,d.push(Ke,er),d.push(F+Se*ie,N+ke*ie)):(d.push(F-ae*j,N-se*j),d.push(or,Z),x+=$i(F,N,F-ae*j,N-se*j,F-Se*j,N-ke*j,d,!1)+4,d.push(F-Se*j,N-ke*j),d.push(or,Z)):(d.push(Ke,er),d.push(or,Z)):(d.push(F-ae*j,N-se*j),d.push(F+ae*ie,N+se*ie),o.join==="round"?Ee?x+=$i(F,N,F+ae*ie,N+se*ie,F+Se*ie,N+ke*ie,d,!0)+2:x+=$i(F,N,F-ae*j,N-se*j,F-Se*j,N-ke*j,d,!1)+2:o.join==="miter"&&Et/M<=O&&(Ee?(d.push(or,Z),d.push(or,Z)):(d.push(Ke,er),d.push(Ke,er)),x+=2),d.push(F-Se*j,N-ke*j),d.push(F+Se*ie,N+ke*ie),x+=2)}P=e[(y-2)*2],U=e[(y-2)*2+1],F=e[(y-1)*2],N=e[(y-1)*2+1],ae=-(U-N),se=P-F,z=Math.sqrt(ae*ae+se*se),ae/=z,se/=z,ae*=w,se*=w,d.push(F-ae*j,N-se*j),d.push(F+ae*ie,N+se*ie),c||(o.cap==="round"?x+=$i(F-ae*(j-ie)*.5,N-se*(j-ie)*.5,F-ae*j,N-se*j,F+ae*ie,N+se*ie,d,!1)+2:o.cap==="square"&&(x+=Tf(F,N,ae,se,j,ie,!1,d)));let A=1e-4*1e-4;for(let B=v;B{wt(),Yx()});function Zx(e,t,r,i){let n=1e-4;if(e.length===0)return;let s=e[0],a=e[1],o=e[e.length-2],l=e[e.length-1],h=t||Math.abs(s-o){}),Sf=Ve((e,t)=>{"use strict";t.exports=r,t.exports.default=r;function r(A,B,R){R=R||2;var $=B&&B.length,q=$?B[0]*R:A.length,te=i(A,0,q,R,!0),ee=[];if(!te||te.next===te.prev)return ee;var le,Ee,ve,Le,je,qe,Et;if($&&(te=u(A,B,te,R)),A.length>80*R){le=ve=A[0],Ee=Le=A[1];for(var Ke=R;Keve&&(ve=je),qe>Le&&(Le=qe);Et=Math.max(ve-le,Le-Ee),Et=Et!==0?32767/Et:0}return s(te,ee,R,le,Ee,Et,0),ee}function i(A,B,R,$,q){var te,ee;if(q===ie(A,B,R,$)>0)for(te=B;te=B;te-=$)ee=z(te,A[te],A[te+1],ee);return ee&&F(ee,ee.next)&&(me(ee),ee=ee.next),ee}function n(A,B){if(!A)return A;B||(B=A);var R=A,$;do if($=!1,!R.steiner&&(F(R,R.next)||U(R.prev,R,R.next)===0)){if(me(R),R=B=R.prev,R===R.next)break;$=!0}else R=R.next;while($||R!==B);return B}function s(A,B,R,$,q,te,ee){if(A){!ee&&te&&x(A,$,q,te);for(var le=A,Ee,ve;A.prev!==A.next;){if(Ee=A.prev,ve=A.next,te?o(A,$,q,te):a(A)){B.push(Ee.i/R|0),B.push(A.i/R|0),B.push(ve.i/R|0),me(A),A=ve.next,le=ve.next;continue}if(A=ve,A===le){ee?ee===1?(A=l(n(A),B,R),s(A,B,R,$,q,te,2)):ee===2&&h(A,B,R,$,q,te):s(n(A),B,R,$,q,te,1);break}}}}function a(A){var B=A.prev,R=A,$=A.next;if(U(B,R,$)>=0)return!1;for(var q=B.x,te=R.x,ee=$.x,le=B.y,Ee=R.y,ve=$.y,Le=qte?q>ee?q:ee:te>ee?te:ee,Et=le>Ee?le>ve?le:ve:Ee>ve?Ee:ve,Ke=$.next;Ke!==B;){if(Ke.x>=Le&&Ke.x<=qe&&Ke.y>=je&&Ke.y<=Et&&O(q,le,te,Ee,ee,ve,Ke.x,Ke.y)&&U(Ke.prev,Ke,Ke.next)>=0)return!1;Ke=Ke.next}return!0}function o(A,B,R,$){var q=A.prev,te=A,ee=A.next;if(U(q,te,ee)>=0)return!1;for(var le=q.x,Ee=te.x,ve=ee.x,Le=q.y,je=te.y,qe=ee.y,Et=leEe?le>ve?le:ve:Ee>ve?Ee:ve,or=Le>je?Le>qe?Le:qe:je>qe?je:qe,Z=w(Et,Ke,B,R,$),de=w(er,or,B,R,$),pe=A.prevZ,be=A.nextZ;pe&&pe.z>=Z&&be&&be.z<=de;){if(pe.x>=Et&&pe.x<=er&&pe.y>=Ke&&pe.y<=or&&pe!==q&&pe!==ee&&O(le,Le,Ee,je,ve,qe,pe.x,pe.y)&&U(pe.prev,pe,pe.next)>=0||(pe=pe.prevZ,be.x>=Et&&be.x<=er&&be.y>=Ke&&be.y<=or&&be!==q&&be!==ee&&O(le,Le,Ee,je,ve,qe,be.x,be.y)&&U(be.prev,be,be.next)>=0))return!1;be=be.nextZ}for(;pe&&pe.z>=Z;){if(pe.x>=Et&&pe.x<=er&&pe.y>=Ke&&pe.y<=or&&pe!==q&&pe!==ee&&O(le,Le,Ee,je,ve,qe,pe.x,pe.y)&&U(pe.prev,pe,pe.next)>=0)return!1;pe=pe.prevZ}for(;be&&be.z<=de;){if(be.x>=Et&&be.x<=er&&be.y>=Ke&&be.y<=or&&be!==q&&be!==ee&&O(le,Le,Ee,je,ve,qe,be.x,be.y)&&U(be.prev,be,be.next)>=0)return!1;be=be.nextZ}return!0}function l(A,B,R){var $=A;do{var q=$.prev,te=$.next.next;!F(q,te)&&N(q,$,$.next,te)&&se(q,te)&&se(te,q)&&(B.push(q.i/R|0),B.push($.i/R|0),B.push(te.i/R|0),me($),me($.next),$=A=te),$=$.next}while($!==A);return n($)}function h(A,B,R,$,q,te){var ee=A;do{for(var le=ee.next.next;le!==ee.prev;){if(ee.i!==le.i&&P(ee,le)){var Ee=ke(ee,le);ee=n(ee,ee.next),Ee=n(Ee,Ee.next),s(ee,B,R,$,q,te,0),s(Ee,B,R,$,q,te,0);return}le=le.next}ee=ee.next}while(ee!==A)}function u(A,B,R,$){var q=[],te,ee,le,Ee,ve;for(te=0,ee=B.length;te=R.next.y&&R.next.y!==R.y){var le=R.x+(q-R.y)*(R.next.x-R.x)/(R.next.y-R.y);if(le<=$&&le>te&&(te=le,ee=R.x=R.x&&R.x>=ve&&$!==R.x&&O(qee.x||R.x===ee.x&&y(ee,R)))&&(ee=R,je=qe)),R=R.next;while(R!==Ee);return ee}function y(A,B){return U(A.prev,A,B.prev)<0&&U(B.next,A,A.next)<0}function x(A,B,R,$){var q=A;do q.z===0&&(q.z=w(q.x,q.y,B,R,$)),q.prevZ=q.prev,q.nextZ=q.next,q=q.next;while(q!==A);q.prevZ.nextZ=null,q.prevZ=null,v(q)}function v(A){var B,R,$,q,te,ee,le,Ee,ve=1;do{for(R=A,A=null,te=null,ee=0;R;){for(ee++,$=R,le=0,B=0;B0||Ee>0&&$;)le!==0&&(Ee===0||!$||R.z<=$.z)?(q=R,R=R.nextZ,le--):(q=$,$=$.nextZ,Ee--),te?te.nextZ=q:A=q,q.prevZ=te,te=q;R=$}te.nextZ=null,ve*=2}while(ee>1);return A}function w(A,B,R,$,q){return A=(A-R)*q|0,B=(B-$)*q|0,A=(A|A<<8)&16711935,A=(A|A<<4)&252645135,A=(A|A<<2)&858993459,A=(A|A<<1)&1431655765,B=(B|B<<8)&16711935,B=(B|B<<4)&252645135,B=(B|B<<2)&858993459,B=(B|B<<1)&1431655765,A|B<<1}function M(A){var B=A,R=A;do(B.x=(A-ee)*(te-le)&&(A-ee)*($-le)>=(R-ee)*(B-le)&&(R-ee)*(te-le)>=(q-ee)*($-le)}function P(A,B){return A.next.i!==B.i&&A.prev.i!==B.i&&!ae(A,B)&&(se(A,B)&&se(B,A)&&Se(A,B)&&(U(A.prev,A,B.prev)||U(A,B.prev,B))||F(A,B)&&U(A.prev,A,A.next)>0&&U(B.prev,B,B.next)>0)}function U(A,B,R){return(B.y-A.y)*(R.x-B.x)-(B.x-A.x)*(R.y-B.y)}function F(A,B){return A.x===B.x&&A.y===B.y}function N(A,B,R,$){var q=ce(U(A,B,R)),te=ce(U(A,B,$)),ee=ce(U(R,$,A)),le=ce(U(R,$,B));return!!(q!==te&&ee!==le||q===0&&oe(A,R,B)||te===0&&oe(A,$,B)||ee===0&&oe(R,A,$)||le===0&&oe(R,B,$))}function oe(A,B,R){return B.x<=Math.max(A.x,R.x)&&B.x>=Math.min(A.x,R.x)&&B.y<=Math.max(A.y,R.y)&&B.y>=Math.min(A.y,R.y)}function ce(A){return A>0?1:A<0?-1:0}function ae(A,B){var R=A;do{if(R.i!==A.i&&R.next.i!==A.i&&R.i!==B.i&&R.next.i!==B.i&&N(R,R.next,A,B))return!0;R=R.next}while(R!==A);return!1}function se(A,B){return U(A.prev,A,A.next)<0?U(A,B,A.next)>=0&&U(A,A.prev,B)>=0:U(A,B,A.prev)<0||U(A,A.next,B)<0}function Se(A,B){var R=A,$=!1,q=(A.x+B.x)/2,te=(A.y+B.y)/2;do R.y>te!=R.next.y>te&&R.next.y!==R.y&&q<(R.next.x-R.x)*(te-R.y)/(R.next.y-R.y)+R.x&&($=!$),R=R.next;while(R!==A);return $}function ke(A,B){var R=new j(A.i,A.x,A.y),$=new j(B.i,B.x,B.y),q=A.next,te=B.prev;return A.next=B,B.prev=A,R.next=q,q.prev=R,$.next=R,R.prev=$,te.next=$,$.prev=te,$}function z(A,B,R,$){var q=new j(A,B,R);return $?(q.next=$.next,q.prev=$,$.next.prev=q,$.next=q):(q.prev=q,q.next=q),q}function me(A){A.next.prev=A.prev,A.prev.next=A.next,A.prevZ&&(A.prevZ.nextZ=A.nextZ),A.nextZ&&(A.nextZ.prevZ=A.prevZ)}function j(A,B,R){this.i=A,this.x=B,this.y=R,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}r.deviation=function(A,B,R,$){var q=B&&B.length,te=q?B[0]*R:A.length,ee=Math.abs(ie(A,0,te,R));if(q)for(var le=0,Ee=B.length;le0&&($+=A[q-1].length,R.holes.push($))}return R}});function Ef(e,t,r,i,n,s,a){let o=(0,Cf.default)(e,t,2);if(!o)return;for(let h=0;h{Cf=ct(Sf(),1)}),Mf,Pf,Jx=_(()=>{re(),Af(),Mf=[],Pf={extension:{type:I.ShapeBuilder,name:"polygon"},build(e,t){for(let r=0;r{re(),Rf={extension:{type:I.ShapeBuilder,name:"rectangle"},build(e,t){let r=e,i=r.x,n=r.y,s=r.width,a=r.height;return s>=0&&a>=0&&(t[0]=i,t[1]=n,t[2]=i+s,t[3]=n,t[4]=i+s,t[5]=n+a,t[6]=i,t[7]=n+a),t},triangulate(e,t,r,i,n,s){let a=0;i*=r,t[i+a]=e[0],t[i+a+1]=e[1],a+=r,t[i+a]=e[2],t[i+a+1]=e[3],a+=r,t[i+a]=e[6],t[i+a+1]=e[7],a+=r,t[i+a]=e[4],t[i+a+1]=e[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}}}),kf,tb=_(()=>{re(),kf={extension:{type:I.ShapeBuilder,name:"triangle"},build(e,t){return t[0]=e.x,t[1]=e.y,t[2]=e.x2,t[3]=e.y2,t[4]=e.x3,t[5]=e.y3,t},triangulate(e,t,r,i,n,s){let a=0;i*=r,t[i+a]=e[0],t[i+a+1]=e[1],a+=r,t[i+a]=e[2],t[i+a+1]=e[3],a+=r,t[i+a]=e[4],t[i+a+1]=e[5];let o=i/r;n[s++]=o,n[s++]=o+1,n[s++]=o+2}}});function rb(e,t){let{geometryData:r,batches:i}=t;i.length=0,r.indices.length=0,r.vertices.length=0,r.uvs.length=0;for(let n=0;n{let d=l.length,y=a.length/2,x=[],v=Jn[u.type],w="triangle-list";if(v.build(u,x),c&&vf(x,c),i){let U=u.closePath??!0,F=t;F.pixelLine?(Zx(x,U,a,l),w="line-list"):qx(x,F,!1,U,a,l)}else if(r&&h===f){h!==0&&console.warn("[Pixi Graphics] only the last shape have be cut out");let U=[],F=x.slice();nb(r.shapePath).forEach(N=>{U.push(F.length/2),F.push(...N)}),Ef(F,U,a,2,y,l,d)}else v.triangulate(x,a,2,y,l,d);let M=o.length/2,O=t.texture;if(O!==Ie.WHITE){let U=t.matrix;U&&(c&&U.append(c.clone().invert()),zx(a,2,y,o,M,2,a.length/2-y,U))}else Vx(o,M,2,a.length/2-y);let P=He.get(ba);P.indexOffset=d,P.indexSize=l.length-d,P.attributeOffset=y,P.attributeSize=a.length/2-y,P.baseColor=t.color,P.alpha=t.alpha,P.texture=O,P.geometryData=s,P.topology=w,n.push(P)})}function nb(e){if(!e)return[];let t=e.shapePrimitives,r=[];for(let i=0;i{re(),E(),Wx(),jx(),mt(),Ot(),xf(),$x(),Kx(),Qx(),Jx(),eb(),tb(),Af(),Jn={},fe.handleByMap(I.ShapeBuilder,Jn),fe.add(Rf,Pf,kf,wn,bf,wf),If=new b}),Gf,Of,wa,Ta,Yl=_(()=>{re(),kl(),_f(),Lc(),dt(),Ot(),sb(),Gf=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}},Of=class{constructor(){this.batcher=new xa,this.instructions=new Uo}init(){this.instructions.reset()}get geometry(){return We(Bi,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},wa=class Bc{constructor(t){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),t.renderableGC.addManagedHash(this,"_gpuContextHash"),t.renderableGC.addManagedHash(this,"_graphicsDataContextHash")}init(t){Bc.defaultOptions.bezierSmoothness=t?.bezierSmoothness??Bc.defaultOptions.bezierSmoothness}getContextRenderData(t){return this._graphicsDataContextHash[t.uid]||this._initContextRenderData(t)}updateGpuContext(t){let r=this._gpuContextHash[t.uid]||this._initContext(t);if(t.dirty){r?this._cleanGraphicsContextData(t):r=this._initContext(t),rb(t,r);let i=t.batchMode;t.customShader||i==="no-batch"?r.isBatchable=!1:i==="auto"&&(r.isBatchable=r.geometryData.vertices.length<400),t.dirty=!1}return r}getGpuContext(t){return this._gpuContextHash[t.uid]||this._initContext(t)}_initContextRenderData(t){let r=He.get(Of),{batches:i,geometryData:n}=this._gpuContextHash[t.uid],s=n.vertices.length,a=n.indices.length;for(let u=0;u{He.return(i)})}destroy(){for(let t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context)}},wa.extension={type:[I.WebGLSystem,I.WebGPUSystem,I.CanvasSystem],name:"graphicsContext"},wa.defaultOptions={bezierSmoothness:.5},Ta=wa}),Df,Sa,Ea,Ca,Aa,Ma,Pa,Ra,Er,jr=_(()=>{"use strict";Df={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},Sa=0,Ea=1,Ca=2,Aa=3,Ma=4,Pa=5,Ra=class kv{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;t[r++]=(e&255)/255*i,t[r++]=(e>>8&255)/255*i,t[r++]=(e>>16&255)/255*i,t[r++]=i}var ts=_(()=>{"use strict"}),ql,ab=_(()=>{re(),jr(),Ot(),ts(),xf(),ql=class{constructor(e,t){this.state=Er.for2d(),this._graphicsBatchesHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=e,this._adaptor=t,this._adaptor.init(),this.renderer.renderableGC.addManagedHash(this,"_graphicsBatchesHash")}validateRenderable(e){let t=e.context,r=!!this._graphicsBatchesHash[e.uid],i=this.renderer.graphicsContext.updateGpuContext(t);return!!(i.isBatchable||r!==i.isBatchable)}addRenderable(e,t){let r=this.renderer.graphicsContext.updateGpuContext(e.context);e.didViewUpdate&&this._rebuild(e),r.isBatchable?this._addToBatcher(e,t):(this.renderer.renderPipes.batch.break(t),t.add(e))}updateRenderable(e){let t=this._graphicsBatchesHash[e.uid];if(t)for(let r=0;r{let a=He.get(ba);return s.copyTo(a),a.renderable=e,a.roundPixels=i,a});return this._graphicsBatchesHash[e.uid]===void 0&&e.on("destroyed",this._destroyRenderableBound),this._graphicsBatchesHash[e.uid]=n,n}_removeBatchForRenderable(e){this._graphicsBatchesHash[e].forEach(t=>{He.return(t)}),this._graphicsBatchesHash[e]=null}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null;for(let e in this._graphicsBatchesHash)this._removeBatchForRenderable(e);this._graphicsBatchesHash=null}},ql.extension={type:[I.WebGLPipes,I.WebGPUPipes,I.CanvasPipes],name:"graphics"}}),Uf=_(()=>{re(),Yl(),ab(),fe.add(ql),fe.add(Ta)}),ka,Kl=_(()=>{"use strict";ka=class{constructor(){this.batcherName="default",this.packAsQuad=!1,this.indexOffset=0,this.attributeOffset=0,this.roundPixels=0,this._batcher=null,this._batch=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}get blendMode(){return this.renderable.groupBlendMode}get topology(){return this._topology||this.geometry.topology}set topology(e){this._topology=e}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.geometry=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}get uvs(){let e=this.geometry.getBuffer("aUV"),t=e.data,r=t,i=this.texture.textureMatrix;return i.isSimple||(r=this._transformedUvs,(this._textureMatrixUpdateId!==i._updateID||this._uvUpdateId!==e._updateID)&&((!r||r.length{re(),Ze(),Li(),dr(),sa(),Ot(),ts(),Kl(),Zl=class{constructor(e,t){this.localUniforms=new Jt({uTransformMatrix:{value:new _e,type:"mat3x3"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new Vr({0:this.localUniforms}),this._meshDataHash=Object.create(null),this._gpuBatchableMeshHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=e,this._adaptor=t,this._adaptor.init(),e.renderableGC.addManagedHash(this,"_gpuBatchableMeshHash"),e.renderableGC.addManagedHash(this,"_meshDataHash")}validateRenderable(e){let t=this._getMeshData(e),r=t.batched,i=e.batched;if(t.batched=i,r!==i)return!0;if(i){let n=e._geometry;if(n.indices.length!==t.indexSize||n.positions.length!==t.vertexSize)return t.indexSize=n.indices.length,t.vertexSize=n.positions.length,!0;let s=this._getBatchableMesh(e);return!s._batcher.checkAndUpdateTexture(s,e.texture)}return!1}addRenderable(e,t){let r=this.renderer.renderPipes.batch,{batched:i}=this._getMeshData(e);if(i){let n=this._getBatchableMesh(e);n.texture=e._texture,n.geometry=e._geometry,r.addToBatch(n,t)}else r.break(t),t.add(e)}updateRenderable(e){if(e.batched){let t=this._gpuBatchableMeshHash[e.uid];t.texture=e._texture,t.geometry=e._geometry,t._batcher.updateElement(t)}}destroyRenderable(e){this._meshDataHash[e.uid]=null;let t=this._gpuBatchableMeshHash[e.uid];t&&(He.return(t),this._gpuBatchableMeshHash[e.uid]=null),e.off("destroyed",this._destroyRenderableBound)}execute(e){if(!e.isRenderable)return;e.state.blendMode=Xn(e.groupBlendMode,e.texture._source);let t=this.localUniforms;t.uniforms.uTransformMatrix=e.groupTransform,t.uniforms.uRound=this.renderer._roundPixels|e._roundPixels,t.update(),es(e.groupColorAlpha,t.uniforms.uColor,0),this._adaptor.execute(this,e)}_getMeshData(e){return this._meshDataHash[e.uid]||this._initMeshData(e)}_initMeshData(e){return this._meshDataHash[e.uid]={batched:e.batched,indexSize:e._geometry.indices?.length,vertexSize:e._geometry.positions?.length},e.on("destroyed",this._destroyRenderableBound),this._meshDataHash[e.uid]}_getBatchableMesh(e){return this._gpuBatchableMeshHash[e.uid]||this._initBatchableMesh(e)}_initBatchableMesh(e){let t=He.get(ka);return t.renderable=e,t.texture=e._texture,t.transform=e.groupTransform,t.roundPixels=this.renderer._roundPixels|e._roundPixels,this._gpuBatchableMeshHash[e.uid]=t,t}destroy(){for(let e in this._gpuBatchableMeshHash)this._gpuBatchableMeshHash[e]&&He.return(this._gpuBatchableMeshHash[e]);this._gpuBatchableMeshHash=null,this._meshDataHash=null,this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null}},Zl.extension={type:[I.WebGLPipes,I.WebGPUPipes,I.CanvasPipes],name:"mesh"}}),Ff=_(()=>{re(),ob(),fe.add(Zl)}),Lf,lb=_(()=>{"use strict";Lf=class{execute(e,t){let r=e.state,i=e.renderer,n=t.shader||e.defaultShader;n.resources.uTexture=t.texture._source,n.resources.uniforms=e.localUniforms;let s=i.gl,a=e.getBuffers(t);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,t.particleChildren.length*6,o,0)}}});function Nf(e,t=null){let r=e*6;if(r>65535?t||(t=new Uint32Array(r)):t||(t=new Uint16Array(r)),t.length!==r)throw new Error(`Out buffer length is incorrect, got ${t.length} and expected ${r}`);for(let i=0,n=0;i{"use strict"});function ub(e){return{dynamicUpdate:Hf(e,!0),staticUpdate:Hf(e,!1)}}function Hf(e,t){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 e){let a=e[s];if(t!==a.dynamic)continue;r.push(`offset = index + ${i}`),r.push(a.code);let o=Ei(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 cb=_(()=>{_n()});function db(e){let t=[];for(let r in e){let i=e[r];t.push(r,i.code,i.dynamic?"d":"s")}return t.join("_")}var zf,fb=_(()=>{zi(),Si(),Yn(),_n(),Ud(),hb(),cb(),zf=class{constructor(e){this._size=0,this._generateParticleUpdateCache={};let t=this._size=e.size??1e3,r=e.properties,i=0,n=0;for(let h in r){let u=r[h],c=Ei(u.format);u.dynamic?n+=c.stride:i+=c.stride}this._dynamicStride=n/4,this._staticStride=i/4,this.staticAttributeBuffer=new Hi(t*4*i),this.dynamicAttributeBuffer=new Hi(t*4*n),this.indexBuffer=Nf(t);let s=new gn,a=0,o=0;this._staticBuffer=new cr({data:new Float32Array(1),label:"static-particle-buffer",shrinkToFit:!1,usage:Je.VERTEX|Je.COPY_DST}),this._dynamicBuffer=new cr({data:new Float32Array(1),label:"dynamic-particle-buffer",shrinkToFit:!1,usage:Je.VERTEX|Je.COPY_DST});for(let h in r){let u=r[h],c=Ei(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(e){let t=db(e);return this._generateParticleUpdateCache[t]?this._generateParticleUpdateCache[t]:(this._generateParticleUpdateCache[t]=this.generateParticleUpdate(e),this._generateParticleUpdateCache[t])}generateParticleUpdate(e){return ub(e)}update(e,t){e.length>this._size&&(t=!0,this._size=Math.max(e.length,this._size*1.5|0),this.staticAttributeBuffer=new Hi(this._size*this._staticStride*4*4),this.dynamicAttributeBuffer=new Hi(this._size*this._dynamicStride*4*4),this.indexBuffer=Nf(this._size),this.geometry.indexBuffer.setDataWithSize(this.indexBuffer,this.indexBuffer.byteLength,!0));let r=this.dynamicAttributeBuffer;if(this._dynamicUpload(e,r.float32View,r.uint32View),this._dynamicBuffer.setDataWithSize(this.dynamicAttributeBuffer.float32View,e.length*this._dynamicStride*4,!0),t){let i=this.staticAttributeBuffer;this._staticUpload(e,i.float32View,i.uint32View),this._staticBuffer.setDataWithSize(i.float32View,e.length*this._staticStride*4,!0)}}destroy(){this._staticBuffer.destroy(),this._dynamicBuffer.destroy(),this.geometry.destroy()}}}),Vf,pb=_(()=>{Vf=`varying vec2 vUV; varying vec4 vColor; uniform sampler2D uTexture; void main(void){ vec4 color = texture2D(uTexture, vUV) * vColor; gl_FragColor = color; }`}),Wf,gb=_(()=>{Wf=`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; } `}),Ql,mb=_(()=>{Ql=` 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; }`}),jf,_b=_(()=>{Ne(),Ze(),mn(),Kn(),Wr(),mt(),Hc(),pb(),gb(),mb(),jf=class extends Rr{constructor(){let e=Vi.from({vertex:Wf,fragment:Vf}),t=yn.from({fragment:{source:Ql,entryPoint:"mainFragment"},vertex:{source:Ql,entryPoint:"mainVertex"}});super({glProgram:e,gpuProgram:t,resources:{uTexture:Ie.WHITE.source,uSampler:new No({}),uniforms:{uTranslationMatrix:{value:new _e,type:"mat3x3"},uColor:{value:new Ce(16777215),type:"vec4"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2"}}}})}}}),Jl,$f=_(()=>{Ze(),dr(),sa(),jr(),ts(),fb(),_b(),Jl=class{constructor(e,t){this.state=Er.for2d(),this._gpuBufferHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.localUniforms=new Jt({uTranslationMatrix:{value:new _e,type:"mat3x3"},uColor:{value:new Float32Array(4),type:"vec4"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2"}}),this.renderer=e,this.adaptor=t,this.defaultShader=new jf,this.state=Er.for2d()}validateRenderable(e){return!1}addRenderable(e,t){this.renderer.renderPipes.batch.break(t),t.add(e)}getBuffers(e){return this._gpuBufferHash[e.uid]||this._initBuffer(e)}_initBuffer(e){return this._gpuBufferHash[e.uid]=new zf({size:e.particleChildren.length,properties:e._properties}),e.on("destroyed",this._destroyRenderableBound),this._gpuBufferHash[e.uid]}updateRenderable(e){}destroyRenderable(e){this._gpuBufferHash[e.uid].destroy(),this._gpuBufferHash[e.uid]=null,e.off("destroyed",this._destroyRenderableBound)}execute(e){let t=e.particleChildren;if(t.length===0)return;let r=this.renderer,i=this.getBuffers(e);e.texture||(e.texture=t[0].texture);let n=this.state;i.update(t,e._childrenDirty),e._childrenDirty=!1,n.blendMode=Xn(e.blendMode,e.texture._source);let s=this.localUniforms.uniforms,a=s.uTranslationMatrix;e.worldTransform.copyTo(a),a.prepend(r.globalUniforms.globalUniformData.projectionMatrix),s.uResolution=r.globalUniforms.globalUniformData.resolution,s.uRound=r._roundPixels|e._roundPixels,es(e.groupColorAlpha,s.uColor,0),this.adaptor.execute(this,e)}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}}),eh,vb=_(()=>{re(),lb(),$f(),eh=class extends Jl{constructor(e){super(e,new Lf)}},eh.extension={type:[I.WebGLPipes],name:"particle"}}),Xf,yb=_(()=>{"use strict";Xf=class{execute(e,t){let r=e.renderer,i=t.shader||e.defaultShader;i.groups[0]=r.renderPipes.uniformBatch.getUniformBindGroup(e.localUniforms,!0),i.groups[1]=r.texture.getTextureBindGroup(t.texture);let n=e.state,s=e.getBuffers(t);r.encoder.draw({geometry:s.geometry,shader:t.shader||e.defaultShader,state:n,size:t.particleChildren.length*6})}}}),th,xb=_(()=>{re(),yb(),$f(),th=class extends Jl{constructor(e){super(e,new Xf)}},th.extension={type:[I.WebGPUPipes],name:"particle"}}),Yf=_(()=>{re(),vb(),xb(),fe.add(eh),fe.add(th)}),rs,Ba=_(()=>{"use strict";rs=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}}}),rh,bb=_(()=>{re(),bl(),Ot(),Ba(),rh=class{constructor(e){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText")}resolutionChange(){for(let e in this._gpuText){let t=this._gpuText[e];if(!t)continue;let r=t.batchableSprite.renderable;r._autoResolution&&(r._resolution=this._renderer.resolution,r.onViewUpdate())}}validateRenderable(e){let t=this._getGpuText(e),r=e._getKey();return t.currentKey!==r}addRenderable(e,t){let r=this._getGpuText(e).batchableSprite;e._didTextUpdate&&this._updateText(e),this._renderer.renderPipes.batch.addToBatch(r,t)}updateRenderable(e){let t=this._getGpuText(e).batchableSprite;e._didTextUpdate&&this._updateText(e),t._batcher.updateElement(t)}destroyRenderable(e){e.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(e.uid)}_destroyRenderableById(e){let t=this._gpuText[e];this._renderer.canvasText.decreaseReferenceCount(t.currentKey),He.return(t.batchableSprite),this._gpuText[e]=null}_updateText(e){let t=e._getKey(),r=this._getGpuText(e),i=r.batchableSprite;r.currentKey!==t&&this._updateGpuText(e),e._didTextUpdate=!1;let n=e._style.padding;Qs(i.bounds,e._anchor,i.texture,n)}_updateGpuText(e){let t=this._getGpuText(e),r=t.batchableSprite;t.texture&&this._renderer.canvasText.decreaseReferenceCount(t.currentKey),t.texture=r.texture=this._renderer.canvasText.getManagedTexture(e),t.currentKey=e._getKey(),r.texture=t.texture}_getGpuText(e){return this._gpuText[e.uid]||this.initGpuText(e)}initGpuText(e){let t={texture:null,currentKey:"--",batchableSprite:He.get(rs)};return t.batchableSprite.renderable=e,t.batchableSprite.transform=e.groupTransform,t.batchableSprite.bounds={minX:0,maxX:1,minY:0,maxY:0},t.batchableSprite.roundPixels=this._renderer._roundPixels|e._roundPixels,this._gpuText[e.uid]=t,e._resolution=e._autoResolution?this._renderer.resolution:e.resolution,this._updateText(e),e.on("destroyed",this._destroyRenderableBound),t}destroy(){for(let e in this._gpuText)this._destroyRenderableById(e);this._gpuText=null,this._renderer=null}},rh.extension={type:[I.WebGLPipes,I.WebGPUPipes,I.CanvasPipes],name:"text"}}),qf,$r,is=_(()=>{Ht(),Ls(),qf=class{constructor(e){this._canvasPool=Object.create(null),this.canvasOptions=e||{},this.enableFullScreen=!1}_createCanvasAndContext(e,t){let r=yt.get().createCanvas();r.width=e,r.height=t;let i=r.getContext("2d");return{canvas:r,context:i}}getOptimalCanvasAndContext(e,t,r=1){e=Math.ceil(e*r-1e-6),t=Math.ceil(t*r-1e-6),e=an(e),t=an(t);let i=(e<<17)+(t<<1);this._canvasPool[i]||(this._canvasPool[i]=[]);let n=this._canvasPool[i].pop();return n||(n=this._createCanvasAndContext(e,t)),n}returnCanvasAndContext(e){let t=e.canvas,{width:r,height:i}=t,n=(r<<17)+(i<<1);e.context.clearRect(0,0,r,i),this._canvasPool[n].push(e)}clear(){this._canvasPool={}}},$r=new qf});function Kf(e,t,r){for(let i=0,n=4*r*t;i{E()}),ih,Tn,nh=_(()=>{Ne(),Ht(),Ze(),Cl(),mt(),At(),ih=class Ic{constructor(t,r,i,n){this.uid=ut("fillGradient"),this.type="linear",this.gradientStops=[],this._styleKey=null,this.x0=t,this.y0=r,this.x1=i,this.y1=n}addColorStop(t,r){return this.gradientStops.push({offset:t,color:Ce.shared.setValue(r).toHexa()}),this._styleKey=null,this}buildLinearGradient(){if(this.texture)return;let t=Ic.defaultTextureSize,{gradientStops:r}=this,i=yt.get().createCanvas();i.width=t,i.height=t;let n=i.getContext("2d"),s=n.createLinearGradient(0,0,Ic.defaultTextureSize,1);for(let x=0;x`${n.offset}-${n.color}`).join("-"),r=this.texture.uid,i=this.transform.toArray().join("-");return`fill-gradient-${this.uid}-${t}-${r}-${i}-${this.x0}-${this.y0}-${this.x1}-${this.y1}`}},ih.defaultTextureSize=256,Tn=ih}),sh,ns,ah=_(()=>{Ze(),At(),sh={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"}},ns=class{constructor(e,t){this.uid=ut("fillPattern"),this.transform=new _e,this._styleKey=null,this.texture=e,this.transform.scale(1/e.frame.width,1/e.frame.height),t&&(e.source.style.addressModeU=sh[t].addressModeU,e.source.style.addressModeV=sh[t].addressModeV)}setTransform(e){let t=this.texture;this.transform.copyFrom(e),this.transform.invert(),this.transform.scale(1/t.frame.width,1/t.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)}}}),Sb=Ve((e,t)=>{t.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:ge(`Unknown SVG path command: ${h}`)}h!=="Z"&&h!=="z"&&n===null&&(n={startX:s,startY:a},i.push(n))}return t}var Qf,Cb=_(()=>{Qf=ct(Sb(),1),Fe()}),oh,Jf=_(()=>{E(),oh=class Bv{constructor(t=0,r=0,i=0){this.type="circle",this.x=t,this.y=r,this.radius=i}clone(){return new Bv(this.x,this.y,this.radius)}contains(t,r){if(this.radius<=0)return!1;let i=this.radius*this.radius,n=this.x-t,s=this.y-r;return n*=n,s*=s,n+s<=i}strokeContains(t,r,i,n=.5){if(this.radius===0)return!1;let s=this.x-t,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(t){return t||(t=new b),t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=this.radius*2,t.height=this.radius*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}}),ep,Ab=_(()=>{E(),ep=class Iv{constructor(t=0,r=0,i=0,n=0){this.type="ellipse",this.x=t,this.y=r,this.halfWidth=i,this.halfHeight=n}clone(){return new Iv(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,r){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let i=(t-this.x)/this.halfWidth,n=(r-this.y)/this.halfHeight;return i*=i,n*=n,i+n<=1}strokeContains(t,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=t-this.x,y=r-this.y,x=d*d/(h*h)+y*y/(u*u),v=d*d/(c*c)+y*y/(f*f);return x>1&&v<=1}getBounds(t){return t||(t=new b),t.x=this.x-this.halfWidth,t.y=this.y-this.halfHeight,t.width=this.halfWidth*2,t.height=this.halfHeight*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}});function Mb(e,t,r,i,n,s){let a=e-r,o=t-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,y;f<0?(d=r,y=i):f>1?(d=n,y=s):(d=r+f*l,y=i+f*h);let x=e-d,v=t-y;return x*x+v*v}var Pb=_(()=>{"use strict"}),Ia,Rb=_(()=>{Pb(),E(),Ia=class Gv{constructor(...t){this.type="polygon";let r=Array.isArray(t[0])?t[0]:t;if(typeof r[0]!="number"){let i=[];for(let n=0,s=r.length;nr!=u>r&&t<(h-o)*((r-l)/(u-l))+o&&(i=!i)}return i}strokeContains(t,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 t.x=i,t.width=n-i,t.y=s,t.height=a-s,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((t,r)=>`${t}, ${r}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return this.points[this.points.length-2]}get y(){return this.points[this.points.length-1]}}}),ss,tp,kb=_(()=>{E(),ss=(e,t,r,i,n,s,a)=>{let o=e-r,l=t-i,h=Math.sqrt(o*o+l*l);return h>=n-s&&h<=n+a},tp=class Ov{constructor(t=0,r=0,i=0,n=0,s=20){this.type="roundedRectangle",this.x=t,this.y=r,this.width=i,this.height=n,this.radius=s}getBounds(t){return t||(t=new b),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new Ov(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,r){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=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||t>=this.x+i&&t<=this.x+this.width-i)return!0;let n=t-(this.x+i),s=r-(this.y+i),a=i*i;if(n*n+s*s<=a||(n=t-(this.x+this.width-i),n*n+s*s<=a)||(s=r-(this.y+this.height-i),n*n+s*s<=a)||(n=t-(this.x+i),n*n+s*s<=a))return!0}return!1}strokeContains(t,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,y=o-h*2,x=l-h*2,v=s+o,w=a+l;return(t>=s-u&&t<=s+c||t>=v-c&&t<=v+u)&&r>=d&&r<=d+x||(r>=a-u&&r<=a+c||r>=w-c&&r<=w+u)&&t>=f&&t<=f+y?!0:tv-h&&rv-h&&r>w-h&&ss(t,r,v-h,w-h,h,c,u)||tw-h&&ss(t,r,f,w-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 rp(e,t,r,i,n,s,a,o,l,h){let u=Math.min(.99,Math.max(0,h??Ta.defaultOptions.bezierSmoothness)),c=(np-u)/1;return c*=c,Bb(t,r,i,n,s,a,o,l,e,c),e}function Bb(e,t,r,i,n,s,a,o,l,h){lh(e,t,r,i,n,s,a,o,l,h,0),l.push(a,o)}function lh(e,t,r,i,n,s,a,o,l,h,u){if(u>ip)return;let c=Math.PI,f=(e+r)/2,d=(t+i)/2,y=(r+n)/2,x=(i+s)/2,v=(n+a)/2,w=(s+o)/2,M=(f+y)/2,O=(d+x)/2,P=(y+v)/2,U=(x+w)/2,F=(M+P)/2,N=(O+U)/2;if(u>0){let oe=a-e,ce=o-t,ae=Math.abs((r-a)*ce-(i-o)*oe),se=Math.abs((n-a)*ce-(s-o)*oe),Se,ke;if(ae>as&&se>as){if((ae+se)*(ae+se)<=h*(oe*oe+ce*ce)){if(Xi=c&&(Se=2*c-Se),ke>=c&&(ke=2*c-ke),Se+keAi){l.push(r,i);return}if(ke>Ai){l.push(n,s);return}}}}else if(ae>as){if(ae*ae<=h*(oe*oe+ce*ce)){if(Xi=c&&(Se=2*c-Se),SeAi){l.push(r,i);return}}}else if(se>as){if(se*se<=h*(oe*oe+ce*ce)){if(Xi=c&&(Se=2*c-Se),SeAi){l.push(n,s);return}}}else if(oe=F-(e+a)/2,ce=N-(t+o)/2,oe*oe+ce*ce<=h){l.push(F,N);return}}lh(e,t,f,d,M,O,F,N,l,h,u+1),lh(F,N,P,U,v,w,a,o,l,h,u+1)}var ip,as,np,Ga,Xi,Ai,sp=_(()=>{Yl(),ip=8,as=11920929e-14,np=1,Ga=.01,Xi=0,Ai=0});function Ib(e,t,r,i,n,s,a,o){let l=Math.min(.99,Math.max(0,o??Ta.defaultOptions.bezierSmoothness)),h=(lp-l)/1;return h*=h,Gb(t,r,i,n,s,a,e,h),e}function Gb(e,t,r,i,n,s,a,o){hh(a,e,t,r,i,n,s,o,0),a.push(n,s)}function hh(e,t,r,i,n,s,a,o,l){if(l>ap)return;let h=Math.PI,u=(t+i)/2,c=(r+n)/2,f=(i+s)/2,d=(n+a)/2,y=(u+f)/2,x=(c+d)/2,v=s-t,w=a-r,M=Math.abs((i-s)*w-(n-a)*v);if(M>op){if(M*M<=o*(v*v+w*w)){if(uh=h&&(O=2*h-O),O{Yl(),ap=8,op=11920929e-14,lp=1,hp=.01,uh=0});function up(e,t,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 Db(e,t,r,i,n,s){let a=e[e.length-2],o=e[e.length-1]-r,l=a-t,h=n-r,u=i-t,c=Math.abs(o*u-l*h);if(c<1e-8||s===0){(e[e.length-2]!==t||e[e.length-1]!==r)&&e.push(t,r);return}let f=o*o+l*l,d=h*h+u*u,y=o*h+l*u,x=s*Math.sqrt(f)/c,v=s*Math.sqrt(d)/c,w=x*y/f,M=v*y/d,O=x*u+v*l,P=x*h+v*o,U=l*(v+w),F=o*(v+w),N=u*(x+M),oe=h*(x+M),ce=Math.atan2(F-P,U-O),ae=Math.atan2(oe-P,N-O);up(e,O+t,P+r,s,ce,ae,l*h>u*o)}var Ub=_(()=>{cp()});function Fb(e,t){let r=t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),i=t===1.5707963267948966?.551915024494:r,n=Math.cos(e),s=Math.sin(e),a=Math.cos(e+t),o=Math.sin(e+t);return[{x:n-s*i,y:s+n*i},{x:a+o*i,y:o-a*i},{x:a,y:o}]}function Lb(e,t,r,i,n,s,a,o=0,l=0,h=0){if(s===0||a===0)return;let u=Math.sin(o*Sn/360),c=Math.cos(o*Sn/360),f=c*(t-i)/2+u*(r-n)/2,d=-u*(t-i)/2+c*(r-n)/2;if(f===0&&d===0)return;s=Math.abs(s),a=Math.abs(a);let y=Math.pow(f,2)/Math.pow(s,2)+Math.pow(d,2)/Math.pow(a,2);y>1&&(s*=Math.sqrt(y),a*=Math.sqrt(y)),dp(t,r,i,n,s,a,l,h,u,c,f,d,Oa);let{ang1:x,ang2:v}=Oa,{centerX:w,centerY:M}=Oa,O=Math.abs(v)/(Sn/4);Math.abs(1-O)<1e-7&&(O=1);let P=Math.max(Math.ceil(O),1);v/=P;let U=e[e.length-2],F=e[e.length-1],N={x:0,y:0};for(let oe=0;oe{sp(),Sn=Math.PI*2,Oa={centerX:0,centerY:0,ang1:0,ang2:0},Da=({x:e,y:t},r,i,n,s,a,o,l)=>{e*=r,t*=i;let h=n*e-s*t,u=s*e+n*t;return l.x=h+a,l.y=u+o,l},ch=(e,t,r,i)=>{let n=e*i-t*r<0?-1:1,s=e*r+t*i;return s>1&&(s=1),s<-1&&(s=-1),n*Math.acos(s)},dp=(e,t,r,i,n,s,a,o,l,h,u,c,f)=>{let d=Math.pow(n,2),y=Math.pow(s,2),x=Math.pow(u,2),v=Math.pow(c,2),w=d*y-d*v-y*x;w<0&&(w=0),w/=d*v+y*x,w=Math.sqrt(w)*(a===o?-1:1);let M=w*n/s*c,O=w*-s/n*u,P=h*M-l*O+(e+r)/2,U=l*M+h*O+(t+i)/2,F=(u-M)/n,N=(c-O)/s,oe=(-u-M)/n,ce=(-c-O)/s,ae=ch(1,0,F,N),se=ch(F,N,oe,ce);o===0&&se>0&&(se-=Sn),o===1&&se<0&&(se+=Sn),f.centerX=P,f.centerY=U,f.ang1=ae,f.ang2=se}});function Hb(e,t,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?e.moveTo(o.x,o.y):e.lineTo(o.x,o.y)},s=t[t.length-1];for(let a=0;a0&&(d=-1,y=!0);let x=f/2,v,w=Math.abs(Math.cos(x)*l/Math.sin(x));w>Math.min(u.len/2,c.len/2)?(w=Math.min(u.len/2,c.len/2),v=Math.abs(w*Math.sin(x)/Math.cos(x))):v=l;let M=o.x+c.nx*w+-c.ny*v*d,O=o.y+c.ny*w+c.nx*v*d,P=Math.atan2(u.ny,u.nx)+Math.PI/2*d,U=Math.atan2(c.ny,c.nx)-Math.PI/2*d;a===0&&e.moveTo(M+Math.cos(P)*v,O+Math.sin(P)*v),e.arc(M,O,v,P,U,y),s=o}}function zb(e,t,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=t.length;for(let o=0;o{"use strict"}),fp,pp,Wb=_(()=>{Jf(),Ab(),Rb(),E(),kb(),T(),sp(),Ob(),cp(),Ub(),Nb(),Vb(),fp=new b,pp=class{constructor(e){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new m,this._graphicsPath2D=e}moveTo(e,t){return this.startPoly(e,t),this}lineTo(e,t){this._ensurePoly();let r=this._currentPoly.points,i=r[r.length-2],n=r[r.length-1];return(i!==e||n!==t)&&r.push(e,t),this}arc(e,t,r,i,n,s){this._ensurePoly(!1);let a=this._currentPoly.points;return up(a,e,t,r,i,n,s),this}arcTo(e,t,r,i,n){this._ensurePoly();let s=this._currentPoly.points;return Db(s,e,t,r,i,n),this}arcToSvg(e,t,r,i,n,s,a){let o=this._currentPoly.points;return Lb(o,this._currentPoly.lastX,this._currentPoly.lastY,s,a,e,t,r,i,n),this}bezierCurveTo(e,t,r,i,n,s,a){this._ensurePoly();let o=this._currentPoly;return rp(this._currentPoly.points,o.lastX,o.lastY,e,t,r,i,n,s,a),this}quadraticCurveTo(e,t,r,i,n){this._ensurePoly();let s=this._currentPoly;return Ib(this._currentPoly.points,s.lastX,s.lastY,e,t,r,i,n),this}closePath(){return this.endPoly(!0),this}addPath(e,t){this.endPoly(),t&&!t.isIdentity()&&(e=e.clone(!0),e.transform(t));for(let r=0;r=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(e,t,r,i,n){return this.drawShape(new ep(e,t,r,i),n),this}roundRect(e,t,r,i,n,s){return this.drawShape(new tp(e,t,r,i,n),s),this}drawShape(e,t){return this.endPoly(),this.shapePrimitives.push({shape:e,transform:t}),this}startPoly(e,t){let r=this._currentPoly;return r&&this.endPoly(),r=new Ia,r.points.push(e,t),this._currentPoly=r,this}endPoly(e=!1){let t=this._currentPoly;return t&&t.points.length>2&&(t.closePath=e,this.shapePrimitives.push({shape:t})),this._currentPoly=null,this}_ensurePoly(e=!0){if(!this._currentPoly&&(this._currentPoly=new Ia,e)){let t=this.shapePrimitives[this.shapePrimitives.length-1];if(t){let r=t.shape.x,i=t.shape.y;if(t.transform&&!t.transform.isIdentity()){let n=t.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 e=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let t=0;t{wt(),At(),Fe(),Cb(),Wb(),ls=class Dv{constructor(t){this.instructions=[],this.uid=ut("graphicsPath"),this._dirty=!0,typeof t=="string"?Eb(t,this):this.instructions=t?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new pp(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(t,r){return t=t.clone(),this.instructions.push({action:"addPath",data:[t,r]}),this._dirty=!0,this}arc(...t){return this.instructions.push({action:"arc",data:t}),this._dirty=!0,this}arcTo(...t){return this.instructions.push({action:"arcTo",data:t}),this._dirty=!0,this}arcToSvg(...t){return this.instructions.push({action:"arcToSvg",data:t}),this._dirty=!0,this}bezierCurveTo(...t){return this.instructions.push({action:"bezierCurveTo",data:t}),this._dirty=!0,this}bezierCurveToShort(t,r,i,n,s){let a=this.instructions[this.instructions.length-1],o=this.getLastPoint(xe.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,t,r,i,n,s]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...t){return this.instructions.push({action:"ellipse",data:t}),this._dirty=!0,this}lineTo(...t){return this.instructions.push({action:"lineTo",data:t}),this._dirty=!0,this}moveTo(...t){return this.instructions.push({action:"moveTo",data:t}),this}quadraticCurveTo(...t){return this.instructions.push({action:"quadraticCurveTo",data:t}),this._dirty=!0,this}quadraticCurveToShort(t,r,i){let n=this.instructions[this.instructions.length-1],s=this.getLastPoint(xe.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,t,r,i]}),this._dirty=!0,this}rect(t,r,i,n,s){return this.instructions.push({action:"rect",data:[t,r,i,n,s]}),this._dirty=!0,this}circle(t,r,i,n){return this.instructions.push({action:"circle",data:[t,r,i,n]}),this._dirty=!0,this}roundRect(...t){return this.instructions.push({action:"roundRect",data:t}),this._dirty=!0,this}poly(...t){return this.instructions.push({action:"poly",data:t}),this._dirty=!0,this}regularPoly(...t){return this.instructions.push({action:"regularPoly",data:t}),this._dirty=!0,this}roundPoly(...t){return this.instructions.push({action:"roundPoly",data:t}),this._dirty=!0,this}roundShape(...t){return this.instructions.push({action:"roundShape",data:t}),this._dirty=!0,this}filletRect(...t){return this.instructions.push({action:"filletRect",data:t}),this._dirty=!0,this}chamferRect(...t){return this.instructions.push({action:"chamferRect",data:t}),this._dirty=!0,this}star(t,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;fparseInt(oe,10)),t.context.poly(M,!0),r&&t.context.fill(),i&&t.context.stroke();break;case"polyline":O=e.getAttribute("points"),M=O.match(/\d+/g).map(oe=>parseInt(oe,10)),t.context.poly(M,!1),i&&t.context.stroke();break;case"g":case"svg":break;default:{console.info(`[SVG parser] <${e.nodeName}> elements unsupported`);break}}for(let oe=0;oe{Ne(),gp()});function Yb(e){return Ce.isColorLike(e)}function _p(e){return e instanceof ns}function vp(e){return e instanceof Tn}function qb(e,t,r){let i=Ce.shared.setValue(t??0);return e.color=i.toNumber(),e.alpha=i.alpha===1?r.alpha:i.alpha,e.texture=Ie.WHITE,{...r,...e}}function yp(e,t,r){return e.fill=t,e.color=16777215,e.texture=t.texture,e.matrix=t.transform,{...r,...e}}function xp(e,t,r){return t.buildLinearGradient(),e.fill=t,e.color=16777215,e.texture=t.texture,e.matrix=t.transform,{...r,...e}}function Kb(e,t){let r={...t,...e};if(r.texture){if(r.texture!==Ie.WHITE){let s=r.matrix?.clone().invert()||new _e;s.translate(r.texture.frame.x,r.texture.frame.y),s.scale(1/r.texture.source.width,1/r.texture.source.height),r.matrix=s}let n=r.texture.source.style;n.addressMode==="clamp-to-edge"&&(n.addressMode="repeat",n.update())}let i=Ce.shared.setValue(r.color);return r.alpha*=i.alpha,r.color=i.toNumber(),r.matrix=r.matrix?r.matrix.clone():null,r}function Yi(e,t){if(e==null)return null;let r={},i=e;return Yb(e)?qb(r,e,t):_p(e)?yp(r,e,t):vp(e)?xp(r,e,t):i.fill&&_p(i.fill)?yp(i,i.fill,t):i.fill&&vp(i.fill)?xp(i,i.fill,t):Kb(i,t)}function Ua(e,t){let{width:r,alignment:i,miterLimit:n,cap:s,join:a,pixelLine:o,...l}=t,h=Yi(e,l);return h?{width:r,alignment:i,miterLimit:n,cap:s,join:a,pixelLine:o,...h}:null}var bp=_(()=>{Ne(),Ze(),mt(),nh(),ah()}),wp,dh,Fa,Cr,Tp=_(()=>{xt(),Ne(),Ze(),wt(),mt(),At(),dt(),T(),gp(),Xb(),bp(),wp=new xe,dh=new _e,Fa=class Qr extends et{constructor(){super(...arguments),this.uid=ut("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new ls,this._transform=new _e,this._fillStyle={...Qr.defaultFillStyle},this._strokeStyle={...Qr.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new m,this._boundsDirty=!0}clone(){let t=new Qr;return t.batchMode=this.batchMode,t.instructions=this.instructions.slice(),t._activePath=this._activePath.clone(),t._transform=this._transform.clone(),t._fillStyle={...this._fillStyle},t._strokeStyle={...this._strokeStyle},t._stateStack=this._stateStack.slice(),t._bounds=this._bounds.clone(),t._boundsDirty=!0,t}get fillStyle(){return this._fillStyle}set fillStyle(t){this._fillStyle=Yi(t,Qr.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=Ua(t,Qr.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=Yi(t,Qr.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=Yi(t,Qr.defaultStrokeStyle),this}texture(t,r,i,n,s,a){return this.instructions.push({action:"texture",data:{image:t,dx:i||0,dy:n||0,dw:s||t.frame.width,dh:a||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:r?Ce.shared.setValue(r).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new ls,this}fill(t,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?(t!=null&&(r!==void 0&&typeof t=="number"&&(We(Qe,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:r}),this._fillStyle=Yi(t,Qr.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:i}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){let{x:t,y:r}=this._activePath.getLastPoint(xe.shared);this._activePath.clear(),this._activePath.moveTo(t,r)}stroke(t){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?(t!=null&&(this._strokeStyle=Ua(t,Qr.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:r}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let t=0;t<2;t++){let r=this.instructions[this.instructions.length-1-t],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(t,r,i,n,s,a){this._tick++;let o=this._transform;return this._activePath.arc(o.a*t+o.c*r+o.tx,o.b*t+o.d*r+o.ty,i,n,s,a),this}arcTo(t,r,i,n,s){this._tick++;let a=this._transform;return this._activePath.arcTo(a.a*t+a.c*r+a.tx,a.b*t+a.d*r+a.ty,a.a*i+a.c*n+a.tx,a.b*i+a.d*n+a.ty,s),this}arcToSvg(t,r,i,n,s,a,o){this._tick++;let l=this._transform;return this._activePath.arcToSvg(t,r,i,n,s,l.a*a+l.c*o+l.tx,l.b*a+l.d*o+l.ty),this}bezierCurveTo(t,r,i,n,s,a,o){this._tick++;let l=this._transform;return this._activePath.bezierCurveTo(l.a*t+l.c*r+l.tx,l.b*t+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(t,r,i,n){return this._tick++,this._activePath.ellipse(t,r,i,n,this._transform.clone()),this}circle(t,r,i){return this._tick++,this._activePath.circle(t,r,i,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,r){this._tick++;let i=this._transform;return this._activePath.lineTo(i.a*t+i.c*r+i.tx,i.b*t+i.d*r+i.ty),this}moveTo(t,r){this._tick++;let i=this._transform,n=this._activePath.instructions,s=i.a*t+i.c*r+i.tx,a=i.b*t+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(t,r,i,n,s){this._tick++;let a=this._transform;return this._activePath.quadraticCurveTo(a.a*t+a.c*r+a.tx,a.b*t+a.d*r+a.ty,a.a*i+a.c*n+a.tx,a.b*i+a.d*n+a.ty,s),this}rect(t,r,i,n){return this._tick++,this._activePath.rect(t,r,i,n,this._transform.clone()),this}roundRect(t,r,i,n,s){return this._tick++,this._activePath.roundRect(t,r,i,n,s,this._transform.clone()),this}poly(t,r){return this._tick++,this._activePath.poly(t,r,this._transform.clone()),this}regularPoly(t,r,i,n,s=0,a){return this._tick++,this._activePath.regularPoly(t,r,i,n,s,a),this}roundPoly(t,r,i,n,s,a){return this._tick++,this._activePath.roundPoly(t,r,i,n,s,a),this}roundShape(t,r,i,n){return this._tick++,this._activePath.roundShape(t,r,i,n),this}filletRect(t,r,i,n,s){return this._tick++,this._activePath.filletRect(t,r,i,n,s),this}chamferRect(t,r,i,n,s,a){return this._tick++,this._activePath.chamferRect(t,r,i,n,s,a),this}star(t,r,i,n,s=0,a=0){return this._tick++,this._activePath.star(t,r,i,n,s,a,this._transform.clone()),this}svg(t){return this._tick++,jb(t,this),this}restore(){let t=this._stateStack.pop();return t&&(this._transform=t.transform,this._fillStyle=t.fillStyle,this._strokeStyle=t.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(t){return this._transform.rotate(t),this}scale(t,r=t){return this._transform.scale(t,r),this}setTransform(t,r,i,n,s,a){return t instanceof _e?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,r,i,n,s,a),this)}transform(t,r,i,n,s,a){return t instanceof _e?(this._transform.append(t),this):(dh.set(t,r,i,n,s,a),this._transform.append(dh),this)}translate(t,r=t){return this._transform.translate(t,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 t=this._bounds;t.clear();for(let r=0;r{Ne(),fh=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"]});function Jb(e){let t=e;if(typeof t.dropShadow=="boolean"&&t.dropShadow){let r=Xr.defaultDropShadow;e.dropShadow={alpha:t.dropShadowAlpha??r.alpha,angle:t.dropShadowAngle??r.angle,blur:t.dropShadowBlur??r.blur,color:t.dropShadowColor??r.color,distance:t.dropShadowDistance??r.distance}}if(t.strokeThickness!==void 0){We(Qe,"strokeThickness is now a part of stroke");let r=t.stroke,i={};if(Ce.isColorLike(r))i.color=r;else if(r instanceof Tn||r instanceof ns)i.fill=r;else if(Object.hasOwnProperty.call(r,"color")||Object.hasOwnProperty.call(r,"fill"))i=r;else throw new Error("Invalid stroke value.");e.stroke={...i,width:t.strokeThickness}}if(Array.isArray(t.fillGradientStops)){We(Qe,"gradient fill is now a fill pattern: `new FillGradient(...)`");let r;e.fontSize==null?e.fontSize=Xr.defaultTextStyle.fontSize:typeof e.fontSize=="string"?r=parseInt(e.fontSize,10):r=e.fontSize;let i=new Tn(0,0,0,r*1.7),n=t.fillGradientStops.map(s=>Ce.shared.setValue(s).toNumber());n.forEach((s,a)=>{let o=a/(n.length-1);i.addColorStop(o,s)}),e.fill={fill:i}}}var La,Xr,hs=_(()=>{xt(),Ne(),dt(),nh(),ah(),Tp(),bp(),Cp(),La=class Gn extends et{constructor(t={}){super(),Jb(t);let r={...Gn.defaultTextStyle,...t};for(let i in r){let n=i;this[n]=r[i]}this.update()}get align(){return this._align}set align(t){this._align=t,this.update()}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords=t,this.update()}get dropShadow(){return this._dropShadow}set dropShadow(t){t!==null&&typeof t=="object"?this._dropShadow=this._createProxy({...Gn.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...Gn.defaultDropShadow}):null,this.update()}get fontFamily(){return this._fontFamily}set fontFamily(t){this._fontFamily=t,this.update()}get fontSize(){return this._fontSize}set fontSize(t){typeof t=="string"?this._fontSize=parseInt(t,10):this._fontSize=t,this.update()}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle=t.toLowerCase(),this.update()}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant=t,this.update()}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight=t,this.update()}get leading(){return this._leading}set leading(t){this._leading=t,this.update()}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing=t,this.update()}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight=t,this.update()}get padding(){return this._padding}set padding(t){this._padding=t,this.update()}get trim(){return this._trim}set trim(t){this._trim=t,this.update()}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline=t,this.update()}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace=t,this.update()}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap=t,this.update()}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth=t,this.update()}get fill(){return this._originalFill}set fill(t){t!==this._originalFill&&(this._originalFill=t,this._isFillStyle(t)&&(this._originalFill=this._createProxy({...Cr.defaultFillStyle,...t},()=>{this._fill=Yi({...this._originalFill},Cr.defaultFillStyle)})),this._fill=Yi(t===0?"black":t,Cr.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...Cr.defaultStrokeStyle,...t},()=>{this._stroke=Ua({...this._originalStroke},Cr.defaultStrokeStyle)})),this._stroke=Ua(t,Cr.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=Sp(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){let t=Gn.defaultTextStyle;for(let r in t)this[r]=t[r]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new Gn({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})}destroy(t=!1){if(this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._fill?.texture&&this._fill.texture.destroy(r),this._originalFill?.texture&&this._originalFill.texture.destroy(r),this._stroke?.texture&&this._stroke.texture.destroy(r),this._originalStroke?.texture&&this._originalStroke.texture.destroy(r)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(t,r){return new Proxy(t,{set:(i,n,s)=>(i[n]=s,r?.(n,s),this.update(),!0)})}_isFillStyle(t){return(t??null)!==null&&!(Ce.isColorLike(t)||t instanceof Tn||t instanceof ns)}},La.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5},La.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},Xr=La});function Ap(e,t,r,i){let n=Mp;n.minX=0,n.minY=0,n.maxX=e.width/i|0,n.maxY=e.height/i|0;let s=Kt.getOptimalTexture(n.width,n.height,i,!1);return s.source.uploadMethodId="image",s.source.resource=e,s.source.alphaMode="premultiply-alpha-on-upload",s.frame.width=t/i,s.frame.height=r/i,s.source.emit("update",s.source),s.updateUvs(),s}var Mp,Pp=_(()=>{Oi(),T(),Mp=new m});function Na(e){let t=typeof e.fontSize=="number"?`${e.fontSize}px`:e.fontSize,r=e.fontFamily;Array.isArray(e.fontFamily)||(r=e.fontFamily.split(","));for(let i=r.length-1;i>=0;i--){let n=r[i].trim();!/([\"\'])[^\'\"]+\1/.test(n)&&!Rp.includes(n)&&(n=`"${n}"`),r[i]=n}return`${e.fontStyle} ${e.fontVariant} ${e.fontWeight} ${t} ${r.join(",")}`}var Rp,ph=_(()=>{"use strict";Rp=["serif","sans-serif","monospace","cursive","fantasy","system-ui"]}),Ha,Ar,Yr,gh=_(()=>{Ht(),ph(),Ha={willReadFrequently:!0},Ar=class Me{static get experimentalLetterSpacingSupported(){let t=Me._experimentalLetterSpacingSupported;if(t!==void 0){let r=yt.get().getCanvasRenderingContext2D().prototype;t=Me._experimentalLetterSpacingSupported="letterSpacing"in r||"textLetterSpacing"in r}return t}constructor(t,r,i,n,s,a,o,l,h){this.text=t,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(t=" ",r,i=Me._canvas,n=r.wordWrap){let s=`${t}:${r.styleKey}`;if(Me._measurementCache[s])return Me._measurementCache[s];let a=Na(r),o=Me.measureFont(a);o.fontSize===0&&(o.fontSize=r.fontSize,o.ascent=r.fontSize);let l=Me.__context;l.font=a;let h=(n?Me._wordWrap(t,r,i):t).split(/(?:\r\n|\r|\n)/),u=new Array(h.length),c=0;for(let v=0;v0)if(n)a-=r,l-=r;else{let h=(Me.graphemeSegmenter(t).length-1)*r;a+=h,l+=h}return Math.max(a,l)}static _wordWrap(t,r,i=Me._canvas){let n=i.getContext("2d",Ha),s=0,a="",o="",l=Object.create(null),{letterSpacing:h,whiteSpace:u}=r,c=Me._collapseSpaces(u),f=Me._collapseNewlines(u),d=!c,y=r.wordWrapWidth+h,x=Me._tokenize(t);for(let v=0;vy)if(a!==""&&(o+=Me._addLine(a),a="",s=0),Me.canBreakWords(w,r.breakWords)){let O=Me.wordWrapSplit(w);for(let P=0;Py&&(o+=Me._addLine(a),d=!1,a="",s=0),a+=U,s+=oe}}else{a.length>0&&(o+=Me._addLine(a),a="",s=0);let O=v===x.length-1;o+=Me._addLine(w,!O),d=!1,a="",s=0}else M+s>y&&(d=!1,o+=Me._addLine(a),a="",s=0),(a.length>0||!Me.isBreakingSpace(w)||d)&&(a+=w,s+=M)}return o+=Me._addLine(a,!1),o}static _addLine(t,r=!0){return t=Me._trimRight(t),t=r?`${t} `:t,t}static _getFromCache(t,r,i,n){let s=i[t];return typeof s!="number"&&(s=Me._measureText(t,r,n)+r,i[t]=s),s}static _collapseSpaces(t){return t==="normal"||t==="pre-line"}static _collapseNewlines(t){return t==="normal"}static _trimRight(t){if(typeof t!="string")return"";for(let r=t.length-1;r>=0;r--){let i=t[r];if(!Me.isBreakingSpace(i))break;t=t.slice(0,-1)}return t}static _isNewline(t){return typeof t!="string"?!1:Me._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,r){return typeof t!="string"?!1:Me._breakingSpaces.includes(t.charCodeAt(0))}static _tokenize(t){let r=[],i="";if(typeof t!="string")return r;for(let n=0;n{if(typeof Intl?.Segmenter=="function"){let e=new Intl.Segmenter;return t=>[...e.segment(t)].map(r=>r.segment)}return e=>[...e]})(),Ar.experimentalLetterSpacing=!1,Ar._fonts={},Ar._newlines=[10,13],Ar._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288],Ar._measurementCache={},Yr=Ar});function za(e,t){if(e.texture===Ie.WHITE&&!e.fill)return Ce.shared.setValue(e.color).setAlpha(e.alpha??1).toHexa();if(e.fill){if(e.fill instanceof ns){let r=e.fill,i=t.createPattern(r.texture.source.resource,"repeat"),n=r.transform.copyTo(_e.shared);return n.scale(r.texture.frame.width,r.texture.frame.height),i.setTransform(n),i}else if(e.fill instanceof Tn){let r=e.fill;if(r.type==="linear"){let i=t.createLinearGradient(r.x0,r.y0,r.x1,r.y1);return r.gradientStops.forEach(n=>{i.addColorStop(n.offset,Ce.shared.setValue(n.color).toHex())}),i}}}else{let r=t.createPattern(e.texture.source.resource,"repeat"),i=e.matrix.copyTo(_e.shared);return i.scale(e.texture.frame.width,e.texture.frame.height),r.setTransform(i),r}return ge("FillStyle not recognised",e),"red"}var kp=_(()=>{Ne(),Ze(),mt(),Fe(),nh(),ah()}),mh,e0=_(()=>{Ne(),re(),Ls(),is(),Oi(),Tb(),dt(),hs(),Pp(),gh(),ph(),kp(),mh=class{constructor(e){this._activeTextures={},this._renderer=e}getTextureSize(e,t,r){let i=Yr.measureText(e||" ",r),n=Math.ceil(Math.ceil(Math.max(1,i.width)+r.padding*2)*t),s=Math.ceil(Math.ceil(Math.max(1,i.height)+r.padding*2)*t);return n=Math.ceil(n-1e-6),s=Math.ceil(s-1e-6),n=an(n),s=an(s),{width:n,height:s}}getTexture(e,t,r,i){typeof e=="string"&&(We("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),e={text:e,style:r,resolution:t}),e.style instanceof Xr||(e.style=new Xr(e.style));let{texture:n,canvasAndContext:s}=this.createTextureAndCanvas(e);return this._renderer.texture.initSource(n._source),$r.returnCanvasAndContext(s),n}createTextureAndCanvas(e){let{text:t,style:r}=e,i=e.resolution??this._renderer.resolution,n=Yr.measureText(t||" ",r),s=Math.ceil(Math.ceil(Math.max(1,n.width)+r.padding*2)*i),a=Math.ceil(Math.ceil(Math.max(1,n.height)+r.padding*2)*i),o=$r.getOptimalCanvasAndContext(s,a),{canvas:l}=o;this.renderTextToCanvas(t,r,i,o);let h=Ap(l,s,a,i);if(r.trim){let u=wb(l,i);h.frame.copyFrom(u),h.updateUvs()}return{texture:h,canvasAndContext:o}}getManagedTexture(e){e._resolution=e._autoResolution?this._renderer.resolution:e.resolution;let t=e._getKey();if(this._activeTextures[t])return this._increaseReferenceCount(t),this._activeTextures[t].texture;let{texture:r,canvasAndContext:i}=this.createTextureAndCanvas(e);return this._activeTextures[t]={canvasAndContext:i,texture:r,usageCount:1},r}_increaseReferenceCount(e){this._activeTextures[e].usageCount++}decreaseReferenceCount(e){let t=this._activeTextures[e];if(t.usageCount--,t.usageCount===0){$r.returnCanvasAndContext(t.canvasAndContext),Kt.returnTexture(t.texture);let r=t.texture.source;r.resource=null,r.uploadMethodId="unknown",r.alphaMode="no-premultiply-alpha",this._activeTextures[e]=null}}getReferenceCount(e){return this._activeTextures[e].usageCount}renderTextToCanvas(e,t,r,i){let{canvas:n,context:s}=i,a=Na(t),o=Yr.measureText(e||" ",t),l=o.lines,h=o.lineHeight,u=o.lineWidths,c=o.maxLineWidth,f=o.fontProperties,d=n.height;if(s.resetTransform(),s.scale(r,r),s.textBaseline=t.textBaseline,t._stroke?.width){let w=t._stroke;s.lineWidth=w.width,s.miterLimit=w.miterLimit,s.lineJoin=w.join,s.lineCap=w.cap}s.font=a;let y,x,v=t.dropShadow?2:1;for(let w=0;w{re(),bb(),e0(),fe.add(mh),fe.add(rh)}),Va,Ip=_(()=>{dt(),wl(),Tp(),Va=class Gc extends Js{constructor(t){t instanceof Cr&&(t={context:t});let{context:r,roundPixels:i,...n}=t||{};super({label:"Graphics",...n}),this.renderPipeId="graphics",r?this._context=r:this._context=this._ownedContext=new Cr,this._context.on("update",this.onViewUpdate,this),this.allowChildren=!1,this.roundPixels=i??!1}set context(t){t!==this._context&&(this._context.off("update",this.onViewUpdate,this),this._context=t,this._context.on("update",this.onViewUpdate,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}updateBounds(){}containsPoint(t){return this._context.containsPoint(t)}destroy(t){this._ownedContext&&!t?this._ownedContext.destroy(t):(t===!0||t?.context===!0)&&this._context.destroy(t),this._ownedContext=null,this._context=null,super.destroy(t)}_callContextMethod(t,r){return this.context[t](...r),this}setFillStyle(...t){return this._callContextMethod("setFillStyle",t)}setStrokeStyle(...t){return this._callContextMethod("setStrokeStyle",t)}fill(...t){return this._callContextMethod("fill",t)}stroke(...t){return this._callContextMethod("stroke",t)}texture(...t){return this._callContextMethod("texture",t)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...t){return this._callContextMethod("arc",t)}arcTo(...t){return this._callContextMethod("arcTo",t)}arcToSvg(...t){return this._callContextMethod("arcToSvg",t)}bezierCurveTo(...t){return this._callContextMethod("bezierCurveTo",t)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...t){return this._callContextMethod("ellipse",t)}circle(...t){return this._callContextMethod("circle",t)}path(...t){return this._callContextMethod("path",t)}lineTo(...t){return this._callContextMethod("lineTo",t)}moveTo(...t){return this._callContextMethod("moveTo",t)}quadraticCurveTo(...t){return this._callContextMethod("quadraticCurveTo",t)}rect(...t){return this._callContextMethod("rect",t)}roundRect(...t){return this._callContextMethod("roundRect",t)}poly(...t){return this._callContextMethod("poly",t)}regularPoly(...t){return this._callContextMethod("regularPoly",t)}roundPoly(...t){return this._callContextMethod("roundPoly",t)}roundShape(...t){return this._callContextMethod("roundShape",t)}filletRect(...t){return this._callContextMethod("filletRect",t)}chamferRect(...t){return this._callContextMethod("chamferRect",t)}star(...t){return this._callContextMethod("star",t)}svg(...t){return this._callContextMethod("svg",t)}restore(...t){return this._callContextMethod("restore",t)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...t){return this._callContextMethod("rotate",t)}scaleTransform(...t){return this._callContextMethod("scale",t)}setTransform(...t){return this._callContextMethod("setTransform",t)}transform(...t){return this._callContextMethod("transform",t)}translateTransform(...t){return this._callContextMethod("translate",t)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(t){this._context.fillStyle=t}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(t){this._context.strokeStyle=t}clone(t=!1){return t?new Gc(this._context.clone()):(this._ownedContext=null,new Gc(this._context))}lineStyle(t,r,i){We(Qe,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");let n={};return t&&(n.width=t),r&&(n.color=r),i&&(n.alpha=i),this.context.strokeStyle=n,this}beginFill(t,r){We(Qe,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");let i={};return t!==void 0&&(i.color=t),r!==void 0&&(i.alpha=r),this.context.fillStyle=i,this}endFill(){We(Qe,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();let t=this.context.strokeStyle;return(t.width!==Cr.defaultStrokeStyle.width||t.color!==Cr.defaultStrokeStyle.color||t.alpha!==Cr.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return We(Qe,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return We(Qe,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return We(Qe,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return We(Qe,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return We(Qe,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return We(Qe,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}}}),Gp,Op,t0=_(()=>{"use strict";Gp={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)); `}},Op={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)); `}}}),Dp,Up,r0=_(()=>{"use strict";Dp={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; } `}},Up={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; } `}}}),_h,vh,Fp,i0=_(()=>{Ze(),dn(),Wi(),ma(),ya(),ji(),jl(),Wr(),dr(),t0(),r0(),Fp=class extends Rr{constructor(){let e=new Jt({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uTransformMatrix:{value:new _e,type:"mat3x3"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}}),t=cn();_h??(_h=Zn({name:"sdf-shader",bits:[pa,Ll(t),Gp,Dp,xn]})),vh??(vh=Qn({name:"sdf-shader",bits:[ga,Nl(t),Op,Up,bn]})),super({glProgram:vh,gpuProgram:_h,resources:{localUniforms:e,batchSamplers:Vl(t)}})}}}),Lp,n0=_(()=>{xt(),dt(),Lp=class extends et{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 We(Qe,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return We(Qe,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return We(Qe,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return We(Qe,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return We(Qe,"BitmapFont.distanceFieldType is deprecated, please use BitmapFont.distanceField.type instead."),this.distanceField.type}destroy(e=!1){this.emit("destroy",this),this.removeAllListeners();for(let t in this.chars)this.chars[t].texture?.destroy();this.chars=null,e&&(this.pages.forEach(t=>t.texture.destroy(!0)),this.pages=null)}}});function Np(e){if(e==="")return[];typeof e=="string"&&(e=[e]);let t=[];for(let r=0,i=e.length;r{"use strict"}),yh,xh,s0=_(()=>{Ne(),E(),is(),Cl(),mt(),dt(),gh(),ph(),kp(),hs(),n0(),Hp(),yh=class Uv extends Lp{constructor(t){super(),this.resolution=1,this.pages=[],this._padding=0,this._measureCache=Object.create(null),this._currentChars=[],this._currentX=0,this._currentY=0,this._currentPageIndex=-1,this._skipKerning=!1;let r={...Uv.defaultOptions,...t};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=Ie.WHITE,i._fill.fill=null),this.applyFillAsTint=r.overrideFill;let n=i.fontSize;i.fontSize=this.baseMeasurementFontSize;let s=Na(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,this.fontMetrics=Yr.measureFont(s),this.lineHeight=i.lineHeight||this.fontMetrics.fontSize||i.fontSize}ensureCharacters(t){let r=Np(t).filter(v=>!this._currentChars.includes(v)).filter((v,w,M)=>M.indexOf(v)===w);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.baseRenderedFontSize/this.baseMeasurementFontSize,c=this._padding*u,f=0,d=!1,y=n.width/this.resolution,x=n.height/this.resolution;for(let v=0;vy&&(h+=f,f=N,l=0,h+f>x)){a.update();let ce=this._nextPage();n=ce.canvasAndContext.canvas,s=ce.canvasAndContext.context,a=ce.texture.source,h=0}let oe=O/u-(o.dropShadow?.distance??0)-(o._stroke?.width??0);if(this.chars[w]={id:w.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:oe,kerning:{}},d){this._drawGlyph(s,M,l+c,h+c,u,o);let ce=a.width*u,ae=a.height*u,se=new b(l/ce*a.width,h/ae*a.height,F/ce*a.width,N/ae*a.height);this.chars[w].texture=new Ie({source:a,frame:se}),l+=Math.ceil(F)}}a.update(),this._currentX=l,this._currentY=h,this._skipKerning&&this._applyKerning(r,s)}get pageTextures(){return We(Qe,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(t,r){let i=this._measureCache;for(let n=0;n{let x=s.width;for(let v=0;v{let y=s.chars.length-1;if(i){let x=s.chars[y];for(;x===" ";)s.width-=r.chars[x].xAdvance,x=s.chars[--y]}n.width=Math.max(n.width,s.width),s={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},o=!0,n.lines.push(s),n.height+=r.lineHeight},c=r.baseMeasurementFontSize/t.fontSize,f=t.letterSpacing*c,d=t.wordWrapWidth*c;for(let y=0;yd?(u(),h(l),v||s.charPositions.push(0)):(l.start=s.width,h(l),v||s.charPositions.push(0)),x==="\r"||x===` `)s.width!==0&&u();else if(!v){let M=w.xAdvance+(w.kerning[a]||0)+f;s.width+=M,s.spaceWidth=M,s.spacesIndex.push(s.charPositions.length),s.chars.push(x)}}else{let M=w.kerning[a]||0,O=w.xAdvance+M+f;l.positions[l.index++]=l.width+M,l.chars.push(x),l.width+=O}a=x}return u(),t.align==="center"?a0(n):t.align==="right"?o0(n):t.align==="justify"&&l0(n),n}function a0(e){for(let t=0;t{"use strict"}),us,Wp,jp,h0=_(()=>{ta(),dt(),Fe(),hs(),s0(),Vp(),Hp(),us=0,Wp=class{constructor(){this.ALPHA=[["a","z"],["A","Z"]," "],this.NUMERIC=[["0","9"]],this.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],this.ASCII=[[" ","~"]],this.defaultOptions={chars:this.ALPHANUMERIC,resolution:1,padding:4,skipKerning:!1}}getFont(e,t){let r=`${t.fontFamily}-bitmap`,i=!0;if(t._fill.fill&&!t._stroke)r+=t._fill.fill.styleKey,i=!1;else if(t._stroke||t.dropShadow){let s=t.styleKey;s=s.substring(0,s.lastIndexOf("-")),r=`${s}-bitmap`,i=!1}if(!Zt.has(r)){let s=new xh({style:t,overrideFill:i,overrideSize:!0,...this.defaultOptions});us++,us>50&&ge("BitmapText",`You have dynamically created ${us} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),s.once("destroy",()=>{us--,Zt.remove(r)}),Zt.set(r,s)}let n=Zt.get(r);return n.ensureCharacters?.(e),n}getLayout(e,t,r=!0){let i=this.getFont(e,t);return zp([...e],t,i,r)}measureText(e,t,r=!0){return this.getLayout(e,t,r)}install(...e){let t=e[0];typeof t=="string"&&(t={name:t,style:e[1],chars:e[2]?.chars,resolution:e[2]?.resolution,padding:e[2]?.padding,skipKerning:e[2]?.skipKerning},We(Qe,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));let r=t?.name;if(!r)throw new Error("[BitmapFontManager] Property `name` is required.");t={...this.defaultOptions,...t};let i=t.style,n=i instanceof Xr?i:new Xr(i),s=n._fill.fill!==null&&n._fill.fill!==void 0,a=new xh({style:n,overrideFill:s,skipKerning:t.skipKerning,padding:t.padding,resolution:t.resolution,overrideSize:!1}),o=Np(t.chars);return a.ensureCharacters(o.join("")),Zt.set(`${r}-bitmap`,a),a.once("destroy",()=>Zt.remove(`${r}-bitmap`)),a}uninstall(e){let t=`${e}-bitmap`,r=Zt.get(t);r&&r.destroy()}},jp=new Wp});function $p(e,t){t.groupTransform=e.groupTransform,t.groupColorAlpha=e.groupColorAlpha,t.groupColor=e.groupColor,t.groupBlendMode=e.groupBlendMode,t.globalDisplayStatus=e.globalDisplayStatus,t.groupTransform=e.groupTransform,t.localDisplayStatus=e.localDisplayStatus,t.groupAlpha=e.groupAlpha,t._roundPixels=e._roundPixels}var bh,u0=_(()=>{ta(),re(),Ot(),Ip(),i0(),h0(),Vp(),bh=class{constructor(e){this._gpuBitmapText={},this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_gpuBitmapText")}validateRenderable(e){let t=this._getGpuBitmapText(e);return e._didTextUpdate&&(e._didTextUpdate=!1,this._updateContext(e,t)),this._renderer.renderPipes.graphics.validateRenderable(t)}addRenderable(e,t){let r=this._getGpuBitmapText(e);$p(e,r),e._didTextUpdate&&(e._didTextUpdate=!1,this._updateContext(e,r)),this._renderer.renderPipes.graphics.addRenderable(r,t),r.context.customShader&&this._updateDistanceField(e)}destroyRenderable(e){e.off("destroyed",this._destroyRenderableBound),this._destroyRenderableByUid(e.uid)}_destroyRenderableByUid(e){let t=this._gpuBitmapText[e].context;t.customShader&&(He.return(t.customShader),t.customShader=null),He.return(this._gpuBitmapText[e]),this._gpuBitmapText[e]=null}updateRenderable(e){let t=this._getGpuBitmapText(e);$p(e,t),this._renderer.renderPipes.graphics.updateRenderable(t),t.context.customShader&&this._updateDistanceField(e)}_updateContext(e,t){let{context:r}=t,i=jp.getFont(e.text,e._style);r.clear(),i.distanceField.type!=="none"&&(r.customShader||(r.customShader=He.get(Fp)));let n=Array.from(e.text),s=e._style,a=i.baseLineOffset,o=zp(n,s,i,!0),l=0,h=s.padding,u=o.scale,c=o.width,f=o.height+o.offsetY;s._stroke&&(c+=s._stroke.width/u,f+=s._stroke.width/u),r.translate(-e._anchor._x*c-h,-e._anchor._y*f-h).scale(u,u);let d=i.applyFillAsTint?s._fill.color:16777215;for(let y=0;y{re(),u0(),fe.add(bh)}),wh,c0=_(()=>{re(),mt(),bl(),Ot(),Ba(),wh=class{constructor(e){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText")}resolutionChange(){for(let e in this._gpuText){let t=this._gpuText[e];if(!t)continue;let r=t.batchableSprite.renderable;r._autoResolution&&(r._resolution=this._renderer.resolution,r.onViewUpdate())}}validateRenderable(e){let t=this._getGpuText(e),r=e._getKey();return t.textureNeedsUploading?(t.textureNeedsUploading=!1,!0):t.currentKey!==r}addRenderable(e,t){let r=this._getGpuText(e).batchableSprite;e._didTextUpdate&&this._updateText(e),this._renderer.renderPipes.batch.addToBatch(r,t)}updateRenderable(e){let t=this._getGpuText(e).batchableSprite;e._didTextUpdate&&this._updateText(e),t._batcher.updateElement(t)}destroyRenderable(e){e.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(e.uid)}_destroyRenderableById(e){let t=this._gpuText[e];this._renderer.htmlText.decreaseReferenceCount(t.currentKey),He.return(t.batchableSprite),this._gpuText[e]=null}_updateText(e){let t=e._getKey(),r=this._getGpuText(e),i=r.batchableSprite;r.currentKey!==t&&this._updateGpuText(e).catch(s=>{console.error(s)}),e._didTextUpdate=!1;let n=e._style.padding;Qs(i.bounds,e._anchor,i.texture,n)}async _updateGpuText(e){e._didTextUpdate=!1;let t=this._getGpuText(e);if(t.generatingTexture)return;let r=e._getKey();this._renderer.htmlText.decreaseReferenceCount(t.currentKey),t.generatingTexture=!0,t.currentKey=r;let i=e.resolution??this._renderer.resolution,n=await this._renderer.htmlText.getManagedTexture(e.text,i,e._style,e._getKey()),s=t.batchableSprite;s.texture=t.texture=n,t.generatingTexture=!1,t.textureNeedsUploading=!0,e.onViewUpdate();let a=e._style.padding;Qs(s.bounds,e._anchor,s.texture,a)}_getGpuText(e){return this._gpuText[e.uid]||this.initGpuText(e)}initGpuText(e){let t={texture:Ie.EMPTY,currentKey:"--",batchableSprite:He.get(rs),textureNeedsUploading:!1,generatingTexture:!1},r=t.batchableSprite;return r.renderable=e,r.transform=e.groupTransform,r.texture=Ie.EMPTY,r.bounds={minX:0,maxX:1,minY:0,maxY:0},r.roundPixels=this._renderer._roundPixels|e._roundPixels,e._resolution=e._autoResolution?this._renderer.resolution:e.resolution,this._gpuText[e.uid]=t,e.on("destroyed",this._destroyRenderableBound),t}destroy(){for(let e in this._gpuText)this._destroyRenderableById(e);this._gpuText=null,this._renderer=null}},wh.extension={type:[I.WebGLPipes,I.WebGPUPipes,I.CanvasPipes],name:"htmlText"}});function d0(){let{userAgent:e}=yt.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(e)}var f0=_(()=>{Ht()}),Th,Sh,Eh,Yp=_(()=>{"use strict";Th="http://www.w3.org/2000/svg",Sh="http://www.w3.org/1999/xhtml",Eh=class{constructor(){this.svgRoot=document.createElementNS(Th,"svg"),this.foreignObject=document.createElementNS(Th,"foreignObject"),this.domElement=document.createElementNS(Sh,"div"),this.styleElement=document.createElementNS(Sh,"style"),this.image=new Image;let{foreignObject:e,svgRoot:t,styleElement:r,domElement:i}=this;e.setAttribute("width","10000"),e.setAttribute("height","10000"),e.style.overflow="hidden",t.appendChild(e),e.appendChild(r),e.appendChild(i)}}});function p0(e){let t=e._stroke,r=e._fill,i=[`div { ${[`color: ${Ce.shared.setValue(r.color).toHex()}`,`font-size: ${e.fontSize}px`,`font-family: ${e.fontFamily}`,`font-weight: ${e.fontWeight}`,`font-style: ${e.fontStyle}`,`font-variant: ${e.fontVariant}`,`letter-spacing: ${e.letterSpacing}px`,`text-align: ${e.align}`,`padding: ${e.padding}px`,`white-space: ${e.whiteSpace==="pre"&&e.wordWrap?"pre-wrap":e.whiteSpace}`,...e.lineHeight?[`line-height: ${e.lineHeight}px`]:[],...e.wordWrap?[`word-wrap: ${e.breakWords?"break-all":"break-word"}`,`max-width: ${e.wordWrapWidth}px`]:[],...t?[Kp(t)]:[],...e.dropShadow?[qp(e.dropShadow)]:[],...e.cssOverrides].join(";")} }`];return g0(e.tagStyles,i),i.join(" ")}function qp(e){let t=Ce.shared.setValue(e.color).setAlpha(e.alpha).toHexa(),r=Math.round(Math.cos(e.angle)*e.distance),i=Math.round(Math.sin(e.angle)*e.distance),n=`${r}px ${i}px`;return e.blur>0?`text-shadow: ${n} ${e.blur}px ${t}`:`text-shadow: ${n} ${t}`}function Kp(e){return[`-webkit-text-stroke-width: ${e.width}px`,`-webkit-text-stroke-color: ${Ce.shared.setValue(e.color).toHex()}`,`text-stroke-width: ${e.width}px`,`text-stroke-color: ${Ce.shared.setValue(e.color).toHex()}`,"paint-order: stroke"].join(";")}function g0(e,t){for(let r in e){let i=e[r],n=[];for(let s in i)Ah[s]?n.push(Ah[s](i[s])):Ch[s]&&n.push(Ch[s].replace("{{VALUE}}",i[s]));t.push(`${r} { ${n.join(";")} }`)}}var Ch,Ah,m0=_(()=>{Ne(),Ch={fontSize:"font-size: {{VALUE}}px",fontFamily:"font-family: {{VALUE}}",fontWeight:"font-weight: {{VALUE}}",fontStyle:"font-style: {{VALUE}}",fontVariant:"font-variant: {{VALUE}}",letterSpacing:"letter-spacing: {{VALUE}}px",align:"text-align: {{VALUE}}",padding:"padding: {{VALUE}}px",whiteSpace:"white-space: {{VALUE}}",lineHeight:"line-height: {{VALUE}}px",wordWrapWidth:"max-width: {{VALUE}}px"},Ah={fill:e=>`color: ${Ce.shared.setValue(e).toHex()}`,breakWords:e=>`word-wrap: ${e?"break-all":"break-word"}`,stroke:Kp,dropShadow:qp}}),Zp,_0=_(()=>{Fe(),hs(),Cp(),m0(),Zp=class Fv extends Xr{constructor(t={}){super(t),this._cssOverrides=[],this.cssOverrides??(this.cssOverrides=t.cssOverrides),this.tagStyles=t.tagStyles??{}}set cssOverrides(t){this._cssOverrides=t instanceof Array?t:[t],this.update()}get cssOverrides(){return this._cssOverrides}_generateKey(){return this._styleKey=Sp(this)+this._cssOverrides.join("-"),this._styleKey}update(){this._cssStyle=null,super.update()}clone(){return new Fv({align:this.align,breakWords:this.breakWords,dropShadow:this.dropShadow?{...this.dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,cssOverrides:this.cssOverrides})}get cssStyle(){return this._cssStyle||(this._cssStyle=p0(this)),this._cssStyle}addOverride(...t){let r=t.filter(i=>!this.cssOverrides.includes(i));r.length>0&&(this.cssOverrides.push(...r),this.update())}removeOverride(...t){let r=t.filter(i=>this.cssOverrides.includes(i));r.length>0&&(this.cssOverrides=this.cssOverrides.filter(i=>!r.includes(i)),this.update())}set fill(t){typeof t!="string"&&typeof t!="number"&&ge("[HTMLTextStyle] only color fill is not supported by HTMLText"),super.fill=t}set stroke(t){t&&typeof t!="string"&&typeof t!="number"&&ge("[HTMLTextStyle] only color stroke is not supported by HTMLText"),super.stroke=t}}});function v0(e,t){let r=t.fontFamily,i=[],n={},s=/font-family:([^;"\s]+)/g,a=e.match(s);function o(l){n[l]||(i.push(l),n[l]=!0)}if(Array.isArray(r))for(let l=0;l{let h=l.split(":")[1].trim();o(h)});for(let l in t.tagStyles){let h=t.tagStyles[l].fontFamily;o(h)}return i}var y0=_(()=>{"use strict"});async function x0(e){let t=await(await yt.get().fetch(e)).blob(),r=new FileReader;return await new Promise((i,n)=>{r.onloadend=()=>i(r.result),r.onerror=n,r.readAsDataURL(t)})}var b0=_(()=>{Ht()});async function Qp(e,t){let r=await x0(t);return`@font-face { font-family: "${e.fontFamily}"; src: url('${r}'); font-weight: ${e.fontWeight}; font-style: ${e.fontStyle}; }`}var w0=_(()=>{b0()});async function T0(e,t,r){let i=e.filter(n=>Zt.has(`${n}-and-url`)).map((n,s)=>{if(!cs.has(n)){let{url:a}=Zt.get(`${n}-and-url`);s===0?cs.set(n,Qp({fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:n},a)):cs.set(n,Qp({fontWeight:r.fontWeight,fontStyle:r.fontStyle,fontFamily:n},a))}return cs.get(n)});return(await Promise.all(i)).join(` `)}var cs,S0=_(()=>{ta(),w0(),cs=new Map});function E0(e,t,r,i,n){let{domElement:s,styleElement:a,svgRoot:o}=n;s.innerHTML=`
    ${e}
    `,s.setAttribute("style",`transform: scale(${r});transform-origin: top left; display: inline-block`),a.textContent=i;let{width:l,height:h}=n.image;return o.setAttribute("width",l.toString()),o.setAttribute("height",h.toString()),new XMLSerializer().serializeToString(o)}var C0=_(()=>{"use strict"});function A0(e,t){let r=$r.getOptimalCanvasAndContext(e.width,e.height,t),{context:i}=r;return i.clearRect(0,0,e.width,e.height),i.drawImage(e,0,0),r}var M0=_(()=>{is()});function P0(e,t,r){return new Promise(async i=>{r&&await new Promise(n=>setTimeout(n,100)),e.onload=()=>{i()},e.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(t)}`,e.crossOrigin="anonymous"})}var R0=_(()=>{"use strict"});function k0(e,t,r,i){i||(i=Jp||(Jp=new Eh));let{domElement:n,styleElement:s,svgRoot:a}=i;n.innerHTML=`
    ${e}
    `,n.setAttribute("style","transform-origin: top left; display: inline-block"),r&&(s.textContent=r),document.body.appendChild(a);let o=n.getBoundingClientRect();a.remove();let l=t.padding*2;return{width:o.width-l,height:o.height-l}}var Jp,B0=_(()=>{Yp()}),Wa,I0=_(()=>{re(),is(),Oi(),li(),f0(),Fe(),Ot(),Pp(),Yp(),_0(),y0(),S0(),C0(),M0(),R0(),B0(),Wa=class{constructor(e){this._activeTextures={},this._renderer=e,this._createCanvas=e.type===Sr.WEBGPU}getTexture(e){return this._buildTexturePromise(e.text,e.resolution,e.style)}getManagedTexture(e,t,r,i){if(this._activeTextures[i])return this._increaseReferenceCount(i),this._activeTextures[i].promise;let n=this._buildTexturePromise(e,t,r).then(s=>(this._activeTextures[i].texture=s,s));return this._activeTextures[i]={texture:null,promise:n,usageCount:1},n}async _buildTexturePromise(e,t,r){let i=He.get(Eh),n=v0(e,r),s=await T0(n,r,Zp.defaultTextStyle),a=k0(e,r,s,i),o=Math.ceil(Math.ceil(Math.max(1,a.width)+r.padding*2)*t),l=Math.ceil(Math.ceil(Math.max(1,a.height)+r.padding*2)*t),h=i.image,u=2;h.width=(o|0)+u,h.height=(l|0)+u;let c=E0(e,r,t,s,i);await P0(h,c,d0()&&n.length>0);let f=h,d;this._createCanvas&&(d=A0(h,t));let y=Ap(d?d.canvas:f,h.width-u,h.height-u,t);return this._createCanvas&&(this._renderer.texture.initSource(y.source),$r.returnCanvasAndContext(d)),He.return(i),y}_increaseReferenceCount(e){this._activeTextures[e].usageCount++}decreaseReferenceCount(e){let t=this._activeTextures[e];t&&(t.usageCount--,t.usageCount===0&&(t.texture?this._cleanUp(t):t.promise.then(r=>{t.texture=r,this._cleanUp(t)}).catch(()=>{ge("HTMLTextSystem: Failed to clean texture")}),this._activeTextures[e]=null))}_cleanUp(e){Kt.returnTexture(e.texture),e.texture.source.resource=null,e.texture.source.uploadMethodId="unknown"}getReferenceCount(e){return this._activeTextures[e].usageCount}destroy(){this._activeTextures=null}},Wa.extension={type:[I.WebGLSystem,I.WebGPUSystem,I.CanvasSystem],name:"htmlText"},Wa.defaultFontOptions={fontFamily:"Arial",fontStyle:"normal",fontWeight:"normal"}}),eg=_(()=>{re(),c0(),I0(),fe.add(Wa),fe.add(wh)}),Mh,ja,Ph=_(()=>{zi(),Si(),Yn(),dt(),Mh=class Lv extends gn{constructor(...t){let r=t[0]??{};r instanceof Float32Array&&(We(Qe,"use new MeshGeometry({ positions, uvs, indices }) instead"),r={positions:r,uvs:t[1],indices:t[2]}),r={...Lv.defaultOptions,...r};let i=r.positions||new Float32Array([0,0,1,0,1,1,0,1]),n=r.uvs||new Float32Array([0,0,1,0,1,1,0,1]),s=r.indices||new Uint32Array([0,1,2,0,2,3]),a=r.shrinkBuffersToFit,o=new cr({data:i,label:"attribute-mesh-positions",shrinkToFit:a,usage:Je.VERTEX|Je.COPY_DST}),l=new cr({data:n,label:"attribute-mesh-uvs",shrinkToFit:a,usage:Je.VERTEX|Je.COPY_DST}),h=new cr({data:s,label:"index-mesh-buffer",shrinkToFit:a,usage:Je.INDEX|Je.COPY_DST});super({attributes:{aPosition:{buffer:o,format:"float32x2",stride:2*4,offset:0},aUV:{buffer:l,format:"float32x2",stride:2*4,offset:0}},indexBuffer:h,topology:r.topology}),this.batchMode="auto"}get positions(){return this.attributes.aPosition.buffer.data}set positions(t){this.attributes.aPosition.buffer.data=t}get uvs(){return this.attributes.aUV.buffer.data}set uvs(t){this.attributes.aUV.buffer.data=t}get indices(){return this.indexBuffer.data}set indices(t){this.indexBuffer.data=t}},Mh.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:!1},ja=Mh}),En,tg,$a,ds=_(()=>{"use strict";En={name:"local-uniform-bit",vertex:{header:` struct LocalUniforms { uTransformMatrix:mat3x3, uColor:vec4, uRound:f32, } @group(1) @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); } `}},tg={...En,vertex:{...En.vertex,header:En.vertex.header.replace("group(1)","group(2)")}},$a={name:"local-uniform-bit",vertex:{header:` uniform mat3 uTransformMatrix; uniform vec4 uColor; uniform float uRound; `,main:` vColor *= uColor; modelMatrix = uTransformMatrix; `,end:` if(uRound == 1.) { gl_Position.xy = roundPixels(gl_Position.xy, uResolution); } `}}}),rg,ig,G0=_(()=>{"use strict";rg={name:"tiling-bit",vertex:{header:` struct TilingUniforms { uMapCoord:mat3x3, uClampFrame:vec4, uClampOffset:vec2, uTextureTransform:mat3x3, uSizeAnchor:vec4 }; @group(2) @binding(0) var tilingUniforms: TilingUniforms; @group(2) @binding(1) var uTexture: texture_2d; @group(2) @binding(2) var uSampler: sampler; `,main:` uv = (tilingUniforms.uTextureTransform * vec3(uv, 1.0)).xy; position = (position - tilingUniforms.uSizeAnchor.zw) * tilingUniforms.uSizeAnchor.xy; `},fragment:{header:` struct TilingUniforms { uMapCoord:mat3x3, uClampFrame:vec4, uClampOffset:vec2, uTextureTransform:mat3x3, uSizeAnchor:vec4 }; @group(2) @binding(0) var tilingUniforms: TilingUniforms; @group(2) @binding(1) var uTexture: texture_2d; @group(2) @binding(2) var uSampler: sampler; `,main:` var coord = vUV + ceil(tilingUniforms.uClampOffset - vUV); coord = (tilingUniforms.uMapCoord * vec3(coord, 1.0)).xy; var unclamped = coord; coord = clamp(coord, tilingUniforms.uClampFrame.xy, tilingUniforms.uClampFrame.zw); var bias = 0.; if(unclamped.x == coord.x && unclamped.y == coord.y) { bias = -32.; } outColor = textureSampleBias(uTexture, uSampler, coord, bias); `}},ig={name:"tiling-bit",vertex:{header:` uniform mat3 uTextureTransform; uniform vec4 uSizeAnchor; `,main:` uv = (uTextureTransform * vec3(aUV, 1.0)).xy; position = (position - uSizeAnchor.zw) * uSizeAnchor.xy; `},fragment:{header:` uniform sampler2D uTexture; uniform mat3 uMapCoord; uniform vec4 uClampFrame; uniform vec2 uClampOffset; `,main:` vec2 coord = vUV + ceil(uClampOffset - vUV); coord = (uMapCoord * vec3(coord, 1.0)).xy; vec2 unclamped = coord; coord = clamp(coord, uClampFrame.xy, uClampFrame.zw); outColor = texture(uTexture, coord, unclamped == coord ? 0.0 : -32.0);// lod-bias very negative to force lod 0 `}}}),Rh,kh,ng,O0=_(()=>{Ze(),Wi(),ds(),ji(),Wr(),dr(),mt(),G0(),ng=class extends Rr{constructor(){Rh??(Rh=Zn({name:"tiling-sprite-shader",bits:[En,rg,xn]})),kh??(kh=Qn({name:"tiling-sprite-shader",bits:[$a,ig,bn]}));let e=new Jt({uMapCoord:{value:new _e,type:"mat3x3"},uClampFrame:{value:new Float32Array([0,0,1,1]),type:"vec4"},uClampOffset:{value:new Float32Array([0,0]),type:"vec2"},uTextureTransform:{value:new _e,type:"mat3x3"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4"}});super({glProgram:kh,gpuProgram:Rh,resources:{localUniforms:new Jt({uTransformMatrix:{value:new _e,type:"mat3x3"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uRound:{value:0,type:"f32"}}),tilingUniforms:e,uTexture:Ie.EMPTY.source,uSampler:Ie.EMPTY.source.style}})}updateUniforms(e,t,r,i,n,s){let a=this.resources.tilingUniforms,o=s.width,l=s.height,h=s.textureMatrix,u=a.uniforms.uTextureTransform;u.set(r.a*o/e,r.b*o/t,r.c*l/e,r.d*l/t,r.tx/e,r.ty/t),u.invert(),a.uniforms.uMapCoord=h.mapCoord,a.uniforms.uClampFrame=h.uClampFrame,a.uniforms.uClampOffset=h.uClampOffset,a.uniforms.uTextureTransform=u,a.uniforms.uSizeAnchor[0]=e,a.uniforms.uSizeAnchor[1]=t,a.uniforms.uSizeAnchor[2]=i,a.uniforms.uSizeAnchor[3]=n,s&&(this.resources.uTexture=s.source,this.resources.uSampler=s.source.style)}}}),sg,D0=_(()=>{Ph(),sg=class extends ja{constructor(){super({positions:new Float32Array([0,0,1,0,1,1,0,1]),uvs:new Float32Array([0,0,1,0,1,1,0,1]),indices:new Uint32Array([0,1,2,0,2,3])})}}});function U0(e,t){let r=e.anchor.x,i=e.anchor.y;t[0]=-r*e.width,t[1]=-i*e.height,t[2]=(1-r)*e.width,t[3]=-i*e.height,t[4]=(1-r)*e.width,t[5]=(1-i)*e.height,t[6]=-r*e.width,t[7]=(1-i)*e.height}var F0=_(()=>{"use strict"});function L0(e,t,r,i){let n=0,s=e.length/(t||2),a=i.a,o=i.b,l=i.c,h=i.d,u=i.tx,c=i.ty;for(r*=t;n{"use strict"});function H0(e,t){let r=e.texture,i=r.frame.width,n=r.frame.height,s=0,a=0;e.applyAnchorToTexture&&(s=e.anchor.x,a=e.anchor.y),t[0]=t[6]=-s,t[2]=t[4]=1-s,t[1]=t[3]=-a,t[5]=t[7]=1-a;let o=_e.shared;o.copyFrom(e._tileTransform.matrix),o.tx/=e.width,o.ty/=e.height,o.invert(),o.scale(e.width/i,e.height/n),L0(t,2,0,o)}var z0=_(()=>{Ze(),N0()}),fs,Bh,V0=_(()=>{re(),sa(),jr(),li(),ts(),Kl(),Ph(),O0(),D0(),F0(),z0(),fs=new sg,Bh=class{constructor(e){this._state=Er.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_tilingSpriteDataHash")}validateRenderable(e){let t=this._getTilingSpriteData(e),r=t.canBatch;this._updateCanBatch(e);let i=t.canBatch;if(i&&i===r){let{batchableMesh:n}=t;return!n._batcher.checkAndUpdateTexture(n,e.texture)}return r!==i}addRenderable(e,t){let r=this._renderer.renderPipes.batch;this._updateCanBatch(e);let i=this._getTilingSpriteData(e),{geometry:n,canBatch:s}=i;if(s){i.batchableMesh||(i.batchableMesh=new ka);let a=i.batchableMesh;e.didViewUpdate&&(this._updateBatchableMesh(e),a.geometry=n,a.renderable=e,a.transform=e.groupTransform,a.texture=e._texture),a.roundPixels=this._renderer._roundPixels|e._roundPixels,r.addToBatch(a,t)}else r.break(t),i.shader||(i.shader=new ng),this.updateRenderable(e),t.add(e)}execute(e){let{shader:t}=this._tilingSpriteDataHash[e.uid];t.groups[0]=this._renderer.globalUniforms.bindGroup;let r=t.resources.localUniforms.uniforms;r.uTransformMatrix=e.groupTransform,r.uRound=this._renderer._roundPixels|e._roundPixels,es(e.groupColorAlpha,r.uColor,0),this._state.blendMode=Xn(e.groupBlendMode,e.texture._source),this._renderer.encoder.draw({geometry:fs,shader:t,state:this._state})}updateRenderable(e){let t=this._getTilingSpriteData(e),{canBatch:r}=t;if(r){let{batchableMesh:i}=t;e.didViewUpdate&&this._updateBatchableMesh(e),i._batcher.updateElement(i)}else if(e.didViewUpdate){let{shader:i}=t;i.updateUniforms(e.width,e.height,e._tileTransform.matrix,e.anchor.x,e.anchor.y,e.texture)}}destroyRenderable(e){let t=this._getTilingSpriteData(e);t.batchableMesh=null,t.shader?.destroy(),this._tilingSpriteDataHash[e.uid]=null,e.off("destroyed",this._destroyRenderableBound)}_getTilingSpriteData(e){return this._tilingSpriteDataHash[e.uid]||this._initTilingSpriteData(e)}_initTilingSpriteData(e){let t=new ja({indices:fs.indices,positions:fs.positions.slice(),uvs:fs.uvs.slice()});return this._tilingSpriteDataHash[e.uid]={canBatch:!0,renderable:e,geometry:t},e.on("destroyed",this._destroyRenderableBound),this._tilingSpriteDataHash[e.uid]}_updateBatchableMesh(e){let t=this._getTilingSpriteData(e),{geometry:r}=t,i=e.texture.source.style;i.addressMode!=="repeat"&&(i.addressMode="repeat",i.update()),H0(e,r.uvs),U0(e,r.positions)}destroy(){for(let e in this._tilingSpriteDataHash)this.destroyRenderable(this._tilingSpriteDataHash[e].renderable);this._tilingSpriteDataHash=null,this._renderer=null}_updateCanBatch(e){let t=this._getTilingSpriteData(e),r=e.texture,i=!0;return this._renderer.type===Sr.WEBGL&&(i=this._renderer.context.supports.nonPowOf2wrapping),t.canBatch=r.textureMatrix.isSimple&&(i||r.source.isPowerOfTwo),t.canBatch}},Bh.extension={type:[I.WebGLPipes,I.WebGPUPipes,I.CanvasPipes],name:"tilingSprite"}}),ag=_(()=>{re(),V0(),fe.add(Bh)}),Ih,og,W0=_(()=>{dt(),Ph(),Ih=class Nv extends ja{constructor(...t){super({});let r=t[0]??{};typeof r=="number"&&(We(Qe,"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"),r={width:r,height:t[1],verticesX:t[2],verticesY:t[3]}),this.build(r)}build(t){t={...Nv.defaultOptions,...t},this.verticesX=this.verticesX??t.verticesX,this.verticesY=this.verticesY??t.verticesY,this.width=this.width??t.width,this.height=this.height??t.height;let r=this.verticesX*this.verticesY,i=[],n=[],s=[],a=this.verticesX-1,o=this.verticesY-1,l=this.width/a,h=this.height/o;for(let c=0;c{W0(),Gh=class Hv extends og{constructor(t={}){t={...Hv.defaultOptions,...t},super({width:t.width,height:t.height,verticesX:4,verticesY:4}),this.update(t)}update(t){this.width=t.width??this.width,this.height=t.height??this.height,this._originalWidth=t.originalWidth??this._originalWidth,this._originalHeight=t.originalHeight??this._originalHeight,this._leftWidth=t.leftWidth??this._leftWidth,this._rightWidth=t.rightWidth??this._rightWidth,this._topHeight=t.topHeight??this._topHeight,this._bottomHeight=t.bottomHeight??this._bottomHeight,this.updateUvs(),this.updatePositions()}updatePositions(){let t=this.positions,r=this._leftWidth+this._rightWidth,i=this.width>r?1:this.width/r,n=this._topHeight+this._bottomHeight,s=this.height>n?1:this.height/n,a=Math.min(i,s);t[9]=t[11]=t[13]=t[15]=this._topHeight*a,t[17]=t[19]=t[21]=t[23]=this.height-this._bottomHeight*a,t[25]=t[27]=t[29]=t[31]=this.height,t[2]=t[10]=t[18]=t[26]=this._leftWidth*a,t[4]=t[12]=t[20]=t[28]=this.width-this._rightWidth*a,t[6]=t[14]=t[22]=t[30]=this.width,this.getBuffer("aPosition").update()}updateUvs(){let t=this.uvs;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1;let r=1/this._originalWidth,i=1/this._originalHeight;t[2]=t[10]=t[18]=t[26]=r*this._leftWidth,t[9]=t[11]=t[13]=t[15]=i*this._topHeight,t[4]=t[12]=t[20]=t[28]=1-r*this._rightWidth,t[17]=t[19]=t[21]=t[23]=1-i*this._bottomHeight,this.getBuffer("aUV").update()}},Gh.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100},lg=Gh}),Oh,$0=_(()=>{re(),Ot(),Kl(),j0(),Oh=class{constructor(e){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(e,t){let r=this._getGpuSprite(e);e.didViewUpdate&&this._updateBatchableSprite(e,r),this._renderer.renderPipes.batch.addToBatch(r,t)}updateRenderable(e){let t=this._gpuSpriteHash[e.uid];e.didViewUpdate&&this._updateBatchableSprite(e,t),t._batcher.updateElement(t)}validateRenderable(e){let t=this._getGpuSprite(e);return!t._batcher.checkAndUpdateTexture(t,e._texture)}destroyRenderable(e){let t=this._gpuSpriteHash[e.uid];He.return(t.geometry),He.return(t),this._gpuSpriteHash[e.uid]=null,e.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(e,t){t.geometry.update(e),t.texture=e._texture}_getGpuSprite(e){return this._gpuSpriteHash[e.uid]||this._initGPUSprite(e)}_initGPUSprite(e){let t=He.get(ka);return t.geometry=He.get(lg),t.renderable=e,t.transform=e.groupTransform,t.texture=e._texture,t.roundPixels=this._renderer._roundPixels|e._roundPixels,this._gpuSpriteHash[e.uid]=t,e.didViewUpdate||this._updateBatchableSprite(e,t),e.on("destroyed",this._destroyRenderableBound),t}destroy(){for(let e in this._gpuSpriteHash)this._gpuSpriteHash[e].geometry.destroy();this._gpuSpriteHash=null,this._renderer=null}},Oh.extension={type:[I.WebGLPipes,I.WebGPUPipes,I.CanvasPipes],name:"nineSliceSprite"}}),hg=_(()=>{re(),$0(),fe.add(Oh)}),Dh,X0=_(()=>{re(),Dh=class{constructor(e){this._renderer=e}push(e,t,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:t,filterEffect:e})}pop(e,t,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}execute(e){e.action==="pushFilter"?this._renderer.filter.push(e):e.action==="popFilter"&&this._renderer.filter.pop()}destroy(){this._renderer=null}},Dh.extension={type:[I.WebGLPipes,I.WebGPUPipes,I.CanvasPipes],name:"filter"}});function Y0(e,t){t.clear(),ug(e,t),t.isValid||t.set(0,0,0,0);let r=e.renderGroup||e.parentRenderGroup;return t.applyMatrix(r.worldTransform),t}function ug(e,t){if(e.localDisplayStatus!==7||!e.measurable)return;let r=!!e.effects.length,i=t;if((e.renderGroup||r)&&(i=C.get().clear()),e.boundsArea)t.addRect(e.boundsArea,e.worldTransform);else{if(e.renderPipeId){let s=e.bounds;i.addFrame(s.minX,s.minY,s.maxX,s.maxY,e.groupTransform)}let n=e.children;for(let s=0;s{Ze(),k(),cg=new _e});function K0(e,t){t.clear();let r=t.matrix;for(let i=0;i{"use strict"}),dg,Uh,Q0=_(()=>{re(),Ze(),wt(),Li(),Yn(),dr(),mt(),Oi(),li(),T(),q0(),Z0(),Fe(),dg=new gn({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:"float32x2",stride:2*4,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])}),Uh=class{constructor(e){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new Jt({uInputSize:{value:new Float32Array(4),type:"vec4"},uInputPixel:{value:new Float32Array(4),type:"vec4"},uInputClamp:{value:new Float32Array(4),type:"vec4"},uOutputFrame:{value:new Float32Array(4),type:"vec4"},uGlobalFrame:{value:new Float32Array(4),type:"vec4"},uOutputTexture:{value:new Float32Array(4),type:"vec4"}}),this._globalFilterBindGroup=new Vr({}),this.renderer=e}get activeBackTexture(){return this._activeFilterData?.backTexture}push(e){let t=this.renderer,r=e.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());let i=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,r.length===0){i.skip=!0;return}let n=i.bounds;if(e.renderables?K0(e.renderables,n):e.filterEffect.filterArea?(n.clear(),n.addRect(e.filterEffect.filterArea),n.applyMatrix(e.container.worldTransform)):Y0(e.container,n),e.container){let f=(e.container.renderGroup||e.container.parentRenderGroup).cacheToLocalTransform;f&&n.applyMatrix(f)}let s=t.renderTarget.renderTarget.colorTexture.source,a=1/0,o=0,l=!0,h=!1,u=!1,c=!0;for(let f=0;f0?this._filterStack[this._filterStackIndex-1].bounds:null,o=e.renderTarget.getRenderTarget(t.previousRenderSurface);n=this.getBackTexture(o,i,a)}t.backTexture=n;let s=t.filterEffect.filters;if(this._globalFilterBindGroup.setResource(r.source.style,2),this._globalFilterBindGroup.setResource(n.source,3),e.globalUniforms.pop(),s.length===1)s[0].apply(this,r,t.previousRenderSurface,!1),Kt.returnTexture(r);else{let a=t.inputTexture,o=Kt.getOptimalTexture(i.width,i.height,a.source._resolution,!1),l=0;for(l=0;l0&&this._filterStack[u].skip;)--u;u>0&&(h=this._filterStack[u].inputTexture.source._resolution);let c=this._filterGlobalUniforms,f=c.uniforms,d=f.uOutputFrame,y=f.uInputSize,x=f.uInputPixel,v=f.uInputClamp,w=f.uGlobalFrame,M=f.uOutputTexture;if(l){let U=this._filterStackIndex;for(;U>0;){U--;let F=this._filterStack[this._filterStackIndex-1];if(!F.skip){o.x=F.bounds.minX,o.y=F.bounds.minY;break}}d[0]=a.minX-o.x,d[1]=a.minY-o.y}else d[0]=0,d[1]=0;d[2]=t.frame.width,d[3]=t.frame.height,y[0]=t.source.width,y[1]=t.source.height,y[2]=1/y[0],y[3]=1/y[1],x[0]=t.source.pixelWidth,x[1]=t.source.pixelHeight,x[2]=1/x[0],x[3]=1/x[1],v[0]=.5*x[2],v[1]=.5*x[3],v[2]=t.frame.width*y[2]-.5*x[2],v[3]=t.frame.height*y[3]-.5*x[3];let O=this.renderer.renderTarget.rootRenderTarget.colorTexture;w[0]=o.x*h,w[1]=o.y*h,w[2]=O.source.width*h,w[3]=O.source.height*h;let P=this.renderer.renderTarget.getRenderTarget(r);if(n.renderTarget.bind(r,!!i),r instanceof Ie?(M[0]=r.frame.width,M[1]=r.frame.height):(M[0]=P.width,M[1]=P.height),M[2]=P.isRoot?-1:1,c.update(),n.renderPipes.uniformBatch){let U=n.renderPipes.uniformBatch.getUboResource(c);this._globalFilterBindGroup.setResource(U,0)}else this._globalFilterBindGroup.setResource(c,0);this._globalFilterBindGroup.setResource(t.source,1),this._globalFilterBindGroup.setResource(t.source.style,2),e.groups[0]=this._globalFilterBindGroup,n.encoder.draw({geometry:dg,shader:e,state:e._state,topology:"triangle-list"}),n.type===Sr.WEBGL&&n.renderTarget.finishRenderPass()}_getFilterData(){return{skip:!1,inputTexture:null,bounds:new m,container:null,filterEffect:null,blendRequired:!1,previousRenderSurface:null}}calculateSpriteMatrix(e,t){let r=this._activeFilterData,i=e.set(r.inputTexture._source.width,0,0,r.inputTexture._source.height,r.bounds.minX,r.bounds.minY),n=t.worldTransform.copyTo(_e.shared),s=t.renderGroup||t.parentRenderGroup;return s&&s.cacheToLocalTransform&&n.prepend(s.cacheToLocalTransform),n.invert(),i.prepend(n),i.scale(1/t.texture.frame.width,1/t.texture.frame.height),i.translate(t.anchor.x,t.anchor.y),i}},Uh.extension={type:[I.WebGLSystem,I.WebGPUSystem],name:"filter"}}),fg=_(()=>{re(),X0(),Q0(),fe.add(Uh),fe.add(Dh)}),J0={},e1=_(()=>{py(),nd(),xy(),xl(),Ml(),Uf(),Ff(),Yf(),Bp(),Xp(),eg(),ag(),hg(),fg()}),t1={},r1=_(()=>{nd(),xl(),Ml(),Uf(),Ff(),Yf(),Bp(),Xp(),eg(),ag(),hg(),fg()}),Fh,pg,i1=_(()=>{mn(),Kn(),Wr(),jr(),Fh=class Oc extends Rr{constructor(t){t={...Oc.defaultOptions,...t},super(t),this.enabled=!0,this._state=Er.for2d(),this.blendMode=t.blendMode,this.padding=t.padding,typeof t.antialias=="boolean"?this.antialias=t.antialias?"on":"off":this.antialias=t.antialias,this.resolution=t.resolution,this.blendRequired=t.blendRequired,this.clipToViewport=t.clipToViewport,this.addResource("uTexture",0,1)}apply(t,r,i,n){t.applyFilter(this,r,i,n)}get blendMode(){return this._state.blendMode}set blendMode(t){this._state.blendMode=t}static from(t){let{gpu:r,gl:i,...n}=t,s,a;return r&&(s=yn.from(r)),i&&(a=Vi.from(i)),new Oc({gpuProgram:s,glProgram:a,...n})}},Fh.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0},pg=Fh});async function n1(e){if(!e)for(let t=0;t{re(),Xa=[],fe.handleByNamedList(I.Environment,Xa)});function gg(){if(typeof ps=="boolean")return ps;try{ps=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{ps=!1}return ps}var ps,mg=_(()=>{"use strict"}),fr,gs=_(()=>{"use strict";fr=(e=>(e[e.NONE=0]="NONE",e[e.COLOR=16384]="COLOR",e[e.STENCIL=1024]="STENCIL",e[e.DEPTH=256]="DEPTH",e[e.COLOR_DEPTH=16640]="COLOR_DEPTH",e[e.COLOR_STENCIL=17408]="COLOR_STENCIL",e[e.DEPTH_STENCIL=1280]="DEPTH_STENCIL",e[e.ALL=17664]="ALL",e))(fr||{})}),Lh,_g=_(()=>{"use strict";Lh=class{constructor(e){this.items=[],this._name=e}emit(e,t,r,i,n,s,a,o){let{name:l,items:h}=this;for(let u=0,c=h.length;u{Ne(),s1(),Hr(),mg(),dt(),gs(),_g(),xt(),vg=["init","destroy","contextChange","resolutionChange","reset","renderEnd","renderStart","render","update","postrender","prerender"],Nh=class zv extends et{constructor(t){super(),this.runners=Object.create(null),this.renderPipes=Object.create(null),this._initOptions={},this._systemsHash=Object.create(null),this.type=t.type,this.name=t.name,this.config=t;let r=[...vg,...this.config.runners??[]];this._addRunners(...r),this._unsafeEvalCheck()}async init(t={}){let r=t.skipExtensionImports===!0?!0:t.manageImports===!1;await n1(r),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(let i in this._systemsHash)t={...this._systemsHash[i].constructor.defaultOptions,...t};t={...zv.defaultOptions,...t},this._roundPixels=t.roundPixels?1:0;for(let i=0;i{this.runners[r]=new Lh(r)})}_addSystems(t){let r;for(r in t){let i=t[r];this._addSystem(i.value,i.name)}}_addSystem(t,r){let i=new t(this);if(this[r])throw new Error(`Whoops! The name "${r}" is already in use`);this[r]=i,this._systemsHash[r]=i;for(let n in this.runners)this.runners[n].add(i);return this}_addPipes(t,r){let i=r.reduce((n,s)=>(n[s.name]=s.value,n),{});t.forEach(n=>{let s=n.value,a=n.name,o=i[a];this.renderPipes[a]=new s(this,o?new o:null)})}destroy(t=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(t),Object.values(this.runners).forEach(r=>{r.destroy()}),this._systemsHash=null,this.renderPipes=null}generateTexture(t){return this.textureGenerator.generateTexture(t)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!gg())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}},Nh.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1},ms=Nh}),Hh,a1=_(()=>{re(),Ze(),dn(),kl(),Wi(),ma(),ya(),ds(),ji(),Wr(),dr(),Hh=class{init(){let e=new Jt({uTransformMatrix:{value:new _e,type:"mat3x3"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uRound:{value:0,type:"f32"}}),t=Zn({name:"graphics",bits:[pa,Ll(cn()),tg,xn]});this.shader=new Rr({gpuProgram:t,resources:{localUniforms:e}})}execute(e,t){let r=t.context,i=r.customShader||this.shader,n=e.renderer,s=n.graphicsContext,{batcher:a,instructions:o}=s.getContextRenderData(r),l=n.encoder;l.setGeometry(a.geometry,i.gpuProgram);let h=n.globalUniforms.bindGroup;l.setBindGroup(0,h,i.gpuProgram);let u=n.renderPipes.uniformBatch.getUniformBindGroup(i.resources.localUniforms,!0);l.setBindGroup(2,u,i.gpuProgram);let c=o.instructions,f=null;for(let d=0;d{"use strict";yg={name:"texture-bit",vertex:{header:` struct TextureUniforms { uTextureMatrix:mat3x3, } @group(2) @binding(2) var textureUniforms : TextureUniforms; `,main:` uv = (textureUniforms.uTextureMatrix * vec3(uv, 1.0)).xy; `},fragment:{header:` @group(2) @binding(0) var uTexture: texture_2d; @group(2) @binding(1) var uSampler: sampler; `,main:` outColor = textureSample(uTexture, uSampler, vUV); `}},xg={name:"texture-bit",vertex:{header:` uniform mat3 uTextureMatrix; `,main:` uv = (uTextureMatrix * vec3(uv, 1.0)).xy; `},fragment:{header:` uniform sampler2D uTexture; `,main:` outColor = texture(uTexture, vUV); `}}}),zh,o1=_(()=>{re(),Ze(),Wi(),ds(),ji(),bg(),Wr(),mt(),Fe(),zh=class{init(){let e=Zn({name:"mesh",bits:[En,yg,xn]});this._shader=new Rr({gpuProgram:e,resources:{uTexture:Ie.EMPTY._source,uSampler:Ie.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3",value:new _e}}}})}execute(e,t){let r=e.renderer,i=t._shader;if(!i)i=this._shader,i.groups[2]=r.texture.getTextureBindGroup(t.texture);else if(!i.gpuProgram){ge("Mesh shader has no gpuProgram",t.shader);return}let n=i.gpuProgram;if(n.autoAssignGlobalUniforms&&(i.groups[0]=r.globalUniforms.bindGroup),n.autoAssignLocalUniforms){let s=e.localUniforms;i.groups[1]=r.renderPipes.uniformBatch.getUniformBindGroup(s,!0)}r.encoder.draw({geometry:t._geometry,shader:i,state:t.state})}destroy(){this._shader.destroy(!0),this._shader=null}},zh.extension={type:[I.WebGPUPipesAdaptor],name:"mesh"}}),_s,Vh,l1=_(()=>{re(),jr(),kl(),_s=Er.for2d(),Vh=class{start(e,t,r){let i=e.renderer,n=i.encoder,s=r.gpuProgram;this._shader=r,this._geometry=t,n.setGeometry(t,s),_s.blendMode="normal",i.pipeline.getPipeline(t,s,_s);let a=i.globalUniforms.bindGroup;n.resetBindGroup(1),n.setBindGroup(0,a,s)}execute(e,t){let r=this._shader.gpuProgram,i=e.renderer,n=i.encoder;if(!t.bindGroup){let o=t.textures;t.bindGroup=Pl(o.textures,o.count)}_s.blendMode=t.blendMode;let s=i.bindGroup.getBindGroup(t.bindGroup,r,1),a=i.pipeline.getPipeline(this._geometry,r,_s,t.topology);t.bindGroup._touch(i.textureGC.count),n.setPipeline(a),n.renderPassEncoder.setBindGroup(1,s),n.renderPassEncoder.drawIndexed(t.size,1,t.start)}},Vh.extension={type:[I.WebGPUPipesAdaptor],name:"batch"}}),Wh,h1=_(()=>{re(),Wh=class{constructor(e){this._renderer=e}updateRenderable(){}destroyRenderable(){}validateRenderable(){return!1}addRenderable(e,t){this._renderer.renderPipes.batch.break(t),t.add(e)}execute(e){e.isRenderable&&e.render(this._renderer)}destroy(){this._renderer=null}},Wh.extension={type:[I.WebGLPipes,I.WebGPUPipes,I.CanvasPipes],name:"customRender"}});function jh(e,t){let r=e.instructionSet,i=r.instructions;for(let n=0;n{"use strict"}),Tg,$h,u1=_(()=>{re(),Ze(),Ot(),Ba(),wg(),Tg=new _e,$h=class{constructor(e){this._renderer=e}addRenderGroup(e,t){e.isCachedAsTexture?this._addRenderableCacheAsTexture(e,t):this._addRenderableDirect(e,t)}execute(e){e.isRenderable&&(e.isCachedAsTexture?this._executeCacheAsTexture(e):this._executeDirect(e))}destroy(){this._renderer=null}_addRenderableDirect(e,t){this._renderer.renderPipes.batch.break(t),e._batchableRenderGroup&&(He.return(e._batchableRenderGroup),e._batchableRenderGroup=null),t.add(e)}_addRenderableCacheAsTexture(e,t){let r=e._batchableRenderGroup??(e._batchableRenderGroup=He.get(rs));r.renderable=e.root,r.transform=e.root.relativeGroupTransform,r.texture=e.texture,r.bounds=e._textureBounds,t.add(e),this._renderer.renderPipes.batch.addToBatch(r,t)}_executeCacheAsTexture(e){if(e.textureNeedsUpdate){e.textureNeedsUpdate=!1;let t=Tg.identity().translate(-e._textureBounds.x,-e._textureBounds.y);this._renderer.renderTarget.push(e.texture,!0,null,e.texture.frame),this._renderer.globalUniforms.push({worldTransformMatrix:t,worldColor:4294967295}),jh(e,this._renderer.renderPipes),this._renderer.renderTarget.finishRenderPass(),this._renderer.renderTarget.pop(),this._renderer.globalUniforms.pop()}e._batchableRenderGroup._batcher.updateElement(e._batchableRenderGroup),e._batchableRenderGroup._batcher.geometry.buffers[0].update()}_executeDirect(e){this._renderer.globalUniforms.push({worldTransformMatrix:e.inverseParentTextureTransform,worldColor:e.worldColorAlpha}),jh(e,this._renderer.renderPipes),this._renderer.globalUniforms.pop()}},$h.extension={type:[I.WebGLPipes,I.WebGPUPipes,I.CanvasPipes],name:"renderGroup"}});function c1(e,t){let r=e.root,i=e.instructionSet;i.reset();let n=t.renderPipes?t:t.batch.renderer,s=n.renderPipes;s.batch.buildStart(i),s.blendMode.buildStart(),s.colorMask.buildStart(),r.sortableChildren&&r.sortChildren(),Sg(r,i,n,!0),s.batch.buildEnd(i),s.blendMode.buildEnd(i)}function qa(e,t,r){let i=r.renderPipes?r:r.batch.renderer;e.globalDisplayStatus<7||!e.includeInBuild||(e.sortableChildren&&e.sortChildren(),e.isSimple?d1(e,t,i):Sg(e,t,i,!1))}function d1(e,t,r){if(e.renderPipeId){let i=e,{renderPipes:n,renderableGC:s}=r;n.blendMode.setBlendMode(i,e.groupBlendMode,t),n[i.renderPipeId].addRenderable(i,t),s.addRenderable(i),i.didViewUpdate=!1}if(!e.renderGroup){let i=e.children,n=i.length;for(let s=0;s=0;h--){let u=e.effects[h];n[u.pipe].pop(u,e,t)}}}var Xh=_(()=>{"use strict"});function Yh(e,t){t||(t=0);for(let r=t;r{"use strict"});function Cg(e,t=!1){f1(e);let r=e.childrenToUpdate,i=e.updateTick++;for(let n in r){let s=Number(n),a=r[n],o=a.list,l=a.index;for(let h=0;h1?1:r,e.worldAlpha=r,e.worldColorAlpha=e.worldColor+((r*255|0)<<24)}function Ag(e,t,r){if(t===e.updateTick)return;e.updateTick=t,e.didChange=!1;let i=e.localTransform;e.updateLocalTransform();let n=e.parent;if(n&&!n.renderGroup?(r|=e._updateFlags,e.relativeGroupTransform.appendFrom(i,n.relativeGroupTransform),r&qh&&Mg(e,n,r)):(r=e._updateFlags,e.relativeGroupTransform.copyFrom(i),r&qh&&Mg(e,Pg,r)),!e.renderGroup){let s=e.children,a=s.length;for(let h=0;h1?1:i,e.groupAlpha=i,e.groupColorAlpha=e.groupColor+((i*255|0)<<24)}r&js&&(e.groupBlendMode=e.localBlendMode==="inherit"?t.groupBlendMode:e.localBlendMode),r&on&&(e.globalDisplayStatus=e.localDisplayStatus&t.globalDisplayStatus),e._updateFlags=0}var Pg,qh,p1=_(()=>{Hr(),Eg(),J(),Pg=new St,qh=on|Ln|js});function g1(e,t){let{list:r,index:i}=e.childrenRenderablesToUpdate,n=!1;for(let s=0;s{"use strict"}),Rg,Kh,_1=_(()=>{re(),Ze(),Oi(),T(),Xh(),Eg(),wg(),p1(),m1(),Rg=new _e,Kh=class{constructor(e){this._renderer=e}render({container:e,transform:t}){let r=e.parent,i=e.renderGroup.renderGroupParent;e.parent=null,e.renderGroup.renderGroupParent=null;let n=this._renderer,s=Rg;t&&(s=s.copyFrom(e.renderGroup.localTransform),e.renderGroup.localTransform.copyFrom(t));let a=n.renderPipes;this._updateCachedRenderGroups(e.renderGroup,null),this._updateRenderGroups(e.renderGroup),n.globalUniforms.start({worldTransformMatrix:t?e.renderGroup.localTransform:e.renderGroup.worldTransform,worldColor:e.renderGroup.worldColorAlpha}),jh(e.renderGroup,a),a.uniformBatch&&a.uniformBatch.renderEnd(),t&&e.renderGroup.localTransform.copyFrom(s),e.parent=r,e.renderGroup.renderGroupParent=i}destroy(){this._renderer=null}_updateCachedRenderGroups(e,t){if(e.isCachedAsTexture){if(!e.updateCacheTexture)return;t=e}e._parentCacheAsTextureRenderGroup=t;for(let r=e.renderGroupChildren.length-1;r>=0;r--)this._updateCachedRenderGroups(e.renderGroupChildren[r],t);if(e.invalidateMatrices(),e.isCachedAsTexture){if(e.textureNeedsUpdate){let r=e.root.getLocalBounds();r.ceil();let i=e.texture;e.texture&&Kt.returnTexture(e.texture);let n=this._renderer,s=e.textureOptions.resolution||n.view.resolution,a=e.textureOptions.antialias??n.view.antialias;e.texture=Kt.getOptimalTexture(r.width,r.height,s,a),e._textureBounds||(e._textureBounds=new m),e._textureBounds.copyFrom(r),i!==e.texture&&e.renderGroupParent&&(e.renderGroupParent.structureDidChange=!0)}}else e.texture&&(Kt.returnTexture(e.texture),e.texture=null)}_updateRenderGroups(e){let t=this._renderer,r=t.renderPipes;if(e.runOnRender(),e.instructionSet.renderPipes=r,e.structureDidChange?Yh(e.childrenRenderablesToUpdate.list,0):g1(e,r),Cg(e),e.structureDidChange?(e.structureDidChange=!1,c1(e,t)):this._updateRenderables(e),e.childrenRenderablesToUpdate.index=0,t.renderPipes.batch.upload(e.instructionSet),!(e.isCachedAsTexture&&!e.textureNeedsUpdate))for(let i=0;i{re(),Ot(),Ba(),Zh=class{constructor(e){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(e,t){let r=this._getGpuSprite(e);e.didViewUpdate&&this._updateBatchableSprite(e,r),this._renderer.renderPipes.batch.addToBatch(r,t)}updateRenderable(e){let t=this._gpuSpriteHash[e.uid];e.didViewUpdate&&this._updateBatchableSprite(e,t),t._batcher.updateElement(t)}validateRenderable(e){let t=this._getGpuSprite(e);return!t._batcher.checkAndUpdateTexture(t,e._texture)}destroyRenderable(e){let t=this._gpuSpriteHash[e.uid];He.return(t),this._gpuSpriteHash[e.uid]=null,e.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(e,t){t.bounds=e.visualBounds,t.texture=e._texture}_getGpuSprite(e){return this._gpuSpriteHash[e.uid]||this._initGPUSprite(e)}_initGPUSprite(e){let t=He.get(rs);return t.renderable=e,t.transform=e.groupTransform,t.texture=e._texture,t.bounds=e.visualBounds,t.roundPixels=this._renderer._roundPixels|e._roundPixels,this._gpuSpriteHash[e.uid]=t,e.on("destroyed",this._destroyRenderableBound),t}destroy(){for(let e in this._gpuSpriteHash)He.return(this._gpuSpriteHash[e]);this._gpuSpriteHash=null,this._renderer=null}},Zh.extension={type:[I.WebGLPipes,I.WebGPUPipes,I.CanvasPipes],name:"sprite"}}),vs,kg=_(()=>{xt(),vs="8.6.6"}),Qh,Jh,Bg=_(()=>{re(),kg(),Qh=class{static init(){globalThis.__PIXI_APP_INIT__?.(this,vs)}static destroy(){}},Qh.extension=I.Application,Jh=class{constructor(e){this._renderer=e}init(){globalThis.__PIXI_RENDERER_INIT__?.(this._renderer,vs)}destroy(){this._renderer=null}},Jh.extension={type:[I.WebGLSystem,I.WebGPUSystem],name:"initHook",priority:-10}}),Ka,eu,y1=_(()=>{re(),jr(),_f(),Ka=class Vv{constructor(t,r){this.state=Er.for2d(),this._batchersByInstructionSet=Object.create(null),this._activeBatches=Object.create(null),this.renderer=t,this._adaptor=r,this._adaptor.init?.(this)}static getBatcher(t){return new this._availableBatchers[t]}buildStart(t){let r=this._batchersByInstructionSet[t.uid];r||(r=this._batchersByInstructionSet[t.uid]=Object.create(null),r.default||(r.default=new xa)),this._activeBatches=r,this._activeBatch=this._activeBatches.default;for(let i in this._activeBatches)this._activeBatches[i].begin()}addToBatch(t,r){if(this._activeBatch.name!==t.batcherName){this._activeBatch.break(r);let i=this._activeBatches[t.batcherName];i||(i=this._activeBatches[t.batcherName]=Vv.getBatcher(t.batcherName),i.begin()),this._activeBatch=i}this._activeBatch.add(t)}break(t){this._activeBatch.break(t)}buildEnd(t){this._activeBatch.break(t);let r=this._activeBatches;for(let i in r){let n=r[i],s=n.geometry;s.indexBuffer.setDataWithSize(n.indexBuffer,n.indexSize,!0),s.buffers[0].setDataWithSize(n.attributeBuffer.float32View,n.attributeSize,!1)}}upload(t){let r=this._batchersByInstructionSet[t.uid];for(let i in r){let n=r[i],s=n.geometry;n.dirty&&(n.dirty=!1,s.buffers[0].update(n.attributeSize*4))}}execute(t){if(t.action==="startBatch"){let r=t.batcher,i=r.geometry,n=r.shader;this._adaptor.start(this,i,n)}this._adaptor.execute(this,t)}destroy(){this.state=null,this.renderer=null,this._adaptor=null;for(let t in this._activeBatches)this._activeBatches[t].destroy();this._activeBatches=null}},Ka.extension={type:[I.WebGLPipes,I.WebGPUPipes,I.CanvasPipes],name:"batch"},Ka._availableBatchers=Object.create(null),eu=Ka,fe.handleByMap(I.Batcher,eu._availableBatchers),fe.add(xa)}),Ig,x1=_(()=>{Ig=`in vec2 vMaskCoord; in vec2 vTextureCoord; uniform sampler2D uTexture; uniform sampler2D uMaskTexture; uniform float uAlpha; uniform vec4 uMaskClamp; uniform float uInverse; out vec4 finalColor; void main(void) { float clip = step(3.5, step(uMaskClamp.x, vMaskCoord.x) + step(uMaskClamp.y, vMaskCoord.y) + step(vMaskCoord.x, uMaskClamp.z) + step(vMaskCoord.y, uMaskClamp.w)); // TODO look into why this is needed float npmAlpha = uAlpha; vec4 original = texture(uTexture, vTextureCoord); vec4 masky = texture(uMaskTexture, vMaskCoord); float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a); float a = alphaMul * masky.r * npmAlpha * clip; if (uInverse == 1.0) { a = 1.0 - a; } finalColor = original * a; } `}),Gg,b1=_(()=>{Gg=`in vec2 aPosition; out vec2 vTextureCoord; out vec2 vMaskCoord; uniform vec4 uInputSize; uniform vec4 uOutputFrame; uniform vec4 uOutputTexture; uniform mat3 uFilterMatrix; vec4 filterVertexPosition( vec2 aPosition ) { vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy; position.x = position.x * (2.0 / uOutputTexture.x) - 1.0; position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z; return vec4(position, 0.0, 1.0); } vec2 filterTextureCoord( vec2 aPosition ) { return aPosition * (uOutputFrame.zw * uInputSize.zw); } vec2 getFilterCoord( vec2 aPosition ) { return ( uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy; } void main(void) { gl_Position = filterVertexPosition(aPosition); vTextureCoord = filterTextureCoord(aPosition); vMaskCoord = getFilterCoord(aPosition); } `}),tu,w1=_(()=>{tu=`struct GlobalFilterUniforms { uInputSize:vec4, uInputPixel:vec4, uInputClamp:vec4, uOutputFrame:vec4, uGlobalFrame:vec4, uOutputTexture:vec4, }; struct MaskUniforms { uFilterMatrix:mat3x3, uMaskClamp:vec4, uAlpha:f32, uInverse:f32, }; @group(0) @binding(0) var gfu: GlobalFilterUniforms; @group(0) @binding(1) var uTexture: texture_2d; @group(0) @binding(2) var uSampler : sampler; @group(1) @binding(0) var filterUniforms : MaskUniforms; @group(1) @binding(1) var uMaskTexture: texture_2d; struct VSOutput { @builtin(position) position: vec4, @location(0) uv : vec2, @location(1) filterUv : vec2, }; fn filterVertexPosition(aPosition:vec2) -> vec4 { var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy; position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0; position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z; return vec4(position, 0.0, 1.0); } fn filterTextureCoord( aPosition:vec2 ) -> vec2 { return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw); } fn globalTextureCoord( aPosition:vec2 ) -> vec2 { return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw); } fn getFilterCoord(aPosition:vec2 ) -> vec2 { return ( filterUniforms.uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy; } fn getSize() -> vec2 { return gfu.uGlobalFrame.zw; } @vertex fn mainVertex( @location(0) aPosition : vec2, ) -> VSOutput { return VSOutput( filterVertexPosition(aPosition), filterTextureCoord(aPosition), getFilterCoord(aPosition) ); } @fragment fn mainFragment( @location(0) uv: vec2, @location(1) filterUv: vec2, @builtin(position) position: vec4 ) -> @location(0) vec4 { var maskClamp = filterUniforms.uMaskClamp; var uAlpha = filterUniforms.uAlpha; var clip = step(3.5, step(maskClamp.x, filterUv.x) + step(maskClamp.y, filterUv.y) + step(filterUv.x, maskClamp.z) + step(filterUv.y, maskClamp.w)); var mask = textureSample(uMaskTexture, uSampler, filterUv); var source = textureSample(uTexture, uSampler, uv); var alphaMul = 1.0 - uAlpha * (1.0 - mask.a); var a: f32 = alphaMul * mask.r * uAlpha * clip; if (filterUniforms.uInverse == 1.0) { a = 1.0 - a; } return source * a; } `}),Og,T1=_(()=>{Ze(),mn(),Kn(),dr(),Vc(),i1(),x1(),b1(),w1(),Og=class extends pg{constructor(e){let{sprite:t,...r}=e,i=new jo(t.texture),n=new Jt({uFilterMatrix:{value:new _e,type:"mat3x3"},uMaskClamp:{value:i.uClampFrame,type:"vec4"},uAlpha:{value:1,type:"f32"},uInverse:{value:e.inverse?1:0,type:"f32"}}),s=yn.from({vertex:{source:tu,entryPoint:"mainVertex"},fragment:{source:tu,entryPoint:"mainFragment"}}),a=Vi.from({vertex:Gg,fragment:Ig,name:"mask-filter"});super({...r,gpuProgram:s,glProgram:a,resources:{filterUniforms:n,uMaskTexture:t.texture.source}}),this.sprite=t,this._textureMatrix=i}set inverse(e){this.resources.filterUniforms.uniforms.uInverse=e?1:0}get inverse(){return this.resources.filterUniforms.uniforms.uInverse===1}apply(e,t,r,i){this._textureMatrix.texture=this.sprite.texture,e.calculateSpriteMatrix(this.resources.filterUniforms.uniforms.uFilterMatrix,this.sprite).prepend(this._textureMatrix.mapCoord),this.resources.uMaskTexture=this.sprite.texture.source,e.applyFilter(this,t,r,i)}}}),Dg,Ug,ru,S1=_(()=>{re(),ni(),T1(),T(),Y(),Xh(),Td(),Ot(),mt(),Oi(),li(),Dg=new m,Ug=class extends ii{constructor(){super(),this.filters=[new Og({sprite:new ea(Ie.EMPTY),inverse:!1,resolution:"inherit",antialias:"inherit"})]}get sprite(){return this.filters[0].sprite}set sprite(e){this.filters[0].sprite=e}get inverse(){return this.filters[0].inverse}set inverse(e){this.filters[0].inverse=e}},ru=class{constructor(e){this._activeMaskStage=[],this._renderer=e}push(e,t,r){let i=this._renderer;if(i.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:e,inverse:t._maskOptions.inverse,canBundle:!1,maskedContainer:t}),e.inverse=t._maskOptions.inverse,e.renderMaskToTexture){let n=e.mask;n.includeInBuild=!0,qa(n,r,i),n.includeInBuild=!1}i.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:e,maskedContainer:t,inverse:t._maskOptions.inverse,canBundle:!1})}pop(e,t,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:e,inverse:t._maskOptions.inverse,canBundle:!1})}execute(e){let t=this._renderer,r=e.mask.renderMaskToTexture;if(e.action==="pushMaskBegin"){let i=He.get(Ug);if(i.inverse=e.inverse,r){e.mask.mask.measurable=!0;let n=D(e.mask.mask,!0,Dg);e.mask.mask.measurable=!1,n.ceil();let s=t.renderTarget.renderTarget.colorTexture.source,a=Kt.getOptimalTexture(n.width,n.height,s._resolution,s.antialias);t.renderTarget.push(a,!0),t.globalUniforms.push({offset:n,worldColor:4294967295});let o=i.sprite;o.texture=a,o.worldTransform.tx=n.minX,o.worldTransform.ty=n.minY,this._activeMaskStage.push({filterEffect:i,maskedContainer:e.maskedContainer,filterTexture:a})}else i.sprite=e.mask.mask,this._activeMaskStage.push({filterEffect:i,maskedContainer:e.maskedContainer})}else if(e.action==="pushMaskEnd"){let i=this._activeMaskStage[this._activeMaskStage.length-1];r&&(t.type===Sr.WEBGL&&t.renderTarget.finishRenderPass(),t.renderTarget.pop(),t.globalUniforms.pop()),t.filter.push({renderPipeId:"filter",action:"pushFilter",container:i.maskedContainer,filterEffect:i.filterEffect,canBundle:!1})}else if(e.action==="popMaskEnd"){t.filter.pop();let i=this._activeMaskStage.pop();r&&Kt.returnTexture(i.filterTexture),He.return(i.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}},ru.extension={type:[I.WebGLPipes,I.WebGPUPipes,I.CanvasPipes],name:"alphaMask"}}),iu,E1=_(()=>{re(),iu=class{constructor(e){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=e}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(e,t,r){this._renderer.renderPipes.batch.break(r);let i=this._colorStack;i[this._colorStackIndex]=i[this._colorStackIndex-1]&e.mask;let n=this._colorStack[this._colorStackIndex];n!==this._currentColor&&(this._currentColor=n,r.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1})),this._colorStackIndex++}pop(e,t,r){this._renderer.renderPipes.batch.break(r);let i=this._colorStack;this._colorStackIndex--;let n=i[this._colorStackIndex-1];n!==this._currentColor&&(this._currentColor=n,r.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1}))}execute(e){this._renderer.colorMask.setMask(e.colorMask)}destroy(){this._colorStack=null}},iu.extension={type:[I.WebGLPipes,I.WebGPUPipes,I.CanvasPipes],name:"colorMask"}}),nu,C1=_(()=>{re(),Xh(),gs(),fn(),nu=class{constructor(e){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=e}push(e,t,r){var i;let n=e,s=this._renderer;s.renderPipes.batch.break(r),s.renderPipes.blendMode.setBlendMode(n.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:e,inverse:t._maskOptions.inverse,canBundle:!1});let a=n.mask;a.includeInBuild=!0,this._maskHash.has(n)||this._maskHash.set(n,{instructionsStart:0,instructionsLength:0});let o=this._maskHash.get(n);o.instructionsStart=r.instructionSize,qa(a,r,s),a.includeInBuild=!1,s.renderPipes.batch.break(r),r.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:e,inverse:t._maskOptions.inverse,canBundle:!1});let l=r.instructionSize-o.instructionsStart-1;o.instructionsLength=l;let h=s.renderTarget.renderTarget.uid;(i=this._maskStackHash)[h]??(i[h]=0)}pop(e,t,r){let i=e,n=this._renderer;n.renderPipes.batch.break(r),n.renderPipes.blendMode.setBlendMode(i.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"popMaskBegin",inverse:t._maskOptions.inverse,canBundle:!1});let s=this._maskHash.get(e);for(let a=0;a{Ne(),re(),Za=class Wv{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new Ce(0),this.color=this._backgroundColor,this.alpha=1}init(t){t={...Wv.defaultOptions,...t},this.clearBeforeRender=t.clearBeforeRender,this.color=t.background||t.backgroundColor||this._backgroundColor,this.alpha=t.backgroundAlpha,this._backgroundColor.setAlpha(t.backgroundAlpha)}get color(){return this._backgroundColor}set color(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}},Za.extension={type:[I.WebGLSystem,I.WebGPUSystem,I.CanvasSystem],name:"background",priority:0},Za.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},Fg=Za}),Cn,su,M1=_(()=>{re(),ni(),Fe(),Cn={},fe.handle(I.BlendMode,e=>{if(!e.name)throw new Error("BlendMode extension must have a name property");Cn[e.name]=e.ref},e=>{delete Cn[e.name]}),su=class{constructor(e){this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=e}setBlendMode(e,t,r){if(this._activeBlendMode===t){this._isAdvanced&&this._renderableList.push(e);return}this._activeBlendMode=t,this._isAdvanced&&this._endAdvancedBlendMode(r),this._isAdvanced=!!Cn[t],this._isAdvanced&&(this._beginAdvancedBlendMode(r),this._renderableList.push(e))}_beginAdvancedBlendMode(e){this._renderer.renderPipes.batch.break(e);let t=this._activeBlendMode;if(!Cn[t]){ge(`Unable to assign BlendMode: '${t}'. You may want to include: import 'pixi.js/advanced-blend-modes'`);return}let r=this._filterHash[t];r||(r=this._filterHash[t]=new ii,r.filters=[new Cn[t]]);let i={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:r,canBundle:!1};this._renderableList=i.renderables,e.add(i)}_endAdvancedBlendMode(e){this._renderableList=null,this._renderer.renderPipes.batch.break(e),e.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(e){this._isAdvanced&&this._endAdvancedBlendMode(e)}destroy(){this._renderer=null,this._renderableList=null;for(let e in this._filterHash)this._filterHash[e].destroy();this._filterHash=null}},su.extension={type:[I.WebGLPipes,I.WebGPUPipes,I.CanvasPipes],name:"blendMode"}}),Qa,Ja,Lg,P1=_(()=>{re(),Hr(),mt(),Qa={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},Ja=class jv{constructor(t){this._renderer=t}_normalizeOptions(t,r={}){return t instanceof St||t instanceof Ie?{target:t,...r}:{...r,...t}}async image(t){let r=new Image;return r.src=await this.base64(t),r}async base64(t){t=this._normalizeOptions(t,jv.defaultImageOptions);let{format:r,quality:i}=t,n=this.canvas(t);if(n.toBlob!==void 0)return new Promise((s,a)=>{n.toBlob(o=>{if(!o){a(new Error("ICanvas.toBlob failed!"));return}let l=new FileReader;l.onload=()=>s(l.result),l.onerror=a,l.readAsDataURL(o)},Qa[r],i)});if(n.toDataURL!==void 0)return n.toDataURL(Qa[r],i);if(n.convertToBlob!==void 0){let s=await n.convertToBlob({type:Qa[r],quality:i});return new Promise((a,o)=>{let l=new FileReader;l.onload=()=>a(l.result),l.onerror=o,l.readAsDataURL(s)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t){t=this._normalizeOptions(t);let r=t.target,i=this._renderer;if(r instanceof Ie)return i.texture.generateCanvas(r);let n=i.textureGenerator.generateTexture(t),s=i.texture.generateCanvas(n);return n.destroy(!0),s}pixels(t){t=this._normalizeOptions(t);let r=t.target,i=this._renderer,n=r instanceof Ie?r:i.textureGenerator.generateTexture(t),s=i.texture.getPixels(n);return r instanceof St&&n.destroy(!0),s}texture(t){return t=this._normalizeOptions(t),t.target instanceof Ie?t.target:this._renderer.textureGenerator.generateTexture(t)}download(t){t=this._normalizeOptions(t);let r=this.canvas(t),i=document.createElement("a");i.download=t.filename??"image.png",i.href=r.toDataURL("image/png"),document.body.appendChild(i),i.click(),document.body.removeChild(i)}log(t){let r=t.width??200;t=this._normalizeOptions(t);let i=this.canvas(t),n=i.toDataURL();console.log(`[Pixi Texture] ${i.width}px ${i.height}px`);let s=["font-size: 1px;",`padding: ${r}px 300px;`,`background: url(${n}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",s)}destroy(){this._renderer=null}},Ja.extension={type:[I.WebGLSystem,I.WebGPUSystem],name:"extract"},Ja.defaultImageOptions={format:"png",quality:1},Lg=Ja}),Ng,R1=_(()=>{vr(),mt(),Ng=class $v extends Ie{static create(t){return new $v({source:new Nt(t)})}resize(t,r,i){return this.source.resize(t,r,i),this}}}),Hg,zg,Vg,au,k1=_(()=>{Ne(),re(),Ze(),E(),T(),Oe(),Hr(),R1(),Hg=new b,zg=new m,Vg=[0,0,0,0],au=class{constructor(e){this._renderer=e}generateTexture(e){e instanceof St&&(e={target:e,frame:void 0,textureSourceOptions:{},resolution:void 0});let t=e.resolution||this._renderer.resolution,r=e.antialias||this._renderer.view.antialias,i=e.target,n=e.clearColor;n?n=Array.isArray(n)&&n.length===4?n:Ce.shared.setValue(n).toArray():n=Vg;let s=e.frame?.copyTo(Hg)||ur(i,zg).rectangle;s.width=Math.max(s.width,1/t)|0,s.height=Math.max(s.height,1/t)|0;let a=Ng.create({...e.textureSourceOptions,width:s.width,height:s.height,resolution:t,antialias:r}),o=_e.shared.translate(-s.x,-s.y);return this._renderer.render({container:i,transform:o,target:a,clearColor:n}),a.source.updateMipmaps(),a}destroy(){this._renderer=null}},au.extension={type:[I.WebGLSystem,I.WebGPUSystem],name:"textureGenerator"}}),ou,B1=_(()=>{re(),Ze(),wt(),ts(),Li(),li(),dr(),ou=class{constructor(e){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=e}reset(){this._stackIndex=0;for(let e=0;e"},uWorldTransformMatrix:{value:new _e,type:"mat3x3"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4"},uResolution:{value:[0,0],type:"vec2"}},{isStatic:!0})}destroy(){this._renderer=null}},ou.extension={type:[I.WebGLSystem,I.WebGPUSystem,I.CanvasSystem],name:"globalUniforms"}}),Wg,lu,I1=_(()=>{re(),Ks(),Wg=1,lu=class{constructor(){this._tasks=[],this._offset=0}init(){Mr.system.add(this._update,this)}repeat(e,t,r=!0){let i=Wg++,n=0;return r&&(this._offset+=1e3,n=this._offset),this._tasks.push({func:e,duration:t,start:performance.now(),offset:n,last:performance.now(),repeat:!0,id:i}),i}cancel(e){for(let t=0;t=r.duration){let i=e-r.start;r.func(i),r.last=e}}}destroy(){Mr.system.remove(this._update,this),this._tasks.length=0}},lu.extension={type:[I.WebGLSystem,I.WebGPUSystem,I.CanvasSystem],name:"scheduler",priority:0}});function G1(e){if(!hu){if(yt.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){let t=[`%c %c %c %c %c PixiJS %c v${vs} (${e}) http://www.pixijs.com/ `,"background: #E72264; padding:5px 0;","background: #6CA2EA; padding:5px 0;","background: #B5D33D; padding:5px 0;","background: #FED23F; padding:5px 0;","color: #FFFFFF; background: #E72264; padding:5px 0;","color: #E72264; background: #FFFFFF; padding:5px 0;"];globalThis.console.log(...t)}else globalThis.console&&globalThis.console.log(`PixiJS ${vs} - ${e} - http://www.pixijs.com/`);hu=!0}}var hu,O1=_(()=>{Ht(),kg(),hu=!1}),eo,D1=_(()=>{re(),O1(),li(),eo=class{constructor(e){this._renderer=e}init(e){if(e.hello){let t=this._renderer.name;this._renderer.type===Sr.WEBGL&&(t+=` ${this._renderer.context.webGLVersion}`),G1(t)}}},eo.extension={type:[I.WebGLSystem,I.WebGPUSystem,I.CanvasSystem],name:"hello",priority:-2},eo.defaultOptions={hello:!1}});function U1(e){let t=!1;for(let i in e)if(e[i]==null){t=!0;break}if(!t)return e;let r=Object.create(null);for(let i in e){let n=e[i];n&&(r[i]=n)}return r}function F1(e){let t=0;for(let r=0;r{"use strict"}),jg,to,$g,N1=_(()=>{re(),L1(),jg=0,to=class Xv{constructor(t){this._managedRenderables=[],this._managedHashes=[],this._managedArrays=[],this._renderer=t}init(t){t={...Xv.defaultOptions,...t},this.maxUnusedTime=t.renderableGCMaxUnusedTime,this._frequency=t.renderableGCFrequency,this.enabled=t.renderableGCActive}get enabled(){return!!this._handler}set enabled(t){this.enabled!==t&&(t?(this._handler=this._renderer.scheduler.repeat(()=>this.run(),this._frequency,!1),this._hashHandler=this._renderer.scheduler.repeat(()=>{for(let r of this._managedHashes)r.context[r.hash]=U1(r.context[r.hash])},this._frequency),this._arrayHandler=this._renderer.scheduler.repeat(()=>{for(let r of this._managedArrays)F1(r.context[r.hash])},this._frequency)):(this._renderer.scheduler.cancel(this._handler),this._renderer.scheduler.cancel(this._hashHandler),this._renderer.scheduler.cancel(this._arrayHandler)))}addManagedHash(t,r){this._managedHashes.push({context:t,hash:r})}addManagedArray(t,r){this._managedArrays.push({context:t,hash:r})}prerender({container:t}){this._now=performance.now(),t.renderGroup.gcTick=jg++,this._updateInstructionGCTick(t.renderGroup,t.renderGroup.gcTick)}addRenderable(t){this.enabled&&(t._lastUsed===-1&&(this._managedRenderables.push(t),t.once("destroyed",this._removeRenderable,this)),t._lastUsed=this._now)}run(){let t=this._now,r=this._managedRenderables,i=this._renderer.renderPipes,n=0;for(let s=0;sthis.maxUnusedTime){if(!a.destroyed){let h=i;o&&(o.structureDidChange=!0),h[a.renderPipeId].destroyRenderable(a)}a._lastUsed=-1,n++,a.off("destroyed",this._removeRenderable,this)}else r[s-n]=a}r.length-=n}destroy(){this.enabled=!1,this._renderer=null,this._managedRenderables.length=0,this._managedHashes.length=0,this._managedArrays.length=0}_removeRenderable(t){let r=this._managedRenderables.indexOf(t);r>=0&&(t.off("destroyed",this._removeRenderable,this),this._managedRenderables[r]=null)}_updateInstructionGCTick(t,r){t.instructionSet.gcTick=r;for(let i of t.renderGroupChildren)this._updateInstructionGCTick(i,r)}},to.extension={type:[I.WebGLSystem,I.WebGPUSystem],name:"renderableGC",priority:0},to.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4},$g=to}),ro,Xg,H1=_(()=>{re(),ro=class Yv{constructor(t){this._renderer=t,this.count=0,this.checkCount=0}init(t){t={...Yv.defaultOptions,...t},this.checkCountMax=t.textureGCCheckCountMax,this.maxIdle=t.textureGCAMaxIdle??t.textureGCMaxIdle,this.active=t.textureGCActive}postrender(){this._renderer.renderingToScreen&&(this.count++,this.active&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let t=this._renderer.texture.managedTextures;for(let r=0;r-1&&this.count-i._touched>this.maxIdle&&(i._touched=-1,i.unload())}}destroy(){this._renderer=null}},ro.extension={type:[I.WebGLSystem,I.WebGPUSystem],name:"textureGC"},ro.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:60*60,textureGCCheckCountMax:600},Xg=ro}),uu,io,Yg=_(()=>{At(),vr(),mt(),uu=class qv{constructor(t={}){if(this.uid=ut("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,t={...qv.defaultOptions,...t},this.stencil=t.stencil,this.depth=t.depth,this.isRoot=t.isRoot,typeof t.colorTextures=="number"){this._managedColorTextures=!0;for(let r=0;ri.source)];let r=this.colorTexture.source;this.resize(r.width,r.height,r._resolution)}this.colorTexture.source.on("resize",this.onSourceResize,this),(t.depthStencilTexture||this.stencil)&&(t.depthStencilTexture instanceof Ie||t.depthStencilTexture instanceof Nt?this.depthStencilTexture=t.depthStencilTexture.source:this.ensureDepthStencilTexture())}get size(){let t=this._size;return t[0]=this.pixelWidth,t[1]=this.pixelHeight,t}get width(){return this.colorTexture.source.width}get height(){return this.colorTexture.source.height}get pixelWidth(){return this.colorTexture.source.pixelWidth}get pixelHeight(){return this.colorTexture.source.pixelHeight}get resolution(){return this.colorTexture.source._resolution}get colorTexture(){return this.colorTextures[0]}onSourceResize(t){this.resize(t.width,t.height,t._resolution,!0)}ensureDepthStencilTexture(){this.depthStencilTexture||(this.depthStencilTexture=new Nt({width:this.width,height:this.height,resolution:this.resolution,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1}))}resize(t,r,i=this.resolution,n=!1){this.dirtyId++,this.colorTextures.forEach((s,a)=>{n&&a===0||s.source.resize(t,r,i)}),this.depthStencilTexture&&this.depthStencilTexture.source.resize(t,r,i)}destroy(){this.colorTexture.source.off("resize",this.onSourceResize,this),this._managedColorTextures&&this.colorTextures.forEach(t=>{t.destroy()}),this.depthStencilTexture&&(this.depthStencilTexture.destroy(),delete this.depthStencilTexture)}},uu.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1},io=uu});function qg(e,t){if(!An.has(e)){let r=new Ie({source:new oi({resource:e,...t})}),i=()=>{An.get(e)===r&&An.delete(e)};r.once("destroy",i),r.source.once("destroy",i),An.set(e,r)}return An.get(e)}var An,Kg=_(()=>{Wn(),mt(),An=new Map}),no,Zg,z1=_(()=>{Ht(),re(),E(),dt(),Yg(),Kg(),no=class Kv{get autoDensity(){return this.texture.source.autoDensity}set autoDensity(t){this.texture.source.autoDensity=t}get resolution(){return this.texture.source._resolution}set resolution(t){this.texture.source.resize(this.texture.source.width,this.texture.source.height,t)}init(t){t={...Kv.defaultOptions,...t},t.view&&(We(Qe,"ViewSystem.view has been renamed to ViewSystem.canvas"),t.canvas=t.view),this.screen=new b(0,0,t.width,t.height),this.canvas=t.canvas||yt.get().createCanvas(),this.antialias=!!t.antialias,this.texture=qg(this.canvas,t),this.renderTarget=new io({colorTextures:[this.texture],depth:!!t.depth,isRoot:!0}),this.texture.source.transparent=t.backgroundAlpha<1,this.resolution=t.resolution}resize(t,r,i){this.texture.source.resize(t,r,i),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height}destroy(t=!1){(typeof t=="boolean"?t:t?.removeView)&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}},no.extension={type:[I.WebGLSystem,I.WebGPUSystem,I.CanvasSystem],name:"view",priority:0},no.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1},Zg=no}),cu,du,Qg=_(()=>{h1(),u1(),_1(),v1(),Bg(),y1(),S1(),E1(),C1(),A1(),M1(),P1(),k1(),B1(),I1(),D1(),N1(),H1(),z1(),cu=[Fg,ou,eo,Zg,Kh,Xg,au,Lg,Jh,$g,lu],du=[su,eu,Zh,$h,ru,nu,iu,Wh]}),fu,V1=_(()=>{re(),fu=class{constructor(e){this._hash=Object.create(null),this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_hash")}contextChange(e){this._gpu=e}getBindGroup(e,t,r){return e._updateKey(),this._hash[e._key]||this._createBindGroup(e,t,r)}_createBindGroup(e,t,r){let i=this._gpu.device,n=t.layout[r],s=[],a=this._renderer;for(let h in n){let u=e.resources[h]??e.resources[n[h]],c;if(u._resourceType==="uniformGroup"){let f=u;a.ubo.updateUniformGroup(f);let d=f.buffer;c={buffer:a.buffer.getGPUBuffer(d),offset:0,size:d.descriptor.size}}else if(u._resourceType==="buffer"){let f=u;c={buffer:a.buffer.getGPUBuffer(f),offset:0,size:f.descriptor.size}}else if(u._resourceType==="bufferResource"){let f=u;c={buffer:a.buffer.getGPUBuffer(f.buffer),offset:f.offset,size:f.size}}else if(u._resourceType==="textureSampler"){let f=u;c=a.texture.getGpuSampler(f)}else if(u._resourceType==="textureSource"){let f=u;c=a.texture.getGpuSource(f).createView({})}s.push({binding:n[h],resource:c})}let o=a.shader.getProgramData(t).bindGroups[r],l=i.createBindGroup({layout:o,entries:s});return this._hash[e._key]=l,l}destroy(){for(let e of Object.keys(this._hash))this._hash[e]=null;this._hash=null,this._renderer=null}},fu.extension={type:[I.WebGPUSystem],name:"bindGroup"}}),pu,W1=_(()=>{re(),Fd(),pu=class{constructor(e){this._gpuBuffers=Object.create(null),this._managedBuffers=[],e.renderableGC.addManagedHash(this,"_gpuBuffers")}contextChange(e){this._gpu=e}getGPUBuffer(e){return this._gpuBuffers[e.uid]||this.createGPUBuffer(e)}updateBuffer(e){let t=this._gpuBuffers[e.uid]||this.createGPUBuffer(e),r=e.data;return e._updateID&&r&&(e._updateID=0,this._gpu.device.queue.writeBuffer(t,0,r.buffer,0,(e._updateSize||r.byteLength)+3&-4)),t}destroyAll(){for(let e in this._gpuBuffers)this._gpuBuffers[e].destroy();this._gpuBuffers={}}createGPUBuffer(e){this._gpuBuffers[e.uid]||(e.on("update",this.updateBuffer,this),e.on("change",this.onBufferChange,this),e.on("destroy",this.onBufferDestroy,this),this._managedBuffers.push(e));let t=this._gpu.device.createBuffer(e.descriptor);return e._updateID=0,e.data&&(Bl(e.data.buffer,t.getMappedRange()),t.unmap()),this._gpuBuffers[e.uid]=t,t}onBufferChange(e){this._gpuBuffers[e.uid].destroy(),e._updateID=0,this._gpuBuffers[e.uid]=this.createGPUBuffer(e)}onBufferDestroy(e){this._managedBuffers.splice(this._managedBuffers.indexOf(e),1),this._destroyBuffer(e)}destroy(){this._managedBuffers.forEach(e=>this._destroyBuffer(e)),this._managedBuffers=null,this._gpuBuffers=null}_destroyBuffer(e){this._gpuBuffers[e.uid].destroy(),e.off("update",this.updateBuffer,this),e.off("change",this.onBufferChange,this),e.off("destroy",this.onBufferDestroy,this),this._gpuBuffers[e.uid]=null}},pu.extension={type:[I.WebGPUSystem],name:"buffer"}}),gu,j1=_(()=>{re(),gu=class{constructor(e){this._colorMaskCache=15,this._renderer=e}setMask(e){this._colorMaskCache!==e&&(this._colorMaskCache=e,this._renderer.pipeline.setColorMask(e))}destroy(){this._renderer=null,this._colorMaskCache=null}},gu.extension={type:[I.WebGPUSystem],name:"colorMask"}}),so,$1=_(()=>{Ht(),re(),so=class{constructor(e){this._renderer=e}async init(e){return this._initPromise?this._initPromise:(this._initPromise=this._createDeviceAndAdaptor(e).then(t=>{this.gpu=t,this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(e){this._renderer.gpu=e}async _createDeviceAndAdaptor(e){let t=await yt.get().getNavigator().gpu.requestAdapter({powerPreference:e.powerPreference,forceFallbackAdapter:e.forceFallbackAdapter}),r=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(n=>t.features.has(n)),i=await t.requestDevice({requiredFeatures:r});return{adapter:t,device:i}}destroy(){this.gpu=null,this._renderer=null}},so.extension={type:[I.WebGPUSystem],name:"device"},so.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1}}),mu,X1=_(()=>{re(),mu=class{constructor(e){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=e}renderStart(){this.commandFinished=new Promise(e=>{this._resolveCommandFinished=e}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(e){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(e.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(e){this.renderPassEncoder.setViewport(e.x,e.y,e.width,e.height,0,1)}setPipelineFromGeometryProgramAndState(e,t,r,i){let n=this._renderer.pipeline.getPipeline(e,t,r,i);this.setPipeline(n)}setPipeline(e){this._boundPipeline!==e&&(this._boundPipeline=e,this.renderPassEncoder.setPipeline(e))}_setVertexBuffer(e,t){this._boundVertexBuffer[e]!==t&&(this._boundVertexBuffer[e]=t,this.renderPassEncoder.setVertexBuffer(e,this._renderer.buffer.updateBuffer(t)))}_setIndexBuffer(e){if(this._boundIndexBuffer===e)return;this._boundIndexBuffer=e;let t=e.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(e),t)}resetBindGroup(e){this._boundBindGroup[e]=null}setBindGroup(e,t,r){if(this._boundBindGroup[e]===t)return;this._boundBindGroup[e]=t,t._touch(this._renderer.textureGC.count);let i=this._renderer.bindGroup.getBindGroup(t,r,e);this.renderPassEncoder.setBindGroup(e,i)}setGeometry(e,t){let r=this._renderer.pipeline.getBufferNamesToBind(e,t);for(let i in r)this._setVertexBuffer(i,e.attributes[r[i]].buffer);e.indexBuffer&&this._setIndexBuffer(e.indexBuffer)}_setShaderBindGroups(e,t){for(let r in e.groups){let i=e.groups[r];t||this._syncBindGroup(i),this.setBindGroup(r,i,e.gpuProgram)}}_syncBindGroup(e){for(let t in e.resources){let r=e.resources[t];r.isUniformGroup&&this._renderer.ubo.updateUniformGroup(r)}}draw(e){let{geometry:t,shader:r,state:i,topology:n,size:s,start:a,instanceCount:o,skipSync:l}=e;this.setPipelineFromGeometryProgramAndState(t,r.gpuProgram,i,n),this.setGeometry(t,r.gpuProgram),this._setShaderBindGroups(r,l),t.indexBuffer?this.renderPassEncoder.drawIndexed(s||t.indexBuffer.data.length,o??t.instanceCount,a||0):this.renderPassEncoder.draw(s||t.getSize(),o??t.instanceCount,a||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){let e=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1]);this.renderPassEncoder=this.commandEncoder.beginRenderPass(e);let t=this._boundPipeline,r={...this._boundVertexBuffer},i=this._boundIndexBuffer,n={...this._boundBindGroup};this._clearCache();let s=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(s.x,s.y,s.width,s.height,0,1),this.setPipeline(t);for(let a in r)this._setVertexBuffer(a,r[a]);for(let a in n)this.setBindGroup(a,n[a],null);this._setIndexBuffer(i)}_clearCache(){for(let e=0;e<16;e++)this._boundBindGroup[e]=null,this._boundVertexBuffer[e]=null;this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null}contextChange(e){this._gpu=e}},mu.extension={type:[I.WebGPUSystem],name:"encoder",priority:1}}),_u,Y1=_(()=>{re(),fn(),_u=class{constructor(e){this._renderTargetStencilState=Object.create(null),this._renderer=e,e.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(e){let t=this._renderTargetStencilState[e.uid];t||(t=this._renderTargetStencilState[e.uid]={stencilMode:Mt.DISABLED,stencilReference:0}),this._activeRenderTarget=e,this.setStencilMode(t.stencilMode,t.stencilReference)}setStencilMode(e,t){let r=this._renderTargetStencilState[this._activeRenderTarget.uid];r.stencilMode=e,r.stencilReference=t;let i=this._renderer;i.pipeline.setStencilMode(e),i.encoder.renderPassEncoder.setStencilReference(t)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}},_u.extension={type:[I.WebGPUSystem],name:"stencil"}}),vu,Jg=_(()=>{mg(),zi(),Si(),vu=class{constructor(e){this._syncFunctionHash=Object.create(null),this._adaptor=e,this._systemCheck()}_systemCheck(){if(!gg())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}ensureUniformGroup(e){let t=this.getUniformGroupData(e);e.buffer||(e.buffer=new cr({data:new Float32Array(t.layout.size/4),usage:Je.UNIFORM|Je.COPY_DST}))}getUniformGroupData(e){return this._syncFunctionHash[e._signature]||this._initUniformGroup(e)}_initUniformGroup(e){let t=e._signature,r=this._syncFunctionHash[t];if(!r){let i=Object.keys(e.uniformStructures).map(a=>e.uniformStructures[a]),n=this._adaptor.createUboElements(i),s=this._generateUboSync(n.uboElements);r=this._syncFunctionHash[t]={layout:n,syncFunction:s}}return this._syncFunctionHash[t]}_generateUboSync(e){return this._adaptor.generateUboSync(e)}syncUniformGroup(e,t,r){let i=this.getUniformGroupData(e);e.buffer||(e.buffer=new cr({data:new Float32Array(i.layout.size/4),usage:Je.UNIFORM|Je.COPY_DST}));let n=null;return t||(t=e.buffer.data,n=e.buffer.dataInt32),r||(r=0),i.syncFunction(e.uniforms,t,n,r),!0}updateUniformGroup(e){if(e.isStatic&&!e._dirtyId)return!1;e._dirtyId=0;let t=this.syncUniformGroup(e);return e.buffer.update(),t}destroy(){this._syncFunctionHash=null}}});function q1(e){let t=e.map(i=>({data:i,offset:0,size:0})),r=0;for(let i=0;i1&&(s=Math.max(s,a)*n.data.size),r=Math.ceil(r/a)*a,n.size=s,n.offset=r,r+=s}return r=Math.ceil(r/16)*16,{uboElements:t,size:r}}var ys,em=_(()=>{"use strict";ys={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2":{align:8,size:8},"vec2":{align:8,size:8},"vec2":{align:8,size:8},"vec2":{align:4,size:4},"vec3":{align:16,size:12},"vec3":{align:16,size:12},"vec3":{align:16,size:12},"vec3":{align:8,size:6},"vec4":{align:16,size:16},"vec4":{align:16,size:16},"vec4":{align:16,size:16},"vec4":{align:8,size:8},"mat2x2":{align:8,size:16},"mat2x2":{align:4,size:8},"mat3x2":{align:8,size:24},"mat3x2":{align:4,size:12},"mat4x2":{align:8,size:32},"mat4x2":{align:4,size:16},"mat2x3":{align:16,size:32},"mat2x3":{align:8,size:16},"mat3x3":{align:16,size:48},"mat3x3":{align:8,size:24},"mat4x3":{align:16,size:64},"mat4x3":{align:8,size:32},"mat2x4":{align:16,size:32},"mat2x4":{align:8,size:16},"mat3x4":{align:16,size:48},"mat3x4":{align:8,size:24},"mat4x4":{align:16,size:64},"mat4x4":{align:8,size:32}}}),Mi,tm=_(()=>{"use strict";Mi=[{type:"mat3x3",test:e=>e.value.a!==void 0,ubo:` var matrix = uv[name].toArray(true); data[offset] = matrix[0]; data[offset + 1] = matrix[1]; data[offset + 2] = matrix[2]; data[offset + 4] = matrix[3]; data[offset + 5] = matrix[4]; data[offset + 6] = matrix[5]; data[offset + 8] = matrix[6]; data[offset + 9] = matrix[7]; data[offset + 10] = matrix[8]; `,uniform:` gl.uniformMatrix3fv(ud[name].location, false, uv[name].toArray(true)); `},{type:"vec4",test:e=>e.type==="vec4"&&e.size===1&&e.value.width!==void 0,ubo:` v = uv[name]; data[offset] = v.x; data[offset + 1] = v.y; data[offset + 2] = v.width; data[offset + 3] = v.height; `,uniform:` cv = ud[name].value; v = uv[name]; if (cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height) { cv[0] = v.x; cv[1] = v.y; cv[2] = v.width; cv[3] = v.height; gl.uniform4f(ud[name].location, v.x, v.y, v.width, v.height); } `},{type:"vec2",test:e=>e.type==="vec2"&&e.size===1&&e.value.x!==void 0,ubo:` v = uv[name]; data[offset] = v.x; data[offset + 1] = v.y; `,uniform:` cv = ud[name].value; v = uv[name]; if (cv[0] !== v.x || cv[1] !== v.y) { cv[0] = v.x; cv[1] = v.y; gl.uniform2f(ud[name].location, v.x, v.y); } `},{type:"vec4",test:e=>e.type==="vec4"&&e.size===1&&e.value.red!==void 0,ubo:` v = uv[name]; data[offset] = v.red; data[offset + 1] = v.green; data[offset + 2] = v.blue; data[offset + 3] = v.alpha; `,uniform:` cv = ud[name].value; v = uv[name]; if (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha) { cv[0] = v.red; cv[1] = v.green; cv[2] = v.blue; cv[3] = v.alpha; gl.uniform4f(ud[name].location, v.red, v.green, v.blue, v.alpha); } `},{type:"vec3",test:e=>e.type==="vec3"&&e.size===1&&e.value.red!==void 0,ubo:` v = uv[name]; data[offset] = v.red; data[offset + 1] = v.green; data[offset + 2] = v.blue; `,uniform:` cv = ud[name].value; v = uv[name]; if (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue) { cv[0] = v.red; cv[1] = v.green; cv[2] = v.blue; gl.uniform3f(ud[name].location, v.red, v.green, v.blue); } `}]});function rm(e,t,r,i){let n=[` var v = null; var v2 = null; var t = 0; var index = 0; var name = null; var arrayOffset = null; `],s=0;for(let o=0;o1)c=l.offset/4,n.push(r(l,c-s));else{let f=i[l.data.type];c=l.offset/4,n.push(` v = uv.${h}; offset += ${c-s}; ${f}; `)}s=c}let a=n.join(` `);return new Function("uv","data","dataInt32","offset",a)}var im=_(()=>{tm()});function Mn(e,t){return` for (let i = 0; i < ${e*t}; i++) { data[offset + (((i / ${e})|0) * 4) + (i % ${e})] = v[i]; } `}var yu,nm,sm=_(()=>{"use strict";yu={f32:` data[offset] = v;`,i32:` dataInt32[offset] = v;`,"vec2":` data[offset] = v[0]; data[offset + 1] = v[1];`,"vec3":` data[offset] = v[0]; data[offset + 1] = v[1]; data[offset + 2] = v[2];`,"vec4":` data[offset] = v[0]; data[offset + 1] = v[1]; data[offset + 2] = v[2]; data[offset + 3] = v[3];`,"vec2":` dataInt32[offset] = v[0]; dataInt32[offset + 1] = v[1];`,"vec3":` dataInt32[offset] = v[0]; dataInt32[offset + 1] = v[1]; dataInt32[offset + 2] = v[2];`,"vec4":` dataInt32[offset] = v[0]; dataInt32[offset + 1] = v[1]; dataInt32[offset + 2] = v[2]; dataInt32[offset + 3] = v[3];`,"mat2x2":` data[offset] = v[0]; data[offset + 1] = v[1]; data[offset + 4] = v[2]; data[offset + 5] = v[3];`,"mat3x3":` data[offset] = v[0]; data[offset + 1] = v[1]; data[offset + 2] = v[2]; data[offset + 4] = v[3]; data[offset + 5] = v[4]; data[offset + 6] = v[5]; data[offset + 8] = v[6]; data[offset + 9] = v[7]; data[offset + 10] = v[8];`,"mat4x4":` for (let i = 0; i < 16; i++) { data[offset + i] = v[i]; }`,"mat3x2":Mn(3,2),"mat4x2":Mn(4,2),"mat2x3":Mn(2,3),"mat4x3":Mn(4,3),"mat2x4":Mn(2,4),"mat3x4":Mn(3,4)},nm={...yu,"mat2x2":` data[offset] = v[0]; data[offset + 1] = v[1]; data[offset + 2] = v[2]; data[offset + 3] = v[3]; `}});function K1(e,t){let{size:r,align:i}=ys[e.data.type],n=(i-r)/4,s=e.data.type.indexOf("i32")>=0?"dataInt32":"data";return` v = uv.${e.data.name}; ${t!==0?`offset += ${t};`:""} arrayOffset = offset; t = 0; for(var i=0; i < ${e.data.size*(r/4)}; i++) { for(var j = 0; j < ${r/4}; j++) { ${s}[arrayOffset++] = v[t++]; } ${n!==0?`arrayOffset += ${n};`:""} } `}var Z1=_(()=>{em()});function Q1(e){return rm(e,"uboWgsl",K1,nm)}var J1=_(()=>{im(),sm(),Z1()}),xu,ew=_(()=>{re(),Jg(),em(),J1(),xu=class extends vu{constructor(){super({createUboElements:q1,generateUboSync:Q1})}},xu.extension={type:[I.WebGPUSystem],name:"ubo"}}),ao,bu=_(()=>{xt(),At(),ao=class extends et{constructor({buffer:e,offset:t,size:r}){super(),this.uid=ut("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=ut("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=e,this.offset=t|0,this.size=r,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=ut("resource"),this.emit("change",this)}destroy(e=!1){this.destroyed=!0,e&&this.buffer.destroy(),this.emit("change",this),this.buffer=null}}}),am,tw=_(()=>{"use strict";am=class{constructor({minUniformOffsetAlignment:e}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=e,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(e){if(e>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${e*4}`);let t=this.byteIndex,r=t+e*4;if(r=Math.ceil(r/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,r>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=r,t}addGroup(e){let t=this.addEmptyGroup(e.length);for(let r=0;r{re(),zi(),bu(),Si(),tw(),Li(),hi=128,wu=class{constructor(e){this._bindGroupHash=Object.create(null),this._buffers=[],this._bindGroups=[],this._bufferResources=[],this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_bindGroupHash"),this._batchBuffer=new am({minUniformOffsetAlignment:hi});let t=256/hi;for(let r=0;r{Fe(),_n()}),ui,hm=_(()=>{fn(),ui=[],ui[Mt.NONE]=void 0,ui[Mt.DISABLED]={stencilWriteMask:0,stencilReadMask:0},ui[Mt.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}},ui[Mt.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}},ui[Mt.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}},ui[Mt.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"replace"},stencilBack:{compare:"not-equal",passOp:"replace"}}});function nw(e,t,r,i,n){return e<<24|t<<16|r<<10|i<<5|n}function sw(e,t,r,i){return r<<6|e<<3|i<<1|t}var um,Tu,aw=_(()=>{re(),Fe(),lm(),fn(),la(),hm(),um={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4},Tu=class{constructor(e){this._moduleCache=Object.create(null),this._bufferLayoutsCache=Object.create(null),this._bindingNamesCache=Object.create(null),this._pipeCache=Object.create(null),this._pipeStateCaches=Object.create(null),this._colorMask=15,this._multisampleCount=1,this._renderer=e}contextChange(e){this._gpu=e,this.setStencilMode(Mt.DISABLED),this._updatePipeHash()}setMultisampleCount(e){this._multisampleCount!==e&&(this._multisampleCount=e,this._updatePipeHash())}setRenderTarget(e){this._multisampleCount=e.msaaSamples,this._depthStencilAttachment=e.descriptor.depthStencilAttachment?1:0,this._updatePipeHash()}setColorMask(e){this._colorMask!==e&&(this._colorMask=e,this._updatePipeHash())}setStencilMode(e){this._stencilMode!==e&&(this._stencilMode=e,this._stencilState=ui[e],this._updatePipeHash())}setPipeline(e,t,r,i){let n=this.getPipeline(e,t,r);i.setPipeline(n)}getPipeline(e,t,r,i){e._layoutKey||(om(e,t.attributeData),this._generateBufferKey(e)),i||(i=e.topology);let n=nw(e._layoutKey,t._layoutKey,r.data,r._blendModeId,um[i]);return this._pipeCache[n]?this._pipeCache[n]:(this._pipeCache[n]=this._createPipeline(e,t,r,i),this._pipeCache[n])}_createPipeline(e,t,r,i){let n=this._gpu.device,s=this._createVertexBufferLayouts(e,t),a=this._renderer.state.getColorTargets(r);a[0].writeMask=this._stencilMode===Mt.RENDERING_MASK_ADD?0:this._colorMask;let o=this._renderer.shader.getProgramData(t).pipeline,l={vertex:{module:this._getModule(t.vertex.source),entryPoint:t.vertex.entryPoint,buffers:s},fragment:{module:this._getModule(t.fragment.source),entryPoint:t.fragment.entryPoint,targets:a},primitive:{topology:i,cullMode:r.cullMode},layout:o,multisample:{count:this._multisampleCount},label:"PIXI Pipeline"};return this._depthStencilAttachment&&(l.depthStencil={...this._stencilState,format:"depth24plus-stencil8",depthWriteEnabled:r.depthTest,depthCompare:r.depthTest?"less":"always"}),n.createRenderPipeline(l)}_getModule(e){return this._moduleCache[e]||this._createModule(e)}_createModule(e){let t=this._gpu.device;return this._moduleCache[e]=t.createShaderModule({code:e}),this._moduleCache[e]}_generateBufferKey(e){let t=[],r=0,i=Object.keys(e.attributes).sort();for(let s=0;s{let s={arrayStride:0,stepMode:"vertex",attributes:[]},a=s.attributes;for(let o in t.attributeData){let l=e.attributes[o];(l.divisor??1)!==1&&ge(`Attribute ${o} has an invalid divisor value of '${l.divisor}'. WebGPU only supports a divisor value of 1`),l.buffer===n&&(s.arrayStride=l.stride,s.stepMode=l.instance?"instance":"vertex",a.push({shaderLocation:t.attributeData[o].location,offset:l.offset,format:l.format}))}a.length&&i.push(s)}),this._bufferLayoutsCache[r]=i,i}_updatePipeHash(){let e=sw(this._stencilMode,this._multisampleCount,this._colorMask,this._depthStencilAttachment);this._pipeStateCaches[e]||(this._pipeStateCaches[e]=Object.create(null)),this._pipeCache=this._pipeStateCaches[e]}destroy(){this._renderer=null,this._bufferLayoutsCache=null}},Tu.extension={type:[I.WebGPUSystem],name:"pipeline"}});function ow(e,t,r,i,n,s){let a=s?1:-1;return e.identity(),e.a=1/i*2,e.d=a*(1/n*2),e.tx=-1-t*e.a,e.ty=-a-r*e.d,e}var lw=_(()=>{"use strict"});function hw(e){let t=e.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement&&document.body.contains(t)}var uw=_(()=>{"use strict"}),Su,cm=_(()=>{Ze(),E(),gs(),lw(),_g(),Wn(),vr(),mt(),Kg(),uw(),Yg(),Su=class{constructor(e){this.rootViewPort=new b,this.viewport=new b,this.onRenderTargetChange=new Lh("onRenderTargetChange"),this.projectionMatrix=new _e,this.defaultClearColor=[0,0,0,0],this._renderSurfaceToRenderTargetHash=new Map,this._gpuRenderTargetHash=Object.create(null),this._renderTargetStack=[],this._renderer=e,e.renderableGC.addManagedHash(this,"_gpuRenderTargetHash")}finishRenderPass(){this.adaptor.finishRenderPass(this.renderTarget)}renderStart({target:e,clear:t,clearColor:r,frame:i}){this._renderTargetStack.length=0,this.push(e,t,r,i),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=hw(this.rootRenderTarget),this.adaptor.prerender?.(this.rootRenderTarget)}postrender(){this.adaptor.postrender?.(this.rootRenderTarget)}bind(e,t=!0,r,i){let n=this.getRenderTarget(e),s=this.renderTarget!==n;this.renderTarget=n,this.renderSurface=e;let a=this.getGpuRenderTarget(n);(n.pixelWidth!==a.width||n.pixelHeight!==a.height)&&(this.adaptor.resizeGpuRenderTarget(n),a.width=n.pixelWidth,a.height=n.pixelHeight);let o=n.colorTexture,l=this.viewport,h=o.pixelWidth,u=o.pixelHeight;if(!i&&e instanceof Ie&&(i=e.frame),i){let c=o._resolution;l.x=i.x*c+.5|0,l.y=i.y*c+.5|0,l.width=i.width*c+.5|0,l.height=i.height*c+.5|0}else l.x=0,l.y=0,l.width=h,l.height=u;return ow(this.projectionMatrix,0,0,l.width/o.resolution,l.height/o.resolution,!n.isRoot),this.adaptor.startRenderPass(n,t,r,l),s&&this.onRenderTargetChange.emit(n),n}clear(e,t=fr.ALL,r){t&&(e&&(e=this.getRenderTarget(e)),this.adaptor.clear(e||this.renderTarget,t,r,this.viewport))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(e,t=fr.ALL,r,i){let n=this.bind(e,t,r,i);return this._renderTargetStack.push({renderTarget:n,frame:i}),n}pop(){this._renderTargetStack.pop();let e=this._renderTargetStack[this._renderTargetStack.length-1];this.bind(e.renderTarget,!1,null,e.frame)}getRenderTarget(e){return e.isTexture&&(e=e.source),this._renderSurfaceToRenderTargetHash.get(e)??this._initRenderTarget(e)}copyToTexture(e,t,r,i,n){r.x<0&&(i.width+=r.x,n.x-=r.x,r.x=0),r.y<0&&(i.height+=r.y,n.y-=r.y,r.y=0);let{pixelWidth:s,pixelHeight:a}=e;return i.width=Math.min(i.width,s-r.x),i.height=Math.min(i.height,a-r.y),this.adaptor.copyToTexture(e,t,r,i,n)}ensureDepthStencil(){this.renderTarget.stencil||(this.renderTarget.stencil=!0,this.adaptor.startRenderPass(this.renderTarget,!1,null,this.viewport))}destroy(){this._renderer=null,this._renderSurfaceToRenderTargetHash.forEach((e,t)=>{e!==t&&e.destroy()}),this._renderSurfaceToRenderTargetHash.clear(),this._gpuRenderTargetHash=Object.create(null)}_initRenderTarget(e){let t=null;return oi.test(e)&&(e=qg(e).source),e instanceof io?t=e:e instanceof Nt&&(t=new io({colorTextures:[e]}),oi.test(e.source.resource)&&(t.isRoot=!0),e.once("destroy",()=>{t.destroy(),this._renderSurfaceToRenderTargetHash.delete(e);let r=this._gpuRenderTargetHash[t.uid];r&&(this._gpuRenderTargetHash[t.uid]=null,this.adaptor.destroyGpuRenderTarget(r))})),this._renderSurfaceToRenderTargetHash.set(e,t),t}getGpuRenderTarget(e){return this._gpuRenderTargetHash[e.uid]||(this._gpuRenderTargetHash[e.uid]=this.adaptor.initGpuRenderTarget(e))}}}),dm,cw=_(()=>{"use strict";dm=class{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}}),fm,dw=_(()=>{gs(),Wn(),vr(),cw(),fm=class{init(e,t){this._renderer=e,this._renderTargetSystem=t}copyToTexture(e,t,r,i,n){let s=this._renderer,a=this._getGpuColorTexture(e),o=s.texture.getGpuSource(t.source);return s.encoder.commandEncoder.copyTextureToTexture({texture:a,origin:r},{texture:o,origin:n},i),t}startRenderPass(e,t=!0,r,i){let n=this._renderTargetSystem.getGpuRenderTarget(e),s=this.getDescriptor(e,t,r);n.descriptor=s,this._renderer.pipeline.setRenderTarget(n),this._renderer.encoder.beginRenderPass(n),this._renderer.encoder.setViewport(i)}finishRenderPass(){this._renderer.encoder.endRenderPass()}_getGpuColorTexture(e){let t=this._renderTargetSystem.getGpuRenderTarget(e);return t.contexts[0]?t.contexts[0].getCurrentTexture():this._renderer.texture.getGpuSource(e.colorTextures[0].source)}getDescriptor(e,t,r){typeof t=="boolean"&&(t=t?fr.ALL:fr.NONE);let i=this._renderTargetSystem,n=i.getGpuRenderTarget(e),s=e.colorTextures.map((o,l)=>{let h=n.contexts[l],u,c;h?u=h.getCurrentTexture().createView():u=this._renderer.texture.getGpuSource(o).createView({mipLevelCount:1}),n.msaaTextures[l]&&(c=u,u=this._renderer.texture.getTextureView(n.msaaTextures[l]));let f=t&fr.COLOR?"clear":"load";return r??(r=i.defaultClearColor),{view:u,resolveTarget:c,clearValue:r,storeOp:"store",loadOp:f}}),a;if((e.stencil||e.depth)&&!e.depthStencilTexture&&(e.ensureDepthStencilTexture(),e.depthStencilTexture.source.sampleCount=n.msaa?4:1),e.depthStencilTexture){let o=t&fr.STENCIL?"clear":"load",l=t&fr.DEPTH?"clear":"load";a={view:this._renderer.texture.getGpuSource(e.depthStencilTexture.source).createView(),stencilStoreOp:"store",stencilLoadOp:o,depthClearValue:1,depthLoadOp:l,depthStoreOp:"store"}}return{colorAttachments:s,depthStencilAttachment:a}}clear(e,t=!0,r,i){if(!t)return;let{gpu:n,encoder:s}=this._renderer,a=n.device;if(s.commandEncoder===null){let o=a.createCommandEncoder(),l=this.getDescriptor(e,t,r),h=o.beginRenderPass(l);h.setViewport(i.x,i.y,i.width,i.height,0,1),h.end();let u=o.finish();a.queue.submit([u])}else this.startRenderPass(e,t,r,i)}initGpuRenderTarget(e){e.isRoot=!0;let t=new dm;return e.colorTextures.forEach((r,i)=>{if(oi.test(r.resource)){let n=r.resource.getContext("webgpu"),s=r.transparent?"premultiplied":"opaque";try{n.configure({device:this._renderer.gpu.device,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,format:"bgra8unorm",alphaMode:s})}catch(a){console.error(a)}t.contexts[i]=n}if(t.msaa=r.source.antialias,r.source.antialias){let n=new Nt({width:0,height:0,sampleCount:4});t.msaaTextures[i]=n}}),t.msaa&&(t.msaaSamples=4,e.depthStencilTexture&&(e.depthStencilTexture.source.sampleCount=4)),t}destroyGpuRenderTarget(e){e.contexts.forEach(t=>{t.unconfigure()}),e.msaaTextures.forEach(t=>{t.destroy()}),e.msaaTextures.length=0,e.contexts.length=0}ensureDepthStencilTexture(e){let t=this._renderTargetSystem.getGpuRenderTarget(e);e.depthStencilTexture&&t.msaa&&(e.depthStencilTexture.source.sampleCount=4)}resizeGpuRenderTarget(e){let t=this._renderTargetSystem.getGpuRenderTarget(e);t.width=e.width,t.height=e.height,t.msaa&&e.colorTextures.forEach((r,i)=>{t.msaaTextures[i]?.resize(r.source.width,r.source.height,r.source._resolution)})}}}),Eu,fw=_(()=>{re(),cm(),dw(),Eu=class extends Su{constructor(e){super(e),this.adaptor=new fm,this.adaptor.init(e,this)}},Eu.extension={type:[I.WebGPUSystem],name:"renderTarget"}}),Cu,pw=_(()=>{re(),Cu=class{constructor(){this._gpuProgramData=Object.create(null)}contextChange(e){this._gpu=e,this.maxTextures=e.device.limits.maxSampledTexturesPerShaderStage}getProgramData(e){return this._gpuProgramData[e._layoutKey]||this._createGPUProgramData(e)}_createGPUProgramData(e){let t=this._gpu.device,r=e.gpuLayout.map(n=>t.createBindGroupLayout({entries:n})),i={bindGroupLayouts:r};return this._gpuProgramData[e._layoutKey]={bindGroups:r,pipeline:t.createPipelineLayout(i)},this._gpuProgramData[e._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}},Cu.extension={type:[I.WebGPUSystem],name:"shader"}}),nr,gw=_(()=>{"use strict";nr={},nr.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}},nr.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}},nr.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}},nr.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}},nr.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}},nr.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}},nr["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}},nr["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}},nr["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}},nr.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}},nr.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}},nr.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}}}),Au,mw=_(()=>{re(),jr(),gw(),Au=class{constructor(){this.defaultState=new Er,this.defaultState.blend=!0}contextChange(e){this.gpu=e}getColorTargets(e){return[{format:"bgra8unorm",writeMask:0,blend:nr[e.blendMode]||nr.normal}]}destroy(){this.gpu=null}},Au.extension={type:[I.WebGPUSystem],name:"state"}}),pm,_w=_(()=>{"use strict";pm={type:"image",upload(e,t,r){let i=e.resource,n=(e.pixelWidth|0)*(e.pixelHeight|0),s=i.byteLength/n;r.device.queue.writeTexture({texture:t},i,{offset:0,rowsPerImage:e.pixelHeight,bytesPerRow:e.pixelHeight*s},{width:e.pixelWidth,height:e.pixelHeight,depthOrArrayLayers:1})}}}),Mu,gm,mm,vw=_(()=>{"use strict";Mu={"bc1-rgba-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"bc2-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc3-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc7-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"etc1-rgb-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"etc2-rgba8unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"astc-4x4-unorm":{blockBytes:16,blockWidth:4,blockHeight:4}},gm={blockBytes:4,blockWidth:1,blockHeight:1},mm={type:"compressed",upload(e,t,r){let i=e.pixelWidth,n=e.pixelHeight,s=Mu[e.format]||gm;for(let a=0;a>1,1),n=Math.max(n>>1,1)}}}}),Pu,_m=_(()=>{"use strict";Pu={type:"image",upload(e,t,r){let i=e.resource;if(!i)return;let n=Math.min(t.width,e.resourceWidth||e.pixelWidth),s=Math.min(t.height,e.resourceHeight||e.pixelHeight),a=e.alphaMode==="premultiply-alpha-on-upload";r.device.queue.copyExternalImageToTexture({source:i},{texture:t,premultipliedAlpha:a},{width:n,height:s})}}}),vm,yw=_(()=>{_m(),vm={type:"video",upload(e,t,r){Pu.upload(e,t,r)}}}),ym,xw=_(()=>{"use strict";ym=class{constructor(e){this.device=e,this.sampler=e.createSampler({minFilter:"linear"}),this.pipelines={}}_getMipmapPipeline(e){let t=this.pipelines[e];return t||(this.mipmapShaderModule||(this.mipmapShaderModule=this.device.createShaderModule({code:` var pos : array, 3> = array, 3>( vec2(-1.0, -1.0), vec2(-1.0, 3.0), vec2(3.0, -1.0)); struct VertexOutput { @builtin(position) position : vec4, @location(0) texCoord : vec2, }; @vertex fn vertexMain(@builtin(vertex_index) vertexIndex : u32) -> VertexOutput { var output : VertexOutput; output.texCoord = pos[vertexIndex] * vec2(0.5, -0.5) + vec2(0.5); output.position = vec4(pos[vertexIndex], 0.0, 1.0); return output; } @group(0) @binding(0) var imgSampler : sampler; @group(0) @binding(1) var img : texture_2d; @fragment fn fragmentMain(@location(0) texCoord : vec2) -> @location(0) vec4 { return textureSample(img, imgSampler, texCoord); } `})),t=this.device.createRenderPipeline({layout:"auto",vertex:{module:this.mipmapShaderModule,entryPoint:"vertexMain"},fragment:{module:this.mipmapShaderModule,entryPoint:"fragmentMain",targets:[{format:e}]}}),this.pipelines[e]=t),t}generateMipmap(e){let t=this._getMipmapPipeline(e.format);if(e.dimension==="3d"||e.dimension==="1d")throw new Error("Generating mipmaps for non-2d textures is currently unsupported!");let r=e,i=e.depthOrArrayLayers||1,n=e.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!n){let o={size:{width:Math.ceil(e.width/2),height:Math.ceil(e.height/2),depthOrArrayLayers:i},format:e.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:e.mipLevelCount-1};r=this.device.createTexture(o)}let s=this.device.createCommandEncoder({}),a=t.getBindGroupLayout(0);for(let o=0;o{Ht(),re(),dr(),is(),Li(),_w(),vw(),_m(),yw(),xw(),Ru=class{constructor(e){this.managedTextures=[],this._gpuSources=Object.create(null),this._gpuSamplers=Object.create(null),this._bindGroupHash=Object.create(null),this._textureViewHash=Object.create(null),this._uploads={image:Pu,buffer:pm,video:vm,compressed:mm},this._renderer=e,e.renderableGC.addManagedHash(this,"_gpuSources"),e.renderableGC.addManagedHash(this,"_gpuSamplers"),e.renderableGC.addManagedHash(this,"_bindGroupHash"),e.renderableGC.addManagedHash(this,"_textureViewHash")}contextChange(e){this._gpu=e}initSource(e){if(e.autoGenerateMipmaps){let o=Math.max(e.pixelWidth,e.pixelHeight);e.mipLevelCount=Math.floor(Math.log2(o))+1}let t=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST;e.uploadMethodId!=="compressed"&&(t|=GPUTextureUsage.RENDER_ATTACHMENT,t|=GPUTextureUsage.COPY_SRC);let r=Mu[e.format]||{blockBytes:4,blockWidth:1,blockHeight:1},i=Math.ceil(e.pixelWidth/r.blockWidth)*r.blockWidth,n=Math.ceil(e.pixelHeight/r.blockHeight)*r.blockHeight,s={label:e.label,size:{width:i,height:n},format:e.format,sampleCount:e.sampleCount,mipLevelCount:e.mipLevelCount,dimension:e.dimension,usage:t},a=this._gpu.device.createTexture(s);return this._gpuSources[e.uid]=a,this.managedTextures.includes(e)||(e.on("update",this.onSourceUpdate,this),e.on("resize",this.onSourceResize,this),e.on("destroy",this.onSourceDestroy,this),e.on("unload",this.onSourceUnload,this),e.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(e)),this.onSourceUpdate(e),a}onSourceUpdate(e){let t=this.getGpuSource(e);t&&(this._uploads[e.uploadMethodId]&&this._uploads[e.uploadMethodId].upload(e,t,this._gpu),e.autoGenerateMipmaps&&e.mipLevelCount>1&&this.onUpdateMipmaps(e))}onSourceUnload(e){let t=this._gpuSources[e.uid];t&&(this._gpuSources[e.uid]=null,t.destroy())}onUpdateMipmaps(e){this._mipmapGenerator||(this._mipmapGenerator=new ym(this._gpu.device));let t=this.getGpuSource(e);this._mipmapGenerator.generateMipmap(t)}onSourceDestroy(e){e.off("update",this.onSourceUpdate,this),e.off("unload",this.onSourceUnload,this),e.off("destroy",this.onSourceDestroy,this),e.off("resize",this.onSourceResize,this),e.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(e),1),this.onSourceUnload(e)}onSourceResize(e){let t=this._gpuSources[e.uid];t?(t.width!==e.pixelWidth||t.height!==e.pixelHeight)&&(this._textureViewHash[e.uid]=null,this._bindGroupHash[e.uid]=null,this.onSourceUnload(e),this.initSource(e)):this.initSource(e)}_initSampler(e){return this._gpuSamplers[e._resourceId]=this._gpu.device.createSampler(e),this._gpuSamplers[e._resourceId]}getGpuSampler(e){return this._gpuSamplers[e._resourceId]||this._initSampler(e)}getGpuSource(e){return this._gpuSources[e.uid]||this.initSource(e)}getTextureBindGroup(e){return this._bindGroupHash[e.uid]??this._createTextureBindGroup(e)}_createTextureBindGroup(e){let t=e.source;return this._bindGroupHash[e.uid]=new Vr({0:t,1:t.style,2:new Jt({uTextureMatrix:{type:"mat3x3",value:e.textureMatrix.mapCoord}})}),this._bindGroupHash[e.uid]}getTextureView(e){let t=e.source;return this._textureViewHash[t.uid]??this._createTextureView(t)}_createTextureView(e){return this._textureViewHash[e.uid]=this.getGpuSource(e).createView(),this._textureViewHash[e.uid]}generateCanvas(e){let t=this._renderer,r=t.gpu.device.createCommandEncoder(),i=yt.get().createCanvas();i.width=e.source.pixelWidth,i.height=e.source.pixelHeight;let n=i.getContext("webgpu");return n.configure({device:t.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:yt.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),r.copyTextureToTexture({texture:t.texture.getGpuSource(e.source),origin:{x:0,y:0}},{texture:n.getCurrentTexture()},{width:i.width,height:i.height}),t.gpu.device.queue.submit([r.finish()]),i}getPixels(e){let t=this.generateCanvas(e),r=$r.getOptimalCanvasAndContext(t.width,t.height),i=r.context;i.drawImage(t,0,0);let{width:n,height:s}=t,a=i.getImageData(0,0,n,s),o=new Uint8ClampedArray(a.data.buffer);return $r.returnCanvasAndContext(r),{pixels:o,width:n,height:s}}destroy(){this.managedTextures.slice().forEach(e=>this.onSourceDestroy(e)),this.managedTextures=null;for(let e of Object.keys(this._bindGroupHash)){let t=Number(e);this._bindGroupHash[t]?.destroy(),this._bindGroupHash[t]=null}this._gpu=null,this._mipmapGenerator=null,this._gpuSources=null,this._bindGroupHash=null,this._textureViewHash=null,this._gpuSamplers=null}},Ru.extension={type:[I.WebGPUSystem],name:"texture"}}),xm={};$e(xm,{WebGPURenderer:()=>Sm});var bm,wm,Tm,ku,Bu,Iu,Sm,ww=_(()=>{re(),a1(),o1(),l1(),Ya(),Qg(),li(),V1(),W1(),j1(),$1(),X1(),Y1(),ew(),rw(),aw(),fw(),pw(),mw(),bw(),bm=[...cu,xu,mu,so,pu,Ru,Eu,Cu,Au,Tu,gu,_u,fu],wm=[...du,wu],Tm=[Vh,zh,Hh],ku=[],Bu=[],Iu=[],fe.handleByNamedList(I.WebGPUSystem,ku),fe.handleByNamedList(I.WebGPUPipes,Bu),fe.handleByNamedList(I.WebGPUPipesAdaptor,Iu),fe.add(...bm,...wm,...Tm),Sm=class extends ms{constructor(){let e={name:"webgpu",type:Sr.WEBGPU,systems:ku,renderPipes:Bu,renderPipeAdaptors:Iu};super(e)}}}),Gu,Tw=_(()=>{re(),Ze(),dn(),Wi(),ma(),ya(),ds(),ji(),jl(),Wr(),dr(),Gu=class{init(){let e=new Jt({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uTransformMatrix:{value:new _e,type:"mat3x3"},uRound:{value:0,type:"f32"}}),t=cn(),r=Qn({name:"graphics",bits:[ga,Nl(t),$a,bn]});this.shader=new Rr({glProgram:r,resources:{localUniforms:e,batchSamplers:Vl(t)}})}execute(e,t){let r=t.context,i=r.customShader||this.shader,n=e.renderer,s=n.graphicsContext,{batcher:a,instructions:o}=s.getContextRenderData(r);i.groups[0]=n.globalUniforms.bindGroup,n.state.set(e.state),n.shader.bind(i),n.geometry.bind(a.geometry,i.glProgram);let l=o.instructions;for(let h=0;h{re(),Ze(),Wi(),ds(),ji(),bg(),Wr(),mt(),Fe(),Ou=class{init(){let e=Qn({name:"mesh",bits:[$a,xg,bn]});this._shader=new Rr({glProgram:e,resources:{uTexture:Ie.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3",value:new _e}}}})}execute(e,t){let r=e.renderer,i=t._shader;if(i){if(!i.glProgram){ge("Mesh shader has no glProgram",t.shader);return}}else{i=this._shader;let n=t.texture,s=n.source;i.resources.uTexture=s,i.resources.uSampler=s.style,i.resources.textureUniforms.uniforms.uTextureMatrix=n.textureMatrix.mapCoord}i.groups[100]=r.globalUniforms.bindGroup,i.groups[101]=e.localUniformsBindGroup,r.encoder.draw({geometry:t._geometry,shader:i,state:t.state})}destroy(){this._shader.destroy(!0),this._shader=null}},Ou.extension={type:[I.WebGLPipesAdaptor],name:"mesh"}}),Du,Ew=_(()=>{re(),jr(),Du=class{constructor(){this._didUpload=!1,this._tempState=Er.for2d()}init(e){e.renderer.runners.contextChange.add(this)}contextChange(){this._didUpload=!1}start(e,t,r){let i=e.renderer;i.shader.bind(r,this._didUpload),i.shader.updateUniformGroup(i.globalUniforms.uniformGroup),i.geometry.bind(t,r.glProgram)}execute(e,t){let r=e.renderer;this._didUpload=!0,this._tempState.blendMode=t.blendMode,r.state.set(this._tempState);let i=t.textures.textures;for(let n=0;n{"use strict";xs=(e=>(e[e.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",e[e.ARRAY_BUFFER=34962]="ARRAY_BUFFER",e[e.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",e))(xs||{})}),Em,Aw=_(()=>{"use strict";Em=class{constructor(e,t){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.type=t}}}),Uu,Mw=_(()=>{re(),Si(),Cw(),Aw(),Uu=class{constructor(e){this._gpuBuffers=Object.create(null),this._boundBufferBases=Object.create(null),this._minBaseLocation=0,this._nextBindBaseIndex=this._minBaseLocation,this._bindCallId=0,this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_gpuBuffers")}destroy(){this._renderer=null,this._gl=null,this._gpuBuffers=null,this._boundBufferBases=null}contextChange(){let e=this._gl=this._renderer.gl;this._gpuBuffers=Object.create(null),this._maxBindings=e.MAX_UNIFORM_BUFFER_BINDINGS?e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS):0}getGlBuffer(e){return this._gpuBuffers[e.uid]||this.createGLBuffer(e)}bind(e){let{_gl:t}=this,r=this.getGlBuffer(e);t.bindBuffer(r.type,r.buffer)}bindBufferBase(e,t){let{_gl:r}=this;this._boundBufferBases[t]!==e&&(this._boundBufferBases[t]=e,e._lastBindBaseLocation=t,r.bindBufferBase(r.UNIFORM_BUFFER,t,e.buffer))}nextBindBase(e){this._bindCallId++,this._minBaseLocation=0,e&&(this._boundBufferBases[0]=null,this._minBaseLocation=1,this._nextBindBaseIndex<1&&(this._nextBindBaseIndex=1))}freeLocationForBufferBase(e){let t=this.getLastBindBaseLocation(e);if(t>=this._minBaseLocation)return e._lastBindCallId=this._bindCallId,t;let r=0,i=this._nextBindBaseIndex;for(;r<2;){i>=this._maxBindings&&(i=this._minBaseLocation,r++);let n=this._boundBufferBases[i];if(n&&n._lastBindCallId===this._bindCallId){i++;continue}break}return t=i,this._nextBindBaseIndex=i+1,r>=2?-1:(e._lastBindCallId=this._bindCallId,this._boundBufferBases[t]=null,t)}getLastBindBaseLocation(e){let t=e._lastBindBaseLocation;return this._boundBufferBases[t]===e?t:-1}bindBufferRange(e,t,r,i){let{_gl:n}=this;r||(r=0),t||(t=0),this._boundBufferBases[t]=null,n.bindBufferRange(n.UNIFORM_BUFFER,t||0,e.buffer,r*256,i||256)}updateBuffer(e){let{_gl:t}=this,r=this.getGlBuffer(e);if(e._updateID===r.updateID)return r;r.updateID=e._updateID,t.bindBuffer(r.type,r.buffer);let i=e.data,n=e.descriptor.usage&Je.STATIC?t.STATIC_DRAW:t.DYNAMIC_DRAW;return i?r.byteLength>=i.byteLength?t.bufferSubData(r.type,0,i,0,e._updateSize/i.BYTES_PER_ELEMENT):(r.byteLength=i.byteLength,t.bufferData(r.type,i,n)):(r.byteLength=e.descriptor.size,t.bufferData(r.type,r.byteLength,n)),r}destroyAll(){let e=this._gl;for(let t in this._gpuBuffers)e.deleteBuffer(this._gpuBuffers[t].buffer);this._gpuBuffers=Object.create(null)}onBufferDestroy(e,t){let r=this._gpuBuffers[e.uid],i=this._gl;t||i.deleteBuffer(r.buffer),this._gpuBuffers[e.uid]=null}createGLBuffer(e){let{_gl:t}=this,r=xs.ARRAY_BUFFER;e.descriptor.usage&Je.INDEX?r=xs.ELEMENT_ARRAY_BUFFER:e.descriptor.usage&Je.UNIFORM&&(r=xs.UNIFORM_BUFFER);let i=new Em(t.createBuffer(),r);return this._gpuBuffers[e.uid]=i,e.on("destroy",this.onBufferDestroy,this),i}},Uu.extension={type:[I.WebGLSystem],name:"buffer"}}),oo,Cm,Pw=_(()=>{Ht(),re(),Fe(),oo=class Zv{constructor(t){this.supports={uint32Indices:!0,uniformBufferObject:!0,vertexArrayObject:!0,srgbTextures:!0,nonPowOf2wrapping:!0,msaa:!0,nonPowOf2mipmaps:!0},this._renderer=t,this.extensions=Object.create(null),this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(t){this.gl=t,this._renderer.gl=t}init(t){t={...Zv.defaultOptions,...t};let r=this.multiView=t.multiView;if(t.context&&r&&(ge("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),r=!1),r?this.canvas=yt.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,t.context)this.initFromContext(t.context);else{let i=this._renderer.background.alpha<1,n=t.premultipliedAlpha??!0,s=t.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(t.preferWebGLVersion,{alpha:i,premultipliedAlpha:n,antialias:s,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference??"default"})}}ensureCanvasSize(t){if(!this.multiView){t!==this.canvas&&ge("multiView is disabled, but targetCanvas is not the main canvas");return}let{canvas:r}=this;(r.width{this.gl.isContextLost()&&this.extensions.loseContext?.restoreContext()},0))}handleContextRestored(){this._renderer.runners.contextChange.emit(this.gl)}destroy(){let t=this._renderer.view.canvas;this._renderer=null,t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext?.loseContext()}forceContextLoss(){this.extensions.loseContext?.loseContext(),this._contextLossForced=!0}validateContext(t){let r=t.getContextAttributes();r&&!r.stencil&&ge("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let i=this.supports,n=this.webGLVersion===2,s=this.extensions;i.uint32Indices=n||!!s.uint32ElementIndex,i.uniformBufferObject=n,i.vertexArrayObject=n||!!s.vertexArrayObject,i.srgbTextures=n||!!s.srgb,i.nonPowOf2wrapping=n,i.nonPowOf2mipmaps=n,i.msaa=n,i.uint32Indices||ge("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}},oo.extension={type:[I.WebGLSystem],name:"context"},oo.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1},Cm=oo}),lo,Fu,rt,Am=_(()=>{"use strict";lo=(e=>(e[e.RGBA=6408]="RGBA",e[e.RGB=6407]="RGB",e[e.RG=33319]="RG",e[e.RED=6403]="RED",e[e.RGBA_INTEGER=36249]="RGBA_INTEGER",e[e.RGB_INTEGER=36248]="RGB_INTEGER",e[e.RG_INTEGER=33320]="RG_INTEGER",e[e.RED_INTEGER=36244]="RED_INTEGER",e[e.ALPHA=6406]="ALPHA",e[e.LUMINANCE=6409]="LUMINANCE",e[e.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",e[e.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",e[e.DEPTH_STENCIL=34041]="DEPTH_STENCIL",e))(lo||{}),Fu=(e=>(e[e.TEXTURE_2D=3553]="TEXTURE_2D",e[e.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",e[e.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",e[e.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",e[e.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",e[e.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",e[e.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",e))(Fu||{}),rt=(e=>(e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",e[e.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",e[e.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",e[e.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",e[e.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",e[e.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",e[e.BYTE=5120]="BYTE",e[e.SHORT=5122]="SHORT",e[e.INT=5124]="INT",e[e.FLOAT=5126]="FLOAT",e[e.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",e[e.HALF_FLOAT=36193]="HALF_FLOAT",e))(rt||{})});function Rw(e){return Lu[e]??Lu.float32}var Lu,kw=_(()=>{Am(),Lu={uint8x2:rt.UNSIGNED_BYTE,uint8x4:rt.UNSIGNED_BYTE,sint8x2:rt.BYTE,sint8x4:rt.BYTE,unorm8x2:rt.UNSIGNED_BYTE,unorm8x4:rt.UNSIGNED_BYTE,snorm8x2:rt.BYTE,snorm8x4:rt.BYTE,uint16x2:rt.UNSIGNED_SHORT,uint16x4:rt.UNSIGNED_SHORT,sint16x2:rt.SHORT,sint16x4:rt.SHORT,unorm16x2:rt.UNSIGNED_SHORT,unorm16x4:rt.UNSIGNED_SHORT,snorm16x2:rt.SHORT,snorm16x4:rt.SHORT,float16x2:rt.HALF_FLOAT,float16x4:rt.HALF_FLOAT,float32:rt.FLOAT,float32x2:rt.FLOAT,float32x3:rt.FLOAT,float32x4:rt.FLOAT,uint32:rt.UNSIGNED_INT,uint32x2:rt.UNSIGNED_INT,uint32x3:rt.UNSIGNED_INT,uint32x4:rt.UNSIGNED_INT,sint32:rt.INT,sint32x2:rt.INT,sint32x3:rt.INT,sint32x4:rt.INT}}),Mm,Nu,Bw=_(()=>{re(),_n(),lm(),kw(),Mm={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5},Nu=class{constructor(e){this._geometryVaoHash=Object.create(null),this._renderer=e,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this._renderer.renderableGC.addManagedHash(this,"_geometryVaoHash")}contextChange(){let e=this.gl=this._renderer.gl;if(!this._renderer.context.supports.vertexArrayObject)throw new Error("[PixiJS] Vertex Array Objects are not supported on this device");let t=this._renderer.context.extensions.vertexArrayObject;t&&(e.createVertexArray=()=>t.createVertexArrayOES(),e.bindVertexArray=i=>t.bindVertexArrayOES(i),e.deleteVertexArray=i=>t.deleteVertexArrayOES(i));let r=this._renderer.context.extensions.vertexAttribDivisorANGLE;r&&(e.drawArraysInstanced=(i,n,s,a)=>{r.drawArraysInstancedANGLE(i,n,s,a)},e.drawElementsInstanced=(i,n,s,a,o)=>{r.drawElementsInstancedANGLE(i,n,s,a,o)},e.vertexAttribDivisor=(i,n)=>r.vertexAttribDivisorANGLE(i,n)),this._activeGeometry=null,this._activeVao=null,this._geometryVaoHash=Object.create(null)}bind(e,t){let r=this.gl;this._activeGeometry=e;let i=this.getVao(e,t);this._activeVao!==i&&(this._activeVao=i,r.bindVertexArray(i)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){let e=this._activeGeometry,t=this._renderer.buffer;for(let r=0;r1?n.drawElementsInstanced(a,t||s.indexBuffer.data.length,l,(r||0)*o,i):n.drawElements(a,t||s.indexBuffer.data.length,l,(r||0)*o)}else i>1?n.drawArraysInstanced(a,r||0,t||s.getSize(),i):n.drawArrays(a,r||0,t||s.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this._renderer=null,this.gl=null,this._activeVao=null,this._activeGeometry=null}},Nu.extension={type:[I.WebGLSystem],name:"geometry"}}),Pm,ho,Rm,Iw=_(()=>{re(),Fe(),Yn(),Wr(),jr(),vr(),mt(),mn(),Pm=new gn({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),ho=class Qv{constructor(t){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=t}init(t={}){let{useBackBuffer:r,antialias:i}={...Qv.defaultOptions,...t};this.useBackBuffer=r,this._antialias=i,this._renderer.context.supports.msaa||(ge("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=Er.for2d();let n=new Vi({vertex:` attribute vec2 aPosition; out vec2 vUv; void main() { gl_Position = vec4(aPosition, 0.0, 1.0); vUv = (aPosition + 1.0) / 2.0; // flip dem UVs vUv.y = 1.0 - vUv.y; }`,fragment:` in vec2 vUv; out vec4 finalColor; uniform sampler2D uTexture; void main() { finalColor = texture(uTexture, vUv); }`,name:"big-triangle"});this._bigTriangleShader=new Rr({glProgram:n,resources:{uTexture:Ie.WHITE.source}})}renderStart(t){let r=this._renderer.renderTarget.getRenderTarget(t.target);if(this._useBackBufferThisRender=this.useBackBuffer&&!!r.isRoot,this._useBackBufferThisRender){let i=this._renderer.renderTarget.getRenderTarget(t.target);this._targetTexture=i.colorTexture,t.target=this._getBackBufferTexture(i.colorTexture)}}renderEnd(){this._presentBackBuffer()}_presentBackBuffer(){let t=this._renderer;t.renderTarget.finishRenderPass(),this._useBackBufferThisRender&&(t.renderTarget.bind(this._targetTexture,!1),this._bigTriangleShader.resources.uTexture=this._backBufferTexture.source,t.encoder.draw({geometry:Pm,shader:this._bigTriangleShader,state:this._state}))}_getBackBufferTexture(t){return this._backBufferTexture=this._backBufferTexture||new Ie({source:new Nt({width:t.width,height:t.height,resolution:t._resolution,antialias:this._antialias})}),this._backBufferTexture.source.resize(t.width,t.height,t._resolution),this._backBufferTexture}destroy(){this._backBufferTexture&&(this._backBufferTexture.destroy(),this._backBufferTexture=null)}},ho.extension={type:[I.WebGLSystem],name:"backBuffer",priority:1},ho.defaultOptions={useBackBuffer:!1},Rm=ho}),Hu,Gw=_(()=>{re(),Hu=class{constructor(e){this._colorMaskCache=15,this._renderer=e}setMask(e){this._colorMaskCache!==e&&(this._colorMaskCache=e,this._renderer.gl.colorMask(!!(e&8),!!(e&4),!!(e&2),!!(e&1)))}},Hu.extension={type:[I.WebGLSystem],name:"colorMask"}}),zu,Ow=_(()=>{re(),zu=class{constructor(e){this.commandFinished=Promise.resolve(),this._renderer=e}setGeometry(e,t){this._renderer.geometry.bind(e,t.glProgram)}finishRenderPass(){}draw(e){let t=this._renderer,{geometry:r,shader:i,state:n,skipSync:s,topology:a,size:o,start:l,instanceCount:h}=e;t.shader.bind(i,s),t.geometry.bind(r,t.shader._activeProgram),n&&t.state.set(n),t.geometry.draw(a,o,l,h??r.instanceCount)}destroy(){this._renderer=null}},zu.extension={type:[I.WebGLSystem],name:"encoder"}}),Vu,Dw=_(()=>{re(),hm(),fn(),Vu=class{constructor(e){this._stencilCache={enabled:!1,stencilReference:0,stencilMode:Mt.NONE},this._renderTargetStencilState=Object.create(null),e.renderTarget.onRenderTargetChange.add(this)}contextChange(e){this._gl=e,this._comparisonFuncMapping={always:e.ALWAYS,never:e.NEVER,equal:e.EQUAL,"not-equal":e.NOTEQUAL,less:e.LESS,"less-equal":e.LEQUAL,greater:e.GREATER,"greater-equal":e.GEQUAL},this._stencilOpsMapping={keep:e.KEEP,zero:e.ZERO,replace:e.REPLACE,invert:e.INVERT,"increment-clamp":e.INCR,"decrement-clamp":e.DECR,"increment-wrap":e.INCR_WRAP,"decrement-wrap":e.DECR_WRAP},this._stencilCache.enabled=!1,this._stencilCache.stencilMode=Mt.NONE,this._stencilCache.stencilReference=0}onRenderTargetChange(e){if(this._activeRenderTarget===e)return;this._activeRenderTarget=e;let t=this._renderTargetStencilState[e.uid];t||(t=this._renderTargetStencilState[e.uid]={stencilMode:Mt.DISABLED,stencilReference:0}),this.setStencilMode(t.stencilMode,t.stencilReference)}setStencilMode(e,t){let r=this._renderTargetStencilState[this._activeRenderTarget.uid],i=this._gl,n=ui[e],s=this._stencilCache;if(r.stencilMode=e,r.stencilReference=t,e===Mt.DISABLED){this._stencilCache.enabled&&(this._stencilCache.enabled=!1,i.disable(i.STENCIL_TEST));return}this._stencilCache.enabled||(this._stencilCache.enabled=!0,i.enable(i.STENCIL_TEST)),(e!==s.stencilMode||s.stencilReference!==t)&&(s.stencilMode=e,s.stencilReference=t,i.stencilFunc(this._comparisonFuncMapping[n.stencilBack.compare],t,255),i.stencilOp(i.KEEP,i.KEEP,this._stencilOpsMapping[n.stencilBack.passOp]))}},Vu.extension={type:[I.WebGLSystem],name:"stencil"}});function Uw(e){let t=e.map(s=>({data:s,offset:0,size:0})),r=16,i=0,n=0;for(let s=0;s1&&(i=Math.max(i,r)*a.data.size);let o=i===12?16:i;a.size=i;let l=n%r;l>0&&r-l{"use strict";Wu={f32:4,i32:4,"vec2":8,"vec3":12,"vec4":16,"vec2":8,"vec3":12,"vec4":16,"mat2x2":32,"mat3x3":48,"mat4x4":64}});function Fw(e,t){let r=Math.max(Wu[e.data.type]/16,1),i=e.data.value.length/e.data.size,n=(4-i%4)%4,s=e.data.type.indexOf("i32")>=0?"dataInt32":"data";return` v = uv.${e.data.name}; offset += ${t}; arrayOffset = offset; t = 0; for(var i=0; i < ${e.data.size*r}; i++) { for(var j = 0; j < ${i}; j++) { ${s}[arrayOffset++] = v[t++]; } ${n!==0?`arrayOffset += ${n};`:""} } `}var Lw=_(()=>{km()});function Nw(e){return rm(e,"uboStd40",Fw,yu)}var Hw=_(()=>{im(),sm(),Lw()}),ju,zw=_(()=>{re(),Jg(),km(),Hw(),ju=class extends vu{constructor(){super({createUboElements:Uw,generateUboSync:Nw})}},ju.extension={type:[I.WebGLSystem],name:"ubo"}}),Bm,Vw=_(()=>{"use strict";Bm=class{constructor(){this.width=-1,this.height=-1,this.msaa=!1,this.msaaRenderBuffer=[]}}}),Im,Ww=_(()=>{E(),Fe(),Wn(),gs(),Vw(),Im=class{constructor(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new b}init(e,t){this._renderer=e,this._renderTargetSystem=t,e.runners.contextChange.add(this)}contextChange(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new b}copyToTexture(e,t,r,i,n){let s=this._renderTargetSystem,a=this._renderer,o=s.getGpuRenderTarget(e),l=a.gl;return this.finishRenderPass(e),l.bindFramebuffer(l.FRAMEBUFFER,o.resolveTargetFramebuffer),a.texture.bind(t,0),l.copyTexSubImage2D(l.TEXTURE_2D,0,n.x,n.y,r.x,r.y,i.width,i.height),t}startRenderPass(e,t=!0,r,i){let n=this._renderTargetSystem,s=e.colorTexture,a=n.getGpuRenderTarget(e),o=i.y;e.isRoot&&(o=s.pixelHeight-i.height),e.colorTextures.forEach(u=>{this._renderer.texture.unbind(u)});let l=this._renderer.gl;l.bindFramebuffer(l.FRAMEBUFFER,a.framebuffer);let h=this._viewPortCache;(h.x!==i.x||h.y!==o||h.width!==i.width||h.height!==i.height)&&(h.x=i.x,h.y=o,h.width=i.width,h.height=i.height,l.viewport(i.x,o,i.width,i.height)),!a.depthStencilRenderBuffer&&(e.stencil||e.depth)&&this._initStencil(a),this.clear(e,t,r)}finishRenderPass(e){let t=this._renderTargetSystem.getGpuRenderTarget(e);if(!t.msaa)return;let r=this._renderer.gl;r.bindFramebuffer(r.FRAMEBUFFER,t.resolveTargetFramebuffer),r.bindFramebuffer(r.READ_FRAMEBUFFER,t.framebuffer),r.blitFramebuffer(0,0,t.width,t.height,0,0,t.width,t.height,r.COLOR_BUFFER_BIT,r.NEAREST),r.bindFramebuffer(r.FRAMEBUFFER,t.framebuffer)}initGpuRenderTarget(e){let t=this._renderer,r=t.gl,i=new Bm;return e.colorTexture.resource===t.canvas?(this._renderer.context.ensureCanvasSize(e.colorTexture.resource),i.framebuffer=null,i):(this._initColor(e,i),r.bindFramebuffer(r.FRAMEBUFFER,null),i)}destroyGpuRenderTarget(e){let t=this._renderer.gl;e.framebuffer&&(t.deleteFramebuffer(e.framebuffer),e.framebuffer=null),e.resolveTargetFramebuffer&&(t.deleteFramebuffer(e.resolveTargetFramebuffer),e.resolveTargetFramebuffer=null),e.depthStencilRenderBuffer&&(t.deleteRenderbuffer(e.depthStencilRenderBuffer),e.depthStencilRenderBuffer=null),e.msaaRenderBuffer.forEach(r=>{t.deleteRenderbuffer(r)}),e.msaaRenderBuffer=null}clear(e,t,r){if(!t)return;let i=this._renderTargetSystem;typeof t=="boolean"&&(t=t?fr.ALL:fr.NONE);let n=this._renderer.gl;if(t&fr.COLOR){r??(r=i.defaultClearColor);let s=this._clearColorCache,a=r;(s[0]!==a[0]||s[1]!==a[1]||s[2]!==a[2]||s[3]!==a[3])&&(s[0]=a[0],s[1]=a[1],s[2]=a[2],s[3]=a[3],n.clearColor(a[0],a[1],a[2],a[3]))}n.clear(t)}resizeGpuRenderTarget(e){if(e.isRoot)return;let t=this._renderTargetSystem.getGpuRenderTarget(e);this._resizeColor(e,t),(e.stencil||e.depth)&&this._resizeStencil(t)}_initColor(e,t){let r=this._renderer,i=r.gl,n=i.createFramebuffer();if(t.resolveTargetFramebuffer=n,i.bindFramebuffer(i.FRAMEBUFFER,n),t.width=e.colorTexture.source.pixelWidth,t.height=e.colorTexture.source.pixelHeight,e.colorTextures.forEach((s,a)=>{let o=s.source;o.antialias&&(r.context.supports.msaa?t.msaa=!0:ge("[RenderTexture] Antialiasing on textures is not supported in WebGL1")),r.texture.bindSource(o,0);let l=r.texture.getGlSource(o).texture;i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+a,3553,l,0)}),t.msaa){let s=i.createFramebuffer();t.framebuffer=s,i.bindFramebuffer(i.FRAMEBUFFER,s),e.colorTextures.forEach((a,o)=>{let l=i.createRenderbuffer();t.msaaRenderBuffer[o]=l})}else t.framebuffer=n;this._resizeColor(e,t)}_resizeColor(e,t){let r=e.colorTexture.source;if(t.width=r.pixelWidth,t.height=r.pixelHeight,e.colorTextures.forEach((i,n)=>{n!==0&&i.source.resize(r.width,r.height,r._resolution)}),t.msaa){let i=this._renderer,n=i.gl,s=t.framebuffer;n.bindFramebuffer(n.FRAMEBUFFER,s),e.colorTextures.forEach((a,o)=>{let l=a.source;i.texture.bindSource(l,0);let h=i.texture.getGlSource(l).internalFormat,u=t.msaaRenderBuffer[o];n.bindRenderbuffer(n.RENDERBUFFER,u),n.renderbufferStorageMultisample(n.RENDERBUFFER,4,h,l.pixelWidth,l.pixelHeight),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+o,n.RENDERBUFFER,u)})}}_initStencil(e){if(e.framebuffer===null)return;let t=this._renderer.gl,r=t.createRenderbuffer();e.depthStencilRenderBuffer=r,t.bindRenderbuffer(t.RENDERBUFFER,r),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,r),this._resizeStencil(e)}_resizeStencil(e){let t=this._renderer.gl;t.bindRenderbuffer(t.RENDERBUFFER,e.depthStencilRenderBuffer),e.msaa?t.renderbufferStorageMultisample(t.RENDERBUFFER,4,t.DEPTH24_STENCIL8,e.width,e.height):t.renderbufferStorage(t.RENDERBUFFER,this._renderer.context.webGLVersion===2?t.DEPTH24_STENCIL8:t.DEPTH_STENCIL,e.width,e.height)}prerender(e){let t=e.colorTexture.resource;this._renderer.context.multiView&&oi.test(t)&&this._renderer.context.ensureCanvasSize(t)}postrender(e){if(this._renderer.context.multiView&&oi.test(e.colorTexture.resource)){let t=this._renderer.context.canvas,r=e.colorTexture;r.context2D.drawImage(t,0,r.pixelHeight-t.height)}}}}),$u,jw=_(()=>{re(),cm(),Ww(),$u=class extends Su{constructor(e){super(e),this.adaptor=new Im,this.adaptor.init(e,this)}},$u.extension={type:[I.WebGLSystem],name:"renderTarget"}});function $w(e,t){let r=[],i=[` var g = s.groups; var sS = r.shader; var p = s.glProgram; var ugS = r.uniformGroup; var resources; `],n=!1,s=0,a=t._getProgramData(e.glProgram);for(let l in e.groups){let h=e.groups[l];r.push(` resources = g[${l}].resources; `);for(let u in h.resources){let c=h.resources[u];if(c instanceof Jt)if(c.ubo){let f=e._uniformBindMap[l][Number(u)];r.push(` sS.bindUniformBlock( resources[${u}], '${f}', ${e.glProgram._uniformBlockData[f].index} ); `)}else r.push(` ugS.updateUniformGroup(resources[${u}], p, sD); `);else if(c instanceof ao){let f=e._uniformBindMap[l][Number(u)];r.push(` sS.bindUniformBlock( resources[${u}], '${f}', ${e.glProgram._uniformBlockData[f].index} ); `)}else if(c instanceof Nt){let f=e._uniformBindMap[l][u],d=a.uniformData[f];d&&(n||(n=!0,i.push(` var tS = r.texture; `)),t._gl.uniform1i(d.location,s),r.push(` tS.bind(resources[${u}], ${s}); `),s++)}}}let o=[...i,...r].join(` `);return new Function("r","s","sD",o)}var Xw=_(()=>{bu(),dr(),vr()}),Gm,Yw=_(()=>{"use strict";Gm=class{constructor(e,t){this.program=e,this.uniformData=t,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBlockBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBlockBindings=null,this.program=null}}});function Om(e,t,r){let i=e.createShader(t);return e.shaderSource(i,r),e.compileShader(i),i}var qw=_(()=>{"use strict"});function Xu(e){let t=new Array(e);for(let r=0;r{"use strict"});function Fm(e,t){if(!bs){let r=Object.keys(Yu);bs={};for(let i=0;i{"use strict";bs=null,Yu={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"},Lm={float:"float32",vec2:"float32x2",vec3:"float32x3",vec4:"float32x4",int:"sint32",ivec2:"sint32x2",ivec3:"sint32x3",ivec4:"sint32x4",uint:"uint32",uvec2:"uint32x2",uvec3:"uint32x3",uvec4:"uint32x4",bool:"uint32",bvec2:"uint32x2",bvec3:"uint32x3",bvec4:"uint32x4"}});function Zw(e,t,r=!1){let i={},n=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let a=0;aa>o?1:-1);for(let a=0;a{_n(),Nm()});function Jw(e,t){if(!t.ACTIVE_UNIFORM_BLOCKS)return{};let r={},i=t.getProgramParameter(e,t.ACTIVE_UNIFORM_BLOCKS);for(let n=0;n{"use strict"});function tT(e,t){let r={},i=t.getProgramParameter(e,t.ACTIVE_UNIFORMS);for(let n=0;n{Um(),Nm()});function Hm(e,t){let r=e.getShaderSource(t).split(` `).map((h,u)=>`${u}: ${h}`),i=e.getShaderInfoLog(t),n=i.split(` `),s={},a=n.map(h=>parseFloat(h.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(h=>h&&!s[h]?(s[h]=!0,!0):!1),o=[""];a.forEach(h=>{r[h-1]=`%c${r[h-1]}%c`,o.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});let l=r.join(` `);o[0]=l,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...o),console.groupEnd()}function iT(e,t,r,i){e.getProgramParameter(t,e.LINK_STATUS)||(e.getShaderParameter(r,e.COMPILE_STATUS)||Hm(e,r),e.getShaderParameter(i,e.COMPILE_STATUS)||Hm(e,i),console.error("PixiJS Error: Could not initialize shader."),e.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",e.getProgramInfoLog(t)))}var nT=_(()=>{"use strict"});function sT(e,t){let r=Om(e,e.VERTEX_SHADER,t.vertex),i=Om(e,e.FRAGMENT_SHADER,t.fragment),n=e.createProgram();e.attachShader(n,r),e.attachShader(n,i);let s=t.transformFeedbackVaryings;s&&(typeof e.transformFeedbackVaryings!="function"?ge("TransformFeedback is not supported but TransformFeedbackVaryings are given."):e.transformFeedbackVaryings(n,s.names,s.bufferMode==="separate"?e.SEPARATE_ATTRIBS:e.INTERLEAVED_ATTRIBS)),e.linkProgram(n),e.getProgramParameter(n,e.LINK_STATUS)||iT(e,n,r,i),t._attributeData=Zw(n,e,!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertex)),t._uniformData=tT(n,e),t._uniformBlockData=Jw(n,e),e.deleteShader(r),e.deleteShader(i);let a={};for(let o in t._uniformData){let l=t._uniformData[o];a[o]={location:e.getUniformLocation(n,o),value:Dm(l.type,l.size)}}return new Gm(n,a)}var aT=_(()=>{Fe(),Yw(),qw(),Um(),Qw(),eT(),rT(),nT()}),ws,qu,oT=_(()=>{re(),dn(),Xw(),aT(),ws={textureCount:0,blockIndex:0},qu=class{constructor(e){this._activeProgram=null,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_programDataHash")}contextChange(e){this._gl=e,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._activeProgram=null,this.maxTextures=cn()}bind(e,t){if(this._setProgram(e.glProgram),t)return;ws.textureCount=0,ws.blockIndex=0;let r=this._shaderSyncFunctions[e.glProgram._key];r||(r=this._shaderSyncFunctions[e.glProgram._key]=this._generateShaderSync(e,this)),this._renderer.buffer.nextBindBase(!!e.glProgram.transformFeedbackVaryings),r(this._renderer,e,ws)}updateUniformGroup(e){this._renderer.uniformGroup.updateUniformGroup(e,this._activeProgram,ws)}bindUniformBlock(e,t,r=0){let i=this._renderer.buffer,n=this._getProgramData(this._activeProgram),s=e._bufferResource;s||this._renderer.ubo.updateUniformGroup(e);let a=e.buffer,o=i.updateBuffer(a),l=i.freeLocationForBufferBase(o);if(s){let{offset:u,size:c}=e;u===0&&c===a.data.byteLength?i.bindBufferBase(o,l):i.bindBufferRange(o,l,u)}else i.getLastBindBaseLocation(o)!==l&&i.bindBufferBase(o,l);let h=this._activeProgram._uniformBlockData[t].index;n.uniformBlockBindings[r]!==l&&(n.uniformBlockBindings[r]=l,this._renderer.gl.uniformBlockBinding(n.program,h,l))}_setProgram(e){if(this._activeProgram===e)return;this._activeProgram=e;let t=this._getProgramData(e);this._gl.useProgram(t.program)}_getProgramData(e){return this._programDataHash[e._key]||this._createProgramData(e)}_createProgramData(e){let t=e._key;return this._programDataHash[t]=sT(this._gl,e),this._programDataHash[t]}destroy(){for(let e of Object.keys(this._programDataHash))this._programDataHash[e].destroy(),this._programDataHash[e]=null;this._programDataHash=null}_generateShaderSync(e,t){return $w(e,t)}},qu.extension={type:[I.WebGLSystem],name:"shader"}}),zm,Vm,lT=_(()=>{"use strict";zm={f32:`if (cv !== v) { cu.value = v; gl.uniform1f(location, v); }`,"vec2":`if (cv[0] !== v[0] || cv[1] !== v[1]) { cv[0] = v[0]; cv[1] = v[1]; gl.uniform2f(location, v[0], v[1]); }`,"vec3":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) { cv[0] = v[0]; cv[1] = v[1]; cv[2] = v[2]; gl.uniform3f(location, v[0], v[1], v[2]); }`,"vec4":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { cv[0] = v[0]; cv[1] = v[1]; cv[2] = v[2]; cv[3] = v[3]; gl.uniform4f(location, v[0], v[1], v[2], v[3]); }`,i32:`if (cv !== v) { cu.value = v; gl.uniform1i(location, v); }`,"vec2":`if (cv[0] !== v[0] || cv[1] !== v[1]) { cv[0] = v[0]; cv[1] = v[1]; gl.uniform2i(location, v[0], v[1]); }`,"vec3":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) { cv[0] = v[0]; cv[1] = v[1]; cv[2] = v[2]; gl.uniform3i(location, v[0], v[1], v[2]); }`,"vec4":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { cv[0] = v[0]; cv[1] = v[1]; cv[2] = v[2]; cv[3] = v[3]; gl.uniform4i(location, v[0], v[1], v[2], v[3]); }`,u32:`if (cv !== v) { cu.value = v; gl.uniform1ui(location, v); }`,"vec2":`if (cv[0] !== v[0] || cv[1] !== v[1]) { cv[0] = v[0]; cv[1] = v[1]; gl.uniform2ui(location, v[0], v[1]); }`,"vec3":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) { cv[0] = v[0]; cv[1] = v[1]; cv[2] = v[2]; gl.uniform3ui(location, v[0], v[1], v[2]); }`,"vec4":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { cv[0] = v[0]; cv[1] = v[1]; cv[2] = v[2]; cv[3] = v[3]; gl.uniform4ui(location, v[0], v[1], v[2], v[3]); }`,bool:`if (cv !== v) { cu.value = v; gl.uniform1i(location, v); }`,"vec2":`if (cv[0] !== v[0] || cv[1] !== v[1]) { cv[0] = v[0]; cv[1] = v[1]; gl.uniform2i(location, v[0], v[1]); }`,"vec3":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) { cv[0] = v[0]; cv[1] = v[1]; cv[2] = v[2]; gl.uniform3i(location, v[0], v[1], v[2]); }`,"vec4":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { cv[0] = v[0]; cv[1] = v[1]; cv[2] = v[2]; cv[3] = v[3]; gl.uniform4i(location, v[0], v[1], v[2], v[3]); }`,"mat2x2":"gl.uniformMatrix2fv(location, false, v);","mat3x3":"gl.uniformMatrix3fv(location, false, v);","mat4x4":"gl.uniformMatrix4fv(location, false, v);"},Vm={f32:"gl.uniform1fv(location, v);","vec2":"gl.uniform2fv(location, v);","vec3":"gl.uniform3fv(location, v);","vec4":"gl.uniform4fv(location, v);","mat2x2":"gl.uniformMatrix2fv(location, false, v);","mat3x3":"gl.uniformMatrix3fv(location, false, v);","mat4x4":"gl.uniformMatrix4fv(location, false, v);",i32:"gl.uniform1iv(location, v);","vec2":"gl.uniform2iv(location, v);","vec3":"gl.uniform3iv(location, v);","vec4":"gl.uniform4iv(location, v);",u32:"gl.uniform1iv(location, v);","vec2":"gl.uniform2iv(location, v);","vec3":"gl.uniform3iv(location, v);","vec4":"gl.uniform4iv(location, v);",bool:"gl.uniform1iv(location, v);","vec2":"gl.uniform2iv(location, v);","vec3":"gl.uniform3iv(location, v);","vec4":"gl.uniform4iv(location, v);"}});function hT(e,t){let r=[` var v = null; var cv = null; var cu = null; var t = 0; var gl = renderer.gl; var name = null; `];for(let i in e.uniforms){if(!t[i]){e.uniforms[i]instanceof Jt?e.uniforms[i].ubo?r.push(` renderer.shader.bindUniformBlock(uv.${i}, "${i}"); `):r.push(` renderer.shader.updateUniformGroup(uv.${i}); `):e.uniforms[i]instanceof ao&&r.push(` renderer.shader.bindBufferResource(uv.${i}, "${i}"); `);continue}let n=e.uniformStructures[i],s=!1;for(let a=0;a{bu(),dr(),tm(),lT()}),Ku,cT=_(()=>{re(),uT(),Ku=class{constructor(e){this._cache={},this._uniformGroupSyncHash={},this._renderer=e,this.gl=null,this._cache={}}contextChange(e){this.gl=e}updateUniformGroup(e,t,r){let i=this._renderer.shader._getProgramData(t);(!e.isStatic||e._dirtyId!==i.uniformDirtyGroups[e.uid])&&(i.uniformDirtyGroups[e.uid]=e._dirtyId,this._getUniformSyncFunction(e,t)(i.uniformData,e.uniforms,this._renderer,r))}_getUniformSyncFunction(e,t){return this._uniformGroupSyncHash[e._signature]?.[t._key]||this._createUniformSyncFunction(e,t)}_createUniformSyncFunction(e,t){let r=this._uniformGroupSyncHash[e._signature]||(this._uniformGroupSyncHash[e._signature]={}),i=this._getSignature(e,t._uniformData,"u");return this._cache[i]||(this._cache[i]=this._generateUniformsSync(e,t._uniformData)),r[t._key]=this._cache[i],r[t._key]}_generateUniformsSync(e,t){return hT(e,t)}_getSignature(e,t,r){let i=e.uniforms,n=[`${r}-`];for(let s in i)n.push(s),t[s]&&n.push(t[s].type);return n.join("-")}destroy(){this._renderer=null,this._cache=null}},Ku.extension={type:[I.WebGLSystem],name:"uniformGroup"}});function dT(e){let t={};if(t.normal=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t.add=[e.ONE,e.ONE],t.multiply=[e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA],t.screen=[e.ONE,e.ONE_MINUS_SRC_COLOR,e.ONE,e.ONE_MINUS_SRC_ALPHA],t.none=[0,0],t["normal-npm"]=[e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA],t["add-npm"]=[e.SRC_ALPHA,e.ONE,e.ONE,e.ONE],t["screen-npm"]=[e.SRC_ALPHA,e.ONE_MINUS_SRC_COLOR,e.ONE,e.ONE_MINUS_SRC_ALPHA],t.erase=[e.ZERO,e.ONE_MINUS_SRC_ALPHA],!(e instanceof yt.get().getWebGLRenderingContext()))t.min=[e.ONE,e.ONE,e.ONE,e.ONE,e.MIN,e.MIN],t.max=[e.ONE,e.ONE,e.ONE,e.ONE,e.MAX,e.MAX];else{let r=e.getExtension("EXT_blend_minmax");r&&(t.min=[e.ONE,e.ONE,e.ONE,e.ONE,r.MIN_EXT,r.MIN_EXT],t.max=[e.ONE,e.ONE,e.ONE,e.ONE,r.MAX_EXT,r.MAX_EXT])}return t}var fT=_(()=>{Ht()}),Wm,jm,$m,Xm,Ym,qm,Zu,Km,pT=_(()=>{re(),jr(),fT(),Wm=0,jm=1,$m=2,Xm=3,Ym=4,qm=5,Zu=class Dc{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[Wm]=this.setBlend,this.map[jm]=this.setOffset,this.map[$m]=this.setCullFace,this.map[Xm]=this.setDepthTest,this.map[Ym]=this.setFrontFace,this.map[qm]=this.setDepthMask,this.checks=[],this.defaultState=Er.for2d()}contextChange(t){this.gl=t,this.blendModesMap=dT(t),this.reset()}set(t){if(t||(t=this.defaultState),this.stateId!==t.data){let r=this.stateId^t.data,i=0;for(;r;)r&1&&this.map[i].call(this,!!(t.data&1<>=1,i++;this.stateId=t.data}for(let r=0;r{Am(),Zm=class{constructor(e){this.target=Fu.TEXTURE_2D,this.texture=e,this.width=-1,this.height=-1,this.type=rt.UNSIGNED_BYTE,this.internalFormat=lo.RGBA,this.format=lo.RGBA,this.samplerType=0}}}),Qm,mT=_(()=>{"use strict";Qm={id:"buffer",upload(e,t,r){t.width===e.width||t.height===e.height?r.texSubImage2D(r.TEXTURE_2D,0,0,0,e.width,e.height,t.format,t.type,e.resource):r.texImage2D(t.target,0,t.internalFormat,e.width,e.height,0,t.format,t.type,e.resource),t.width=e.width,t.height=e.height}}}),Jm,e_,_T=_(()=>{"use strict";Jm={"bc1-rgba-unorm":!0,"bc1-rgba-unorm-srgb":!0,"bc2-rgba-unorm":!0,"bc2-rgba-unorm-srgb":!0,"bc3-rgba-unorm":!0,"bc3-rgba-unorm-srgb":!0,"bc4-r-unorm":!0,"bc4-r-snorm":!0,"bc5-rg-unorm":!0,"bc5-rg-snorm":!0,"bc6h-rgb-ufloat":!0,"bc6h-rgb-float":!0,"bc7-rgba-unorm":!0,"bc7-rgba-unorm-srgb":!0,"etc2-rgb8unorm":!0,"etc2-rgb8unorm-srgb":!0,"etc2-rgb8a1unorm":!0,"etc2-rgb8a1unorm-srgb":!0,"etc2-rgba8unorm":!0,"etc2-rgba8unorm-srgb":!0,"eac-r11unorm":!0,"eac-r11snorm":!0,"eac-rg11unorm":!0,"eac-rg11snorm":!0,"astc-4x4-unorm":!0,"astc-4x4-unorm-srgb":!0,"astc-5x4-unorm":!0,"astc-5x4-unorm-srgb":!0,"astc-5x5-unorm":!0,"astc-5x5-unorm-srgb":!0,"astc-6x5-unorm":!0,"astc-6x5-unorm-srgb":!0,"astc-6x6-unorm":!0,"astc-6x6-unorm-srgb":!0,"astc-8x5-unorm":!0,"astc-8x5-unorm-srgb":!0,"astc-8x6-unorm":!0,"astc-8x6-unorm-srgb":!0,"astc-8x8-unorm":!0,"astc-8x8-unorm-srgb":!0,"astc-10x5-unorm":!0,"astc-10x5-unorm-srgb":!0,"astc-10x6-unorm":!0,"astc-10x6-unorm-srgb":!0,"astc-10x8-unorm":!0,"astc-10x8-unorm-srgb":!0,"astc-10x10-unorm":!0,"astc-10x10-unorm-srgb":!0,"astc-12x10-unorm":!0,"astc-12x10-unorm-srgb":!0,"astc-12x12-unorm":!0,"astc-12x12-unorm-srgb":!0},e_={id:"compressed",upload(e,t,r){r.pixelStorei(r.UNPACK_ALIGNMENT,4);let i=e.pixelWidth,n=e.pixelHeight,s=!!Jm[e.format];for(let a=0;a>1,1),n=Math.max(n>>1,1)}}}}),Qu,t_=_(()=>{"use strict";Qu={id:"image",upload(e,t,r,i){let n=e.alphaMode==="premultiply-alpha-on-upload";r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n);let s=t.width,a=t.height,o=e.pixelWidth,l=e.pixelHeight,h=e.resourceWidth,u=e.resourceHeight;h{t_(),r_={id:"video",upload(e,t,r,i){if(!e.isValid){r.texImage2D(t.target,0,t.internalFormat,1,1,0,t.format,t.type,null);return}Qu.upload(e,t,r,i)}}}),Ju,i_,uo,n_,yT=_(()=>{"use strict";Ju={linear:9729,nearest:9728},i_={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},uo={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},n_={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function s_(e,t,r,i,n,s,a,o){let l=s;if(!o||e.addressModeU!=="repeat"||e.addressModeV!=="repeat"||e.addressModeW!=="repeat"){let h=uo[a?"clamp-to-edge":e.addressModeU],u=uo[a?"clamp-to-edge":e.addressModeV],c=uo[a?"clamp-to-edge":e.addressModeW];t[n](l,t.TEXTURE_WRAP_S,h),t[n](l,t.TEXTURE_WRAP_T,u),t.TEXTURE_WRAP_R&&t[n](l,t.TEXTURE_WRAP_R,c)}if((!o||e.magFilter!=="linear")&&t[n](l,t.TEXTURE_MAG_FILTER,Ju[e.magFilter]),r){if(!o||e.mipmapFilter!=="linear"){let h=i_[e.minFilter][e.mipmapFilter];t[n](l,t.TEXTURE_MIN_FILTER,h)}}else t[n](l,t.TEXTURE_MIN_FILTER,Ju[e.minFilter]);if(i&&e.maxAnisotropy>1){let h=Math.min(e.maxAnisotropy,t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[n](l,i.TEXTURE_MAX_ANISOTROPY_EXT,h)}e.compare&&t[n](l,t.TEXTURE_COMPARE_FUNC,n_[e.compare])}var xT=_(()=>{yT()});function bT(e){return{r8unorm:e.RED,r8snorm:e.RED,r8uint:e.RED,r8sint:e.RED,r16uint:e.RED,r16sint:e.RED,r16float:e.RED,rg8unorm:e.RG,rg8snorm:e.RG,rg8uint:e.RG,rg8sint:e.RG,r32uint:e.RED,r32sint:e.RED,r32float:e.RED,rg16uint:e.RG,rg16sint:e.RG,rg16float:e.RG,rgba8unorm:e.RGBA,"rgba8unorm-srgb":e.RGBA,rgba8snorm:e.RGBA,rgba8uint:e.RGBA,rgba8sint:e.RGBA,bgra8unorm:e.RGBA,"bgra8unorm-srgb":e.RGBA,rgb9e5ufloat:e.RGB,rgb10a2unorm:e.RGBA,rg11b10ufloat:e.RGB,rg32uint:e.RG,rg32sint:e.RG,rg32float:e.RG,rgba16uint:e.RGBA,rgba16sint:e.RGBA,rgba16float:e.RGBA,rgba32uint:e.RGBA,rgba32sint:e.RGBA,rgba32float:e.RGBA,stencil8:e.STENCIL_INDEX8,depth16unorm:e.DEPTH_COMPONENT,depth24plus:e.DEPTH_COMPONENT,"depth24plus-stencil8":e.DEPTH_STENCIL,depth32float:e.DEPTH_COMPONENT,"depth32float-stencil8":e.DEPTH_STENCIL}}var wT=_(()=>{"use strict"});function TT(e,t){let r={},i=e.RGBA;return e instanceof yt.get().getWebGLRenderingContext()?t.srgb&&(r={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(r={"rgba8unorm-srgb":e.SRGB8_ALPHA8,"bgra8unorm-srgb":e.SRGB8_ALPHA8},i=e.RGBA8),{r8unorm:e.R8,r8snorm:e.R8_SNORM,r8uint:e.R8UI,r8sint:e.R8I,r16uint:e.R16UI,r16sint:e.R16I,r16float:e.R16F,rg8unorm:e.RG8,rg8snorm:e.RG8_SNORM,rg8uint:e.RG8UI,rg8sint:e.RG8I,r32uint:e.R32UI,r32sint:e.R32I,r32float:e.R32F,rg16uint:e.RG16UI,rg16sint:e.RG16I,rg16float:e.RG16F,rgba8unorm:e.RGBA,...r,rgba8snorm:e.RGBA8_SNORM,rgba8uint:e.RGBA8UI,rgba8sint:e.RGBA8I,bgra8unorm:i,rgb9e5ufloat:e.RGB9_E5,rgb10a2unorm:e.RGB10_A2,rg11b10ufloat:e.R11F_G11F_B10F,rg32uint:e.RG32UI,rg32sint:e.RG32I,rg32float:e.RG32F,rgba16uint:e.RGBA16UI,rgba16sint:e.RGBA16I,rgba16float:e.RGBA16F,rgba32uint:e.RGBA32UI,rgba32sint:e.RGBA32I,rgba32float:e.RGBA32F,stencil8:e.STENCIL_INDEX8,depth16unorm:e.DEPTH_COMPONENT16,depth24plus:e.DEPTH_COMPONENT24,"depth24plus-stencil8":e.DEPTH24_STENCIL8,depth32float:e.DEPTH_COMPONENT32F,"depth32float-stencil8":e.DEPTH32F_STENCIL8,...t.s3tc?{"bc1-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{},...t.s3tc_sRGB?{"bc1-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{},...t.rgtc?{"bc4-r-unorm":t.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":t.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":t.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":t.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{},...t.bptc?{"bc6h-rgb-float":t.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":t.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":t.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":t.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{},...t.etc?{"etc2-rgb8unorm":t.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":t.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":t.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":t.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":t.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":t.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":t.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":t.etc.COMPRESSED_SIGNED_RG11_EAC}:{},...t.astc?{"astc-4x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{}}}var ST=_(()=>{Ht()});function ET(e){return{r8unorm:e.UNSIGNED_BYTE,r8snorm:e.BYTE,r8uint:e.UNSIGNED_BYTE,r8sint:e.BYTE,r16uint:e.UNSIGNED_SHORT,r16sint:e.SHORT,r16float:e.HALF_FLOAT,rg8unorm:e.UNSIGNED_BYTE,rg8snorm:e.BYTE,rg8uint:e.UNSIGNED_BYTE,rg8sint:e.BYTE,r32uint:e.UNSIGNED_INT,r32sint:e.INT,r32float:e.FLOAT,rg16uint:e.UNSIGNED_SHORT,rg16sint:e.SHORT,rg16float:e.HALF_FLOAT,rgba8unorm:e.UNSIGNED_BYTE,"rgba8unorm-srgb":e.UNSIGNED_BYTE,rgba8snorm:e.BYTE,rgba8uint:e.UNSIGNED_BYTE,rgba8sint:e.BYTE,bgra8unorm:e.UNSIGNED_BYTE,"bgra8unorm-srgb":e.UNSIGNED_BYTE,rgb9e5ufloat:e.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:e.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:e.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:e.UNSIGNED_INT,rg32sint:e.INT,rg32float:e.FLOAT,rgba16uint:e.UNSIGNED_SHORT,rgba16sint:e.SHORT,rgba16float:e.HALF_FLOAT,rgba32uint:e.UNSIGNED_INT,rgba32sint:e.INT,rgba32float:e.FLOAT,stencil8:e.UNSIGNED_BYTE,depth16unorm:e.UNSIGNED_SHORT,depth24plus:e.UNSIGNED_INT,"depth24plus-stencil8":e.UNSIGNED_INT_24_8,depth32float:e.FLOAT,"depth32float-stencil8":e.FLOAT_32_UNSIGNED_INT_24_8_REV}}var CT=_(()=>{"use strict"}),a_,ec,AT=_(()=>{Ht(),re(),mt(),gT(),mT(),_T(),t_(),vT(),xT(),wT(),ST(),CT(),a_=4,ec=class{constructor(e){this.managedTextures=[],this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._uploads={image:Qu,buffer:Qm,video:r_,compressed:e_},this._useSeparateSamplers=!1,this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_glTextures"),this._renderer.renderableGC.addManagedHash(this,"_glSamplers")}contextChange(e){this._gl=e,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=TT(e,this._renderer.context.extensions),this._mapFormatToType=ET(e),this._mapFormatToFormat=bT(e)),this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null);for(let t=0;t<16;t++)this.bind(Ie.EMPTY,t)}initSource(e){this.bind(e)}bind(e,t=0){let r=e.source;e?(this.bindSource(r,t),this._useSeparateSamplers&&this._bindSampler(r.style,t)):(this.bindSource(null,t),this._useSeparateSamplers&&this._bindSampler(null,t))}bindSource(e,t=0){let r=this._gl;if(e._touched=this._renderer.textureGC.count,this._boundTextures[t]!==e){this._boundTextures[t]=e,this._activateLocation(t),e||(e=Ie.EMPTY.source);let i=this.getGlSource(e);r.bindTexture(i.target,i.texture)}}_bindSampler(e,t=0){let r=this._gl;if(!e){this._boundSamplers[t]=null,r.bindSampler(t,null);return}let i=this._getGlSampler(e);this._boundSamplers[t]!==i&&(this._boundSamplers[t]=i,r.bindSampler(t,i))}unbind(e){let t=e.source,r=this._boundTextures,i=this._gl;for(let n=0;n1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",r.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!e.isPowerOfTwo,t)}onSourceUnload(e){let t=this._glTextures[e.uid];t&&(this.unbind(e),this._glTextures[e.uid]=null,this._gl.deleteTexture(t.texture))}onSourceUpdate(e){let t=this._gl,r=this.getGlSource(e);t.bindTexture(t.TEXTURE_2D,r.texture),this._boundTextures[this._activeTextureLocation]=e,this._uploads[e.uploadMethodId]?this._uploads[e.uploadMethodId].upload(e,r,t,this._renderer.context.webGLVersion):t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e.pixelWidth,e.pixelHeight,0,t.RGBA,t.UNSIGNED_BYTE,null),e.autoGenerateMipmaps&&e.mipLevelCount>1&&this.onUpdateMipmaps(e,!1)}onUpdateMipmaps(e,t=!0){t&&this.bindSource(e,0);let r=this.getGlSource(e);this._gl.generateMipmap(r.target)}onSourceDestroy(e){e.off("destroy",this.onSourceDestroy,this),e.off("update",this.onSourceUpdate,this),e.off("resize",this.onSourceUpdate,this),e.off("unload",this.onSourceUnload,this),e.off("styleChange",this.onStyleChange,this),e.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(e),1),this.onSourceUnload(e)}_initSampler(e){let t=this._gl,r=this._gl.createSampler();return this._glSamplers[e._resourceId]=r,s_(e,t,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",r,!1,!0),this._glSamplers[e._resourceId]}_getGlSampler(e){return this._glSamplers[e._resourceId]||this._initSampler(e)}getGlSource(e){return this._glTextures[e.uid]||this._initSource(e)}generateCanvas(e){let{pixels:t,width:r,height:i}=this.getPixels(e),n=yt.get().createCanvas();n.width=r,n.height=i;let s=n.getContext("2d");if(s){let a=s.createImageData(r,i);a.data.set(t),s.putImageData(a,0,0)}return n}getPixels(e){let t=e.source.resolution,r=e.frame,i=Math.max(Math.round(r.width*t),1),n=Math.max(Math.round(r.height*t),1),s=new Uint8Array(a_*i*n),a=this._renderer,o=a.renderTarget.getRenderTarget(e),l=a.renderTarget.getGpuRenderTarget(o),h=a.gl;return h.bindFramebuffer(h.FRAMEBUFFER,l.resolveTargetFramebuffer),h.readPixels(Math.round(r.x*t),Math.round(r.y*t),i,n,h.RGBA,h.UNSIGNED_BYTE,s),{pixels:new Uint8ClampedArray(s.buffer),width:i,height:n}}destroy(){this.managedTextures.slice().forEach(e=>this.onSourceDestroy(e)),this.managedTextures=null,this._renderer=null}},ec.extension={type:[I.WebGLSystem],name:"texture"}}),o_={};$e(o_,{WebGLRenderer:()=>c_});var l_,h_,u_,tc,rc,ic,c_,MT=_(()=>{re(),Tw(),Sw(),Ew(),Ya(),Qg(),li(),Mw(),Pw(),Bw(),Iw(),Gw(),Ow(),Dw(),zw(),jw(),oT(),cT(),pT(),AT(),l_=[...cu,ju,Rm,Cm,Uu,ec,$u,Nu,Ku,qu,zu,Km,Vu,Hu],h_=[...du],u_=[Du,Ou,Gu],tc=[],rc=[],ic=[],fe.handleByNamedList(I.WebGLSystem,tc),fe.handleByNamedList(I.WebGLPipes,rc),fe.handleByNamedList(I.WebGLPipesAdaptor,ic),fe.add(...l_,...h_,...u_),c_=class extends ms{constructor(){let e={name:"webgl",type:Sr.WEBGL,systems:tc,renderPipes:rc,renderPipeAdaptors:ic};super(e)}}}),PT=Ve((e,t)=>{"use strict";t.exports=i;function r(s){return s instanceof Buffer?Buffer.from(s):new s.constructor(s.buffer.slice(),s.byteOffset,s.length)}function i(s){if(s=s||{},s.circles)return n(s);let a=new Map;if(a.set(Date,c=>new Date(c)),a.set(Map,(c,f)=>new Map(l(Array.from(c),f))),a.set(Set,(c,f)=>new Set(l(Array.from(c),f))),s.constructorHandlers)for(let c of s.constructorHandlers)a.set(c[0],c[1]);let o=null;return s.proto?u:h;function l(c,f){let d=Object.keys(c),y=new Array(d.length);for(let x=0;xnew Date(d)),l.set(Map,(d,y)=>new Map(u(Array.from(d),y))),l.set(Set,(d,y)=>new Set(u(Array.from(d),y))),s.constructorHandlers)for(let d of s.constructorHandlers)l.set(d[0],d[1]);let h=null;return s.proto?f:c;function u(d,y){let x=Object.keys(d),v=new Array(x.length);for(let w=0;w{}};function d_(){for(var e=0,t=arguments.length,r={},i;e=0&&(i=r.slice(n+1),r=r.slice(0,n)),r&&!t.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:i}})}co.prototype=d_.prototype={constructor:co,on:function(e,t){var r=this._,i=kT(e+"",r),n,s=-1,a=i.length;if(arguments.length<2){for(;++s0)for(var r=new Array(n),i=0,n,s;i=0&&(t=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),p_.hasOwnProperty(t)?{space:p_[t],local:e}:e}function IT(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===nc&&t.documentElement.namespaceURI===nc?t.createElement(e):t.createElementNS(r,e)}}function GT(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function g_(e){var t=po(e);return(t.local?GT:IT)(t)}function OT(){}function sc(e){return e==null?OT:function(){return this.querySelector(e)}}function DT(e){typeof e!="function"&&(e=sc(e));for(var t=this._groups,r=t.length,i=new Array(r),n=0;n=O&&(O=M+1);!(U=v[O])&&++O=0;)(a=i[n])&&(s&&a.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(a,s),s=a);return this}function oS(e){e||(e=lS);function t(c,f){return c&&f?e(c.__data__,f.__data__):!c-!f}for(var r=this._groups,i=r.length,n=new Array(i),s=0;st?1:e>=t?0:NaN}function hS(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function uS(){return Array.from(this)}function cS(){for(var e=this._groups,t=0,r=e.length;t1?this.each((t==null?wS:typeof t=="function"?SS:TS)(e,t,r??"")):Pn(this.node(),e)}function Pn(e,t){return e.style.getPropertyValue(t)||x_(e).getComputedStyle(e,null).getPropertyValue(t)}function CS(e){return function(){delete this[e]}}function AS(e,t){return function(){this[e]=t}}function MS(e,t){return function(){var r=t.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function PS(e,t){return arguments.length>1?this.each((t==null?CS:typeof t=="function"?MS:AS)(e,t)):this.node()[e]}function b_(e){return e.trim().split(/^|\s+/)}function ac(e){return e.classList||new w_(e)}function w_(e){this._node=e,this._names=b_(e.getAttribute("class")||"")}w_.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function T_(e,t){for(var r=ac(e),i=-1,n=t.length;++i=0&&(r=t.slice(i+1),t=t.slice(0,i)),{type:t,name:r}})}function i2(e){return function(){var t=this.__on;if(t){for(var r=0,i=-1,n=t.length,s;r()=>e;function lc(e,{sourceEvent:t,subject:r,target:i,identifier:n,active:s,x:a,y:o,dx:l,dy:h,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:n,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:o,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:h,enumerable:!0,configurable:!0},_:{value:u}})}lc.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function f2(e){return!e.ctrlKey&&!e.button}function p2(){return this.parentNode}function g2(e,t){return t??{x:e.x,y:e.y}}function m2(){return navigator.maxTouchPoints||"ontouchstart"in this}function _2(){var e=f2,t=p2,r=g2,i=m2,n={},s=fo("start","drag","end"),a=0,o,l,h,u,c=0;function f(P){P.on("mousedown.drag",d).filter(i).on("touchstart.drag",v).on("touchmove.drag",w,d2).on("touchend.drag touchcancel.drag",M).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function d(P,U){if(!(u||!e.call(this,P,U))){var F=O(this,t.call(this,P,U),P,U,"mouse");F&&(kr(P.view).on("mousemove.drag",y,Ss).on("mouseup.drag",x,Ss),M_(P.view),oc(P),h=!1,o=P.clientX,l=P.clientY,F("start",P))}}function y(P){if(Rn(P),!h){var U=P.clientX-o,F=P.clientY-l;h=U*U+F*F>c}n.mouse("drag",P)}function x(P){kr(P.view).on("mousemove.drag mouseup.drag",null),P_(P.view,h),Rn(P),n.mouse("end",P)}function v(P,U){if(e.call(this,P,U)){var F=P.changedTouches,N=t.call(this,P,U),oe=F.length,ce,ae;for(ce=0;ce>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?vo(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?vo(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=y2.exec(e))?new pr(t[1],t[2],t[3],1):(t=x2.exec(e))?new pr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=b2.exec(e))?vo(t[1],t[2],t[3],t[4]):(t=w2.exec(e))?vo(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=T2.exec(e))?U_(t[1],t[2]/100,t[3]/100,1):(t=S2.exec(e))?U_(t[1],t[2]/100,t[3]/100,t[4]):k_.hasOwnProperty(e)?G_(k_[e]):e==="transparent"?new pr(NaN,NaN,NaN,0):null}function G_(e){return new pr(e>>16&255,e>>8&255,e&255,1)}function vo(e,t,r,i){return i<=0&&(e=t=r=NaN),new pr(e,t,r,i)}function A2(e){return e instanceof Es||(e=Ms(e)),e?(e=e.rgb(),new pr(e.r,e.g,e.b,e.opacity)):new pr}function yo(e,t,r,i){return arguments.length===1?A2(e):new pr(e,t,r,i??1)}function pr(e,t,r,i){this.r=+e,this.g=+t,this.b=+r,this.opacity=+i}hc(pr,yo,R_(Es,{brighter(e){return e=e==null?_o:Math.pow(_o,e),new pr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Cs:Math.pow(Cs,e),new pr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new pr(qi(this.r),qi(this.g),qi(this.b),xo(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:O_,formatHex:O_,formatHex8:M2,formatRgb:D_,toString:D_}));function O_(){return`#${Ki(this.r)}${Ki(this.g)}${Ki(this.b)}`}function M2(){return`#${Ki(this.r)}${Ki(this.g)}${Ki(this.b)}${Ki((isNaN(this.opacity)?1:this.opacity)*255)}`}function D_(){let e=xo(this.opacity);return`${e===1?"rgb(":"rgba("}${qi(this.r)}, ${qi(this.g)}, ${qi(this.b)}${e===1?")":`, ${e})`}`}function xo(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function qi(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ki(e){return e=qi(e),(e<16?"0":"")+e.toString(16)}function U_(e,t,r,i){return i<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new Br(e,t,r,i)}function F_(e){if(e instanceof Br)return new Br(e.h,e.s,e.l,e.opacity);if(e instanceof Es||(e=Ms(e)),!e)return new Br;if(e instanceof Br)return e;e=e.rgb();var t=e.r/255,r=e.g/255,i=e.b/255,n=Math.min(t,r,i),s=Math.max(t,r,i),a=NaN,o=s-n,l=(s+n)/2;return o?(t===s?a=(r-i)/o+(r0&&l<1?0:a,new Br(a,o,l,e.opacity)}function P2(e,t,r,i){return arguments.length===1?F_(e):new Br(e,t,r,i??1)}function Br(e,t,r,i){this.h=+e,this.s=+t,this.l=+r,this.opacity=+i}hc(Br,P2,R_(Es,{brighter(e){return e=e==null?_o:Math.pow(_o,e),new Br(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Cs:Math.pow(Cs,e),new Br(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,i=r+(r<.5?r:1-r)*t,n=2*r-i;return new pr(uc(e>=240?e-240:e+120,n,i),uc(e,n,i),uc(e<120?e+240:e-120,n,i),this.opacity)},clamp(){return new Br(L_(this.h),bo(this.s),bo(this.l),xo(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=xo(this.opacity);return`${e===1?"hsl(":"hsla("}${L_(this.h)}, ${bo(this.s)*100}%, ${bo(this.l)*100}%${e===1?")":`, ${e})`}`}}));function L_(e){return e=(e||0)%360,e<0?e+360:e}function bo(e){return Math.max(0,Math.min(1,e||0))}function uc(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}function N_(e,t,r,i,n){var s=e*e,a=s*e;return((1-3*e+3*s-a)*t+(4-6*s+3*a)*r+(1+3*e+3*s-3*a)*i+a*n)/6}function R2(e){var t=e.length-1;return function(r){var i=r<=0?r=0:r>=1?(r=1,t-1):Math.floor(r*t),n=e[i],s=e[i+1],a=i>0?e[i-1]:2*n-s,o=i()=>e;function B2(e,t){return function(r){return e+r*t}}function I2(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(i){return Math.pow(e+i*t,r)}}function G2(e){return(e=+e)==1?z_:function(t,r){return r-t?I2(t,r,e):H_(isNaN(t)?r:t)}}function z_(e,t){var r=t-e;return r?B2(e,r):H_(isNaN(e)?t:e)}var V_=function e(t){var r=G2(t);function i(n,s){var a=r((n=yo(n)).r,(s=yo(s)).r),o=r(n.g,s.g),l=r(n.b,s.b),h=z_(n.opacity,s.opacity);return function(u){return n.r=a(u),n.g=o(u),n.b=l(u),n.opacity=h(u),n+""}}return i.gamma=e,i}(1);function W_(e){return function(t){var r=t.length,i=new Array(r),n=new Array(r),s=new Array(r),a,o;for(a=0;ar&&(s=t.slice(r,s),o[a]?o[a]+=s:o[++a]=s),(i=i[0])===(n=n[0])?o[a]?o[a]+=n:o[++a]=n:(o[++a]=null,l.push({i:a,x:Pi(i,n)})),r=dc.lastIndex;return r180?u+=360:u-h>180&&(h+=360),f.push({i:c.push(n(c)+"rotate(",null,i)-2,x:Pi(h,u)})):u&&c.push(n(c)+"rotate("+u+i)}function o(h,u,c,f){h!==u?f.push({i:c.push(n(c)+"skewX(",null,i)-2,x:Pi(h,u)}):u&&c.push(n(c)+"skewX("+u+i)}function l(h,u,c,f,d,y){if(h!==c||u!==f){var x=d.push(n(d)+"scale(",null,",",null,")");y.push({i:x-4,x:Pi(h,c)},{i:x-2,x:Pi(u,f)})}else(c!==1||f!==1)&&d.push(n(d)+"scale("+c+","+f+")")}return function(h,u){var c=[],f=[];return h=e(h),u=e(u),s(h.translateX,h.translateY,u.translateX,u.translateY,c,f),a(h.rotate,u.rotate,c,f),o(h.skewX,u.skewX,c,f),l(h.scaleX,h.scaleY,u.scaleX,u.scaleY,c,f),h=u=null,function(d){for(var y=-1,x=f.length,v;++y=0&&e._call.call(void 0,t),e=e._next;--Bn}function Z_(){Zi=(So=Bs.now())+Eo,Bn=Ps=0;try{X2()}finally{Bn=0,q2(),Zi=0}}function Y2(){var e=Bs.now(),t=e-So;t>q_&&(Eo-=t,So=e)}function q2(){for(var e,t=To,r,i=1/0;t;)t._call?(i>t._time&&(i=t._time),e=t,t=t._next):(r=t._next,t._next=null,t=e?e._next=r:To=r);ks=e,mc(i)}function mc(e){if(!Bn){Ps&&(Ps=clearTimeout(Ps));var t=e-Zi;t>24?(e<1/0&&(Ps=setTimeout(Z_,e-Bs.now()-Eo)),Rs&&(Rs=clearInterval(Rs))):(Rs||(So=Bs.now(),Rs=setInterval(Y2,q_)),Bn=1,K_(Z_))}}function Q_(e,t,r){var i=new Co;return t=t==null?0:+t,i.restart(n=>{i.stop(),e(n+t)},t,r),i}var K2=fo("start","end","cancel","interrupt"),Z2=[],J_=0,ev=1,_c=2,Ao=3,tv=4,vc=5,Mo=6;function Po(e,t,r,i,n,s){var a=e.__transition;if(!a)e.__transition={};else if(r in a)return;Q2(e,r,{name:t,index:i,group:n,on:K2,tween:Z2,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:J_})}function yc(e,t){var r=Ir(e,t);if(r.state>J_)throw new Error("too late; already scheduled");return r}function Kr(e,t){var r=Ir(e,t);if(r.state>Ao)throw new Error("too late; already running");return r}function Ir(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw new Error("transition not found");return r}function Q2(e,t,r){var i=e.__transition,n;i[t]=r,r.timer=gc(s,0,r.time);function s(h){r.state=ev,r.timer.restart(a,r.delay,r.time),r.delay<=h&&a(h-r.delay)}function a(h){var u,c,f,d;if(r.state!==ev)return l();for(u in i)if(d=i[u],d.name===r.name){if(d.state===Ao)return Q_(a);d.state===tv?(d.state=Mo,d.timer.stop(),d.on.call("interrupt",e,e.__data__,d.index,d.group),delete i[u]):+u_c&&i.state=0&&(t=t.slice(0,r)),!t||t==="start"})}function ME(e,t,r){var i,n,s=AE(t)?yc:Kr;return function(){var a=s(this,e),o=a.on;o!==i&&(n=(i=o).copy()).on(t,r),a.on=n}}function PE(e,t){var r=this._id;return arguments.length<2?Ir(this.node(),r).on.on(e):this.each(ME(r,e,t))}function RE(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}function kE(){return this.on("end.remove",RE(this._id))}function BE(e){var t=this._name,r=this._id;typeof e!="function"&&(e=sc(e));for(var i=this._groups,n=i.length,s=new Array(n),a=0;a=(c=(o+h)/2))?o=c:h=c,(v=r>=(f=(l+u)/2))?l=f:u=f,n=s,!(s=s[w=v<<1|x]))return n[w]=a,e;if(d=+e._x.call(null,s.data),y=+e._y.call(null,s.data),t===d&&r===y)return a.next=s,n?n[w]=a:e._root=a,e;do n=n?n[w]=new Array(4):e._root=new Array(4),(x=t>=(c=(o+h)/2))?o=c:h=c,(v=r>=(f=(l+u)/2))?l=f:u=f;while((w=v<<1|x)===(M=(y>=f)<<1|d>=c));return n[M]=s,n[w]=a,e}function oC(e){var t,r,i=e.length,n,s,a=new Array(i),o=new Array(i),l=1/0,h=1/0,u=-1/0,c=-1/0;for(r=0;ru&&(u=n),sc&&(c=s));if(l>u||h>c)return this;for(this.cover(l,h).cover(u,c),r=0;re||e>=n||i>t||t>=s;)switch(h=(tu||(o=y.y0)>c||(l=y.x1)=w)<<1|e>=v)&&(y=f[f.length-1],f[f.length-1]=f[f.length-1-x],f[f.length-1-x]=y)}else{var M=e-+this._x.call(null,d.data),O=t-+this._y.call(null,d.data),P=M*M+O*O;if(P=(f=(a+l)/2))?a=f:l=f,(x=c>=(d=(o+h)/2))?o=d:h=d,t=r,!(r=r[v=x<<1|y]))return this;if(!r.length)break;(t[v+1&3]||t[v+2&3]||t[v+3&3])&&(i=t,w=v)}for(;r.data!==e;)if(n=r,!(r=r.next))return this;return(s=r.next)&&delete r.next,n?(s?n.next=s:delete n.next,this):t?(s?t[v]=s:delete t[v],(r=t[0]||t[1]||t[2]||t[3])&&r===(t[3]||t[2]||t[1]||t[0])&&!r.length&&(i?i[w]=r:this._root=r),this):(this._root=s,this)}function fC(e){for(var t=0,r=e.length;tf.index){var se=d-oe.x-oe.vx,Se=y-oe.y-oe.vy,ke=se*se+Se*Se;ked+ae||Fy+ae||Nh.r&&(h.r=h[u].r)}function l(){if(t){var h,u=t.length,c;for(r=new Array(u),h=0;h[t(U,F,a),U])),P;for(v=0,o=new Array(w);v(e=(1664525*e+1013904223)%4294967296)/4294967296}function MC(e){return e.x}function PC(e){return e.y}var RC=10,kC=Math.PI*(3-Math.sqrt(5));function BC(e){var t,r=1,i=.001,n=1-Math.pow(i,1/300),s=0,a=.6,o=new Map,l=gc(c),h=fo("tick","end"),u=AC();e==null&&(e=[]);function c(){f(),h.call("tick",t),r1?(v==null?o.delete(x):o.set(x,y(v)),t):o.get(x)},find:function(x,v,w){var M=0,O=e.length,P,U,F,N,oe;for(w==null?w=1/0:w*=w,M=0;M1?(h.on(x,v),t):h.on(x)}}}function IC(){var e,t,r,i,n=Qi(-30),s,a=1,o=1/0,l=.81;function h(d){var y,x=e.length,v=wc(e,MC,PC).visitAfter(c);for(i=d,y=0;y=o)){(d.data!==t||d.next)&&(w===0&&(w=Ri(r),P+=w*w),M===0&&(M=Ri(r),P+=M*M),P()=>e;function GC(e,{sourceEvent:t,target:r,transform:i,dispatch:n}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:n}})}function pi(e,t,r){this.k=e,this.x=t,this.y=r}pi.prototype={constructor:pi,scale:function(e){return e===1?this:new pi(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new pi(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Bo=new pi(1,0,0);OC.prototype=pi.prototype;function OC(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Bo;return e.__zoom}function Sc(e){e.stopImmediatePropagation()}function Is(e){e.preventDefault(),e.stopImmediatePropagation()}function DC(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function UC(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function hv(){return this.__zoom||Bo}function FC(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function LC(){return navigator.maxTouchPoints||"ontouchstart"in this}function NC(e,t,r){var i=e.invertX(t[0][0])-r[0][0],n=e.invertX(t[1][0])-r[1][0],s=e.invertY(t[0][1])-r[0][1],a=e.invertY(t[1][1])-r[1][1];return e.translate(n>i?(i+n)/2:Math.min(0,i)||Math.max(0,n),a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a))}function HC(){var e=DC,t=UC,r=NC,i=FC,n=LC,s=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],o=250,l=j2,h=fo("start","zoom","end"),u,c,f,d=500,y=150,x=0,v=10;function w(z){z.property("__zoom",hv).on("wheel.zoom",oe,{passive:!1}).on("mousedown.zoom",ce).on("dblclick.zoom",ae).filter(n).on("touchstart.zoom",se).on("touchmove.zoom",Se).on("touchend.zoom touchcancel.zoom",ke).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}w.transform=function(z,me,j,ie){var A=z.selection?z.selection():z;A.property("__zoom",hv),z!==A?U(z,me,j,ie):A.interrupt().each(function(){F(this,arguments).event(ie).start().zoom(null,typeof me=="function"?me.apply(this,arguments):me).end()})},w.scaleBy=function(z,me,j,ie){w.scaleTo(z,function(){var A=this.__zoom.k,B=typeof me=="function"?me.apply(this,arguments):me;return A*B},j,ie)},w.scaleTo=function(z,me,j,ie){w.transform(z,function(){var A=t.apply(this,arguments),B=this.__zoom,R=j==null?P(A):typeof j=="function"?j.apply(this,arguments):j,$=B.invert(R),q=typeof me=="function"?me.apply(this,arguments):me;return r(O(M(B,q),R,$),A,a)},j,ie)},w.translateBy=function(z,me,j,ie){w.transform(z,function(){return r(this.__zoom.translate(typeof me=="function"?me.apply(this,arguments):me,typeof j=="function"?j.apply(this,arguments):j),t.apply(this,arguments),a)},null,ie)},w.translateTo=function(z,me,j,ie,A){w.transform(z,function(){var B=t.apply(this,arguments),R=this.__zoom,$=ie==null?P(B):typeof ie=="function"?ie.apply(this,arguments):ie;return r(Bo.translate($[0],$[1]).scale(R.k).translate(typeof me=="function"?-me.apply(this,arguments):-me,typeof j=="function"?-j.apply(this,arguments):-j),B,a)},ie,A)};function M(z,me){return me=Math.max(s[0],Math.min(s[1],me)),me===z.k?z:new pi(me,z.x,z.y)}function O(z,me,j){var ie=me[0]-j[0]*z.k,A=me[1]-j[1]*z.k;return ie===z.x&&A===z.y?z:new pi(z.k,ie,A)}function P(z){return[(+z[0][0]+ +z[1][0])/2,(+z[0][1]+ +z[1][1])/2]}function U(z,me,j,ie){z.on("start.zoom",function(){F(this,arguments).event(ie).start()}).on("interrupt.zoom end.zoom",function(){F(this,arguments).event(ie).end()}).tween("zoom",function(){var A=this,B=arguments,R=F(A,B).event(ie),$=t.apply(A,B),q=j==null?P($):typeof j=="function"?j.apply(A,B):j,te=Math.max($[1][0]-$[0][0],$[1][1]-$[0][1]),ee=A.__zoom,le=typeof me=="function"?me.apply(A,B):me,Ee=l(ee.invert(q).concat(te/ee.k),le.invert(q).concat(te/le.k));return function(ve){if(ve===1)ve=le;else{var Le=Ee(ve),je=te/Le[2];ve=new pi(je,q[0]-Le[0]*je,q[1]-Le[1]*je)}R.zoom(null,ve)}})}function F(z,me,j){return!j&&z.__zooming||new N(z,me)}function N(z,me){this.that=z,this.args=me,this.active=0,this.sourceEvent=null,this.extent=t.apply(z,me),this.taps=0}N.prototype={event:function(z){return z&&(this.sourceEvent=z),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(z,me){return this.mouse&&z!=="mouse"&&(this.mouse[1]=me.invert(this.mouse[0])),this.touch0&&z!=="touch"&&(this.touch0[1]=me.invert(this.touch0[0])),this.touch1&&z!=="touch"&&(this.touch1[1]=me.invert(this.touch1[0])),this.that.__zoom=me,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(z){var me=kr(this.that).datum();h.call(z,this.that,new GC(z,{sourceEvent:this.sourceEvent,target:w,type:z,transform:this.that.__zoom,dispatch:h}),me)}};function oe(z,...me){if(!e.apply(this,arguments))return;var j=F(this,me).event(z),ie=this.__zoom,A=Math.max(s[0],Math.min(s[1],ie.k*Math.pow(2,i.apply(this,arguments)))),B=ci(z);if(j.wheel)(j.mouse[0][0]!==B[0]||j.mouse[0][1]!==B[1])&&(j.mouse[1]=ie.invert(j.mouse[0]=B)),clearTimeout(j.wheel);else{if(ie.k===A)return;j.mouse=[B,ie.invert(B)],Ro(this),j.start()}Is(z),j.wheel=setTimeout(R,y),j.zoom("mouse",r(O(M(ie,A),j.mouse[0],j.mouse[1]),j.extent,a));function R(){j.wheel=null,j.end()}}function ce(z,...me){if(f||!e.apply(this,arguments))return;var j=z.currentTarget,ie=F(this,me,!0).event(z),A=kr(z.view).on("mousemove.zoom",q,!0).on("mouseup.zoom",te,!0),B=ci(z,j),R=z.clientX,$=z.clientY;M_(z.view),Sc(z),ie.mouse=[B,this.__zoom.invert(B)],Ro(this),ie.start();function q(ee){if(Is(ee),!ie.moved){var le=ee.clientX-R,Ee=ee.clientY-$;ie.moved=le*le+Ee*Ee>x}ie.event(ee).zoom("mouse",r(O(ie.that.__zoom,ie.mouse[0]=ci(ee,j),ie.mouse[1]),ie.extent,a))}function te(ee){A.on("mousemove.zoom mouseup.zoom",null),P_(ee.view,ie.moved),Is(ee),ie.event(ee).end()}}function ae(z,...me){if(e.apply(this,arguments)){var j=this.__zoom,ie=ci(z.changedTouches?z.changedTouches[0]:z,this),A=j.invert(ie),B=j.k*(z.shiftKey?.5:2),R=r(O(M(j,B),ie,A),t.apply(this,me),a);Is(z),o>0?kr(this).transition().duration(o).call(U,R,ie,z):kr(this).call(w.transform,R,ie,z)}}function se(z,...me){if(e.apply(this,arguments)){var j=z.touches,ie=j.length,A=F(this,me,z.changedTouches.length===ie).event(z),B,R,$,q;for(Sc(z),R=0;R!0,load:async()=>{await Promise.resolve().then(()=>(e1(),J0))}};re();var VC={extension:{type:I.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(r1(),t1))}};re(),Ml(),xl(),re(),Ht(),Ya();var Ec;function WC(e){return Ec!==void 0||(Ec=(()=>{let t={stencil:!0,failIfMajorPerformanceCaveat:e??ms.defaultOptions.failIfMajorPerformanceCaveat};try{if(!yt.get().getWebGLRenderingContext())return!1;let r=yt.get().createCanvas().getContext("webgl",t),i=!!r?.getContextAttributes()?.stencil;if(r){let n=r.getExtension("WEBGL_lose_context");n&&n.loseContext()}return r=null,i}catch{return!1}})()),Ec}Ht();var Cc;async function jC(e={}){return Cc!==void 0||(Cc=await(async()=>{let t=yt.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(e)).requestDevice(),!0}catch{return!1}})()),Cc}Ya();var uv=["webgl","webgpu","canvas"];async function $C(e){let t=[];e.preference?(t.push(e.preference),uv.forEach(s=>{s!==e.preference&&t.push(s)})):t=uv.slice();let r,i={};for(let s=0;s(ww(),xm));r=o,i={...e,...e.webgpu};break}else if(a==="webgl"&&WC(e.failIfMajorPerformanceCaveat??ms.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:o}=await Promise.resolve().then(()=>(MT(),o_));r=o,i={...e,...e.webgl};break}else if(a==="canvas")throw i={...e},new Error("CanvasRenderer is not yet implemented")}if(delete i.webgpu,delete i.webgl,!r)throw new Error("No available renderer for the current environment");let n=new r;return await n.init(i),n}Hr(),Bg(),dt();var cv=class Uc{constructor(...t){this.stage=new St,t[0]!==void 0&&We(Qe,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.renderer=await $C(t),Uc._plugins.forEach(r=>{r.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return We(Qe,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(t=!1,r=!1){let i=Uc._plugins.slice(0);i.reverse(),i.forEach(n=>{n.destroy.call(this)}),this.stage.destroy(r),this.stage=null,this.renderer.destroy(t),this.renderer=null}};cv._plugins=[];var dv=cv;fe.handleByList(I.Application,dv._plugins),fe.add(Qh),ti(),dt(),wl();var XC=class extends Js{constructor(e,t){let{text:r,resolution:i,style:n,anchor:s,width:a,height:o,roundPixels:l,...h}=e;super({...h}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=t,this.text=r??"",this.style=n,this.resolution=i??null,this.allowChildren=!1,this._anchor=new Pt({_onUpdate:()=>{this.onViewUpdate()}}),s&&(this.anchor=s),this.roundPixels=l??!1,a!==void 0&&(this.width=a),o!==void 0&&(this.height=o)}get anchor(){return this._anchor}set anchor(e){typeof e=="number"?this._anchor.set(e):this._anchor.copyFrom(e)}set text(e){e=e.toString(),this._text!==e&&(this._text=e,this.onViewUpdate())}get text(){return this._text}set resolution(e){this._autoResolution=e===null,this._resolution=e,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(e){e||(e={}),this._style?.off("update",this.onViewUpdate,this),e instanceof this._styleClass?this._style=e:this._style=new this._styleClass(e),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(e){this._setWidth(e,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(e){this._setHeight(e,this.bounds.height)}getSize(e){return e||(e={}),e.width=Math.abs(this.scale.x)*this.bounds.width,e.height=Math.abs(this.scale.y)*this.bounds.height,e}setSize(e,t){typeof e=="object"?(t=e.height??e.width,e=e.width):t??(t=e),e!==void 0&&this._setWidth(e,this.bounds.width),t!==void 0&&this._setHeight(t,this.bounds.height)}containsPoint(e){let t=this.bounds.width,r=this.bounds.height,i=-t*this.anchor.x,n=0;return e.x>=i&&e.x<=i+t&&(n=-r*this.anchor.y,e.y>=n&&e.y<=n+r)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(e=!1){super.destroy(e),this.owner=null,this._bounds=null,this._anchor=null,(typeof e=="boolean"?e:e?.style)&&this._style.destroy(e),this._style=null,this._text=null}};function YC(e,t){let r=e[0]??{};return(typeof r=="string"||e[1])&&(We(Qe,`use new ${t}({ text: "hi!", style }) instead`),r={text:r,style:e[1]}),r}gh(),hs();var qC=class extends XC{constructor(...e){let t=YC(e,"Text");super(t,Xr),this.renderPipeId="text"}updateBounds(){let e=this._bounds,t=this._anchor,r=Yr.measureText(this._text,this._style),{width:i,height:n}=r;e.minX=-t._x*i,e.maxX=e.minX+i,e.minY=-t._y*n,e.maxY=e.minY+n}};Jf(),Id(),Hr(),Ip(),xt();var mA=ct(Sf(),1);fe.add(zC,VC);var Gs=Object.freeze({Linear:Object.freeze({None:function(e){return e},In:function(e){return e},Out:function(e){return e},InOut:function(e){return e}}),Quadratic:Object.freeze({In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}}),Cubic:Object.freeze({In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}}),Quartic:Object.freeze({In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}}),Quintic:Object.freeze({In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}}),Sinusoidal:Object.freeze({In:function(e){return 1-Math.sin((1-e)*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return .5*(1-Math.sin(Math.PI*(.5-e)))}}),Exponential:Object.freeze({In:function(e){return e===0?0:Math.pow(1024,e-1)},Out:function(e){return e===1?1:1-Math.pow(2,-10*e)},InOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(-Math.pow(2,-10*(e-1))+2)}}),Circular:Object.freeze({In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}}),Elastic:Object.freeze({In:function(e){return e===0?0:e===1?1:-Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI)},Out:function(e){return e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e-.1)*5*Math.PI)+1},InOut:function(e){return e===0?0:e===1?1:(e*=2,e<1?-.5*Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin((e-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(e){var t=1.70158;return e===1?1:e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return e===0?0:--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?.5*(e*e*((t+1)*e-t)):.5*((e-=2)*e*((t+1)*e+t)+2)}}),Bounce:Object.freeze({In:function(e){return 1-Gs.Bounce.Out(1-e)},Out:function(e){return e<.36363636363636365?7.5625*e*e:e<.7272727272727273?7.5625*(e-=.5454545454545454)*e+.75:e<.9090909090909091?7.5625*(e-=.8181818181818182)*e+.9375:7.5625*(e-=.9545454545454546)*e+.984375},InOut:function(e){return e<.5?Gs.Bounce.In(e*2)*.5:Gs.Bounce.Out(e*2-1)*.5+.5}}),generatePow:function(e){return e===void 0&&(e=4),e=e1e4?1e4:e,{In:function(t){return Math.pow(t,e)},Out:function(t){return 1-Math.pow(1-t,e)},InOut:function(t){return t<.5?Math.pow(t*2,e)/2:(1-Math.pow(2-t*2,e))/2+.5}}}}),Os=function(){return performance.now()},Io=function(){function e(){for(var t=[],r=0;r0;){this._tweensAddedDuringUpdate={};for(var n=0;n1?s(e[r],e[r-1],r-i):s(e[n],e[n+1>r?r:n+1],i-n)},Bezier:function(e,t){for(var r=0,i=e.length-1,n=Math.pow,s=In.Utils.Bernstein,a=0;a<=i;a++)r+=n(1-t,i-a)*n(t,a)*e[a]*s(i,a);return r},CatmullRom:function(e,t){var r=e.length-1,i=r*t,n=Math.floor(i),s=In.Utils.CatmullRom;return e[0]===e[r]?(t<0&&(n=Math.floor(i=r*(1+t))),s(e[(n-1+r)%r],e[n],e[(n+1)%r],e[(n+2)%r],i-n)):t<0?e[0]-(s(e[0],e[0],e[1],e[1],-i)-e[0]):t>1?e[r]-(s(e[r],e[r],e[r-1],e[r-1],i-r)-e[r]):s(e[n?n-1:0],e[n],e[r1;i--)r*=i;return e[t]=r,r}}(),CatmullRom:function(e,t,r,i,n){var s=(r-e)*.5,a=(i-t)*.5,o=n*n,l=n*o;return(2*t-2*r+s+a)*l+(-3*t+3*r-2*s-a)*o+s*n+t}}},fv=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),Ac=new Io,Go=function(){function e(t,r){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Gs.Linear.None,this._interpolationFunction=In.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=fv.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=t,typeof r=="object"?(this._group=r,r.add(this)):r===!0&&(this._group=Ac,Ac.add(this))}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.getDuration=function(){return this._duration},e.prototype.to=function(t,r){if(r===void 0&&(r=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=t,this._propertiesAreSetUp=!1,this._duration=r<0?0:r,this},e.prototype.duration=function(t){return t===void 0&&(t=1e3),this._duration=t<0?0:t,this},e.prototype.dynamic=function(t){return t===void 0&&(t=!1),this._isDynamic=t,this},e.prototype.start=function(t,r){if(t===void 0&&(t=Os()),r===void 0&&(r=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var i in this._valuesStartRepeat)this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=t,this._startTime+=this._delayTime,!this._propertiesAreSetUp||r){if(this._propertiesAreSetUp=!0,!this._isDynamic){var n={};for(var s in this._valuesEnd)n[s]=this._valuesEnd[s];this._valuesEnd=n}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,r)}return this},e.prototype.startFromCurrentValues=function(t){return this.start(t,!0)},e.prototype._setupProperties=function(t,r,i,n,s){for(var a in i){var o=t[a],l=Array.isArray(o),h=l?"array":typeof o,u=!l&&Array.isArray(i[a]);if(!(h==="undefined"||h==="function")){if(u){var c=i[a];if(c.length===0)continue;for(var f=[o],d=0,y=c.length;d"u"||s)&&(r[a]=o),l||(r[a]*=1),u?n[a]=i[a].slice().reverse():n[a]=r[a]||0}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},e.prototype.pause=function(t){return t===void 0&&(t=Os()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=t,this)},e.prototype.resume=function(t){return t===void 0&&(t=Os()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this)},e.prototype.stopChainedTweens=function(){for(var t=0,r=this._chainedTweens.length;tl)return 1;var x=Math.trunc(a/o),v=a-x*o,w=Math.min(v/i._duration,1);return w===0&&a===i._duration?1:w},u=h(),c=this._easingFunction(u);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,c),this._onUpdateCallback&&this._onUpdateCallback(this._object,u),this._duration===0||a>=this._duration)if(this._repeat>0){var f=Math.min(Math.trunc((a-this._duration)/o)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=f);for(s in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[s]=="string"&&(this._valuesStartRepeat[s]=this._valuesStartRepeat[s]+parseFloat(this._valuesEnd[s])),this._yoyo&&this._swapEndStartRepeatValues(s),this._valuesStart[s]=this._valuesStartRepeat[s];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=o*f,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var d=0,y=this._chainedTweens.length;de?.removeEventListener("click",r)),document.addEventListener("keydown",i),window.addCleanup(()=>document.removeEventListener("keydown",i))}function ZC(e){for(;e.firstChild;)e.removeChild(e.firstChild)}var TA=Object.hasOwnProperty,QC=ct(PT(),1),SA=(0,QC.default)();function JC(e){return e.document.body.dataset.slug}function Ds(e){let t=nA(iA(e,"index"),!0);return t.length===0?"/":t}function eA(e){let t=e.split("/").filter(r=>r!=="").slice(0,-1).map(r=>"..").join("/");return t.length===0&&(t="."),t}function pv(e,t){return tA(eA(e),Ds(t))}function tA(...e){return e.filter(t=>t!=="").join("/").replace(/\/\/+/g,"/")}function rA(e,t){return e===t||e.endsWith("/"+t)}function iA(e,t){return rA(e,t)&&(e=e.slice(0,-t.length)),e}function nA(e,t){return e.startsWith("/")&&(e=e.substring(1)),!t&&e.endsWith("/")&&(e=e.slice(0,-1)),e}var gv="graph-visited";function mv(){return new Set(JSON.parse(localStorage.getItem(gv)??"[]"))}function sA(e){let t=mv();t.add(e),localStorage.setItem(gv,JSON.stringify([...t]))}async function Mc(e,t){let r=Ds(t),i=mv(),n=document.getElementById(e);if(!n)return;ZC(n);let{drag:s,zoom:a,depth:o,scale:l,repelForce:h,centerForce:u,linkDistance:c,fontSize:f,opacityScale:d,removeTags:y,showTags:x,focusOnHover:v}=JSON.parse(n.dataset.cfg),w=new Map(Object.entries(await fetchData).map(([Z,de])=>[Ds(Z),de])),M=[],O=[],P=new Set(w.keys()),U=new Map;for(let[Z,de]of w.entries()){let pe=de.links??[];for(let be of pe)P.has(be)&&M.push({source:Z,target:be});if(x){let be=de.tags.filter(zt=>!y.includes(zt)).map(zt=>Ds("tags/"+zt));O.push(...be.filter(zt=>!O.includes(zt)));for(let zt of be)M.push({source:Z,target:zt})}}let F=new Set,N=[r,"__SENTINEL"];if(o>=0)for(;o>=0&&N.length>0;){let Z=N.shift();if(Z==="__SENTINEL")o--,N.push("__SENTINEL");else{F.add(Z);let de=M.filter(be=>be.source===Z),pe=M.filter(be=>be.target===Z);N.push(...de.map(be=>be.target),...pe.map(be=>be.source))}}else P.forEach(Z=>F.add(Z)),x&&O.forEach(Z=>F.add(Z));let oe=[...F].map(Z=>{let de=Z.startsWith("tags/")?"#"+Z.substring(5):w.get(Z)?.title??Z;return{id:Z,text:de,tags:w.get(Z)?.tags??[]}}),ce={nodes:oe,links:M.filter(Z=>F.has(Z.source)&&F.has(Z.target)).map(Z=>({source:oe.find(de=>de.id===Z.source),target:oe.find(de=>de.id===Z.target)}))},ae=BC(ce.nodes).force("charge",IC().strength(-100*h)).force("center",sC().strength(u)).force("link",CC(ce.links).distance(c)).force("collide",SC(Z=>me(Z)).iterations(3)),se=n.offsetWidth,Se=Math.max(n.offsetHeight,250),ke=["--secondary","--tertiary","--gray","--light","--lightgray","--dark","--darkgray","--bodyFont"].reduce((Z,de)=>(Z[de]=getComputedStyle(document.documentElement).getPropertyValue(de),Z),{}),z=Z=>Z.id===r?ke["--secondary"]:i.has(Z.id)||Z.id.startsWith("tags/")?ke["--tertiary"]:ke["--gray"];function me(Z){let de=ce.links.filter(pe=>pe.source.id===Z.id||pe.target.id===Z.id).length;return 2+Math.sqrt(de)}let j=null,ie=new Set,A=[],B=[];function R(Z){if(j=Z,Z===null){ie=new Set;for(let de of B)de.active=!1;for(let de of A)de.active=!1}else{ie=new Set;for(let de of A){let pe=de.simulationData;(pe.source.id===Z||pe.target.id===Z)&&(ie.add(pe.source.id),ie.add(pe.target.id)),de.active=pe.source.id===Z||pe.target.id===Z}for(let de of B)de.active=ie.has(de.simulationData.id)}}let $=0,q=!1;function te(){U.get("link")?.stop();let Z=new Io;for(let de of A){let pe=1;j&&(pe=de.active?1:.2),de.color=de.active?ke["--gray"]:ke["--lightgray"],Z.add(new Go(de).to({alpha:pe},200))}Z.getAll().forEach(de=>de.start()),U.set("link",{update:Z.update.bind(Z),stop(){Z.getAll().forEach(de=>de.stop())}})}function ee(){U.get("label")?.stop();let Z=new Io,de=1/l,pe=de*1.1;for(let be of B){let zt=be.simulationData.id;j===zt?Z.add(new Go(be.label).to({alpha:1,scale:{x:pe,y:pe}},100)):Z.add(new Go(be.label).to({alpha:be.label.alpha,scale:{x:de,y:de}},100))}Z.getAll().forEach(be=>be.start()),U.set("label",{update:Z.update.bind(Z),stop(){Z.getAll().forEach(be=>be.stop())}})}function le(){U.get("hover")?.stop();let Z=new Io;for(let de of B){let pe=1;j!==null&&v&&(pe=de.active?1:.2),Z.add(new Go(de.gfx,Z).to({alpha:pe},200))}Z.getAll().forEach(de=>de.start()),U.set("hover",{update:Z.update.bind(Z),stop(){Z.getAll().forEach(de=>de.stop())}})}function Ee(){le(),te(),ee()}U.forEach(Z=>Z.stop()),U.clear();let ve=new dv;await ve.init({width:se,height:Se,antialias:!0,autoStart:!1,autoDensity:!0,backgroundAlpha:0,preference:"webgpu",resolution:window.devicePixelRatio,eventMode:"static"}),n.appendChild(ve.canvas);let Le=ve.stage;Le.interactive=!1;let je=new St({zIndex:3}),qe=new St({zIndex:2}),Et=new St({zIndex:1});Le.addChild(qe,je,Et);for(let Z of ce.nodes){let de=Z.id,pe=new qC({interactive:!1,eventMode:"none",text:Z.text,alpha:0,anchor:{x:.5,y:1.2},style:{fontSize:f*15,fill:ke["--dark"],fontFamily:ke["--bodyFont"]},resolution:window.devicePixelRatio*4});pe.scale.set(1/l);let be=0,zt=de.startsWith("tags/"),_v=new Va({interactive:!0,label:de,eventMode:"static",hitArea:new oh(0,0,me(Z)),cursor:"pointer"}).circle(0,0,me(Z)).fill({color:zt?ke["--light"]:z(Z)}).stroke({width:zt?2:0,color:z(Z)}).on("pointerover",oA=>{R(oA.target.label),be=pe.alpha,q||Ee()}).on("pointerleave",()=>{R(null),pe.alpha=be,q||Ee()});qe.addChild(_v),je.addChild(pe);let aA={simulationData:Z,gfx:_v,label:pe,color:z(Z),alpha:1,active:!1};B.push(aA)}for(let Z of ce.links){let de=new Va({interactive:!1,eventMode:"none"});Et.addChild(de);let pe={simulationData:Z,gfx:de,color:ke["--lightgray"],alpha:1,active:!1};A.push(pe)}let Ke=Bo;if(s)kr(ve.canvas).call(_2().container(()=>ve.canvas).subject(()=>ce.nodes.find(Z=>Z.id===j)).on("start",function(Z){Z.active||ae.alphaTarget(1).restart(),Z.subject.fx=Z.subject.x,Z.subject.fy=Z.subject.y,Z.subject.__initialDragPos={x:Z.subject.x,y:Z.subject.y,fx:Z.subject.fx,fy:Z.subject.fy},$=Date.now(),q=!0}).on("drag",function(Z){let de=Z.subject.__initialDragPos;Z.subject.fx=de.x+(Z.x-de.x)/Ke.k,Z.subject.fy=de.y+(Z.y-de.y)/Ke.k}).on("end",function(Z){if(Z.active||ae.alphaTarget(0),Z.subject.fx=null,Z.subject.fy=null,q=!1,Date.now()-$<500){let de=ce.nodes.find(be=>be.id===Z.subject.id),pe=pv(t,de.id);window.spaNavigate(new URL(pe,window.location.toString()))}}));else for(let Z of B)Z.gfx.on("click",()=>{let de=pv(t,Z.simulationData.id);window.spaNavigate(new URL(de,window.location.toString()))});a&&kr(ve.canvas).call(HC().extent([[0,0],[se,Se]]).scaleExtent([.25,4]).on("zoom",({transform:Z})=>{Ke=Z,Le.scale.set(Z.k,Z.k),Le.position.set(Z.x,Z.y);let de=Z.k*d,pe=Math.max((de-1)/3.75,0),be=B.filter(zt=>zt.active).flatMap(zt=>zt.label);for(let zt of je.children)be.includes(zt)||(zt.alpha=pe)}));function er(Z){for(let de of B){let{x:pe,y:be}=de.simulationData;!pe||!be||(de.gfx.position.set(pe+se/2,be+Se/2),de.label&&de.label.position.set(pe+se/2,be+Se/2))}for(let de of A){let pe=de.simulationData;de.gfx.clear(),de.gfx.moveTo(pe.source.x+se/2,pe.source.y+Se/2),de.gfx.lineTo(pe.target.x+se/2,pe.target.y+Se/2).stroke({alpha:de.alpha,width:1,color:de.color})}U.forEach(de=>de.update(Z)),ve.renderer.render(Le),requestAnimationFrame(er)}let or=requestAnimationFrame(er);window.addCleanup(()=>cancelAnimationFrame(or))}document.addEventListener("nav",async e=>{let t=e.detail.url;sA(Ds(t)),await Mc("graph-container",t);let r=()=>{Mc("graph-container",t)};document.addEventListener("themechange",r),window.addCleanup(()=>{document.removeEventListener("themechange",r)});let i=document.getElementById("global-graph-outer"),n=i?.closest(".sidebar");function s(){let h=JC(window);i?.classList.add("active"),n&&(n.style.zIndex="1"),Mc("global-graph-container",h),KC(i,a)}function a(){i?.classList.remove("active"),n&&(n.style.zIndex="")}async function o(h){h.key==="g"&&(h.ctrlKey||h.metaKey)&&!h.shiftKey&&(h.preventDefault(),i?.classList.contains("active")?a():s())}let l=document.getElementById("global-graph-icon");l?.addEventListener("click",s),window.addCleanup(()=>l?.removeEventListener("click",s)),document.addEventListener("keydown",o),window.addCleanup(()=>document.removeEventListener("keydown",o))})}(),function(){var Dt=new IntersectionObserver(ft=>{for(let kt of ft){let Yt=kt.target.id,_=document.querySelector(`a[data-for="${Yt}"]`),Ve=kt.rootBounds?.height;Ve&&_&&(kt.boundingClientRect.yft.removeEventListener("click",Rt))}}window.addEventListener("resize",Xt),document.addEventListener("nav",()=>{Xt(),Dt.disconnect(),document.querySelectorAll("h1[id], h2[id], h3[id], h4[id], h5[id], h6[id]").forEach(ft=>Dt.observe(ft))})}(),function(){var Dt=Object.create,Rt=Object.defineProperty,Xt=Object.getOwnPropertyDescriptor,ft=Object.getOwnPropertyNames,kt=Object.getPrototypeOf,Yt=Object.prototype.hasOwnProperty,_=(p,m)=>()=>(m||p((m={exports:{}}).exports,m),m.exports),Ve=(p,m,T,S)=>{if(m&&typeof m=="object"||typeof m=="function")for(let C of ft(m))!Yt.call(p,C)&&C!==T&&Rt(p,C,{get:()=>m[C],enumerable:!(S=Xt(m,C))||S.enumerable});return p},$e=(p,m,T)=>(T=p!=null?Dt(kt(p)):{},Ve(m||!p||!p.__esModule?Rt(T,"default",{value:p,enumerable:!0}):T,p)),Bt=_((p,m)=>{"use strict";m.exports=S;function T(k){return k instanceof Buffer?Buffer.from(k):new k.constructor(k.buffer.slice(),k.byteOffset,k.length)}function S(k){if(k=k||{},k.circles)return C(k);let D=new Map;if(D.set(Date,G=>new Date(G)),D.set(Map,(G,K)=>new Map(V(Array.from(G),K))),D.set(Set,(G,K)=>new Set(V(Array.from(G),K))),k.constructorHandlers)for(let G of k.constructorHandlers)D.set(G[0],G[1]);let W=null;return k.proto?H:Y;function V(G,K){let L=Object.keys(G),J=new Array(L.length);for(let ue=0;uenew Date(L)),V.set(Map,(L,J)=>new Map(H(Array.from(L),J))),V.set(Set,(L,J)=>new Set(H(Array.from(L),J))),k.constructorHandlers)for(let L of k.constructorHandlers)V.set(L[0],L[1]);let Y=null;return k.proto?K:G;function H(L,J){let ue=Object.keys(L),ne=new Array(ue.length);for(let Be=0;Be({x:p,y:p}),fe={left:"right",right:"left",bottom:"top",top:"bottom"},re={start:"end",end:"start"};function _t(p,m,T){return I(p,ct(m,T))}function Vt(p,m){return typeof p=="function"?p(m):p}function et(p){return p.split("-")[0]}function xt(p){return p.split("-")[1]}function Gr(p){return p==="x"?"y":"x"}function Ut(p){return p==="y"?"height":"width"}function st(p){return["top","bottom"].includes(et(p))?"y":"x"}function bt(p){return Gr(st(p))}function at(p,m,T){T===void 0&&(T=!1);let S=xt(p),C=bt(p),k=Ut(C),D=C==="x"?S===(T?"end":"start")?"right":"left":S==="start"?"bottom":"top";return m.reference[k]>m.floating[k]&&(D=Ft(D)),[D,Ft(D)]}function Jr(p){let m=Ft(p);return[br(p),m,br(m)]}function br(p){return p.replace(/start|end/g,m=>re[m])}function gi(p,m,T){let S=["left","right"],C=["right","left"],k=["top","bottom"],D=["bottom","top"];switch(p){case"top":case"bottom":return T?m?C:S:m?S:C;case"left":case"right":return m?k:D;default:return[]}}function gr(p,m,T,S){let C=xt(p),k=gi(et(p),T==="start",S);return C&&(k=k.map(D=>D+"-"+C),m&&(k=k.concat(k.map(br)))),k}function Ft(p){return p.replace(/left|right|bottom|top/g,m=>fe[m])}function Or(p){return{top:0,right:0,bottom:0,left:0,...p}}function lr(p){return typeof p!="number"?Or(p):{top:p,right:p,bottom:p,left:p}}function tr(p){let{x:m,y:T,width:S,height:C}=p;return{width:S,height:C,top:T,left:m,right:m+S,bottom:T+C,x:m,y:T}}function Dr(p,m,T){let{reference:S,floating:C}=p,k=st(m),D=bt(m),W=Ut(D),V=et(m),Y=k==="y",H=S.x+S.width/2-C.width/2,G=S.y+S.height/2-C.height/2,K=S[W]/2-C[W]/2,L;switch(V){case"top":L={x:H,y:S.y-C.height};break;case"bottom":L={x:H,y:S.y+S.height};break;case"right":L={x:S.x+S.width,y:G};break;case"left":L={x:S.x-C.width,y:G};break;default:L={x:S.x,y:S.y}}switch(xt(m)){case"start":L[D]-=K*(T&&Y?-1:1);break;case"end":L[D]+=K*(T&&Y?-1:1);break}return L}var Lt=async(p,m,T)=>{let{placement:S="bottom",strategy:C="absolute",middleware:k=[],platform:D}=T,W=k.filter(Boolean),V=await(D.isRTL==null?void 0:D.isRTL(m)),Y=await D.getElementRects({reference:p,floating:m,strategy:C}),{x:H,y:G}=Dr(Y,S,V),K=S,L={},J=0;for(let ue=0;ueht<=0)){var Ye,lt;let ht=(((Ye=k.flip)==null?void 0:Ye.index)||0)+1,Qt=Fe[ht];if(Qt)return{data:{index:ht,overflows:Oe},reset:{placement:Qt}};let qt=(lt=Oe.filter(vt=>vt.overflows[0]<=0).sort((vt,_r)=>vt.overflows[1]-_r.overflows[1])[0])==null?void 0:lt.placement;if(!qt)switch(L){case"bestFit":{var gt;let vt=(gt=Oe.map(_r=>[_r.placement,_r.overflows.filter(Nr=>Nr>0).reduce((Nr,Un)=>Nr+Un,0)]).sort((_r,Nr)=>_r[1]-Nr[1])[0])==null?void 0:gt[0];vt&&(qt=vt);break}case"initialPlacement":qt=W;break}if(C!==qt)return{reset:{placement:qt}}}return{}}}};function Fr(p){let m=ct(...p.map(k=>k.left)),T=ct(...p.map(k=>k.top)),S=I(...p.map(k=>k.right)),C=I(...p.map(k=>k.bottom));return{x:m,y:T,width:S-m,height:C-T}}function rr(p){let m=p.slice().sort((C,k)=>C.y-k.y),T=[],S=null;for(let C=0;CS.height/2?T.push([k]):T[T.length-1].push(k),S=k}return T.map(C=>tr(Fr(C)))}var hr=function(p){return p===void 0&&(p={}),{name:"inline",options:p,async fn(m){let{placement:T,elements:S,rects:C,platform:k,strategy:D}=m,{padding:W=2,x:V,y:Y}=Vt(p,m),H=Array.from(await(k.getClientRects==null?void 0:k.getClientRects(S.reference))||[]),G=rr(H),K=tr(Fr(H)),L=lr(W);function J(){if(G.length===2&&G[0].left>G[1].right&&V!=null&&Y!=null)return G.find(ne=>V>ne.left-L.left&&Vne.top-L.top&&Y=2){if(st(T)==="y"){let lt=G[0],gt=G[G.length-1],ht=et(T)==="top",Qt=lt.top,qt=gt.bottom,vt=ht?lt.left:gt.left,_r=ht?lt.right:gt.right,Nr=_r-vt,Un=qt-Qt;return{top:Qt,bottom:qt,left:vt,right:_r,width:Nr,height:Un,x:vt,y:Qt}}let ne=et(T)==="left",Be=I(...G.map(lt=>lt.right)),ge=ct(...G.map(lt=>lt.left)),ze=G.filter(lt=>ne?lt.left===ge:lt.right===Be),ot=ze[0].top,Fe=ze[ze.length-1].bottom,ur=ge,Ae=Be,Oe=Ae-ur,Ye=Fe-ot;return{top:ot,bottom:Fe,left:ur,right:Ae,width:Oe,height:Ye,x:ur,y:ot}}return K}let ue=await k.getElementRects({reference:{getBoundingClientRect:J},floating:S.floating,strategy:D});return C.reference.x!==ue.reference.x||C.reference.y!==ue.reference.y||C.reference.width!==ue.reference.width||C.reference.height!==ue.reference.height?{reset:{rects:ue}}:{}}}},ir=function(p){return p===void 0&&(p={}),{name:"shift",options:p,async fn(m){let{x:T,y:S,placement:C}=m,{mainAxis:k=!0,crossAxis:D=!1,limiter:W={fn:ne=>{let{x:Be,y:ge}=ne;return{x:Be,y:ge}}},...V}=Vt(p,m),Y={x:T,y:S},H=await Ur(m,V),G=st(et(C)),K=Gr(G),L=Y[K],J=Y[G];if(k){let ne=K==="y"?"top":"left",Be=K==="y"?"bottom":"right",ge=L+H[ne],ze=L-H[Be];L=_t(ge,L,ze)}if(D){let ne=G==="y"?"top":"left",Be=G==="y"?"bottom":"right",ge=J+H[ne],ze=J-H[Be];J=_t(ge,J,ze)}let ue=W.fn({...m,[K]:L,[G]:J});return{...ue,data:{x:ue.x-T,y:ue.y-S}}}}};function wr(){return typeof window<"u"}function Wt(p){return X(p)?(p.nodeName||"").toLowerCase():"#document"}function pt(p){var m;return(p==null||(m=p.ownerDocument)==null?void 0:m.defaultView)||window}function Gt(p){var m;return(m=(X(p)?p.ownerDocument:p.document)||window.document)==null?void 0:m.documentElement}function X(p){return wr()?p instanceof Node||p instanceof pt(p).Node:!1}function Q(p){return wr()?p instanceof Element||p instanceof pt(p).Element:!1}function he(p){return wr()?p instanceof HTMLElement||p instanceof pt(p).HTMLElement:!1}function we(p){return!wr()||typeof ShadowRoot>"u"?!1:p instanceof ShadowRoot||p instanceof pt(p).ShadowRoot}function De(p){let{overflow:m,overflowX:T,overflowY:S,display:C}=Pe(p);return/auto|scroll|overlay|hidden|clip/.test(m+S+T)&&!["inline","contents"].includes(C)}function Te(p){return["table","td","th"].includes(Wt(p))}function Ge(p){return[":popover-open",":modal"].some(m=>{try{return p.matches(m)}catch{return!1}})}function Ue(p){let m=Ne(),T=Q(p)?Pe(p):p;return T.transform!=="none"||T.perspective!=="none"||(T.containerType?T.containerType!=="normal":!1)||!m&&(T.backdropFilter?T.backdropFilter!=="none":!1)||!m&&(T.filter?T.filter!=="none":!1)||["transform","perspective","filter"].some(S=>(T.willChange||"").includes(S))||["paint","layout","strict","content"].some(S=>(T.contain||"").includes(S))}function Ce(p){let m=ye(p);for(;he(m)&&!Ct(m);){if(Ue(m))return m;if(Ge(m))return null;m=ye(m)}return null}function Ne(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Ct(p){return["html","body","#document"].includes(Wt(p))}function Pe(p){return pt(p).getComputedStyle(p)}function tt(p){return Q(p)?{scrollLeft:p.scrollLeft,scrollTop:p.scrollTop}:{scrollLeft:p.scrollX,scrollTop:p.scrollY}}function ye(p){if(Wt(p)==="html")return p;let m=p.assignedSlot||p.parentNode||we(p)&&p.host||Gt(p);return we(m)?m.host:m}function Re(p){let m=ye(p);return Ct(m)?p.ownerDocument?p.ownerDocument.body:p.body:he(m)&&De(m)?m:Re(m)}function it(p,m,T){var S;m===void 0&&(m=[]),T===void 0&&(T=!0);let C=Re(p),k=C===((S=p.ownerDocument)==null?void 0:S.body),D=pt(C);if(k){let W=xe(D);return m.concat(D,D.visualViewport||[],De(C)?C:[],W&&T?it(W):[])}return m.concat(C,it(C,[],T))}function xe(p){return p.parent&&Object.getPrototypeOf(p.parent)?p.frameElement:null}function nt(p){let m=Pe(p),T=parseFloat(m.width)||0,S=parseFloat(m.height)||0,C=he(p),k=C?p.offsetWidth:T,D=C?p.offsetHeight:S,W=It(T)!==k||It(S)!==D;return W&&(T=k,S=D),{width:T,height:S,$:W}}function wt(p){return Q(p)?p:p.contextElement}function _e(p){let m=wt(p);if(!he(m))return Xe(1);let T=m.getBoundingClientRect(),{width:S,height:C,$:k}=nt(m),D=(k?It(T.width):T.width)/S,W=(k?It(T.height):T.height)/C;return(!D||!Number.isFinite(D))&&(D=1),(!W||!Number.isFinite(W))&&(W=1),{x:D,y:W}}var ei=Xe(0);function _i(p){let m=pt(p);return!Ne()||!m.visualViewport?ei:{x:m.visualViewport.offsetLeft,y:m.visualViewport.offsetTop}}function Ze(p,m,T){return m===void 0&&(m=!1),!T||m&&T!==pt(p)?!1:m}function Pt(p,m,T,S){m===void 0&&(m=!1),T===void 0&&(T=!1);let C=p.getBoundingClientRect(),k=wt(p),D=Xe(1);m&&(S?Q(S)&&(D=_e(S)):D=_e(p));let W=Ze(k,T,S)?_i(k):Xe(0),V=(C.left+W.x)/D.x,Y=(C.top+W.y)/D.y,H=C.width/D.x,G=C.height/D.y;if(k){let K=pt(k),L=S&&Q(S)?pt(S):S,J=K,ue=xe(J);for(;ue&&S&&L!==J;){let ne=_e(ue),Be=ue.getBoundingClientRect(),ge=Pe(ue),ze=Be.left+(ue.clientLeft+parseFloat(ge.paddingLeft))*ne.x,ot=Be.top+(ue.clientTop+parseFloat(ge.paddingTop))*ne.y;V*=ne.x,Y*=ne.y,H*=ne.x,G*=ne.y,V+=ze,Y+=ot,J=pt(ue),ue=xe(J)}}return tr({width:H,height:G,x:V,y:Y})}function ti(p,m){let T=tt(p).scrollLeft;return m?m.left+T:Pt(Gt(p)).left+T}function ut(p,m,T){T===void 0&&(T=!1);let S=p.getBoundingClientRect(),C=S.left+m.scrollLeft-(T?0:ti(p,S)),k=S.top+m.scrollTop;return{x:C,y:k}}function vi(p){let{elements:m,rect:T,offsetParent:S,strategy:C}=p,k=C==="fixed",D=Gt(S),W=m?Ge(m.floating):!1;if(S===D||W&&k)return T;let V={scrollLeft:0,scrollTop:0},Y=Xe(1),H=Xe(0),G=he(S);if((G||!G&&!k)&&((Wt(S)!=="body"||De(D))&&(V=tt(S)),he(S))){let L=Pt(S);Y=_e(S),H.x=L.x+S.clientLeft,H.y=L.y+S.clientTop}let K=D&&!G&&!k?ut(D,V,!0):Xe(0);return{width:T.width*Y.x,height:T.height*Y.y,x:T.x*Y.x-V.scrollLeft*Y.x+H.x+K.x,y:T.y*Y.y-V.scrollTop*Y.y+H.y+K.y}}function At(p){return Array.from(p.getClientRects())}function We(p){let m=Gt(p),T=tt(p),S=p.ownerDocument.body,C=I(m.scrollWidth,m.clientWidth,S.scrollWidth,S.clientWidth),k=I(m.scrollHeight,m.clientHeight,S.scrollHeight,S.clientHeight),D=-T.scrollLeft+ti(p),W=-T.scrollTop;return Pe(S).direction==="rtl"&&(D+=I(m.clientWidth,S.clientWidth)-C),{width:C,height:k,x:D,y:W}}function ki(p,m){let T=pt(p),S=Gt(p),C=T.visualViewport,k=S.clientWidth,D=S.clientHeight,W=0,V=0;if(C){k=C.width,D=C.height;let Y=Ne();(!Y||Y&&m==="fixed")&&(W=C.offsetLeft,V=C.offsetTop)}return{width:k,height:D,x:W,y:V}}function Qe(p,m){let T=Pt(p,!0,m==="fixed"),S=T.top+p.clientTop,C=T.left+p.clientLeft,k=he(p)?_e(p):Xe(1),D=p.clientWidth*k.x,W=p.clientHeight*k.y,V=C*k.x,Y=S*k.y;return{width:D,height:W,x:V,y:Y}}function Bi(p,m,T){let S;if(m==="viewport")S=ki(p,T);else if(m==="document")S=We(Gt(p));else if(Q(m))S=Qe(m,T);else{let C=_i(p);S={x:m.x-C.x,y:m.y-C.y,width:m.width,height:m.height}}return tr(S)}function dt(p,m){let T=ye(p);return T===m||!Q(T)||Ct(T)?!1:Pe(T).position==="fixed"||dt(T,m)}function yi(p,m){let T=m.get(p);if(T)return T;let S=it(p,[],!1).filter(W=>Q(W)&&Wt(W)!=="body"),C=null,k=Pe(p).position==="fixed",D=k?ye(p):p;for(;Q(D)&&!Ct(D);){let W=Pe(D),V=Ue(D);!V&&W.position==="fixed"&&(C=null),(k?!V&&!C:!V&&W.position==="static"&&C&&["absolute","fixed"].includes(C.position)||De(D)&&!V&&dt(p,D))?S=S.filter(Y=>Y!==D):C=W,D=ye(D)}return m.set(p,S),S}function Ji(p){let{element:m,boundary:T,rootBoundary:S,strategy:C}=p,k=[...T==="clippingAncestors"?Ge(m)?[]:yi(m,this._c):[].concat(T),S],D=k[0],W=k.reduce((V,Y)=>{let H=Bi(m,Y,C);return V.top=I(H.top,V.top),V.right=ct(H.right,V.right),V.bottom=ct(H.bottom,V.bottom),V.left=I(H.left,V.left),V},Bi(m,D,C));return{width:W.right-W.left,height:W.bottom-W.top,x:W.left,y:W.top}}function en(p){let{width:m,height:T}=nt(p);return{width:m,height:T}}function He(p,m,T){let S=he(m),C=Gt(m),k=T==="fixed",D=Pt(p,!0,k,m),W={scrollLeft:0,scrollTop:0},V=Xe(0);if(S||!S&&!k)if((Wt(m)!=="body"||De(C))&&(W=tt(m)),S){let K=Pt(m,!0,k,m);V.x=K.x+m.clientLeft,V.y=K.y+m.clientTop}else C&&(V.x=ti(C));let Y=C&&!S&&!k?ut(C,W):Xe(0),H=D.left+W.scrollLeft-V.x-Y.x,G=D.top+W.scrollTop-V.y-Y.y;return{x:H,y:G,width:D.width,height:D.height}}function Ot(p){return Pe(p).position==="static"}function Ii(p,m){if(!he(p)||Pe(p).position==="fixed")return null;if(m)return m(p);let T=p.offsetParent;return Gt(p)===T&&(T=T.ownerDocument.body),T}function tn(p,m){let T=pt(p);if(Ge(p))return T;if(!he(p)){let C=ye(p);for(;C&&!Ct(C);){if(Q(C)&&!Ot(C))return C;C=ye(C)}return T}let S=Ii(p,m);for(;S&&Te(S)&&Ot(S);)S=Ii(S,m);return S&&Ct(S)&&Ot(S)&&!Ue(S)?T:S||Ce(p)||T}var mr=async function(p){let m=this.getOffsetParent||tn,T=this.getDimensions,S=await T(p.floating);return{reference:He(p.reference,await m(p.floating),p.strategy),floating:{x:0,y:0,width:S.width,height:S.height}}};function jt(p){return Pe(p).direction==="rtl"}var rn={convertOffsetParentRelativeRectToViewportRelativeRect:vi,getDocumentElement:Gt,getClippingRect:Ji,getOffsetParent:tn,getElementRects:mr,getClientRects:At,getDimensions:en,getScale:_e,isElement:Q,isRTL:jt},ri=ir,ii=mi,ni=hr,si=(p,m,T)=>{let S=new Map,C={platform:rn,...T},k={...C.platform,_c:S};return Lt(p,m,{...C,platform:k})},Lr=Object.hasOwnProperty,On=$e(Bt(),1),nn=(0,On.default)(),Gi=(p,m,T)=>{let S=new URL(p.getAttribute(m),T);p.setAttribute(m,S.pathname+S.hash)};function sn(p,m){p.querySelectorAll('[href^="./"], [href^="../"]').forEach(T=>Gi(T,"href",m)),p.querySelectorAll('[src^="./"], [src^="../"]').forEach(T=>Gi(T,"src",m))}var Dn=//;async function g(p){let m=await fetch(`${p}`);if(!m.headers.get("content-type")?.startsWith("text/html"))return m;let T=await m.clone().text(),[S,C]=T.match(Dn)??[];return C?fetch(C):m}var b=new DOMParser;async function E({clientX:p,clientY:m}){let T=this;if(T.dataset.noPopover==="true")return;async function S(J){let{x:ue,y:ne}=await si(T,J,{middleware:[ni({x:p,y:m}),ri(),ii()]});Object.assign(J.style,{left:`${ue}px`,top:`${ne}px`})}let C=()=>[...T.children].some(J=>J.classList.contains("popover"));if(C())return S(T.lastChild);let k=new URL(document.location.href);k.hash="",k.search="";let D=new URL(T.href),W=decodeURIComponent(D.hash);D.hash="",D.search="";let V=await g(D).catch(J=>{console.error(J)});if(C()||!V)return;let[Y]=V.headers.get("Content-Type").split(";"),[H,G]=Y.split("/"),K=document.createElement("div");K.classList.add("popover");let L=document.createElement("div");switch(L.classList.add("popover-inner"),K.appendChild(L),L.dataset.contentType=Y??void 0,H){case"image":let J=document.createElement("img");J.src=D.toString(),J.alt=D.pathname,L.appendChild(J);break;case"application":switch(G){case"pdf":let ge=document.createElement("iframe");ge.src=D.toString(),L.appendChild(ge);break;default:break}break;default:let ue=await V.text(),ne=b.parseFromString(ue,"text/html");sn(ne,D);let Be=[...ne.getElementsByClassName("popover-hint")];if(Be.length===0)return;Be.forEach(ge=>L.appendChild(ge))}if(S(K),T.appendChild(K),W!==""){let J=L.querySelector(W);J&&L.scroll({top:J.offsetTop-12,behavior:"instant"})}}document.addEventListener("nav",()=>{let p=[...document.getElementsByClassName("internal")];for(let m of p)m.addEventListener("mouseenter",E),window.addCleanup(()=>m.removeEventListener("mouseenter",E))})}(),function(){var Dt=Object.create,Rt=Object.defineProperty,Xt=Object.getOwnPropertyDescriptor,ft=Object.getOwnPropertyNames,kt=Object.getPrototypeOf,Yt=Object.prototype.hasOwnProperty,_=(X,Q)=>()=>(Q||X((Q={exports:{}}).exports,Q),Q.exports),Ve=(X,Q,he,we)=>{if(Q&&typeof Q=="object"||typeof Q=="function")for(let De of ft(Q))!Yt.call(X,De)&&De!==he&&Rt(X,De,{get:()=>Q[De],enumerable:!(we=Xt(Q,De))||we.enumerable});return X},$e=(X,Q,he)=>(he=X!=null?Dt(kt(X)):{},Ve(Q||!X||!X.__esModule?Rt(he,"default",{value:X,enumerable:!0}):he,X)),Bt=_((X,Q)=>{"use strict";Q.exports=we;function he(Te){return Te instanceof Buffer?Buffer.from(Te):new Te.constructor(Te.buffer.slice(),Te.byteOffset,Te.length)}function we(Te){if(Te=Te||{},Te.circles)return De(Te);let Ge=new Map;if(Ge.set(Date,Pe=>new Date(Pe)),Ge.set(Map,(Pe,tt)=>new Map(Ce(Array.from(Pe),tt))),Ge.set(Set,(Pe,tt)=>new Set(Ce(Array.from(Pe),tt))),Te.constructorHandlers)for(let Pe of Te.constructorHandlers)Ge.set(Pe[0],Pe[1]);let Ue=null;return Te.proto?Ct:Ne;function Ce(Pe,tt){let ye=Object.keys(Pe),Re=new Array(ye.length);for(let it=0;itnew Date(ye)),Ce.set(Map,(ye,Re)=>new Map(Ct(Array.from(ye),Re))),Ce.set(Set,(ye,Re)=>new Set(Ct(Array.from(ye),Re))),Te.constructorHandlers)for(let ye of Te.constructorHandlers)Ce.set(ye[0],ye[1]);let Ne=null;return Te.proto?tt:Pe;function Ct(ye,Re){let it=Object.keys(ye),xe=new Array(it.length);for(let nt=0;nt(Q,he)=>Q[`node${X}`]===he[`node${X}`],I=ct("Name"),It=ct("Type"),Xe=ct("Value");function fe(X,Q){if(X.attributes.length===0&&Q.attributes.length===0)return[];let he=[],we=new Map,De=new Map;for(let Te of X.attributes)we.set(Te.name,Te.value);for(let Te of Q.attributes){let Ge=we.get(Te.name);Te.value===Ge?we.delete(Te.name):(typeof Ge<"u"&&we.delete(Te.name),De.set(Te.name,Te.value))}for(let Te of we.keys())he.push({type:5,name:Te});for(let[Te,Ge]of De.entries())he.push({type:4,name:Te,value:Ge});return he}function re(X,Q=!0){let he=`${X.localName}`;for(let{name:we,value:De}of X.attributes)Q&&we.startsWith("data-")||(he+=`[${we}=${De}]`);return he+=X.innerHTML,he}function _t(X){switch(X.tagName){case"BASE":case"TITLE":return X.localName;case"META":{if(X.hasAttribute("name"))return`meta[name="${X.getAttribute("name")}"]`;if(X.hasAttribute("property"))return`meta[name="${X.getAttribute("property")}"]`;break}case"LINK":{if(X.hasAttribute("rel")&&X.hasAttribute("href"))return`link[rel="${X.getAttribute("rel")}"][href="proxy.php?url=https%3A%2F%2Faminmasoudi.github.io%2F%24%7BX.getAttribute%28"href")}"]`;if(X.hasAttribute("href"))return`link[href="proxy.php?url=https%3A%2F%2Faminmasoudi.github.io%2F%24%7BX.getAttribute%28"href")}"]`;break}}return re(X)}function Vt(X){let[Q,he=""]=X.split("?");return`${Q}?t=${Date.now()}&${he.replace(/t=\d+/g,"")}`}function et(X){if(X.nodeType===1&&X.hasAttribute("data-persist"))return X;if(X.nodeType===1&&X.localName==="script"){let Q=document.createElement("script");for(let{name:he,value:we}of X.attributes)he==="src"&&(we=Vt(we)),Q.setAttribute(he,we);return Q.innerHTML=X.innerHTML,Q}return X.cloneNode(!0)}function xt(X,Q){if(X.children.length===0&&Q.children.length===0)return[];let he=[],we=new Map,De=new Map,Te=new Map;for(let Ge of X.children)we.set(_t(Ge),Ge);for(let Ge of Q.children){let Ue=_t(Ge),Ce=we.get(Ue);Ce?re(Ge,!1)!==re(Ce,!1)&&De.set(Ue,et(Ge)):Te.set(Ue,et(Ge)),we.delete(Ue)}for(let Ge of X.childNodes){if(Ge.nodeType===1){let Ue=_t(Ge);if(we.has(Ue)){he.push({type:1});continue}else if(De.has(Ue)){let Ce=De.get(Ue);he.push({type:3,attributes:fe(Ge,Ce),children:Gr(Ge,Ce)});continue}}he.push(void 0)}for(let Ge of Te.values())he.push({type:0,node:et(Ge)});return he}function Gr(X,Q){let he=[],we=Math.max(X.childNodes.length,Q.childNodes.length);for(let De=0;Debt(we,Ue,Ge[Ce])));return}}}function at(X,Q){let he=Ut(X,Q);return bt(X,he)}var Jr=Object.hasOwnProperty,br=$e(Bt(),1),gi=(0,br.default)();function gr(X){return X.document.body.dataset.slug}var Ft=(X,Q,he)=>{let we=new URL(X.getAttribute(Q),he);X.setAttribute(Q,we.pathname+we.hash)};function Or(X,Q){X.querySelectorAll('[href^="./"], [href^="../"]').forEach(he=>Ft(he,"href",Q)),X.querySelectorAll('[src^="./"], [src^="../"]').forEach(he=>Ft(he,"src",Q))}var lr=//;async function tr(X){let Q=await fetch(`${X}`);if(!Q.headers.get("content-type")?.startsWith("text/html"))return Q;let he=await Q.clone().text(),[we,De]=he.match(lr)??[];return De?fetch(De):Q}var Dr=1,Lt=document.createElement("route-announcer"),Ur=X=>X?.nodeType===Dr,mi=X=>{try{let Q=new URL(X);if(window.location.origin===Q.origin)return!0}catch{}return!1},Fr=X=>{let Q=X.origin===window.location.origin,he=X.pathname===window.location.pathname;return Q&&he},rr=({target:X})=>{if(!Ur(X)||X.attributes.getNamedItem("target")?.value==="_blank")return;let Q=X.closest("a");if(!Q||"routerIgnore"in Q.dataset)return;let{href:he}=Q;if(mi(he))return{url:new URL(he),scroll:"routerNoscroll"in Q.dataset?!1:void 0}};function hr(X){let Q=new CustomEvent("nav",{detail:{url:X}});document.dispatchEvent(Q)}var ir=new Set;window.addCleanup=X=>ir.add(X);function wr(){let X=document.createElement("div");X.className="navigation-progress",X.style.width="0",document.body.contains(X)||document.body.appendChild(X),setTimeout(()=>{X.style.width="80%"},100)}var Wt;async function pt(X,Q=!1){wr(),Wt=Wt||new DOMParser;let he=await tr(X).then(Te=>{if(Te.headers.get("content-type")?.startsWith("text/html"))return Te.text();window.location.assign(X)}).catch(()=>{window.location.assign(X)});if(!he)return;ir.forEach(Te=>Te()),ir.clear();let we=Wt.parseFromString(he,"text/html");Or(we,X);let De=we.querySelector("title")?.textContent;if(De)document.title=De;else{let Te=document.querySelector("h1");De=Te?.innerText??Te?.textContent??X.pathname}Lt.textContent!==De&&(Lt.textContent=De),Lt.dataset.persist="",we.body.appendChild(Lt),at(document.body,we.body),Q||(X.hash?document.getElementById(decodeURIComponent(X.hash.substring(1)))?.scrollIntoView():window.scrollTo({top:0})),document.head.querySelectorAll(":not([spa-preserve])").forEach(Te=>Te.remove()),we.head.querySelectorAll(":not([spa-preserve])").forEach(Te=>document.head.appendChild(Te)),Q||history.pushState({},"",X),hr(gr(window)),delete Lt.dataset.persist}window.spaNavigate=pt;function Gt(){return typeof window<"u"&&(window.addEventListener("click",async X=>{let{url:Q}=rr(X)??{};if(!(!Q||X.ctrlKey||X.metaKey)){if(X.preventDefault(),Fr(Q)&&Q.hash){document.getElementById(decodeURIComponent(Q.hash.substring(1)))?.scrollIntoView(),history.pushState({},"",Q);return}try{pt(Q,!1)}catch{window.location.assign(Q)}}}),window.addEventListener("popstate",X=>{let{url:Q}=rr(X)??{};if(!(window.location.hash&&window.location.pathname===Q?.pathname))try{pt(new URL(window.location.toString()),!0)}catch{window.location.reload()}})),new class{go(X){let Q=new URL(X,window.location.toString());return pt(Q,!1)}back(){return window.history.back()}forward(){return window.history.forward()}}}if(Gt(),hr(gr(window)),!customElements.get("route-announcer")){let X={"aria-live":"assertive","aria-atomic":"true",style:"position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"};customElements.define("route-announcer",class extends HTMLElement{constructor(){super()}connectedCallback(){for(let[Q,he]of Object.entries(X))this.setAttribute(Q,he)}})}}();