mirror of
https://github.com/SoPat712/dotfiles.git
synced 2025-08-21 10:38:44 -04:00
242 lines
260 KiB
JavaScript
242 lines
260 KiB
JavaScript
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./MoveTorrentFileDialog-Dhy8JCS7.js","./ColoredChip.vue_vue_type_script_setup_true_lang-DosC_URk.js","./index-BhWmfNB5.js","./vue-DFryKk-1.js","./vuetify-XtA0Y0Oj.js","./index-X6gg79ld.css","./BulkRenameFilesDialog-CXJ2V15O.js","./BulkRenameFilesDialog-CKEu44go.css","./browserAll-C1HMKx36.js","./webworkerAll-D3jJ_Vry.js","./colorToUniform-C2GHuDhf.js","./CanvasPool-BAToQajg.js","./WebGPURenderer-WqxaCEVy.js","./SharedSystems-B1uG7cSA.js","./WebGLRenderer-DlZELJmP.js"])))=>i.map(i=>d[i]);
|
|
import{b as ve,a as vo,_ as wo}from"./ColoredChip.vue_vue_type_script_setup_true_lang-DosC_URk.js";import{s as Qt,c as Z,a as Yi,a6 as Gr,a0 as Xi,d as pt,V as Co,Q as yt,r as bs,l as Ao,A as Ue,a7 as rr,h as vt,H as So,B as N,D as q,G as v,m as x,I as W,J as G,u as D,K as He,M as Rt,L as Wi,O as Ye,S as Y,N as j,X as gs,U as ji,w as Je,z as ts,q as vs,n as Se,$ as Nr,T as $t,F as Pt,E as qi,a2 as Cr,R as To,W as Vr,v as ko,a8 as Ki,a9 as Zi,P as Po}from"./vue-DFryKk-1.js";import{bp as rt,a1 as Qi,$ as we,u as ee,F as ws,o as Wt,a2 as Mo,ae as Ji,p as Cs,bq as Te,c as tn,e as As,f as pe,g as en,a as Jt,i as Xe,j as ke,k as ht,d as Ht,l as We,br as Or,J as Io,K as Eo,q as dt,s as st,v as zr,bs as Do,a5 as Vt,V as At,ah as sn,bn as Ro,a8 as Ss,R as _s,U as Fo,ax as Bo,W as Ts,ac as ye,C as me,A as ge,a4 as $o,be as Go,r as ys,t as je,an as Lr,bk as fe,z as No,bt as Is,bh as Vo,bc as Oo,bd as zo,bl as Ur,bu as Lo,bv as Uo,I as Ho,ap as Yo,ai as ir,b8 as Xo,bw as Wo,aO as jo,au as qo,ag as nr,a0 as rn,bx as Ko,by as Es,ad as nn,b as Zo,m as Qo,aw as Hr,b2 as Jo,b0 as ta,a3 as ea,b1 as xe,a7 as sa,__tla as __tla_0}from"./index-BhWmfNB5.js";import{a as on,u as ra}from"./vuetify-XtA0Y0Oj.js";let Ls,Kn,Mt,Tt,ne,lt,te,Ps,_n,Cl,Xt,ai,qe,it,ql,ih,St,_t,mr,kh,ns,dr,Ct,lh,hi,ci,Tl,la,re,Ft,bn,Zn,ft,gt,fh,Rh,Qh,tu,nu,au,lu,Be,Ve,Ui,ph,mh,Pr,Ae,Me,fo,Ai,wi,Wa,xs,qa,go,Yc,Ah,Ze,ps,jt,Ci,aa,Mr,Wn,En,qt,Xn,Zh,qr,Jh,ru,so,ll,ou,Ir,_e,ut,Yt,Ln,ja,uu;let __tla=Promise.all([(()=>{try{return __tla_0}catch{}})()]).then(async()=>{var le=(r=>(r[r.DISABLED=0]="DISABLED",r[r.NOT_YET_CONTACTED=1]="NOT_YET_CONTACTED",r[r.WORKING=2]="WORKING",r[r.UPDATING=3]="UPDATING",r[r.NOT_WORKING=4]="NOT_WORKING",r))(le||{});class ia{type;id;fullName;name;availability;priority;progress;size;get selectedSize(){return this.wanted?this.size:0}get childrenIds(){return[this.id]}get wanted(){return this.priority!==rt.DO_NOT_DOWNLOAD}deepCount=[0,1];constructor(t,e){this.type="file",this.name=e,this.id=t.index,this.fullName=t.name,this.availability=t.availability,this.priority=t.priority,this.progress=t.progress,this.size=t.size}buildCache(){}isSelected(t){return t.has(this.fullName)}}class an{type;id;fullName;name;children;priority=rt.DO_NOT_DOWNLOAD;childrenIds=[];wanted=null;progress=0;deepCount=[1,0];size=0;selectedSize=0;constructor(t,e){this.type="folder",this.id=e,this.fullName=e,this.name=t,this.children=[]}buildCache(){if(this.children.length===0){this.priority=rt.DO_NOT_DOWNLOAD,this.childrenIds=[],this.wanted=null,this.progress=0,this.deepCount=[1,0],this.size=0,this.selectedSize=0;return}this.children.forEach(e=>{e.buildCache()}),this.priority=this.children.map(e=>e.priority).reduce((e,s)=>e===rt.MIXED||e===s?e:rt.MIXED),this.childrenIds=this.children.map(e=>e.childrenIds??[]).flat(),this.wanted=this.children.map(e=>e.wanted).some(Boolean);const t=this.children.filter(e=>e.wanted);if(t.length===0)this.progress=0;else{const e=t.reduce((s,i)=>[s[0]+i.selectedSize*i.progress,s[1]+i.selectedSize],[0,0]);this.progress=e[0]/e[1]}this.deepCount=this.children.map(e=>e.deepCount).reduce((e,s)=>[e[0]+s[0],e[1]+s[1]],[1,0]),this.size=this.children.map(e=>e.size).reduce((e,s)=>e+s,0),this.selectedSize=this.children.filter(e=>e.wanted).map(e=>e.selectedSize).reduce((e,s)=>e+s,0)}isSelected(t){return t.has(this.fullName)}}function Yr(){return new an("(root)","")}function na(r,t){const e=Qt(Yr()),s=Z(()=>{const n=(o,a)=>{const l=a===""?o.name:a+"/"+o.name;if(o.type==="folder"&&Gr(t).has(o.fullName)){const u=o.children.toSorted((h,c)=>h.type==="folder"&&c.type==="file"?-1:h.type==="file"&&c.type==="folder"?1:Qi.textWithNumbers.asc(h.name,c.name)).flatMap(h=>n(h,l));return[o,...u]}else return[o]};return n(e.value,"")});function i(){const n=Yr(),o=Gr(r)??[];for(const a of o){let l=n;a.name.replace(/\\/g,"/").split("/").reduce((u,h)=>{const c=u===""?h:u+"/"+h;if(u===a.name.substring(0,a.name.lastIndexOf("/")))l.children.push(new ia(a,h));else{const g=l.children.find(d=>d.name===h);if(g)l=g;else{const d=new an(h,c);l.children.push(d),l=d}}return c},"")}e.value=n,n.buildCache()}return Yi(()=>{i()}),{tree:e,flatTree:s}}const oa={pdf:"mdi-file-pdf-box",png:"mdi-file-image",jpg:"mdi-file-image",jpeg:"mdi-file-image",tiff:"mdi-file-image",doc:"mdi-file-document",docx:"mdi-file-document",txt:"mdi-file-document",nfo:"mdi-information-variant-box",mp3:"mdi-music",wav:"mdi-music",flac:"mdi-music",avi:"mdi-movie",mp4:"mdi-movie",mkv:"mdi-movie",mov:"mdi-movie",wmv:"mdi-movie",srt:"mdi-subtitles",idx:"mdi-subtitles",sub:"mdi-subtitles",rar:"mdi-zip-box-outline",zip:"mdi-zip-box-outline",gz:"mdi-zip-box-outline","7z":"mdi-zip-box-outline",iso:"mdi-zip-box-outline",exe:"mdi-application-brackets",msi:"mdi-application-brackets",dmg:"mdi-application-brackets",deb:"mdi-application-brackets",jar:"mdi-application-brackets"};aa=function(r){const t=r.split(".").pop()?.toLowerCase()||"";return oa[t]||"mdi-file"};let se,ha,ua,ca,da,fa,pa,ma,Xr,ga,_a,ya,xa,ba,va,wa;se=Xi("torrentDetail",()=>{const r=pt("overview"),t=pt();async function e(s){t.value=await we.getTorrentProperties(s)}return{tab:r,properties:t,fetchProperties:e,$reset:()=>{t.value=void 0}}},{persistence:{enabled:!0,storageItems:[{storage:localStorage,includePaths:["tab"]}]}});_e=Xi("content",()=>{const{t:r}=ee(),t=Co(),e=ws(),{fileContentInterval:s}=yt(Wt()),i=Z(()=>t.params.hash),n=bs({isVisible:!1,offset:[0,0]}),o=Qt([]),a=Qt(""),{results:l}=Mo(o,a,S=>S.name),u=Qt(new Set([""])),{flatTree:h}=na(l,u),c=Qt(new Set),g=Qt(""),d=Z(()=>c.value.size===0?[]:h.value.filter(S=>c.value.has(S.fullName))),m=Z(()=>d.value.length>0?d.value[0]:null),_=Z(()=>d.value.map(S=>S.childrenIds).flat().filter((S,k,I)=>I.indexOf(S)===k)),p=Z(()=>[{text:r(`torrentDetail.content.rename.${m.value?.type||"file"}`),icon:"mdi-rename",hidden:c.value.size>1||m.value?.fullName==="",action:()=>E(m.value)},{text:r("torrentDetail.content.rename.bulk"),icon:"mdi-rename",hidden:c.value.size!==1||(m.value?.type||"file")==="file",action:()=>O(Ao(m.value))},{text:r("torrentDetail.content.invert_priority"),icon:"mdi-checkbox-intermediate-variant",action:L},{text:r("torrentDetail.content.priority"),icon:"mdi-trending-up",children:[{text:r("constants.file_priority.max"),icon:"mdi-arrow-up",action:()=>$(_.value,rt.MAXIMAL)},{text:r("constants.file_priority.high"),icon:"mdi-arrow-top-right",action:()=>$(_.value,rt.HIGH)},{text:r("constants.file_priority.normal"),icon:"mdi-minus",action:()=>$(_.value,rt.NORMAL)},{text:r("constants.file_priority.unwanted"),icon:"mdi-cancel",action:()=>$(_.value,rt.DO_NOT_DOWNLOAD)}]},{text:"Collapse All",icon:"mdi-unfold-less-horizontal",action:y},{text:"Expand All",icon:"mdi-unfold-more-horizontal",action:w}]),b=Ji(function*(){yield M()}).drop(),C=Qt(!1),{isActive:T,pause:F,resume:B}=Cs(b.perform,s,{immediate:!1,immediateCallback:!0});async function M(){o.value=await U(i.value),await Ue()}async function E(S){const{default:k}=await Te(async()=>{const{default:V}=await import("./MoveTorrentFileDialog-Dhy8JCS7.js");return{default:V}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url),I={hash:i.value,isFolder:S.type==="folder",oldName:S.fullName};e.createDialog(k,I,b.perform)}async function O(S){const{default:k}=await Te(async()=>{const{default:V}=await import("./BulkRenameFilesDialog-CXJ2V15O.js");return{default:V}},__vite__mapDeps([6,2,3,4,5,1,7]),import.meta.url),I={hash:i.value,node:S};e.createDialog(k,I,b.perform)}async function L(){const S=d.value.flatMap(z=>z.childrenIds),k=o.value.filter(z=>S.includes(z.index)),I=k.filter(z=>z.priority!==rt.DO_NOT_DOWNLOAD).map(z=>z.index),V=k.filter(z=>z.priority===rt.DO_NOT_DOWNLOAD).map(z=>z.index);await Promise.all([$(V,rt.NORMAL),$(I,rt.DO_NOT_DOWNLOAD)])}async function R(S,k,I){await we.renameFile(S,k,I)}async function A(S,k,I){await we.renameFolder(S,k,I)}async function $(S,k){await we.setTorrentFilePriority(i.value,S,k),b.perform()}async function U(S,k){return await we.getTorrentFiles(S,k)}async function X(S){return await we.getTorrentPieceStates(S)}function tt(S,k){S.stopPropagation();const I=k.type==="file"?k.fullName.slice(0,k.fullName.lastIndexOf("/")):k.fullName;u.value.has(I)||(u.value.add(I),rr(u))}function f(S,k){S.stopPropagation();const I=k.type==="file"||!u.value.has(k.fullName)?k.fullName.slice(0,k.fullName.lastIndexOf("/")):k.fullName;u.value.has(I)&&(u.value.delete(I),c.value.has(k.fullName)&&(c.value.delete(k.fullName),c.value.add(I),g.value=I),rr(u))}function y(){u.value=new Set([""])}function w(){u.value=o.value.flatMap(S=>S.name.replaceAll("\\","/").split("/").reduce((k,I,V,z)=>[...k,...V<z.length-1?[[...k,I].join("/")]:[]],[])).reduce((S,k)=>S.add(k),new Set([""]))}async function P(S){S.wanted?await $(S.childrenIds,rt.DO_NOT_DOWNLOAD):await $(S.childrenIds,rt.NORMAL)}return{rightClickProperties:n,internalSelection:c,lastSelected:g,menuData:p,filenameFilter:a,cachedFiles:o,openedItems:u,filteredFiles:l,flatTree:h,updateFileTreeTask:b,timerForcedPause:C,isTimerActive:T,pauseTimer:F,resumeTimer:B,renameTorrentFile:R,renameTorrentFolder:A,setFilePriority:$,fetchFiles:U,fetchPieceState:X,openNode:tt,closeNode:f,collapseAll:y,expandAll:w,toggleFileSelection:P,$reset:()=>{F(),b.clear(),c.value.clear(),g.value="",a.value="",o.value=[],u.value=new Set([""])}}});la=vt({__name:"MoveTorrentFileDialog",props:{guid:{},hash:{},isFolder:{type:Boolean},oldName:{}},setup(r){const t=r,{isOpened:e}=tn(t.guid),{t:s}=ee(),i=_e(),n=pt(),o=pt(),a=pt(!1),l=bs({newName:""}),u=[g=>!!g||s("dialogs.moveTorrent.required")];async function h(){await n.value?.validate(),a.value&&(t.isFolder?await i.renameTorrentFolder(t.hash,t.oldName,l.newName):await i.renameTorrentFile(t.hash,t.oldName,l.newName),c())}const c=()=>{e.value=!1};return So(()=>{if(l.newName=t.oldName,t.isFolder)Ue(()=>o.value?.select());else{const g=l.newName.lastIndexOf("/"),d=l.newName.lastIndexOf(".");Ue(()=>{o.value?.setSelectionRange(g+1,d==-1?l.newName.length:d)})}}),(g,d)=>(N(),q(We,{modelValue:D(e),"onUpdate:modelValue":d[3]||(d[3]=m=>Ye(e)?e.value=m:null)},{default:v(()=>[x(Ht,null,{default:v(()=>[x(As,null,{default:v(()=>[W(G(D(s)("dialogs.moveTorrentFile.title",1+Number(g.isFolder))),1)]),_:1}),x(pe,null,{default:v(()=>[x(D(en),{modelValue:a.value,"onUpdate:modelValue":d[1]||(d[1]=m=>a.value=m),ref_key:"form",ref:n,onSubmit:d[2]||(d[2]=He(()=>{},["prevent"]))},{default:v(()=>[g.oldName?(N(),q(Jt,{key:0,"model-value":g.oldName,disabled:"",label:g.$t("dialogs.moveTorrentFile.oldName")},null,8,["model-value","label"])):Rt("",!0),x(Jt,{modelValue:l.newName,"onUpdate:modelValue":d[0]||(d[0]=m=>l.newName=m),ref_key:"input",ref:o,rules:u,autofocus:"",label:g.$t("dialogs.moveTorrent.newPath"),onKeydown:Wi(h,["enter"])},null,8,["modelValue","label"])]),_:1},8,["modelValue"])]),_:1}),x(Xe,null,{default:v(()=>[x(ke),x(ht,{color:"error",onClick:c},{default:v(()=>[W(G(g.$t("common.cancel")),1)]),_:1}),x(ht,{color:"accent",disabled:!a.value,onClick:h},{default:v(()=>[W(G(g.$t("common.save")),1)]),_:1},8,["disabled"])]),_:1})]),_:1})]),_:1},8,["modelValue"]))}});ha={style:{"white-space":"nowrap"}};ua=vt({__name:"ContentFilterDialog",props:{guid:{}},setup(r){const t=r,{t:e}=ee(),{isOpened:s}=tn(t.guid),i=_e(),n=Wt(),o=Z(()=>i.cachedFiles.map(p=>p.size).reduce((p,b)=>[p[0]===-1||b<p[0]?b:p[0],p[1]===-1||b>p[1]?b:p[1]],[-1,-1])),a=Z(()=>Array.from(new Set(i.cachedFiles.map(p=>Or(p.name)[1])).values())),l=Z(()=>a.value.map(p=>p===""?{title:e("common.none"),value:""}:{title:`.${p}`,value:p}).sort((p,b)=>Qi.text.asc(p.title,b.title))),u=[{title:e("constants.file_priority.unwanted"),value:rt.DO_NOT_DOWNLOAD},{title:e("constants.file_priority.normal"),value:rt.NORMAL},{title:e("constants.file_priority.high"),value:rt.HIGH},{title:e("constants.file_priority.max"),value:rt.MAXIMAL}],h=bs({extensions:[],priority:[],size:o.value}),c=Z(()=>i.cachedFiles.filter(p=>(!h.extensions.length||h.extensions.includes(Or(p.name)[1]))&&(!h.priority.length||h.priority.includes(p.priority))&&p.size>=h.size[0]&&p.size<=h.size[1])),g=Z(()=>c.value.reduce((p,b)=>p+b.size,0));function d(){i.setFilePriority(c.value.map(p=>p.index),rt.DO_NOT_DOWNLOAD),_()}function m(){const p=c.value.filter(b=>b.priority===rt.DO_NOT_DOWNLOAD).map(b=>b.index);i.setFilePriority(p,rt.NORMAL),_()}function _(){s.value=!1}return(p,b)=>(N(),q(We,{modelValue:D(s),"onUpdate:modelValue":b[5]||(b[5]=C=>Ye(s)?s.value=C:null),fullscreen:p.$vuetify.display.mobile},{default:v(()=>[x(Ht,null,{default:v(()=>[x(As,{class:"ios-margin"},{default:v(()=>[x(Io,{color:"transparent"},{default:v(()=>[x(Eo,null,{default:v(()=>[W(G(p.$t("torrentDetail.content.filter.title")),1)]),_:1}),x(ht,{icon:"mdi-close",onClick:_})]),_:1})]),_:1}),x(pe,null,{default:v(()=>[x(dt,null,{default:v(()=>[x(st,{cols:"4",class:"d-flex align-center"},{default:v(()=>[W(G(p.$t("torrentDetail.content.filter.extensions")),1)]),_:1}),x(st,{cols:"8"},{default:v(()=>[x(zr,{modelValue:h.extensions,"onUpdate:modelValue":b[0]||(b[0]=C=>h.extensions=C),items:l.value,placeholder:p.$t("common.disabled"),"persistent-placeholder":"",multiple:"","hide-details":""},null,8,["modelValue","items","placeholder"])]),_:1})]),_:1}),x(dt,null,{default:v(()=>[x(st,{cols:"4",class:"d-flex align-center"},{default:v(()=>[W(G(p.$t("torrentDetail.content.filter.priority")),1)]),_:1}),x(st,{cols:"8"},{default:v(()=>[x(zr,{modelValue:h.priority,"onUpdate:modelValue":b[1]||(b[1]=C=>h.priority=C),items:u,placeholder:p.$t("common.disabled"),"persistent-placeholder":"",multiple:"","hide-details":""},null,8,["modelValue","placeholder"])]),_:1})]),_:1}),x(dt,null,{default:v(()=>[x(st,{cols:"4",class:"d-flex align-center"},{default:v(()=>[W(G(p.$t("torrentDetail.content.filter.size")),1)]),_:1}),x(st,{cols:"8"},{default:v(()=>[x(Do,{modelValue:h.size,"onUpdate:modelValue":b[4]||(b[4]=C=>h.size=C),direction:p.$vuetify.display.mobile?"vertical":"horizontal",color:"primary",disabled:o.value[0]===o.value[1],min:o.value[0],max:o.value[1],step:1,density:"compact","thumb-label":"always","hide-details":""},{"thumb-label":v(({modelValue:C})=>[Y("div",ha,G(D(Vt)(C,D(n).useBinarySize)),1)]),prepend:v(()=>[x(Jt,{modelValue:h.size[0],"onUpdate:modelValue":b[2]||(b[2]=C=>h.size[0]=C),"hide-spin-buttons":"",density:"compact",style:{width:"130px"},type:"number",variant:"outlined","hide-details":"","single-line":""},null,8,["modelValue"])]),append:v(()=>[x(Jt,{modelValue:h.size[1],"onUpdate:modelValue":b[3]||(b[3]=C=>h.size[1]=C),"hide-spin-buttons":"",density:"compact",style:{width:"130px"},type:"number",variant:"outlined","hide-details":"","single-line":""},null,8,["modelValue"])]),_:1},8,["modelValue","direction","disabled","min","max"])]),_:1})]),_:1}),x(dt,null,{default:v(()=>[x(st,{cols:"12"},{default:v(()=>[W(G(p.$t("torrentDetail.content.filter.preview",{count:c.value.length,total:D(i).cachedFiles.length,size:D(Vt)(g.value,D(n).useBinarySize)})),1)]),_:1})]),_:1})]),_:1}),x(Xe,null,{default:v(()=>[x(ht,{color:"error",onClick:d},{default:v(()=>[W(G(p.$t("torrentDetail.content.filter.exclude")),1)]),_:1}),x(ht,{color:"success",onClick:m},{default:v(()=>[W(G(p.$t("torrentDetail.content.filter.include")),1)]),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue","fullscreen"]))}});ca={class:"d-flex"};da={key:1,class:"d-flex align-center spacer"};fa={class:"d-flex flex-column overflow-hidden text-no-wrap mr-3"};pa={class:"text-grey"};ma={class:"d-flex align-center"};Xr="#ffe476";ga=vt({__name:"ContentNode",props:{node:{}},emits:["onRightClick"],setup(r){const t=r,{t:e}=ee(),{mobile:s}=on(),i=_e(),{internalSelection:n,lastSelected:o,openedItems:a}=yt(i),l=Wt(),u=Z(()=>{if(t.node.fullName==="")return 0;const m=t.node.fullName.split("/").length,_=s.value?12:24;return m*_});function h(m,_){Ro(m)?(n.value.has(_.fullName)?n.value.delete(_.fullName):n.value.add(_.fullName),rr(n)):n.value=new Set([_.fullName]),o.value=_.fullName}function c(m){return m.wanted?m.progress===1?"green":"":"grey"}function g(m){const[_,p]=m.deepCount,b=[];return _>1&&b.push(e("torrentDetail.content.folderInfo",_-1)),p>0&&b.push(e("torrentDetail.content.fileInfo",p)),b.join(", ")}function d(m){const _=Vt(m.size,l.useBinarySize),p=Vt(m.selectedSize,l.useBinarySize);let b;if(m.type==="folder"){let C=_;m.selectedSize>0&&(C+=` (${p})`),b=[C,g(m)]}else b=[_];return b.join(" | ")}return(m,_)=>(N(),j("div",{class:gs(["d-flex flex-column py-2 pr-3",m.node.isSelected(D(n))?"selected":""]),style:ji(`padding-left: ${u.value}px`),onClick:_[2]||(_[2]=He(p=>h(p,m.node),["stop"])),onContextmenu:_[3]||(_[3]=p=>m.$emit("onRightClick",p,m.node))},[Y("div",ca,[Y("div",{class:"d-flex align-center",onClick:_[0]||(_[0]=He(p=>D(i).toggleFileSelection(m.node),["stop"]))},[m.node.priority===D(rt).MIXED?(N(),q(At,{key:0,color:c(m.node),icon:"mdi-checkbox-intermediate-variant"},null,8,["color"])):m.node.wanted?(N(),q(At,{key:1,color:c(m.node),icon:"mdi-checkbox-marked"},null,8,["color"])):(N(),q(At,{key:2,color:c(m.node),icon:"mdi-checkbox-blank-outline"},null,8,["color"]))]),m.node.type==="folder"?(N(),j("div",{key:0,class:"d-flex align-center spacer cursor-pointer",onClick:_[1]||(_[1]=p=>D(a).has(m.node.fullName)?D(i).closeNode(p,m.node):D(i).openNode(p,m.node))},[x(At,null,{default:v(()=>[W(G(D(a).has(m.node.fullName)?"mdi-chevron-up":"mdi-chevron-down"),1)]),_:1}),m.node.fullName===""?(N(),q(At,{key:0,icon:"mdi-file-tree"})):D(a).has(m.node.fullName)?(N(),q(At,{key:1,icon:"mdi-folder-open",color:Xr})):(N(),q(At,{key:2,icon:"mdi-folder",color:Xr}))])):(N(),j("div",da,[x(At,{icon:D(aa)(m.node.name)},null,8,["icon"])])),Y("div",fa,[Y("div",{class:gs(`text-${c(m.node)}`)},G(m.node.name),3),Y("div",pa,G(d(m.node)),1)]),x(ke),Y("div",ma,[m.node.priority===D(rt).MAXIMAL?(N(),q(At,{key:0,color:"error"},{default:v(()=>_[4]||(_[4]=[W("mdi-arrow-up")])),_:1})):m.node.priority===D(rt).HIGH?(N(),q(At,{key:1,color:"warning"},{default:v(()=>_[5]||(_[5]=[W("mdi-arrow-top-right")])),_:1})):m.node.priority===D(rt).NORMAL?(N(),q(At,{key:2},{default:v(()=>_[6]||(_[6]=[W("mdi-minus")])),_:1})):m.node.priority===D(rt).MIXED?(N(),q(At,{key:3},{default:v(()=>_[7]||(_[7]=[W("mdi-tilde")])),_:1})):m.node.priority===D(rt).DO_NOT_DOWNLOAD?(N(),q(At,{key:4,color:"grey"},{default:v(()=>_[8]||(_[8]=[W("mdi-cancel")])),_:1})):Rt("",!0)])]),x(sn,{"model-value":m.node.progress,max:1,color:c(m.node),rounded:"sm"},null,8,["model-value","color"])],38))}});_a=Ss(ga,[["__scopeId","data-v-276db43b"]]);ya={class:"mt-2 mx-3 d-flex flex-gap align-center"};xa=vt({__name:"Content",props:{torrent:{},isActive:{type:Boolean}},setup(r){const t=r,{height:e}=on(),s=_e(),{rightClickProperties:i,filenameFilter:n,flatTree:o,internalSelection:a,lastSelected:l,timerForcedPause:u,isTimerActive:h}=yt(s),c=ws(),g=pt(),d=Z(()=>e.value-48*2-64-12*2-56-8);async function m(M,E){i.value.isVisible&&(i.value.isVisible=!1,await Ue()),Object.assign(i.value,{isVisible:!0,offset:[M.pageX,M.pageY],hash:t.torrent.hash}),a.value.size<=1&&(a.value=new Set([E.fullName]),l.value=E.fullName)}const _=pt();function p(M,E){_.value=setTimeout(()=>{m(M,E)},500)}function b(){clearTimeout(_.value)}Je(()=>t.isActive,M=>{M&&!u.value?s.resumeTimer():s.pauseTimer()}),ts(()=>{t.isActive&&s.resumeTimer(),document.addEventListener("keydown",B)}),vs(()=>{s.$reset(),document.removeEventListener("keydown",B)});function C(){u.value=!0,s.pauseTimer()}function T(){u.value=!1,s.resumeTimer()}function F(){c.createDialog(ua)}function B(M){let E;(A=>{A.ArrowUp="ArrowUp",A.ArrowDown="ArrowDown",A.ArrowLeft="ArrowLeft",A.ArrowRight="ArrowRight",A.Spacebar=" "})(E||(E={}));const O=M.key;if(c.hasActiveDialog||!Object.values(E).includes(O))return!1;M.preventDefault();const L=o.value.findIndex(A=>A.fullName===l.value);let R=L;switch(O){case"ArrowUp":L>0&&R--;break;case"ArrowDown":L<o.value.length-1&&R++;break;case"ArrowLeft":s.closeNode(M,o.value[L]),R=o.value.findIndex(A=>A.fullName===l.value);break;case"ArrowRight":s.openNode(M,o.value[L]);break;case" ":s.toggleFileSelection(o.value[L]).then();break}return L!==R&&(l.value=o.value[R].fullName,a.value=new Set([l.value]),g.value?.scrollToIndex(Math.max(0,R-Math.floor(d.value/68/2)))),!0}return(M,E)=>(N(),q(Ht,null,{default:v(()=>[Y("div",ya,[x(Jt,{modelValue:D(n),"onUpdate:modelValue":E[0]||(E[0]=O=>Ye(n)?n.value=O:null),"hide-details":"",clearable:"",placeholder:M.$t("torrentDetail.content.filter_placeholder"),onKeydown:E[1]||(E[1]=He(()=>{},["stop"]))},null,8,["modelValue","placeholder"]),x(_s,{text:M.$t("torrentDetail.content.filter.activator"),location:"bottom"},{activator:v(({props:O})=>[x(ht,Se(O,{icon:"mdi-select-multiple",color:"primary",onClick:F}),null,16)]),_:1},8,["text"]),x(_s,{text:D(h)?M.$t("common.pause"):M.$t("common.resume"),location:"bottom"},{activator:v(({props:O})=>[x(ht,Se(O,{icon:D(h)?"mdi-timer-pause":"mdi-timer-play",color:"primary",onClick:E[2]||(E[2]=L=>D(h)?C():T())}),null,16,["icon"])]),_:1},8,["text"])]),x(D(Fo),{ref_key:"scrollView",ref:g,items:D(o),height:d.value,"item-height":"68",class:"pa-2"},{default:v(({item:O})=>[x(_a,{node:O,onTouchcancel:b,onTouchend:b,onTouchmove:b,onTouchstart:L=>p(L.touches.item(0),O),onOnRightClick:E[3]||(E[3]=(L,R)=>m(L,R))},null,8,["node","onTouchstart"])]),_:1},8,["items","height"])]),_:1}))}});ba={};va={class:"pl-4"};wa={class:"pr-4"};function Ca(r,t){return N(),q(st,{cols:"12",sm:"6",lg:"3"},{default:v(()=>[x(Bo,{rounded:"xl",class:"d-flex align-center py-2 border"},{default:v(()=>[Y("div",va,[Nr(r.$slots,"title")]),x(ke),Y("div",wa,[Nr(r.$slots,"text")])]),_:3})]),_:3})}const Nt=Ss(ba,[["render",Ca]]),Aa=vt({__name:"PanelBoolean",props:{torrent:{}},setup(r){const t=r,e=Ts(),{properties:s}=yt(se()),i=Z({get:()=>t.torrent.auto_tmm,set:u=>e.toggleAutoTmm([t.torrent.hash],u)}),n=Z({get:()=>t.torrent.f_l_piece_prio,set:()=>e.toggleFLPiecePrio([t.torrent.hash])}),o=Z({get:()=>t.torrent.forced,set:u=>{u?e.forceStartTorrents([t.torrent.hash]):e.resumeTorrents([t.torrent.hash])}}),a=Z({get:()=>t.torrent.seq_dl,set:()=>e.toggleSeqDl([t.torrent.hash])}),l=Z({get:()=>t.torrent.super_seeding,set:u=>e.setSuperSeeding([t.torrent.hash],u)});return(u,h)=>(N(),q(ge,{title:u.$t("torrentDetail.info.boolean_values")},{default:v(()=>[x(me,null,{default:v(()=>[x(dt,null,{default:v(()=>[x(Nt,null,{title:v(()=>[x(ye,{modelValue:i.value,"onUpdate:modelValue":h[0]||(h[0]=c=>i.value=c),"hide-details":"",density:"compact",label:u.$t("torrent.properties.auto_tmm")},null,8,["modelValue","label"])]),_:1}),x(Nt,null,{title:v(()=>[x(ye,{modelValue:n.value,"onUpdate:modelValue":h[1]||(h[1]=c=>n.value=c),"hide-details":"",density:"compact",label:u.$t("torrent.properties.f_l_piece_prio")},null,8,["modelValue","label"])]),_:1}),x(Nt,null,{title:v(()=>[x(ye,{modelValue:o.value,"onUpdate:modelValue":h[2]||(h[2]=c=>o.value=c),"hide-details":"",density:"compact",label:u.$t("torrent.properties.forced")},null,8,["modelValue","label"])]),_:1}),x(Nt,null,{title:v(()=>[x(ye,{modelValue:a.value,"onUpdate:modelValue":h[3]||(h[3]=c=>a.value=c),"hide-details":"",density:"compact",label:u.$t("torrent.properties.seq_dl")},null,8,["modelValue","label"])]),_:1}),x(Nt,null,{title:v(()=>[x(ye,{modelValue:l.value,"onUpdate:modelValue":h[4]||(h[4]=c=>l.value=c),"hide-details":"",density:"compact",label:u.$t("torrent.properties.super_seeding")},null,8,["modelValue","label"])]),_:1}),x(Nt,null,{title:v(()=>[x(ye,{disabled:"","model-value":D(s)?.is_private,"hide-details":"",density:"compact",label:u.$t("torrent.properties.is_private")},null,8,["model-value","label"])]),_:1})]),_:1})]),_:1})]),_:1},8,["title"]))}}),Sa=vt({__name:"PanelData",props:{torrent:{}},setup(r){const t=r,{properties:e}=yt(se()),{useBinarySize:s}=yt(Wt()),i=[{title:"downloaded",getter:()=>t.torrent.downloaded},{title:"downloaded_session",getter:()=>t.torrent.downloaded_session},{title:"uploaded",getter:()=>t.torrent.uploaded},{title:"uploaded_session",getter:()=>t.torrent.uploaded_session},{title:"size",getter:()=>t.torrent.size},{title:"total_size",getter:()=>t.torrent.total_size},{title:"total_wasted",getter:()=>e.value?.total_wasted??0},{title:"amount_left",getter:()=>t.torrent.amount_left},{title:"global_volume",getter:()=>t.torrent.globalVolume}];return(n,o)=>(N(),q(ge,{title:n.$t("torrentDetail.info.data_values")},{default:v(()=>[x(me,null,{default:v(()=>[x(dt,null,{default:v(()=>[(N(),j(Pt,null,$t(i,a=>x(Nt,null,{title:v(()=>[W(G(n.$t(`torrent.properties.${a.title}`)),1)]),text:v(()=>[W(G(D(Vt)(a.getter(),D(s))),1)]),_:2},1024)),64))]),_:1})]),_:1})]),_:1},8,["title"]))}}),Ta=vt({__name:"PanelDatetime",props:{torrent:{}},setup(r){const t=r,{properties:e}=yt(se()),{dateFormat:s}=yt(Wt()),i=[{title:"added_on",getter:()=>t.torrent.added_on},{title:"completed_on",getter:()=>t.torrent.completed_on},{title:"creation_date",getter:()=>e.value?.creation_date??0},{title:"last_activity",getter:()=>t.torrent.last_activity},{title:"seen_complete",getter:()=>t.torrent.seen_complete}];return(n,o)=>(N(),q(ge,{title:n.$t("torrentDetail.info.datetime_values")},{default:v(()=>[x(me,null,{default:v(()=>[x(dt,null,{default:v(()=>[(N(),j(Pt,null,$t(i,a=>x(Nt,null,qi({title:v(()=>[W(G(n.$t(`torrent.properties.${a.title}`)),1)]),_:2},[a.getter()>0?{name:"text",fn:v(()=>[W(G(D($o)(a.getter(),D(s))),1)]),key:"0"}:{name:"text",fn:v(()=>[W(G(n.$t("common.NA")),1)]),key:"1"}]),1024)),64))]),_:1})]),_:1})]),_:1},8,["title"]))}}),ka=vt({__name:"PanelDuration",props:{torrent:{}},setup(r){const t=r,{properties:e}=yt(se()),{durationFormat:s}=yt(Wt()),i=[{title:"seeding_time",unit:"s",getter:()=>t.torrent.seeding_time},{title:"seeding_time_limit",unit:"m",getter:()=>t.torrent.seeding_time_limit},{title:"inactive_seeding_time_limit",unit:"m",getter:()=>t.torrent.inactive_seeding_time_limit},{title:"time_active",unit:"s",getter:()=>t.torrent.time_active},{title:"reannounce",unit:"s",getter:()=>e.value?.reannounce??0}];return(n,o)=>(N(),q(ge,{title:n.$t("torrentDetail.info.duration_values")},{default:v(()=>[x(me,null,{default:v(()=>[x(dt,null,{default:v(()=>[(N(),j(Pt,null,$t(i,a=>x(Nt,null,qi({title:v(()=>[W(G(n.$t(`torrent.properties.${a.title}`)),1)]),_:2},[a.getter()>0?{name:"text",fn:v(()=>[W(G(D(Go)(a.getter(),a.unit,D(s))),1)]),key:"0"}:{name:"text",fn:v(()=>[W(G(n.$t("common.NA")),1)]),key:"1"}]),1024)),64))]),_:1})]),_:1})]),_:1},8,["title"]))}}),Pa={key:0,class:"d-flex flex-gap-row-small flex-gap-column"},Ma=vt({__name:"PanelLongText",props:{torrent:{}},setup(r){const t=r,{properties:e}=yt(se()),s=[{title:"content_path",getter:()=>t.torrent.content_path},{title:"download_path",getter:()=>t.torrent.download_path},{title:"hash",getter:()=>t.torrent.hash},{title:"infohash_v1",getter:()=>t.torrent.infohash_v1},{title:"infohash_v2",getter:()=>t.torrent.infohash_v2},{title:"magnet",getter:()=>t.torrent.magnet},{title:"name",getter:()=>t.torrent.name},{title:"save_path",getter:()=>t.torrent.savePath},{title:"tracker",getter:()=>t.torrent.tracker},{title:"comment",getter:()=>e.value?.comment},{title:"created_by",getter:()=>e.value?.created_by}];return(i,n)=>(N(),q(ge,{title:i.$t("torrentDetail.info.long_text_values")},{default:v(()=>[x(me,null,{default:v(()=>[x(ys,null,{default:v(()=>[(N(),j(Pt,null,$t(s,o=>x(je,{title:i.$t(`torrent.properties.${o.title}`)},{default:v(()=>[x(Lr,null,{default:v(()=>[W(G(o.getter()||i.$t("common.none")),1)]),_:2},1024)]),_:2},1032,["title"])),64)),x(je,{title:i.$t("torrent.properties.tags")},{default:v(()=>[i.torrent.tags?.length?(N(),j("div",Pa,[(N(!0),j(Pt,null,$t(i.torrent.tags,o=>(N(),q(ve,{defaultColor:"tag",value:o},null,8,["value"]))),256))])):(N(),q(Lr,{key:1},{default:v(()=>[W(G(i.$t("torrent.properties.empty_tags")),1)]),_:1}))]),_:1},8,["title"])]),_:1})]),_:1})]),_:1},8,["title"]))}}),Ia=vt({__name:"PanelSpeed",props:{torrent:{}},setup(r){const t=r,{properties:e}=yt(se()),{useBitSpeed:s}=yt(Wt()),i=[{title:"download_limit",getter:()=>t.torrent.dl_limit},{title:"download_speed",getter:()=>t.torrent.dlspeed},{title:"avg_download_speed",getter:()=>e.value?.dl_speed_avg??0},{title:"upload_limit",getter:()=>t.torrent.up_limit},{title:"upload_speed",getter:()=>t.torrent.upspeed},{title:"avg_upload_speed",getter:()=>e.value?.up_speed_avg??0},{title:"global_speed",getter:()=>t.torrent.globalSpeed}];return(n,o)=>(N(),q(ge,{title:n.$t("torrentDetail.info.speed_values")},{default:v(()=>[x(me,null,{default:v(()=>[x(dt,null,{default:v(()=>[(N(),j(Pt,null,$t(i,a=>x(Nt,null,{title:v(()=>[W(G(n.$t(`torrent.properties.${a.title}`)),1)]),text:v(()=>[W(G(D(fe)(a.getter(),D(s))),1)]),_:2},1024)),64))]),_:1})]),_:1})]),_:1},8,["title"]))}}),Ea=vt({__name:"PanelText",props:{torrent:{}},setup(r){const t=r,{t:e,getTorrentStateString:s}=ee(),{properties:i}=yt(se()),n=[{title:"available_peers",getter:()=>t.torrent.available_peers},{title:"available_seeds",getter:()=>t.torrent.available_seeds},{title:"ratio",getter:()=>t.torrent.ratio},{title:"ratio_limit",getter:()=>t.torrent.ratio_limit},{title:"num_leechs",getter:()=>t.torrent.num_leechs},{title:"num_seeds",getter:()=>t.torrent.num_seeds},{title:"availability",getter:()=>t.torrent.availability},{title:"eta",getter:()=>t.torrent.eta},{title:"category",getter:()=>t.torrent.category||e("common.NA")},{title:"state",getter:()=>s(t.torrent.state)},{title:"trackers_count",getter:()=>t.torrent.trackers_count},{title:"priority",getter:()=>t.torrent.priority},{title:"nb_connections",getter:()=>i.value?.nb_connections??0},{title:"nb_connections_limit",getter:()=>i.value?.nb_connections_limit??0}];return(o,a)=>(N(),q(ge,{title:o.$t("torrentDetail.info.text_values")},{default:v(()=>[x(me,null,{default:v(()=>[x(dt,null,{default:v(()=>[(N(),j(Pt,null,$t(n,l=>x(Nt,null,{title:v(()=>[W(G(o.$t(`torrent.properties.${l.title}`)),1)]),text:v(()=>[W(G(l.getter()),1)]),_:2},1024)),64))]),_:1})]),_:1})]),_:1},8,["title"]))}}),Da=vt({__name:"Info",props:{torrent:{},isActive:{type:Boolean}},setup(r){return(t,e)=>(N(),q(ys,null,{default:v(()=>[x(je,null,{default:v(()=>[x(No,null,{default:v(()=>[x(Ta,{torrent:t.torrent},null,8,["torrent"]),x(ka,{torrent:t.torrent},null,8,["torrent"]),x(Aa,{torrent:t.torrent},null,8,["torrent"]),x(Sa,{torrent:t.torrent},null,8,["torrent"]),x(Ia,{torrent:t.torrent},null,8,["torrent"]),x(Ea,{torrent:t.torrent},null,8,["torrent"]),x(Ma,{torrent:t.torrent},null,8,["torrent"])]),_:1})]),_:1})]),_:1}))}}),Ra=class or{constructor(t,e){this.low=t,this.high=e}clone(){return new or(this.low,this.high)}get max(){return this.clone()}less_than(t){return this.low<t.low||this.low===t.low&&this.high<t.high}equal_to(t){return this.low===t.low&&this.high===t.high}intersect(t){return!this.not_intersect(t)}not_intersect(t){return this.high<t.low||t.high<this.low}merge(t){return new or(this.low===void 0?t.low:this.low<t.low?this.low:t.low,this.high===void 0?t.high:this.high>t.high?this.high:t.high)}output(){return[this.low,this.high]}static comparable_max(t,e){return t.merge(e)}static comparable_less_than(t,e){return t<e}},wt=0,at=1;class oe{constructor(t=void 0,e=void 0,s=null,i=null,n=null,o=at){if(this.left=s,this.right=i,this.parent=n,this.color=o,this.item={key:t,value:e},t&&t instanceof Array&&t.length===2&&!Number.isNaN(t[0])&&!Number.isNaN(t[1])){let[a,l]=t;a>l&&([a,l]=[l,a]),this.item.key=new Ra(a,l)}this.max=this.item.key?this.item.key.max:void 0}isNil(){return this.item.key===void 0&&this.item.value===void 0&&this.left===null&&this.right===null&&this.color===at}_value_less_than(t){return this.item.value&&t.item.value&&this.item.value.less_than?this.item.value.less_than(t.item.value):this.item.value<t.item.value}less_than(t){return this.item.value===this.item.key&&t.item.value===t.item.key?this.item.key.less_than(t.item.key):this.item.key.less_than(t.item.key)||this.item.key.equal_to(t.item.key)&&this._value_less_than(t)}_value_equal(t){return this.item.value&&t.item.value&&this.item.value.equal_to?this.item.value.equal_to(t.item.value):this.item.value===t.item.value}equal_to(t){return this.item.value===this.item.key&&t.item.value===t.item.key?this.item.key.equal_to(t.item.key):this.item.key.equal_to(t.item.key)&&this._value_equal(t)}intersect(t){return this.item.key.intersect(t.item.key)}copy_data(t){this.item.key=t.item.key,this.item.value=t.item.value}update_max(){if(this.max=this.item.key?this.item.key.max:void 0,this.right&&this.right.max){const t=this.item.key.constructor.comparable_max;this.max=t(this.max,this.right.max)}if(this.left&&this.left.max){const t=this.item.key.constructor.comparable_max;this.max=t(this.max,this.left.max)}}not_intersect_left_subtree(t){const e=this.item.key.constructor.comparable_less_than;let s=this.left.max.high!==void 0?this.left.max.high:this.left.max;return e(s,t.item.key.low)}not_intersect_right_subtree(t){const e=this.item.key.constructor.comparable_less_than;let s=this.right.max.low!==void 0?this.right.max.low:this.right.item.key.low;return e(t.item.key.high,s)}}class Ar{constructor(){this.root=null,this.nil_node=new oe}get size(){let t=0;return this.tree_walk(this.root,()=>t++),t}get keys(){let t=[];return this.tree_walk(this.root,e=>t.push(e.item.key.output?e.item.key.output():e.item.key)),t}get values(){let t=[];return this.tree_walk(this.root,e=>t.push(e.item.value)),t}get items(){let t=[];return this.tree_walk(this.root,e=>t.push({key:e.item.key.output?e.item.key.output():e.item.key,value:e.item.value})),t}isEmpty(){return this.root==null||this.root===this.nil_node}clear(){this.root=null}insert(t,e=t){if(t===void 0)return;let s=new oe(t,e,this.nil_node,this.nil_node,null,wt);return this.tree_insert(s),this.recalc_max(s),s}exist(t,e=t){let s=new oe(t,e);return!!this.tree_search(this.root,s)}remove(t,e=t){let s=new oe(t,e),i=this.tree_search(this.root,s);return i&&this.tree_delete(i),i}search(t,e=(s,i)=>s===i?i.output():s){let s=new oe(t),i=[];return this.tree_search_interval(this.root,s,i),i.map(n=>e(n.item.value,n.item.key))}intersect_any(t){let e=new oe(t);return this.tree_find_any_interval(this.root,e)}forEach(t){this.tree_walk(this.root,e=>t(e.item.key,e.item.value))}map(t){const e=new Ar;return this.tree_walk(this.root,s=>e.insert(s.item.key,t(s.item.value,s.item.key))),e}*iterate(t,e=(s,i)=>s===i?i.output():s){let s;for(t?s=this.tree_search_nearest_forward(this.root,new oe(t)):this.root&&(s=this.local_minimum(this.root));s;)yield e(s.item.value,s.item.key),s=this.tree_successor(s)}recalc_max(t){let e=t;for(;e.parent!=null;)e.parent.update_max(),e=e.parent}tree_insert(t){let e=this.root,s=null;if(this.root==null||this.root===this.nil_node)this.root=t;else{for(;e!==this.nil_node;)s=e,t.less_than(e)?e=e.left:e=e.right;t.parent=s,t.less_than(s)?s.left=t:s.right=t}this.insert_fixup(t)}insert_fixup(t){let e,s;for(e=t;e!==this.root&&e.parent.color===wt;)e.parent===e.parent.parent.left?(s=e.parent.parent.right,s.color===wt?(e.parent.color=at,s.color=at,e.parent.parent.color=wt,e=e.parent.parent):(e===e.parent.right&&(e=e.parent,this.rotate_left(e)),e.parent.color=at,e.parent.parent.color=wt,this.rotate_right(e.parent.parent))):(s=e.parent.parent.left,s.color===wt?(e.parent.color=at,s.color=at,e.parent.parent.color=wt,e=e.parent.parent):(e===e.parent.left&&(e=e.parent,this.rotate_right(e)),e.parent.color=at,e.parent.parent.color=wt,this.rotate_left(e.parent.parent)));this.root.color=at}tree_delete(t){let e,s;t.left===this.nil_node||t.right===this.nil_node?e=t:e=this.tree_successor(t),e.left!==this.nil_node?s=e.left:s=e.right,s.parent=e.parent,e===this.root?this.root=s:(e===e.parent.left?e.parent.left=s:e.parent.right=s,e.parent.update_max()),this.recalc_max(s),e!==t&&(t.copy_data(e),t.update_max(),this.recalc_max(t)),e.color===at&&this.delete_fixup(s)}delete_fixup(t){let e=t,s;for(;e!==this.root&&e.parent!=null&&e.color===at;)e===e.parent.left?(s=e.parent.right,s.color===wt&&(s.color=at,e.parent.color=wt,this.rotate_left(e.parent),s=e.parent.right),s.left.color===at&&s.right.color===at?(s.color=wt,e=e.parent):(s.right.color===at&&(s.color=wt,s.left.color=at,this.rotate_right(s),s=e.parent.right),s.color=e.parent.color,e.parent.color=at,s.right.color=at,this.rotate_left(e.parent),e=this.root)):(s=e.parent.left,s.color===wt&&(s.color=at,e.parent.color=wt,this.rotate_right(e.parent),s=e.parent.left),s.left.color===at&&s.right.color===at?(s.color=wt,e=e.parent):(s.left.color===at&&(s.color=wt,s.right.color=at,this.rotate_left(s),s=e.parent.left),s.color=e.parent.color,e.parent.color=at,s.left.color=at,this.rotate_right(e.parent),e=this.root));e.color=at}tree_search(t,e){if(!(t==null||t===this.nil_node))return e.equal_to(t)?t:e.less_than(t)?this.tree_search(t.left,e):this.tree_search(t.right,e)}tree_search_nearest_forward(t,e){let s,i=t;for(;i&&i!==this.nil_node;)i.less_than(e)?i.intersect(e)?(s=i,i=i.left):i=i.right:((!s||i.less_than(s))&&(s=i),i=i.left);return s||null}tree_search_interval(t,e,s){t!=null&&t!==this.nil_node&&(t.left!==this.nil_node&&!t.not_intersect_left_subtree(e)&&this.tree_search_interval(t.left,e,s),t.intersect(e)&&s.push(t),t.right!==this.nil_node&&!t.not_intersect_right_subtree(e)&&this.tree_search_interval(t.right,e,s))}tree_find_any_interval(t,e){let s=!1;return t!=null&&t!==this.nil_node&&(t.left!==this.nil_node&&!t.not_intersect_left_subtree(e)&&(s=this.tree_find_any_interval(t.left,e)),s||(s=t.intersect(e)),!s&&t.right!==this.nil_node&&!t.not_intersect_right_subtree(e)&&(s=this.tree_find_any_interval(t.right,e))),s}local_minimum(t){let e=t;for(;e.left!=null&&e.left!==this.nil_node;)e=e.left;return e}local_maximum(t){let e=t;for(;e.right!=null&&e.right!==this.nil_node;)e=e.right;return e}tree_successor(t){let e,s,i;if(t.right!==this.nil_node)e=this.local_minimum(t.right);else{for(s=t,i=t.parent;i!=null&&i.right===s;)s=i,i=i.parent;e=i}return e}rotate_left(t){let e=t.right;t.right=e.left,e.left!==this.nil_node&&(e.left.parent=t),e.parent=t.parent,t===this.root?this.root=e:t===t.parent.left?t.parent.left=e:t.parent.right=e,e.left=t,t.parent=e,t!=null&&t!==this.nil_node&&t.update_max(),e=t.parent,e!=null&&e!==this.nil_node&&e.update_max()}rotate_right(t){let e=t.left;t.left=e.right,e.right!==this.nil_node&&(e.right.parent=t),e.parent=t.parent,t===this.root?this.root=e:t===t.parent.left?t.parent.left=e:t.parent.right=e,e.right=t,t.parent=e,t!==null&&t!==this.nil_node&&t.update_max(),e=t.parent,e!=null&&e!==this.nil_node&&e.update_max()}tree_walk(t,e){t!=null&&t!==this.nil_node&&(this.tree_walk(t.left,e),e(t),this.tree_walk(t.right,e))}testRedBlackProperty(){let t=!0;return this.tree_walk(this.root,function(e){e.color===wt&&(e.left.color===at&&e.right.color===at||(t=!1))}),t}testBlackHeightProperty(t){let e=0,s=0,i=0;if(t.color===at&&e++,t.left!==this.nil_node?s=this.testBlackHeightProperty(t.left):s=1,t.right!==this.nil_node?i=this.testBlackHeightProperty(t.right):i=1,s!==i)throw new Error("Red-black height property violated");return e+=s,e}}lt=(r=>(r.Application="application",r.WebGLPipes="webgl-pipes",r.WebGLPipesAdaptor="webgl-pipes-adaptor",r.WebGLSystem="webgl-system",r.WebGPUPipes="webgpu-pipes",r.WebGPUPipesAdaptor="webgpu-pipes-adaptor",r.WebGPUSystem="webgpu-system",r.CanvasSystem="canvas-system",r.CanvasPipesAdaptor="canvas-pipes-adaptor",r.CanvasPipes="canvas-pipes",r.Asset="asset",r.LoadParser="load-parser",r.ResolveParser="resolve-parser",r.CacheParser="cache-parser",r.DetectionParser="detection-parser",r.MaskEffect="mask-effect",r.BlendMode="blend-mode",r.TextureSource="texture-source",r.Environment="environment",r.ShapeBuilder="shape-builder",r.Batcher="batcher",r))(lt||{});let ar,es,Fa,Ba;ar=r=>{if(typeof r=="function"||typeof r=="object"&&r.extension){if(!r.extension)throw new Error("Extension class must have an extension object");r={...typeof r.extension!="object"?{type:r.extension}:r.extension,ref:r}}if(typeof r=="object")r={...r};else throw new Error("Invalid extension type");return typeof r.type=="string"&&(r.type=[r.type]),r};es=(r,t)=>ar(r).priority??t;jt={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(ar).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...r){return r.map(ar).forEach(t=>{t.type.forEach(e=>{const s=this._addHandlers,i=this._queue;s[e]?s[e]?.(t):(i[e]=i[e]||[],i[e]?.push(t))})}),this},handle(r,t,e){const s=this._addHandlers,i=this._removeHandlers;if(s[r]||i[r])throw new Error(`Extension type ${r} already has a handler`);s[r]=t,i[r]=e;const n=this._queue;return n[r]&&(n[r]?.forEach(o=>t(o)),delete n[r]),this},handleByMap(r,t){return this.handle(r,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByNamedList(r,t,e=-1){return this.handle(r,s=>{t.findIndex(n=>n.name===s.name)>=0||(t.push({name:s.name,value:s.ref}),t.sort((n,o)=>es(o.value,e)-es(n.value,e)))},s=>{const i=t.findIndex(n=>n.name===s.name);i!==-1&&t.splice(i,1)})},handleByList(r,t,e=-1){return this.handle(r,s=>{t.includes(s.ref)||(t.push(s.ref),t.sort((i,n)=>es(n,e)-es(i,e)))},s=>{const i=t.indexOf(s.ref);i!==-1&&t.splice(i,1)})}};Fa={extension:{type:lt.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Te(()=>import("./browserAll-C1HMKx36.js"),__vite__mapDeps([8,9,10,11,1,2,3,4,5]),import.meta.url)}};Ba={extension:{type:lt.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Te(()=>import("./webworkerAll-D3jJ_Vry.js"),__vite__mapDeps([9,10,11,1,2,3,4,5]),import.meta.url)}};class Dt{constructor(t,e,s){this._x=e||0,this._y=s||0,this._observer=t}clone(t){return new Dt(t??this._observer,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,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))}}var Ds={exports:{}},Wr;function $a(){return Wr||(Wr=1,function(r){var t=Object.prototype.hasOwnProperty,e="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(e=!1));function i(l,u,h){this.fn=l,this.context=u,this.once=h||!1}function n(l,u,h,c,g){if(typeof h!="function")throw new TypeError("The listener must be a function");var d=new i(h,c||l,g),m=e?e+u:u;return l._events[m]?l._events[m].fn?l._events[m]=[l._events[m],d]:l._events[m].push(d):(l._events[m]=d,l._eventsCount++),l}function o(l,u){--l._eventsCount===0?l._events=new s:delete l._events[u]}function a(){this._events=new s,this._eventsCount=0}a.prototype.eventNames=function(){var u=[],h,c;if(this._eventsCount===0)return u;for(c in h=this._events)t.call(h,c)&&u.push(e?c.slice(1):c);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(h)):u},a.prototype.listeners=function(u){var h=e?e+u:u,c=this._events[h];if(!c)return[];if(c.fn)return[c.fn];for(var g=0,d=c.length,m=new Array(d);g<d;g++)m[g]=c[g].fn;return m},a.prototype.listenerCount=function(u){var h=e?e+u:u,c=this._events[h];return c?c.fn?1:c.length:0},a.prototype.emit=function(u,h,c,g,d,m){var _=e?e+u:u;if(!this._events[_])return!1;var p=this._events[_],b=arguments.length,C,T;if(p.fn){switch(p.once&&this.removeListener(u,p.fn,void 0,!0),b){case 1:return p.fn.call(p.context),!0;case 2:return p.fn.call(p.context,h),!0;case 3:return p.fn.call(p.context,h,c),!0;case 4:return p.fn.call(p.context,h,c,g),!0;case 5:return p.fn.call(p.context,h,c,g,d),!0;case 6:return p.fn.call(p.context,h,c,g,d,m),!0}for(T=1,C=new Array(b-1);T<b;T++)C[T-1]=arguments[T];p.fn.apply(p.context,C)}else{var F=p.length,B;for(T=0;T<F;T++)switch(p[T].once&&this.removeListener(u,p[T].fn,void 0,!0),b){case 1:p[T].fn.call(p[T].context);break;case 2:p[T].fn.call(p[T].context,h);break;case 3:p[T].fn.call(p[T].context,h,c);break;case 4:p[T].fn.call(p[T].context,h,c,g);break;default:if(!C)for(B=1,C=new Array(b-1);B<b;B++)C[B-1]=arguments[B];p[T].fn.apply(p[T].context,C)}}return!0},a.prototype.on=function(u,h,c){return n(this,u,h,c,!1)},a.prototype.once=function(u,h,c){return n(this,u,h,c,!0)},a.prototype.removeListener=function(u,h,c,g){var d=e?e+u:u;if(!this._events[d])return this;if(!h)return o(this,d),this;var m=this._events[d];if(m.fn)m.fn===h&&(!g||m.once)&&(!c||m.context===c)&&o(this,d);else{for(var _=0,p=[],b=m.length;_<b;_++)(m[_].fn!==h||g&&!m[_].once||c&&m[_].context!==c)&&p.push(m[_]);p.length?this._events[d]=p.length===1?p[0]:p:o(this,d)}return this},a.prototype.removeAllListeners=function(u){var h;return u?(h=e?e+u:u,this._events[h]&&o(this,h)):(this._events=new s,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=e,a.EventEmitter=a,r.exports=a}(Ds)),Ds.exports}var Ga=$a();let Na,Va,Oa;re=Cr(Ga);Na=Math.PI*2;Va=180/Math.PI;Oa=Math.PI/180;St=class{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new St(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return Rs.x=0,Rs.y=0,Rs}};const Rs=new St;it=class{constructor(t=1,e=0,s=0,i=1,n=0,o=0){this.array=null,this.a=t,this.b=e,this.c=s,this.d=i,this.tx=n,this.ty=o}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,s,i,n,o){return this.a=t,this.b=e,this.c=s,this.d=i,this.tx=n,this.ty=o,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const s=e||this.array;return t?(s[0]=this.a,s[1]=this.b,s[2]=0,s[3]=this.c,s[4]=this.d,s[5]=0,s[6]=this.tx,s[7]=this.ty,s[8]=1):(s[0]=this.a,s[1]=this.c,s[2]=this.tx,s[3]=this.b,s[4]=this.d,s[5]=this.ty,s[6]=0,s[7]=0,s[8]=1),s}apply(t,e){e=e||new St;const s=t.x,i=t.y;return e.x=this.a*s+this.c*i+this.tx,e.y=this.b*s+this.d*i+this.ty,e}applyInverse(t,e){e=e||new St;const s=this.a,i=this.b,n=this.c,o=this.d,a=this.tx,l=this.ty,u=1/(s*o+n*-i),h=t.x,c=t.y;return e.x=o*u*h+-n*u*c+(l*n-a*o)*u,e.y=s*u*c+-i*u*h+(-l*s+a*i)*u,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){const e=Math.cos(t),s=Math.sin(t),i=this.a,n=this.c,o=this.tx;return this.a=i*e-this.b*s,this.b=i*s+this.b*e,this.c=n*e-this.d*s,this.d=n*s+this.d*e,this.tx=o*e-this.ty*s,this.ty=o*s+this.ty*e,this}append(t){const e=this.a,s=this.b,i=this.c,n=this.d;return this.a=t.a*e+t.b*i,this.b=t.a*s+t.b*n,this.c=t.c*e+t.d*i,this.d=t.c*s+t.d*n,this.tx=t.tx*e+t.ty*i+this.tx,this.ty=t.tx*s+t.ty*n+this.ty,this}appendFrom(t,e){const s=t.a,i=t.b,n=t.c,o=t.d,a=t.tx,l=t.ty,u=e.a,h=e.b,c=e.c,g=e.d;return this.a=s*u+i*c,this.b=s*h+i*g,this.c=n*u+o*c,this.d=n*h+o*g,this.tx=a*u+l*c+e.tx,this.ty=a*h+l*g+e.ty,this}setTransform(t,e,s,i,n,o,a,l,u){return this.a=Math.cos(a+u)*n,this.b=Math.sin(a+u)*n,this.c=-Math.sin(a-l)*o,this.d=Math.cos(a-l)*o,this.tx=t-(s*this.a+i*this.c),this.ty=e-(s*this.b+i*this.d),this}prepend(t){const e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){const s=this.a,i=this.c;this.a=s*t.a+this.b*t.c,this.b=s*t.b+this.b*t.d,this.c=i*t.a+this.d*t.c,this.d=i*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){const e=this.a,s=this.b,i=this.c,n=this.d,o=t.pivot,a=-Math.atan2(-i,n),l=Math.atan2(s,e),u=Math.abs(a+l);return u<1e-5||Math.abs(Na-u)<1e-5?(t.rotation=l,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=l),t.scale.x=Math.sqrt(e*e+s*s),t.scale.y=Math.sqrt(i*i+n*n),t.position.x=this.tx+(o.x*e+o.y*i),t.position.y=this.ty+(o.x*s+o.y*n),t}invert(){const t=this.a,e=this.b,s=this.c,i=this.d,n=this.tx,o=t*i-e*s;return this.a=i/o,this.b=-e/o,this.c=-s/o,this.d=t/o,this.tx=(s*this.ty-i*n)/o,this.ty=-(t*this.ty-e*n)/o,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(){const t=new it;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}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 La.identity()}static get shared(){return za.identity()}};const za=new it,La=new it,he=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],ue=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],ce=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],de=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],lr=[],ln=[],ss=Math.sign;function Ua(){for(let r=0;r<16;r++){const t=[];lr.push(t);for(let e=0;e<16;e++){const s=ss(he[r]*he[e]+ce[r]*ue[e]),i=ss(ue[r]*he[e]+de[r]*ue[e]),n=ss(he[r]*ce[e]+ce[r]*de[e]),o=ss(ue[r]*ce[e]+de[r]*de[e]);for(let a=0;a<16;a++)if(he[a]===s&&ue[a]===i&&ce[a]===n&&de[a]===o){t.push(a);break}}}for(let r=0;r<16;r++){const t=new it;t.set(he[r],ue[r],ce[r],de[r],0,0),ln.push(t)}}Ua();const ct={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:r=>he[r],uY:r=>ue[r],vX:r=>ce[r],vY:r=>de[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>lr[r][t],sub:(r,t)=>lr[r][ct.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?ct.S:ct.N:Math.abs(t)*2<=Math.abs(r)?r>0?ct.E:ct.W:t>0?r>0?ct.SE:ct.SW:r>0?ct.NE:ct.NW,matrixAppendRotationInv:(r,t,e=0,s=0)=>{const i=ln[ct.inv(t)];i.tx=e,i.ty=s,r.append(i)}},rs=[new St,new St,new St,new St];Ct=class{constructor(t=0,e=0,s=0,i=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(s),this.height=Number(i)}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 Ct(0,0,0,0)}clone(){return new Ct(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,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}strokeContains(t,e,s){const{width:i,height:n}=this;if(i<=0||n<=0)return!1;const o=this.x,a=this.y,l=o-s/2,u=o+i+s/2,h=a-s/2,c=a+n+s/2,g=o+s/2,d=o+i-s/2,m=a+s/2,_=a+n-s/2;return t>=l&&t<=u&&e>=h&&e<=c&&!(t>g&&t<d&&e>m&&e<_)}intersects(t,e){if(!e){const O=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=O)return!1;const R=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>R}const s=this.left,i=this.right,n=this.top,o=this.bottom;if(i<=s||o<=n)return!1;const a=rs[0].set(t.left,t.top),l=rs[1].set(t.left,t.bottom),u=rs[2].set(t.right,t.top),h=rs[3].set(t.right,t.bottom);if(u.x<=a.x||l.y<=a.y)return!1;const c=Math.sign(e.a*e.d-e.b*e.c);if(c===0||(e.apply(a,a),e.apply(l,l),e.apply(u,u),e.apply(h,h),Math.max(a.x,l.x,u.x,h.x)<=s||Math.min(a.x,l.x,u.x,h.x)>=i||Math.max(a.y,l.y,u.y,h.y)<=n||Math.min(a.y,l.y,u.y,h.y)>=o))return!1;const g=c*(l.y-a.y),d=c*(a.x-l.x),m=g*s+d*n,_=g*i+d*n,p=g*s+d*o,b=g*i+d*o;if(Math.max(m,_,p,b)<=g*a.x+d*a.y||Math.min(m,_,p,b)>=g*h.x+d*h.y)return!1;const C=c*(a.y-u.y),T=c*(u.x-a.x),F=C*s+T*n,B=C*i+T*n,M=C*s+T*o,E=C*i+T*o;return!(Math.max(F,B,M,E)<=C*a.x+T*a.y||Math.min(F,B,M,E)>=C*h.x+T*h.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){const e=Math.max(this.x,t.x),s=Math.min(this.x+this.width,t.x+t.width),i=Math.max(this.y,t.y),n=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(s-e,0),this.y=i,this.height=Math.max(n-i,0),this}ceil(t=1,e=.001){const s=Math.ceil((this.x+this.width-e)*t)/t,i=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=s-this.x,this.height=i-this.y,this}enlarge(t){const e=Math.min(this.x,t.x),s=Math.max(this.x+this.width,t.x+t.width),i=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=s-e,this.y=i,this.height=n-i,this}getBounds(t){return t||(t=new Ct),t.copyFrom(this),t}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}};const Fs={default:-1};_t=function(r="default"){return Fs[r]===void 0&&(Fs[r]=-1),++Fs[r]};let jr,Ha;jr={};gt="8.0.0";Ha="8.3.4";ft=function(r,t,e=3){if(jr[t])return;let s=new Error().stack;typeof s>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
Deprecated since v${r}`):(s=s.split(`
|
|
`).splice(e).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${r}`),console.warn(s),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
Deprecated since v${r}`),console.warn(s))),jr[t]=!0};const hn=()=>{};qr=function(r){return r+=r===0?1:0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1};function Kr(r){return!(r&r-1)&&!!r}function Ya(r){const t={};for(const e in r)r[e]!==void 0&&(t[e]=r[e]);return t}const Zr=Object.create(null);function Xa(r){const t=Zr[r];return t===void 0&&(Zr[r]=_t("resource")),t}const un=class cn extends re{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...cn.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){ft(gt,"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(){const t=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=Xa(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};un.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};Wa=un;const dn=class fn extends re{constructor(t={}){super(),this.options=t,this.uid=_t("textureSource"),this._resourceType="textureSource",this._resourceId=_t("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={...fn.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 Wa(Ya(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){const 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=_t("resource"),this.emit("change",this),this.emit("unload",this)}get resourceWidth(){const{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){const{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,e,s){s||(s=this._resolution),t||(t=this.width),e||(e=this.height);const i=Math.round(t*s),n=Math.round(e*s);return this.width=i/s,this.height=n/s,this._resolution=s,this.pixelWidth===i&&this.pixelHeight===n?!1:(this._refreshPOT(),this.pixelWidth=i,this.pixelHeight=n,this.emit("resize",this),this._resourceId=_t("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=Kr(this.pixelWidth)&&Kr(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};dn.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};qt=dn;class Sr extends qt{constructor(t){const e=t.resource||new Float32Array(t.width*t.height*4);let s=t.format;s||(e instanceof Float32Array?s="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?s="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?s="rgba16uint":(e instanceof Int8Array,s="bgra8unorm")),super({...t,resource:e,format:s}),this.uploadMethodId="buffer"}static test(t){return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}}Sr.extension=lt.TextureSource;const Qr=new it;ja=class{constructor(t,e){this.mapCoord=new it,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof e>"u"?this.clampMargin=t.width<10?0:.5:this.clampMargin=e,this.isSimple=!1,this.texture=t}get texture(){return this._texture}set texture(t){this.texture!==t&&(this._texture?.removeListener("update",this.update,this),this._texture=t,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(t,e){e===void 0&&(e=t);const s=this.mapCoord;for(let i=0;i<t.length;i+=2){const n=t[i],o=t[i+1];e[i]=n*s.a+o*s.c+s.tx,e[i+1]=n*s.b+o*s.d+s.ty}return e}update(){const t=this._texture;this._updateID++;const e=t.uvs;this.mapCoord.set(e.x1-e.x0,e.y1-e.y0,e.x3-e.x0,e.y3-e.y0,e.x0,e.y0);const s=t.orig,i=t.trim;i&&(Qr.set(s.width/i.width,0,0,s.height/i.height,-i.x/i.width,-i.y/i.height),this.mapCoord.append(Qr));const n=t.source,o=this.uClampFrame,a=this.clampMargin/n._resolution,l=this.clampOffset/n._resolution;return o[0]=(t.frame.x+a+l)/n.width,o[1]=(t.frame.y+a+l)/n.height,o[2]=(t.frame.x+t.frame.width-a+l)/n.width,o[3]=(t.frame.y+t.frame.height-a+l)/n.height,this.uClampOffset[0]=this.clampOffset/n.pixelWidth,this.uClampOffset[1]=this.clampOffset/n.pixelHeight,this.isSimple=t.frame.width===n.width&&t.frame.height===n.height&&t.rotate===0,!0}};ut=class extends re{constructor({source:t,label:e,frame:s,orig:i,trim:n,defaultAnchor:o,defaultBorders:a,rotate:l,dynamic:u}={}){if(super(),this.uid=_t("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new Ct,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=t?.source??new qt,this.noFrame=!s,s)this.frame.copyFrom(s);else{const{width:h,height:c}=this._source;this.frame.width=h,this.frame.height=c}this.orig=i||this.frame,this.trim=n,this.rotate=l??0,this.defaultAnchor=o,this.defaultBorders=a,this.destroyed=!1,this.dynamic=u||!1,this.updateUvs()}set source(t){this._source&&this._source.off("resize",this.update,this),this._source=t,t.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new ja(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){const{uvs:t,frame:e}=this,{width:s,height:i}=this._source,n=e.x/s,o=e.y/i,a=e.width/s,l=e.height/i;let u=this.rotate;if(u){const h=a/2,c=l/2,g=n+h,d=o+c;u=ct.add(u,ct.NW),t.x0=g+h*ct.uX(u),t.y0=d+c*ct.uY(u),u=ct.add(u,2),t.x1=g+h*ct.uX(u),t.y1=d+c*ct.uY(u),u=ct.add(u,2),t.x2=g+h*ct.uX(u),t.y2=d+c*ct.uY(u),u=ct.add(u,2),t.x3=g+h*ct.uX(u),t.y3=d+c*ct.uY(u)}else t.x0=n,t.y0=o,t.x1=n+a,t.y1=o,t.x2=n+a,t.y2=o+l,t.x3=n,t.y3=o+l}destroy(t=!1){this._source&&t&&(this._source.destroy(),this._source=null),this._textureMatrix=null,this.destroyed=!0,this.emit("destroy",this),this.removeAllListeners()}update(){this.noFrame&&(this.frame.width=this._source.width,this.frame.height=this._source.height),this.updateUvs(),this.emit("update",this)}get baseTexture(){return ft(gt,"Texture.baseTexture is now Texture.source"),this._source}};ut.EMPTY=new ut({label:"EMPTY",source:new qt({label:"EMPTY"})});ut.EMPTY.destroy=hn;ut.WHITE=new ut({source:new Sr({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});ut.WHITE.destroy=hn;qa=function(r,t,e,s){const{width:i,height:n}=e.orig,o=e.trim;if(o){const a=o.width,l=o.height;r.minX=o.x-t._x*i-s,r.maxX=r.minX+a,r.minY=o.y-t._y*n-s,r.maxY=r.minY+l}else r.minX=-t._x*i-s,r.maxX=r.minX+i,r.minY=-t._y*n-s,r.maxY=r.minY+n};const Jr=new it;Xt=class{constructor(t=1/0,e=1/0,s=-1/0,i=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=Jr,this.minX=t,this.minY=e,this.maxX=s,this.maxY=i}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new Ct);const 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=Jr,this}set(t,e,s,i){this.minX=t,this.minY=e,this.maxX=s,this.maxY=i}addFrame(t,e,s,i,n){n||(n=this.matrix);const o=n.a,a=n.b,l=n.c,u=n.d,h=n.tx,c=n.ty;let g=this.minX,d=this.minY,m=this.maxX,_=this.maxY,p=o*t+l*e+h,b=a*t+u*e+c;p<g&&(g=p),b<d&&(d=b),p>m&&(m=p),b>_&&(_=b),p=o*s+l*e+h,b=a*s+u*e+c,p<g&&(g=p),b<d&&(d=b),p>m&&(m=p),b>_&&(_=b),p=o*t+l*i+h,b=a*t+u*i+c,p<g&&(g=p),b<d&&(d=b),p>m&&(m=p),b>_&&(_=b),p=o*s+l*i+h,b=a*s+u*i+c,p<g&&(g=p),b<d&&(d=b),p>m&&(m=p),b>_&&(_=b),this.minX=g,this.minY=d,this.maxX=m,this.maxY=_}addRect(t,e){this.addFrame(t.x,t.y,t.x+t.width,t.y+t.height,e)}addBounds(t,e){this.addFrame(t.minX,t.minY,t.maxX,t.maxY,e)}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.maxX<t.maxX?this.maxX:t.maxX,this.maxY=this.maxY<t.maxY?this.maxY:t.maxY}applyMatrix(t){const e=this.minX,s=this.minY,i=this.maxX,n=this.maxY,{a:o,b:a,c:l,d:u,tx:h,ty:c}=t;let g=o*e+l*s+h,d=a*e+u*s+c;this.minX=g,this.minY=d,this.maxX=g,this.maxY=d,g=o*i+l*s+h,d=a*i+u*s+c,this.minX=g<this.minX?g:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=g>this.maxX?g:this.maxX,this.maxY=d>this.maxY?d:this.maxY,g=o*e+l*n+h,d=a*e+u*n+c,this.minX=g<this.minX?g:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=g>this.maxX?g:this.maxX,this.maxY=d>this.maxY?d:this.maxY,g=o*i+l*n+h,d=a*i+u*n+c,this.minX=g<this.minX?g:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=g>this.maxX?g:this.maxX,this.maxY=d>this.maxY?d:this.maxY}fit(t){return this.minX<t.left&&(this.minX=t.left),this.maxX>t.right&&(this.maxX=t.right),this.minY<t.top&&(this.minY=t.top),this.maxY>t.bottom&&(this.maxY=t.bottom),this}fitBounds(t,e,s,i){return this.minX<t&&(this.minX=t),this.maxX>e&&(this.maxX=e),this.minY<s&&(this.minY=s),this.maxY>i&&(this.maxY=i),this}pad(t,e=t){return this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e,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 Xt(this.minX,this.minY,this.maxX,this.maxY)}scale(t,e=t){return this.minX*=t,this.minY*=e,this.maxX*=t,this.maxY*=e,this}get x(){return this.minX}set x(t){const e=this.maxX-this.minX;this.minX=t,this.maxX=t+e}get y(){return this.minY}set y(t){const e=this.maxY-this.minY;this.minY=t,this.maxY=t+e}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,e,s,i){let n=this.minX,o=this.minY,a=this.maxX,l=this.maxY;i||(i=this.matrix);const u=i.a,h=i.b,c=i.c,g=i.d,d=i.tx,m=i.ty;for(let _=e;_<s;_+=2){const p=t[_],b=t[_+1],C=u*p+c*b+d,T=h*p+g*b+m;n=C<n?C:n,o=T<o?T:o,a=C>a?C:a,l=T>l?T:l}this.minX=n,this.minY=o,this.maxX=a,this.maxY=l}containsPoint(t,e){return this.minX<=t&&this.minY<=e&&this.maxX>=t&&this.maxY>=e}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}};var Ka={grad:.9,turn:360,rad:360/(2*Math.PI)},Zt=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},bt=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*r)/e+0},Bt=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),r>e?e:r>t?r:t},pn=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},ti=function(r){return{r:Bt(r.r,0,255),g:Bt(r.g,0,255),b:Bt(r.b,0,255),a:Bt(r.a)}},Bs=function(r){return{r:bt(r.r),g:bt(r.g),b:bt(r.b),a:bt(r.a,3)}},Za=/^#([0-9a-f]{3,8})$/i,is=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},mn=function(r){var t=r.r,e=r.g,s=r.b,i=r.a,n=Math.max(t,e,s),o=n-Math.min(t,e,s),a=o?n===t?(e-s)/o:n===e?2+(s-t)/o:4+(t-e)/o:0;return{h:60*(a<0?a+6:a),s:n?o/n*100:0,v:n/255*100,a:i}},gn=function(r){var t=r.h,e=r.s,s=r.v,i=r.a;t=t/360*6,e/=100,s/=100;var n=Math.floor(t),o=s*(1-e),a=s*(1-(t-n)*e),l=s*(1-(1-t+n)*e),u=n%6;return{r:255*[s,a,o,o,l,s][u],g:255*[l,s,s,a,o,o][u],b:255*[o,o,l,s,s,a][u],a:i}},ei=function(r){return{h:pn(r.h),s:Bt(r.s,0,100),l:Bt(r.l,0,100),a:Bt(r.a)}},si=function(r){return{h:bt(r.h),s:bt(r.s),l:bt(r.l),a:bt(r.a,3)}},ri=function(r){return gn((e=(t=r).s,{h:t.h,s:(e*=((s=t.l)<50?s:100-s)/100)>0?2*e/(s+e)*100:0,v:s+e,a:t.a}));var t,e,s},Oe=function(r){return{h:(t=mn(r)).h,s:(i=(200-(e=t.s))*(s=t.v)/100)>0&&i<200?e*s/100/(i<=100?i:200-i)*100:0,l:i/2,a:t.a};var t,e,s,i},Qa=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ja=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,tl=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,el=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,hr={string:[[function(r){var t=Za.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:r.length===4?bt(parseInt(r[3]+r[3],16)/255,2):1}:r.length===6||r.length===8?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:r.length===8?bt(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=tl.exec(r)||el.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:ti({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(r){var t=Qa.exec(r)||Ja.exec(r);if(!t)return null;var e,s,i=ei({h:(e=t[1],s=t[2],s===void 0&&(s="deg"),Number(e)*(Ka[s]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return ri(i)},"hsl"]],object:[[function(r){var t=r.r,e=r.g,s=r.b,i=r.a,n=i===void 0?1:i;return Zt(t)&&Zt(e)&&Zt(s)?ti({r:Number(t),g:Number(e),b:Number(s),a:Number(n)}):null},"rgb"],[function(r){var t=r.h,e=r.s,s=r.l,i=r.a,n=i===void 0?1:i;if(!Zt(t)||!Zt(e)||!Zt(s))return null;var o=ei({h:Number(t),s:Number(e),l:Number(s),a:Number(n)});return ri(o)},"hsl"],[function(r){var t=r.h,e=r.s,s=r.v,i=r.a,n=i===void 0?1:i;if(!Zt(t)||!Zt(e)||!Zt(s))return null;var o=function(a){return{h:pn(a.h),s:Bt(a.s,0,100),v:Bt(a.v,0,100),a:Bt(a.a)}}({h:Number(t),s:Number(e),v:Number(s),a:Number(n)});return gn(o)},"hsv"]]},ii=function(r,t){for(var e=0;e<t.length;e++){var s=t[e][0](r);if(s)return[s,t[e][1]]}return[null,void 0]},sl=function(r){return typeof r=="string"?ii(r.trim(),hr.string):typeof r=="object"&&r!==null?ii(r,hr.object):[null,void 0]},$s=function(r,t){var e=Oe(r);return{h:e.h,s:Bt(e.s+100*t,0,100),l:e.l,a:e.a}},Gs=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},ni=function(r,t){var e=Oe(r);return{h:e.h,s:e.s,l:Bt(e.l+100*t,0,100),a:e.a}},ur=function(){function r(t){this.parsed=sl(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return this.parsed!==null},r.prototype.brightness=function(){return bt(Gs(this.rgba),2)},r.prototype.isDark=function(){return Gs(this.rgba)<.5},r.prototype.isLight=function(){return Gs(this.rgba)>=.5},r.prototype.toHex=function(){return t=Bs(this.rgba),e=t.r,s=t.g,i=t.b,o=(n=t.a)<1?is(bt(255*n)):"","#"+is(e)+is(s)+is(i)+o;var t,e,s,i,n,o},r.prototype.toRgb=function(){return Bs(this.rgba)},r.prototype.toRgbString=function(){return t=Bs(this.rgba),e=t.r,s=t.g,i=t.b,(n=t.a)<1?"rgba("+e+", "+s+", "+i+", "+n+")":"rgb("+e+", "+s+", "+i+")";var t,e,s,i,n},r.prototype.toHsl=function(){return si(Oe(this.rgba))},r.prototype.toHslString=function(){return t=si(Oe(this.rgba)),e=t.h,s=t.s,i=t.l,(n=t.a)<1?"hsla("+e+", "+s+"%, "+i+"%, "+n+")":"hsl("+e+", "+s+"%, "+i+"%)";var t,e,s,i,n},r.prototype.toHsv=function(){return t=mn(this.rgba),{h:bt(t.h),s:bt(t.s),v:bt(t.v),a:bt(t.a,3)};var t},r.prototype.invert=function(){return Lt({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},r.prototype.saturate=function(t){return t===void 0&&(t=.1),Lt($s(this.rgba,t))},r.prototype.desaturate=function(t){return t===void 0&&(t=.1),Lt($s(this.rgba,-t))},r.prototype.grayscale=function(){return Lt($s(this.rgba,-1))},r.prototype.lighten=function(t){return t===void 0&&(t=.1),Lt(ni(this.rgba,t))},r.prototype.darken=function(t){return t===void 0&&(t=.1),Lt(ni(this.rgba,-t))},r.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},r.prototype.alpha=function(t){return typeof t=="number"?Lt({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):bt(this.rgba.a,3);var e},r.prototype.hue=function(t){var e=Oe(this.rgba);return typeof t=="number"?Lt({h:t,s:e.s,l:e.l,a:e.a}):bt(e.h)},r.prototype.isEqual=function(t){return this.toHex()===Lt(t).toHex()},r}(),Lt=function(r){return r instanceof ur?r:new ur(r)},oi=[],rl=function(r){r.forEach(function(t){oi.indexOf(t)<0&&(t(ur,hr),oi.push(t))})};function il(r,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},s={};for(var i in e)s[e[i]]=i;var n={};r.prototype.toName=function(o){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,l,u=s[this.toHex()];if(u)return u;if(o?.closest){var h=this.toRgb(),c=1/0,g="black";if(!n.length)for(var d in e)n[d]=new r(e[d]).toRgb();for(var m in e){var _=(a=h,l=n[m],Math.pow(a.r-l.r,2)+Math.pow(a.g-l.g,2)+Math.pow(a.b-l.b,2));_<c&&(c=_,g=m)}return g}},t.string.push([function(o){var a=o.toLowerCase(),l=a==="transparent"?"#0000":e[a];return l?new r(l).toRgb():null},"name"])}rl([il]);const Pe=class $e{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 $e)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,e){const s=typeof t;if(s!==typeof e)return!1;if(s==="number"||s==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((n,o)=>n===e[o]);if(t!==null&&e!==null){const n=Object.keys(t),o=Object.keys(e);return n.length!==o.length?!1:n.every(a=>t[a]===e[a])}return t===e}toRgba(){const[t,e,s,i]=this._components;return{r:t,g:e,b:s,a:i}}toRgb(){const[t,e,s]=this._components;return{r:t,g:e,b:s}}toRgbaString(){const[t,e,s]=this.toUint8RgbArray();return`rgba(${t},${e},${s},${this.alpha})`}toUint8RgbArray(t){const[e,s,i]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb),t[0]=Math.round(e*255),t[1]=Math.round(s*255),t[2]=Math.round(i*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t||(t=this._arrayRgba);const[e,s,i,n]=this._components;return t[0]=e,t[1]=s,t[2]=i,t[3]=n,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb);const[e,s,i]=this._components;return t[0]=e,t[1]=s,t[2]=i,t}toNumber(){return this._int}toBgrNumber(){const[t,e,s]=this.toUint8RgbArray();return(s<<16)+(e<<8)+t}toLittleEndianNumber(){const t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){const[e,s,i,n]=$e._temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=s,this._components[2]*=i,this._components[3]*=n,this._refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this._refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let s=this._int>>16&255,i=this._int>>8&255,n=this._int&255;return e&&(s=s*t+.5|0,i=i*t+.5|0,n=n*t+.5|0),(t*255<<24)+(s<<16)+(i<<8)+n}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const e=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-e.length)+e}setAlpha(t){return this._components[3]=this._clamp(t),this}_normalize(t){let e,s,i,n;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){const o=t;e=(o>>16&255)/255,s=(o>>8&255)/255,i=(o&255)/255,n=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,s,i,n=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,s,i,n=255]=t,e/=255,s/=255,i/=255,n/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const a=$e.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}const o=Lt(t);o.isValid()&&({r:e,g:s,b:i,a:n}=o.rgba,e/=255,s/=255,i/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=s,this._components[2]=i,this._components[3]=n,this._refreshInt();else throw new Error(`Unable to convert color ${t}`)}_refreshInt(){this._clamp(this._components);const[t,e,s]=this._components;this._int=(t*255<<16)+(e*255<<8)+(s*255|0)}_clamp(t,e=0,s=1){return typeof t=="number"?Math.min(Math.max(t,e),s):(t.forEach((i,n)=>{t[n]=Math.min(Math.max(i,e),s)}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof $e||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}};Pe.shared=new Pe;Pe._temp=new Pe;Pe.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;Ft=Pe;const nl={cullArea:null,cullable:!1,cullableChildren:!0};class Tr{constructor(t,e){this._pool=[],this._count=0,this._index=0,this._classType=t,e&&this.prepopulate(e)}prepopulate(t){for(let e=0;e<t;e++)this._pool[this._index++]=new this._classType;this._count+=t}get(t){let e;return this._index>0?e=this._pool[--this._index]:e=new this._classType,e.init?.(t),e}return(t){t.reset?.(),this._pool[this._index++]=t}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}clear(){this._pool.length=0,this._index=0}}class ol{constructor(){this._poolsByClass=new Map}prepopulate(t,e){this.getPool(t).prepopulate(e)}get(t,e){return this.getPool(t).get(e)}return(t){this.getPool(t.constructor).return(t)}getPool(t){return this._poolsByClass.has(t)||this._poolsByClass.set(t,new Tr(t)),this._poolsByClass.get(t)}stats(){const t={};return this._poolsByClass.forEach(e=>{const s=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[s]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}}),t}}let al;te=new ol;al={get isCachedAsTexture(){return!!this.renderGroup?.isCachedAsTexture},cacheAsTexture(r){typeof r=="boolean"&&r===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(r===!0?{}:r))},updateCacheTexture(){this.renderGroup?.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(r){ft("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(r)}};ll=function(r,t,e){const s=r.length;let i;if(t>=s||e===0)return;e=t+e>s?s-t:e;const n=s-e;for(i=t;i<n;++i)r[i]=r[i+e];r.length=n};const hl={allowChildren:!0,removeChildren(r=0,t){const e=t??this.children.length,s=e-r,i=[];if(s>0&&s<=e){for(let o=e-1;o>=r;o--){const a=this.children[o];a&&(i.push(a),a.parent=null)}ll(this.children,r,e);const n=this.renderGroup||this.parentRenderGroup;n&&n.removeChildren(i);for(let o=0;o<i.length;++o)this.emit("childRemoved",i[o],this,o),i[o].emit("removed",this);return i}else if(s===0&&this.children.length===0)return i;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(r){const t=this.getChildAt(r);return this.removeChild(t)},getChildAt(r){if(r<0||r>=this.children.length)throw new Error(`getChildAt: Index (${r}) does not exist.`);return this.children[r]},setChildIndex(r,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(r),this.addChildAt(r,t)},getChildIndex(r){const t=this.children.indexOf(r);if(t===-1)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(r,t){this.allowChildren||ft(gt,"addChildAt: Only Containers will be allowed to add children in v8.0.0");const{children:e}=this;if(t<0||t>e.length)throw new Error(`${r}addChildAt: The index ${t} supplied is out of bounds ${e.length}`);if(r.parent){const i=r.parent.children.indexOf(r);if(r.parent===this&&i===t)return r;i!==-1&&r.parent.children.splice(i,1)}t===e.length?e.push(r):e.splice(t,0,r),r.parent=this,r.didChange=!0,r._updateFlags=15;const s=this.renderGroup||this.parentRenderGroup;return s&&s.addChild(r),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",r,this,t),r.emit("added",this),r},swapChildren(r,t){if(r===t)return;const e=this.getChildIndex(r),s=this.getChildIndex(t);this.children[e]=t,this.children[s]=r;const i=this.renderGroup||this.parentRenderGroup;i&&(i.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...r){return r.length===1?this.reparentChildAt(r[0],this.children.length):(r.forEach(t=>this.reparentChildAt(t,this.children.length)),r[0])},reparentChildAt(r,t){if(r.parent===this)return this.setChildIndex(r,t),r;const e=r.worldTransform.clone();r.removeFromParent(),this.addChildAt(r,t);const s=this.worldTransform.clone();return s.invert(),e.prepend(s),r.setFromMatrix(e),r}};ai=class{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let t=0;t<this.filters.length;t++)this.filters[t].destroy();this.filters=null,this.filterArea=null}};class ul{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach(t=>{this.add({test:t.test,maskClass:t})}))}add(t){this._tests.push(t)}getMaskEffect(t){this._initialized||this.init();for(let e=0;e<this._tests.length;e++){const s=this._tests[e];if(s.test(t))return te.get(s.maskClass,t)}return t}returnMaskEffect(t){te.return(t)}}const cr=new ul;jt.handleByList(lt.MaskEffect,cr._effectClasses);let cl,dl,kt;cl={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){const r=this.renderGroup||this.parentRenderGroup;r&&(r.structureDidChange=!0)},addEffect(r){this.effects.indexOf(r)===-1&&(this.effects.push(r),this.effects.sort((e,s)=>e.priority-s.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(r){const t=this.effects.indexOf(r);t!==-1&&(this.effects.splice(t,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(r){const t=this._maskEffect;t?.mask!==r&&(t&&(this.removeEffect(t),cr.returnMaskEffect(t),this._maskEffect=null),r!=null&&(this._maskEffect=cr.getMaskEffect(r),this.addEffect(this._maskEffect)))},setMask(r){this._maskOptions={...this._maskOptions,...r},r.mask&&(this.mask=r.mask),this._markStructureAsChanged()},get mask(){return this._maskEffect?.mask},set filters(r){!Array.isArray(r)&&r&&(r=[r]);const t=this._filterEffect||(this._filterEffect=new ai);r=r;const e=r?.length>0,s=t.filters?.length>0,i=e!==s;r=Array.isArray(r)?r.slice(0):r,t.filters=Object.freeze(r),i&&(e?this.addEffect(t):(this.removeEffect(t),t.filters=r??null))},get filters(){return this._filterEffect?.filters},set filterArea(r){this._filterEffect||(this._filterEffect=new ai),this._filterEffect.filterArea=r},get filterArea(){return this._filterEffect?.filterArea}};dl={label:null,get name(){return ft(gt,"Container.name property has been removed, use Container.label instead"),this.label},set name(r){ft(gt,"Container.name property has been removed, use Container.label instead"),this.label=r},getChildByName(r,t=!1){return this.getChildByLabel(r,t)},getChildByLabel(r,t=!1){const e=this.children;for(let s=0;s<e.length;s++){const i=e[s];if(i.label===r||r instanceof RegExp&&r.test(i.label))return i}if(t)for(let s=0;s<e.length;s++){const n=e[s].getChildByLabel(r,!0);if(n)return n}return null},getChildrenByLabel(r,t=!1,e=[]){const s=this.children;for(let i=0;i<s.length;i++){const n=s[i];(n.label===r||r instanceof RegExp&&r.test(n.label))&&e.push(n)}if(t)for(let i=0;i<s.length;i++)s[i].getChildrenByLabel(r,!0,e);return e}};kt=new Tr(it);Me=new Tr(Xt);_n=function(r,t,e){e.clear();let s,i;return r.parent?t?s=r.parent.worldTransform:(i=kt.get().identity(),s=kr(r,i)):s=it.IDENTITY,yn(r,e,s,t),i&&kt.return(i),e.isValid||e.set(0,0,0,0),e};function yn(r,t,e,s){if(!r.visible||!r.measurable)return;let i;s?i=r.worldTransform:(r.updateLocalTransform(),i=kt.get(),i.appendFrom(r.localTransform,e));const n=t,o=!!r.effects.length;if(o&&(t=Me.get().clear()),r.boundsArea)t.addRect(r.boundsArea,i);else{r.bounds&&(t.matrix=i,t.addBounds(r.bounds));for(let a=0;a<r.children.length;a++)yn(r.children[a],t,i,s)}if(o){for(let a=0;a<r.effects.length;a++)r.effects[a].addBounds?.(t);n.addBounds(t,it.IDENTITY),Me.return(t)}s||kt.return(i)}function kr(r,t){const e=r.parent;return e&&(kr(e,t),e.updateLocalTransform(),t.append(e.localTransform)),t}function xn(r,t){if(r===16777215||!t)return t;if(t===16777215||!r)return r;const e=r>>16&255,s=r>>8&255,i=r&255,n=t>>16&255,o=t>>8&255,a=t&255,l=e*n/255|0,u=s*o/255|0,h=i*a/255|0;return(l<<16)+(u<<8)+h}const li=16777215;hi=function(r,t){return r===li?t:t===li?r:xn(r,t)};function fs(r){return((r&255)<<16)+(r&65280)+(r>>16&255)}const fl={getGlobalAlpha(r){if(r)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let t=this.alpha,e=this.parent;for(;e;)t*=e.alpha,e=e.parent;return t},getGlobalTransform(r,t){if(t)return r.copyFrom(this.worldTransform);this.updateLocalTransform();const e=kr(this,kt.get().identity());return r.appendFrom(this.localTransform,e),kt.return(e),r},getGlobalTint(r){if(r)return this.renderGroup?fs(this.renderGroup.worldColor):this.parentRenderGroup?fs(hi(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,e=this.parent;for(;e;)t=hi(t,e.localColor),e=e.parent;return fs(t)}};let Ns=0;const ui=500;Yt=function(...r){Ns!==ui&&(Ns++,Ns===ui?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...r))};bn=function(r,t,e){return t.clear(),e||(e=it.IDENTITY),vn(r,t,e,r,!0),t.isValid||t.set(0,0,0,0),t};function vn(r,t,e,s,i){let n;if(i)n=kt.get(),n=e.copyTo(n);else{if(!r.visible||!r.measurable)return;r.updateLocalTransform();const l=r.localTransform;n=kt.get(),n.appendFrom(l,e)}const o=t,a=!!r.effects.length;if(a&&(t=Me.get().clear()),r.boundsArea)t.addRect(r.boundsArea,n);else{r.renderPipeId&&(t.matrix=n,t.addBounds(r.bounds));const l=r.children;for(let u=0;u<l.length;u++)vn(l[u],t,n,s,!1)}if(a){for(let l=0;l<r.effects.length;l++)r.effects[l].addLocalBounds?.(t,s);o.addBounds(t,it.IDENTITY),Me.return(t)}kt.return(n)}function wn(r,t){const e=r.children;for(let s=0;s<e.length;s++){const i=e[s],n=i.uid,o=(i._didViewChangeTick&65535)<<16|i._didContainerChangeTick&65535,a=t.index;(t.data[a]!==n||t.data[a+1]!==o)&&(t.data[t.index]=n,t.data[t.index+1]=o,t.didChange=!0),t.index=a+2,i.children.length&&wn(i,t)}return t.didChange}const pl=new it,ml={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(r,t){const e=Math.sign(this.scale.x)||1;t!==0?this.scale.x=r/t*e:this.scale.x=e},_setHeight(r,t){const e=Math.sign(this.scale.y)||1;t!==0?this.scale.y=r/t*e:this.scale.y=e},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new Xt});const r=this._localBoundsCacheData;return r.index=1,r.didChange=!1,r.data[0]!==this._didViewChangeTick&&(r.didChange=!0,r.data[0]=this._didViewChangeTick),wn(this,r),r.didChange&&bn(this,r.localBounds,pl),r.localBounds},getBounds(r,t){return _n(this,r,t||new Xt)}},gl={_onRender:null,set onRender(r){const t=this.renderGroup||this.parentRenderGroup;if(!r){this._onRender&&t?.removeOnRender(this),this._onRender=null;return}this._onRender||t?.addOnRender(this),this._onRender=r},get onRender(){return this._onRender}},_l={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(r){this._zIndex!==r&&(this._zIndex=r,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(yl))}};function yl(r,t){return r._zIndex-t._zIndex}const xl={getGlobalPosition(r=new St,t=!1){return this.parent?this.parent.toGlobal(this._position,r,t):(r.x=this._position.x,r.y=this._position.y),r},toGlobal(r,t,e=!1){const s=this.getGlobalTransform(kt.get(),e);return t=s.apply(r,t),kt.return(s),t},toLocal(r,t,e,s){t&&(r=t.toGlobal(r,e,s));const i=this.getGlobalTransform(kt.get(),s);return e=i.applyInverse(r,e),kt.return(i),e}};let bl=0;class Cn{constructor(){this.uid=_t("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.tick=0}reset(){this.instructionSize=0,this.tick=bl++}add(t){this.instructions[this.instructionSize++]=t}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}let vl=0;class wl{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1}createTexture(t,e,s){const i=new qt({...this.textureOptions,width:t,height:e,resolution:1,antialias:s,autoGarbageCollect:!0});return new ut({source:i,label:`texturePool_${vl++}`})}getOptimalTexture(t,e,s=1,i){let n=Math.ceil(t*s-1e-6),o=Math.ceil(e*s-1e-6);n=qr(n),o=qr(o);const a=(n<<17)+(o<<1)+(i?1:0);this._texturePool[a]||(this._texturePool[a]=[]);let l=this._texturePool[a].pop();return l||(l=this.createTexture(n,o,i)),l.source._resolution=s,l.source.width=n/s,l.source.height=o/s,l.source.pixelWidth=n,l.source.pixelHeight=o,l.frame.x=0,l.frame.y=0,l.frame.width=t,l.frame.height=e,l.updateUvs(),this._poolKeyHash[l.uid]=a,l}getSameSizeTexture(t,e=!1){const s=t.source;return this.getOptimalTexture(t.width,t.height,s._resolution,e)}returnTexture(t){const e=this._poolKeyHash[t.uid];this._texturePool[e].push(t)}clear(t){if(t=t!==!1,t)for(const e in this._texturePool){const s=this._texturePool[e];if(s)for(let i=0;i<s.length;i++)s[i].destroy(!0)}this._texturePool={}}}Cl=new wl;class Al{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new it,this.worldColorAlpha=4294967295,this.worldColor=16777215,this.worldAlpha=1,this.childrenToUpdate=Object.create(null),this.updateTick=0,this.childrenRenderablesToUpdate={list:[],index:0},this.structureDidChange=!0,this.instructionSet=new Cn,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(t){this.root=t,t._onRender&&this.addOnRender(t),t.didChange=!0;const e=t.children;for(let s=0;s<e.length;s++)this.addChild(e[s])}enableCacheAsTexture(t={}){this.textureOptions=t,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(Cl.returnTexture(this.texture),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0}reset(){this.renderGroupChildren.length=0;for(const t in this.childrenToUpdate){const e=this.childrenToUpdate[t];e.list.fill(null),e.index=0}this.childrenRenderablesToUpdate.index=0,this.childrenRenderablesToUpdate.list.fill(null),this.root=null,this.updateTick=0,this.structureDidChange=!0,this._onRenderContainers.length=0,this.renderGroupParent=null,this.disableCacheAsTexture()}get localTransform(){return this.root.localTransform}addRenderGroupChild(t){t.renderGroupParent&&t.renderGroupParent._removeRenderGroupChild(t),t.renderGroupParent=this,this.renderGroupChildren.push(t)}_removeRenderGroupChild(t){const e=this.renderGroupChildren.indexOf(t);e>-1&&this.renderGroupChildren.splice(e,1),t.renderGroupParent=null}addChild(t){if(this.structureDidChange=!0,t.parentRenderGroup=this,t.updateTick=-1,t.parent===this.root?t.relativeRenderGroupDepth=1:t.relativeRenderGroupDepth=t.parent.relativeRenderGroupDepth+1,t.didChange=!0,this.onChildUpdate(t),t.renderGroup){this.addRenderGroupChild(t.renderGroup);return}t._onRender&&this.addOnRender(t);const e=t.children;for(let s=0;s<e.length;s++)this.addChild(e[s])}removeChild(t){if(this.structureDidChange=!0,t._onRender&&(t.renderGroup||this.removeOnRender(t)),t.parentRenderGroup=null,t.renderGroup){this._removeRenderGroupChild(t.renderGroup);return}const e=t.children;for(let s=0;s<e.length;s++)this.removeChild(e[s])}removeChildren(t){for(let e=0;e<t.length;e++)this.removeChild(t[e])}onChildUpdate(t){let e=this.childrenToUpdate[t.relativeRenderGroupDepth];e||(e=this.childrenToUpdate[t.relativeRenderGroupDepth]={index:0,list:[]}),e.list[e.index++]=t}updateRenderable(t){t.globalDisplayStatus<7||(this.instructionSet.renderPipes[t.renderPipeId].updateRenderable(t),t.didViewUpdate=!1)}onChildViewUpdate(t){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=t}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(t){this._onRenderContainers.push(t)}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1)}runOnRender(){for(let t=0;t<this._onRenderContainers.length;t++)this._onRenderContainers[t]._onRender()}destroy(){this.disableCacheAsTexture(),this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null}getChildren(t=[]){const e=this.root.children;for(let s=0;s<e.length;s++)this._getChildren(e[s],t);return t}_getChildren(t,e=[]){if(e.push(t),t.renderGroup)return e;const s=t.children;for(let i=0;i<s.length;i++)this._getChildren(s[i],e);return e}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return this._matrixDirty&1?(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new it),this._inverseWorldTransform.copyFrom(this.worldTransform).invert()):this._inverseWorldTransform}get textureOffsetInverseTransform(){return this._matrixDirty&2?(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new it),this._textureOffsetInverseTransform.copyFrom(this.inverseWorldTransform).translate(-this._textureBounds.x,-this._textureBounds.y)):this._textureOffsetInverseTransform}get inverseParentTextureTransform(){if(!(this._matrixDirty&4))return this._inverseParentTextureTransform;this._matrixDirty&=-5;const t=this._parentCacheAsTextureRenderGroup;return t?(this._inverseParentTextureTransform||(this._inverseParentTextureTransform=new it),this._inverseParentTextureTransform.copyFrom(this.worldTransform).prepend(t.inverseWorldTransform).translate(-t._textureBounds.x,-t._textureBounds.y)):this.worldTransform}get cacheToLocalTransform(){return this._parentCacheAsTextureRenderGroup?this._parentCacheAsTextureRenderGroup.textureOffsetInverseTransform:null}}function Sl(r,t,e={}){for(const s in t)!e[s]&&t[s]!==void 0&&(r[s]=t[s])}let Vs,Os,zs;Vs=new Dt(null);Os=new Dt(null);zs=new Dt(null,1,1);ci=1;Tl=2;Ls=4;Tt=class extends re{constructor(t={}){super(),this.uid=_t("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 it,this.relativeGroupTransform=new it,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new Dt(this,0,0),this._scale=zs,this._pivot=Os,this._skew=Vs,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=[],Sl(this,t,{children:!0,parent:!0,effects:!0}),t.children?.forEach(e=>this.addChild(e)),t.parent?.addChild(this)}static mixin(t){Object.defineProperties(Tt.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||ft(gt,"addChild: Only Containers will be allowed to add children in v8.0.0"),t.length>1){for(let i=0;i<t.length;i++)this.addChild(t[i]);return t[0]}const e=t[0],s=this.renderGroup||this.parentRenderGroup;return e.parent===this?(this.children.splice(this.children.indexOf(e),1),this.children.push(e),s&&(s.structureDidChange=!0),e):(e.parent&&e.parent.removeChild(e),this.children.push(e),this.sortableChildren&&(this.sortDirty=!0),e.parent=this,e.didChange=!0,e._updateFlags=15,s&&s.addChild(e),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this),this._didViewChangeTick++,e._zIndex!==0&&e.depthOfChildModified(),e)}removeChild(...t){if(t.length>1){for(let i=0;i<t.length;i++)this.removeChild(t[i]);return t[0]}const e=t[0],s=this.children.indexOf(e);return s>-1&&(this._didViewChangeTick++,this.children.splice(s,1),this.renderGroup?this.renderGroup.removeChild(e):this.parentRenderGroup&&this.parentRenderGroup.removeChild(e),e.parent=null,this.emit("childRemoved",e,this,s),e.emit("removed",this)),e}_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;const t=this.parentRenderGroup;t?.removeChild(this),this.renderGroup=te.get(Al,this),this.groupTransform=it.IDENTITY,t?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;const t=this.parentRenderGroup;t?.removeChild(this),te.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 it),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*Va}set angle(t){this.rotation=t*Oa}get pivot(){return this._pivot===Os&&(this._pivot=new Dt(this,0,0)),this._pivot}set pivot(t){this._pivot===Os&&(this._pivot=new Dt(this,0,0)),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===Vs&&(this._skew=new Dt(this,0,0)),this._skew}set skew(t){this._skew===Vs&&(this._skew=new Dt(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===zs&&(this._scale=new Dt(this,1,1)),this._scale}set scale(t){this._scale===zs&&(this._scale=new Dt(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){const e=this.getLocalBounds().width;this._setWidth(t,e)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){const e=this.getLocalBounds().height;this._setHeight(t,e)}getSize(t){t||(t={});const e=this.getLocalBounds();return t.width=Math.abs(this.scale.x*e.width),t.height=Math.abs(this.scale.y*e.height),t}setSize(t,e){const s=this.getLocalBounds();typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,s.width),e!==void 0&&this._setHeight(e,s.height)}_updateSkew(){const t=this._rotation,e=this._skew;this._cx=Math.cos(t+e._y),this._sx=Math.sin(t+e._y),this._cy=-Math.sin(t-e._x),this._sy=Math.cos(t-e._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(){const t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;const e=this.localTransform,s=this._scale,i=this._pivot,n=this._position,o=s._x,a=s._y,l=i._x,u=i._y;e.a=this._cx*o,e.b=this._sx*o,e.c=this._cy*a,e.d=this._sy*a,e.tx=n._x-(l*e.a+u*e.c),e.ty=n._y-(l*e.b+u*e.d)}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=ci,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){const s=Ft.shared.setValue(t??16777215).toBgrNumber();s!==this.localColor&&(this.localColor=s,this._updateFlags|=ci,this._onUpdate())}get tint(){return fs(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Tl,this.localBlendMode=t,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(t){const e=t?2:0;(this.localDisplayStatus&2)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Ls,this.localDisplayStatus^=2,this._onUpdate())}get culled(){return!(this.localDisplayStatus&4)}set culled(t){const e=t?0:4;(this.localDisplayStatus&4)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Ls,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(t){const e=t?1:0;(this.localDisplayStatus&1)!==e&&(this._updateFlags|=Ls,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 e;if(this.children.length&&(e=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)&&e)for(let i=0;i<e.length;++i)e[i].destroy(t);this.renderGroup?.destroy(),this.renderGroup=null}};Tt.mixin(hl);Tt.mixin(xl);Tt.mixin(gl);Tt.mixin(ml);Tt.mixin(cl);Tt.mixin(dl);Tt.mixin(_l);Tt.mixin(nl);Tt.mixin(al);Tt.mixin(fl);class An extends Tt{constructor(){super(...arguments),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=0,this._lastInstructionTick=-1,this._bounds=new Xt(0,1,0,0),this._boundsDirty=!0}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=!1,this._bounds):this._bounds}get roundPixels(){return!!this._roundPixels}set roundPixels(t){this._roundPixels=t?1:0}containsPoint(t){const e=this.bounds,{x:s,y:i}=t;return s>=e.minX&&s<=e.maxX&&i>=e.minY&&i<=e.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}destroy(t){super.destroy(t),this._bounds=null}}qe=class extends An{constructor(t=ut.EMPTY){t instanceof ut&&(t={texture:t});const{texture:e=ut.EMPTY,anchor:s,roundPixels:i,width:n,height:o,...a}=t;super({label:"Sprite",...a}),this.renderPipeId="sprite",this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new Dt({_onUpdate:()=>{this.onViewUpdate()}}),s?this.anchor=s:e.defaultAnchor&&(this.anchor=e.defaultAnchor),this.texture=e,this.allowChildren=!1,this.roundPixels=i??!1,n!==void 0&&(this.width=n),o!==void 0&&(this.height=o)}static from(t,e=!1){return t instanceof ut?new qe(t):new qe(ut.from(t,e))}set texture(t){t||(t=ut.EMPTY);const e=this._texture;e!==t&&(e&&e.dynamic&&e.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 qa(this._visualBounds,this._anchor,this._texture,0),this._visualBounds}get sourceBounds(){return ft("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){const t=this._anchor,e=this._texture,s=this._bounds,{width:i,height:n}=e.orig;s.minX=-t._x*i,s.maxX=s.minX+i,s.minY=-t._y*n,s.maxY=s.minY+n}destroy(t=!1){if(super.destroy(t),typeof t=="boolean"?t:t?.texture){const s=typeof t=="boolean"?t:t?.textureSource;this._texture.destroy(s)}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,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this._texture.orig.width),e!==void 0&&this._setHeight(e,this._texture.orig.height)}};const kl=new Xt;function Sn(r,t,e){const s=kl;r.measurable=!0,_n(r,e,s),t.addBoundsMask(s),r.measurable=!1}function Tn(r,t,e){const s=Me.get();r.measurable=!0;const i=kt.get().identity(),n=kn(r,e,i);bn(r,s,n),r.measurable=!1,t.addBoundsMask(s),kt.return(i),Me.return(s)}function kn(r,t,e){return r?(r!==t&&(kn(r.parent,t,e),r.updateLocalTransform(),e.append(r.localTransform)),e):(Yt("Mask bounds, renderable is not inside the root container"),e)}class Pn{constructor(t){this.priority=0,this.inverse=!1,this.pipe="alphaMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof qe),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask=null}addBounds(t,e){this.inverse||Sn(this.mask,t,e)}addLocalBounds(t,e){Tn(this.mask,t,e)}containsPoint(t,e){const s=this.mask;return e(s,t)}destroy(){this.reset()}static test(t){return t instanceof qe}}Pn.extension=lt.MaskEffect;class Mn{constructor(t){this.priority=0,this.pipe="colorMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t}destroy(){}static test(t){return typeof t=="number"}}Mn.extension=lt.MaskEffect;class In{constructor(t){this.priority=0,this.pipe="stencilMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null}addBounds(t,e){Sn(this.mask,t,e)}addLocalBounds(t,e){Tn(this.mask,t,e)}containsPoint(t,e){const s=this.mask;return e(s,t)}destroy(){this.reset()}static test(t){return t instanceof Tt}}In.extension=lt.MaskEffect;const Pl={createCanvas:(r,t)=>{const e=document.createElement("canvas");return e.width=r,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")};let di=Pl;ne={get(){return di},set(r){di=r}};En=class extends qt{constructor(t){t.resource||(t.resource=ne.get().createCanvas()),t.width||(t.width=t.resource.width,t.autoDensity||(t.width/=t.resolution)),t.height||(t.height=t.resource.height,t.autoDensity||(t.height/=t.resolution)),super(t),this.uploadMethodId="image",this.autoDensity=t.autoDensity,this.resizeCanvas(),this.transparent=!!t.transparent}resizeCanvas(){this.autoDensity&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(t=this.width,e=this.height,s=this._resolution){const i=super.resize(t,e,s);return i&&this.resizeCanvas(),i}static test(t){return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&t instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}};En.extension=lt.TextureSource;Pr=class extends qt{constructor(t){if(t.resource&&globalThis.HTMLImageElement&&t.resource instanceof HTMLImageElement){const e=ne.get().createCanvas(t.resource.width,t.resource.height);e.getContext("2d").drawImage(t.resource,0,0,t.resource.width,t.resource.height),t.resource=e,Yt("ImageSource: Image element passed, converting to canvas. Use CanvasSource instead.")}super(t),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(t){return globalThis.HTMLImageElement&&t instanceof HTMLImageElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||globalThis.VideoFrame&&t instanceof VideoFrame}};Pr.extension=lt.TextureSource;dr=(r=>(r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY",r))(dr||{});class Us{constructor(t,e=null,s=0,i=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=s,this._once=i}match(t,e=null){return this._fn===t&&this._context===e}emit(t){this._fn&&(this._context?this._fn.call(this._context,t):this._fn(t));const e=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const e=this.next;return this.next=t?null:e,this.previous=null,e}}const Dn=class Et{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 Us(null,null,1/0),this.deltaMS=1/Et.targetFPMS,this.elapsedMS=1/Et.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,s=dr.NORMAL){return this._addListener(new Us(t,e,s))}addOnce(t,e,s=dr.NORMAL){return this._addListener(new Us(t,e,s,!0))}_addListener(t){let e=this._head.next,s=this._head;if(!e)t.connect(s);else{for(;e;){if(t.priority>e.priority){t.connect(s);break}s=e,e=e.next}t.previous||t.connect(s)}return this._startIfPossible(),this}remove(t,e){let s=this._head.next;for(;s;)s.match(t,e)?s=s.destroy():s=s.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){const n=t-this._lastFrame|0;if(n<this._minElapsedMS)return;this._lastFrame=t-n%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*Et.targetFPMS;const s=this._head;let i=s.next;for(;i;)i=i.emit(this);s.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){const e=Math.min(this.maxFPS,t),s=Math.min(Math.max(0,e)/1e3,Et.targetFPMS);this._maxElapsedMS=1/s}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{const e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!Et._shared){const t=Et._shared=new Et;t.autoStart=!0,t._protected=!0}return Et._shared}static get system(){if(!Et._system){const t=Et._system=new Et;t.autoStart=!0,t._protected=!0}return Et._system}};Dn.targetFPMS=.06;let Hs;ns=Dn;async function Ml(){return Hs??(Hs=(async()=>{const t=document.createElement("canvas").getContext("webgl");if(!t)return"premultiply-alpha-on-upload";const e=await new Promise(o=>{const a=document.createElement("video");a.onloadeddata=()=>o(a),a.onerror=()=>o(null),a.autoplay=!1,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load()});if(!e)return"premultiply-alpha-on-upload";const s=t.createTexture();t.bindTexture(t.TEXTURE_2D,s);const i=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,i),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,s,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);const n=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,n),t.deleteFramebuffer(i),t.deleteTexture(s),t.getExtension("WEBGL_lose_context")?.loseContext(),n[0]<=n[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),Hs}const ks=class Rn extends qt{constructor(t){super(t),this.isReady=!1,this.uploadMethodId="video",t={...Rn.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){const t=ns.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;const t=this.resource,e=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():(e.preload||t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlayThrough),t.addEventListener("error",this._onError,!0)),this.alphaMode=await Ml(),this._load=new Promise((s,i)=>{this.isValid?s(this):(this._resolve=s,this._reject=i,e.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${e.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(){const 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(){const 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();const 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&&(ns.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||(ns.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(ns.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};ks.extension=lt.TextureSource;ks.defaultOptions={...qt.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};ks.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let Il=ks;const Ce=(r,t,e=!1)=>(Array.isArray(r)||(r=[r]),t?r.map(s=>typeof s=="string"||e?t(s):s):r);class El{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){const e=this._cache.get(t);return e||Yt(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){const s=Ce(t);let i;for(let l=0;l<this.parsers.length;l++){const u=this.parsers[l];if(u.test(e)){i=u.getCacheableAssets(s,e);break}}const n=new Map(Object.entries(i||{}));i||s.forEach(l=>{n.set(l,e)});const o=[...n.keys()],a={cacheKeys:o,keys:s};s.forEach(l=>{this._cacheMap.set(l,a)}),o.forEach(l=>{const u=i?i[l]:e;this._cache.has(l)&&this._cache.get(l)!==u&&Yt("[Cache] already has key:",l),this._cache.set(l,n.get(l))})}remove(t){if(!this._cacheMap.has(t)){Yt(`[Assets] Asset id ${t} was not found in the Cache`);return}const e=this._cacheMap.get(t);e.cacheKeys.forEach(i=>{this._cache.delete(i)}),e.keys.forEach(i=>{this._cacheMap.delete(i)})}get parsers(){return this._parsers}}let fr;Ae=new El;fr=[];jt.handleByList(lt.TextureSource,fr);function Fn(r={}){const t=r&&r.resource,e=t?r.resource:r,s=t?r:{resource:r};for(let i=0;i<fr.length;i++){const n=fr[i];if(n.test(e))return new n(s)}throw new Error(`Could not find a source type for resource: ${s.resource}`)}function Dl(r={},t=!1){const e=r&&r.resource,s=e?r.resource:r,i=e?r:{resource:r};if(!t&&Ae.has(s))return Ae.get(s);const n=new ut({source:Fn(i)});return n.on("destroy",()=>{Ae.has(s)&&Ae.remove(s)}),t||Ae.set(s,n),n}function Rl(r,t=!1){return typeof r=="string"?Ae.get(r):r instanceof qt?new ut({source:r}):Dl(r,t)}ut.from=Rl;qt.from=Fn;jt.add(Pn,Mn,In,Il,Pr,En,Sr);var Bn=(r=>(r[r.Low=0]="Low",r[r.Normal=1]="Normal",r[r.High=2]="High",r))(Bn||{});function Gt(r){if(typeof r!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(r)}`)}function Ee(r){return r.split("?")[0].split("#")[0]}function Fl(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Bl(r,t,e){return r.replace(new RegExp(Fl(t),"g"),e)}function $l(r,t){let e="",s=0,i=-1,n=0,o=-1;for(let a=0;a<=r.length;++a){if(a<r.length)o=r.charCodeAt(a);else{if(o===47)break;o=47}if(o===47){if(!(i===a-1||n===1))if(i!==a-1&&n===2){if(e.length<2||s!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){const l=e.lastIndexOf("/");if(l!==e.length-1){l===-1?(e="",s=0):(e=e.slice(0,l),s=e.length-1-e.lastIndexOf("/")),i=a,n=0;continue}}else if(e.length===2||e.length===1){e="",s=0,i=a,n=0;continue}}}else e.length>0?e+=`/${r.slice(i+1,a)}`:e=r.slice(i+1,a),s=a-i-1;i=a,n=0}else o===46&&n!==-1?++n:n=-1}return e}const Ke={toPosix(r){return Bl(r,"\\","/")},isUrl(r){return/^https?:/.test(this.toPosix(r))},isDataUrl(r){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(r)},isBlobUrl(r){return r.startsWith("blob:")},hasProtocol(r){return/^[^/:]+:/.test(this.toPosix(r))},getProtocol(r){Gt(r),r=this.toPosix(r);const t=/^file:\/\/\//.exec(r);if(t)return t[0];const e=/^[^/:]+:\/{0,2}/.exec(r);return e?e[0]:""},toAbsolute(r,t,e){if(Gt(r),this.isDataUrl(r)||this.isBlobUrl(r))return r;const s=Ee(this.toPosix(t??ne.get().getBaseUrl())),i=Ee(this.toPosix(e??this.rootname(s)));return r=this.toPosix(r),r.startsWith("/")?Ke.join(i,r.slice(1)):this.isAbsolute(r)?r:this.join(s,r)},normalize(r){if(Gt(r),r.length===0)return".";if(this.isDataUrl(r)||this.isBlobUrl(r))return r;r=this.toPosix(r);let t="";const e=r.startsWith("/");this.hasProtocol(r)&&(t=this.rootname(r),r=r.slice(t.length));const s=r.endsWith("/");return r=$l(r),r.length>0&&s&&(r+="/"),e?`/${r}`:t+r},isAbsolute(r){return Gt(r),r=this.toPosix(r),this.hasProtocol(r)?!0:r.startsWith("/")},join(...r){if(r.length===0)return".";let t;for(let e=0;e<r.length;++e){const s=r[e];if(Gt(s),s.length>0)if(t===void 0)t=s;else{const i=r[e-1]??"";this.joinExtensions.includes(this.extname(i).toLowerCase())?t+=`/../${s}`:t+=`/${s}`}}return t===void 0?".":this.normalize(t)},dirname(r){if(Gt(r),r.length===0)return".";r=this.toPosix(r);let t=r.charCodeAt(0);const e=t===47;let s=-1,i=!0;const n=this.getProtocol(r),o=r;r=r.slice(n.length);for(let a=r.length-1;a>=1;--a)if(t=r.charCodeAt(a),t===47){if(!i){s=a;break}}else i=!1;return s===-1?e?"/":this.isUrl(o)?n+r:n:e&&s===1?"//":n+r.slice(0,s)},rootname(r){Gt(r),r=this.toPosix(r);let t="";if(r.startsWith("/")?t="/":t=this.getProtocol(r),this.isUrl(r)){const e=r.indexOf("/",t.length);e!==-1?t=r.slice(0,e):t=r,t.endsWith("/")||(t+="/")}return t},basename(r,t){Gt(r),t&&Gt(t),r=Ee(this.toPosix(r));let e=0,s=-1,i=!0,n;if(t!==void 0&&t.length>0&&t.length<=r.length){if(t.length===r.length&&t===r)return"";let o=t.length-1,a=-1;for(n=r.length-1;n>=0;--n){const l=r.charCodeAt(n);if(l===47){if(!i){e=n+1;break}}else a===-1&&(i=!1,a=n+1),o>=0&&(l===t.charCodeAt(o)?--o===-1&&(s=n):(o=-1,s=a))}return e===s?s=a:s===-1&&(s=r.length),r.slice(e,s)}for(n=r.length-1;n>=0;--n)if(r.charCodeAt(n)===47){if(!i){e=n+1;break}}else s===-1&&(i=!1,s=n+1);return s===-1?"":r.slice(e,s)},extname(r){Gt(r),r=Ee(this.toPosix(r));let t=-1,e=0,s=-1,i=!0,n=0;for(let o=r.length-1;o>=0;--o){const a=r.charCodeAt(o);if(a===47){if(!i){e=o+1;break}continue}s===-1&&(i=!1,s=o+1),a===46?t===-1?t=o:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||s===-1||n===0||n===1&&t===s-1&&t===e+1?"":r.slice(t,s)},parse(r){Gt(r);const t={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return t;r=Ee(this.toPosix(r));let e=r.charCodeAt(0);const s=this.isAbsolute(r);let i;t.root=this.rootname(r),s||this.hasProtocol(r)?i=1:i=0;let n=-1,o=0,a=-1,l=!0,u=r.length-1,h=0;for(;u>=i;--u){if(e=r.charCodeAt(u),e===47){if(!l){o=u+1;break}continue}a===-1&&(l=!1,a=u+1),e===46?n===-1?n=u:h!==1&&(h=1):n!==-1&&(h=-1)}return n===-1||a===-1||h===0||h===1&&n===a-1&&n===o+1?a!==-1&&(o===0&&s?t.base=t.name=r.slice(1,a):t.base=t.name=r.slice(o,a)):(o===0&&s?(t.name=r.slice(1,n),t.base=r.slice(1,a)):(t.name=r.slice(o,n),t.base=r.slice(o,a)),t.ext=r.slice(n,a)),t.dir=this.dirname(r),t},sep:"/",delimiter:":",joinExtensions:[".html"]};function $n(r,t,e,s,i){const n=t[e];for(let o=0;o<n.length;o++){const a=n[o];e<t.length-1?$n(r.replace(s[e],a),t,e+1,s,i):i.push(r.replace(s[e],a))}}function Gl(r){const t=/\{(.*?)\}/g,e=r.match(t),s=[];if(e){const i=[];e.forEach(n=>{const o=n.substring(1,n.length-1).split(",");i.push(o)}),$n(r,i,0,e,s)}else s.push(r);return s}const fi=r=>!Array.isArray(r);class Gn{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params))}),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if(typeof t=="string")this._defaultSearchParams=t;else{const e=t;this._defaultSearchParams=Object.keys(e).map(s=>`${encodeURIComponent(s)}=${encodeURIComponent(e[s])}`).join("&")}}getAlias(t){const{alias:e,src:s}=t;return Ce(e||s,n=>typeof n=="string"?n:Array.isArray(n)?n.map(o=>o?.src??o):n?.src?n.src:n,!0)}addManifest(t){this._manifest&&Yt("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){const s=[];let i=e;Array.isArray(e)||(i=Object.entries(e).map(([n,o])=>typeof o=="string"||Array.isArray(o)?{alias:n,src:o}:{alias:n,...o})),i.forEach(n=>{const o=n.src,a=n.alias;let l;if(typeof a=="string"){const u=this._createBundleAssetId(t,a);s.push(u),l=[a,u]}else{const u=a.map(h=>this._createBundleAssetId(t,h));s.push(...u),l=[...a,...u]}this.add({...n,alias:l,src:o})}),this._bundles[t]=s}add(t){const e=[];Array.isArray(t)?e.push(...t):e.push(t);let s;s=n=>{this.hasKey(n)&&Yt(`[Resolver] already has key: ${n} overwriting`)},Ce(e).forEach(n=>{const{src:o}=n;let{data:a,format:l,loadParser:u}=n;const h=Ce(o).map(d=>typeof d=="string"?Gl(d):Array.isArray(d)?d:[d]),c=this.getAlias(n);Array.isArray(c)?c.forEach(s):s(c);const g=[];h.forEach(d=>{d.forEach(m=>{let _={};if(typeof m!="object"){_.src=m;for(let p=0;p<this._parsers.length;p++){const b=this._parsers[p];if(b.test(m)){_=b.parse(m);break}}}else a=m.data??a,l=m.format??l,u=m.loadParser??u,_={..._,...m};if(!c)throw new Error(`[Resolver] alias is undefined for this asset: ${_.src}`);_=this._buildResolvedAsset(_,{aliases:c,data:a,format:l,loadParser:u}),g.push(_)})}),c.forEach(d=>{this._assetMap[d]=g})})}resolveBundle(t){const e=fi(t);t=Ce(t);const s={};return t.forEach(i=>{const n=this._bundles[i];if(n){const o=this.resolve(n),a={};for(const l in o){const u=o[l];a[this._extractAssetIdFromBundle(i,l)]=u}s[i]=a}}),e?s[t[0]]:s}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const s={};for(const i in e)s[i]=e[i].src;return s}return e.src}resolve(t){const e=fi(t);t=Ce(t);const s={};return t.forEach(i=>{if(!this._resolverHash[i])if(this._assetMap[i]){let n=this._assetMap[i];const o=this._getPreferredOrder(n);o?.priority.forEach(a=>{o.params[a].forEach(l=>{const u=n.filter(h=>h[a]?h[a]===l:!1);u.length&&(n=u)})}),this._resolverHash[i]=n[0]}else this._resolverHash[i]=this._buildResolvedAsset({alias:[i],src:i},{});s[i]=this._resolverHash[i]}),e?s[t[0]]:s}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){const s=t[0],i=this._preferredOrder.find(n=>n.params.format.includes(s.format));if(i)return i}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;const e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){const{aliases:s,data:i,loadParser:n,format:o}=e;return(this._basePath||this._rootPath)&&(t.src=Ke.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=s??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...i||{},...t.data},t.loadParser=n??t.loadParser,t.format=o??t.format??Nl(t.src),t}}Gn.RETINA_PREFIX=/@([0-9\.]+)x/;function Nl(r){return r.split(".").pop().split("?").shift().split("#").shift()}const pi=(r,t)=>{const e=t.split("?")[1];return e&&(r+=`?${e}`),r},Nn=class Ge{constructor(t,e){this.linkedSheets=[],this._texture=t instanceof ut?t:null,this.textureSource=t.source,this.textures={},this.animations={},this.data=e;const s=parseFloat(e.meta.scale);s?(this.resolution=s,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<=Ge.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const s=Ge.BATCH_SIZE;for(;e-t<s&&e<this._frameKeys.length;){const i=this._frameKeys[e],n=this._frames[i],o=n.frame;if(o){let a=null,l=null;const u=n.trimmed!==!1&&n.sourceSize?n.sourceSize:n.frame,h=new Ct(0,0,Math.floor(u.w)/this.resolution,Math.floor(u.h)/this.resolution);n.rotated?a=new Ct(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.h)/this.resolution,Math.floor(o.w)/this.resolution):a=new Ct(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution),n.trimmed!==!1&&n.spriteSourceSize&&(l=new Ct(Math.floor(n.spriteSourceSize.x)/this.resolution,Math.floor(n.spriteSourceSize.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution)),this.textures[i]=new ut({source:this.textureSource,frame:a,orig:h,trim:l,rotate:n.rotated?2:0,defaultAnchor:n.anchor,defaultBorders:n.borders,label:i.toString()})}e++}}_processAnimations(){const t=this.data.animations||{};for(const e in t){this.animations[e]=[];for(let s=0;s<t[e].length;s++){const i=t[e][s];this.animations[e].push(this.textures[i])}}}_parseComplete(){const t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*Ge.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Ge.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){for(const e in this.textures)this.textures[e].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&(this._texture?.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[]}};Nn.BATCH_SIZE=1e3;let mi=Nn;const Vl=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];function Vn(r,t,e){const s={};if(r.forEach(i=>{s[i]=t}),Object.keys(t.textures).forEach(i=>{s[i]=t.textures[i]}),!e){const i=Ke.dirname(r[0]);t.linkedSheets.forEach((n,o)=>{const a=Vn([`${i}/${t.data.meta.related_multi_packs[o]}`],n,!0);Object.assign(s,a)})}return s}const Ol={extension:lt.Asset,cache:{test:r=>r instanceof mi,getCacheableAssets:(r,t)=>Vn(r,t,!1)},resolver:{extension:{type:lt.ResolveParser,name:"resolveSpritesheet"},test:r=>{const e=r.split("?")[0].split("."),s=e.pop(),i=e.pop();return s==="json"&&Vl.includes(i)},parse:r=>{const t=r.split(".");return{resolution:parseFloat(Gn.RETINA_PREFIX.exec(r)?.[1]??"1"),format:t[t.length-2],src:r}}},loader:{name:"spritesheetLoader",extension:{type:lt.LoadParser,priority:Bn.Normal,name:"spritesheetLoader"},async testParse(r,t){return Ke.extname(t.src).toLowerCase()===".json"&&!!r.frames},async parse(r,t,e){const{texture:s,imageFilename:i}=t?.data??{};let n=Ke.dirname(t.src);n&&n.lastIndexOf("/")!==n.length-1&&(n+="/");let o;if(s instanceof ut)o=s;else{const u=pi(n+(i??r.meta.image),t.src);o=(await e.load([u]))[u]}const a=new mi(o.source,r);await a.parse();const l=r?.meta?.related_multi_packs;if(Array.isArray(l)){const u=[];for(const c of l){if(typeof c!="string")continue;let g=n+c;t.data?.ignoreMultiPack||(g=pi(g,t.src),u.push(e.load({src:g,data:{ignoreMultiPack:!0}})))}const h=await Promise.all(u);a.linkedSheets=h,h.forEach(c=>{c.linkedSheets=[a].concat(a.linkedSheets.filter(g=>g!==c))})}return a},async unload(r,t,e){await e.unload(r.textureSource._sourceOrigin),r.destroy(!1)}}};jt.add(Ol);const Ys=Object.create(null),gi=Object.create(null);Mr=function(r,t){let e=gi[r];return e===void 0&&(Ys[t]===void 0&&(Ys[t]=1),gi[r]=e=Ys[t]++),e};let os;function On(){return(!os||os?.isContextLost())&&(os=ne.get().createCanvas().getContext("webgl",{})),os}let as;function zl(){if(!as){as="mediump";const r=On();r&&r.getShaderPrecisionFormat&&(as=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision?"highp":"mediump")}return as}function Ll(r,t,e){return t?r:e?(r=r.replace("out vec4 finalColor;",""),`
|
|
|
|
#ifdef GL_ES // This checks if it is WebGL1
|
|
#define in varying
|
|
#define finalColor gl_FragColor
|
|
#define texture texture2D
|
|
#endif
|
|
${r}
|
|
`):`
|
|
|
|
#ifdef GL_ES // This checks if it is WebGL1
|
|
#define in attribute
|
|
#define out varying
|
|
#endif
|
|
${r}
|
|
`}function Ul(r,t,e){const s=e?t.maxSupportedFragmentPrecision:t.maxSupportedVertexPrecision;if(r.substring(0,9)!=="precision"){let i=e?t.requestedFragmentPrecision:t.requestedVertexPrecision;return i==="highp"&&s!=="highp"&&(i="mediump"),`precision ${i} float;
|
|
${r}`}else if(s!=="highp"&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}function Hl(r,t){return t?`#version 300 es
|
|
${r}`:r}const Yl={},Xl={};function Wl(r,{name:t="pixi-program"},e=!0){t=t.replace(/\s+/g,"-"),t+=e?"-fragment":"-vertex";const s=e?Yl:Xl;return s[t]?(s[t]++,t+=`-${s[t]}`):s[t]=1,r.indexOf("#define SHADER_NAME")!==-1?r:`${`#define SHADER_NAME ${t}`}
|
|
${r}`}function jl(r,t){return t?r.replace("#version 300 es",""):r}const Xs={stripVersion:jl,ensurePrecision:Ul,addProgramDefines:Ll,setProgramName:Wl,insertVersion:Hl},Ws=Object.create(null),zn=class pr{constructor(t){t={...pr.defaultOptions,...t};const e=t.fragment.indexOf("#version 300 es")!==-1,s={stripVersion:e,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:zl()},setProgramName:{name:t.name},addProgramDefines:e,insertVersion:e};let i=t.fragment,n=t.vertex;Object.keys(Xs).forEach(o=>{const a=s[o];i=Xs[o](i,a,!0),n=Xs[o](n,a,!1)}),this.fragment=i,this.vertex=n,this.transformFeedbackVaryings=t.transformFeedbackVaryings,this._key=Mr(`${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){const e=`${t.vertex}:${t.fragment}`;return Ws[e]||(Ws[e]=new pr(t)),Ws[e]}};zn.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};Ln=zn;const _i={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}};ql=function(r){return _i[r]??_i.float32};const Kl={f32:"float32","vec2<f32>":"float32x2","vec3<f32>":"float32x3","vec4<f32>":"float32x4",vec2f:"float32x2",vec3f:"float32x3",vec4f:"float32x4",i32:"sint32","vec2<i32>":"sint32x2","vec3<i32>":"sint32x3","vec4<i32>":"sint32x4",u32:"uint32","vec2<u32>":"uint32x2","vec3<u32>":"uint32x3","vec4<u32>":"uint32x4",bool:"uint32","vec2<bool>":"uint32x2","vec3<bool>":"uint32x3","vec4<bool>":"uint32x4"};function Zl({source:r,entryPoint:t}){const e={},s=r.indexOf(`fn ${t}`);if(s!==-1){const i=r.indexOf("->",s);if(i!==-1){const n=r.substring(s,i),o=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|$)/g;let a;for(;(a=o.exec(n))!==null;){const l=Kl[a[3]]??"float32";e[a[2]]={location:parseInt(a[1],10),format:l,stride:ql(l).stride,offset:0,instance:!1,start:0}}}}return e}function js(r){const t=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,e=/@group\((\d+)\)/,s=/@binding\((\d+)\)/,i=/var(<[^>]+>)? (\w+)/,n=/:\s*(\w+)/,o=/struct\s+(\w+)\s*{([^}]+)}/g,a=/(\w+)\s*:\s*([\w\<\>]+)/g,l=/struct\s+(\w+)/,u=r.match(t)?.map(c=>({group:parseInt(c.match(e)[1],10),binding:parseInt(c.match(s)[1],10),name:c.match(i)[2],isUniform:c.match(i)[1]==="<uniform>",type:c.match(n)[1]}));if(!u)return{groups:[],structs:[]};const h=r.match(o)?.map(c=>{const g=c.match(l)[1],d=c.match(a).reduce((m,_)=>{const[p,b]=_.split(":");return m[p.trim()]=b.trim(),m},{});return d?{name:g,members:d}:null}).filter(({name:c})=>u.some(g=>g.type===c))??[];return{groups:u,structs:h}}var Ne=(r=>(r[r.VERTEX=1]="VERTEX",r[r.FRAGMENT=2]="FRAGMENT",r[r.COMPUTE=4]="COMPUTE",r))(Ne||{});function Ql({groups:r}){const t=[];for(let e=0;e<r.length;e++){const s=r[e];t[s.group]||(t[s.group]=[]),s.isUniform?t[s.group].push({binding:s.binding,visibility:Ne.VERTEX|Ne.FRAGMENT,buffer:{type:"uniform"}}):s.type==="sampler"?t[s.group].push({binding:s.binding,visibility:Ne.FRAGMENT,sampler:{type:"filtering"}}):s.type==="texture_2d"&&t[s.group].push({binding:s.binding,visibility:Ne.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:!1}})}return t}function Jl({groups:r}){const t=[];for(let e=0;e<r.length;e++){const s=r[e];t[s.group]||(t[s.group]={}),t[s.group][s.name]=s.binding}return t}function th(r,t){const e=new Set,s=new Set,i=[...r.structs,...t.structs].filter(o=>e.has(o.name)?!1:(e.add(o.name),!0)),n=[...r.groups,...t.groups].filter(o=>{const a=`${o.name}-${o.binding}`;return s.has(a)?!1:(s.add(a),!0)});return{structs:i,groups:n}}const qs=Object.create(null);Ps=class{constructor(t){this._layoutKey=0,this._attributeLocationsKey=0;const{fragment:e,vertex:s,layout:i,gpuLayout:n,name:o}=t;if(this.name=o,this.fragment=e,this.vertex=s,e.source===s.source){const a=js(e.source);this.structsAndGroups=a}else{const a=js(s.source),l=js(e.source);this.structsAndGroups=th(a,l)}this.layout=i??Jl(this.structsAndGroups),this.gpuLayout=n??Ql(this.structsAndGroups),this.autoAssignGlobalUniforms=this.layout[0]?.globalUniforms!==void 0,this.autoAssignLocalUniforms=this.layout[1]?.localUniforms!==void 0,this._generateProgramKey()}_generateProgramKey(){const{vertex:t,fragment:e}=this,s=t.source+e.source+t.entryPoint+e.entryPoint;this._layoutKey=Mr(s,"program")}get attributeData(){return this._attributeData??(this._attributeData=Zl(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null}static from(t){const e=`${t.vertex.source}:${t.fragment.source}:${t.fragment.entryPoint}:${t.vertex.entryPoint}`;return qs[e]||(qs[e]=new Ps(t)),qs[e]}};const Un=["f32","i32","vec2<f32>","vec3<f32>","vec4<f32>","mat2x2<f32>","mat3x3<f32>","mat4x4<f32>","mat3x2<f32>","mat4x2<f32>","mat2x3<f32>","mat4x3<f32>","mat2x4<f32>","mat3x4<f32>","vec2<i32>","vec3<i32>","vec4<i32>"],eh=Un.reduce((r,t)=>(r[t]=!0,r),{});function sh(r,t){switch(r){case"f32":return 0;case"vec2<f32>":return new Float32Array(2*t);case"vec3<f32>":return new Float32Array(3*t);case"vec4<f32>":return new Float32Array(4*t);case"mat2x2<f32>":return new Float32Array([1,0,0,1]);case"mat3x3<f32>":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4<f32>":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}const Hn=class Yn{constructor(t,e){this._touched=0,this.uid=_t("uniform"),this._resourceType="uniformGroup",this._resourceId=_t("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,e={...Yn.defaultOptions,...e},this.uniformStructures=t;const s={};for(const i in t){const n=t[i];if(n.name=i,n.size=n.size??1,!eh[n.type])throw new Error(`Uniform type ${n.type} is not supported. Supported uniform types are: ${Un.join(", ")}`);n.value??(n.value=sh(n.type,n.size)),s[i]=n.value}this.uniforms=s,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=Mr(Object.keys(s).map(i=>`${i}-${t[i].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};Hn.defaultOptions={ubo:!1,isStatic:!1};Xn=Hn;ps=class{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(const s in t){const i=t[s];this.setResource(i,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;const t=[];let e=0;for(const s in this.resources)t[e++]=this.resources[s]._resourceId;this._key=t.join("|")}setResource(t,e){const s=this.resources[e];t!==s&&(s&&t.off?.("change",this.onResourceChange,this),t.on?.("change",this.onResourceChange,this),this.resources[e]=t,this._dirty=!0)}getResource(t){return this.resources[t]}_touch(t){const e=this.resources;for(const s in e)e[s]._touched=t}destroy(){const t=this.resources;for(const e in t)t[e].off?.("change",this.onResourceChange,this);this.resources=null}onResourceChange(t){if(this._dirty=!0,t.destroyed){const e=this.resources;for(const s in e)e[s]===t&&(e[s]=null)}else this._updateKey()}};mr=(r=>(r[r.WEBGL=1]="WEBGL",r[r.WEBGPU=2]="WEBGPU",r[r.BOTH=3]="BOTH",r))(mr||{});Ir=class extends re{constructor(t){super(),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:e,glProgram:s,groups:i,resources:n,compatibleRenderers:o,groupMap:a}=t;this.gpuProgram=e,this.glProgram=s,o===void 0&&(o=0,e&&(o|=mr.WEBGPU),s&&(o|=mr.WEBGL)),this.compatibleRenderers=o;const l={};if(!n&&!i&&(n={}),n&&i)throw new Error("[Shader] Cannot have both resources and groups");if(!e&&i&&!a)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!e&&i&&a)for(const u in a)for(const h in a[u]){const c=a[u][h];l[c]={group:u,binding:h,name:c}}else if(e&&i&&!a){const u=e.structsAndGroups.groups;a={},u.forEach(h=>{a[h.group]=a[h.group]||{},a[h.group][h.binding]=h.name,l[h.name]=h})}else if(n){i={},a={},e&&e.structsAndGroups.groups.forEach(c=>{a[c.group]=a[c.group]||{},a[c.group][c.binding]=c.name,l[c.name]=c});let u=0;for(const h in n)l[h]||(i[99]||(i[99]=new ps,this._ownedBindGroups.push(i[99])),l[h]={group:99,binding:u,name:h},a[99]=a[99]||{},a[99][u]=h,u++);for(const h in n){const c=h;let g=n[h];!g.source&&!g._resourceType&&(g=new Xn(g));const d=l[c];d&&(i[d.group]||(i[d.group]=new ps,this._ownedBindGroups.push(i[d.group])),i[d.group].setResource(g,d.binding))}}this.groups=i,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(i,l)}addResource(t,e,s){var i,n;(i=this._uniformBindMap)[e]||(i[e]={}),(n=this._uniformBindMap[e])[s]||(n[s]=t),this.groups[e]||(this.groups[e]=new ps,this._ownedBindGroups.push(this.groups[e]))}_buildResourceAccessor(t,e){const s={};for(const i in e){const n=e[i];Object.defineProperty(s,n.name,{get(){return t[n.group].getResource(n.binding)},set(o){t[n.group].setResource(o,n.binding)}})}return s}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(e=>{e.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null}static from(t){const{gpu:e,gl:s,...i}=t;let n,o;return e&&(n=Ps.from(e)),s&&(o=Ln.from(s)),new Ir({gpuProgram:n,glProgram:o,...i})}};const gr=[];jt.handleByNamedList(lt.Environment,gr);async function rh(r){if(!r)for(let t=0;t<gr.length;t++){const e=gr[t];if(e.value.test()){await e.value.load();return}}}let De;ih=function(){if(typeof De=="boolean")return De;try{De=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{De=!1}return De};var ls={exports:{}},yi;function nh(){if(yi)return ls.exports;yi=1,ls.exports=r,ls.exports.default=r;function r(f,y,w){w=w||2;var P=y&&y.length,S=P?y[0]*w:f.length,k=t(f,0,S,w,!0),I=[];if(!k||k.next===k.prev)return I;var V,z,H,nt,ot,Q,mt;if(P&&(k=l(f,y,k,w)),f.length>80*w){V=H=f[0],z=nt=f[1];for(var et=w;et<S;et+=w)ot=f[et],Q=f[et+1],ot<V&&(V=ot),Q<z&&(z=Q),ot>H&&(H=ot),Q>nt&&(nt=Q);mt=Math.max(H-V,nt-z),mt=mt!==0?32767/mt:0}return s(k,I,w,V,z,mt,0),I}function t(f,y,w,P,S){var k,I;if(S===tt(f,y,w,P)>0)for(k=y;k<w;k+=P)I=$(k,f[k],f[k+1],I);else for(k=w-P;k>=y;k-=P)I=$(k,f[k],f[k+1],I);return I&&F(I,I.next)&&(U(I),I=I.next),I}function e(f,y){if(!f)return f;y||(y=f);var w=f,P;do if(P=!1,!w.steiner&&(F(w,w.next)||T(w.prev,w,w.next)===0)){if(U(w),w=y=w.prev,w===w.next)break;P=!0}else w=w.next;while(P||w!==y);return y}function s(f,y,w,P,S,k,I){if(f){!I&&k&&d(f,P,S,k);for(var V=f,z,H;f.prev!==f.next;){if(z=f.prev,H=f.next,k?n(f,P,S,k):i(f)){y.push(z.i/w|0),y.push(f.i/w|0),y.push(H.i/w|0),U(f),f=H.next,V=H.next;continue}if(f=H,f===V){I?I===1?(f=o(e(f),y,w),s(f,y,w,P,S,k,2)):I===2&&a(f,y,w,P,S,k):s(e(f),y,w,P,S,k,1);break}}}}function i(f){var y=f.prev,w=f,P=f.next;if(T(y,w,P)>=0)return!1;for(var S=y.x,k=w.x,I=P.x,V=y.y,z=w.y,H=P.y,nt=S<k?S<I?S:I:k<I?k:I,ot=V<z?V<H?V:H:z<H?z:H,Q=S>k?S>I?S:I:k>I?k:I,mt=V>z?V>H?V:H:z>H?z:H,et=P.next;et!==y;){if(et.x>=nt&&et.x<=Q&&et.y>=ot&&et.y<=mt&&b(S,V,k,z,I,H,et.x,et.y)&&T(et.prev,et,et.next)>=0)return!1;et=et.next}return!0}function n(f,y,w,P){var S=f.prev,k=f,I=f.next;if(T(S,k,I)>=0)return!1;for(var V=S.x,z=k.x,H=I.x,nt=S.y,ot=k.y,Q=I.y,mt=V<z?V<H?V:H:z<H?z:H,et=nt<ot?nt<Q?nt:Q:ot<Q?ot:Q,Kt=V>z?V>H?V:H:z>H?z:H,It=nt>ot?nt>Q?nt:Q:ot>Q?ot:Q,Ot=_(mt,et,y,w,P),zt=_(Kt,It,y,w,P),K=f.prevZ,J=f.nextZ;K&&K.z>=Ot&&J&&J.z<=zt;){if(K.x>=mt&&K.x<=Kt&&K.y>=et&&K.y<=It&&K!==S&&K!==I&&b(V,nt,z,ot,H,Q,K.x,K.y)&&T(K.prev,K,K.next)>=0||(K=K.prevZ,J.x>=mt&&J.x<=Kt&&J.y>=et&&J.y<=It&&J!==S&&J!==I&&b(V,nt,z,ot,H,Q,J.x,J.y)&&T(J.prev,J,J.next)>=0))return!1;J=J.nextZ}for(;K&&K.z>=Ot;){if(K.x>=mt&&K.x<=Kt&&K.y>=et&&K.y<=It&&K!==S&&K!==I&&b(V,nt,z,ot,H,Q,K.x,K.y)&&T(K.prev,K,K.next)>=0)return!1;K=K.prevZ}for(;J&&J.z<=zt;){if(J.x>=mt&&J.x<=Kt&&J.y>=et&&J.y<=It&&J!==S&&J!==I&&b(V,nt,z,ot,H,Q,J.x,J.y)&&T(J.prev,J,J.next)>=0)return!1;J=J.nextZ}return!0}function o(f,y,w){var P=f;do{var S=P.prev,k=P.next.next;!F(S,k)&&B(S,P,P.next,k)&&L(S,k)&&L(k,S)&&(y.push(S.i/w|0),y.push(P.i/w|0),y.push(k.i/w|0),U(P),U(P.next),P=f=k),P=P.next}while(P!==f);return e(P)}function a(f,y,w,P,S,k){var I=f;do{for(var V=I.next.next;V!==I.prev;){if(I.i!==V.i&&C(I,V)){var z=A(I,V);I=e(I,I.next),z=e(z,z.next),s(I,y,w,P,S,k,0),s(z,y,w,P,S,k,0);return}V=V.next}I=I.next}while(I!==f)}function l(f,y,w,P){var S=[],k,I,V,z,H;for(k=0,I=y.length;k<I;k++)V=y[k]*P,z=k<I-1?y[k+1]*P:f.length,H=t(f,V,z,P,!1),H===H.next&&(H.steiner=!0),S.push(p(H));for(S.sort(u),k=0;k<S.length;k++)w=h(S[k],w);return w}function u(f,y){return f.x-y.x}function h(f,y){var w=c(f,y);if(!w)return y;var P=A(w,f);return e(P,P.next),e(w,w.next)}function c(f,y){var w=y,P=f.x,S=f.y,k=-1/0,I;do{if(S<=w.y&&S>=w.next.y&&w.next.y!==w.y){var V=w.x+(S-w.y)*(w.next.x-w.x)/(w.next.y-w.y);if(V<=P&&V>k&&(k=V,I=w.x<w.next.x?w:w.next,V===P))return I}w=w.next}while(w!==y);if(!I)return null;var z=I,H=I.x,nt=I.y,ot=1/0,Q;w=I;do P>=w.x&&w.x>=H&&P!==w.x&&b(S<nt?P:k,S,H,nt,S<nt?k:P,S,w.x,w.y)&&(Q=Math.abs(S-w.y)/(P-w.x),L(w,f)&&(Q<ot||Q===ot&&(w.x>I.x||w.x===I.x&&g(I,w)))&&(I=w,ot=Q)),w=w.next;while(w!==z);return I}function g(f,y){return T(f.prev,f,y.prev)<0&&T(y.next,f,f.next)<0}function d(f,y,w,P){var S=f;do S.z===0&&(S.z=_(S.x,S.y,y,w,P)),S.prevZ=S.prev,S.nextZ=S.next,S=S.next;while(S!==f);S.prevZ.nextZ=null,S.prevZ=null,m(S)}function m(f){var y,w,P,S,k,I,V,z,H=1;do{for(w=f,f=null,k=null,I=0;w;){for(I++,P=w,V=0,y=0;y<H&&(V++,P=P.nextZ,!!P);y++);for(z=H;V>0||z>0&&P;)V!==0&&(z===0||!P||w.z<=P.z)?(S=w,w=w.nextZ,V--):(S=P,P=P.nextZ,z--),k?k.nextZ=S:f=S,S.prevZ=k,k=S;w=P}k.nextZ=null,H*=2}while(I>1);return f}function _(f,y,w,P,S){return f=(f-w)*S|0,y=(y-P)*S|0,f=(f|f<<8)&16711935,f=(f|f<<4)&252645135,f=(f|f<<2)&858993459,f=(f|f<<1)&1431655765,y=(y|y<<8)&16711935,y=(y|y<<4)&252645135,y=(y|y<<2)&858993459,y=(y|y<<1)&1431655765,f|y<<1}function p(f){var y=f,w=f;do(y.x<w.x||y.x===w.x&&y.y<w.y)&&(w=y),y=y.next;while(y!==f);return w}function b(f,y,w,P,S,k,I,V){return(S-I)*(y-V)>=(f-I)*(k-V)&&(f-I)*(P-V)>=(w-I)*(y-V)&&(w-I)*(k-V)>=(S-I)*(P-V)}function C(f,y){return f.next.i!==y.i&&f.prev.i!==y.i&&!O(f,y)&&(L(f,y)&&L(y,f)&&R(f,y)&&(T(f.prev,f,y.prev)||T(f,y.prev,y))||F(f,y)&&T(f.prev,f,f.next)>0&&T(y.prev,y,y.next)>0)}function T(f,y,w){return(y.y-f.y)*(w.x-y.x)-(y.x-f.x)*(w.y-y.y)}function F(f,y){return f.x===y.x&&f.y===y.y}function B(f,y,w,P){var S=E(T(f,y,w)),k=E(T(f,y,P)),I=E(T(w,P,f)),V=E(T(w,P,y));return!!(S!==k&&I!==V||S===0&&M(f,w,y)||k===0&&M(f,P,y)||I===0&&M(w,f,P)||V===0&&M(w,y,P))}function M(f,y,w){return y.x<=Math.max(f.x,w.x)&&y.x>=Math.min(f.x,w.x)&&y.y<=Math.max(f.y,w.y)&&y.y>=Math.min(f.y,w.y)}function E(f){return f>0?1:f<0?-1:0}function O(f,y){var w=f;do{if(w.i!==f.i&&w.next.i!==f.i&&w.i!==y.i&&w.next.i!==y.i&&B(w,w.next,f,y))return!0;w=w.next}while(w!==f);return!1}function L(f,y){return T(f.prev,f,f.next)<0?T(f,y,f.next)>=0&&T(f,f.prev,y)>=0:T(f,y,f.prev)<0||T(f,f.next,y)<0}function R(f,y){var w=f,P=!1,S=(f.x+y.x)/2,k=(f.y+y.y)/2;do w.y>k!=w.next.y>k&&w.next.y!==w.y&&S<(w.next.x-w.x)*(k-w.y)/(w.next.y-w.y)+w.x&&(P=!P),w=w.next;while(w!==f);return P}function A(f,y){var w=new X(f.i,f.x,f.y),P=new X(y.i,y.x,y.y),S=f.next,k=y.prev;return f.next=y,y.prev=f,w.next=S,S.prev=w,P.next=w,w.prev=P,k.next=P,P.prev=k,P}function $(f,y,w,P){var S=new X(f,y,w);return P?(S.next=P.next,S.prev=P,P.next.prev=S,P.next=S):(S.prev=S,S.next=S),S}function U(f){f.next.prev=f.prev,f.prev.next=f.next,f.prevZ&&(f.prevZ.nextZ=f.nextZ),f.nextZ&&(f.nextZ.prevZ=f.prevZ)}function X(f,y,w){this.i=f,this.x=y,this.y=w,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}r.deviation=function(f,y,w,P){var S=y&&y.length,k=S?y[0]*w:f.length,I=Math.abs(tt(f,0,k,w));if(S)for(var V=0,z=y.length;V<z;V++){var H=y[V]*w,nt=V<z-1?y[V+1]*w:f.length;I-=Math.abs(tt(f,H,nt,w))}var ot=0;for(V=0;V<P.length;V+=3){var Q=P[V]*w,mt=P[V+1]*w,et=P[V+2]*w;ot+=Math.abs((f[Q]-f[et])*(f[mt+1]-f[Q+1])-(f[Q]-f[mt])*(f[et+1]-f[Q+1]))}return I===0&&ot===0?0:Math.abs((ot-I)/I)};function tt(f,y,w,P){for(var S=0,k=y,I=w-P;k<w;k+=P)S+=(f[I]-f[k])*(f[k+1]+f[I+1]),I=k;return S}return r.flatten=function(f){for(var y=f[0][0].length,w={vertices:[],holes:[],dimensions:y},P=0,S=0;S<f.length;S++){for(var k=0;k<f[S].length;k++)for(var I=0;I<y;I++)w.vertices.push(f[S][k][I]);S>0&&(P+=f[S-1].length,w.holes.push(P))}return w},ls.exports}var oh=nh();const ah=Cr(oh);Wn=(r=>(r[r.NONE=0]="NONE",r[r.COLOR=16384]="COLOR",r[r.STENCIL=1024]="STENCIL",r[r.DEPTH=256]="DEPTH",r[r.COLOR_DEPTH=16640]="COLOR_DEPTH",r[r.COLOR_STENCIL=17408]="COLOR_STENCIL",r[r.DEPTH_STENCIL=1280]="DEPTH_STENCIL",r[r.ALL=17664]="ALL",r))(Wn||{});lh=class{constructor(t){this.items=[],this._name=t}emit(t,e,s,i,n,o,a,l){const{name:u,items:h}=this;for(let c=0,g=h.length;c<g;c++)h[c][u](t,e,s,i,n,o,a,l);return this}add(t){return t[this._name]&&(this.remove(t),this.items.push(t)),this}remove(t){const e=this.items.indexOf(t);return e!==-1&&this.items.splice(e,1),this}contains(t){return this.items.indexOf(t)!==-1}removeAll(){return this.items.length=0,this}destroy(){this.removeAll(),this.items=null,this._name=null}get empty(){return this.items.length===0}get name(){return this._name}};const hh=["init","destroy","contextChange","resolutionChange","reset","renderEnd","renderStart","render","update","postrender","prerender"],jn=class qn extends re{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;const e=[...hh,...this.config.runners??[]];this._addRunners(...e),this._unsafeEvalCheck()}async init(t={}){const e=t.skipExtensionImports===!0?!0:t.manageImports===!1;await rh(e),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(const s in this._systemsHash)t={...this._systemsHash[s].constructor.defaultOptions,...t};t={...qn.defaultOptions,...t},this._roundPixels=t.roundPixels?1:0;for(let s=0;s<this.runners.init.items.length;s++)await this.runners.init.items[s].init(t);this._initOptions=t}render(t,e){let s=t;if(s instanceof Tt&&(s={container:s},e&&(ft(gt,"passing a second argument is deprecated, please use render options instead"),s.target=e.renderTexture)),s.target||(s.target=this.view.renderTarget),s.target===this.view.renderTarget&&(this._lastObjectRendered=s.container,s.clearColor=this.background.colorRgba),s.clearColor){const i=Array.isArray(s.clearColor)&&s.clearColor.length===4;s.clearColor=i?s.clearColor:Ft.shared.setValue(s.clearColor).toArray()}s.transform||(s.container.updateLocalTransform(),s.transform=s.container.localTransform),s.container.enableRenderGroup(),this.runners.prerender.emit(s),this.runners.renderStart.emit(s),this.runners.render.emit(s),this.runners.renderEnd.emit(s),this.runners.postrender.emit(s)}resize(t,e,s){const i=this.view.resolution;this.view.resize(t,e,s),this.emit("resize",this.view.screen.width,this.view.screen.height,this.view.resolution),s!==void 0&&s!==i&&this.runners.resolutionChange.emit(s)}clear(t={}){const e=this;t.target||(t.target=e.renderTarget.renderTarget),t.clearColor||(t.clearColor=this.background.colorRgba),t.clear??(t.clear=Wn.ALL);const{clear:s,clearColor:i,target:n}=t;Ft.shared.setValue(i??this.background.colorRgba),e.renderTarget.clear(n,s,Ft.shared.toArray())}get resolution(){return this.view.resolution}set resolution(t){this.view.resolution=t,this.runners.resolutionChange.emit(t)}get width(){return this.view.texture.frame.width}get height(){return this.view.texture.frame.height}get canvas(){return this.view.canvas}get lastObjectRendered(){return this._lastObjectRendered}get renderingToScreen(){return this.renderTarget.renderingToScreen}get screen(){return this.view.screen}_addRunners(...t){t.forEach(e=>{this.runners[e]=new lh(e)})}_addSystems(t){let e;for(e in t){const s=t[e];this._addSystem(s.value,s.name)}}_addSystem(t,e){const s=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=s,this._systemsHash[e]=s;for(const i in this.runners)this.runners[i].add(s);return this}_addPipes(t,e){const s=e.reduce((i,n)=>(i[n.name]=n.value,i),{});t.forEach(i=>{const n=i.value,o=i.name,a=s[o];this.renderPipes[o]=new n(this,a?new a:null)})}destroy(t=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(t),Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash=null,this.renderPipes=null}generateTexture(t){return this.textureGenerator.generateTexture(t)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!ih())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}};jn.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};let hs;Kn=jn;function uh(r){return hs!==void 0||(hs=(()=>{const t={stencil:!0,failIfMajorPerformanceCaveat:r??Kn.defaultOptions.failIfMajorPerformanceCaveat};try{if(!ne.get().getWebGLRenderingContext())return!1;let s=ne.get().createCanvas().getContext("webgl",t);const i=!!s?.getContextAttributes()?.stencil;if(s){const n=s.getExtension("WEBGL_lose_context");n&&n.loseContext()}return s=null,i}catch{return!1}})()),hs}let us;async function ch(r={}){return us!==void 0||(us=await (async()=>{const t=ne.get().getNavigator().gpu;if(!t)return!1;try{return await (await t.requestAdapter(r)).requestDevice(),!0}catch{return!1}})()),us}const xi=["webgl","webgpu","canvas"];async function dh(r){let t=[];r.preference?(t.push(r.preference),xi.forEach(n=>{n!==r.preference&&t.push(n)})):t=xi.slice();let e,s={};for(let n=0;n<t.length;n++){const o=t[n];if(o==="webgpu"&&await ch()){const{WebGPURenderer:a}=await Te(async()=>{const{WebGPURenderer:l}=await import("./WebGPURenderer-WqxaCEVy.js");return{WebGPURenderer:l}},__vite__mapDeps([12,10,13,11,1,2,3,4,5]),import.meta.url);e=a,s={...r,...r.webgpu};break}else if(o==="webgl"&&uh(r.failIfMajorPerformanceCaveat??Kn.defaultOptions.failIfMajorPerformanceCaveat)){const{WebGLRenderer:a}=await Te(async()=>{const{WebGLRenderer:l}=await import("./WebGLRenderer-DlZELJmP.js");return{WebGLRenderer:l}},__vite__mapDeps([14,10,13,1,2,3,4,5]),import.meta.url);e=a,s={...r,...r.webgl};break}else if(o==="canvas")throw s={...r},new Error("CanvasRenderer is not yet implemented")}if(delete s.webgpu,delete s.webgl,!e)throw new Error("No available renderer for the current environment");const i=new e;return await i.init(s),i}Zn="8.6.3";class Qn{static init(){globalThis.__PIXI_APP_INIT__?.(this,Zn)}static destroy(){}}Qn.extension=lt.Application;fh=class{constructor(t){this._renderer=t}init(){globalThis.__PIXI_RENDERER_INIT__?.(this._renderer,Zn)}destroy(){this._renderer=null}};fh.extension={type:[lt.WebGLSystem,lt.WebGPUSystem],name:"initHook",priority:-10};const Jn=class _r{constructor(...t){this.stage=new Tt,t[0]!==void 0&&ft(gt,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.renderer=await dh(t),_r._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return ft(gt,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(t=!1,e=!1){const s=_r._plugins.slice(0);s.reverse(),s.forEach(i=>{i.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};Jn._plugins=[];let to=Jn;jt.handleByList(lt.Application,to._plugins);jt.add(Qn);const eo=class yr{constructor(t,e,s,i){this.uid=_t("fillGradient"),this.type="linear",this.gradientStops=[],this._styleKey=null,this.x0=t,this.y0=e,this.x1=s,this.y1=i}addColorStop(t,e){return this.gradientStops.push({offset:t,color:Ft.shared.setValue(e).toHexa()}),this._styleKey=null,this}buildLinearGradient(){if(this.texture)return;const t=yr.defaultTextureSize,{gradientStops:e}=this,s=ne.get().createCanvas();s.width=t,s.height=t;const i=s.getContext("2d"),n=i.createLinearGradient(0,0,yr.defaultTextureSize,1);for(let _=0;_<e.length;_++){const p=e[_];n.addColorStop(p.offset,p.color)}i.fillStyle=n,i.fillRect(0,0,t,t),this.texture=new ut({source:new Pr({resource:s,addressModeU:"clamp-to-edge",addressModeV:"repeat"})});const{x0:o,y0:a,x1:l,y1:u}=this,h=new it,c=l-o,g=u-a,d=Math.sqrt(c*c+g*g),m=Math.atan2(g,c);h.translate(-o,-a),h.scale(1/t,1/t),h.rotate(-m),h.scale(256/d,1),this.transform=h,this._styleKey=null}get styleKey(){if(this._styleKey)return this._styleKey;const t=this.gradientStops.map(i=>`${i.offset}-${i.color}`).join("-"),e=this.texture.uid,s=this.transform.toArray().join("-");return`fill-gradient-${this.uid}-${t}-${e}-${s}-${this.x0}-${this.y0}-${this.x1}-${this.y1}`}};eo.defaultTextureSize=256;ph=eo;const bi={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"}};mh=class{constructor(t,e){this.uid=_t("fillPattern"),this.transform=new it,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=bi[e].addressModeU,t.source.style.addressModeV=bi[e].addressModeV)}setTransform(t){const e=this.texture;this.transform.copyFrom(t),this.transform.invert(),this.transform.scale(1/e.frame.width,1/e.frame.height),this._styleKey=null}get styleKey(){return this._styleKey?this._styleKey:(this._styleKey=`fill-pattern-${this.uid}-${this.texture.uid}-${this.transform.toArray().join("-")}`,this._styleKey)}};var Ks,vi;function gh(){if(vi)return Ks;vi=1,Ks=e;var r={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},t=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function e(n){var o=[];return n.replace(t,function(a,l,u){var h=l.toLowerCase();for(u=i(u),h=="m"&&u.length>2&&(o.push([l].concat(u.splice(0,2))),h="l",l=l=="m"?"l":"L");;){if(u.length==r[h])return u.unshift(l),o.push(u);if(u.length<r[h])throw new Error("malformed path data");o.push([l].concat(u.splice(0,r[h])))}}),o}var s=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function i(n){var o=n.match(s);return o?o.map(Number):[]}return Ks}var _h=gh();const yh=Cr(_h);function xh(r,t){const e=yh(r),s=[];let i=null,n=0,o=0;for(let a=0;a<e.length;a++){const l=e[a],u=l[0],h=l;switch(u){case"M":n=h[1],o=h[2],t.moveTo(n,o);break;case"m":n+=h[1],o+=h[2],t.moveTo(n,o);break;case"H":n=h[1],t.lineTo(n,o);break;case"h":n+=h[1],t.lineTo(n,o);break;case"V":o=h[1],t.lineTo(n,o);break;case"v":o+=h[1],t.lineTo(n,o);break;case"L":n=h[1],o=h[2],t.lineTo(n,o);break;case"l":n+=h[1],o+=h[2],t.lineTo(n,o);break;case"C":n=h[5],o=h[6],t.bezierCurveTo(h[1],h[2],h[3],h[4],n,o);break;case"c":t.bezierCurveTo(n+h[1],o+h[2],n+h[3],o+h[4],n+h[5],o+h[6]),n+=h[5],o+=h[6];break;case"S":n=h[3],o=h[4],t.bezierCurveToShort(h[1],h[2],n,o);break;case"s":t.bezierCurveToShort(n+h[1],o+h[2],n+h[3],o+h[4]),n+=h[3],o+=h[4];break;case"Q":n=h[3],o=h[4],t.quadraticCurveTo(h[1],h[2],n,o);break;case"q":t.quadraticCurveTo(n+h[1],o+h[2],n+h[3],o+h[4]),n+=h[3],o+=h[4];break;case"T":n=h[1],o=h[2],t.quadraticCurveToShort(n,o);break;case"t":n+=h[1],o+=h[2],t.quadraticCurveToShort(n,o);break;case"A":n=h[6],o=h[7],t.arcToSvg(h[1],h[2],h[3],h[4],h[5],n,o);break;case"a":n+=h[6],o+=h[7],t.arcToSvg(h[1],h[2],h[3],h[4],h[5],n,o);break;case"Z":case"z":t.closePath(),s.length>0&&(i=s.pop(),i?(n=i.startX,o=i.startY):(n=0,o=0)),i=null;break;default:Yt(`Unknown SVG path command: ${u}`)}u!=="Z"&&u!=="z"&&i===null&&(i={startX:n,startY:o},s.push(i))}return t}class Er{constructor(t=0,e=0,s=0){this.type="circle",this.x=t,this.y=e,this.radius=s}clone(){return new Er(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const s=this.radius*this.radius;let i=this.x-t,n=this.y-e;return i*=i,n*=n,i+n<=s}strokeContains(t,e,s){if(this.radius===0)return!1;const i=this.x-t,n=this.y-e,o=this.radius,a=s/2,l=Math.sqrt(i*i+n*n);return l<o+a&&l>o-a}getBounds(t){return t||(t=new Ct),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}]`}}class Dr{constructor(t=0,e=0,s=0,i=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=s,this.halfHeight=i}clone(){return new Dr(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let s=(t-this.x)/this.halfWidth,i=(e-this.y)/this.halfHeight;return s*=s,i*=i,s+i<=1}strokeContains(t,e,s){const{halfWidth:i,halfHeight:n}=this;if(i<=0||n<=0)return!1;const o=s/2,a=i-o,l=n-o,u=i+o,h=n+o,c=t-this.x,g=e-this.y,d=c*c/(a*a)+g*g/(l*l),m=c*c/(u*u)+g*g/(h*h);return d>1&&m<=1}getBounds(t){return t||(t=new Ct),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 bh(r,t,e,s,i,n){const o=r-e,a=t-s,l=i-e,u=n-s,h=o*l+a*u,c=l*l+u*u;let g=-1;c!==0&&(g=h/c);let d,m;g<0?(d=e,m=s):g>1?(d=i,m=n):(d=e+g*l,m=s+g*u);const _=r-d,p=t-m;return _*_+p*p}class ze{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){const s=[];for(let i=0,n=e.length;i<n;i++)s.push(e[i].x,e[i].y);e=s}this.points=e,this.closePath=!0}clone(){const t=this.points.slice(),e=new ze(t);return e.closePath=this.closePath,e}contains(t,e){let s=!1;const i=this.points.length/2;for(let n=0,o=i-1;n<i;o=n++){const a=this.points[n*2],l=this.points[n*2+1],u=this.points[o*2],h=this.points[o*2+1];l>e!=h>e&&t<(u-a)*((e-l)/(h-l))+a&&(s=!s)}return s}strokeContains(t,e,s){const i=s/2,n=i*i,{points:o}=this,a=o.length-(this.closePath?0:2);for(let l=0;l<a;l+=2){const u=o[l],h=o[l+1],c=o[(l+2)%o.length],g=o[(l+3)%o.length];if(bh(t,e,u,h,c,g)<=n)return!0}return!1}getBounds(t){t||(t=new Ct);const e=this.points;let s=1/0,i=-1/0,n=1/0,o=-1/0;for(let a=0,l=e.length;a<l;a+=2){const u=e[a],h=e[a+1];s=u<s?u:s,i=u>i?u:i,n=h<n?h:n,o=h>o?h:o}return t.x=s,t.width=i-s,t.y=n,t.height=o-n,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,e)=>`${t}, ${e}`,"")}]`}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]}}const cs=(r,t,e,s,i,n)=>{const o=r-e,a=t-s,l=Math.sqrt(o*o+a*a);return l>=i-n&&l<=i+n};class Rr{constructor(t=0,e=0,s=0,i=0,n=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=s,this.height=i,this.radius=n}getBounds(t){return t||(t=new Ct),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new Rr(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,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){const s=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+s&&e<=this.y+this.height-s||t>=this.x+s&&t<=this.x+this.width-s)return!0;let i=t-(this.x+s),n=e-(this.y+s);const o=s*s;if(i*i+n*n<=o||(i=t-(this.x+this.width-s),i*i+n*n<=o)||(n=e-(this.y+this.height-s),i*i+n*n<=o)||(i=t-(this.x+s),i*i+n*n<=o))return!0}return!1}strokeContains(t,e,s){const{x:i,y:n,width:o,height:a,radius:l}=this,u=s/2,h=i+l,c=n+l,g=o-l*2,d=a-l*2,m=i+o,_=n+a;return(t>=i-u&&t<=i+u||t>=m-u&&t<=m+u)&&e>=c&&e<=c+d||(e>=n-u&&e<=n+u||e>=_-u&&e<=_+u)&&t>=h&&t<=h+g?!0:t<h&&e<c&&cs(t,e,h,c,l,u)||t>m-l&&e<c&&cs(t,e,m-l,c,l,u)||t>m-l&&e>_-l&&cs(t,e,m-l,_-l,l,u)||t<h&&e>_-l&&cs(t,e,h,_-l,l,u)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}const vh=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
`);function wh(r){let t="";for(let e=0;e<r;++e)e>0&&(t+=`
|
|
else `),e<r-1&&(t+=`if(test == ${e}.0){}`);return t}function Ch(r,t){if(r===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const e=t.createShader(t.FRAGMENT_SHADER);try{for(;;){const s=vh.replace(/%forloop%/gi,wh(r));if(t.shaderSource(e,s),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))r=r/2|0;else break}}finally{t.deleteShader(e)}return r}let be=null;so=function(){if(be)return be;const r=On();return be=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),be=Ch(be,r),r.getExtension("WEBGL_lose_context")?.loseContext(),be};const ro={};Ah=function(r,t){let e=2166136261;for(let s=0;s<t;s++)e^=r[s].uid,e=Math.imul(e,16777619),e>>>=0;return ro[e]||Sh(r,t,e)};let Zs=0;function Sh(r,t,e){const s={};let i=0;Zs||(Zs=so());for(let o=0;o<Zs;o++){const a=o<t?r[o]:ut.EMPTY.source;s[i++]=a.source,s[i++]=a.style}const n=new ps(s);return ro[e]=n,n}wi=class{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData),this.size=this.rawBinaryData.byteLength}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}get float64View(){return this._float64Array||(this._float64Array=new Float64Array(this.rawBinaryData)),this._float64Array}get bigUint64View(){return this._bigUint64Array||(this._bigUint64Array=new BigUint64Array(this.rawBinaryData)),this._bigUint64Array}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this.uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}};Ci=function(r,t){const e=r.byteLength/8|0,s=new Float64Array(r,0,e);new Float64Array(t,0,e).set(s);const n=r.byteLength-e*8;if(n>0){const o=new Uint8Array(r,e*8,n);new Uint8Array(t,e*8,n).set(o)}};const Th={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};kh=(r=>(r[r.DISABLED=0]="DISABLED",r[r.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",r[r.MASK_ACTIVE=2]="MASK_ACTIVE",r[r.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",r[r.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",r[r.NONE=5]="NONE",r))(kh||{});Ai=function(r,t){return t.alphaMode==="no-premultiply-alpha"&&Th[r]||r};class Ph{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let t=0;t<this.count;t++){const e=this.textures[t];this.textures[t]=null,this.ids[e.uid]=null}this.count=0}}class Mh{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new Ph,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null}}const io=[];let xr=0;function Si(){return xr>0?io[--xr]:new Mh}function Ti(r){io[xr++]=r}let Re=0;const no=class ms{constructor(t={}){this.uid=_t("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],ms.defaultOptions.maxTextures=ms.defaultOptions.maxTextures??so(),t={...ms.defaultOptions,...t};const{maxTextures:e,attributesInitialSize:s,indicesInitialSize:i}=t;this.attributeBuffer=new wi(s*4),this.indexBuffer=new Uint16Array(i),this.maxTextures=e}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;t<this.batchIndex;t++)Ti(this.batches[t]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=!0}add(t){this._elements[this.elementSize++]=t,t._indexStart=this.indexSize,t._attributeStart=this.attributeSize,t._batcher=this,this.indexSize+=t.indexSize,this.attributeSize+=t.attributeSize*this.vertexSize}checkAndUpdateTexture(t,e){const s=t._batch.textures.ids[e._source.uid];return!s&&s!==0?!1:(t._textureId=s,t.texture=e,!0)}updateElement(t){this.dirty=!0;const e=this.attributeBuffer;t.packAsQuad?this.packQuadAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId):this.packAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId)}break(t){const e=this._elements;if(!e[this.elementStart])return;let s=Si(),i=s.textures;i.clear();const n=e[this.elementStart];let o=Ai(n.blendMode,n.texture._source),a=n.topology;this.attributeSize*4>this.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);const l=this.attributeBuffer.float32View,u=this.attributeBuffer.uint32View,h=this.indexBuffer;let c=this._batchIndexSize,g=this._batchIndexStart,d="startBatch";const m=this.maxTextures;for(let _=this.elementStart;_<this.elementSize;++_){const p=e[_];e[_]=null;const C=p.texture._source,T=Ai(p.blendMode,C),F=o!==T||a!==p.topology;if(C._batchTick===Re&&!F){p._textureId=C._textureBindLocation,c+=p.indexSize,p.packAsQuad?(this.packQuadAttributes(p,l,u,p._attributeStart,p._textureId),this.packQuadIndex(h,p._indexStart,p._attributeStart/this.vertexSize)):(this.packAttributes(p,l,u,p._attributeStart,p._textureId),this.packIndex(p,h,p._indexStart,p._attributeStart/this.vertexSize)),p._batch=s;continue}C._batchTick=Re,(i.count>=m||F)&&(this._finishBatch(s,g,c-g,i,o,a,t,d),d="renderBatch",g=c,o=T,a=p.topology,s=Si(),i=s.textures,i.clear(),++Re),p._textureId=C._textureBindLocation=i.count,i.ids[C.uid]=i.count,i.textures[i.count++]=C,p._batch=s,c+=p.indexSize,p.packAsQuad?(this.packQuadAttributes(p,l,u,p._attributeStart,p._textureId),this.packQuadIndex(h,p._indexStart,p._attributeStart/this.vertexSize)):(this.packAttributes(p,l,u,p._attributeStart,p._textureId),this.packIndex(p,h,p._indexStart,p._attributeStart/this.vertexSize))}i.count>0&&(this._finishBatch(s,g,c-g,i,o,a,t,d),g=c,++Re),this.elementStart=this.elementSize,this._batchIndexStart=g,this._batchIndexSize=c}_finishBatch(t,e,s,i,n,o,a,l){t.gpuBindGroup=null,t.bindGroup=null,t.action=l,t.batcher=this,t.textures=i,t.blendMode=n,t.topology=o,t.start=e,t.size=s,++Re,this.batches[this.batchIndex++]=t,a.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){const e=Math.max(t,this.attributeBuffer.size*2),s=new wi(e);Ci(this.attributeBuffer.rawBinaryData,s.rawBinaryData),this.attributeBuffer=s}_resizeIndexBuffer(t){const e=this.indexBuffer;let s=Math.max(t,e.length*1.5);s+=s%2;const i=s>65535?new Uint32Array(s):new Uint16Array(s);if(i.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let n=0;n<e.length;n++)i[n]=e[n];else Ci(e.buffer,i.buffer);this.indexBuffer=i}packQuadIndex(t,e,s){t[e]=s+0,t[e+1]=s+1,t[e+2]=s+2,t[e+3]=s+0,t[e+4]=s+2,t[e+5]=s+3}packIndex(t,e,s,i){const n=t.indices,o=t.indexSize,a=t.indexOffset,l=t.attributeOffset;for(let u=0;u<o;u++)e[s++]=i+n[u+a]-l}destroy(){for(let t=0;t<this.batches.length;t++)Ti(this.batches[t]);this.batches=null;for(let t=0;t<this._elements.length;t++)this._elements[t]._batch=null;this._elements=null,this.indexBuffer=null,this.attributeBuffer.destroy(),this.attributeBuffer=null}};no.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};let Ih=no;Mt=(r=>(r[r.MAP_READ=1]="MAP_READ",r[r.MAP_WRITE=2]="MAP_WRITE",r[r.COPY_SRC=4]="COPY_SRC",r[r.COPY_DST=8]="COPY_DST",r[r.INDEX=16]="INDEX",r[r.VERTEX=32]="VERTEX",r[r.UNIFORM=64]="UNIFORM",r[r.STORAGE=128]="STORAGE",r[r.INDIRECT=256]="INDIRECT",r[r.QUERY_RESOLVE=512]="QUERY_RESOLVE",r[r.STATIC=1024]="STATIC",r))(Mt||{});Ze=class extends re{constructor(t){let{data:e,size:s}=t;const{usage:i,label:n,shrinkToFit:o}=t;super(),this.uid=_t("buffer"),this._resourceType="buffer",this._resourceId=_t("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=!0,this.destroyed=!1,e instanceof Array&&(e=new Float32Array(e)),this._data=e,s??(s=e?.byteLength);const a=!!e;this.descriptor={size:s,usage:i,mappedAtCreation:a,label:n},this.shrinkToFit=o??!0}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,!0)}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return!!(this.descriptor.usage&Mt.STATIC)}set static(t){t?this.descriptor.usage|=Mt.STATIC:this.descriptor.usage&=~Mt.STATIC}setDataWithSize(t,e,s){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){s&&this.emit("update",this);return}const i=this._data;if(this._data=t,this._dataInt32=null,!i||i.length!==t.length){!this.shrinkToFit&&i&&t.byteLength<i.byteLength?s&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=_t("resource"),this.emit("change",this));return}s&&this.emit("update",this)}update(t){this._updateSize=t??this._updateSize,this._updateID++,this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners()}};function oo(r,t){if(!(r instanceof Ze)){let e=t?Mt.INDEX:Mt.VERTEX;r instanceof Array&&(t?(r=new Uint32Array(r),e=Mt.INDEX|Mt.COPY_DST):(r=new Float32Array(r),e=Mt.VERTEX|Mt.COPY_DST)),r=new Ze({data:r,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e})}return r}function Eh(r,t,e){const s=r.getAttribute(t);if(!s)return e.minX=0,e.minY=0,e.maxX=0,e.maxY=0,e;const i=s.buffer.data;let n=1/0,o=1/0,a=-1/0,l=-1/0;const u=i.BYTES_PER_ELEMENT,h=(s.offset||0)/u,c=(s.stride||2*4)/u;for(let g=h;g<i.length;g+=c){const d=i[g],m=i[g+1];d>a&&(a=d),m>l&&(l=m),d<n&&(n=d),m<o&&(o=m)}return e.minX=n,e.minY=o,e.maxX=a,e.maxY=l,e}function Dh(r){return(r instanceof Ze||Array.isArray(r)||r.BYTES_PER_ELEMENT)&&(r={buffer:r}),r.buffer=oo(r.buffer,!1),r}Rh=class extends re{constructor(t={}){super(),this.uid=_t("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new Xt,this._boundsDirty=!0;const{attributes:e,indexBuffer:s,topology:i}=t;if(this.buffers=[],this.attributes={},e)for(const n in e)this.addAttribute(n,e[n]);this.instanceCount=t.instanceCount??1,s&&this.addIndex(s),this.topology=i||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this.emit("update",this)}getAttribute(t){return this.attributes[t]}getIndex(){return this.indexBuffer}getBuffer(t){return this.getAttribute(t).buffer}getSize(){for(const t in this.attributes){const e=this.attributes[t];return e.buffer.data.length/(e.stride/4||e.size)}return 0}addAttribute(t,e){const s=Dh(e);this.buffers.indexOf(s.buffer)===-1&&(this.buffers.push(s.buffer),s.buffer.on("update",this.onBufferUpdate,this),s.buffer.on("change",this.onBufferUpdate,this)),this.attributes[t]=s}addIndex(t){this.indexBuffer=oo(t,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,Eh(this,"aPosition",this._bounds)):this._bounds}destroy(t=!1){this.emit("destroy",this),this.removeAllListeners(),t&&this.buffers.forEach(e=>e.destroy()),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}};const Fh=new Float32Array(1),Bh=new Uint32Array(1);class $h extends Rh{constructor(){const e=new Ze({data:Fh,label:"attribute-batch-buffer",usage:Mt.VERTEX|Mt.COPY_DST,shrinkToFit:!1}),s=new Ze({data:Bh,label:"index-batch-buffer",usage:Mt.INDEX|Mt.COPY_DST,shrinkToFit:!1}),i=6*4;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:i,offset:0},aUV:{buffer:e,format:"float32x2",stride:i,offset:2*4},aColor:{buffer:e,format:"unorm8x4",stride:i,offset:4*4},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:i,offset:5*4}},indexBuffer:s})}}function ki(r,t,e){if(r)for(const s in r){const i=s.toLocaleLowerCase(),n=t[i];if(n){let o=r[s];s==="header"&&(o=o.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),e&&n.push(`//----${e}----//`),n.push(o)}else Yt(`${s} placement hook does not exist in shader`)}}const Gh=/\{\{(.*?)\}\}/g;function Pi(r){const t={};return(r.match(Gh)?.map(s=>s.replace(/[{()}]/g,""))??[]).forEach(s=>{t[s]=[]}),t}function Mi(r,t){let e;const s=/@in\s+([^;]+);/g;for(;(e=s.exec(r))!==null;)t.push(e[1])}function Ii(r,t,e=!1){const s=[];Mi(t,s),r.forEach(a=>{a.header&&Mi(a.header,s)});const i=s;e&&i.sort();const n=i.map((a,l)=>` @location(${l}) ${a},`).join(`
|
|
`);let o=t.replace(/@in\s+[^;]+;\s*/g,"");return o=o.replace("{{in}}",`
|
|
${n}
|
|
`),o}function Ei(r,t){let e;const s=/@out\s+([^;]+);/g;for(;(e=s.exec(r))!==null;)t.push(e[1])}function Nh(r){const e=/\b(\w+)\s*:/g.exec(r);return e?e[1]:""}function Vh(r){const t=/@.*?\s+/g;return r.replace(t,"")}function Oh(r,t){const e=[];Ei(t,e),r.forEach(l=>{l.header&&Ei(l.header,e)});let s=0;const i=e.sort().map(l=>l.indexOf("builtin")>-1?l:`@location(${s++}) ${l}`).join(`,
|
|
`),n=e.sort().map(l=>` var ${Vh(l)};`).join(`
|
|
`),o=`return VSOutput(
|
|
${e.sort().map(l=>` ${Nh(l)}`).join(`,
|
|
`)});`;let a=t.replace(/@out\s+[^;]+;\s*/g,"");return a=a.replace("{{struct}}",`
|
|
${i}
|
|
`),a=a.replace("{{start}}",`
|
|
${n}
|
|
`),a=a.replace("{{return}}",`
|
|
${o}
|
|
`),a}function Di(r,t){let e=r;for(const s in t){const i=t[s];i.join(`
|
|
`).length?e=e.replace(`{{${s}}}`,`//-----${s} START-----//
|
|
${i.join(`
|
|
`)}
|
|
//----${s} FINISH----//`):e=e.replace(`{{${s}}}`,"")}return e}const ie=Object.create(null),Qs=new Map;let zh=0;function Lh({template:r,bits:t}){const e=ao(r,t);if(ie[e])return ie[e];const{vertex:s,fragment:i}=Hh(r,t);return ie[e]=lo(s,i,t),ie[e]}function Uh({template:r,bits:t}){const e=ao(r,t);return ie[e]||(ie[e]=lo(r.vertex,r.fragment,t)),ie[e]}function Hh(r,t){const e=t.map(o=>o.vertex).filter(o=>!!o),s=t.map(o=>o.fragment).filter(o=>!!o);let i=Ii(e,r.vertex,!0);i=Oh(e,i);const n=Ii(s,r.fragment,!0);return{vertex:i,fragment:n}}function ao(r,t){return t.map(e=>(Qs.has(e)||Qs.set(e,zh++),Qs.get(e))).sort((e,s)=>e-s).join("-")+r.vertex+r.fragment}function lo(r,t,e){const s=Pi(r),i=Pi(t);return e.forEach(n=>{ki(n.vertex,s,n.name),ki(n.fragment,i,n.name)}),{vertex:Di(r,s),fragment:Di(t,i)}}const Yh=`
|
|
@in aPosition: vec2<f32>;
|
|
@in aUV: vec2<f32>;
|
|
|
|
@out @builtin(position) vPosition: vec4<f32>;
|
|
@out vUV : vec2<f32>;
|
|
@out vColor : vec4<f32>;
|
|
|
|
{{header}}
|
|
|
|
struct VSOutput {
|
|
{{struct}}
|
|
};
|
|
|
|
@vertex
|
|
fn main( {{in}} ) -> VSOutput {
|
|
|
|
var worldTransformMatrix = globalUniforms.uWorldTransformMatrix;
|
|
var modelMatrix = mat3x3<f32>(
|
|
1.0, 0.0, 0.0,
|
|
0.0, 1.0, 0.0,
|
|
0.0, 0.0, 1.0
|
|
);
|
|
var position = aPosition;
|
|
var uv = aUV;
|
|
|
|
{{start}}
|
|
|
|
vColor = vec4<f32>(1., 1., 1., 1.);
|
|
|
|
{{main}}
|
|
|
|
vUV = uv;
|
|
|
|
var modelViewProjectionMatrix = globalUniforms.uProjectionMatrix * worldTransformMatrix * modelMatrix;
|
|
|
|
vPosition = vec4<f32>((modelViewProjectionMatrix * vec3<f32>(position, 1.0)).xy, 0.0, 1.0);
|
|
|
|
vColor *= globalUniforms.uWorldColorAlpha;
|
|
|
|
{{end}}
|
|
|
|
{{return}}
|
|
};
|
|
`,Xh=`
|
|
@in vUV : vec2<f32>;
|
|
@in vColor : vec4<f32>;
|
|
|
|
{{header}}
|
|
|
|
@fragment
|
|
fn main(
|
|
{{in}}
|
|
) -> @location(0) vec4<f32> {
|
|
|
|
{{start}}
|
|
|
|
var outColor:vec4<f32>;
|
|
|
|
{{main}}
|
|
|
|
var finalColor:vec4<f32> = outColor * vColor;
|
|
|
|
{{end}}
|
|
|
|
return finalColor;
|
|
};
|
|
`,Wh=`
|
|
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}}
|
|
}
|
|
`,jh=`
|
|
|
|
in vec4 vColor;
|
|
in vec2 vUV;
|
|
|
|
out vec4 finalColor;
|
|
|
|
{{header}}
|
|
|
|
void main(void) {
|
|
|
|
{{start}}
|
|
|
|
vec4 outColor;
|
|
|
|
{{main}}
|
|
|
|
finalColor = outColor * vColor;
|
|
|
|
{{end}}
|
|
}
|
|
`,qh={name:"global-uniforms-bit",vertex:{header:`
|
|
struct GlobalUniforms {
|
|
uProjectionMatrix:mat3x3<f32>,
|
|
uWorldTransformMatrix:mat3x3<f32>,
|
|
uWorldColorAlpha: vec4<f32>,
|
|
uResolution: vec2<f32>,
|
|
}
|
|
|
|
@group(0) @binding(0) var<uniform> globalUniforms : GlobalUniforms;
|
|
`}},Kh={name:"global-uniforms-bit",vertex:{header:`
|
|
uniform mat3 uProjectionMatrix;
|
|
uniform mat3 uWorldTransformMatrix;
|
|
uniform vec4 uWorldColorAlpha;
|
|
uniform vec2 uResolution;
|
|
`}};Zh=function({bits:r,name:t}){const e=Lh({template:{fragment:Xh,vertex:Yh},bits:[qh,...r]});return Ps.from({name:t,vertex:{source:e.vertex,entryPoint:"main"},fragment:{source:e.fragment,entryPoint:"main"}})};Qh=function({bits:r,name:t}){return new Ln({name:t,...Uh({template:{vertex:Wh,fragment:jh},bits:[Kh,...r]})})};let Js;Jh={name:"color-bit",vertex:{header:`
|
|
@in aColor: vec4<f32>;
|
|
`,main:`
|
|
vColor *= vec4<f32>(aColor.rgb * aColor.a, aColor.a);
|
|
`}};tu={name:"color-bit",vertex:{header:`
|
|
in vec4 aColor;
|
|
`,main:`
|
|
vColor *= vec4(aColor.rgb * aColor.a, aColor.a);
|
|
`}};Js={};function eu(r){const t=[];if(r===1)t.push("@group(1) @binding(0) var textureSource1: texture_2d<f32>;"),t.push("@group(1) @binding(1) var textureSampler1: sampler;");else{let e=0;for(let s=0;s<r;s++)t.push(`@group(1) @binding(${e++}) var textureSource${s+1}: texture_2d<f32>;`),t.push(`@group(1) @binding(${e++}) var textureSampler${s+1}: sampler;`)}return t.join(`
|
|
`)}function su(r){const t=[];if(r===1)t.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{t.push("switch vTextureId {");for(let e=0;e<r;e++)e===r-1?t.push(" default:{"):t.push(` case ${e}:{`),t.push(` outColor = textureSampleGrad(textureSource${e+1}, textureSampler${e+1}, vUV, uvDx, uvDy);`),t.push(" break;}");t.push("}")}return t.join(`
|
|
`)}ru=function(r){return Js[r]||(Js[r]={name:"texture-batch-bit",vertex:{header:`
|
|
@in aTextureIdAndRound: vec2<u32>;
|
|
@out @interpolate(flat) vTextureId : u32;
|
|
`,main:`
|
|
vTextureId = aTextureIdAndRound.y;
|
|
`,end:`
|
|
if(aTextureIdAndRound.x == 1)
|
|
{
|
|
vPosition = vec4<f32>(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
|
|
}
|
|
`},fragment:{header:`
|
|
@in @interpolate(flat) vTextureId: u32;
|
|
|
|
${eu(r)}
|
|
`,main:`
|
|
var uvDx = dpdx(vUV);
|
|
var uvDy = dpdy(vUV);
|
|
|
|
${su(r)}
|
|
`}}),Js[r]};const tr={};function iu(r){const t=[];for(let e=0;e<r;e++)e>0&&t.push("else"),e<r-1&&t.push(`if(vTextureId < ${e}.5)`),t.push("{"),t.push(` outColor = texture(uTextures[${e}], vUV);`),t.push("}");return t.join(`
|
|
`)}nu=function(r){return tr[r]||(tr[r]={name:"texture-batch-bit",vertex:{header:`
|
|
in vec2 aTextureIdAndRound;
|
|
out float vTextureId;
|
|
|
|
`,main:`
|
|
vTextureId = aTextureIdAndRound.y;
|
|
`,end:`
|
|
if(aTextureIdAndRound.x == 1.)
|
|
{
|
|
gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
|
|
}
|
|
`},fragment:{header:`
|
|
in float vTextureId;
|
|
|
|
uniform sampler2D uTextures[${r}];
|
|
|
|
`,main:`
|
|
|
|
${iu(r)}
|
|
`}}),tr[r]};let Ri;ou={name:"round-pixels-bit",vertex:{header:`
|
|
fn roundPixels(position: vec2<f32>, targetSize: vec2<f32>) -> vec2<f32>
|
|
{
|
|
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
|
|
}
|
|
`}};au={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;
|
|
}
|
|
`}};Ri={};lu=function(r){let t=Ri[r];if(t)return t;const e=new Int32Array(r);for(let s=0;s<r;s++)e[s]=s;return t=Ri[r]=new Xn({uTextures:{value:e,type:"i32",size:r}},{isStatic:!0}),t};class hu extends Ir{constructor(t){const e=Qh({name:"batch",bits:[tu,nu(t),au]}),s=Zh({name:"batch",bits:[Jh,ru(t),ou]});super({glProgram:e,gpuProgram:s,resources:{batchSamplers:lu(t)}})}}let Fi=null;const ho=class uo extends Ih{constructor(){super(...arguments),this.geometry=new $h,this.shader=Fi||(Fi=new hu(this.maxTextures)),this.name=uo.extension.name,this.vertexSize=6}packAttributes(t,e,s,i,n){const o=n<<16|t.roundPixels&65535,a=t.transform,l=a.a,u=a.b,h=a.c,c=a.d,g=a.tx,d=a.ty,{positions:m,uvs:_}=t,p=t.color,b=t.attributeOffset,C=b+t.attributeSize;for(let T=b;T<C;T++){const F=T*2,B=m[F],M=m[F+1];e[i++]=l*B+h*M+g,e[i++]=c*M+u*B+d,e[i++]=_[F],e[i++]=_[F+1],s[i++]=p,s[i++]=o}}packQuadAttributes(t,e,s,i,n){const o=t.texture,a=t.transform,l=a.a,u=a.b,h=a.c,c=a.d,g=a.tx,d=a.ty,m=t.bounds,_=m.maxX,p=m.minX,b=m.maxY,C=m.minY,T=o.uvs,F=t.color,B=n<<16|t.roundPixels&65535;e[i+0]=l*p+h*C+g,e[i+1]=c*C+u*p+d,e[i+2]=T.x0,e[i+3]=T.y0,s[i+4]=F,s[i+5]=B,e[i+6]=l*_+h*C+g,e[i+7]=c*C+u*_+d,e[i+8]=T.x1,e[i+9]=T.y1,s[i+10]=F,s[i+11]=B,e[i+12]=l*_+h*b+g,e[i+13]=c*b+u*_+d,e[i+14]=T.x2,e[i+15]=T.y2,s[i+16]=F,s[i+17]=B,e[i+18]=l*p+h*b+g,e[i+19]=c*b+u*p+d,e[i+20]=T.x3,e[i+21]=T.y3,s[i+22]=F,s[i+23]=B}};ho.extension={type:[lt.Batcher],name:"default"};uu=ho;function cu(r,t,e,s,i,n,o,a=null){let l=0;e*=t,i*=n;const u=a.a,h=a.b,c=a.c,g=a.d,d=a.tx,m=a.ty;for(;l<o;){const _=r[e],p=r[e+1];s[i]=u*_+c*p+d,s[i+1]=h*_+g*p+m,i+=n,e+=t,l++}}function du(r,t,e,s){let i=0;for(t*=e;i<s;)r[t]=0,r[t+1]=0,t+=e,i++}function co(r,t,e,s,i){const n=t.a,o=t.b,a=t.c,l=t.d,u=t.tx,h=t.ty;e||(e=0),s||(s=2),i||(i=r.length/s-e);let c=e*s;for(let g=0;g<i;g++){const d=r[c],m=r[c+1];r[c]=n*d+a*m+u,r[c+1]=o*d+l*m+h,c+=s}}const fu=new it;fo=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(){const t=this.baseColor,e=t>>16|t&65280|(t&255)<<16,s=this.renderable;return s?xn(e,s.groupColor)+(this.alpha*s.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||fu}copyTo(t){t.indexOffset=this.indexOffset,t.indexSize=this.indexSize,t.attributeOffset=this.attributeOffset,t.attributeSize=this.attributeSize,t.baseColor=this.baseColor,t.alpha=this.alpha,t.texture=this.texture,t.geometryData=this.geometryData,t.topology=this.topology}reset(){this.applyTransform=!0,this.renderable=null,this.topology="triangle-list"}};const Qe={extension:{type:lt.ShapeBuilder,name:"circle"},build(r,t){let e,s,i,n,o,a;if(r.type==="circle"){const F=r;e=F.x,s=F.y,o=a=F.radius,i=n=0}else if(r.type==="ellipse"){const F=r;e=F.x,s=F.y,o=F.halfWidth,a=F.halfHeight,i=n=0}else{const F=r,B=F.width/2,M=F.height/2;e=F.x+B,s=F.y+M,o=a=Math.max(0,Math.min(F.radius,Math.min(B,M))),i=B-o,n=M-a}if(!(o>=0&&a>=0&&i>=0&&n>=0))return t;const l=Math.ceil(2.3*Math.sqrt(o+a)),u=l*8+(i?4:0)+(n?4:0);if(u===0)return t;if(l===0)return t[0]=t[6]=e+i,t[1]=t[3]=s+n,t[2]=t[4]=e-i,t[5]=t[7]=s-n,t;let h=0,c=l*4+(i?2:0)+2,g=c,d=u,m=i+o,_=n,p=e+m,b=e-m,C=s+_;if(t[h++]=p,t[h++]=C,t[--c]=C,t[--c]=b,n){const F=s-_;t[g++]=b,t[g++]=F,t[--d]=F,t[--d]=p}for(let F=1;F<l;F++){const B=Math.PI/2*(F/l),M=i+Math.cos(B)*o,E=n+Math.sin(B)*a,O=e+M,L=e-M,R=s+E,A=s-E;t[h++]=O,t[h++]=R,t[--c]=R,t[--c]=L,t[g++]=L,t[g++]=A,t[--d]=A,t[--d]=O}m=i,_=n+a,p=e+m,b=e-m,C=s+_;const T=s-_;return t[h++]=p,t[h++]=C,t[--d]=T,t[--d]=p,i&&(t[h++]=b,t[h++]=C,t[--d]=T,t[--d]=b),t},triangulate(r,t,e,s,i,n){if(r.length===0)return;let o=0,a=0;for(let h=0;h<r.length;h+=2)o+=r[h],a+=r[h+1];o/=r.length/2,a/=r.length/2;let l=s;t[l*e]=o,t[l*e+1]=a;const u=l++;for(let h=0;h<r.length;h+=2)t[l*e]=r[h],t[l*e+1]=r[h+1],h>0&&(i[n++]=l,i[n++]=u,i[n++]=l-1),l++;i[n++]=u+1,i[n++]=u,i[n++]=l-1}},pu={...Qe,extension:{...Qe.extension,name:"ellipse"}},mu={...Qe,extension:{...Qe.extension,name:"roundedRectangle"}},po=1e-4,Bi=1e-4;function gu(r){const t=r.length;if(t<6)return 1;let e=0;for(let s=0,i=r[t-2],n=r[t-1];s<t;s+=2){const o=r[s],a=r[s+1];e+=(o-i)*(a+n),i=o,n=a}return e<0?-1:1}function $i(r,t,e,s,i,n,o,a){const l=r-e*i,u=t-s*i,h=r+e*n,c=t+s*n;let g,d;o?(g=s,d=-e):(g=-s,d=e);const m=l+g,_=u+d,p=h+g,b=c+d;return a.push(m,_),a.push(p,b),2}function ae(r,t,e,s,i,n,o,a){const l=e-r,u=s-t;let h=Math.atan2(l,u),c=Math.atan2(i-r,n-t);a&&h<c?h+=Math.PI*2:!a&&h>c&&(c+=Math.PI*2);let g=h;const d=c-h,m=Math.abs(d),_=Math.sqrt(l*l+u*u),p=(15*m*Math.sqrt(_)/Math.PI>>0)+1,b=d/p;if(g+=b,a){o.push(r,t),o.push(e,s);for(let C=1,T=g;C<p;C++,T+=b)o.push(r,t),o.push(r+Math.sin(T)*_,t+Math.cos(T)*_);o.push(r,t),o.push(i,n)}else{o.push(e,s),o.push(r,t);for(let C=1,T=g;C<p;C++,T+=b)o.push(r+Math.sin(T)*_,t+Math.cos(T)*_),o.push(r,t);o.push(i,n),o.push(r,t)}return p*2}function _u(r,t,e,s,i,n){const o=po;if(r.length===0)return;const a=t;let l=a.alignment;if(t.alignment!==.5){let P=gu(r);l=(l-.5)*P+.5}const u=new St(r[0],r[1]),h=new St(r[r.length-2],r[r.length-1]),c=s,g=Math.abs(u.x-h.x)<o&&Math.abs(u.y-h.y)<o;if(c){r=r.slice(),g&&(r.pop(),r.pop(),h.set(r[r.length-2],r[r.length-1]));const P=(u.x+h.x)*.5,S=(h.y+u.y)*.5;r.unshift(P,S),r.push(P,S)}const d=i,m=r.length/2;let _=r.length;const p=d.length/2,b=a.width/2,C=b*b,T=a.miterLimit*a.miterLimit;let F=r[0],B=r[1],M=r[2],E=r[3],O=0,L=0,R=-(B-E),A=F-M,$=0,U=0,X=Math.sqrt(R*R+A*A);R/=X,A/=X,R*=b,A*=b;const tt=l,f=(1-tt)*2,y=tt*2;c||(a.cap==="round"?_+=ae(F-R*(f-y)*.5,B-A*(f-y)*.5,F-R*f,B-A*f,F+R*y,B+A*y,d,!0)+2:a.cap==="square"&&(_+=$i(F,B,R,A,f,y,!0,d))),d.push(F-R*f,B-A*f),d.push(F+R*y,B+A*y);for(let P=1;P<m-1;++P){F=r[(P-1)*2],B=r[(P-1)*2+1],M=r[P*2],E=r[P*2+1],O=r[(P+1)*2],L=r[(P+1)*2+1],R=-(B-E),A=F-M,X=Math.sqrt(R*R+A*A),R/=X,A/=X,R*=b,A*=b,$=-(E-L),U=M-O,X=Math.sqrt($*$+U*U),$/=X,U/=X,$*=b,U*=b;const S=M-F,k=B-E,I=M-O,V=L-E,z=S*I+k*V,H=k*I-V*S,nt=H<0;if(Math.abs(H)<.001*Math.abs(z)){d.push(M-R*f,E-A*f),d.push(M+R*y,E+A*y),z>=0&&(a.join==="round"?_+=ae(M,E,M-R*f,E-A*f,M-$*f,E-U*f,d,!1)+4:_+=2,d.push(M-$*y,E-U*y),d.push(M+$*f,E+U*f));continue}const ot=(-R+F)*(-A+E)-(-R+M)*(-A+B),Q=(-$+O)*(-U+E)-(-$+M)*(-U+L),mt=(S*Q-I*ot)/H,et=(V*ot-k*Q)/H,Kt=(mt-M)*(mt-M)+(et-E)*(et-E),It=M+(mt-M)*f,Ot=E+(et-E)*f,zt=M-(mt-M)*y,K=E-(et-E)*y,J=Math.min(S*S+k*k,I*I+V*V),$r=nt?f:y,bo=J+$r*$r*C;Kt<=bo?a.join==="bevel"||Kt/C>T?(nt?(d.push(It,Ot),d.push(M+R*y,E+A*y),d.push(It,Ot),d.push(M+$*y,E+U*y)):(d.push(M-R*f,E-A*f),d.push(zt,K),d.push(M-$*f,E-U*f),d.push(zt,K)),_+=2):a.join==="round"?nt?(d.push(It,Ot),d.push(M+R*y,E+A*y),_+=ae(M,E,M+R*y,E+A*y,M+$*y,E+U*y,d,!0)+4,d.push(It,Ot),d.push(M+$*y,E+U*y)):(d.push(M-R*f,E-A*f),d.push(zt,K),_+=ae(M,E,M-R*f,E-A*f,M-$*f,E-U*f,d,!1)+4,d.push(M-$*f,E-U*f),d.push(zt,K)):(d.push(It,Ot),d.push(zt,K)):(d.push(M-R*f,E-A*f),d.push(M+R*y,E+A*y),a.join==="round"?nt?_+=ae(M,E,M+R*y,E+A*y,M+$*y,E+U*y,d,!0)+2:_+=ae(M,E,M-R*f,E-A*f,M-$*f,E-U*f,d,!1)+2:a.join==="miter"&&Kt/C<=T&&(nt?(d.push(zt,K),d.push(zt,K)):(d.push(It,Ot),d.push(It,Ot)),_+=2),d.push(M-$*f,E-U*f),d.push(M+$*y,E+U*y),_+=2)}F=r[(m-2)*2],B=r[(m-2)*2+1],M=r[(m-1)*2],E=r[(m-1)*2+1],R=-(B-E),A=F-M,X=Math.sqrt(R*R+A*A),R/=X,A/=X,R*=b,A*=b,d.push(M-R*f,E-A*f),d.push(M+R*y,E+A*y),c||(a.cap==="round"?_+=ae(M-R*(f-y)*.5,E-A*(f-y)*.5,M-R*f,E-A*f,M+R*y,E+A*y,d,!1)+2:a.cap==="square"&&(_+=$i(M,E,R,A,f,y,!1,d)));const w=Bi*Bi;for(let P=p;P<_+p-2;++P)F=d[P*2],B=d[P*2+1],M=d[(P+1)*2],E=d[(P+1)*2+1],O=d[(P+2)*2],L=d[(P+2)*2+1],!(Math.abs(F*(E-L)+M*(L-B)+O*(B-E))<w)&&n.push(P,P+1,P+2)}function yu(r,t,e,s){const i=po;if(r.length===0)return;const n=r[0],o=r[1],a=r[r.length-2],l=r[r.length-1],u=t||Math.abs(n-a)<i&&Math.abs(o-l)<i,h=e,c=r.length/2,g=h.length/2;for(let d=0;d<c;d++)h.push(r[d*2]),h.push(r[d*2+1]);for(let d=0;d<c-1;d++)s.push(g+d,g+d+1);u&&s.push(g+c-1,g)}function mo(r,t,e,s,i,n,o){const a=ah(r,t,2);if(!a)return;for(let u=0;u<a.length;u+=3)n[o++]=a[u]+i,n[o++]=a[u+1]+i,n[o++]=a[u+2]+i;let l=i*s;for(let u=0;u<r.length;u+=2)e[l]=r[u],e[l+1]=r[u+1],l+=s}const xu=[],bu={extension:{type:lt.ShapeBuilder,name:"polygon"},build(r,t){for(let e=0;e<r.points.length;e++)t[e]=r.points[e];return t},triangulate(r,t,e,s,i,n){mo(r,xu,t,e,s,i,n)}},vu={extension:{type:lt.ShapeBuilder,name:"rectangle"},build(r,t){const e=r,s=e.x,i=e.y,n=e.width,o=e.height;return n>=0&&o>=0&&(t[0]=s,t[1]=i,t[2]=s+n,t[3]=i,t[4]=s+n,t[5]=i+o,t[6]=s,t[7]=i+o),t},triangulate(r,t,e,s,i,n){let o=0;s*=e,t[s+o]=r[0],t[s+o+1]=r[1],o+=e,t[s+o]=r[2],t[s+o+1]=r[3],o+=e,t[s+o]=r[6],t[s+o+1]=r[7],o+=e,t[s+o]=r[4],t[s+o+1]=r[5],o+=e;const a=s/e;i[n++]=a,i[n++]=a+1,i[n++]=a+2,i[n++]=a+1,i[n++]=a+3,i[n++]=a+2}},wu={extension:{type:lt.ShapeBuilder,name:"triangle"},build(r,t){return t[0]=r.x,t[1]=r.y,t[2]=r.x2,t[3]=r.y2,t[4]=r.x3,t[5]=r.y3,t},triangulate(r,t,e,s,i,n){let o=0;s*=e,t[s+o]=r[0],t[s+o+1]=r[1],o+=e,t[s+o]=r[2],t[s+o+1]=r[3],o+=e,t[s+o]=r[4],t[s+o+1]=r[5];const a=s/e;i[n++]=a,i[n++]=a+1,i[n++]=a+2}},Ms={};jt.handleByMap(lt.ShapeBuilder,Ms);jt.add(vu,bu,wu,Qe,pu,mu);const Cu=new Ct;function Au(r,t){const{geometryData:e,batches:s}=t;s.length=0,e.indices.length=0,e.vertices.length=0,e.uvs.length=0;for(let i=0;i<r.instructions.length;i++){const n=r.instructions[i];if(n.action==="texture")Su(n.data,s,e);else if(n.action==="fill"||n.action==="stroke"){const o=n.action==="stroke",a=n.data.path.shapePath,l=n.data.style,u=n.data.hole;o&&u&&Gi(u.shapePath,l,null,!0,s,e),Gi(a,l,u,o,s,e)}}}function Su(r,t,e){const{vertices:s,uvs:i,indices:n}=e,o=n.length,a=s.length/2,l=[],u=Ms.rectangle,h=Cu,c=r.image;h.x=r.dx,h.y=r.dy,h.width=r.dw,h.height=r.dh;const g=r.transform;u.build(h,l),g&&co(l,g),u.triangulate(l,s,2,a,n,o);const d=c.uvs;i.push(d.x0,d.y0,d.x1,d.y1,d.x3,d.y3,d.x2,d.y2);const m=te.get(fo);m.indexOffset=o,m.indexSize=n.length-o,m.attributeOffset=a,m.attributeSize=s.length/2-a,m.baseColor=r.style,m.alpha=r.alpha,m.texture=c,m.geometryData=e,t.push(m)}function Gi(r,t,e,s,i,n){const{vertices:o,uvs:a,indices:l}=n,u=r.shapePrimitives.length-1;r.shapePrimitives.forEach(({shape:h,transform:c},g)=>{const d=l.length,m=o.length/2,_=[],p=Ms[h.type];let b="triangle-list";if(p.build(h,_),c&&co(_,c),s){const B=h.closePath??!0,M=t;M.pixelLine?(yu(_,B,o,l),b="line-list"):_u(_,M,!1,B,o,l)}else if(e&&u===g){u!==0&&console.warn("[Pixi Graphics] only the last shape have be cut out");const B=[],M=_.slice();Tu(e.shapePath).forEach(O=>{B.push(M.length/2),M.push(...O)}),mo(M,B,o,2,m,l,d)}else p.triangulate(_,o,2,m,l,d);const C=a.length/2,T=t.texture;if(T!==ut.WHITE){const B=t.matrix;B&&(c&&B.append(c.clone().invert()),cu(o,2,m,a,C,2,o.length/2-m,B))}else du(a,C,2,o.length/2-m);const F=te.get(fo);F.indexOffset=d,F.indexSize=l.length-d,F.attributeOffset=m,F.attributeSize=o.length/2-m,F.baseColor=t.color,F.alpha=t.alpha,F.texture=T,F.geometryData=n,F.topology=b,i.push(F)})}function Tu(r){if(!r)return[];const t=r.shapePrimitives,e=[];for(let s=0;s<t.length;s++){const i=t[s].shape,n=[];Ms[i.type].build(i,n),e.push(n)}return e}class ku{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}}class Pu{constructor(){this.batcher=new uu,this.instructions=new Cn}init(){this.instructions.reset()}get geometry(){return ft(Ha,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}}const Fr=class br{constructor(t){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),t.renderableGC.addManagedHash(this,"_gpuContextHash"),t.renderableGC.addManagedHash(this,"_graphicsDataContextHash")}init(t){br.defaultOptions.bezierSmoothness=t?.bezierSmoothness??br.defaultOptions.bezierSmoothness}getContextRenderData(t){return this._graphicsDataContextHash[t.uid]||this._initContextRenderData(t)}updateGpuContext(t){let e=this._gpuContextHash[t.uid]||this._initContext(t);if(t.dirty){e?this._cleanGraphicsContextData(t):e=this._initContext(t),Au(t,e);const s=t.batchMode;t.customShader||s==="no-batch"?e.isBatchable=!1:s==="auto"&&(e.isBatchable=e.geometryData.vertices.length<400),t.dirty=!1}return e}getGpuContext(t){return this._gpuContextHash[t.uid]||this._initContext(t)}_initContextRenderData(t){const e=te.get(Pu),{batches:s,geometryData:i}=this._gpuContextHash[t.uid],n=i.vertices.length,o=i.indices.length;for(let h=0;h<s.length;h++)s[h].applyTransform=!1;const a=e.batcher;a.ensureAttributeBuffer(n),a.ensureIndexBuffer(o),a.begin();for(let h=0;h<s.length;h++){const c=s[h];a.add(c)}a.finish(e.instructions);const l=a.geometry;l.indexBuffer.setDataWithSize(a.indexBuffer,a.indexSize,!0),l.buffers[0].setDataWithSize(a.attributeBuffer.float32View,a.attributeSize,!0);const u=a.batches;for(let h=0;h<u.length;h++){const c=u[h];c.bindGroup=Ah(c.textures.textures,c.textures.count)}return this._graphicsDataContextHash[t.uid]=e,e}_initContext(t){const e=new ku;return e.context=t,this._gpuContextHash[t.uid]=e,t.on("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]}onGraphicsContextDestroy(t){this._cleanGraphicsContextData(t),t.off("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]=null}_cleanGraphicsContextData(t){const e=this._gpuContextHash[t.uid];e.isBatchable||this._graphicsDataContextHash[t.uid]&&(te.return(this.getContextRenderData(t)),this._graphicsDataContextHash[t.uid]=null),e.batches&&e.batches.forEach(s=>{te.return(s)})}destroy(){for(const t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context)}};Fr.extension={type:[lt.WebGLSystem,lt.WebGPUSystem,lt.CanvasSystem],name:"graphicsContext"};Fr.defaultOptions={bezierSmoothness:.5};go=Fr;const Mu=8,ds=11920929e-14,Iu=1;function _o(r,t,e,s,i,n,o,a,l,u){const c=Math.min(.99,Math.max(0,u??go.defaultOptions.bezierSmoothness));let g=(Iu-c)/1;return g*=g,Eu(t,e,s,i,n,o,a,l,r,g),r}function Eu(r,t,e,s,i,n,o,a,l,u){vr(r,t,e,s,i,n,o,a,l,u,0),l.push(o,a)}function vr(r,t,e,s,i,n,o,a,l,u,h){if(h>Mu)return;const c=(r+e)/2,g=(t+s)/2,d=(e+i)/2,m=(s+n)/2,_=(i+o)/2,p=(n+a)/2,b=(c+d)/2,C=(g+m)/2,T=(d+_)/2,F=(m+p)/2,B=(b+T)/2,M=(C+F)/2;if(h>0){let E=o-r,O=a-t;const L=Math.abs((e-o)*O-(s-a)*E),R=Math.abs((i-o)*O-(n-a)*E);if(L>ds&&R>ds){if((L+R)*(L+R)<=u*(E*E+O*O)){l.push(B,M);return}}else if(L>ds){if(L*L<=u*(E*E+O*O)){l.push(B,M);return}}else if(R>ds){if(R*R<=u*(E*E+O*O)){l.push(B,M);return}}else if(E=B-(r+o)/2,O=M-(t+a)/2,E*E+O*O<=u){l.push(B,M);return}}vr(r,t,c,g,b,C,B,M,l,u,h+1),vr(B,M,T,F,_,p,o,a,l,u,h+1)}const Du=8,Ru=11920929e-14,Fu=1;function Bu(r,t,e,s,i,n,o,a){const u=Math.min(.99,Math.max(0,a??go.defaultOptions.bezierSmoothness));let h=(Fu-u)/1;return h*=h,$u(t,e,s,i,n,o,r,h),r}function $u(r,t,e,s,i,n,o,a){wr(o,r,t,e,s,i,n,a,0),o.push(i,n)}function wr(r,t,e,s,i,n,o,a,l){if(l>Du)return;const u=(t+s)/2,h=(e+i)/2,c=(s+n)/2,g=(i+o)/2,d=(u+c)/2,m=(h+g)/2;let _=n-t,p=o-e;const b=Math.abs((s-n)*p-(i-o)*_);if(b>Ru){if(b*b<=a*(_*_+p*p)){r.push(d,m);return}}else if(_=d-(t+n)/2,p=m-(e+o)/2,_*_+p*p<=a){r.push(d,m);return}wr(r,t,e,u,h,d,m,a,l+1),wr(r,d,m,c,g,n,o,a,l+1)}function yo(r,t,e,s,i,n,o,a){let l=Math.abs(i-n);(!o&&i>n||o&&n>i)&&(l=2*Math.PI-l),a||(a=Math.max(6,Math.floor(6*Math.pow(s,1/3)*(l/Math.PI)))),a=Math.max(a,3);let u=l/a,h=i;u*=o?-1:1;for(let c=0;c<a+1;c++){const g=Math.cos(h),d=Math.sin(h),m=t+g*s,_=e+d*s;r.push(m,_),h+=u}}function Gu(r,t,e,s,i,n){const o=r[r.length-2],l=r[r.length-1]-e,u=o-t,h=i-e,c=s-t,g=Math.abs(l*c-u*h);if(g<1e-8||n===0){(r[r.length-2]!==t||r[r.length-1]!==e)&&r.push(t,e);return}const d=l*l+u*u,m=h*h+c*c,_=l*h+u*c,p=n*Math.sqrt(d)/g,b=n*Math.sqrt(m)/g,C=p*_/d,T=b*_/m,F=p*c+b*u,B=p*h+b*l,M=u*(b+C),E=l*(b+C),O=c*(p+T),L=h*(p+T),R=Math.atan2(E-B,M-F),A=Math.atan2(L-B,O-F);yo(r,F+t,B+e,n,R,A,u*h>c*l)}const Le=Math.PI*2,er={centerX:0,centerY:0,ang1:0,ang2:0},sr=({x:r,y:t},e,s,i,n,o,a,l)=>{r*=e,t*=s;const u=i*r-n*t,h=n*r+i*t;return l.x=u+o,l.y=h+a,l};function Nu(r,t){const e=t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),s=t===1.5707963267948966?.551915024494:e,i=Math.cos(r),n=Math.sin(r),o=Math.cos(r+t),a=Math.sin(r+t);return[{x:i-n*s,y:n+i*s},{x:o+a*s,y:a-o*s},{x:o,y:a}]}const Ni=(r,t,e,s)=>{const i=r*s-t*e<0?-1:1;let n=r*e+t*s;return n>1&&(n=1),n<-1&&(n=-1),i*Math.acos(n)},Vu=(r,t,e,s,i,n,o,a,l,u,h,c,g)=>{const d=Math.pow(i,2),m=Math.pow(n,2),_=Math.pow(h,2),p=Math.pow(c,2);let b=d*m-d*p-m*_;b<0&&(b=0),b/=d*p+m*_,b=Math.sqrt(b)*(o===a?-1:1);const C=b*i/n*c,T=b*-n/i*h,F=u*C-l*T+(r+e)/2,B=l*C+u*T+(t+s)/2,M=(h-C)/i,E=(c-T)/n,O=(-h-C)/i,L=(-c-T)/n,R=Ni(1,0,M,E);let A=Ni(M,E,O,L);a===0&&A>0&&(A-=Le),a===1&&A<0&&(A+=Le),g.centerX=F,g.centerY=B,g.ang1=R,g.ang2=A};function Ou(r,t,e,s,i,n,o,a=0,l=0,u=0){if(n===0||o===0)return;const h=Math.sin(a*Le/360),c=Math.cos(a*Le/360),g=c*(t-s)/2+h*(e-i)/2,d=-h*(t-s)/2+c*(e-i)/2;if(g===0&&d===0)return;n=Math.abs(n),o=Math.abs(o);const m=Math.pow(g,2)/Math.pow(n,2)+Math.pow(d,2)/Math.pow(o,2);m>1&&(n*=Math.sqrt(m),o*=Math.sqrt(m)),Vu(t,e,s,i,n,o,l,u,h,c,g,d,er);let{ang1:_,ang2:p}=er;const{centerX:b,centerY:C}=er;let T=Math.abs(p)/(Le/4);Math.abs(1-T)<1e-7&&(T=1);const F=Math.max(Math.ceil(T),1);p/=F;let B=r[r.length-2],M=r[r.length-1];const E={x:0,y:0};for(let O=0;O<F;O++){const L=Nu(_,p),{x:R,y:A}=sr(L[0],n,o,c,h,b,C,E),{x:$,y:U}=sr(L[1],n,o,c,h,b,C,E),{x:X,y:tt}=sr(L[2],n,o,c,h,b,C,E);_o(r,B,M,R,A,$,U,X,tt),B=X,M=tt,_+=p}}function zu(r,t,e){const s=(o,a)=>{const l=a.x-o.x,u=a.y-o.y,h=Math.sqrt(l*l+u*u),c=l/h,g=u/h;return{len:h,nx:c,ny:g}},i=(o,a)=>{o===0?r.moveTo(a.x,a.y):r.lineTo(a.x,a.y)};let n=t[t.length-1];for(let o=0;o<t.length;o++){const a=t[o%t.length],l=a.radius??e;if(l<=0){i(o,a),n=a;continue}const u=t[(o+1)%t.length],h=s(a,n),c=s(a,u);if(h.len<1e-4||c.len<1e-4){i(o,a),n=a;continue}let g=Math.asin(h.nx*c.ny-h.ny*c.nx),d=1,m=!1;h.nx*c.nx-h.ny*-c.ny<0?g<0?g=Math.PI+g:(g=Math.PI-g,d=-1,m=!0):g>0&&(d=-1,m=!0);const _=g/2;let p,b=Math.abs(Math.cos(_)*l/Math.sin(_));b>Math.min(h.len/2,c.len/2)?(b=Math.min(h.len/2,c.len/2),p=Math.abs(b*Math.sin(_)/Math.cos(_))):p=l;const C=a.x+c.nx*b+-c.ny*p*d,T=a.y+c.ny*b+c.nx*p*d,F=Math.atan2(h.ny,h.nx)+Math.PI/2*d,B=Math.atan2(c.ny,c.nx)-Math.PI/2*d;o===0&&r.moveTo(C+Math.cos(F)*p,T+Math.sin(F)*p),r.arc(C,T,p,F,B,m),n=a}}function Lu(r,t,e,s){const i=(a,l)=>Math.sqrt((a.x-l.x)**2+(a.y-l.y)**2),n=(a,l,u)=>({x:a.x+(l.x-a.x)*u,y:a.y+(l.y-a.y)*u}),o=t.length;for(let a=0;a<o;a++){const l=t[(a+1)%o],u=l.radius??e;if(u<=0){a===0?r.moveTo(l.x,l.y):r.lineTo(l.x,l.y);continue}const h=t[a],c=t[(a+2)%o],g=i(h,l);let d;if(g<1e-4)d=l;else{const p=Math.min(g/2,u);d=n(l,h,p/g)}const m=i(c,l);let _;if(m<1e-4)_=l;else{const p=Math.min(m/2,u);_=n(l,c,p/m)}a===0?r.moveTo(d.x,d.y):r.lineTo(d.x,d.y),r.quadraticCurveTo(l.x,l.y,_.x,_.y,s)}}const Uu=new Ct;class Hu{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new Xt,this._graphicsPath2D=t}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();const s=this._currentPoly.points,i=s[s.length-2],n=s[s.length-1];return(i!==t||n!==e)&&s.push(t,e),this}arc(t,e,s,i,n,o){this._ensurePoly(!1);const a=this._currentPoly.points;return yo(a,t,e,s,i,n,o),this}arcTo(t,e,s,i,n){this._ensurePoly();const o=this._currentPoly.points;return Gu(o,t,e,s,i,n),this}arcToSvg(t,e,s,i,n,o,a){const l=this._currentPoly.points;return Ou(l,this._currentPoly.lastX,this._currentPoly.lastY,o,a,t,e,s,i,n),this}bezierCurveTo(t,e,s,i,n,o,a){this._ensurePoly();const l=this._currentPoly;return _o(this._currentPoly.points,l.lastX,l.lastY,t,e,s,i,n,o,a),this}quadraticCurveTo(t,e,s,i,n){this._ensurePoly();const o=this._currentPoly;return Bu(this._currentPoly.points,o.lastX,o.lastY,t,e,s,i,n),this}closePath(){return this.endPoly(!0),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(!0),t.transform(e));for(let s=0;s<t.instructions.length;s++){const i=t.instructions[s];this[i.action](...i.data)}return this}finish(t=!1){this.endPoly(t)}rect(t,e,s,i,n){return this.drawShape(new Ct(t,e,s,i),n),this}circle(t,e,s,i){return this.drawShape(new Er(t,e,s),i),this}poly(t,e,s){const i=new ze(t);return i.closePath=e,this.drawShape(i,s),this}regularPoly(t,e,s,i,n=0,o){i=Math.max(i|0,3);const a=-1*Math.PI/2+n,l=Math.PI*2/i,u=[];for(let h=0;h<i;h++){const c=h*l+a;u.push(t+s*Math.cos(c),e+s*Math.sin(c))}return this.poly(u,!0,o),this}roundPoly(t,e,s,i,n,o=0,a){if(i=Math.max(i|0,3),n<=0)return this.regularPoly(t,e,s,i,o);const l=s*Math.sin(Math.PI/i)-.001;n=Math.min(n,l);const u=-1*Math.PI/2+o,h=Math.PI*2/i,c=(i-2)*Math.PI/i/2;for(let g=0;g<i;g++){const d=g*h+u,m=t+s*Math.cos(d),_=e+s*Math.sin(d),p=d+Math.PI+c,b=d-Math.PI-c,C=m+n*Math.cos(p),T=_+n*Math.sin(p),F=m+n*Math.cos(b),B=_+n*Math.sin(b);g===0?this.moveTo(C,T):this.lineTo(C,T),this.quadraticCurveTo(m,_,F,B,a)}return this.closePath()}roundShape(t,e,s=!1,i){return t.length<3?this:(s?Lu(this,t,e,i):zu(this,t,e),this.closePath())}filletRect(t,e,s,i,n){if(n===0)return this.rect(t,e,s,i);const o=Math.min(s,i)/2,a=Math.min(o,Math.max(-o,n)),l=t+s,u=e+i,h=a<0?-a:0,c=Math.abs(a);return this.moveTo(t,e+c).arcTo(t+h,e+h,t+c,e,c).lineTo(l-c,e).arcTo(l-h,e+h,l,e+c,c).lineTo(l,u-c).arcTo(l-h,u-h,t+s-c,u,c).lineTo(t+c,u).arcTo(t+h,u-h,t,u-c,c).closePath()}chamferRect(t,e,s,i,n,o){if(n<=0)return this.rect(t,e,s,i);const a=Math.min(n,Math.min(s,i)/2),l=t+s,u=e+i,h=[t+a,e,l-a,e,l,e+a,l,u-a,l-a,u,t+a,u,t,u-a,t,e+a];for(let c=h.length-1;c>=2;c-=2)h[c]===h[c-2]&&h[c-1]===h[c-3]&&h.splice(c-1,2);return this.poly(h,!0,o)}ellipse(t,e,s,i,n){return this.drawShape(new Dr(t,e,s,i),n),this}roundRect(t,e,s,i,n,o){return this.drawShape(new Rr(t,e,s,i,n),o),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let s=this._currentPoly;return s&&this.endPoly(),s=new ze,s.points.push(t,e),this._currentPoly=s,this}endPoly(t=!1){const e=this._currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this._currentPoly=null,this}_ensurePoly(t=!0){if(!this._currentPoly&&(this._currentPoly=new ze,t)){const e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let s=e.shape.x,i=e.shape.y;if(e.transform&&!e.transform.isIdentity()){const n=e.transform,o=s;s=n.a*s+n.c*i+n.tx,i=n.b*o+n.d*i+n.ty}this._currentPoly.points.push(s,i)}else this._currentPoly.points.push(0,0)}}buildPath(){const t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;e<t.instructions.length;e++){const s=t.instructions[e];this[s.action](...s.data)}this.finish()}get bounds(){const t=this._bounds;t.clear();const e=this.shapePrimitives;for(let s=0;s<e.length;s++){const i=e[s],n=i.shape.getBounds(Uu);i.transform?t.addRect(n,i.transform):t.addRect(n)}return t}}class Ie{constructor(t){this.instructions=[],this.uid=_t("graphicsPath"),this._dirty=!0,typeof t=="string"?xh(t,this):this.instructions=t?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new Hu(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(t,e){return t=t.clone(),this.instructions.push({action:"addPath",data:[t,e]}),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,e,s,i,n){const o=this.instructions[this.instructions.length-1],a=this.getLastPoint(St.shared);let l=0,u=0;if(!o||o.action!=="bezierCurveTo")l=a.x,u=a.y;else{l=o.data[2],u=o.data[3];const h=a.x,c=a.y;l=h+(h-l),u=c+(c-u)}return this.instructions.push({action:"bezierCurveTo",data:[l,u,t,e,s,i,n]}),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,e,s){const i=this.instructions[this.instructions.length-1],n=this.getLastPoint(St.shared);let o=0,a=0;if(!i||i.action!=="quadraticCurveTo")o=n.x,a=n.y;else{o=i.data[0],a=i.data[1];const l=n.x,u=n.y;o=l+(l-o),a=u+(u-a)}return this.instructions.push({action:"quadraticCurveTo",data:[o,a,t,e,s]}),this._dirty=!0,this}rect(t,e,s,i,n){return this.instructions.push({action:"rect",data:[t,e,s,i,n]}),this._dirty=!0,this}circle(t,e,s,i){return this.instructions.push({action:"circle",data:[t,e,s,i]}),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,e,s,i,n,o,a){n||(n=i/2);const l=-1*Math.PI/2+o,u=s*2,h=Math.PI*2/u,c=[];for(let g=0;g<u;g++){const d=g%2?n:i,m=g*h+l;c.push(t+d*Math.cos(m),e+d*Math.sin(m))}return this.poly(c,!0,a),this}clone(t=!1){const e=new Ie;if(!t)e.instructions=this.instructions.slice();else for(let s=0;s<this.instructions.length;s++){const i=this.instructions[s];e.instructions.push({action:i.action,data:i.data.slice()})}return e}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(t){if(t.isIdentity())return this;const e=t.a,s=t.b,i=t.c,n=t.d,o=t.tx,a=t.ty;let l=0,u=0,h=0,c=0,g=0,d=0,m=0,_=0;for(let p=0;p<this.instructions.length;p++){const b=this.instructions[p],C=b.data;switch(b.action){case"moveTo":case"lineTo":l=C[0],u=C[1],C[0]=e*l+i*u+o,C[1]=s*l+n*u+a;break;case"bezierCurveTo":h=C[0],c=C[1],g=C[2],d=C[3],l=C[4],u=C[5],C[0]=e*h+i*c+o,C[1]=s*h+n*c+a,C[2]=e*g+i*d+o,C[3]=s*g+n*d+a,C[4]=e*l+i*u+o,C[5]=s*l+n*u+a;break;case"quadraticCurveTo":h=C[0],c=C[1],l=C[2],u=C[3],C[0]=e*h+i*c+o,C[1]=s*h+n*c+a,C[2]=e*l+i*u+o,C[3]=s*l+n*u+a;break;case"arcToSvg":l=C[5],u=C[6],m=C[0],_=C[1],C[0]=e*m+i*_,C[1]=s*m+n*_,C[5]=e*l+i*u+o,C[6]=s*l+n*u+a;break;case"circle":C[4]=Fe(C[3],t);break;case"rect":C[4]=Fe(C[4],t);break;case"ellipse":C[8]=Fe(C[8],t);break;case"roundRect":C[5]=Fe(C[5],t);break;case"addPath":C[0].transform(t);break;case"poly":C[2]=Fe(C[2],t);break;default:Yt("unknown transform action",b.action);break}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(t){let e=this.instructions.length-1,s=this.instructions[e];if(!s)return t.x=0,t.y=0,t;for(;s.action==="closePath";){if(e--,e<0)return t.x=0,t.y=0,t;s=this.instructions[e]}switch(s.action){case"moveTo":case"lineTo":t.x=s.data[0],t.y=s.data[1];break;case"quadraticCurveTo":t.x=s.data[2],t.y=s.data[3];break;case"bezierCurveTo":t.x=s.data[4],t.y=s.data[5];break;case"arc":case"arcToSvg":t.x=s.data[5],t.y=s.data[6];break;case"addPath":s.data[0].getLastPoint(t);break}return t}}function Fe(r,t){return r?r.prepend(t):t.clone()}function Yu(r,t){if(typeof r=="string"){const s=document.createElement("div");s.innerHTML=r.trim(),r=s.querySelector("svg")}const e={context:t,path:new Ie};return xo(r,e,null,null),t}function xo(r,t,e,s){const i=r.children,{fillStyle:n,strokeStyle:o}=Xu(r);n&&e?e={...e,...n}:n&&(e=n),o&&s?s={...s,...o}:o&&(s=o),t.context.fillStyle=e,t.context.strokeStyle=s;let a,l,u,h,c,g,d,m,_,p,b,C,T,F,B,M,E;switch(r.nodeName.toLowerCase()){case"path":F=r.getAttribute("d"),B=new Ie(F),t.context.path(B),e&&t.context.fill(),s&&t.context.stroke();break;case"circle":d=xt(r,"cx",0),m=xt(r,"cy",0),_=xt(r,"r",0),t.context.ellipse(d,m,_,_),e&&t.context.fill(),s&&t.context.stroke();break;case"rect":a=xt(r,"x",0),l=xt(r,"y",0),M=xt(r,"width",0),E=xt(r,"height",0),p=xt(r,"rx",0),b=xt(r,"ry",0),p||b?t.context.roundRect(a,l,M,E,p||b):t.context.rect(a,l,M,E),e&&t.context.fill(),s&&t.context.stroke();break;case"ellipse":d=xt(r,"cx",0),m=xt(r,"cy",0),p=xt(r,"rx",0),b=xt(r,"ry",0),t.context.beginPath(),t.context.ellipse(d,m,p,b),e&&t.context.fill(),s&&t.context.stroke();break;case"line":u=xt(r,"x1",0),h=xt(r,"y1",0),c=xt(r,"x2",0),g=xt(r,"y2",0),t.context.beginPath(),t.context.moveTo(u,h),t.context.lineTo(c,g),s&&t.context.stroke();break;case"polygon":T=r.getAttribute("points"),C=T.match(/\d+/g).map(O=>parseInt(O,10)),t.context.poly(C,!0),e&&t.context.fill(),s&&t.context.stroke();break;case"polyline":T=r.getAttribute("points"),C=T.match(/\d+/g).map(O=>parseInt(O,10)),t.context.poly(C,!1),s&&t.context.stroke();break;case"g":case"svg":break;default:{console.info(`[SVG parser] <${r.nodeName}> elements unsupported`);break}}for(let O=0;O<i.length;O++)xo(i[O],t,e,s)}function xt(r,t,e){const s=r.getAttribute(t);return s?Number(s):e}function Xu(r){const t=r.getAttribute("style"),e={},s={};let i=!1,n=!1;if(t){const o=t.split(";");for(let a=0;a<o.length;a++){const l=o[a],[u,h]=l.split(":");switch(u){case"stroke":h!=="none"&&(e.color=Ft.shared.setValue(h).toNumber(),n=!0);break;case"stroke-width":e.width=Number(h);break;case"fill":h!=="none"&&(i=!0,s.color=Ft.shared.setValue(h).toNumber());break;case"fill-opacity":s.alpha=Number(h);break;case"stroke-opacity":e.alpha=Number(h);break;case"opacity":s.alpha=Number(h),e.alpha=Number(h);break}}}else{const o=r.getAttribute("stroke");o&&o!=="none"&&(n=!0,e.color=Ft.shared.setValue(o).toNumber(),e.width=xt(r,"stroke-width",1));const a=r.getAttribute("fill");a&&a!=="none"&&(i=!0,s.color=Ft.shared.setValue(a).toNumber())}return{strokeStyle:n?e:null,fillStyle:i?s:null}}function Wu(r){return Ft.isColorLike(r)}function Vi(r){return r instanceof mh}function Oi(r){return r instanceof ph}function ju(r,t,e){const s=Ft.shared.setValue(t??0);return r.color=s.toNumber(),r.alpha=s.alpha===1?e.alpha:s.alpha,r.texture=ut.WHITE,{...e,...r}}function zi(r,t,e){return r.fill=t,r.color=16777215,r.texture=t.texture,r.matrix=t.transform,{...e,...r}}function Li(r,t,e){return t.buildLinearGradient(),r.fill=t,r.color=16777215,r.texture=t.texture,r.matrix=t.transform,{...e,...r}}function qu(r,t){const e={...t,...r};if(e.texture){if(e.texture!==ut.WHITE){const n=e.matrix?.clone().invert()||new it;n.translate(e.texture.frame.x,e.texture.frame.y),n.scale(1/e.texture.source.width,1/e.texture.source.height),e.matrix=n}const i=e.texture.source.style;i.addressMode==="clamp-to-edge"&&(i.addressMode="repeat",i.update())}const s=Ft.shared.setValue(e.color);return e.alpha*=s.alpha,e.color=s.toNumber(),e.matrix=e.matrix?e.matrix.clone():null,e}Ve=function(r,t){if(r==null)return null;const e={},s=r;return Wu(r)?ju(e,r,t):Vi(r)?zi(e,r,t):Oi(r)?Li(e,r,t):s.fill&&Vi(s.fill)?zi(s,s.fill,t):s.fill&&Oi(s.fill)?Li(s,s.fill,t):qu(s,t)};Ui=function(r,t){const{width:e,alignment:s,miterLimit:i,cap:n,join:o,pixelLine:a,...l}=t,u=Ve(r,l);return u?{width:e,alignment:s,miterLimit:i,cap:n,join:o,pixelLine:a,...u}:null};const Ku=new St,Hi=new it,Br=class Ut extends re{constructor(){super(...arguments),this.uid=_t("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new Ie,this._transform=new it,this._fillStyle={...Ut.defaultFillStyle},this._strokeStyle={...Ut.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new Xt,this._boundsDirty=!0}clone(){const t=new Ut;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=Ve(t,Ut.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=Ui(t,Ut.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=Ve(t,Ut.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=Ve(t,Ut.defaultStrokeStyle),this}texture(t,e,s,i,n,o){return this.instructions.push({action:"texture",data:{image:t,dx:s||0,dy:i||0,dw:n||t.frame.width,dh:o||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e?Ft.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new Ie,this}fill(t,e){let s;const i=this.instructions[this.instructions.length-1];return this._tick===0&&i&&i.action==="stroke"?s=i.data.path:s=this._activePath.clone(),s?(t!=null&&(e!==void 0&&typeof t=="number"&&(ft(gt,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:e}),this._fillStyle=Ve(t,Ut.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:s}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){const{x:t,y:e}=this._activePath.getLastPoint(St.shared);this._activePath.clear(),this._activePath.moveTo(t,e)}stroke(t){let e;const s=this.instructions[this.instructions.length-1];return this._tick===0&&s&&s.action==="fill"?e=s.data.path:e=this._activePath.clone(),e?(t!=null&&(this._strokeStyle=Ui(t,Ut.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:e}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let t=0;t<2;t++){const e=this.instructions[this.instructions.length-1-t],s=this._activePath.clone();if(e&&(e.action==="stroke"||e.action==="fill"))if(e.data.hole)e.data.hole.addPath(s);else{e.data.hole=s;break}}return this._initNextPathLocation(),this}arc(t,e,s,i,n,o){this._tick++;const a=this._transform;return this._activePath.arc(a.a*t+a.c*e+a.tx,a.b*t+a.d*e+a.ty,s,i,n,o),this}arcTo(t,e,s,i,n){this._tick++;const o=this._transform;return this._activePath.arcTo(o.a*t+o.c*e+o.tx,o.b*t+o.d*e+o.ty,o.a*s+o.c*i+o.tx,o.b*s+o.d*i+o.ty,n),this}arcToSvg(t,e,s,i,n,o,a){this._tick++;const l=this._transform;return this._activePath.arcToSvg(t,e,s,i,n,l.a*o+l.c*a+l.tx,l.b*o+l.d*a+l.ty),this}bezierCurveTo(t,e,s,i,n,o,a){this._tick++;const l=this._transform;return this._activePath.bezierCurveTo(l.a*t+l.c*e+l.tx,l.b*t+l.d*e+l.ty,l.a*s+l.c*i+l.tx,l.b*s+l.d*i+l.ty,l.a*n+l.c*o+l.tx,l.b*n+l.d*o+l.ty,a),this}closePath(){return this._tick++,this._activePath?.closePath(),this}ellipse(t,e,s,i){return this._tick++,this._activePath.ellipse(t,e,s,i,this._transform.clone()),this}circle(t,e,s){return this._tick++,this._activePath.circle(t,e,s,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;const s=this._transform;return this._activePath.lineTo(s.a*t+s.c*e+s.tx,s.b*t+s.d*e+s.ty),this}moveTo(t,e){this._tick++;const s=this._transform,i=this._activePath.instructions,n=s.a*t+s.c*e+s.tx,o=s.b*t+s.d*e+s.ty;return i.length===1&&i[0].action==="moveTo"?(i[0].data[0]=n,i[0].data[1]=o,this):(this._activePath.moveTo(n,o),this)}quadraticCurveTo(t,e,s,i,n){this._tick++;const o=this._transform;return this._activePath.quadraticCurveTo(o.a*t+o.c*e+o.tx,o.b*t+o.d*e+o.ty,o.a*s+o.c*i+o.tx,o.b*s+o.d*i+o.ty,n),this}rect(t,e,s,i){return this._tick++,this._activePath.rect(t,e,s,i,this._transform.clone()),this}roundRect(t,e,s,i,n){return this._tick++,this._activePath.roundRect(t,e,s,i,n,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,s,i,n=0,o){return this._tick++,this._activePath.regularPoly(t,e,s,i,n,o),this}roundPoly(t,e,s,i,n,o){return this._tick++,this._activePath.roundPoly(t,e,s,i,n,o),this}roundShape(t,e,s,i){return this._tick++,this._activePath.roundShape(t,e,s,i),this}filletRect(t,e,s,i,n){return this._tick++,this._activePath.filletRect(t,e,s,i,n),this}chamferRect(t,e,s,i,n,o){return this._tick++,this._activePath.chamferRect(t,e,s,i,n,o),this}star(t,e,s,i,n=0,o=0){return this._tick++,this._activePath.star(t,e,s,i,n,o,this._transform.clone()),this}svg(t){return this._tick++,Yu(t,this),this}restore(){const 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,e=t){return this._transform.scale(t,e),this}setTransform(t,e,s,i,n,o){return t instanceof it?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,s,i,n,o),this)}transform(t,e,s,i,n,o){return t instanceof it?(this._transform.append(t),this):(Hi.set(t,e,s,i,n,o),this._transform.append(Hi),this)}translate(t,e=t){return this._transform.translate(t,e),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;const t=this._bounds;t.clear();for(let e=0;e<this.instructions.length;e++){const s=this.instructions[e],i=s.action;if(i==="fill"){const n=s.data;t.addBounds(n.path.bounds)}else if(i==="texture"){const n=s.data;t.addFrame(n.dx,n.dy,n.dx+n.dw,n.dy+n.dh,n.transform)}if(i==="stroke"){const n=s.data,o=n.style.alignment,a=n.style.width*(1-o),l=n.path.bounds;t.addFrame(l.minX-a,l.minY-a,l.maxX+a,l.maxY+a)}}return t}containsPoint(t){if(!this.bounds.containsPoint(t.x,t.y))return!1;const e=this.instructions;let s=!1;for(let i=0;i<e.length;i++){const n=e[i],o=n.data,a=o.path;if(!n.action||!a)continue;const l=o.style,u=a.shapePath.shapePrimitives;for(let h=0;h<u.length;h++){const c=u[h].shape;if(!l||!c)continue;const g=u[h].transform,d=g?g.applyInverse(t,Ku):t;n.action==="fill"?s=c.contains(d.x,d.y):s=c.strokeContains(d.x,d.y,l.width);const m=o.hole;if(m){const _=m.shapePath?.shapePrimitives;if(_)for(let p=0;p<_.length;p++)_[p].shape.contains(d.x,d.y)&&(s=!1)}if(s)return!0}}return s}destroy(t=!1){if(this._stateStack.length=0,this._transform=null,this.emit("destroy",this),this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){const s=typeof t=="boolean"?t:t?.textureSource;this._fillStyle.texture&&this._fillStyle.texture.destroy(s),this._strokeStyle.texture&&this._strokeStyle.texture.destroy(s)}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}};Br.defaultFillStyle={color:16777215,alpha:1,texture:ut.WHITE,matrix:null,fill:null};Br.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:ut.WHITE,matrix:null,fill:null,pixelLine:!1};Be=Br;xs=class extends An{constructor(t){t instanceof Be&&(t={context:t});const{context:e,roundPixels:s,...i}=t||{};super({label:"Graphics",...i}),this.renderPipeId="graphics",e?this._context=e:this._context=this._ownedContext=new Be,this._context.on("update",this.onViewUpdate,this),this.allowChildren=!1,this.roundPixels=s??!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,e){return this.context[t](...e),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 xs(this._context.clone()):(this._ownedContext=null,new xs(this._context))}lineStyle(t,e,s){ft(gt,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");const i={};return t&&(i.width=t),e&&(i.color=e),s&&(i.alpha=s),this.context.strokeStyle=i,this}beginFill(t,e){ft(gt,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");const s={};return t!==void 0&&(s.color=t),e!==void 0&&(s.alpha=e),this.context.fillStyle=s,this}endFill(){ft(gt,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();const t=this.context.strokeStyle;return(t.width!==Be.defaultStrokeStyle.width||t.color!==Be.defaultStrokeStyle.color||t.alpha!==Be.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return ft(gt,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return ft(gt,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return ft(gt,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return ft(gt,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return ft(gt,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return ft(gt,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}};jt.add(Fa,Ba);let Zu,Qu,Ju,tc,ec,sc,rc,ic,nc,oc,ac,lc,hc,uc,cc,dc,fc,pc,mc,gc,_c,yc,xc,bc,vc,wc,Cc,Ac,Sc,Tc,kc,Pc,Mc,Ic,Ec,Dc,Rc,Fc,Bc,$c,Gc,Nc,Vc;Zu=vt({__name:"PieceCanvas",props:{torrent:{},isActive:{type:Boolean}},setup(r){const t=r,e=ra(),s=_e(),{cachedFiles:i}=yt(s),{fileContentInterval:n}=yt(Wt()),o=pt(),a=pt(!1),l=Qt(),u=Qt();async function h(){if(a.value||!o.value||!l.value)return;a.value=!0;const m=await s.fetchPieceState(t.torrent.hash),_=new Ar;i.value.filter(T=>T.priority!==rt.DO_NOT_DOWNLOAD).forEach(T=>_.insert(T.piece_range,T.name));const p=new xs;let b="",C=1;for(let T=0;T<m.length;++T){const F=m[T];let B="";if(F===Is.DOWNLOADING?B=e.current.value.colors["torrent-downloading"]:F===Is.DOWNLOADED?B=e.current.value.colors["torrent-ul_stopped"]:F===Is.MISSING&&_.intersect_any([T,T])&&(B=e.current.value.colors["torrent-dl_stopped"]),B===b){++C;continue}b!==""&&(p.rect((T-C)/m.length*o.value.width,0,C/m.length*o.value.width,o.value.height),p.fill(b)),C=1,b=B}b!==""&&(p.rect((m.length-C)/m.length*o.value.width,0,C/m.length*o.value.width,o.value.height),p.fill(b)),l.value.stage.addChild(p),u.value&&u.value.destroy(),u.value=p,a.value=!1}function c(){h().catch(()=>{})}const{pause:g,resume:d}=Cs(c,n,{immediate:!1,immediateCallback:!0});return Je(()=>t.isActive,m=>{m?d():g()}),ts(()=>{if(!o.value)return;const m=new to;m.init({antialias:!0,width:o.value?.width,height:o.value?.height,canvas:o.value}).then(()=>l.value=m).then(()=>t.isActive&&d())}),vs(()=>{l.value?.destroy({removeView:!1},{children:!0})}),(m,_)=>(N(),j("canvas",{ref_key:"canvas",ref:o,width:"4096",height:"20"},null,512))}});Qu=Ss(Zu,[["__scopeId","data-v-c3384aa7"]]);Ju=["href"];tc={key:1};ec={class:"my-1"};sc={class:"mr-2"};rc={key:0};ic={key:2};nc={key:0};oc={key:1};ac={key:2};lc={key:0};hc={key:0,class:"d-flex flex-wrap flex-gap-row-small flex-gap-column"};uc=vt({__name:"Overview",props:{torrent:{},isActive:{type:Boolean}},setup(r){const t=r,{t:e,getTorrentStateString:s}=ee(),i=_e(),{cachedFiles:n}=yt(i),o=ws(),{properties:a}=yt(se()),l=Wt(),u=Z(()=>window.isSecureContext),h=Z(()=>n.value.filter(A=>A.priority!==rt.DO_NOT_DOWNLOAD)),c=Z(()=>n.value.length),g=Z(()=>h.value.length===1?h.value[0].name:""),d=Z(()=>a.value?.comment??""),m=Z(()=>a.value?.dl_speed_avg??0),_=Z(()=>a.value?.piece_size??0),p=Z(()=>a.value?.pieces_have??0),b=Z(()=>a.value?.pieces_num??0),C=Z(()=>a.value?.up_speed_avg??0),T=Z(()=>Vo(t.torrent.state)),F=Z(()=>`${parseInt(Oo(_.value,!0))} ${zo(_.value,!0)}`),B=Z(()=>[Ur.META_DOWNLOAD,Ur.FORCED_META_DOWNLOAD].includes(t.torrent.state)),M=Z(()=>l.enableRatioColors?Lo(t.torrent.ratio):"");async function E(){try{await navigator.clipboard.writeText(t.torrent.hash)}catch{Vr.error(e("toast.copy.error"));return}Vr.success(e("toast.copy.success"))}function O(A){o.createDialog(vo,{hashes:[t.torrent.hash],mode:A})}function L(){o.createDialog(la,{hash:t.torrent.hash,isFolder:!1,oldName:g.value},i.updateFileTreeTask.perform)}function R(A){if(o.hasActiveDialog||!t.isActive)return!1;if(A.key==="d")return A.preventDefault(),O("dl"),!0;if(A.key==="s")return A.preventDefault(),O("save"),!0;if(A.key==="f"&&h.value.length===1)return A.preventDefault(),L(),!0;if(A.key==="Delete")return A.preventDefault(),o.createDialog(Xo,{hashes:[t.torrent.hash]}),!0}return ts(()=>{document.addEventListener("keydown",R)}),To(async()=>{document.removeEventListener("keydown",R)}),(A,$)=>A.torrent?(N(),q(Ht,{key:0},{default:v(()=>[x(As,{class:"text-wrap"},{default:v(()=>[W(G(A.torrent.name),1)]),_:1}),x(Ho,null,{default:v(()=>[Y("div",null,[(N(!0),j(Pt,null,$t(D(Uo)(d.value),U=>(N(),j("span",null,[D(Wo)(U)?(N(),j("a",{key:0,target:"_blank",href:U},G(U),9,Ju)):(N(),j("span",tc,G(U),1))]))),256))]),Y("div",ec,[Y("span",sc,G(A.torrent.hash),1),u.value?(N(),q(ht,{key:0,variant:"outlined",rounded:"",onClick:E},{default:v(()=>[W(G(A.$t("torrentDetail.overview.copy_hash")),1)]),_:1})):Rt("",!0)])]),_:1}),x(pe,null,{default:v(()=>[x(dt,null,{default:v(()=>[x(st,{cols:"12",md:"6"},{default:v(()=>[x(dt,null,{default:v(()=>[x(st,{cols:"4"},{default:v(()=>[x(Yo,{color:T.value,indeterminate:B.value,size:100,"model-value":A.torrent?.progress*100||0,width:15},{default:v(()=>[B.value?(N(),j("span",rc,G(A.$t("torrentDetail.overview.fetchingMetadata")),1)):A.torrent.progress===1?(N(),q(At,{key:1,icon:"mdi-check",size:"x-large"})):(N(),j("span",ic,G(D(ir)(A.torrent.progress)),1))]),_:1},8,["color","indeterminate","model-value"])]),_:1}),x(st,{cols:"8",class:"d-flex flex-column align-center justify-center"},{default:v(()=>[B.value?(N(),j("div",nc,[Y("span",null,G(A.$t("torrentDetail.overview.waitingForMetadata")),1)])):(N(),j("div",oc,[x(Qu,{torrent:A.torrent,isActive:A.isActive},null,8,["torrent","isActive"])])),b.value>0?(N(),j("div",ac,[Y("span",null,G(D(e)("torrentDetail.overview.pieceCount",{owned:p.value,total:b.value,pieceSize:F.value})),1)])):Rt("",!0),Y("div",null,[x(At,{icon:"mdi-arrow-down"}),W(" "+G(D(fe)(A.torrent.dlspeed,D(l).useBitSpeed))+" ",1),x(At,{icon:"mdi-arrow-up"}),W(" "+G(D(fe)(A.torrent.upspeed,D(l).useBitSpeed)),1)])]),_:1})]),_:1}),x(dt,null,{default:v(()=>[x(st,{cols:"6"},{default:v(()=>[Y("div",null,G(A.$t("torrent.properties.download_path"))+":",1),Y("div",null,G(A.torrent.download_path),1),x(ht,{icon:"mdi-pencil",color:"accent",size:"x-small",onClick:$[0]||($[0]=U=>O("dl"))})]),_:1}),x(st,{cols:"6"},{default:v(()=>[Y("div",null,G(A.$t("torrentDetail.overview.fileCount"))+":",1),Y("div",null,G(h.value.length)+" / "+G(c.value),1),h.value.length===1?(N(),j("div",lc,G(g.value),1)):Rt("",!0),h.value.length===1?(N(),q(ht,{key:1,icon:"mdi-pencil",color:"accent",size:"x-small",onClick:L})):Rt("",!0)]),_:1})]),_:1}),x(dt,null,{default:v(()=>[x(st,{cols:"6"},{default:v(()=>[Y("div",null,G(A.$t("torrent.properties.save_path"))+":",1),Y("div",null,G(A.torrent.savePath),1),x(ht,{icon:"mdi-pencil",color:"accent",size:"x-small",onClick:$[1]||($[1]=U=>O("save"))})]),_:1}),x(st,{cols:"6"},{default:v(()=>[Y("div",null,G(A.$t("torrent.properties.content_path"))+":",1),Y("div",null,G(A.torrent.content_path),1)]),_:1})]),_:1})]),_:1}),x(st,{cols:"12",md:"6"},{default:v(()=>[x(dt,null,{default:v(()=>[x(st,{cols:"6"},{default:v(()=>[Y("div",null,G(A.$t("torrent.properties.state"))+":",1),x(ve,{disabled:!0,"default-color":T.value,value:D(s)(A.torrent.state)},null,8,["default-color","value"])]),_:1}),x(st,{cols:"6"},{default:v(()=>[Y("div",null,G(A.$t("torrent.properties.category"))+":",1),x(ve,{"default-color":"category",disabled:!A.torrent.category.length,"disabled-value":A.$t("navbar.side.filters.category.empty"),value:A.torrent.category},null,8,["disabled","disabled-value","value"])]),_:1})]),_:1}),x(dt,null,{default:v(()=>[x(st,{cols:"6"},{default:v(()=>[Y("div",null,G(A.$t("torrent.properties.tracker"))+":",1),x(ve,{disabled:!A.torrent.trackerDomain.length,"default-color":"tracker","disabled-value":A.$t("navbar.side.filters.tracker.empty"),value:A.torrent.trackerDomain},null,8,["disabled","disabled-value","value"])]),_:1}),x(st,{cols:"6"},{default:v(()=>[Y("div",null,G(A.$t("torrent.properties.tags"))+":",1),A.torrent.tags.length?(N(),j("div",hc,[(N(!0),j(Pt,null,$t(A.torrent.tags,U=>(N(),q(ve,{"default-color":"tag",value:U},null,8,["value"]))),256))])):(N(),q(ve,{key:1,disabled:!0,"default-color":"tag",value:A.$t("navbar.side.filters.tag.empty")},null,8,["value"]))]),_:1})]),_:1}),x(dt,null,{default:v(()=>[x(st,{cols:"6"},{default:v(()=>[Y("div",null,G(A.$t("torrentDetail.overview.selectedFileSize"))+":",1),Y("div",null,G(D(Vt)(A.torrent.size,D(l).useBinarySize))+" / "+G(D(Vt)(A.torrent.total_size,D(l).useBinarySize)),1)]),_:1}),x(st,{cols:"6"},{default:v(()=>[Y("div",null,G(A.$t("torrentDetail.overview.ratio"))+":",1),Y("div",{class:gs(M.value)},G(A.torrent.ratio),3)]),_:1})]),_:1}),x(dt,null,{default:v(()=>[x(st,{cols:"6"},{default:v(()=>[Y("div",null,G(A.$t("torrentDetail.overview.downloaded"))+":",1),Y("div",null,G(D(Vt)(A.torrent.downloaded,D(l).useBinarySize)),1)]),_:1}),x(st,{cols:"6"},{default:v(()=>[Y("div",null,G(A.$t("torrentDetail.overview.uploaded"))+":",1),Y("div",null,G(D(Vt)(A.torrent.uploaded,D(l).useBinarySize)),1)]),_:1})]),_:1}),x(dt,null,{default:v(()=>[x(st,{cols:"6"},{default:v(()=>[Y("div",null,G(A.$t("torrentDetail.overview.dlSpeedAverage"))+":",1),Y("div",null,G(D(fe)(m.value,D(l).useBitSpeed)),1)]),_:1}),x(st,{cols:"6"},{default:v(()=>[Y("div",null,G(A.$t("torrentDetail.overview.upSpeedAverage"))+":",1),Y("div",null,G(D(fe)(C.value,D(l).useBitSpeed)),1)]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})):Rt("",!0)}});cc={class:"mt-2 mx-3 d-flex flex-gap align-center"};dc={class:"text-grey"};fc={key:0};pc={key:1};mc={key:0};gc={key:2,class:"text-grey"};_c=["title"];yc={key:0};xc=["alt","src","title"];bc=["title"];vc=["title"];wc={key:1};Cc={class:"text-download"};Ac={class:"text-upload"};Sc={class:"d-flex my-3 flex-gap align-center justify-center"};Tc=vt({__name:"Peers",props:{torrent:{},isActive:{type:Boolean}},setup(r){const t=r,{t:e}=ee(),s=jo(),i=qo(),n=Wt();function o(R,A){const $=R.ip.split(".").map(Number),U=A.ip.split(".").map(Number);for(let X=0;X<4;X++)if($[X]!==U[X])return $[X]-U[X];return R.port-A.port}function a(R,A){return R.country&&!A.country?-1:!R.country&&A.country?1:R.country===A.country?o(R,A):R.country.localeCompare(A.country)}const l=ko([{nowrap:!0,key:"actions",sortable:!1},{nowrap:!0,title:e("torrentDetail.peers.fields.country"),key:"country",sortRaw:a},{nowrap:!0,title:e("torrentDetail.peers.fields.host"),key:"host",sortRaw:o},{nowrap:!0,title:e("torrentDetail.peers.fields.progress"),key:"progress"},{nowrap:!0,title:e("torrentDetail.peers.fields.download"),key:"dl_speed"},{nowrap:!0,title:e("torrentDetail.peers.fields.upload"),key:"up_speed"},{nowrap:!0,title:e("torrentDetail.peers.fields.flags"),key:"flags"},{nowrap:!0,title:e("torrentDetail.peers.fields.client"),key:"client"},{nowrap:!0,title:e("torrentDetail.peers.fields.relevance"),key:"relevance"},{nowrap:!0,title:e("torrentDetail.peers.fields.files"),key:"files"}]),u=Ki([{key:"dl_speed",order:"desc"},{key:"up_speed",order:"desc"}]),h=pt(),c=pt(new Map),g=pt(!1),d=pt(""),m=pt(!1),_=pt(""),p=Z(()=>Array.from(c.value.entries()).map(([R,A])=>({...A,host:R})));function b(R){Object.entries(R).forEach(([A,$])=>{const U=c.value.get(A);c.value.set(A,{...U,...$})})}function C(R){R.forEach(A=>c.value.delete(A))}async function T(){const R=await s.syncTorrentPeers(t.torrent.hash,h.value);h.value=R.rid,g.value=R.show_flags??g.value,R.full_update?c.value=new Map(Object.entries(R.peers)):(R.peers_removed&&C(R.peers_removed),R.peers&&b(R.peers))}async function F(){_.value.length&&(await s.addTorrentPeers(t.torrent.hash,_.value.split(`
|
|
`)),L(),B())}function B(){m.value=!1,_.value=""}async function M(R){await s.banPeers([R.host]),await i.fetchPreferences(),L()}const{isActive:E,pause:O,resume:L}=Cs(T,2e3,{immediate:!0,immediateCallback:!0});return Je(()=>t.isActive,R=>{R?L():O()}),Zi(()=>!m.value),(R,A)=>(N(),q(Ht,null,{default:v(()=>[c.value.size?(N(),q(rn,{key:1,headers:D(l),items:p.value,"multi-sort":"","sort-by":D(u),search:d.value,"filter-keys":["host","client","files"],mobile:null},{top:v(()=>[Y("div",cc,[x(Jt,{modelValue:d.value,"onUpdate:modelValue":A[0]||(A[0]=$=>d.value=$),density:"compact",label:R.$t("common.search"),"prepend-inner-icon":"mdi-magnify",flat:"","hide-details":"","single-line":"",clearable:""},null,8,["modelValue","label"]),x(_s,{text:D(E)?R.$t("common.pause"):R.$t("common.resume"),location:"bottom"},{activator:v(({props:$})=>[x(ht,Se($,{icon:D(E)?"mdi-timer-pause":"mdi-timer-play",color:"primary",onClick:A[1]||(A[1]=U=>D(E)?D(O)():D(L)())}),null,16,["icon"])]),_:1},8,["text"])])]),"item.host":v(({item:$})=>[W(G($.ip),1),Y("span",dc,":"+G($.port),1)]),"item.client":v(({item:$})=>[$.connection?(N(),j("span",fc,"["+G($.connection)+"]\xa0",1)):Rt("",!0),$.client?(N(),j("span",pc,[W(G($.client)+" ",1),$.peer_id_client?(N(),j("span",mc,"("+G($.peer_id_client)+")",1)):Rt("",!0)])):(N(),j("span",gc,"?????"))]),"item.actions":v(({item:$})=>[x(ht,{color:"red",icon:"mdi-cancel",variant:"text",onClick:U=>M($)},null,8,["onClick"])]),"item.country":v(({item:$})=>[g.value?(N(),j("div",{key:0,class:"cursor-help",title:$.country},[$.country_code?D(Ko)?(N(),j("img",{key:1,alt:D(Es)($.country_code).char,src:D(Es)($.country_code).url,title:$.country,style:{"max-width":"32px"}},null,8,xc)):(N(),j("span",{key:2,title:$.country},G(D(Es)($.country_code).char),9,bc)):(N(),j("span",yc))],8,_c)):Rt("",!0)]),"item.flags":v(({item:$})=>[$.flags?(N(),j("div",{key:0,class:"cursor-help",title:$.flags_desc},G($.flags),9,vc)):(N(),j("div",wc,G(R.$t("common.none")),1))]),"item.dl_speed":v(({item:$})=>[Y("span",Cc,G(D(fe)($.dl_speed,D(n).useBitSpeed))+" ("+G(D(Vt)($.downloaded,D(n).useBinarySize))+") ",1)]),"item.up_speed":v(({item:$})=>[Y("span",Ac,G(D(fe)($.up_speed,D(n).useBitSpeed))+" ("+G(D(Vt)($.uploaded,D(n).useBinarySize))+") ",1)]),"item.progress":v(({item:$})=>[x(sn,{"model-value":$.progress,max:1,height:20,rounded:"sm",style:{width:"8em"},color:$.progress===1?"torrent-ul_stalled":"torrent-downloading"},{default:v(()=>[W(G(D(ir)($.progress)),1)]),_:2},1032,["model-value","color"])]),"item.relevance":v(({item:$})=>[W(G(D(ir)($.relevance)),1)]),_:2},1032,["headers","items","sort-by","search"])):(N(),q(nr,{key:0,title:R.$t("torrentDetail.peers.empty"),icon:"mdi-account-sync",color:"accent"},null,8,["title"])),Y("div",Sc,[x(We,{modelValue:m.value,"onUpdate:modelValue":A[3]||(A[3]=$=>m.value=$),"max-width":"750px"},{activator:v(({props:$})=>[x(ht,Se($,{variant:"flat",text:D(e)("torrentDetail.peers.addPeers.title"),color:"accent"}),null,16,["text"])]),default:v(()=>[x(Ht,{title:R.$t("torrentDetail.peers.addPeers.title")},{default:v(()=>[x(pe,null,{default:v(()=>[x(nn,{modelValue:_.value,"onUpdate:modelValue":A[2]||(A[2]=$=>_.value=$),label:D(e)("torrentDetail.peers.addPeers.newPeers"),placeholder:D(e)("torrentDetail.peers.addPeers.newPeersPlaceholder"),hint:D(e)("torrentDetail.peers.addPeers.newPeersHint")},null,8,["modelValue","label","placeholder","hint"])]),_:1}),x(Xe,null,{default:v(()=>[x(ke),x(ht,{color:"error",onClick:B},{default:v(()=>[W(G(D(e)("common.cancel")),1)]),_:1}),x(ht,{color:"accent",onClick:F},{default:v(()=>[W(G(D(e)("common.ok")),1)]),_:1})]),_:1})]),_:1},8,["title"])]),_:1},8,["modelValue"])])]),_:1}))}});kc=vt({__name:"TagsAndCategories",props:{torrent:{},isActive:{type:Boolean}},setup(r){const t=r,e=Zo(),s=Qo(),i=Ts();async function n(a){t.torrent.category===a?await i.setTorrentCategory([t.torrent.hash],""):await i.setTorrentCategory([t.torrent.hash],a)}async function o(a){t.torrent.tags?.includes(a)?await i.removeTorrentTags([t.torrent.hash],[a]):await i.addTorrentTags([t.torrent.hash],[a])}return(a,l)=>(N(),q(Ht,null,{default:v(()=>[x(pe,null,{default:v(()=>[x(dt,null,{default:v(()=>[x(st,{cols:"12",md:"6"},{default:v(()=>[x(ys,null,{default:v(()=>[x(Hr,null,{default:v(()=>[W(G(a.$t("torrentDetail.tagsAndCategories.tags")),1)]),_:1}),(N(!0),j(Pt,null,$t(D(s).tags,u=>(N(),q(je,{variant:"text",color:"accent",title:u,active:a.torrent.tags?.includes(u),onClick:h=>o(u)},null,8,["title","active","onClick"]))),256))]),_:1})]),_:1}),x(st,{cols:"12",md:"6"},{default:v(()=>[x(ys,null,{default:v(()=>[x(Hr,null,{default:v(()=>[W(G(a.$t("torrentDetail.tagsAndCategories.categories")),1)]),_:1}),(N(!0),j(Pt,null,$t(D(e).categories,u=>(N(),q(je,{variant:"text",color:"accent",title:u.name,active:u.name===t.torrent.category,onClick:h=>n(u.name)},null,8,["title","active","onClick"]))),256))]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}))}});Pc={class:"mt-2 mx-3 d-flex flex-gap align-center"};Mc={key:0};Ic={key:0};Ec={key:1};Dc={class:"d-flex my-3 flex-gap align-center justify-center"};Rc={class:"text-h5"};Fc=vt({__name:"Trackers",props:{torrent:{},isActive:{type:Boolean}},setup(r){const t=r,{t:e}=ee(),s=Ts(),i=Jo(),n=[{nowrap:!0,title:e("torrentDetail.trackers.fields.tier"),key:"tier"},{nowrap:!0,title:e("torrentDetail.trackers.fields.url"),key:"url"},{nowrap:!0,title:e("torrentDetail.trackers.fields.status"),key:"status"},{nowrap:!0,title:e("torrentDetail.trackers.fields.num_seeds"),key:"num_seeds"},{nowrap:!0,title:e("torrentDetail.trackers.fields.num_peers"),key:"num_peers"},{nowrap:!0,title:e("torrentDetail.trackers.fields.num_downloaded"),key:"num_downloaded"},{nowrap:!0,title:e("torrentDetail.trackers.fields.num_leeches"),key:"num_leeches"},{nowrap:!0,title:e("torrentDetail.trackers.fields.msg"),key:"msg"},{nowrap:!0,key:"actions",sortable:!1}],o=Ki([{key:"tier",order:"asc"},{key:"url",order:"asc"}]),a=pt("");function l(X){switch(X){case le.DISABLED:return e("constants.trackerStatus.disabled");case le.NOT_YET_CONTACTED:return e("constants.trackerStatus.not_yet_contacted");case le.WORKING:return e("constants.trackerStatus.working");case le.UPDATING:return e("constants.trackerStatus.updating");case le.NOT_WORKING:return e("constants.trackerStatus.not_working");default:return""}}const u=pt(!1),h=pt(!1),c=pt([]),g=pt(""),d=pt(!1),m=[X=>!!X||e("torrentDetail.trackers.editTracker.newUrlRequired")],_=bs({isVisible:!1,isFormValid:!1,oldUrl:"",newUrl:""});function p(X){_.isVisible=!0,_.oldUrl=X.url,_.newUrl=X.url,Ue(()=>{document.getElementById("input")?.select()})}async function b(){u.value=!0,h.value=!1;try{c.value=await i.getTorrentTrackers(t.torrent.hash)}catch{h.value=!0}finally{u.value=!1}}const C=Ji(function*(){yield b()}).drop();async function T(){g.value.length&&(await i.addTorrentTrackers(t.torrent.hash,g.value),U(),F())}function F(){d.value=!1,g.value=""}async function B(){_.isFormValid&&(await i.editTorrentTracker(t.torrent.hash,_.oldUrl,_.newUrl),_.isVisible=!1,U())}async function M(X){await i.removeTorrentTrackers(t.torrent.hash,[X.url]),U()}async function E(){await s.reannounceTorrents([t.torrent.hash])}const O=pt(!1),{isActive:L,resume:R,pause:A}=Cs(C.perform,5e3,{immediate:!0,immediateCallback:!0});function $(){O.value=!0,A()}function U(){O.value=!1,R()}return Je(()=>t.isActive,X=>{X&&!O.value?U():$()}),ts(()=>{t.isActive&&U()}),vs(()=>{$()}),Zi(()=>!d.value&&!_.isVisible),(X,tt)=>(N(),j(Pt,null,[x(Ht,null,{default:v(()=>[!c.value.length&&u.value?(N(),q(nr,{key:0,title:X.$t("torrentDetail.trackers.loading"),icon:"mdi-web-sync",color:"accent"},null,8,["title"])):!c.value.length&&h.value?(N(),q(nr,{key:1,title:X.$t("torrentDetail.trackers.error"),icon:"mdi-web-remove",color:"error"},null,8,["title"])):(N(),q(rn,{key:2,headers:n,items:c.value,"multi-sort":"","sort-by":D(o),search:a.value,"filter-keys":["url","msg"],mobile:null},{top:v(()=>[Y("div",Pc,[x(Jt,{modelValue:a.value,"onUpdate:modelValue":tt[0]||(tt[0]=f=>a.value=f),density:"compact",label:X.$t("common.search"),"prepend-inner-icon":"mdi-magnify",flat:"","hide-details":"","single-line":"",clearable:""},null,8,["modelValue","label"]),x(_s,{text:D(L)?X.$t("common.pause"):X.$t("common.resume"),location:"bottom"},{activator:v(({props:f})=>[x(ht,Se(f,{icon:D(L)?"mdi-timer-pause":"mdi-timer-play",color:"primary",onClick:tt[1]||(tt[1]=y=>D(L)?$():U())}),null,16,["icon"])]),_:1},8,["text"])])]),"item.tier":v(({value:f})=>[f>=0?(N(),j("span",Mc,G(f),1)):Rt("",!0)]),"item.status":v(({value:f})=>[Y("span",{class:gs(`tracker-${D(le)[f].toLowerCase()}`)},G(l(f)),3)]),"item.msg":v(({value:f})=>[f?(N(),j("span",Ec,G(f),1)):(N(),j("span",Ic,G(X.$t("common.NA")),1))]),"item.actions":v(({item:f})=>[f.tier!==-1?(N(),j(Pt,{key:0},[x(ht,{icon:"mdi-pencil",variant:"text",onClick:y=>p(f)},null,8,["onClick"]),x(ht,{color:"red",icon:"mdi-delete",variant:"text",onClick:y=>M(f)},null,8,["onClick"])],64)):Rt("",!0)]),_:2},1032,["items","sort-by","search"])),Y("div",Dc,[x(We,{modelValue:d.value,"onUpdate:modelValue":tt[3]||(tt[3]=f=>d.value=f),"max-width":"750px"},{activator:v(({props:f})=>[x(ht,Se(f,{variant:"flat",text:D(e)("torrentDetail.trackers.addTrackers.title"),color:"accent"}),null,16,["text"])]),default:v(()=>[x(Ht,{title:X.$t("torrentDetail.trackers.addTrackers.title")},{default:v(()=>[x(pe,null,{default:v(()=>[x(nn,{modelValue:g.value,"onUpdate:modelValue":tt[2]||(tt[2]=f=>g.value=f),label:D(e)("torrentDetail.trackers.addTrackers.newTrackers"),hint:D(e)("torrentDetail.trackers.addTrackers.newTrackersHint")},null,8,["modelValue","label","hint"])]),_:1}),x(Xe,null,{default:v(()=>[x(ke),x(ht,{color:"error",onClick:F},{default:v(()=>[W(G(D(e)("common.cancel")),1)]),_:1}),x(ht,{color:"accent",onClick:T},{default:v(()=>[W(G(D(e)("common.ok")),1)]),_:1})]),_:1})]),_:1},8,["title"])]),_:1},8,["modelValue"]),x(ht,{variant:"flat",disabled:c.value.length===3,text:D(e)("torrentDetail.trackers.reannounce"),color:"primary",onClick:E},null,8,["disabled","text"])])]),_:1}),x(We,{modelValue:_.isVisible,"onUpdate:modelValue":tt[8]||(tt[8]=f=>_.isVisible=f),"max-width":"750px"},{default:v(()=>[x(Ht,null,{default:v(()=>[x(As,null,{default:v(()=>[Y("span",Rc,G(D(e)("torrentDetail.trackers.editTracker.title")),1)]),_:1}),x(pe,null,{default:v(()=>[x(en,{modelValue:_.isFormValid,"onUpdate:modelValue":tt[5]||(tt[5]=f=>_.isFormValid=f),onSubmit:tt[6]||(tt[6]=He(()=>{},["prevent"]))},{default:v(()=>[x(Jt,{"model-value":_.oldUrl,disabled:"",label:X.$t("torrentDetail.trackers.editTracker.oldUrl")},null,8,["model-value","label"]),x(Jt,{modelValue:_.newUrl,"onUpdate:modelValue":tt[4]||(tt[4]=f=>_.newUrl=f),id:"input",rules:m,label:X.$t("torrentDetail.trackers.editTracker.newUrl"),autofocus:"",onKeydown:Wi(B,["enter"])},null,8,["modelValue","label"])]),_:1},8,["modelValue"])]),_:1}),x(Xe,null,{default:v(()=>[x(ke),x(ht,{color:"error",disabled:!_.isFormValid,onClick:tt[7]||(tt[7]=f=>_.isVisible=!1)},{default:v(()=>[W(G(D(e)("common.cancel")),1)]),_:1},8,["disabled"]),x(ht,{color:"accent",onClick:B},{default:v(()=>[W(G(D(e)("common.ok")),1)]),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"])],64))}});Bc=Ss(Fc,[["__scopeId","data-v-c5792b64"]]);$c={class:"pa-3 text-select"};Gc={style:{"font-size":"1.6em !important"},class:"subtitle-1 ml-2"};Nc={class:"d-flex justify-end"};Vc=vt({__name:"TorrentDetail",setup(r){const t=Po(),{t:e}=ee(),s=_e(),i=ws(),n=Ts(),o=se(),{tab:a}=yt(o),l=[{text:e("torrentDetail.tabs.overview"),value:"overview"},{text:e("torrentDetail.tabs.info"),value:"info"},{text:e("torrentDetail.tabs.trackers"),value:"trackers"},{text:e("torrentDetail.tabs.peers"),value:"peers"},{text:e("torrentDetail.tabs.content"),value:"content"},{text:e("torrentDetail.tabs.tagsAndCategories"),value:"tagsAndCategories"}],u=Z(()=>t.currentRoute.value.params.hash),h=Z(()=>n.getTorrentByHash(u.value)),c=()=>{t.push({name:"dashboard"})};function g(m){if(i.hasActiveDialog)return!1;m.key==="Escape"&&c()}function d(){const m=t.currentRoute.value.params.tab;m&&(a.value=m)}return Yi(()=>{d()}),Je(h,()=>{o.fetchProperties(u.value)}),ts(()=>{document.addEventListener("keydown",g),d(),o.fetchProperties(u.value),s.updateFileTreeTask.perform().then(()=>s.expandAll())}),vs(()=>{document.removeEventListener("keydown",g),o.$reset()}),(m,_)=>(N(),j(Pt,null,[Y("div",$c,[x(dt,{"no-gutters":"",align:"center",justify:"center"},{default:v(()=>[x(st,null,{default:v(()=>[Y("h1",Gc,G(D(e)("torrentDetail.title")),1)]),_:1}),x(st,null,{default:v(()=>[Y("div",Nc,[x(ht,{icon:"mdi-close",variant:"plain",onClick:c})])]),_:1})]),_:1}),x(dt,{class:"ma-0 pa-0"},{default:v(()=>[x(ea,{modelValue:D(a),"onUpdate:modelValue":_[0]||(_[0]=p=>Ye(a)?a.value=p:null),"bg-color":"primary",grow:"","show-arrows":""},{default:v(()=>[(N(),j(Pt,null,$t(l,({text:p,value:b})=>x(sa,{value:b,text:p,replace:"",to:{name:"torrentDetail",params:{hash:u.value,tab:b}}},null,8,["value","text","to"])),64))]),_:1},8,["modelValue"])]),_:1}),h.value?(N(),q(ta,{key:0,modelValue:D(a),"onUpdate:modelValue":_[1]||(_[1]=p=>Ye(a)?a.value=p:null),touch:!1},{default:v(()=>[x(xe,{value:"overview"},{default:v(()=>[x(uc,{torrent:h.value,"is-active":D(a)==="overview"},null,8,["torrent","is-active"])]),_:1}),x(xe,{value:"info"},{default:v(()=>[x(Da,{torrent:h.value,"is-active":D(a)==="info"},null,8,["torrent","is-active"])]),_:1}),x(xe,{value:"trackers"},{default:v(()=>[x(Bc,{torrent:h.value,"is-active":D(a)==="trackers"},null,8,["torrent","is-active"])]),_:1}),x(xe,{value:"peers"},{default:v(()=>[x(Tc,{torrent:h.value,"is-active":D(a)==="peers"},null,8,["torrent","is-active"])]),_:1}),x(xe,{value:"content"},{default:v(()=>[x(D(xa),{torrent:h.value,"is-active":D(a)==="content"},null,8,["torrent","is-active"])]),_:1}),x(xe,{value:"tagsAndCategories"},{default:v(()=>[x(kc,{torrent:h.value,"is-active":D(a)==="tagsAndCategories"},null,8,["torrent","is-active"])]),_:1})]),_:1},8,["modelValue"])):Rt("",!0)]),Y("div",{style:ji(`position: absolute; left: ${D(s).rightClickProperties.offset[0]}px; top: ${D(s).rightClickProperties.offset[1]}px;`)},[x(D(wo),{modelValue:D(s).rightClickProperties.isVisible,"onUpdate:modelValue":_[2]||(_[2]=p=>D(s).rightClickProperties.isVisible=p),"menu-data":D(s).menuData},null,8,["modelValue","menu-data"])],4)],64))}});Yc=Object.freeze(Object.defineProperty({__proto__:null,default:Vc},Symbol.toStringTag,{value:"Module"}))});export{Ls as $,Kn as A,Mt as B,Tt as C,ne as D,lt as E,te as F,Ps as G,_n as H,Cl as I,Xt as J,ai as K,qe as L,it as M,ql as N,ih as O,St as P,_t as Q,mr as R,kh as S,ns as T,dr as U,Ct as V,lh as W,hi as X,ci as Y,Tl as Z,la as _,re as a,Ft as a0,bn as a1,Zn as a2,ft as a3,gt as a4,fh as a5,Rh as a6,Qh as a7,tu as a8,nu as a9,au as aa,lu as ab,Be as ac,Ve as ad,Ui as ae,ph as af,mh as ag,Pr as ah,Ae as ai,Me as aj,fo as ak,Ai as al,wi as am,Wa as an,xs as ao,qa as ap,go as aq,Yc as ar,Ah as b,Ze as c,ps as d,jt as e,Ci as f,aa as g,Mr as h,Wn as i,En as j,qt as k,Xn as l,Zh as m,qr as n,Jh as o,ru as p,so as q,ll as r,ou as s,Ir as t,_e as u,ut as v,Yt as w,Ln as x,ja as y,uu as z,__tla}; |