@annotorious/openseadragon 3.0.0-rc.8 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/Annotorious.d.ts +5 -6
  2. package/dist/annotation/index.d.ts +0 -1
  3. package/dist/annotation/pixi/PixiLayer.svelte.d.ts +1 -1
  4. package/dist/annotation/pixi/PixiLayerClickEvent.d.ts +1 -2
  5. package/dist/annotation/pixi/PixiLayerConfiguration.d.ts +1 -2
  6. package/dist/annotation/pixi/index.d.ts +0 -1
  7. package/dist/annotation/pixi/stageRenderer.d.ts +9 -8
  8. package/dist/annotation/svg/OSDLayer.svelte.d.ts +1 -1
  9. package/dist/annotation/svg/drawing/OSDToolMount.svelte.d.ts +1 -1
  10. package/dist/annotation/svg/drawing/SVGDrawingLayer.svelte.d.ts +1 -1
  11. package/dist/annotation/svg/index.d.ts +0 -1
  12. package/dist/annotation/svg/presence/SVGPresenceLabel.svelte.d.ts +1 -1
  13. package/dist/annotation/svg/presence/SVGPresenceLayer.svelte.d.ts +1 -1
  14. package/dist/annotation/svg/presence/shapes/PresencePolygon.svelte.d.ts +1 -1
  15. package/dist/annotation/svg/presence/shapes/PresenceRectangle.svelte.d.ts +1 -1
  16. package/dist/annotorious-openseadragon.css +1 -1
  17. package/dist/annotorious-openseadragon.es.js +29943 -20537
  18. package/dist/annotorious-openseadragon.es.js.map +1 -1
  19. package/dist/annotorious-openseadragon.js +627 -1038
  20. package/dist/annotorious-openseadragon.js.map +1 -1
  21. package/dist/api/fitBounds.d.ts +2 -3
  22. package/dist/api/index.d.ts +0 -1
  23. package/dist/index.d.ts +7 -15
  24. package/dist/themes/index.d.ts +1 -0
  25. package/dist/themes/setTheme.d.ts +2 -3
  26. package/package.json +17 -16
  27. package/dist/Annotorious.d.ts.map +0 -1
  28. package/dist/annotation/index.d.ts.map +0 -1
  29. package/dist/annotation/pixi/PixiLayerClickEvent.d.ts.map +0 -1
  30. package/dist/annotation/pixi/PixiLayerConfiguration.d.ts.map +0 -1
  31. package/dist/annotation/pixi/index.d.ts.map +0 -1
  32. package/dist/annotation/pixi/stageRenderer.d.ts.map +0 -1
  33. package/dist/annotation/svg/index.d.ts.map +0 -1
  34. package/dist/api/fitBounds.d.ts.map +0 -1
  35. package/dist/api/index.d.ts.map +0 -1
  36. package/dist/index.d.ts.map +0 -1
  37. package/dist/themes/setTheme.d.ts.map +0 -1
@@ -1,180 +1,89 @@
1
- (function(te,Fe){typeof exports=="object"&&typeof module<"u"?Fe(exports,require("openseadragon")):typeof define=="function"&&define.amd?define(["exports","openseadragon"],Fe):(te=typeof globalThis<"u"?globalThis:te||self,Fe(te.AnnotoriousOSD={},te.OpenSeadragon))})(this,function(te,Fe){"use strict";var bs=Object.prototype.hasOwnProperty;function qe(r,t){var e,n;if(r===t)return!0;if(r&&t&&(e=r.constructor)===t.constructor){if(e===Date)return r.getTime()===t.getTime();if(e===RegExp)return r.toString()===t.toString();if(e===Array){if((n=r.length)===t.length)for(;n--&&qe(r[n],t[n]););return n===-1}if(!e||typeof r=="object"){n=0;for(e in r)if(bs.call(r,e)&&++n&&!bs.call(t,e)||!(e in t)||!qe(r[e],t[e]))return!1;return Object.keys(t).length===n}}return r!==r&&t!==t}function Wi(){}function wf(r,t){return r!=r?t==t:r!==t||r&&typeof r=="object"||typeof r=="function"}const mr=[];function qi(r,t=Wi){let e;const n=new Set;function i(s){if(wf(r,s)&&(r=s,e)){const u=!mr.length;for(const h of n)h[1](),mr.push(h,r);if(u){for(let h=0;h<mr.length;h+=2)mr[h][0](mr[h+1]);mr.length=0}}}function o(s){i(s(r))}function a(s,u=Wi){const h=[s,u];return n.add(h),n.size===1&&(e=t(i)||Wi),s(r),()=>{n.delete(h),n.size===0&&e&&(e(),e=null)}}return{set:i,update:o,subscribe:a}}const Sf=r=>{const{subscribe:t,set:e}=qi(null);let n=null;return t(i=>n=i),r.observe(({changes:i})=>{if(n){i.deleted.some(a=>a.id===n)&&e(null);const o=i.updated.find(({oldValue:a})=>a.id===n);o&&e(o.newValue.id)}}),{get current(){return n},subscribe:t,set:e}};var xs=(r=>(r.EDIT="EDIT",r.SELECT="SELECT",r.NONE="NONE",r))(xs||{});const $i={selected:[]},Af=(r,t="EDIT")=>{const{subscribe:e,set:n}=qi($i);let i=$i;e(f=>i=f);const o=()=>n($i),a=()=>{var f;return((f=i.selected)==null?void 0:f.length)===0},s=f=>{if(i.selected.length===0)return!1;const c=typeof f=="string"?f:f.id;return i.selected.some(d=>d.id===c)},u=(f,c)=>{const d=r.getAnnotation(f);if(d){const p=Pf(d,t);n(p==="EDIT"?{selected:[{id:f,editable:!0}],pointerEvent:c}:p==="SELECT"?{selected:[{id:f}],pointerEvent:c}:{selected:[],pointerEvent:c})}else console.warn("Invalid selection: "+f)},h=(f,c=!0)=>{const d=Array.isArray(f)?f:[f],p=d.map(v=>r.getAnnotation(v)).filter(v=>v);n({selected:p.map(({id:v})=>({id:v,editable:c}))}),p.length!==d.length&&console.warn("Invalid selection",f)},l=f=>{if(i.selected.length===0)return!1;const{selected:c}=i;c.filter(({id:d})=>f.includes(d)).length>0&&n({selected:c.filter(({id:d})=>!f.includes(d))})};return r.observe(({changes:f})=>l(f.deleted.map(c=>c.id))),{clear:o,clickSelect:u,get selected(){return i?[...i.selected]:null},get pointerEvent(){return i?i.pointerEvent:null},isEmpty:a,isSelected:s,setSelected:h,subscribe:e}},Pf=(r,t)=>typeof t=="function"?t(r)||"EDIT":t||"EDIT",Of=[];for(let r=0;r<256;++r)Of.push((r+256).toString(16).slice(1));typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Rf=(r,t)=>{const e=new Set(r.bodies.map(n=>n.id));return t.bodies.filter(n=>!e.has(n.id))},If=(r,t)=>{const e=new Set(t.bodies.map(n=>n.id));return r.bodies.filter(n=>!e.has(n.id))},Cf=(r,t)=>t.bodies.map(e=>{const n=r.bodies.find(i=>i.id===e.id);return{newBody:e,oldBody:n&&!qe(n,e)?n:void 0}}).filter(({oldBody:e})=>e),Mf=(r,t)=>!qe(r.target,t.target),Es=(r,t)=>{const e=Rf(r,t),n=If(r,t),i=Cf(r,t);return{oldValue:r,newValue:t,bodiesCreated:e.length>0?e:void 0,bodiesDeleted:n.length>0?n:void 0,bodiesUpdated:i.length>0?i:void 0,targetUpdated:Mf(r,t)?{oldTarget:r.target,newTarget:t.target}:void 0}};var Ot=(r=>(r.LOCAL="LOCAL",r.REMOTE="REMOTE",r))(Ot||{});const Df=(r,t)=>{var e,n;const{changes:i,origin:o}=t;if(!(!r.options.origin||r.options.origin===o))return!1;if(r.options.ignore){const{ignore:a}=r.options,s=u=>(u==null?void 0:u.length)>0;if(!(s(i.created)||s(i.deleted))){const u=(e=i.updated)==null?void 0:e.some(l=>s(l.bodiesCreated)||s(l.bodiesDeleted)||s(l.bodiesUpdated)),h=(n=i.updated)==null?void 0:n.some(l=>l.targetUpdated);if(a==="BODY_ONLY"&&u&&!h||a==="TARGET_ONLY"&&h&&!u)return!1}}if(r.options.annotations){const a=new Set([...i.created.map(s=>s.id),...i.deleted.map(s=>s.id),...i.updated.map(({oldValue:s})=>s.id)]);return!!(Array.isArray(r.options.annotations)?r.options.annotations:[r.options.annotations]).find(s=>a.has(s))}else return!0},Ff=(r,t)=>{const e=new Set((r.created||[]).map(f=>f.id)),n=new Set((r.updated||[]).map(({newValue:f})=>f.id)),i=new Set((t.created||[]).map(f=>f.id)),o=new Set((t.deleted||[]).map(f=>f.id)),a=new Set((t.updated||[]).map(({oldValue:f})=>f.id)),s=new Set((t.updated||[]).filter(({oldValue:f})=>e.has(f.id)||n.has(f.id)).map(({oldValue:f})=>f.id)),u=[...(r.created||[]).filter(f=>!o.has(f.id)).map(f=>a.has(f.id)?t.updated.find(({oldValue:c})=>c.id===f.id).newValue:f),...t.created||[]],h=[...(r.deleted||[]).filter(f=>!i.has(f.id)),...(t.deleted||[]).filter(f=>!e.has(f.id))],l=[...(r.updated||[]).filter(({newValue:f})=>!o.has(f.id)).map(f=>{const{oldValue:c,newValue:d}=f;if(a.has(d.id)){const p=t.updated.find(v=>v.oldValue.id===d.id).newValue;return Es(c,p)}else return f}),...(t.updated||[]).filter(({oldValue:f})=>!s.has(f.id))];return{created:u,deleted:h,updated:l}},Bf=r=>r.id!==void 0,Nf=()=>{const r=new Map,t=new Map,e=[],n=(T,x={})=>e.push({onChange:T,options:x}),i=T=>{const x=e.findIndex(w=>w.onChange==T);x>-1&&e.splice(x,1)},o=(T,x)=>{const w={origin:T,changes:{created:x.created||[],updated:x.updated||[],deleted:x.deleted||[]},state:[...r.values()]};e.forEach(O=>{Df(O,w)&&O.onChange(w)})},a=(T,x=Ot.LOCAL)=>{if(r.get(T.id))throw Error(`Cannot add annotation ${T.id} - exists already`);r.set(T.id,T),T.bodies.forEach(w=>t.set(w.id,T.id)),o(x,{created:[T]})},s=(T,x)=>{const w=typeof T=="string"?x:T,O=typeof T=="string"?T:T.id,I=r.get(O);if(I){const C=Es(I,w);return O===w.id?r.set(O,w):(r.delete(O),r.set(w.id,w)),I.bodies.forEach(G=>t.delete(G.id)),w.bodies.forEach(G=>t.set(G.id,w.id)),C}else console.warn(`Cannot update annotation ${O} - does not exist`)},u=(T,x=Ot.LOCAL,w=Ot.LOCAL)=>{const O=Bf(x)?w:x,I=s(T,x);I&&o(O,{updated:[I]})},h=(T,x=Ot.LOCAL)=>{const w=T.reduce((O,I)=>{const C=s(I);return C?[...O,C]:O},[]);w.length>0&&o(x,{updated:w})},l=(T,x=Ot.LOCAL)=>{const w=r.get(T.annotation);if(w){const O={...w,bodies:[...w.bodies,T]};r.set(w.id,O),t.set(T.id,O.id),o(x,{updated:[{oldValue:w,newValue:O,bodiesCreated:[T]}]})}else console.warn(`Attempt to add body to missing annotation: ${T.annotation}`)},f=()=>[...r.values()],c=(T=Ot.LOCAL)=>{const x=[...r.values()];r.clear(),t.clear(),o(T,{deleted:x})},d=(T,x=!0,w=Ot.LOCAL)=>{if(x){const O=[...r.values()];r.clear(),t.clear(),T.forEach(I=>{r.set(I.id,I),I.bodies.forEach(C=>t.set(C.id,I.id))}),o(w,{created:T,deleted:O})}else{const O=T.reduce((I,C)=>{const G=r.get(C.id);return G?[...I,G]:I},[]);if(O.length>0)throw Error(`Bulk insert would overwrite the following annotations: ${O.map(I=>I.id).join(", ")}`);T.forEach(I=>{r.set(I.id,I),I.bodies.forEach(C=>t.set(C.id,I.id))}),o(w,{created:T})}},p=T=>{const x=typeof T=="string"?T:T.id,w=r.get(x);if(w)return r.delete(x),w.bodies.forEach(O=>t.delete(O.id)),w;console.warn(`Attempt to delete missing annotation: ${x}`)},v=(T,x=Ot.LOCAL)=>{const w=p(T);w&&o(x,{deleted:[w]})},_=(T,x=Ot.LOCAL)=>{const w=T.reduce((O,I)=>{const C=p(I);return C?[...O,C]:O},[]);w.length>0&&o(x,{deleted:w})},m=(T,x=Ot.LOCAL)=>{const w=r.get(T.annotation);if(w){const O=w.bodies.find(I=>I.id===T.id);if(O){t.delete(O.id);const I={...w,bodies:w.bodies.filter(C=>C.id!==T.id)};r.set(w.id,I),o(x,{updated:[{oldValue:w,newValue:I,bodiesDeleted:[O]}]})}else console.warn(`Attempt to delete missing body ${T.id} from annotation ${T.annotation}`)}else console.warn(`Attempt to delete body from missing annotation ${T.annotation}`)},g=T=>{const x=r.get(T);return x?{...x}:void 0},y=T=>{const x=t.get(T);if(x){const w=g(x).bodies.find(O=>O.id===T);if(w)return w;console.error(`Store integrity error: body ${T} in index, but not in annotation`)}else console.warn(`Attempt to retrieve missing body: ${T}`)},E=(T,x)=>{if(T.annotation!==x.annotation)throw"Annotation integrity violation: annotation ID must be the same when updating bodies";const w=r.get(T.annotation);if(w){const O=w.bodies.find(C=>C.id===T.id),I={...w,bodies:w.bodies.map(C=>C.id===O.id?x:C)};return r.set(w.id,I),O.id!==x.id&&(t.delete(O.id),t.set(x.id,I.id)),{oldValue:w,newValue:I,bodiesUpdated:[{oldBody:O,newBody:x}]}}else console.warn(`Attempt to add body to missing annotation ${T.annotation}`)},b=(T,x,w=Ot.LOCAL)=>{const O=E(T,x);o(w,{updated:[O]})},S=(T,x=Ot.LOCAL)=>{const w=T.map(O=>E({id:O.id,annotation:O.annotation},O));o(x,{updated:w})},P=T=>{const x=r.get(T.annotation);if(x){const w={...x,target:{...x.target,...T}};return r.set(x.id,w),{oldValue:x,newValue:w,targetUpdated:{oldTarget:x.target,newTarget:T}}}else console.warn(`Attempt to update target on missing annotation: ${T.annotation}`)};return{addAnnotation:a,addBody:l,all:f,bulkAddAnnotation:d,bulkDeleteAnnotation:_,bulkUpdateAnnotation:h,bulkUpdateBodies:S,bulkUpdateTargets:(T,x=Ot.LOCAL)=>{const w=T.map(P).filter(O=>O);w.length>0&&o(x,{updated:w})},clear:c,deleteAnnotation:v,deleteBody:m,getAnnotation:g,getBody:y,observe:n,unobserve:i,updateAnnotation:u,updateBody:b,updateTarget:(T,x=Ot.LOCAL)=>{const w=P(T);w&&o(x,{updated:[w]})}}};let Lf=()=>({emit(r,...t){let e=this.events[r]||[];for(let n=0,i=e.length;n<i;n++)e[n](...t)},events:{},on(r,t){var e;return(e=this.events[r])!=null&&e.push(t)||(this.events[r]=[t]),()=>{var n;this.events[r]=(n=this.events[r])==null?void 0:n.filter(i=>t!==i)}}});const Uf=250,Gf=r=>{const t=Lf(),e=[];let n=-1,i=!1,o=0;const a=d=>{if(!i){const{changes:p}=d,v=performance.now();if(v-o>Uf)e.splice(n+1),e.push(p),n=e.length-1;else{const _=e.length-1;e[_]=Ff(e[_],p)}o=v}i=!1};r.observe(a,{origin:Ot.LOCAL});const s=d=>(d==null?void 0:d.length)>0&&r.bulkDeleteAnnotation(d),u=d=>(d==null?void 0:d.length)>0&&r.bulkAddAnnotation(d,!1),h=d=>(d==null?void 0:d.length)>0&&r.bulkUpdateAnnotation(d.map(({oldValue:p})=>p)),l=d=>(d==null?void 0:d.length)>0&&r.bulkUpdateAnnotation(d.map(({newValue:p})=>p)),f=d=>(d==null?void 0:d.length)>0&&r.bulkAddAnnotation(d,!1),c=d=>(d==null?void 0:d.length)>0&&r.bulkDeleteAnnotation(d);return{canRedo:()=>e.length-1>n,canUndo:()=>n>-1,destroy:()=>r.unobserve(a),on:(d,p)=>t.on(d,p),redo:()=>{if(e.length-1>n){i=!0;const{created:d,updated:p,deleted:v}=e[n+1];u(d),l(p),c(v),t.emit("redo",e[n+1]),n+=1}},undo:()=>{if(n>-1){i=!0;const{created:d,updated:p,deleted:v}=e[n];s(d),h(p),f(v),t.emit("undo",e[n]),n-=1}}}},kf=()=>{const{subscribe:r,set:t}=qi([]);return{subscribe:r,set:t}},Xf=(r,t,e,n)=>{const{store:i,selection:o,hover:a,viewport:s}=r,u=new Map;let h=[],l,f;const c=(m,g)=>{u.has(m)?u.get(m).push(g):u.set(m,[g])},d=(m,g)=>{const y=u.get(m);y&&y.indexOf(g)>0&&y.splice(y.indexOf(g),1)},p=(m,g,y)=>{u.has(m)&&setTimeout(()=>{u.get(m).forEach(E=>{if(e){const b=Array.isArray(g)?g.map(P=>e.serialize(P)):e.serialize(g),S=y?y instanceof PointerEvent?y:e.serialize(y):void 0;E(b,S)}else E(g,y)})},1)},v=()=>{const{selected:m}=o,g=m.map(({id:y})=>i.getAnnotation(y));g.forEach(y=>{const E=h.find(b=>b.id===y.id);(!E||!qe(E,y))&&p("updateAnnotation",y,E)}),h=h.map(y=>g.find(({id:b})=>b===y.id)||y)};o.subscribe(({selected:m})=>{if(!(h.length===0&&m.length===0)){if(h.length===0&&m.length>0)h=m.map(({id:g})=>i.getAnnotation(g));else if(h.length>0&&m.length===0)h.forEach(g=>{const y=i.getAnnotation(g.id);y&&!qe(y,g)&&p("updateAnnotation",y,g)}),h=[];else{const g=new Set(h.map(E=>E.id)),y=new Set(m.map(({id:E})=>E));h.filter(E=>!y.has(E.id)).forEach(E=>{const b=i.getAnnotation(E.id);b&&!qe(b,E)&&p("updateAnnotation",b,E)}),h=[...h.filter(E=>y.has(E.id)),...m.filter(({id:E})=>!g.has(E)).map(({id:E})=>i.getAnnotation(E))]}p("selectionChanged",h)}}),a.subscribe(m=>{!l&&m?p("mouseEnterAnnotation",i.getAnnotation(m)):l&&!m?p("mouseLeaveAnnotation",i.getAnnotation(l)):l&&m&&(p("mouseLeaveAnnotation",i.getAnnotation(l)),p("mouseEnterAnnotation",i.getAnnotation(m))),l=m}),s==null||s.subscribe(m=>p("viewportIntersect",m.map(i.getAnnotation))),i.observe(m=>{n&&(f&&clearTimeout(f),f=setTimeout(v,1e3));const{created:g,deleted:y}=m.changes;g.forEach(E=>p("createAnnotation",E)),y.forEach(E=>p("deleteAnnotation",E)),m.changes.updated.filter(E=>[...E.bodiesCreated||[],...E.bodiesDeleted||[],...E.bodiesUpdated||[]].length>0).forEach(({oldValue:E,newValue:b})=>{const S=h.find(P=>P.id===E.id)||E;h=h.map(P=>P.id===E.id?b:P),p("updateAnnotation",b,S)})},{origin:Ot.LOCAL}),i.observe(m=>{if(h){const g=new Set(h.map(E=>E.id)),y=m.changes.updated.filter(({newValue:E})=>g.has(E.id)).map(({newValue:E})=>E);y.length>0&&(h=h.map(E=>y.find(S=>S.id===E.id)||E))}},{origin:Ot.REMOTE});const _=m=>g=>{const{created:y,deleted:E,updated:b}=g;y.forEach(S=>p("createAnnotation",S)),E.forEach(S=>p("deleteAnnotation",S)),m?b.forEach(S=>p("updateAnnotation",S.oldValue,S.newValue)):b.forEach(S=>p("updateAnnotation",S.newValue,S.oldValue))};return t.on("undo",_(!0)),t.on("redo",_(!1)),{on:c,off:d,emit:p}},Hf=r=>t=>t.reduce((e,n)=>{const{parsed:i,error:o}=r.parse(n);return o?{parsed:e.parsed,failed:[...e.failed,n]}:{parsed:[...e.parsed,i],failed:e.failed}},{parsed:[],failed:[]}),jf=(r,t,e)=>{const{store:n,selection:i}=r,o=_=>{if(e){const{parsed:m,error:g}=e.parse(_);m?n.addAnnotation(m,Ot.REMOTE):console.error(g)}else n.addAnnotation(_,Ot.REMOTE)},a=()=>i.clear(),s=()=>n.clear(),u=_=>{const m=n.getAnnotation(_);return e&&m?e.serialize(m):m},h=()=>e?n.all().map(e.serialize):n.all(),l=()=>{var _;const m=(((_=i.selected)==null?void 0:_.map(g=>g.id))||[]).map(g=>n.getAnnotation(g));return e?m.map(e.serialize):m},f=_=>fetch(_).then(m=>m.json()).then(m=>(d(m),m)),c=_=>{if(typeof _=="string"){const m=n.getAnnotation(_);return n.deleteAnnotation(_),e?e.serialize(m):m}else{const m=e?e.parse(_).parsed:_;return n.deleteAnnotation(m),_}},d=_=>{if(e){const{parsed:m,failed:g}=Hf(e)(_);g.length>0&&console.warn(`Discarded ${g.length} invalid annotations`,g),n.bulkAddAnnotation(m,!0,Ot.REMOTE)}else n.bulkAddAnnotation(_,!0,Ot.REMOTE)},p=_=>{_?i.setSelected(_):i.clear()},v=_=>{if(e){const m=e.parse(_).parsed,g=e.serialize(n.getAnnotation(m.id));return n.updateAnnotation(m),g}else{const m=n.getAnnotation(_.id);return n.updateAnnotation(_),m}};return{addAnnotation:o,cancelSelected:a,canRedo:t.canRedo,canUndo:t.canUndo,clearAnnotations:s,getAnnotationById:u,getAnnotations:h,getSelected:l,loadAnnotations:f,redo:t.redo,removeAnnotation:c,setAnnotations:d,setSelected:p,undo:t.undo,updateAnnotation:v}};let Vf=r=>crypto.getRandomValues(new Uint8Array(r)),Yf=(r,t,e)=>{let n=(2<<Math.log(r.length-1)/Math.LN2)-1,i=-~(1.6*n*t/r.length);return(o=t)=>{let a="";for(;;){let s=e(i),u=i;for(;u--;)if(a+=r[s[u]&n]||"",a.length===o)return a}}},zf=(r,t=21)=>Yf(r,t,Vf),Wf=(r=21)=>crypto.getRandomValues(new Uint8Array(r)).reduce((t,e)=>(e&=63,e<36?t+=e.toString(36):e<62?t+=(e-26).toString(36).toUpperCase():e>62?t+="-":t+="_",t),"");const qf=()=>({isGuest:!0,id:zf("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_",20)()});Wf();function ee(){}function $f(r,t){for(const e in t)r[e]=t[e];return r}function Ts(r){return r()}function ws(){return Object.create(null)}function Be(r){r.forEach(Ts)}function Xt(r){return typeof r=="function"}function Ht(r,t){return r!=r?t==t:r!==t||r&&typeof r=="object"||typeof r=="function"}function Kf(r){return Object.keys(r).length===0}function Zf(r,...t){if(r==null)return ee;const e=r.subscribe(...t);return e.unsubscribe?()=>e.unsubscribe():e}function Ki(r,t,e){r.$$.on_destroy.push(Zf(t,e))}function Ss(r,t,e,n){if(r){const i=As(r,t,e,n);return r[0](i)}}function As(r,t,e,n){return r[1]&&n?$f(e.ctx.slice(),r[1](n(t))):e.ctx}function Ps(r,t,e,n){if(r[2]&&n){const i=r[2](n(e));if(t.dirty===void 0)return i;if(typeof i=="object"){const o=[],a=Math.max(t.dirty.length,i.length);for(let s=0;s<a;s+=1)o[s]=t.dirty[s]|i[s];return o}return t.dirty|i}return t.dirty}function Os(r,t,e,n,i,o){if(i){const a=As(t,e,n,o);r.p(a,i)}}function Rs(r){if(r.ctx.length>32){const t=[],e=r.ctx.length/32;for(let n=0;n<e;n++)t[n]=-1;return t}return-1}const Jf=typeof window<"u"?window:typeof globalThis<"u"?globalThis:global;function $e(r,t){r.appendChild(t)}function Z(r,t,e){r.insertBefore(t,e||null)}function $(r){r.parentNode&&r.parentNode.removeChild(r)}function Zi(r,t){for(let e=0;e<r.length;e+=1)r[e]&&r[e].d(t)}function ft(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function Ji(r){return document.createTextNode(r)}function re(){return Ji(" ")}function Ne(){return Ji("")}function Yt(r,t,e,n){return r.addEventListener(t,e,n),()=>r.removeEventListener(t,e,n)}function A(r,t,e){e==null?r.removeAttribute(t):r.getAttribute(t)!==e&&r.setAttribute(t,e)}function Qf(r){return Array.from(r.childNodes)}function tc(r,t){t=""+t,r.data!==t&&(r.data=t)}function Is(r,t,e){r.classList[e?"add":"remove"](t)}function ec(r,t,{bubbles:e=!1,cancelable:n=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(r,e,n,t),i}let Qr;function tn(r){Qr=r}function Qi(){if(!Qr)throw new Error("Function called outside component initialization");return Qr}function gr(r){Qi().$$.on_mount.push(r)}function rc(r){Qi().$$.on_destroy.push(r)}function yr(){const r=Qi();return(t,e,{cancelable:n=!1}={})=>{const i=r.$$.callbacks[t];if(i){const o=ec(t,e,{cancelable:n});return i.slice().forEach(a=>{a.call(r,o)}),!o.defaultPrevented}return!0}}function br(r,t){const e=r.$$.callbacks[t.type];e&&e.slice().forEach(n=>n.call(this,t))}const xr=[],Ln=[];let Er=[];const Cs=[],nc=Promise.resolve();let to=!1;function ic(){to||(to=!0,nc.then(Ms))}function eo(r){Er.push(r)}const ro=new Set;let Tr=0;function Ms(){if(Tr!==0)return;const r=Qr;do{try{for(;Tr<xr.length;){const t=xr[Tr];Tr++,tn(t),oc(t.$$)}}catch(t){throw xr.length=0,Tr=0,t}for(tn(null),xr.length=0,Tr=0;Ln.length;)Ln.pop()();for(let t=0;t<Er.length;t+=1){const e=Er[t];ro.has(e)||(ro.add(e),e())}Er.length=0}while(xr.length);for(;Cs.length;)Cs.pop()();to=!1,ro.clear(),tn(r)}function oc(r){if(r.fragment!==null){r.update(),Be(r.before_update);const t=r.dirty;r.dirty=[-1],r.fragment&&r.fragment.p(r.ctx,t),r.after_update.forEach(eo)}}function ac(r){const t=[],e=[];Er.forEach(n=>r.indexOf(n)===-1?t.push(n):e.push(n)),e.forEach(n=>n()),Er=t}const Un=new Set;let Ke;function Le(){Ke={r:0,c:[],p:Ke}}function Ue(){Ke.r||Be(Ke.c),Ke=Ke.p}function lt(r,t){r&&r.i&&(Un.delete(r),r.i(t))}function _t(r,t,e,n){if(r&&r.o){if(Un.has(r))return;Un.add(r),Ke.c.push(()=>{Un.delete(r),n&&(e&&r.d(1),n())}),r.o(t)}else n&&n()}function ve(r){r&&r.c()}function ne(r,t,e,n){const{fragment:i,after_update:o}=r.$$;i&&i.m(t,e),n||eo(()=>{const a=r.$$.on_mount.map(Ts).filter(Xt);r.$$.on_destroy?r.$$.on_destroy.push(...a):Be(a),r.$$.on_mount=[]}),o.forEach(eo)}function ie(r,t){const e=r.$$;e.fragment!==null&&(ac(e.after_update),Be(e.on_destroy),e.fragment&&e.fragment.d(t),e.on_destroy=e.fragment=null,e.ctx=[])}function sc(r,t){r.$$.dirty[0]===-1&&(xr.push(r),ic(),r.$$.dirty.fill(0)),r.$$.dirty[t/31|0]|=1<<t%31}function $t(r,t,e,n,i,o,a,s=[-1]){const u=Qr;tn(r);const h=r.$$={fragment:null,ctx:[],props:o,update:ee,not_equal:i,bound:ws(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(u?u.$$.context:[])),callbacks:ws(),dirty:s,skip_bound:!1,root:t.target||u.$$.root};a&&a(h.root);let l=!1;if(h.ctx=e?e(r,t.props||{},(f,c,...d)=>{const p=d.length?d[0]:c;return h.ctx&&i(h.ctx[f],h.ctx[f]=p)&&(!h.skip_bound&&h.bound[f]&&h.bound[f](p),l&&sc(r,f)),c}):[],h.update(),l=!0,Be(h.before_update),h.fragment=n?n(h.ctx):!1,t.target){if(t.hydrate){const f=Qf(t.target);h.fragment&&h.fragment.l(f),f.forEach($)}else h.fragment&&h.fragment.c();t.intro&&lt(r.$$.fragment),ne(r,t.target,t.anchor,t.customElement),Ms()}tn(u)}class Kt{$destroy(){ie(this,1),this.$destroy=ee}$on(t,e){if(!Xt(e))return ee;const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const i=n.indexOf(e);i!==-1&&n.splice(i,1)}}$set(t){this.$$set&&!Kf(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}var zt=(r=>(r.ELLIPSE="ELLIPSE",r.POLYGON="POLYGON",r.RECTANGLE="RECTANGLE",r))(zt||{});const no={},io=(r,t)=>no[r]=t,oo=r=>no[r.type].area(r),uc=(r,t,e)=>no[r.type].intersects(r,t,e),ao=r=>{let t=1/0,e=1/0,n=-1/0,i=-1/0;return r.forEach(([o,a])=>{t=Math.min(t,o),e=Math.min(e,a),n=Math.max(n,o),i=Math.max(i,a)}),{minX:t,minY:e,maxX:n,maxY:i}},hc={area:r=>Math.PI*r.geometry.rx*r.geometry.ry,intersects:(r,t,e)=>{const{cx:n,cy:i,rx:o,ry:a}=r.geometry,s=0,u=Math.cos(s),h=Math.sin(s),l=t-n,f=e-i,c=u*l+h*f,d=h*l-u*f;return c*c/(o*o)+d*d/(a*a)<=1}};io(zt.ELLIPSE,hc);const lc={area:r=>{const{points:t}=r.geometry;let e=0,n=t.length-1;for(let i=0;i<t.length;i++)e+=(t[n][0]+t[i][0])*(t[n][1]-t[i][1]),n=i;return Math.abs(.5*e)},intersects:(r,t,e)=>{const{points:n}=r.geometry;let i=!1;for(let o=0,a=n.length-1;o<n.length;a=o++){const s=n[o][0],u=n[o][1],h=n[a][0],l=n[a][1];u>e!=l>e&&t<(h-s)*(e-u)/(l-u)+s&&(i=!i)}return i}};io(zt.POLYGON,lc);const fc={area:r=>r.geometry.w*r.geometry.h,intersects:(r,t,e)=>t>=r.geometry.x&&t<=r.geometry.x+r.geometry.w&&e>=r.geometry.y&&e<=r.geometry.y+r.geometry.h};io(zt.RECTANGLE,fc);let Gn;const cc=new Uint8Array(16);function dc(){if(!Gn&&(Gn=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Gn))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Gn(cc)}const Lt=[];for(let r=0;r<256;++r)Lt.push((r+256).toString(16).slice(1));function pc(r,t=0){return Lt[r[t+0]]+Lt[r[t+1]]+Lt[r[t+2]]+Lt[r[t+3]]+"-"+Lt[r[t+4]]+Lt[r[t+5]]+"-"+Lt[r[t+6]]+Lt[r[t+7]]+"-"+Lt[r[t+8]]+Lt[r[t+9]]+"-"+Lt[r[t+10]]+Lt[r[t+11]]+Lt[r[t+12]]+Lt[r[t+13]]+Lt[r[t+14]]+Lt[r[t+15]]}const Ds={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Fs(r,t,e){if(Ds.randomUUID&&!t&&!r)return Ds.randomUUID();r=r||{};const n=r.random||(r.rng||dc)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){e=e||0;for(let i=0;i<16;++i)t[e+i]=n[i];return t}return pc(n)}function Bs(r,t,e){const n=r.slice();return n[11]=t[e],n[13]=e,n}function Ns(r){let t,e,n,i,o;return{c(){t=ft("rect"),A(t,"class","a9s-corner-handle"),A(t,"x",e=r[11][0]-r[3]/2),A(t,"y",n=r[11][1]-r[3]/2),A(t,"height",r[3]),A(t,"width",r[3])},m(a,s){Z(a,t,s),i||(o=Yt(t,"pointerdown",function(){Xt(r[10](Y(r[13])))&&r[10](Y(r[13])).apply(this,arguments)}),i=!0)},p(a,s){r=a,s&24&&e!==(e=r[11][0]-r[3]/2)&&A(t,"x",e),s&24&&n!==(n=r[11][1]-r[3]/2)&&A(t,"y",n),s&8&&A(t,"height",r[3]),s&8&&A(t,"width",r[3])},d(a){a&&$(t),i=!1,o()}}}function vc(r){let t,e,n,i,o,a,s,u,h,l,f=r[4].points,c=[];for(let d=0;d<f.length;d+=1)c[d]=Ns(Bs(r,f,d));return{c(){t=ft("polygon"),i=re(),o=ft("polygon"),s=re();for(let d=0;d<c.length;d+=1)c[d].c();u=Ne(),A(t,"class","a9s-outer"),A(t,"style",e=r[1]?"display:none;":void 0),A(t,"points",n=r[4].points.map(Ls).join(" ")),A(o,"class","a9s-inner a9s-shape-handle"),A(o,"style",r[1]),A(o,"points",a=r[4].points.map(Us).join(" "))},m(d,p){Z(d,t,p),Z(d,i,p),Z(d,o,p),Z(d,s,p);for(let v=0;v<c.length;v+=1)c[v]&&c[v].m(d,p);Z(d,u,p),h||(l=[Yt(t,"pointerdown",function(){Xt(r[10](Y.SHAPE))&&r[10](Y.SHAPE).apply(this,arguments)}),Yt(o,"pointerdown",function(){Xt(r[10](Y.SHAPE))&&r[10](Y.SHAPE).apply(this,arguments)})],h=!0)},p(d,p){if(r=d,p&2&&e!==(e=r[1]?"display:none;":void 0)&&A(t,"style",e),p&16&&n!==(n=r[4].points.map(Ls).join(" "))&&A(t,"points",n),p&2&&A(o,"style",r[1]),p&16&&a!==(a=r[4].points.map(Us).join(" "))&&A(o,"points",a),p&1048){f=r[4].points;let v;for(v=0;v<f.length;v+=1){const _=Bs(r,f,v);c[v]?c[v].p(_,p):(c[v]=Ns(_),c[v].c(),c[v].m(u.parentNode,u))}for(;v<c.length;v+=1)c[v].d(1);c.length=f.length}},d(d){d&&$(t),d&&$(i),d&&$(o),d&&$(s),Zi(c,d),d&&$(u),h=!1,Be(l)}}}function _c(r){let t,e;return t=new Hs({props:{shape:r[0],transform:r[2],editor:r[5],$$slots:{default:[vc,({grab:n})=>({10:n}),({grab:n})=>n?1024:0]},$$scope:{ctx:r}}}),t.$on("change",r[7]),t.$on("grab",r[8]),t.$on("release",r[9]),{c(){ve(t.$$.fragment)},m(n,i){ne(t,n,i),e=!0},p(n,[i]){const o={};i&1&&(o.shape=n[0]),i&4&&(o.transform=n[2]),i&17434&&(o.$$scope={dirty:i,ctx:n}),t.$set(o)},i(n){e||(lt(t.$$.fragment,n),e=!0)},o(n){_t(t.$$.fragment,n),e=!1},d(n){ie(t,n)}}}const Ls=r=>r.join(","),Us=r=>r.join(",");function mc(r,t,e){let n,i,{shape:o}=t,{computedStyle:a=void 0}=t,{transform:s}=t,{viewportScale:u=1}=t;const h=(d,p,v)=>{let _;p===Y.SHAPE?_=d.geometry.points.map(([g,y])=>[g+v[0],y+v[1]]):_=d.geometry.points.map(([g,y],E)=>p===Y(E)?[g+v[0],y+v[1]]:[g,y]);const m=ao(_);return{...d,geometry:{points:_,bounds:m}}};function l(d){br.call(this,r,d)}function f(d){br.call(this,r,d)}function c(d){br.call(this,r,d)}return r.$$set=d=>{"shape"in d&&e(0,o=d.shape),"computedStyle"in d&&e(1,a=d.computedStyle),"transform"in d&&e(2,s=d.transform),"viewportScale"in d&&e(6,u=d.viewportScale)},r.$$.update=()=>{r.$$.dirty&1&&e(4,n=o.geometry),r.$$.dirty&64&&e(3,i=10/u)},[o,a,s,i,n,h,u,l,f,c]}class gc extends Kt{constructor(t){super(),$t(this,t,mc,_c,Ht,{shape:0,computedStyle:1,transform:2,viewportScale:6})}}function yc(r){let t,e,n,i,o,a,s,u,h,l,f,c,d,p,v,_,m,g,y,E,b,S,P,T,x,w,O,I,C,G,B,N,W,K,Q,L,F,X,tt,rt,vt,V,ht,gt,Tt,q,it,at,ct,nt;return{c(){t=ft("rect"),s=re(),u=ft("rect"),d=re(),p=ft("rect"),g=re(),y=ft("rect"),P=re(),T=ft("rect"),I=re(),C=ft("rect"),W=re(),K=ft("rect"),F=re(),X=ft("rect"),vt=re(),V=ft("rect"),Tt=re(),q=ft("rect"),A(t,"class","a9s-outer"),A(t,"style",e=r[1]?"display:none;":void 0),A(t,"x",n=r[4].x),A(t,"y",i=r[4].y),A(t,"width",o=r[4].w),A(t,"height",a=r[4].h),A(u,"class","a9s-inner a9s-shape-handle"),A(u,"style",r[1]),A(u,"x",h=r[4].x),A(u,"y",l=r[4].y),A(u,"width",f=r[4].w),A(u,"height",c=r[4].h),A(p,"class","a9s-edge-handle a9s-edge-handle-top"),A(p,"x",v=r[4].x),A(p,"y",_=r[4].y),A(p,"height",1),A(p,"width",m=r[4].w),A(y,"class","a9s-edge-handle a9s-edge-handle-right"),A(y,"x",E=r[4].x+r[4].w),A(y,"y",b=r[4].y),A(y,"height",S=r[4].h),A(y,"width",1),A(T,"class","a9s-edge-handle a9s-edge-handle-bottom"),A(T,"x",x=r[4].x),A(T,"y",w=r[4].y+r[4].h),A(T,"height",1),A(T,"width",O=r[4].w),A(C,"class","a9s-edge-handle a9s-edge-handle-left"),A(C,"x",G=r[4].x),A(C,"y",B=r[4].y),A(C,"height",N=r[4].h),A(C,"width",1),A(K,"class","a9s-corner-handle a9s-corner-handle-topleft"),A(K,"x",Q=r[4].x-r[3]/2),A(K,"y",L=r[4].y-r[3]/2),A(K,"height",r[3]),A(K,"width",r[3]),A(X,"class","a9s-corner-handle a9s-corner-handle-topright"),A(X,"x",tt=r[4].x+r[4].w-r[3]/2),A(X,"y",rt=r[4].y-r[3]/2),A(X,"height",r[3]),A(X,"width",r[3]),A(V,"class","a9s-corner-handle a9s-corner-handle-bottomright"),A(V,"x",ht=r[4].x+r[4].w-r[3]/2),A(V,"y",gt=r[4].y+r[4].h-r[3]/2),A(V,"height",r[3]),A(V,"width",r[3]),A(q,"class","a9s-corner-handle a9s-corner-handle-bottomleft"),A(q,"x",it=r[4].x-r[3]/2),A(q,"y",at=r[4].y+r[4].h-r[3]/2),A(q,"height",r[3]),A(q,"width",r[3])},m(D,R){Z(D,t,R),Z(D,s,R),Z(D,u,R),Z(D,d,R),Z(D,p,R),Z(D,g,R),Z(D,y,R),Z(D,P,R),Z(D,T,R),Z(D,I,R),Z(D,C,R),Z(D,W,R),Z(D,K,R),Z(D,F,R),Z(D,X,R),Z(D,vt,R),Z(D,V,R),Z(D,Tt,R),Z(D,q,R),ct||(nt=[Yt(t,"pointerdown",function(){Xt(r[10](Y.SHAPE))&&r[10](Y.SHAPE).apply(this,arguments)}),Yt(u,"pointerdown",function(){Xt(r[10](Y.SHAPE))&&r[10](Y.SHAPE).apply(this,arguments)}),Yt(p,"pointerdown",function(){Xt(r[10](Y.TOP))&&r[10](Y.TOP).apply(this,arguments)}),Yt(y,"pointerdown",function(){Xt(r[10](Y.RIGHT))&&r[10](Y.RIGHT).apply(this,arguments)}),Yt(T,"pointerdown",function(){Xt(r[10](Y.BOTTOM))&&r[10](Y.BOTTOM).apply(this,arguments)}),Yt(C,"pointerdown",function(){Xt(r[10](Y.LEFT))&&r[10](Y.LEFT).apply(this,arguments)}),Yt(K,"pointerdown",function(){Xt(r[10](Y.TOP_LEFT))&&r[10](Y.TOP_LEFT).apply(this,arguments)}),Yt(X,"pointerdown",function(){Xt(r[10](Y.TOP_RIGHT))&&r[10](Y.TOP_RIGHT).apply(this,arguments)}),Yt(V,"pointerdown",function(){Xt(r[10](Y.BOTTOM_RIGHT))&&r[10](Y.BOTTOM_RIGHT).apply(this,arguments)}),Yt(q,"pointerdown",function(){Xt(r[10](Y.BOTTOM_LEFT))&&r[10](Y.BOTTOM_LEFT).apply(this,arguments)})],ct=!0)},p(D,R){r=D,R&2&&e!==(e=r[1]?"display:none;":void 0)&&A(t,"style",e),R&16&&n!==(n=r[4].x)&&A(t,"x",n),R&16&&i!==(i=r[4].y)&&A(t,"y",i),R&16&&o!==(o=r[4].w)&&A(t,"width",o),R&16&&a!==(a=r[4].h)&&A(t,"height",a),R&2&&A(u,"style",r[1]),R&16&&h!==(h=r[4].x)&&A(u,"x",h),R&16&&l!==(l=r[4].y)&&A(u,"y",l),R&16&&f!==(f=r[4].w)&&A(u,"width",f),R&16&&c!==(c=r[4].h)&&A(u,"height",c),R&16&&v!==(v=r[4].x)&&A(p,"x",v),R&16&&_!==(_=r[4].y)&&A(p,"y",_),R&16&&m!==(m=r[4].w)&&A(p,"width",m),R&16&&E!==(E=r[4].x+r[4].w)&&A(y,"x",E),R&16&&b!==(b=r[4].y)&&A(y,"y",b),R&16&&S!==(S=r[4].h)&&A(y,"height",S),R&16&&x!==(x=r[4].x)&&A(T,"x",x),R&16&&w!==(w=r[4].y+r[4].h)&&A(T,"y",w),R&16&&O!==(O=r[4].w)&&A(T,"width",O),R&16&&G!==(G=r[4].x)&&A(C,"x",G),R&16&&B!==(B=r[4].y)&&A(C,"y",B),R&16&&N!==(N=r[4].h)&&A(C,"height",N),R&24&&Q!==(Q=r[4].x-r[3]/2)&&A(K,"x",Q),R&24&&L!==(L=r[4].y-r[3]/2)&&A(K,"y",L),R&8&&A(K,"height",r[3]),R&8&&A(K,"width",r[3]),R&24&&tt!==(tt=r[4].x+r[4].w-r[3]/2)&&A(X,"x",tt),R&24&&rt!==(rt=r[4].y-r[3]/2)&&A(X,"y",rt),R&8&&A(X,"height",r[3]),R&8&&A(X,"width",r[3]),R&24&&ht!==(ht=r[4].x+r[4].w-r[3]/2)&&A(V,"x",ht),R&24&&gt!==(gt=r[4].y+r[4].h-r[3]/2)&&A(V,"y",gt),R&8&&A(V,"height",r[3]),R&8&&A(V,"width",r[3]),R&24&&it!==(it=r[4].x-r[3]/2)&&A(q,"x",it),R&24&&at!==(at=r[4].y+r[4].h-r[3]/2)&&A(q,"y",at),R&8&&A(q,"height",r[3]),R&8&&A(q,"width",r[3])},d(D){D&&$(t),D&&$(s),D&&$(u),D&&$(d),D&&$(p),D&&$(g),D&&$(y),D&&$(P),D&&$(T),D&&$(I),D&&$(C),D&&$(W),D&&$(K),D&&$(F),D&&$(X),D&&$(vt),D&&$(V),D&&$(Tt),D&&$(q),ct=!1,Be(nt)}}}function bc(r){let t,e;return t=new Hs({props:{shape:r[0],transform:r[2],editor:r[5],$$slots:{default:[yc,({grab:n})=>({10:n}),({grab:n})=>n?1024:0]},$$scope:{ctx:r}}}),t.$on("grab",r[7]),t.$on("change",r[8]),t.$on("release",r[9]),{c(){ve(t.$$.fragment)},m(n,i){ne(t,n,i),e=!0},p(n,[i]){const o={};i&1&&(o.shape=n[0]),i&4&&(o.transform=n[2]),i&3098&&(o.$$scope={dirty:i,ctx:n}),t.$set(o)},i(n){e||(lt(t.$$.fragment,n),e=!0)},o(n){_t(t.$$.fragment,n),e=!1},d(n){ie(t,n)}}}function xc(r,t,e){let n,i,{shape:o}=t,{computedStyle:a=void 0}=t,{transform:s}=t,{viewportScale:u=1}=t;const h=(d,p,v)=>{const _=d.geometry.bounds;let[m,g]=[_.minX,_.minY],[y,E]=[_.maxX,_.maxY];const[b,S]=v;if(p===Y.SHAPE)m+=b,y+=b,g+=S,E+=S;else{switch(p){case Y.TOP:case Y.TOP_LEFT:case Y.TOP_RIGHT:{g+=S;break}case Y.BOTTOM:case Y.BOTTOM_LEFT:case Y.BOTTOM_RIGHT:{E+=S;break}}switch(p){case Y.LEFT:case Y.TOP_LEFT:case Y.BOTTOM_LEFT:{m+=b;break}case Y.RIGHT:case Y.TOP_RIGHT:case Y.BOTTOM_RIGHT:{y+=b;break}}}const P=Math.min(m,y),T=Math.min(g,E),x=Math.abs(y-m),w=Math.abs(E-g);return{...d,geometry:{x:P,y:T,w:x,h:w,bounds:{minX:P,minY:T,maxX:P+x,maxY:T+w}}}};function l(d){br.call(this,r,d)}function f(d){br.call(this,r,d)}function c(d){br.call(this,r,d)}return r.$$set=d=>{"shape"in d&&e(0,o=d.shape),"computedStyle"in d&&e(1,a=d.computedStyle),"transform"in d&&e(2,s=d.transform),"viewportScale"in d&&e(6,u=d.viewportScale)},r.$$.update=()=>{r.$$.dirty&1&&e(4,n=o.geometry),r.$$.dirty&64&&e(3,i=10/u)},[o,a,s,i,n,h,u,l,f,c]}class Ec extends Kt{constructor(t){super(),$t(this,t,xc,bc,Ht,{shape:0,computedStyle:1,transform:2,viewportScale:6})}}const Gs=new Map([[zt.RECTANGLE,Ec],[zt.POLYGON,gc]]),ks=r=>Gs.get(r.type),Tc=(r,t)=>Gs.set(r,t),Y=r=>`HANDLE-${r}`;Y.SHAPE="SHAPE",Y.TOP="TOP",Y.RIGHT="RIGHT",Y.BOTTOM="BOTTOM",Y.LEFT="LEFT",Y.TOP_LEFT="TOP_LEFT",Y.TOP_RIGHT="TOP_RIGHT",Y.BOTTOM_RIGHT="BOTTOM_RIGHT",Y.BOTTOM_LEFT="BOTTOM_LEFT";const wc=r=>({}),Xs=r=>({grab:r[0]});function Sc(r){let t,e,n,i;const o=r[7].default,a=Ss(o,r,r[6],Xs);return{c(){t=ft("g"),a&&a.c(),A(t,"class","a9s-annotation selected")},m(s,u){Z(s,t,u),a&&a.m(t,null),e=!0,n||(i=[Yt(t,"pointerup",r[2]),Yt(t,"pointermove",r[1])],n=!0)},p(s,[u]){a&&a.p&&(!e||u&64)&&Os(a,o,s,s[6],e?Ps(o,s[6],u,wc):Rs(s[6]),Xs)},i(s){e||(lt(a,s),e=!0)},o(s){_t(a,s),e=!1},d(s){s&&$(t),a&&a.d(s),n=!1,Be(i)}}}function Ac(r,t,e){let{$$slots:n={},$$scope:i}=t;const o=yr();let{shape:a}=t,{editor:s}=t,{transform:u}=t,h=null,l,f=null;const c=v=>_=>{h=v,l=u.elementToImage(_.offsetX,_.offsetY),f=a,_.target.setPointerCapture(_.pointerId),o("grab")},d=v=>{if(h){const[_,m]=u.elementToImage(v.offsetX,v.offsetY),g=[_-l[0],m-l[1]];e(3,a=s(f,h,g)),o("change",a)}},p=v=>{v.target.releasePointerCapture(v.pointerId),h=null,f=a,o("release")};return r.$$set=v=>{"shape"in v&&e(3,a=v.shape),"editor"in v&&e(4,s=v.editor),"transform"in v&&e(5,u=v.transform),"$$scope"in v&&e(6,i=v.$$scope)},[c,d,p,a,s,u,i,n]}class Hs extends Kt{constructor(t){super(),$t(this,t,Ac,Sc,Ht,{shape:3,editor:4,transform:5})}}const Pc=(r,t)=>{const e=typeof t=="function"?t(r):t;if(e){const{fill:n,fillOpacity:i}=e;let o="";return n&&(o+=`fill:${n};stroke:${n};`),o+=`fill-opacity:${i||"0.25"};`,o}};function Oc(r,t,e){let n;const i=yr();let{annotation:o}=t,{editor:a}=t,{style:s=void 0}=t,{target:u}=t,{transform:h}=t,{viewportScale:l}=t,f;return gr(()=>(e(6,f=new a({target:u,props:{shape:o.target.selector,computedStyle:n,transform:h,viewportScale:l}})),f.$on("change",c=>{f.$$set({shape:c.detail}),i("change",c.detail)}),f.$on("grab",c=>i("grab",c.detail)),f.$on("release",c=>i("release",c.detail)),()=>{f.$destroy()})),r.$$set=c=>{"annotation"in c&&e(0,o=c.annotation),"editor"in c&&e(1,a=c.editor),"style"in c&&e(2,s=c.style),"target"in c&&e(3,u=c.target),"transform"in c&&e(4,h=c.transform),"viewportScale"in c&&e(5,l=c.viewportScale)},r.$$.update=()=>{r.$$.dirty&5&&(n=Pc(o,s)),r.$$.dirty&65&&o&&(f==null||f.$set({shape:o.target.selector})),r.$$.dirty&80&&f&&f.$set({transform:h}),r.$$.dirty&96&&f&&f.$set({viewportScale:l})},[o,a,s,u,h,l,f]}class Rc extends Kt{constructor(t){super(),$t(this,t,Oc,null,Ht,{annotation:0,editor:1,style:2,target:3,transform:4,viewportScale:5})}}function js(r){let t,e;return{c(){t=ft("rect"),e=ft("rect"),A(t,"class","a9s-outer"),A(t,"x",r[1]),A(t,"y",r[2]),A(t,"width",r[3]),A(t,"height",r[4]),A(e,"class","a9s-inner"),A(e,"x",r[1]),A(e,"y",r[2]),A(e,"width",r[3]),A(e,"height",r[4])},m(n,i){Z(n,t,i),Z(n,e,i)},p(n,i){i&2&&A(t,"x",n[1]),i&4&&A(t,"y",n[2]),i&8&&A(t,"width",n[3]),i&16&&A(t,"height",n[4]),i&2&&A(e,"x",n[1]),i&4&&A(e,"y",n[2]),i&8&&A(e,"width",n[3]),i&16&&A(e,"height",n[4])},d(n){n&&$(t),n&&$(e)}}}function Ic(r){let t,e=r[0]&&js(r);return{c(){t=ft("g"),e&&e.c(),A(t,"class","a9s-annotation a9s-rubberband")},m(n,i){Z(n,t,i),e&&e.m(t,null)},p(n,[i]){n[0]?e?e.p(n,i):(e=js(n),e.c(),e.m(t,null)):e&&(e.d(1),e=null)},i:ee,o:ee,d(n){n&&$(t),e&&e.d()}}}function Cc(r,t,e){const n=yr();let{addEventListener:i}=t,{drawingMode:o}=t,{transform:a}=t,s,u,h,l,f,c,d;const p=g=>{s=performance.now(),o==="drag"&&(e(0,u=a.elementToImage(g.offsetX,g.offsetY)),h=u,e(1,l=u[0]),e(2,f=u[1]),e(3,c=1),e(4,d=1))},v=g=>{u&&(h=a.elementToImage(g.offsetX,g.offsetY),e(1,l=Math.min(h[0],u[0])),e(2,f=Math.min(h[1],u[1])),e(3,c=Math.abs(h[0]-u[0])),e(4,d=Math.abs(h[1]-u[1])))},_=g=>{const y=performance.now()-s;if(o==="click"){if(y>300)return;g.stopPropagation(),u?m():(e(0,u=a.elementToImage(g.offsetX,g.offsetY)),h=u,e(1,l=u[0]),e(2,f=u[1]),e(3,c=1),e(4,d=1))}else u&&(y>300||c*d>100?(g.stopPropagation(),m()):(e(0,u=null),h=null))},m=()=>{if(c*d>15){const g={type:zt.RECTANGLE,geometry:{bounds:{minX:l,minY:f,maxX:l+c,maxY:f+d},x:l,y:f,w:c,h:d}};n("create",g)}e(0,u=null),h=null};return gr(()=>{i("pointerdown",p),i("pointermove",v),i("pointerup",_,!0)}),r.$$set=g=>{"addEventListener"in g&&e(5,i=g.addEventListener),"drawingMode"in g&&e(6,o=g.drawingMode),"transform"in g&&e(7,a=g.transform)},[u,l,f,c,d,i,o,a]}class Mc extends Kt{constructor(t){super(),$t(this,t,Cc,Ic,Ht,{addEventListener:5,drawingMode:6,transform:7})}}const so=(r,t)=>{const e=Math.abs(t[0]-r[0]),n=Math.abs(t[1]-r[1]);return Math.sqrt(Math.pow(e,2)+Math.pow(n,2))};function uo(r){const t=r.slice(),e=(t[2]?t[0]:[...t[0],t[1]]).map(n=>n.join(",")).join(" ");return t[15]=e,t}function Vs(r){let t,e,n,i,o,a=r[2]&&Ys(r);return{c(){t=ft("polygon"),n=ft("polygon"),a&&a.c(),o=Ne(),A(t,"class","a9s-outer"),A(t,"points",e=r[15]),A(n,"class","a9s-inner"),A(n,"points",i=r[15])},m(s,u){Z(s,t,u),Z(s,n,u),a&&a.m(s,u),Z(s,o,u)},p(s,u){u&7&&e!==(e=s[15])&&A(t,"points",e),u&7&&i!==(i=s[15])&&A(n,"points",i),s[2]?a?a.p(s,u):(a=Ys(s),a.c(),a.m(o.parentNode,o)):a&&(a.d(1),a=null)},d(s){s&&$(t),s&&$(n),a&&a.d(s),s&&$(o)}}}function Ys(r){let t,e,n;return{c(){t=ft("rect"),A(t,"class","a9s-corner-handle"),A(t,"x",e=r[0][0][0]-r[3]/2),A(t,"y",n=r[0][0][1]-r[3]/2),A(t,"height",r[3]),A(t,"width",r[3])},m(i,o){Z(i,t,o)},p(i,o){o&9&&e!==(e=i[0][0][0]-i[3]/2)&&A(t,"x",e),o&9&&n!==(n=i[0][0][1]-i[3]/2)&&A(t,"y",n),o&8&&A(t,"height",i[3]),o&8&&A(t,"width",i[3])},d(i){i&&$(t)}}}function Dc(r){let t,e=r[1]&&Vs(uo(r));return{c(){t=ft("g"),e&&e.c(),A(t,"class","a9s-annotation a9s-rubberband")},m(n,i){Z(n,t,i),e&&e.m(t,null)},p(n,[i]){n[1]?e?e.p(uo(n),i):(e=Vs(uo(n)),e.c(),e.m(t,null)):e&&(e.d(1),e=null)},i:ee,o:ee,d(n){n&&$(t),e&&e.d()}}}const Fc=20;function Bc(r,t,e){let n;const i=yr();let{addEventListener:o}=t,{drawingMode:a}=t,{transform:s}=t,{viewportScale:u=1}=t,h,l=[],f=null,c=!1;const d=g=>{const{timeStamp:y,offsetX:E,offsetY:b}=g;if(h={timeStamp:y,offsetX:E,offsetY:b},a==="drag"&&l.length===0){const S=s.elementToImage(g.offsetX,g.offsetY);l.push(S),e(1,f=S)}},p=g=>{if(l.length>0&&(e(1,f=s.elementToImage(g.offsetX,g.offsetY)),l.length>2)){const y=so(f,l[0])*u;e(2,c=y<Fc)}},v=g=>{if(a==="click"){const y=g.timeStamp-h.timeStamp,E=so([h.offsetX,h.offsetY],[g.offsetX,g.offsetY]);if(y>300||E>15)return;if(c)m();else if(l.length===0){const b=s.elementToImage(g.offsetX,g.offsetY);l.push(b),e(1,f=b)}else l.push(f)}else{if(l.length===1&&so(l[0],f)<=4){e(0,l=[]),e(1,f=null);return}g.stopImmediatePropagation(),c?m():l.push(f)}},_=()=>{const g=[...l,f],y={type:zt.POLYGON,geometry:{bounds:ao(g),points:g}};oo(y)>4&&(e(0,l=[]),e(1,f=null),i("create",y))},m=()=>{const g={type:zt.POLYGON,geometry:{bounds:ao(l),points:[...l]}};e(0,l=[]),e(1,f=null),i("create",g)};return gr(()=>{o("pointerdown",d,!0),o("pointermove",p),o("pointerup",v,!0),o("dblclick",_,!0)}),r.$$set=g=>{"addEventListener"in g&&e(4,o=g.addEventListener),"drawingMode"in g&&e(5,a=g.drawingMode),"transform"in g&&e(6,s=g.transform),"viewportScale"in g&&e(7,u=g.viewportScale)},r.$$.update=()=>{r.$$.dirty&128&&e(3,n=10/u)},[l,f,c,n,o,a,s,u]}class Nc extends Kt{constructor(t){super(),$t(this,t,Bc,Dc,Ht,{addEventListener:4,drawingMode:5,transform:6,viewportScale:7})}}const ho=new Map([["rectangle",{tool:Mc}],["polygon",{tool:Nc}]]),lo=()=>[...ho.keys()],zs=r=>ho.get(r),Lc=(r,t,e)=>ho.set(r,{tool:t,opts:e});function Uc(r,t,e,n,i){Ws(r,t,e||0,n||r.length-1,i||Gc)}function Ws(r,t,e,n,i){for(;n>e;){if(n-e>600){var o=n-e+1,a=t-e+1,s=Math.log(o),u=.5*Math.exp(2*s/3),h=.5*Math.sqrt(s*u*(o-u)/o)*(a-o/2<0?-1:1),l=Math.max(e,Math.floor(t-a*u/o+h)),f=Math.min(n,Math.floor(t+(o-a)*u/o+h));Ws(r,t,l,f,i)}var c=r[t],d=e,p=n;for(en(r,e,t),i(r[n],c)>0&&en(r,e,n);d<p;){for(en(r,d,p),d++,p--;i(r[d],c)<0;)d++;for(;i(r[p],c)>0;)p--}i(r[e],c)===0?en(r,e,p):(p++,en(r,p,n)),p<=t&&(e=p+1),t<=p&&(n=p-1)}}function en(r,t,e){var n=r[t];r[t]=r[e],r[e]=n}function Gc(r,t){return r<t?-1:r>t?1:0}class kc{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const n=[];if(!Xn(t,e))return n;const i=this.toBBox,o=[];for(;e;){for(let a=0;a<e.children.length;a++){const s=e.children[a],u=e.leaf?i(s):s;Xn(t,u)&&(e.leaf?n.push(s):co(t,u)?this._all(s,n):o.push(s))}e=o.pop()}return n}collides(t){let e=this.data;if(!Xn(t,e))return!1;const n=[];for(;e;){for(let i=0;i<e.children.length;i++){const o=e.children[i],a=e.leaf?this.toBBox(o):o;if(Xn(t,a)){if(e.leaf||co(t,a))return!0;n.push(o)}}e=n.pop()}return!1}load(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(let n=0;n<t.length;n++)this.insert(t[n]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length)this.data=e;else if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){const n=this.data;this.data=e,e=n}this._insert(e,this.data.height-e.height-1,!0)}return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=Sr([]),this}remove(t,e){if(!t)return this;let n=this.data;const i=this.toBBox(t),o=[],a=[];let s,u,h;for(;n||o.length;){if(n||(n=o.pop(),u=o[o.length-1],s=a.pop(),h=!0),n.leaf){const l=Xc(t,n.children,e);if(l!==-1)return n.children.splice(l,1),o.push(n),this._condense(o),this}!h&&!n.leaf&&co(n,i)?(o.push(n),a.push(s),s=0,u=n,n=n.children[0]):u?(s++,n=u.children[s],h=!1):n=null}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const n=[];for(;t;)t.leaf?e.push(...t.children):n.push(...t.children),t=n.pop();return e}_build(t,e,n,i){const o=n-e+1;let a=this._maxEntries,s;if(o<=a)return s=Sr(t.slice(e,n+1)),wr(s,this.toBBox),s;i||(i=Math.ceil(Math.log(o)/Math.log(a)),a=Math.ceil(o/Math.pow(a,i-1))),s=Sr([]),s.leaf=!1,s.height=i;const u=Math.ceil(o/a),h=u*Math.ceil(Math.sqrt(a));qs(t,e,n,h,this.compareMinX);for(let l=e;l<=n;l+=h){const f=Math.min(l+h-1,n);qs(t,l,f,u,this.compareMinY);for(let c=l;c<=f;c+=u){const d=Math.min(c+u-1,f);s.children.push(this._build(t,c,d,i-1))}}return wr(s,this.toBBox),s}_chooseSubtree(t,e,n,i){for(;i.push(e),!(e.leaf||i.length-1===n);){let o=1/0,a=1/0,s;for(let u=0;u<e.children.length;u++){const h=e.children[u],l=fo(h),f=Vc(t,h)-l;f<a?(a=f,o=l<o?l:o,s=h):f===a&&l<o&&(o=l,s=h)}e=s||e.children[0]}return e}_insert(t,e,n){const i=n?t:this.toBBox(t),o=[],a=this._chooseSubtree(i,this.data,e,o);for(a.children.push(t),nn(a,i);e>=0&&o[e].children.length>this._maxEntries;)this._split(o,e),e--;this._adjustParentBBoxes(i,o,e)}_split(t,e){const n=t[e],i=n.children.length,o=this._minEntries;this._chooseSplitAxis(n,o,i);const a=this._chooseSplitIndex(n,o,i),s=Sr(n.children.splice(a,n.children.length-a));s.height=n.height,s.leaf=n.leaf,wr(n,this.toBBox),wr(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(n,s)}_splitRoot(t,e){this.data=Sr([t,e]),this.data.height=t.height+1,this.data.leaf=!1,wr(this.data,this.toBBox)}_chooseSplitIndex(t,e,n){let i,o=1/0,a=1/0;for(let s=e;s<=n-e;s++){const u=rn(t,0,s,this.toBBox),h=rn(t,s,n,this.toBBox),l=Yc(u,h),f=fo(u)+fo(h);l<o?(o=l,i=s,a=f<a?f:a):l===o&&f<a&&(a=f,i=s)}return i||n-e}_chooseSplitAxis(t,e,n){const i=t.leaf?this.compareMinX:Hc,o=t.leaf?this.compareMinY:jc,a=this._allDistMargin(t,e,n,i),s=this._allDistMargin(t,e,n,o);a<s&&t.children.sort(i)}_allDistMargin(t,e,n,i){t.children.sort(i);const o=this.toBBox,a=rn(t,0,e,o),s=rn(t,n-e,n,o);let u=kn(a)+kn(s);for(let h=e;h<n-e;h++){const l=t.children[h];nn(a,t.leaf?o(l):l),u+=kn(a)}for(let h=n-e-1;h>=e;h--){const l=t.children[h];nn(s,t.leaf?o(l):l),u+=kn(s)}return u}_adjustParentBBoxes(t,e,n){for(let i=n;i>=0;i--)nn(e[i],t)}_condense(t){for(let e=t.length-1,n;e>=0;e--)t[e].children.length===0?e>0?(n=t[e-1].children,n.splice(n.indexOf(t[e]),1)):this.clear():wr(t[e],this.toBBox)}}function Xc(r,t,e){if(!e)return t.indexOf(r);for(let n=0;n<t.length;n++)if(e(r,t[n]))return n;return-1}function wr(r,t){rn(r,0,r.children.length,t,r)}function rn(r,t,e,n,i){i||(i=Sr(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(let o=t;o<e;o++){const a=r.children[o];nn(i,r.leaf?n(a):a)}return i}function nn(r,t){return r.minX=Math.min(r.minX,t.minX),r.minY=Math.min(r.minY,t.minY),r.maxX=Math.max(r.maxX,t.maxX),r.maxY=Math.max(r.maxY,t.maxY),r}function Hc(r,t){return r.minX-t.minX}function jc(r,t){return r.minY-t.minY}function fo(r){return(r.maxX-r.minX)*(r.maxY-r.minY)}function kn(r){return r.maxX-r.minX+(r.maxY-r.minY)}function Vc(r,t){return(Math.max(t.maxX,r.maxX)-Math.min(t.minX,r.minX))*(Math.max(t.maxY,r.maxY)-Math.min(t.minY,r.minY))}function Yc(r,t){const e=Math.max(r.minX,t.minX),n=Math.max(r.minY,t.minY),i=Math.min(r.maxX,t.maxX),o=Math.min(r.maxY,t.maxY);return Math.max(0,i-e)*Math.max(0,o-n)}function co(r,t){return r.minX<=t.minX&&r.minY<=t.minY&&t.maxX<=r.maxX&&t.maxY<=r.maxY}function Xn(r,t){return t.minX<=r.maxX&&t.minY<=r.maxY&&t.maxX>=r.minX&&t.maxY>=r.minY}function Sr(r){return{children:r,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function qs(r,t,e,n,i){const o=[t,e];for(;o.length;){if(e=o.pop(),t=o.pop(),e-t<=n)continue;const a=t+Math.ceil((e-t)/n/2)*n;Uc(r,a,t,e,i),o.push(t,a,a,e)}}const zc=()=>{const r=new kc,t=new Map,e=()=>[...t.values()],n=()=>{r.clear(),t.clear()},i=f=>{const{minX:c,minY:d,maxX:p,maxY:v}=f.selector.geometry.bounds,_={minX:c,minY:d,maxX:p,maxY:v,target:f};r.insert(_),t.set(f.annotation,_)},o=f=>{const c=t.get(f.annotation);r.remove(c),t.delete(f.annotation)};return{all:e,clear:n,getAt:(f,c)=>{const p=r.search({minX:f,minY:c,maxX:f,maxY:c}).map(v=>v.target).filter(v=>v.selector.type===zt.RECTANGLE||uc(v.selector,f,c));if(p.length>0)return p.sort((v,_)=>oo(v.selector)-oo(_.selector)),p[0]},getIntersecting:(f,c,d,p)=>r.search({minX:f,minY:c,maxX:f+d,maxY:c+p}).map(v=>v.target),insert:i,remove:o,set:(f,c=!0)=>{c&&n();const d=f.map(p=>{const{minX:v,minY:_,maxX:m,maxY:g}=p.selector.geometry.bounds;return{minX:v,minY:_,maxX:m,maxY:g,target:p}});d.forEach(p=>t.set(p.target.annotation,p)),r.load(d)},size:()=>r.all().length,update:(f,c)=>{o(f),i(c)}}},Wc=r=>{const t=Nf(),e=zc(),n=Af(t,r.pointerSelectAction),i=Sf(t),o=kf();return t.observe(({changes:u})=>{e.set(u.created.map(h=>h.target),!1),u.deleted.forEach(h=>e.remove(h.target)),u.updated.forEach(({oldValue:h,newValue:l})=>e.update(h.target,l.target))}),{store:{...t,getAt:(u,h)=>{const l=e.getAt(u,h);return l?t.getAnnotation(l.annotation):void 0},getIntersecting:(u,h,l,f)=>e.getIntersecting(u,h,l,f).map(c=>t.getAnnotation(c.annotation))},selection:n,hover:i,viewport:o}},qc=r=>{let t,e;if(r.nodeName==="CANVAS")t=r,e=t.getContext("2d",{willReadFrequently:!0});else{const i=r;t=document.createElement("canvas"),t.width=i.width,t.height=i.height,e=t.getContext("2d",{willReadFrequently:!0}),e.drawImage(i,0,0,i.width,i.height)}let n=0;for(let i=1;i<10;i++)for(let o=1;o<10;o++){const a=Math.round(o*t.width/10),s=Math.round(i*t.height/10),u=e.getImageData(a,s,1,1).data,h=(.299*u[0]+.587*u[1]+.114*u[2])/255;n+=h}return n/81},$c=r=>{const t=qc(r),e=t>.6?"dark":"light";return console.log(`[Annotorious] Image brightness: ${t.toFixed(1)}. Setting ${e} theme.`),e},Kc=r=>({...r,drawingEnabled:r.drawingEnabled===void 0?!0:r.drawingEnabled,drawingMode:r.drawingMode||"drag",pointerSelectAction:r.pointerSelectAction||xs.EDIT,theme:r.theme||"light"}),$s=navigator.userAgent.indexOf("Mac OS X")!==-1,Zc=(r,t)=>{const e=t||document,n=a=>{a.key==="Z"&&a.ctrlKey?r.undo():a.key==="Y"&&a.ctrlKey&&r.redo()},i=a=>{a.key==="z"&&a.metaKey&&(a.shiftKey?r.redo():r.undo())},o=()=>{$s?e.removeEventListener("keydown",i):e.removeEventListener("keydown",n)};return $s?e.addEventListener("keydown",i):e.addEventListener("keydown",n),{destroy:o}},KE="",ZE="",JE="";function Jc(r){var t=this.constructor;return this.then(function(e){return t.resolve(r()).then(function(){return e})},function(e){return t.resolve(r()).then(function(){return t.reject(e)})})}function Qc(r){var t=this;return new t(function(e,n){if(!(r&&typeof r.length<"u"))return n(new TypeError(typeof r+" "+r+" is not iterable(cannot read property Symbol(Symbol.iterator))"));var i=Array.prototype.slice.call(r);if(i.length===0)return e([]);var o=i.length;function a(u,h){if(h&&(typeof h=="object"||typeof h=="function")){var l=h.then;if(typeof l=="function"){l.call(h,function(f){a(u,f)},function(f){i[u]={status:"rejected",reason:f},--o===0&&e(i)});return}}i[u]={status:"fulfilled",value:h},--o===0&&e(i)}for(var s=0;s<i.length;s++)a(s,i[s])})}function Ks(r,t){this.name="AggregateError",this.errors=r,this.message=t||""}Ks.prototype=Error.prototype;function td(r){var t=this;return new t(function(e,n){if(!(r&&typeof r.length<"u"))return n(new TypeError("Promise.any accepts an array"));var i=Array.prototype.slice.call(r);if(i.length===0)return n();for(var o=[],a=0;a<i.length;a++)try{t.resolve(i[a]).then(e).catch(function(s){o.push(s),o.length===i.length&&n(new Ks(o,"All promises were rejected"))})}catch(s){n(s)}})}var ed=setTimeout;function Zs(r){return!!(r&&typeof r.length<"u")}function rd(){}function nd(r,t){return function(){r.apply(t,arguments)}}function St(r){if(!(this instanceof St))throw new TypeError("Promises must be constructed via new");if(typeof r!="function")throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],Qs(r,this)}function Js(r,t){for(;r._state===3;)r=r._value;if(r._state===0){r._deferreds.push(t);return}r._handled=!0,St._immediateFn(function(){var e=r._state===1?t.onFulfilled:t.onRejected;if(e===null){(r._state===1?po:on)(t.promise,r._value);return}var n;try{n=e(r._value)}catch(i){on(t.promise,i);return}po(t.promise,n)})}function po(r,t){try{if(t===r)throw new TypeError("A promise cannot be resolved with itself.");if(t&&(typeof t=="object"||typeof t=="function")){var e=t.then;if(t instanceof St){r._state=3,r._value=t,vo(r);return}else if(typeof e=="function"){Qs(nd(e,t),r);return}}r._state=1,r._value=t,vo(r)}catch(n){on(r,n)}}function on(r,t){r._state=2,r._value=t,vo(r)}function vo(r){r._state===2&&r._deferreds.length===0&&St._immediateFn(function(){r._handled||St._unhandledRejectionFn(r._value)});for(var t=0,e=r._deferreds.length;t<e;t++)Js(r,r._deferreds[t]);r._deferreds=null}function id(r,t,e){this.onFulfilled=typeof r=="function"?r:null,this.onRejected=typeof t=="function"?t:null,this.promise=e}function Qs(r,t){var e=!1;try{r(function(n){e||(e=!0,po(t,n))},function(n){e||(e=!0,on(t,n))})}catch(n){if(e)return;e=!0,on(t,n)}}St.prototype.catch=function(r){return this.then(null,r)},St.prototype.then=function(r,t){var e=new this.constructor(rd);return Js(this,new id(r,t,e)),e},St.prototype.finally=Jc,St.all=function(r){return new St(function(t,e){if(!Zs(r))return e(new TypeError("Promise.all accepts an array"));var n=Array.prototype.slice.call(r);if(n.length===0)return t([]);var i=n.length;function o(s,u){try{if(u&&(typeof u=="object"||typeof u=="function")){var h=u.then;if(typeof h=="function"){h.call(u,function(l){o(s,l)},e);return}}n[s]=u,--i===0&&t(n)}catch(l){e(l)}}for(var a=0;a<n.length;a++)o(a,n[a])})},St.any=td,St.allSettled=Qc,St.resolve=function(r){return r&&typeof r=="object"&&r.constructor===St?r:new St(function(t){t(r)})},St.reject=function(r){return new St(function(t,e){e(r)})},St.race=function(r){return new St(function(t,e){if(!Zs(r))return e(new TypeError("Promise.race accepts an array"));for(var n=0,i=r.length;n<i;n++)St.resolve(r[n]).then(t,e)})},St._immediateFn=typeof setImmediate=="function"&&function(r){setImmediate(r)}||function(r){ed(r,0)},St._unhandledRejectionFn=function(t){typeof console<"u"&&console&&console.warn("Possible Unhandled Promise Rejection:",t)};var Hn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function _o(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function od(r){if(r.__esModule)return r;var t=r.default;if(typeof t=="function"){var e=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(r).forEach(function(n){var i=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:function(){return r[n]}})}),e}/*
2
- object-assign
3
- (c) Sindre Sorhus
4
- @license MIT
5
- */var tu=Object.getOwnPropertySymbols,ad=Object.prototype.hasOwnProperty,sd=Object.prototype.propertyIsEnumerable;function ud(r){if(r==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function hd(){try{if(!Object.assign)return!1;var r=new String("abc");if(r[5]="de",Object.getOwnPropertyNames(r)[0]==="5")return!1;for(var t={},e=0;e<10;e++)t["_"+String.fromCharCode(e)]=e;var n=Object.getOwnPropertyNames(t).map(function(o){return t[o]});if(n.join("")!=="0123456789")return!1;var i={};return"abcdefghijklmnopqrst".split("").forEach(function(o){i[o]=o}),Object.keys(Object.assign({},i)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}var ld=hd()?Object.assign:function(r,t){for(var e,n=ud(r),i,o=1;o<arguments.length;o++){e=Object(arguments[o]);for(var a in e)ad.call(e,a)&&(n[a]=e[a]);if(tu){i=tu(e);for(var s=0;s<i.length;s++)sd.call(e,i[s])&&(n[i[s]]=e[i[s]])}}return n};const fd=_o(ld);/*!
6
- * @pixi/polyfill - v6.5.10
7
- * Compiled Thu, 06 Jul 2023 15:25:11 UTC
8
- *
9
- * @pixi/polyfill is licensed under the MIT License.
10
- * http://www.opensource.org/licenses/mit-license
11
- */typeof globalThis>"u"&&(typeof self<"u"?self.globalThis=self:typeof global<"u"&&(global.globalThis=global)),globalThis.Promise||(globalThis.Promise=St),Object.assign||(Object.assign=fd);var cd=16;if(Date.now&&Date.prototype.getTime||(Date.now=function(){return new Date().getTime()}),!(globalThis.performance&&globalThis.performance.now)){var dd=Date.now();globalThis.performance||(globalThis.performance={}),globalThis.performance.now=function(){return Date.now()-dd}}for(var mo=Date.now(),eu=["ms","moz","webkit","o"],go=0;go<eu.length&&!globalThis.requestAnimationFrame;++go){var yo=eu[go];globalThis.requestAnimationFrame=globalThis[yo+"RequestAnimationFrame"],globalThis.cancelAnimationFrame=globalThis[yo+"CancelAnimationFrame"]||globalThis[yo+"CancelRequestAnimationFrame"]}globalThis.requestAnimationFrame||(globalThis.requestAnimationFrame=function(r){if(typeof r!="function")throw new TypeError(r+"is not a function");var t=Date.now(),e=cd+mo-t;return e<0&&(e=0),mo=t,globalThis.self.setTimeout(function(){mo=Date.now(),r(performance.now())},e)}),globalThis.cancelAnimationFrame||(globalThis.cancelAnimationFrame=function(r){return clearTimeout(r)}),Math.sign||(Math.sign=function(t){return t=Number(t),t===0||isNaN(t)?t:t>0?1:-1}),Number.isInteger||(Number.isInteger=function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t}),globalThis.ArrayBuffer||(globalThis.ArrayBuffer=Array),globalThis.Float32Array||(globalThis.Float32Array=Array),globalThis.Uint32Array||(globalThis.Uint32Array=Array),globalThis.Uint16Array||(globalThis.Uint16Array=Array),globalThis.Uint8Array||(globalThis.Uint8Array=Array),globalThis.Int32Array||(globalThis.Int32Array=Array);/*!
12
- * @pixi/constants - v6.5.10
13
- * Compiled Thu, 06 Jul 2023 15:25:11 UTC
14
- *
15
- * @pixi/constants is licensed under the MIT License.
16
- * http://www.opensource.org/licenses/mit-license
17
- */var Se;(function(r){r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2"})(Se||(Se={}));var an;(function(r){r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS"})(an||(an={}));var jn;(function(r){r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL"})(jn||(jn={}));var j;(function(r){r[r.NORMAL=0]="NORMAL",r[r.ADD=1]="ADD",r[r.MULTIPLY=2]="MULTIPLY",r[r.SCREEN=3]="SCREEN",r[r.OVERLAY=4]="OVERLAY",r[r.DARKEN=5]="DARKEN",r[r.LIGHTEN=6]="LIGHTEN",r[r.COLOR_DODGE=7]="COLOR_DODGE",r[r.COLOR_BURN=8]="COLOR_BURN",r[r.HARD_LIGHT=9]="HARD_LIGHT",r[r.SOFT_LIGHT=10]="SOFT_LIGHT",r[r.DIFFERENCE=11]="DIFFERENCE",r[r.EXCLUSION=12]="EXCLUSION",r[r.HUE=13]="HUE",r[r.SATURATION=14]="SATURATION",r[r.COLOR=15]="COLOR",r[r.LUMINOSITY=16]="LUMINOSITY",r[r.NORMAL_NPM=17]="NORMAL_NPM",r[r.ADD_NPM=18]="ADD_NPM",r[r.SCREEN_NPM=19]="SCREEN_NPM",r[r.NONE=20]="NONE",r[r.SRC_OVER=0]="SRC_OVER",r[r.SRC_IN=21]="SRC_IN",r[r.SRC_OUT=22]="SRC_OUT",r[r.SRC_ATOP=23]="SRC_ATOP",r[r.DST_OVER=24]="DST_OVER",r[r.DST_IN=25]="DST_IN",r[r.DST_OUT=26]="DST_OUT",r[r.DST_ATOP=27]="DST_ATOP",r[r.ERASE=26]="ERASE",r[r.SUBTRACT=28]="SUBTRACT",r[r.XOR=29]="XOR"})(j||(j={}));var oe;(function(r){r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN"})(oe||(oe={}));var U;(function(r){r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL"})(U||(U={}));var Ze;(function(r){r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z"})(Ze||(Ze={}));var H;(function(r){r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT"})(H||(H={}));var Vn;(function(r){r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT"})(Vn||(Vn={}));var _e;(function(r){r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR"})(_e||(_e={}));var me;(function(r){r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"})(me||(me={}));var ae;(function(r){r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL"})(ae||(ae={}));var se;(function(r){r[r.NPM=0]="NPM",r[r.UNPACK=1]="UNPACK",r[r.PMA=2]="PMA",r[r.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",r[r.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",r[r.PREMULTIPLY_ALPHA=2]="PREMULTIPLY_ALPHA",r[r.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA"})(se||(se={}));var ue;(function(r){r[r.NO=0]="NO",r[r.YES=1]="YES",r[r.AUTO=2]="AUTO",r[r.BLEND=0]="BLEND",r[r.CLEAR=1]="CLEAR",r[r.BLIT=2]="BLIT"})(ue||(ue={}));var Yn;(function(r){r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL"})(Yn||(Yn={}));var Jt;(function(r){r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp"})(Jt||(Jt={}));var Ct;(function(r){r[r.NONE=0]="NONE",r[r.SCISSOR=1]="SCISSOR",r[r.STENCIL=2]="STENCIL",r[r.SPRITE=3]="SPRITE",r[r.COLOR=4]="COLOR"})(Ct||(Ct={}));var ru;(function(r){r[r.RED=1]="RED",r[r.GREEN=2]="GREEN",r[r.BLUE=4]="BLUE",r[r.ALPHA=8]="ALPHA"})(ru||(ru={}));var wt;(function(r){r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH"})(wt||(wt={}));var ge;(function(r){r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER"})(ge||(ge={}));/*!
18
- * @pixi/settings - v6.5.10
19
- * Compiled Thu, 06 Jul 2023 15:25:11 UTC
20
- *
21
- * @pixi/settings is licensed under the MIT License.
22
- * http://www.opensource.org/licenses/mit-license
23
- */var pd={createCanvas:function(r,t){var e=document.createElement("canvas");return e.width=r,e.height=t,e},getWebGLRenderingContext:function(){return WebGLRenderingContext},getNavigator:function(){return navigator},getBaseUrl:function(){var r;return(r=document.baseURI)!==null&&r!==void 0?r:window.location.href},fetch:function(r,t){return fetch(r,t)}},bo=/iPhone/i,nu=/iPod/i,iu=/iPad/i,ou=/\biOS-universal(?:.+)Mac\b/i,xo=/\bAndroid(?:.+)Mobile\b/i,au=/Android/i,Ar=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,zn=/Silk/i,Ae=/Windows Phone/i,su=/\bWindows(?:.+)ARM\b/i,uu=/BlackBerry/i,hu=/BB10/i,lu=/Opera Mini/i,fu=/\b(CriOS|Chrome)(?:.+)Mobile/i,cu=/Mobile(?:.+)Firefox\b/i,du=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"};function vd(r){return function(t){return t.test(r)}}function _d(r){var t={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?t.userAgent=r:r&&r.userAgent&&(t={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var e=t.userAgent,n=e.split("[FBAN");typeof n[1]<"u"&&(e=n[0]),n=e.split("Twitter"),typeof n[1]<"u"&&(e=n[0]);var i=vd(e),o={apple:{phone:i(bo)&&!i(Ae),ipod:i(nu),tablet:!i(bo)&&(i(iu)||du(t))&&!i(Ae),universal:i(ou),device:(i(bo)||i(nu)||i(iu)||i(ou)||du(t))&&!i(Ae)},amazon:{phone:i(Ar),tablet:!i(Ar)&&i(zn),device:i(Ar)||i(zn)},android:{phone:!i(Ae)&&i(Ar)||!i(Ae)&&i(xo),tablet:!i(Ae)&&!i(Ar)&&!i(xo)&&(i(zn)||i(au)),device:!i(Ae)&&(i(Ar)||i(zn)||i(xo)||i(au))||i(/\bokhttp\b/i)},windows:{phone:i(Ae),tablet:i(su),device:i(Ae)||i(su)},other:{blackberry:i(uu),blackberry10:i(hu),opera:i(lu),firefox:i(cu),chrome:i(fu),device:i(uu)||i(hu)||i(lu)||i(cu)||i(fu)},any:!1,phone:!1,tablet:!1};return o.any=o.apple.device||o.android.device||o.windows.device||o.other.device,o.phone=o.apple.phone||o.android.phone||o.windows.phone,o.tablet=o.apple.tablet||o.android.tablet||o.windows.tablet,o}var ye=_d(globalThis.navigator);function md(){return!ye.apple.device}function gd(r){var t=!0;if(ye.tablet||ye.phone){if(ye.apple.device){var e=navigator.userAgent.match(/OS (\d+)_(\d+)?/);if(e){var n=parseInt(e[1],10);n<11&&(t=!1)}}if(ye.android.device){var e=navigator.userAgent.match(/Android\s([0-9.]*)/);if(e){var n=parseInt(e[1],10);n<7&&(t=!1)}}}return t?r:4}var k={ADAPTER:pd,MIPMAP_TEXTURES:ae.POW2,ANISOTROPIC_LEVEL:0,RESOLUTION:1,FILTER_RESOLUTION:1,FILTER_MULTISAMPLE:wt.NONE,SPRITE_MAX_TEXTURES:gd(32),SPRITE_BATCH_SIZE:4096,RENDER_OPTIONS:{view:null,width:800,height:600,autoDensity:!1,backgroundColor:0,backgroundAlpha:1,useContextAlpha:!0,clearBeforeRender:!0,antialias:!1,preserveDrawingBuffer:!1},GC_MODE:Yn.AUTO,GC_MAX_IDLE:60*60,GC_MAX_CHECK_COUNT:60*10,WRAP_MODE:me.CLAMP,SCALE_MODE:_e.LINEAR,PRECISION_VERTEX:Jt.HIGH,PRECISION_FRAGMENT:ye.apple.device?Jt.HIGH:Jt.MEDIUM,CAN_UPLOAD_SAME_BUFFER:md(),CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1},pu={exports:{}};(function(r){var t=Object.prototype.hasOwnProperty,e="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(e=!1));function i(u,h,l){this.fn=u,this.context=h,this.once=l||!1}function o(u,h,l,f,c){if(typeof l!="function")throw new TypeError("The listener must be a function");var d=new i(l,f||u,c),p=e?e+h:h;return u._events[p]?u._events[p].fn?u._events[p]=[u._events[p],d]:u._events[p].push(d):(u._events[p]=d,u._eventsCount++),u}function a(u,h){--u._eventsCount===0?u._events=new n:delete u._events[h]}function s(){this._events=new n,this._eventsCount=0}s.prototype.eventNames=function(){var h=[],l,f;if(this._eventsCount===0)return h;for(f in l=this._events)t.call(l,f)&&h.push(e?f.slice(1):f);return Object.getOwnPropertySymbols?h.concat(Object.getOwnPropertySymbols(l)):h},s.prototype.listeners=function(h){var l=e?e+h:h,f=this._events[l];if(!f)return[];if(f.fn)return[f.fn];for(var c=0,d=f.length,p=new Array(d);c<d;c++)p[c]=f[c].fn;return p},s.prototype.listenerCount=function(h){var l=e?e+h:h,f=this._events[l];return f?f.fn?1:f.length:0},s.prototype.emit=function(h,l,f,c,d,p){var v=e?e+h:h;if(!this._events[v])return!1;var _=this._events[v],m=arguments.length,g,y;if(_.fn){switch(_.once&&this.removeListener(h,_.fn,void 0,!0),m){case 1:return _.fn.call(_.context),!0;case 2:return _.fn.call(_.context,l),!0;case 3:return _.fn.call(_.context,l,f),!0;case 4:return _.fn.call(_.context,l,f,c),!0;case 5:return _.fn.call(_.context,l,f,c,d),!0;case 6:return _.fn.call(_.context,l,f,c,d,p),!0}for(y=1,g=new Array(m-1);y<m;y++)g[y-1]=arguments[y];_.fn.apply(_.context,g)}else{var E=_.length,b;for(y=0;y<E;y++)switch(_[y].once&&this.removeListener(h,_[y].fn,void 0,!0),m){case 1:_[y].fn.call(_[y].context);break;case 2:_[y].fn.call(_[y].context,l);break;case 3:_[y].fn.call(_[y].context,l,f);break;case 4:_[y].fn.call(_[y].context,l,f,c);break;default:if(!g)for(b=1,g=new Array(m-1);b<m;b++)g[b-1]=arguments[b];_[y].fn.apply(_[y].context,g)}}return!0},s.prototype.on=function(h,l,f){return o(this,h,l,f,!1)},s.prototype.once=function(h,l,f){return o(this,h,l,f,!0)},s.prototype.removeListener=function(h,l,f,c){var d=e?e+h:h;if(!this._events[d])return this;if(!l)return a(this,d),this;var p=this._events[d];if(p.fn)p.fn===l&&(!c||p.once)&&(!f||p.context===f)&&a(this,d);else{for(var v=0,_=[],m=p.length;v<m;v++)(p[v].fn!==l||c&&!p[v].once||f&&p[v].context!==f)&&_.push(p[v]);_.length?this._events[d]=_.length===1?_[0]:_:a(this,d)}return this},s.prototype.removeAllListeners=function(h){var l;return h?(l=e?e+h:h,this._events[l]&&a(this,l)):(this._events=new n,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=e,s.EventEmitter=s,r.exports=s})(pu);var yd=pu.exports;const sn=_o(yd);var Eo={exports:{}};Eo.exports=Wn,Eo.exports.default=Wn;function Wn(r,t,e){e=e||2;var n=t&&t.length,i=n?t[0]*e:r.length,o=vu(r,0,i,e,!0),a=[];if(!o||o.next===o.prev)return a;var s,u,h,l,f,c,d;if(n&&(o=wd(r,t,o,e)),r.length>80*e){s=h=r[0],u=l=r[1];for(var p=e;p<i;p+=e)f=r[p],c=r[p+1],f<s&&(s=f),c<u&&(u=c),f>h&&(h=f),c>l&&(l=c);d=Math.max(h-s,l-u),d=d!==0?32767/d:0}return un(o,a,e,s,u,d,0),a}function vu(r,t,e,n,i){var o,a;if(i===So(r,t,e,n)>0)for(o=t;o<e;o+=n)a=gu(o,r[o],r[o+1],a);else for(o=e-n;o>=t;o-=n)a=gu(o,r[o],r[o+1],a);return a&&qn(a,a.next)&&(ln(a),a=a.next),a}function Je(r,t){if(!r)return r;t||(t=r);var e=r,n;do if(n=!1,!e.steiner&&(qn(e,e.next)||At(e.prev,e,e.next)===0)){if(ln(e),e=t=e.prev,e===e.next)break;n=!0}else e=e.next;while(n||e!==t);return t}function un(r,t,e,n,i,o,a){if(r){!a&&o&&Rd(r,n,i,o);for(var s=r,u,h;r.prev!==r.next;){if(u=r.prev,h=r.next,o?xd(r,n,i,o):bd(r)){t.push(u.i/e|0),t.push(r.i/e|0),t.push(h.i/e|0),ln(r),r=h.next,s=h.next;continue}if(r=h,r===s){a?a===1?(r=Ed(Je(r),t,e),un(r,t,e,n,i,o,2)):a===2&&Td(r,t,e,n,i,o):un(Je(r),t,e,n,i,o,1);break}}}}function bd(r){var t=r.prev,e=r,n=r.next;if(At(t,e,n)>=0)return!1;for(var i=t.x,o=e.x,a=n.x,s=t.y,u=e.y,h=n.y,l=i<o?i<a?i:a:o<a?o:a,f=s<u?s<h?s:h:u<h?u:h,c=i>o?i>a?i:a:o>a?o:a,d=s>u?s>h?s:h:u>h?u:h,p=n.next;p!==t;){if(p.x>=l&&p.x<=c&&p.y>=f&&p.y<=d&&Pr(i,s,o,u,a,h,p.x,p.y)&&At(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function xd(r,t,e,n){var i=r.prev,o=r,a=r.next;if(At(i,o,a)>=0)return!1;for(var s=i.x,u=o.x,h=a.x,l=i.y,f=o.y,c=a.y,d=s<u?s<h?s:h:u<h?u:h,p=l<f?l<c?l:c:f<c?f:c,v=s>u?s>h?s:h:u>h?u:h,_=l>f?l>c?l:c:f>c?f:c,m=To(d,p,t,e,n),g=To(v,_,t,e,n),y=r.prevZ,E=r.nextZ;y&&y.z>=m&&E&&E.z<=g;){if(y.x>=d&&y.x<=v&&y.y>=p&&y.y<=_&&y!==i&&y!==a&&Pr(s,l,u,f,h,c,y.x,y.y)&&At(y.prev,y,y.next)>=0||(y=y.prevZ,E.x>=d&&E.x<=v&&E.y>=p&&E.y<=_&&E!==i&&E!==a&&Pr(s,l,u,f,h,c,E.x,E.y)&&At(E.prev,E,E.next)>=0))return!1;E=E.nextZ}for(;y&&y.z>=m;){if(y.x>=d&&y.x<=v&&y.y>=p&&y.y<=_&&y!==i&&y!==a&&Pr(s,l,u,f,h,c,y.x,y.y)&&At(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;E&&E.z<=g;){if(E.x>=d&&E.x<=v&&E.y>=p&&E.y<=_&&E!==i&&E!==a&&Pr(s,l,u,f,h,c,E.x,E.y)&&At(E.prev,E,E.next)>=0)return!1;E=E.nextZ}return!0}function Ed(r,t,e){var n=r;do{var i=n.prev,o=n.next.next;!qn(i,o)&&_u(i,n,n.next,o)&&hn(i,o)&&hn(o,i)&&(t.push(i.i/e|0),t.push(n.i/e|0),t.push(o.i/e|0),ln(n),ln(n.next),n=r=o),n=n.next}while(n!==r);return Je(n)}function Td(r,t,e,n,i,o){var a=r;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&Md(a,s)){var u=mu(a,s);a=Je(a,a.next),u=Je(u,u.next),un(a,t,e,n,i,o,0),un(u,t,e,n,i,o,0);return}s=s.next}a=a.next}while(a!==r)}function wd(r,t,e,n){var i=[],o,a,s,u,h;for(o=0,a=t.length;o<a;o++)s=t[o]*n,u=o<a-1?t[o+1]*n:r.length,h=vu(r,s,u,n,!1),h===h.next&&(h.steiner=!0),i.push(Cd(h));for(i.sort(Sd),o=0;o<i.length;o++)e=Ad(i[o],e);return e}function Sd(r,t){return r.x-t.x}function Ad(r,t){var e=Pd(r,t);if(!e)return t;var n=mu(e,r);return Je(n,n.next),Je(e,e.next)}function Pd(r,t){var e=t,n=r.x,i=r.y,o=-1/0,a;do{if(i<=e.y&&i>=e.next.y&&e.next.y!==e.y){var s=e.x+(i-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(s<=n&&s>o&&(o=s,a=e.x<e.next.x?e:e.next,s===n))return a}e=e.next}while(e!==t);if(!a)return null;var u=a,h=a.x,l=a.y,f=1/0,c;e=a;do n>=e.x&&e.x>=h&&n!==e.x&&Pr(i<l?n:o,i,h,l,i<l?o:n,i,e.x,e.y)&&(c=Math.abs(i-e.y)/(n-e.x),hn(e,r)&&(c<f||c===f&&(e.x>a.x||e.x===a.x&&Od(a,e)))&&(a=e,f=c)),e=e.next;while(e!==u);return a}function Od(r,t){return At(r.prev,r,t.prev)<0&&At(t.next,r,r.next)<0}function Rd(r,t,e,n){var i=r;do i.z===0&&(i.z=To(i.x,i.y,t,e,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,Id(i)}function Id(r){var t,e,n,i,o,a,s,u,h=1;do{for(e=r,r=null,o=null,a=0;e;){for(a++,n=e,s=0,t=0;t<h&&(s++,n=n.nextZ,!!n);t++);for(u=h;s>0||u>0&&n;)s!==0&&(u===0||!n||e.z<=n.z)?(i=e,e=e.nextZ,s--):(i=n,n=n.nextZ,u--),o?o.nextZ=i:r=i,i.prevZ=o,o=i;e=n}o.nextZ=null,h*=2}while(a>1);return r}function To(r,t,e,n,i){return r=(r-e)*i|0,t=(t-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function Cd(r){var t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function Pr(r,t,e,n,i,o,a,s){return(i-a)*(t-s)>=(r-a)*(o-s)&&(r-a)*(n-s)>=(e-a)*(t-s)&&(e-a)*(o-s)>=(i-a)*(n-s)}function Md(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!Dd(r,t)&&(hn(r,t)&&hn(t,r)&&Fd(r,t)&&(At(r.prev,r,t.prev)||At(r,t.prev,t))||qn(r,t)&&At(r.prev,r,r.next)>0&&At(t.prev,t,t.next)>0)}function At(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function qn(r,t){return r.x===t.x&&r.y===t.y}function _u(r,t,e,n){var i=Kn(At(r,t,e)),o=Kn(At(r,t,n)),a=Kn(At(e,n,r)),s=Kn(At(e,n,t));return!!(i!==o&&a!==s||i===0&&$n(r,e,t)||o===0&&$n(r,n,t)||a===0&&$n(e,r,n)||s===0&&$n(e,t,n))}function $n(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function Kn(r){return r>0?1:r<0?-1:0}function Dd(r,t){var e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&_u(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function hn(r,t){return At(r.prev,r,r.next)<0?At(r,t,r.next)>=0&&At(r,r.prev,t)>=0:At(r,t,r.prev)<0||At(r,r.next,t)<0}function Fd(r,t){var e=r,n=!1,i=(r.x+t.x)/2,o=(r.y+t.y)/2;do e.y>o!=e.next.y>o&&e.next.y!==e.y&&i<(e.next.x-e.x)*(o-e.y)/(e.next.y-e.y)+e.x&&(n=!n),e=e.next;while(e!==r);return n}function mu(r,t){var e=new wo(r.i,r.x,r.y),n=new wo(t.i,t.x,t.y),i=r.next,o=t.prev;return r.next=t,t.prev=r,e.next=i,i.prev=e,n.next=e,e.prev=n,o.next=n,n.prev=o,n}function gu(r,t,e,n){var i=new wo(r,t,e);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function ln(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function wo(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Wn.deviation=function(r,t,e,n){var i=t&&t.length,o=i?t[0]*e:r.length,a=Math.abs(So(r,0,o,e));if(i)for(var s=0,u=t.length;s<u;s++){var h=t[s]*e,l=s<u-1?t[s+1]*e:r.length;a-=Math.abs(So(r,h,l,e))}var f=0;for(s=0;s<n.length;s+=3){var c=n[s]*e,d=n[s+1]*e,p=n[s+2]*e;f+=Math.abs((r[c]-r[p])*(r[d+1]-r[c+1])-(r[c]-r[d])*(r[p+1]-r[c+1]))}return a===0&&f===0?0:Math.abs((f-a)/a)};function So(r,t,e,n){for(var i=0,o=t,a=e-n;o<e;o+=n)i+=(r[a]-r[o])*(r[o+1]+r[a+1]),a=o;return i}Wn.flatten=function(r){for(var t=r[0][0].length,e={vertices:[],holes:[],dimensions:t},n=0,i=0;i<r.length;i++){for(var o=0;o<r[i].length;o++)for(var a=0;a<t;a++)e.vertices.push(r[i][o][a]);i>0&&(n+=r[i-1].length,e.holes.push(n))}return e};var Bd=Eo.exports;const yu=_o(Bd);var Zn={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */Zn.exports,function(r,t){(function(e){var n=t&&!t.nodeType&&t,i=r&&!r.nodeType&&r,o=typeof Hn=="object"&&Hn;(o.global===o||o.window===o||o.self===o)&&(e=o);var a,s=2147483647,u=36,h=1,l=26,f=38,c=700,d=72,p=128,v="-",_=/^xn--/,m=/[^\x20-\x7E]/,g=/[\x2E\u3002\uFF0E\uFF61]/g,y={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},E=u-h,b=Math.floor,S=String.fromCharCode,P;function T(L){throw new RangeError(y[L])}function x(L,F){for(var X=L.length,tt=[];X--;)tt[X]=F(L[X]);return tt}function w(L,F){var X=L.split("@"),tt="";X.length>1&&(tt=X[0]+"@",L=X[1]),L=L.replace(g,".");var rt=L.split("."),vt=x(rt,F).join(".");return tt+vt}function O(L){for(var F=[],X=0,tt=L.length,rt,vt;X<tt;)rt=L.charCodeAt(X++),rt>=55296&&rt<=56319&&X<tt?(vt=L.charCodeAt(X++),(vt&64512)==56320?F.push(((rt&1023)<<10)+(vt&1023)+65536):(F.push(rt),X--)):F.push(rt);return F}function I(L){return x(L,function(F){var X="";return F>65535&&(F-=65536,X+=S(F>>>10&1023|55296),F=56320|F&1023),X+=S(F),X}).join("")}function C(L){return L-48<10?L-22:L-65<26?L-65:L-97<26?L-97:u}function G(L,F){return L+22+75*(L<26)-((F!=0)<<5)}function B(L,F,X){var tt=0;for(L=X?b(L/c):L>>1,L+=b(L/F);L>E*l>>1;tt+=u)L=b(L/E);return b(tt+(E+1)*L/(L+f))}function N(L){var F=[],X=L.length,tt,rt=0,vt=p,V=d,ht,gt,Tt,q,it,at,ct,nt,D;for(ht=L.lastIndexOf(v),ht<0&&(ht=0),gt=0;gt<ht;++gt)L.charCodeAt(gt)>=128&&T("not-basic"),F.push(L.charCodeAt(gt));for(Tt=ht>0?ht+1:0;Tt<X;){for(q=rt,it=1,at=u;Tt>=X&&T("invalid-input"),ct=C(L.charCodeAt(Tt++)),(ct>=u||ct>b((s-rt)/it))&&T("overflow"),rt+=ct*it,nt=at<=V?h:at>=V+l?l:at-V,!(ct<nt);at+=u)D=u-nt,it>b(s/D)&&T("overflow"),it*=D;tt=F.length+1,V=B(rt-q,tt,q==0),b(rt/tt)>s-vt&&T("overflow"),vt+=b(rt/tt),rt%=tt,F.splice(rt++,0,vt)}return I(F)}function W(L){var F,X,tt,rt,vt,V,ht,gt,Tt,q,it,at=[],ct,nt,D,R;for(L=O(L),ct=L.length,F=p,X=0,vt=d,V=0;V<ct;++V)it=L[V],it<128&&at.push(S(it));for(tt=rt=at.length,rt&&at.push(v);tt<ct;){for(ht=s,V=0;V<ct;++V)it=L[V],it>=F&&it<ht&&(ht=it);for(nt=tt+1,ht-F>b((s-X)/nt)&&T("overflow"),X+=(ht-F)*nt,F=ht,V=0;V<ct;++V)if(it=L[V],it<F&&++X>s&&T("overflow"),it==F){for(gt=X,Tt=u;q=Tt<=vt?h:Tt>=vt+l?l:Tt-vt,!(gt<q);Tt+=u)R=gt-q,D=u-q,at.push(S(G(q+R%D,0))),gt=b(R/D);at.push(S(G(gt,0))),vt=B(X,nt,tt==rt),X=0,++tt}++X,++F}return at.join("")}function K(L){return w(L,function(F){return _.test(F)?N(F.slice(4).toLowerCase()):F})}function Q(L){return w(L,function(F){return m.test(F)?"xn--"+W(F):F})}if(a={version:"1.4.1",ucs2:{decode:O,encode:I},decode:N,encode:W,toASCII:Q,toUnicode:K},n&&i)if(r.exports==n)i.exports=a;else for(P in a)a.hasOwnProperty(P)&&(n[P]=a[P]);else e.punycode=a})(Hn)}(Zn,Zn.exports);var Nd=Zn.exports,Ld=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),n=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;t[e]=i;for(e in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var o=Object.getOwnPropertySymbols(t);if(o.length!==1||o[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(t,e);if(a.value!==i||a.enumerable!==!0)return!1}return!0},bu=typeof Symbol<"u"&&Symbol,Ud=Ld,Gd=function(){return typeof bu!="function"||typeof Symbol!="function"||typeof bu("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Ud()},xu={foo:{}},kd=Object,Xd=function(){return{__proto__:xu}.foo===xu.foo&&!({__proto__:null}instanceof kd)},Hd="Function.prototype.bind called on incompatible ",jd=Object.prototype.toString,Vd=Math.max,Yd="[object Function]",Eu=function(t,e){for(var n=[],i=0;i<t.length;i+=1)n[i]=t[i];for(var o=0;o<e.length;o+=1)n[o+t.length]=e[o];return n},zd=function(t,e){for(var n=[],i=e||0,o=0;i<t.length;i+=1,o+=1)n[o]=t[i];return n},Wd=function(r,t){for(var e="",n=0;n<r.length;n+=1)e+=r[n],n+1<r.length&&(e+=t);return e},qd=function(t){var e=this;if(typeof e!="function"||jd.apply(e)!==Yd)throw new TypeError(Hd+e);for(var n=zd(arguments,1),i,o=function(){if(this instanceof i){var l=e.apply(this,Eu(n,arguments));return Object(l)===l?l:this}return e.apply(t,Eu(n,arguments))},a=Vd(0,e.length-n.length),s=[],u=0;u<a;u++)s[u]="$"+u;if(i=Function("binder","return function ("+Wd(s,",")+"){ return binder.apply(this,arguments); }")(o),e.prototype){var h=function(){};h.prototype=e.prototype,i.prototype=new h,h.prototype=null}return i},$d=qd,Ao=Function.prototype.bind||$d,Kd=Function.prototype.call,Zd=Object.prototype.hasOwnProperty,Jd=Ao,Qd=Jd.call(Kd,Zd),ot,Or=SyntaxError,Tu=Function,Rr=TypeError,Po=function(r){try{return Tu('"use strict"; return ('+r+").constructor;")()}catch{}},Qe=Object.getOwnPropertyDescriptor;if(Qe)try{Qe({},"")}catch{Qe=null}var Oo=function(){throw new Rr},tp=Qe?function(){try{return arguments.callee,Oo}catch{try{return Qe(arguments,"callee").get}catch{return Oo}}}():Oo,Ir=Gd(),ep=Xd(),Ft=Object.getPrototypeOf||(ep?function(r){return r.__proto__}:null),Cr={},rp=typeof Uint8Array>"u"||!Ft?ot:Ft(Uint8Array),tr={"%AggregateError%":typeof AggregateError>"u"?ot:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?ot:ArrayBuffer,"%ArrayIteratorPrototype%":Ir&&Ft?Ft([][Symbol.iterator]()):ot,"%AsyncFromSyncIteratorPrototype%":ot,"%AsyncFunction%":Cr,"%AsyncGenerator%":Cr,"%AsyncGeneratorFunction%":Cr,"%AsyncIteratorPrototype%":Cr,"%Atomics%":typeof Atomics>"u"?ot:Atomics,"%BigInt%":typeof BigInt>"u"?ot:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?ot:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?ot:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?ot:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?ot:Float32Array,"%Float64Array%":typeof Float64Array>"u"?ot:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?ot:FinalizationRegistry,"%Function%":Tu,"%GeneratorFunction%":Cr,"%Int8Array%":typeof Int8Array>"u"?ot:Int8Array,"%Int16Array%":typeof Int16Array>"u"?ot:Int16Array,"%Int32Array%":typeof Int32Array>"u"?ot:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ir&&Ft?Ft(Ft([][Symbol.iterator]())):ot,"%JSON%":typeof JSON=="object"?JSON:ot,"%Map%":typeof Map>"u"?ot:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Ir||!Ft?ot:Ft(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?ot:Promise,"%Proxy%":typeof Proxy>"u"?ot:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?ot:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?ot:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Ir||!Ft?ot:Ft(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?ot:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ir&&Ft?Ft(""[Symbol.iterator]()):ot,"%Symbol%":Ir?Symbol:ot,"%SyntaxError%":Or,"%ThrowTypeError%":tp,"%TypedArray%":rp,"%TypeError%":Rr,"%Uint8Array%":typeof Uint8Array>"u"?ot:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?ot:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?ot:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?ot:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?ot:WeakMap,"%WeakRef%":typeof WeakRef>"u"?ot:WeakRef,"%WeakSet%":typeof WeakSet>"u"?ot:WeakSet};if(Ft)try{null.error}catch(r){var np=Ft(Ft(r));tr["%Error.prototype%"]=np}var ip=function r(t){var e;if(t==="%AsyncFunction%")e=Po("async function () {}");else if(t==="%GeneratorFunction%")e=Po("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=Po("async function* () {}");else if(t==="%AsyncGenerator%"){var n=r("%AsyncGeneratorFunction%");n&&(e=n.prototype)}else if(t==="%AsyncIteratorPrototype%"){var i=r("%AsyncGenerator%");i&&Ft&&(e=Ft(i.prototype))}return tr[t]=e,e},wu={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},fn=Ao,Jn=Qd,op=fn.call(Function.call,Array.prototype.concat),ap=fn.call(Function.apply,Array.prototype.splice),Su=fn.call(Function.call,String.prototype.replace),Qn=fn.call(Function.call,String.prototype.slice),sp=fn.call(Function.call,RegExp.prototype.exec),up=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,hp=/\\(\\)?/g,lp=function(t){var e=Qn(t,0,1),n=Qn(t,-1);if(e==="%"&&n!=="%")throw new Or("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&e!=="%")throw new Or("invalid intrinsic syntax, expected opening `%`");var i=[];return Su(t,up,function(o,a,s,u){i[i.length]=s?Su(u,hp,"$1"):a||o}),i},fp=function(t,e){var n=t,i;if(Jn(wu,n)&&(i=wu[n],n="%"+i[0]+"%"),Jn(tr,n)){var o=tr[n];if(o===Cr&&(o=ip(n)),typeof o>"u"&&!e)throw new Rr("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:o}}throw new Or("intrinsic "+t+" does not exist!")},er=function(t,e){if(typeof t!="string"||t.length===0)throw new Rr("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Rr('"allowMissing" argument must be a boolean');if(sp(/^%?[^%]*%?$/,t)===null)throw new Or("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=lp(t),i=n.length>0?n[0]:"",o=fp("%"+i+"%",e),a=o.name,s=o.value,u=!1,h=o.alias;h&&(i=h[0],ap(n,op([0,1],h)));for(var l=1,f=!0;l<n.length;l+=1){var c=n[l],d=Qn(c,0,1),p=Qn(c,-1);if((d==='"'||d==="'"||d==="`"||p==='"'||p==="'"||p==="`")&&d!==p)throw new Or("property names with quotes must have matching quotes");if((c==="constructor"||!f)&&(u=!0),i+="."+c,a="%"+i+"%",Jn(tr,a))s=tr[a];else if(s!=null){if(!(c in s)){if(!e)throw new Rr("base intrinsic for "+t+" exists, but the property is not available.");return}if(Qe&&l+1>=n.length){var v=Qe(s,c);f=!!v,f&&"get"in v&&!("originalValue"in v.get)?s=v.get:s=s[c]}else f=Jn(s,c),s=s[c];f&&!u&&(tr[a]=s)}}return s},Au={exports:{}},cp=er,Ro=cp("%Object.defineProperty%",!0),Io=function(){if(Ro)try{return Ro({},"a",{value:1}),!0}catch{return!1}return!1};Io.hasArrayLengthDefineBug=function(){if(!Io())return null;try{return Ro([],"length",{value:1}).length!==1}catch{return!0}};var Pu=Io,dp=er,ti=dp("%Object.getOwnPropertyDescriptor%",!0);if(ti)try{ti([],"length")}catch{ti=null}var Ou=ti,pp=Pu(),Co=er,cn=pp&&Co("%Object.defineProperty%",!0);if(cn)try{cn({},"a",{value:1})}catch{cn=!1}var vp=Co("%SyntaxError%"),Mr=Co("%TypeError%"),Ru=Ou,_p=function(t,e,n){if(!t||typeof t!="object"&&typeof t!="function")throw new Mr("`obj` must be an object or a function`");if(typeof e!="string"&&typeof e!="symbol")throw new Mr("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Mr("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Mr("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Mr("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Mr("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,o=arguments.length>4?arguments[4]:null,a=arguments.length>5?arguments[5]:null,s=arguments.length>6?arguments[6]:!1,u=!!Ru&&Ru(t,e);if(cn)cn(t,e,{configurable:a===null&&u?u.configurable:!a,enumerable:i===null&&u?u.enumerable:!i,value:n,writable:o===null&&u?u.writable:!o});else if(s||!i&&!o&&!a)t[e]=n;else throw new vp("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Iu=er,Cu=_p,mp=Pu(),Mu=Ou,Du=Iu("%TypeError%"),gp=Iu("%Math.floor%"),yp=function(t,e){if(typeof t!="function")throw new Du("`fn` is not a function");if(typeof e!="number"||e<0||e>4294967295||gp(e)!==e)throw new Du("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],i=!0,o=!0;if("length"in t&&Mu){var a=Mu(t,"length");a&&!a.configurable&&(i=!1),a&&!a.writable&&(o=!1)}return(i||o||!n)&&(mp?Cu(t,"length",e,!0,!0):Cu(t,"length",e)),t};(function(r){var t=Ao,e=er,n=yp,i=e("%TypeError%"),o=e("%Function.prototype.apply%"),a=e("%Function.prototype.call%"),s=e("%Reflect.apply%",!0)||t.call(a,o),u=e("%Object.defineProperty%",!0),h=e("%Math.max%");if(u)try{u({},"a",{value:1})}catch{u=null}r.exports=function(c){if(typeof c!="function")throw new i("a function is required");var d=s(t,a,arguments);return n(d,1+h(0,c.length-(arguments.length-1)),!0)};var l=function(){return s(t,o,arguments)};u?u(r.exports,"apply",{value:l}):r.exports.apply=l})(Au);var bp=Au.exports,Fu=er,Bu=bp,xp=Bu(Fu("String.prototype.indexOf")),Ep=function(t,e){var n=Fu(t,!!e);return typeof n=="function"&&xp(t,".prototype.")>-1?Bu(n):n};const Tp=od(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Mo=typeof Map=="function"&&Map.prototype,Do=Object.getOwnPropertyDescriptor&&Mo?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,ei=Mo&&Do&&typeof Do.get=="function"?Do.get:null,Nu=Mo&&Map.prototype.forEach,Fo=typeof Set=="function"&&Set.prototype,Bo=Object.getOwnPropertyDescriptor&&Fo?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,ri=Fo&&Bo&&typeof Bo.get=="function"?Bo.get:null,Lu=Fo&&Set.prototype.forEach,wp=typeof WeakMap=="function"&&WeakMap.prototype,dn=wp?WeakMap.prototype.has:null,Sp=typeof WeakSet=="function"&&WeakSet.prototype,pn=Sp?WeakSet.prototype.has:null,Ap=typeof WeakRef=="function"&&WeakRef.prototype,Uu=Ap?WeakRef.prototype.deref:null,Pp=Boolean.prototype.valueOf,Op=Object.prototype.toString,Rp=Function.prototype.toString,Ip=String.prototype.match,No=String.prototype.slice,Ge=String.prototype.replace,Cp=String.prototype.toUpperCase,Gu=String.prototype.toLowerCase,ku=RegExp.prototype.test,Xu=Array.prototype.concat,be=Array.prototype.join,Mp=Array.prototype.slice,Hu=Math.floor,Lo=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Uo=Object.getOwnPropertySymbols,Go=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Dr=typeof Symbol=="function"&&typeof Symbol.iterator=="object",jt=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Dr||"symbol")?Symbol.toStringTag:null,ju=Object.prototype.propertyIsEnumerable,Vu=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function Yu(r,t){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||ku.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var n=r<0?-Hu(-r):Hu(r);if(n!==r){var i=String(n),o=No.call(t,i.length+1);return Ge.call(i,e,"$&_")+"."+Ge.call(Ge.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Ge.call(t,e,"$&_")}var ko=Tp,zu=ko.custom,Wu=Ku(zu)?zu:null,Dp=function r(t,e,n,i){var o=e||{};if(ke(o,"quoteStyle")&&o.quoteStyle!=="single"&&o.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ke(o,"maxStringLength")&&(typeof o.maxStringLength=="number"?o.maxStringLength<0&&o.maxStringLength!==1/0:o.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var a=ke(o,"customInspect")?o.customInspect:!0;if(typeof a!="boolean"&&a!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(ke(o,"indent")&&o.indent!==null&&o.indent!==" "&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(ke(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var s=o.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return Ju(t,o);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var u=String(t);return s?Yu(t,u):u}if(typeof t=="bigint"){var h=String(t)+"n";return s?Yu(t,h):h}var l=typeof o.depth>"u"?5:o.depth;if(typeof n>"u"&&(n=0),n>=l&&l>0&&typeof t=="object")return Xo(t)?"[Array]":"[Object]";var f=Zp(o,n);if(typeof i>"u")i=[];else if(Zu(i,t)>=0)return"[Circular]";function c(C,G,B){if(G&&(i=Mp.call(i),i.push(G)),B){var N={depth:o.depth};return ke(o,"quoteStyle")&&(N.quoteStyle=o.quoteStyle),r(C,N,n+1,i)}return r(C,o,n+1,i)}if(typeof t=="function"&&!$u(t)){var d=Hp(t),p=ni(t,c);return"[Function"+(d?": "+d:" (anonymous)")+"]"+(p.length>0?" { "+be.call(p,", ")+" }":"")}if(Ku(t)){var v=Dr?Ge.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Go.call(t);return typeof t=="object"&&!Dr?vn(v):v}if(qp(t)){for(var _="<"+Gu.call(String(t.nodeName)),m=t.attributes||[],g=0;g<m.length;g++)_+=" "+m[g].name+"="+qu(Fp(m[g].value),"double",o);return _+=">",t.childNodes&&t.childNodes.length&&(_+="..."),_+="</"+Gu.call(String(t.nodeName))+">",_}if(Xo(t)){if(t.length===0)return"[]";var y=ni(t,c);return f&&!Kp(y)?"["+jo(y,f)+"]":"[ "+be.call(y,", ")+" ]"}if(Np(t)){var E=ni(t,c);return!("cause"in Error.prototype)&&"cause"in t&&!ju.call(t,"cause")?"{ ["+String(t)+"] "+be.call(Xu.call("[cause]: "+c(t.cause),E),", ")+" }":E.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+be.call(E,", ")+" }"}if(typeof t=="object"&&a){if(Wu&&typeof t[Wu]=="function"&&ko)return ko(t,{depth:l-n});if(a!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(jp(t)){var b=[];return Nu&&Nu.call(t,function(C,G){b.push(c(G,t,!0)+" => "+c(C,t))}),Qu("Map",ei.call(t),b,f)}if(zp(t)){var S=[];return Lu&&Lu.call(t,function(C){S.push(c(C,t))}),Qu("Set",ri.call(t),S,f)}if(Vp(t))return Ho("WeakMap");if(Wp(t))return Ho("WeakSet");if(Yp(t))return Ho("WeakRef");if(Up(t))return vn(c(Number(t)));if(kp(t))return vn(c(Lo.call(t)));if(Gp(t))return vn(Pp.call(t));if(Lp(t))return vn(c(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(t===Hn)return"{ [object globalThis] }";if(!Bp(t)&&!$u(t)){var P=ni(t,c),T=Vu?Vu(t)===Object.prototype:t instanceof Object||t.constructor===Object,x=t instanceof Object?"":"null prototype",w=!T&&jt&&Object(t)===t&&jt in t?No.call(Xe(t),8,-1):x?"Object":"",O=T||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",I=O+(w||x?"["+be.call(Xu.call([],w||[],x||[]),": ")+"] ":"");return P.length===0?I+"{}":f?I+"{"+jo(P,f)+"}":I+"{ "+be.call(P,", ")+" }"}return String(t)};function qu(r,t,e){var n=(e.quoteStyle||t)==="double"?'"':"'";return n+r+n}function Fp(r){return Ge.call(String(r),/"/g,"&quot;")}function Xo(r){return Xe(r)==="[object Array]"&&(!jt||!(typeof r=="object"&&jt in r))}function Bp(r){return Xe(r)==="[object Date]"&&(!jt||!(typeof r=="object"&&jt in r))}function $u(r){return Xe(r)==="[object RegExp]"&&(!jt||!(typeof r=="object"&&jt in r))}function Np(r){return Xe(r)==="[object Error]"&&(!jt||!(typeof r=="object"&&jt in r))}function Lp(r){return Xe(r)==="[object String]"&&(!jt||!(typeof r=="object"&&jt in r))}function Up(r){return Xe(r)==="[object Number]"&&(!jt||!(typeof r=="object"&&jt in r))}function Gp(r){return Xe(r)==="[object Boolean]"&&(!jt||!(typeof r=="object"&&jt in r))}function Ku(r){if(Dr)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!Go)return!1;try{return Go.call(r),!0}catch{}return!1}function kp(r){if(!r||typeof r!="object"||!Lo)return!1;try{return Lo.call(r),!0}catch{}return!1}var Xp=Object.prototype.hasOwnProperty||function(r){return r in this};function ke(r,t){return Xp.call(r,t)}function Xe(r){return Op.call(r)}function Hp(r){if(r.name)return r.name;var t=Ip.call(Rp.call(r),/^function\s*([\w$]+)/);return t?t[1]:null}function Zu(r,t){if(r.indexOf)return r.indexOf(t);for(var e=0,n=r.length;e<n;e++)if(r[e]===t)return e;return-1}function jp(r){if(!ei||!r||typeof r!="object")return!1;try{ei.call(r);try{ri.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function Vp(r){if(!dn||!r||typeof r!="object")return!1;try{dn.call(r,dn);try{pn.call(r,pn)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function Yp(r){if(!Uu||!r||typeof r!="object")return!1;try{return Uu.call(r),!0}catch{}return!1}function zp(r){if(!ri||!r||typeof r!="object")return!1;try{ri.call(r);try{ei.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function Wp(r){if(!pn||!r||typeof r!="object")return!1;try{pn.call(r,pn);try{dn.call(r,dn)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function qp(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function Ju(r,t){if(r.length>t.maxStringLength){var e=r.length-t.maxStringLength,n="... "+e+" more character"+(e>1?"s":"");return Ju(No.call(r,0,t.maxStringLength),t)+n}var i=Ge.call(Ge.call(r,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,$p);return qu(i,"single",t)}function $p(r){var t=r.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+Cp.call(t.toString(16))}function vn(r){return"Object("+r+")"}function Ho(r){return r+" { ? }"}function Qu(r,t,e,n){var i=n?jo(e,n):be.call(e,", ");return r+" ("+t+") {"+i+"}"}function Kp(r){for(var t=0;t<r.length;t++)if(Zu(r[t],`
24
- `)>=0)return!1;return!0}function Zp(r,t){var e;if(r.indent===" ")e=" ";else if(typeof r.indent=="number"&&r.indent>0)e=be.call(Array(r.indent+1)," ");else return null;return{base:e,prev:be.call(Array(t+1),e)}}function jo(r,t){if(r.length===0)return"";var e=`
25
- `+t.prev+t.base;return e+be.call(r,","+e)+`
26
- `+t.prev}function ni(r,t){var e=Xo(r),n=[];if(e){n.length=r.length;for(var i=0;i<r.length;i++)n[i]=ke(r,i)?t(r[i],r):""}var o=typeof Uo=="function"?Uo(r):[],a;if(Dr){a={};for(var s=0;s<o.length;s++)a["$"+o[s]]=o[s]}for(var u in r)ke(r,u)&&(e&&String(Number(u))===u&&u<r.length||Dr&&a["$"+u]instanceof Symbol||(ku.call(/[^\w$]/,u)?n.push(t(u,r)+": "+t(r[u],r)):n.push(u+": "+t(r[u],r))));if(typeof Uo=="function")for(var h=0;h<o.length;h++)ju.call(r,o[h])&&n.push("["+t(o[h])+"]: "+t(r[o[h]],r));return n}var Vo=er,Fr=Ep,Jp=Dp,Qp=Vo("%TypeError%"),ii=Vo("%WeakMap%",!0),oi=Vo("%Map%",!0),tv=Fr("WeakMap.prototype.get",!0),ev=Fr("WeakMap.prototype.set",!0),rv=Fr("WeakMap.prototype.has",!0),nv=Fr("Map.prototype.get",!0),iv=Fr("Map.prototype.set",!0),ov=Fr("Map.prototype.has",!0),Yo=function(r,t){for(var e=r,n;(n=e.next)!==null;e=n)if(n.key===t)return e.next=n.next,n.next=r.next,r.next=n,n},av=function(r,t){var e=Yo(r,t);return e&&e.value},sv=function(r,t,e){var n=Yo(r,t);n?n.value=e:r.next={key:t,next:r.next,value:e}},uv=function(r,t){return!!Yo(r,t)},hv=function(){var t,e,n,i={assert:function(o){if(!i.has(o))throw new Qp("Side channel does not contain "+Jp(o))},get:function(o){if(ii&&o&&(typeof o=="object"||typeof o=="function")){if(t)return tv(t,o)}else if(oi){if(e)return nv(e,o)}else if(n)return av(n,o)},has:function(o){if(ii&&o&&(typeof o=="object"||typeof o=="function")){if(t)return rv(t,o)}else if(oi){if(e)return ov(e,o)}else if(n)return uv(n,o);return!1},set:function(o,a){ii&&o&&(typeof o=="object"||typeof o=="function")?(t||(t=new ii),ev(t,o,a)):oi?(e||(e=new oi),iv(e,o,a)):(n||(n={key:{},next:null}),sv(n,o,a))}};return i},lv=String.prototype.replace,fv=/%20/g,zo={RFC1738:"RFC1738",RFC3986:"RFC3986"},Wo={default:zo.RFC3986,formatters:{RFC1738:function(r){return lv.call(r,fv,"+")},RFC3986:function(r){return String(r)}},RFC1738:zo.RFC1738,RFC3986:zo.RFC3986},cv=Wo,qo=Object.prototype.hasOwnProperty,rr=Array.isArray,xe=function(){for(var r=[],t=0;t<256;++t)r.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return r}(),dv=function(t){for(;t.length>1;){var e=t.pop(),n=e.obj[e.prop];if(rr(n)){for(var i=[],o=0;o<n.length;++o)typeof n[o]<"u"&&i.push(n[o]);e.obj[e.prop]=i}}},th=function(t,e){for(var n=e&&e.plainObjects?Object.create(null):{},i=0;i<t.length;++i)typeof t[i]<"u"&&(n[i]=t[i]);return n},pv=function r(t,e,n){if(!e)return t;if(typeof e!="object"){if(rr(t))t.push(e);else if(t&&typeof t=="object")(n&&(n.plainObjects||n.allowPrototypes)||!qo.call(Object.prototype,e))&&(t[e]=!0);else return[t,e];return t}if(!t||typeof t!="object")return[t].concat(e);var i=t;return rr(t)&&!rr(e)&&(i=th(t,n)),rr(t)&&rr(e)?(e.forEach(function(o,a){if(qo.call(t,a)){var s=t[a];s&&typeof s=="object"&&o&&typeof o=="object"?t[a]=r(s,o,n):t.push(o)}else t[a]=o}),t):Object.keys(e).reduce(function(o,a){var s=e[a];return qo.call(o,a)?o[a]=r(o[a],s,n):o[a]=s,o},i)},vv=function(t,e){return Object.keys(e).reduce(function(n,i){return n[i]=e[i],n},t)},_v=function(r,t,e){var n=r.replace(/\+/g," ");if(e==="iso-8859-1")return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch{return n}},mv=function(t,e,n,i,o){if(t.length===0)return t;var a=t;if(typeof t=="symbol"?a=Symbol.prototype.toString.call(t):typeof t!="string"&&(a=String(t)),n==="iso-8859-1")return escape(a).replace(/%u[0-9a-f]{4}/gi,function(l){return"%26%23"+parseInt(l.slice(2),16)+"%3B"});for(var s="",u=0;u<a.length;++u){var h=a.charCodeAt(u);if(h===45||h===46||h===95||h===126||h>=48&&h<=57||h>=65&&h<=90||h>=97&&h<=122||o===cv.RFC1738&&(h===40||h===41)){s+=a.charAt(u);continue}if(h<128){s=s+xe[h];continue}if(h<2048){s=s+(xe[192|h>>6]+xe[128|h&63]);continue}if(h<55296||h>=57344){s=s+(xe[224|h>>12]+xe[128|h>>6&63]+xe[128|h&63]);continue}u+=1,h=65536+((h&1023)<<10|a.charCodeAt(u)&1023),s+=xe[240|h>>18]+xe[128|h>>12&63]+xe[128|h>>6&63]+xe[128|h&63]}return s},gv=function(t){for(var e=[{obj:{o:t},prop:"o"}],n=[],i=0;i<e.length;++i)for(var o=e[i],a=o.obj[o.prop],s=Object.keys(a),u=0;u<s.length;++u){var h=s[u],l=a[h];typeof l=="object"&&l!==null&&n.indexOf(l)===-1&&(e.push({obj:a,prop:h}),n.push(l))}return dv(e),t},yv=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},bv=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},xv=function(t,e){return[].concat(t,e)},Ev=function(t,e){if(rr(t)){for(var n=[],i=0;i<t.length;i+=1)n.push(e(t[i]));return n}return e(t)},eh={arrayToObject:th,assign:vv,combine:xv,compact:gv,decode:_v,encode:mv,isBuffer:bv,isRegExp:yv,maybeMap:Ev,merge:pv},rh=hv,ai=eh,_n=Wo,Tv=Object.prototype.hasOwnProperty,nh={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},Pe=Array.isArray,wv=Array.prototype.push,ih=function(r,t){wv.apply(r,Pe(t)?t:[t])},Sv=Date.prototype.toISOString,oh=_n.default,Vt={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:ai.encode,encodeValuesOnly:!1,format:oh,formatter:_n.formatters[oh],indices:!1,serializeDate:function(t){return Sv.call(t)},skipNulls:!1,strictNullHandling:!1},Av=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},$o={},Pv=function r(t,e,n,i,o,a,s,u,h,l,f,c,d,p,v,_){for(var m=t,g=_,y=0,E=!1;(g=g.get($o))!==void 0&&!E;){var b=g.get(t);if(y+=1,typeof b<"u"){if(b===y)throw new RangeError("Cyclic object value");E=!0}typeof g.get($o)>"u"&&(y=0)}if(typeof u=="function"?m=u(e,m):m instanceof Date?m=f(m):n==="comma"&&Pe(m)&&(m=ai.maybeMap(m,function(N){return N instanceof Date?f(N):N})),m===null){if(o)return s&&!p?s(e,Vt.encoder,v,"key",c):e;m=""}if(Av(m)||ai.isBuffer(m)){if(s){var S=p?e:s(e,Vt.encoder,v,"key",c);return[d(S)+"="+d(s(m,Vt.encoder,v,"value",c))]}return[d(e)+"="+d(String(m))]}var P=[];if(typeof m>"u")return P;var T;if(n==="comma"&&Pe(m))p&&s&&(m=ai.maybeMap(m,s)),T=[{value:m.length>0?m.join(",")||null:void 0}];else if(Pe(u))T=u;else{var x=Object.keys(m);T=h?x.sort(h):x}for(var w=i&&Pe(m)&&m.length===1?e+"[]":e,O=0;O<T.length;++O){var I=T[O],C=typeof I=="object"&&typeof I.value<"u"?I.value:m[I];if(!(a&&C===null)){var G=Pe(m)?typeof n=="function"?n(w,I):w:w+(l?"."+I:"["+I+"]");_.set(t,y);var B=rh();B.set($o,_),ih(P,r(C,G,n,i,o,a,n==="comma"&&p&&Pe(m)?null:s,u,h,l,f,c,d,p,v,B))}}return P},Ov=function(t){if(!t)return Vt;if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");var e=t.charset||Vt.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=_n.default;if(typeof t.format<"u"){if(!Tv.call(_n.formatters,t.format))throw new TypeError("Unknown format option provided.");n=t.format}var i=_n.formatters[n],o=Vt.filter;return(typeof t.filter=="function"||Pe(t.filter))&&(o=t.filter),{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:Vt.addQueryPrefix,allowDots:typeof t.allowDots>"u"?Vt.allowDots:!!t.allowDots,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Vt.charsetSentinel,delimiter:typeof t.delimiter>"u"?Vt.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:Vt.encode,encoder:typeof t.encoder=="function"?t.encoder:Vt.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:Vt.encodeValuesOnly,filter:o,format:n,formatter:i,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:Vt.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:Vt.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Vt.strictNullHandling}},Rv=function(r,t){var e=r,n=Ov(t),i,o;typeof n.filter=="function"?(o=n.filter,e=o("",e)):Pe(n.filter)&&(o=n.filter,i=o);var a=[];if(typeof e!="object"||e===null)return"";var s;t&&t.arrayFormat in nh?s=t.arrayFormat:t&&"indices"in t?s=t.indices?"indices":"repeat":s="indices";var u=nh[s];if(t&&"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var h=u==="comma"&&t&&t.commaRoundTrip;i||(i=Object.keys(e)),n.sort&&i.sort(n.sort);for(var l=rh(),f=0;f<i.length;++f){var c=i[f];n.skipNulls&&e[c]===null||ih(a,Pv(e[c],c,u,h,n.strictNullHandling,n.skipNulls,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,l))}var d=a.join(n.delimiter),p=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?p+="utf8=%26%2310003%3B&":p+="utf8=%E2%9C%93&"),d.length>0?p+d:""},Br=eh,Ko=Object.prototype.hasOwnProperty,Iv=Array.isArray,Bt={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:Br.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},Cv=function(r){return r.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},ah=function(r,t){return r&&typeof r=="string"&&t.comma&&r.indexOf(",")>-1?r.split(","):r},Mv="utf8=%26%2310003%3B",Dv="utf8=%E2%9C%93",Fv=function(t,e){var n={__proto__:null},i=e.ignoreQueryPrefix?t.replace(/^\?/,""):t,o=e.parameterLimit===1/0?void 0:e.parameterLimit,a=i.split(e.delimiter,o),s=-1,u,h=e.charset;if(e.charsetSentinel)for(u=0;u<a.length;++u)a[u].indexOf("utf8=")===0&&(a[u]===Dv?h="utf-8":a[u]===Mv&&(h="iso-8859-1"),s=u,u=a.length);for(u=0;u<a.length;++u)if(u!==s){var l=a[u],f=l.indexOf("]="),c=f===-1?l.indexOf("="):f+1,d,p;c===-1?(d=e.decoder(l,Bt.decoder,h,"key"),p=e.strictNullHandling?null:""):(d=e.decoder(l.slice(0,c),Bt.decoder,h,"key"),p=Br.maybeMap(ah(l.slice(c+1),e),function(v){return e.decoder(v,Bt.decoder,h,"value")})),p&&e.interpretNumericEntities&&h==="iso-8859-1"&&(p=Cv(p)),l.indexOf("[]=")>-1&&(p=Iv(p)?[p]:p),Ko.call(n,d)?n[d]=Br.combine(n[d],p):n[d]=p}return n},Bv=function(r,t,e,n){for(var i=n?t:ah(t,e),o=r.length-1;o>=0;--o){var a,s=r[o];if(s==="[]"&&e.parseArrays)a=[].concat(i);else{a=e.plainObjects?Object.create(null):{};var u=s.charAt(0)==="["&&s.charAt(s.length-1)==="]"?s.slice(1,-1):s,h=parseInt(u,10);!e.parseArrays&&u===""?a={0:i}:!isNaN(h)&&s!==u&&String(h)===u&&h>=0&&e.parseArrays&&h<=e.arrayLimit?(a=[],a[h]=i):u!=="__proto__"&&(a[u]=i)}i=a}return i},Nv=function(t,e,n,i){if(t){var o=n.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,a=/(\[[^[\]]*])/,s=/(\[[^[\]]*])/g,u=n.depth>0&&a.exec(o),h=u?o.slice(0,u.index):o,l=[];if(h){if(!n.plainObjects&&Ko.call(Object.prototype,h)&&!n.allowPrototypes)return;l.push(h)}for(var f=0;n.depth>0&&(u=s.exec(o))!==null&&f<n.depth;){if(f+=1,!n.plainObjects&&Ko.call(Object.prototype,u[1].slice(1,-1))&&!n.allowPrototypes)return;l.push(u[1])}return u&&l.push("["+o.slice(u.index)+"]"),Bv(l,e,n,i)}},Lv=function(t){if(!t)return Bt;if(t.decoder!==null&&t.decoder!==void 0&&typeof t.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var e=typeof t.charset>"u"?Bt.charset:t.charset;return{allowDots:typeof t.allowDots>"u"?Bt.allowDots:!!t.allowDots,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:Bt.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:Bt.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:Bt.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Bt.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:Bt.comma,decoder:typeof t.decoder=="function"?t.decoder:Bt.decoder,delimiter:typeof t.delimiter=="string"||Br.isRegExp(t.delimiter)?t.delimiter:Bt.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:Bt.depth,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:Bt.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:Bt.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:Bt.plainObjects,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Bt.strictNullHandling}},Uv=function(r,t){var e=Lv(t);if(r===""||r===null||typeof r>"u")return e.plainObjects?Object.create(null):{};for(var n=typeof r=="string"?Fv(r,e):r,i=e.plainObjects?Object.create(null):{},o=Object.keys(n),a=0;a<o.length;++a){var s=o[a],u=Nv(s,n[s],e,typeof r=="string");i=Br.merge(i,u,e)}return e.allowSparse===!0?i:Br.compact(i)},Gv=Rv,kv=Uv,Xv=Wo,Hv={formats:Xv,parse:kv,stringify:Gv},jv=Nd;function he(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var Vv=/^([a-z0-9.+-]+:)/i,Yv=/:[0-9]*$/,zv=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,Wv=["<",">",'"',"`"," ","\r",`
27
- `," "],qv=["{","}","|","\\","^","`"].concat(Wv),Zo=["'"].concat(qv),sh=["%","/","?",";","#"].concat(Zo),uh=["/","?","#"],$v=255,hh=/^[+a-z0-9A-Z_-]{0,63}$/,Kv=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,Zv={javascript:!0,"javascript:":!0},Jo={javascript:!0,"javascript:":!0},Nr={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Qo=Hv;function si(r,t,e){if(r&&typeof r=="object"&&r instanceof he)return r;var n=new he;return n.parse(r,t,e),n}he.prototype.parse=function(r,t,e){if(typeof r!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof r);var n=r.indexOf("?"),i=n!==-1&&n<r.indexOf("#")?"?":"#",o=r.split(i),a=/\\/g;o[0]=o[0].replace(a,"/"),r=o.join(i);var s=r;if(s=s.trim(),!e&&r.split("#").length===1){var u=zv.exec(s);if(u)return this.path=s,this.href=s,this.pathname=u[1],u[2]?(this.search=u[2],t?this.query=Qo.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var h=Vv.exec(s);if(h){h=h[0];var l=h.toLowerCase();this.protocol=l,s=s.substr(h.length)}if(e||h||s.match(/^\/\/[^@/]+@[^@/]+/)){var f=s.substr(0,2)==="//";f&&!(h&&Jo[h])&&(s=s.substr(2),this.slashes=!0)}if(!Jo[h]&&(f||h&&!Nr[h])){for(var c=-1,d=0;d<uh.length;d++){var p=s.indexOf(uh[d]);p!==-1&&(c===-1||p<c)&&(c=p)}var v,_;c===-1?_=s.lastIndexOf("@"):_=s.lastIndexOf("@",c),_!==-1&&(v=s.slice(0,_),s=s.slice(_+1),this.auth=decodeURIComponent(v)),c=-1;for(var d=0;d<sh.length;d++){var p=s.indexOf(sh[d]);p!==-1&&(c===-1||p<c)&&(c=p)}c===-1&&(c=s.length),this.host=s.slice(0,c),s=s.slice(c),this.parseHost(),this.hostname=this.hostname||"";var m=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!m)for(var g=this.hostname.split(/\./),d=0,y=g.length;d<y;d++){var E=g[d];if(E&&!E.match(hh)){for(var b="",S=0,P=E.length;S<P;S++)E.charCodeAt(S)>127?b+="x":b+=E[S];if(!b.match(hh)){var T=g.slice(0,d),x=g.slice(d+1),w=E.match(Kv);w&&(T.push(w[1]),x.unshift(w[2])),x.length&&(s="/"+x.join(".")+s),this.hostname=T.join(".");break}}}this.hostname.length>$v?this.hostname="":this.hostname=this.hostname.toLowerCase(),m||(this.hostname=jv.toASCII(this.hostname));var O=this.port?":"+this.port:"",I=this.hostname||"";this.host=I+O,this.href+=this.host,m&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),s[0]!=="/"&&(s="/"+s))}if(!Zv[l])for(var d=0,y=Zo.length;d<y;d++){var C=Zo[d];if(s.indexOf(C)!==-1){var G=encodeURIComponent(C);G===C&&(G=escape(C)),s=s.split(C).join(G)}}var B=s.indexOf("#");B!==-1&&(this.hash=s.substr(B),s=s.slice(0,B));var N=s.indexOf("?");if(N!==-1?(this.search=s.substr(N),this.query=s.substr(N+1),t&&(this.query=Qo.parse(this.query)),s=s.slice(0,N)):t&&(this.search="",this.query={}),s&&(this.pathname=s),Nr[l]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var O=this.pathname||"",W=this.search||"";this.path=O+W}return this.href=this.format(),this};function Jv(r){return typeof r=="string"&&(r=si(r)),r instanceof he?r.format():he.prototype.format.call(r)}he.prototype.format=function(){var r=this.auth||"";r&&(r=encodeURIComponent(r),r=r.replace(/%3A/i,":"),r+="@");var t=this.protocol||"",e=this.pathname||"",n=this.hash||"",i=!1,o="";this.host?i=r+this.host:this.hostname&&(i=r+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(i+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(o=Qo.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var a=this.search||o&&"?"+o||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||Nr[t])&&i!==!1?(i="//"+(i||""),e&&e.charAt(0)!=="/"&&(e="/"+e)):i||(i=""),n&&n.charAt(0)!=="#"&&(n="#"+n),a&&a.charAt(0)!=="?"&&(a="?"+a),e=e.replace(/[?#]/g,function(s){return encodeURIComponent(s)}),a=a.replace("#","%23"),t+i+e+a+n};function Qv(r,t){return si(r,!1,!0).resolve(t)}he.prototype.resolve=function(r){return this.resolveObject(si(r,!1,!0)).format()},he.prototype.resolveObject=function(r){if(typeof r=="string"){var t=new he;t.parse(r,!1,!0),r=t}for(var e=new he,n=Object.keys(this),i=0;i<n.length;i++){var o=n[i];e[o]=this[o]}if(e.hash=r.hash,r.href==="")return e.href=e.format(),e;if(r.slashes&&!r.protocol){for(var a=Object.keys(r),s=0;s<a.length;s++){var u=a[s];u!=="protocol"&&(e[u]=r[u])}return Nr[e.protocol]&&e.hostname&&!e.pathname&&(e.pathname="/",e.path=e.pathname),e.href=e.format(),e}if(r.protocol&&r.protocol!==e.protocol){if(!Nr[r.protocol]){for(var h=Object.keys(r),l=0;l<h.length;l++){var f=h[l];e[f]=r[f]}return e.href=e.format(),e}if(e.protocol=r.protocol,!r.host&&!Jo[r.protocol]){for(var y=(r.pathname||"").split("/");y.length&&!(r.host=y.shift()););r.host||(r.host=""),r.hostname||(r.hostname=""),y[0]!==""&&y.unshift(""),y.length<2&&y.unshift(""),e.pathname=y.join("/")}else e.pathname=r.pathname;if(e.search=r.search,e.query=r.query,e.host=r.host||"",e.auth=r.auth,e.hostname=r.hostname||r.host,e.port=r.port,e.pathname||e.search){var c=e.pathname||"",d=e.search||"";e.path=c+d}return e.slashes=e.slashes||r.slashes,e.href=e.format(),e}var p=e.pathname&&e.pathname.charAt(0)==="/",v=r.host||r.pathname&&r.pathname.charAt(0)==="/",_=v||p||e.host&&r.pathname,m=_,g=e.pathname&&e.pathname.split("/")||[],y=r.pathname&&r.pathname.split("/")||[],E=e.protocol&&!Nr[e.protocol];if(E&&(e.hostname="",e.port=null,e.host&&(g[0]===""?g[0]=e.host:g.unshift(e.host)),e.host="",r.protocol&&(r.hostname=null,r.port=null,r.host&&(y[0]===""?y[0]=r.host:y.unshift(r.host)),r.host=null),_=_&&(y[0]===""||g[0]==="")),v)e.host=r.host||r.host===""?r.host:e.host,e.hostname=r.hostname||r.hostname===""?r.hostname:e.hostname,e.search=r.search,e.query=r.query,g=y;else if(y.length)g||(g=[]),g.pop(),g=g.concat(y),e.search=r.search,e.query=r.query;else if(r.search!=null){if(E){e.host=g.shift(),e.hostname=e.host;var b=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;b&&(e.auth=b.shift(),e.hostname=b.shift(),e.host=e.hostname)}return e.search=r.search,e.query=r.query,(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.href=e.format(),e}if(!g.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var S=g.slice(-1)[0],P=(e.host||r.host||g.length>1)&&(S==="."||S==="..")||S==="",T=0,x=g.length;x>=0;x--)S=g[x],S==="."?g.splice(x,1):S===".."?(g.splice(x,1),T++):T&&(g.splice(x,1),T--);if(!_&&!m)for(;T--;T)g.unshift("..");_&&g[0]!==""&&(!g[0]||g[0].charAt(0)!=="/")&&g.unshift(""),P&&g.join("/").substr(-1)!=="/"&&g.push("");var w=g[0]===""||g[0]&&g[0].charAt(0)==="/";if(E){e.hostname=w?"":g.length?g.shift():"",e.host=e.hostname;var b=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;b&&(e.auth=b.shift(),e.hostname=b.shift(),e.host=e.hostname)}return _=_||e.host&&g.length,_&&!w&&g.unshift(""),g.length>0?e.pathname=g.join("/"):(e.pathname=null,e.path=null),(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.auth=r.auth||e.auth,e.slashes=e.slashes||r.slashes,e.href=e.format(),e},he.prototype.parseHost=function(){var r=this.host,t=Yv.exec(r);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),r=r.substr(0,r.length-t.length)),r&&(this.hostname=r)};var t_=si,e_=Qv,r_=Jv;/*!
28
- * @pixi/utils - v6.5.10
29
- * Compiled Thu, 06 Jul 2023 15:25:11 UTC
30
- *
31
- * @pixi/utils is licensed under the MIT License.
32
- * http://www.opensource.org/licenses/mit-license
33
- */var Lr={parse:t_,format:r_,resolve:e_};k.RETINA_PREFIX=/@([0-9\.]+)x/,k.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var lh=!1,fh="6.5.10";function n_(r){var t;if(!lh){if(k.ADAPTER.getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){var e=[`
34
- %c %c %c PixiJS `+fh+" - ✰ "+r+` ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥
35
-
36
- `,"background: #ff66a5; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff66a5; background: #030307; padding:5px 0;","background: #ff66a5; padding:5px 0;","background: #ffc3dc; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;"];(t=globalThis.console).log.apply(t,e)}else globalThis.console&&globalThis.console.log("PixiJS "+fh+" - "+r+" - http://www.pixijs.com/");lh=!0}}var ta;function i_(){return typeof ta>"u"&&(ta=function(){var t={stencil:!0,failIfMajorPerformanceCaveat:k.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!k.ADAPTER.getWebGLRenderingContext())return!1;var e=k.ADAPTER.createCanvas(),n=e.getContext("webgl",t)||e.getContext("experimental-webgl",t),i=!!(n&&n.getContextAttributes().stencil);if(n){var o=n.getExtension("WEBGL_lose_context");o&&o.loseContext()}return n=null,i}catch{return!1}}()),ta}var o_="#f0f8ff",a_="#faebd7",s_="#00ffff",u_="#7fffd4",h_="#f0ffff",l_="#f5f5dc",f_="#ffe4c4",c_="#000000",d_="#ffebcd",p_="#0000ff",v_="#8a2be2",__="#a52a2a",m_="#deb887",g_="#5f9ea0",y_="#7fff00",b_="#d2691e",x_="#ff7f50",E_="#6495ed",T_="#fff8dc",w_="#dc143c",S_="#00ffff",A_="#00008b",P_="#008b8b",O_="#b8860b",R_="#a9a9a9",I_="#006400",C_="#a9a9a9",M_="#bdb76b",D_="#8b008b",F_="#556b2f",B_="#ff8c00",N_="#9932cc",L_="#8b0000",U_="#e9967a",G_="#8fbc8f",k_="#483d8b",X_="#2f4f4f",H_="#2f4f4f",j_="#00ced1",V_="#9400d3",Y_="#ff1493",z_="#00bfff",W_="#696969",q_="#696969",$_="#1e90ff",K_="#b22222",Z_="#fffaf0",J_="#228b22",Q_="#ff00ff",tm="#dcdcdc",em="#f8f8ff",rm="#daa520",nm="#ffd700",im="#808080",om="#008000",am="#adff2f",sm="#808080",um="#f0fff0",hm="#ff69b4",lm="#cd5c5c",fm="#4b0082",cm="#fffff0",dm="#f0e68c",pm="#fff0f5",vm="#e6e6fa",_m="#7cfc00",mm="#fffacd",gm="#add8e6",ym="#f08080",bm="#e0ffff",xm="#fafad2",Em="#d3d3d3",Tm="#90ee90",wm="#d3d3d3",Sm="#ffb6c1",Am="#ffa07a",Pm="#20b2aa",Om="#87cefa",Rm="#778899",Im="#778899",Cm="#b0c4de",Mm="#ffffe0",Dm="#00ff00",Fm="#32cd32",Bm="#faf0e6",Nm="#ff00ff",Lm="#800000",Um="#66cdaa",Gm="#0000cd",km="#ba55d3",Xm="#9370db",Hm="#3cb371",jm="#7b68ee",Vm="#00fa9a",Ym="#48d1cc",zm="#c71585",Wm="#191970",qm="#f5fffa",$m="#ffe4e1",Km="#ffe4b5",Zm="#ffdead",Jm="#000080",Qm="#fdf5e6",tg="#808000",eg="#6b8e23",rg="#ffa500",ng="#ff4500",ig="#da70d6",og="#eee8aa",ag="#98fb98",sg="#afeeee",ug="#db7093",hg="#ffefd5",lg="#ffdab9",fg="#cd853f",cg="#ffc0cb",dg="#dda0dd",pg="#b0e0e6",vg="#800080",_g="#663399",mg="#ff0000",gg="#bc8f8f",yg="#4169e1",bg="#8b4513",xg="#fa8072",Eg="#f4a460",Tg="#2e8b57",wg="#fff5ee",Sg="#a0522d",Ag="#c0c0c0",Pg="#87ceeb",Og="#6a5acd",Rg="#708090",Ig="#708090",Cg="#fffafa",Mg="#00ff7f",Dg="#4682b4",Fg="#d2b48c",Bg="#008080",Ng="#d8bfd8",Lg="#ff6347",Ug="#40e0d0",Gg="#ee82ee",kg="#f5deb3",Xg="#ffffff",Hg="#f5f5f5",jg="#ffff00",Vg="#9acd32",Yg={aliceblue:o_,antiquewhite:a_,aqua:s_,aquamarine:u_,azure:h_,beige:l_,bisque:f_,black:c_,blanchedalmond:d_,blue:p_,blueviolet:v_,brown:__,burlywood:m_,cadetblue:g_,chartreuse:y_,chocolate:b_,coral:x_,cornflowerblue:E_,cornsilk:T_,crimson:w_,cyan:S_,darkblue:A_,darkcyan:P_,darkgoldenrod:O_,darkgray:R_,darkgreen:I_,darkgrey:C_,darkkhaki:M_,darkmagenta:D_,darkolivegreen:F_,darkorange:B_,darkorchid:N_,darkred:L_,darksalmon:U_,darkseagreen:G_,darkslateblue:k_,darkslategray:X_,darkslategrey:H_,darkturquoise:j_,darkviolet:V_,deeppink:Y_,deepskyblue:z_,dimgray:W_,dimgrey:q_,dodgerblue:$_,firebrick:K_,floralwhite:Z_,forestgreen:J_,fuchsia:Q_,gainsboro:tm,ghostwhite:em,goldenrod:rm,gold:nm,gray:im,green:om,greenyellow:am,grey:sm,honeydew:um,hotpink:hm,indianred:lm,indigo:fm,ivory:cm,khaki:dm,lavenderblush:pm,lavender:vm,lawngreen:_m,lemonchiffon:mm,lightblue:gm,lightcoral:ym,lightcyan:bm,lightgoldenrodyellow:xm,lightgray:Em,lightgreen:Tm,lightgrey:wm,lightpink:Sm,lightsalmon:Am,lightseagreen:Pm,lightskyblue:Om,lightslategray:Rm,lightslategrey:Im,lightsteelblue:Cm,lightyellow:Mm,lime:Dm,limegreen:Fm,linen:Bm,magenta:Nm,maroon:Lm,mediumaquamarine:Um,mediumblue:Gm,mediumorchid:km,mediumpurple:Xm,mediumseagreen:Hm,mediumslateblue:jm,mediumspringgreen:Vm,mediumturquoise:Ym,mediumvioletred:zm,midnightblue:Wm,mintcream:qm,mistyrose:$m,moccasin:Km,navajowhite:Zm,navy:Jm,oldlace:Qm,olive:tg,olivedrab:eg,orange:rg,orangered:ng,orchid:ig,palegoldenrod:og,palegreen:ag,paleturquoise:sg,palevioletred:ug,papayawhip:hg,peachpuff:lg,peru:fg,pink:cg,plum:dg,powderblue:pg,purple:vg,rebeccapurple:_g,red:mg,rosybrown:gg,royalblue:yg,saddlebrown:bg,salmon:xg,sandybrown:Eg,seagreen:Tg,seashell:wg,sienna:Sg,silver:Ag,skyblue:Pg,slateblue:Og,slategray:Rg,slategrey:Ig,snow:Cg,springgreen:Mg,steelblue:Dg,tan:Fg,teal:Bg,thistle:Ng,tomato:Lg,turquoise:Ug,violet:Gg,wheat:kg,white:Xg,whitesmoke:Hg,yellow:jg,yellowgreen:Vg};function Ur(r,t){return t===void 0&&(t=[]),t[0]=(r>>16&255)/255,t[1]=(r>>8&255)/255,t[2]=(r&255)/255,t}function ch(r){var t=r.toString(16);return t="000000".substring(0,6-t.length)+t,"#"+t}function mn(r){return typeof r=="string"&&(r=Yg[r.toLowerCase()]||r,r[0]==="#"&&(r=r.slice(1))),parseInt(r,16)}function zg(){for(var r=[],t=[],e=0;e<32;e++)r[e]=e,t[e]=e;r[j.NORMAL_NPM]=j.NORMAL,r[j.ADD_NPM]=j.ADD,r[j.SCREEN_NPM]=j.SCREEN,t[j.NORMAL]=j.NORMAL_NPM,t[j.ADD]=j.ADD_NPM,t[j.SCREEN]=j.SCREEN_NPM;var n=[];return n.push(t),n.push(r),n}var dh=zg();function ph(r,t){return dh[t?1:0][r]}function Wg(r,t,e,n){return e=e||new Float32Array(4),n||n===void 0?(e[0]=r[0]*t,e[1]=r[1]*t,e[2]=r[2]*t):(e[0]=r[0],e[1]=r[1],e[2]=r[2]),e[3]=t,e}function ea(r,t){if(t===1)return(t*255<<24)+r;if(t===0)return 0;var e=r>>16&255,n=r>>8&255,i=r&255;return e=e*t+.5|0,n=n*t+.5|0,i=i*t+.5|0,(t*255<<24)+(e<<16)+(n<<8)+i}function vh(r,t,e,n){return e=e||new Float32Array(4),e[0]=(r>>16&255)/255,e[1]=(r>>8&255)/255,e[2]=(r&255)/255,(n||n===void 0)&&(e[0]*=t,e[1]*=t,e[2]*=t),e[3]=t,e}function qg(r,t){t===void 0&&(t=null);var e=r*6;if(t=t||new Uint16Array(e),t.length!==e)throw new Error("Out buffer length is incorrect, got "+t.length+" and expected "+e);for(var n=0,i=0;n<e;n+=6,i+=4)t[n+0]=i+0,t[n+1]=i+1,t[n+2]=i+2,t[n+3]=i+0,t[n+4]=i+2,t[n+5]=i+3;return t}function _h(r){if(r.BYTES_PER_ELEMENT===4)return r instanceof Float32Array?"Float32Array":r instanceof Uint32Array?"Uint32Array":"Int32Array";if(r.BYTES_PER_ELEMENT===2){if(r instanceof Uint16Array)return"Uint16Array"}else if(r.BYTES_PER_ELEMENT===1&&r instanceof Uint8Array)return"Uint8Array";return null}function ui(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 mh(r){return!(r&r-1)&&!!r}function gh(r){var t=(r>65535?1:0)<<4;r>>>=t;var e=(r>255?1:0)<<3;return r>>>=e,t|=e,e=(r>15?1:0)<<2,r>>>=e,t|=e,e=(r>3?1:0)<<1,r>>>=e,t|=e,t|r>>1}function Gr(r,t,e){var n=r.length,i;if(!(t>=n||e===0)){e=t+e>n?n-t:e;var o=n-e;for(i=t;i<o;++i)r[i]=r[i+e];r.length=o}}function kr(r){return r===0?0:r<0?-1:1}var $g=0;function nr(){return++$g}var yh={};function le(r,t,e){if(e===void 0&&(e=3),!yh[t]){var n=new Error().stack;typeof n>"u"?console.warn("PixiJS Deprecation Warning: ",t+`
37
- Deprecated since v`+r):(n=n.split(`
1
+ (function(Ot,Nt){typeof exports=="object"&&typeof module<"u"?Nt(exports,require("openseadragon")):typeof define=="function"&&define.amd?define(["exports","openseadragon"],Nt):(Ot=typeof globalThis<"u"?globalThis:Ot||self,Nt(Ot.AnnotoriousOSD={},Ot.OpenSeadragon))})(this,function(Ot,Nt){"use strict";var GE=Object.defineProperty;var $E=(Ot,Nt,Rr)=>Nt in Ot?GE(Ot,Nt,{enumerable:!0,configurable:!0,writable:!0,value:Rr}):Ot[Nt]=Rr;var Ml=(Ot,Nt,Rr)=>$E(Ot,typeof Nt!="symbol"?Nt+"":Nt,Rr);var Rr=Object.prototype.hasOwnProperty;function Pr(r,t){var e,i;if(r===t)return!0;if(r&&t&&(e=r.constructor)===t.constructor){if(e===Date)return r.getTime()===t.getTime();if(e===RegExp)return r.toString()===t.toString();if(e===Array){if((i=r.length)===t.length)for(;i--&&Pr(r[i],t[i]););return i===-1}if(!e||typeof r=="object"){i=0;for(e in r)if(Rr.call(r,e)&&++i&&!Rr.call(t,e)||!(e in t)||!Pr(r[e],t[e]))return!1;return Object.keys(t).length===i}}return r!==r&&t!==t}for(var no=(r=>(r.EDIT="EDIT",r.SELECT="SELECT",r.NONE="NONE",r))(no||{}),Ht=[],oo=0;oo<256;++oo)Ht.push((oo+256).toString(16).slice(1));function jf(r,t=0){return(Ht[r[t+0]]+Ht[r[t+1]]+Ht[r[t+2]]+Ht[r[t+3]]+"-"+Ht[r[t+4]]+Ht[r[t+5]]+"-"+Ht[r[t+6]]+Ht[r[t+7]]+"-"+Ht[r[t+8]]+Ht[r[t+9]]+"-"+Ht[r[t+10]]+Ht[r[t+11]]+Ht[r[t+12]]+Ht[r[t+13]]+Ht[r[t+14]]+Ht[r[t+15]]).toLowerCase()}var Ss,Yf=new Uint8Array(16);function qf(){if(!Ss&&(Ss=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ss))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ss(Yf)}var Kf=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const kl={randomUUID:Kf};function Zf(r,t,e){if(kl.randomUUID&&!t&&!r)return kl.randomUUID();r=r||{};var i=r.random||(r.rng||qf)();return i[6]=i[6]&15|64,i[8]=i[8]&63|128,jf(i)}const Jf=(r,t,e,i)=>({id:Zf(),annotation:typeof r=="string"?r:r.id,created:e||new Date,creator:i,...t}),Qf=(r,t)=>{const e=new Set(r.bodies.map(i=>i.id));return t.bodies.filter(i=>!e.has(i.id))},tp=(r,t)=>{const e=new Set(t.bodies.map(i=>i.id));return r.bodies.filter(i=>!e.has(i.id))},ep=(r,t)=>t.bodies.map(e=>{const i=r.bodies.find(s=>s.id===e.id);return{newBody:e,oldBody:i&&!Pr(i,e)?i:void 0}}).filter(({oldBody:e})=>e).map(({oldBody:e,newBody:i})=>({oldBody:e,newBody:i})),rp=(r,t)=>!Pr(r.target,t.target),ip=(r,t)=>{const e=Qf(r,t),i=tp(r,t),s=ep(r,t);return{oldValue:r,newValue:t,bodiesCreated:e.length>0?e:void 0,bodiesDeleted:i.length>0?i:void 0,bodiesUpdated:s.length>0?s:void 0,targetUpdated:rp(r,t)?{oldTarget:r.target,newTarget:t.target}:void 0}};var cr=(r=>(r.LOCAL="LOCAL",r.REMOTE="REMOTE",r))(cr||{});const sp=(r,t)=>{const e=new Set((r.created||[]).map(u=>u.id)),i=new Set((r.updated||[]).map(({newValue:u})=>u.id)),s=new Set((t.created||[]).map(u=>u.id)),n=new Set((t.deleted||[]).map(u=>u.id)),o=new Set((t.updated||[]).map(({oldValue:u})=>u.id)),a=new Set((t.updated||[]).filter(({oldValue:u})=>e.has(u.id)||i.has(u.id)).map(({oldValue:u})=>u.id)),l=[...(r.created||[]).filter(u=>!n.has(u.id)).map(u=>o.has(u.id)?t.updated.find(({oldValue:d})=>d.id===u.id).newValue:u),...t.created||[]],h=[...(r.deleted||[]).filter(u=>!s.has(u.id)),...(t.deleted||[]).filter(u=>!e.has(u.id))],c=[...(r.updated||[]).filter(({newValue:u})=>!n.has(u.id)).map(u=>{const{oldValue:d,newValue:f}=u;if(o.has(f.id)){const p=t.updated.find(m=>m.oldValue.id===f.id).newValue;return ip(d,p)}else return u}),...(t.updated||[]).filter(({oldValue:u})=>!a.has(u.id))];return{created:l,deleted:h,updated:c}};let np=()=>({emit(r,...t){for(let e=0,i=this.events[r]||[],s=i.length;e<s;e++)i[e](...t)},events:{},on(r,t){var e;return((e=this.events)[r]||(e[r]=[])).push(t),()=>{var i;this.events[r]=(i=this.events[r])==null?void 0:i.filter(s=>t!==s)}}});const op=250,ap=r=>{const t=np(),e=[];let i=-1,s=!1,n=0;const o=f=>{if(!s){const{changes:p}=f,m=performance.now();if(m-n>op)e.splice(i+1),e.push(p),i=e.length-1;else{const _=e.length-1;e[_]=sp(e[_],p)}n=m}s=!1};r.observe(o,{origin:cr.LOCAL});const a=f=>f&&f.length>0&&r.bulkDeleteAnnotation(f),l=f=>f&&f.length>0&&r.bulkAddAnnotation(f,!1),h=f=>f&&f.length>0&&r.bulkUpdateAnnotation(f.map(({oldValue:p})=>p)),c=f=>f&&f.length>0&&r.bulkUpdateAnnotation(f.map(({newValue:p})=>p)),u=f=>f&&f.length>0&&r.bulkAddAnnotation(f,!1),d=f=>f&&f.length>0&&r.bulkDeleteAnnotation(f);return{canRedo:()=>e.length-1>i,canUndo:()=>i>-1,destroy:()=>r.unobserve(o),on:(f,p)=>t.on(f,p),redo:()=>{if(e.length-1>i){s=!0;const{created:f,updated:p,deleted:m}=e[i+1];l(f),c(p),d(m),t.emit("redo",e[i+1]),i+=1}},undo:()=>{if(i>-1){s=!0;const{created:f,updated:p,deleted:m}=e[i];a(f),h(p),u(m),t.emit("undo",e[i]),i-=1}}}},lp=(r,t,e,i)=>{const{store:s,selection:n,hover:o,viewport:a}=r,l=new Map;let h=[],c,u;const d=(y,x)=>{l.has(y)?l.get(y).push(x):l.set(y,[x])},f=(y,x)=>{const g=l.get(y);if(g){const v=g.indexOf(x);v!==-1&&g.splice(v,1)}},p=(y,x,g)=>{l.has(y)&&setTimeout(()=>{l.get(y).forEach(v=>{if(e){const w=Array.isArray(x)?x.map(T=>e.serialize(T)):e.serialize(x),I=g?g instanceof PointerEvent?g:e.serialize(g):void 0;v(w,I)}else v(x,g)})},1)},m=()=>{const{selected:y}=n,x=(y||[]).map(({id:g})=>s.getAnnotation(g));x.forEach(g=>{const v=h.find(w=>w.id===g.id);(!v||!Pr(v,g))&&p("updateAnnotation",g,v)}),h=h.map(g=>x.find(({id:w})=>w===g.id)||g)};n.subscribe(({selected:y})=>{if(!(h.length===0&&y.length===0)){if(h.length===0&&y.length>0)h=y.map(({id:x})=>s.getAnnotation(x));else if(h.length>0&&y.length===0)h.forEach(x=>{const g=s.getAnnotation(x.id);g&&!Pr(g,x)&&p("updateAnnotation",g,x)}),h=[];else{const x=new Set(h.map(v=>v.id)),g=new Set(y.map(({id:v})=>v));h.filter(v=>!g.has(v.id)).forEach(v=>{const w=s.getAnnotation(v.id);w&&!Pr(w,v)&&p("updateAnnotation",w,v)}),h=[...h.filter(v=>g.has(v.id)),...y.filter(({id:v})=>!x.has(v)).map(({id:v})=>s.getAnnotation(v))]}p("selectionChanged",h)}}),o.subscribe(y=>{!c&&y?p("mouseEnterAnnotation",s.getAnnotation(y)):c&&!y?p("mouseLeaveAnnotation",s.getAnnotation(c)):c&&y&&(p("mouseLeaveAnnotation",s.getAnnotation(c)),p("mouseEnterAnnotation",s.getAnnotation(y))),c=y}),a==null||a.subscribe(y=>p("viewportIntersect",y.map(x=>s.getAnnotation(x)))),s.observe(y=>{i&&(u&&clearTimeout(u),u=setTimeout(m,1e3));const{created:x,deleted:g}=y.changes;(x||[]).forEach(v=>p("createAnnotation",v)),(g||[]).forEach(v=>p("deleteAnnotation",v)),(y.changes.updated||[]).filter(v=>[...v.bodiesCreated||[],...v.bodiesDeleted||[],...v.bodiesUpdated||[]].length>0).forEach(({oldValue:v,newValue:w})=>{const I=h.find(T=>T.id===v.id)||v;h=h.map(T=>T.id===v.id?w:T),p("updateAnnotation",w,I)})},{origin:cr.LOCAL}),s.observe(y=>{if(h){const x=new Set(h.map(v=>v.id)),g=(y.changes.updated||[]).filter(({newValue:v})=>x.has(v.id)).map(({newValue:v})=>v);g.length>0&&(h=h.map(v=>g.find(I=>I.id===v.id)||v))}},{origin:cr.REMOTE});const _=y=>x=>{const{updated:g}=x;y?(g||[]).forEach(v=>p("updateAnnotation",v.oldValue,v.newValue)):(g||[]).forEach(v=>p("updateAnnotation",v.newValue,v.oldValue))};return t.on("undo",_(!0)),t.on("redo",_(!1)),{on:d,off:f,emit:p}},hp=r=>t=>t.reduce((e,i)=>{const{parsed:s,error:n}=r.parse(i);return n?{parsed:e.parsed,failed:[...e.failed,i]}:s?{parsed:[...e.parsed,s],failed:e.failed}:{...e}},{parsed:[],failed:[]}),cp=(r,t,e)=>{const{store:i,selection:s}=r,n=y=>{if(e){const{parsed:x,error:g}=e.parse(y);x?i.addAnnotation(x,cr.REMOTE):console.error(g)}else i.addAnnotation(y,cr.REMOTE)},o=()=>s.clear(),a=()=>i.clear(),l=y=>{const x=i.getAnnotation(y);return e&&x?e.serialize(x):x},h=()=>e?i.all().map(e.serialize):i.all(),c=()=>{var y;const x=(((y=s.selected)==null?void 0:y.map(g=>g.id))||[]).map(g=>i.getAnnotation(g)).filter(Boolean);return e?x.map(e.serialize):x},u=(y,x=!0)=>fetch(y).then(g=>g.json()).then(g=>(f(g,x),g)),d=y=>{if(typeof y=="string"){const x=i.getAnnotation(y);if(i.deleteAnnotation(y),x)return e?e.serialize(x):x}else{const x=e?e.parse(y).parsed:y;if(x)return i.deleteAnnotation(x),y}},f=(y,x=!0)=>{if(e){const{parsed:g,failed:v}=hp(e)(y);v.length>0&&console.warn(`Discarded ${v.length} invalid annotations`,v),i.bulkAddAnnotation(g,x,cr.REMOTE)}else i.bulkAddAnnotation(y,x,cr.REMOTE)},p=(y,x)=>{y?s.setSelected(y,x):s.clear()},m=y=>{s.clear(),s.setUserSelectAction(y)},_=y=>{if(e){const x=e.parse(y).parsed,g=e.serialize(i.getAnnotation(x.id));return i.updateAnnotation(x),g}else{const x=i.getAnnotation(y.id);return i.updateAnnotation(y),x}};return{addAnnotation:n,cancelSelected:o,canRedo:t.canRedo,canUndo:t.canUndo,clearAnnotations:a,getAnnotationById:l,getAnnotations:h,getSelected:c,loadAnnotations:u,redo:t.redo,removeAnnotation:d,setAnnotations:f,setSelected:p,setUserSelectAction:m,undo:t.undo,updateAnnotation:_}},up="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let dp=r=>crypto.getRandomValues(new Uint8Array(r)),fp=(r,t,e)=>{let i=(2<<Math.log(r.length-1)/Math.LN2)-1,s=-~(1.6*i*t/r.length);return(n=t)=>{let o="";for(;;){let a=e(s),l=s;for(;l--;)if(o+=r[a[l]&i]||"",o.length===n)return o}}},pp=(r,t=21)=>fp(r,t,dp),mp=(r=21)=>{let t="",e=crypto.getRandomValues(new Uint8Array(r));for(;r--;)t+=up[e[r]&63];return t};const gp=()=>({isGuest:!0,id:pp("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_",20)()}),yp=["#ff7c00","#1ac938","#e8000b","#8b2be2","#9f4800","#f14cc1","#ffc400","#00d7ff","#023eff"],_p=()=>{const r=[...yp];return{assignRandomColor:()=>{const t=Math.floor(Math.random()*r.length),e=r[t];return r.splice(t,1),e},releaseColor:t=>r.push(t)}};mp();var vp=Object.defineProperty,xp=(r,t,e)=>t in r?vp(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Gl=(r,t,e)=>xp(r,typeof t!="symbol"?t+"":t,e);function At(){}function ao(r,t){for(const e in t)r[e]=t[e];return r}function $l(r){return r()}function Hl(){return Object.create(null)}function Pe(r){r.forEach($l)}function Ut(r){return typeof r=="function"}function qt(r,t){return r!=r?t==t:r!==t||r&&typeof r=="object"||typeof r=="function"}function bp(r){return Object.keys(r).length===0}function Xl(r,...t){if(r==null){for(const i of t)i(void 0);return At}const e=r.subscribe(...t);return e.unsubscribe?()=>e.unsubscribe():e}function lo(r,t,e){r.$$.on_destroy.push(Xl(t,e))}function wp(r,t,e,i){if(r){const s=Vl(r,t,e,i);return r[0](s)}}function Vl(r,t,e,i){return r[1]&&i?ao(e.ctx.slice(),r[1](i(t))):e.ctx}function Ep(r,t,e,i){if(r[2]&&i){const s=r[2](i(e));if(t.dirty===void 0)return s;if(typeof s=="object"){const n=[],o=Math.max(t.dirty.length,s.length);for(let a=0;a<o;a+=1)n[a]=t.dirty[a]|s[a];return n}return t.dirty|s}return t.dirty}function Tp(r,t,e,i,s,n){if(s){const o=Vl(t,e,i,n);r.p(o,s)}}function Ap(r){if(r.ctx.length>32){const t=[],e=r.ctx.length/32;for(let i=0;i<e;i++)t[i]=-1;return t}return-1}function zl(r){const t={};for(const e in r)e[0]!=="$"&&(t[e]=r[e]);return t}function Cs(r){return r??""}const Sp=typeof window<"u"?window:typeof globalThis<"u"?globalThis:global;function Me(r,t){r.appendChild(t)}function rt(r,t,e){r.insertBefore(t,e||null)}function et(r){r.parentNode&&r.parentNode.removeChild(r)}function ho(r,t){for(let e=0;e<r.length;e+=1)r[e]&&r[e].d(t)}function gt(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function Wl(r){return document.createTextNode(r)}function ge(){return Wl(" ")}function ye(){return Wl("")}function Bt(r,t,e,i){return r.addEventListener(t,e,i),()=>r.removeEventListener(t,e,i)}function E(r,t,e){e==null?r.removeAttribute(t):r.getAttribute(t)!==e&&r.setAttribute(t,e)}function Cp(r){return Array.from(r.childNodes)}function ur(r,t,e){r.classList.toggle(t,!!e)}function Ip(r,t,{bubbles:e=!1,cancelable:i=!1}={}){return new CustomEvent(r,{detail:t,bubbles:e,cancelable:i})}let Hi;function Xi(r){Hi=r}function jl(){if(!Hi)throw new Error("Function called outside component initialization");return Hi}function Vi(r){jl().$$.on_mount.push(r)}function Jr(){const r=jl();return(t,e,{cancelable:i=!1}={})=>{const s=r.$$.callbacks[t];if(s){const n=Ip(t,e,{cancelable:i});return s.slice().forEach(o=>{o.call(r,n)}),!n.defaultPrevented}return!0}}function qe(r,t){const e=r.$$.callbacks[t.type];e&&e.slice().forEach(i=>i.call(this,t))}const Qr=[],Is=[];let ti=[];const Yl=[],Rp=Promise.resolve();let co=!1;function Pp(){co||(co=!0,Rp.then(ql))}function uo(r){ti.push(r)}const fo=new Set;let ei=0;function ql(){if(ei!==0)return;const r=Hi;do{try{for(;ei<Qr.length;){const t=Qr[ei];ei++,Xi(t),Mp(t.$$)}}catch(t){throw Qr.length=0,ei=0,t}for(Xi(null),Qr.length=0,ei=0;Is.length;)Is.pop()();for(let t=0;t<ti.length;t+=1){const e=ti[t];fo.has(e)||(fo.add(e),e())}ti.length=0}while(Qr.length);for(;Yl.length;)Yl.pop()();co=!1,fo.clear(),Xi(r)}function Mp(r){if(r.fragment!==null){r.update(),Pe(r.before_update);const t=r.dirty;r.dirty=[-1],r.fragment&&r.fragment.p(r.ctx,t),r.after_update.forEach(uo)}}function Bp(r){const t=[],e=[];ti.forEach(i=>r.indexOf(i)===-1?t.push(i):e.push(i)),e.forEach(i=>i()),ti=t}const Rs=new Set;let Mr;function _e(){Mr={r:0,c:[],p:Mr}}function ve(){Mr.r||Pe(Mr.c),Mr=Mr.p}function st(r,t){r&&r.i&&(Rs.delete(r),r.i(t))}function ut(r,t,e,i){if(r&&r.o){if(Rs.has(r))return;Rs.add(r),Mr.c.push(()=>{Rs.delete(r),i&&(e&&r.d(1),i())}),r.o(t)}else i&&i()}function ri(r){return(r==null?void 0:r.length)!==void 0?r:Array.from(r)}function ce(r){r&&r.c()}function se(r,t,e){const{fragment:i,after_update:s}=r.$$;i&&i.m(t,e),uo(()=>{const n=r.$$.on_mount.map($l).filter(Ut);r.$$.on_destroy?r.$$.on_destroy.push(...n):Pe(n),r.$$.on_mount=[]}),s.forEach(uo)}function ne(r,t){const e=r.$$;e.fragment!==null&&(Bp(e.after_update),Pe(e.on_destroy),e.fragment&&e.fragment.d(t),e.on_destroy=e.fragment=null,e.ctx=[])}function Dp(r,t){r.$$.dirty[0]===-1&&(Qr.push(r),Pp(),r.$$.dirty.fill(0)),r.$$.dirty[t/31|0]|=1<<t%31}function ue(r,t,e,i,s,n,o=null,a=[-1]){const l=Hi;Xi(r);const h=r.$$={fragment:null,ctx:[],props:n,update:At,not_equal:s,bound:Hl(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(l?l.$$.context:[])),callbacks:Hl(),dirty:a,skip_bound:!1,root:t.target||l.$$.root};o&&o(h.root);let c=!1;if(h.ctx=e?e(r,t.props||{},(u,d,...f)=>{const p=f.length?f[0]:d;return h.ctx&&s(h.ctx[u],h.ctx[u]=p)&&(!h.skip_bound&&h.bound[u]&&h.bound[u](p),c&&Dp(r,u)),d}):[],h.update(),c=!0,Pe(h.before_update),h.fragment=i?i(h.ctx):!1,t.target){if(t.hydrate){const u=Cp(t.target);h.fragment&&h.fragment.l(u),u.forEach(et)}else h.fragment&&h.fragment.c();t.intro&&st(r.$$.fragment),se(r,t.target,t.anchor),ql()}Xi(l)}class de{constructor(){Gl(this,"$$"),Gl(this,"$$set")}$destroy(){ne(this,1),this.$destroy=At}$on(t,e){if(!Ut(e))return At;const i=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return i.push(e),()=>{const s=i.indexOf(e);s!==-1&&i.splice(s,1)}}$set(t){this.$$set&&!bp(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const Op="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Op);var wt=(r=>(r.ELLIPSE="ELLIPSE",r.POLYGON="POLYGON",r.RECTANGLE="RECTANGLE",r))(wt||{});const po={},mo=(r,t)=>po[r]=t,go=r=>po[r.type].area(r),Fp=(r,t,e)=>po[r.type].intersects(r,t,e),Ps=r=>{let t=1/0,e=1/0,i=-1/0,s=-1/0;return r.forEach(([n,o])=>{t=Math.min(t,n),e=Math.min(e,o),i=Math.max(i,n),s=Math.max(s,o)}),{minX:t,minY:e,maxX:i,maxY:s}},Lp={area:r=>Math.PI*r.geometry.rx*r.geometry.ry,intersects:(r,t,e)=>{const{cx:i,cy:s,rx:n,ry:o}=r.geometry,a=0,l=Math.cos(a),h=Math.sin(a),c=t-i,u=e-s,d=l*c+h*u,f=h*c-l*u;return d*d/(n*n)+f*f/(o*o)<=1}};mo(wt.ELLIPSE,Lp);const Np={area:r=>{const{points:t}=r.geometry;let e=0,i=t.length-1;for(let s=0;s<t.length;s++)e+=(t[i][0]+t[s][0])*(t[i][1]-t[s][1]),i=s;return Math.abs(.5*e)},intersects:(r,t,e)=>{const{points:i}=r.geometry;let s=!1;for(let n=0,o=i.length-1;n<i.length;o=n++){const a=i[n][0],l=i[n][1],h=i[o][0],c=i[o][1];l>e!=c>e&&t<(h-a)*(e-l)/(c-l)+a&&(s=!s)}return s}};mo(wt.POLYGON,Np);const Up={area:r=>r.geometry.w*r.geometry.h,intersects:(r,t,e)=>t>=r.geometry.x&&t<=r.geometry.x+r.geometry.w&&e>=r.geometry.y&&e<=r.geometry.y+r.geometry.h};mo(wt.RECTANGLE,Up);const kp=(r,t=!1)=>{const e=typeof r=="string"?r:r.value,i=/^(xywh)=(pixel|percent)?:?(.+?),(.+?),(.+?),(.+)*/g,s=[...e.matchAll(i)][0],[n,o,a,l,h,c,u]=s;if(o!=="xywh")throw new Error("Unsupported MediaFragment: "+e);if(a&&a!=="pixel")throw new Error(`Unsupported MediaFragment unit: ${a}`);const[d,f,p,m]=[l,h,c,u].map(parseFloat);return{type:wt.RECTANGLE,geometry:{x:d,y:f,w:p,h:m,bounds:{minX:d,minY:t?f-m:f,maxX:d+p,maxY:t?f:f+m}}}},Gp=r=>{const{x:t,y:e,w:i,h:s}=r;return{type:"FragmentSelector",conformsTo:"http://www.w3.org/TR/media-frags/",value:`xywh=pixel:${t},${e},${i},${s}`}},Kl="http://www.w3.org/2000/svg",Zl=r=>{const t=i=>{Array.from(i.attributes).forEach(s=>{s.name.startsWith("on")&&i.removeAttribute(s.name)})},e=r.getElementsByTagName("script");return Array.from(e).reverse().forEach(i=>i.parentNode.removeChild(i)),Array.from(r.querySelectorAll("*")).forEach(t),r},$p=r=>{const t=new XMLSerializer().serializeToString(r.documentElement).replace("<svg>",`<svg xmlns="${Kl}">`);return new DOMParser().parseFromString(t,"image/svg+xml").documentElement},Hp=r=>{const t=new DOMParser().parseFromString(r,"image/svg+xml"),e=t.lookupPrefix(Kl),i=t.lookupNamespaceURI(null);return e||i?Zl(t).firstChild:Zl($p(t)).firstChild},Xp=r=>{const[t,e,i]=r.match(/(<polygon points=["|'])([^("|')]*)/)||[],s=i.split(" ").map(n=>n.split(",").map(parseFloat));return{type:wt.POLYGON,geometry:{points:s,bounds:Ps(s)}}},Vp=r=>{const t=Hp(r),e=parseFloat(t.getAttribute("cx")),i=parseFloat(t.getAttribute("cy")),s=parseFloat(t.getAttribute("rx")),n=parseFloat(t.getAttribute("ry")),o={minX:e-s,minY:i-n,maxX:e+s,maxY:i+n};return{type:wt.ELLIPSE,geometry:{cx:e,cy:i,rx:s,ry:n,bounds:o}}},zp=r=>{const t=typeof r=="string"?r:r.value;if(t.includes("<polygon points="))return Xp(t);if(t.includes("<ellipse "))return Vp(t);throw"Unsupported SVG shape: "+t},Wp=r=>{let t;if(r.type===wt.POLYGON){const e=r.geometry,{points:i}=e;t=`<svg><polygon points="${i.map(s=>s.join(",")).join(" ")}" /></svg>`}else if(r.type===wt.ELLIPSE){const e=r.geometry;t=`<svg><ellipse cx="${e.cx}" cy="${e.cy}" rx="${e.rx}" ry="${e.ry}" /></svg>`}if(t)return{type:"SvgSelector",value:t};throw`Unsupported shape type: ${r.type}`};for(var Xt=[],yo=0;yo<256;++yo)Xt.push((yo+256).toString(16).slice(1));function jp(r,t=0){return(Xt[r[t+0]]+Xt[r[t+1]]+Xt[r[t+2]]+Xt[r[t+3]]+"-"+Xt[r[t+4]]+Xt[r[t+5]]+"-"+Xt[r[t+6]]+Xt[r[t+7]]+"-"+Xt[r[t+8]]+Xt[r[t+9]]+"-"+Xt[r[t+10]]+Xt[r[t+11]]+Xt[r[t+12]]+Xt[r[t+13]]+Xt[r[t+14]]+Xt[r[t+15]]).toLowerCase()}var Ms,Yp=new Uint8Array(16);function qp(){if(!Ms&&(Ms=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ms))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ms(Yp)}var Kp=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Jl={randomUUID:Kp};function Ql(r,t,e){if(Jl.randomUUID&&!t&&!r)return Jl.randomUUID();r=r||{};var i=r.random||(r.rng||qp)();return i[6]=i[6]&15|64,i[8]=i[8]&63|128,jp(i)}var th=Object.prototype.hasOwnProperty;function dr(r,t){var e,i;if(r===t)return!0;if(r&&t&&(e=r.constructor)===t.constructor){if(e===Date)return r.getTime()===t.getTime();if(e===RegExp)return r.toString()===t.toString();if(e===Array){if((i=r.length)===t.length)for(;i--&&dr(r[i],t[i]););return i===-1}if(!e||typeof r=="object"){i=0;for(e in r)if(th.call(r,e)&&++i&&!th.call(t,e)||!(e in t)||!dr(r[e],t[e]))return!1;return Object.keys(t).length===i}}return r!==r&&t!==t}function _o(){}function Zp(r,t){return r!=r?t==t:r!==t||r&&typeof r=="object"||typeof r=="function"}const ii=[];function vo(r,t=_o){let e;const i=new Set;function s(a){if(Zp(r,a)&&(r=a,e)){const l=!ii.length;for(const h of i)h[1](),ii.push(h,r);if(l){for(let h=0;h<ii.length;h+=2)ii[h][0](ii[h+1]);ii.length=0}}}function n(a){s(a(r))}function o(a,l=_o){const h=[a,l];return i.add(h),i.size===1&&(e=t(s,n)||_o),a(r),()=>{i.delete(h),i.size===0&&e&&(e(),e=null)}}return{set:s,update:n,subscribe:o}}const Jp=r=>{const{subscribe:t,set:e}=vo();let i;return t(s=>i=s),r.observe(({changes:s})=>{if(i){(s.deleted||[]).some(o=>o.id===i)&&e(void 0);const n=(s.updated||[]).find(({oldValue:o})=>o.id===i);n&&e(n.newValue.id)}}),{get current(){return i},subscribe:t,set:e}};var eh=(r=>(r.EDIT="EDIT",r.SELECT="SELECT",r.NONE="NONE",r))(eh||{});const Bs={selected:[]},Qp=r=>{const{subscribe:t,set:e}=vo(Bs);let i,s=Bs;t(d=>s=d);const n=()=>{dr(s,Bs)||e(Bs)},o=()=>{var d;return((d=s.selected)==null?void 0:d.length)===0},a=d=>{if(o())return!1;const f=typeof d=="string"?d:d.id;return s.selected.some(p=>p.id===f)},l=(d,f)=>{const p=r.getAnnotation(d);if(!p){console.warn("Invalid selection: "+d);return}switch(rh(p,i)){case"EDIT":e({selected:[{id:d,editable:!0}],event:f});break;case"SELECT":e({selected:[{id:d}],event:f});break;default:e({selected:[],event:f})}},h=(d,f)=>{const p=Array.isArray(d)?d:[d],m=p.map(_=>r.getAnnotation(_)).filter(_=>!!_);e({selected:m.map(_=>{const y=f===void 0?rh(_,i)==="EDIT":f;return{id:_.id,editable:y}})}),m.length!==p.length&&console.warn("Invalid selection",d)},c=d=>{if(o())return!1;const{selected:f}=s;f.some(({id:p})=>d.includes(p))&&e({selected:f.filter(({id:p})=>!d.includes(p))})},u=d=>i=d;return r.observe(({changes:d})=>c((d.deleted||[]).map(f=>f.id))),{get event(){return s?s.event:null},get selected(){return s?[...s.selected]:null},get userSelectAction(){return i},clear:n,isEmpty:o,isSelected:a,setSelected:h,setUserSelectAction:u,subscribe:t,userSelect:l}},rh=(r,t)=>typeof t=="function"?t(r):t||"EDIT";for(var Vt=[],xo=0;xo<256;++xo)Vt.push((xo+256).toString(16).slice(1));function tm(r,t=0){return(Vt[r[t+0]]+Vt[r[t+1]]+Vt[r[t+2]]+Vt[r[t+3]]+"-"+Vt[r[t+4]]+Vt[r[t+5]]+"-"+Vt[r[t+6]]+Vt[r[t+7]]+"-"+Vt[r[t+8]]+Vt[r[t+9]]+"-"+Vt[r[t+10]]+Vt[r[t+11]]+Vt[r[t+12]]+Vt[r[t+13]]+Vt[r[t+14]]+Vt[r[t+15]]).toLowerCase()}var Ds,em=new Uint8Array(16);function rm(){if(!Ds&&(Ds=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ds))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ds(em)}var im=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const ih={randomUUID:im};function sm(r,t,e){if(ih.randomUUID&&!t&&!r)return ih.randomUUID();r=r||{};var i=r.random||(r.rng||rm)();return i[6]=i[6]&15|64,i[8]=i[8]&63|128,tm(i)}const nm=(r,t)=>{const e=new Set(r.bodies.map(i=>i.id));return t.bodies.filter(i=>!e.has(i.id))},om=(r,t)=>{const e=new Set(t.bodies.map(i=>i.id));return r.bodies.filter(i=>!e.has(i.id))},am=(r,t)=>t.bodies.map(e=>{const i=r.bodies.find(s=>s.id===e.id);return{newBody:e,oldBody:i&&!dr(i,e)?i:void 0}}).filter(({oldBody:e})=>e).map(({oldBody:e,newBody:i})=>({oldBody:e,newBody:i})),lm=(r,t)=>!dr(r.target,t.target),sh=(r,t)=>{const e=nm(r,t),i=om(r,t),s=am(r,t);return{oldValue:r,newValue:t,bodiesCreated:e.length>0?e:void 0,bodiesDeleted:i.length>0?i:void 0,bodiesUpdated:s.length>0?s:void 0,targetUpdated:lm(r,t)?{oldTarget:r.target,newTarget:t.target}:void 0}};var St=(r=>(r.LOCAL="LOCAL",r.REMOTE="REMOTE",r))(St||{});const hm=(r,t)=>{var e,i;const{changes:s,origin:n}=t;if(!(!r.options.origin||r.options.origin===n))return!1;if(r.options.ignore){const{ignore:o}=r.options,a=l=>l&&l.length>0;if(!(a(s.created)||a(s.deleted))){const l=(e=s.updated)==null?void 0:e.some(c=>a(c.bodiesCreated)||a(c.bodiesDeleted)||a(c.bodiesUpdated)),h=(i=s.updated)==null?void 0:i.some(c=>c.targetUpdated);if(o==="BODY_ONLY"&&l&&!h||o==="TARGET_ONLY"&&h&&!l)return!1}}if(r.options.annotations){const o=new Set([...(s.created||[]).map(a=>a.id),...(s.deleted||[]).map(a=>a.id),...(s.updated||[]).map(({oldValue:a})=>a.id)]);return!!(Array.isArray(r.options.annotations)?r.options.annotations:[r.options.annotations]).find(a=>o.has(a))}else return!0},cm=(r,t)=>{const e=new Set((r.created||[]).map(u=>u.id)),i=new Set((r.updated||[]).map(({newValue:u})=>u.id)),s=new Set((t.created||[]).map(u=>u.id)),n=new Set((t.deleted||[]).map(u=>u.id)),o=new Set((t.updated||[]).map(({oldValue:u})=>u.id)),a=new Set((t.updated||[]).filter(({oldValue:u})=>e.has(u.id)||i.has(u.id)).map(({oldValue:u})=>u.id)),l=[...(r.created||[]).filter(u=>!n.has(u.id)).map(u=>o.has(u.id)?t.updated.find(({oldValue:d})=>d.id===u.id).newValue:u),...t.created||[]],h=[...(r.deleted||[]).filter(u=>!s.has(u.id)),...(t.deleted||[]).filter(u=>!e.has(u.id))],c=[...(r.updated||[]).filter(({newValue:u})=>!n.has(u.id)).map(u=>{const{oldValue:d,newValue:f}=u;if(o.has(f.id)){const p=t.updated.find(m=>m.oldValue.id===f.id).newValue;return sh(d,p)}else return u}),...(t.updated||[]).filter(({oldValue:u})=>!a.has(u.id))];return{created:l,deleted:h,updated:c}},bo=r=>{const t=r.id===void 0?sm():r.id;return{...r,id:t,bodies:r.bodies===void 0?[]:r.bodies.map(e=>({...e,annotation:t})),target:{...r.target,annotation:t}}},um=r=>r.id!==void 0,dm=()=>{const r=new Map,t=new Map,e=[],i=(A,P={})=>e.push({onChange:A,options:P}),s=A=>{const P=e.findIndex(R=>R.onChange==A);P>-1&&e.splice(P,1)},n=(A,P)=>{const R={origin:A,changes:{created:P.created||[],updated:P.updated||[],deleted:P.deleted||[]},state:[...r.values()]};e.forEach(b=>{hm(b,R)&&b.onChange(R)})},o=(A,P=St.LOCAL)=>{if(A.id&&r.get(A.id))throw Error(`Cannot add annotation ${A.id} - exists already`);{const R=bo(A);r.set(R.id,R),R.bodies.forEach(b=>t.set(b.id,R.id)),n(P,{created:[R]})}},a=(A,P)=>{const R=bo(typeof A=="string"?P:A),b=typeof A=="string"?A:A.id,M=b&&r.get(b);if(M){const S=sh(M,R);return b===R.id?r.set(b,R):(r.delete(b),r.set(R.id,R)),M.bodies.forEach(U=>t.delete(U.id)),R.bodies.forEach(U=>t.set(U.id,R.id)),S}else console.warn(`Cannot update annotation ${b} - does not exist`)},l=(A,P=St.LOCAL,R=St.LOCAL)=>{const b=um(P)?R:P,M=a(A,P);M&&n(b,{updated:[M]})},h=(A,P=St.LOCAL)=>{const R=A.reduce((b,M)=>{const S=a(M);return S?[...b,S]:b},[]);R.length>0&&n(P,{updated:R})},c=(A,P=St.LOCAL)=>{const R=r.get(A.annotation);if(R){const b={...R,bodies:[...R.bodies,A]};r.set(R.id,b),t.set(A.id,b.id),n(P,{updated:[{oldValue:R,newValue:b,bodiesCreated:[A]}]})}else console.warn(`Attempt to add body to missing annotation: ${A.annotation}`)},u=()=>[...r.values()],d=(A=St.LOCAL)=>{const P=[...r.values()];r.clear(),t.clear(),n(A,{deleted:P})},f=(A,P=!0,R=St.LOCAL)=>{const b=A.map(bo);if(P){const M=[...r.values()];r.clear(),t.clear(),b.forEach(S=>{r.set(S.id,S),S.bodies.forEach(U=>t.set(U.id,S.id))}),n(R,{created:b,deleted:M})}else{const M=A.reduce((S,U)=>{const L=U.id&&r.get(U.id);return L?[...S,L]:S},[]);if(M.length>0)throw Error(`Bulk insert would overwrite the following annotations: ${M.map(S=>S.id).join(", ")}`);b.forEach(S=>{r.set(S.id,S),S.bodies.forEach(U=>t.set(U.id,S.id))}),n(R,{created:b})}},p=A=>{const P=typeof A=="string"?A:A.id,R=r.get(P);if(R)return r.delete(P),R.bodies.forEach(b=>t.delete(b.id)),R;console.warn(`Attempt to delete missing annotation: ${P}`)},m=(A,P=St.LOCAL)=>{const R=p(A);R&&n(P,{deleted:[R]})},_=(A,P=St.LOCAL)=>{const R=A.reduce((b,M)=>{const S=p(M);return S?[...b,S]:b},[]);R.length>0&&n(P,{deleted:R})},y=A=>{const P=r.get(A.annotation);if(P){const R=P.bodies.find(b=>b.id===A.id);if(R){t.delete(R.id);const b={...P,bodies:P.bodies.filter(M=>M.id!==A.id)};return r.set(P.id,b),{oldValue:P,newValue:b,bodiesDeleted:[R]}}else console.warn(`Attempt to delete missing body ${A.id} from annotation ${A.annotation}`)}else console.warn(`Attempt to delete body from missing annotation ${A.annotation}`)},x=(A,P=St.LOCAL)=>{const R=y(A);R&&n(P,{updated:[R]})},g=(A,P=St.LOCAL)=>{const R=A.map(b=>y(b)).filter(Boolean);R.length>0&&n(P,{updated:R})},v=A=>{const P=r.get(A);return P?{...P}:void 0},w=A=>{const P=t.get(A);if(P){const R=v(P).bodies.find(b=>b.id===A);if(R)return R;console.error(`Store integrity error: body ${A} in index, but not in annotation`)}else console.warn(`Attempt to retrieve missing body: ${A}`)},I=(A,P)=>{if(A.annotation!==P.annotation)throw"Annotation integrity violation: annotation ID must be the same when updating bodies";const R=r.get(A.annotation);if(R){const b=R.bodies.find(S=>S.id===A.id),M={...R,bodies:R.bodies.map(S=>S.id===b.id?P:S)};return r.set(R.id,M),b.id!==P.id&&(t.delete(b.id),t.set(P.id,M.id)),{oldValue:R,newValue:M,bodiesUpdated:[{oldBody:b,newBody:P}]}}else console.warn(`Attempt to add body to missing annotation ${A.annotation}`)},T=(A,P,R=St.LOCAL)=>{const b=I(A,P);b&&n(R,{updated:[b]})},C=(A,P=St.LOCAL)=>{const R=A.map(b=>I({id:b.id,annotation:b.annotation},b)).filter(Boolean);n(P,{updated:R})},D=A=>{const P=r.get(A.annotation);if(P){const R={...P,target:{...P.target,...A}};return r.set(P.id,R),{oldValue:P,newValue:R,targetUpdated:{oldTarget:P.target,newTarget:A}}}else console.warn(`Attempt to update target on missing annotation: ${A.annotation}`)};return{addAnnotation:o,addBody:c,all:u,bulkAddAnnotation:f,bulkDeleteAnnotation:_,bulkDeleteBodies:g,bulkUpdateAnnotation:h,bulkUpdateBodies:C,bulkUpdateTargets:(A,P=St.LOCAL)=>{const R=A.map(b=>D(b)).filter(Boolean);R.length>0&&n(P,{updated:R})},clear:d,deleteAnnotation:m,deleteBody:x,getAnnotation:v,getBody:w,observe:i,unobserve:s,updateAnnotation:l,updateBody:T,updateTarget:(A,P=St.LOCAL)=>{const R=D(A);R&&n(P,{updated:[R]})}}},fm=r=>({...r,subscribe:t=>{const e=i=>t(i.state);return r.observe(e),t(r.all()),()=>r.unobserve(e)}});let pm=()=>({emit(r,...t){for(let e=0,i=this.events[r]||[],s=i.length;e<s;e++)i[e](...t)},events:{},on(r,t){var e;return((e=this.events)[r]||(e[r]=[])).push(t),()=>{var i;this.events[r]=(i=this.events[r])==null?void 0:i.filter(s=>t!==s)}}});const mm=250,gm=r=>{const t=pm(),e=[];let i=-1,s=!1,n=0;const o=f=>{if(!s){const{changes:p}=f,m=performance.now();if(m-n>mm)e.splice(i+1),e.push(p),i=e.length-1;else{const _=e.length-1;e[_]=cm(e[_],p)}n=m}s=!1};r.observe(o,{origin:St.LOCAL});const a=f=>f&&f.length>0&&r.bulkDeleteAnnotation(f),l=f=>f&&f.length>0&&r.bulkAddAnnotation(f,!1),h=f=>f&&f.length>0&&r.bulkUpdateAnnotation(f.map(({oldValue:p})=>p)),c=f=>f&&f.length>0&&r.bulkUpdateAnnotation(f.map(({newValue:p})=>p)),u=f=>f&&f.length>0&&r.bulkAddAnnotation(f,!1),d=f=>f&&f.length>0&&r.bulkDeleteAnnotation(f);return{canRedo:()=>e.length-1>i,canUndo:()=>i>-1,destroy:()=>r.unobserve(o),on:(f,p)=>t.on(f,p),redo:()=>{if(e.length-1>i){s=!0;const{created:f,updated:p,deleted:m}=e[i+1];l(f),c(p),d(m),t.emit("redo",e[i+1]),i+=1}},undo:()=>{if(i>-1){s=!0;const{created:f,updated:p,deleted:m}=e[i];a(f),h(p),u(m),t.emit("undo",e[i]),i-=1}}}},ym=()=>{const{subscribe:r,set:t}=vo([]);return{subscribe:r,set:t}},_m=(r,t,e,i)=>{const{store:s,selection:n,hover:o,viewport:a}=r,l=new Map;let h=[],c,u;const d=(y,x)=>{l.has(y)?l.get(y).push(x):l.set(y,[x])},f=(y,x)=>{const g=l.get(y);if(g){const v=g.indexOf(x);v!==-1&&g.splice(v,1)}},p=(y,x,g)=>{l.has(y)&&setTimeout(()=>{l.get(y).forEach(v=>{if(e){const w=Array.isArray(x)?x.map(T=>e.serialize(T)):e.serialize(x),I=g?g instanceof PointerEvent?g:e.serialize(g):void 0;v(w,I)}else v(x,g)})},1)},m=()=>{const{selected:y}=n,x=(y||[]).map(({id:g})=>s.getAnnotation(g));x.forEach(g=>{const v=h.find(w=>w.id===g.id);(!v||!dr(v,g))&&p("updateAnnotation",g,v)}),h=h.map(g=>x.find(({id:v})=>v===g.id)||g)};n.subscribe(({selected:y})=>{if(!(h.length===0&&y.length===0)){if(h.length===0&&y.length>0)h=y.map(({id:x})=>s.getAnnotation(x));else if(h.length>0&&y.length===0)h.forEach(x=>{const g=s.getAnnotation(x.id);g&&!dr(g,x)&&p("updateAnnotation",g,x)}),h=[];else{const x=new Set(h.map(v=>v.id)),g=new Set(y.map(({id:v})=>v));h.filter(v=>!g.has(v.id)).forEach(v=>{const w=s.getAnnotation(v.id);w&&!dr(w,v)&&p("updateAnnotation",w,v)}),h=[...h.filter(v=>g.has(v.id)),...y.filter(({id:v})=>!x.has(v)).map(({id:v})=>s.getAnnotation(v))]}p("selectionChanged",h)}}),o.subscribe(y=>{!c&&y?p("mouseEnterAnnotation",s.getAnnotation(y)):c&&!y?p("mouseLeaveAnnotation",s.getAnnotation(c)):c&&y&&(p("mouseLeaveAnnotation",s.getAnnotation(c)),p("mouseEnterAnnotation",s.getAnnotation(y))),c=y}),a==null||a.subscribe(y=>p("viewportIntersect",y.map(x=>s.getAnnotation(x)))),s.observe(y=>{i&&(u&&clearTimeout(u),u=setTimeout(m,1e3));const{created:x,deleted:g}=y.changes;(x||[]).forEach(v=>p("createAnnotation",v)),(g||[]).forEach(v=>p("deleteAnnotation",v)),(y.changes.updated||[]).filter(v=>[...v.bodiesCreated||[],...v.bodiesDeleted||[],...v.bodiesUpdated||[]].length>0).forEach(({oldValue:v,newValue:w})=>{const I=h.find(T=>T.id===v.id)||v;h=h.map(T=>T.id===v.id?w:T),p("updateAnnotation",w,I)})},{origin:St.LOCAL}),s.observe(y=>{if(h){const x=new Set(h.map(v=>v.id)),g=(y.changes.updated||[]).filter(({newValue:v})=>x.has(v.id)).map(({newValue:v})=>v);g.length>0&&(h=h.map(v=>g.find(w=>w.id===v.id)||v))}},{origin:St.REMOTE});const _=y=>x=>{const{updated:g}=x;y?(g||[]).forEach(v=>p("updateAnnotation",v.oldValue,v.newValue)):(g||[]).forEach(v=>p("updateAnnotation",v.newValue,v.oldValue))};return t.on("undo",_(!0)),t.on("redo",_(!1)),{on:d,off:f,emit:p}},vm=r=>t=>t.reduce((e,i)=>{const{parsed:s,error:n}=r.parse(i);return n?{parsed:e.parsed,failed:[...e.failed,i]}:s?{parsed:[...e.parsed,s],failed:e.failed}:{...e}},{parsed:[],failed:[]}),xm=(r,t,e)=>{const{store:i,selection:s}=r,n=y=>{if(e){const{parsed:x,error:g}=e.parse(y);x?i.addAnnotation(x,St.REMOTE):console.error(g)}else i.addAnnotation(y,St.REMOTE)},o=()=>s.clear(),a=()=>i.clear(),l=y=>{const x=i.getAnnotation(y);return e&&x?e.serialize(x):x},h=()=>e?i.all().map(e.serialize):i.all(),c=()=>{var y;const x=(((y=s.selected)==null?void 0:y.map(g=>g.id))||[]).map(g=>i.getAnnotation(g)).filter(Boolean);return e?x.map(e.serialize):x},u=(y,x=!0)=>fetch(y).then(g=>g.json()).then(g=>(f(g,x),g)),d=y=>{if(typeof y=="string"){const x=i.getAnnotation(y);if(i.deleteAnnotation(y),x)return e?e.serialize(x):x}else{const x=e?e.parse(y).parsed:y;if(x)return i.deleteAnnotation(x),y}},f=(y,x=!0)=>{if(e){const{parsed:g,failed:v}=vm(e)(y);v.length>0&&console.warn(`Discarded ${v.length} invalid annotations`,v),i.bulkAddAnnotation(g,x,St.REMOTE)}else i.bulkAddAnnotation(y,x,St.REMOTE)},p=(y,x)=>{y?s.setSelected(y,x):s.clear()},m=y=>{s.clear(),s.setUserSelectAction(y)},_=y=>{if(e){const x=e.parse(y).parsed,g=e.serialize(i.getAnnotation(x.id));return i.updateAnnotation(x),g}else{const x=i.getAnnotation(y.id);return i.updateAnnotation(y),x}};return{addAnnotation:n,cancelSelected:o,canRedo:t.canRedo,canUndo:t.canUndo,clearAnnotations:a,getAnnotationById:l,getAnnotations:h,getSelected:c,loadAnnotations:u,redo:t.redo,removeAnnotation:d,setAnnotations:f,setSelected:p,setUserSelectAction:m,undo:t.undo,updateAnnotation:_}},bm="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let wm=r=>crypto.getRandomValues(new Uint8Array(r)),Em=(r,t,e)=>{let i=(2<<Math.log(r.length-1)/Math.LN2)-1,s=-~(1.6*i*t/r.length);return(n=t)=>{let o="";for(;;){let a=e(s),l=s;for(;l--;)if(o+=r[a[l]&i]||"",o.length===n)return o}}},Tm=(r,t=21)=>Em(r,t,wm),Am=(r=21)=>{let t="",e=crypto.getRandomValues(new Uint8Array(r));for(;r--;)t+=bm[e[r]&63];return t};const Sm=()=>({isGuest:!0,id:Tm("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_",20)()}),Cm=r=>{const t=JSON.stringify(r);let e=0;for(let i=0,s=t.length;i<s;i++){let n=t.charCodeAt(i);e=(e<<5)-e+n,e|=0}return`${e}`},nh=r=>r?typeof r=="object"?{...r}:r:void 0,Im=(r,t)=>(Array.isArray(r)?r:[r]).map(e=>{const{id:i,type:s,purpose:n,value:o,created:a,modified:l,creator:h,...c}=e;return{id:i||`temp-${Cm(e)}`,annotation:t,type:s,purpose:n,value:o,creator:nh(h),created:a?new Date(a):void 0,updated:l?new Date(l):void 0,...c}}),Rm=r=>r.map(t=>{var e;const{annotation:i,created:s,updated:n,...o}=t,a={...o,created:s==null?void 0:s.toISOString(),modified:n==null?void 0:n.toISOString()};return(e=a.id)!=null&&e.startsWith("temp-")&&delete a.id,a});Am();const Pm=(r,t={strict:!0,invertY:!1})=>({parse:e=>Mm(e,t),serialize:e=>Bm(e,r,t)}),Mm=(r,t={strict:!0,invertY:!1})=>{const e=r.id||Ql(),{creator:i,created:s,modified:n,body:o,...a}=r,l=Im(o||[],e),h=Array.isArray(r.target)?r.target[0]:r.target,c=Array.isArray(h.selector)?h.selector[0]:h.selector,u=(c==null?void 0:c.type)==="FragmentSelector"?kp(c,t.invertY):(c==null?void 0:c.type)==="SvgSelector"?zp(c):void 0;return u||!t.strict?{parsed:{...a,id:e,bodies:l,target:{created:s?new Date(s):void 0,creator:nh(i),updated:n?new Date(n):void 0,...Array.isArray(a.target)?a.target[0]:a.target,annotation:e,selector:u||c}}}:{error:Error(`Invalid selector: ${JSON.stringify(c)}`)}},Bm=(r,t,e={strict:!0,invertY:!1})=>{const{selector:i,creator:s,created:n,updated:o,updatedBy:a,...l}=r.target;let h;try{h=i.type==wt.RECTANGLE?Gp(i.geometry):Wp(i)}catch(u){if(e.strict)throw u;h=i}const c={...r,"@context":"http://www.w3.org/ns/anno.jsonld",id:r.id,type:"Annotation",body:Rm(r.bodies),created:n==null?void 0:n.toISOString(),creator:s,modified:o==null?void 0:o.toISOString(),target:{...l,source:t,selector:h}};return delete c.bodies,"annotation"in c.target&&delete c.target.annotation,c};function oh(r,t,e){const i=r.slice();return i[10]=t[e],i[12]=e,i}function ah(r){let t,e;return t=new zi({props:{x:r[10][0],y:r[10][1],scale:r[3]}}),t.$on("pointerdown",function(){Ut(r[9](`HANDLE-${r[12]}`))&&r[9](`HANDLE-${r[12]}`).apply(this,arguments)}),{c(){ce(t.$$.fragment)},m(i,s){se(t,i,s),e=!0},p(i,s){r=i;const n={};s&16&&(n.x=r[10][0]),s&16&&(n.y=r[10][1]),s&8&&(n.scale=r[3]),t.$set(n)},i(i){e||(st(t.$$.fragment,i),e=!0)},o(i){ut(t.$$.fragment,i),e=!1},d(i){ne(t,i)}}}function Dm(r){let t,e,i,s,n,o,a,l,h,c,u,d=ri(r[4].points),f=[];for(let m=0;m<d.length;m+=1)f[m]=ah(oh(r,d,m));const p=m=>ut(f[m],1,1,()=>{f[m]=null});return{c(){t=gt("polygon"),s=ge(),n=gt("polygon"),a=ge();for(let m=0;m<f.length;m+=1)f[m].c();l=ye(),E(t,"class","a9s-outer"),E(t,"style",e=r[1]?"display:none;":void 0),E(t,"points",i=r[4].points.map(lh).join(" ")),E(n,"class","a9s-inner a9s-shape-handle"),E(n,"style",r[1]),E(n,"points",o=r[4].points.map(hh).join(" "))},m(m,_){rt(m,t,_),rt(m,s,_),rt(m,n,_),rt(m,a,_);for(let y=0;y<f.length;y+=1)f[y]&&f[y].m(m,_);rt(m,l,_),h=!0,c||(u=[Bt(t,"pointerdown",function(){Ut(r[9]("SHAPE"))&&r[9]("SHAPE").apply(this,arguments)}),Bt(n,"pointerdown",function(){Ut(r[9]("SHAPE"))&&r[9]("SHAPE").apply(this,arguments)})],c=!0)},p(m,_){if(r=m,(!h||_&2&&e!==(e=r[1]?"display:none;":void 0))&&E(t,"style",e),(!h||_&16&&i!==(i=r[4].points.map(lh).join(" ")))&&E(t,"points",i),(!h||_&2)&&E(n,"style",r[1]),(!h||_&16&&o!==(o=r[4].points.map(hh).join(" ")))&&E(n,"points",o),_&536){d=ri(r[4].points);let y;for(y=0;y<d.length;y+=1){const x=oh(r,d,y);f[y]?(f[y].p(x,_),st(f[y],1)):(f[y]=ah(x),f[y].c(),st(f[y],1),f[y].m(l.parentNode,l))}for(_e(),y=d.length;y<f.length;y+=1)p(y);ve()}},i(m){if(!h){for(let _=0;_<d.length;_+=1)st(f[_]);h=!0}},o(m){f=f.filter(Boolean);for(let _=0;_<f.length;_+=1)ut(f[_]);h=!1},d(m){m&&(et(t),et(s),et(n),et(a),et(l)),ho(f,m),c=!1,Pe(u)}}}function Om(r){let t,e;return t=new mh({props:{shape:r[0],transform:r[2],editor:r[5],$$slots:{default:[Dm,({grab:i})=>({9:i}),({grab:i})=>i?512:0]},$$scope:{ctx:r}}}),t.$on("change",r[6]),t.$on("grab",r[7]),t.$on("release",r[8]),{c(){ce(t.$$.fragment)},m(i,s){se(t,i,s),e=!0},p(i,[s]){const n={};s&1&&(n.shape=i[0]),s&4&&(n.transform=i[2]),s&8730&&(n.$$scope={dirty:s,ctx:i}),t.$set(n)},i(i){e||(st(t.$$.fragment,i),e=!0)},o(i){ut(t.$$.fragment,i),e=!1},d(i){ne(t,i)}}}const lh=r=>r.join(","),hh=r=>r.join(",");function Fm(r,t,e){let i,{shape:s}=t,{computedStyle:n}=t,{transform:o}=t,{viewportScale:a=1}=t;const l=(d,f,p)=>{let m;const _=d.geometry;f==="SHAPE"?m=_.points.map(([x,g])=>[x+p[0],g+p[1]]):m=_.points.map(([x,g],v)=>f===`HANDLE-${v}`?[x+p[0],g+p[1]]:[x,g]);const y=Ps(m);return{...d,geometry:{points:m,bounds:y}}};function h(d){qe.call(this,r,d)}function c(d){qe.call(this,r,d)}function u(d){qe.call(this,r,d)}return r.$$set=d=>{"shape"in d&&e(0,s=d.shape),"computedStyle"in d&&e(1,n=d.computedStyle),"transform"in d&&e(2,o=d.transform),"viewportScale"in d&&e(3,a=d.viewportScale)},r.$$.update=()=>{r.$$.dirty&1&&e(4,i=s.geometry)},[s,n,o,a,i,l,h,c,u]}class Lm extends de{constructor(t){super(),ue(this,t,Fm,Om,qt,{shape:0,computedStyle:1,transform:2,viewportScale:3})}}const wo=(r,t)=>{const e=Math.abs(t[0]-r[0]),i=Math.abs(t[1]-r[1]);return Math.sqrt(Math.pow(e,2)+Math.pow(i,2))},si=[];function Nm(r,t=At){let e;const i=new Set;function s(a){if(qt(r,a)&&(r=a,e)){const l=!si.length;for(const h of i)h[1](),si.push(h,r);if(l){for(let h=0;h<si.length;h+=2)si[h][0](si[h+1]);si.length=0}}}function n(a){s(a(r))}function o(a,l=At){const h=[a,l];return i.add(h),i.size===1&&(e=t(s,n)||At),a(r),()=>{i.delete(h),i.size===0&&e&&(e(),e=null)}}return{set:s,update:n,subscribe:o}}const Um=(r,t)=>{const{naturalWidth:e,naturalHeight:i}=r;if(!e&&!i){const{width:s,height:n}=r;t.setAttribute("viewBox",`0 0 ${s} ${n}`),r.addEventListener("load",o=>{const a=o.target;t.setAttribute("viewBox",`0 0 ${a.naturalWidth} ${a.naturalHeight}`)})}else t.setAttribute("viewBox",`0 0 ${e} ${i}`)},km=(r,t)=>{Um(r,t);const{subscribe:e,set:i}=Nm(1);let s;return window.ResizeObserver&&(s=new ResizeObserver(()=>{const n=t.getBoundingClientRect(),{width:o,height:a}=t.viewBox.baseVal,l=Math.max(n.width/o,n.height/a);i(l)}),s.observe(t.parentElement)),{destroy:()=>{s&&s.disconnect()},subscribe:e}},ch=typeof window>"u"||typeof navigator>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0;function Gm(r){let t,e,i,s,n,o;return{c(){t=gt("rect"),E(t,"class",e=Cs(`a9s-handle ${r[8].class||""}`.trim())+" svelte-1sgkh33"),E(t,"x",i=r[0]-r[5]/2),E(t,"y",s=r[1]-r[5]/2),E(t,"width",r[5]),E(t,"height",r[5])},m(a,l){rt(a,t,l),n||(o=Bt(t,"pointerdown",r[11]),n=!0)},p(a,l){l&256&&e!==(e=Cs(`a9s-handle ${a[8].class||""}`.trim())+" svelte-1sgkh33")&&E(t,"class",e),l&33&&i!==(i=a[0]-a[5]/2)&&E(t,"x",i),l&34&&s!==(s=a[1]-a[5]/2)&&E(t,"y",s),l&32&&E(t,"width",a[5]),l&32&&E(t,"height",a[5])},d(a){a&&et(t),n=!1,o()}}}function $m(r){let t,e,i,s,n,o,a,l,h;return{c(){t=gt("g"),e=gt("circle"),s=gt("rect"),E(e,"cx",r[0]),E(e,"cy",r[1]),E(e,"r",i=r[3]/r[2]),E(e,"class","a9s-touch-halo svelte-1sgkh33"),ur(e,"touched",r[4]),E(s,"class",n=Cs(`a9s-handle ${r[8].class||""}`.trim())+" svelte-1sgkh33"),E(s,"x",o=r[0]-r[5]/2),E(s,"y",a=r[1]-r[5]/2),E(s,"width",r[5]),E(s,"height",r[5]),E(t,"class","a9s-touch-handle")},m(c,u){rt(c,t,u),Me(t,e),Me(t,s),l||(h=[Bt(e,"pointerdown",r[10]),Bt(e,"pointerdown",r[6]),Bt(e,"pointerup",r[7]),Bt(s,"pointerdown",r[9]),Bt(s,"pointerdown",r[6]),Bt(s,"pointerup",r[7])],l=!0)},p(c,u){u&1&&E(e,"cx",c[0]),u&2&&E(e,"cy",c[1]),u&12&&i!==(i=c[3]/c[2])&&E(e,"r",i),u&16&&ur(e,"touched",c[4]),u&256&&n!==(n=Cs(`a9s-handle ${c[8].class||""}`.trim())+" svelte-1sgkh33")&&E(s,"class",n),u&33&&o!==(o=c[0]-c[5]/2)&&E(s,"x",o),u&34&&a!==(a=c[1]-c[5]/2)&&E(s,"y",a),u&32&&E(s,"width",c[5]),u&32&&E(s,"height",c[5])},d(c){c&&et(t),l=!1,Pe(h)}}}function Hm(r){let t;function e(s,n){return ch?$m:Gm}let i=e()(r);return{c(){i.c(),t=ye()},m(s,n){i.m(s,n),rt(s,t,n)},p(s,[n]){i.p(s,n)},i:At,o:At,d(s){s&&et(t),i.d(s)}}}function Xm(r,t,e){let i,{x:s}=t,{y:n}=t,{scale:o}=t,{radius:a=30}=t,l=!1;const h=p=>{p.pointerType==="touch"&&e(4,l=!0)},c=()=>e(4,l=!1);function u(p){qe.call(this,r,p)}function d(p){qe.call(this,r,p)}function f(p){qe.call(this,r,p)}return r.$$set=p=>{e(8,t=ao(ao({},t),zl(p))),"x"in p&&e(0,s=p.x),"y"in p&&e(1,n=p.y),"scale"in p&&e(2,o=p.scale),"radius"in p&&e(3,a=p.radius)},r.$$.update=()=>{r.$$.dirty&4&&e(5,i=10/o)},t=zl(t),[s,n,o,a,l,i,h,c,t,u,d,f]}class zi extends de{constructor(t){super(),ue(this,t,Xm,Hm,qt,{x:0,y:1,scale:2,radius:3})}}function Vm(r){let t,e,i,s,n,o,a,l,h,c,u,d,f,p,m,_,y,x,g,v,w,I,T,C,D,A,P,R,b,M,S,U,L,H,tt,F,k,J,X,K,$,at,vt;return H=new zi({props:{class:"a9s-corner-handle-topleft",x:r[4].x,y:r[4].y,scale:r[3]}}),H.$on("pointerdown",function(){Ut(r[9]("TOP_LEFT"))&&r[9]("TOP_LEFT").apply(this,arguments)}),F=new zi({props:{class:"a9s-corner-handle-topright",x:r[4].x+r[4].w,y:r[4].y,scale:r[3]}}),F.$on("pointerdown",function(){Ut(r[9]("TOP_RIGHT"))&&r[9]("TOP_RIGHT").apply(this,arguments)}),J=new zi({props:{class:"a9s-corner-handle-bottomright",x:r[4].x+r[4].w,y:r[4].y+r[4].h,scale:r[3]}}),J.$on("pointerdown",function(){Ut(r[9]("BOTTOM_RIGHT"))&&r[9]("BOTTOM_RIGHT").apply(this,arguments)}),K=new zi({props:{class:"a9s-corner-handle-bottomleft",x:r[4].x,y:r[4].y+r[4].h,scale:r[3]}}),K.$on("pointerdown",function(){Ut(r[9]("BOTTOM_LEFT"))&&r[9]("BOTTOM_LEFT").apply(this,arguments)}),{c(){t=gt("rect"),a=ge(),l=gt("rect"),f=ge(),p=gt("rect"),x=ge(),g=gt("rect"),T=ge(),C=gt("rect"),R=ge(),b=gt("rect"),L=ge(),ce(H.$$.fragment),tt=ge(),ce(F.$$.fragment),k=ge(),ce(J.$$.fragment),X=ge(),ce(K.$$.fragment),E(t,"class","a9s-outer"),E(t,"style",e=r[1]?"display:none;":void 0),E(t,"x",i=r[4].x),E(t,"y",s=r[4].y),E(t,"width",n=r[4].w),E(t,"height",o=r[4].h),E(l,"class","a9s-inner a9s-shape-handle"),E(l,"style",r[1]),E(l,"x",h=r[4].x),E(l,"y",c=r[4].y),E(l,"width",u=r[4].w),E(l,"height",d=r[4].h),E(p,"class","a9s-edge-handle a9s-edge-handle-top"),E(p,"x",m=r[4].x),E(p,"y",_=r[4].y),E(p,"height",1),E(p,"width",y=r[4].w),E(g,"class","a9s-edge-handle a9s-edge-handle-right"),E(g,"x",v=r[4].x+r[4].w),E(g,"y",w=r[4].y),E(g,"height",I=r[4].h),E(g,"width",1),E(C,"class","a9s-edge-handle a9s-edge-handle-bottom"),E(C,"x",D=r[4].x),E(C,"y",A=r[4].y+r[4].h),E(C,"height",1),E(C,"width",P=r[4].w),E(b,"class","a9s-edge-handle a9s-edge-handle-left"),E(b,"x",M=r[4].x),E(b,"y",S=r[4].y),E(b,"height",U=r[4].h),E(b,"width",1)},m(N,O){rt(N,t,O),rt(N,a,O),rt(N,l,O),rt(N,f,O),rt(N,p,O),rt(N,x,O),rt(N,g,O),rt(N,T,O),rt(N,C,O),rt(N,R,O),rt(N,b,O),rt(N,L,O),se(H,N,O),rt(N,tt,O),se(F,N,O),rt(N,k,O),se(J,N,O),rt(N,X,O),se(K,N,O),$=!0,at||(vt=[Bt(t,"pointerdown",function(){Ut(r[9]("SHAPE"))&&r[9]("SHAPE").apply(this,arguments)}),Bt(l,"pointerdown",function(){Ut(r[9]("SHAPE"))&&r[9]("SHAPE").apply(this,arguments)}),Bt(p,"pointerdown",function(){Ut(r[9]("TOP"))&&r[9]("TOP").apply(this,arguments)}),Bt(g,"pointerdown",function(){Ut(r[9]("RIGHT"))&&r[9]("RIGHT").apply(this,arguments)}),Bt(C,"pointerdown",function(){Ut(r[9]("BOTTOM"))&&r[9]("BOTTOM").apply(this,arguments)}),Bt(b,"pointerdown",function(){Ut(r[9]("LEFT"))&&r[9]("LEFT").apply(this,arguments)})],at=!0)},p(N,O){r=N,(!$||O&2&&e!==(e=r[1]?"display:none;":void 0))&&E(t,"style",e),(!$||O&16&&i!==(i=r[4].x))&&E(t,"x",i),(!$||O&16&&s!==(s=r[4].y))&&E(t,"y",s),(!$||O&16&&n!==(n=r[4].w))&&E(t,"width",n),(!$||O&16&&o!==(o=r[4].h))&&E(t,"height",o),(!$||O&2)&&E(l,"style",r[1]),(!$||O&16&&h!==(h=r[4].x))&&E(l,"x",h),(!$||O&16&&c!==(c=r[4].y))&&E(l,"y",c),(!$||O&16&&u!==(u=r[4].w))&&E(l,"width",u),(!$||O&16&&d!==(d=r[4].h))&&E(l,"height",d),(!$||O&16&&m!==(m=r[4].x))&&E(p,"x",m),(!$||O&16&&_!==(_=r[4].y))&&E(p,"y",_),(!$||O&16&&y!==(y=r[4].w))&&E(p,"width",y),(!$||O&16&&v!==(v=r[4].x+r[4].w))&&E(g,"x",v),(!$||O&16&&w!==(w=r[4].y))&&E(g,"y",w),(!$||O&16&&I!==(I=r[4].h))&&E(g,"height",I),(!$||O&16&&D!==(D=r[4].x))&&E(C,"x",D),(!$||O&16&&A!==(A=r[4].y+r[4].h))&&E(C,"y",A),(!$||O&16&&P!==(P=r[4].w))&&E(C,"width",P),(!$||O&16&&M!==(M=r[4].x))&&E(b,"x",M),(!$||O&16&&S!==(S=r[4].y))&&E(b,"y",S),(!$||O&16&&U!==(U=r[4].h))&&E(b,"height",U);const bt={};O&16&&(bt.x=r[4].x),O&16&&(bt.y=r[4].y),O&8&&(bt.scale=r[3]),H.$set(bt);const mt={};O&16&&(mt.x=r[4].x+r[4].w),O&16&&(mt.y=r[4].y),O&8&&(mt.scale=r[3]),F.$set(mt);const yt={};O&16&&(yt.x=r[4].x+r[4].w),O&16&&(yt.y=r[4].y+r[4].h),O&8&&(yt.scale=r[3]),J.$set(yt);const _t={};O&16&&(_t.x=r[4].x),O&16&&(_t.y=r[4].y+r[4].h),O&8&&(_t.scale=r[3]),K.$set(_t)},i(N){$||(st(H.$$.fragment,N),st(F.$$.fragment,N),st(J.$$.fragment,N),st(K.$$.fragment,N),$=!0)},o(N){ut(H.$$.fragment,N),ut(F.$$.fragment,N),ut(J.$$.fragment,N),ut(K.$$.fragment,N),$=!1},d(N){N&&(et(t),et(a),et(l),et(f),et(p),et(x),et(g),et(T),et(C),et(R),et(b),et(L),et(tt),et(k),et(X)),ne(H,N),ne(F,N),ne(J,N),ne(K,N),at=!1,Pe(vt)}}}function zm(r){let t,e;return t=new mh({props:{shape:r[0],transform:r[2],editor:r[5],$$slots:{default:[Vm,({grab:i})=>({9:i}),({grab:i})=>i?512:0]},$$scope:{ctx:r}}}),t.$on("grab",r[6]),t.$on("change",r[7]),t.$on("release",r[8]),{c(){ce(t.$$.fragment)},m(i,s){se(t,i,s),e=!0},p(i,[s]){const n={};s&1&&(n.shape=i[0]),s&4&&(n.transform=i[2]),s&1562&&(n.$$scope={dirty:s,ctx:i}),t.$set(n)},i(i){e||(st(t.$$.fragment,i),e=!0)},o(i){ut(t.$$.fragment,i),e=!1},d(i){ne(t,i)}}}function Wm(r,t,e){let i,{shape:s}=t,{computedStyle:n}=t,{transform:o}=t,{viewportScale:a=1}=t;const l=(d,f,p)=>{const m=d.geometry.bounds;let[_,y]=[m.minX,m.minY],[x,g]=[m.maxX,m.maxY];const[v,w]=p;if(f==="SHAPE")_+=v,x+=v,y+=w,g+=w;else{switch(f){case"TOP":case"TOP_LEFT":case"TOP_RIGHT":{y+=w;break}case"BOTTOM":case"BOTTOM_LEFT":case"BOTTOM_RIGHT":{g+=w;break}}switch(f){case"LEFT":case"TOP_LEFT":case"BOTTOM_LEFT":{_+=v;break}case"RIGHT":case"TOP_RIGHT":case"BOTTOM_RIGHT":{x+=v;break}}}const I=Math.min(_,x),T=Math.min(y,g),C=Math.abs(x-_),D=Math.abs(g-y);return{...d,geometry:{x:I,y:T,w:C,h:D,bounds:{minX:I,minY:T,maxX:I+C,maxY:T+D}}}};function h(d){qe.call(this,r,d)}function c(d){qe.call(this,r,d)}function u(d){qe.call(this,r,d)}return r.$$set=d=>{"shape"in d&&e(0,s=d.shape),"computedStyle"in d&&e(1,n=d.computedStyle),"transform"in d&&e(2,o=d.transform),"viewportScale"in d&&e(3,a=d.viewportScale)},r.$$.update=()=>{r.$$.dirty&1&&e(4,i=s.geometry)},[s,n,o,a,i,l,h,c,u]}class jm extends de{constructor(t){super(),ue(this,t,Wm,zm,qt,{shape:0,computedStyle:1,transform:2,viewportScale:3})}}const uh=new Map([[wt.RECTANGLE,jm],[wt.POLYGON,Lm]]),dh=r=>uh.get(r.type),fh=(r,t)=>uh.set(r,t),Ym=r=>({}),ph=r=>({grab:r[0]});function qm(r){let t,e,i,s;const n=r[7].default,o=wp(n,r,r[6],ph);return{c(){t=gt("g"),o&&o.c(),E(t,"class","a9s-annotation selected")},m(a,l){rt(a,t,l),o&&o.m(t,null),e=!0,i||(s=[Bt(t,"pointerup",r[2]),Bt(t,"pointermove",r[1])],i=!0)},p(a,[l]){o&&o.p&&(!e||l&64)&&Tp(o,n,a,a[6],e?Ep(n,a[6],l,Ym):Ap(a[6]),ph)},i(a){e||(st(o,a),e=!0)},o(a){ut(o,a),e=!1},d(a){a&&et(t),o&&o.d(a),i=!1,Pe(s)}}}function Km(r,t,e){let{$$slots:i={},$$scope:s}=t;const n=Jr();let{shape:o}=t,{editor:a}=t,{transform:l}=t,h,c,u;const d=m=>_=>{h=m,c=l.elementToImage(_.offsetX,_.offsetY),u=o,_.target.setPointerCapture(_.pointerId),n("grab",_)},f=m=>{if(h){const[_,y]=l.elementToImage(m.offsetX,m.offsetY),x=[_-c[0],y-c[1]];e(3,o=a(u,h,x)),n("change",o)}},p=m=>{m.target.releasePointerCapture(m.pointerId),h=void 0,u=o,n("release",m)};return r.$$set=m=>{"shape"in m&&e(3,o=m.shape),"editor"in m&&e(4,a=m.editor),"transform"in m&&e(5,l=m.transform),"$$scope"in m&&e(6,s=m.$$scope)},[d,f,p,o,a,l,s,i]}class mh extends de{constructor(t){super(),ue(this,t,Km,qm,qt,{shape:3,editor:4,transform:5})}}const Os=(r,t)=>{const e=typeof t=="function"?t(r):t;if(e){const{fill:i,fillOpacity:s,stroke:n,strokeWidth:o,strokeOpacity:a}=e;let l="";return i&&(l+=`fill:${i};`,l+=`fill-opacity:${s||"0.25"};`),n&&(l+=`stroke:${n};`,l+=`stroke-width:${o||"1"};`,l+=`stroke-opacity:${a||"1"};`),l}};function Zm(r,t,e){let i;const s=Jr();let{annotation:n}=t,{editor:o}=t,{style:a}=t,{target:l}=t,{transform:h}=t,{viewportScale:c}=t,u;return Vi(()=>(e(6,u=new o({target:l,props:{shape:n.target.selector,computedStyle:i,transform:h,viewportScale:c}})),u.$on("change",d=>{u.$$set({shape:d.detail}),s("change",d.detail)}),u.$on("grab",d=>s("grab",d.detail)),u.$on("release",d=>s("release",d.detail)),()=>{u.$destroy()})),r.$$set=d=>{"annotation"in d&&e(0,n=d.annotation),"editor"in d&&e(1,o=d.editor),"style"in d&&e(2,a=d.style),"target"in d&&e(3,l=d.target),"transform"in d&&e(4,h=d.transform),"viewportScale"in d&&e(5,c=d.viewportScale)},r.$$.update=()=>{r.$$.dirty&5&&(i=Os(n,a)),r.$$.dirty&65&&n&&(u==null||u.$set({shape:n.target.selector})),r.$$.dirty&80&&u&&u.$set({transform:h}),r.$$.dirty&96&&u&&u.$set({viewportScale:c})},[n,o,a,l,h,c,u]}class Jm extends de{constructor(t){super(),ue(this,t,Zm,null,qt,{annotation:0,editor:1,style:2,target:3,transform:4,viewportScale:5})}}function Qm(r,t,e){const i=Jr();let{drawingMode:s}=t,{target:n}=t,{tool:o}=t,{transform:a}=t,{viewportScale:l}=t,h;return Vi(()=>{const c=n.closest("svg"),u=[],d=(f,p,m)=>{c==null||c.addEventListener(f,p,m),u.push(()=>c==null?void 0:c.removeEventListener(f,p,m))};return e(5,h=new o({target:n,props:{addEventListener:d,drawingMode:s,transform:a,viewportScale:l}})),h.$on("create",f=>i("create",f.detail)),()=>{u.forEach(f=>f()),h.$destroy()}}),r.$$set=c=>{"drawingMode"in c&&e(0,s=c.drawingMode),"target"in c&&e(1,n=c.target),"tool"in c&&e(2,o=c.tool),"transform"in c&&e(3,a=c.transform),"viewportScale"in c&&e(4,l=c.viewportScale)},r.$$.update=()=>{r.$$.dirty&40&&h&&h.$set({transform:a}),r.$$.dirty&48&&h&&h.$set({viewportScale:l})},[s,n,o,a,l,h]}class tg extends de{constructor(t){super(),ue(this,t,Qm,null,qt,{drawingMode:0,target:1,tool:2,transform:3,viewportScale:4})}}function gh(r){let t,e;return{c(){t=gt("rect"),e=gt("rect"),E(t,"class","a9s-outer"),E(t,"x",r[1]),E(t,"y",r[2]),E(t,"width",r[3]),E(t,"height",r[4]),E(e,"class","a9s-inner"),E(e,"x",r[1]),E(e,"y",r[2]),E(e,"width",r[3]),E(e,"height",r[4])},m(i,s){rt(i,t,s),rt(i,e,s)},p(i,s){s&2&&E(t,"x",i[1]),s&4&&E(t,"y",i[2]),s&8&&E(t,"width",i[3]),s&16&&E(t,"height",i[4]),s&2&&E(e,"x",i[1]),s&4&&E(e,"y",i[2]),s&8&&E(e,"width",i[3]),s&16&&E(e,"height",i[4])},d(i){i&&(et(t),et(e))}}}function eg(r){let t,e=r[0]&&gh(r);return{c(){t=gt("g"),e&&e.c(),E(t,"class","a9s-annotation a9s-rubberband")},m(i,s){rt(i,t,s),e&&e.m(t,null)},p(i,[s]){i[0]?e?e.p(i,s):(e=gh(i),e.c(),e.m(t,null)):e&&(e.d(1),e=null)},i:At,o:At,d(i){i&&et(t),e&&e.d()}}}function rg(r,t,e){const i=Jr();let{addEventListener:s}=t,{drawingMode:n}=t,{transform:o}=t,a,l,h,c,u,d,f;const p=x=>{const g=x;a=performance.now(),n==="drag"&&(e(0,l=o.elementToImage(g.offsetX,g.offsetY)),h=l,e(1,c=l[0]),e(2,u=l[1]),e(3,d=1),e(4,f=1))},m=x=>{const g=x;l&&(h=o.elementToImage(g.offsetX,g.offsetY),e(1,c=Math.min(h[0],l[0])),e(2,u=Math.min(h[1],l[1])),e(3,d=Math.abs(h[0]-l[0])),e(4,f=Math.abs(h[1]-l[1])))},_=x=>{const g=x,v=performance.now()-a;if(n==="click"){if(v>300)return;l?y():(e(0,l=o.elementToImage(g.offsetX,g.offsetY)),h=l,e(1,c=l[0]),e(2,u=l[1]),e(3,d=1),e(4,f=1))}else l&&(v>300||d*f>100?(g.stopPropagation(),y()):(e(0,l=void 0),h=void 0))},y=()=>{if(d*f>15){const x={type:wt.RECTANGLE,geometry:{bounds:{minX:c,minY:u,maxX:c+d,maxY:u+f},x:c,y:u,w:d,h:f}};i("create",x)}e(0,l=void 0),h=void 0};return Vi(()=>{s("pointerdown",p),s("pointermove",m),s("pointerup",_,!0)}),r.$$set=x=>{"addEventListener"in x&&e(5,s=x.addEventListener),"drawingMode"in x&&e(6,n=x.drawingMode),"transform"in x&&e(7,o=x.transform)},[l,c,u,d,f,s,n,o]}class ig extends de{constructor(t){super(),ue(this,t,rg,eg,qt,{addEventListener:5,drawingMode:6,transform:7})}}function Eo(r){const t=r.slice(),e=(t[2]?t[0]:[...t[0],t[1]]).map(i=>i.join(",")).join(" ");return t[16]=e,t}function yh(r){let t,e,i,s,n,o=r[2]&&_h(r);return{c(){t=gt("polygon"),i=gt("polygon"),o&&o.c(),n=ye(),E(t,"class","a9s-outer"),E(t,"points",e=r[16]),E(i,"class","a9s-inner"),E(i,"points",s=r[16])},m(a,l){rt(a,t,l),rt(a,i,l),o&&o.m(a,l),rt(a,n,l)},p(a,l){l&7&&e!==(e=a[16])&&E(t,"points",e),l&7&&s!==(s=a[16])&&E(i,"points",s),a[2]?o?o.p(a,l):(o=_h(a),o.c(),o.m(n.parentNode,n)):o&&(o.d(1),o=null)},d(a){a&&(et(t),et(i),et(n)),o&&o.d(a)}}}function _h(r){let t,e,i;return{c(){t=gt("rect"),E(t,"class","a9s-corner-handle"),E(t,"x",e=r[0][0][0]-r[3]/2),E(t,"y",i=r[0][0][1]-r[3]/2),E(t,"height",r[3]),E(t,"width",r[3])},m(s,n){rt(s,t,n)},p(s,n){n&9&&e!==(e=s[0][0][0]-s[3]/2)&&E(t,"x",e),n&9&&i!==(i=s[0][0][1]-s[3]/2)&&E(t,"y",i),n&8&&E(t,"height",s[3]),n&8&&E(t,"width",s[3])},d(s){s&&et(t)}}}function sg(r){let t,e=r[1]&&yh(Eo(r));return{c(){t=gt("g"),e&&e.c(),E(t,"class","a9s-annotation a9s-rubberband")},m(i,s){rt(i,t,s),e&&e.m(t,null)},p(i,[s]){i[1]?e?e.p(Eo(i),s):(e=yh(Eo(i)),e.c(),e.m(t,null)):e&&(e.d(1),e=null)},i:At,o:At,d(i){i&&et(t),e&&e.d()}}}const ng=20,og=1500;function ag(r,t,e){let i;const s=Jr();let{addEventListener:n}=t,{drawingMode:o}=t,{transform:a}=t,{viewportScale:l=1}=t,h,c=[],u,d,f=!1;const p=g=>{const v=g,{timeStamp:w,offsetX:I,offsetY:T}=v;if(h={timeStamp:w,offsetX:I,offsetY:T},o==="drag"&&c.length===0){const C=a.elementToImage(v.offsetX,v.offsetY);c.push(C),e(1,u=C)}},m=g=>{const v=g;if(d&&clearTimeout(d),c.length>0){if(e(1,u=a.elementToImage(v.offsetX,v.offsetY)),c.length>2){const w=wo(u,c[0])*l;e(2,f=w<ng)}v.pointerType==="touch"&&(d=setTimeout(()=>{y()},og))}},_=g=>{const v=g;if(d&&clearTimeout(d),o==="click"){const w=v.timeStamp-h.timeStamp,I=wo([h.offsetX,h.offsetY],[v.offsetX,v.offsetY]);if(w>300||I>15)return;if(f)x();else if(c.length===0){const T=a.elementToImage(v.offsetX,v.offsetY);c.push(T),e(1,u=T)}else c.push(u)}else{if(c.length===1&&wo(c[0],u)<=4){e(0,c=[]),e(1,u=void 0);return}v.stopImmediatePropagation(),f?x():c.push(u)}},y=()=>{if(!u)return;const g=[...c,u],v={type:wt.POLYGON,geometry:{bounds:Ps(g),points:g}};go(v)>4&&(e(0,c=[]),e(1,u=void 0),s("create",v))},x=()=>{const g={type:wt.POLYGON,geometry:{bounds:Ps(c),points:[...c]}};e(0,c=[]),e(1,u=void 0),s("create",g)};return Vi(()=>{n("pointerdown",p,!0),n("pointermove",m),n("pointerup",_,!0),n("dblclick",y,!0)}),r.$$set=g=>{"addEventListener"in g&&e(4,n=g.addEventListener),"drawingMode"in g&&e(5,o=g.drawingMode),"transform"in g&&e(6,a=g.transform),"viewportScale"in g&&e(7,l=g.viewportScale)},r.$$.update=()=>{r.$$.dirty&128&&e(3,i=10/l)},[c,u,f,i,n,o,a,l]}class lg extends de{constructor(t){super(),ue(this,t,ag,sg,qt,{addEventListener:4,drawingMode:5,transform:6,viewportScale:7})}}const To=new Map([["rectangle",{tool:ig}],["polygon",{tool:lg}]]),Fs=()=>[...To.keys()],Ls=r=>To.get(r),vh=(r,t,e)=>To.set(r,{tool:t,opts:e});function hg(r){let t,e,i,s,n;return{c(){t=gt("g"),e=gt("ellipse"),s=gt("ellipse"),E(e,"class","a9s-outer"),E(e,"style",i=r[1]?"display:none;":void 0),E(e,"cx",r[2]),E(e,"cy",r[3]),E(e,"rx",r[4]),E(e,"ry",r[5]),E(s,"class","a9s-inner"),E(s,"style",r[1]),E(s,"cx",r[2]),E(s,"cy",r[3]),E(s,"rx",r[4]),E(s,"ry",r[5]),E(t,"class","a9s-annotation"),E(t,"data-id",n=r[0].id)},m(o,a){rt(o,t,a),Me(t,e),Me(t,s)},p(o,[a]){a&2&&i!==(i=o[1]?"display:none;":void 0)&&E(e,"style",i),a&2&&E(s,"style",o[1]),a&1&&n!==(n=o[0].id)&&E(t,"data-id",n)},i:At,o:At,d(o){o&&et(t)}}}function cg(r,t,e){let i,{annotation:s}=t,{geom:n}=t,{style:o}=t;const{cx:a,cy:l,rx:h,ry:c}=n;return r.$$set=u=>{"annotation"in u&&e(0,s=u.annotation),"geom"in u&&e(6,n=u.geom),"style"in u&&e(7,o=u.style)},r.$$.update=()=>{r.$$.dirty&129&&e(1,i=Os(s,o))},[s,i,a,l,h,c,n,o]}class ug extends de{constructor(t){super(),ue(this,t,cg,hg,qt,{annotation:0,geom:6,style:7})}}function dg(r){let t,e,i,s,n;return{c(){t=gt("g"),e=gt("polygon"),s=gt("polygon"),E(e,"class","a9s-outer"),E(e,"style",i=r[1]?"display:none;":void 0),E(e,"points",r[2].map(fg).join(" ")),E(s,"class","a9s-inner"),E(s,"style",r[1]),E(s,"points",r[2].map(pg).join(" ")),E(t,"class","a9s-annotation"),E(t,"data-id",n=r[0].id)},m(o,a){rt(o,t,a),Me(t,e),Me(t,s)},p(o,[a]){a&2&&i!==(i=o[1]?"display:none;":void 0)&&E(e,"style",i),a&2&&E(s,"style",o[1]),a&1&&n!==(n=o[0].id)&&E(t,"data-id",n)},i:At,o:At,d(o){o&&et(t)}}}const fg=r=>r.join(","),pg=r=>r.join(",");function mg(r,t,e){let i,{annotation:s}=t,{geom:n}=t,{style:o}=t;const{points:a}=n;return r.$$set=l=>{"annotation"in l&&e(0,s=l.annotation),"geom"in l&&e(3,n=l.geom),"style"in l&&e(4,o=l.style)},r.$$.update=()=>{r.$$.dirty&17&&e(1,i=Os(s,o))},[s,i,a,n,o]}class gg extends de{constructor(t){super(),ue(this,t,mg,dg,qt,{annotation:0,geom:3,style:4})}}function yg(r){let t,e,i,s,n;return{c(){t=gt("g"),e=gt("rect"),s=gt("rect"),E(e,"class","a9s-outer"),E(e,"style",i=r[5]?"display:none;":void 0),E(e,"x",r[4]),E(e,"y",r[3]),E(e,"width",r[2]),E(e,"height",r[1]),E(s,"class","a9s-inner"),E(s,"style",r[5]),E(s,"x",r[4]),E(s,"y",r[3]),E(s,"width",r[2]),E(s,"height",r[1]),E(t,"class","a9s-annotation"),E(t,"data-id",n=r[0].id)},m(o,a){rt(o,t,a),Me(t,e),Me(t,s)},p(o,[a]){a&32&&i!==(i=o[5]?"display:none;":void 0)&&E(e,"style",i),a&16&&E(e,"x",o[4]),a&8&&E(e,"y",o[3]),a&4&&E(e,"width",o[2]),a&2&&E(e,"height",o[1]),a&32&&E(s,"style",o[5]),a&16&&E(s,"x",o[4]),a&8&&E(s,"y",o[3]),a&4&&E(s,"width",o[2]),a&2&&E(s,"height",o[1]),a&1&&n!==(n=o[0].id)&&E(t,"data-id",n)},i:At,o:At,d(o){o&&et(t)}}}function _g(r,t,e){let i,s,n,o,a,{annotation:l}=t,{geom:h}=t,{style:c}=t;return r.$$set=u=>{"annotation"in u&&e(0,l=u.annotation),"geom"in u&&e(6,h=u.geom),"style"in u&&e(7,c=u.style)},r.$$.update=()=>{r.$$.dirty&129&&e(5,i=Os(l,c)),r.$$.dirty&64&&e(4,{x:s,y:n,w:o,h:a}=h,s,(e(3,n),e(6,h)),(e(2,o),e(6,h)),(e(1,a),e(6,h)))},[l,a,o,n,s,i,h,c]}class vg extends de{constructor(t){super(),ue(this,t,_g,yg,qt,{annotation:0,geom:6,style:7})}}const xg=r=>({elementToImage:(t,e)=>{const i=r.getBoundingClientRect(),s=r.createSVGPoint();s.x=t+i.x,s.y=e+i.y;const{x:n,y:o}=s.matrixTransform(r.getScreenCTM().inverse());return[n,o]}}),bg=250,wg=(r,t)=>{const e=Jr();let i;return{onPointerDown:()=>i=performance.now(),onPointerUp:s=>{if(performance.now()-i<bg){const{x:n,y:o}=xh(s,r),a=t.getAt(n,o);a?e("click",{originalEvent:s,annotation:a}):e("click",{originalEvent:s})}}}},xh=(r,t)=>{const e=t.createSVGPoint(),i=t.getBoundingClientRect(),s=r.clientX-i.x,n=r.clientY-i.y,{left:o,top:a}=t.getBoundingClientRect();return e.x=s+o,e.y=n+a,e.matrixTransform(t.getScreenCTM().inverse())},{Boolean:bh}=Sp;function wh(r,t,e){const i=r.slice();i[34]=t[e];const s=i[23](i[34].target.selector);return i[35]=s,i}function Eh(r,t,e){const i=r.slice();return i[38]=t[e],i}function Ao(r){const t=r.slice(),e=t[38].target.selector;return t[41]=e,t}function Th(r){let t=r[38].id,e,i,s=Ah(r);return{c(){s.c(),e=ye()},m(n,o){s.m(n,o),rt(n,e,o),i=!0},p(n,o){o[0]&32768&&qt(t,t=n[38].id)?(_e(),ut(s,1,1,At),ve(),s=Ah(n),s.c(),st(s,1),s.m(e.parentNode,e)):s.p(n,o)},i(n){i||(st(s),i=!0)},o(n){ut(s),i=!1},d(n){n&&et(e),s.d(n)}}}function Eg(r){let t,e;return t=new gg({props:{annotation:r[38],geom:r[41].geometry,style:r[1]}}),{c(){ce(t.$$.fragment)},m(i,s){se(t,i,s),e=!0},p(i,s){const n={};s[0]&32768&&(n.annotation=i[38]),s[0]&32768&&(n.geom=i[41].geometry),s[0]&2&&(n.style=i[1]),t.$set(n)},i(i){e||(st(t.$$.fragment,i),e=!0)},o(i){ut(t.$$.fragment,i),e=!1},d(i){ne(t,i)}}}function Tg(r){let t,e;return t=new vg({props:{annotation:r[38],geom:r[41].geometry,style:r[1]}}),{c(){ce(t.$$.fragment)},m(i,s){se(t,i,s),e=!0},p(i,s){const n={};s[0]&32768&&(n.annotation=i[38]),s[0]&32768&&(n.geom=i[41].geometry),s[0]&2&&(n.style=i[1]),t.$set(n)},i(i){e||(st(t.$$.fragment,i),e=!0)},o(i){ut(t.$$.fragment,i),e=!1},d(i){ne(t,i)}}}function Ag(r){var t;let e,i;return e=new ug({props:{annotation:r[38],geom:(t=r[41])==null?void 0:t.geometry,style:r[1]}}),{c(){ce(e.$$.fragment)},m(s,n){se(e,s,n),i=!0},p(s,n){var o;const a={};n[0]&32768&&(a.annotation=s[38]),n[0]&32768&&(a.geom=(o=s[41])==null?void 0:o.geometry),n[0]&2&&(a.style=s[1]),e.$set(a)},i(s){i||(st(e.$$.fragment,s),i=!0)},o(s){ut(e.$$.fragment,s),i=!1},d(s){ne(e,s)}}}function Ah(r){let t,e,i,s;const n=[Ag,Tg,Eg],o=[];function a(l,h){var c,u,d;return((c=l[41])==null?void 0:c.type)===wt.ELLIPSE?0:((u=l[41])==null?void 0:u.type)===wt.RECTANGLE?1:((d=l[41])==null?void 0:d.type)===wt.POLYGON?2:-1}return~(t=a(r))&&(e=o[t]=n[t](r)),{c(){e&&e.c(),i=ye()},m(l,h){~t&&o[t].m(l,h),rt(l,i,h),s=!0},p(l,h){let c=t;t=a(l),t===c?~t&&o[t].p(l,h):(e&&(_e(),ut(o[c],1,1,()=>{o[c]=null}),ve()),~t?(e=o[t],e?e.p(l,h):(e=o[t]=n[t](l),e.c()),st(e,1),e.m(i.parentNode,i)):e=null)},i(l){s||(st(e),s=!0)},o(l){ut(e),s=!1},d(l){l&&et(i),~t&&o[t].d(l)}}}function Sh(r){let t=!r[8](r[38]),e,i,s=t&&Th(Ao(r));return{c(){s&&s.c(),e=ye()},m(n,o){s&&s.m(n,o),rt(n,e,o),i=!0},p(n,o){o[0]&33024&&(t=!n[8](n[38])),t?s?(s.p(Ao(n),o),o[0]&33024&&st(s,1)):(s=Th(Ao(n)),s.c(),st(s,1),s.m(e.parentNode,e)):s&&(_e(),ut(s,1,1,()=>{s=null}),ve())},i(n){i||(st(s),i=!0)},o(n){ut(s),i=!1},d(n){n&&et(e),s&&s.d(n)}}}function Ch(r){let t,e,i,s;const n=[Cg,Sg],o=[];function a(l,h){return l[7]?0:l[13]&&l[0]?1:-1}return~(t=a(r))&&(e=o[t]=n[t](r)),{c(){e&&e.c(),i=ye()},m(l,h){~t&&o[t].m(l,h),rt(l,i,h),s=!0},p(l,h){let c=t;t=a(l),t===c?~t&&o[t].p(l,h):(e&&(_e(),ut(o[c],1,1,()=>{o[c]=null}),ve()),~t?(e=o[t],e?e.p(l,h):(e=o[t]=n[t](l),e.c()),st(e,1),e.m(i.parentNode,i)):e=null)},i(l){s||(st(e),s=!0)},o(l){ut(e),s=!1},d(l){l&&et(i),~t&&o[t].d(l)}}}function Sg(r){let t=r[2],e,i,s=Ih(r);return{c(){s.c(),e=ye()},m(n,o){s.m(n,o),rt(n,e,o),i=!0},p(n,o){o[0]&4&&qt(t,t=n[2])?(_e(),ut(s,1,1,At),ve(),s=Ih(n),s.c(),st(s,1),s.m(e.parentNode,e)):s.p(n,o)},i(n){i||(st(s),i=!0)},o(n){ut(s),i=!1},d(n){n&&et(e),s.d(n)}}}function Cg(r){let t,e,i=ri(r[7]),s=[];for(let o=0;o<i.length;o+=1)s[o]=Mh(wh(r,i,o));const n=o=>ut(s[o],1,1,()=>{s[o]=null});return{c(){for(let o=0;o<s.length;o+=1)s[o].c();t=ye()},m(o,a){for(let l=0;l<s.length;l+=1)s[l]&&s[l].m(o,a);rt(o,t,a),e=!0},p(o,a){if(a[0]&10553506){i=ri(o[7]);let l;for(l=0;l<i.length;l+=1){const h=wh(o,i,l);s[l]?(s[l].p(h,a),st(s[l],1)):(s[l]=Mh(h),s[l].c(),st(s[l],1),s[l].m(t.parentNode,t))}for(_e(),l=i.length;l<s.length;l+=1)n(l);ve()}},i(o){if(!e){for(let a=0;a<i.length;a+=1)st(s[a]);e=!0}},o(o){s=s.filter(bh);for(let a=0;a<s.length;a+=1)ut(s[a]);e=!1},d(o){o&&et(t),ho(s,o)}}}function Ih(r){let t,e;return t=new tg({props:{target:r[5],tool:r[13],drawingMode:r[12],transform:r[11],viewportScale:r[16]}}),t.$on("create",r[20]),{c(){ce(t.$$.fragment)},m(i,s){se(t,i,s),e=!0},p(i,s){const n={};s[0]&32&&(n.target=i[5]),s[0]&8192&&(n.tool=i[13]),s[0]&4096&&(n.drawingMode=i[12]),s[0]&2048&&(n.transform=i[11]),s[0]&65536&&(n.viewportScale=i[16]),t.$set(n)},i(i){e||(st(t.$$.fragment,i),e=!0)},o(i){ut(t.$$.fragment,i),e=!1},d(i){ne(t,i)}}}function Rh(r){let t=r[34].id,e,i,s=Ph(r);return{c(){s.c(),e=ye()},m(n,o){s.m(n,o),rt(n,e,o),i=!0},p(n,o){o[0]&128&&qt(t,t=n[34].id)?(_e(),ut(s,1,1,At),ve(),s=Ph(n),s.c(),st(s,1),s.m(e.parentNode,e)):s.p(n,o)},i(n){i||(st(s),i=!0)},o(n){ut(s),i=!1},d(n){n&&et(e),s.d(n)}}}function Ph(r){let t,e;return t=new Jm({props:{target:r[5],editor:r[23](r[34].target.selector),annotation:r[34],style:r[1],transform:r[11],viewportScale:r[16]}}),t.$on("change",function(){Ut(r[21](r[34]))&&r[21](r[34]).apply(this,arguments)}),{c(){ce(t.$$.fragment)},m(i,s){se(t,i,s),e=!0},p(i,s){r=i;const n={};s[0]&32&&(n.target=r[5]),s[0]&128&&(n.editor=r[23](r[34].target.selector)),s[0]&128&&(n.annotation=r[34]),s[0]&2&&(n.style=r[1]),s[0]&2048&&(n.transform=r[11]),s[0]&65536&&(n.viewportScale=r[16]),t.$set(n)},i(i){e||(st(t.$$.fragment,i),e=!0)},o(i){ut(t.$$.fragment,i),e=!1},d(i){ne(t,i)}}}function Mh(r){let t,e,i=r[35]&&Rh(r);return{c(){i&&i.c(),t=ye()},m(s,n){i&&i.m(s,n),rt(s,t,n),e=!0},p(s,n){s[35]?i?(i.p(s,n),n[0]&128&&st(i,1)):(i=Rh(s),i.c(),st(i,1),i.m(t.parentNode,t)):i&&(_e(),ut(i,1,1,()=>{i=null}),ve())},i(s){e||(st(i),e=!0)},o(s){ut(i),e=!1},d(s){s&&et(t),i&&i.d(s)}}}function Ig(r){let t,e,i,s,n,o,a=ri(r[15]),l=[];for(let u=0;u<a.length;u+=1)l[u]=Sh(Eh(r,a,u));const h=u=>ut(l[u],1,1,()=>{l[u]=null});let c=r[5]&&Ch(r);return{c(){t=gt("svg"),e=gt("g");for(let u=0;u<l.length;u+=1)l[u].c();i=gt("g"),c&&c.c(),E(i,"class","drawing"),E(t,"class","a9s-annotationlayer"),ur(t,"drawing",r[13]),ur(t,"hidden",!r[3]),ur(t,"hover",r[14])},m(u,d){rt(u,t,d),Me(t,e);for(let f=0;f<l.length;f+=1)l[f]&&l[f].m(e,null);Me(t,i),c&&c.m(i,null),r[30](i),r[31](t),s=!0,n||(o=[Bt(t,"pointerup",function(){Ut(r[9])&&r[9].apply(this,arguments)}),Bt(t,"pointerdown",function(){Ut(r[10])&&r[10].apply(this,arguments)}),Bt(t,"pointermove",r[22])],n=!0)},p(u,d){if(r=u,d[0]&33026){a=ri(r[15]);let f;for(f=0;f<a.length;f+=1){const p=Eh(r,a,f);l[f]?(l[f].p(p,d),st(l[f],1)):(l[f]=Sh(p),l[f].c(),st(l[f],1),l[f].m(e,null))}for(_e(),f=a.length;f<l.length;f+=1)h(f);ve()}r[5]?c?(c.p(r,d),d[0]&32&&st(c,1)):(c=Ch(r),c.c(),st(c,1),c.m(i,null)):c&&(_e(),ut(c,1,1,()=>{c=null}),ve()),(!s||d[0]&8192)&&ur(t,"drawing",r[13]),(!s||d[0]&8)&&ur(t,"hidden",!r[3]),(!s||d[0]&16384)&&ur(t,"hover",r[14])},i(u){if(!s){for(let d=0;d<a.length;d+=1)st(l[d]);st(c),s=!0}},o(u){l=l.filter(bh);for(let d=0;d<l.length;d+=1)ut(l[d]);ut(c),s=!1},d(u){u&&et(t),ho(l,u),c&&c.d(),r[30](null),r[31](null),n=!1,Pe(o)}}}function Rg(r,t,e){let i,s,n,o,a,l,h,c,u,d,f,p=At,m=()=>(p(),p=Xl(A,X=>e(16,f=X)),A);r.$$.on_destroy.push(()=>p());let{drawingEnabled:_}=t,{image:y}=t,{preferredDrawingMode:x}=t,{state:g}=t,{style:v=void 0}=t,{toolName:w=Fs()[0]}=t,{user:I}=t,{visible:T=!0}=t,C,D,A;Vi(()=>m(e(6,A=km(y,D))));const{hover:P,selection:R,store:b}=g;lo(r,P,X=>e(14,c=X)),lo(r,R,X=>e(29,u=X)),lo(r,b,X=>e(15,d=X));let M,S;const U=X=>{M&&b.unobserve(M);const K=X.filter(({editable:$})=>$).map(({id:$})=>$);K.length>0?(e(7,S=K.map($=>b.getAnnotation($)).filter(Boolean)),M=$=>{const{updated:at}=$.changes;e(7,S=at==null?void 0:at.map(vt=>vt.newValue))},b.observe(M,{annotations:K})):e(7,S=void 0)},L=X=>{const K=Ql(),$={id:K,bodies:[],target:{annotation:K,selector:X.detail,creator:I,created:new Date}};b.addAnnotation($),R.setSelected($.id)},H=X=>K=>{var $;const{target:at}=X,vt=10*60*1e3,N=(($=at.creator)==null?void 0:$.id)!==I.id||!at.created||new Date().getTime()-at.created.getTime()>vt;b.updateTarget({...at,selector:K.detail,created:N?at.created:new Date,updated:N?new Date:void 0,updatedBy:N?I:void 0})},tt=X=>{const{x:K,y:$}=xh(X,D),at=b.getAt(K,$);at?c!==at.id&&P.set(at.id):P.set(void 0)},F=X=>dh(X);function k(X){Is[X?"unshift":"push"](()=>{C=X,e(5,C)})}function J(X){Is[X?"unshift":"push"](()=>{D=X,e(4,D)})}return r.$$set=X=>{"drawingEnabled"in X&&e(0,_=X.drawingEnabled),"image"in X&&e(24,y=X.image),"preferredDrawingMode"in X&&e(25,x=X.preferredDrawingMode),"state"in X&&e(26,g=X.state),"style"in X&&e(1,v=X.style),"toolName"in X&&e(2,w=X.toolName),"user"in X&&e(27,I=X.user),"visible"in X&&e(3,T=X.visible)},r.$$.update=()=>{r.$$.dirty[0]&4&&e(13,{tool:i,opts:s}=Ls(w)||{tool:void 0,opts:void 0},i,(e(28,s),e(2,w))),r.$$.dirty[0]&301989888&&e(12,n=(s==null?void 0:s.drawingMode)||x),r.$$.dirty[0]&16&&e(11,o=xg(D)),r.$$.dirty[0]&16&&e(10,{onPointerDown:a,onPointerUp:l}=wg(D,b),a,(e(9,l),e(4,D))),r.$$.dirty[0]&536870912&&e(8,h=X=>u.selected.find(K=>K.id===X.id&&K.editable)),r.$$.dirty[0]&536870912&&U(u.selected)},[_,v,w,T,D,C,A,S,h,l,a,o,n,i,c,d,f,P,R,b,L,H,tt,F,y,x,g,I,s,u,k,J]}class Pg extends de{constructor(t){super(),ue(this,t,Rg,Ig,qt,{drawingEnabled:0,image:24,preferredDrawingMode:25,state:26,style:1,toolName:2,user:27,visible:3},null,[-1,-1])}}function Bh(r,t,e=0,i=r.length-1,s=Mg){for(;i>e;){if(i-e>600){const l=i-e+1,h=t-e+1,c=Math.log(l),u=.5*Math.exp(2*c/3),d=.5*Math.sqrt(c*u*(l-u)/l)*(h-l/2<0?-1:1),f=Math.max(e,Math.floor(t-h*u/l+d)),p=Math.min(i,Math.floor(t+(l-h)*u/l+d));Bh(r,t,f,p,s)}const n=r[t];let o=e,a=i;for(Wi(r,e,t),s(r[i],n)>0&&Wi(r,e,i);o<a;){for(Wi(r,o,a),o++,a--;s(r[o],n)<0;)o++;for(;s(r[a],n)>0;)a--}s(r[e],n)===0?Wi(r,e,a):(a++,Wi(r,a,i)),a<=t&&(e=a+1),t<=a&&(i=a-1)}}function Wi(r,t,e){const i=r[t];r[t]=r[e],r[e]=i}function Mg(r,t){return r<t?-1:r>t?1:0}class Bg{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const i=[];if(!Us(t,e))return i;const s=this.toBBox,n=[];for(;e;){for(let o=0;o<e.children.length;o++){const a=e.children[o],l=e.leaf?s(a):a;Us(t,l)&&(e.leaf?i.push(a):Co(t,l)?this._all(a,i):n.push(a))}e=n.pop()}return i}collides(t){let e=this.data;if(!Us(t,e))return!1;const i=[];for(;e;){for(let s=0;s<e.children.length;s++){const n=e.children[s],o=e.leaf?this.toBBox(n):n;if(Us(t,o)){if(e.leaf||Co(t,o))return!0;i.push(n)}}e=i.pop()}return!1}load(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(let i=0;i<t.length;i++)this.insert(t[i]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length)this.data=e;else if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){const i=this.data;this.data=e,e=i}this._insert(e,this.data.height-e.height-1,!0)}return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=oi([]),this}remove(t,e){if(!t)return this;let i=this.data;const s=this.toBBox(t),n=[],o=[];let a,l,h;for(;i||n.length;){if(i||(i=n.pop(),l=n[n.length-1],a=o.pop(),h=!0),i.leaf){const c=Dg(t,i.children,e);if(c!==-1)return i.children.splice(c,1),n.push(i),this._condense(n),this}!h&&!i.leaf&&Co(i,s)?(n.push(i),o.push(a),a=0,l=i,i=i.children[0]):l?(a++,i=l.children[a],h=!1):i=null}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const i=[];for(;t;)t.leaf?e.push(...t.children):i.push(...t.children),t=i.pop();return e}_build(t,e,i,s){const n=i-e+1;let o=this._maxEntries,a;if(n<=o)return a=oi(t.slice(e,i+1)),ni(a,this.toBBox),a;s||(s=Math.ceil(Math.log(n)/Math.log(o)),o=Math.ceil(n/Math.pow(o,s-1))),a=oi([]),a.leaf=!1,a.height=s;const l=Math.ceil(n/o),h=l*Math.ceil(Math.sqrt(o));Dh(t,e,i,h,this.compareMinX);for(let c=e;c<=i;c+=h){const u=Math.min(c+h-1,i);Dh(t,c,u,l,this.compareMinY);for(let d=c;d<=u;d+=l){const f=Math.min(d+l-1,u);a.children.push(this._build(t,d,f,s-1))}}return ni(a,this.toBBox),a}_chooseSubtree(t,e,i,s){for(;s.push(e),!(e.leaf||s.length-1===i);){let n=1/0,o=1/0,a;for(let l=0;l<e.children.length;l++){const h=e.children[l],c=So(h),u=Lg(t,h)-c;u<o?(o=u,n=c<n?c:n,a=h):u===o&&c<n&&(n=c,a=h)}e=a||e.children[0]}return e}_insert(t,e,i){const s=i?t:this.toBBox(t),n=[],o=this._chooseSubtree(s,this.data,e,n);for(o.children.push(t),Yi(o,s);e>=0&&n[e].children.length>this._maxEntries;)this._split(n,e),e--;this._adjustParentBBoxes(s,n,e)}_split(t,e){const i=t[e],s=i.children.length,n=this._minEntries;this._chooseSplitAxis(i,n,s);const o=this._chooseSplitIndex(i,n,s),a=oi(i.children.splice(o,i.children.length-o));a.height=i.height,a.leaf=i.leaf,ni(i,this.toBBox),ni(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(i,a)}_splitRoot(t,e){this.data=oi([t,e]),this.data.height=t.height+1,this.data.leaf=!1,ni(this.data,this.toBBox)}_chooseSplitIndex(t,e,i){let s,n=1/0,o=1/0;for(let a=e;a<=i-e;a++){const l=ji(t,0,a,this.toBBox),h=ji(t,a,i,this.toBBox),c=Ng(l,h),u=So(l)+So(h);c<n?(n=c,s=a,o=u<o?u:o):c===n&&u<o&&(o=u,s=a)}return s||i-e}_chooseSplitAxis(t,e,i){const s=t.leaf?this.compareMinX:Og,n=t.leaf?this.compareMinY:Fg,o=this._allDistMargin(t,e,i,s),a=this._allDistMargin(t,e,i,n);o<a&&t.children.sort(s)}_allDistMargin(t,e,i,s){t.children.sort(s);const n=this.toBBox,o=ji(t,0,e,n),a=ji(t,i-e,i,n);let l=Ns(o)+Ns(a);for(let h=e;h<i-e;h++){const c=t.children[h];Yi(o,t.leaf?n(c):c),l+=Ns(o)}for(let h=i-e-1;h>=e;h--){const c=t.children[h];Yi(a,t.leaf?n(c):c),l+=Ns(a)}return l}_adjustParentBBoxes(t,e,i){for(let s=i;s>=0;s--)Yi(e[s],t)}_condense(t){for(let e=t.length-1,i;e>=0;e--)t[e].children.length===0?e>0?(i=t[e-1].children,i.splice(i.indexOf(t[e]),1)):this.clear():ni(t[e],this.toBBox)}}function Dg(r,t,e){if(!e)return t.indexOf(r);for(let i=0;i<t.length;i++)if(e(r,t[i]))return i;return-1}function ni(r,t){ji(r,0,r.children.length,t,r)}function ji(r,t,e,i,s){s||(s=oi(null)),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(let n=t;n<e;n++){const o=r.children[n];Yi(s,r.leaf?i(o):o)}return s}function Yi(r,t){return r.minX=Math.min(r.minX,t.minX),r.minY=Math.min(r.minY,t.minY),r.maxX=Math.max(r.maxX,t.maxX),r.maxY=Math.max(r.maxY,t.maxY),r}function Og(r,t){return r.minX-t.minX}function Fg(r,t){return r.minY-t.minY}function So(r){return(r.maxX-r.minX)*(r.maxY-r.minY)}function Ns(r){return r.maxX-r.minX+(r.maxY-r.minY)}function Lg(r,t){return(Math.max(t.maxX,r.maxX)-Math.min(t.minX,r.minX))*(Math.max(t.maxY,r.maxY)-Math.min(t.minY,r.minY))}function Ng(r,t){const e=Math.max(r.minX,t.minX),i=Math.max(r.minY,t.minY),s=Math.min(r.maxX,t.maxX),n=Math.min(r.maxY,t.maxY);return Math.max(0,s-e)*Math.max(0,n-i)}function Co(r,t){return r.minX<=t.minX&&r.minY<=t.minY&&t.maxX<=r.maxX&&t.maxY<=r.maxY}function Us(r,t){return t.minX<=r.maxX&&t.minY<=r.maxY&&t.maxX>=r.minX&&t.maxY>=r.minY}function oi(r){return{children:r,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Dh(r,t,e,i,s){const n=[t,e];for(;n.length;){if(e=n.pop(),t=n.pop(),e-t<=i)continue;const o=t+Math.ceil((e-t)/i/2)*i;Bh(r,o,t,e,s),n.push(t,o,o,e)}}const Ug=()=>{const r=new Bg,t=new Map,e=()=>[...t.values()],i=()=>{r.clear(),t.clear()},s=o=>{const{minX:a,minY:l,maxX:h,maxY:c}=o.selector.geometry.bounds,u={minX:a,minY:l,maxX:h,maxY:c,target:o};r.insert(u),t.set(o.annotation,u)},n=o=>{const a=t.get(o.annotation);a&&r.remove(a),t.delete(o.annotation)};return{all:e,clear:i,getAt:(o,a)=>{const l=r.search({minX:o,minY:a,maxX:o,maxY:a}).map(h=>h.target).filter(h=>h.selector.type===wt.RECTANGLE||Fp(h.selector,o,a));if(l.length>0)return l.sort((h,c)=>go(h.selector)-go(c.selector)),l[0]},getIntersecting:(o,a,l,h)=>r.search({minX:o,minY:a,maxX:o+l,maxY:a+h}).map(c=>c.target),insert:s,remove:n,set:(o,a=!0)=>{a&&i();const l=o.reduce((h,c)=>{var u,d;if((d=(u=c.selector)==null?void 0:u.geometry)!=null&&d.bounds){const{minX:f,minY:p,maxX:m,maxY:_}=c.selector.geometry.bounds;return[...h,{minX:f,minY:p,maxX:m,maxY:_,target:c}]}else return h},[]);l.forEach(h=>t.set(h.target.annotation,h)),r.load(l)},size:()=>r.all().length,update:(o,a)=>{n(o),s(a)}}},Oh=r=>{const t=dm(),e=Ug(),i=Qp(t);i.setUserSelectAction(r.userSelectAction);const s=Jp(t),n=ym();return t.observe(({changes:o})=>{e.set((o.created||[]).map(a=>a.target),!1),(o.deleted||[]).forEach(a=>e.remove(a.target)),(o.updated||[]).forEach(({oldValue:a,newValue:l})=>e.update(a.target,l.target))}),{store:{...t,getAt:(o,a)=>{const l=e.getAt(o,a);return l?t.getAnnotation(l.annotation):void 0},getIntersecting:(o,a,l,h)=>e.getIntersecting(o,a,l,h).map(c=>t.getAnnotation(c.annotation))},selection:i,hover:s,viewport:n}},kg=r=>{const t=Oh(r);return{...t,store:fm(t.store)}},Gg=r=>{let t,e;if(r.nodeName==="CANVAS")t=r,e=t.getContext("2d",{willReadFrequently:!0});else{const s=r;t=document.createElement("canvas"),t.width=s.width,t.height=s.height,e=t.getContext("2d",{willReadFrequently:!0}),e.drawImage(s,0,0,s.width,s.height)}let i=0;for(let s=1;s<10;s++)for(let n=1;n<10;n++){const o=Math.round(n*t.width/10),a=Math.round(s*t.height/10),l=e.getImageData(o,a,1,1).data,h=(.299*l[0]+.587*l[1]+.114*l[2])/255;i+=h}return i/81},Fh=r=>{const t=Gg(r),e=t>.6?"dark":"light";return console.log(`[Annotorious] Image brightness: ${t.toFixed(1)}. Setting ${e} theme.`),e},Lh=(r,t,e)=>t.setAttribute("data-theme",e==="auto"?Fh(r):e),Nh=(r,t)=>({...r,drawingEnabled:r.drawingEnabled===void 0?t.drawingEnabled:r.drawingEnabled,drawingMode:r.drawingMode||t.drawingMode,userSelectAction:r.userSelectAction||t.userSelectAction,theme:r.theme||t.theme}),Uh=typeof navigator>"u"?!1:navigator.userAgent.indexOf("Mac OS X")!==-1,kh=(r,t)=>{const e=t||document,i=o=>{const a=o;a.key==="z"&&a.ctrlKey?r.undo():a.key==="y"&&a.ctrlKey&&r.redo()},s=o=>{const a=o;a.key==="z"&&a.metaKey&&(a.shiftKey?r.redo():r.undo())},n=()=>{Uh?e.removeEventListener("keydown",s):e.removeEventListener("keydown",i)};return Uh?e.addEventListener("keydown",s):e.addEventListener("keydown",i),{destroy:n}},$g=(r,t={})=>{if(!r)throw"Missing argument: image";const e=typeof r=="string"?document.getElementById(r):r,i=Nh(t,{drawingEnabled:!0,drawingMode:"drag",userSelectAction:eh.EDIT,theme:"light"}),s=kg(i),{selection:n,store:o}=s,a=gm(o),l=_m(s,a,i.adapter,i.autoSave),h=document.createElement("DIV");h.style.position="relative",h.style.display="inline-block",e.style.display="block",e.parentNode.insertBefore(h,e),h.appendChild(e);const c=kh(a);let u=Sm();Lh(e,h,i.theme);const d=new Pg({target:h,props:{drawingEnabled:!!i.drawingEnabled,image:e,preferredDrawingMode:i.drawingMode,state:s,style:i.style,user:u}});d.$on("click",D=>{const{originalEvent:A,annotation:P}=D.detail;P?n.userSelect(P.id,A):n.isEmpty()||n.clear()});const f=xm(s,a,i.adapter),p=()=>{d.$destroy(),h.parentNode.insertBefore(e,h),h.parentNode.removeChild(h),c.destroy(),a.destroy()},m=()=>u,_=(D,A,P)=>vh(D,A,P),y=(D,A)=>fh(D,A),x=D=>{if(!Ls(D))throw`No drawing tool named ${D}`;d.$set({toolName:D})},g=D=>d.$set({drawingEnabled:D}),v=D=>{console.warn("Filter not implemented yet")},w=D=>d.$set({style:D}),I=D=>Lh(e,h,D),T=D=>{u=D,d.$set({user:D})},C=D=>d.$set({visible:D});return{...f,destroy:p,getUser:m,listDrawingTools:Fs,on:l.on,off:l.off,registerDrawingTool:_,registerShapeEditor:y,setDrawingEnabled:g,setDrawingTool:x,setFilter:v,setStyle:w,setTheme:I,setUser:T,setVisible:C,element:h,state:s}};function Be(){}function Io(r,t){for(const e in t)r[e]=t[e];return r}function Gh(r){return r()}function $h(){return Object.create(null)}function Ke(r){r.forEach(Gh)}function Kt(r){return typeof r=="function"}function te(r,t){return r!=r?t==t:r!==t||r&&typeof r=="object"||typeof r=="function"}function Hg(r){return Object.keys(r).length===0}function Xg(r,...t){if(r==null){for(const i of t)i(void 0);return Be}const e=r.subscribe(...t);return e.unsubscribe?()=>e.unsubscribe():e}function Ro(r,t,e){r.$$.on_destroy.push(Xg(t,e))}function Hh(r,t,e,i){if(r){const s=Xh(r,t,e,i);return r[0](s)}}function Xh(r,t,e,i){return r[1]&&i?Io(e.ctx.slice(),r[1](i(t))):e.ctx}function Vh(r,t,e,i){if(r[2]&&i){const s=r[2](i(e));if(t.dirty===void 0)return s;if(typeof s=="object"){const n=[],o=Math.max(t.dirty.length,s.length);for(let a=0;a<o;a+=1)n[a]=t.dirty[a]|s[a];return n}return t.dirty|s}return t.dirty}function zh(r,t,e,i,s,n){if(s){const o=Xh(t,e,i,n);r.p(o,s)}}function Wh(r){if(r.ctx.length>32){const t=[],e=r.ctx.length/32;for(let i=0;i<e;i++)t[i]=-1;return t}return-1}function jh(r){const t={};for(const e in r)e[0]!=="$"&&(t[e]=r[e]);return t}function ks(r){return r??""}const Vg=typeof window<"u"?window:typeof globalThis<"u"?globalThis:global;function Ze(r,t){r.appendChild(t)}function dt(r,t,e){r.insertBefore(t,e||null)}function ht(r){r.parentNode&&r.parentNode.removeChild(r)}function Po(r,t){for(let e=0;e<r.length;e+=1)r[e]&&r[e].d(t)}function Tt(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function Mo(r){return document.createTextNode(r)}function xe(){return Mo(" ")}function fr(){return Mo("")}function zt(r,t,e,i){return r.addEventListener(t,e,i),()=>r.removeEventListener(t,e,i)}function B(r,t,e){e==null?r.removeAttribute(t):r.getAttribute(t)!==e&&r.setAttribute(t,e)}function zg(r){return Array.from(r.childNodes)}function Wg(r,t){t=""+t,r.data!==t&&(r.data=t)}function Gs(r,t,e){r.classList.toggle(t,!!e)}function jg(r,t,{bubbles:e=!1,cancelable:i=!1}={}){return new CustomEvent(r,{detail:t,bubbles:e,cancelable:i})}let qi;function Ki(r){qi=r}function Bo(){if(!qi)throw new Error("Function called outside component initialization");return qi}function $s(r){Bo().$$.on_mount.push(r)}function Yg(r){Bo().$$.on_destroy.push(r)}function Hs(){const r=Bo();return(t,e,{cancelable:i=!1}={})=>{const s=r.$$.callbacks[t];if(s){const n=jg(t,e,{cancelable:i});return s.slice().forEach(o=>{o.call(r,n)}),!n.defaultPrevented}return!0}}function Je(r,t){const e=r.$$.callbacks[t.type];e&&e.slice().forEach(i=>i.call(this,t))}const ai=[],Xs=[];let li=[];const Yh=[],qg=Promise.resolve();let Do=!1;function Kg(){Do||(Do=!0,qg.then(qh))}function Oo(r){li.push(r)}const Fo=new Set;let hi=0;function qh(){if(hi!==0)return;const r=qi;do{try{for(;hi<ai.length;){const t=ai[hi];hi++,Ki(t),Zg(t.$$)}}catch(t){throw ai.length=0,hi=0,t}for(Ki(null),ai.length=0,hi=0;Xs.length;)Xs.pop()();for(let t=0;t<li.length;t+=1){const e=li[t];Fo.has(e)||(Fo.add(e),e())}li.length=0}while(ai.length);for(;Yh.length;)Yh.pop()();Do=!1,Fo.clear(),Ki(r)}function Zg(r){if(r.fragment!==null){r.update(),Ke(r.before_update);const t=r.dirty;r.dirty=[-1],r.fragment&&r.fragment.p(r.ctx,t),r.after_update.forEach(Oo)}}function Jg(r){const t=[],e=[];li.forEach(i=>r.indexOf(i)===-1?t.push(i):e.push(i)),e.forEach(i=>i()),li=t}const Vs=new Set;let Br;function Qe(){Br={r:0,c:[],p:Br}}function tr(){Br.r||Ke(Br.c),Br=Br.p}function ot(r,t){r&&r.i&&(Vs.delete(r),r.i(t))}function ft(r,t,e,i){if(r&&r.o){if(Vs.has(r))return;Vs.add(r),Br.c.push(()=>{Vs.delete(r),i&&(e&&r.d(1),i())}),r.o(t)}else i&&i()}function ci(r){return(r==null?void 0:r.length)!==void 0?r:Array.from(r)}function ee(r){r&&r.c()}function Zt(r,t,e){const{fragment:i,after_update:s}=r.$$;i&&i.m(t,e),Oo(()=>{const n=r.$$.on_mount.map(Gh).filter(Kt);r.$$.on_destroy?r.$$.on_destroy.push(...n):Ke(n),r.$$.on_mount=[]}),s.forEach(Oo)}function Jt(r,t){const e=r.$$;e.fragment!==null&&(Jg(e.after_update),Ke(e.on_destroy),e.fragment&&e.fragment.d(t),e.on_destroy=e.fragment=null,e.ctx=[])}function Qg(r,t){r.$$.dirty[0]===-1&&(ai.push(r),Kg(),r.$$.dirty.fill(0)),r.$$.dirty[t/31|0]|=1<<t%31}function oe(r,t,e,i,s,n,o=null,a=[-1]){const l=qi;Ki(r);const h=r.$$={fragment:null,ctx:[],props:n,update:Be,not_equal:s,bound:$h(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(l?l.$$.context:[])),callbacks:$h(),dirty:a,skip_bound:!1,root:t.target||l.$$.root};o&&o(h.root);let c=!1;if(h.ctx=e?e(r,t.props||{},(u,d,...f)=>{const p=f.length?f[0]:d;return h.ctx&&s(h.ctx[u],h.ctx[u]=p)&&(!h.skip_bound&&h.bound[u]&&h.bound[u](p),c&&Qg(r,u)),d}):[],h.update(),c=!0,Ke(h.before_update),h.fragment=i?i(h.ctx):!1,t.target){if(t.hydrate){const u=zg(t.target);h.fragment&&h.fragment.l(u),u.forEach(ht)}else h.fragment&&h.fragment.c();t.intro&&ot(r.$$.fragment),Zt(r,t.target,t.anchor),qh()}Ki(l)}class ae{constructor(){Ml(this,"$$");Ml(this,"$$set")}$destroy(){Jt(this,1),this.$destroy=Be}$on(t,e){if(!Kt(e))return Be;const i=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return i.push(e),()=>{const s=i.indexOf(e);s!==-1&&i.splice(s,1)}}$set(t){this.$$set&&!Hg(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const ty="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(ty);var Dr=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(Dr||{}),Kh=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(Kh||{}),Lo=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(Lo||{}),Q=(r=>(r[r.NORMAL=0]="NORMAL",r[r.ADD=1]="ADD",r[r.MULTIPLY=2]="MULTIPLY",r[r.SCREEN=3]="SCREEN",r[r.OVERLAY=4]="OVERLAY",r[r.DARKEN=5]="DARKEN",r[r.LIGHTEN=6]="LIGHTEN",r[r.COLOR_DODGE=7]="COLOR_DODGE",r[r.COLOR_BURN=8]="COLOR_BURN",r[r.HARD_LIGHT=9]="HARD_LIGHT",r[r.SOFT_LIGHT=10]="SOFT_LIGHT",r[r.DIFFERENCE=11]="DIFFERENCE",r[r.EXCLUSION=12]="EXCLUSION",r[r.HUE=13]="HUE",r[r.SATURATION=14]="SATURATION",r[r.COLOR=15]="COLOR",r[r.LUMINOSITY=16]="LUMINOSITY",r[r.NORMAL_NPM=17]="NORMAL_NPM",r[r.ADD_NPM=18]="ADD_NPM",r[r.SCREEN_NPM=19]="SCREEN_NPM",r[r.NONE=20]="NONE",r[r.SRC_OVER=0]="SRC_OVER",r[r.SRC_IN=21]="SRC_IN",r[r.SRC_OUT=22]="SRC_OUT",r[r.SRC_ATOP=23]="SRC_ATOP",r[r.DST_OVER=24]="DST_OVER",r[r.DST_IN=25]="DST_IN",r[r.DST_OUT=26]="DST_OUT",r[r.DST_ATOP=27]="DST_ATOP",r[r.ERASE=26]="ERASE",r[r.SUBTRACT=28]="SUBTRACT",r[r.XOR=29]="XOR",r))(Q||{}),De=(r=>(r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN",r))(De||{}),G=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(G||{}),ui=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))(ui||{}),Z=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(Z||{}),z=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(z||{}),er=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(er||{}),pr=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(pr||{}),Oe=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(Oe||{}),ie=(r=>(r[r.NPM=0]="NPM",r[r.UNPACK=1]="UNPACK",r[r.PMA=2]="PMA",r[r.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",r[r.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",r[r.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",r))(ie||{}),Fe=(r=>(r[r.NO=0]="NO",r[r.YES=1]="YES",r[r.AUTO=2]="AUTO",r[r.BLEND=0]="BLEND",r[r.CLEAR=1]="CLEAR",r[r.BLIT=2]="BLIT",r))(Fe||{}),No=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(No||{}),fe=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(fe||{}),Ft=(r=>(r[r.NONE=0]="NONE",r[r.SCISSOR=1]="SCISSOR",r[r.STENCIL=2]="STENCIL",r[r.SPRITE=3]="SPRITE",r[r.COLOR=4]="COLOR",r))(Ft||{}),Dt=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(Dt||{}),Le=(r=>(r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r))(Le||{});const W={ADAPTER:{createCanvas:(r,t)=>{const e=document.createElement("canvas");return e.width=r,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")},RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};var Uo=/iPhone/i,Zh=/iPod/i,Jh=/iPad/i,Qh=/\biOS-universal(?:.+)Mac\b/i,ko=/\bAndroid(?:.+)Mobile\b/i,tc=/Android/i,di=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,zs=/Silk/i,rr=/Windows Phone/i,ec=/\bWindows(?:.+)ARM\b/i,rc=/BlackBerry/i,ic=/BB10/i,sc=/Opera Mini/i,nc=/\b(CriOS|Chrome)(?:.+)Mobile/i,oc=/Mobile(?:.+)Firefox\b/i,ac=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"};function ey(r){return function(t){return t.test(r)}}function lc(r){var t={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?t.userAgent=r:r&&r.userAgent&&(t={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var e=t.userAgent,i=e.split("[FBAN");typeof i[1]<"u"&&(e=i[0]),i=e.split("Twitter"),typeof i[1]<"u"&&(e=i[0]);var s=ey(e),n={apple:{phone:s(Uo)&&!s(rr),ipod:s(Zh),tablet:!s(Uo)&&(s(Jh)||ac(t))&&!s(rr),universal:s(Qh),device:(s(Uo)||s(Zh)||s(Jh)||s(Qh)||ac(t))&&!s(rr)},amazon:{phone:s(di),tablet:!s(di)&&s(zs),device:s(di)||s(zs)},android:{phone:!s(rr)&&s(di)||!s(rr)&&s(ko),tablet:!s(rr)&&!s(di)&&!s(ko)&&(s(zs)||s(tc)),device:!s(rr)&&(s(di)||s(zs)||s(ko)||s(tc))||s(/\bokhttp\b/i)},windows:{phone:s(rr),tablet:s(ec),device:s(rr)||s(ec)},other:{blackberry:s(rc),blackberry10:s(ic),opera:s(sc),firefox:s(oc),chrome:s(nc),device:s(rc)||s(ic)||s(sc)||s(oc)||s(nc)},any:!1,phone:!1,tablet:!1};return n.any=n.apple.device||n.android.device||n.windows.device||n.other.device,n.phone=n.apple.phone||n.android.phone||n.windows.phone,n.tablet=n.apple.tablet||n.android.tablet||n.windows.tablet,n}const ry=lc.default??lc,ir=ry(globalThis.navigator);W.RETINA_PREFIX=/@([0-9\.]+)x/,W.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Zi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function hc(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function iy(r){if(r.__esModule)return r;var t=r.default;if(typeof t=="function"){var e=function i(){return this instanceof i?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(r).forEach(function(i){var s=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:function(){return r[i]}})}),e}var cc={exports:{}};(function(r){var t=Object.prototype.hasOwnProperty,e="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(e=!1));function s(l,h,c){this.fn=l,this.context=h,this.once=c||!1}function n(l,h,c,u,d){if(typeof c!="function")throw new TypeError("The listener must be a function");var f=new s(c,u||l,d),p=e?e+h:h;return l._events[p]?l._events[p].fn?l._events[p]=[l._events[p],f]:l._events[p].push(f):(l._events[p]=f,l._eventsCount++),l}function o(l,h){--l._eventsCount===0?l._events=new i:delete l._events[h]}function a(){this._events=new i,this._eventsCount=0}a.prototype.eventNames=function(){var h=[],c,u;if(this._eventsCount===0)return h;for(u in c=this._events)t.call(c,u)&&h.push(e?u.slice(1):u);return Object.getOwnPropertySymbols?h.concat(Object.getOwnPropertySymbols(c)):h},a.prototype.listeners=function(h){var c=e?e+h:h,u=this._events[c];if(!u)return[];if(u.fn)return[u.fn];for(var d=0,f=u.length,p=new Array(f);d<f;d++)p[d]=u[d].fn;return p},a.prototype.listenerCount=function(h){var c=e?e+h:h,u=this._events[c];return u?u.fn?1:u.length:0},a.prototype.emit=function(h,c,u,d,f,p){var m=e?e+h:h;if(!this._events[m])return!1;var _=this._events[m],y=arguments.length,x,g;if(_.fn){switch(_.once&&this.removeListener(h,_.fn,void 0,!0),y){case 1:return _.fn.call(_.context),!0;case 2:return _.fn.call(_.context,c),!0;case 3:return _.fn.call(_.context,c,u),!0;case 4:return _.fn.call(_.context,c,u,d),!0;case 5:return _.fn.call(_.context,c,u,d,f),!0;case 6:return _.fn.call(_.context,c,u,d,f,p),!0}for(g=1,x=new Array(y-1);g<y;g++)x[g-1]=arguments[g];_.fn.apply(_.context,x)}else{var v=_.length,w;for(g=0;g<v;g++)switch(_[g].once&&this.removeListener(h,_[g].fn,void 0,!0),y){case 1:_[g].fn.call(_[g].context);break;case 2:_[g].fn.call(_[g].context,c);break;case 3:_[g].fn.call(_[g].context,c,u);break;case 4:_[g].fn.call(_[g].context,c,u,d);break;default:if(!x)for(w=1,x=new Array(y-1);w<y;w++)x[w-1]=arguments[w];_[g].fn.apply(_[g].context,x)}}return!0},a.prototype.on=function(h,c,u){return n(this,h,c,u,!1)},a.prototype.once=function(h,c,u){return n(this,h,c,u,!0)},a.prototype.removeListener=function(h,c,u,d){var f=e?e+h:h;if(!this._events[f])return this;if(!c)return o(this,f),this;var p=this._events[f];if(p.fn)p.fn===c&&(!d||p.once)&&(!u||p.context===u)&&o(this,f);else{for(var m=0,_=[],y=p.length;m<y;m++)(p[m].fn!==c||d&&!p[m].once||u&&p[m].context!==u)&&_.push(p[m]);_.length?this._events[f]=_.length===1?_[0]:_:o(this,f)}return this},a.prototype.removeAllListeners=function(h){var c;return h?(c=e?e+h:h,this._events[c]&&o(this,c)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=e,a.EventEmitter=a,r.exports=a})(cc);var sy=cc.exports;const Ji=hc(sy);var Go={exports:{}};Go.exports=Ws,Go.exports.default=Ws;function Ws(r,t,e){e=e||2;var i=t&&t.length,s=i?t[0]*e:r.length,n=uc(r,0,s,e,!0),o=[];if(!n||n.next===n.prev)return o;var a,l,h,c,u,d,f;if(i&&(n=hy(r,t,n,e)),r.length>80*e){a=h=r[0],l=c=r[1];for(var p=e;p<s;p+=e)u=r[p],d=r[p+1],u<a&&(a=u),d<l&&(l=d),u>h&&(h=u),d>c&&(c=d);f=Math.max(h-a,c-l),f=f!==0?32767/f:0}return Qi(n,o,e,a,l,f,0),o}function uc(r,t,e,i,s){var n,o;if(s===Xo(r,t,e,i)>0)for(n=t;n<e;n+=i)o=pc(n,r[n],r[n+1],o);else for(n=e-i;n>=t;n-=i)o=pc(n,r[n],r[n+1],o);return o&&js(o,o.next)&&(es(o),o=o.next),o}function Or(r,t){if(!r)return r;t||(t=r);var e=r,i;do if(i=!1,!e.steiner&&(js(e,e.next)||Ct(e.prev,e,e.next)===0)){if(es(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function Qi(r,t,e,i,s,n,o){if(r){!o&&n&&py(r,i,s,n);for(var a=r,l,h;r.prev!==r.next;){if(l=r.prev,h=r.next,n?oy(r,i,s,n):ny(r)){t.push(l.i/e|0),t.push(r.i/e|0),t.push(h.i/e|0),es(r),r=h.next,a=h.next;continue}if(r=h,r===a){o?o===1?(r=ay(Or(r),t,e),Qi(r,t,e,i,s,n,2)):o===2&&ly(r,t,e,i,s,n):Qi(Or(r),t,e,i,s,n,1);break}}}}function ny(r){var t=r.prev,e=r,i=r.next;if(Ct(t,e,i)>=0)return!1;for(var s=t.x,n=e.x,o=i.x,a=t.y,l=e.y,h=i.y,c=s<n?s<o?s:o:n<o?n:o,u=a<l?a<h?a:h:l<h?l:h,d=s>n?s>o?s:o:n>o?n:o,f=a>l?a>h?a:h:l>h?l:h,p=i.next;p!==t;){if(p.x>=c&&p.x<=d&&p.y>=u&&p.y<=f&&fi(s,a,n,l,o,h,p.x,p.y)&&Ct(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function oy(r,t,e,i){var s=r.prev,n=r,o=r.next;if(Ct(s,n,o)>=0)return!1;for(var a=s.x,l=n.x,h=o.x,c=s.y,u=n.y,d=o.y,f=a<l?a<h?a:h:l<h?l:h,p=c<u?c<d?c:d:u<d?u:d,m=a>l?a>h?a:h:l>h?l:h,_=c>u?c>d?c:d:u>d?u:d,y=$o(f,p,t,e,i),x=$o(m,_,t,e,i),g=r.prevZ,v=r.nextZ;g&&g.z>=y&&v&&v.z<=x;){if(g.x>=f&&g.x<=m&&g.y>=p&&g.y<=_&&g!==s&&g!==o&&fi(a,c,l,u,h,d,g.x,g.y)&&Ct(g.prev,g,g.next)>=0||(g=g.prevZ,v.x>=f&&v.x<=m&&v.y>=p&&v.y<=_&&v!==s&&v!==o&&fi(a,c,l,u,h,d,v.x,v.y)&&Ct(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;g&&g.z>=y;){if(g.x>=f&&g.x<=m&&g.y>=p&&g.y<=_&&g!==s&&g!==o&&fi(a,c,l,u,h,d,g.x,g.y)&&Ct(g.prev,g,g.next)>=0)return!1;g=g.prevZ}for(;v&&v.z<=x;){if(v.x>=f&&v.x<=m&&v.y>=p&&v.y<=_&&v!==s&&v!==o&&fi(a,c,l,u,h,d,v.x,v.y)&&Ct(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function ay(r,t,e){var i=r;do{var s=i.prev,n=i.next.next;!js(s,n)&&dc(s,i,i.next,n)&&ts(s,n)&&ts(n,s)&&(t.push(s.i/e|0),t.push(i.i/e|0),t.push(n.i/e|0),es(i),es(i.next),i=r=n),i=i.next}while(i!==r);return Or(i)}function ly(r,t,e,i,s,n){var o=r;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&yy(o,a)){var l=fc(o,a);o=Or(o,o.next),l=Or(l,l.next),Qi(o,t,e,i,s,n,0),Qi(l,t,e,i,s,n,0);return}a=a.next}o=o.next}while(o!==r)}function hy(r,t,e,i){var s=[],n,o,a,l,h;for(n=0,o=t.length;n<o;n++)a=t[n]*i,l=n<o-1?t[n+1]*i:r.length,h=uc(r,a,l,i,!1),h===h.next&&(h.steiner=!0),s.push(gy(h));for(s.sort(cy),n=0;n<s.length;n++)e=uy(s[n],e);return e}function cy(r,t){return r.x-t.x}function uy(r,t){var e=dy(r,t);if(!e)return t;var i=fc(e,r);return Or(i,i.next),Or(e,e.next)}function dy(r,t){var e=t,i=r.x,s=r.y,n=-1/0,o;do{if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){var a=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(a<=i&&a>n&&(n=a,o=e.x<e.next.x?e:e.next,a===i))return o}e=e.next}while(e!==t);if(!o)return null;var l=o,h=o.x,c=o.y,u=1/0,d;e=o;do i>=e.x&&e.x>=h&&i!==e.x&&fi(s<c?i:n,s,h,c,s<c?n:i,s,e.x,e.y)&&(d=Math.abs(s-e.y)/(i-e.x),ts(e,r)&&(d<u||d===u&&(e.x>o.x||e.x===o.x&&fy(o,e)))&&(o=e,u=d)),e=e.next;while(e!==l);return o}function fy(r,t){return Ct(r.prev,r,t.prev)<0&&Ct(t.next,r,r.next)<0}function py(r,t,e,i){var s=r;do s.z===0&&(s.z=$o(s.x,s.y,t,e,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==r);s.prevZ.nextZ=null,s.prevZ=null,my(s)}function my(r){var t,e,i,s,n,o,a,l,h=1;do{for(e=r,r=null,n=null,o=0;e;){for(o++,i=e,a=0,t=0;t<h&&(a++,i=i.nextZ,!!i);t++);for(l=h;a>0||l>0&&i;)a!==0&&(l===0||!i||e.z<=i.z)?(s=e,e=e.nextZ,a--):(s=i,i=i.nextZ,l--),n?n.nextZ=s:r=s,s.prevZ=n,n=s;e=i}n.nextZ=null,h*=2}while(o>1);return r}function $o(r,t,e,i,s){return r=(r-e)*s|0,t=(t-i)*s|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function gy(r){var t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function fi(r,t,e,i,s,n,o,a){return(s-o)*(t-a)>=(r-o)*(n-a)&&(r-o)*(i-a)>=(e-o)*(t-a)&&(e-o)*(n-a)>=(s-o)*(i-a)}function yy(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!_y(r,t)&&(ts(r,t)&&ts(t,r)&&vy(r,t)&&(Ct(r.prev,r,t.prev)||Ct(r,t.prev,t))||js(r,t)&&Ct(r.prev,r,r.next)>0&&Ct(t.prev,t,t.next)>0)}function Ct(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function js(r,t){return r.x===t.x&&r.y===t.y}function dc(r,t,e,i){var s=qs(Ct(r,t,e)),n=qs(Ct(r,t,i)),o=qs(Ct(e,i,r)),a=qs(Ct(e,i,t));return!!(s!==n&&o!==a||s===0&&Ys(r,e,t)||n===0&&Ys(r,i,t)||o===0&&Ys(e,r,i)||a===0&&Ys(e,t,i))}function Ys(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function qs(r){return r>0?1:r<0?-1:0}function _y(r,t){var e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&dc(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function ts(r,t){return Ct(r.prev,r,r.next)<0?Ct(r,t,r.next)>=0&&Ct(r,r.prev,t)>=0:Ct(r,t,r.prev)<0||Ct(r,r.next,t)<0}function vy(r,t){var e=r,i=!1,s=(r.x+t.x)/2,n=(r.y+t.y)/2;do e.y>n!=e.next.y>n&&e.next.y!==e.y&&s<(e.next.x-e.x)*(n-e.y)/(e.next.y-e.y)+e.x&&(i=!i),e=e.next;while(e!==r);return i}function fc(r,t){var e=new Ho(r.i,r.x,r.y),i=new Ho(t.i,t.x,t.y),s=r.next,n=t.prev;return r.next=t,t.prev=r,e.next=s,s.prev=e,i.next=e,e.prev=i,n.next=i,i.prev=n,i}function pc(r,t,e,i){var s=new Ho(r,t,e);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function es(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Ho(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Ws.deviation=function(r,t,e,i){var s=t&&t.length,n=s?t[0]*e:r.length,o=Math.abs(Xo(r,0,n,e));if(s)for(var a=0,l=t.length;a<l;a++){var h=t[a]*e,c=a<l-1?t[a+1]*e:r.length;o-=Math.abs(Xo(r,h,c,e))}var u=0;for(a=0;a<i.length;a+=3){var d=i[a]*e,f=i[a+1]*e,p=i[a+2]*e;u+=Math.abs((r[d]-r[p])*(r[f+1]-r[d+1])-(r[d]-r[f])*(r[p+1]-r[d+1]))}return o===0&&u===0?0:Math.abs((u-o)/o)};function Xo(r,t,e,i){for(var s=0,n=t,o=e-i;n<e;n+=i)s+=(r[o]-r[n])*(r[n+1]+r[o+1]),o=n;return s}Ws.flatten=function(r){for(var t=r[0][0].length,e={vertices:[],holes:[],dimensions:t},i=0,s=0;s<r.length;s++){for(var n=0;n<r[s].length;n++)for(var o=0;o<t;o++)e.vertices.push(r[s][n][o]);s>0&&(i+=r[s-1].length,e.holes.push(i))}return e};var xy=Go.exports;const by=hc(xy);var Ks={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */Ks.exports,function(r,t){(function(e){var i=t&&!t.nodeType&&t,s=r&&!r.nodeType&&r,n=typeof Zi=="object"&&Zi;(n.global===n||n.window===n||n.self===n)&&(e=n);var o,a=2147483647,l=36,h=1,c=26,u=38,d=700,f=72,p=128,m="-",_=/^xn--/,y=/[^\x20-\x7E]/,x=/[\x2E\u3002\uFF0E\uFF61]/g,g={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},v=l-h,w=Math.floor,I=String.fromCharCode,T;function C(F){throw new RangeError(g[F])}function D(F,k){for(var J=F.length,X=[];J--;)X[J]=k(F[J]);return X}function A(F,k){var J=F.split("@"),X="";J.length>1&&(X=J[0]+"@",F=J[1]),F=F.replace(x,".");var K=F.split("."),$=D(K,k).join(".");return X+$}function P(F){for(var k=[],J=0,X=F.length,K,$;J<X;)K=F.charCodeAt(J++),K>=55296&&K<=56319&&J<X?($=F.charCodeAt(J++),($&64512)==56320?k.push(((K&1023)<<10)+($&1023)+65536):(k.push(K),J--)):k.push(K);return k}function R(F){return D(F,function(k){var J="";return k>65535&&(k-=65536,J+=I(k>>>10&1023|55296),k=56320|k&1023),J+=I(k),J}).join("")}function b(F){return F-48<10?F-22:F-65<26?F-65:F-97<26?F-97:l}function M(F,k){return F+22+75*(F<26)-((k!=0)<<5)}function S(F,k,J){var X=0;for(F=J?w(F/d):F>>1,F+=w(F/k);F>v*c>>1;X+=l)F=w(F/v);return w(X+(v+1)*F/(F+u))}function U(F){var k=[],J=F.length,X,K=0,$=p,at=f,vt,N,O,bt,mt,yt,_t,We,je;for(vt=F.lastIndexOf(m),vt<0&&(vt=0),N=0;N<vt;++N)F.charCodeAt(N)>=128&&C("not-basic"),k.push(F.charCodeAt(N));for(O=vt>0?vt+1:0;O<J;){for(bt=K,mt=1,yt=l;O>=J&&C("invalid-input"),_t=b(F.charCodeAt(O++)),(_t>=l||_t>w((a-K)/mt))&&C("overflow"),K+=_t*mt,We=yt<=at?h:yt>=at+c?c:yt-at,!(_t<We);yt+=l)je=l-We,mt>w(a/je)&&C("overflow"),mt*=je;X=k.length+1,at=S(K-bt,X,bt==0),w(K/X)>a-$&&C("overflow"),$+=w(K/X),K%=X,k.splice(K++,0,$)}return R(k)}function L(F){var k,J,X,K,$,at,vt,N,O,bt,mt,yt=[],_t,We,je,xs;for(F=P(F),_t=F.length,k=p,J=0,$=f,at=0;at<_t;++at)mt=F[at],mt<128&&yt.push(I(mt));for(X=K=yt.length,K&&yt.push(m);X<_t;){for(vt=a,at=0;at<_t;++at)mt=F[at],mt>=k&&mt<vt&&(vt=mt);for(We=X+1,vt-k>w((a-J)/We)&&C("overflow"),J+=(vt-k)*We,k=vt,at=0;at<_t;++at)if(mt=F[at],mt<k&&++J>a&&C("overflow"),mt==k){for(N=J,O=l;bt=O<=$?h:O>=$+c?c:O-$,!(N<bt);O+=l)xs=N-bt,je=l-bt,yt.push(I(M(bt+xs%je,0))),N=w(xs/je);yt.push(I(M(N,0))),$=S(J,We,X==K),J=0,++X}++J,++k}return yt.join("")}function H(F){return A(F,function(k){return _.test(k)?U(k.slice(4).toLowerCase()):k})}function tt(F){return A(F,function(k){return y.test(k)?"xn--"+L(k):k})}if(o={version:"1.4.1",ucs2:{decode:P,encode:R},decode:U,encode:L,toASCII:tt,toUnicode:H},i&&s)if(r.exports==i)s.exports=o;else for(T in o)o.hasOwnProperty(T)&&(i[T]=o[T]);else e.punycode=o})(Zi)}(Ks,Ks.exports);var wy=Ks.exports,Ey=Error,Ty=EvalError,Ay=RangeError,Sy=ReferenceError,mc=SyntaxError,rs=TypeError,Cy=URIError,Iy=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),i=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var s=42;t[e]=s;for(e in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var n=Object.getOwnPropertySymbols(t);if(n.length!==1||n[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(t,e);if(o.value!==s||o.enumerable!==!0)return!1}return!0},gc=typeof Symbol<"u"&&Symbol,Ry=Iy,Py=function(){return typeof gc!="function"||typeof Symbol!="function"||typeof gc("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Ry()},Vo={__proto__:null,foo:{}},My=Object,By=function(){return{__proto__:Vo}.foo===Vo.foo&&!(Vo instanceof My)},Dy="Function.prototype.bind called on incompatible ",Oy=Object.prototype.toString,Fy=Math.max,Ly="[object Function]",yc=function(t,e){for(var i=[],s=0;s<t.length;s+=1)i[s]=t[s];for(var n=0;n<e.length;n+=1)i[n+t.length]=e[n];return i},Ny=function(t,e){for(var i=[],s=e,n=0;s<t.length;s+=1,n+=1)i[n]=t[s];return i},Uy=function(r,t){for(var e="",i=0;i<r.length;i+=1)e+=r[i],i+1<r.length&&(e+=t);return e},ky=function(t){var e=this;if(typeof e!="function"||Oy.apply(e)!==Ly)throw new TypeError(Dy+e);for(var i=Ny(arguments,1),s,n=function(){if(this instanceof s){var c=e.apply(this,yc(i,arguments));return Object(c)===c?c:this}return e.apply(t,yc(i,arguments))},o=Fy(0,e.length-i.length),a=[],l=0;l<o;l++)a[l]="$"+l;if(s=Function("binder","return function ("+Uy(a,",")+"){ return binder.apply(this,arguments); }")(n),e.prototype){var h=function(){};h.prototype=e.prototype,s.prototype=new h,h.prototype=null}return s},Gy=ky,zo=Function.prototype.bind||Gy,$y=Function.prototype.call,Hy=Object.prototype.hasOwnProperty,Xy=zo,Vy=Xy.call($y,Hy),ct,zy=Ey,Wy=Ty,jy=Ay,Yy=Sy,pi=mc,mi=rs,qy=Cy,_c=Function,Wo=function(r){try{return _c('"use strict"; return ('+r+").constructor;")()}catch{}},Fr=Object.getOwnPropertyDescriptor;if(Fr)try{Fr({},"")}catch{Fr=null}var jo=function(){throw new mi},Ky=Fr?function(){try{return arguments.callee,jo}catch{try{return Fr(arguments,"callee").get}catch{return jo}}}():jo,gi=Py(),Zy=By(),kt=Object.getPrototypeOf||(Zy?function(r){return r.__proto__}:null),yi={},Jy=typeof Uint8Array>"u"||!kt?ct:kt(Uint8Array),Lr={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?ct:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?ct:ArrayBuffer,"%ArrayIteratorPrototype%":gi&&kt?kt([][Symbol.iterator]()):ct,"%AsyncFromSyncIteratorPrototype%":ct,"%AsyncFunction%":yi,"%AsyncGenerator%":yi,"%AsyncGeneratorFunction%":yi,"%AsyncIteratorPrototype%":yi,"%Atomics%":typeof Atomics>"u"?ct:Atomics,"%BigInt%":typeof BigInt>"u"?ct:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?ct:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?ct:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?ct:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":zy,"%eval%":eval,"%EvalError%":Wy,"%Float32Array%":typeof Float32Array>"u"?ct:Float32Array,"%Float64Array%":typeof Float64Array>"u"?ct:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?ct:FinalizationRegistry,"%Function%":_c,"%GeneratorFunction%":yi,"%Int8Array%":typeof Int8Array>"u"?ct:Int8Array,"%Int16Array%":typeof Int16Array>"u"?ct:Int16Array,"%Int32Array%":typeof Int32Array>"u"?ct:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":gi&&kt?kt(kt([][Symbol.iterator]())):ct,"%JSON%":typeof JSON=="object"?JSON:ct,"%Map%":typeof Map>"u"?ct:Map,"%MapIteratorPrototype%":typeof Map>"u"||!gi||!kt?ct:kt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?ct:Promise,"%Proxy%":typeof Proxy>"u"?ct:Proxy,"%RangeError%":jy,"%ReferenceError%":Yy,"%Reflect%":typeof Reflect>"u"?ct:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?ct:Set,"%SetIteratorPrototype%":typeof Set>"u"||!gi||!kt?ct:kt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?ct:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":gi&&kt?kt(""[Symbol.iterator]()):ct,"%Symbol%":gi?Symbol:ct,"%SyntaxError%":pi,"%ThrowTypeError%":Ky,"%TypedArray%":Jy,"%TypeError%":mi,"%Uint8Array%":typeof Uint8Array>"u"?ct:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?ct:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?ct:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?ct:Uint32Array,"%URIError%":qy,"%WeakMap%":typeof WeakMap>"u"?ct:WeakMap,"%WeakRef%":typeof WeakRef>"u"?ct:WeakRef,"%WeakSet%":typeof WeakSet>"u"?ct:WeakSet};if(kt)try{null.error}catch(r){var Qy=kt(kt(r));Lr["%Error.prototype%"]=Qy}var t0=function r(t){var e;if(t==="%AsyncFunction%")e=Wo("async function () {}");else if(t==="%GeneratorFunction%")e=Wo("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=Wo("async function* () {}");else if(t==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(e=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=r("%AsyncGenerator%");s&&kt&&(e=kt(s.prototype))}return Lr[t]=e,e},vc={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},is=zo,Zs=Vy,e0=is.call(Function.call,Array.prototype.concat),r0=is.call(Function.apply,Array.prototype.splice),xc=is.call(Function.call,String.prototype.replace),Js=is.call(Function.call,String.prototype.slice),i0=is.call(Function.call,RegExp.prototype.exec),s0=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,n0=/\\(\\)?/g,o0=function(t){var e=Js(t,0,1),i=Js(t,-1);if(e==="%"&&i!=="%")throw new pi("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&e!=="%")throw new pi("invalid intrinsic syntax, expected opening `%`");var s=[];return xc(t,s0,function(n,o,a,l){s[s.length]=a?xc(l,n0,"$1"):o||n}),s},a0=function(t,e){var i=t,s;if(Zs(vc,i)&&(s=vc[i],i="%"+s[0]+"%"),Zs(Lr,i)){var n=Lr[i];if(n===yi&&(n=t0(i)),typeof n>"u"&&!e)throw new mi("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:n}}throw new pi("intrinsic "+t+" does not exist!")},_i=function(t,e){if(typeof t!="string"||t.length===0)throw new mi("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new mi('"allowMissing" argument must be a boolean');if(i0(/^%?[^%]*%?$/,t)===null)throw new pi("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=o0(t),s=i.length>0?i[0]:"",n=a0("%"+s+"%",e),o=n.name,a=n.value,l=!1,h=n.alias;h&&(s=h[0],r0(i,e0([0,1],h)));for(var c=1,u=!0;c<i.length;c+=1){var d=i[c],f=Js(d,0,1),p=Js(d,-1);if((f==='"'||f==="'"||f==="`"||p==='"'||p==="'"||p==="`")&&f!==p)throw new pi("property names with quotes must have matching quotes");if((d==="constructor"||!u)&&(l=!0),s+="."+d,o="%"+s+"%",Zs(Lr,o))a=Lr[o];else if(a!=null){if(!(d in a)){if(!e)throw new mi("base intrinsic for "+t+" exists, but the property is not available.");return}if(Fr&&c+1>=i.length){var m=Fr(a,d);u=!!m,u&&"get"in m&&!("originalValue"in m.get)?a=m.get:a=a[d]}else u=Zs(a,d),a=a[d];u&&!l&&(Lr[o]=a)}}return a},bc={exports:{}},Yo,wc;function qo(){if(wc)return Yo;wc=1;var r=_i,t=r("%Object.defineProperty%",!0)||!1;if(t)try{t({},"a",{value:1})}catch{t=!1}return Yo=t,Yo}var l0=_i,Qs=l0("%Object.getOwnPropertyDescriptor%",!0);if(Qs)try{Qs([],"length")}catch{Qs=null}var Ec=Qs,Tc=qo(),h0=mc,vi=rs,Ac=Ec,c0=function(t,e,i){if(!t||typeof t!="object"&&typeof t!="function")throw new vi("`obj` must be an object or a function`");if(typeof e!="string"&&typeof e!="symbol")throw new vi("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new vi("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new vi("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new vi("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new vi("`loose`, if provided, must be a boolean");var s=arguments.length>3?arguments[3]:null,n=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,a=arguments.length>6?arguments[6]:!1,l=!!Ac&&Ac(t,e);if(Tc)Tc(t,e,{configurable:o===null&&l?l.configurable:!o,enumerable:s===null&&l?l.enumerable:!s,value:i,writable:n===null&&l?l.writable:!n});else if(a||!s&&!n&&!o)t[e]=i;else throw new h0("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Ko=qo(),Sc=function(){return!!Ko};Sc.hasArrayLengthDefineBug=function(){if(!Ko)return null;try{return Ko([],"length",{value:1}).length!==1}catch{return!0}};var u0=Sc,d0=_i,Cc=c0,f0=u0(),Ic=Ec,Rc=rs,p0=d0("%Math.floor%"),m0=function(t,e){if(typeof t!="function")throw new Rc("`fn` is not a function");if(typeof e!="number"||e<0||e>4294967295||p0(e)!==e)throw new Rc("`length` must be a positive 32-bit integer");var i=arguments.length>2&&!!arguments[2],s=!0,n=!0;if("length"in t&&Ic){var o=Ic(t,"length");o&&!o.configurable&&(s=!1),o&&!o.writable&&(n=!1)}return(s||n||!i)&&(f0?Cc(t,"length",e,!0,!0):Cc(t,"length",e)),t};(function(r){var t=zo,e=_i,i=m0,s=rs,n=e("%Function.prototype.apply%"),o=e("%Function.prototype.call%"),a=e("%Reflect.apply%",!0)||t.call(o,n),l=qo(),h=e("%Math.max%");r.exports=function(d){if(typeof d!="function")throw new s("a function is required");var f=a(t,o,arguments);return i(f,1+h(0,d.length-(arguments.length-1)),!0)};var c=function(){return a(t,n,arguments)};l?l(r.exports,"apply",{value:c}):r.exports.apply=c})(bc);var g0=bc.exports,Pc=_i,Mc=g0,y0=Mc(Pc("String.prototype.indexOf")),_0=function(t,e){var i=Pc(t,!!e);return typeof i=="function"&&y0(t,".prototype.")>-1?Mc(i):i};const v0=iy(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Zo=typeof Map=="function"&&Map.prototype,Jo=Object.getOwnPropertyDescriptor&&Zo?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,tn=Zo&&Jo&&typeof Jo.get=="function"?Jo.get:null,Bc=Zo&&Map.prototype.forEach,Qo=typeof Set=="function"&&Set.prototype,ta=Object.getOwnPropertyDescriptor&&Qo?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,en=Qo&&ta&&typeof ta.get=="function"?ta.get:null,Dc=Qo&&Set.prototype.forEach,x0=typeof WeakMap=="function"&&WeakMap.prototype,ss=x0?WeakMap.prototype.has:null,b0=typeof WeakSet=="function"&&WeakSet.prototype,ns=b0?WeakSet.prototype.has:null,w0=typeof WeakRef=="function"&&WeakRef.prototype,Oc=w0?WeakRef.prototype.deref:null,E0=Boolean.prototype.valueOf,T0=Object.prototype.toString,A0=Function.prototype.toString,S0=String.prototype.match,ea=String.prototype.slice,mr=String.prototype.replace,C0=String.prototype.toUpperCase,Fc=String.prototype.toLowerCase,Lc=RegExp.prototype.test,Nc=Array.prototype.concat,Ne=Array.prototype.join,I0=Array.prototype.slice,Uc=Math.floor,ra=typeof BigInt=="function"?BigInt.prototype.valueOf:null,ia=Object.getOwnPropertySymbols,sa=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,xi=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Qt=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===xi||!0)?Symbol.toStringTag:null,kc=Object.prototype.propertyIsEnumerable,Gc=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function $c(r,t){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||Lc.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-Uc(-r):Uc(r);if(i!==r){var s=String(i),n=ea.call(t,s.length+1);return mr.call(s,e,"$&_")+"."+mr.call(mr.call(n,/([0-9]{3})/g,"$&_"),/_$/,"")}}return mr.call(t,e,"$&_")}var na=v0,Hc=na.custom,Xc=Wc(Hc)?Hc:null,R0=function r(t,e,i,s){var n=e||{};if(gr(n,"quoteStyle")&&n.quoteStyle!=="single"&&n.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(gr(n,"maxStringLength")&&(typeof n.maxStringLength=="number"?n.maxStringLength<0&&n.maxStringLength!==1/0:n.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var o=gr(n,"customInspect")?n.customInspect:!0;if(typeof o!="boolean"&&o!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(gr(n,"indent")&&n.indent!==null&&n.indent!==" "&&!(parseInt(n.indent,10)===n.indent&&n.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(gr(n,"numericSeparator")&&typeof n.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=n.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return Yc(t,n);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var l=String(t);return a?$c(t,l):l}if(typeof t=="bigint"){var h=String(t)+"n";return a?$c(t,h):h}var c=typeof n.depth>"u"?5:n.depth;if(typeof i>"u"&&(i=0),i>=c&&c>0&&typeof t=="object")return oa(t)?"[Array]":"[Object]";var u=j0(n,i);if(typeof s>"u")s=[];else if(jc(s,t)>=0)return"[Circular]";function d(b,M,S){if(M&&(s=I0.call(s),s.push(M)),S){var U={depth:n.depth};return gr(n,"quoteStyle")&&(U.quoteStyle=n.quoteStyle),r(b,U,i+1,s)}return r(b,n,i+1,s)}if(typeof t=="function"&&!zc(t)){var f=U0(t),p=rn(t,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+Ne.call(p,", ")+" }":"")}if(Wc(t)){var m=xi?mr.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):sa.call(t);return typeof t=="object"&&!xi?os(m):m}if(V0(t)){for(var _="<"+Fc.call(String(t.nodeName)),y=t.attributes||[],x=0;x<y.length;x++)_+=" "+y[x].name+"="+Vc(P0(y[x].value),"double",n);return _+=">",t.childNodes&&t.childNodes.length&&(_+="..."),_+="</"+Fc.call(String(t.nodeName))+">",_}if(oa(t)){if(t.length===0)return"[]";var g=rn(t,d);return u&&!W0(g)?"["+la(g,u)+"]":"[ "+Ne.call(g,", ")+" ]"}if(B0(t)){var v=rn(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!kc.call(t,"cause")?"{ ["+String(t)+"] "+Ne.call(Nc.call("[cause]: "+d(t.cause),v),", ")+" }":v.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+Ne.call(v,", ")+" }"}if(typeof t=="object"&&o){if(Xc&&typeof t[Xc]=="function"&&na)return na(t,{depth:c-i});if(o!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(k0(t)){var w=[];return Bc&&Bc.call(t,function(b,M){w.push(d(M,t,!0)+" => "+d(b,t))}),qc("Map",tn.call(t),w,u)}if(H0(t)){var I=[];return Dc&&Dc.call(t,function(b){I.push(d(b,t))}),qc("Set",en.call(t),I,u)}if(G0(t))return aa("WeakMap");if(X0(t))return aa("WeakSet");if($0(t))return aa("WeakRef");if(O0(t))return os(d(Number(t)));if(L0(t))return os(d(ra.call(t)));if(F0(t))return os(E0.call(t));if(D0(t))return os(d(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(typeof globalThis<"u"&&t===globalThis||typeof Zi<"u"&&t===Zi)return"{ [object globalThis] }";if(!M0(t)&&!zc(t)){var T=rn(t,d),C=Gc?Gc(t)===Object.prototype:t instanceof Object||t.constructor===Object,D=t instanceof Object?"":"null prototype",A=!C&&Qt&&Object(t)===t&&Qt in t?ea.call(yr(t),8,-1):D?"Object":"",P=C||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",R=P+(A||D?"["+Ne.call(Nc.call([],A||[],D||[]),": ")+"] ":"");return T.length===0?R+"{}":u?R+"{"+la(T,u)+"}":R+"{ "+Ne.call(T,", ")+" }"}return String(t)};function Vc(r,t,e){var i=(e.quoteStyle||t)==="double"?'"':"'";return i+r+i}function P0(r){return mr.call(String(r),/"/g,"&quot;")}function oa(r){return yr(r)==="[object Array]"&&(!Qt||!(typeof r=="object"&&Qt in r))}function M0(r){return yr(r)==="[object Date]"&&(!Qt||!(typeof r=="object"&&Qt in r))}function zc(r){return yr(r)==="[object RegExp]"&&(!Qt||!(typeof r=="object"&&Qt in r))}function B0(r){return yr(r)==="[object Error]"&&(!Qt||!(typeof r=="object"&&Qt in r))}function D0(r){return yr(r)==="[object String]"&&(!Qt||!(typeof r=="object"&&Qt in r))}function O0(r){return yr(r)==="[object Number]"&&(!Qt||!(typeof r=="object"&&Qt in r))}function F0(r){return yr(r)==="[object Boolean]"&&(!Qt||!(typeof r=="object"&&Qt in r))}function Wc(r){if(xi)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!sa)return!1;try{return sa.call(r),!0}catch{}return!1}function L0(r){if(!r||typeof r!="object"||!ra)return!1;try{return ra.call(r),!0}catch{}return!1}var N0=Object.prototype.hasOwnProperty||function(r){return r in this};function gr(r,t){return N0.call(r,t)}function yr(r){return T0.call(r)}function U0(r){if(r.name)return r.name;var t=S0.call(A0.call(r),/^function\s*([\w$]+)/);return t?t[1]:null}function jc(r,t){if(r.indexOf)return r.indexOf(t);for(var e=0,i=r.length;e<i;e++)if(r[e]===t)return e;return-1}function k0(r){if(!tn||!r||typeof r!="object")return!1;try{tn.call(r);try{en.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function G0(r){if(!ss||!r||typeof r!="object")return!1;try{ss.call(r,ss);try{ns.call(r,ns)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function $0(r){if(!Oc||!r||typeof r!="object")return!1;try{return Oc.call(r),!0}catch{}return!1}function H0(r){if(!en||!r||typeof r!="object")return!1;try{en.call(r);try{tn.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function X0(r){if(!ns||!r||typeof r!="object")return!1;try{ns.call(r,ns);try{ss.call(r,ss)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function V0(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function Yc(r,t){if(r.length>t.maxStringLength){var e=r.length-t.maxStringLength,i="... "+e+" more character"+(e>1?"s":"");return Yc(ea.call(r,0,t.maxStringLength),t)+i}var s=mr.call(mr.call(r,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,z0);return Vc(s,"single",t)}function z0(r){var t=r.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+C0.call(t.toString(16))}function os(r){return"Object("+r+")"}function aa(r){return r+" { ? }"}function qc(r,t,e,i){var s=i?la(e,i):Ne.call(e,", ");return r+" ("+t+") {"+s+"}"}function W0(r){for(var t=0;t<r.length;t++)if(jc(r[t],`
2
+ `)>=0)return!1;return!0}function j0(r,t){var e;if(r.indent===" ")e=" ";else if(typeof r.indent=="number"&&r.indent>0)e=Ne.call(Array(r.indent+1)," ");else return null;return{base:e,prev:Ne.call(Array(t+1),e)}}function la(r,t){if(r.length===0)return"";var e=`
3
+ `+t.prev+t.base;return e+Ne.call(r,","+e)+`
4
+ `+t.prev}function rn(r,t){var e=oa(r),i=[];if(e){i.length=r.length;for(var s=0;s<r.length;s++)i[s]=gr(r,s)?t(r[s],r):""}var n=typeof ia=="function"?ia(r):[],o;if(xi){o={};for(var a=0;a<n.length;a++)o["$"+n[a]]=n[a]}for(var l in r)gr(r,l)&&(e&&String(Number(l))===l&&l<r.length||xi&&o["$"+l]instanceof Symbol||(Lc.call(/[^\w$]/,l)?i.push(t(l,r)+": "+t(r[l],r)):i.push(l+": "+t(r[l],r))));if(typeof ia=="function")for(var h=0;h<n.length;h++)kc.call(r,n[h])&&i.push("["+t(n[h])+"]: "+t(r[n[h]],r));return i}var Kc=_i,bi=_0,Y0=R0,q0=rs,sn=Kc("%WeakMap%",!0),nn=Kc("%Map%",!0),K0=bi("WeakMap.prototype.get",!0),Z0=bi("WeakMap.prototype.set",!0),J0=bi("WeakMap.prototype.has",!0),Q0=bi("Map.prototype.get",!0),t_=bi("Map.prototype.set",!0),e_=bi("Map.prototype.has",!0),ha=function(r,t){for(var e=r,i;(i=e.next)!==null;e=i)if(i.key===t)return e.next=i.next,i.next=r.next,r.next=i,i},r_=function(r,t){var e=ha(r,t);return e&&e.value},i_=function(r,t,e){var i=ha(r,t);i?i.value=e:r.next={key:t,next:r.next,value:e}},s_=function(r,t){return!!ha(r,t)},n_=function(){var t,e,i,s={assert:function(n){if(!s.has(n))throw new q0("Side channel does not contain "+Y0(n))},get:function(n){if(sn&&n&&(typeof n=="object"||typeof n=="function")){if(t)return K0(t,n)}else if(nn){if(e)return Q0(e,n)}else if(i)return r_(i,n)},has:function(n){if(sn&&n&&(typeof n=="object"||typeof n=="function")){if(t)return J0(t,n)}else if(nn){if(e)return e_(e,n)}else if(i)return s_(i,n);return!1},set:function(n,o){sn&&n&&(typeof n=="object"||typeof n=="function")?(t||(t=new sn),Z0(t,n,o)):nn?(e||(e=new nn),t_(e,n,o)):(i||(i={key:{},next:null}),i_(i,n,o))}};return s},o_=String.prototype.replace,a_=/%20/g,ca={RFC1738:"RFC1738",RFC3986:"RFC3986"},ua={default:ca.RFC3986,formatters:{RFC1738:function(r){return o_.call(r,a_,"+")},RFC3986:function(r){return String(r)}},RFC1738:ca.RFC1738,RFC3986:ca.RFC3986},l_=ua,da=Object.prototype.hasOwnProperty,Nr=Array.isArray,Ue=function(){for(var r=[],t=0;t<256;++t)r.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return r}(),h_=function(t){for(;t.length>1;){var e=t.pop(),i=e.obj[e.prop];if(Nr(i)){for(var s=[],n=0;n<i.length;++n)typeof i[n]<"u"&&s.push(i[n]);e.obj[e.prop]=s}}},Zc=function(t,e){for(var i=e&&e.plainObjects?Object.create(null):{},s=0;s<t.length;++s)typeof t[s]<"u"&&(i[s]=t[s]);return i},c_=function r(t,e,i){if(!e)return t;if(typeof e!="object"){if(Nr(t))t.push(e);else if(t&&typeof t=="object")(i&&(i.plainObjects||i.allowPrototypes)||!da.call(Object.prototype,e))&&(t[e]=!0);else return[t,e];return t}if(!t||typeof t!="object")return[t].concat(e);var s=t;return Nr(t)&&!Nr(e)&&(s=Zc(t,i)),Nr(t)&&Nr(e)?(e.forEach(function(n,o){if(da.call(t,o)){var a=t[o];a&&typeof a=="object"&&n&&typeof n=="object"?t[o]=r(a,n,i):t.push(n)}else t[o]=n}),t):Object.keys(e).reduce(function(n,o){var a=e[o];return da.call(n,o)?n[o]=r(n[o],a,i):n[o]=a,n},s)},u_=function(t,e){return Object.keys(e).reduce(function(i,s){return i[s]=e[s],i},t)},d_=function(r,t,e){var i=r.replace(/\+/g," ");if(e==="iso-8859-1")return i.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(i)}catch{return i}},fa=1024,f_=function(t,e,i,s,n){if(t.length===0)return t;var o=t;if(typeof t=="symbol"?o=Symbol.prototype.toString.call(t):typeof t!="string"&&(o=String(t)),i==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(f){return"%26%23"+parseInt(f.slice(2),16)+"%3B"});for(var a="",l=0;l<o.length;l+=fa){for(var h=o.length>=fa?o.slice(l,l+fa):o,c=[],u=0;u<h.length;++u){var d=h.charCodeAt(u);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||n===l_.RFC1738&&(d===40||d===41)){c[c.length]=h.charAt(u);continue}if(d<128){c[c.length]=Ue[d];continue}if(d<2048){c[c.length]=Ue[192|d>>6]+Ue[128|d&63];continue}if(d<55296||d>=57344){c[c.length]=Ue[224|d>>12]+Ue[128|d>>6&63]+Ue[128|d&63];continue}u+=1,d=65536+((d&1023)<<10|h.charCodeAt(u)&1023),c[c.length]=Ue[240|d>>18]+Ue[128|d>>12&63]+Ue[128|d>>6&63]+Ue[128|d&63]}a+=c.join("")}return a},p_=function(t){for(var e=[{obj:{o:t},prop:"o"}],i=[],s=0;s<e.length;++s)for(var n=e[s],o=n.obj[n.prop],a=Object.keys(o),l=0;l<a.length;++l){var h=a[l],c=o[h];typeof c=="object"&&c!==null&&i.indexOf(c)===-1&&(e.push({obj:o,prop:h}),i.push(c))}return h_(e),t},m_=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},g_=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},y_=function(t,e){return[].concat(t,e)},__=function(t,e){if(Nr(t)){for(var i=[],s=0;s<t.length;s+=1)i.push(e(t[s]));return i}return e(t)},Jc={arrayToObject:Zc,assign:u_,combine:y_,compact:p_,decode:d_,encode:f_,isBuffer:g_,isRegExp:m_,maybeMap:__,merge:c_},Qc=n_,on=Jc,as=ua,v_=Object.prototype.hasOwnProperty,tu={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},ke=Array.isArray,x_=Array.prototype.push,eu=function(r,t){x_.apply(r,ke(t)?t:[t])},b_=Date.prototype.toISOString,ru=as.default,Lt={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:on.encode,encodeValuesOnly:!1,format:ru,formatter:as.formatters[ru],indices:!1,serializeDate:function(t){return b_.call(t)},skipNulls:!1,strictNullHandling:!1},w_=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},pa={},E_=function r(t,e,i,s,n,o,a,l,h,c,u,d,f,p,m,_,y,x){for(var g=t,v=x,w=0,I=!1;(v=v.get(pa))!==void 0&&!I;){var T=v.get(t);if(w+=1,typeof T<"u"){if(T===w)throw new RangeError("Cyclic object value");I=!0}typeof v.get(pa)>"u"&&(w=0)}if(typeof c=="function"?g=c(e,g):g instanceof Date?g=f(g):i==="comma"&&ke(g)&&(g=on.maybeMap(g,function(F){return F instanceof Date?f(F):F})),g===null){if(o)return h&&!_?h(e,Lt.encoder,y,"key",p):e;g=""}if(w_(g)||on.isBuffer(g)){if(h){var C=_?e:h(e,Lt.encoder,y,"key",p);return[m(C)+"="+m(h(g,Lt.encoder,y,"value",p))]}return[m(e)+"="+m(String(g))]}var D=[];if(typeof g>"u")return D;var A;if(i==="comma"&&ke(g))_&&h&&(g=on.maybeMap(g,h)),A=[{value:g.length>0?g.join(",")||null:void 0}];else if(ke(c))A=c;else{var P=Object.keys(g);A=u?P.sort(u):P}var R=l?e.replace(/\./g,"%2E"):e,b=s&&ke(g)&&g.length===1?R+"[]":R;if(n&&ke(g)&&g.length===0)return b+"[]";for(var M=0;M<A.length;++M){var S=A[M],U=typeof S=="object"&&typeof S.value<"u"?S.value:g[S];if(!(a&&U===null)){var L=d&&l?S.replace(/\./g,"%2E"):S,H=ke(g)?typeof i=="function"?i(b,L):b:b+(d?"."+L:"["+L+"]");x.set(t,w);var tt=Qc();tt.set(pa,x),eu(D,r(U,H,i,s,n,o,a,l,i==="comma"&&_&&ke(g)?null:h,c,u,d,f,p,m,_,y,tt))}}return D},T_=function(t){if(!t)return Lt;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");var e=t.charset||Lt.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var i=as.default;if(typeof t.format<"u"){if(!v_.call(as.formatters,t.format))throw new TypeError("Unknown format option provided.");i=t.format}var s=as.formatters[i],n=Lt.filter;(typeof t.filter=="function"||ke(t.filter))&&(n=t.filter);var o;if(t.arrayFormat in tu?o=t.arrayFormat:"indices"in t?o=t.indices?"indices":"repeat":o=Lt.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var a=typeof t.allowDots>"u"?t.encodeDotInKeys===!0?!0:Lt.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:Lt.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Lt.allowEmptyArrays,arrayFormat:o,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Lt.charsetSentinel,commaRoundTrip:t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?Lt.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:Lt.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:Lt.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:Lt.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:Lt.encodeValuesOnly,filter:n,format:i,formatter:s,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:Lt.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:Lt.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Lt.strictNullHandling}},A_=function(r,t){var e=r,i=T_(t),s,n;typeof i.filter=="function"?(n=i.filter,e=n("",e)):ke(i.filter)&&(n=i.filter,s=n);var o=[];if(typeof e!="object"||e===null)return"";var a=tu[i.arrayFormat],l=a==="comma"&&i.commaRoundTrip;s||(s=Object.keys(e)),i.sort&&s.sort(i.sort);for(var h=Qc(),c=0;c<s.length;++c){var u=s[c];i.skipNulls&&e[u]===null||eu(o,E_(e[u],u,a,l,i.allowEmptyArrays,i.strictNullHandling,i.skipNulls,i.encodeDotInKeys,i.encode?i.encoder:null,i.filter,i.sort,i.allowDots,i.serializeDate,i.format,i.formatter,i.encodeValuesOnly,i.charset,h))}var d=o.join(i.delimiter),f=i.addQueryPrefix===!0?"?":"";return i.charsetSentinel&&(i.charset==="iso-8859-1"?f+="utf8=%26%2310003%3B&":f+="utf8=%E2%9C%93&"),d.length>0?f+d:""},wi=Jc,ma=Object.prototype.hasOwnProperty,S_=Array.isArray,Pt={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:wi.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1},C_=function(r){return r.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},iu=function(r,t){return r&&typeof r=="string"&&t.comma&&r.indexOf(",")>-1?r.split(","):r},I_="utf8=%26%2310003%3B",R_="utf8=%E2%9C%93",P_=function(t,e){var i={__proto__:null},s=e.ignoreQueryPrefix?t.replace(/^\?/,""):t;s=s.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var n=e.parameterLimit===1/0?void 0:e.parameterLimit,o=s.split(e.delimiter,n),a=-1,l,h=e.charset;if(e.charsetSentinel)for(l=0;l<o.length;++l)o[l].indexOf("utf8=")===0&&(o[l]===R_?h="utf-8":o[l]===I_&&(h="iso-8859-1"),a=l,l=o.length);for(l=0;l<o.length;++l)if(l!==a){var c=o[l],u=c.indexOf("]="),d=u===-1?c.indexOf("="):u+1,f,p;d===-1?(f=e.decoder(c,Pt.decoder,h,"key"),p=e.strictNullHandling?null:""):(f=e.decoder(c.slice(0,d),Pt.decoder,h,"key"),p=wi.maybeMap(iu(c.slice(d+1),e),function(_){return e.decoder(_,Pt.decoder,h,"value")})),p&&e.interpretNumericEntities&&h==="iso-8859-1"&&(p=C_(p)),c.indexOf("[]=")>-1&&(p=S_(p)?[p]:p);var m=ma.call(i,f);m&&e.duplicates==="combine"?i[f]=wi.combine(i[f],p):(!m||e.duplicates==="last")&&(i[f]=p)}return i},M_=function(r,t,e,i){for(var s=i?t:iu(t,e),n=r.length-1;n>=0;--n){var o,a=r[n];if(a==="[]"&&e.parseArrays)o=e.allowEmptyArrays&&(s===""||e.strictNullHandling&&s===null)?[]:[].concat(s);else{o=e.plainObjects?Object.create(null):{};var l=a.charAt(0)==="["&&a.charAt(a.length-1)==="]"?a.slice(1,-1):a,h=e.decodeDotInKeys?l.replace(/%2E/g,"."):l,c=parseInt(h,10);!e.parseArrays&&h===""?o={0:s}:!isNaN(c)&&a!==h&&String(c)===h&&c>=0&&e.parseArrays&&c<=e.arrayLimit?(o=[],o[c]=s):h!=="__proto__"&&(o[h]=s)}s=o}return s},B_=function(t,e,i,s){if(t){var n=i.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,o=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,l=i.depth>0&&o.exec(n),h=l?n.slice(0,l.index):n,c=[];if(h){if(!i.plainObjects&&ma.call(Object.prototype,h)&&!i.allowPrototypes)return;c.push(h)}for(var u=0;i.depth>0&&(l=a.exec(n))!==null&&u<i.depth;){if(u+=1,!i.plainObjects&&ma.call(Object.prototype,l[1].slice(1,-1))&&!i.allowPrototypes)return;c.push(l[1])}if(l){if(i.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+i.depth+" and strictDepth is true");c.push("["+n.slice(l.index)+"]")}return M_(c,e,i,s)}},D_=function(t){if(!t)return Pt;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.decodeDotInKeys<"u"&&typeof t.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(t.decoder!==null&&typeof t.decoder<"u"&&typeof t.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var e=typeof t.charset>"u"?Pt.charset:t.charset,i=typeof t.duplicates>"u"?Pt.duplicates:t.duplicates;if(i!=="combine"&&i!=="first"&&i!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var s=typeof t.allowDots>"u"?t.decodeDotInKeys===!0?!0:Pt.allowDots:!!t.allowDots;return{allowDots:s,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Pt.allowEmptyArrays,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:Pt.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:Pt.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:Pt.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Pt.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:Pt.comma,decodeDotInKeys:typeof t.decodeDotInKeys=="boolean"?t.decodeDotInKeys:Pt.decodeDotInKeys,decoder:typeof t.decoder=="function"?t.decoder:Pt.decoder,delimiter:typeof t.delimiter=="string"||wi.isRegExp(t.delimiter)?t.delimiter:Pt.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:Pt.depth,duplicates:i,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:Pt.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:Pt.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:Pt.plainObjects,strictDepth:typeof t.strictDepth=="boolean"?!!t.strictDepth:Pt.strictDepth,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Pt.strictNullHandling}},O_=function(r,t){var e=D_(t);if(r===""||r===null||typeof r>"u")return e.plainObjects?Object.create(null):{};for(var i=typeof r=="string"?P_(r,e):r,s=e.plainObjects?Object.create(null):{},n=Object.keys(i),o=0;o<n.length;++o){var a=n[o],l=B_(a,i[a],e,typeof r=="string");s=wi.merge(s,l,e)}return e.allowSparse===!0?s:wi.compact(s)},F_=A_,L_=O_,N_=ua,U_={formats:N_,parse:L_,stringify:F_},k_=wy;function sr(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var G_=/^([a-z0-9.+-]+:)/i,$_=/:[0-9]*$/,H_=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,X_=["<",">",'"',"`"," ","\r",`
5
+ `," "],V_=["{","}","|","\\","^","`"].concat(X_),ga=["'"].concat(V_),su=["%","/","?",";","#"].concat(ga),nu=["/","?","#"],z_=255,ou=/^[+a-z0-9A-Z_-]{0,63}$/,W_=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,j_={javascript:!0,"javascript:":!0},ya={javascript:!0,"javascript:":!0},Ei={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},_a=U_;function Y_(r,t,e){if(r&&typeof r=="object"&&r instanceof sr)return r;var i=new sr;return i.parse(r,t,e),i}sr.prototype.parse=function(r,t,e){if(typeof r!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof r);var i=r.indexOf("?"),s=i!==-1&&i<r.indexOf("#")?"?":"#",n=r.split(s),o=/\\/g;n[0]=n[0].replace(o,"/"),r=n.join(s);var a=r;if(a=a.trim(),!e&&r.split("#").length===1){var l=H_.exec(a);if(l)return this.path=a,this.href=a,this.pathname=l[1],l[2]?(this.search=l[2],t?this.query=_a.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var h=G_.exec(a);if(h){h=h[0];var c=h.toLowerCase();this.protocol=c,a=a.substr(h.length)}if(e||h||a.match(/^\/\/[^@/]+@[^@/]+/)){var u=a.substr(0,2)==="//";u&&!(h&&ya[h])&&(a=a.substr(2),this.slashes=!0)}if(!ya[h]&&(u||h&&!Ei[h])){for(var d=-1,f=0;f<nu.length;f++){var p=a.indexOf(nu[f]);p!==-1&&(d===-1||p<d)&&(d=p)}var m,_;d===-1?_=a.lastIndexOf("@"):_=a.lastIndexOf("@",d),_!==-1&&(m=a.slice(0,_),a=a.slice(_+1),this.auth=decodeURIComponent(m)),d=-1;for(var f=0;f<su.length;f++){var p=a.indexOf(su[f]);p!==-1&&(d===-1||p<d)&&(d=p)}d===-1&&(d=a.length),this.host=a.slice(0,d),a=a.slice(d),this.parseHost(),this.hostname=this.hostname||"";var y=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!y)for(var x=this.hostname.split(/\./),f=0,g=x.length;f<g;f++){var v=x[f];if(v&&!v.match(ou)){for(var w="",I=0,T=v.length;I<T;I++)v.charCodeAt(I)>127?w+="x":w+=v[I];if(!w.match(ou)){var C=x.slice(0,f),D=x.slice(f+1),A=v.match(W_);A&&(C.push(A[1]),D.unshift(A[2])),D.length&&(a="/"+D.join(".")+a),this.hostname=C.join(".");break}}}this.hostname.length>z_?this.hostname="":this.hostname=this.hostname.toLowerCase(),y||(this.hostname=k_.toASCII(this.hostname));var P=this.port?":"+this.port:"",R=this.hostname||"";this.host=R+P,this.href+=this.host,y&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!j_[c])for(var f=0,g=ga.length;f<g;f++){var b=ga[f];if(a.indexOf(b)!==-1){var M=encodeURIComponent(b);M===b&&(M=escape(b)),a=a.split(b).join(M)}}var S=a.indexOf("#");S!==-1&&(this.hash=a.substr(S),a=a.slice(0,S));var U=a.indexOf("?");if(U!==-1?(this.search=a.substr(U),this.query=a.substr(U+1),t&&(this.query=_a.parse(this.query)),a=a.slice(0,U)):t&&(this.search="",this.query={}),a&&(this.pathname=a),Ei[c]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var P=this.pathname||"",L=this.search||"";this.path=P+L}return this.href=this.format(),this},sr.prototype.format=function(){var r=this.auth||"";r&&(r=encodeURIComponent(r),r=r.replace(/%3A/i,":"),r+="@");var t=this.protocol||"",e=this.pathname||"",i=this.hash||"",s=!1,n="";this.host?s=r+this.host:this.hostname&&(s=r+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(s+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(n=_a.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var o=this.search||n&&"?"+n||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||Ei[t])&&s!==!1?(s="//"+(s||""),e&&e.charAt(0)!=="/"&&(e="/"+e)):s||(s=""),i&&i.charAt(0)!=="#"&&(i="#"+i),o&&o.charAt(0)!=="?"&&(o="?"+o),e=e.replace(/[?#]/g,function(a){return encodeURIComponent(a)}),o=o.replace("#","%23"),t+s+e+o+i},sr.prototype.resolve=function(r){return this.resolveObject(Y_(r,!1,!0)).format()},sr.prototype.resolveObject=function(r){if(typeof r=="string"){var t=new sr;t.parse(r,!1,!0),r=t}for(var e=new sr,i=Object.keys(this),s=0;s<i.length;s++){var n=i[s];e[n]=this[n]}if(e.hash=r.hash,r.href==="")return e.href=e.format(),e;if(r.slashes&&!r.protocol){for(var o=Object.keys(r),a=0;a<o.length;a++){var l=o[a];l!=="protocol"&&(e[l]=r[l])}return Ei[e.protocol]&&e.hostname&&!e.pathname&&(e.pathname="/",e.path=e.pathname),e.href=e.format(),e}if(r.protocol&&r.protocol!==e.protocol){if(!Ei[r.protocol]){for(var h=Object.keys(r),c=0;c<h.length;c++){var u=h[c];e[u]=r[u]}return e.href=e.format(),e}if(e.protocol=r.protocol,!r.host&&!ya[r.protocol]){for(var g=(r.pathname||"").split("/");g.length&&!(r.host=g.shift()););r.host||(r.host=""),r.hostname||(r.hostname=""),g[0]!==""&&g.unshift(""),g.length<2&&g.unshift(""),e.pathname=g.join("/")}else e.pathname=r.pathname;if(e.search=r.search,e.query=r.query,e.host=r.host||"",e.auth=r.auth,e.hostname=r.hostname||r.host,e.port=r.port,e.pathname||e.search){var d=e.pathname||"",f=e.search||"";e.path=d+f}return e.slashes=e.slashes||r.slashes,e.href=e.format(),e}var p=e.pathname&&e.pathname.charAt(0)==="/",m=r.host||r.pathname&&r.pathname.charAt(0)==="/",_=m||p||e.host&&r.pathname,y=_,x=e.pathname&&e.pathname.split("/")||[],g=r.pathname&&r.pathname.split("/")||[],v=e.protocol&&!Ei[e.protocol];if(v&&(e.hostname="",e.port=null,e.host&&(x[0]===""?x[0]=e.host:x.unshift(e.host)),e.host="",r.protocol&&(r.hostname=null,r.port=null,r.host&&(g[0]===""?g[0]=r.host:g.unshift(r.host)),r.host=null),_=_&&(g[0]===""||x[0]==="")),m)e.host=r.host||r.host===""?r.host:e.host,e.hostname=r.hostname||r.hostname===""?r.hostname:e.hostname,e.search=r.search,e.query=r.query,x=g;else if(g.length)x||(x=[]),x.pop(),x=x.concat(g),e.search=r.search,e.query=r.query;else if(r.search!=null){if(v){e.host=x.shift(),e.hostname=e.host;var w=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;w&&(e.auth=w.shift(),e.hostname=w.shift(),e.host=e.hostname)}return e.search=r.search,e.query=r.query,(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.href=e.format(),e}if(!x.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var I=x.slice(-1)[0],T=(e.host||r.host||x.length>1)&&(I==="."||I==="..")||I==="",C=0,D=x.length;D>=0;D--)I=x[D],I==="."?x.splice(D,1):I===".."?(x.splice(D,1),C++):C&&(x.splice(D,1),C--);if(!_&&!y)for(;C--;C)x.unshift("..");_&&x[0]!==""&&(!x[0]||x[0].charAt(0)!=="/")&&x.unshift(""),T&&x.join("/").substr(-1)!=="/"&&x.push("");var A=x[0]===""||x[0]&&x[0].charAt(0)==="/";if(v){e.hostname=A?"":x.length?x.shift():"",e.host=e.hostname;var w=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;w&&(e.auth=w.shift(),e.hostname=w.shift(),e.host=e.hostname)}return _=_||e.host&&x.length,_&&!A&&x.unshift(""),x.length>0?e.pathname=x.join("/"):(e.pathname=null,e.path=null),(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.auth=r.auth||e.auth,e.slashes=e.slashes||r.slashes,e.href=e.format(),e},sr.prototype.parseHost=function(){var r=this.host,t=$_.exec(r);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),r=r.substr(0,r.length-t.length)),r&&(this.hostname=r)};const au={};function lt(r,t,e=3){if(au[t])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
6
+ Deprecated since v${r}`):(i=i.split(`
38
7
  `).splice(e).join(`
39
- `),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",t+`
40
- Deprecated since v`+r),console.warn(n),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",t+`
41
- Deprecated since v`+r),console.warn(n))),yh[t]=!0}}var bh={},Oe=Object.create(null),ir=Object.create(null),xh=function(){function r(t,e,n){this.canvas=k.ADAPTER.createCanvas(),this.context=this.canvas.getContext("2d"),this.resolution=n||k.RESOLUTION,this.resize(t,e)}return r.prototype.clear=function(){this.context.setTransform(1,0,0,1,0,0),this.context.clearRect(0,0,this.canvas.width,this.canvas.height)},r.prototype.resize=function(t,e){this.canvas.width=Math.round(t*this.resolution),this.canvas.height=Math.round(e*this.resolution)},r.prototype.destroy=function(){this.context=null,this.canvas=null},Object.defineProperty(r.prototype,"width",{get:function(){return this.canvas.width},set:function(t){this.canvas.width=Math.round(t)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"height",{get:function(){return this.canvas.height},set:function(t){this.canvas.height=Math.round(t)},enumerable:!1,configurable:!0}),r}();function Kg(r){var t=r.width,e=r.height,n=r.getContext("2d",{willReadFrequently:!0}),i=n.getImageData(0,0,t,e),o=i.data,a=o.length,s={top:null,left:null,right:null,bottom:null},u=null,h,l,f;for(h=0;h<a;h+=4)o[h+3]!==0&&(l=h/4%t,f=~~(h/4/t),s.top===null&&(s.top=f),(s.left===null||l<s.left)&&(s.left=l),(s.right===null||s.right<l)&&(s.right=l+1),(s.bottom===null||s.bottom<f)&&(s.bottom=f));return s.top!==null&&(t=s.right-s.left,e=s.bottom-s.top+1,u=n.getImageData(s.left,s.top,t,e)),{height:e,width:t,data:u}}var hi;function Zg(r,t){if(t===void 0&&(t=globalThis.location),r.indexOf("data:")===0)return"";t=t||globalThis.location,hi||(hi=document.createElement("a")),hi.href=r;var e=Lr.parse(hi.href),n=!e.port&&t.port===""||e.port===t.port;return e.hostname!==t.hostname||!n||e.protocol!==t.protocol?"anonymous":""}function li(r,t){var e=k.RETINA_PREFIX.exec(r);return e?parseFloat(e[1]):t!==void 0?t:1}/*!
42
- * @pixi/math - v6.5.10
43
- * Compiled Thu, 06 Jul 2023 15:25:11 UTC
44
- *
45
- * @pixi/math is licensed under the MIT License.
46
- * http://www.opensource.org/licenses/mit-license
47
- */var fi=Math.PI*2,Jg=180/Math.PI,Qg=Math.PI/180,Nt;(function(r){r[r.POLY=0]="POLY",r[r.RECT=1]="RECT",r[r.CIRC=2]="CIRC",r[r.ELIP=3]="ELIP",r[r.RREC=4]="RREC"})(Nt||(Nt={}));var Et=function(){function r(t,e){t===void 0&&(t=0),e===void 0&&(e=0),this.x=0,this.y=0,this.x=t,this.y=e}return r.prototype.clone=function(){return new r(this.x,this.y)},r.prototype.copyFrom=function(t){return this.set(t.x,t.y),this},r.prototype.copyTo=function(t){return t.set(this.x,this.y),t},r.prototype.equals=function(t){return t.x===this.x&&t.y===this.y},r.prototype.set=function(t,e){return t===void 0&&(t=0),e===void 0&&(e=t),this.x=t,this.y=e,this},r.prototype.toString=function(){return"[@pixi/math:Point x="+this.x+" y="+this.y+"]"},r}(),ci=[new Et,new Et,new Et,new Et],st=function(){function r(t,e,n,i){t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0),i===void 0&&(i=0),this.x=Number(t),this.y=Number(e),this.width=Number(n),this.height=Number(i),this.type=Nt.RECT}return Object.defineProperty(r.prototype,"left",{get:function(){return this.x},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"right",{get:function(){return this.x+this.width},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"top",{get:function(){return this.y},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!1,configurable:!0}),Object.defineProperty(r,"EMPTY",{get:function(){return new r(0,0,0,0)},enumerable:!1,configurable:!0}),r.prototype.clone=function(){return new r(this.x,this.y,this.width,this.height)},r.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this},r.prototype.copyTo=function(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t},r.prototype.contains=function(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},r.prototype.intersects=function(t,e){if(!e){var n=this.x<t.x?t.x:this.x,i=this.right>t.right?t.right:this.right;if(i<=n)return!1;var o=this.y<t.y?t.y:this.y,a=this.bottom>t.bottom?t.bottom:this.bottom;return a>o}var s=this.left,u=this.right,h=this.top,l=this.bottom;if(u<=s||l<=h)return!1;var f=ci[0].set(t.left,t.top),c=ci[1].set(t.left,t.bottom),d=ci[2].set(t.right,t.top),p=ci[3].set(t.right,t.bottom);if(d.x<=f.x||c.y<=f.y)return!1;var v=Math.sign(e.a*e.d-e.b*e.c);if(v===0||(e.apply(f,f),e.apply(c,c),e.apply(d,d),e.apply(p,p),Math.max(f.x,c.x,d.x,p.x)<=s||Math.min(f.x,c.x,d.x,p.x)>=u||Math.max(f.y,c.y,d.y,p.y)<=h||Math.min(f.y,c.y,d.y,p.y)>=l))return!1;var _=v*(c.y-f.y),m=v*(f.x-c.x),g=_*s+m*h,y=_*u+m*h,E=_*s+m*l,b=_*u+m*l;if(Math.max(g,y,E,b)<=_*f.x+m*f.y||Math.min(g,y,E,b)>=_*p.x+m*p.y)return!1;var S=v*(f.y-d.y),P=v*(d.x-f.x),T=S*s+P*h,x=S*u+P*h,w=S*s+P*l,O=S*u+P*l;return!(Math.max(T,x,w,O)<=S*f.x+P*f.y||Math.min(T,x,w,O)>=S*p.x+P*p.y)},r.prototype.pad=function(t,e){return t===void 0&&(t=0),e===void 0&&(e=t),this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this},r.prototype.fit=function(t){var e=Math.max(this.x,t.x),n=Math.min(this.x+this.width,t.x+t.width),i=Math.max(this.y,t.y),o=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(n-e,0),this.y=i,this.height=Math.max(o-i,0),this},r.prototype.ceil=function(t,e){t===void 0&&(t=1),e===void 0&&(e=.001);var n=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=n-this.x,this.height=i-this.y,this},r.prototype.enlarge=function(t){var e=Math.min(this.x,t.x),n=Math.max(this.x+this.width,t.x+t.width),i=Math.min(this.y,t.y),o=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=n-e,this.y=i,this.height=o-i,this},r.prototype.toString=function(){return"[@pixi/math:Rectangle x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+"]"},r}(),ty=function(){function r(t,e,n){t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0),this.x=t,this.y=e,this.radius=n,this.type=Nt.CIRC}return r.prototype.clone=function(){return new r(this.x,this.y,this.radius)},r.prototype.contains=function(t,e){if(this.radius<=0)return!1;var n=this.radius*this.radius,i=this.x-t,o=this.y-e;return i*=i,o*=o,i+o<=n},r.prototype.getBounds=function(){return new st(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)},r.prototype.toString=function(){return"[@pixi/math:Circle x="+this.x+" y="+this.y+" radius="+this.radius+"]"},r}(),ey=function(){function r(t,e,n,i){t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0),i===void 0&&(i=0),this.x=t,this.y=e,this.width=n,this.height=i,this.type=Nt.ELIP}return r.prototype.clone=function(){return new r(this.x,this.y,this.width,this.height)},r.prototype.contains=function(t,e){if(this.width<=0||this.height<=0)return!1;var n=(t-this.x)/this.width,i=(e-this.y)/this.height;return n*=n,i*=i,n+i<=1},r.prototype.getBounds=function(){return new st(this.x-this.width,this.y-this.height,this.width,this.height)},r.prototype.toString=function(){return"[@pixi/math:Ellipse x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+"]"},r}(),di=function(){function r(){for(var t=arguments,e=[],n=0;n<arguments.length;n++)e[n]=t[n];var i=Array.isArray(e[0])?e[0]:e;if(typeof i[0]!="number"){for(var o=[],a=0,s=i.length;a<s;a++)o.push(i[a].x,i[a].y);i=o}this.points=i,this.type=Nt.POLY,this.closeStroke=!0}return r.prototype.clone=function(){var t=this.points.slice(),e=new r(t);return e.closeStroke=this.closeStroke,e},r.prototype.contains=function(t,e){for(var n=!1,i=this.points.length/2,o=0,a=i-1;o<i;a=o++){var s=this.points[o*2],u=this.points[o*2+1],h=this.points[a*2],l=this.points[a*2+1],f=u>e!=l>e&&t<(h-s)*((e-u)/(l-u))+s;f&&(n=!n)}return n},r.prototype.toString=function(){return"[@pixi/math:Polygon"+("closeStroke="+this.closeStroke)+("points="+this.points.reduce(function(t,e){return t+", "+e},"")+"]")},r}(),ry=function(){function r(t,e,n,i,o){t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0),i===void 0&&(i=0),o===void 0&&(o=20),this.x=t,this.y=e,this.width=n,this.height=i,this.radius=o,this.type=Nt.RREC}return r.prototype.clone=function(){return new r(this.x,this.y,this.width,this.height,this.radius)},r.prototype.contains=function(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){var n=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+n&&e<=this.y+this.height-n||t>=this.x+n&&t<=this.x+this.width-n)return!0;var i=t-(this.x+n),o=e-(this.y+n),a=n*n;if(i*i+o*o<=a||(i=t-(this.x+this.width-n),i*i+o*o<=a)||(o=e-(this.y+this.height-n),i*i+o*o<=a)||(i=t-(this.x+n),i*i+o*o<=a))return!0}return!1},r.prototype.toString=function(){return"[@pixi/math:RoundedRectangle x="+this.x+" y="+this.y+("width="+this.width+" height="+this.height+" radius="+this.radius+"]")},r}(),Xr=function(){function r(t,e,n,i){n===void 0&&(n=0),i===void 0&&(i=0),this._x=n,this._y=i,this.cb=t,this.scope=e}return r.prototype.clone=function(t,e){return t===void 0&&(t=this.cb),e===void 0&&(e=this.scope),new r(t,e,this._x,this._y)},r.prototype.set=function(t,e){return t===void 0&&(t=0),e===void 0&&(e=t),(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this.cb.call(this.scope)),this},r.prototype.copyFrom=function(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this},r.prototype.copyTo=function(t){return t.set(this._x,this._y),t},r.prototype.equals=function(t){return t.x===this._x&&t.y===this._y},r.prototype.toString=function(){return"[@pixi/math:ObservablePoint x=0 y=0 scope="+this.scope+"]"},Object.defineProperty(r.prototype,"x",{get:function(){return this._x},set:function(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"y",{get:function(){return this._y},set:function(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),r}(),Mt=function(){function r(t,e,n,i,o,a){t===void 0&&(t=1),e===void 0&&(e=0),n===void 0&&(n=0),i===void 0&&(i=1),o===void 0&&(o=0),a===void 0&&(a=0),this.array=null,this.a=t,this.b=e,this.c=n,this.d=i,this.tx=o,this.ty=a}return r.prototype.fromArray=function(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]},r.prototype.set=function(t,e,n,i,o,a){return this.a=t,this.b=e,this.c=n,this.d=i,this.tx=o,this.ty=a,this},r.prototype.toArray=function(t,e){this.array||(this.array=new Float32Array(9));var n=e||this.array;return t?(n[0]=this.a,n[1]=this.b,n[2]=0,n[3]=this.c,n[4]=this.d,n[5]=0,n[6]=this.tx,n[7]=this.ty,n[8]=1):(n[0]=this.a,n[1]=this.c,n[2]=this.tx,n[3]=this.b,n[4]=this.d,n[5]=this.ty,n[6]=0,n[7]=0,n[8]=1),n},r.prototype.apply=function(t,e){e=e||new Et;var n=t.x,i=t.y;return e.x=this.a*n+this.c*i+this.tx,e.y=this.b*n+this.d*i+this.ty,e},r.prototype.applyInverse=function(t,e){e=e||new Et;var n=1/(this.a*this.d+this.c*-this.b),i=t.x,o=t.y;return e.x=this.d*n*i+-this.c*n*o+(this.ty*this.c-this.tx*this.d)*n,e.y=this.a*n*o+-this.b*n*i+(-this.ty*this.a+this.tx*this.b)*n,e},r.prototype.translate=function(t,e){return this.tx+=t,this.ty+=e,this},r.prototype.scale=function(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this},r.prototype.rotate=function(t){var e=Math.cos(t),n=Math.sin(t),i=this.a,o=this.c,a=this.tx;return this.a=i*e-this.b*n,this.b=i*n+this.b*e,this.c=o*e-this.d*n,this.d=o*n+this.d*e,this.tx=a*e-this.ty*n,this.ty=a*n+this.ty*e,this},r.prototype.append=function(t){var e=this.a,n=this.b,i=this.c,o=this.d;return this.a=t.a*e+t.b*i,this.b=t.a*n+t.b*o,this.c=t.c*e+t.d*i,this.d=t.c*n+t.d*o,this.tx=t.tx*e+t.ty*i+this.tx,this.ty=t.tx*n+t.ty*o+this.ty,this},r.prototype.setTransform=function(t,e,n,i,o,a,s,u,h){return this.a=Math.cos(s+h)*o,this.b=Math.sin(s+h)*o,this.c=-Math.sin(s-u)*a,this.d=Math.cos(s-u)*a,this.tx=t-(n*this.a+i*this.c),this.ty=e-(n*this.b+i*this.d),this},r.prototype.prepend=function(t){var e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){var n=this.a,i=this.c;this.a=n*t.a+this.b*t.c,this.b=n*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},r.prototype.decompose=function(t){var e=this.a,n=this.b,i=this.c,o=this.d,a=t.pivot,s=-Math.atan2(-i,o),u=Math.atan2(n,e),h=Math.abs(s+u);return h<1e-5||Math.abs(fi-h)<1e-5?(t.rotation=u,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=s,t.skew.y=u),t.scale.x=Math.sqrt(e*e+n*n),t.scale.y=Math.sqrt(i*i+o*o),t.position.x=this.tx+(a.x*e+a.y*i),t.position.y=this.ty+(a.x*n+a.y*o),t},r.prototype.invert=function(){var t=this.a,e=this.b,n=this.c,i=this.d,o=this.tx,a=t*i-e*n;return this.a=i/a,this.b=-e/a,this.c=-n/a,this.d=t/a,this.tx=(n*this.ty-i*o)/a,this.ty=-(t*this.ty-e*o)/a,this},r.prototype.identity=function(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this},r.prototype.clone=function(){var t=new r;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},r.prototype.copyTo=function(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},r.prototype.copyFrom=function(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},r.prototype.toString=function(){return"[@pixi/math:Matrix a="+this.a+" b="+this.b+" c="+this.c+" d="+this.d+" tx="+this.tx+" ty="+this.ty+"]"},Object.defineProperty(r,"IDENTITY",{get:function(){return new r},enumerable:!1,configurable:!0}),Object.defineProperty(r,"TEMP_MATRIX",{get:function(){return new r},enumerable:!1,configurable:!0}),r}(),or=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],ar=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],sr=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],ur=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],ra=[],Eh=[],pi=Math.sign;function ny(){for(var r=0;r<16;r++){var t=[];ra.push(t);for(var e=0;e<16;e++)for(var n=pi(or[r]*or[e]+sr[r]*ar[e]),i=pi(ar[r]*or[e]+ur[r]*ar[e]),o=pi(or[r]*sr[e]+sr[r]*ur[e]),a=pi(ar[r]*sr[e]+ur[r]*ur[e]),s=0;s<16;s++)if(or[s]===n&&ar[s]===i&&sr[s]===o&&ur[s]===a){t.push(s);break}}for(var r=0;r<16;r++){var u=new Mt;u.set(or[r],ar[r],sr[r],ur[r],0,0),Eh.push(u)}}ny();var Pt={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:function(r){return or[r]},uY:function(r){return ar[r]},vX:function(r){return sr[r]},vY:function(r){return ur[r]},inv:function(r){return r&8?r&15:-r&7},add:function(r,t){return ra[r][t]},sub:function(r,t){return ra[r][Pt.inv(t)]},rotate180:function(r){return r^4},isVertical:function(r){return(r&3)===2},byDirection:function(r,t){return Math.abs(r)*2<=Math.abs(t)?t>=0?Pt.S:Pt.N:Math.abs(t)*2<=Math.abs(r)?r>0?Pt.E:Pt.W:t>0?r>0?Pt.SE:Pt.SW:r>0?Pt.NE:Pt.NW},matrixAppendRotationInv:function(r,t,e,n){e===void 0&&(e=0),n===void 0&&(n=0);var i=Eh[Pt.inv(t)];i.tx=e,i.ty=n,r.append(i)}},Th=function(){function r(){this.worldTransform=new Mt,this.localTransform=new Mt,this.position=new Xr(this.onChange,this,0,0),this.scale=new Xr(this.onChange,this,1,1),this.pivot=new Xr(this.onChange,this,0,0),this.skew=new Xr(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}return r.prototype.onChange=function(){this._localID++},r.prototype.updateSkew=function(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++},r.prototype.toString=function(){return"[@pixi/math:Transform "+("position=("+this.position.x+", "+this.position.y+") ")+("rotation="+this.rotation+" ")+("scale=("+this.scale.x+", "+this.scale.y+") ")+("skew=("+this.skew.x+", "+this.skew.y+") ")+"]"},r.prototype.updateLocalTransform=function(){var t=this.localTransform;this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1)},r.prototype.updateTransform=function(t){var e=this.localTransform;if(this._localID!==this._currentLocalID&&(e.a=this._cx*this.scale.x,e.b=this._sx*this.scale.x,e.c=this._cy*this.scale.y,e.d=this._sy*this.scale.y,e.tx=this.position.x-(this.pivot.x*e.a+this.pivot.y*e.c),e.ty=this.position.y-(this.pivot.x*e.b+this.pivot.y*e.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==t._worldID){var n=t.worldTransform,i=this.worldTransform;i.a=e.a*n.a+e.b*n.c,i.b=e.a*n.b+e.b*n.d,i.c=e.c*n.a+e.d*n.c,i.d=e.c*n.b+e.d*n.d,i.tx=e.tx*n.a+e.ty*n.c+n.tx,i.ty=e.tx*n.b+e.ty*n.d+n.ty,this._parentID=t._worldID,this._worldID++}},r.prototype.setFromMatrix=function(t){t.decompose(this),this._localID++},Object.defineProperty(r.prototype,"rotation",{get:function(){return this._rotation},set:function(t){this._rotation!==t&&(this._rotation=t,this.updateSkew())},enumerable:!1,configurable:!0}),r.IDENTITY=new r,r}();/*!
48
- * @pixi/display - v6.5.10
49
- * Compiled Thu, 06 Jul 2023 15:25:11 UTC
50
- *
51
- * @pixi/display is licensed under the MIT License.
52
- * http://www.opensource.org/licenses/mit-license
53
- */k.SORTABLE_CHILDREN=!1;var vi=function(){function r(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}return r.prototype.isEmpty=function(){return this.minX>this.maxX||this.minY>this.maxY},r.prototype.clear=function(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0},r.prototype.getRectangle=function(t){return this.minX>this.maxX||this.minY>this.maxY?st.EMPTY:(t=t||new st(0,0,1,1),t.x=this.minX,t.y=this.minY,t.width=this.maxX-this.minX,t.height=this.maxY-this.minY,t)},r.prototype.addPoint=function(t){this.minX=Math.min(this.minX,t.x),this.maxX=Math.max(this.maxX,t.x),this.minY=Math.min(this.minY,t.y),this.maxY=Math.max(this.maxY,t.y)},r.prototype.addPointMatrix=function(t,e){var n=t.a,i=t.b,o=t.c,a=t.d,s=t.tx,u=t.ty,h=n*e.x+o*e.y+s,l=i*e.x+a*e.y+u;this.minX=Math.min(this.minX,h),this.maxX=Math.max(this.maxX,h),this.minY=Math.min(this.minY,l),this.maxY=Math.max(this.maxY,l)},r.prototype.addQuad=function(t){var e=this.minX,n=this.minY,i=this.maxX,o=this.maxY,a=t[0],s=t[1];e=a<e?a:e,n=s<n?s:n,i=a>i?a:i,o=s>o?s:o,a=t[2],s=t[3],e=a<e?a:e,n=s<n?s:n,i=a>i?a:i,o=s>o?s:o,a=t[4],s=t[5],e=a<e?a:e,n=s<n?s:n,i=a>i?a:i,o=s>o?s:o,a=t[6],s=t[7],e=a<e?a:e,n=s<n?s:n,i=a>i?a:i,o=s>o?s:o,this.minX=e,this.minY=n,this.maxX=i,this.maxY=o},r.prototype.addFrame=function(t,e,n,i,o){this.addFrameMatrix(t.worldTransform,e,n,i,o)},r.prototype.addFrameMatrix=function(t,e,n,i,o){var a=t.a,s=t.b,u=t.c,h=t.d,l=t.tx,f=t.ty,c=this.minX,d=this.minY,p=this.maxX,v=this.maxY,_=a*e+u*n+l,m=s*e+h*n+f;c=_<c?_:c,d=m<d?m:d,p=_>p?_:p,v=m>v?m:v,_=a*i+u*n+l,m=s*i+h*n+f,c=_<c?_:c,d=m<d?m:d,p=_>p?_:p,v=m>v?m:v,_=a*e+u*o+l,m=s*e+h*o+f,c=_<c?_:c,d=m<d?m:d,p=_>p?_:p,v=m>v?m:v,_=a*i+u*o+l,m=s*i+h*o+f,c=_<c?_:c,d=m<d?m:d,p=_>p?_:p,v=m>v?m:v,this.minX=c,this.minY=d,this.maxX=p,this.maxY=v},r.prototype.addVertexData=function(t,e,n){for(var i=this.minX,o=this.minY,a=this.maxX,s=this.maxY,u=e;u<n;u+=2){var h=t[u],l=t[u+1];i=h<i?h:i,o=l<o?l:o,a=h>a?h:a,s=l>s?l:s}this.minX=i,this.minY=o,this.maxX=a,this.maxY=s},r.prototype.addVertices=function(t,e,n,i){this.addVerticesMatrix(t.worldTransform,e,n,i)},r.prototype.addVerticesMatrix=function(t,e,n,i,o,a){o===void 0&&(o=0),a===void 0&&(a=o);for(var s=t.a,u=t.b,h=t.c,l=t.d,f=t.tx,c=t.ty,d=this.minX,p=this.minY,v=this.maxX,_=this.maxY,m=n;m<i;m+=2){var g=e[m],y=e[m+1],E=s*g+h*y+f,b=l*y+u*g+c;d=Math.min(d,E-o),v=Math.max(v,E+o),p=Math.min(p,b-a),_=Math.max(_,b+a)}this.minX=d,this.minY=p,this.maxX=v,this.maxY=_},r.prototype.addBounds=function(t){var e=this.minX,n=this.minY,i=this.maxX,o=this.maxY;this.minX=t.minX<e?t.minX:e,this.minY=t.minY<n?t.minY:n,this.maxX=t.maxX>i?t.maxX:i,this.maxY=t.maxY>o?t.maxY:o},r.prototype.addBoundsMask=function(t,e){var n=t.minX>e.minX?t.minX:e.minX,i=t.minY>e.minY?t.minY:e.minY,o=t.maxX<e.maxX?t.maxX:e.maxX,a=t.maxY<e.maxY?t.maxY:e.maxY;if(n<=o&&i<=a){var s=this.minX,u=this.minY,h=this.maxX,l=this.maxY;this.minX=n<s?n:s,this.minY=i<u?i:u,this.maxX=o>h?o:h,this.maxY=a>l?a:l}},r.prototype.addBoundsMatrix=function(t,e){this.addFrameMatrix(e,t.minX,t.minY,t.maxX,t.maxY)},r.prototype.addBoundsArea=function(t,e){var n=t.minX>e.x?t.minX:e.x,i=t.minY>e.y?t.minY:e.y,o=t.maxX<e.x+e.width?t.maxX:e.x+e.width,a=t.maxY<e.y+e.height?t.maxY:e.y+e.height;if(n<=o&&i<=a){var s=this.minX,u=this.minY,h=this.maxX,l=this.maxY;this.minX=n<s?n:s,this.minY=i<u?i:u,this.maxX=o>h?o:h,this.maxY=a>l?a:l}},r.prototype.pad=function(t,e){t===void 0&&(t=0),e===void 0&&(e=t),this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e)},r.prototype.addFramePad=function(t,e,n,i,o,a){t-=o,e-=a,n+=o,i+=a,this.minX=this.minX<t?this.minX:t,this.maxX=this.maxX>n?this.maxX:n,this.minY=this.minY<e?this.minY:e,this.maxY=this.maxY>i?this.maxY:i},r}();/*! *****************************************************************************
54
- Copyright (c) Microsoft Corporation.
55
-
56
- Permission to use, copy, modify, and/or distribute this software for any
57
- purpose with or without fee is hereby granted.
58
-
59
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
60
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
61
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
62
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
63
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
64
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
65
- PERFORMANCE OF THIS SOFTWARE.
66
- ***************************************************************************** */var na=function(r,t){return na=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var i in n)n.hasOwnProperty(i)&&(e[i]=n[i])},na(r,t)};function ia(r,t){na(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var It=function(r){ia(t,r);function t(){var e=r.call(this)||this;return e.tempDisplayObjectParent=null,e.transform=new Th,e.alpha=1,e.visible=!0,e.renderable=!0,e.cullable=!1,e.cullArea=null,e.parent=null,e.worldAlpha=1,e._lastSortedIndex=0,e._zIndex=0,e.filterArea=null,e.filters=null,e._enabledFilters=null,e._bounds=new vi,e._localBounds=null,e._boundsID=0,e._boundsRect=null,e._localBoundsRect=null,e._mask=null,e._maskRefCount=0,e._destroyed=!1,e.isSprite=!1,e.isMask=!1,e}return t.mixin=function(e){for(var n=Object.keys(e),i=0;i<n.length;++i){var o=n[i];Object.defineProperty(t.prototype,o,Object.getOwnPropertyDescriptor(e,o))}},Object.defineProperty(t.prototype,"destroyed",{get:function(){return this._destroyed},enumerable:!1,configurable:!0}),t.prototype._recursivePostUpdateTransform=function(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateTransform(this.parent.transform)):this.transform.updateTransform(this._tempDisplayObjectParent.transform)},t.prototype.updateTransform=function(){this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha},t.prototype.getBounds=function(e,n){return e||(this.parent?(this._recursivePostUpdateTransform(),this.updateTransform()):(this.parent=this._tempDisplayObjectParent,this.updateTransform(),this.parent=null)),this._bounds.updateID!==this._boundsID&&(this.calculateBounds(),this._bounds.updateID=this._boundsID),n||(this._boundsRect||(this._boundsRect=new st),n=this._boundsRect),this._bounds.getRectangle(n)},t.prototype.getLocalBounds=function(e){e||(this._localBoundsRect||(this._localBoundsRect=new st),e=this._localBoundsRect),this._localBounds||(this._localBounds=new vi);var n=this.transform,i=this.parent;this.parent=null,this.transform=this._tempDisplayObjectParent.transform;var o=this._bounds,a=this._boundsID;this._bounds=this._localBounds;var s=this.getBounds(!1,e);return this.parent=i,this.transform=n,this._bounds=o,this._bounds.updateID+=this._boundsID-a,s},t.prototype.toGlobal=function(e,n,i){return i===void 0&&(i=!1),i||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(e,n)},t.prototype.toLocal=function(e,n,i,o){return n&&(e=n.toGlobal(e,i,o)),o||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(e,i)},t.prototype.setParent=function(e){if(!e||!e.addChild)throw new Error("setParent: Argument must be a Container");return e.addChild(this),e},t.prototype.setTransform=function(e,n,i,o,a,s,u,h,l){return e===void 0&&(e=0),n===void 0&&(n=0),i===void 0&&(i=1),o===void 0&&(o=1),a===void 0&&(a=0),s===void 0&&(s=0),u===void 0&&(u=0),h===void 0&&(h=0),l===void 0&&(l=0),this.position.x=e,this.position.y=n,this.scale.x=i||1,this.scale.y=o||1,this.rotation=a,this.skew.x=s,this.skew.y=u,this.pivot.x=h,this.pivot.y=l,this},t.prototype.destroy=function(e){this.parent&&this.parent.removeChild(this),this._destroyed=!0,this.transform=null,this.parent=null,this._bounds=null,this.mask=null,this.cullArea=null,this.filters=null,this.filterArea=null,this.hitArea=null,this.interactive=!1,this.interactiveChildren=!1,this.emit("destroyed"),this.removeAllListeners()},Object.defineProperty(t.prototype,"_tempDisplayObjectParent",{get:function(){return this.tempDisplayObjectParent===null&&(this.tempDisplayObjectParent=new wh),this.tempDisplayObjectParent},enumerable:!1,configurable:!0}),t.prototype.enableTempParent=function(){var e=this.parent;return this.parent=this._tempDisplayObjectParent,e},t.prototype.disableTempParent=function(e){this.parent=e},Object.defineProperty(t.prototype,"x",{get:function(){return this.position.x},set:function(e){this.transform.position.x=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"y",{get:function(){return this.position.y},set:function(e){this.transform.position.y=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"worldTransform",{get:function(){return this.transform.worldTransform},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localTransform",{get:function(){return this.transform.localTransform},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"position",{get:function(){return this.transform.position},set:function(e){this.transform.position.copyFrom(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scale",{get:function(){return this.transform.scale},set:function(e){this.transform.scale.copyFrom(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pivot",{get:function(){return this.transform.pivot},set:function(e){this.transform.pivot.copyFrom(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"skew",{get:function(){return this.transform.skew},set:function(e){this.transform.skew.copyFrom(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotation",{get:function(){return this.transform.rotation},set:function(e){this.transform.rotation=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"angle",{get:function(){return this.transform.rotation*Jg},set:function(e){this.transform.rotation=e*Qg},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"zIndex",{get:function(){return this._zIndex},set:function(e){this._zIndex=e,this.parent&&(this.parent.sortDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"worldVisible",{get:function(){var e=this;do{if(!e.visible)return!1;e=e.parent}while(e);return!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mask",{get:function(){return this._mask},set:function(e){if(this._mask!==e){if(this._mask){var n=this._mask.isMaskData?this._mask.maskObject:this._mask;n&&(n._maskRefCount--,n._maskRefCount===0&&(n.renderable=!0,n.isMask=!1))}if(this._mask=e,this._mask){var n=this._mask.isMaskData?this._mask.maskObject:this._mask;n&&(n._maskRefCount===0&&(n.renderable=!1,n.isMask=!0),n._maskRefCount++)}}},enumerable:!1,configurable:!0}),t}(sn),wh=function(r){ia(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.sortDirty=null,e}return t}(It);It.prototype.displayObjectUpdateTransform=It.prototype.updateTransform;function iy(r,t){return r.zIndex===t.zIndex?r._lastSortedIndex-t._lastSortedIndex:r.zIndex-t.zIndex}var Ee=function(r){ia(t,r);function t(){var e=r.call(this)||this;return e.children=[],e.sortableChildren=k.SORTABLE_CHILDREN,e.sortDirty=!1,e}return t.prototype.onChildrenChange=function(e){},t.prototype.addChild=function(){for(var e=arguments,n=[],i=0;i<arguments.length;i++)n[i]=e[i];if(n.length>1)for(var o=0;o<n.length;o++)this.addChild(n[o]);else{var a=n[0];a.parent&&a.parent.removeChild(a),a.parent=this,this.sortDirty=!0,a.transform._parentID=-1,this.children.push(a),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit("childAdded",a,this,this.children.length-1),a.emit("added",this)}return n[0]},t.prototype.addChildAt=function(e,n){if(n<0||n>this.children.length)throw new Error(e+"addChildAt: The index "+n+" supplied is out of bounds "+this.children.length);return e.parent&&e.parent.removeChild(e),e.parent=this,this.sortDirty=!0,e.transform._parentID=-1,this.children.splice(n,0,e),this._boundsID++,this.onChildrenChange(n),e.emit("added",this),this.emit("childAdded",e,this,n),e},t.prototype.swapChildren=function(e,n){if(e!==n){var i=this.getChildIndex(e),o=this.getChildIndex(n);this.children[i]=n,this.children[o]=e,this.onChildrenChange(i<o?i:o)}},t.prototype.getChildIndex=function(e){var n=this.children.indexOf(e);if(n===-1)throw new Error("The supplied DisplayObject must be a child of the caller");return n},t.prototype.setChildIndex=function(e,n){if(n<0||n>=this.children.length)throw new Error("The index "+n+" supplied is out of bounds "+this.children.length);var i=this.getChildIndex(e);Gr(this.children,i,1),this.children.splice(n,0,e),this.onChildrenChange(n)},t.prototype.getChildAt=function(e){if(e<0||e>=this.children.length)throw new Error("getChildAt: Index ("+e+") does not exist.");return this.children[e]},t.prototype.removeChild=function(){for(var e=arguments,n=[],i=0;i<arguments.length;i++)n[i]=e[i];if(n.length>1)for(var o=0;o<n.length;o++)this.removeChild(n[o]);else{var a=n[0],s=this.children.indexOf(a);if(s===-1)return null;a.parent=null,a.transform._parentID=-1,Gr(this.children,s,1),this._boundsID++,this.onChildrenChange(s),a.emit("removed",this),this.emit("childRemoved",a,this,s)}return n[0]},t.prototype.removeChildAt=function(e){var n=this.getChildAt(e);return n.parent=null,n.transform._parentID=-1,Gr(this.children,e,1),this._boundsID++,this.onChildrenChange(e),n.emit("removed",this),this.emit("childRemoved",n,this,e),n},t.prototype.removeChildren=function(e,n){e===void 0&&(e=0),n===void 0&&(n=this.children.length);var i=e,o=n,a=o-i,s;if(a>0&&a<=o){s=this.children.splice(i,a);for(var u=0;u<s.length;++u)s[u].parent=null,s[u].transform&&(s[u].transform._parentID=-1);this._boundsID++,this.onChildrenChange(e);for(var u=0;u<s.length;++u)s[u].emit("removed",this),this.emit("childRemoved",s[u],this,u);return s}else if(a===0&&this.children.length===0)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},t.prototype.sortChildren=function(){for(var e=!1,n=0,i=this.children.length;n<i;++n){var o=this.children[n];o._lastSortedIndex=n,!e&&o.zIndex!==0&&(e=!0)}e&&this.children.length>1&&this.children.sort(iy),this.sortDirty=!1},t.prototype.updateTransform=function(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(var e=0,n=this.children.length;e<n;++e){var i=this.children[e];i.visible&&i.updateTransform()}},t.prototype.calculateBounds=function(){this._bounds.clear(),this._calculateBounds();for(var e=0;e<this.children.length;e++){var n=this.children[e];if(!(!n.visible||!n.renderable))if(n.calculateBounds(),n._mask){var i=n._mask.isMaskData?n._mask.maskObject:n._mask;i?(i.calculateBounds(),this._bounds.addBoundsMask(n._bounds,i._bounds)):this._bounds.addBounds(n._bounds)}else n.filterArea?this._bounds.addBoundsArea(n._bounds,n.filterArea):this._bounds.addBounds(n._bounds)}this._bounds.updateID=this._boundsID},t.prototype.getLocalBounds=function(e,n){n===void 0&&(n=!1);var i=r.prototype.getLocalBounds.call(this,e);if(!n)for(var o=0,a=this.children.length;o<a;++o){var s=this.children[o];s.visible&&s.updateTransform()}return i},t.prototype._calculateBounds=function(){},t.prototype._renderWithCulling=function(e){var n=e.renderTexture.sourceFrame;if(n.width>0&&n.height>0){var i,o;if(this.cullArea?(i=this.cullArea,o=this.worldTransform):this._render!==t.prototype._render&&(i=this.getBounds(!0)),i&&n.intersects(i,o))this._render(e);else if(this.cullArea)return;for(var a=0,s=this.children.length;a<s;++a){var u=this.children[a],h=u.cullable;u.cullable=h||!this.cullArea,u.render(e),u.cullable=h}}},t.prototype.render=function(e){if(!(!this.visible||this.worldAlpha<=0||!this.renderable))if(this._mask||this.filters&&this.filters.length)this.renderAdvanced(e);else if(this.cullable)this._renderWithCulling(e);else{this._render(e);for(var n=0,i=this.children.length;n<i;++n)this.children[n].render(e)}},t.prototype.renderAdvanced=function(e){var n=this.filters,i=this._mask;if(n){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(var o=0;o<n.length;o++)n[o].enabled&&this._enabledFilters.push(n[o])}var a=n&&this._enabledFilters&&this._enabledFilters.length||i&&(!i.isMaskData||i.enabled&&(i.autoDetect||i.type!==Ct.NONE));if(a&&e.batch.flush(),n&&this._enabledFilters&&this._enabledFilters.length&&e.filter.push(this,this._enabledFilters),i&&e.mask.push(this,this._mask),this.cullable)this._renderWithCulling(e);else{this._render(e);for(var o=0,s=this.children.length;o<s;++o)this.children[o].render(e)}a&&e.batch.flush(),i&&e.mask.pop(this),n&&this._enabledFilters&&this._enabledFilters.length&&e.filter.pop()},t.prototype._render=function(e){},t.prototype.destroy=function(e){r.prototype.destroy.call(this),this.sortDirty=!1;var n=typeof e=="boolean"?e:e&&e.children,i=this.removeChildren(0,this.children.length);if(n)for(var o=0;o<i.length;++o)i[o].destroy(e)},Object.defineProperty(t.prototype,"width",{get:function(){return this.scale.x*this.getLocalBounds().width},set:function(e){var n=this.getLocalBounds().width;n!==0?this.scale.x=e/n:this.scale.x=1,this._width=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.scale.y*this.getLocalBounds().height},set:function(e){var n=this.getLocalBounds().height;n!==0?this.scale.y=e/n:this.scale.y=1,this._height=e},enumerable:!1,configurable:!0}),t}(It);Ee.prototype.containerUpdateTransform=Ee.prototype.updateTransform;/*!
67
- * @pixi/extensions - v6.5.10
68
- * Compiled Thu, 06 Jul 2023 15:25:11 UTC
69
- *
70
- * @pixi/extensions is licensed under the MIT License.
71
- * http://www.opensource.org/licenses/mit-license
72
- *//*! *****************************************************************************
73
- Copyright (c) Microsoft Corporation.
74
-
75
- Permission to use, copy, modify, and/or distribute this software for any
76
- purpose with or without fee is hereby granted.
77
-
78
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
79
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
80
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
81
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
82
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
83
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
84
- PERFORMANCE OF THIS SOFTWARE.
85
- ***************************************************************************** */var gn=function(){return gn=Object.assign||function(t){for(var e=arguments,n,i=1,o=arguments.length;i<o;i++){n=e[i];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},gn.apply(this,arguments)},mt;(function(r){r.Application="application",r.RendererPlugin="renderer-webgl-plugin",r.CanvasRendererPlugin="renderer-canvas-plugin",r.Loader="loader",r.LoadParser="load-parser",r.ResolveParser="resolve-parser",r.CacheParser="cache-parser",r.DetectionParser="detection-parser"})(mt||(mt={}));var Sh=function(r){if(typeof r=="function"||typeof r=="object"&&r.extension){if(!r.extension)throw new Error("Extension class must have an extension object");var t=typeof r.extension!="object"?{type:r.extension}:r.extension;r=gn(gn({},t),{ref:r})}if(typeof r=="object")r=gn({},r);else throw new Error("Invalid extension type");return typeof r.type=="string"&&(r.type=[r.type]),r},Re={_addHandlers:null,_removeHandlers:null,_queue:{},remove:function(){for(var r=arguments,t=this,e=[],n=0;n<arguments.length;n++)e[n]=r[n];return e.map(Sh).forEach(function(i){i.type.forEach(function(o){var a,s;return(s=(a=t._removeHandlers)[o])===null||s===void 0?void 0:s.call(a,i)})}),this},add:function(){for(var r=arguments,t=this,e=[],n=0;n<arguments.length;n++)e[n]=r[n];return e.map(Sh).forEach(function(i){i.type.forEach(function(o){var a=t._addHandlers,s=t._queue;a[o]?a[o](i):(s[o]=s[o]||[],s[o].push(i))})}),this},handle:function(r,t,e){var n=this._addHandlers=this._addHandlers||{},i=this._removeHandlers=this._removeHandlers||{};if(n[r]||i[r])throw new Error("Extension type "+r+" already has a handler");n[r]=t,i[r]=e;var o=this._queue;return o[r]&&(o[r].forEach(function(a){return t(a)}),delete o[r]),this},handleByMap:function(r,t){return this.handle(r,function(e){t[e.name]=e.ref},function(e){delete t[e.name]})},handleByList:function(r,t){return this.handle(r,function(e){var n,i;t.includes(e.ref)||(t.push(e.ref),r===mt.Loader&&((i=(n=e.ref).add)===null||i===void 0||i.call(n)))},function(e){var n=t.indexOf(e.ref);n!==-1&&t.splice(n,1)})}};/*!
86
- * @pixi/runner - v6.5.10
87
- * Compiled Thu, 06 Jul 2023 15:25:11 UTC
88
- *
89
- * @pixi/runner is licensed under the MIT License.
90
- * http://www.opensource.org/licenses/mit-license
91
- */var Ut=function(){function r(t){this.items=[],this._name=t,this._aliasCount=0}return r.prototype.emit=function(t,e,n,i,o,a,s,u){if(arguments.length>8)throw new Error("max arguments reached");var h=this,l=h.name,f=h.items;this._aliasCount++;for(var c=0,d=f.length;c<d;c++)f[c][l](t,e,n,i,o,a,s,u);return f===this.items&&this._aliasCount--,this},r.prototype.ensureNonAliasedItems=function(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))},r.prototype.add=function(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this},r.prototype.remove=function(t){var e=this.items.indexOf(t);return e!==-1&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this},r.prototype.contains=function(t){return this.items.indexOf(t)!==-1},r.prototype.removeAll=function(){return this.ensureNonAliasedItems(),this.items.length=0,this},r.prototype.destroy=function(){this.removeAll(),this.items=null,this._name=null},Object.defineProperty(r.prototype,"empty",{get:function(){return this.items.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),r}();Object.defineProperties(Ut.prototype,{dispatch:{value:Ut.prototype.emit},run:{value:Ut.prototype.emit}});/*!
92
- * @pixi/ticker - v6.5.10
93
- * Compiled Thu, 06 Jul 2023 15:25:11 UTC
94
- *
95
- * @pixi/ticker is licensed under the MIT License.
96
- * http://www.opensource.org/licenses/mit-license
97
- */k.TARGET_FPMS=.06;var Ie;(function(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"})(Ie||(Ie={}));var oa=function(){function r(t,e,n,i){e===void 0&&(e=null),n===void 0&&(n=0),i===void 0&&(i=!1),this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=n,this.once=i}return r.prototype.match=function(t,e){return e===void 0&&(e=null),this.fn===t&&this.context===e},r.prototype.emit=function(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));var e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e},r.prototype.connect=function(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this},r.prototype.destroy=function(t){t===void 0&&(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);var e=this.next;return this.next=t?null:e,this.previous=null,e},r}(),Gt=function(){function r(){var t=this;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 oa(null,null,1/0),this.deltaMS=1/k.TARGET_FPMS,this.elapsedMS=1/k.TARGET_FPMS,this._tick=function(e){t._requestId=null,t.started&&(t.update(e),t.started&&t._requestId===null&&t._head.next&&(t._requestId=requestAnimationFrame(t._tick)))}}return r.prototype._requestIfNeeded=function(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))},r.prototype._cancelIfNeeded=function(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)},r.prototype._startIfPossible=function(){this.started?this._requestIfNeeded():this.autoStart&&this.start()},r.prototype.add=function(t,e,n){return n===void 0&&(n=Ie.NORMAL),this._addListener(new oa(t,e,n))},r.prototype.addOnce=function(t,e,n){return n===void 0&&(n=Ie.NORMAL),this._addListener(new oa(t,e,n,!0))},r.prototype._addListener=function(t){var e=this._head.next,n=this._head;if(!e)t.connect(n);else{for(;e;){if(t.priority>e.priority){t.connect(n);break}n=e,e=e.next}t.previous||t.connect(n)}return this._startIfPossible(),this},r.prototype.remove=function(t,e){for(var n=this._head.next;n;)n.match(t,e)?n=n.destroy():n=n.next;return this._head.next||this._cancelIfNeeded(),this},Object.defineProperty(r.prototype,"count",{get:function(){if(!this._head)return 0;for(var t=0,e=this._head;e=e.next;)t++;return t},enumerable:!1,configurable:!0}),r.prototype.start=function(){this.started||(this.started=!0,this._requestIfNeeded())},r.prototype.stop=function(){this.started&&(this.started=!1,this._cancelIfNeeded())},r.prototype.destroy=function(){if(!this._protected){this.stop();for(var t=this._head.next;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}},r.prototype.update=function(t){t===void 0&&(t=performance.now());var e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){var n=t-this._lastFrame|0;if(n<this._minElapsedMS)return;this._lastFrame=t-n%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*k.TARGET_FPMS;for(var i=this._head,o=i.next;o;)o=o.emit(this.deltaTime);i.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t},Object.defineProperty(r.prototype,"FPS",{get:function(){return 1e3/this.elapsedMS},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"minFPS",{get:function(){return 1e3/this._maxElapsedMS},set:function(t){var e=Math.min(this.maxFPS,t),n=Math.min(Math.max(0,e)/1e3,k.TARGET_FPMS);this._maxElapsedMS=1/n},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"maxFPS",{get:function(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0},set:function(t){if(t===0)this._minElapsedMS=0;else{var e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}},enumerable:!1,configurable:!0}),Object.defineProperty(r,"shared",{get:function(){if(!r._shared){var t=r._shared=new r;t.autoStart=!0,t._protected=!0}return r._shared},enumerable:!1,configurable:!0}),Object.defineProperty(r,"system",{get:function(){if(!r._system){var t=r._system=new r;t.autoStart=!0,t._protected=!0}return r._system},enumerable:!1,configurable:!0}),r}(),oy=function(){function r(){}return r.init=function(t){var e=this;t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set:function(n){this._ticker&&this._ticker.remove(this.render,this),this._ticker=n,n&&n.add(this.render,this,Ie.LOW)},get:function(){return this._ticker}}),this.stop=function(){e._ticker.stop()},this.start=function(){e._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?Gt.shared:new Gt,t.autoStart&&this.start()},r.destroy=function(){if(this._ticker){var t=this._ticker;this.ticker=null,t.destroy()}},r.extension=mt.Application,r}();/*!
98
- * @pixi/core - v6.5.10
99
- * Compiled Thu, 06 Jul 2023 15:25:11 UTC
100
- *
101
- * @pixi/core is licensed under the MIT License.
102
- * http://www.opensource.org/licenses/mit-license
103
- */k.PREFER_ENV=ye.any?Se.WEBGL:Se.WEBGL2,k.STRICT_TEXTURE_CACHE=!1;var aa=[];function Ah(r,t){if(!r)return null;var e="";if(typeof r=="string"){var n=/\.(\w{3,4})(?:$|\?|#)/i.exec(r);n&&(e=n[1].toLowerCase())}for(var i=aa.length-1;i>=0;--i){var o=aa[i];if(o.test&&o.test(r,e))return new o(r,t)}throw new Error("Unrecognized source type to auto-detect Resource")}/*! *****************************************************************************
104
- Copyright (c) Microsoft Corporation.
105
-
106
- Permission to use, copy, modify, and/or distribute this software for any
107
- purpose with or without fee is hereby granted.
108
-
109
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
110
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
111
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
112
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
113
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
114
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
115
- PERFORMANCE OF THIS SOFTWARE.
116
- ***************************************************************************** */var sa=function(r,t){return sa=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var i in n)n.hasOwnProperty(i)&&(e[i]=n[i])},sa(r,t)};function bt(r,t){sa(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var ua=function(){return ua=Object.assign||function(t){for(var e=arguments,n,i=1,o=arguments.length;i<o;i++){n=e[i];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},ua.apply(this,arguments)};function ay(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e}var yn=function(){function r(t,e){t===void 0&&(t=0),e===void 0&&(e=0),this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new Ut("setRealSize"),this.onUpdate=new Ut("update"),this.onError=new Ut("onError")}return r.prototype.bind=function(t){this.onResize.add(t),this.onUpdate.add(t),this.onError.add(t),(this._width||this._height)&&this.onResize.emit(this._width,this._height)},r.prototype.unbind=function(t){this.onResize.remove(t),this.onUpdate.remove(t),this.onError.remove(t)},r.prototype.resize=function(t,e){(t!==this._width||e!==this._height)&&(this._width=t,this._height=e,this.onResize.emit(t,e))},Object.defineProperty(r.prototype,"valid",{get:function(){return!!this._width&&!!this._height},enumerable:!1,configurable:!0}),r.prototype.update=function(){this.destroyed||this.onUpdate.emit()},r.prototype.load=function(){return Promise.resolve(this)},Object.defineProperty(r.prototype,"width",{get:function(){return this._width},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"height",{get:function(){return this._height},enumerable:!1,configurable:!0}),r.prototype.style=function(t,e,n){return!1},r.prototype.dispose=function(){},r.prototype.destroy=function(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)},r.test=function(t,e){return!1},r}(),bn=function(r){bt(t,r);function t(e,n){var i=this,o=n||{},a=o.width,s=o.height;if(!a||!s)throw new Error("BufferResource width or height invalid");return i=r.call(this,a,s)||this,i.data=e,i}return t.prototype.upload=function(e,n,i){var o=e.gl;o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.alphaMode===se.UNPACK);var a=n.realWidth,s=n.realHeight;return i.width===a&&i.height===s?o.texSubImage2D(n.target,0,0,0,a,s,n.format,i.type,this.data):(i.width=a,i.height=s,o.texImage2D(n.target,0,i.internalFormat,a,s,0,n.format,i.type,this.data)),!0},t.prototype.dispose=function(){this.data=null},t.test=function(e){return e instanceof Float32Array||e instanceof Uint8Array||e instanceof Uint32Array},t}(yn),sy={scaleMode:_e.NEAREST,format:U.RGBA,alphaMode:se.NPM},ut=function(r){bt(t,r);function t(e,n){e===void 0&&(e=null),n===void 0&&(n=null);var i=r.call(this)||this;n=n||{};var o=n.alphaMode,a=n.mipmap,s=n.anisotropicLevel,u=n.scaleMode,h=n.width,l=n.height,f=n.wrapMode,c=n.format,d=n.type,p=n.target,v=n.resolution,_=n.resourceOptions;return e&&!(e instanceof yn)&&(e=Ah(e,_),e.internal=!0),i.resolution=v||k.RESOLUTION,i.width=Math.round((h||0)*i.resolution)/i.resolution,i.height=Math.round((l||0)*i.resolution)/i.resolution,i._mipmap=a!==void 0?a:k.MIPMAP_TEXTURES,i.anisotropicLevel=s!==void 0?s:k.ANISOTROPIC_LEVEL,i._wrapMode=f||k.WRAP_MODE,i._scaleMode=u!==void 0?u:k.SCALE_MODE,i.format=c||U.RGBA,i.type=d||H.UNSIGNED_BYTE,i.target=p||Ze.TEXTURE_2D,i.alphaMode=o!==void 0?o:se.UNPACK,i.uid=nr(),i.touched=0,i.isPowerOfTwo=!1,i._refreshPOT(),i._glTextures={},i.dirtyId=0,i.dirtyStyleId=0,i.cacheId=null,i.valid=h>0&&l>0,i.textureCacheIds=[],i.destroyed=!1,i.resource=null,i._batchEnabled=0,i._batchLocation=0,i.parentTextureArray=null,i.setResource(e),i}return Object.defineProperty(t.prototype,"realWidth",{get:function(){return Math.round(this.width*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"realHeight",{get:function(){return Math.round(this.height*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mipmap",{get:function(){return this._mipmap},set:function(e){this._mipmap!==e&&(this._mipmap=e,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scaleMode",{get:function(){return this._scaleMode},set:function(e){this._scaleMode!==e&&(this._scaleMode=e,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wrapMode",{get:function(){return this._wrapMode},set:function(e){this._wrapMode!==e&&(this._wrapMode=e,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),t.prototype.setStyle=function(e,n){var i;return e!==void 0&&e!==this.scaleMode&&(this.scaleMode=e,i=!0),n!==void 0&&n!==this.mipmap&&(this.mipmap=n,i=!0),i&&this.dirtyStyleId++,this},t.prototype.setSize=function(e,n,i){return i=i||this.resolution,this.setRealSize(e*i,n*i,i)},t.prototype.setRealSize=function(e,n,i){return this.resolution=i||this.resolution,this.width=Math.round(e)/this.resolution,this.height=Math.round(n)/this.resolution,this._refreshPOT(),this.update(),this},t.prototype._refreshPOT=function(){this.isPowerOfTwo=mh(this.realWidth)&&mh(this.realHeight)},t.prototype.setResolution=function(e){var n=this.resolution;return n===e?this:(this.resolution=e,this.valid&&(this.width=Math.round(this.width*n)/e,this.height=Math.round(this.height*n)/e,this.emit("update",this)),this._refreshPOT(),this)},t.prototype.setResource=function(e){if(this.resource===e)return this;if(this.resource)throw new Error("Resource can be set only once");return e.bind(this),this.resource=e,this},t.prototype.update=function(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))},t.prototype.onError=function(e){this.emit("error",this,e)},t.prototype.destroy=function(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete ir[this.cacheId],delete Oe[this.cacheId],this.cacheId=null),this.dispose(),t.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0},t.prototype.dispose=function(){this.emit("dispose",this)},t.prototype.castToBaseTexture=function(){return this},t.from=function(e,n,i){i===void 0&&(i=k.STRICT_TEXTURE_CACHE);var o=typeof e=="string",a=null;if(o)a=e;else{if(!e._pixiId){var s=n&&n.pixiIdPrefix||"pixiid";e._pixiId=s+"_"+nr()}a=e._pixiId}var u=ir[a];if(o&&i&&!u)throw new Error('The cacheId "'+a+'" does not exist in BaseTextureCache.');return u||(u=new t(e,n),u.cacheId=a,t.addToCache(u,a)),u},t.fromBuffer=function(e,n,i,o){e=e||new Float32Array(n*i*4);var a=new bn(e,{width:n,height:i}),s=e instanceof Float32Array?H.FLOAT:H.UNSIGNED_BYTE;return new t(a,Object.assign({},sy,o||{width:n,height:i,type:s}))},t.addToCache=function(e,n){n&&(e.textureCacheIds.indexOf(n)===-1&&e.textureCacheIds.push(n),ir[n]&&console.warn("BaseTexture added to the cache with an id ["+n+"] that already had an entry"),ir[n]=e)},t.removeFromCache=function(e){if(typeof e=="string"){var n=ir[e];if(n){var i=n.textureCacheIds.indexOf(e);return i>-1&&n.textureCacheIds.splice(i,1),delete ir[e],n}}else if(e&&e.textureCacheIds){for(var o=0;o<e.textureCacheIds.length;++o)delete ir[e.textureCacheIds[o]];return e.textureCacheIds.length=0,e}return null},t._globalBatch=0,t}(sn),Ph=function(r){bt(t,r);function t(e,n){var i=this,o=n||{},a=o.width,s=o.height;i=r.call(this,a,s)||this,i.items=[],i.itemDirtyIds=[];for(var u=0;u<e;u++){var h=new ut;i.items.push(h),i.itemDirtyIds.push(-2)}return i.length=e,i._load=null,i.baseTexture=null,i}return t.prototype.initFromArray=function(e,n){for(var i=0;i<this.length;i++)e[i]&&(e[i].castToBaseTexture?this.addBaseTextureAt(e[i].castToBaseTexture(),i):e[i]instanceof yn?this.addResourceAt(e[i],i):this.addResourceAt(Ah(e[i],n),i))},t.prototype.dispose=function(){for(var e=0,n=this.length;e<n;e++)this.items[e].destroy();this.items=null,this.itemDirtyIds=null,this._load=null},t.prototype.addResourceAt=function(e,n){if(!this.items[n])throw new Error("Index "+n+" is out of bounds");return e.valid&&!this.valid&&this.resize(e.width,e.height),this.items[n].setResource(e),this},t.prototype.bind=function(e){if(this.baseTexture!==null)throw new Error("Only one base texture per TextureArray is allowed");r.prototype.bind.call(this,e);for(var n=0;n<this.length;n++)this.items[n].parentTextureArray=e,this.items[n].on("update",e.update,e)},t.prototype.unbind=function(e){r.prototype.unbind.call(this,e);for(var n=0;n<this.length;n++)this.items[n].parentTextureArray=null,this.items[n].off("update",e.update,e)},t.prototype.load=function(){var e=this;if(this._load)return this._load;var n=this.items.map(function(o){return o.resource}).filter(function(o){return o}),i=n.map(function(o){return o.load()});return this._load=Promise.all(i).then(function(){var o=e.items[0],a=o.realWidth,s=o.realHeight;return e.resize(a,s),Promise.resolve(e)}),this._load},t}(yn),uy=function(r){bt(t,r);function t(e,n){var i=this,o=n||{},a=o.width,s=o.height,u,h;return Array.isArray(e)?(u=e,h=e.length):h=e,i=r.call(this,h,{width:a,height:s})||this,u&&i.initFromArray(u,n),i}return t.prototype.addBaseTextureAt=function(e,n){if(e.resource)this.addResourceAt(e.resource,n);else throw new Error("ArrayResource does not support RenderTexture");return this},t.prototype.bind=function(e){r.prototype.bind.call(this,e),e.target=Ze.TEXTURE_2D_ARRAY},t.prototype.upload=function(e,n,i){var o=this,a=o.length,s=o.itemDirtyIds,u=o.items,h=e.gl;i.dirtyId<0&&h.texImage3D(h.TEXTURE_2D_ARRAY,0,i.internalFormat,this._width,this._height,a,0,n.format,i.type,null);for(var l=0;l<a;l++){var f=u[l];s[l]<f.dirtyId&&(s[l]=f.dirtyId,f.valid&&h.texSubImage3D(h.TEXTURE_2D_ARRAY,0,0,0,l,f.resource.width,f.resource.height,1,n.format,i.type,f.resource.source))}return!0},t}(Ph),He=function(r){bt(t,r);function t(e){var n=this,i=e,o=i.naturalWidth||i.videoWidth||i.width,a=i.naturalHeight||i.videoHeight||i.height;return n=r.call(this,o,a)||this,n.source=e,n.noSubImage=!1,n}return t.crossOrigin=function(e,n,i){i===void 0&&n.indexOf("data:")!==0?e.crossOrigin=Zg(n):i!==!1&&(e.crossOrigin=typeof i=="string"?i:"anonymous")},t.prototype.upload=function(e,n,i,o){var a=e.gl,s=n.realWidth,u=n.realHeight;if(o=o||this.source,o instanceof HTMLImageElement){if(!o.complete||o.naturalWidth===0)return!1}else if(o instanceof HTMLVideoElement&&o.readyState<=1)return!1;return a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.alphaMode===se.UNPACK),!this.noSubImage&&n.target===a.TEXTURE_2D&&i.width===s&&i.height===u?a.texSubImage2D(a.TEXTURE_2D,0,0,0,n.format,i.type,o):(i.width=s,i.height=u,a.texImage2D(n.target,0,i.internalFormat,n.format,i.type,o)),!0},t.prototype.update=function(){if(!this.destroyed){var e=this.source,n=e.naturalWidth||e.videoWidth||e.width,i=e.naturalHeight||e.videoHeight||e.height;this.resize(n,i),r.prototype.update.call(this)}},t.prototype.dispose=function(){this.source=null},t}(yn),hy=function(r){bt(t,r);function t(e){return r.call(this,e)||this}return t.test=function(e){var n=globalThis.OffscreenCanvas;return n&&e instanceof n?!0:globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement},t}(He),ly=function(r){bt(t,r);function t(e,n){var i=this,o=n||{},a=o.width,s=o.height,u=o.autoLoad,h=o.linkBaseTexture;if(e&&e.length!==t.SIDES)throw new Error("Invalid length. Got "+e.length+", expected 6");i=r.call(this,6,{width:a,height:s})||this;for(var l=0;l<t.SIDES;l++)i.items[l].target=Ze.TEXTURE_CUBE_MAP_POSITIVE_X+l;return i.linkBaseTexture=h!==!1,e&&i.initFromArray(e,n),u!==!1&&i.load(),i}return t.prototype.bind=function(e){r.prototype.bind.call(this,e),e.target=Ze.TEXTURE_CUBE_MAP},t.prototype.addBaseTextureAt=function(e,n,i){if(!this.items[n])throw new Error("Index "+n+" is out of bounds");if(!this.linkBaseTexture||e.parentTextureArray||Object.keys(e._glTextures).length>0)if(e.resource)this.addResourceAt(e.resource,n);else throw new Error("CubeResource does not support copying of renderTexture.");else e.target=Ze.TEXTURE_CUBE_MAP_POSITIVE_X+n,e.parentTextureArray=this.baseTexture,this.items[n]=e;return e.valid&&!this.valid&&this.resize(e.realWidth,e.realHeight),this.items[n]=e,this},t.prototype.upload=function(e,n,i){for(var o=this.itemDirtyIds,a=0;a<t.SIDES;a++){var s=this.items[a];(o[a]<s.dirtyId||i.dirtyId<n.dirtyId)&&(s.valid&&s.resource?(s.resource.upload(e,s,i),o[a]=s.dirtyId):o[a]<-1&&(e.gl.texImage2D(s.target,0,i.internalFormat,n.realWidth,n.realHeight,0,n.format,i.type,null),o[a]=-1))}return!0},t.test=function(e){return Array.isArray(e)&&e.length===t.SIDES},t.SIDES=6,t}(Ph),Oh=function(r){bt(t,r);function t(e,n){var i=this;if(n=n||{},!(e instanceof HTMLImageElement)){var o=new Image;He.crossOrigin(o,e,n.crossorigin),o.src=e,e=o}return i=r.call(this,e)||this,!e.complete&&i._width&&i._height&&(i._width=0,i._height=0),i.url=e.src,i._process=null,i.preserveBitmap=!1,i.createBitmap=(n.createBitmap!==void 0?n.createBitmap:k.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,i.alphaMode=typeof n.alphaMode=="number"?n.alphaMode:null,i.bitmap=null,i._load=null,n.autoLoad!==!1&&i.load(),i}return t.prototype.load=function(e){var n=this;return this._load?this._load:(e!==void 0&&(this.createBitmap=e),this._load=new Promise(function(i,o){var a=n.source;n.url=a.src;var s=function(){n.destroyed||(a.onload=null,a.onerror=null,n.resize(a.width,a.height),n._load=null,n.createBitmap?i(n.process()):i(n))};a.complete&&a.src?s():(a.onload=s,a.onerror=function(u){o(u),n.onError.emit(u)})}),this._load)},t.prototype.process=function(){var e=this,n=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);var i=globalThis.createImageBitmap,o=!n.crossOrigin||n.crossOrigin==="anonymous";return this._process=fetch(n.src,{mode:o?"cors":"no-cors"}).then(function(a){return a.blob()}).then(function(a){return i(a,0,0,n.width,n.height,{premultiplyAlpha:e.alphaMode===null||e.alphaMode===se.UNPACK?"premultiply":"none"})}).then(function(a){return e.destroyed?Promise.reject():(e.bitmap=a,e.update(),e._process=null,Promise.resolve(e))}),this._process},t.prototype.upload=function(e,n,i){if(typeof this.alphaMode=="number"&&(n.alphaMode=this.alphaMode),!this.createBitmap)return r.prototype.upload.call(this,e,n,i);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(r.prototype.upload.call(this,e,n,i,this.bitmap),!this.preserveBitmap){var o=!0,a=n._glTextures;for(var s in a){var u=a[s];if(u!==i&&u.dirtyId!==n.dirtyId){o=!1;break}}o&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0},t.prototype.dispose=function(){this.source.onload=null,this.source.onerror=null,r.prototype.dispose.call(this),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null},t.test=function(e){return typeof e=="string"||e instanceof HTMLImageElement},t}(He),fy=function(r){bt(t,r);function t(e,n){var i=this;return n=n||{},i=r.call(this,k.ADAPTER.createCanvas())||this,i._width=0,i._height=0,i.svg=e,i.scale=n.scale||1,i._overrideWidth=n.width,i._overrideHeight=n.height,i._resolve=null,i._crossorigin=n.crossorigin,i._load=null,n.autoLoad!==!1&&i.load(),i}return t.prototype.load=function(){var e=this;return this._load?this._load:(this._load=new Promise(function(n){if(e._resolve=function(){e.resize(e.source.width,e.source.height),n(e)},t.SVG_XML.test(e.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");e.svg="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(e.svg)))}e._loadSvg()}),this._load)},t.prototype._loadSvg=function(){var e=this,n=new Image;He.crossOrigin(n,this.svg,this._crossorigin),n.src=this.svg,n.onerror=function(i){e._resolve&&(n.onerror=null,e.onError.emit(i))},n.onload=function(){if(e._resolve){var i=n.width,o=n.height;if(!i||!o)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");var a=i*e.scale,s=o*e.scale;(e._overrideWidth||e._overrideHeight)&&(a=e._overrideWidth||e._overrideHeight/o*i,s=e._overrideHeight||e._overrideWidth/i*o),a=Math.round(a),s=Math.round(s);var u=e.source;u.width=a,u.height=s,u._pixiId="canvas_"+nr(),u.getContext("2d").drawImage(n,0,0,i,o,0,0,a,s),e._resolve(),e._resolve=null}}},t.getSize=function(e){var n=t.SVG_SIZE.exec(e),i={};return n&&(i[n[1]]=Math.round(parseFloat(n[3])),i[n[5]]=Math.round(parseFloat(n[7]))),i},t.prototype.dispose=function(){r.prototype.dispose.call(this),this._resolve=null,this._crossorigin=null},t.test=function(e,n){return n==="svg"||typeof e=="string"&&e.startsWith("data:image/svg+xml")||typeof e=="string"&&t.SVG_XML.test(e)},t.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,t.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i,t}(He),cy=function(r){bt(t,r);function t(e,n){var i=this;if(n=n||{},!(e instanceof HTMLVideoElement)){var o=document.createElement("video");o.setAttribute("preload","auto"),o.setAttribute("webkit-playsinline",""),o.setAttribute("playsinline",""),typeof e=="string"&&(e=[e]);var a=e[0].src||e[0];He.crossOrigin(o,a,n.crossorigin);for(var s=0;s<e.length;++s){var u=document.createElement("source"),h=e[s],l=h.src,f=h.mime;l=l||e[s];var c=l.split("?").shift().toLowerCase(),d=c.slice(c.lastIndexOf(".")+1);f=f||t.MIME_TYPES[d]||"video/"+d,u.src=l,u.type=f,o.appendChild(u)}e=o}return i=r.call(this,e)||this,i.noSubImage=!0,i._autoUpdate=!0,i._isConnectedToTicker=!1,i._updateFPS=n.updateFPS||0,i._msToNextUpdate=0,i.autoPlay=n.autoPlay!==!1,i._load=null,i._resolve=null,i._onCanPlay=i._onCanPlay.bind(i),i._onError=i._onError.bind(i),n.autoLoad!==!1&&i.load(),i}return t.prototype.update=function(e){if(!this.destroyed){var n=Gt.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-n),(!this._updateFPS||this._msToNextUpdate<=0)&&(r.prototype.update.call(this),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}},t.prototype.load=function(){var e=this;if(this._load)return this._load;var n=this.source;return(n.readyState===n.HAVE_ENOUGH_DATA||n.readyState===n.HAVE_FUTURE_DATA)&&n.width&&n.height&&(n.complete=!0),n.addEventListener("play",this._onPlayStart.bind(this)),n.addEventListener("pause",this._onPlayStop.bind(this)),this._isSourceReady()?this._onCanPlay():(n.addEventListener("canplay",this._onCanPlay),n.addEventListener("canplaythrough",this._onCanPlay),n.addEventListener("error",this._onError,!0)),this._load=new Promise(function(i){e.valid?i(e):(e._resolve=i,n.load())}),this._load},t.prototype._onError=function(e){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(e)},t.prototype._isSourcePlaying=function(){var e=this.source;return!e.paused&&!e.ended&&this._isSourceReady()},t.prototype._isSourceReady=function(){var e=this.source;return e.readyState>2},t.prototype._onPlayStart=function(){this.valid||this._onCanPlay(),this.autoUpdate&&!this._isConnectedToTicker&&(Gt.shared.add(this.update,this),this._isConnectedToTicker=!0)},t.prototype._onPlayStop=function(){this._isConnectedToTicker&&(Gt.shared.remove(this.update,this),this._isConnectedToTicker=!1)},t.prototype._onCanPlay=function(){var e=this.source;e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlay);var n=this.valid;this.resize(e.videoWidth,e.videoHeight),!n&&this._resolve&&(this._resolve(this),this._resolve=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&e.play()},t.prototype.dispose=function(){this._isConnectedToTicker&&(Gt.shared.remove(this.update,this),this._isConnectedToTicker=!1);var e=this.source;e&&(e.removeEventListener("error",this._onError,!0),e.pause(),e.src="",e.load()),r.prototype.dispose.call(this)},Object.defineProperty(t.prototype,"autoUpdate",{get:function(){return this._autoUpdate},set:function(e){e!==this._autoUpdate&&(this._autoUpdate=e,!this._autoUpdate&&this._isConnectedToTicker?(Gt.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._isSourcePlaying()&&(Gt.shared.add(this.update,this),this._isConnectedToTicker=!0))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"updateFPS",{get:function(){return this._updateFPS},set:function(e){e!==this._updateFPS&&(this._updateFPS=e)},enumerable:!1,configurable:!0}),t.test=function(e,n){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement||t.TYPES.indexOf(n)>-1},t.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],t.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"},t}(He),dy=function(r){bt(t,r);function t(e){return r.call(this,e)||this}return t.test=function(e){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&e instanceof ImageBitmap},t}(He);aa.push(Oh,dy,hy,cy,fy,bn,ly,uy);var py=function(r){bt(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.upload=function(e,n,i){var o=e.gl;o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.alphaMode===se.UNPACK);var a=n.realWidth,s=n.realHeight;return i.width===a&&i.height===s?o.texSubImage2D(n.target,0,0,0,a,s,n.format,i.type,this.data):(i.width=a,i.height=s,o.texImage2D(n.target,0,i.internalFormat,a,s,0,n.format,i.type,this.data)),!0},t}(bn),ha=function(){function r(t,e){this.width=Math.round(t||100),this.height=Math.round(e||100),this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new Ut("disposeFramebuffer"),this.multisample=wt.NONE}return Object.defineProperty(r.prototype,"colorTexture",{get:function(){return this.colorTextures[0]},enumerable:!1,configurable:!0}),r.prototype.addColorTexture=function(t,e){return t===void 0&&(t=0),this.colorTextures[t]=e||new ut(null,{scaleMode:_e.NEAREST,resolution:1,mipmap:ae.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this},r.prototype.addDepthTexture=function(t){return this.depthTexture=t||new ut(new py(null,{width:this.width,height:this.height}),{scaleMode:_e.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:ae.OFF,format:U.DEPTH_COMPONENT,type:H.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this},r.prototype.enableDepth=function(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this},r.prototype.enableStencil=function(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this},r.prototype.resize=function(t,e){if(t=Math.round(t),e=Math.round(e),!(t===this.width&&e===this.height)){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(var n=0;n<this.colorTextures.length;n++){var i=this.colorTextures[n],o=i.resolution;i.setSize(t/o,e/o)}if(this.depthTexture){var o=this.depthTexture.resolution;this.depthTexture.setSize(t/o,e/o)}}},r.prototype.dispose=function(){this.disposeRunner.emit(this,!1)},r.prototype.destroyDepthTexture=function(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)},r}(),Rh=function(r){bt(t,r);function t(e){e===void 0&&(e={});var n=this;if(typeof e=="number"){var i=arguments[0],o=arguments[1],a=arguments[2],s=arguments[3];e={width:i,height:o,scaleMode:a,resolution:s}}return e.width=e.width||100,e.height=e.height||100,e.multisample=e.multisample!==void 0?e.multisample:wt.NONE,n=r.call(this,null,e)||this,n.mipmap=ae.OFF,n.valid=!0,n.clearColor=[0,0,0,0],n.framebuffer=new ha(n.realWidth,n.realHeight).addColorTexture(0,n),n.framebuffer.multisample=e.multisample,n.maskStack=[],n.filterStack=[{}],n}return t.prototype.resize=function(e,n){this.framebuffer.resize(e*this.resolution,n*this.resolution),this.setRealSize(this.framebuffer.width,this.framebuffer.height)},t.prototype.dispose=function(){this.framebuffer.dispose(),r.prototype.dispose.call(this)},t.prototype.destroy=function(){r.prototype.destroy.call(this),this.framebuffer.destroyDepthTexture(),this.framebuffer=null},t}(ut),Ih=function(){function r(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}return r.prototype.set=function(t,e,n){var i=e.width,o=e.height;if(n){var a=t.width/2/i,s=t.height/2/o,u=t.x/i+a,h=t.y/o+s;n=Pt.add(n,Pt.NW),this.x0=u+a*Pt.uX(n),this.y0=h+s*Pt.uY(n),n=Pt.add(n,2),this.x1=u+a*Pt.uX(n),this.y1=h+s*Pt.uY(n),n=Pt.add(n,2),this.x2=u+a*Pt.uX(n),this.y2=h+s*Pt.uY(n),n=Pt.add(n,2),this.x3=u+a*Pt.uX(n),this.y3=h+s*Pt.uY(n)}else this.x0=t.x/i,this.y0=t.y/o,this.x1=(t.x+t.width)/i,this.y1=t.y/o,this.x2=(t.x+t.width)/i,this.y2=(t.y+t.height)/o,this.x3=t.x/i,this.y3=(t.y+t.height)/o;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3},r.prototype.toString=function(){return"[@pixi/core:TextureUvs "+("x0="+this.x0+" y0="+this.y0+" ")+("x1="+this.x1+" y1="+this.y1+" x2="+this.x2+" ")+("y2="+this.y2+" x3="+this.x3+" y3="+this.y3)+"]"},r}(),Ch=new Ih;function _i(r){r.destroy=function(){},r.on=function(){},r.once=function(){},r.emit=function(){}}var J=function(r){bt(t,r);function t(e,n,i,o,a,s){var u=r.call(this)||this;if(u.noFrame=!1,n||(u.noFrame=!0,n=new st(0,0,1,1)),e instanceof t&&(e=e.baseTexture),u.baseTexture=e,u._frame=n,u.trim=o,u.valid=!1,u._uvs=Ch,u.uvMatrix=null,u.orig=i||n,u._rotate=Number(a||0),a===!0)u._rotate=2;else if(u._rotate%2!==0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");return u.defaultAnchor=s?new Et(s.x,s.y):new Et(0,0),u._updateID=0,u.textureCacheIds=[],e.valid?u.noFrame?e.valid&&u.onBaseTextureUpdated(e):u.frame=n:e.once("loaded",u.onBaseTextureUpdated,u),u.noFrame&&e.on("update",u.onBaseTextureUpdated,u),u}return t.prototype.update=function(){this.baseTexture.resource&&this.baseTexture.resource.update()},t.prototype.onBaseTextureUpdated=function(e){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=e.width,this._frame.height=e.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)},t.prototype.destroy=function(e){if(this.baseTexture){if(e){var n=this.baseTexture.resource;n&&n.url&&Oe[n.url]&&t.removeFromCache(n.url),this.baseTexture.destroy()}this.baseTexture.off("loaded",this.onBaseTextureUpdated,this),this.baseTexture.off("update",this.onBaseTextureUpdated,this),this.baseTexture=null}this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,t.removeFromCache(this),this.textureCacheIds=null},t.prototype.clone=function(){var e=this._frame.clone(),n=this._frame===this.orig?e:this.orig.clone(),i=new t(this.baseTexture,!this.noFrame&&e,n,this.trim&&this.trim.clone(),this.rotate,this.defaultAnchor);return this.noFrame&&(i._frame=e),i},t.prototype.updateUvs=function(){this._uvs===Ch&&(this._uvs=new Ih),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++},t.from=function(e,n,i){n===void 0&&(n={}),i===void 0&&(i=k.STRICT_TEXTURE_CACHE);var o=typeof e=="string",a=null;if(o)a=e;else if(e instanceof ut){if(!e.cacheId){var s=n&&n.pixiIdPrefix||"pixiid";e.cacheId=s+"-"+nr(),ut.addToCache(e,e.cacheId)}a=e.cacheId}else{if(!e._pixiId){var s=n&&n.pixiIdPrefix||"pixiid";e._pixiId=s+"_"+nr()}a=e._pixiId}var u=Oe[a];if(o&&i&&!u)throw new Error('The cacheId "'+a+'" does not exist in TextureCache.');return!u&&!(e instanceof ut)?(n.resolution||(n.resolution=li(e)),u=new t(new ut(e,n)),u.baseTexture.cacheId=a,ut.addToCache(u.baseTexture,a),t.addToCache(u,a)):!u&&e instanceof ut&&(u=new t(e),t.addToCache(u,a)),u},t.fromURL=function(e,n){var i=Object.assign({autoLoad:!1},n==null?void 0:n.resourceOptions),o=t.from(e,Object.assign({resourceOptions:i},n),!1),a=o.baseTexture.resource;return o.baseTexture.valid?Promise.resolve(o):a.load().then(function(){return Promise.resolve(o)})},t.fromBuffer=function(e,n,i,o){return new t(ut.fromBuffer(e,n,i,o))},t.fromLoader=function(e,n,i,o){var a=new ut(e,Object.assign({scaleMode:k.SCALE_MODE,resolution:li(n)},o)),s=a.resource;s instanceof Oh&&(s.url=n);var u=new t(a);return i||(i=n),ut.addToCache(u.baseTexture,i),t.addToCache(u,i),i!==n&&(ut.addToCache(u.baseTexture,n),t.addToCache(u,n)),u.baseTexture.valid?Promise.resolve(u):new Promise(function(h){u.baseTexture.once("loaded",function(){return h(u)})})},t.addToCache=function(e,n){n&&(e.textureCacheIds.indexOf(n)===-1&&e.textureCacheIds.push(n),Oe[n]&&console.warn("Texture added to the cache with an id ["+n+"] that already had an entry"),Oe[n]=e)},t.removeFromCache=function(e){if(typeof e=="string"){var n=Oe[e];if(n){var i=n.textureCacheIds.indexOf(e);return i>-1&&n.textureCacheIds.splice(i,1),delete Oe[e],n}}else if(e&&e.textureCacheIds){for(var o=0;o<e.textureCacheIds.length;++o)Oe[e.textureCacheIds[o]]===e&&delete Oe[e.textureCacheIds[o]];return e.textureCacheIds.length=0,e}return null},Object.defineProperty(t.prototype,"resolution",{get:function(){return this.baseTexture.resolution},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"frame",{get:function(){return this._frame},set:function(e){this._frame=e,this.noFrame=!1;var n=e.x,i=e.y,o=e.width,a=e.height,s=n+o>this.baseTexture.width,u=i+a>this.baseTexture.height;if(s||u){var h=s&&u?"and":"or",l="X: "+n+" + "+o+" = "+(n+o)+" > "+this.baseTexture.width,f="Y: "+i+" + "+a+" = "+(i+a)+" > "+this.baseTexture.height;throw new Error("Texture Error: frame does not fit inside the base Texture dimensions: "+(l+" "+h+" "+f))}this.valid=o&&a&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=e),this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotate",{get:function(){return this._rotate},set:function(e){this._rotate=e,this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this.orig.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.orig.height},enumerable:!1,configurable:!0}),t.prototype.castToBaseTexture=function(){return this.baseTexture},Object.defineProperty(t,"EMPTY",{get:function(){return t._EMPTY||(t._EMPTY=new t(new ut),_i(t._EMPTY),_i(t._EMPTY.baseTexture)),t._EMPTY},enumerable:!1,configurable:!0}),Object.defineProperty(t,"WHITE",{get:function(){if(!t._WHITE){var e=k.ADAPTER.createCanvas(16,16),n=e.getContext("2d");e.width=16,e.height=16,n.fillStyle="white",n.fillRect(0,0,16,16),t._WHITE=new t(ut.from(e)),_i(t._WHITE),_i(t._WHITE.baseTexture)}return t._WHITE},enumerable:!1,configurable:!0}),t}(sn),hr=function(r){bt(t,r);function t(e,n){var i=r.call(this,e,n)||this;return i.valid=!0,i.filterFrame=null,i.filterPoolKey=null,i.updateUvs(),i}return Object.defineProperty(t.prototype,"framebuffer",{get:function(){return this.baseTexture.framebuffer},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"multisample",{get:function(){return this.framebuffer.multisample},set:function(e){this.framebuffer.multisample=e},enumerable:!1,configurable:!0}),t.prototype.resize=function(e,n,i){i===void 0&&(i=!0);var o=this.baseTexture.resolution,a=Math.round(e*o)/o,s=Math.round(n*o)/o;this.valid=a>0&&s>0,this._frame.width=this.orig.width=a,this._frame.height=this.orig.height=s,i&&this.baseTexture.resize(a,s),this.updateUvs()},t.prototype.setResolution=function(e){var n=this.baseTexture;n.resolution!==e&&(n.setResolution(e),this.resize(n.width,n.height,!1))},t.create=function(e){for(var n=arguments,i=[],o=1;o<arguments.length;o++)i[o-1]=n[o];return typeof e=="number"&&(le("6.0.0","Arguments (width, height, scaleMode, resolution) have been deprecated."),e={width:e,height:i[0],scaleMode:i[1],resolution:i[2]}),new t(new Rh(e))},t}(J),vy=function(){function r(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}return r.prototype.createTexture=function(t,e,n){n===void 0&&(n=wt.NONE);var i=new Rh(Object.assign({width:t,height:e,resolution:1,multisample:n},this.textureOptions));return new hr(i)},r.prototype.getOptimalTexture=function(t,e,n,i){n===void 0&&(n=1),i===void 0&&(i=wt.NONE);var o;t=Math.ceil(t*n-1e-6),e=Math.ceil(e*n-1e-6),!this.enableFullScreen||t!==this._pixelsWidth||e!==this._pixelsHeight?(t=ui(t),e=ui(e),o=((t&65535)<<16|e&65535)>>>0,i>1&&(o+=i*4294967296)):o=i>1?-i:-1,this.texturePool[o]||(this.texturePool[o]=[]);var a=this.texturePool[o].pop();return a||(a=this.createTexture(t,e,i)),a.filterPoolKey=o,a.setResolution(n),a},r.prototype.getFilterTexture=function(t,e,n){var i=this.getOptimalTexture(t.width,t.height,e||t.resolution,n||wt.NONE);return i.filterFrame=t.filterFrame,i},r.prototype.returnTexture=function(t){var e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)},r.prototype.returnFilterTexture=function(t){this.returnTexture(t)},r.prototype.clear=function(t){if(t=t!==!1,t)for(var e in this.texturePool){var n=this.texturePool[e];if(n)for(var i=0;i<n.length;i++)n[i].destroy(!0)}this.texturePool={}},r.prototype.setScreenSize=function(t){if(!(t.width===this._pixelsWidth&&t.height===this._pixelsHeight)){this.enableFullScreen=t.width>0&&t.height>0;for(var e in this.texturePool)if(Number(e)<0){var n=this.texturePool[e];if(n)for(var i=0;i<n.length;i++)n[i].destroy(!0);this.texturePool[e]=[]}this._pixelsWidth=t.width,this._pixelsHeight=t.height}},r.SCREEN_KEY=-1,r}(),Mh=function(){function r(t,e,n,i,o,a,s){e===void 0&&(e=0),n===void 0&&(n=!1),i===void 0&&(i=H.FLOAT),this.buffer=t,this.size=e,this.normalized=n,this.type=i,this.stride=o,this.start=a,this.instance=s}return r.prototype.destroy=function(){this.buffer=null},r.from=function(t,e,n,i,o){return new r(t,e,n,i,o)},r}(),_y=0,Dt=function(){function r(t,e,n){e===void 0&&(e=!0),n===void 0&&(n=!1),this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=n,this.static=e,this.id=_y++,this.disposeRunner=new Ut("disposeBuffer")}return r.prototype.update=function(t){t instanceof Array&&(t=new Float32Array(t)),this.data=t||this.data,this._updateID++},r.prototype.dispose=function(){this.disposeRunner.emit(this,!1)},r.prototype.destroy=function(){this.dispose(),this.data=null},Object.defineProperty(r.prototype,"index",{get:function(){return this.type===ge.ELEMENT_ARRAY_BUFFER},set:function(t){this.type=t?ge.ELEMENT_ARRAY_BUFFER:ge.ARRAY_BUFFER},enumerable:!1,configurable:!0}),r.from=function(t){return t instanceof Array&&(t=new Float32Array(t)),new r(t)},r}(),my={Float32Array,Uint32Array,Int32Array,Uint8Array};function gy(r,t){for(var e=0,n=0,i={},o=0;o<r.length;o++)n+=t[o],e+=r[o].length;for(var a=new ArrayBuffer(e*4),s=null,u=0,o=0;o<r.length;o++){var h=t[o],l=r[o],f=_h(l);i[f]||(i[f]=new my[f](a)),s=i[f];for(var c=0;c<l.length;c++){var d=(c/h|0)*n+u,p=c%h;s[d+p]=l[c]}u+=h}return new Float32Array(a)}var Dh={5126:4,5123:2,5121:1},yy=0,by={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array},xn=function(){function r(t,e){t===void 0&&(t=[]),e===void 0&&(e={}),this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=yy++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new Ut("disposeGeometry"),this.refCount=0}return r.prototype.addAttribute=function(t,e,n,i,o,a,s,u){if(n===void 0&&(n=0),i===void 0&&(i=!1),u===void 0&&(u=!1),!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof Dt||(e instanceof Array&&(e=new Float32Array(e)),e=new Dt(e));var h=t.split("|");if(h.length>1){for(var l=0;l<h.length;l++)this.addAttribute(h[l],e,n,i,o);return this}var f=this.buffers.indexOf(e);return f===-1&&(this.buffers.push(e),f=this.buffers.length-1),this.attributes[t]=new Mh(f,n,i,o,a,s,u),this.instanced=this.instanced||u,this},r.prototype.getAttribute=function(t){return this.attributes[t]},r.prototype.getBuffer=function(t){return this.buffers[this.getAttribute(t).buffer]},r.prototype.addIndex=function(t){return t instanceof Dt||(t instanceof Array&&(t=new Uint16Array(t)),t=new Dt(t)),t.type=ge.ELEMENT_ARRAY_BUFFER,this.indexBuffer=t,this.buffers.indexOf(t)===-1&&this.buffers.push(t),this},r.prototype.getIndex=function(){return this.indexBuffer},r.prototype.interleave=function(){if(this.buffers.length===1||this.buffers.length===2&&this.indexBuffer)return this;var t=[],e=[],n=new Dt,i;for(i in this.attributes){var o=this.attributes[i],a=this.buffers[o.buffer];t.push(a.data),e.push(o.size*Dh[o.type]/4),o.buffer=0}for(n.data=gy(t,e),i=0;i<this.buffers.length;i++)this.buffers[i]!==this.indexBuffer&&this.buffers[i].destroy();return this.buffers=[n],this.indexBuffer&&this.buffers.push(this.indexBuffer),this},r.prototype.getSize=function(){for(var t in this.attributes){var e=this.attributes[t],n=this.buffers[e.buffer];return n.data.length/(e.stride/4||e.size)}return 0},r.prototype.dispose=function(){this.disposeRunner.emit(this,!1)},r.prototype.destroy=function(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null},r.prototype.clone=function(){for(var t=new r,e=0;e<this.buffers.length;e++)t.buffers[e]=new Dt(this.buffers[e].data.slice(0));for(var e in this.attributes){var n=this.attributes[e];t.attributes[e]=new Mh(n.buffer,n.size,n.normalized,n.type,n.stride,n.start,n.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.type=ge.ELEMENT_ARRAY_BUFFER),t},r.merge=function(t){for(var e=new r,n=[],i=[],o=[],a,s=0;s<t.length;s++){a=t[s];for(var u=0;u<a.buffers.length;u++)i[u]=i[u]||0,i[u]+=a.buffers[u].data.length,o[u]=0}for(var s=0;s<a.buffers.length;s++)n[s]=new by[_h(a.buffers[s].data)](i[s]),e.buffers[s]=new Dt(n[s]);for(var s=0;s<t.length;s++){a=t[s];for(var u=0;u<a.buffers.length;u++)n[u].set(a.buffers[u].data,o[u]),o[u]+=a.buffers[u].data.length}if(e.attributes=a.attributes,a.indexBuffer){e.indexBuffer=e.buffers[a.buffers.indexOf(a.indexBuffer)],e.indexBuffer.type=ge.ELEMENT_ARRAY_BUFFER;for(var h=0,l=0,f=0,c=0,s=0;s<a.buffers.length;s++)if(a.buffers[s]!==a.indexBuffer){c=s;break}for(var s in a.attributes){var d=a.attributes[s];(d.buffer|0)===c&&(l+=d.size*Dh[d.type]/4)}for(var s=0;s<t.length;s++){for(var p=t[s].indexBuffer.data,u=0;u<p.length;u++)e.indexBuffer.data[u+f]+=h;h+=t[s].buffers[c].data.length/l,f+=p.length}}return e},r}(),xy=function(r){bt(t,r);function t(){var e=r.call(this)||this;return e.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2]),e}return t}(xn),Fh=function(r){bt(t,r);function t(){var e=r.call(this)||this;return e.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),e.uvs=new Float32Array([0,0,1,0,1,1,0,1]),e.vertexBuffer=new Dt(e.vertices),e.uvBuffer=new Dt(e.uvs),e.addAttribute("aVertexPosition",e.vertexBuffer).addAttribute("aTextureCoord",e.uvBuffer).addIndex([0,1,2,0,2,3]),e}return t.prototype.map=function(e,n){var i=0,o=0;return this.uvs[0]=i,this.uvs[1]=o,this.uvs[2]=i+n.width/e.width,this.uvs[3]=o,this.uvs[4]=i+n.width/e.width,this.uvs[5]=o+n.height/e.height,this.uvs[6]=i,this.uvs[7]=o+n.height/e.height,i=n.x,o=n.y,this.vertices[0]=i,this.vertices[1]=o,this.vertices[2]=i+n.width,this.vertices[3]=o,this.vertices[4]=i+n.width,this.vertices[5]=o+n.height,this.vertices[6]=i,this.vertices[7]=o+n.height,this.invalidate(),this},t.prototype.invalidate=function(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this},t}(xn),Ey=0,lr=function(){function r(t,e,n){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=Ey++,this.static=!!e,this.ubo=!!n,t instanceof Dt?(this.buffer=t,this.buffer.type=ge.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=t,this.ubo&&(this.buffer=new Dt(new Float32Array(1)),this.buffer.type=ge.UNIFORM_BUFFER,this.autoManage=!0))}return r.prototype.update=function(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update()},r.prototype.add=function(t,e,n){if(!this.ubo)this.uniforms[t]=new r(e,n);else throw new Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them")},r.from=function(t,e,n){return new r(t,e,n)},r.uboFrom=function(t,e){return new r(t,e??!0,!0)},r}(),Ty=function(){function r(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=wt.NONE,this.sourceFrame=new st,this.destinationFrame=new st,this.bindingSourceFrame=new st,this.bindingDestinationFrame=new st,this.filters=[],this.transform=null}return r.prototype.clear=function(){this.target=null,this.filters=null,this.renderTexture=null},r}(),mi=[new Et,new Et,new Et,new Et],la=new Mt,wy=function(){function r(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new vy,this.texturePool.setScreenSize(t.view),this.statePool=[],this.quad=new xy,this.quadUv=new Fh,this.tempRect=new st,this.activeState={},this.globalUniforms=new lr({outputFrame:new st,inputSize:new Float32Array(4),inputPixel:new Float32Array(4),inputClamp:new Float32Array(4),resolution:1,filterArea:new Float32Array(4),filterClamp:new Float32Array(4)},!0),this.forceClear=!1,this.useMaxPadding=!1}return r.prototype.push=function(t,e){for(var n,i,o=this.renderer,a=this.defaultFilterStack,s=this.statePool.pop()||new Ty,u=this.renderer.renderTexture,h=e[0].resolution,l=e[0].multisample,f=e[0].padding,c=e[0].autoFit,d=(n=e[0].legacy)!==null&&n!==void 0?n:!0,p=1;p<e.length;p++){var v=e[p];h=Math.min(h,v.resolution),l=Math.min(l,v.multisample),f=this.useMaxPadding?Math.max(f,v.padding):f+v.padding,c=c&&v.autoFit,d=d||((i=v.legacy)!==null&&i!==void 0?i:!0)}a.length===1&&(this.defaultFilterStack[0].renderTexture=u.current),a.push(s),s.resolution=h,s.multisample=l,s.legacy=d,s.target=t,s.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),s.sourceFrame.pad(f);var _=this.tempRect.copyFrom(u.sourceFrame);o.projection.transform&&this.transformAABB(la.copyFrom(o.projection.transform).invert(),_),c?(s.sourceFrame.fit(_),(s.sourceFrame.width<=0||s.sourceFrame.height<=0)&&(s.sourceFrame.width=0,s.sourceFrame.height=0)):s.sourceFrame.intersects(_)||(s.sourceFrame.width=0,s.sourceFrame.height=0),this.roundFrame(s.sourceFrame,u.current?u.current.resolution:o.resolution,u.sourceFrame,u.destinationFrame,o.projection.transform),s.renderTexture=this.getOptimalFilterTexture(s.sourceFrame.width,s.sourceFrame.height,h,l),s.filters=e,s.destinationFrame.width=s.renderTexture.width,s.destinationFrame.height=s.renderTexture.height;var m=this.tempRect;m.x=0,m.y=0,m.width=s.sourceFrame.width,m.height=s.sourceFrame.height,s.renderTexture.filterFrame=s.sourceFrame,s.bindingSourceFrame.copyFrom(u.sourceFrame),s.bindingDestinationFrame.copyFrom(u.destinationFrame),s.transform=o.projection.transform,o.projection.transform=null,u.bind(s.renderTexture,s.sourceFrame,m),o.framebuffer.clear(0,0,0,0)},r.prototype.pop=function(){var t=this.defaultFilterStack,e=t.pop(),n=e.filters;this.activeState=e;var i=this.globalUniforms.uniforms;i.outputFrame=e.sourceFrame,i.resolution=e.resolution;var o=i.inputSize,a=i.inputPixel,s=i.inputClamp;if(o[0]=e.destinationFrame.width,o[1]=e.destinationFrame.height,o[2]=1/o[0],o[3]=1/o[1],a[0]=Math.round(o[0]*e.resolution),a[1]=Math.round(o[1]*e.resolution),a[2]=1/a[0],a[3]=1/a[1],s[0]=.5*a[2],s[1]=.5*a[3],s[2]=e.sourceFrame.width*o[2]-.5*a[2],s[3]=e.sourceFrame.height*o[3]-.5*a[3],e.legacy){var u=i.filterArea;u[0]=e.destinationFrame.width,u[1]=e.destinationFrame.height,u[2]=e.sourceFrame.x,u[3]=e.sourceFrame.y,i.filterClamp=i.inputClamp}this.globalUniforms.update();var h=t[t.length-1];if(this.renderer.framebuffer.blit(),n.length===1)n[0].apply(this,e.renderTexture,h.renderTexture,ue.BLEND,e),this.returnFilterTexture(e.renderTexture);else{var l=e.renderTexture,f=this.getOptimalFilterTexture(l.width,l.height,e.resolution);f.filterFrame=l.filterFrame;var c=0;for(c=0;c<n.length-1;++c){c===1&&e.multisample>1&&(f=this.getOptimalFilterTexture(l.width,l.height,e.resolution),f.filterFrame=l.filterFrame),n[c].apply(this,l,f,ue.CLEAR,e);var d=l;l=f,f=d}n[c].apply(this,l,h.renderTexture,ue.BLEND,e),c>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(l),this.returnFilterTexture(f)}e.clear(),this.statePool.push(e)},r.prototype.bindAndClear=function(t,e){e===void 0&&(e=ue.CLEAR);var n=this.renderer,i=n.renderTexture,o=n.state;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,t&&t.filterFrame){var a=this.tempRect;a.x=0,a.y=0,a.width=t.filterFrame.width,a.height=t.filterFrame.height,i.bind(t,t.filterFrame,a)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?i.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);var s=o.stateId&1||this.forceClear;(e===ue.CLEAR||e===ue.BLIT&&s)&&this.renderer.framebuffer.clear(0,0,0,0)},r.prototype.applyFilter=function(t,e,n,i){var o=this.renderer;o.state.set(t.state),this.bindAndClear(n,i),t.uniforms.uSampler=e,t.uniforms.filterGlobals=this.globalUniforms,o.shader.bind(t),t.legacy=!!t.program.attributeData.aTextureCoord,t.legacy?(this.quadUv.map(e._frame,e.filterFrame),o.geometry.bind(this.quadUv),o.geometry.draw(oe.TRIANGLES)):(o.geometry.bind(this.quad),o.geometry.draw(oe.TRIANGLE_STRIP))},r.prototype.calculateSpriteMatrix=function(t,e){var n=this.activeState,i=n.sourceFrame,o=n.destinationFrame,a=e._texture.orig,s=t.set(o.width,0,0,o.height,i.x,i.y),u=e.worldTransform.copyTo(Mt.TEMP_MATRIX);return u.invert(),s.prepend(u),s.scale(1/a.width,1/a.height),s.translate(e.anchor.x,e.anchor.y),s},r.prototype.destroy=function(){this.renderer=null,this.texturePool.clear(!1)},r.prototype.getOptimalFilterTexture=function(t,e,n,i){return n===void 0&&(n=1),i===void 0&&(i=wt.NONE),this.texturePool.getOptimalTexture(t,e,n,i)},r.prototype.getFilterTexture=function(t,e,n){if(typeof t=="number"){var i=t;t=e,e=i}t=t||this.activeState.renderTexture;var o=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,n||wt.NONE);return o.filterFrame=t.filterFrame,o},r.prototype.returnFilterTexture=function(t){this.texturePool.returnTexture(t)},r.prototype.emptyPool=function(){this.texturePool.clear(!0)},r.prototype.resize=function(){this.texturePool.setScreenSize(this.renderer.view)},r.prototype.transformAABB=function(t,e){var n=mi[0],i=mi[1],o=mi[2],a=mi[3];n.set(e.left,e.top),i.set(e.left,e.bottom),o.set(e.right,e.top),a.set(e.right,e.bottom),t.apply(n,n),t.apply(i,i),t.apply(o,o),t.apply(a,a);var s=Math.min(n.x,i.x,o.x,a.x),u=Math.min(n.y,i.y,o.y,a.y),h=Math.max(n.x,i.x,o.x,a.x),l=Math.max(n.y,i.y,o.y,a.y);e.x=s,e.y=u,e.width=h-s,e.height=l-u},r.prototype.roundFrame=function(t,e,n,i,o){if(!(t.width<=0||t.height<=0||n.width<=0||n.height<=0)){if(o){var a=o.a,s=o.b,u=o.c,h=o.d;if((Math.abs(s)>1e-4||Math.abs(u)>1e-4)&&(Math.abs(a)>1e-4||Math.abs(h)>1e-4))return}o=o?la.copyFrom(o):la.identity(),o.translate(-n.x,-n.y).scale(i.width/n.width,i.height/n.height).translate(i.x,i.y),this.transformAABB(o,t),t.ceil(e),this.transformAABB(o.invert(),t)}},r}(),gi=function(){function r(t){this.renderer=t}return r.prototype.flush=function(){},r.prototype.destroy=function(){this.renderer=null},r.prototype.start=function(){},r.prototype.stop=function(){this.flush()},r.prototype.render=function(t){},r}(),Sy=function(){function r(t){this.renderer=t,this.emptyRenderer=new gi(t),this.currentRenderer=this.emptyRenderer}return r.prototype.setObjectRenderer=function(t){this.currentRenderer!==t&&(this.currentRenderer.stop(),this.currentRenderer=t,this.currentRenderer.start())},r.prototype.flush=function(){this.setObjectRenderer(this.emptyRenderer)},r.prototype.reset=function(){this.setObjectRenderer(this.emptyRenderer)},r.prototype.copyBoundTextures=function(t,e){for(var n=this.renderer.texture.boundTextures,i=e-1;i>=0;--i)t[i]=n[i]||null,t[i]&&(t[i]._batchLocation=i)},r.prototype.boundArray=function(t,e,n,i){for(var o=t.elements,a=t.ids,s=t.count,u=0,h=0;h<s;h++){var l=o[h],f=l._batchLocation;if(f>=0&&f<i&&e[f]===l){a[h]=f;continue}for(;u<i;){var c=e[u];if(c&&c._batchEnabled===n&&c._batchLocation===u){u++;continue}a[h]=u,l._batchLocation=u,e[u]=l;break}}},r.prototype.destroy=function(){this.renderer=null},r}(),Bh=0,Ay=function(){function r(t){this.renderer=t,this.webGLVersion=1,this.extensions={},this.supports={uint32Indices:!1},this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this),t.view.addEventListener("webglcontextlost",this.handleContextLost,!1),t.view.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}return Object.defineProperty(r.prototype,"isLost",{get:function(){return!this.gl||this.gl.isContextLost()},enumerable:!1,configurable:!0}),r.prototype.contextChange=function(t){this.gl=t,this.renderer.gl=t,this.renderer.CONTEXT_UID=Bh++},r.prototype.initFromContext=function(t){this.gl=t,this.validateContext(t),this.renderer.gl=t,this.renderer.CONTEXT_UID=Bh++,this.renderer.runners.contextChange.emit(t)},r.prototype.initFromOptions=function(t){var e=this.createContext(this.renderer.view,t);this.initFromContext(e)},r.prototype.createContext=function(t,e){var n;if(k.PREFER_ENV>=Se.WEBGL2&&(n=t.getContext("webgl2",e)),n)this.webGLVersion=2;else if(this.webGLVersion=1,n=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!n)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=n,this.getExtensions(),this.gl},r.prototype.getExtensions=function(){var t=this.gl,e={loseContext:t.getExtension("WEBGL_lose_context"),anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc")};this.webGLVersion===1?Object.assign(this.extensions,e,{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear")}):this.webGLVersion===2&&Object.assign(this.extensions,e,{colorBufferFloat:t.getExtension("EXT_color_buffer_float")})},r.prototype.handleContextLost=function(t){var e=this;t.preventDefault(),setTimeout(function(){e.gl.isContextLost()&&e.extensions.loseContext&&e.extensions.loseContext.restoreContext()},0)},r.prototype.handleContextRestored=function(){this.renderer.runners.contextChange.emit(this.gl)},r.prototype.destroy=function(){var t=this.renderer.view;this.renderer=null,t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()},r.prototype.postrender=function(){this.renderer.renderingToScreen&&this.gl.flush()},r.prototype.validateContext=function(t){var e=t.getContextAttributes(),n="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;n&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");var i=n||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=i,i||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")},r}(),Py=function(){function r(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=wt.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}return r}(),Oy=new st,Ry=function(){function r(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new ha(10,10),this.msaaSamples=null}return r.prototype.contextChange=function(){this.disposeAll(!0);var t=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new st,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){var e=this.renderer.context.extensions.drawBuffers,n=this.renderer.context.extensions.depthTexture;k.PREFER_ENV===Se.WEBGL_LEGACY&&(e=null,n=null),e?t.drawBuffers=function(i){return e.drawBuffersWEBGL(i)}:(this.hasMRT=!1,t.drawBuffers=function(){}),n||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)},r.prototype.bind=function(t,e,n){n===void 0&&(n=0);var i=this.gl;if(t){var o=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,i.bindFramebuffer(i.FRAMEBUFFER,o.framebuffer)),o.mipLevel!==n&&(t.dirtyId++,t.dirtyFormat++,o.mipLevel=n),o.dirtyId!==t.dirtyId&&(o.dirtyId=t.dirtyId,o.dirtyFormat!==t.dirtyFormat?(o.dirtyFormat=t.dirtyFormat,o.dirtySize=t.dirtySize,this.updateFramebuffer(t,n)):o.dirtySize!==t.dirtySize&&(o.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(var a=0;a<t.colorTextures.length;a++){var s=t.colorTextures[a];this.renderer.texture.unbind(s.parentTextureArray||s)}if(t.depthTexture&&this.renderer.texture.unbind(t.depthTexture),e){var u=e.width>>n,h=e.height>>n,l=u/e.width;this.setViewport(e.x*l,e.y*l,u,h)}else{var u=t.width>>n,h=t.height>>n;this.setViewport(0,0,u,h)}}else this.current&&(this.current=null,i.bindFramebuffer(i.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)},r.prototype.setViewport=function(t,e,n,i){var o=this.viewport;t=Math.round(t),e=Math.round(e),n=Math.round(n),i=Math.round(i),(o.width!==n||o.height!==i||o.x!==t||o.y!==e)&&(o.x=t,o.y=e,o.width=n,o.height=i,this.gl.viewport(t,e,n,i))},Object.defineProperty(r.prototype,"size",{get:function(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}},enumerable:!1,configurable:!0}),r.prototype.clear=function(t,e,n,i,o){o===void 0&&(o=jn.COLOR|jn.DEPTH);var a=this.gl;a.clearColor(t,e,n,i),a.clear(o)},r.prototype.initFramebuffer=function(t){var e=this.gl,n=new Py(e.createFramebuffer());return n.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=n,this.managedFramebuffers.push(t),t.disposeRunner.add(this),n},r.prototype.resizeFramebuffer=function(t){var e=this.gl,n=t.glFramebuffers[this.CONTEXT_UID];n.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,n.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,n.multisample,e.RGBA8,t.width,t.height)),n.stencil&&(e.bindRenderbuffer(e.RENDERBUFFER,n.stencil),n.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,n.multisample,e.DEPTH24_STENCIL8,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,t.width,t.height));var i=t.colorTextures,o=i.length;e.drawBuffers||(o=Math.min(o,1));for(var a=0;a<o;a++){var s=i[a],u=s.parentTextureArray||s;this.renderer.texture.bind(u,0)}t.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(t.depthTexture,0)},r.prototype.updateFramebuffer=function(t,e){var n=this.gl,i=t.glFramebuffers[this.CONTEXT_UID],o=t.colorTextures,a=o.length;n.drawBuffers||(a=Math.min(a,1)),i.multisample>1&&this.canMultisampleFramebuffer(t)?(i.msaaBuffer=i.msaaBuffer||n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,i.msaaBuffer),n.renderbufferStorageMultisample(n.RENDERBUFFER,i.multisample,n.RGBA8,t.width,t.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,i.msaaBuffer)):i.msaaBuffer&&(n.deleteRenderbuffer(i.msaaBuffer),i.msaaBuffer=null,i.blitFramebuffer&&(i.blitFramebuffer.dispose(),i.blitFramebuffer=null));for(var s=[],u=0;u<a;u++){var h=o[u],l=h.parentTextureArray||h;this.renderer.texture.bind(l,0),!(u===0&&i.msaaBuffer)&&(n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+u,h.target,l._glTextures[this.CONTEXT_UID].texture,e),s.push(n.COLOR_ATTACHMENT0+u))}if(s.length>1&&n.drawBuffers(s),t.depthTexture){var f=this.writeDepthTexture;if(f){var c=t.depthTexture;this.renderer.texture.bind(c,0),n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,c._glTextures[this.CONTEXT_UID].texture,e)}}(t.stencil||t.depth)&&!(t.depthTexture&&this.writeDepthTexture)?(i.stencil=i.stencil||n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,i.stencil),i.msaaBuffer?n.renderbufferStorageMultisample(n.RENDERBUFFER,i.multisample,n.DEPTH24_STENCIL8,t.width,t.height):n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,t.width,t.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,i.stencil)):i.stencil&&(n.deleteRenderbuffer(i.stencil),i.stencil=null)},r.prototype.canMultisampleFramebuffer=function(t){return this.renderer.context.webGLVersion!==1&&t.colorTextures.length<=1&&!t.depthTexture},r.prototype.detectSamples=function(t){var e=this.msaaSamples,n=wt.NONE;if(t<=1||e===null)return n;for(var i=0;i<e.length;i++)if(e[i]<=t){n=e[i];break}return n===1&&(n=wt.NONE),n},r.prototype.blit=function(t,e,n){var i=this,o=i.current,a=i.renderer,s=i.gl,u=i.CONTEXT_UID;if(a.context.webGLVersion===2&&o){var h=o.glFramebuffers[u];if(h){if(!t){if(!h.msaaBuffer)return;var l=o.colorTextures[0];if(!l)return;h.blitFramebuffer||(h.blitFramebuffer=new ha(o.width,o.height),h.blitFramebuffer.addColorTexture(0,l)),t=h.blitFramebuffer,t.colorTextures[0]!==l&&(t.colorTextures[0]=l,t.dirtyId++,t.dirtyFormat++),(t.width!==o.width||t.height!==o.height)&&(t.width=o.width,t.height=o.height,t.dirtyId++,t.dirtySize++)}e||(e=Oy,e.width=o.width,e.height=o.height),n||(n=e);var f=e.width===n.width&&e.height===n.height;this.bind(t),s.bindFramebuffer(s.READ_FRAMEBUFFER,h.framebuffer),s.blitFramebuffer(e.left,e.top,e.right,e.bottom,n.left,n.top,n.right,n.bottom,s.COLOR_BUFFER_BIT,f?s.NEAREST:s.LINEAR)}}},r.prototype.disposeFramebuffer=function(t,e){var n=t.glFramebuffers[this.CONTEXT_UID],i=this.gl;if(n){delete t.glFramebuffers[this.CONTEXT_UID];var o=this.managedFramebuffers.indexOf(t);o>=0&&this.managedFramebuffers.splice(o,1),t.disposeRunner.remove(this),e||(i.deleteFramebuffer(n.framebuffer),n.msaaBuffer&&i.deleteRenderbuffer(n.msaaBuffer),n.stencil&&i.deleteRenderbuffer(n.stencil)),n.blitFramebuffer&&n.blitFramebuffer.dispose()}},r.prototype.disposeAll=function(t){var e=this.managedFramebuffers;this.managedFramebuffers=[];for(var n=0;n<e.length;n++)this.disposeFramebuffer(e[n],t)},r.prototype.forceStencil=function(){var t=this.current;if(t){var e=t.glFramebuffers[this.CONTEXT_UID];if(!(!e||e.stencil)){t.stencil=!0;var n=t.width,i=t.height,o=this.gl,a=o.createRenderbuffer();o.bindRenderbuffer(o.RENDERBUFFER,a),e.msaaBuffer?o.renderbufferStorageMultisample(o.RENDERBUFFER,e.multisample,o.DEPTH24_STENCIL8,n,i):o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_STENCIL,n,i),e.stencil=a,o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_STENCIL_ATTACHMENT,o.RENDERBUFFER,a)}}},r.prototype.reset=function(){this.current=this.unknownFramebuffer,this.viewport=new st},r.prototype.destroy=function(){this.renderer=null},r}(),fa={5126:4,5123:2,5121:1},Iy=function(){function r(t){this.renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this.canUseUInt32ElementIndex=!1,this.managedGeometries={}}return r.prototype.contextChange=function(){this.disposeAll(!0);var t=this.gl=this.renderer.gl,e=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,e.webGLVersion!==2){var n=this.renderer.context.extensions.vertexArrayObject;k.PREFER_ENV===Se.WEBGL_LEGACY&&(n=null),n?(t.createVertexArray=function(){return n.createVertexArrayOES()},t.bindVertexArray=function(o){return n.bindVertexArrayOES(o)},t.deleteVertexArray=function(o){return n.deleteVertexArrayOES(o)}):(this.hasVao=!1,t.createVertexArray=function(){return null},t.bindVertexArray=function(){return null},t.deleteVertexArray=function(){return null})}if(e.webGLVersion!==2){var i=t.getExtension("ANGLE_instanced_arrays");i?(t.vertexAttribDivisor=function(o,a){return i.vertexAttribDivisorANGLE(o,a)},t.drawElementsInstanced=function(o,a,s,u,h){return i.drawElementsInstancedANGLE(o,a,s,u,h)},t.drawArraysInstanced=function(o,a,s,u){return i.drawArraysInstancedANGLE(o,a,s,u)}):this.hasInstance=!1}this.canUseUInt32ElementIndex=e.webGLVersion===2||!!e.extensions.uint32ElementIndex},r.prototype.bind=function(t,e){e=e||this.renderer.shader.shader;var n=this.gl,i=t.glVertexArrayObjects[this.CONTEXT_UID],o=!1;i||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=i={},o=!0);var a=i[e.program.id]||this.initGeometryVao(t,e,o);this._activeGeometry=t,this._activeVao!==a&&(this._activeVao=a,this.hasVao?n.bindVertexArray(a):this.activateVao(t,e.program)),this.updateBuffers()},r.prototype.reset=function(){this.unbind()},r.prototype.updateBuffers=function(){for(var t=this._activeGeometry,e=this.renderer.buffer,n=0;n<t.buffers.length;n++){var i=t.buffers[n];e.update(i)}},r.prototype.checkCompatibility=function(t,e){var n=t.attributes,i=e.attributeData;for(var o in i)if(!n[o])throw new Error('shader and geometry incompatible, geometry missing the "'+o+'" attribute')},r.prototype.getSignature=function(t,e){var n=t.attributes,i=e.attributeData,o=["g",t.id];for(var a in n)i[a]&&o.push(a,i[a].location);return o.join("-")},r.prototype.initGeometryVao=function(t,e,n){n===void 0&&(n=!0);var i=this.gl,o=this.CONTEXT_UID,a=this.renderer.buffer,s=e.program;s.glPrograms[o]||this.renderer.shader.generateProgram(e),this.checkCompatibility(t,s);var u=this.getSignature(t,s),h=t.glVertexArrayObjects[this.CONTEXT_UID],l=h[u];if(l)return h[s.id]=l,l;var f=t.buffers,c=t.attributes,d={},p={};for(var v in f)d[v]=0,p[v]=0;for(var v in c)!c[v].size&&s.attributeData[v]?c[v].size=s.attributeData[v].size:c[v].size||console.warn("PIXI Geometry attribute '"+v+"' size cannot be determined (likely the bound shader does not have the attribute)"),d[c[v].buffer]+=c[v].size*fa[c[v].type];for(var v in c){var _=c[v],m=_.size;_.stride===void 0&&(d[_.buffer]===m*fa[_.type]?_.stride=0:_.stride=d[_.buffer]),_.start===void 0&&(_.start=p[_.buffer],p[_.buffer]+=m*fa[_.type])}l=i.createVertexArray(),i.bindVertexArray(l);for(var g=0;g<f.length;g++){var y=f[g];a.bind(y),n&&y._glBuffers[o].refCount++}return this.activateVao(t,s),this._activeVao=l,h[s.id]=l,h[u]=l,l},r.prototype.disposeGeometry=function(t,e){var n;if(this.managedGeometries[t.id]){delete this.managedGeometries[t.id];var i=t.glVertexArrayObjects[this.CONTEXT_UID],o=this.gl,a=t.buffers,s=(n=this.renderer)===null||n===void 0?void 0:n.buffer;if(t.disposeRunner.remove(this),!!i){if(s)for(var u=0;u<a.length;u++){var h=a[u]._glBuffers[this.CONTEXT_UID];h&&(h.refCount--,h.refCount===0&&!e&&s.dispose(a[u],e))}if(!e){for(var l in i)if(l[0]==="g"){var f=i[l];this._activeVao===f&&this.unbind(),o.deleteVertexArray(f)}}delete t.glVertexArrayObjects[this.CONTEXT_UID]}}},r.prototype.disposeAll=function(t){for(var e=Object.keys(this.managedGeometries),n=0;n<e.length;n++)this.disposeGeometry(this.managedGeometries[e[n]],t)},r.prototype.activateVao=function(t,e){var n=this.gl,i=this.CONTEXT_UID,o=this.renderer.buffer,a=t.buffers,s=t.attributes;t.indexBuffer&&o.bind(t.indexBuffer);var u=null;for(var h in s){var l=s[h],f=a[l.buffer],c=f._glBuffers[i];if(e.attributeData[h]){u!==c&&(o.bind(f),u=c);var d=e.attributeData[h].location;if(n.enableVertexAttribArray(d),n.vertexAttribPointer(d,l.size,l.type||n.FLOAT,l.normalized,l.stride,l.start),l.instance)if(this.hasInstance)n.vertexAttribDivisor(d,1);else throw new Error("geometry error, GPU Instancing is not supported on this device")}}},r.prototype.draw=function(t,e,n,i){var o=this.gl,a=this._activeGeometry;if(a.indexBuffer){var s=a.indexBuffer.data.BYTES_PER_ELEMENT,u=s===2?o.UNSIGNED_SHORT:o.UNSIGNED_INT;s===2||s===4&&this.canUseUInt32ElementIndex?a.instanced?o.drawElementsInstanced(t,e||a.indexBuffer.data.length,u,(n||0)*s,i||1):o.drawElements(t,e||a.indexBuffer.data.length,u,(n||0)*s):console.warn("unsupported index buffer type: uint32")}else a.instanced?o.drawArraysInstanced(t,n,e||a.getSize(),i||1):o.drawArrays(t,n,e||a.getSize());return this},r.prototype.unbind=function(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null},r.prototype.destroy=function(){this.renderer=null},r}(),Cy=function(){function r(t){t===void 0&&(t=null),this.type=Ct.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=k.FILTER_MULTISAMPLE,this.enabled=!0,this.colorMask=15,this._filters=null,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._scissorRectLocal=null,this._colorMask=15,this._target=null}return Object.defineProperty(r.prototype,"filter",{get:function(){return this._filters?this._filters[0]:null},set:function(t){t?this._filters?this._filters[0]=t:this._filters=[t]:this._filters=null},enumerable:!1,configurable:!0}),r.prototype.reset=function(){this.pooled&&(this.maskObject=null,this.type=Ct.NONE,this.autoDetect=!0),this._target=null,this._scissorRectLocal=null},r.prototype.copyCountersOrReset=function(t){t?(this._stencilCounter=t._stencilCounter,this._scissorCounter=t._scissorCounter,this._scissorRect=t._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)},r}();function Nh(r,t,e){var n=r.createShader(t);return r.shaderSource(n,e),r.compileShader(n),n}function Lh(r,t){var e=r.getShaderSource(t).split(`
117
- `).map(function(h,l){return l+": "+h}),n=r.getShaderInfoLog(t),i=n.split(`
118
- `),o={},a=i.map(function(h){return parseFloat(h.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))}).filter(function(h){return h&&!o[h]?(o[h]=!0,!0):!1}),s=[""];a.forEach(function(h){e[h-1]="%c"+e[h-1]+"%c",s.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});var u=e.join(`
119
- `);s[0]=u,console.error(n),console.groupCollapsed("click to view full shader code"),console.warn.apply(console,s),console.groupEnd()}function My(r,t,e,n){r.getProgramParameter(t,r.LINK_STATUS)||(r.getShaderParameter(e,r.COMPILE_STATUS)||Lh(r,e),r.getShaderParameter(n,r.COMPILE_STATUS)||Lh(r,n),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(t)))}function ca(r){for(var t=new Array(r),e=0;e<t.length;e++)t[e]=!1;return t}function Uh(r,t){switch(r){case"float":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*t);case"ivec3":return new Int32Array(3*t);case"ivec4":return new Int32Array(4*t);case"uvec2":return new Uint32Array(2*t);case"uvec3":return new Uint32Array(3*t);case"uvec4":return new Uint32Array(4*t);case"bool":return!1;case"bvec2":return ca(2*t);case"bvec3":return ca(3*t);case"bvec4":return ca(4*t);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var Gh={},En=Gh;function Dy(){if(En===Gh||En&&En.isContextLost()){var r=k.ADAPTER.createCanvas(),t=void 0;k.PREFER_ENV>=Se.WEBGL2&&(t=r.getContext("webgl2",{})),t||(t=r.getContext("webgl",{})||r.getContext("experimental-webgl",{}),t?t.getExtension("WEBGL_draw_buffers"):t=null),En=t}return En}var yi;function Fy(){if(!yi){yi=Jt.MEDIUM;var r=Dy();if(r&&r.getShaderPrecisionFormat){var t=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);yi=t.precision?Jt.HIGH:Jt.MEDIUM}}return yi}function kh(r,t,e){if(r.substring(0,9)!=="precision"){var n=t;return t===Jt.HIGH&&e!==Jt.HIGH&&(n=Jt.MEDIUM),"precision "+n+` float;
120
- `+r}else if(e!==Jt.HIGH&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}var By={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function Xh(r){return By[r]}var bi=null,Hh={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function jh(r,t){if(!bi){var e=Object.keys(Hh);bi={};for(var n=0;n<e.length;++n){var i=e[n];bi[r[i]]=Hh[i]}}return bi[t]}var Hr=[{test:function(r){return r.type==="float"&&r.size===1&&!r.isArray},code:function(r){return`
121
- if(uv["`+r+'"] !== ud["'+r+`"].value)
8
+ `),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t}
9
+ Deprecated since v${r}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
10
+ Deprecated since v${r}`),console.warn(i))),au[t]=!0}function be(r){if(typeof r!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(r)}`)}function ls(r){return r.split("?")[0].split("#")[0]}function q_(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function K_(r,t,e){return r.replace(new RegExp(q_(t),"g"),e)}function Z_(r,t){let e="",i=0,s=-1,n=0,o=-1;for(let a=0;a<=r.length;++a){if(a<r.length)o=r.charCodeAt(a);else{if(o===47)break;o=47}if(o===47){if(!(s===a-1||n===1))if(s!==a-1&&n===2){if(e.length<2||i!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){const l=e.lastIndexOf("/");if(l!==e.length-1){l===-1?(e="",i=0):(e=e.slice(0,l),i=e.length-1-e.lastIndexOf("/")),s=a,n=0;continue}}else if(e.length===2||e.length===1){e="",i=0,s=a,n=0;continue}}}else e.length>0?e+=`/${r.slice(s+1,a)}`:e=r.slice(s+1,a),i=a-s-1;s=a,n=0}else o===46&&n!==-1?++n:n=-1}return e}const Gt={toPosix(r){return K_(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){be(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(be(r),this.isDataUrl(r)||this.isBlobUrl(r))return r;const i=ls(this.toPosix(t??W.ADAPTER.getBaseUrl())),s=ls(this.toPosix(e??this.rootname(i)));return r=this.toPosix(r),r.startsWith("/")?Gt.join(s,r.slice(1)):this.isAbsolute(r)?r:this.join(i,r)},normalize(r){if(be(r),r.length===0)return".";if(this.isDataUrl(r)||this.isBlobUrl(r))return r;r=this.toPosix(r);let t="";const e=r.startsWith("/");this.hasProtocol(r)&&(t=this.rootname(r),r=r.slice(t.length));const i=r.endsWith("/");return r=Z_(r),r.length>0&&i&&(r+="/"),e?`/${r}`:t+r},isAbsolute(r){return be(r),r=this.toPosix(r),this.hasProtocol(r)?!0:r.startsWith("/")},join(...r){if(r.length===0)return".";let t;for(let e=0;e<r.length;++e){const i=r[e];if(be(i),i.length>0)if(t===void 0)t=i;else{const s=r[e-1]??"";this.joinExtensions.includes(this.extname(s).toLowerCase())?t+=`/../${i}`:t+=`/${i}`}}return t===void 0?".":this.normalize(t)},dirname(r){if(be(r),r.length===0)return".";r=this.toPosix(r);let t=r.charCodeAt(0);const e=t===47;let i=-1,s=!0;const n=this.getProtocol(r),o=r;r=r.slice(n.length);for(let a=r.length-1;a>=1;--a)if(t=r.charCodeAt(a),t===47){if(!s){i=a;break}}else s=!1;return i===-1?e?"/":this.isUrl(o)?n+r:n:e&&i===1?"//":n+r.slice(0,i)},rootname(r){be(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){be(r),t&&be(t),r=ls(this.toPosix(r));let e=0,i=-1,s=!0,n;if(t!==void 0&&t.length>0&&t.length<=r.length){if(t.length===r.length&&t===r)return"";let o=t.length-1,a=-1;for(n=r.length-1;n>=0;--n){const l=r.charCodeAt(n);if(l===47){if(!s){e=n+1;break}}else a===-1&&(s=!1,a=n+1),o>=0&&(l===t.charCodeAt(o)?--o===-1&&(i=n):(o=-1,i=a))}return e===i?i=a:i===-1&&(i=r.length),r.slice(e,i)}for(n=r.length-1;n>=0;--n)if(r.charCodeAt(n)===47){if(!s){e=n+1;break}}else i===-1&&(s=!1,i=n+1);return i===-1?"":r.slice(e,i)},extname(r){be(r),r=ls(this.toPosix(r));let t=-1,e=0,i=-1,s=!0,n=0;for(let o=r.length-1;o>=0;--o){const a=r.charCodeAt(o);if(a===47){if(!s){e=o+1;break}continue}i===-1&&(s=!1,i=o+1),a===46?t===-1?t=o:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||i===-1||n===0||n===1&&t===i-1&&t===e+1?"":r.slice(t,i)},parse(r){be(r);const t={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return t;r=ls(this.toPosix(r));let e=r.charCodeAt(0);const i=this.isAbsolute(r);let s;t.root=this.rootname(r),i||this.hasProtocol(r)?s=1:s=0;let n=-1,o=0,a=-1,l=!0,h=r.length-1,c=0;for(;h>=s;--h){if(e=r.charCodeAt(h),e===47){if(!l){o=h+1;break}continue}a===-1&&(l=!1,a=h+1),e===46?n===-1?n=h:c!==1&&(c=1):n!==-1&&(c=-1)}return n===-1||a===-1||c===0||c===1&&n===a-1&&n===o+1?a!==-1&&(o===0&&i?t.base=t.name=r.slice(1,a):t.base=t.name=r.slice(o,a)):(o===0&&i?(t.name=r.slice(1,n),t.base=r.slice(1,a)):(t.name=r.slice(o,n),t.base=r.slice(o,a)),t.ext=r.slice(n,a)),t.dir=this.dirname(r),t},sep:"/",delimiter:":",joinExtensions:[".html"]};let va;async function J_(){return va??(va=(async()=>{var n;const r=document.createElement("canvas").getContext("webgl");if(!r)return ie.UNPACK;const t=await new Promise(o=>{const a=document.createElement("video");a.onloadeddata=()=>o(a),a.onerror=()=>o(null),a.autoplay=!1,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load()});if(!t)return ie.UNPACK;const e=r.createTexture();r.bindTexture(r.TEXTURE_2D,e);const i=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,i),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,e,0),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.NONE),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,t);const s=new Uint8Array(4);return r.readPixels(0,0,1,1,r.RGBA,r.UNSIGNED_BYTE,s),r.deleteFramebuffer(i),r.deleteTexture(e),(n=r.getExtension("WEBGL_lose_context"))==null||n.loseContext(),s[0]<=s[3]?ie.PMA:ie.UNPACK})()),va}let xa;function Q_(){return typeof xa>"u"&&(xa=function(){var t;const r={stencil:!0,failIfMajorPerformanceCaveat:W.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!W.ADAPTER.getWebGLRenderingContext())return!1;const e=W.ADAPTER.createCanvas();let i=e.getContext("webgl",r)||e.getContext("experimental-webgl",r);const s=!!((t=i==null?void 0:i.getContextAttributes())!=null&&t.stencil);if(i){const n=i.getExtension("WEBGL_lose_context");n&&n.loseContext()}return i=null,s}catch{return!1}}()),xa}var tv={grad:.9,turn:360,rad:360/(2*Math.PI)},nr=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},$t=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*r)/e+0},pe=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),r>e?e:r>t?r:t},lu=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},hu=function(r){return{r:pe(r.r,0,255),g:pe(r.g,0,255),b:pe(r.b,0,255),a:pe(r.a)}},ba=function(r){return{r:$t(r.r),g:$t(r.g),b:$t(r.b),a:$t(r.a,3)}},ev=/^#([0-9a-f]{3,8})$/i,an=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},cu=function(r){var t=r.r,e=r.g,i=r.b,s=r.a,n=Math.max(t,e,i),o=n-Math.min(t,e,i),a=o?n===t?(e-i)/o:n===e?2+(i-t)/o:4+(t-e)/o:0;return{h:60*(a<0?a+6:a),s:n?o/n*100:0,v:n/255*100,a:s}},uu=function(r){var t=r.h,e=r.s,i=r.v,s=r.a;t=t/360*6,e/=100,i/=100;var n=Math.floor(t),o=i*(1-e),a=i*(1-(t-n)*e),l=i*(1-(1-t+n)*e),h=n%6;return{r:255*[i,a,o,o,l,i][h],g:255*[l,i,i,a,o,o][h],b:255*[o,o,l,i,i,a][h],a:s}},du=function(r){return{h:lu(r.h),s:pe(r.s,0,100),l:pe(r.l,0,100),a:pe(r.a)}},fu=function(r){return{h:$t(r.h),s:$t(r.s),l:$t(r.l),a:$t(r.a,3)}},pu=function(r){return uu((e=(t=r).s,{h:t.h,s:(e*=((i=t.l)<50?i:100-i)/100)>0?2*e/(i+e)*100:0,v:i+e,a:t.a}));var t,e,i},hs=function(r){return{h:(t=cu(r)).h,s:(s=(200-(e=t.s))*(i=t.v)/100)>0&&s<200?e*i/100/(s<=100?s:200-s)*100:0,l:s/2,a:t.a};var t,e,i,s},rv=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,iv=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,sv=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,nv=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,wa={string:[[function(r){var t=ev.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?$t(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?$t(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=sv.exec(r)||nv.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:hu({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=rv.exec(r)||iv.exec(r);if(!t)return null;var e,i,s=du({h:(e=t[1],i=t[2],i===void 0&&(i="deg"),Number(e)*(tv[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return pu(s)},"hsl"]],object:[[function(r){var t=r.r,e=r.g,i=r.b,s=r.a,n=s===void 0?1:s;return nr(t)&&nr(e)&&nr(i)?hu({r:Number(t),g:Number(e),b:Number(i),a:Number(n)}):null},"rgb"],[function(r){var t=r.h,e=r.s,i=r.l,s=r.a,n=s===void 0?1:s;if(!nr(t)||!nr(e)||!nr(i))return null;var o=du({h:Number(t),s:Number(e),l:Number(i),a:Number(n)});return pu(o)},"hsl"],[function(r){var t=r.h,e=r.s,i=r.v,s=r.a,n=s===void 0?1:s;if(!nr(t)||!nr(e)||!nr(i))return null;var o=function(a){return{h:lu(a.h),s:pe(a.s,0,100),v:pe(a.v,0,100),a:pe(a.a)}}({h:Number(t),s:Number(e),v:Number(i),a:Number(n)});return uu(o)},"hsv"]]},mu=function(r,t){for(var e=0;e<t.length;e++){var i=t[e][0](r);if(i)return[i,t[e][1]]}return[null,void 0]},ov=function(r){return typeof r=="string"?mu(r.trim(),wa.string):typeof r=="object"&&r!==null?mu(r,wa.object):[null,void 0]},Ea=function(r,t){var e=hs(r);return{h:e.h,s:pe(e.s+100*t,0,100),l:e.l,a:e.a}},Ta=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},gu=function(r,t){var e=hs(r);return{h:e.h,s:e.s,l:pe(e.l+100*t,0,100),a:e.a}},Aa=function(){function r(t){this.parsed=ov(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 $t(Ta(this.rgba),2)},r.prototype.isDark=function(){return Ta(this.rgba)<.5},r.prototype.isLight=function(){return Ta(this.rgba)>=.5},r.prototype.toHex=function(){return t=ba(this.rgba),e=t.r,i=t.g,s=t.b,o=(n=t.a)<1?an($t(255*n)):"","#"+an(e)+an(i)+an(s)+o;var t,e,i,s,n,o},r.prototype.toRgb=function(){return ba(this.rgba)},r.prototype.toRgbString=function(){return t=ba(this.rgba),e=t.r,i=t.g,s=t.b,(n=t.a)<1?"rgba("+e+", "+i+", "+s+", "+n+")":"rgb("+e+", "+i+", "+s+")";var t,e,i,s,n},r.prototype.toHsl=function(){return fu(hs(this.rgba))},r.prototype.toHslString=function(){return t=fu(hs(this.rgba)),e=t.h,i=t.s,s=t.l,(n=t.a)<1?"hsla("+e+", "+i+"%, "+s+"%, "+n+")":"hsl("+e+", "+i+"%, "+s+"%)";var t,e,i,s,n},r.prototype.toHsv=function(){return t=cu(this.rgba),{h:$t(t.h),s:$t(t.s),v:$t(t.v),a:$t(t.a,3)};var t},r.prototype.invert=function(){return Ge({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),Ge(Ea(this.rgba,t))},r.prototype.desaturate=function(t){return t===void 0&&(t=.1),Ge(Ea(this.rgba,-t))},r.prototype.grayscale=function(){return Ge(Ea(this.rgba,-1))},r.prototype.lighten=function(t){return t===void 0&&(t=.1),Ge(gu(this.rgba,t))},r.prototype.darken=function(t){return t===void 0&&(t=.1),Ge(gu(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"?Ge({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):$t(this.rgba.a,3);var e},r.prototype.hue=function(t){var e=hs(this.rgba);return typeof t=="number"?Ge({h:t,s:e.s,l:e.l,a:e.a}):$t(e.h)},r.prototype.isEqual=function(t){return this.toHex()===Ge(t).toHex()},r}(),Ge=function(r){return r instanceof Aa?r:new Aa(r)},yu=[],av=function(r){r.forEach(function(t){yu.indexOf(t)<0&&(t(Aa,wa),yu.push(t))})};function lv(r,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},i={};for(var s in e)i[e[s]]=s;var n={};r.prototype.toName=function(o){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,l,h=i[this.toHex()];if(h)return h;if(o!=null&&o.closest){var c=this.toRgb(),u=1/0,d="black";if(!n.length)for(var f in e)n[f]=new r(e[f]).toRgb();for(var p in e){var m=(a=c,l=n[p],Math.pow(a.r-l.r,2)+Math.pow(a.g-l.g,2)+Math.pow(a.b-l.b,2));m<u&&(u=m,d=p)}return d}},t.string.push([function(o){var a=o.toLowerCase(),l=a==="transparent"?"#0000":e[a];return l?new r(l).toRgb():null},"name"])}av([lv]);const Ti=class to{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 to)this._value=this.cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set PIXI.Color#value to null");(this._value===null||!this.isSourceEqual(this._value,t))&&(this.normalize(t),this._value=this.cloneSource(t))}}get value(){return this._value}cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?{...t}:t}isSourceEqual(t,e){const i=typeof t;if(i!==typeof e)return!1;if(i==="number"||i==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((s,n)=>s===e[n]);if(t!==null&&e!==null){const s=Object.keys(t),n=Object.keys(e);return s.length!==n.length?!1:s.every(o=>t[o]===e[o])}return t===e}toRgba(){const[t,e,i,s]=this._components;return{r:t,g:e,b:i,a:s}}toRgb(){const[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){const[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){const[e,i,s]=this._components;return t=t??[],t[0]=Math.round(e*255),t[1]=Math.round(i*255),t[2]=Math.round(s*255),t}toRgbArray(t){t=t??[];const[e,i,s]=this._components;return t[0]=e,t[1]=i,t[2]=s,t}toNumber(){return this._int}toLittleEndianNumber(){const t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){const[e,i,s,n]=to.temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=i,this._components[2]*=s,this._components[3]*=n,this.refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this.refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let i=this._int>>16&255,s=this._int>>8&255,n=this._int&255;return e&&(i=i*t+.5|0,s=s*t+.5|0,n=n*t+.5|0),(t*255<<24)+(i<<16)+(s<<8)+n}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const t=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this}round(t){const[e,i,s]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(i*t)/t,this._components[2]=Math.round(s*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t??[];const[e,i,s,n]=this._components;return t[0]=e,t[1]=i,t[2]=s,t[3]=n,t}normalize(t){let e,i,s,n;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){const o=t;e=(o>>16&255)/255,i=(o>>8&255)/255,s=(o&255)/255,n=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,i,s,n=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,i,s,n=255]=t,e/=255,i/=255,s/=255,n/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const a=to.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}const o=Ge(t);o.isValid()&&({r:e,g:i,b:s,a:n}=o.rgba,e/=255,i/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,this._components[2]=s,this._components[3]=n,this.refreshInt();else throw new Error(`Unable to convert color ${t}`)}refreshInt(){this._clamp(this._components);const[t,e,i]=this._components;this._int=(t*255<<16)+(e*255<<8)+(i*255|0)}_clamp(t,e=0,i=1){return typeof t=="number"?Math.min(Math.max(t,e),i):(t.forEach((s,n)=>{t[n]=Math.min(Math.max(s,e),i)}),t)}};Ti.shared=new Ti,Ti.temp=new Ti,Ti.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let xt=Ti;function hv(r){return lt("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),xt.shared.setValue(r).toHex()}function cv(r){return lt("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),xt.shared.setValue(r).toNumber()}function uv(){const r=[],t=[];for(let i=0;i<32;i++)r[i]=i,t[i]=i;r[Q.NORMAL_NPM]=Q.NORMAL,r[Q.ADD_NPM]=Q.ADD,r[Q.SCREEN_NPM]=Q.SCREEN,t[Q.NORMAL]=Q.NORMAL_NPM,t[Q.ADD]=Q.ADD_NPM,t[Q.SCREEN]=Q.SCREEN_NPM;const e=[];return e.push(t),e.push(r),e}const _u=uv();function vu(r,t){return _u[t?1:0][r]}function dv(r,t=null){const e=r*6;if(t=t||new Uint16Array(e),t.length!==e)throw new Error(`Out buffer length is incorrect, got ${t.length} and expected ${e}`);for(let i=0,s=0;i<e;i+=6,s+=4)t[i+0]=s+0,t[i+1]=s+1,t[i+2]=s+2,t[i+3]=s+0,t[i+4]=s+2,t[i+5]=s+3;return t}function xu(r){if(r.BYTES_PER_ELEMENT===4)return r instanceof Float32Array?"Float32Array":r instanceof Uint32Array?"Uint32Array":"Int32Array";if(r.BYTES_PER_ELEMENT===2){if(r instanceof Uint16Array)return"Uint16Array"}else if(r.BYTES_PER_ELEMENT===1&&r instanceof Uint8Array)return"Uint8Array";return null}function ln(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 bu(r){return!(r&r-1)&&!!r}function wu(r){let t=(r>65535?1:0)<<4;r>>>=t;let e=(r>255?1:0)<<3;return r>>>=e,t|=e,e=(r>15?1:0)<<2,r>>>=e,t|=e,e=(r>3?1:0)<<1,r>>>=e,t|=e,t|r>>1}function Ai(r,t,e){const i=r.length;let s;if(t>=i||e===0)return;e=t+e>i?i-t:e;const n=i-e;for(s=t;s<n;++s)r[s]=r[s+e];r.length=n}function _r(r){return r===0?0:r<0?-1:1}let fv=0;function Ur(){return++fv}const Sa=class{constructor(r,t,e,i){this.left=r,this.top=t,this.right=e,this.bottom=i}get width(){return this.right-this.left}get height(){return this.bottom-this.top}isEmpty(){return this.left===this.right||this.top===this.bottom}};Sa.EMPTY=new Sa(0,0,0,0);let Eu=Sa;const Tu={},$e=Object.create(null),vr=Object.create(null);class pv{constructor(t,e,i){this._canvas=W.ADAPTER.createCanvas(),this._context=this._canvas.getContext("2d"),this.resolution=i||W.RESOLUTION,this.resize(t,e)}clear(){this._checkDestroyed(),this._context.setTransform(1,0,0,1,0,0),this._context.clearRect(0,0,this._canvas.width,this._canvas.height)}resize(t,e){this._checkDestroyed(),this._canvas.width=Math.round(t*this.resolution),this._canvas.height=Math.round(e*this.resolution)}destroy(){this._context=null,this._canvas=null}get width(){return this._checkDestroyed(),this._canvas.width}set width(t){this._checkDestroyed(),this._canvas.width=Math.round(t)}get height(){return this._checkDestroyed(),this._canvas.height}set height(t){this._checkDestroyed(),this._canvas.height=Math.round(t)}get canvas(){return this._checkDestroyed(),this._canvas}get context(){return this._checkDestroyed(),this._context}_checkDestroyed(){if(this._canvas===null)throw new TypeError("The CanvasRenderTarget has already been destroyed")}}function Au(r,t,e){for(let i=0,s=4*e*t;i<t;++i,s+=4)if(r[s+3]!==0)return!1;return!0}function Su(r,t,e,i,s){const n=4*t;for(let o=i,a=i*n+4*e;o<=s;++o,a+=n)if(r[a+3]!==0)return!1;return!0}function mv(r){const{width:t,height:e}=r,i=r.getContext("2d",{willReadFrequently:!0});if(i===null)throw new TypeError("Failed to get canvas 2D context");const s=i.getImageData(0,0,t,e).data;let n=0,o=0,a=t-1,l=e-1;for(;o<e&&Au(s,t,o);)++o;if(o===e)return Eu.EMPTY;for(;Au(s,t,l);)--l;for(;Su(s,t,n,o,l);)++n;for(;Su(s,t,a,o,l);)--a;return++a,++l,new Eu(n,o,a,l)}function gv(r){const t=mv(r),{width:e,height:i}=t;let s=null;if(!t.isEmpty()){const n=r.getContext("2d");if(n===null)throw new TypeError("Failed to get canvas 2D context");s=n.getImageData(t.left,t.top,e,i)}return{width:e,height:i,data:s}}function yv(r,t=globalThis.location){if(r.startsWith("data:"))return"";t=t||globalThis.location;const e=new URL(r,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}function or(r,t=1){var i;const e=(i=W.RETINA_PREFIX)==null?void 0:i.exec(r);return e?parseFloat(e[1]):t}var V=(r=>(r.Renderer="renderer",r.Application="application",r.RendererSystem="renderer-webgl-system",r.RendererPlugin="renderer-webgl-plugin",r.CanvasRendererSystem="renderer-canvas-system",r.CanvasRendererPlugin="renderer-canvas-plugin",r.Asset="asset",r.LoadParser="load-parser",r.ResolveParser="resolve-parser",r.CacheParser="cache-parser",r.DetectionParser="detection-parser",r))(V||{});const Ca=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},Cu=(r,t)=>Ca(r).priority??t,j={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(Ca).forEach(t=>{t.type.forEach(e=>{var i,s;return(s=(i=this._removeHandlers)[e])==null?void 0:s.call(i,t)})}),this},add(...r){return r.map(Ca).forEach(t=>{t.type.forEach(e=>{var n,o;const i=this._addHandlers,s=this._queue;i[e]?(n=i[e])==null||n.call(i,t):(s[e]=s[e]||[],(o=s[e])==null||o.push(t))})}),this},handle(r,t,e){var o;const i=this._addHandlers,s=this._removeHandlers;if(i[r]||s[r])throw new Error(`Extension type ${r} already has a handler`);i[r]=t,s[r]=e;const n=this._queue;return n[r]&&((o=n[r])==null||o.forEach(a=>t(a)),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]})},handleByList(r,t,e=-1){return this.handle(r,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((s,n)=>Cu(n,e)-Cu(s,e)))},i=>{const s=t.indexOf(i.ref);s!==-1&&t.splice(s,1)})}};class Ia{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get uint16View(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}}const _v=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
11
+ `);function vv(r){let t="";for(let e=0;e<r;++e)e>0&&(t+=`
12
+ else `),e<r-1&&(t+=`if(test == ${e}.0){}`);return t}function xv(r,t){if(r===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const e=t.createShader(t.FRAGMENT_SHADER);for(;;){const i=_v.replace(/%forloop%/gi,vv(r));if(t.shaderSource(e,i),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))r=r/2|0;else break}return r}const Ra=0,Pa=1,Ma=2,Ba=3,Da=4,Oa=5;class He{constructor(){this.data=0,this.blendMode=Q.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Ra)}set blend(t){!!(this.data&1<<Ra)!==t&&(this.data^=1<<Ra)}get offsets(){return!!(this.data&1<<Pa)}set offsets(t){!!(this.data&1<<Pa)!==t&&(this.data^=1<<Pa)}get culling(){return!!(this.data&1<<Ma)}set culling(t){!!(this.data&1<<Ma)!==t&&(this.data^=1<<Ma)}get depthTest(){return!!(this.data&1<<Ba)}set depthTest(t){!!(this.data&1<<Ba)!==t&&(this.data^=1<<Ba)}get depthMask(){return!!(this.data&1<<Oa)}set depthMask(t){!!(this.data&1<<Oa)!==t&&(this.data^=1<<Oa)}get clockwiseFrontFace(){return!!(this.data&1<<Da)}set clockwiseFrontFace(t){!!(this.data&1<<Da)!==t&&(this.data^=1<<Da)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==Q.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){const t=new He;return t.depthTest=!1,t.blend=!0,t}}He.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};const Fa=[];function Iu(r,t){if(!r)return null;let e="";if(typeof r=="string"){const i=/\.(\w{3,4})(?:$|\?|#)/i.exec(r);i&&(e=i[1].toLowerCase())}for(let i=Fa.length-1;i>=0;--i){const s=Fa[i];if(s.test&&s.test(r,e))return new s(r,t)}throw new Error("Unrecognized source type to auto-detect Resource")}class we{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,i,s,n,o,a,l){if(arguments.length>8)throw new Error("max arguments reached");const{name:h,items:c}=this;this._aliasCount++;for(let u=0,d=c.length;u<d;u++)c[u][h](t,e,i,s,n,o,a,l);return c===this.items&&this._aliasCount--,this}ensureNonAliasedItems(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this}remove(t){const e=this.items.indexOf(t);return e!==-1&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this}contains(t){return this.items.includes(t)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items.length=0,this._name=""}get empty(){return this.items.length===0}get name(){return this._name}}Object.defineProperties(we.prototype,{dispatch:{value:we.prototype.emit},run:{value:we.prototype.emit}});class cs{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new we("setRealSize"),this.onUpdate=new we("update"),this.onError=new we("onError")}bind(t){this.onResize.add(t),this.onUpdate.add(t),this.onError.add(t),(this._width||this._height)&&this.onResize.emit(this._width,this._height)}unbind(t){this.onResize.remove(t),this.onUpdate.remove(t),this.onError.remove(t)}resize(t,e){(t!==this._width||e!==this._height)&&(this._width=t,this._height=e,this.onResize.emit(t,e))}get valid(){return!!this._width&&!!this._height}update(){this.destroyed||this.onUpdate.emit()}load(){return Promise.resolve(this)}get width(){return this._width}get height(){return this._height}style(t,e,i){return!1}dispose(){}destroy(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)}static test(t,e){return!1}}class hn extends cs{constructor(t,e){const{width:i,height:s}=e||{};if(!i||!s)throw new Error("BufferResource width or height invalid");super(i,s),this.data=t,this.unpackAlignment=e.unpackAlignment??4}upload(t,e,i){const s=t.gl;s.pixelStorei(s.UNPACK_ALIGNMENT,this.unpackAlignment),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===ie.UNPACK);const n=e.realWidth,o=e.realHeight;return i.width===n&&i.height===o?s.texSubImage2D(e.target,0,0,0,n,o,e.format,i.type,this.data):(i.width=n,i.height=o,s.texImage2D(e.target,0,i.internalFormat,n,o,0,e.format,i.type,this.data)),!0}dispose(){this.data=null}static test(t){return t===null||t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}}const bv={scaleMode:er.NEAREST,alphaMode:ie.NPM},La=class Ui extends Ji{constructor(t=null,e=null){super(),e=Object.assign({},Ui.defaultOptions,e);const{alphaMode:i,mipmap:s,anisotropicLevel:n,scaleMode:o,width:a,height:l,wrapMode:h,format:c,type:u,target:d,resolution:f,resourceOptions:p}=e;t&&!(t instanceof cs)&&(t=Iu(t,p),t.internal=!0),this.resolution=f||W.RESOLUTION,this.width=Math.round((a||0)*this.resolution)/this.resolution,this.height=Math.round((l||0)*this.resolution)/this.resolution,this._mipmap=s,this.anisotropicLevel=n,this._wrapMode=h,this._scaleMode=o,this.format=c,this.type=u,this.target=d,this.alphaMode=i,this.uid=Ur(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=a>0&&l>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(t)}get realWidth(){return Math.round(this.width*this.resolution)}get realHeight(){return Math.round(this.height*this.resolution)}get mipmap(){return this._mipmap}set mipmap(t){this._mipmap!==t&&(this._mipmap=t,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(t){this._scaleMode!==t&&(this._scaleMode=t,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(t){this._wrapMode!==t&&(this._wrapMode=t,this.dirtyStyleId++)}setStyle(t,e){let i;return t!==void 0&&t!==this.scaleMode&&(this.scaleMode=t,i=!0),e!==void 0&&e!==this.mipmap&&(this.mipmap=e,i=!0),i&&this.dirtyStyleId++,this}setSize(t,e,i){return i=i||this.resolution,this.setRealSize(t*i,e*i,i)}setRealSize(t,e,i){return this.resolution=i||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=bu(this.realWidth)&&bu(this.realHeight)}setResolution(t){const e=this.resolution;return e===t?this:(this.resolution=t,this.valid&&(this.width=Math.round(this.width*e)/t,this.height=Math.round(this.height*e)/t,this.emit("update",this)),this._refreshPOT(),this)}setResource(t){if(this.resource===t)return this;if(this.resource)throw new Error("Resource can be set only once");return t.bind(this),this.resource=t,this}update(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))}onError(t){this.emit("error",this,t)}destroy(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete vr[this.cacheId],delete $e[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),Ui.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(t,e,i=W.STRICT_TEXTURE_CACHE){const s=typeof t=="string";let n=null;if(s)n=t;else{if(!t._pixiId){const a=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${a}_${Ur()}`}n=t._pixiId}let o=vr[n];if(s&&i&&!o)throw new Error(`The cacheId "${n}" does not exist in BaseTextureCache.`);return o||(o=new Ui(t,e),o.cacheId=n,Ui.addToCache(o,n)),o}static fromBuffer(t,e,i,s){t=t||new Float32Array(e*i*4);const n=new hn(t,{width:e,height:i,...s==null?void 0:s.resourceOptions});let o,a;return t instanceof Float32Array?(o=G.RGBA,a=Z.FLOAT):t instanceof Int32Array?(o=G.RGBA_INTEGER,a=Z.INT):t instanceof Uint32Array?(o=G.RGBA_INTEGER,a=Z.UNSIGNED_INT):t instanceof Int16Array?(o=G.RGBA_INTEGER,a=Z.SHORT):t instanceof Uint16Array?(o=G.RGBA_INTEGER,a=Z.UNSIGNED_SHORT):t instanceof Int8Array?(o=G.RGBA,a=Z.BYTE):(o=G.RGBA,a=Z.UNSIGNED_BYTE),n.internal=!0,new Ui(n,Object.assign({},bv,{type:a,format:o},s))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),vr[e]&&vr[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),vr[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=vr[t];if(e){const i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete vr[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete vr[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};La.defaultOptions={mipmap:Oe.POW2,anisotropicLevel:0,scaleMode:er.LINEAR,wrapMode:pr.CLAMP,alphaMode:ie.UNPACK,target:ui.TEXTURE_2D,format:G.RGBA,type:Z.UNSIGNED_BYTE},La._globalBatch=0;let it=La;class Na{constructor(){this.texArray=null,this.blend=0,this.type=De.TRIANGLES,this.start=0,this.size=0,this.data=null}}let wv=0;class Mt{constructor(t,e=!0,i=!1){this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=i,this.static=e,this.id=wv++,this.disposeRunner=new we("disposeBuffer")}update(t){t instanceof Array&&(t=new Float32Array(t)),this.data=t||this.data,this._updateID++}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.data=null}set index(t){this.type=t?Le.ELEMENT_ARRAY_BUFFER:Le.ARRAY_BUFFER}get index(){return this.type===Le.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new Mt(t)}}class cn{constructor(t,e=0,i=!1,s=Z.FLOAT,n,o,a,l=1){this.buffer=t,this.size=e,this.normalized=i,this.type=s,this.stride=n,this.start=o,this.instance=a,this.divisor=l}destroy(){this.buffer=null}static from(t,e,i,s,n){return new cn(t,e,i,s,n)}}const Ev={Float32Array,Uint32Array,Int32Array,Uint8Array};function Tv(r,t){let e=0,i=0;const s={};for(let l=0;l<r.length;l++)i+=t[l],e+=r[l].length;const n=new ArrayBuffer(e*4);let o=null,a=0;for(let l=0;l<r.length;l++){const h=t[l],c=r[l],u=xu(c);s[u]||(s[u]=new Ev[u](n)),o=s[u];for(let d=0;d<c.length;d++){const f=(d/h|0)*i+a,p=d%h;o[f+p]=c[d]}a+=h}return new Float32Array(n)}const Ru={5126:4,5123:2,5121:1};let Av=0;const Sv={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array};class xr{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=Av++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new we("disposeGeometry"),this.refCount=0}addAttribute(t,e,i=0,s=!1,n,o,a,l=!1){if(!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof Mt||(e instanceof Array&&(e=new Float32Array(e)),e=new Mt(e));const h=t.split("|");if(h.length>1){for(let u=0;u<h.length;u++)this.addAttribute(h[u],e,i,s,n);return this}let c=this.buffers.indexOf(e);return c===-1&&(this.buffers.push(e),c=this.buffers.length-1),this.attributes[t]=new cn(c,i,s,n,o,a,l),this.instanced=this.instanced||l,this}getAttribute(t){return this.attributes[t]}getBuffer(t){return this.buffers[this.getAttribute(t).buffer]}addIndex(t){return t instanceof Mt||(t instanceof Array&&(t=new Uint16Array(t)),t=new Mt(t)),t.type=Le.ELEMENT_ARRAY_BUFFER,this.indexBuffer=t,this.buffers.includes(t)||this.buffers.push(t),this}getIndex(){return this.indexBuffer}interleave(){if(this.buffers.length===1||this.buffers.length===2&&this.indexBuffer)return this;const t=[],e=[],i=new Mt;let s;for(s in this.attributes){const n=this.attributes[s],o=this.buffers[n.buffer];t.push(o.data),e.push(n.size*Ru[n.type]/4),n.buffer=0}for(i.data=Tv(t,e),s=0;s<this.buffers.length;s++)this.buffers[s]!==this.indexBuffer&&this.buffers[s].destroy();return this.buffers=[i],this.indexBuffer&&this.buffers.push(this.indexBuffer),this}getSize(){for(const t in this.attributes){const e=this.attributes[t];return this.buffers[e.buffer].data.length/(e.stride/4||e.size)}return 0}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null}clone(){const t=new xr;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new Mt(this.buffers[e].data.slice(0));for(const e in this.attributes){const i=this.attributes[e];t.attributes[e]=new cn(i.buffer,i.size,i.normalized,i.type,i.stride,i.start,i.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.type=Le.ELEMENT_ARRAY_BUFFER),t}static merge(t){const e=new xr,i=[],s=[],n=[];let o;for(let a=0;a<t.length;a++){o=t[a];for(let l=0;l<o.buffers.length;l++)s[l]=s[l]||0,s[l]+=o.buffers[l].data.length,n[l]=0}for(let a=0;a<o.buffers.length;a++)i[a]=new Sv[xu(o.buffers[a].data)](s[a]),e.buffers[a]=new Mt(i[a]);for(let a=0;a<t.length;a++){o=t[a];for(let l=0;l<o.buffers.length;l++)i[l].set(o.buffers[l].data,n[l]),n[l]+=o.buffers[l].data.length}if(e.attributes=o.attributes,o.indexBuffer){e.indexBuffer=e.buffers[o.buffers.indexOf(o.indexBuffer)],e.indexBuffer.type=Le.ELEMENT_ARRAY_BUFFER;let a=0,l=0,h=0,c=0;for(let u=0;u<o.buffers.length;u++)if(o.buffers[u]!==o.indexBuffer){c=u;break}for(const u in o.attributes){const d=o.attributes[u];(d.buffer|0)===c&&(l+=d.size*Ru[d.type]/4)}for(let u=0;u<t.length;u++){const d=t[u].indexBuffer.data;for(let f=0;f<d.length;f++)e.indexBuffer.data[f+h]+=a;a+=t[u].buffers[c].data.length/l,h+=d.length}}return e}}class Pu extends xr{constructor(t=!1){super(),this._buffer=new Mt(null,t,!1),this._indexBuffer=new Mt(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,Z.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,Z.FLOAT).addAttribute("aColor",this._buffer,4,!0,Z.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,Z.FLOAT).addIndex(this._indexBuffer)}}const un=Math.PI*2,Cv=180/Math.PI,Iv=Math.PI/180;var Wt=(r=>(r[r.POLY=0]="POLY",r[r.RECT=1]="RECT",r[r.CIRC=2]="CIRC",r[r.ELIP=3]="ELIP",r[r.RREC=4]="RREC",r))(Wt||{});class pt{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new pt(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}}pt.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};const dn=[new pt,new pt,new pt,new pt];class nt{constructor(t=0,e=0,i=0,s=0){this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(s),this.type=Wt.RECT}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}static get EMPTY(){return new nt(0,0,0,0)}clone(){return new nt(this.x,this.y,this.width,this.height)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}intersects(t,e){if(!e){const C=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=C)return!1;const D=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>D}const i=this.left,s=this.right,n=this.top,o=this.bottom;if(s<=i||o<=n)return!1;const a=dn[0].set(t.left,t.top),l=dn[1].set(t.left,t.bottom),h=dn[2].set(t.right,t.top),c=dn[3].set(t.right,t.bottom);if(h.x<=a.x||l.y<=a.y)return!1;const u=Math.sign(e.a*e.d-e.b*e.c);if(u===0||(e.apply(a,a),e.apply(l,l),e.apply(h,h),e.apply(c,c),Math.max(a.x,l.x,h.x,c.x)<=i||Math.min(a.x,l.x,h.x,c.x)>=s||Math.max(a.y,l.y,h.y,c.y)<=n||Math.min(a.y,l.y,h.y,c.y)>=o))return!1;const d=u*(l.y-a.y),f=u*(a.x-l.x),p=d*i+f*n,m=d*s+f*n,_=d*i+f*o,y=d*s+f*o;if(Math.max(p,m,_,y)<=d*a.x+f*a.y||Math.min(p,m,_,y)>=d*c.x+f*c.y)return!1;const x=u*(a.y-h.y),g=u*(h.x-a.x),v=x*i+g*n,w=x*s+g*n,I=x*i+g*o,T=x*s+g*o;return!(Math.max(v,w,I,T)<=x*a.x+g*a.y||Math.min(v,w,I,T)>=x*c.x+g*c.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){const e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),n=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=s,this.height=Math.max(n-s,0),this}ceil(t=1,e=.001){const i=Math.ceil((this.x+this.width-e)*t)/t,s=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=s-this.y,this}enlarge(t){const e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=s,this.height=n-s,this}}nt.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class fn{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.radius=i,this.type=Wt.CIRC}clone(){return new fn(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const i=this.radius*this.radius;let s=this.x-t,n=this.y-e;return s*=s,n*=n,s+n<=i}getBounds(){return new nt(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}fn.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};class pn{constructor(t=0,e=0,i=0,s=0){this.x=t,this.y=e,this.width=i,this.height=s,this.type=Wt.ELIP}clone(){return new pn(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let i=(t-this.x)/this.width,s=(e-this.y)/this.height;return i*=i,s*=s,i+s<=1}getBounds(){return new nt(this.x-this.width,this.y-this.height,this.width,this.height)}}pn.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class kr{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){const i=[];for(let s=0,n=e.length;s<n;s++)i.push(e[s].x,e[s].y);e=i}this.points=e,this.type=Wt.POLY,this.closeStroke=!0}clone(){const t=this.points.slice(),e=new kr(t);return e.closeStroke=this.closeStroke,e}contains(t,e){let i=!1;const s=this.points.length/2;for(let n=0,o=s-1;n<s;o=n++){const a=this.points[n*2],l=this.points[n*2+1],h=this.points[o*2],c=this.points[o*2+1];l>e!=c>e&&t<(h-a)*((e-l)/(c-l))+a&&(i=!i)}return i}}kr.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((r,t)=>`${r}, ${t}`,"")}]`};class mn{constructor(t=0,e=0,i=0,s=0,n=20){this.x=t,this.y=e,this.width=i,this.height=s,this.radius=n,this.type=Wt.RREC}clone(){return new mn(this.x,this.y,this.width,this.height,this.radius)}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){const i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let s=t-(this.x+i),n=e-(this.y+i);const o=i*i;if(s*s+n*n<=o||(s=t-(this.x+this.width-i),s*s+n*n<=o)||(n=e-(this.y+this.height-i),s*s+n*n<=o)||(s=t-(this.x+i),s*s+n*n<=o))return!0}return!1}}mn.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};class Et{constructor(t=1,e=0,i=0,s=1,n=0,o=0){this.array=null,this.a=t,this.b=e,this.c=i,this.d=s,this.tx=n,this.ty=o}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,i,s,n,o){return this.a=t,this.b=e,this.c=i,this.d=s,this.tx=n,this.ty=o,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,e){e=e||new pt;const i=t.x,s=t.y;return e.x=this.a*i+this.c*s+this.tx,e.y=this.b*i+this.d*s+this.ty,e}applyInverse(t,e){e=e||new pt;const i=1/(this.a*this.d+this.c*-this.b),s=t.x,n=t.y;return e.x=this.d*i*s+-this.c*i*n+(this.ty*this.c-this.tx*this.d)*i,e.y=this.a*i*n+-this.b*i*s+(-this.ty*this.a+this.tx*this.b)*i,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){const e=Math.cos(t),i=Math.sin(t),s=this.a,n=this.c,o=this.tx;return this.a=s*e-this.b*i,this.b=s*i+this.b*e,this.c=n*e-this.d*i,this.d=n*i+this.d*e,this.tx=o*e-this.ty*i,this.ty=o*i+this.ty*e,this}append(t){const e=this.a,i=this.b,s=this.c,n=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*i+t.b*n,this.c=t.c*e+t.d*s,this.d=t.c*i+t.d*n,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*i+t.ty*n+this.ty,this}setTransform(t,e,i,s,n,o,a,l,h){return this.a=Math.cos(a+h)*n,this.b=Math.sin(a+h)*n,this.c=-Math.sin(a-l)*o,this.d=Math.cos(a-l)*o,this.tx=t-(i*this.a+s*this.c),this.ty=e-(i*this.b+s*this.d),this}prepend(t){const e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){const i=this.a,s=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){const e=this.a,i=this.b,s=this.c,n=this.d,o=t.pivot,a=-Math.atan2(-s,n),l=Math.atan2(i,e),h=Math.abs(a+l);return h<1e-5||Math.abs(un-h)<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+i*i),t.scale.y=Math.sqrt(s*s+n*n),t.position.x=this.tx+(o.x*e+o.y*s),t.position.y=this.ty+(o.x*i+o.y*n),t}invert(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.tx,o=t*s-e*i;return this.a=s/o,this.b=-e/o,this.c=-i/o,this.d=t/o,this.tx=(i*this.ty-s*n)/o,this.ty=-(t*this.ty-e*n)/o,this}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){const t=new Et;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}static get IDENTITY(){return new Et}static get TEMP_MATRIX(){return new Et}}Et.prototype.toString=function(){return`[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`};const Gr=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],$r=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Hr=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Xr=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Ua=[],Mu=[],gn=Math.sign;function Rv(){for(let r=0;r<16;r++){const t=[];Ua.push(t);for(let e=0;e<16;e++){const i=gn(Gr[r]*Gr[e]+Hr[r]*$r[e]),s=gn($r[r]*Gr[e]+Xr[r]*$r[e]),n=gn(Gr[r]*Hr[e]+Hr[r]*Xr[e]),o=gn($r[r]*Hr[e]+Xr[r]*Xr[e]);for(let a=0;a<16;a++)if(Gr[a]===i&&$r[a]===s&&Hr[a]===n&&Xr[a]===o){t.push(a);break}}}for(let r=0;r<16;r++){const t=new Et;t.set(Gr[r],$r[r],Hr[r],Xr[r],0,0),Mu.push(t)}}Rv();const It={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=>Gr[r],uY:r=>$r[r],vX:r=>Hr[r],vY:r=>Xr[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>Ua[r][t],sub:(r,t)=>Ua[r][It.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?It.S:It.N:Math.abs(t)*2<=Math.abs(r)?r>0?It.E:It.W:t>0?r>0?It.SE:It.SW:r>0?It.NE:It.NW,matrixAppendRotationInv:(r,t,e=0,i=0)=>{const s=Mu[It.inv(t)];s.tx=e,s.ty=i,r.append(s)}};class ar{constructor(t,e,i=0,s=0){this._x=i,this._y=s,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new ar(t,e,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this.cb.call(this.scope)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))}}ar.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};const ka=class{constructor(){this.worldTransform=new Et,this.localTransform=new Et,this.position=new ar(this.onChange,this,0,0),this.scale=new ar(this.onChange,this,1,1),this.pivot=new ar(this.onChange,this,0,0),this.skew=new ar(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}onChange(){this._localID++}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++}updateLocalTransform(){const r=this.localTransform;this._localID!==this._currentLocalID&&(r.a=this._cx*this.scale.x,r.b=this._sx*this.scale.x,r.c=this._cy*this.scale.y,r.d=this._sy*this.scale.y,r.tx=this.position.x-(this.pivot.x*r.a+this.pivot.y*r.c),r.ty=this.position.y-(this.pivot.x*r.b+this.pivot.y*r.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(r){const t=this.localTransform;if(this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==r._worldID){const e=r.worldTransform,i=this.worldTransform;i.a=t.a*e.a+t.b*e.c,i.b=t.a*e.b+t.b*e.d,i.c=t.c*e.a+t.d*e.c,i.d=t.c*e.b+t.d*e.d,i.tx=t.tx*e.a+t.ty*e.c+e.tx,i.ty=t.tx*e.b+t.ty*e.d+e.ty,this._parentID=r._worldID,this._worldID++}}setFromMatrix(r){r.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(r){this._rotation!==r&&(this._rotation=r,this.updateSkew())}};ka.IDENTITY=new ka;let Ga=ka;Ga.prototype.toString=function(){return`[@pixi/math:Transform position=(${this.position.x}, ${this.position.y}) rotation=${this.rotation} scale=(${this.scale.x}, ${this.scale.y}) skew=(${this.skew.x}, ${this.skew.y}) ]`};var Pv=`varying vec2 vTextureCoord;
13
+
14
+ uniform sampler2D uSampler;
15
+
16
+ void main(void){
17
+ gl_FragColor *= texture2D(uSampler, vTextureCoord);
18
+ }`,Mv=`attribute vec2 aVertexPosition;
19
+ attribute vec2 aTextureCoord;
20
+
21
+ uniform mat3 projectionMatrix;
22
+
23
+ varying vec2 vTextureCoord;
24
+
25
+ void main(void){
26
+ gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
27
+ vTextureCoord = aTextureCoord;
28
+ }
29
+ `;function Bu(r,t,e){const i=r.createShader(t);return r.shaderSource(i,e),r.compileShader(i),i}function $a(r){const t=new Array(r);for(let e=0;e<t.length;e++)t[e]=!1;return t}function Du(r,t){switch(r){case"float":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*t);case"ivec3":return new Int32Array(3*t);case"ivec4":return new Int32Array(4*t);case"uvec2":return new Uint32Array(2*t);case"uvec3":return new Uint32Array(3*t);case"uvec4":return new Uint32Array(4*t);case"bool":return!1;case"bvec2":return $a(2*t);case"bvec3":return $a(3*t);case"bvec4":return $a(4*t);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}const Si=[{test:r=>r.type==="float"&&r.size===1&&!r.isArray,code:r=>`
30
+ if(uv["${r}"] !== ud["${r}"].value)
122
31
  {
123
- ud["`+r+'"].value = uv["'+r+`"]
124
- gl.uniform1f(ud["`+r+'"].location, uv["'+r+`"])
32
+ ud["${r}"].value = uv["${r}"]
33
+ gl.uniform1f(ud["${r}"].location, uv["${r}"])
125
34
  }
126
- `}},{test:function(r,t){return(r.type==="sampler2D"||r.type==="samplerCube"||r.type==="sampler2DArray")&&r.size===1&&!r.isArray&&(t==null||t.castToBaseTexture!==void 0)},code:function(r){return`t = syncData.textureCount++;
35
+ `},{test:(r,t)=>(r.type==="sampler2D"||r.type==="samplerCube"||r.type==="sampler2DArray")&&r.size===1&&!r.isArray&&(t==null||t.castToBaseTexture!==void 0),code:r=>`t = syncData.textureCount++;
127
36
 
128
- renderer.texture.bind(uv["`+r+`"], t);
37
+ renderer.texture.bind(uv["${r}"], t);
129
38
 
130
- if(ud["`+r+`"].value !== t)
39
+ if(ud["${r}"].value !== t)
131
40
  {
132
- ud["`+r+`"].value = t;
133
- gl.uniform1i(ud["`+r+`"].location, t);
41
+ ud["${r}"].value = t;
42
+ gl.uniform1i(ud["${r}"].location, t);
134
43
  ; // eslint-disable-line max-len
135
- }`}},{test:function(r,t){return r.type==="mat3"&&r.size===1&&!r.isArray&&t.a!==void 0},code:function(r){return`
136
- gl.uniformMatrix3fv(ud["`+r+'"].location, false, uv["'+r+`"].toArray(true));
137
- `},codeUbo:function(r){return`
138
- var `+r+"_matrix = uv."+r+`.toArray(true);
139
-
140
- data[offset] = `+r+`_matrix[0];
141
- data[offset+1] = `+r+`_matrix[1];
142
- data[offset+2] = `+r+`_matrix[2];
44
+ }`},{test:(r,t)=>r.type==="mat3"&&r.size===1&&!r.isArray&&t.a!==void 0,code:r=>`
45
+ gl.uniformMatrix3fv(ud["${r}"].location, false, uv["${r}"].toArray(true));
46
+ `,codeUbo:r=>`
47
+ var ${r}_matrix = uv.${r}.toArray(true);
48
+
49
+ data[offset] = ${r}_matrix[0];
50
+ data[offset+1] = ${r}_matrix[1];
51
+ data[offset+2] = ${r}_matrix[2];
143
52
 
144
- data[offset + 4] = `+r+`_matrix[3];
145
- data[offset + 5] = `+r+`_matrix[4];
146
- data[offset + 6] = `+r+`_matrix[5];
53
+ data[offset + 4] = ${r}_matrix[3];
54
+ data[offset + 5] = ${r}_matrix[4];
55
+ data[offset + 6] = ${r}_matrix[5];
147
56
 
148
- data[offset + 8] = `+r+`_matrix[6];
149
- data[offset + 9] = `+r+`_matrix[7];
150
- data[offset + 10] = `+r+`_matrix[8];
151
- `}},{test:function(r,t){return r.type==="vec2"&&r.size===1&&!r.isArray&&t.x!==void 0},code:function(r){return`
152
- cv = ud["`+r+`"].value;
153
- v = uv["`+r+`"];
57
+ data[offset + 8] = ${r}_matrix[6];
58
+ data[offset + 9] = ${r}_matrix[7];
59
+ data[offset + 10] = ${r}_matrix[8];
60
+ `},{test:(r,t)=>r.type==="vec2"&&r.size===1&&!r.isArray&&t.x!==void 0,code:r=>`
61
+ cv = ud["${r}"].value;
62
+ v = uv["${r}"];
154
63
 
155
64
  if(cv[0] !== v.x || cv[1] !== v.y)
156
65
  {
157
66
  cv[0] = v.x;
158
67
  cv[1] = v.y;
159
- gl.uniform2f(ud["`+r+`"].location, v.x, v.y);
160
- }`},codeUbo:function(r){return`
161
- v = uv.`+r+`;
68
+ gl.uniform2f(ud["${r}"].location, v.x, v.y);
69
+ }`,codeUbo:r=>`
70
+ v = uv.${r};
162
71
 
163
72
  data[offset] = v.x;
164
73
  data[offset+1] = v.y;
165
- `}},{test:function(r){return r.type==="vec2"&&r.size===1&&!r.isArray},code:function(r){return`
166
- cv = ud["`+r+`"].value;
167
- v = uv["`+r+`"];
74
+ `},{test:r=>r.type==="vec2"&&r.size===1&&!r.isArray,code:r=>`
75
+ cv = ud["${r}"].value;
76
+ v = uv["${r}"];
168
77
 
169
78
  if(cv[0] !== v[0] || cv[1] !== v[1])
170
79
  {
171
80
  cv[0] = v[0];
172
81
  cv[1] = v[1];
173
- gl.uniform2f(ud["`+r+`"].location, v[0], v[1]);
82
+ gl.uniform2f(ud["${r}"].location, v[0], v[1]);
174
83
  }
175
- `}},{test:function(r,t){return r.type==="vec4"&&r.size===1&&!r.isArray&&t.width!==void 0},code:function(r){return`
176
- cv = ud["`+r+`"].value;
177
- v = uv["`+r+`"];
84
+ `},{test:(r,t)=>r.type==="vec4"&&r.size===1&&!r.isArray&&t.width!==void 0,code:r=>`
85
+ cv = ud["${r}"].value;
86
+ v = uv["${r}"];
178
87
 
179
88
  if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)
180
89
  {
@@ -182,17 +91,52 @@ Deprecated since v`+r),console.warn(n))),yh[t]=!0}}var bh={},Oe=Object.create(nu
182
91
  cv[1] = v.y;
183
92
  cv[2] = v.width;
184
93
  cv[3] = v.height;
185
- gl.uniform4f(ud["`+r+`"].location, v.x, v.y, v.width, v.height)
186
- }`},codeUbo:function(r){return`
187
- v = uv.`+r+`;
94
+ gl.uniform4f(ud["${r}"].location, v.x, v.y, v.width, v.height)
95
+ }`,codeUbo:r=>`
96
+ v = uv.${r};
188
97
 
189
98
  data[offset] = v.x;
190
99
  data[offset+1] = v.y;
191
100
  data[offset+2] = v.width;
192
101
  data[offset+3] = v.height;
193
- `}},{test:function(r){return r.type==="vec4"&&r.size===1&&!r.isArray},code:function(r){return`
194
- cv = ud["`+r+`"].value;
195
- v = uv["`+r+`"];
102
+ `},{test:(r,t)=>r.type==="vec4"&&r.size===1&&!r.isArray&&t.red!==void 0,code:r=>`
103
+ cv = ud["${r}"].value;
104
+ v = uv["${r}"];
105
+
106
+ if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha)
107
+ {
108
+ cv[0] = v.red;
109
+ cv[1] = v.green;
110
+ cv[2] = v.blue;
111
+ cv[3] = v.alpha;
112
+ gl.uniform4f(ud["${r}"].location, v.red, v.green, v.blue, v.alpha)
113
+ }`,codeUbo:r=>`
114
+ v = uv.${r};
115
+
116
+ data[offset] = v.red;
117
+ data[offset+1] = v.green;
118
+ data[offset+2] = v.blue;
119
+ data[offset+3] = v.alpha;
120
+ `},{test:(r,t)=>r.type==="vec3"&&r.size===1&&!r.isArray&&t.red!==void 0,code:r=>`
121
+ cv = ud["${r}"].value;
122
+ v = uv["${r}"];
123
+
124
+ if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.a)
125
+ {
126
+ cv[0] = v.red;
127
+ cv[1] = v.green;
128
+ cv[2] = v.blue;
129
+
130
+ gl.uniform3f(ud["${r}"].location, v.red, v.green, v.blue)
131
+ }`,codeUbo:r=>`
132
+ v = uv.${r};
133
+
134
+ data[offset] = v.red;
135
+ data[offset+1] = v.green;
136
+ data[offset+2] = v.blue;
137
+ `},{test:r=>r.type==="vec4"&&r.size===1&&!r.isArray,code:r=>`
138
+ cv = ud["${r}"].value;
139
+ v = uv["${r}"];
196
140
 
197
141
  if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
198
142
  {
@@ -201,8 +145,8 @@ Deprecated since v`+r),console.warn(n))),yh[t]=!0}}var bh={},Oe=Object.create(nu
201
145
  cv[2] = v[2];
202
146
  cv[3] = v[3];
203
147
 
204
- gl.uniform4f(ud["`+r+`"].location, v[0], v[1], v[2], v[3])
205
- }`}}],Ny={float:`
148
+ gl.uniform4f(ud["${r}"].location, v[0], v[1], v[2], v[3])
149
+ }`}],Bv={float:`
206
150
  if (cv !== v)
207
151
  {
208
152
  cu.value = v;
@@ -338,50 +282,74 @@ Deprecated since v`+r),console.warn(n))),yh[t]=!0}}var bh={},Oe=Object.create(nu
338
282
  cu.value = v;
339
283
 
340
284
  gl.uniform1i(location, v);
341
- }`},Ly={float:"gl.uniform1fv(location, v)",vec2:"gl.uniform2fv(location, v)",vec3:"gl.uniform3fv(location, v)",vec4:"gl.uniform4fv(location, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat2:"gl.uniformMatrix2fv(location, false, v)",int:"gl.uniform1iv(location, v)",ivec2:"gl.uniform2iv(location, v)",ivec3:"gl.uniform3iv(location, v)",ivec4:"gl.uniform4iv(location, v)",uint:"gl.uniform1uiv(location, v)",uvec2:"gl.uniform2uiv(location, v)",uvec3:"gl.uniform3uiv(location, v)",uvec4:"gl.uniform4uiv(location, v)",bool:"gl.uniform1iv(location, v)",bvec2:"gl.uniform2iv(location, v)",bvec3:"gl.uniform3iv(location, v)",bvec4:"gl.uniform4iv(location, v)",sampler2D:"gl.uniform1iv(location, v)",samplerCube:"gl.uniform1iv(location, v)",sampler2DArray:"gl.uniform1iv(location, v)"};function Uy(r,t){var e,n=[`
285
+ }`},Dv={float:"gl.uniform1fv(location, v)",vec2:"gl.uniform2fv(location, v)",vec3:"gl.uniform3fv(location, v)",vec4:"gl.uniform4fv(location, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat2:"gl.uniformMatrix2fv(location, false, v)",int:"gl.uniform1iv(location, v)",ivec2:"gl.uniform2iv(location, v)",ivec3:"gl.uniform3iv(location, v)",ivec4:"gl.uniform4iv(location, v)",uint:"gl.uniform1uiv(location, v)",uvec2:"gl.uniform2uiv(location, v)",uvec3:"gl.uniform3uiv(location, v)",uvec4:"gl.uniform4uiv(location, v)",bool:"gl.uniform1iv(location, v)",bvec2:"gl.uniform2iv(location, v)",bvec3:"gl.uniform3iv(location, v)",bvec4:"gl.uniform4iv(location, v)",sampler2D:"gl.uniform1iv(location, v)",samplerCube:"gl.uniform1iv(location, v)",sampler2DArray:"gl.uniform1iv(location, v)"};function Ov(r,t){var i;const e=[`
342
286
  var v = null;
343
287
  var cv = null;
344
288
  var cu = null;
345
289
  var t = 0;
346
290
  var gl = renderer.gl;
347
- `];for(var i in r.uniforms){var o=t[i];if(!o){!((e=r.uniforms[i])===null||e===void 0)&&e.group&&(r.uniforms[i].ubo?n.push(`
348
- renderer.shader.syncUniformBufferGroup(uv.`+i+", '"+i+`');
349
- `):n.push(`
350
- renderer.shader.syncUniformGroup(uv.`+i+`, syncData);
351
- `));continue}for(var a=r.uniforms[i],s=!1,u=0;u<Hr.length;u++)if(Hr[u].test(o,a)){n.push(Hr[u].code(i,a)),s=!0;break}if(!s){var h=o.size===1&&!o.isArray?Ny:Ly,l=h[o.type].replace("location",'ud["'+i+'"].location');n.push(`
352
- cu = ud["`+i+`"];
291
+ `];for(const s in r.uniforms){const n=t[s];if(!n){((i=r.uniforms[s])==null?void 0:i.group)===!0&&(r.uniforms[s].ubo?e.push(`
292
+ renderer.shader.syncUniformBufferGroup(uv.${s}, '${s}');
293
+ `):e.push(`
294
+ renderer.shader.syncUniformGroup(uv.${s}, syncData);
295
+ `));continue}const o=r.uniforms[s];let a=!1;for(let l=0;l<Si.length;l++)if(Si[l].test(n,o)){e.push(Si[l].code(s,o)),a=!0;break}if(!a){const l=(n.size===1&&!n.isArray?Bv:Dv)[n.type].replace("location",`ud["${s}"].location`);e.push(`
296
+ cu = ud["${s}"];
353
297
  cv = cu.value;
354
- v = uv["`+i+`"];
355
- `+l+";")}}return new Function("ud","uv","renderer","syncData",n.join(`
356
- `))}var Gy=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
357
- `);function ky(r){for(var t="",e=0;e<r;++e)e>0&&(t+=`
358
- else `),e<r-1&&(t+="if(test == "+e+".0){}");return t}function Xy(r,t){if(r===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");for(var e=t.createShader(t.FRAGMENT_SHADER);;){var n=Gy.replace(/%forloop%/gi,ky(r));if(t.shaderSource(e,n),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))r=r/2|0;else break}return r}var Tn;function Hy(){if(typeof Tn=="boolean")return Tn;try{var r=new Function("param1","param2","param3","return param1[param2] === param3;");Tn=r({a:"b"},"a","b")===!0}catch{Tn=!1}return Tn}var jy=`varying vec2 vTextureCoord;
359
-
360
- uniform sampler2D uSampler;
298
+ v = uv["${s}"];
299
+ ${l};`)}}return new Function("ud","uv","renderer","syncData",e.join(`
300
+ `))}const Ou={};let Ci=Ou;function Fv(){if(Ci===Ou||Ci!=null&&Ci.isContextLost()){const r=W.ADAPTER.createCanvas();let t;W.PREFER_ENV>=Dr.WEBGL2&&(t=r.getContext("webgl2",{})),t||(t=r.getContext("webgl",{})||r.getContext("experimental-webgl",{}),t?t.getExtension("WEBGL_draw_buffers"):t=null),Ci=t}return Ci}let yn;function Lv(){if(!yn){yn=fe.MEDIUM;const r=Fv();if(r&&r.getShaderPrecisionFormat){const t=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);t&&(yn=t.precision?fe.HIGH:fe.MEDIUM)}}return yn}function Fu(r,t){const e=r.getShaderSource(t).split(`
301
+ `).map((h,c)=>`${c}: ${h}`),i=r.getShaderInfoLog(t),s=i.split(`
302
+ `),n={},o=s.map(h=>parseFloat(h.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(h=>h&&!n[h]?(n[h]=!0,!0):!1),a=[""];o.forEach(h=>{e[h-1]=`%c${e[h-1]}%c`,a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});const l=e.join(`
303
+ `);a[0]=l,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function Nv(r,t,e,i){r.getProgramParameter(t,r.LINK_STATUS)||(r.getShaderParameter(e,r.COMPILE_STATUS)||Fu(r,e),r.getShaderParameter(i,r.COMPILE_STATUS)||Fu(r,i),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(t)))}const Uv={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function Lu(r){return Uv[r]}let _n=null;const Nu={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function Uu(r,t){if(!_n){const e=Object.keys(Nu);_n={};for(let i=0;i<e.length;++i){const s=e[i];_n[r[s]]=Nu[s]}}return _n[t]}function ku(r,t,e){if(r.substring(0,9)!=="precision"){let i=t;return t===fe.HIGH&&e!==fe.HIGH&&(i=fe.MEDIUM),`precision ${i} float;
304
+ ${r}`}else if(e!==fe.HIGH&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}let us;function kv(){if(typeof us=="boolean")return us;try{us=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{us=!1}return us}let Gv=0;const vn={},Ha=class ki{constructor(t,e,i="pixi-shader",s={}){this.extra={},this.id=Gv++,this.vertexSrc=t||ki.defaultVertexSrc,this.fragmentSrc=e||ki.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),this.extra=s,this.vertexSrc.substring(0,8)!=="#version"&&(i=i.replace(/\s+/g,"-"),vn[i]?(vn[i]++,i+=`-${vn[i]}`):vn[i]=1,this.vertexSrc=`#define SHADER_NAME ${i}
305
+ ${this.vertexSrc}`,this.fragmentSrc=`#define SHADER_NAME ${i}
306
+ ${this.fragmentSrc}`,this.vertexSrc=ku(this.vertexSrc,ki.defaultVertexPrecision,fe.HIGH),this.fragmentSrc=ku(this.fragmentSrc,ki.defaultFragmentPrecision,Lv())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return Mv}static get defaultFragmentSrc(){return Pv}static from(t,e,i){const s=t+e;let n=Tu[s];return n||(Tu[s]=n=new ki(t,e,i)),n}};Ha.defaultVertexPrecision=fe.HIGH,Ha.defaultFragmentPrecision=ir.apple.device?fe.HIGH:fe.MEDIUM;let lr=Ha,$v=0;class Ee{constructor(t,e,i){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=$v++,this.static=!!e,this.ubo=!!i,t instanceof Mt?(this.buffer=t,this.buffer.type=Le.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=t,this.ubo&&(this.buffer=new Mt(new Float32Array(1)),this.buffer.type=Le.UNIFORM_BUFFER,this.autoManage=!0))}update(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update()}add(t,e,i){if(!this.ubo)this.uniforms[t]=new Ee(e,i);else throw new Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them")}static from(t,e,i){return new Ee(t,e,i)}static uboFrom(t,e){return new Ee(t,e??!0,!0)}}class Xe{constructor(t,e){this.uniformBindCount=0,this.program=t,e?e instanceof Ee?this.uniformGroup=e:this.uniformGroup=new Ee(e):this.uniformGroup=new Ee({}),this.disposeRunner=new we("disposeShader")}checkUniformExists(t,e){if(e.uniforms[t])return!0;for(const i in e.uniforms){const s=e.uniforms[i];if(s.group===!0&&this.checkUniformExists(t,s))return!0}return!1}destroy(){this.uniformGroup=null,this.disposeRunner.emit(this),this.disposeRunner.destroy()}get uniforms(){return this.uniformGroup.uniforms}static from(t,e,i){const s=lr.from(t,e);return new Xe(s,i)}}class Hv{constructor(t,e){if(this.vertexSrc=t,this.fragTemplate=e,this.programCache={},this.defaultGroupCache={},!e.includes("%count%"))throw new Error('Fragment template must contain "%count%".');if(!e.includes("%forloop%"))throw new Error('Fragment template must contain "%forloop%".')}generateShader(t){if(!this.programCache[t]){const i=new Int32Array(t);for(let n=0;n<t;n++)i[n]=n;this.defaultGroupCache[t]=Ee.from({uSamplers:i},!0);let s=this.fragTemplate;s=s.replace(/%count%/gi,`${t}`),s=s.replace(/%forloop%/gi,this.generateSampleSrc(t)),this.programCache[t]=new lr(this.vertexSrc,s)}const e={tint:new Float32Array([1,1,1,1]),translationMatrix:new Et,default:this.defaultGroupCache[t]};return new Xe(this.programCache[t],e)}generateSampleSrc(t){let e="";e+=`
307
+ `,e+=`
308
+ `;for(let i=0;i<t;i++)i>0&&(e+=`
309
+ else `),i<t-1&&(e+=`if(vTextureId < ${i}.5)`),e+=`
310
+ {`,e+=`
311
+ color = texture2D(uSamplers[${i}], vTextureCoord);`,e+=`
312
+ }`;return e+=`
313
+ `,e+=`
314
+ `,e}}class Xa{constructor(){this.elements=[],this.ids=[],this.count=0}clear(){for(let t=0;t<this.count;t++)this.elements[t]=null;this.count=0}}function Xv(){return!ir.apple.device}function Vv(r){let t=!0;const e=W.ADAPTER.getNavigator();if(ir.tablet||ir.phone){if(ir.apple.device){const i=e.userAgent.match(/OS (\d+)_(\d+)?/);i&&parseInt(i[1],10)<11&&(t=!1)}if(ir.android.device){const i=e.userAgent.match(/Android\s([0-9.]*)/);i&&parseInt(i[1],10)<7&&(t=!1)}}return t?r:4}class xn{constructor(t){this.renderer=t}flush(){}destroy(){this.renderer=null}start(){}stop(){this.flush()}render(t){}}var zv=`varying vec2 vTextureCoord;
315
+ varying vec4 vColor;
316
+ varying float vTextureId;
317
+ uniform sampler2D uSamplers[%count%];
361
318
 
362
319
  void main(void){
363
- gl_FragColor *= texture2D(uSampler, vTextureCoord);
364
- }`,Vy=`attribute vec2 aVertexPosition;
320
+ vec4 color;
321
+ %forloop%
322
+ gl_FragColor = color * vColor;
323
+ }
324
+ `,Wv=`precision highp float;
325
+ attribute vec2 aVertexPosition;
365
326
  attribute vec2 aTextureCoord;
327
+ attribute vec4 aColor;
328
+ attribute float aTextureId;
366
329
 
367
330
  uniform mat3 projectionMatrix;
331
+ uniform mat3 translationMatrix;
332
+ uniform vec4 tint;
368
333
 
369
334
  varying vec2 vTextureCoord;
335
+ varying vec4 vColor;
336
+ varying float vTextureId;
370
337
 
371
338
  void main(void){
372
- gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
373
- vTextureCoord = aTextureCoord;
339
+ gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
340
+
341
+ vTextureCoord = aTextureCoord;
342
+ vTextureId = aTextureId;
343
+ vColor = aColor * tint;
374
344
  }
375
- `,Yy=0,xi={},wn=function(){function r(t,e,n){n===void 0&&(n="pixi-shader"),this.id=Yy++,this.vertexSrc=t||r.defaultVertexSrc,this.fragmentSrc=e||r.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),this.vertexSrc.substring(0,8)!=="#version"&&(n=n.replace(/\s+/g,"-"),xi[n]?(xi[n]++,n+="-"+xi[n]):xi[n]=1,this.vertexSrc="#define SHADER_NAME "+n+`
376
- `+this.vertexSrc,this.fragmentSrc="#define SHADER_NAME "+n+`
377
- `+this.fragmentSrc,this.vertexSrc=kh(this.vertexSrc,k.PRECISION_VERTEX,Jt.HIGH),this.fragmentSrc=kh(this.fragmentSrc,k.PRECISION_FRAGMENT,Fy())),this.glPrograms={},this.syncUniforms=null}return Object.defineProperty(r,"defaultVertexSrc",{get:function(){return Vy},enumerable:!1,configurable:!0}),Object.defineProperty(r,"defaultFragmentSrc",{get:function(){return jy},enumerable:!1,configurable:!0}),r.from=function(t,e,n){var i=t+e,o=bh[i];return o||(bh[i]=o=new r(t,e,n)),o},r}(),je=function(){function r(t,e){this.uniformBindCount=0,this.program=t,e?e instanceof lr?this.uniformGroup=e:this.uniformGroup=new lr(e):this.uniformGroup=new lr({}),this.disposeRunner=new Ut("disposeShader")}return r.prototype.checkUniformExists=function(t,e){if(e.uniforms[t])return!0;for(var n in e.uniforms){var i=e.uniforms[n];if(i.group&&this.checkUniformExists(t,i))return!0}return!1},r.prototype.destroy=function(){this.uniformGroup=null,this.disposeRunner.emit(this),this.disposeRunner.destroy()},Object.defineProperty(r.prototype,"uniforms",{get:function(){return this.uniformGroup.uniforms},enumerable:!1,configurable:!0}),r.from=function(t,e,n){var i=wn.from(t,e);return new r(i,n)},r}(),da=0,pa=1,va=2,_a=3,ma=4,ga=5,fr=function(){function r(){this.data=0,this.blendMode=j.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}return Object.defineProperty(r.prototype,"blend",{get:function(){return!!(this.data&1<<da)},set:function(t){!!(this.data&1<<da)!==t&&(this.data^=1<<da)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"offsets",{get:function(){return!!(this.data&1<<pa)},set:function(t){!!(this.data&1<<pa)!==t&&(this.data^=1<<pa)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"culling",{get:function(){return!!(this.data&1<<va)},set:function(t){!!(this.data&1<<va)!==t&&(this.data^=1<<va)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"depthTest",{get:function(){return!!(this.data&1<<_a)},set:function(t){!!(this.data&1<<_a)!==t&&(this.data^=1<<_a)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"depthMask",{get:function(){return!!(this.data&1<<ga)},set:function(t){!!(this.data&1<<ga)!==t&&(this.data^=1<<ga)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"clockwiseFrontFace",{get:function(){return!!(this.data&1<<ma)},set:function(t){!!(this.data&1<<ma)!==t&&(this.data^=1<<ma)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"blendMode",{get:function(){return this._blendMode},set:function(t){this.blend=t!==j.NONE,this._blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"polygonOffset",{get:function(){return this._polygonOffset},set:function(t){this.offsets=!!t,this._polygonOffset=t},enumerable:!1,configurable:!0}),r.prototype.toString=function(){return"[@pixi/core:State "+("blendMode="+this.blendMode+" ")+("clockwiseFrontFace="+this.clockwiseFrontFace+" ")+("culling="+this.culling+" ")+("depthMask="+this.depthMask+" ")+("polygonOffset="+this.polygonOffset)+"]"},r.for2d=function(){var t=new r;return t.depthTest=!1,t.blend=!0,t},r}(),zy=`varying vec2 vTextureCoord;
345
+ `;const ds=class Re extends xn{constructor(t){super(t),this.setShaderGenerator(),this.geometryClass=Pu,this.vertexSize=6,this.state=He.for2d(),this.size=Re.defaultBatchSize*4,this._vertexCount=0,this._indexCount=0,this._bufferedElements=[],this._bufferedTextures=[],this._bufferSize=0,this._shader=null,this._packedGeometries=[],this._packedGeometryPoolSize=2,this._flushId=0,this._aBuffers={},this._iBuffers={},this.maxTextures=1,this.renderer.on("prerender",this.onPrerender,this),t.runners.contextChange.add(this),this._dcIndex=0,this._aIndex=0,this._iIndex=0,this._attributeBuffer=null,this._indexBuffer=null,this._tempBoundTextures=[]}static get defaultMaxTextures(){return this._defaultMaxTextures=this._defaultMaxTextures??Vv(32),this._defaultMaxTextures}static set defaultMaxTextures(t){this._defaultMaxTextures=t}static get canUploadSameBuffer(){return this._canUploadSameBuffer=this._canUploadSameBuffer??Xv(),this._canUploadSameBuffer}static set canUploadSameBuffer(t){this._canUploadSameBuffer=t}get MAX_TEXTURES(){return lt("7.1.0","BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures"),this.maxTextures}static get defaultVertexSrc(){return Wv}static get defaultFragmentTemplate(){return zv}setShaderGenerator({vertex:t=Re.defaultVertexSrc,fragment:e=Re.defaultFragmentTemplate}={}){this.shaderGenerator=new Hv(t,e)}contextChange(){const t=this.renderer.gl;W.PREFER_ENV===Dr.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),Re.defaultMaxTextures),this.maxTextures=xv(this.maxTextures,t)),this._shader=this.shaderGenerator.generateShader(this.maxTextures);for(let e=0;e<this._packedGeometryPoolSize;e++)this._packedGeometries[e]=new this.geometryClass;this.initFlushBuffers()}initFlushBuffers(){const{_drawCallPool:t,_textureArrayPool:e}=Re,i=this.size/4,s=Math.floor(i/this.maxTextures)+1;for(;t.length<i;)t.push(new Na);for(;e.length<s;)e.push(new Xa);for(let n=0;n<this.maxTextures;n++)this._tempBoundTextures[n]=null}onPrerender(){this._flushId=0}render(t){t._texture.valid&&(this._vertexCount+t.vertexData.length/2>this.size&&this.flush(),this._vertexCount+=t.vertexData.length/2,this._indexCount+=t.indices.length,this._bufferedTextures[this._bufferSize]=t._texture.baseTexture,this._bufferedElements[this._bufferSize++]=t)}buildTexturesAndDrawCalls(){const{_bufferedTextures:t,maxTextures:e}=this,i=Re._textureArrayPool,s=this.renderer.batch,n=this._tempBoundTextures,o=this.renderer.textureGC.count;let a=++it._globalBatch,l=0,h=i[0],c=0;s.copyBoundTextures(n,e);for(let u=0;u<this._bufferSize;++u){const d=t[u];t[u]=null,d._batchEnabled!==a&&(h.count>=e&&(s.boundArray(h,n,a,e),this.buildDrawCalls(h,c,u),c=u,h=i[++l],++a),d._batchEnabled=a,d.touched=o,h.elements[h.count++]=d)}h.count>0&&(s.boundArray(h,n,a,e),this.buildDrawCalls(h,c,this._bufferSize),++l,++a);for(let u=0;u<n.length;u++)n[u]=null;it._globalBatch=a}buildDrawCalls(t,e,i){const{_bufferedElements:s,_attributeBuffer:n,_indexBuffer:o,vertexSize:a}=this,l=Re._drawCallPool;let h=this._dcIndex,c=this._aIndex,u=this._iIndex,d=l[h];d.start=this._iIndex,d.texArray=t;for(let f=e;f<i;++f){const p=s[f],m=p._texture.baseTexture,_=_u[m.alphaMode?1:0][p.blendMode];s[f]=null,e<f&&d.blend!==_&&(d.size=u-d.start,e=f,d=l[++h],d.texArray=t,d.start=u),this.packInterleavedGeometry(p,n,o,c,u),c+=p.vertexData.length/2*a,u+=p.indices.length,d.blend=_}e<i&&(d.size=u-d.start,++h),this._dcIndex=h,this._aIndex=c,this._iIndex=u}bindAndClearTexArray(t){const e=this.renderer.texture;for(let i=0;i<t.count;i++)e.bind(t.elements[i],t.ids[i]),t.elements[i]=null;t.count=0}updateGeometry(){const{_packedGeometries:t,_attributeBuffer:e,_indexBuffer:i}=this;Re.canUploadSameBuffer?(t[this._flushId]._buffer.update(e.rawBinaryData),t[this._flushId]._indexBuffer.update(i),this.renderer.geometry.updateBuffers()):(this._packedGeometryPoolSize<=this._flushId&&(this._packedGeometryPoolSize++,t[this._flushId]=new this.geometryClass),t[this._flushId]._buffer.update(e.rawBinaryData),t[this._flushId]._indexBuffer.update(i),this.renderer.geometry.bind(t[this._flushId]),this.renderer.geometry.updateBuffers(),this._flushId++)}drawBatches(){const t=this._dcIndex,{gl:e,state:i}=this.renderer,s=Re._drawCallPool;let n=null;for(let o=0;o<t;o++){const{texArray:a,type:l,size:h,start:c,blend:u}=s[o];n!==a&&(n=a,this.bindAndClearTexArray(a)),this.state.blendMode=u,i.set(this.state),e.drawElements(l,h,e.UNSIGNED_SHORT,c*2)}}flush(){this._vertexCount!==0&&(this._attributeBuffer=this.getAttributeBuffer(this._vertexCount),this._indexBuffer=this.getIndexBuffer(this._indexCount),this._aIndex=0,this._iIndex=0,this._dcIndex=0,this.buildTexturesAndDrawCalls(),this.updateGeometry(),this.drawBatches(),this._bufferSize=0,this._vertexCount=0,this._indexCount=0)}start(){this.renderer.state.set(this.state),this.renderer.texture.ensureSamplerType(this.maxTextures),this.renderer.shader.bind(this._shader),Re.canUploadSameBuffer&&this.renderer.geometry.bind(this._packedGeometries[this._flushId])}stop(){this.flush()}destroy(){for(let t=0;t<this._packedGeometryPoolSize;t++)this._packedGeometries[t]&&this._packedGeometries[t].destroy();this.renderer.off("prerender",this.onPrerender,this),this._aBuffers=null,this._iBuffers=null,this._packedGeometries=null,this._attributeBuffer=null,this._indexBuffer=null,this._shader&&(this._shader.destroy(),this._shader=null),super.destroy()}getAttributeBuffer(t){const e=ln(Math.ceil(t/8)),i=wu(e),s=e*8;this._aBuffers.length<=i&&(this._iBuffers.length=i+1);let n=this._aBuffers[s];return n||(this._aBuffers[s]=n=new Ia(s*this.vertexSize*4)),n}getIndexBuffer(t){const e=ln(Math.ceil(t/12)),i=wu(e),s=e*12;this._iBuffers.length<=i&&(this._iBuffers.length=i+1);let n=this._iBuffers[i];return n||(this._iBuffers[i]=n=new Uint16Array(s)),n}packInterleavedGeometry(t,e,i,s,n){const{uint32View:o,float32View:a}=e,l=s/this.vertexSize,h=t.uvs,c=t.indices,u=t.vertexData,d=t._texture.baseTexture._batchLocation,f=Math.min(t.worldAlpha,1),p=xt.shared.setValue(t._tintRGB).toPremultiplied(f,t._texture.baseTexture.alphaMode>0);for(let m=0;m<u.length;m+=2)a[s++]=u[m],a[s++]=u[m+1],a[s++]=h[m],a[s++]=h[m+1],o[s++]=p,a[s++]=d;for(let m=0;m<c.length;m++)i[n++]=l+c[m]}};ds.defaultBatchSize=4096,ds.extension={name:"batch",type:V.RendererPlugin},ds._drawCallPool=[],ds._textureArrayPool=[];let Vr=ds;j.add(Vr);var jv=`varying vec2 vTextureCoord;
378
346
 
379
347
  uniform sampler2D uSampler;
380
348
 
381
349
  void main(void){
382
350
  gl_FragColor = texture2D(uSampler, vTextureCoord);
383
351
  }
384
- `,Wy=`attribute vec2 aVertexPosition;
352
+ `,Yv=`attribute vec2 aVertexPosition;
385
353
 
386
354
  uniform mat3 projectionMatrix;
387
355
 
@@ -407,23 +375,7 @@ void main(void)
407
375
  gl_Position = filterVertexPosition();
408
376
  vTextureCoord = filterTextureCoord();
409
377
  }
410
- `,Ve=function(r){bt(t,r);function t(e,n,i){var o=this,a=wn.from(e||t.defaultVertexSrc,n||t.defaultFragmentSrc);return o=r.call(this,a,i)||this,o.padding=0,o.resolution=k.FILTER_RESOLUTION,o.multisample=k.FILTER_MULTISAMPLE,o.enabled=!0,o.autoFit=!0,o.state=new fr,o}return t.prototype.apply=function(e,n,i,o,a){e.applyFilter(this,n,i,o)},Object.defineProperty(t.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(e){this.state.blendMode=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"resolution",{get:function(){return this._resolution},set:function(e){this._resolution=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,"defaultVertexSrc",{get:function(){return Wy},enumerable:!1,configurable:!0}),Object.defineProperty(t,"defaultFragmentSrc",{get:function(){return zy},enumerable:!1,configurable:!0}),t}(je),qy=`attribute vec2 aVertexPosition;
411
- attribute vec2 aTextureCoord;
412
-
413
- uniform mat3 projectionMatrix;
414
- uniform mat3 otherMatrix;
415
-
416
- varying vec2 vMaskCoord;
417
- varying vec2 vTextureCoord;
418
-
419
- void main(void)
420
- {
421
- gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
422
-
423
- vTextureCoord = aTextureCoord;
424
- vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;
425
- }
426
- `,$y=`varying vec2 vMaskCoord;
378
+ `;const Va=class bs extends Xe{constructor(t,e,i){const s=lr.from(t||bs.defaultVertexSrc,e||bs.defaultFragmentSrc);super(s,i),this.padding=0,this.resolution=bs.defaultResolution,this.multisample=bs.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new He}apply(t,e,i,s,n){t.applyFilter(this,e,i,s)}get blendMode(){return this.state.blendMode}set blendMode(t){this.state.blendMode=t}get resolution(){return this._resolution}set resolution(t){this._resolution=t}static get defaultVertexSrc(){return Yv}static get defaultFragmentSrc(){return jv}};Va.defaultResolution=1,Va.defaultMultisample=Dt.NONE;let re=Va;class bn{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new xt(0),this.alpha=1}init(t){this.clearBeforeRender=t.clearBeforeRender;const{backgroundColor:e,background:i,backgroundAlpha:s}=t,n=i??e;n!==void 0&&(this.color=n),this.alpha=s}get color(){return this._backgroundColor.value}set color(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get backgroundColor(){return this._backgroundColor}destroy(){}}bn.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},bn.extension={type:[V.RendererSystem,V.CanvasRendererSystem],name:"background"},j.add(bn);class Gu{constructor(t){this.renderer=t,this.emptyRenderer=new xn(t),this.currentRenderer=this.emptyRenderer}setObjectRenderer(t){this.currentRenderer!==t&&(this.currentRenderer.stop(),this.currentRenderer=t,this.currentRenderer.start())}flush(){this.setObjectRenderer(this.emptyRenderer)}reset(){this.setObjectRenderer(this.emptyRenderer)}copyBoundTextures(t,e){const{boundTextures:i}=this.renderer.texture;for(let s=e-1;s>=0;--s)t[s]=i[s]||null,t[s]&&(t[s]._batchLocation=s)}boundArray(t,e,i,s){const{elements:n,ids:o,count:a}=t;let l=0;for(let h=0;h<a;h++){const c=n[h],u=c._batchLocation;if(u>=0&&u<s&&e[u]===c){o[h]=u;continue}for(;l<s;){const d=e[l];if(d&&d._batchEnabled===i&&d._batchLocation===l){l++;continue}o[h]=l,c._batchLocation=l,e[l]=c;break}}}destroy(){this.renderer=null}}Gu.extension={type:V.RendererSystem,name:"batch"},j.add(Gu);let $u=0;class wn{constructor(t){this.renderer=t,this.webGLVersion=1,this.extensions={},this.supports={uint32Indices:!1},this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(t){this.gl=t,this.renderer.gl=t,this.renderer.CONTEXT_UID=$u++}init(t){if(t.context)this.initFromContext(t.context);else{const e=this.renderer.background.alpha<1,i=t.premultipliedAlpha;this.preserveDrawingBuffer=t.preserveDrawingBuffer,this.useContextAlpha=t.useContextAlpha,this.powerPreference=t.powerPreference,this.initFromOptions({alpha:e,premultipliedAlpha:i,antialias:t.antialias,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference})}}initFromContext(t){this.gl=t,this.validateContext(t),this.renderer.gl=t,this.renderer.CONTEXT_UID=$u++,this.renderer.runners.contextChange.emit(t);const e=this.renderer.view;e.addEventListener!==void 0&&(e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1))}initFromOptions(t){const e=this.createContext(this.renderer.view,t);this.initFromContext(e)}createContext(t,e){let i;if(W.PREFER_ENV>=Dr.WEBGL2&&(i=t.getContext("webgl2",e)),i)this.webGLVersion=2;else if(this.webGLVersion=1,i=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!i)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=i,this.getExtensions(),this.gl}getExtensions(){const{gl:t}=this,e={loseContext:t.getExtension("WEBGL_lose_context"),anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc"),bptc:t.getExtension("EXT_texture_compression_bptc")};this.webGLVersion===1?Object.assign(this.extensions,e,{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear")}):this.webGLVersion===2&&Object.assign(this.extensions,e,{colorBufferFloat:t.getExtension("EXT_color_buffer_float")})}handleContextLost(t){t.preventDefault(),setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext&&this.extensions.loseContext.restoreContext()},0)}handleContextRestored(){this.renderer.runners.contextChange.emit(this.gl)}destroy(){const t=this.renderer.view;this.renderer=null,t.removeEventListener!==void 0&&(t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored)),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()}postrender(){this.renderer.objectRenderer.renderingToScreen&&this.gl.flush()}validateContext(t){const e=t.getContextAttributes(),i="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;i&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const s=i||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=s,s||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}}wn.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},wn.extension={type:V.RendererSystem,name:"context"},j.add(wn);class za{constructor(t,e){if(this.width=Math.round(t),this.height=Math.round(e),!this.width||!this.height)throw new Error("Framebuffer width or height is zero");this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new we("disposeFramebuffer"),this.multisample=Dt.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new it(null,{scaleMode:er.NEAREST,resolution:1,mipmap:Oe.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new it(null,{scaleMode:er.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:Oe.OFF,format:G.DEPTH_COMPONENT,type:Z.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this}enableDepth(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this}enableStencil(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this}resize(t,e){if(t=Math.round(t),e=Math.round(e),!t||!e)throw new Error("Framebuffer width and height must not be zero");if(!(t===this.width&&e===this.height)){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(let i=0;i<this.colorTextures.length;i++){const s=this.colorTextures[i],n=s.resolution;s.setSize(t/n,e/n)}if(this.depthTexture){const i=this.depthTexture.resolution;this.depthTexture.setSize(t/i,e/i)}}}dispose(){this.disposeRunner.emit(this,!1)}destroyDepthTexture(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)}}class Hu extends it{constructor(t={}){if(typeof t=="number"){const e=arguments[0],i=arguments[1],s=arguments[2],n=arguments[3];t={width:e,height:i,scaleMode:s,resolution:n}}t.width=t.width??100,t.height=t.height??100,t.multisample??(t.multisample=Dt.NONE),super(null,t),this.mipmap=Oe.OFF,this.valid=!0,this._clear=new xt([0,0,0,0]),this.framebuffer=new za(this.realWidth,this.realHeight).addColorTexture(0,this),this.framebuffer.multisample=t.multisample,this.maskStack=[],this.filterStack=[{}]}set clearColor(t){this._clear.setValue(t)}get clearColor(){return this._clear.value}get clear(){return this._clear}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e){this.framebuffer.resize(t*this.resolution,e*this.resolution),this.setRealSize(this.framebuffer.width,this.framebuffer.height)}dispose(){this.framebuffer.dispose(),super.dispose()}destroy(){super.destroy(),this.framebuffer.destroyDepthTexture(),this.framebuffer=null}}class hr extends cs{constructor(t){const e=t,i=e.naturalWidth||e.videoWidth||e.displayWidth||e.width,s=e.naturalHeight||e.videoHeight||e.displayHeight||e.height;super(i,s),this.source=t,this.noSubImage=!1}static crossOrigin(t,e,i){i===void 0&&!e.startsWith("data:")?t.crossOrigin=yv(e):i!==!1&&(t.crossOrigin=typeof i=="string"?i:"anonymous")}upload(t,e,i,s){const n=t.gl,o=e.realWidth,a=e.realHeight;if(s=s||this.source,typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement){if(!s.complete||s.naturalWidth===0)return!1}else if(typeof HTMLVideoElement<"u"&&s instanceof HTMLVideoElement&&s.readyState<=1)return!1;return n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===ie.UNPACK),!this.noSubImage&&e.target===n.TEXTURE_2D&&i.width===o&&i.height===a?n.texSubImage2D(n.TEXTURE_2D,0,0,0,e.format,i.type,s):(i.width=o,i.height=a,n.texImage2D(e.target,0,i.internalFormat,e.format,i.type,s)),!0}update(){if(this.destroyed)return;const t=this.source,e=t.naturalWidth||t.videoWidth||t.width,i=t.naturalHeight||t.videoHeight||t.height;this.resize(e,i),super.update()}dispose(){this.source=null}}class Xu extends hr{constructor(t,e){if(e=e||{},typeof t=="string"){const i=new Image;hr.crossOrigin(i,t,e.crossorigin),i.src=t,t=i}super(t),!t.complete&&this._width&&this._height&&(this._width=0,this._height=0),this.url=t.src,this._process=null,this.preserveBitmap=!1,this.createBitmap=(e.createBitmap??W.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.bitmap=null,this._load=null,e.autoLoad!==!1&&this.load()}load(t){return this._load?this._load:(t!==void 0&&(this.createBitmap=t),this._load=new Promise((e,i)=>{const s=this.source;this.url=s.src;const n=()=>{this.destroyed||(s.onload=null,s.onerror=null,this.update(),this._load=null,this.createBitmap?e(this.process()):e(this))};s.complete&&s.src?n():(s.onload=n,s.onerror=o=>{i(o),this.onError.emit(o)})}),this._load)}process(){const t=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);const e=globalThis.createImageBitmap,i=!t.crossOrigin||t.crossOrigin==="anonymous";return this._process=fetch(t.src,{mode:i?"cors":"no-cors"}).then(s=>s.blob()).then(s=>e(s,0,0,t.width,t.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===ie.UNPACK?"premultiply":"none"})).then(s=>this.destroyed?Promise.reject():(this.bitmap=s,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(t,e,i){if(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(t,e,i);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(t,e,i,this.bitmap),!this.preserveBitmap){let s=!0;const n=e._glTextures;for(const o in n){const a=n[o];if(a!==i&&a.dirtyId!==e.dirtyId){s=!1;break}}s&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0}dispose(){this.source.onload=null,this.source.onerror=null,super.dispose(),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null}static test(t){return typeof HTMLImageElement<"u"&&(typeof t=="string"||t instanceof HTMLImageElement)}}class Wa{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(t,e,i){const s=e.width,n=e.height;if(i){const o=t.width/2/s,a=t.height/2/n,l=t.x/s+o,h=t.y/n+a;i=It.add(i,It.NW),this.x0=l+o*It.uX(i),this.y0=h+a*It.uY(i),i=It.add(i,2),this.x1=l+o*It.uX(i),this.y1=h+a*It.uY(i),i=It.add(i,2),this.x2=l+o*It.uX(i),this.y2=h+a*It.uY(i),i=It.add(i,2),this.x3=l+o*It.uX(i),this.y3=h+a*It.uY(i)}else this.x0=t.x/s,this.y0=t.y/n,this.x1=(t.x+t.width)/s,this.y1=t.y/n,this.x2=(t.x+t.width)/s,this.y2=(t.y+t.height)/n,this.x3=t.x/s,this.y3=(t.y+t.height)/n;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3}}Wa.prototype.toString=function(){return`[@pixi/core:TextureUvs x0=${this.x0} y0=${this.y0} x1=${this.x1} y1=${this.y1} x2=${this.x2} y2=${this.y2} x3=${this.x3} y3=${this.y3}]`};const Vu=new Wa;function En(r){r.destroy=function(){},r.on=function(){},r.once=function(){},r.emit=function(){}}class Y extends Ji{constructor(t,e,i,s,n,o,a){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new nt(0,0,1,1)),t instanceof Y&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=s,this.valid=!1,this.destroyed=!1,this._uvs=Vu,this.uvMatrix=null,this.orig=i||e,this._rotate=Number(n||0),n===!0)this._rotate=2;else if(this._rotate%2!==0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");this.defaultAnchor=o?new pt(o.x,o.y):new pt(0,0),this.defaultBorders=a,this._updateID=0,this.textureCacheIds=[],t.valid?this.noFrame?t.valid&&this.onBaseTextureUpdated(t):this.frame=e:t.once("loaded",this.onBaseTextureUpdated,this),this.noFrame&&t.on("update",this.onBaseTextureUpdated,this)}update(){this.baseTexture.resource&&this.baseTexture.resource.update()}onBaseTextureUpdated(t){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=t.width,this._frame.height=t.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)}destroy(t){if(this.baseTexture){if(t){const{resource:e}=this.baseTexture;e!=null&&e.url&&$e[e.url]&&Y.removeFromCache(e.url),this.baseTexture.destroy()}this.baseTexture.off("loaded",this.onBaseTextureUpdated,this),this.baseTexture.off("update",this.onBaseTextureUpdated,this),this.baseTexture=null}this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,Y.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){var s;const t=this._frame.clone(),e=this._frame===this.orig?t:this.orig.clone(),i=new Y(this.baseTexture,!this.noFrame&&t,e,(s=this.trim)==null?void 0:s.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(i._frame=t),i}updateUvs(){this._uvs===Vu&&(this._uvs=new Wa),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},i=W.STRICT_TEXTURE_CACHE){const s=typeof t=="string";let n=null;if(s)n=t;else if(t instanceof it){if(!t.cacheId){const a=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t.cacheId=`${a}-${Ur()}`,it.addToCache(t,t.cacheId)}n=t.cacheId}else{if(!t._pixiId){const a=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${a}_${Ur()}`}n=t._pixiId}let o=$e[n];if(s&&i&&!o)throw new Error(`The cacheId "${n}" does not exist in TextureCache.`);return!o&&!(t instanceof it)?(e.resolution||(e.resolution=or(t)),o=new Y(new it(t,e)),o.baseTexture.cacheId=n,it.addToCache(o.baseTexture,n),Y.addToCache(o,n)):!o&&t instanceof it&&(o=new Y(t),Y.addToCache(o,n)),o}static fromURL(t,e){const i=Object.assign({autoLoad:!1},e==null?void 0:e.resourceOptions),s=Y.from(t,Object.assign({resourceOptions:i},e),!1),n=s.baseTexture.resource;return s.baseTexture.valid?Promise.resolve(s):n.load().then(()=>Promise.resolve(s))}static fromBuffer(t,e,i,s){return new Y(it.fromBuffer(t,e,i,s))}static fromLoader(t,e,i,s){const n=new it(t,Object.assign({scaleMode:it.defaultOptions.scaleMode,resolution:or(e)},s)),{resource:o}=n;o instanceof Xu&&(o.url=e);const a=new Y(n);return i||(i=e),it.addToCache(a.baseTexture,i),Y.addToCache(a,i),i!==e&&(it.addToCache(a.baseTexture,e),Y.addToCache(a,e)),a.baseTexture.valid?Promise.resolve(a):new Promise(l=>{a.baseTexture.once("loaded",()=>l(a))})}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),$e[e]&&$e[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),$e[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=$e[t];if(e){const i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete $e[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)$e[t.textureCacheIds[e]]===t&&delete $e[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}get resolution(){return this.baseTexture.resolution}get frame(){return this._frame}set frame(t){this._frame=t,this.noFrame=!1;const{x:e,y:i,width:s,height:n}=t,o=e+s>this.baseTexture.width,a=i+n>this.baseTexture.height;if(o||a){const l=o&&a?"and":"or",h=`X: ${e} + ${s} = ${e+s} > ${this.baseTexture.width}`,c=`Y: ${i} + ${n} = ${i+n} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${h} ${l} ${c}`)}this.valid=s&&n&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=t),this.valid&&this.updateUvs()}get rotate(){return this._rotate}set rotate(t){this._rotate=t,this.valid&&this.updateUvs()}get width(){return this.orig.width}get height(){return this.orig.height}castToBaseTexture(){return this.baseTexture}static get EMPTY(){return Y._EMPTY||(Y._EMPTY=new Y(new it),En(Y._EMPTY),En(Y._EMPTY.baseTexture)),Y._EMPTY}static get WHITE(){if(!Y._WHITE){const t=W.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),Y._WHITE=new Y(it.from(t)),En(Y._WHITE),En(Y._WHITE.baseTexture)}return Y._WHITE}}class zr extends Y{constructor(t,e){super(t,e),this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}get framebuffer(){return this.baseTexture.framebuffer}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e,i=!0){const s=this.baseTexture.resolution,n=Math.round(t*s)/s,o=Math.round(e*s)/s;this.valid=n>0&&o>0,this._frame.width=this.orig.width=n,this._frame.height=this.orig.height=o,i&&this.baseTexture.resize(n,o),this.updateUvs()}setResolution(t){const{baseTexture:e}=this;e.resolution!==t&&(e.setResolution(t),this.resize(e.width,e.height,!1))}static create(t){return new zr(new Hu(t))}}class zu{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,i=Dt.NONE){const s=new Hu(Object.assign({width:t,height:e,resolution:1,multisample:i},this.textureOptions));return new zr(s)}getOptimalTexture(t,e,i=1,s=Dt.NONE){let n;t=Math.max(Math.ceil(t*i-1e-6),1),e=Math.max(Math.ceil(e*i-1e-6),1),!this.enableFullScreen||t!==this._pixelsWidth||e!==this._pixelsHeight?(t=ln(t),e=ln(e),n=((t&65535)<<16|e&65535)>>>0,s>1&&(n+=s*4294967296)):n=s>1?-s:-1,this.texturePool[n]||(this.texturePool[n]=[]);let o=this.texturePool[n].pop();return o||(o=this.createTexture(t,e,s)),o.filterPoolKey=n,o.setResolution(i),o}getFilterTexture(t,e,i){const s=this.getOptimalTexture(t.width,t.height,e||t.resolution,i||Dt.NONE);return s.filterFrame=t.filterFrame,s}returnTexture(t){const e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)}returnFilterTexture(t){this.returnTexture(t)}clear(t){if(t=t!==!1,t)for(const e in this.texturePool){const i=this.texturePool[e];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0)}this.texturePool={}}setScreenSize(t){if(!(t.width===this._pixelsWidth&&t.height===this._pixelsHeight)){this.enableFullScreen=t.width>0&&t.height>0;for(const e in this.texturePool){if(!(Number(e)<0))continue;const i=this.texturePool[e];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0);this.texturePool[e]=[]}this._pixelsWidth=t.width,this._pixelsHeight=t.height}}}zu.SCREEN_KEY=-1;class qv extends xr{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}}class Wu extends xr{constructor(){super(),this.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),this.uvs=new Float32Array([0,0,1,0,1,1,0,1]),this.vertexBuffer=new Mt(this.vertices),this.uvBuffer=new Mt(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(t,e){let i=0,s=0;return this.uvs[0]=i,this.uvs[1]=s,this.uvs[2]=i+e.width/t.width,this.uvs[3]=s,this.uvs[4]=i+e.width/t.width,this.uvs[5]=s+e.height/t.height,this.uvs[6]=i,this.uvs[7]=s+e.height/t.height,i=e.x,s=e.y,this.vertices[0]=i,this.vertices[1]=s,this.vertices[2]=i+e.width,this.vertices[3]=s,this.vertices[4]=i+e.width,this.vertices[5]=s+e.height,this.vertices[6]=i,this.vertices[7]=s+e.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}}class Kv{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=Dt.NONE,this.sourceFrame=new nt,this.destinationFrame=new nt,this.bindingSourceFrame=new nt,this.bindingDestinationFrame=new nt,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}}const Tn=[new pt,new pt,new pt,new pt],ja=new Et;class ju{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new zu,this.statePool=[],this.quad=new qv,this.quadUv=new Wu,this.tempRect=new nt,this.activeState={},this.globalUniforms=new Ee({outputFrame:new nt,inputSize:new Float32Array(4),inputPixel:new Float32Array(4),inputClamp:new Float32Array(4),resolution:1,filterArea:new Float32Array(4),filterClamp:new Float32Array(4)},!0),this.forceClear=!1,this.useMaxPadding=!1}init(){this.texturePool.setScreenSize(this.renderer.view)}push(t,e){const i=this.renderer,s=this.defaultFilterStack,n=this.statePool.pop()||new Kv,o=i.renderTexture;let a,l;if(o.current){const _=o.current;a=_.resolution,l=_.multisample}else a=i.resolution,l=i.multisample;let h=e[0].resolution||a,c=e[0].multisample??l,u=e[0].padding,d=e[0].autoFit,f=e[0].legacy??!0;for(let _=1;_<e.length;_++){const y=e[_];h=Math.min(h,y.resolution||a),c=Math.min(c,y.multisample??l),u=this.useMaxPadding?Math.max(u,y.padding):u+y.padding,d=d&&y.autoFit,f=f||(y.legacy??!0)}s.length===1&&(this.defaultFilterStack[0].renderTexture=o.current),s.push(n),n.resolution=h,n.multisample=c,n.legacy=f,n.target=t,n.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),n.sourceFrame.pad(u);const p=this.tempRect.copyFrom(o.sourceFrame);i.projection.transform&&this.transformAABB(ja.copyFrom(i.projection.transform).invert(),p),d?(n.sourceFrame.fit(p),(n.sourceFrame.width<=0||n.sourceFrame.height<=0)&&(n.sourceFrame.width=0,n.sourceFrame.height=0)):n.sourceFrame.intersects(p)||(n.sourceFrame.width=0,n.sourceFrame.height=0),this.roundFrame(n.sourceFrame,o.current?o.current.resolution:i.resolution,o.sourceFrame,o.destinationFrame,i.projection.transform),n.renderTexture=this.getOptimalFilterTexture(n.sourceFrame.width,n.sourceFrame.height,h,c),n.filters=e,n.destinationFrame.width=n.renderTexture.width,n.destinationFrame.height=n.renderTexture.height;const m=this.tempRect;m.x=0,m.y=0,m.width=n.sourceFrame.width,m.height=n.sourceFrame.height,n.renderTexture.filterFrame=n.sourceFrame,n.bindingSourceFrame.copyFrom(o.sourceFrame),n.bindingDestinationFrame.copyFrom(o.destinationFrame),n.transform=i.projection.transform,i.projection.transform=null,o.bind(n.renderTexture,n.sourceFrame,m),i.framebuffer.clear(0,0,0,0)}pop(){const t=this.defaultFilterStack,e=t.pop(),i=e.filters;this.activeState=e;const s=this.globalUniforms.uniforms;s.outputFrame=e.sourceFrame,s.resolution=e.resolution;const n=s.inputSize,o=s.inputPixel,a=s.inputClamp;if(n[0]=e.destinationFrame.width,n[1]=e.destinationFrame.height,n[2]=1/n[0],n[3]=1/n[1],o[0]=Math.round(n[0]*e.resolution),o[1]=Math.round(n[1]*e.resolution),o[2]=1/o[0],o[3]=1/o[1],a[0]=.5*o[2],a[1]=.5*o[3],a[2]=e.sourceFrame.width*n[2]-.5*o[2],a[3]=e.sourceFrame.height*n[3]-.5*o[3],e.legacy){const h=s.filterArea;h[0]=e.destinationFrame.width,h[1]=e.destinationFrame.height,h[2]=e.sourceFrame.x,h[3]=e.sourceFrame.y,s.filterClamp=s.inputClamp}this.globalUniforms.update();const l=t[t.length-1];if(this.renderer.framebuffer.blit(),i.length===1)i[0].apply(this,e.renderTexture,l.renderTexture,Fe.BLEND,e),this.returnFilterTexture(e.renderTexture);else{let h=e.renderTexture,c=this.getOptimalFilterTexture(h.width,h.height,e.resolution);c.filterFrame=h.filterFrame;let u=0;for(u=0;u<i.length-1;++u){u===1&&e.multisample>1&&(c=this.getOptimalFilterTexture(h.width,h.height,e.resolution),c.filterFrame=h.filterFrame),i[u].apply(this,h,c,Fe.CLEAR,e);const d=h;h=c,c=d}i[u].apply(this,h,l.renderTexture,Fe.BLEND,e),u>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(h),this.returnFilterTexture(c)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=Fe.CLEAR){const{renderTexture:i,state:s}=this.renderer;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,t==null?void 0:t.filterFrame){const o=this.tempRect;o.x=0,o.y=0,o.width=t.filterFrame.width,o.height=t.filterFrame.height,i.bind(t,t.filterFrame,o)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?i.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);const n=s.stateId&1||this.forceClear;(e===Fe.CLEAR||e===Fe.BLIT&&n)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,i,s){const n=this.renderer;n.state.set(t.state),this.bindAndClear(i,s),t.uniforms.uSampler=e,t.uniforms.filterGlobals=this.globalUniforms,n.shader.bind(t),t.legacy=!!t.program.attributeData.aTextureCoord,t.legacy?(this.quadUv.map(e._frame,e.filterFrame),n.geometry.bind(this.quadUv),n.geometry.draw(De.TRIANGLES)):(n.geometry.bind(this.quad),n.geometry.draw(De.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){const{sourceFrame:i,destinationFrame:s}=this.activeState,{orig:n}=e._texture,o=t.set(s.width,0,0,s.height,i.x,i.y),a=e.worldTransform.copyTo(Et.TEMP_MATRIX);return a.invert(),o.prepend(a),o.scale(1/n.width,1/n.height),o.translate(e.anchor.x,e.anchor.y),o}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(t,e,i=1,s=Dt.NONE){return this.texturePool.getOptimalTexture(t,e,i,s)}getFilterTexture(t,e,i){if(typeof t=="number"){const n=t;t=e,e=n}t=t||this.activeState.renderTexture;const s=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,i||Dt.NONE);return s.filterFrame=t.filterFrame,s}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){const i=Tn[0],s=Tn[1],n=Tn[2],o=Tn[3];i.set(e.left,e.top),s.set(e.left,e.bottom),n.set(e.right,e.top),o.set(e.right,e.bottom),t.apply(i,i),t.apply(s,s),t.apply(n,n),t.apply(o,o);const a=Math.min(i.x,s.x,n.x,o.x),l=Math.min(i.y,s.y,n.y,o.y),h=Math.max(i.x,s.x,n.x,o.x),c=Math.max(i.y,s.y,n.y,o.y);e.x=a,e.y=l,e.width=h-a,e.height=c-l}roundFrame(t,e,i,s,n){if(!(t.width<=0||t.height<=0||i.width<=0||i.height<=0)){if(n){const{a:o,b:a,c:l,d:h}=n;if((Math.abs(a)>1e-4||Math.abs(l)>1e-4)&&(Math.abs(o)>1e-4||Math.abs(h)>1e-4))return}n=n?ja.copyFrom(n):ja.identity(),n.translate(-i.x,-i.y).scale(s.width/i.width,s.height/i.height).translate(s.x,s.y),this.transformAABB(n,t),t.ceil(e),this.transformAABB(n.invert(),t)}}}ju.extension={type:V.RendererSystem,name:"filter"},j.add(ju);class Zv{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=Dt.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const Jv=new nt;class Yu{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new za(10,10),this.msaaSamples=null}contextChange(){this.disposeAll(!0);const t=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new nt,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;W.PREFER_ENV===Dr.WEBGL_LEGACY&&(e=null,i=null),e?t.drawBuffers=s=>e.drawBuffersWEBGL(s):(this.hasMRT=!1,t.drawBuffers=()=>{}),i||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)}bind(t,e,i=0){const{gl:s}=this;if(t){const n=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,s.bindFramebuffer(s.FRAMEBUFFER,n.framebuffer)),n.mipLevel!==i&&(t.dirtyId++,t.dirtyFormat++,n.mipLevel=i),n.dirtyId!==t.dirtyId&&(n.dirtyId=t.dirtyId,n.dirtyFormat!==t.dirtyFormat?(n.dirtyFormat=t.dirtyFormat,n.dirtySize=t.dirtySize,this.updateFramebuffer(t,i)):n.dirtySize!==t.dirtySize&&(n.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(let o=0;o<t.colorTextures.length;o++){const a=t.colorTextures[o];this.renderer.texture.unbind(a.parentTextureArray||a)}if(t.depthTexture&&this.renderer.texture.unbind(t.depthTexture),e){const o=e.width>>i,a=e.height>>i,l=o/e.width;this.setViewport(e.x*l,e.y*l,o,a)}else{const o=t.width>>i,a=t.height>>i;this.setViewport(0,0,o,a)}}else this.current&&(this.current=null,s.bindFramebuffer(s.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(t,e,i,s){const n=this.viewport;t=Math.round(t),e=Math.round(e),i=Math.round(i),s=Math.round(s),(n.width!==i||n.height!==s||n.x!==t||n.y!==e)&&(n.x=t,n.y=e,n.width=i,n.height=s,this.gl.viewport(t,e,i,s))}get size(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}}clear(t,e,i,s,n=Lo.COLOR|Lo.DEPTH){const{gl:o}=this;o.clearColor(t,e,i,s),o.clear(n)}initFramebuffer(t){const{gl:e}=this,i=new Zv(e.createFramebuffer());return i.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=i,this.managedFramebuffers.push(t),t.disposeRunner.add(this),i}resizeFramebuffer(t){const{gl:e}=this,i=t.glFramebuffers[this.CONTEXT_UID];if(i.stencil){e.bindRenderbuffer(e.RENDERBUFFER,i.stencil);let o;this.renderer.context.webGLVersion===1?o=e.DEPTH_STENCIL:t.depth&&t.stencil?o=e.DEPTH24_STENCIL8:t.depth?o=e.DEPTH_COMPONENT24:o=e.STENCIL_INDEX8,i.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,o,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,o,t.width,t.height)}const s=t.colorTextures;let n=s.length;e.drawBuffers||(n=Math.min(n,1));for(let o=0;o<n;o++){const a=s[o],l=a.parentTextureArray||a;this.renderer.texture.bind(l,0),o===0&&i.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,i.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,l._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height))}t.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(t.depthTexture,0)}updateFramebuffer(t,e){const{gl:i}=this,s=t.glFramebuffers[this.CONTEXT_UID],n=t.colorTextures;let o=n.length;i.drawBuffers||(o=Math.min(o,1)),s.multisample>1&&this.canMultisampleFramebuffer(t)?s.msaaBuffer=s.msaaBuffer||i.createRenderbuffer():s.msaaBuffer&&(i.deleteRenderbuffer(s.msaaBuffer),s.msaaBuffer=null,s.blitFramebuffer&&(s.blitFramebuffer.dispose(),s.blitFramebuffer=null));const a=[];for(let l=0;l<o;l++){const h=n[l],c=h.parentTextureArray||h;this.renderer.texture.bind(c,0),l===0&&s.msaaBuffer?(i.bindRenderbuffer(i.RENDERBUFFER,s.msaaBuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,s.multisample,c._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,s.msaaBuffer)):(i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+l,h.target,c._glTextures[this.CONTEXT_UID].texture,e),a.push(i.COLOR_ATTACHMENT0+l))}if(a.length>1&&i.drawBuffers(a),t.depthTexture&&this.writeDepthTexture){const l=t.depthTexture;this.renderer.texture.bind(l,0),i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,l._glTextures[this.CONTEXT_UID].texture,e)}if((t.stencil||t.depth)&&!(t.depthTexture&&this.writeDepthTexture)){s.stencil=s.stencil||i.createRenderbuffer();let l,h;this.renderer.context.webGLVersion===1?(l=i.DEPTH_STENCIL_ATTACHMENT,h=i.DEPTH_STENCIL):t.depth&&t.stencil?(l=i.DEPTH_STENCIL_ATTACHMENT,h=i.DEPTH24_STENCIL8):t.depth?(l=i.DEPTH_ATTACHMENT,h=i.DEPTH_COMPONENT24):(l=i.STENCIL_ATTACHMENT,h=i.STENCIL_INDEX8),i.bindRenderbuffer(i.RENDERBUFFER,s.stencil),s.msaaBuffer?i.renderbufferStorageMultisample(i.RENDERBUFFER,s.multisample,h,t.width,t.height):i.renderbufferStorage(i.RENDERBUFFER,h,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,l,i.RENDERBUFFER,s.stencil)}else s.stencil&&(i.deleteRenderbuffer(s.stencil),s.stencil=null)}canMultisampleFramebuffer(t){return this.renderer.context.webGLVersion!==1&&t.colorTextures.length<=1&&!t.depthTexture}detectSamples(t){const{msaaSamples:e}=this;let i=Dt.NONE;if(t<=1||e===null)return i;for(let s=0;s<e.length;s++)if(e[s]<=t){i=e[s];break}return i===1&&(i=Dt.NONE),i}blit(t,e,i){const{current:s,renderer:n,gl:o,CONTEXT_UID:a}=this;if(n.context.webGLVersion!==2||!s)return;const l=s.glFramebuffers[a];if(!l)return;if(!t){if(!l.msaaBuffer)return;const c=s.colorTextures[0];if(!c)return;l.blitFramebuffer||(l.blitFramebuffer=new za(s.width,s.height),l.blitFramebuffer.addColorTexture(0,c)),t=l.blitFramebuffer,t.colorTextures[0]!==c&&(t.colorTextures[0]=c,t.dirtyId++,t.dirtyFormat++),(t.width!==s.width||t.height!==s.height)&&(t.width=s.width,t.height=s.height,t.dirtyId++,t.dirtySize++)}e||(e=Jv,e.width=s.width,e.height=s.height),i||(i=e);const h=e.width===i.width&&e.height===i.height;this.bind(t),o.bindFramebuffer(o.READ_FRAMEBUFFER,l.framebuffer),o.blitFramebuffer(e.left,e.top,e.right,e.bottom,i.left,i.top,i.right,i.bottom,o.COLOR_BUFFER_BIT,h?o.NEAREST:o.LINEAR),o.bindFramebuffer(o.READ_FRAMEBUFFER,t.glFramebuffers[this.CONTEXT_UID].framebuffer)}disposeFramebuffer(t,e){const i=t.glFramebuffers[this.CONTEXT_UID],s=this.gl;if(!i)return;delete t.glFramebuffers[this.CONTEXT_UID];const n=this.managedFramebuffers.indexOf(t);n>=0&&this.managedFramebuffers.splice(n,1),t.disposeRunner.remove(this),e||(s.deleteFramebuffer(i.framebuffer),i.msaaBuffer&&s.deleteRenderbuffer(i.msaaBuffer),i.stencil&&s.deleteRenderbuffer(i.stencil)),i.blitFramebuffer&&this.disposeFramebuffer(i.blitFramebuffer,e)}disposeAll(t){const e=this.managedFramebuffers;this.managedFramebuffers=[];for(let i=0;i<e.length;i++)this.disposeFramebuffer(e[i],t)}forceStencil(){const t=this.current;if(!t)return;const e=t.glFramebuffers[this.CONTEXT_UID];if(!e||e.stencil&&t.stencil)return;t.stencil=!0;const i=t.width,s=t.height,n=this.gl,o=e.stencil=n.createRenderbuffer();n.bindRenderbuffer(n.RENDERBUFFER,o);let a,l;this.renderer.context.webGLVersion===1?(a=n.DEPTH_STENCIL_ATTACHMENT,l=n.DEPTH_STENCIL):t.depth?(a=n.DEPTH_STENCIL_ATTACHMENT,l=n.DEPTH24_STENCIL8):(a=n.STENCIL_ATTACHMENT,l=n.STENCIL_INDEX8),e.msaaBuffer?n.renderbufferStorageMultisample(n.RENDERBUFFER,e.multisample,l,i,s):n.renderbufferStorage(n.RENDERBUFFER,l,i,s),n.framebufferRenderbuffer(n.FRAMEBUFFER,a,n.RENDERBUFFER,o)}reset(){this.current=this.unknownFramebuffer,this.viewport=new nt}destroy(){this.renderer=null}}Yu.extension={type:V.RendererSystem,name:"framebuffer"},j.add(Yu);const Ya={5126:4,5123:2,5121:1};class qu{constructor(t){this.renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this.canUseUInt32ElementIndex=!1,this.managedGeometries={}}contextChange(){this.disposeAll(!0);const t=this.gl=this.renderer.gl,e=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,e.webGLVersion!==2){let i=this.renderer.context.extensions.vertexArrayObject;W.PREFER_ENV===Dr.WEBGL_LEGACY&&(i=null),i?(t.createVertexArray=()=>i.createVertexArrayOES(),t.bindVertexArray=s=>i.bindVertexArrayOES(s),t.deleteVertexArray=s=>i.deleteVertexArrayOES(s)):(this.hasVao=!1,t.createVertexArray=()=>null,t.bindVertexArray=()=>null,t.deleteVertexArray=()=>null)}if(e.webGLVersion!==2){const i=t.getExtension("ANGLE_instanced_arrays");i?(t.vertexAttribDivisor=(s,n)=>i.vertexAttribDivisorANGLE(s,n),t.drawElementsInstanced=(s,n,o,a,l)=>i.drawElementsInstancedANGLE(s,n,o,a,l),t.drawArraysInstanced=(s,n,o,a)=>i.drawArraysInstancedANGLE(s,n,o,a)):this.hasInstance=!1}this.canUseUInt32ElementIndex=e.webGLVersion===2||!!e.extensions.uint32ElementIndex}bind(t,e){e=e||this.renderer.shader.shader;const{gl:i}=this;let s=t.glVertexArrayObjects[this.CONTEXT_UID],n=!1;s||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=s={},n=!0);const o=s[e.program.id]||this.initGeometryVao(t,e,n);this._activeGeometry=t,this._activeVao!==o&&(this._activeVao=o,this.hasVao?i.bindVertexArray(o):this.activateVao(t,e.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){const t=this._activeGeometry,e=this.renderer.buffer;for(let i=0;i<t.buffers.length;i++){const s=t.buffers[i];e.update(s)}}checkCompatibility(t,e){const i=t.attributes,s=e.attributeData;for(const n in s)if(!i[n])throw new Error(`shader and geometry incompatible, geometry missing the "${n}" attribute`)}getSignature(t,e){const i=t.attributes,s=e.attributeData,n=["g",t.id];for(const o in i)s[o]&&n.push(o,s[o].location);return n.join("-")}initGeometryVao(t,e,i=!0){const s=this.gl,n=this.CONTEXT_UID,o=this.renderer.buffer,a=e.program;a.glPrograms[n]||this.renderer.shader.generateProgram(e),this.checkCompatibility(t,a);const l=this.getSignature(t,a),h=t.glVertexArrayObjects[this.CONTEXT_UID];let c=h[l];if(c)return h[a.id]=c,c;const u=t.buffers,d=t.attributes,f={},p={};for(const m in u)f[m]=0,p[m]=0;for(const m in d)!d[m].size&&a.attributeData[m]?d[m].size=a.attributeData[m].size:d[m].size||console.warn(`PIXI Geometry attribute '${m}' size cannot be determined (likely the bound shader does not have the attribute)`),f[d[m].buffer]+=d[m].size*Ya[d[m].type];for(const m in d){const _=d[m],y=_.size;_.stride===void 0&&(f[_.buffer]===y*Ya[_.type]?_.stride=0:_.stride=f[_.buffer]),_.start===void 0&&(_.start=p[_.buffer],p[_.buffer]+=y*Ya[_.type])}c=s.createVertexArray(),s.bindVertexArray(c);for(let m=0;m<u.length;m++){const _=u[m];o.bind(_),i&&_._glBuffers[n].refCount++}return this.activateVao(t,a),h[a.id]=c,h[l]=c,s.bindVertexArray(null),o.unbind(Le.ARRAY_BUFFER),c}disposeGeometry(t,e){var a;if(!this.managedGeometries[t.id])return;delete this.managedGeometries[t.id];const i=t.glVertexArrayObjects[this.CONTEXT_UID],s=this.gl,n=t.buffers,o=(a=this.renderer)==null?void 0:a.buffer;if(t.disposeRunner.remove(this),!!i){if(o)for(let l=0;l<n.length;l++){const h=n[l]._glBuffers[this.CONTEXT_UID];h&&(h.refCount--,h.refCount===0&&!e&&o.dispose(n[l],e))}if(!e){for(const l in i)if(l[0]==="g"){const h=i[l];this._activeVao===h&&this.unbind(),s.deleteVertexArray(h)}}delete t.glVertexArrayObjects[this.CONTEXT_UID]}}disposeAll(t){const e=Object.keys(this.managedGeometries);for(let i=0;i<e.length;i++)this.disposeGeometry(this.managedGeometries[e[i]],t)}activateVao(t,e){const i=this.gl,s=this.CONTEXT_UID,n=this.renderer.buffer,o=t.buffers,a=t.attributes;t.indexBuffer&&n.bind(t.indexBuffer);let l=null;for(const h in a){const c=a[h],u=o[c.buffer],d=u._glBuffers[s];if(e.attributeData[h]){l!==d&&(n.bind(u),l=d);const f=e.attributeData[h].location;if(i.enableVertexAttribArray(f),i.vertexAttribPointer(f,c.size,c.type||i.FLOAT,c.normalized,c.stride,c.start),c.instance)if(this.hasInstance)i.vertexAttribDivisor(f,c.divisor);else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,i,s){const{gl:n}=this,o=this._activeGeometry;if(o.indexBuffer){const a=o.indexBuffer.data.BYTES_PER_ELEMENT,l=a===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;a===2||a===4&&this.canUseUInt32ElementIndex?o.instanced?n.drawElementsInstanced(t,e||o.indexBuffer.data.length,l,(i||0)*a,s||1):n.drawElements(t,e||o.indexBuffer.data.length,l,(i||0)*a):console.warn("unsupported index buffer type: uint32")}else o.instanced?n.drawArraysInstanced(t,i,e||o.getSize(),s||1):n.drawArrays(t,i,e||o.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}}qu.extension={type:V.RendererSystem,name:"geometry"},j.add(qu);const Ku=new Et;class Zu{constructor(t,e){this._texture=t,this.mapCoord=new Et,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof e>"u"?.5:e,this.isSimple=!1}get texture(){return this._texture}set texture(t){this._texture=t,this._textureID=-1}multiplyUvs(t,e){e===void 0&&(e=t);const i=this.mapCoord;for(let s=0;s<t.length;s+=2){const n=t[s],o=t[s+1];e[s]=n*i.a+o*i.c+i.tx,e[s+1]=n*i.b+o*i.d+i.ty}return e}update(t){const e=this._texture;if(!e||!e.valid||!t&&this._textureID===e._updateID)return!1;this._textureID=e._updateID,this._updateID++;const i=e._uvs;this.mapCoord.set(i.x1-i.x0,i.y1-i.y0,i.x3-i.x0,i.y3-i.y0,i.x0,i.y0);const s=e.orig,n=e.trim;n&&(Ku.set(s.width/n.width,0,0,s.height/n.height,-n.x/n.width,-n.y/n.height),this.mapCoord.append(Ku));const o=e.baseTexture,a=this.uClampFrame,l=this.clampMargin/o.resolution,h=this.clampOffset;return a[0]=(e._frame.x+l+h)/o.width,a[1]=(e._frame.y+l+h)/o.height,a[2]=(e._frame.x+e._frame.width-l+h)/o.width,a[3]=(e._frame.y+e._frame.height-l+h)/o.height,this.uClampOffset[0]=h/o.realWidth,this.uClampOffset[1]=h/o.realHeight,this.isSimple=e._frame.width===o.width&&e._frame.height===o.height&&e.rotate===0,!0}}var Qv=`varying vec2 vMaskCoord;
427
379
  varying vec2 vTextureCoord;
428
380
 
429
381
  uniform sampler2D uSampler;
@@ -448,7 +400,23 @@ void main(void)
448
400
 
449
401
  gl_FragColor = original;
450
402
  }
451
- `,Vh=new Mt,ya=function(){function r(t,e){this._texture=t,this.mapCoord=new Mt,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof e>"u"?.5:e,this.isSimple=!1}return Object.defineProperty(r.prototype,"texture",{get:function(){return this._texture},set:function(t){this._texture=t,this._textureID=-1},enumerable:!1,configurable:!0}),r.prototype.multiplyUvs=function(t,e){e===void 0&&(e=t);for(var n=this.mapCoord,i=0;i<t.length;i+=2){var o=t[i],a=t[i+1];e[i]=o*n.a+a*n.c+n.tx,e[i+1]=o*n.b+a*n.d+n.ty}return e},r.prototype.update=function(t){var e=this._texture;if(!e||!e.valid||!t&&this._textureID===e._updateID)return!1;this._textureID=e._updateID,this._updateID++;var n=e._uvs;this.mapCoord.set(n.x1-n.x0,n.y1-n.y0,n.x3-n.x0,n.y3-n.y0,n.x0,n.y0);var i=e.orig,o=e.trim;o&&(Vh.set(i.width/o.width,0,0,i.height/o.height,-o.x/o.width,-o.y/o.height),this.mapCoord.append(Vh));var a=e.baseTexture,s=this.uClampFrame,u=this.clampMargin/a.resolution,h=this.clampOffset;return s[0]=(e._frame.x+u+h)/a.width,s[1]=(e._frame.y+u+h)/a.height,s[2]=(e._frame.x+e._frame.width-u+h)/a.width,s[3]=(e._frame.y+e._frame.height-u+h)/a.height,this.uClampOffset[0]=h/a.realWidth,this.uClampOffset[1]=h/a.realHeight,this.isSimple=e._frame.width===a.width&&e._frame.height===a.height&&e.rotate===0,!0},r}(),Ky=function(r){bt(t,r);function t(e,n,i){var o=this,a=null;return typeof e!="string"&&n===void 0&&i===void 0&&(a=e,e=void 0,n=void 0,i=void 0),o=r.call(this,e||qy,n||$y,i)||this,o.maskSprite=a,o.maskMatrix=new Mt,o}return Object.defineProperty(t.prototype,"maskSprite",{get:function(){return this._maskSprite},set:function(e){this._maskSprite=e,this._maskSprite&&(this._maskSprite.renderable=!1)},enumerable:!1,configurable:!0}),t.prototype.apply=function(e,n,i,o){var a=this._maskSprite,s=a._texture;s.valid&&(s.uvMatrix||(s.uvMatrix=new ya(s,0)),s.uvMatrix.update(),this.uniforms.npmAlpha=s.baseTexture.alphaMode?0:1,this.uniforms.mask=s,this.uniforms.otherMatrix=e.calculateSpriteMatrix(this.maskMatrix,a).prepend(s.uvMatrix.mapCoord),this.uniforms.alpha=a.worldAlpha,this.uniforms.maskClamp=s.uvMatrix.uClampFrame,e.applyFilter(this,n,i,o))},t}(Ve),Zy=function(){function r(t){this.renderer=t,this.enableScissor=!0,this.alphaMaskPool=[],this.maskDataPool=[],this.maskStack=[],this.alphaMaskIndex=0}return r.prototype.setMaskStack=function(t){this.maskStack=t,this.renderer.scissor.setMaskStack(t),this.renderer.stencil.setMaskStack(t)},r.prototype.push=function(t,e){var n=e;if(!n.isMaskData){var i=this.maskDataPool.pop()||new Cy;i.pooled=!0,i.maskObject=e,n=i}var o=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(n.copyCountersOrReset(o),n._colorMask=o?o._colorMask:15,n.autoDetect&&this.detect(n),n._target=t,n.type!==Ct.SPRITE&&this.maskStack.push(n),n.enabled)switch(n.type){case Ct.SCISSOR:this.renderer.scissor.push(n);break;case Ct.STENCIL:this.renderer.stencil.push(n);break;case Ct.SPRITE:n.copyCountersOrReset(null),this.pushSpriteMask(n);break;case Ct.COLOR:this.pushColorMask(n);break}n.type===Ct.SPRITE&&this.maskStack.push(n)},r.prototype.pop=function(t){var e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case Ct.SCISSOR:this.renderer.scissor.pop(e);break;case Ct.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case Ct.SPRITE:this.popSpriteMask(e);break;case Ct.COLOR:this.popColorMask(e);break}if(e.reset(),e.pooled&&this.maskDataPool.push(e),this.maskStack.length!==0){var n=this.maskStack[this.maskStack.length-1];n.type===Ct.SPRITE&&n._filters&&(n._filters[0].maskSprite=n.maskObject)}}},r.prototype.detect=function(t){var e=t.maskObject;e?e.isSprite?t.type=Ct.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=Ct.SCISSOR:t.type=Ct.STENCIL:t.type=Ct.COLOR},r.prototype.pushSpriteMask=function(t){var e,n,i=t.maskObject,o=t._target,a=t._filters;a||(a=this.alphaMaskPool[this.alphaMaskIndex],a||(a=this.alphaMaskPool[this.alphaMaskIndex]=[new Ky]));var s=this.renderer,u=s.renderTexture,h,l;if(u.current){var f=u.current;h=t.resolution||f.resolution,l=(e=t.multisample)!==null&&e!==void 0?e:f.multisample}else h=t.resolution||s.resolution,l=(n=t.multisample)!==null&&n!==void 0?n:s.multisample;a[0].resolution=h,a[0].multisample=l,a[0].maskSprite=i;var c=o.filterArea;o.filterArea=i.getBounds(!0),s.filter.push(o,a),o.filterArea=c,t._filters||this.alphaMaskIndex++},r.prototype.popSpriteMask=function(t){this.renderer.filter.pop(),t._filters?t._filters[0].maskSprite=null:(this.alphaMaskIndex--,this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite=null)},r.prototype.pushColorMask=function(t){var e=t._colorMask,n=t._colorMask=e&t.colorMask;n!==e&&this.renderer.gl.colorMask((n&1)!==0,(n&2)!==0,(n&4)!==0,(n&8)!==0)},r.prototype.popColorMask=function(t){var e=t._colorMask,n=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;n!==e&&this.renderer.gl.colorMask((n&1)!==0,(n&2)!==0,(n&4)!==0,(n&8)!==0)},r.prototype.destroy=function(){this.renderer=null},r}(),Yh=function(){function r(t){this.renderer=t,this.maskStack=[],this.glConst=0}return r.prototype.getStackLength=function(){return this.maskStack.length},r.prototype.setMaskStack=function(t){var e=this.renderer.gl,n=this.getStackLength();this.maskStack=t;var i=this.getStackLength();i!==n&&(i===0?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))},r.prototype._useCurrent=function(){},r.prototype.destroy=function(){this.renderer=null,this.maskStack=null},r}(),zh=new Mt,Wh=[],Jy=function(r){bt(t,r);function t(e){var n=r.call(this,e)||this;return n.glConst=k.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST,n}return t.prototype.getStackLength=function(){var e=this.maskStack[this.maskStack.length-1];return e?e._scissorCounter:0},t.prototype.calcScissorRect=function(e){var n;if(!e._scissorRectLocal){var i=e._scissorRect,o=e.maskObject,a=this.renderer,s=a.renderTexture,u=o.getBounds(!0,(n=Wh.pop())!==null&&n!==void 0?n:new st);this.roundFrameToPixels(u,s.current?s.current.resolution:a.resolution,s.sourceFrame,s.destinationFrame,a.projection.transform),i&&u.fit(i),e._scissorRectLocal=u}},t.isMatrixRotated=function(e){if(!e)return!1;var n=e.a,i=e.b,o=e.c,a=e.d;return(Math.abs(i)>1e-4||Math.abs(o)>1e-4)&&(Math.abs(n)>1e-4||Math.abs(a)>1e-4)},t.prototype.testScissor=function(e){var n=e.maskObject;if(!n.isFastRect||!n.isFastRect()||t.isMatrixRotated(n.worldTransform)||t.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(e);var i=e._scissorRectLocal;return i.width>0&&i.height>0},t.prototype.roundFrameToPixels=function(e,n,i,o,a){t.isMatrixRotated(a)||(a=a?zh.copyFrom(a):zh.identity(),a.translate(-i.x,-i.y).scale(o.width/i.width,o.height/i.height).translate(o.x,o.y),this.renderer.filter.transformAABB(a,e),e.fit(o),e.x=Math.round(e.x*n),e.y=Math.round(e.y*n),e.width=Math.round(e.width*n),e.height=Math.round(e.height*n))},t.prototype.push=function(e){e._scissorRectLocal||this.calcScissorRect(e);var n=this.renderer.gl;e._scissorRect||n.enable(n.SCISSOR_TEST),e._scissorCounter++,e._scissorRect=e._scissorRectLocal,this._useCurrent()},t.prototype.pop=function(e){var n=this.renderer.gl;e&&Wh.push(e._scissorRectLocal),this.getStackLength()>0?this._useCurrent():n.disable(n.SCISSOR_TEST)},t.prototype._useCurrent=function(){var e=this.maskStack[this.maskStack.length-1]._scissorRect,n;this.renderer.renderTexture.current?n=e.y:n=this.renderer.height-e.height-e.y,this.renderer.gl.scissor(e.x,n,e.width,e.height)},t}(Yh),Qy=function(r){bt(t,r);function t(e){var n=r.call(this,e)||this;return n.glConst=k.ADAPTER.getWebGLRenderingContext().STENCIL_TEST,n}return t.prototype.getStackLength=function(){var e=this.maskStack[this.maskStack.length-1];return e?e._stencilCounter:0},t.prototype.push=function(e){var n=e.maskObject,i=this.renderer.gl,o=e._stencilCounter;o===0&&(this.renderer.framebuffer.forceStencil(),i.clearStencil(0),i.clear(i.STENCIL_BUFFER_BIT),i.enable(i.STENCIL_TEST)),e._stencilCounter++;var a=e._colorMask;a!==0&&(e._colorMask=0,i.colorMask(!1,!1,!1,!1)),i.stencilFunc(i.EQUAL,o,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.INCR),n.renderable=!0,n.render(this.renderer),this.renderer.batch.flush(),n.renderable=!1,a!==0&&(e._colorMask=a,i.colorMask((a&1)!==0,(a&2)!==0,(a&4)!==0,(a&8)!==0)),this._useCurrent()},t.prototype.pop=function(e){var n=this.renderer.gl;if(this.getStackLength()===0)n.disable(n.STENCIL_TEST);else{var i=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,o=i?i._colorMask:15;o!==0&&(i._colorMask=0,n.colorMask(!1,!1,!1,!1)),n.stencilOp(n.KEEP,n.KEEP,n.DECR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,o!==0&&(i._colorMask=o,n.colorMask((o&1)!==0,(o&2)!==0,(o&4)!==0,(o&8)!==0)),this._useCurrent()}},t.prototype._useCurrent=function(){var e=this.renderer.gl;e.stencilFunc(e.EQUAL,this.getStackLength(),4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP)},t}(Yh),t0=function(){function r(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new Mt,this.transform=null}return r.prototype.update=function(t,e,n,i){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,n,i),this.transform&&this.projectionMatrix.append(this.transform);var o=this.renderer;o.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,o.globalUniforms.update(),o.shader.shader&&o.shader.syncUniformGroup(o.shader.shader.uniforms.globals)},r.prototype.calculateProjection=function(t,e,n,i){var o=this.projectionMatrix,a=i?-1:1;o.identity(),o.a=1/e.width*2,o.d=a*(1/e.height*2),o.tx=-1-e.x*o.a,o.ty=-a-e.y*o.d},r.prototype.setTransform=function(t){},r.prototype.destroy=function(){this.renderer=null},r}(),cr=new st,Sn=new st,e0=function(){function r(t){this.renderer=t,this.clearColor=t._backgroundColorRgba,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new st,this.destinationFrame=new st,this.viewportFrame=new st}return r.prototype.bind=function(t,e,n){t===void 0&&(t=null);var i=this.renderer;this.current=t;var o,a,s;t?(o=t.baseTexture,s=o.resolution,e||(cr.width=t.frame.width,cr.height=t.frame.height,e=cr),n||(Sn.x=t.frame.x,Sn.y=t.frame.y,Sn.width=e.width,Sn.height=e.height,n=Sn),a=o.framebuffer):(s=i.resolution,e||(cr.width=i.screen.width,cr.height=i.screen.height,e=cr),n||(n=cr,n.width=e.width,n.height=e.height));var u=this.viewportFrame;u.x=n.x*s,u.y=n.y*s,u.width=n.width*s,u.height=n.height*s,t||(u.y=i.view.height-(u.y+u.height)),u.ceil(),this.renderer.framebuffer.bind(a,u),this.renderer.projection.update(n,e,s,!a),t?this.renderer.mask.setMaskStack(o.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(n)},r.prototype.clear=function(t,e){this.current?t=t||this.current.baseTexture.clearColor:t=t||this.clearColor;var n=this.destinationFrame,i=this.current?this.current.baseTexture:this.renderer.screen,o=n.width!==i.width||n.height!==i.height;if(o){var a=this.viewportFrame,s=a.x,u=a.y,h=a.width,l=a.height;s=Math.round(s),u=Math.round(u),h=Math.round(h),l=Math.round(l),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(s,u,h,l)}this.renderer.framebuffer.clear(t[0],t[1],t[2],t[3],e),o&&this.renderer.scissor.pop()},r.prototype.resize=function(){this.bind(null)},r.prototype.reset=function(){this.bind(null)},r.prototype.destroy=function(){this.renderer=null},r}();function r0(r,t,e,n,i){e.buffer.update(i)}var n0={float:`
403
+ `,t1=`attribute vec2 aVertexPosition;
404
+ attribute vec2 aTextureCoord;
405
+
406
+ uniform mat3 projectionMatrix;
407
+ uniform mat3 otherMatrix;
408
+
409
+ varying vec2 vMaskCoord;
410
+ varying vec2 vTextureCoord;
411
+
412
+ void main(void)
413
+ {
414
+ gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
415
+
416
+ vTextureCoord = aTextureCoord;
417
+ vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;
418
+ }
419
+ `;class e1 extends re{constructor(t,e,i){let s=null;typeof t!="string"&&e===void 0&&i===void 0&&(s=t,t=void 0,e=void 0,i=void 0),super(t||t1,e||Qv,i),this.maskSprite=s,this.maskMatrix=new Et}get maskSprite(){return this._maskSprite}set maskSprite(t){this._maskSprite=t,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(t,e,i,s){const n=this._maskSprite,o=n._texture;o.valid&&(o.uvMatrix||(o.uvMatrix=new Zu(o,0)),o.uvMatrix.update(),this.uniforms.npmAlpha=o.baseTexture.alphaMode?0:1,this.uniforms.mask=o,this.uniforms.otherMatrix=t.calculateSpriteMatrix(this.maskMatrix,n).prepend(o.uvMatrix.mapCoord),this.uniforms.alpha=n.worldAlpha,this.uniforms.maskClamp=o.uvMatrix.uClampFrame,t.applyFilter(this,e,i,s))}}class r1{constructor(t=null){this.type=Ft.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=re.defaultMultisample,this.enabled=!0,this.colorMask=15,this._filters=null,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._scissorRectLocal=null,this._colorMask=15,this._target=null}get filter(){return this._filters?this._filters[0]:null}set filter(t){t?this._filters?this._filters[0]=t:this._filters=[t]:this._filters=null}reset(){this.pooled&&(this.maskObject=null,this.type=Ft.NONE,this.autoDetect=!0),this._target=null,this._scissorRectLocal=null}copyCountersOrReset(t){t?(this._stencilCounter=t._stencilCounter,this._scissorCounter=t._scissorCounter,this._scissorRect=t._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)}}class Ju{constructor(t){this.renderer=t,this.enableScissor=!0,this.alphaMaskPool=[],this.maskDataPool=[],this.maskStack=[],this.alphaMaskIndex=0}setMaskStack(t){this.maskStack=t,this.renderer.scissor.setMaskStack(t),this.renderer.stencil.setMaskStack(t)}push(t,e){let i=e;if(!i.isMaskData){const n=this.maskDataPool.pop()||new r1;n.pooled=!0,n.maskObject=e,i=n}const s=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(i.copyCountersOrReset(s),i._colorMask=s?s._colorMask:15,i.autoDetect&&this.detect(i),i._target=t,i.type!==Ft.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case Ft.SCISSOR:this.renderer.scissor.push(i);break;case Ft.STENCIL:this.renderer.stencil.push(i);break;case Ft.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case Ft.COLOR:this.pushColorMask(i);break}i.type===Ft.SPRITE&&this.maskStack.push(i)}pop(t){const e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case Ft.SCISSOR:this.renderer.scissor.pop(e);break;case Ft.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case Ft.SPRITE:this.popSpriteMask(e);break;case Ft.COLOR:this.popColorMask(e);break}if(e.reset(),e.pooled&&this.maskDataPool.push(e),this.maskStack.length!==0){const i=this.maskStack[this.maskStack.length-1];i.type===Ft.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}}detect(t){const e=t.maskObject;e?e.isSprite?t.type=Ft.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=Ft.SCISSOR:t.type=Ft.STENCIL:t.type=Ft.COLOR}pushSpriteMask(t){const{maskObject:e}=t,i=t._target;let s=t._filters;s||(s=this.alphaMaskPool[this.alphaMaskIndex],s||(s=this.alphaMaskPool[this.alphaMaskIndex]=[new e1])),s[0].resolution=t.resolution,s[0].multisample=t.multisample,s[0].maskSprite=e;const n=i.filterArea;i.filterArea=e.getBounds(!0),this.renderer.filter.push(i,s),i.filterArea=n,t._filters||this.alphaMaskIndex++}popSpriteMask(t){this.renderer.filter.pop(),t._filters?t._filters[0].maskSprite=null:(this.alphaMaskIndex--,this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite=null)}pushColorMask(t){const e=t._colorMask,i=t._colorMask=e&t.colorMask;i!==e&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}popColorMask(t){const e=t._colorMask,i=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;i!==e&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}destroy(){this.renderer=null}}Ju.extension={type:V.RendererSystem,name:"mask"},j.add(Ju);class Qu{constructor(t){this.renderer=t,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(t){const{gl:e}=this.renderer,i=this.getStackLength();this.maskStack=t;const s=this.getStackLength();s!==i&&(s===0?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}}const td=new Et,ed=[],rd=class eo extends Qu{constructor(t){super(t),this.glConst=W.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0}calcScissorRect(t){if(t._scissorRectLocal)return;const e=t._scissorRect,{maskObject:i}=t,{renderer:s}=this,n=s.renderTexture,o=i.getBounds(!0,ed.pop()??new nt);this.roundFrameToPixels(o,n.current?n.current.resolution:s.resolution,n.sourceFrame,n.destinationFrame,s.projection.transform),e&&o.fit(e),t._scissorRectLocal=o}static isMatrixRotated(t){if(!t)return!1;const{a:e,b:i,c:s,d:n}=t;return(Math.abs(i)>1e-4||Math.abs(s)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(n)>1e-4)}testScissor(t){const{maskObject:e}=t;if(!e.isFastRect||!e.isFastRect()||eo.isMatrixRotated(e.worldTransform)||eo.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);const i=t._scissorRectLocal;return i.width>0&&i.height>0}roundFrameToPixels(t,e,i,s,n){eo.isMatrixRotated(n)||(n=n?td.copyFrom(n):td.identity(),n.translate(-i.x,-i.y).scale(s.width/i.width,s.height/i.height).translate(s.x,s.y),this.renderer.filter.transformAABB(n,t),t.fit(s),t.x=Math.round(t.x*e),t.y=Math.round(t.y*e),t.width=Math.round(t.width*e),t.height=Math.round(t.height*e))}push(t){t._scissorRectLocal||this.calcScissorRect(t);const{gl:e}=this.renderer;t._scissorRect||e.enable(e.SCISSOR_TEST),t._scissorCounter++,t._scissorRect=t._scissorRectLocal,this._useCurrent()}pop(t){const{gl:e}=this.renderer;t&&ed.push(t._scissorRectLocal),this.getStackLength()>0?this._useCurrent():e.disable(e.SCISSOR_TEST)}_useCurrent(){const t=this.maskStack[this.maskStack.length-1]._scissorRect;let e;this.renderer.renderTexture.current?e=t.y:e=this.renderer.height-t.height-t.y,this.renderer.gl.scissor(t.x,e,t.width,t.height)}};rd.extension={type:V.RendererSystem,name:"scissor"};let i1=rd;j.add(i1);class id extends Qu{constructor(t){super(t),this.glConst=W.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0}push(t){const e=t.maskObject,{gl:i}=this.renderer,s=t._stencilCounter;s===0&&(this.renderer.framebuffer.forceStencil(),i.clearStencil(0),i.clear(i.STENCIL_BUFFER_BIT),i.enable(i.STENCIL_TEST)),t._stencilCounter++;const n=t._colorMask;n!==0&&(t._colorMask=0,i.colorMask(!1,!1,!1,!1)),i.stencilFunc(i.EQUAL,s,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,n!==0&&(t._colorMask=n,i.colorMask((n&1)!==0,(n&2)!==0,(n&4)!==0,(n&8)!==0)),this._useCurrent()}pop(t){const e=this.renderer.gl;if(this.getStackLength()===0)e.disable(e.STENCIL_TEST);else{const i=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,s=i?i._colorMask:15;s!==0&&(i._colorMask=0,e.colorMask(!1,!1,!1,!1)),e.stencilOp(e.KEEP,e.KEEP,e.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,s!==0&&(i._colorMask=s,e.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)),this._useCurrent()}}_useCurrent(){const t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)}}id.extension={type:V.RendererSystem,name:"stencil"},j.add(id);class sd{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return lt("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract}},prepare:{enumerable:!1,get(){return lt("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare}},interaction:{enumerable:!1,get(){return lt("7.0.0","renderer.plugins.interaction has been deprecated, use renderer.events"),t.events}}})}init(){const t=this.rendererPlugins;for(const e in t)this.plugins[e]=new t[e](this.renderer)}destroy(){for(const t in this.plugins)this.plugins[t].destroy(),this.plugins[t]=null}}sd.extension={type:[V.RendererSystem,V.CanvasRendererSystem],name:"_plugin"},j.add(sd);class nd{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new Et,this.transform=null}update(t,e,i,s){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,i,s),this.transform&&this.projectionMatrix.append(this.transform);const n=this.renderer;n.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,n.globalUniforms.update(),n.shader.shader&&n.shader.syncUniformGroup(n.shader.shader.uniforms.globals)}calculateProjection(t,e,i,s){const n=this.projectionMatrix,o=s?-1:1;n.identity(),n.a=1/e.width*2,n.d=o*(1/e.height*2),n.tx=-1-e.x*n.a,n.ty=-o-e.y*n.d}setTransform(t){}destroy(){this.renderer=null}}nd.extension={type:V.RendererSystem,name:"projection"},j.add(nd);const s1=new Ga,od=new nt;class ad{constructor(t){this.renderer=t,this._tempMatrix=new Et}generateTexture(t,e){const{region:i,...s}=e||{},n=(i==null?void 0:i.copyTo(od))||t.getLocalBounds(od,!0),o=s.resolution||this.renderer.resolution;n.width=Math.max(n.width,1/o),n.height=Math.max(n.height,1/o),s.width=n.width,s.height=n.height,s.resolution=o,s.multisample??(s.multisample=this.renderer.multisample);const a=zr.create(s);this._tempMatrix.tx=-n.x,this._tempMatrix.ty=-n.y;const l=t.transform;return t.transform=s1,this.renderer.render(t,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=l,a}destroy(){}}ad.extension={type:[V.RendererSystem,V.CanvasRendererSystem],name:"textureGenerator"},j.add(ad);const Wr=new nt,fs=new nt;class ld{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new nt,this.destinationFrame=new nt,this.viewportFrame=new nt}contextChange(){var e;const t=(e=this.renderer)==null?void 0:e.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}bind(t=null,e,i){const s=this.renderer;this.current=t;let n,o,a;t?(n=t.baseTexture,a=n.resolution,e||(Wr.width=t.frame.width,Wr.height=t.frame.height,e=Wr),i||(fs.x=t.frame.x,fs.y=t.frame.y,fs.width=e.width,fs.height=e.height,i=fs),o=n.framebuffer):(a=s.resolution,e||(Wr.width=s._view.screen.width,Wr.height=s._view.screen.height,e=Wr),i||(i=Wr,i.width=e.width,i.height=e.height));const l=this.viewportFrame;l.x=i.x*a,l.y=i.y*a,l.width=i.width*a,l.height=i.height*a,t||(l.y=s.view.height-(l.y+l.height)),l.ceil(),this.renderer.framebuffer.bind(o,l),this.renderer.projection.update(i,e,a,!o),t?this.renderer.mask.setMaskStack(n.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(i)}clear(t,e){const i=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,s=xt.shared.setValue(t||i);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&s.premultiply(s.alpha);const n=this.destinationFrame,o=this.current?this.current.baseTexture:this.renderer._view.screen,a=n.width!==o.width||n.height!==o.height;if(a){let{x:l,y:h,width:c,height:u}=this.viewportFrame;l=Math.round(l),h=Math.round(h),c=Math.round(c),u=Math.round(u),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(l,h,c,u)}this.renderer.framebuffer.clear(s.red,s.green,s.blue,s.alpha,e),a&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}ld.extension={type:V.RendererSystem,name:"renderTexture"},j.add(ld);class n1{constructor(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null}}function o1(r,t){const e={},i=t.getProgramParameter(r,t.ACTIVE_ATTRIBUTES);for(let s=0;s<i;s++){const n=t.getActiveAttrib(r,s);if(n.name.startsWith("gl_"))continue;const o=Uu(t,n.type),a={type:o,name:n.name,size:Lu(o),location:t.getAttribLocation(r,n.name)};e[n.name]=a}return e}function a1(r,t){const e={},i=t.getProgramParameter(r,t.ACTIVE_UNIFORMS);for(let s=0;s<i;s++){const n=t.getActiveUniform(r,s),o=n.name.replace(/\[.*?\]$/,""),a=!!n.name.match(/\[.*?\]$/),l=Uu(t,n.type);e[o]={name:o,index:s,type:l,size:n.size,isArray:a,value:Du(l,n.size)}}return e}function l1(r,t){var a;const e=Bu(r,r.VERTEX_SHADER,t.vertexSrc),i=Bu(r,r.FRAGMENT_SHADER,t.fragmentSrc),s=r.createProgram();r.attachShader(s,e),r.attachShader(s,i);const n=(a=t.extra)==null?void 0:a.transformFeedbackVaryings;if(n&&(typeof r.transformFeedbackVaryings!="function"?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):r.transformFeedbackVaryings(s,n.names,n.bufferMode==="separate"?r.SEPARATE_ATTRIBS:r.INTERLEAVED_ATTRIBS)),r.linkProgram(s),r.getProgramParameter(s,r.LINK_STATUS)||Nv(r,s,e,i),t.attributeData=o1(s,r),t.uniformData=a1(s,r),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertexSrc)){const l=Object.keys(t.attributeData);l.sort((h,c)=>h>c?1:-1);for(let h=0;h<l.length;h++)t.attributeData[l[h]].location=h,r.bindAttribLocation(s,h,l[h]);r.linkProgram(s)}r.deleteShader(e),r.deleteShader(i);const o={};for(const l in t.uniformData){const h=t.uniformData[l];o[l]={location:r.getUniformLocation(s,l),value:Du(h.type,h.size)}}return new n1(s,o)}function h1(r,t,e,i,s){e.buffer.update(s)}const c1={float:`
452
420
  data[offset] = v;
453
421
  `,vec2:`
454
422
  data[offset] = v[0];
@@ -486,7 +454,7 @@ void main(void)
486
454
  {
487
455
  data[offset + i] = v[i];
488
456
  }
489
- `},qh={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:16*2,mat3:16*3,mat4:16*4};function i0(r){for(var t=r.map(function(u){return{data:u,offset:0,dataLen:0,dirty:0}}),e=0,n=0,i=0,o=0;o<t.length;o++){var a=t[o];if(e=qh[a.data.type],a.data.size>1&&(e=Math.max(e,16)*a.data.size),a.dataLen=e,n%e!==0&&n<16){var s=n%e%16;n+=s,i+=s}n+e>16?(i=Math.ceil(i/16)*16,a.offset=i,i+=e,n=e):(a.offset=i,n+=e,i+=e)}return i=Math.ceil(i/16)*16,{uboElements:t,size:i}}function o0(r,t){var e=[];for(var n in r)t[n]&&e.push(t[n]);return e.sort(function(i,o){return i.index-o.index}),e}function a0(r,t){if(!r.autoManage)return{size:0,syncFunc:r0};for(var e=o0(r.uniforms,t),n=i0(e),i=n.uboElements,o=n.size,a=[`
457
+ `},hd={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:16*2,mat3:16*3,mat4:16*4};function u1(r){const t=r.map(n=>({data:n,offset:0,dataLen:0,dirty:0}));let e=0,i=0,s=0;for(let n=0;n<t.length;n++){const o=t[n];if(e=hd[o.data.type],o.data.size>1&&(e=Math.max(e,16)*o.data.size),o.dataLen=e,i%e!==0&&i<16){const a=i%e%16;i+=a,s+=a}i+e>16?(s=Math.ceil(s/16)*16,o.offset=s,s+=e,i=e):(o.offset=s,i+=e,s+=e)}return s=Math.ceil(s/16)*16,{uboElements:t,size:s}}function d1(r,t){const e=[];for(const i in r)t[i]&&e.push(t[i]);return e.sort((i,s)=>i.index-s.index),e}function f1(r,t){if(!r.autoManage)return{size:0,syncFunc:h1};const e=d1(r.uniforms,t),{uboElements:i,size:s}=u1(e),n=[`
490
458
  var v = null;
491
459
  var v2 = null;
492
460
  var cv = null;
@@ -494,31 +462,31 @@ void main(void)
494
462
  var gl = renderer.gl
495
463
  var index = 0;
496
464
  var data = buffer.data;
497
- `],s=0;s<i.length;s++){for(var u=i[s],h=r.uniforms[u.data.name],l=u.data.name,f=!1,c=0;c<Hr.length;c++){var d=Hr[c];if(d.codeUbo&&d.test(u.data,h)){a.push("offset = "+u.offset/4+";",Hr[c].codeUbo(u.data.name,h)),f=!0;break}}if(!f)if(u.data.size>1){var p=Xh(u.data.type),v=Math.max(qh[u.data.type]/16,1),_=p/v,m=(4-_%4)%4;a.push(`
498
- cv = ud.`+l+`.value;
499
- v = uv.`+l+`;
500
- offset = `+u.offset/4+`;
465
+ `];for(let o=0;o<i.length;o++){const a=i[o],l=r.uniforms[a.data.name],h=a.data.name;let c=!1;for(let u=0;u<Si.length;u++){const d=Si[u];if(d.codeUbo&&d.test(a.data,l)){n.push(`offset = ${a.offset/4};`,Si[u].codeUbo(a.data.name,l)),c=!0;break}}if(!c)if(a.data.size>1){const u=Lu(a.data.type),d=Math.max(hd[a.data.type]/16,1),f=u/d,p=(4-f%4)%4;n.push(`
466
+ cv = ud.${h}.value;
467
+ v = uv.${h};
468
+ offset = ${a.offset/4};
501
469
 
502
470
  t = 0;
503
471
 
504
- for(var i=0; i < `+u.data.size*v+`; i++)
472
+ for(var i=0; i < ${a.data.size*d}; i++)
505
473
  {
506
- for(var j = 0; j < `+_+`; j++)
474
+ for(var j = 0; j < ${f}; j++)
507
475
  {
508
476
  data[offset++] = v[t++];
509
477
  }
510
- offset += `+m+`;
478
+ offset += ${p};
511
479
  }
512
480
 
513
- `)}else{var g=n0[u.data.type];a.push(`
514
- cv = ud.`+l+`.value;
515
- v = uv.`+l+`;
516
- offset = `+u.offset/4+`;
517
- `+g+`;
518
- `)}}return a.push(`
481
+ `)}else{const u=c1[a.data.type];n.push(`
482
+ cv = ud.${h}.value;
483
+ v = uv.${h};
484
+ offset = ${a.offset/4};
485
+ ${u};
486
+ `)}}return n.push(`
519
487
  renderer.buffer.update(buffer);
520
- `),{size:o,syncFunc:new Function("ud","uv","renderer","syncData","buffer",a.join(`
521
- `))}}var s0=function(){function r(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}return r.prototype.destroy=function(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null},r}();function u0(r,t){for(var e={},n=t.getProgramParameter(r,t.ACTIVE_ATTRIBUTES),i=0;i<n;i++){var o=t.getActiveAttrib(r,i);if(o.name.indexOf("gl_")!==0){var a=jh(t,o.type),s={type:a,name:o.name,size:Xh(a),location:t.getAttribLocation(r,o.name)};e[o.name]=s}}return e}function h0(r,t){for(var e={},n=t.getProgramParameter(r,t.ACTIVE_UNIFORMS),i=0;i<n;i++){var o=t.getActiveUniform(r,i),a=o.name.replace(/\[.*?\]$/,""),s=!!o.name.match(/\[.*?\]$/),u=jh(t,o.type);e[a]={name:a,index:i,type:u,size:o.size,isArray:s,value:Uh(u,o.size)}}return e}function l0(r,t){var e=Nh(r,r.VERTEX_SHADER,t.vertexSrc),n=Nh(r,r.FRAGMENT_SHADER,t.fragmentSrc),i=r.createProgram();if(r.attachShader(i,e),r.attachShader(i,n),r.linkProgram(i),r.getProgramParameter(i,r.LINK_STATUS)||My(r,i,e,n),t.attributeData=u0(i,r),t.uniformData=h0(i,r),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertexSrc)){var o=Object.keys(t.attributeData);o.sort(function(l,f){return l>f?1:-1});for(var a=0;a<o.length;a++)t.attributeData[o[a]].location=a,r.bindAttribLocation(i,a,o[a]);r.linkProgram(i)}r.deleteShader(e),r.deleteShader(n);var s={};for(var a in t.uniformData){var u=t.uniformData[a];s[a]={location:r.getUniformLocation(i,a),value:Uh(u.type,u.size)}}var h=new s0(i,s);return h}var f0=0,Ei={textureCount:0,uboCount:0},c0=function(){function r(t){this.destroyed=!1,this.renderer=t,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=f0++}return r.prototype.systemCheck=function(){if(!Hy())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")},r.prototype.contextChange=function(t){this.gl=t,this.reset()},r.prototype.bind=function(t,e){t.disposeRunner.add(this),t.uniforms.globals=this.renderer.globalUniforms;var n=t.program,i=n.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==n&&(this.program=n,this.gl.useProgram(i.program)),e||(Ei.textureCount=0,Ei.uboCount=0,this.syncUniformGroup(t.uniformGroup,Ei)),i},r.prototype.setUniforms=function(t){var e=this.shader.program,n=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(n.uniformData,t,this.renderer)},r.prototype.syncUniformGroup=function(t,e){var n=this.getGlProgram();(!t.static||t.dirtyId!==n.uniformDirtyGroups[t.id])&&(n.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,n,e))},r.prototype.syncUniforms=function(t,e,n){var i=t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t);i(e.uniformData,t.uniforms,this.renderer,n)},r.prototype.createSyncGroups=function(t){var e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=Uy(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]},r.prototype.syncUniformBufferGroup=function(t,e){var n=this.getGlProgram();if(!t.static||t.dirtyId!==0||!n.uniformGroups[t.id]){t.dirtyId=0;var i=n.uniformGroups[t.id]||this.createSyncBufferGroup(t,n,e);t.buffer.update(),i(n.uniformData,t.uniforms,this.renderer,Ei,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,n.uniformBufferBindings[e])},r.prototype.createSyncBufferGroup=function(t,e,n){var i=this.renderer.gl;this.renderer.buffer.bind(t.buffer);var o=this.gl.getUniformBlockIndex(e.program,n);e.uniformBufferBindings[n]=this.shader.uniformBindCount,i.uniformBlockBinding(e.program,o,this.shader.uniformBindCount),this.shader.uniformBindCount++;var a=this.getSignature(t,this.shader.program.uniformData,"ubo"),s=this._uboCache[a];if(s||(s=this._uboCache[a]=a0(t,this.shader.program.uniformData)),t.autoManage){var u=new Float32Array(s.size/4);t.buffer.update(u)}return e.uniformGroups[t.id]=s.syncFunc,e.uniformGroups[t.id]},r.prototype.getSignature=function(t,e,n){var i=t.uniforms,o=[n+"-"];for(var a in i)o.push(a),e[a]&&o.push(e[a].type);return o.join("-")},r.prototype.getGlProgram=function(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null},r.prototype.generateProgram=function(t){var e=this.gl,n=t.program,i=l0(e,n);return n.glPrograms[this.renderer.CONTEXT_UID]=i,i},r.prototype.reset=function(){this.program=null,this.shader=null},r.prototype.disposeShader=function(t){this.shader===t&&(this.shader=null)},r.prototype.destroy=function(){this.renderer=null,this.destroyed=!0},r}();function d0(r,t){return t===void 0&&(t=[]),t[j.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[j.ADD]=[r.ONE,r.ONE],t[j.MULTIPLY]=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[j.SCREEN]=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[j.OVERLAY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[j.DARKEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[j.LIGHTEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[j.COLOR_DODGE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[j.COLOR_BURN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[j.HARD_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[j.SOFT_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[j.DIFFERENCE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[j.EXCLUSION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[j.HUE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[j.SATURATION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[j.COLOR]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[j.LUMINOSITY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[j.NONE]=[0,0],t[j.NORMAL_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[j.ADD_NPM]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t[j.SCREEN_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[j.SRC_IN]=[r.DST_ALPHA,r.ZERO],t[j.SRC_OUT]=[r.ONE_MINUS_DST_ALPHA,r.ZERO],t[j.SRC_ATOP]=[r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[j.DST_OVER]=[r.ONE_MINUS_DST_ALPHA,r.ONE],t[j.DST_IN]=[r.ZERO,r.SRC_ALPHA],t[j.DST_OUT]=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],t[j.DST_ATOP]=[r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA],t[j.XOR]=[r.ONE_MINUS_DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[j.SUBTRACT]=[r.ONE,r.ONE,r.ONE,r.ONE,r.FUNC_REVERSE_SUBTRACT,r.FUNC_ADD],t}var p0=0,v0=1,_0=2,m0=3,g0=4,y0=5,b0=function(){function r(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=j.NONE,this._blendEq=!1,this.map=[],this.map[p0]=this.setBlend,this.map[v0]=this.setOffset,this.map[_0]=this.setCullFace,this.map[m0]=this.setDepthTest,this.map[g0]=this.setFrontFace,this.map[y0]=this.setDepthMask,this.checks=[],this.defaultState=new fr,this.defaultState.blend=!0}return r.prototype.contextChange=function(t){this.gl=t,this.blendModes=d0(t),this.set(this.defaultState),this.reset()},r.prototype.set=function(t){if(t=t||this.defaultState,this.stateId!==t.data){for(var e=this.stateId^t.data,n=0;e;)e&1&&this.map[n].call(this,!!(t.data&1<<n)),e=e>>1,n++;this.stateId=t.data}for(var n=0;n<this.checks.length;n++)this.checks[n](this,t)},r.prototype.forceState=function(t){t=t||this.defaultState;for(var e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(var e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data},r.prototype.setBlend=function(t){this.updateCheck(r.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)},r.prototype.setOffset=function(t){this.updateCheck(r.checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)},r.prototype.setDepthTest=function(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)},r.prototype.setDepthMask=function(t){this.gl.depthMask(t)},r.prototype.setCullFace=function(t){this.gl[t?"enable":"disable"](this.gl.CULL_FACE)},r.prototype.setFrontFace=function(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])},r.prototype.setBlendMode=function(t){if(t!==this.blendMode){this.blendMode=t;var e=this.blendModes[t],n=this.gl;e.length===2?n.blendFunc(e[0],e[1]):n.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,n.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,n.blendEquationSeparate(n.FUNC_ADD,n.FUNC_ADD))}},r.prototype.setPolygonOffset=function(t,e){this.gl.polygonOffset(t,e)},r.prototype.reset=function(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)},r.prototype.updateCheck=function(t,e){var n=this.checks.indexOf(t);e&&n===-1?this.checks.push(t):!e&&n!==-1&&this.checks.splice(n,1)},r.checkBlendMode=function(t,e){t.setBlendMode(e.blendMode)},r.checkPolygonOffset=function(t,e){t.setPolygonOffset(1,e.polygonOffset)},r.prototype.destroy=function(){this.gl=null},r}(),x0=function(){function r(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=k.GC_MAX_IDLE,this.checkCountMax=k.GC_MAX_CHECK_COUNT,this.mode=k.GC_MODE}return r.prototype.postrender=function(){this.renderer.renderingToScreen&&(this.count++,this.mode!==Yn.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))},r.prototype.run=function(){for(var t=this.renderer.texture,e=t.managedTextures,n=!1,i=0;i<e.length;i++){var o=e[i];!o.framebuffer&&this.count-o.touched>this.maxIdle&&(t.destroyTexture(o,!0),e[i]=null,n=!0)}if(n){for(var a=0,i=0;i<e.length;i++)e[i]!==null&&(e[a++]=e[i]);e.length=a}},r.prototype.unload=function(t){var e=this.renderer.texture,n=t._texture;n&&!n.framebuffer&&e.destroyTexture(n);for(var i=t.children.length-1;i>=0;i--)this.unload(t.children[i])},r.prototype.destroy=function(){this.renderer=null},r}();function E0(r){var t,e,n,i,o,a,s,u,h,l,f,c,d,p,v,_,m,g,y,E,b,S,P;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?P=(t={},t[H.UNSIGNED_BYTE]=(e={},e[U.RGBA]=r.RGBA8,e[U.RGB]=r.RGB8,e[U.RG]=r.RG8,e[U.RED]=r.R8,e[U.RGBA_INTEGER]=r.RGBA8UI,e[U.RGB_INTEGER]=r.RGB8UI,e[U.RG_INTEGER]=r.RG8UI,e[U.RED_INTEGER]=r.R8UI,e[U.ALPHA]=r.ALPHA,e[U.LUMINANCE]=r.LUMINANCE,e[U.LUMINANCE_ALPHA]=r.LUMINANCE_ALPHA,e),t[H.BYTE]=(n={},n[U.RGBA]=r.RGBA8_SNORM,n[U.RGB]=r.RGB8_SNORM,n[U.RG]=r.RG8_SNORM,n[U.RED]=r.R8_SNORM,n[U.RGBA_INTEGER]=r.RGBA8I,n[U.RGB_INTEGER]=r.RGB8I,n[U.RG_INTEGER]=r.RG8I,n[U.RED_INTEGER]=r.R8I,n),t[H.UNSIGNED_SHORT]=(i={},i[U.RGBA_INTEGER]=r.RGBA16UI,i[U.RGB_INTEGER]=r.RGB16UI,i[U.RG_INTEGER]=r.RG16UI,i[U.RED_INTEGER]=r.R16UI,i[U.DEPTH_COMPONENT]=r.DEPTH_COMPONENT16,i),t[H.SHORT]=(o={},o[U.RGBA_INTEGER]=r.RGBA16I,o[U.RGB_INTEGER]=r.RGB16I,o[U.RG_INTEGER]=r.RG16I,o[U.RED_INTEGER]=r.R16I,o),t[H.UNSIGNED_INT]=(a={},a[U.RGBA_INTEGER]=r.RGBA32UI,a[U.RGB_INTEGER]=r.RGB32UI,a[U.RG_INTEGER]=r.RG32UI,a[U.RED_INTEGER]=r.R32UI,a[U.DEPTH_COMPONENT]=r.DEPTH_COMPONENT24,a),t[H.INT]=(s={},s[U.RGBA_INTEGER]=r.RGBA32I,s[U.RGB_INTEGER]=r.RGB32I,s[U.RG_INTEGER]=r.RG32I,s[U.RED_INTEGER]=r.R32I,s),t[H.FLOAT]=(u={},u[U.RGBA]=r.RGBA32F,u[U.RGB]=r.RGB32F,u[U.RG]=r.RG32F,u[U.RED]=r.R32F,u[U.DEPTH_COMPONENT]=r.DEPTH_COMPONENT32F,u),t[H.HALF_FLOAT]=(h={},h[U.RGBA]=r.RGBA16F,h[U.RGB]=r.RGB16F,h[U.RG]=r.RG16F,h[U.RED]=r.R16F,h),t[H.UNSIGNED_SHORT_5_6_5]=(l={},l[U.RGB]=r.RGB565,l),t[H.UNSIGNED_SHORT_4_4_4_4]=(f={},f[U.RGBA]=r.RGBA4,f),t[H.UNSIGNED_SHORT_5_5_5_1]=(c={},c[U.RGBA]=r.RGB5_A1,c),t[H.UNSIGNED_INT_2_10_10_10_REV]=(d={},d[U.RGBA]=r.RGB10_A2,d[U.RGBA_INTEGER]=r.RGB10_A2UI,d),t[H.UNSIGNED_INT_10F_11F_11F_REV]=(p={},p[U.RGB]=r.R11F_G11F_B10F,p),t[H.UNSIGNED_INT_5_9_9_9_REV]=(v={},v[U.RGB]=r.RGB9_E5,v),t[H.UNSIGNED_INT_24_8]=(_={},_[U.DEPTH_STENCIL]=r.DEPTH24_STENCIL8,_),t[H.FLOAT_32_UNSIGNED_INT_24_8_REV]=(m={},m[U.DEPTH_STENCIL]=r.DEPTH32F_STENCIL8,m),t):P=(g={},g[H.UNSIGNED_BYTE]=(y={},y[U.RGBA]=r.RGBA,y[U.RGB]=r.RGB,y[U.ALPHA]=r.ALPHA,y[U.LUMINANCE]=r.LUMINANCE,y[U.LUMINANCE_ALPHA]=r.LUMINANCE_ALPHA,y),g[H.UNSIGNED_SHORT_5_6_5]=(E={},E[U.RGB]=r.RGB,E),g[H.UNSIGNED_SHORT_4_4_4_4]=(b={},b[U.RGBA]=r.RGBA,b),g[H.UNSIGNED_SHORT_5_5_5_1]=(S={},S[U.RGBA]=r.RGBA,S),g),P}var ba=function(){function r(t){this.texture=t,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=H.UNSIGNED_BYTE,this.internalFormat=U.RGBA,this.samplerType=0}return r}(),T0=function(){function r(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new ut,this.hasIntegerTextures=!1}return r.prototype.contextChange=function(){var t=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=E0(t);var e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(var n=0;n<e;n++)this.boundTextures[n]=null;this.emptyTextures={};var i=new ba(t.createTexture());t.bindTexture(t.TEXTURE_2D,i.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[t.TEXTURE_2D]=i,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new ba(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture);for(var n=0;n<6;n++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,null);t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,t.LINEAR);for(var n=0;n<this.boundTextures.length;n++)this.bind(null,n)},r.prototype.bind=function(t,e){e===void 0&&(e=0);var n=this.gl;if(t=t==null?void 0:t.castToBaseTexture(),t&&t.valid&&!t.parentTextureArray){t.touched=this.renderer.textureGC.count;var i=t._glTextures[this.CONTEXT_UID]||this.initTexture(t);this.boundTextures[e]!==t&&(this.currentLocation!==e&&(this.currentLocation=e,n.activeTexture(n.TEXTURE0+e)),n.bindTexture(t.target,i.texture)),i.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,n.activeTexture(n.TEXTURE0+e)),this.updateTexture(t)):i.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,n.activeTexture(n.TEXTURE0+e)),n.bindTexture(n.TEXTURE_2D,this.emptyTextures[n.TEXTURE_2D].texture),this.boundTextures[e]=null},r.prototype.reset=function(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(var t=0;t<this.boundTextures.length;t++)this.boundTextures[t]=this.unknownTexture},r.prototype.unbind=function(t){var e=this,n=e.gl,i=e.boundTextures;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(var o=0;o<i.length;o++)i[o]===this.unknownTexture&&this.bind(null,o)}for(var o=0;o<i.length;o++)i[o]===t&&(this.currentLocation!==o&&(n.activeTexture(n.TEXTURE0+o),this.currentLocation=o),n.bindTexture(t.target,this.emptyTextures[t.target].texture),i[o]=null)},r.prototype.ensureSamplerType=function(t){var e=this,n=e.boundTextures,i=e.hasIntegerTextures,o=e.CONTEXT_UID;if(i)for(var a=t-1;a>=0;--a){var s=n[a];if(s){var u=s._glTextures[o];u.samplerType!==Vn.FLOAT&&this.renderer.texture.unbind(s)}}},r.prototype.initTexture=function(t){var e=new ba(this.gl.createTexture());return e.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=e,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),e},r.prototype.initTextureType=function(t,e){var n,i;e.internalFormat=(i=(n=this.internalFormats[t.type])===null||n===void 0?void 0:n[t.format])!==null&&i!==void 0?i:t.format,this.webGLVersion===2&&t.type===H.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type},r.prototype.updateTexture=function(t){var e=t._glTextures[this.CONTEXT_UID];if(e){var n=this.renderer;if(this.initTextureType(t,e),t.resource&&t.resource.upload(n,t,e))e.samplerType!==Vn.FLOAT&&(this.hasIntegerTextures=!0);else{var i=t.realWidth,o=t.realHeight,a=n.gl;(e.width!==i||e.height!==o||e.dirtyId<0)&&(e.width=i,e.height=o,a.texImage2D(t.target,0,e.internalFormat,i,o,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.dirtyId=t.dirtyId}},r.prototype.destroyTexture=function(t,e){var n=this.gl;if(t=t.castToBaseTexture(),t._glTextures[this.CONTEXT_UID]&&(this.unbind(t),n.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){var i=this.managedTextures.indexOf(t);i!==-1&&Gr(this.managedTextures,i,1)}},r.prototype.updateTextureStyle=function(t){var e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===ae.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=me.CLAMP:e.wrapMode=t.wrapMode,t.resource&&t.resource.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)},r.prototype.setStyle=function(t,e){var n=this.gl;if(e.mipmap&&t.mipmap!==ae.ON_MANUAL&&n.generateMipmap(t.target),n.texParameteri(t.target,n.TEXTURE_WRAP_S,e.wrapMode),n.texParameteri(t.target,n.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){n.texParameteri(t.target,n.TEXTURE_MIN_FILTER,t.scaleMode===_e.LINEAR?n.LINEAR_MIPMAP_LINEAR:n.NEAREST_MIPMAP_NEAREST);var i=this.renderer.context.extensions.anisotropicFiltering;if(i&&t.anisotropicLevel>0&&t.scaleMode===_e.LINEAR){var o=Math.min(t.anisotropicLevel,n.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT));n.texParameterf(t.target,i.TEXTURE_MAX_ANISOTROPY_EXT,o)}}else n.texParameteri(t.target,n.TEXTURE_MIN_FILTER,t.scaleMode===_e.LINEAR?n.LINEAR:n.NEAREST);n.texParameteri(t.target,n.TEXTURE_MAG_FILTER,t.scaleMode===_e.LINEAR?n.LINEAR:n.NEAREST)},r.prototype.destroy=function(){this.renderer=null},r}(),xa=new Mt,w0=function(r){bt(t,r);function t(e,n){e===void 0&&(e=an.UNKNOWN);var i=r.call(this)||this;return n=Object.assign({},k.RENDER_OPTIONS,n),i.options=n,i.type=e,i.screen=new st(0,0,n.width,n.height),i.view=n.view||k.ADAPTER.createCanvas(),i.resolution=n.resolution||k.RESOLUTION,i.useContextAlpha=n.useContextAlpha,i.autoDensity=!!n.autoDensity,i.preserveDrawingBuffer=n.preserveDrawingBuffer,i.clearBeforeRender=n.clearBeforeRender,i._backgroundColor=0,i._backgroundColorRgba=[0,0,0,1],i._backgroundColorString="#000000",i.backgroundColor=n.backgroundColor||i._backgroundColor,i.backgroundAlpha=n.backgroundAlpha,n.transparent!==void 0&&(le("6.0.0","Option transparent is deprecated, please use backgroundAlpha instead."),i.useContextAlpha=n.transparent,i.backgroundAlpha=n.transparent?0:1),i._lastObjectRendered=null,i.plugins={},i}return t.prototype.initPlugins=function(e){for(var n in e)this.plugins[n]=new e[n](this)},Object.defineProperty(t.prototype,"width",{get:function(){return this.view.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.view.height},enumerable:!1,configurable:!0}),t.prototype.resize=function(e,n){this.view.width=Math.round(e*this.resolution),this.view.height=Math.round(n*this.resolution);var i=this.view.width/this.resolution,o=this.view.height/this.resolution;this.screen.width=i,this.screen.height=o,this.autoDensity&&(this.view.style.width=i+"px",this.view.style.height=o+"px"),this.emit("resize",i,o)},t.prototype.generateTexture=function(e,n,i,o){n===void 0&&(n={}),typeof n=="number"&&(le("6.1.0","generateTexture options (scaleMode, resolution, region) are now object options."),n={scaleMode:n,resolution:i,region:o});var a=n.region,s=ay(n,["region"]);o=a||e.getLocalBounds(null,!0),o.width===0&&(o.width=1),o.height===0&&(o.height=1);var u=hr.create(ua({width:o.width,height:o.height},s));return xa.tx=-o.x,xa.ty=-o.y,this.render(e,{renderTexture:u,clear:!1,transform:xa,skipUpdateTransform:!!e.parent}),u},t.prototype.destroy=function(e){for(var n in this.plugins)this.plugins[n].destroy(),this.plugins[n]=null;e&&this.view.parentNode&&this.view.parentNode.removeChild(this.view);var i=this;i.plugins=null,i.type=an.UNKNOWN,i.view=null,i.screen=null,i._tempDisplayObjectParent=null,i.options=null,this._backgroundColorRgba=null,this._backgroundColorString=null,this._lastObjectRendered=null},Object.defineProperty(t.prototype,"backgroundColor",{get:function(){return this._backgroundColor},set:function(e){this._backgroundColor=e,this._backgroundColorString=ch(e),Ur(e,this._backgroundColorRgba)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"backgroundAlpha",{get:function(){return this._backgroundColorRgba[3]},set:function(e){this._backgroundColorRgba[3]=e},enumerable:!1,configurable:!0}),t}(sn),S0=function(){function r(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}return r}(),A0=function(){function r(t){this.renderer=t,this.managedBuffers={},this.boundBufferBases={}}return r.prototype.destroy=function(){this.renderer=null},r.prototype.contextChange=function(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID},r.prototype.bind=function(t){var e=this,n=e.gl,i=e.CONTEXT_UID,o=t._glBuffers[i]||this.createGLBuffer(t);n.bindBuffer(t.type,o.buffer)},r.prototype.bindBufferBase=function(t,e){var n=this,i=n.gl,o=n.CONTEXT_UID;if(this.boundBufferBases[e]!==t){var a=t._glBuffers[o]||this.createGLBuffer(t);this.boundBufferBases[e]=t,i.bindBufferBase(i.UNIFORM_BUFFER,e,a.buffer)}},r.prototype.bindBufferRange=function(t,e,n){var i=this,o=i.gl,a=i.CONTEXT_UID;n=n||0;var s=t._glBuffers[a]||this.createGLBuffer(t);o.bindBufferRange(o.UNIFORM_BUFFER,e||0,s.buffer,n*256,256)},r.prototype.update=function(t){var e=this,n=e.gl,i=e.CONTEXT_UID,o=t._glBuffers[i];if(t._updateID!==o.updateID)if(o.updateID=t._updateID,n.bindBuffer(t.type,o.buffer),o.byteLength>=t.data.byteLength)n.bufferSubData(t.type,0,t.data);else{var a=t.static?n.STATIC_DRAW:n.DYNAMIC_DRAW;o.byteLength=t.data.byteLength,n.bufferData(t.type,t.data,a)}},r.prototype.dispose=function(t,e){if(this.managedBuffers[t.id]){delete this.managedBuffers[t.id];var n=t._glBuffers[this.CONTEXT_UID],i=this.gl;t.disposeRunner.remove(this),n&&(e||i.deleteBuffer(n.buffer),delete t._glBuffers[this.CONTEXT_UID])}},r.prototype.disposeAll=function(t){for(var e=Object.keys(this.managedBuffers),n=0;n<e.length;n++)this.dispose(this.managedBuffers[e[n]],t)},r.prototype.createGLBuffer=function(t){var e=this,n=e.CONTEXT_UID,i=e.gl;return t._glBuffers[n]=new S0(i.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[n]},r}(),$h=function(r){bt(t,r);function t(e){var n=r.call(this,an.WEBGL,e)||this;return e=n.options,n.gl=null,n.CONTEXT_UID=0,n.runners={destroy:new Ut("destroy"),contextChange:new Ut("contextChange"),reset:new Ut("reset"),update:new Ut("update"),postrender:new Ut("postrender"),prerender:new Ut("prerender"),resize:new Ut("resize")},n.runners.contextChange.add(n),n.globalUniforms=new lr({projectionMatrix:new Mt},!0),n.addSystem(Zy,"mask").addSystem(Ay,"context").addSystem(b0,"state").addSystem(c0,"shader").addSystem(T0,"texture").addSystem(A0,"buffer").addSystem(Iy,"geometry").addSystem(Ry,"framebuffer").addSystem(Jy,"scissor").addSystem(Qy,"stencil").addSystem(t0,"projection").addSystem(x0,"textureGC").addSystem(wy,"filter").addSystem(e0,"renderTexture").addSystem(Sy,"batch"),n.initPlugins(t.__plugins),n.multisample=void 0,e.context?n.context.initFromContext(e.context):n.context.initFromOptions({alpha:!!n.useContextAlpha,antialias:e.antialias,premultipliedAlpha:n.useContextAlpha&&n.useContextAlpha!=="notMultiplied",stencil:!0,preserveDrawingBuffer:e.preserveDrawingBuffer,powerPreference:n.options.powerPreference}),n.renderingToScreen=!0,n_(n.context.webGLVersion===2?"WebGL 2":"WebGL 1"),n.resize(n.options.width,n.options.height),n}return t.create=function(e){if(i_())return new t(e);throw new Error('WebGL unsupported in this browser, use "pixi.js-legacy" for fallback canvas2d support.')},t.prototype.contextChange=function(){var e=this.gl,n;if(this.context.webGLVersion===1){var i=e.getParameter(e.FRAMEBUFFER_BINDING);e.bindFramebuffer(e.FRAMEBUFFER,null),n=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.FRAMEBUFFER,i)}else{var i=e.getParameter(e.DRAW_FRAMEBUFFER_BINDING);e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),n=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,i)}n>=wt.HIGH?this.multisample=wt.HIGH:n>=wt.MEDIUM?this.multisample=wt.MEDIUM:n>=wt.LOW?this.multisample=wt.LOW:this.multisample=wt.NONE},t.prototype.addSystem=function(e,n){var i=new e(this);if(this[n])throw new Error('Whoops! The name "'+n+'" is already in use');this[n]=i;for(var o in this.runners)this.runners[o].add(i);return this},t.prototype.render=function(e,n){var i,o,a,s;if(n&&(n instanceof hr?(le("6.0.0","Renderer#render arguments changed, use options instead."),i=n,o=arguments[2],a=arguments[3],s=arguments[4]):(i=n.renderTexture,o=n.clear,a=n.transform,s=n.skipUpdateTransform)),this.renderingToScreen=!i,this.runners.prerender.emit(),this.emit("prerender"),this.projection.transform=a,!this.context.isLost){if(i||(this._lastObjectRendered=e),!s){var u=e.enableTempParent();e.updateTransform(),e.disableTempParent(u)}this.renderTexture.bind(i),this.batch.currentRenderer.start(),(o!==void 0?o:this.clearBeforeRender)&&this.renderTexture.clear(),e.render(this),this.batch.currentRenderer.flush(),i&&i.baseTexture.update(),this.runners.postrender.emit(),this.projection.transform=null,this.emit("postrender")}},t.prototype.generateTexture=function(e,n,i,o){n===void 0&&(n={});var a=r.prototype.generateTexture.call(this,e,n,i,o);return this.framebuffer.blit(),a},t.prototype.resize=function(e,n){r.prototype.resize.call(this,e,n),this.runners.resize.emit(this.screen.height,this.screen.width)},t.prototype.reset=function(){return this.runners.reset.emit(),this},t.prototype.clear=function(){this.renderTexture.bind(),this.renderTexture.clear()},t.prototype.destroy=function(e){this.runners.destroy.emit();for(var n in this.runners)this.runners[n].destroy();r.prototype.destroy.call(this,e),this.gl=null},Object.defineProperty(t.prototype,"extract",{get:function(){return le("6.0.0","Renderer#extract has been deprecated, please use Renderer#plugins.extract instead."),this.plugins.extract},enumerable:!1,configurable:!0}),t.registerPlugin=function(e,n){le("6.5.0","Renderer.registerPlugin() has been deprecated, please use extensions.add() instead."),Re.add({name:e,type:mt.RendererPlugin,ref:n})},t.__plugins={},t}(w0);Re.handleByMap(mt.RendererPlugin,$h.__plugins);function Kh(r){return $h.create(r)}var P0=`attribute vec2 aVertexPosition;
488
+ `),{size:s,syncFunc:new Function("ud","uv","renderer","syncData","buffer",n.join(`
489
+ `))}}let p1=0;const An={textureCount:0,uboCount:0};class cd{constructor(t){this.destroyed=!1,this.renderer=t,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=p1++}systemCheck(){if(!kv())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(t){this.gl=t,this.reset()}bind(t,e){t.disposeRunner.add(this),t.uniforms.globals=this.renderer.globalUniforms;const i=t.program,s=i.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==i&&(this.program=i,this.gl.useProgram(s.program)),e||(An.textureCount=0,An.uboCount=0,this.syncUniformGroup(t.uniformGroup,An)),s}setUniforms(t){const e=this.shader.program,i=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(i.uniformData,t,this.renderer)}syncUniformGroup(t,e){const i=this.getGlProgram();(!t.static||t.dirtyId!==i.uniformDirtyGroups[t.id])&&(i.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,i,e))}syncUniforms(t,e,i){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,i)}createSyncGroups(t){const e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=Ov(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){const i=this.getGlProgram();if(!t.static||t.dirtyId!==0||!i.uniformGroups[t.id]){t.dirtyId=0;const s=i.uniformGroups[t.id]||this.createSyncBufferGroup(t,i,e);t.buffer.update(),s(i.uniformData,t.uniforms,this.renderer,An,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,i.uniformBufferBindings[e])}createSyncBufferGroup(t,e,i){const{gl:s}=this.renderer;this.renderer.buffer.bind(t.buffer);const n=this.gl.getUniformBlockIndex(e.program,i);e.uniformBufferBindings[i]=this.shader.uniformBindCount,s.uniformBlockBinding(e.program,n,this.shader.uniformBindCount),this.shader.uniformBindCount++;const o=this.getSignature(t,this.shader.program.uniformData,"ubo");let a=this._uboCache[o];if(a||(a=this._uboCache[o]=f1(t,this.shader.program.uniformData)),t.autoManage){const l=new Float32Array(a.size/4);t.buffer.update(l)}return e.uniformGroups[t.id]=a.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,i){const s=t.uniforms,n=[`${i}-`];for(const o in s)n.push(o),e[o]&&n.push(e[o].type);return n.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){const e=this.gl,i=t.program,s=l1(e,i);return i.glPrograms[this.renderer.CONTEXT_UID]=s,s}reset(){this.program=null,this.shader=null}disposeShader(t){this.shader===t&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}}cd.extension={type:V.RendererSystem,name:"shader"},j.add(cd);class Sn{constructor(t){this.renderer=t}run(t){const{renderer:e}=this;e.runners.init.emit(e.options),t.hello&&console.log(`PixiJS 7.4.2 - ${e.rendererLogId} - https://pixijs.com`),e.resize(e.screen.width,e.screen.height)}destroy(){}}Sn.defaultOptions={hello:!1},Sn.extension={type:[V.RendererSystem,V.CanvasRendererSystem],name:"startup"},j.add(Sn);function m1(r,t=[]){return t[Q.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Q.ADD]=[r.ONE,r.ONE],t[Q.MULTIPLY]=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Q.SCREEN]=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Q.OVERLAY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Q.DARKEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Q.LIGHTEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Q.COLOR_DODGE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Q.COLOR_BURN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Q.HARD_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Q.SOFT_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Q.DIFFERENCE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Q.EXCLUSION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Q.HUE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Q.SATURATION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Q.COLOR]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Q.LUMINOSITY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Q.NONE]=[0,0],t[Q.NORMAL_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Q.ADD_NPM]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t[Q.SCREEN_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[Q.SRC_IN]=[r.DST_ALPHA,r.ZERO],t[Q.SRC_OUT]=[r.ONE_MINUS_DST_ALPHA,r.ZERO],t[Q.SRC_ATOP]=[r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[Q.DST_OVER]=[r.ONE_MINUS_DST_ALPHA,r.ONE],t[Q.DST_IN]=[r.ZERO,r.SRC_ALPHA],t[Q.DST_OUT]=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],t[Q.DST_ATOP]=[r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA],t[Q.XOR]=[r.ONE_MINUS_DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[Q.SUBTRACT]=[r.ONE,r.ONE,r.ONE,r.ONE,r.FUNC_REVERSE_SUBTRACT,r.FUNC_ADD],t}const g1=0,y1=1,_1=2,v1=3,x1=4,b1=5,ud=class Bl{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=Q.NONE,this._blendEq=!1,this.map=[],this.map[g1]=this.setBlend,this.map[y1]=this.setOffset,this.map[_1]=this.setCullFace,this.map[v1]=this.setDepthTest,this.map[x1]=this.setFrontFace,this.map[b1]=this.setDepthMask,this.checks=[],this.defaultState=new He,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=m1(t),this.set(this.defaultState),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,i=0;for(;e;)e&1&&this.map[i].call(this,!!(t.data&1<<i)),e=e>>1,i++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t=t||this.defaultState;for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this.updateCheck(Bl.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(Bl.checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this.gl[t?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])}setBlendMode(t){if(t===this.blendMode)return;this.blendMode=t;const e=this.blendModes[t],i=this.gl;e.length===2?i.blendFunc(e[0],e[1]):i.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,i.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)}updateCheck(t,e){const i=this.checks.indexOf(t);e&&i===-1?this.checks.push(t):!e&&i!==-1&&this.checks.splice(i,1)}static checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null}};ud.extension={type:V.RendererSystem,name:"state"};let w1=ud;j.add(w1);class E1 extends Ji{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);const e=(t.priority??[]).filter(s=>t.systems[s]),i=[...e,...Object.keys(t.systems).filter(s=>!e.includes(s))];for(const s of i)this.addSystem(t.systems[s],s)}addRunners(...t){t.forEach(e=>{this.runners[e]=new we(e)})}addSystem(t,e){const i=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=i,this._systemsHash[e]=i;for(const s in this.runners)this.runners[s].add(i);return this}emitWithCustomOptions(t,e){const i=Object.keys(this._systemsHash);t.items.forEach(s=>{const n=i.find(o=>this._systemsHash[o]===s);s[t.name](e[n])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}}const ps=class ro{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=ro.defaultMaxIdle,this.checkCountMax=ro.defaultCheckCountMax,this.mode=ro.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==No.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){const t=this.renderer.texture,e=t.managedTextures;let i=!1;for(let s=0;s<e.length;s++){const n=e[s];n.resource&&this.count-n.touched>this.maxIdle&&(t.destroyTexture(n,!0),e[s]=null,i=!0)}if(i){let s=0;for(let n=0;n<e.length;n++)e[n]!==null&&(e[s++]=e[n]);e.length=s}}unload(t){const e=this.renderer.texture,i=t._texture;i&&!i.framebuffer&&e.destroyTexture(i);for(let s=t.children.length-1;s>=0;s--)this.unload(t.children[s])}destroy(){this.renderer=null}};ps.defaultMode=No.AUTO,ps.defaultMaxIdle=60*60,ps.defaultCheckCountMax=60*10,ps.extension={type:V.RendererSystem,name:"textureGC"};let jr=ps;j.add(jr);class qa{constructor(t){this.texture=t,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=Z.UNSIGNED_BYTE,this.internalFormat=G.RGBA,this.samplerType=0}}function T1(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[r.RGB]:z.FLOAT,[r.RGBA]:z.FLOAT,[r.ALPHA]:z.FLOAT,[r.LUMINANCE]:z.FLOAT,[r.LUMINANCE_ALPHA]:z.FLOAT,[r.R8]:z.FLOAT,[r.R8_SNORM]:z.FLOAT,[r.RG8]:z.FLOAT,[r.RG8_SNORM]:z.FLOAT,[r.RGB8]:z.FLOAT,[r.RGB8_SNORM]:z.FLOAT,[r.RGB565]:z.FLOAT,[r.RGBA4]:z.FLOAT,[r.RGB5_A1]:z.FLOAT,[r.RGBA8]:z.FLOAT,[r.RGBA8_SNORM]:z.FLOAT,[r.RGB10_A2]:z.FLOAT,[r.RGB10_A2UI]:z.FLOAT,[r.SRGB8]:z.FLOAT,[r.SRGB8_ALPHA8]:z.FLOAT,[r.R16F]:z.FLOAT,[r.RG16F]:z.FLOAT,[r.RGB16F]:z.FLOAT,[r.RGBA16F]:z.FLOAT,[r.R32F]:z.FLOAT,[r.RG32F]:z.FLOAT,[r.RGB32F]:z.FLOAT,[r.RGBA32F]:z.FLOAT,[r.R11F_G11F_B10F]:z.FLOAT,[r.RGB9_E5]:z.FLOAT,[r.R8I]:z.INT,[r.R8UI]:z.UINT,[r.R16I]:z.INT,[r.R16UI]:z.UINT,[r.R32I]:z.INT,[r.R32UI]:z.UINT,[r.RG8I]:z.INT,[r.RG8UI]:z.UINT,[r.RG16I]:z.INT,[r.RG16UI]:z.UINT,[r.RG32I]:z.INT,[r.RG32UI]:z.UINT,[r.RGB8I]:z.INT,[r.RGB8UI]:z.UINT,[r.RGB16I]:z.INT,[r.RGB16UI]:z.UINT,[r.RGB32I]:z.INT,[r.RGB32UI]:z.UINT,[r.RGBA8I]:z.INT,[r.RGBA8UI]:z.UINT,[r.RGBA16I]:z.INT,[r.RGBA16UI]:z.UINT,[r.RGBA32I]:z.INT,[r.RGBA32UI]:z.UINT,[r.DEPTH_COMPONENT16]:z.FLOAT,[r.DEPTH_COMPONENT24]:z.FLOAT,[r.DEPTH_COMPONENT32F]:z.FLOAT,[r.DEPTH_STENCIL]:z.FLOAT,[r.DEPTH24_STENCIL8]:z.FLOAT,[r.DEPTH32F_STENCIL8]:z.FLOAT}:t={[r.RGB]:z.FLOAT,[r.RGBA]:z.FLOAT,[r.ALPHA]:z.FLOAT,[r.LUMINANCE]:z.FLOAT,[r.LUMINANCE_ALPHA]:z.FLOAT,[r.DEPTH_STENCIL]:z.FLOAT},t}function A1(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[Z.UNSIGNED_BYTE]:{[G.RGBA]:r.RGBA8,[G.RGB]:r.RGB8,[G.RG]:r.RG8,[G.RED]:r.R8,[G.RGBA_INTEGER]:r.RGBA8UI,[G.RGB_INTEGER]:r.RGB8UI,[G.RG_INTEGER]:r.RG8UI,[G.RED_INTEGER]:r.R8UI,[G.ALPHA]:r.ALPHA,[G.LUMINANCE]:r.LUMINANCE,[G.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[Z.BYTE]:{[G.RGBA]:r.RGBA8_SNORM,[G.RGB]:r.RGB8_SNORM,[G.RG]:r.RG8_SNORM,[G.RED]:r.R8_SNORM,[G.RGBA_INTEGER]:r.RGBA8I,[G.RGB_INTEGER]:r.RGB8I,[G.RG_INTEGER]:r.RG8I,[G.RED_INTEGER]:r.R8I},[Z.UNSIGNED_SHORT]:{[G.RGBA_INTEGER]:r.RGBA16UI,[G.RGB_INTEGER]:r.RGB16UI,[G.RG_INTEGER]:r.RG16UI,[G.RED_INTEGER]:r.R16UI,[G.DEPTH_COMPONENT]:r.DEPTH_COMPONENT16},[Z.SHORT]:{[G.RGBA_INTEGER]:r.RGBA16I,[G.RGB_INTEGER]:r.RGB16I,[G.RG_INTEGER]:r.RG16I,[G.RED_INTEGER]:r.R16I},[Z.UNSIGNED_INT]:{[G.RGBA_INTEGER]:r.RGBA32UI,[G.RGB_INTEGER]:r.RGB32UI,[G.RG_INTEGER]:r.RG32UI,[G.RED_INTEGER]:r.R32UI,[G.DEPTH_COMPONENT]:r.DEPTH_COMPONENT24},[Z.INT]:{[G.RGBA_INTEGER]:r.RGBA32I,[G.RGB_INTEGER]:r.RGB32I,[G.RG_INTEGER]:r.RG32I,[G.RED_INTEGER]:r.R32I},[Z.FLOAT]:{[G.RGBA]:r.RGBA32F,[G.RGB]:r.RGB32F,[G.RG]:r.RG32F,[G.RED]:r.R32F,[G.DEPTH_COMPONENT]:r.DEPTH_COMPONENT32F},[Z.HALF_FLOAT]:{[G.RGBA]:r.RGBA16F,[G.RGB]:r.RGB16F,[G.RG]:r.RG16F,[G.RED]:r.R16F},[Z.UNSIGNED_SHORT_5_6_5]:{[G.RGB]:r.RGB565},[Z.UNSIGNED_SHORT_4_4_4_4]:{[G.RGBA]:r.RGBA4},[Z.UNSIGNED_SHORT_5_5_5_1]:{[G.RGBA]:r.RGB5_A1},[Z.UNSIGNED_INT_2_10_10_10_REV]:{[G.RGBA]:r.RGB10_A2,[G.RGBA_INTEGER]:r.RGB10_A2UI},[Z.UNSIGNED_INT_10F_11F_11F_REV]:{[G.RGB]:r.R11F_G11F_B10F},[Z.UNSIGNED_INT_5_9_9_9_REV]:{[G.RGB]:r.RGB9_E5},[Z.UNSIGNED_INT_24_8]:{[G.DEPTH_STENCIL]:r.DEPTH24_STENCIL8},[Z.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[G.DEPTH_STENCIL]:r.DEPTH32F_STENCIL8}}:t={[Z.UNSIGNED_BYTE]:{[G.RGBA]:r.RGBA,[G.RGB]:r.RGB,[G.ALPHA]:r.ALPHA,[G.LUMINANCE]:r.LUMINANCE,[G.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[Z.UNSIGNED_SHORT_5_6_5]:{[G.RGB]:r.RGB},[Z.UNSIGNED_SHORT_4_4_4_4]:{[G.RGBA]:r.RGBA},[Z.UNSIGNED_SHORT_5_5_5_1]:{[G.RGBA]:r.RGBA}},t}class dd{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new it,this.hasIntegerTextures=!1}contextChange(){const t=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=A1(t),this.samplerTypes=T1(t);const e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let s=0;s<e;s++)this.boundTextures[s]=null;this.emptyTextures={};const i=new qa(t.createTexture());t.bindTexture(t.TEXTURE_2D,i.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[t.TEXTURE_2D]=i,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new qa(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture);for(let s=0;s<6;s++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,null);t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,t.LINEAR);for(let s=0;s<this.boundTextures.length;s++)this.bind(null,s)}bind(t,e=0){const{gl:i}=this;if(t=t==null?void 0:t.castToBaseTexture(),(t==null?void 0:t.valid)&&!t.parentTextureArray){t.touched=this.renderer.textureGC.count;const s=t._glTextures[this.CONTEXT_UID]||this.initTexture(t);this.boundTextures[e]!==t&&(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(t.target,s.texture)),s.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),this.updateTexture(t)):s.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(i.TEXTURE_2D,this.emptyTextures[i.TEXTURE_2D].texture),this.boundTextures[e]=null}reset(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(let t=0;t<this.boundTextures.length;t++)this.boundTextures[t]=this.unknownTexture}unbind(t){const{gl:e,boundTextures:i}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let s=0;s<i.length;s++)i[s]===this.unknownTexture&&this.bind(null,s)}for(let s=0;s<i.length;s++)i[s]===t&&(this.currentLocation!==s&&(e.activeTexture(e.TEXTURE0+s),this.currentLocation=s),e.bindTexture(t.target,this.emptyTextures[t.target].texture),i[s]=null)}ensureSamplerType(t){const{boundTextures:e,hasIntegerTextures:i,CONTEXT_UID:s}=this;if(i)for(let n=t-1;n>=0;--n){const o=e[n];o&&o._glTextures[s].samplerType!==z.FLOAT&&this.renderer.texture.unbind(o)}}initTexture(t){const e=new qa(this.gl.createTexture());return e.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=e,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),e}initTextureType(t,e){var i;e.internalFormat=((i=this.internalFormats[t.type])==null?void 0:i[t.format])??t.format,e.samplerType=this.samplerTypes[e.internalFormat]??z.FLOAT,this.webGLVersion===2&&t.type===Z.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){var s;const e=t._glTextures[this.CONTEXT_UID];if(!e)return;const i=this.renderer;if(this.initTextureType(t,e),(s=t.resource)==null?void 0:s.upload(i,t,e))e.samplerType!==z.FLOAT&&(this.hasIntegerTextures=!0);else{const n=t.realWidth,o=t.realHeight,a=i.gl;(e.width!==n||e.height!==o||e.dirtyId<0)&&(e.width=n,e.height=o,a.texImage2D(t.target,0,e.internalFormat,n,o,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.dirtyId=t.dirtyId}destroyTexture(t,e){const{gl:i}=this;if(t=t.castToBaseTexture(),t._glTextures[this.CONTEXT_UID]&&(this.unbind(t),i.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){const s=this.managedTextures.indexOf(t);s!==-1&&Ai(this.managedTextures,s,1)}}updateTextureStyle(t){var i;const e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===Oe.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=pr.CLAMP:e.wrapMode=t.wrapMode,(i=t.resource)!=null&&i.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){const i=this.gl;if(e.mipmap&&t.mipmap!==Oe.ON_MANUAL&&i.generateMipmap(t.target),i.texParameteri(t.target,i.TEXTURE_WRAP_S,e.wrapMode),i.texParameteri(t.target,i.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===er.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);const s=this.renderer.context.extensions.anisotropicFiltering;if(s&&t.anisotropicLevel>0&&t.scaleMode===er.LINEAR){const n=Math.min(t.anisotropicLevel,i.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(t.target,s.TEXTURE_MAX_ANISOTROPY_EXT,n)}}else i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===er.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(t.target,i.TEXTURE_MAG_FILTER,t.scaleMode===er.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}}dd.extension={type:V.RendererSystem,name:"texture"},j.add(dd);class fd{constructor(t){this.renderer=t}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:e,CONTEXT_UID:i}=this,s=t._glTransformFeedbacks[i]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,s)}unbind(){const{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){const{gl:i,renderer:s}=this;e&&s.shader.bind(e),i.beginTransformFeedback(t)}endTransformFeedback(){const{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){const{gl:e,renderer:i,CONTEXT_UID:s}=this,n=e.createTransformFeedback();t._glTransformFeedbacks[s]=n,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,n);for(let o=0;o<t.buffers.length;o++){const a=t.buffers[o];a&&(i.buffer.update(a),a._glBuffers[s].refCount++,e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,o,a._glBuffers[s].buffer||null))}return e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null),t.disposeRunner.add(this),n}disposeTransformFeedback(t,e){const i=t._glTransformFeedbacks[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this);const n=this.renderer.buffer;if(n)for(let o=0;o<t.buffers.length;o++){const a=t.buffers[o];if(!a)continue;const l=a._glBuffers[this.CONTEXT_UID];l&&(l.refCount--,l.refCount===0&&!e&&n.dispose(a,e))}i&&(e||s.deleteTransformFeedback(i),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}}fd.extension={type:V.RendererSystem,name:"transformFeedback"},j.add(fd);class Cn{constructor(t){this.renderer=t}init(t){this.screen=new nt(0,0,t.width,t.height),this.element=t.view||W.ADAPTER.createCanvas(),this.resolution=t.resolution||W.RESOLUTION,this.autoDensity=!!t.autoDensity}resizeView(t,e){this.element.width=Math.round(t*this.resolution),this.element.height=Math.round(e*this.resolution);const i=this.element.width/this.resolution,s=this.element.height/this.resolution;this.screen.width=i,this.screen.height=s,this.autoDensity&&(this.element.style.width=`${i}px`,this.element.style.height=`${s}px`),this.renderer.emit("resize",i,s),this.renderer.runners.resize.emit(this.screen.width,this.screen.height)}destroy(t){var e;t&&((e=this.element.parentNode)==null||e.removeChild(this.element)),this.renderer=null,this.element=null,this.screen=null}}Cn.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},Cn.extension={type:[V.RendererSystem,V.CanvasRendererSystem],name:"_view"},j.add(Cn),W.PREFER_ENV=Dr.WEBGL2,W.STRICT_TEXTURE_CACHE=!1,W.RENDER_OPTIONS={...wn.defaultOptions,...bn.defaultOptions,...Cn.defaultOptions,...Sn.defaultOptions},Object.defineProperties(W,{WRAP_MODE:{get(){return it.defaultOptions.wrapMode},set(r){lt("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),it.defaultOptions.wrapMode=r}},SCALE_MODE:{get(){return it.defaultOptions.scaleMode},set(r){lt("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),it.defaultOptions.scaleMode=r}},MIPMAP_TEXTURES:{get(){return it.defaultOptions.mipmap},set(r){lt("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),it.defaultOptions.mipmap=r}},ANISOTROPIC_LEVEL:{get(){return it.defaultOptions.anisotropicLevel},set(r){lt("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),it.defaultOptions.anisotropicLevel=r}},FILTER_RESOLUTION:{get(){return lt("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),re.defaultResolution},set(r){re.defaultResolution=r}},FILTER_MULTISAMPLE:{get(){return lt("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),re.defaultMultisample},set(r){re.defaultMultisample=r}},SPRITE_MAX_TEXTURES:{get(){return Vr.defaultMaxTextures},set(r){lt("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),Vr.defaultMaxTextures=r}},SPRITE_BATCH_SIZE:{get(){return Vr.defaultBatchSize},set(r){lt("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),Vr.defaultBatchSize=r}},CAN_UPLOAD_SAME_BUFFER:{get(){return Vr.canUploadSameBuffer},set(r){lt("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),Vr.canUploadSameBuffer=r}},GC_MODE:{get(){return jr.defaultMode},set(r){lt("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),jr.defaultMode=r}},GC_MAX_IDLE:{get(){return jr.defaultMaxIdle},set(r){lt("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),jr.defaultMaxIdle=r}},GC_MAX_CHECK_COUNT:{get(){return jr.defaultCheckCountMax},set(r){lt("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),jr.defaultCheckCountMax=r}},PRECISION_VERTEX:{get(){return lr.defaultVertexPrecision},set(r){lt("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),lr.defaultVertexPrecision=r}},PRECISION_FRAGMENT:{get(){return lr.defaultFragmentPrecision},set(r){lt("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),lr.defaultFragmentPrecision=r}}});var Yr=(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))(Yr||{});class Ka{constructor(t,e=null,i=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=i,this.once=s}match(t,e=null){return this.fn===t&&this.context===e}emit(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));const e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const e=this.next;return this.next=t?null:e,this.previous=null,e}}const pd=class he{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 Ka(null,null,1/0),this.deltaMS=1/he.targetFPMS,this.elapsedMS=1/he.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,i=Yr.NORMAL){return this._addListener(new Ka(t,e,i))}addOnce(t,e,i=Yr.NORMAL){return this._addListener(new Ka(t,e,i,!0))}_addListener(t){let e=this._head.next,i=this._head;if(!e)t.connect(i);else{for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}return this._startIfPossible(),this}remove(t,e){let i=this._head.next;for(;i;)i.match(t,e)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){const n=t-this._lastFrame|0;if(n<this._minElapsedMS)return;this._lastFrame=t-n%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*he.targetFPMS;const i=this._head;let s=i.next;for(;s;)s=s.emit(this.deltaTime);i.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){const e=Math.min(this.maxFPS,t),i=Math.min(Math.max(0,e)/1e3,he.targetFPMS);this._maxElapsedMS=1/i}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{const e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!he._shared){const t=he._shared=new he;t.autoStart=!0,t._protected=!0}return he._shared}static get system(){if(!he._system){const t=he._system=new he;t.autoStart=!0,t._protected=!0}return he._system}};pd.targetFPMS=.06;let le=pd;Object.defineProperties(W,{TARGET_FPMS:{get(){return le.targetFPMS},set(r){lt("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),le.targetFPMS=r}}});class md{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,Yr.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?le.shared:new le,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}md.extension=V.Application,j.add(md);const gd=[];j.handleByList(V.Renderer,gd);function yd(r){for(const t of gd)if(t.test(r))return new t(r);throw new Error("Unable to auto-detect a suitable renderer.")}var S1=`attribute vec2 aVertexPosition;
522
490
  attribute vec2 aTextureCoord;
523
491
 
524
492
  uniform mat3 projectionMatrix;
@@ -529,7 +497,7 @@ void main(void)
529
497
  {
530
498
  gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
531
499
  vTextureCoord = aTextureCoord;
532
- }`,O0=`attribute vec2 aVertexPosition;
500
+ }`,C1=`attribute vec2 aVertexPosition;
533
501
 
534
502
  uniform mat3 projectionMatrix;
535
503
 
@@ -555,773 +523,158 @@ void main(void)
555
523
  gl_Position = filterVertexPosition();
556
524
  vTextureCoord = filterTextureCoord();
557
525
  }
558
- `,R0=P0,Zh=O0,Ea=function(){function r(){this.texArray=null,this.blend=0,this.type=oe.TRIANGLES,this.start=0,this.size=0,this.data=null}return r}(),Ta=function(){function r(){this.elements=[],this.ids=[],this.count=0}return r.prototype.clear=function(){for(var t=0;t<this.count;t++)this.elements[t]=null;this.count=0},r}(),wa=function(){function r(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)}return Object.defineProperty(r.prototype,"int8View",{get:function(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"uint8View",{get:function(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"int16View",{get:function(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"uint16View",{get:function(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"int32View",{get:function(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View},enumerable:!1,configurable:!0}),r.prototype.view=function(t){return this[t+"View"]},r.prototype.destroy=function(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null},r.sizeOf=function(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")}},r}(),I0=function(r){bt(t,r);function t(e){var n=r.call(this,e)||this;return n.shaderGenerator=null,n.geometryClass=null,n.vertexSize=null,n.state=fr.for2d(),n.size=k.SPRITE_BATCH_SIZE*4,n._vertexCount=0,n._indexCount=0,n._bufferedElements=[],n._bufferedTextures=[],n._bufferSize=0,n._shader=null,n._packedGeometries=[],n._packedGeometryPoolSize=2,n._flushId=0,n._aBuffers={},n._iBuffers={},n.MAX_TEXTURES=1,n.renderer.on("prerender",n.onPrerender,n),e.runners.contextChange.add(n),n._dcIndex=0,n._aIndex=0,n._iIndex=0,n._attributeBuffer=null,n._indexBuffer=null,n._tempBoundTextures=[],n}return t.prototype.contextChange=function(){var e=this.renderer.gl;k.PREFER_ENV===Se.WEBGL_LEGACY?this.MAX_TEXTURES=1:(this.MAX_TEXTURES=Math.min(e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),k.SPRITE_MAX_TEXTURES),this.MAX_TEXTURES=Xy(this.MAX_TEXTURES,e)),this._shader=this.shaderGenerator.generateShader(this.MAX_TEXTURES);for(var n=0;n<this._packedGeometryPoolSize;n++)this._packedGeometries[n]=new this.geometryClass;this.initFlushBuffers()},t.prototype.initFlushBuffers=function(){for(var e=t._drawCallPool,n=t._textureArrayPool,i=this.size/4,o=Math.floor(i/this.MAX_TEXTURES)+1;e.length<i;)e.push(new Ea);for(;n.length<o;)n.push(new Ta);for(var a=0;a<this.MAX_TEXTURES;a++)this._tempBoundTextures[a]=null},t.prototype.onPrerender=function(){this._flushId=0},t.prototype.render=function(e){e._texture.valid&&(this._vertexCount+e.vertexData.length/2>this.size&&this.flush(),this._vertexCount+=e.vertexData.length/2,this._indexCount+=e.indices.length,this._bufferedTextures[this._bufferSize]=e._texture.baseTexture,this._bufferedElements[this._bufferSize++]=e)},t.prototype.buildTexturesAndDrawCalls=function(){var e=this,n=e._bufferedTextures,i=e.MAX_TEXTURES,o=t._textureArrayPool,a=this.renderer.batch,s=this._tempBoundTextures,u=this.renderer.textureGC.count,h=++ut._globalBatch,l=0,f=o[0],c=0;a.copyBoundTextures(s,i);for(var d=0;d<this._bufferSize;++d){var p=n[d];n[d]=null,p._batchEnabled!==h&&(f.count>=i&&(a.boundArray(f,s,h,i),this.buildDrawCalls(f,c,d),c=d,f=o[++l],++h),p._batchEnabled=h,p.touched=u,f.elements[f.count++]=p)}f.count>0&&(a.boundArray(f,s,h,i),this.buildDrawCalls(f,c,this._bufferSize),++l,++h);for(var d=0;d<s.length;d++)s[d]=null;ut._globalBatch=h},t.prototype.buildDrawCalls=function(e,n,i){var o=this,a=o._bufferedElements,s=o._attributeBuffer,u=o._indexBuffer,h=o.vertexSize,l=t._drawCallPool,f=this._dcIndex,c=this._aIndex,d=this._iIndex,p=l[f];p.start=this._iIndex,p.texArray=e;for(var v=n;v<i;++v){var _=a[v],m=_._texture.baseTexture,g=dh[m.alphaMode?1:0][_.blendMode];a[v]=null,n<v&&p.blend!==g&&(p.size=d-p.start,n=v,p=l[++f],p.texArray=e,p.start=d),this.packInterleavedGeometry(_,s,u,c,d),c+=_.vertexData.length/2*h,d+=_.indices.length,p.blend=g}n<i&&(p.size=d-p.start,++f),this._dcIndex=f,this._aIndex=c,this._iIndex=d},t.prototype.bindAndClearTexArray=function(e){for(var n=this.renderer.texture,i=0;i<e.count;i++)n.bind(e.elements[i],e.ids[i]),e.elements[i]=null;e.count=0},t.prototype.updateGeometry=function(){var e=this,n=e._packedGeometries,i=e._attributeBuffer,o=e._indexBuffer;k.CAN_UPLOAD_SAME_BUFFER?(n[this._flushId]._buffer.update(i.rawBinaryData),n[this._flushId]._indexBuffer.update(o),this.renderer.geometry.updateBuffers()):(this._packedGeometryPoolSize<=this._flushId&&(this._packedGeometryPoolSize++,n[this._flushId]=new this.geometryClass),n[this._flushId]._buffer.update(i.rawBinaryData),n[this._flushId]._indexBuffer.update(o),this.renderer.geometry.bind(n[this._flushId]),this.renderer.geometry.updateBuffers(),this._flushId++)},t.prototype.drawBatches=function(){for(var e=this._dcIndex,n=this.renderer,i=n.gl,o=n.state,a=t._drawCallPool,s=null,u=0;u<e;u++){var h=a[u],l=h.texArray,f=h.type,c=h.size,d=h.start,p=h.blend;s!==l&&(s=l,this.bindAndClearTexArray(l)),this.state.blendMode=p,o.set(this.state),i.drawElements(f,c,i.UNSIGNED_SHORT,d*2)}},t.prototype.flush=function(){this._vertexCount!==0&&(this._attributeBuffer=this.getAttributeBuffer(this._vertexCount),this._indexBuffer=this.getIndexBuffer(this._indexCount),this._aIndex=0,this._iIndex=0,this._dcIndex=0,this.buildTexturesAndDrawCalls(),this.updateGeometry(),this.drawBatches(),this._bufferSize=0,this._vertexCount=0,this._indexCount=0)},t.prototype.start=function(){this.renderer.state.set(this.state),this.renderer.texture.ensureSamplerType(this.MAX_TEXTURES),this.renderer.shader.bind(this._shader),k.CAN_UPLOAD_SAME_BUFFER&&this.renderer.geometry.bind(this._packedGeometries[this._flushId])},t.prototype.stop=function(){this.flush()},t.prototype.destroy=function(){for(var e=0;e<this._packedGeometryPoolSize;e++)this._packedGeometries[e]&&this._packedGeometries[e].destroy();this.renderer.off("prerender",this.onPrerender,this),this._aBuffers=null,this._iBuffers=null,this._packedGeometries=null,this._attributeBuffer=null,this._indexBuffer=null,this._shader&&(this._shader.destroy(),this._shader=null),r.prototype.destroy.call(this)},t.prototype.getAttributeBuffer=function(e){var n=ui(Math.ceil(e/8)),i=gh(n),o=n*8;this._aBuffers.length<=i&&(this._iBuffers.length=i+1);var a=this._aBuffers[o];return a||(this._aBuffers[o]=a=new wa(o*this.vertexSize*4)),a},t.prototype.getIndexBuffer=function(e){var n=ui(Math.ceil(e/12)),i=gh(n),o=n*12;this._iBuffers.length<=i&&(this._iBuffers.length=i+1);var a=this._iBuffers[i];return a||(this._iBuffers[i]=a=new Uint16Array(o)),a},t.prototype.packInterleavedGeometry=function(e,n,i,o,a){for(var s=n.uint32View,u=n.float32View,h=o/this.vertexSize,l=e.uvs,f=e.indices,c=e.vertexData,d=e._texture.baseTexture._batchLocation,p=Math.min(e.worldAlpha,1),v=p<1&&e._texture.baseTexture.alphaMode?ea(e._tintRGB,p):e._tintRGB+(p*255<<24),_=0;_<c.length;_+=2)u[o++]=c[_],u[o++]=c[_+1],u[o++]=l[_],u[o++]=l[_+1],s[o++]=v,u[o++]=d;for(var _=0;_<f.length;_++)i[a++]=h+f[_]},t._drawCallPool=[],t._textureArrayPool=[],t}(gi),C0=function(){function r(t,e){if(this.vertexSrc=t,this.fragTemplate=e,this.programCache={},this.defaultGroupCache={},e.indexOf("%count%")<0)throw new Error('Fragment template must contain "%count%".');if(e.indexOf("%forloop%")<0)throw new Error('Fragment template must contain "%forloop%".')}return r.prototype.generateShader=function(t){if(!this.programCache[t]){for(var e=new Int32Array(t),n=0;n<t;n++)e[n]=n;this.defaultGroupCache[t]=lr.from({uSamplers:e},!0);var i=this.fragTemplate;i=i.replace(/%count%/gi,""+t),i=i.replace(/%forloop%/gi,this.generateSampleSrc(t)),this.programCache[t]=new wn(this.vertexSrc,i)}var o={tint:new Float32Array([1,1,1,1]),translationMatrix:new Mt,default:this.defaultGroupCache[t]};return new je(this.programCache[t],o)},r.prototype.generateSampleSrc=function(t){var e="";e+=`
559
- `,e+=`
560
- `;for(var n=0;n<t;n++)n>0&&(e+=`
561
- else `),n<t-1&&(e+="if(vTextureId < "+n+".5)"),e+=`
562
- {`,e+=`
563
- color = texture2D(uSamplers[`+n+"], vTextureCoord);",e+=`
564
- }`;return e+=`
565
- `,e+=`
566
- `,e},r}(),Jh=function(r){bt(t,r);function t(e){e===void 0&&(e=!1);var n=r.call(this)||this;return n._buffer=new Dt(null,e,!1),n._indexBuffer=new Dt(null,e,!0),n.addAttribute("aVertexPosition",n._buffer,2,!1,H.FLOAT).addAttribute("aTextureCoord",n._buffer,2,!1,H.FLOAT).addAttribute("aColor",n._buffer,4,!0,H.UNSIGNED_BYTE).addAttribute("aTextureId",n._buffer,1,!0,H.FLOAT).addIndex(n._indexBuffer),n}return t}(xn),Qh=`precision highp float;
567
- attribute vec2 aVertexPosition;
568
- attribute vec2 aTextureCoord;
569
- attribute vec4 aColor;
570
- attribute float aTextureId;
526
+ `;const I1=S1,_d=C1;class vd{constructor(t){this.renderer=t}contextChange(t){let e;if(this.renderer.context.webGLVersion===1){const i=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,i)}else{const i=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,i)}e>=Dt.HIGH?this.multisample=Dt.HIGH:e>=Dt.MEDIUM?this.multisample=Dt.MEDIUM:e>=Dt.LOW?this.multisample=Dt.LOW:this.multisample=Dt.NONE}destroy(){}}vd.extension={type:V.RendererSystem,name:"_multisample"},j.add(vd);class R1{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class xd{constructor(t){this.renderer=t,this.managedBuffers={},this.boundBufferBases={}}destroy(){this.renderer=null}contextChange(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:e,CONTEXT_UID:i}=this,s=t._glBuffers[i]||this.createGLBuffer(t);e.bindBuffer(t.type,s.buffer)}unbind(t){const{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){const{gl:i,CONTEXT_UID:s}=this;if(this.boundBufferBases[e]!==t){const n=t._glBuffers[s]||this.createGLBuffer(t);this.boundBufferBases[e]=t,i.bindBufferBase(i.UNIFORM_BUFFER,e,n.buffer)}}bindBufferRange(t,e,i){const{gl:s,CONTEXT_UID:n}=this;i=i||0;const o=t._glBuffers[n]||this.createGLBuffer(t);s.bindBufferRange(s.UNIFORM_BUFFER,e||0,o.buffer,i*256,256)}update(t){const{gl:e,CONTEXT_UID:i}=this,s=t._glBuffers[i]||this.createGLBuffer(t);if(t._updateID!==s.updateID)if(s.updateID=t._updateID,e.bindBuffer(t.type,s.buffer),s.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{const n=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;s.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,n)}}dispose(t,e){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];const i=t._glBuffers[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this),i&&(e||s.deleteBuffer(i.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){const e=Object.keys(this.managedBuffers);for(let i=0;i<e.length;i++)this.dispose(this.managedBuffers[e[i]],t)}createGLBuffer(t){const{CONTEXT_UID:e,gl:i}=this;return t._glBuffers[e]=new R1(i.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}}xd.extension={type:V.RendererSystem,name:"buffer"},j.add(xd);class bd{constructor(t){this.renderer=t}render(t,e){const i=this.renderer;let s,n,o,a;if(e&&(s=e.renderTexture,n=e.clear,o=e.transform,a=e.skipUpdateTransform),this.renderingToScreen=!s,i.runners.prerender.emit(),i.emit("prerender"),i.projection.transform=o,!i.context.isLost){if(s||(this.lastObjectRendered=t),!a){const l=t.enableTempParent();t.updateTransform(),t.disableTempParent(l)}i.renderTexture.bind(s),i.batch.currentRenderer.start(),(n??i.background.clearBeforeRender)&&i.renderTexture.clear(),t.render(i),i.batch.currentRenderer.flush(),s&&(e.blit&&i.framebuffer.blit(),s.baseTexture.update()),i.runners.postrender.emit(),i.projection.transform=null,i.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}}bd.extension={type:V.RendererSystem,name:"objectRenderer"},j.add(bd);const In=class Dl extends E1{constructor(t){super(),this.type=Kh.WEBGL,t=Object.assign({},W.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new Ee({projectionMatrix:new Et},!0);const e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:Dl.__systems,priority:["_view","textureGenerator","background","_plugin","startup","context","state","texture","buffer","geometry","framebuffer","transformFeedback","mask","scissor","stencil","projection","textureGC","filter","renderTexture","batch","objectRenderer","_multisample"]};this.setup(e),"useContextAlpha"in t&&(lt("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),t.premultipliedAlpha=t.useContextAlpha&&t.useContextAlpha!=="notMultiplied",t.backgroundAlpha=t.useContextAlpha===!1?1:t.backgroundAlpha),this._plugin.rendererPlugins=Dl.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t!=null&&t.forceCanvas?!1:Q_()}render(t,e){this.objectRenderer.render(t,e)}resize(t,e){this._view.resizeView(t,e)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(t=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:t}),super.destroy()}get plugins(){return this._plugin.plugins}get multisample(){return this._multisample.multisample}get width(){return this._view.element.width}get height(){return this._view.element.height}get resolution(){return this._view.resolution}set resolution(t){this._view.resolution=t,this.runners.resolutionChange.emit(t)}get autoDensity(){return this._view.autoDensity}get view(){return this._view.element}get screen(){return this._view.screen}get lastObjectRendered(){return this.objectRenderer.lastObjectRendered}get renderingToScreen(){return this.objectRenderer.renderingToScreen}get rendererLogId(){return`WebGL ${this.context.webGLVersion}`}get clearBeforeRender(){return lt("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return lt("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return lt("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return lt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){lt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return lt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){lt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return lt("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(t,e){return this.textureGenerator.generateTexture(t,e)}};In.extension={type:V.Renderer,priority:1},In.__plugins={},In.__systems={};let Za=In;j.handleByMap(V.RendererPlugin,Za.__plugins),j.handleByMap(V.RendererSystem,Za.__systems),j.add(Za);class wd extends cs{constructor(t,e){const{width:i,height:s}=e||{};super(i,s),this.items=[],this.itemDirtyIds=[];for(let n=0;n<t;n++){const o=new it;this.items.push(o),this.itemDirtyIds.push(-2)}this.length=t,this._load=null,this.baseTexture=null}initFromArray(t,e){for(let i=0;i<this.length;i++)t[i]&&(t[i].castToBaseTexture?this.addBaseTextureAt(t[i].castToBaseTexture(),i):t[i]instanceof cs?this.addResourceAt(t[i],i):this.addResourceAt(Iu(t[i],e),i))}dispose(){for(let t=0,e=this.length;t<e;t++)this.items[t].destroy();this.items=null,this.itemDirtyIds=null,this._load=null}addResourceAt(t,e){if(!this.items[e])throw new Error(`Index ${e} is out of bounds`);return t.valid&&!this.valid&&this.resize(t.width,t.height),this.items[e].setResource(t),this}bind(t){if(this.baseTexture!==null)throw new Error("Only one base texture per TextureArray is allowed");super.bind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=t,this.items[e].on("update",t.update,t)}unbind(t){super.unbind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=null,this.items[e].off("update",t.update,t)}load(){if(this._load)return this._load;const t=this.items.map(e=>e.resource).filter(e=>e).map(e=>e.load());return this._load=Promise.all(t).then(()=>{const{realWidth:e,realHeight:i}=this.items[0];return this.resize(e,i),this.update(),Promise.resolve(this)}),this._load}}class P1 extends wd{constructor(t,e){const{width:i,height:s}=e||{};let n,o;Array.isArray(t)?(n=t,o=t.length):o=t,super(o,{width:i,height:s}),n&&this.initFromArray(n,e)}addBaseTextureAt(t,e){if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(t){super.bind(t),t.target=ui.TEXTURE_2D_ARRAY}upload(t,e,i){const{length:s,itemDirtyIds:n,items:o}=this,{gl:a}=t;i.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,i.internalFormat,this._width,this._height,s,0,e.format,i.type,null);for(let l=0;l<s;l++){const h=o[l];n[l]<h.dirtyId&&(n[l]=h.dirtyId,h.valid&&a.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,l,h.resource.width,h.resource.height,1,e.format,i.type,h.resource.source))}return!0}}class M1 extends hr{constructor(t){super(t)}static test(t){const{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}}const Ed=class ws extends wd{constructor(t,e){const{width:i,height:s,autoLoad:n,linkBaseTexture:o}=e||{};if(t&&t.length!==ws.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:i,height:s});for(let a=0;a<ws.SIDES;a++)this.items[a].target=ui.TEXTURE_CUBE_MAP_POSITIVE_X+a;this.linkBaseTexture=o!==!1,t&&this.initFromArray(t,e),n!==!1&&this.load()}bind(t){super.bind(t),t.target=ui.TEXTURE_CUBE_MAP}addBaseTextureAt(t,e,i){if(i===void 0&&(i=this.linkBaseTexture),!this.items[e])throw new Error(`Index ${e} is out of bounds`);if(!this.linkBaseTexture||t.parentTextureArray||Object.keys(t._glTextures).length>0)if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("CubeResource does not support copying of renderTexture.");else t.target=ui.TEXTURE_CUBE_MAP_POSITIVE_X+e,t.parentTextureArray=this.baseTexture,this.items[e]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[e]=t,this}upload(t,e,i){const s=this.itemDirtyIds;for(let n=0;n<ws.SIDES;n++){const o=this.items[n];(s[n]<o.dirtyId||i.dirtyId<e.dirtyId)&&(o.valid&&o.resource?(o.resource.upload(t,o,i),s[n]=o.dirtyId):s[n]<-1&&(t.gl.texImage2D(o.target,0,i.internalFormat,e.realWidth,e.realHeight,0,e.format,i.type,null),s[n]=-1))}return!0}static test(t){return Array.isArray(t)&&t.length===ws.SIDES}};Ed.SIDES=6;let B1=Ed;class Ii extends hr{constructor(t,e){e=e||{};let i,s,n;typeof t=="string"?(i=Ii.EMPTY,s=t,n=!0):(i=t,s=null,n=!1),super(i),this.url=s,this.crossOrigin=e.crossOrigin??!0,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.ownsImageBitmap=e.ownsImageBitmap??n,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(async(t,e)=>{if(this.url===null){t(this);return}try{const i=await W.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;const s=await i.blob();if(this.destroyed)return;const n=await createImageBitmap(s,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===ie.UNPACK?"premultiply":"none"});if(this.destroyed){n.close();return}this.source=n,this.update(),t(this)}catch(i){if(this.destroyed)return;e(i),this.onError.emit(i)}}),this._load)}upload(t,e,i){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),super.upload(t,e,i)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(t){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&(typeof t=="string"||t instanceof ImageBitmap)}static get EMPTY(){return Ii._EMPTY=Ii._EMPTY??W.ADAPTER.createCanvas(0,0),Ii._EMPTY}}const Ja=class io extends hr{constructor(t,e){e=e||{},super(W.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=t,this.scale=e.scale||1,this._overrideWidth=e.width,this._overrideHeight=e.height,this._resolve=null,this._crossorigin=e.crossorigin,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(t=>{if(this._resolve=()=>{this.update(),t(this)},io.SVG_XML.test(this.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");this.svg=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`}this._loadSvg()}),this._load)}_loadSvg(){const t=new Image;hr.crossOrigin(t,this.svg,this._crossorigin),t.src=this.svg,t.onerror=e=>{this._resolve&&(t.onerror=null,this.onError.emit(e))},t.onload=()=>{if(!this._resolve)return;const e=t.width,i=t.height;if(!e||!i)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let s=e*this.scale,n=i*this.scale;(this._overrideWidth||this._overrideHeight)&&(s=this._overrideWidth||this._overrideHeight/i*e,n=this._overrideHeight||this._overrideWidth/e*i),s=Math.round(s),n=Math.round(n);const o=this.source;o.width=s,o.height=n,o._pixiId=`canvas_${Ur()}`,o.getContext("2d").drawImage(t,0,0,e,i,0,0,s,n),this._resolve(),this._resolve=null}}static getSize(t){const e=io.SVG_SIZE.exec(t),i={};return e&&(i[e[1]]=Math.round(parseFloat(e[3])),i[e[5]]=Math.round(parseFloat(e[7]))),i}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(t,e){return e==="svg"||typeof t=="string"&&t.startsWith("data:image/svg+xml")||typeof t=="string"&&io.SVG_XML.test(t)}};Ja.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,Ja.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let Qa=Ja;class D1 extends hr{constructor(t){super(t)}static test(t){return!!globalThis.VideoFrame&&t instanceof globalThis.VideoFrame}}const tl=class Ol extends hr{constructor(t,e){if(e=e||{},!(t instanceof HTMLVideoElement)){const i=document.createElement("video");e.autoLoad!==!1&&i.setAttribute("preload","auto"),e.playsinline!==!1&&(i.setAttribute("webkit-playsinline",""),i.setAttribute("playsinline","")),e.muted===!0&&(i.setAttribute("muted",""),i.muted=!0),e.loop===!0&&i.setAttribute("loop",""),e.autoPlay!==!1&&i.setAttribute("autoplay",""),typeof t=="string"&&(t=[t]);const s=t[0].src||t[0];hr.crossOrigin(i,s,e.crossorigin);for(let n=0;n<t.length;++n){const o=document.createElement("source");let{src:a,mime:l}=t[n];if(a=a||t[n],a.startsWith("data:"))l=a.slice(5,a.indexOf(";"));else if(!a.startsWith("blob:")){const h=a.split("?").shift().toLowerCase(),c=h.slice(h.lastIndexOf(".")+1);l=l||Ol.MIME_TYPES[c]||`video/${c}`}o.src=a,l&&(o.type=l),i.appendChild(o)}t=i}super(t),this.noSubImage=!0,this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=e.autoPlay!==!1,this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),e.autoLoad!==!1&&this.load()}update(t=0){if(!this.destroyed){if(this._updateFPS){const e=le.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!this._updateFPS||this._msToNextUpdate<=0)&&(super.update(),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}}_videoFrameRequestCallback(){this.update(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback)}load(){if(this._load)return this._load;const t=this.source;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._onCanPlay():(t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlay),t.addEventListener("error",this._onError,!0)),this._load=new Promise((e,i)=>{this.valid?e(this):(this._resolve=e,this._reject=i,t.load())}),this._load}_onError(t){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){const t=this.source;return!t.paused&&!t.ended}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0)}_onCanPlay(){const t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);const e=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!e&&this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()}dispose(){this._configureAutoUpdate();const t=this.source;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.dispose()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.source.requestVideoFrameCallback?(this._isConnectedToTicker&&(le.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(le.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(le.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||Ol.TYPES.includes(e)}};tl.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],tl.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let Td=tl;Fa.push(Ii,Xu,M1,Td,D1,Qa,hn,B1,P1);class Rn{constructor(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}clear(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0}getRectangle(t){return this.minX>this.maxX||this.minY>this.maxY?nt.EMPTY:(t=t||new nt(0,0,1,1),t.x=this.minX,t.y=this.minY,t.width=this.maxX-this.minX,t.height=this.maxY-this.minY,t)}addPoint(t){this.minX=Math.min(this.minX,t.x),this.maxX=Math.max(this.maxX,t.x),this.minY=Math.min(this.minY,t.y),this.maxY=Math.max(this.maxY,t.y)}addPointMatrix(t,e){const{a:i,b:s,c:n,d:o,tx:a,ty:l}=t,h=i*e.x+n*e.y+a,c=s*e.x+o*e.y+l;this.minX=Math.min(this.minX,h),this.maxX=Math.max(this.maxX,h),this.minY=Math.min(this.minY,c),this.maxY=Math.max(this.maxY,c)}addQuad(t){let e=this.minX,i=this.minY,s=this.maxX,n=this.maxY,o=t[0],a=t[1];e=o<e?o:e,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,o=t[2],a=t[3],e=o<e?o:e,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,o=t[4],a=t[5],e=o<e?o:e,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,o=t[6],a=t[7],e=o<e?o:e,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,this.minX=e,this.minY=i,this.maxX=s,this.maxY=n}addFrame(t,e,i,s,n){this.addFrameMatrix(t.worldTransform,e,i,s,n)}addFrameMatrix(t,e,i,s,n){const o=t.a,a=t.b,l=t.c,h=t.d,c=t.tx,u=t.ty;let d=this.minX,f=this.minY,p=this.maxX,m=this.maxY,_=o*e+l*i+c,y=a*e+h*i+u;d=_<d?_:d,f=y<f?y:f,p=_>p?_:p,m=y>m?y:m,_=o*s+l*i+c,y=a*s+h*i+u,d=_<d?_:d,f=y<f?y:f,p=_>p?_:p,m=y>m?y:m,_=o*e+l*n+c,y=a*e+h*n+u,d=_<d?_:d,f=y<f?y:f,p=_>p?_:p,m=y>m?y:m,_=o*s+l*n+c,y=a*s+h*n+u,d=_<d?_:d,f=y<f?y:f,p=_>p?_:p,m=y>m?y:m,this.minX=d,this.minY=f,this.maxX=p,this.maxY=m}addVertexData(t,e,i){let s=this.minX,n=this.minY,o=this.maxX,a=this.maxY;for(let l=e;l<i;l+=2){const h=t[l],c=t[l+1];s=h<s?h:s,n=c<n?c:n,o=h>o?h:o,a=c>a?c:a}this.minX=s,this.minY=n,this.maxX=o,this.maxY=a}addVertices(t,e,i,s){this.addVerticesMatrix(t.worldTransform,e,i,s)}addVerticesMatrix(t,e,i,s,n=0,o=n){const a=t.a,l=t.b,h=t.c,c=t.d,u=t.tx,d=t.ty;let f=this.minX,p=this.minY,m=this.maxX,_=this.maxY;for(let y=i;y<s;y+=2){const x=e[y],g=e[y+1],v=a*x+h*g+u,w=c*g+l*x+d;f=Math.min(f,v-n),m=Math.max(m,v+n),p=Math.min(p,w-o),_=Math.max(_,w+o)}this.minX=f,this.minY=p,this.maxX=m,this.maxY=_}addBounds(t){const e=this.minX,i=this.minY,s=this.maxX,n=this.maxY;this.minX=t.minX<e?t.minX:e,this.minY=t.minY<i?t.minY:i,this.maxX=t.maxX>s?t.maxX:s,this.maxY=t.maxY>n?t.maxY:n}addBoundsMask(t,e){const i=t.minX>e.minX?t.minX:e.minX,s=t.minY>e.minY?t.minY:e.minY,n=t.maxX<e.maxX?t.maxX:e.maxX,o=t.maxY<e.maxY?t.maxY:e.maxY;if(i<=n&&s<=o){const a=this.minX,l=this.minY,h=this.maxX,c=this.maxY;this.minX=i<a?i:a,this.minY=s<l?s:l,this.maxX=n>h?n:h,this.maxY=o>c?o:c}}addBoundsMatrix(t,e){this.addFrameMatrix(e,t.minX,t.minY,t.maxX,t.maxY)}addBoundsArea(t,e){const i=t.minX>e.x?t.minX:e.x,s=t.minY>e.y?t.minY:e.y,n=t.maxX<e.x+e.width?t.maxX:e.x+e.width,o=t.maxY<e.y+e.height?t.maxY:e.y+e.height;if(i<=n&&s<=o){const a=this.minX,l=this.minY,h=this.maxX,c=this.maxY;this.minX=i<a?i:a,this.minY=s<l?s:l,this.maxX=n>h?n:h,this.maxY=o>c?o:c}}pad(t=0,e=t){this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e)}addFramePad(t,e,i,s,n,o){t-=n,e-=o,i+=n,s+=o,this.minX=this.minX<t?this.minX:t,this.maxX=this.maxX>i?this.maxX:i,this.minY=this.minY<e?this.minY:e,this.maxY=this.maxY>s?this.maxY:s}}class Rt extends Ji{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new Ga,this.alpha=1,this.visible=!0,this.renderable=!0,this.cullable=!1,this.cullArea=null,this.parent=null,this.worldAlpha=1,this._lastSortedIndex=0,this._zIndex=0,this.filterArea=null,this.filters=null,this._enabledFilters=null,this._bounds=new Rn,this._localBounds=null,this._boundsID=0,this._boundsRect=null,this._localBoundsRect=null,this._mask=null,this._maskRefCount=0,this._destroyed=!1,this.isSprite=!1,this.isMask=!1}static mixin(t){const e=Object.keys(t);for(let i=0;i<e.length;++i){const s=e[i];Object.defineProperty(Rt.prototype,s,Object.getOwnPropertyDescriptor(t,s))}}get destroyed(){return this._destroyed}_recursivePostUpdateTransform(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateTransform(this.parent.transform)):this.transform.updateTransform(this._tempDisplayObjectParent.transform)}updateTransform(){this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha}getBounds(t,e){return t||(this.parent?(this._recursivePostUpdateTransform(),this.updateTransform()):(this.parent=this._tempDisplayObjectParent,this.updateTransform(),this.parent=null)),this._bounds.updateID!==this._boundsID&&(this.calculateBounds(),this._bounds.updateID=this._boundsID),e||(this._boundsRect||(this._boundsRect=new nt),e=this._boundsRect),this._bounds.getRectangle(e)}getLocalBounds(t){t||(this._localBoundsRect||(this._localBoundsRect=new nt),t=this._localBoundsRect),this._localBounds||(this._localBounds=new Rn);const e=this.transform,i=this.parent;this.parent=null,this._tempDisplayObjectParent.worldAlpha=(i==null?void 0:i.worldAlpha)??1,this.transform=this._tempDisplayObjectParent.transform;const s=this._bounds,n=this._boundsID;this._bounds=this._localBounds;const o=this.getBounds(!1,t);return this.parent=i,this.transform=e,this._bounds=s,this._bounds.updateID+=this._boundsID-n,o}toGlobal(t,e,i=!1){return i||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(t,e)}toLocal(t,e,i,s){return e&&(t=e.toGlobal(t,i,s)),s||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(t,i)}setParent(t){if(!t||!t.addChild)throw new Error("setParent: Argument must be a Container");return t.addChild(this),t}removeFromParent(){var t;(t=this.parent)==null||t.removeChild(this)}setTransform(t=0,e=0,i=1,s=1,n=0,o=0,a=0,l=0,h=0){return this.position.x=t,this.position.y=e,this.scale.x=i||1,this.scale.y=s||1,this.rotation=n,this.skew.x=o,this.skew.y=a,this.pivot.x=l,this.pivot.y=h,this}destroy(t){this.removeFromParent(),this._destroyed=!0,this.transform=null,this.parent=null,this._bounds=null,this.mask=null,this.cullArea=null,this.filters=null,this.filterArea=null,this.hitArea=null,this.eventMode="auto",this.interactiveChildren=!1,this.emit("destroyed"),this.removeAllListeners()}get _tempDisplayObjectParent(){return this.tempDisplayObjectParent===null&&(this.tempDisplayObjectParent=new O1),this.tempDisplayObjectParent}enableTempParent(){const t=this.parent;return this.parent=this._tempDisplayObjectParent,t}disableTempParent(t){this.parent=t}get x(){return this.position.x}set x(t){this.transform.position.x=t}get y(){return this.position.y}set y(t){this.transform.position.y=t}get worldTransform(){return this.transform.worldTransform}get localTransform(){return this.transform.localTransform}get position(){return this.transform.position}set position(t){this.transform.position.copyFrom(t)}get scale(){return this.transform.scale}set scale(t){this.transform.scale.copyFrom(t)}get pivot(){return this.transform.pivot}set pivot(t){this.transform.pivot.copyFrom(t)}get skew(){return this.transform.skew}set skew(t){this.transform.skew.copyFrom(t)}get rotation(){return this.transform.rotation}set rotation(t){this.transform.rotation=t}get angle(){return this.transform.rotation*Cv}set angle(t){this.transform.rotation=t*Iv}get zIndex(){return this._zIndex}set zIndex(t){this._zIndex!==t&&(this._zIndex=t,this.parent&&(this.parent.sortDirty=!0))}get worldVisible(){let t=this;do{if(!t.visible)return!1;t=t.parent}while(t);return!0}get mask(){return this._mask}set mask(t){if(this._mask!==t){if(this._mask){const e=this._mask.isMaskData?this._mask.maskObject:this._mask;e&&(e._maskRefCount--,e._maskRefCount===0&&(e.renderable=!0,e.isMask=!1))}if(this._mask=t,this._mask){const e=this._mask.isMaskData?this._mask.maskObject:this._mask;e&&(e._maskRefCount===0&&(e.renderable=!1,e.isMask=!0),e._maskRefCount++)}}}}class O1 extends Rt{constructor(){super(...arguments),this.sortDirty=null}}Rt.prototype.displayObjectUpdateTransform=Rt.prototype.updateTransform;const F1=new Et;function L1(r,t){return r.zIndex===t.zIndex?r._lastSortedIndex-t._lastSortedIndex:r.zIndex-t.zIndex}const Ad=class Fl extends Rt{constructor(){super(),this.children=[],this.sortableChildren=Fl.defaultSortableChildren,this.sortDirty=!1}onChildrenChange(t){}addChild(...t){if(t.length>1)for(let e=0;e<t.length;e++)this.addChild(t[e]);else{const e=t[0];e.parent&&e.parent.removeChild(e),e.parent=this,this.sortDirty=!0,e.transform._parentID=-1,this.children.push(e),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this)}return t[0]}addChildAt(t,e){if(e<0||e>this.children.length)throw new Error(`${t}addChildAt: The index ${e} supplied is out of bounds ${this.children.length}`);return t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.splice(e,0,t),this._boundsID++,this.onChildrenChange(e),t.emit("added",this),this.emit("childAdded",t,this,e),t}swapChildren(t,e){if(t===e)return;const i=this.getChildIndex(t),s=this.getChildIndex(e);this.children[i]=e,this.children[s]=t,this.onChildrenChange(i<s?i:s)}getChildIndex(t){const e=this.children.indexOf(t);if(e===-1)throw new Error("The supplied DisplayObject must be a child of the caller");return e}setChildIndex(t,e){if(e<0||e>=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);const i=this.getChildIndex(t);Ai(this.children,i,1),this.children.splice(e,0,t),this.onChildrenChange(e)}getChildAt(t){if(t<0||t>=this.children.length)throw new Error(`getChildAt: Index (${t}) does not exist.`);return this.children[t]}removeChild(...t){if(t.length>1)for(let e=0;e<t.length;e++)this.removeChild(t[e]);else{const e=t[0],i=this.children.indexOf(e);if(i===-1)return null;e.parent=null,e.transform._parentID=-1,Ai(this.children,i,1),this._boundsID++,this.onChildrenChange(i),e.emit("removed",this),this.emit("childRemoved",e,this,i)}return t[0]}removeChildAt(t){const e=this.getChildAt(t);return e.parent=null,e.transform._parentID=-1,Ai(this.children,t,1),this._boundsID++,this.onChildrenChange(t),e.emit("removed",this),this.emit("childRemoved",e,this,t),e}removeChildren(t=0,e=this.children.length){const i=t,s=e,n=s-i;let o;if(n>0&&n<=s){o=this.children.splice(i,n);for(let a=0;a<o.length;++a)o[a].parent=null,o[a].transform&&(o[a].transform._parentID=-1);this._boundsID++,this.onChildrenChange(t);for(let a=0;a<o.length;++a)o[a].emit("removed",this),this.emit("childRemoved",o[a],this,a);return o}else if(n===0&&this.children.length===0)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")}sortChildren(){let t=!1;for(let e=0,i=this.children.length;e<i;++e){const s=this.children[e];s._lastSortedIndex=e,!t&&s.zIndex!==0&&(t=!0)}t&&this.children.length>1&&this.children.sort(L1),this.sortDirty=!1}updateTransform(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(let t=0,e=this.children.length;t<e;++t){const i=this.children[t];i.visible&&i.updateTransform()}}calculateBounds(){this._bounds.clear(),this._calculateBounds();for(let t=0;t<this.children.length;t++){const e=this.children[t];if(!(!e.visible||!e.renderable))if(e.calculateBounds(),e._mask){const i=e._mask.isMaskData?e._mask.maskObject:e._mask;i?(i.calculateBounds(),this._bounds.addBoundsMask(e._bounds,i._bounds)):this._bounds.addBounds(e._bounds)}else e.filterArea?this._bounds.addBoundsArea(e._bounds,e.filterArea):this._bounds.addBounds(e._bounds)}this._bounds.updateID=this._boundsID}getLocalBounds(t,e=!1){const i=super.getLocalBounds(t);if(!e)for(let s=0,n=this.children.length;s<n;++s){const o=this.children[s];o.visible&&o.updateTransform()}return i}_calculateBounds(){}_renderWithCulling(t){const e=t.renderTexture.sourceFrame;if(!(e.width>0&&e.height>0))return;let i,s;this.cullArea?(i=this.cullArea,s=this.worldTransform):this._render!==Fl.prototype._render&&(i=this.getBounds(!0));const n=t.projection.transform;if(n&&(s?(s=F1.copyFrom(s),s.prepend(n)):s=n),i&&e.intersects(i,s))this._render(t);else if(this.cullArea)return;for(let o=0,a=this.children.length;o<a;++o){const l=this.children[o],h=l.cullable;l.cullable=h||!this.cullArea,l.render(t),l.cullable=h}}render(t){var e;if(!(!this.visible||this.worldAlpha<=0||!this.renderable))if(this._mask||(e=this.filters)!=null&&e.length)this.renderAdvanced(t);else if(this.cullable)this._renderWithCulling(t);else{this._render(t);for(let i=0,s=this.children.length;i<s;++i)this.children[i].render(t)}}renderAdvanced(t){var n,o,a;const e=this.filters,i=this._mask;if(e){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(let l=0;l<e.length;l++)e[l].enabled&&this._enabledFilters.push(e[l])}const s=e&&((n=this._enabledFilters)==null?void 0:n.length)||i&&(!i.isMaskData||i.enabled&&(i.autoDetect||i.type!==Ft.NONE));if(s&&t.batch.flush(),e&&((o=this._enabledFilters)!=null&&o.length)&&t.filter.push(this,this._enabledFilters),i&&t.mask.push(this,this._mask),this.cullable)this._renderWithCulling(t);else{this._render(t);for(let l=0,h=this.children.length;l<h;++l)this.children[l].render(t)}s&&t.batch.flush(),i&&t.mask.pop(this),e&&((a=this._enabledFilters)!=null&&a.length)&&t.filter.pop()}_render(t){}destroy(t){super.destroy(),this.sortDirty=!1;const e=typeof t=="boolean"?t:t==null?void 0:t.children,i=this.removeChildren(0,this.children.length);if(e)for(let s=0;s<i.length;++s)i[s].destroy(t)}get width(){return this.scale.x*this.getLocalBounds().width}set width(t){const e=this.getLocalBounds().width;e!==0?this.scale.x=t/e:this.scale.x=1,this._width=t}get height(){return this.scale.y*this.getLocalBounds().height}set height(t){const e=this.getLocalBounds().height;e!==0?this.scale.y=t/e:this.scale.y=1,this._height=t}};Ad.defaultSortableChildren=!1;let Te=Ad;Te.prototype.containerUpdateTransform=Te.prototype.updateTransform,Object.defineProperties(W,{SORTABLE_CHILDREN:{get(){return Te.defaultSortableChildren},set(r){lt("7.1.0","settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),Te.defaultSortableChildren=r}}});const ms=new pt,N1=new Uint16Array([0,1,2,0,2,3]);class Ri extends Te{constructor(t){super(),this._anchor=new ar(this._onAnchorUpdate,this,t?t.defaultAnchor.x:0,t?t.defaultAnchor.y:0),this._texture=null,this._width=0,this._height=0,this._tintColor=new xt(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=Q.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=t||Y.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=N1,this.pluginName="batch",this.isSprite=!0,this._roundPixels=W.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=_r(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=_r(this.scale.y)*this._height/this._texture.orig.height)}_onAnchorUpdate(){this._transformID=-1,this._transformTrimmedID=-1}calculateVertices(){const t=this._texture;if(this._transformID===this.transform._worldID&&this._textureID===t._updateID)return;this._textureID!==t._updateID&&(this.uvs=this._texture._uvs.uvsFloat32),this._transformID=this.transform._worldID,this._textureID=t._updateID;const e=this.transform.worldTransform,i=e.a,s=e.b,n=e.c,o=e.d,a=e.tx,l=e.ty,h=this.vertexData,c=t.trim,u=t.orig,d=this._anchor;let f=0,p=0,m=0,_=0;if(c?(p=c.x-d._x*u.width,f=p+c.width,_=c.y-d._y*u.height,m=_+c.height):(p=-d._x*u.width,f=p+u.width,_=-d._y*u.height,m=_+u.height),h[0]=i*p+n*_+a,h[1]=o*_+s*p+l,h[2]=i*f+n*_+a,h[3]=o*_+s*f+l,h[4]=i*f+n*m+a,h[5]=o*m+s*f+l,h[6]=i*p+n*m+a,h[7]=o*m+s*p+l,this._roundPixels){const y=W.RESOLUTION;for(let x=0;x<h.length;++x)h[x]=Math.round(h[x]*y)/y}}calculateTrimmedVertices(){if(!this.vertexTrimmedData)this.vertexTrimmedData=new Float32Array(8);else if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return;this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;const t=this._texture,e=this.vertexTrimmedData,i=t.orig,s=this._anchor,n=this.transform.worldTransform,o=n.a,a=n.b,l=n.c,h=n.d,c=n.tx,u=n.ty,d=-s._x*i.width,f=d+i.width,p=-s._y*i.height,m=p+i.height;if(e[0]=o*d+l*p+c,e[1]=h*p+a*d+u,e[2]=o*f+l*p+c,e[3]=h*p+a*f+u,e[4]=o*f+l*m+c,e[5]=h*m+a*f+u,e[6]=o*d+l*m+c,e[7]=h*m+a*d+u,this._roundPixels){const _=W.RESOLUTION;for(let y=0;y<e.length;++y)e[y]=Math.round(e[y]*_)/_}}_render(t){this.calculateVertices(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this)}_calculateBounds(){const t=this._texture.trim,e=this._texture.orig;!t||t.width===e.width&&t.height===e.height?(this.calculateVertices(),this._bounds.addQuad(this.vertexData)):(this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData))}getLocalBounds(t){return this.children.length===0?(this._localBounds||(this._localBounds=new Rn),this._localBounds.minX=this._texture.orig.width*-this._anchor._x,this._localBounds.minY=this._texture.orig.height*-this._anchor._y,this._localBounds.maxX=this._texture.orig.width*(1-this._anchor._x),this._localBounds.maxY=this._texture.orig.height*(1-this._anchor._y),t||(this._localBoundsRect||(this._localBoundsRect=new nt),t=this._localBoundsRect),this._localBounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,ms);const e=this._texture.orig.width,i=this._texture.orig.height,s=-e*this.anchor.x;let n=0;return ms.x>=s&&ms.x<s+e&&(n=-i*this.anchor.y,ms.y>=n&&ms.y<n+i)}destroy(t){if(super.destroy(t),this._texture.off("update",this._onTextureUpdate,this),this._anchor=null,typeof t=="boolean"?t:t==null?void 0:t.texture){const e=typeof t=="boolean"?t:t==null?void 0:t.baseTexture;this._texture.destroy(!!e)}this._texture=null}static from(t,e){const i=t instanceof Y?t:Y.from(t,e);return new Ri(i)}set roundPixels(t){this._roundPixels!==t&&(this._transformID=-1,this._transformTrimmedID=-1),this._roundPixels=t}get roundPixels(){return this._roundPixels}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){const e=_r(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){const e=_r(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t}get anchor(){return this._anchor}set anchor(t){this._anchor.copyFrom(t)}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t),this._tintRGB=this._tintColor.toLittleEndianNumber()}get tintValue(){return this._tintColor.toNumber()}get texture(){return this._texture}set texture(t){this._texture!==t&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=t||Y.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))}}const Sd=new Et;Rt.prototype._cacheAsBitmap=!1,Rt.prototype._cacheData=null,Rt.prototype._cacheAsBitmapResolution=null,Rt.prototype._cacheAsBitmapMultisample=null;class U1{constructor(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null}}Object.defineProperties(Rt.prototype,{cacheAsBitmapResolution:{get(){return this._cacheAsBitmapResolution},set(r){r!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=r,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get(){return this._cacheAsBitmapMultisample},set(r){r!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=r,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get(){return this._cacheAsBitmap},set(r){if(this._cacheAsBitmap===r)return;this._cacheAsBitmap=r;let t;r?(this._cacheData||(this._cacheData=new U1),t=this._cacheData,t.originalRender=this.render,t.originalRenderCanvas=this.renderCanvas,t.originalUpdateTransform=this.updateTransform,t.originalCalculateBounds=this.calculateBounds,t.originalGetLocalBounds=this.getLocalBounds,t.originalDestroy=this.destroy,t.originalContainsPoint=this.containsPoint,t.originalMask=this._mask,t.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):(t=this._cacheData,t.sprite&&this._destroyCachedDisplayObject(),this.render=t.originalRender,this.renderCanvas=t.originalRenderCanvas,this.calculateBounds=t.originalCalculateBounds,this.getLocalBounds=t.originalGetLocalBounds,this.destroy=t.originalDestroy,this.updateTransform=t.originalUpdateTransform,this.containsPoint=t.originalContainsPoint,this._mask=t.originalMask,this.filterArea=t.originalFilterArea)}}}),Rt.prototype._renderCached=function(r){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(r),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(r))},Rt.prototype._initCachedDisplayObject=function(r){var d,f;if((d=this._cacheData)!=null&&d.sprite)return;const t=this.alpha;this.alpha=1,r.batch.flush();const e=this.getLocalBounds(new nt,!0);if((f=this.filters)!=null&&f.length){const p=this.filters[0].padding;e.pad(p)}const i=this.cacheAsBitmapResolution||r.resolution;e.ceil(i),e.width=Math.max(e.width,1/i),e.height=Math.max(e.height,1/i);const s=r.renderTexture.current,n=r.renderTexture.sourceFrame.clone(),o=r.renderTexture.destinationFrame.clone(),a=r.projection.transform,l=zr.create({width:e.width,height:e.height,resolution:i,multisample:this.cacheAsBitmapMultisample??r.multisample}),h=`cacheAsBitmap_${Ur()}`;this._cacheData.textureCacheId=h,it.addToCache(l.baseTexture,h),Y.addToCache(l,h);const c=this.transform.localTransform.copyTo(Sd).invert().translate(-e.x,-e.y);this.render=this._cacheData.originalRender,r.render(this,{renderTexture:l,clear:!0,transform:c,skipUpdateTransform:!1}),r.framebuffer.blit(),r.projection.transform=a,r.renderTexture.bind(s,n,o),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=t;const u=new Ri(l);u.transform.worldTransform=this.transform.worldTransform,u.anchor.x=-(e.x/e.width),u.anchor.y=-(e.y/e.height),u.alpha=t,u._bounds=this._bounds,this._cacheData.sprite=u,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=u.containsPoint.bind(u)},Rt.prototype._renderCachedCanvas=function(r){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(r),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(r))},Rt.prototype._initCachedDisplayObjectCanvas=function(r){var c;if((c=this._cacheData)!=null&&c.sprite)return;const t=this.getLocalBounds(new nt,!0),e=this.alpha;this.alpha=1;const i=r.canvasContext.activeContext,s=r._projTransform,n=this.cacheAsBitmapResolution||r.resolution;t.ceil(n),t.width=Math.max(t.width,1/n),t.height=Math.max(t.height,1/n);const o=zr.create({width:t.width,height:t.height,resolution:n}),a=`cacheAsBitmap_${Ur()}`;this._cacheData.textureCacheId=a,it.addToCache(o.baseTexture,a),Y.addToCache(o,a);const l=Sd;this.transform.localTransform.copyTo(l),l.invert(),l.tx-=t.x,l.ty-=t.y,this.renderCanvas=this._cacheData.originalRenderCanvas,r.render(this,{renderTexture:o,clear:!0,transform:l,skipUpdateTransform:!1}),r.canvasContext.activeContext=i,r._projTransform=s,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=e;const h=new Ri(o);h.transform.worldTransform=this.transform.worldTransform,h.anchor.x=-(t.x/t.width),h.anchor.y=-(t.y/t.height),h.alpha=e,h._bounds=this._bounds,this._cacheData.sprite=h,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=r._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=h.containsPoint.bind(h)},Rt.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},Rt.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},Rt.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,it.removeFromCache(this._cacheData.textureCacheId),Y.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},Rt.prototype._cacheAsBitmapDestroy=function(r){this.cacheAsBitmap=!1,this.destroy(r)},Rt.prototype.name=null,Te.prototype.getChildByName=function(r,t){for(let e=0,i=this.children.length;e<i;e++)if(this.children[e].name===r)return this.children[e];if(t)for(let e=0,i=this.children.length;e<i;e++){const s=this.children[e];if(!s.getChildByName)continue;const n=s.getChildByName(r,!0);if(n)return n}return null},Rt.prototype.getGlobalPosition=function(r=new pt,t=!1){return this.parent?this.parent.toGlobal(this.position,r,t):(r.x=this.position.x,r.y=this.position.y),r};var k1=`varying vec2 vTextureCoord;
571
527
 
572
- uniform mat3 projectionMatrix;
573
- uniform mat3 translationMatrix;
574
- uniform vec4 tint;
528
+ uniform sampler2D uSampler;
529
+ uniform float uAlpha;
575
530
 
576
- varying vec2 vTextureCoord;
577
- varying vec4 vColor;
578
- varying float vTextureId;
531
+ void main(void)
532
+ {
533
+ gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;
534
+ }
535
+ `;class G1 extends re{constructor(t=1){super(I1,k1,{uAlpha:1}),this.alpha=t}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}}const $1={5:[.153388,.221461,.250301],7:[.071303,.131514,.189879,.214607],9:[.028532,.067234,.124009,.179044,.20236],11:[.0093,.028002,.065984,.121703,.175713,.198596],13:[.002406,.009255,.027867,.065666,.121117,.174868,.197641],15:[489e-6,.002403,.009246,.02784,.065602,.120999,.174697,.197448]},H1=["varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{"," gl_FragColor = vec4(0.0);"," %blur%","}"].join(`
536
+ `);function X1(r){const t=$1[r],e=t.length;let i=H1,s="";const n="gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;";let o;for(let a=0;a<r;a++){let l=n.replace("%index%",a.toString());o=a,a>=e&&(o=r-a-1),l=l.replace("%value%",t[o].toString()),s+=l,s+=`
537
+ `}return i=i.replace("%blur%",s),i=i.replace("%size%",r.toString()),i}const V1=`
538
+ attribute vec2 aVertexPosition;
579
539
 
580
- void main(void){
581
- gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
540
+ uniform mat3 projectionMatrix;
582
541
 
583
- vTextureCoord = aTextureCoord;
584
- vTextureId = aTextureId;
585
- vColor = aColor * tint;
586
- }
587
- `,tl=`varying vec2 vTextureCoord;
588
- varying vec4 vColor;
589
- varying float vTextureId;
590
- uniform sampler2D uSamplers[%count%];
542
+ uniform float strength;
591
543
 
592
- void main(void){
593
- vec4 color;
594
- %forloop%
595
- gl_FragColor = color * vColor;
596
- }
597
- `,M0=function(){function r(){}return r.create=function(t){var e=Object.assign({vertex:Qh,fragment:tl,geometryClass:Jh,vertexSize:6},t),n=e.vertex,i=e.fragment,o=e.vertexSize,a=e.geometryClass;return function(s){bt(u,s);function u(h){var l=s.call(this,h)||this;return l.shaderGenerator=new C0(n,i),l.geometryClass=a,l.vertexSize=o,l}return u}(I0)},Object.defineProperty(r,"defaultVertexSrc",{get:function(){return Qh},enumerable:!1,configurable:!0}),Object.defineProperty(r,"defaultFragmentTemplate",{get:function(){return tl},enumerable:!1,configurable:!0}),r}(),el=M0.create();Object.assign(el,{extension:{name:"batch",type:mt.RendererPlugin}});/*!
598
- * @pixi/accessibility - v6.5.10
599
- * Compiled Thu, 06 Jul 2023 15:25:11 UTC
600
- *
601
- * @pixi/accessibility is licensed under the MIT License.
602
- * http://www.opensource.org/licenses/mit-license
603
- */var D0={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};It.mixin(D0);var F0=9,Ti=100,B0=0,N0=0,rl=2,nl=1,L0=-1e3,U0=-1e3,G0=2,k0=function(){function r(t){this.debug=!1,this._isActive=!1,this._isMobileAccessibility=!1,this.pool=[],this.renderId=0,this.children=[],this.androidUpdateCount=0,this.androidUpdateFrequency=500,this._hookDiv=null,(ye.tablet||ye.phone)&&this.createTouchHook();var e=document.createElement("div");e.style.width=Ti+"px",e.style.height=Ti+"px",e.style.position="absolute",e.style.top=B0+"px",e.style.left=N0+"px",e.style.zIndex=rl.toString(),this.div=e,this.renderer=t,this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)}return Object.defineProperty(r.prototype,"isActive",{get:function(){return this._isActive},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"isMobileAccessibility",{get:function(){return this._isMobileAccessibility},enumerable:!1,configurable:!0}),r.prototype.createTouchHook=function(){var t=this,e=document.createElement("button");e.style.width=nl+"px",e.style.height=nl+"px",e.style.position="absolute",e.style.top=L0+"px",e.style.left=U0+"px",e.style.zIndex=G0.toString(),e.style.backgroundColor="#FF0000",e.title="select to enable accessibility for this content",e.addEventListener("focus",function(){t._isMobileAccessibility=!0,t.activate(),t.destroyTouchHook()}),document.body.appendChild(e),this._hookDiv=e},r.prototype.destroyTouchHook=function(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)},r.prototype.activate=function(){var t;this._isActive||(this._isActive=!0,globalThis.document.addEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown,!1),this.renderer.on("postrender",this.update,this),(t=this.renderer.view.parentNode)===null||t===void 0||t.appendChild(this.div))},r.prototype.deactivate=function(){var t;!this._isActive||this._isMobileAccessibility||(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),(t=this.div.parentNode)===null||t===void 0||t.removeChild(this.div))},r.prototype.updateAccessibleObjects=function(t){if(!(!t.visible||!t.accessibleChildren)){t.accessible&&t.interactive&&(t._accessibleActive||this.addChild(t),t.renderId=this.renderId);var e=t.children;if(e)for(var n=0;n<e.length;n++)this.updateAccessibleObjects(e[n])}},r.prototype.update=function(){var t=performance.now();if(!(ye.android.device&&t<this.androidUpdateCount)&&(this.androidUpdateCount=t+this.androidUpdateFrequency,!!this.renderer.renderingToScreen)){this.renderer._lastObjectRendered&&this.updateAccessibleObjects(this.renderer._lastObjectRendered);var e=this.renderer.view.getBoundingClientRect(),n=e.left,i=e.top,o=e.width,a=e.height,s=this.renderer,u=s.width,h=s.height,l=s.resolution,f=o/u*l,c=a/h*l,d=this.div;d.style.left=n+"px",d.style.top=i+"px",d.style.width=u+"px",d.style.height=h+"px";for(var p=0;p<this.children.length;p++){var v=this.children[p];if(v.renderId!==this.renderId)v._accessibleActive=!1,Gr(this.children,p,1),this.div.removeChild(v._accessibleDiv),this.pool.push(v._accessibleDiv),v._accessibleDiv=null,p--;else{d=v._accessibleDiv;var _=v.hitArea,m=v.worldTransform;v.hitArea?(d.style.left=(m.tx+_.x*m.a)*f+"px",d.style.top=(m.ty+_.y*m.d)*c+"px",d.style.width=_.width*m.a*f+"px",d.style.height=_.height*m.d*c+"px"):(_=v.getBounds(),this.capHitArea(_),d.style.left=_.x*f+"px",d.style.top=_.y*c+"px",d.style.width=_.width*f+"px",d.style.height=_.height*c+"px",d.title!==v.accessibleTitle&&v.accessibleTitle!==null&&(d.title=v.accessibleTitle),d.getAttribute("aria-label")!==v.accessibleHint&&v.accessibleHint!==null&&d.setAttribute("aria-label",v.accessibleHint)),(v.accessibleTitle!==d.title||v.tabIndex!==d.tabIndex)&&(d.title=v.accessibleTitle,d.tabIndex=v.tabIndex,this.debug&&this.updateDebugHTML(d))}}this.renderId++}},r.prototype.updateDebugHTML=function(t){t.innerHTML="type: "+t.type+"</br> title : "+t.title+"</br> tabIndex: "+t.tabIndex},r.prototype.capHitArea=function(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);var e=this.renderer,n=e.width,i=e.height;t.x+t.width>n&&(t.width=n-t.x),t.y+t.height>i&&(t.height=i-t.y)},r.prototype.addChild=function(t){var e=this.pool.pop();e||(e=document.createElement("button"),e.style.width=Ti+"px",e.style.height=Ti+"px",e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=rl.toString(),e.style.borderStyle="none",navigator.userAgent.toLowerCase().indexOf("chrome")>-1?e.setAttribute("aria-live","off"):e.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?e.setAttribute("aria-relevant","additions"):e.setAttribute("aria-relevant","text"),e.addEventListener("click",this._onClick.bind(this)),e.addEventListener("focus",this._onFocus.bind(this)),e.addEventListener("focusout",this._onFocusOut.bind(this))),e.style.pointerEvents=t.accessiblePointerEvents,e.type=t.accessibleType,t.accessibleTitle&&t.accessibleTitle!==null?e.title=t.accessibleTitle:(!t.accessibleHint||t.accessibleHint===null)&&(e.title="displayObject "+t.tabIndex),t.accessibleHint&&t.accessibleHint!==null&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this.updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.displayObject=t,this.children.push(t),this.div.appendChild(t._accessibleDiv),t._accessibleDiv.tabIndex=t.tabIndex},r.prototype._onClick=function(t){var e=this.renderer.plugins.interaction,n=t.target.displayObject,i=e.eventData;e.dispatchEvent(n,"click",i),e.dispatchEvent(n,"pointertap",i),e.dispatchEvent(n,"tap",i)},r.prototype._onFocus=function(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive");var e=this.renderer.plugins.interaction,n=t.target.displayObject,i=e.eventData;e.dispatchEvent(n,"mouseover",i)},r.prototype._onFocusOut=function(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite");var e=this.renderer.plugins.interaction,n=t.target.displayObject,i=e.eventData;e.dispatchEvent(n,"mouseout",i)},r.prototype._onKeyDown=function(t){t.keyCode===F0&&this.activate()},r.prototype._onMouseMove=function(t){t.movementX===0&&t.movementY===0||this.deactivate()},r.prototype.destroy=function(){this.destroyTouchHook(),this.div=null,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null},r.extension={name:"accessibility",type:[mt.RendererPlugin,mt.CanvasRendererPlugin]},r}();/*!
604
- * @pixi/interaction - v6.5.10
605
- * Compiled Thu, 06 Jul 2023 15:25:11 UTC
606
- *
607
- * @pixi/interaction is licensed under the MIT License.
608
- * http://www.opensource.org/licenses/mit-license
609
- */var il=function(){function r(){this.pressure=0,this.rotationAngle=0,this.twist=0,this.tangentialPressure=0,this.global=new Et,this.target=null,this.originalEvent=null,this.identifier=null,this.isPrimary=!1,this.button=0,this.buttons=0,this.width=0,this.height=0,this.tiltX=0,this.tiltY=0,this.pointerType=null,this.pressure=0,this.rotationAngle=0,this.twist=0,this.tangentialPressure=0}return Object.defineProperty(r.prototype,"pointerId",{get:function(){return this.identifier},enumerable:!1,configurable:!0}),r.prototype.getLocalPosition=function(t,e,n){return t.worldTransform.applyInverse(n||this.global,e)},r.prototype.copyEvent=function(t){"isPrimary"in t&&t.isPrimary&&(this.isPrimary=!0),this.button="button"in t&&t.button;var e="buttons"in t&&t.buttons;this.buttons=Number.isInteger(e)?e:"which"in t&&t.which,this.width="width"in t&&t.width,this.height="height"in t&&t.height,this.tiltX="tiltX"in t&&t.tiltX,this.tiltY="tiltY"in t&&t.tiltY,this.pointerType="pointerType"in t&&t.pointerType,this.pressure="pressure"in t&&t.pressure,this.rotationAngle="rotationAngle"in t&&t.rotationAngle,this.twist="twist"in t&&t.twist||0,this.tangentialPressure="tangentialPressure"in t&&t.tangentialPressure||0},r.prototype.reset=function(){this.isPrimary=!1},r}();/*! *****************************************************************************
610
- Copyright (c) Microsoft Corporation.
611
-
612
- Permission to use, copy, modify, and/or distribute this software for any
613
- purpose with or without fee is hereby granted.
614
-
615
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
616
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
617
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
618
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
619
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
620
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
621
- PERFORMANCE OF THIS SOFTWARE.
622
- ***************************************************************************** */var Sa=function(r,t){return Sa=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var i in n)n.hasOwnProperty(i)&&(e[i]=n[i])},Sa(r,t)};function X0(r,t){Sa(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var H0=function(){function r(){this.stopped=!1,this.stopsPropagatingAt=null,this.stopPropagationHint=!1,this.target=null,this.currentTarget=null,this.type=null,this.data=null}return r.prototype.stopPropagation=function(){this.stopped=!0,this.stopPropagationHint=!0,this.stopsPropagatingAt=this.currentTarget},r.prototype.reset=function(){this.stopped=!1,this.stopsPropagatingAt=null,this.stopPropagationHint=!1,this.currentTarget=null,this.target=null},r}(),Aa=function(){function r(t){this._pointerId=t,this._flags=r.FLAGS.NONE}return r.prototype._doSet=function(t,e){e?this._flags=this._flags|t:this._flags=this._flags&~t},Object.defineProperty(r.prototype,"pointerId",{get:function(){return this._pointerId},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"flags",{get:function(){return this._flags},set:function(t){this._flags=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"none",{get:function(){return this._flags===r.FLAGS.NONE},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"over",{get:function(){return(this._flags&r.FLAGS.OVER)!==0},set:function(t){this._doSet(r.FLAGS.OVER,t)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"rightDown",{get:function(){return(this._flags&r.FLAGS.RIGHT_DOWN)!==0},set:function(t){this._doSet(r.FLAGS.RIGHT_DOWN,t)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"leftDown",{get:function(){return(this._flags&r.FLAGS.LEFT_DOWN)!==0},set:function(t){this._doSet(r.FLAGS.LEFT_DOWN,t)},enumerable:!1,configurable:!0}),r.FLAGS=Object.freeze({NONE:0,OVER:1,LEFT_DOWN:2,RIGHT_DOWN:4}),r}(),j0=function(){function r(){this._tempPoint=new Et}return r.prototype.recursiveFindHit=function(t,e,n,i,o){var a;if(!e||!e.visible)return!1;var s=t.data.global;o=e.interactive||o;var u=!1,h=o,l=!0;if(e.hitArea)i&&(e.worldTransform.applyInverse(s,this._tempPoint),e.hitArea.contains(this._tempPoint.x,this._tempPoint.y)?u=!0:(i=!1,l=!1)),h=!1;else if(e._mask&&i){var f=e._mask.isMaskData?e._mask.maskObject:e._mask;f&&!(!((a=f.containsPoint)===null||a===void 0)&&a.call(f,s))&&(i=!1)}if(l&&e.interactiveChildren&&e.children)for(var c=e.children,d=c.length-1;d>=0;d--){var p=c[d],v=this.recursiveFindHit(t,p,n,i,h);if(v){if(!p.parent)continue;h=!1,v&&(t.target&&(i=!1),u=!0)}}return o&&(i&&!t.target&&!e.hitArea&&e.containsPoint&&e.containsPoint(s)&&(u=!0),e.interactive&&(u&&!t.target&&(t.target=e),n&&n(t,e,!!u))),u},r.prototype.findHit=function(t,e,n,i){this.recursiveFindHit(t,e,n,i,!1)},r}(),V0={interactive:!1,interactiveChildren:!0,hitArea:null,get buttonMode(){return this.cursor==="pointer"},set buttonMode(r){r?this.cursor="pointer":this.cursor==="pointer"&&(this.cursor=null)},cursor:null,get trackedPointers(){return this._trackedPointers===void 0&&(this._trackedPointers={}),this._trackedPointers},_trackedPointers:void 0};It.mixin(V0);var wi=1,Si={target:null,data:{global:null}},Y0=function(r){X0(t,r);function t(e,n){var i=r.call(this)||this;return n=n||{},i.renderer=e,i.autoPreventDefault=n.autoPreventDefault!==void 0?n.autoPreventDefault:!0,i.interactionFrequency=n.interactionFrequency||10,i.mouse=new il,i.mouse.identifier=wi,i.mouse.global.set(-999999),i.activeInteractionData={},i.activeInteractionData[wi]=i.mouse,i.interactionDataPool=[],i.eventData=new H0,i.interactionDOMElement=null,i.moveWhenInside=!1,i.eventsAdded=!1,i.tickerAdded=!1,i.mouseOverRenderer=!("PointerEvent"in globalThis),i.supportsTouchEvents="ontouchstart"in globalThis,i.supportsPointerEvents=!!globalThis.PointerEvent,i.onPointerUp=i.onPointerUp.bind(i),i.processPointerUp=i.processPointerUp.bind(i),i.onPointerCancel=i.onPointerCancel.bind(i),i.processPointerCancel=i.processPointerCancel.bind(i),i.onPointerDown=i.onPointerDown.bind(i),i.processPointerDown=i.processPointerDown.bind(i),i.onPointerMove=i.onPointerMove.bind(i),i.processPointerMove=i.processPointerMove.bind(i),i.onPointerOut=i.onPointerOut.bind(i),i.processPointerOverOut=i.processPointerOverOut.bind(i),i.onPointerOver=i.onPointerOver.bind(i),i.cursorStyles={default:"inherit",pointer:"pointer"},i.currentCursorMode=null,i.cursor=null,i.resolution=1,i.delayedEvents=[],i.search=new j0,i._tempDisplayObject=new wh,i._eventListenerOptions={capture:!0,passive:!1},i._useSystemTicker=n.useSystemTicker!==void 0?n.useSystemTicker:!0,i.setTargetElement(i.renderer.view,i.renderer.resolution),i}return Object.defineProperty(t.prototype,"useSystemTicker",{get:function(){return this._useSystemTicker},set:function(e){this._useSystemTicker=e,e?this.addTickerListener():this.removeTickerListener()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastObjectRendered",{get:function(){return this.renderer._lastObjectRendered||this._tempDisplayObject},enumerable:!1,configurable:!0}),t.prototype.hitTest=function(e,n){return Si.target=null,Si.data.global=e,n||(n=this.lastObjectRendered),this.processInteractive(Si,n,null,!0),Si.target},t.prototype.setTargetElement=function(e,n){n===void 0&&(n=1),this.removeTickerListener(),this.removeEvents(),this.interactionDOMElement=e,this.resolution=n,this.addEvents(),this.addTickerListener()},t.prototype.addTickerListener=function(){this.tickerAdded||!this.interactionDOMElement||!this._useSystemTicker||(Gt.system.add(this.tickerUpdate,this,Ie.INTERACTION),this.tickerAdded=!0)},t.prototype.removeTickerListener=function(){this.tickerAdded&&(Gt.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)},t.prototype.addEvents=function(){if(!(this.eventsAdded||!this.interactionDOMElement)){var e=this.interactionDOMElement.style;globalThis.navigator.msPointerEnabled?(e.msContentZooming="none",e.msTouchAction="none"):this.supportsPointerEvents&&(e.touchAction="none"),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerdown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerleave",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerover",this.onPointerOver,this._eventListenerOptions),globalThis.addEventListener("pointercancel",this.onPointerCancel,this._eventListenerOptions),globalThis.addEventListener("pointerup",this.onPointerUp,this._eventListenerOptions)):(globalThis.document.addEventListener("mousemove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mousedown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mouseout",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mouseover",this.onPointerOver,this._eventListenerOptions),globalThis.addEventListener("mouseup",this.onPointerUp,this._eventListenerOptions)),this.supportsTouchEvents&&(this.interactionDOMElement.addEventListener("touchstart",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchcancel",this.onPointerCancel,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchend",this.onPointerUp,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchmove",this.onPointerMove,this._eventListenerOptions)),this.eventsAdded=!0}},t.prototype.removeEvents=function(){if(!(!this.eventsAdded||!this.interactionDOMElement)){var e=this.interactionDOMElement.style;globalThis.navigator.msPointerEnabled?(e.msContentZooming="",e.msTouchAction=""):this.supportsPointerEvents&&(e.touchAction=""),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerdown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerleave",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerover",this.onPointerOver,this._eventListenerOptions),globalThis.removeEventListener("pointercancel",this.onPointerCancel,this._eventListenerOptions),globalThis.removeEventListener("pointerup",this.onPointerUp,this._eventListenerOptions)):(globalThis.document.removeEventListener("mousemove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mousedown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mouseout",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mouseover",this.onPointerOver,this._eventListenerOptions),globalThis.removeEventListener("mouseup",this.onPointerUp,this._eventListenerOptions)),this.supportsTouchEvents&&(this.interactionDOMElement.removeEventListener("touchstart",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchcancel",this.onPointerCancel,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchend",this.onPointerUp,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchmove",this.onPointerMove,this._eventListenerOptions)),this.interactionDOMElement=null,this.eventsAdded=!1}},t.prototype.tickerUpdate=function(e){this._deltaTime+=e,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this.update())},t.prototype.update=function(){if(this.interactionDOMElement){if(this._didMove){this._didMove=!1;return}this.cursor=null;for(var e in this.activeInteractionData)if(this.activeInteractionData.hasOwnProperty(e)){var n=this.activeInteractionData[e];if(n.originalEvent&&n.pointerType!=="touch"){var i=this.configureInteractionEventForDOMEvent(this.eventData,n.originalEvent,n);this.processInteractive(i,this.lastObjectRendered,this.processPointerOverOut,!0)}}this.setCursorMode(this.cursor)}},t.prototype.setCursorMode=function(e){e=e||"default";var n=!0;if(globalThis.OffscreenCanvas&&this.interactionDOMElement instanceof OffscreenCanvas&&(n=!1),this.currentCursorMode!==e){this.currentCursorMode=e;var i=this.cursorStyles[e];if(i)switch(typeof i){case"string":n&&(this.interactionDOMElement.style.cursor=i);break;case"function":i(e);break;case"object":n&&Object.assign(this.interactionDOMElement.style,i);break}else n&&typeof e=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,e)&&(this.interactionDOMElement.style.cursor=e)}},t.prototype.dispatchEvent=function(e,n,i){(!i.stopPropagationHint||e===i.stopsPropagatingAt)&&(i.currentTarget=e,i.type=n,e.emit(n,i),e[n]&&e[n](i))},t.prototype.delayDispatchEvent=function(e,n,i){this.delayedEvents.push({displayObject:e,eventString:n,eventData:i})},t.prototype.mapPositionToPoint=function(e,n,i){var o;this.interactionDOMElement.parentElement?o=this.interactionDOMElement.getBoundingClientRect():o={x:0,y:0,width:this.interactionDOMElement.width,height:this.interactionDOMElement.height,left:0,top:0};var a=1/this.resolution;e.x=(n-o.left)*(this.interactionDOMElement.width/o.width)*a,e.y=(i-o.top)*(this.interactionDOMElement.height/o.height)*a},t.prototype.processInteractive=function(e,n,i,o){var a=this.search.findHit(e,n,i,o),s=this.delayedEvents;if(!s.length)return a;e.stopPropagationHint=!1;var u=s.length;this.delayedEvents=[];for(var h=0;h<u;h++){var l=s[h],f=l.displayObject,c=l.eventString,d=l.eventData;d.stopsPropagatingAt===f&&(d.stopPropagationHint=!0),this.dispatchEvent(f,c,d)}return a},t.prototype.onPointerDown=function(e){if(!(this.supportsTouchEvents&&e.pointerType==="touch")){var n=this.normalizeToPointerData(e);if(this.autoPreventDefault&&n[0].isNormalized){var i=e.cancelable||!("cancelable"in e);i&&e.preventDefault()}for(var o=n.length,a=0;a<o;a++){var s=n[a],u=this.getInteractionDataForPointerId(s),h=this.configureInteractionEventForDOMEvent(this.eventData,s,u);if(h.data.originalEvent=e,this.processInteractive(h,this.lastObjectRendered,this.processPointerDown,!0),this.emit("pointerdown",h),s.pointerType==="touch")this.emit("touchstart",h);else if(s.pointerType==="mouse"||s.pointerType==="pen"){var l=s.button===2;this.emit(l?"rightdown":"mousedown",this.eventData)}}}},t.prototype.processPointerDown=function(e,n,i){var o=e.data,a=e.data.identifier;if(i){if(n.trackedPointers[a]||(n.trackedPointers[a]=new Aa(a)),this.dispatchEvent(n,"pointerdown",e),o.pointerType==="touch")this.dispatchEvent(n,"touchstart",e);else if(o.pointerType==="mouse"||o.pointerType==="pen"){var s=o.button===2;s?n.trackedPointers[a].rightDown=!0:n.trackedPointers[a].leftDown=!0,this.dispatchEvent(n,s?"rightdown":"mousedown",e)}}},t.prototype.onPointerComplete=function(e,n,i){var o=this.normalizeToPointerData(e),a=o.length,s=e.target;e.composedPath&&e.composedPath().length>0&&(s=e.composedPath()[0]);for(var u=s!==this.interactionDOMElement?"outside":"",h=0;h<a;h++){var l=o[h],f=this.getInteractionDataForPointerId(l),c=this.configureInteractionEventForDOMEvent(this.eventData,l,f);if(c.data.originalEvent=e,this.processInteractive(c,this.lastObjectRendered,i,n||!u),this.emit(n?"pointercancel":"pointerup"+u,c),l.pointerType==="mouse"||l.pointerType==="pen"){var d=l.button===2;this.emit(d?"rightup"+u:"mouseup"+u,c)}else l.pointerType==="touch"&&(this.emit(n?"touchcancel":"touchend"+u,c),this.releaseInteractionDataForPointerId(l.pointerId))}},t.prototype.onPointerCancel=function(e){this.supportsTouchEvents&&e.pointerType==="touch"||this.onPointerComplete(e,!0,this.processPointerCancel)},t.prototype.processPointerCancel=function(e,n){var i=e.data,o=e.data.identifier;n.trackedPointers[o]!==void 0&&(delete n.trackedPointers[o],this.dispatchEvent(n,"pointercancel",e),i.pointerType==="touch"&&this.dispatchEvent(n,"touchcancel",e))},t.prototype.onPointerUp=function(e){this.supportsTouchEvents&&e.pointerType==="touch"||this.onPointerComplete(e,!1,this.processPointerUp)},t.prototype.processPointerUp=function(e,n,i){var o=e.data,a=e.data.identifier,s=n.trackedPointers[a],u=o.pointerType==="touch",h=o.pointerType==="mouse"||o.pointerType==="pen",l=!1;if(h){var f=o.button===2,c=Aa.FLAGS,d=f?c.RIGHT_DOWN:c.LEFT_DOWN,p=s!==void 0&&s.flags&d;i?(this.dispatchEvent(n,f?"rightup":"mouseup",e),p&&(this.dispatchEvent(n,f?"rightclick":"click",e),l=!0)):p&&this.dispatchEvent(n,f?"rightupoutside":"mouseupoutside",e),s&&(f?s.rightDown=!1:s.leftDown=!1)}i?(this.dispatchEvent(n,"pointerup",e),u&&this.dispatchEvent(n,"touchend",e),s&&((!h||l)&&this.dispatchEvent(n,"pointertap",e),u&&(this.dispatchEvent(n,"tap",e),s.over=!1))):s&&(this.dispatchEvent(n,"pointerupoutside",e),u&&this.dispatchEvent(n,"touchendoutside",e)),s&&s.none&&delete n.trackedPointers[a]},t.prototype.onPointerMove=function(e){if(!(this.supportsTouchEvents&&e.pointerType==="touch")){var n=this.normalizeToPointerData(e);(n[0].pointerType==="mouse"||n[0].pointerType==="pen")&&(this._didMove=!0,this.cursor=null);for(var i=n.length,o=0;o<i;o++){var a=n[o],s=this.getInteractionDataForPointerId(a),u=this.configureInteractionEventForDOMEvent(this.eventData,a,s);u.data.originalEvent=e,this.processInteractive(u,this.lastObjectRendered,this.processPointerMove,!0),this.emit("pointermove",u),a.pointerType==="touch"&&this.emit("touchmove",u),(a.pointerType==="mouse"||a.pointerType==="pen")&&this.emit("mousemove",u)}n[0].pointerType==="mouse"&&this.setCursorMode(this.cursor)}},t.prototype.processPointerMove=function(e,n,i){var o=e.data,a=o.pointerType==="touch",s=o.pointerType==="mouse"||o.pointerType==="pen";s&&this.processPointerOverOut(e,n,i),(!this.moveWhenInside||i)&&(this.dispatchEvent(n,"pointermove",e),a&&this.dispatchEvent(n,"touchmove",e),s&&this.dispatchEvent(n,"mousemove",e))},t.prototype.onPointerOut=function(e){if(!(this.supportsTouchEvents&&e.pointerType==="touch")){var n=this.normalizeToPointerData(e),i=n[0];i.pointerType==="mouse"&&(this.mouseOverRenderer=!1,this.setCursorMode(null));var o=this.getInteractionDataForPointerId(i),a=this.configureInteractionEventForDOMEvent(this.eventData,i,o);a.data.originalEvent=i,this.processInteractive(a,this.lastObjectRendered,this.processPointerOverOut,!1),this.emit("pointerout",a),i.pointerType==="mouse"||i.pointerType==="pen"?this.emit("mouseout",a):this.releaseInteractionDataForPointerId(o.identifier)}},t.prototype.processPointerOverOut=function(e,n,i){var o=e.data,a=e.data.identifier,s=o.pointerType==="mouse"||o.pointerType==="pen",u=n.trackedPointers[a];i&&!u&&(u=n.trackedPointers[a]=new Aa(a)),u!==void 0&&(i&&this.mouseOverRenderer?(u.over||(u.over=!0,this.delayDispatchEvent(n,"pointerover",e),s&&this.delayDispatchEvent(n,"mouseover",e)),s&&this.cursor===null&&(this.cursor=n.cursor)):u.over&&(u.over=!1,this.dispatchEvent(n,"pointerout",this.eventData),s&&this.dispatchEvent(n,"mouseout",e),u.none&&delete n.trackedPointers[a]))},t.prototype.onPointerOver=function(e){if(!(this.supportsTouchEvents&&e.pointerType==="touch")){var n=this.normalizeToPointerData(e),i=n[0],o=this.getInteractionDataForPointerId(i),a=this.configureInteractionEventForDOMEvent(this.eventData,i,o);a.data.originalEvent=i,i.pointerType==="mouse"&&(this.mouseOverRenderer=!0),this.emit("pointerover",a),(i.pointerType==="mouse"||i.pointerType==="pen")&&this.emit("mouseover",a)}},t.prototype.getInteractionDataForPointerId=function(e){var n=e.pointerId,i;return n===wi||e.pointerType==="mouse"?i=this.mouse:this.activeInteractionData[n]?i=this.activeInteractionData[n]:(i=this.interactionDataPool.pop()||new il,i.identifier=n,this.activeInteractionData[n]=i),i.copyEvent(e),i},t.prototype.releaseInteractionDataForPointerId=function(e){var n=this.activeInteractionData[e];n&&(delete this.activeInteractionData[e],n.reset(),this.interactionDataPool.push(n))},t.prototype.configureInteractionEventForDOMEvent=function(e,n,i){return e.data=i,this.mapPositionToPoint(i.global,n.clientX,n.clientY),n.pointerType==="touch"&&(n.globalX=i.global.x,n.globalY=i.global.y),i.originalEvent=n,e.reset(),e},t.prototype.normalizeToPointerData=function(e){var n=[];if(this.supportsTouchEvents&&e instanceof TouchEvent)for(var i=0,o=e.changedTouches.length;i<o;i++){var a=e.changedTouches[i];typeof a.button>"u"&&(a.button=e.touches.length?1:0),typeof a.buttons>"u"&&(a.buttons=e.touches.length?1:0),typeof a.isPrimary>"u"&&(a.isPrimary=e.touches.length===1&&e.type==="touchstart"),typeof a.width>"u"&&(a.width=a.radiusX||1),typeof a.height>"u"&&(a.height=a.radiusY||1),typeof a.tiltX>"u"&&(a.tiltX=0),typeof a.tiltY>"u"&&(a.tiltY=0),typeof a.pointerType>"u"&&(a.pointerType="touch"),typeof a.pointerId>"u"&&(a.pointerId=a.identifier||0),typeof a.pressure>"u"&&(a.pressure=a.force||.5),typeof a.twist>"u"&&(a.twist=0),typeof a.tangentialPressure>"u"&&(a.tangentialPressure=0),typeof a.layerX>"u"&&(a.layerX=a.offsetX=a.clientX),typeof a.layerY>"u"&&(a.layerY=a.offsetY=a.clientY),a.isNormalized=!0,n.push(a)}else if(!globalThis.MouseEvent||e instanceof MouseEvent&&(!this.supportsPointerEvents||!(e instanceof globalThis.PointerEvent))){var s=e;typeof s.isPrimary>"u"&&(s.isPrimary=!0),typeof s.width>"u"&&(s.width=1),typeof s.height>"u"&&(s.height=1),typeof s.tiltX>"u"&&(s.tiltX=0),typeof s.tiltY>"u"&&(s.tiltY=0),typeof s.pointerType>"u"&&(s.pointerType="mouse"),typeof s.pointerId>"u"&&(s.pointerId=wi),typeof s.pressure>"u"&&(s.pressure=.5),typeof s.twist>"u"&&(s.twist=0),typeof s.tangentialPressure>"u"&&(s.tangentialPressure=0),s.isNormalized=!0,n.push(s)}else n.push(e);return n},t.prototype.destroy=function(){this.removeEvents(),this.removeTickerListener(),this.removeAllListeners(),this.renderer=null,this.mouse=null,this.eventData=null,this.interactionDOMElement=null,this.onPointerDown=null,this.processPointerDown=null,this.onPointerUp=null,this.processPointerUp=null,this.onPointerCancel=null,this.processPointerCancel=null,this.onPointerMove=null,this.processPointerMove=null,this.onPointerOut=null,this.processPointerOverOut=null,this.onPointerOver=null,this.search=null},t.extension={name:"interaction",type:[mt.RendererPlugin,mt.CanvasRendererPlugin]},t}(sn);/*!
623
- * @pixi/extract - v6.5.10
624
- * Compiled Thu, 06 Jul 2023 15:25:11 UTC
625
- *
626
- * @pixi/extract is licensed under the MIT License.
627
- * http://www.opensource.org/licenses/mit-license
628
- */var z0=new st,W0=4,q0=function(){function r(t){this.renderer=t}return r.prototype.image=function(t,e,n){var i=new Image;return i.src=this.base64(t,e,n),i},r.prototype.base64=function(t,e,n){return this.canvas(t).toDataURL(e,n)},r.prototype.canvas=function(t,e){var n=this._rawPixels(t,e),i=n.pixels,o=n.width,a=n.height,s=n.flipY,u=new xh(o,a,1),h=u.context.getImageData(0,0,o,a);if(r.arrayPostDivide(i,h.data),u.context.putImageData(h,0,0),s){var l=new xh(u.width,u.height,1);l.context.scale(1,-1),l.context.drawImage(u.canvas,0,-a),u.destroy(),u=l}return u.canvas},r.prototype.pixels=function(t,e){var n=this._rawPixels(t,e).pixels;return r.arrayPostDivide(n,n),n},r.prototype._rawPixels=function(t,e){var n=this.renderer,i,o=!1,a,s=!1;if(t)if(t instanceof hr)a=t;else{var u=n.context.webGLVersion>=2?n.multisample:wt.NONE;if(a=this.renderer.generateTexture(t,{multisample:u}),u!==wt.NONE){var h=hr.create({width:a.width,height:a.height});n.framebuffer.bind(a.framebuffer),n.framebuffer.blit(h.framebuffer),n.framebuffer.bind(null),a.destroy(!0),a=h}s=!0}a?(i=a.baseTexture.resolution,e=e??a.frame,o=!1,n.renderTexture.bind(a)):(i=n.resolution,e||(e=z0,e.width=n.width,e.height=n.height),o=!0,n.renderTexture.bind(null));var l=Math.round(e.width*i),f=Math.round(e.height*i),c=new Uint8Array(W0*l*f),d=n.gl;return d.readPixels(Math.round(e.x*i),Math.round(e.y*i),l,f,d.RGBA,d.UNSIGNED_BYTE,c),s&&a.destroy(!0),{pixels:c,width:l,height:f,flipY:o}},r.prototype.destroy=function(){this.renderer=null},r.arrayPostDivide=function(t,e){for(var n=0;n<t.length;n+=4){var i=e[n+3]=t[n+3];i!==0?(e[n]=Math.round(Math.min(t[n]*255/i,255)),e[n+1]=Math.round(Math.min(t[n+1]*255/i,255)),e[n+2]=Math.round(Math.min(t[n+2]*255/i,255))):(e[n]=t[n],e[n+1]=t[n+1],e[n+2]=t[n+2])}},r.extension={name:"extract",type:mt.RendererPlugin},r}();/*!
629
- * @pixi/loaders - v6.5.10
630
- * Compiled Thu, 06 Jul 2023 15:25:11 UTC
631
- *
632
- * @pixi/loaders is licensed under the MIT License.
633
- * http://www.opensource.org/licenses/mit-license
634
- */var Ai=function(){function r(t,e,n){e===void 0&&(e=!1),this._fn=t,this._once=e,this._thisArg=n,this._next=this._prev=this._owner=null}return r.prototype.detach=function(){return this._owner===null?!1:(this._owner.detach(this),!0)},r}();function ol(r,t){return r._head?(r._tail._next=t,t._prev=r._tail,r._tail=t):(r._head=t,r._tail=t),t._owner=r,t}var Ce=function(){function r(){this._head=this._tail=void 0}return r.prototype.handlers=function(t){t===void 0&&(t=!1);var e=this._head;if(t)return!!e;for(var n=[];e;)n.push(e),e=e._next;return n},r.prototype.has=function(t){if(!(t instanceof Ai))throw new Error("MiniSignal#has(): First arg must be a SignalBinding object.");return t._owner===this},r.prototype.dispatch=function(){for(var t=arguments,e=[],n=0;n<arguments.length;n++)e[n]=t[n];var i=this._head;if(!i)return!1;for(;i;)i._once&&this.detach(i),i._fn.apply(i._thisArg,e),i=i._next;return!0},r.prototype.add=function(t,e){if(e===void 0&&(e=null),typeof t!="function")throw new Error("MiniSignal#add(): First arg must be a Function.");return ol(this,new Ai(t,!1,e))},r.prototype.once=function(t,e){if(e===void 0&&(e=null),typeof t!="function")throw new Error("MiniSignal#once(): First arg must be a Function.");return ol(this,new Ai(t,!0,e))},r.prototype.detach=function(t){if(!(t instanceof Ai))throw new Error("MiniSignal#detach(): First arg must be a SignalBinding object.");return t._owner!==this?this:(t._prev&&(t._prev._next=t._next),t._next&&(t._next._prev=t._prev),t===this._head?(this._head=t._next,t._next===null&&(this._tail=null)):t===this._tail&&(this._tail=t._prev,this._tail._next=null),t._owner=null,this)},r.prototype.detachAll=function(){var t=this._head;if(!t)return this;for(this._head=this._tail=null;t;)t._owner=null,t=t._next;return this},r}();function al(r,t){t=t||{};for(var e={key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}},n=e.parser[t.strictMode?"strict":"loose"].exec(r),i={},o=14;o--;)i[e.key[o]]=n[o]||"";return i[e.q.name]={},i[e.key[12]].replace(e.q.parser,function(a,s,u){s&&(i[e.q.name][s]=u)}),i}var Pa,Pi=null,$0=0,sl=200,K0=204,Z0=1223,J0=2;function ul(){}function hl(r,t,e){t&&t.indexOf(".")===0&&(t=t.substring(1)),t&&(r[t]=e)}function Oa(r){return r.toString().replace("object ","")}var Rt=function(){function r(t,e,n){if(this._dequeue=ul,this._onLoadBinding=null,this._elementTimer=0,this._boundComplete=null,this._boundOnError=null,this._boundOnProgress=null,this._boundOnTimeout=null,this._boundXhrOnError=null,this._boundXhrOnTimeout=null,this._boundXhrOnAbort=null,this._boundXhrOnLoad=null,typeof t!="string"||typeof e!="string")throw new Error("Both name and url are required for constructing a resource.");n=n||{},this._flags=0,this._setFlag(r.STATUS_FLAGS.DATA_URL,e.indexOf("data:")===0),this.name=t,this.url=e,this.extension=this._getExtension(),this.data=null,this.crossOrigin=n.crossOrigin===!0?"anonymous":n.crossOrigin,this.timeout=n.timeout||0,this.loadType=n.loadType||this._determineLoadType(),this.xhrType=n.xhrType,this.metadata=n.metadata||{},this.error=null,this.xhr=null,this.children=[],this.type=r.TYPE.UNKNOWN,this.progressChunk=0,this._dequeue=ul,this._onLoadBinding=null,this._elementTimer=0,this._boundComplete=this.complete.bind(this),this._boundOnError=this._onError.bind(this),this._boundOnProgress=this._onProgress.bind(this),this._boundOnTimeout=this._onTimeout.bind(this),this._boundXhrOnError=this._xhrOnError.bind(this),this._boundXhrOnTimeout=this._xhrOnTimeout.bind(this),this._boundXhrOnAbort=this._xhrOnAbort.bind(this),this._boundXhrOnLoad=this._xhrOnLoad.bind(this),this.onStart=new Ce,this.onProgress=new Ce,this.onComplete=new Ce,this.onAfterMiddleware=new Ce}return r.setExtensionLoadType=function(t,e){hl(r._loadTypeMap,t,e)},r.setExtensionXhrType=function(t,e){hl(r._xhrTypeMap,t,e)},Object.defineProperty(r.prototype,"isDataUrl",{get:function(){return this._hasFlag(r.STATUS_FLAGS.DATA_URL)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"isComplete",{get:function(){return this._hasFlag(r.STATUS_FLAGS.COMPLETE)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"isLoading",{get:function(){return this._hasFlag(r.STATUS_FLAGS.LOADING)},enumerable:!1,configurable:!0}),r.prototype.complete=function(){this._clearEvents(),this._finish()},r.prototype.abort=function(t){if(!this.error){if(this.error=new Error(t),this._clearEvents(),this.xhr)this.xhr.abort();else if(this.xdr)this.xdr.abort();else if(this.data)if(this.data.src)this.data.src=r.EMPTY_GIF;else for(;this.data.firstChild;)this.data.removeChild(this.data.firstChild);this._finish()}},r.prototype.load=function(t){var e=this;if(!this.isLoading){if(this.isComplete){t&&setTimeout(function(){return t(e)},1);return}else t&&this.onComplete.once(t);switch(this._setFlag(r.STATUS_FLAGS.LOADING,!0),this.onStart.dispatch(this),(this.crossOrigin===!1||typeof this.crossOrigin!="string")&&(this.crossOrigin=this._determineCrossOrigin(this.url)),this.loadType){case r.LOAD_TYPE.IMAGE:this.type=r.TYPE.IMAGE,this._loadElement("image");break;case r.LOAD_TYPE.AUDIO:this.type=r.TYPE.AUDIO,this._loadSourceElement("audio");break;case r.LOAD_TYPE.VIDEO:this.type=r.TYPE.VIDEO,this._loadSourceElement("video");break;case r.LOAD_TYPE.XHR:default:typeof Pa>"u"&&(Pa=!!(globalThis.XDomainRequest&&!("withCredentials"in new XMLHttpRequest))),Pa&&this.crossOrigin?this._loadXdr():this._loadXhr();break}}},r.prototype._hasFlag=function(t){return(this._flags&t)!==0},r.prototype._setFlag=function(t,e){this._flags=e?this._flags|t:this._flags&~t},r.prototype._clearEvents=function(){clearTimeout(this._elementTimer),this.data&&this.data.removeEventListener&&(this.data.removeEventListener("error",this._boundOnError,!1),this.data.removeEventListener("load",this._boundComplete,!1),this.data.removeEventListener("progress",this._boundOnProgress,!1),this.data.removeEventListener("canplaythrough",this._boundComplete,!1)),this.xhr&&(this.xhr.removeEventListener?(this.xhr.removeEventListener("error",this._boundXhrOnError,!1),this.xhr.removeEventListener("timeout",this._boundXhrOnTimeout,!1),this.xhr.removeEventListener("abort",this._boundXhrOnAbort,!1),this.xhr.removeEventListener("progress",this._boundOnProgress,!1),this.xhr.removeEventListener("load",this._boundXhrOnLoad,!1)):(this.xhr.onerror=null,this.xhr.ontimeout=null,this.xhr.onprogress=null,this.xhr.onload=null))},r.prototype._finish=function(){if(this.isComplete)throw new Error("Complete called again for an already completed resource.");this._setFlag(r.STATUS_FLAGS.COMPLETE,!0),this._setFlag(r.STATUS_FLAGS.LOADING,!1),this.onComplete.dispatch(this)},r.prototype._loadElement=function(t){this.metadata.loadElement?this.data=this.metadata.loadElement:t==="image"&&typeof globalThis.Image<"u"?this.data=new Image:this.data=document.createElement(t),this.crossOrigin&&(this.data.crossOrigin=this.crossOrigin),this.metadata.skipSource||(this.data.src=this.url),this.data.addEventListener("error",this._boundOnError,!1),this.data.addEventListener("load",this._boundComplete,!1),this.data.addEventListener("progress",this._boundOnProgress,!1),this.timeout&&(this._elementTimer=setTimeout(this._boundOnTimeout,this.timeout))},r.prototype._loadSourceElement=function(t){if(this.metadata.loadElement?this.data=this.metadata.loadElement:t==="audio"&&typeof globalThis.Audio<"u"?this.data=new Audio:this.data=document.createElement(t),this.data===null){this.abort("Unsupported element: "+t);return}if(this.crossOrigin&&(this.data.crossOrigin=this.crossOrigin),!this.metadata.skipSource)if(navigator.isCocoonJS)this.data.src=Array.isArray(this.url)?this.url[0]:this.url;else if(Array.isArray(this.url))for(var e=this.metadata.mimeType,n=0;n<this.url.length;++n)this.data.appendChild(this._createSource(t,this.url[n],Array.isArray(e)?e[n]:e));else{var e=this.metadata.mimeType;this.data.appendChild(this._createSource(t,this.url,Array.isArray(e)?e[0]:e))}this.data.addEventListener("error",this._boundOnError,!1),this.data.addEventListener("load",this._boundComplete,!1),this.data.addEventListener("progress",this._boundOnProgress,!1),this.data.addEventListener("canplaythrough",this._boundComplete,!1),this.data.load(),this.timeout&&(this._elementTimer=setTimeout(this._boundOnTimeout,this.timeout))},r.prototype._loadXhr=function(){typeof this.xhrType!="string"&&(this.xhrType=this._determineXhrType());var t=this.xhr=new XMLHttpRequest;this.crossOrigin==="use-credentials"&&(t.withCredentials=!0),t.open("GET",this.url,!0),t.timeout=this.timeout,this.xhrType===r.XHR_RESPONSE_TYPE.JSON||this.xhrType===r.XHR_RESPONSE_TYPE.DOCUMENT?t.responseType=r.XHR_RESPONSE_TYPE.TEXT:t.responseType=this.xhrType,t.addEventListener("error",this._boundXhrOnError,!1),t.addEventListener("timeout",this._boundXhrOnTimeout,!1),t.addEventListener("abort",this._boundXhrOnAbort,!1),t.addEventListener("progress",this._boundOnProgress,!1),t.addEventListener("load",this._boundXhrOnLoad,!1),t.send()},r.prototype._loadXdr=function(){typeof this.xhrType!="string"&&(this.xhrType=this._determineXhrType());var t=this.xhr=new globalThis.XDomainRequest;t.timeout=this.timeout||5e3,t.onerror=this._boundXhrOnError,t.ontimeout=this._boundXhrOnTimeout,t.onprogress=this._boundOnProgress,t.onload=this._boundXhrOnLoad,t.open("GET",this.url,!0),setTimeout(function(){return t.send()},1)},r.prototype._createSource=function(t,e,n){n||(n=t+"/"+this._getExtension(e));var i=document.createElement("source");return i.src=e,i.type=n,i},r.prototype._onError=function(t){this.abort("Failed to load element using: "+t.target.nodeName)},r.prototype._onProgress=function(t){t&&t.lengthComputable&&this.onProgress.dispatch(this,t.loaded/t.total)},r.prototype._onTimeout=function(){this.abort("Load timed out.")},r.prototype._xhrOnError=function(){var t=this.xhr;this.abort(Oa(t)+" Request failed. Status: "+t.status+', text: "'+t.statusText+'"')},r.prototype._xhrOnTimeout=function(){var t=this.xhr;this.abort(Oa(t)+" Request timed out.")},r.prototype._xhrOnAbort=function(){var t=this.xhr;this.abort(Oa(t)+" Request was aborted by the user.")},r.prototype._xhrOnLoad=function(){var t=this.xhr,e="",n=typeof t.status>"u"?sl:t.status;(t.responseType===""||t.responseType==="text"||typeof t.responseType>"u")&&(e=t.responseText),n===$0&&(e.length>0||t.responseType===r.XHR_RESPONSE_TYPE.BUFFER)?n=sl:n===Z0&&(n=K0);var i=n/100|0;if(i===J0)if(this.xhrType===r.XHR_RESPONSE_TYPE.TEXT)this.data=e,this.type=r.TYPE.TEXT;else if(this.xhrType===r.XHR_RESPONSE_TYPE.JSON)try{this.data=JSON.parse(e),this.type=r.TYPE.JSON}catch(s){this.abort("Error trying to parse loaded json: "+s);return}else if(this.xhrType===r.XHR_RESPONSE_TYPE.DOCUMENT)try{if(globalThis.DOMParser){var o=new DOMParser;this.data=o.parseFromString(e,"text/xml")}else{var a=document.createElement("div");a.innerHTML=e,this.data=a}this.type=r.TYPE.XML}catch(s){this.abort("Error trying to parse loaded xml: "+s);return}else this.data=t.response||e;else{this.abort("["+t.status+"] "+t.statusText+": "+t.responseURL);return}this.complete()},r.prototype._determineCrossOrigin=function(t,e){if(t.indexOf("data:")===0)return"";if(globalThis.origin!==globalThis.location.origin)return"anonymous";e=e||globalThis.location,Pi||(Pi=document.createElement("a")),Pi.href=t;var n=al(Pi.href,{strictMode:!0}),i=!n.port&&e.port===""||n.port===e.port,o=n.protocol?n.protocol+":":"";return n.host!==e.hostname||!i||o!==e.protocol?"anonymous":""},r.prototype._determineXhrType=function(){return r._xhrTypeMap[this.extension]||r.XHR_RESPONSE_TYPE.TEXT},r.prototype._determineLoadType=function(){return r._loadTypeMap[this.extension]||r.LOAD_TYPE.XHR},r.prototype._getExtension=function(t){t===void 0&&(t=this.url);var e="";if(this.isDataUrl){var n=t.indexOf("/");e=t.substring(n+1,t.indexOf(";",n))}else{var i=t.indexOf("?"),o=t.indexOf("#"),a=Math.min(i>-1?i:t.length,o>-1?o:t.length);t=t.substring(0,a),e=t.substring(t.lastIndexOf(".")+1)}return e.toLowerCase()},r.prototype._getMimeFromXhrType=function(t){switch(t){case r.XHR_RESPONSE_TYPE.BUFFER:return"application/octet-binary";case r.XHR_RESPONSE_TYPE.BLOB:return"application/blob";case r.XHR_RESPONSE_TYPE.DOCUMENT:return"application/xml";case r.XHR_RESPONSE_TYPE.JSON:return"application/json";case r.XHR_RESPONSE_TYPE.DEFAULT:case r.XHR_RESPONSE_TYPE.TEXT:default:return"text/plain"}},r}();(function(r){(function(t){t[t.NONE=0]="NONE",t[t.DATA_URL=1]="DATA_URL",t[t.COMPLETE=2]="COMPLETE",t[t.LOADING=4]="LOADING"})(r.STATUS_FLAGS||(r.STATUS_FLAGS={})),function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.JSON=1]="JSON",t[t.XML=2]="XML",t[t.IMAGE=3]="IMAGE",t[t.AUDIO=4]="AUDIO",t[t.VIDEO=5]="VIDEO",t[t.TEXT=6]="TEXT"}(r.TYPE||(r.TYPE={})),function(t){t[t.XHR=1]="XHR",t[t.IMAGE=2]="IMAGE",t[t.AUDIO=3]="AUDIO",t[t.VIDEO=4]="VIDEO"}(r.LOAD_TYPE||(r.LOAD_TYPE={})),function(t){t.DEFAULT="text",t.BUFFER="arraybuffer",t.BLOB="blob",t.DOCUMENT="document",t.JSON="json",t.TEXT="text"}(r.XHR_RESPONSE_TYPE||(r.XHR_RESPONSE_TYPE={})),r._loadTypeMap={gif:r.LOAD_TYPE.IMAGE,png:r.LOAD_TYPE.IMAGE,bmp:r.LOAD_TYPE.IMAGE,jpg:r.LOAD_TYPE.IMAGE,jpeg:r.LOAD_TYPE.IMAGE,tif:r.LOAD_TYPE.IMAGE,tiff:r.LOAD_TYPE.IMAGE,webp:r.LOAD_TYPE.IMAGE,tga:r.LOAD_TYPE.IMAGE,avif:r.LOAD_TYPE.IMAGE,svg:r.LOAD_TYPE.IMAGE,"svg+xml":r.LOAD_TYPE.IMAGE,mp3:r.LOAD_TYPE.AUDIO,ogg:r.LOAD_TYPE.AUDIO,wav:r.LOAD_TYPE.AUDIO,mp4:r.LOAD_TYPE.VIDEO,webm:r.LOAD_TYPE.VIDEO},r._xhrTypeMap={xhtml:r.XHR_RESPONSE_TYPE.DOCUMENT,html:r.XHR_RESPONSE_TYPE.DOCUMENT,htm:r.XHR_RESPONSE_TYPE.DOCUMENT,xml:r.XHR_RESPONSE_TYPE.DOCUMENT,tmx:r.XHR_RESPONSE_TYPE.DOCUMENT,svg:r.XHR_RESPONSE_TYPE.DOCUMENT,tsx:r.XHR_RESPONSE_TYPE.DOCUMENT,gif:r.XHR_RESPONSE_TYPE.BLOB,png:r.XHR_RESPONSE_TYPE.BLOB,bmp:r.XHR_RESPONSE_TYPE.BLOB,jpg:r.XHR_RESPONSE_TYPE.BLOB,jpeg:r.XHR_RESPONSE_TYPE.BLOB,tif:r.XHR_RESPONSE_TYPE.BLOB,tiff:r.XHR_RESPONSE_TYPE.BLOB,webp:r.XHR_RESPONSE_TYPE.BLOB,tga:r.XHR_RESPONSE_TYPE.BLOB,avif:r.XHR_RESPONSE_TYPE.BLOB,json:r.XHR_RESPONSE_TYPE.JSON,text:r.XHR_RESPONSE_TYPE.TEXT,txt:r.XHR_RESPONSE_TYPE.TEXT,ttf:r.XHR_RESPONSE_TYPE.BUFFER,otf:r.XHR_RESPONSE_TYPE.BUFFER},r.EMPTY_GIF="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="})(Rt||(Rt={}));function dr(){}function Q0(r){return function(){for(var e=arguments,n=[],i=0;i<arguments.length;i++)n[i]=e[i];if(r===null)throw new Error("Callback was already called.");var o=r;r=null,o.apply(this,n)}}var tb=function(){function r(t,e){this.data=t,this.callback=e}return r}(),Ra=function(){function r(t,e){var n=this;if(e===void 0&&(e=1),this.workers=0,this.saturated=dr,this.unsaturated=dr,this.empty=dr,this.drain=dr,this.error=dr,this.started=!1,this.paused=!1,this._tasks=[],this._insert=function(i,o,a){if(a&&typeof a!="function")throw new Error("task callback must be a function");if(n.started=!0,i==null&&n.idle()){setTimeout(function(){return n.drain()},1);return}var s=new tb(i,typeof a=="function"?a:dr);o?n._tasks.unshift(s):n._tasks.push(s),setTimeout(n.process,1)},this.process=function(){for(;!n.paused&&n.workers<n.concurrency&&n._tasks.length;){var i=n._tasks.shift();n._tasks.length===0&&n.empty(),n.workers+=1,n.workers===n.concurrency&&n.saturated(),n._worker(i.data,Q0(n._next(i)))}},this._worker=t,e===0)throw new Error("Concurrency must not be zero");this.concurrency=e,this.buffer=e/4}return r.prototype._next=function(t){var e=this;return function(){for(var n=arguments,i=[],o=0;o<arguments.length;o++)i[o]=n[o];e.workers-=1,t.callback.apply(t,i),i[0]!=null&&e.error(i[0],t.data),e.workers<=e.concurrency-e.buffer&&e.unsaturated(),e.idle()&&e.drain(),e.process()}},r.prototype.push=function(t,e){this._insert(t,!1,e)},r.prototype.kill=function(){this.workers=0,this.drain=dr,this.started=!1,this._tasks=[]},r.prototype.unshift=function(t,e){this._insert(t,!0,e)},r.prototype.length=function(){return this._tasks.length},r.prototype.running=function(){return this.workers},r.prototype.idle=function(){return this._tasks.length+this.workers===0},r.prototype.pause=function(){this.paused!==!0&&(this.paused=!0)},r.prototype.resume=function(){if(this.paused!==!1){this.paused=!1;for(var t=1;t<=this.concurrency;t++)this.process()}},r.eachSeries=function(t,e,n,i){var o=0,a=t.length;function s(u){if(u||o===a){n&&n(u);return}i?setTimeout(function(){e(t[o++],s)},1):e(t[o++],s)}s()},r.queue=function(t,e){return new r(t,e)},r}(),Ia=100,eb=/(#[\w-]+)?$/,Oi=function(){function r(t,e){var n=this;t===void 0&&(t=""),e===void 0&&(e=10),this.progress=0,this.loading=!1,this.defaultQueryString="",this._beforeMiddleware=[],this._afterMiddleware=[],this._resourcesParsing=[],this._boundLoadResource=function(u,h){return n._loadResource(u,h)},this.resources={},this.baseUrl=t,this._beforeMiddleware=[],this._afterMiddleware=[],this._resourcesParsing=[],this._boundLoadResource=function(u,h){return n._loadResource(u,h)},this._queue=Ra.queue(this._boundLoadResource,e),this._queue.pause(),this.resources={},this.onProgress=new Ce,this.onError=new Ce,this.onLoad=new Ce,this.onStart=new Ce,this.onComplete=new Ce;for(var i=0;i<r._plugins.length;++i){var o=r._plugins[i],a=o.pre,s=o.use;a&&this.pre(a),s&&this.use(s)}this._protected=!1}return r.prototype._add=function(t,e,n,i){if(this.loading&&(!n||!n.parentResource))throw new Error("Cannot add resources while the loader is running.");if(this.resources[t])throw new Error('Resource named "'+t+'" already exists.');if(e=this._prepareUrl(e),this.resources[t]=new Rt(t,e,n),typeof i=="function"&&this.resources[t].onAfterMiddleware.once(i),this.loading){for(var o=n.parentResource,a=[],s=0;s<o.children.length;++s)o.children[s].isComplete||a.push(o.children[s]);var u=o.progressChunk*(a.length+1),h=u/(a.length+2);o.children.push(this.resources[t]),o.progressChunk=h;for(var s=0;s<a.length;++s)a[s].progressChunk=h;this.resources[t].progressChunk=h}return this._queue.push(this.resources[t]),this},r.prototype.pre=function(t){return this._beforeMiddleware.push(t),this},r.prototype.use=function(t){return this._afterMiddleware.push(t),this},r.prototype.reset=function(){this.progress=0,this.loading=!1,this._queue.kill(),this._queue.pause();for(var t in this.resources){var e=this.resources[t];e._onLoadBinding&&e._onLoadBinding.detach(),e.isLoading&&e.abort("loader reset")}return this.resources={},this},r.prototype.load=function(t){if(le("6.5.0","@pixi/loaders is being replaced with @pixi/assets in the next major release."),typeof t=="function"&&this.onComplete.once(t),this.loading)return this;if(this._queue.idle())this._onStart(),this._onComplete();else{for(var e=this._queue._tasks.length,n=Ia/e,i=0;i<this._queue._tasks.length;++i)this._queue._tasks[i].data.progressChunk=n;this._onStart(),this._queue.resume()}return this},Object.defineProperty(r.prototype,"concurrency",{get:function(){return this._queue.concurrency},set:function(t){this._queue.concurrency=t},enumerable:!1,configurable:!0}),r.prototype._prepareUrl=function(t){var e=al(t,{strictMode:!0}),n;if(e.protocol||!e.path||t.indexOf("//")===0?n=t:this.baseUrl.length&&this.baseUrl.lastIndexOf("/")!==this.baseUrl.length-1&&t.charAt(0)!=="/"?n=this.baseUrl+"/"+t:n=this.baseUrl+t,this.defaultQueryString){var i=eb.exec(n)[0];n=n.slice(0,n.length-i.length),n.indexOf("?")!==-1?n+="&"+this.defaultQueryString:n+="?"+this.defaultQueryString,n+=i}return n},r.prototype._loadResource=function(t,e){var n=this;t._dequeue=e,Ra.eachSeries(this._beforeMiddleware,function(i,o){i.call(n,t,function(){o(t.isComplete?{}:null)})},function(){t.isComplete?n._onLoad(t):(t._onLoadBinding=t.onComplete.once(n._onLoad,n),t.load())},!0)},r.prototype._onStart=function(){this.progress=0,this.loading=!0,this.onStart.dispatch(this)},r.prototype._onComplete=function(){this.progress=Ia,this.loading=!1,this.onComplete.dispatch(this,this.resources)},r.prototype._onLoad=function(t){var e=this;t._onLoadBinding=null,this._resourcesParsing.push(t),t._dequeue(),Ra.eachSeries(this._afterMiddleware,function(n,i){n.call(e,t,i)},function(){t.onAfterMiddleware.dispatch(t),e.progress=Math.min(Ia,e.progress+t.progressChunk),e.onProgress.dispatch(e,t),t.error?e.onError.dispatch(t.error,e,t):e.onLoad.dispatch(e,t),e._resourcesParsing.splice(e._resourcesParsing.indexOf(t),1),e._queue.idle()&&e._resourcesParsing.length===0&&e._onComplete()},!0)},r.prototype.destroy=function(){this._protected||this.reset()},Object.defineProperty(r,"shared",{get:function(){var t=r._shared;return t||(t=new r,t._protected=!0,r._shared=t),t},enumerable:!1,configurable:!0}),r.registerPlugin=function(t){return le("6.5.0","Loader.registerPlugin() is deprecated, use extensions.add() instead."),Re.add({type:mt.Loader,ref:t}),r},r._plugins=[],r}();Re.handleByList(mt.Loader,Oi._plugins),Oi.prototype.add=function(t,e,n,i){if(Array.isArray(t)){for(var o=0;o<t.length;++o)this.add(t[o]);return this}if(typeof t=="object"&&(n=t,i=e||n.callback||n.onComplete,e=n.url,t=n.name||n.key||n.url),typeof e!="string"&&(i=n,n=e,e=t),typeof e!="string")throw new Error("No url passed to add resource to loader.");return typeof n=="function"&&(i=n,n=null),this._add(t,e,n,i)};var rb=function(){function r(){}return r.init=function(t){t=Object.assign({sharedLoader:!1},t),this.loader=t.sharedLoader?Oi.shared:new Oi},r.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},r.extension=mt.Application,r}(),nb=function(){function r(){}return r.add=function(){Rt.setExtensionLoadType("svg",Rt.LOAD_TYPE.XHR),Rt.setExtensionXhrType("svg",Rt.XHR_RESPONSE_TYPE.TEXT)},r.use=function(t,e){if(t.data&&(t.type===Rt.TYPE.IMAGE||t.extension==="svg")){var n=t.data,i=t.url,o=t.name,a=t.metadata;J.fromLoader(n,i,o,a).then(function(s){t.texture=s,e()}).catch(e)}else e()},r.extension=mt.Loader,r}(),ib="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function ob(r){for(var t="",e=0;e<r.length;){for(var n=[0,0,0],i=[0,0,0,0],o=0;o<n.length;++o)e<r.length?n[o]=r.charCodeAt(e++)&255:n[o]=0;i[0]=n[0]>>2,i[1]=(n[0]&3)<<4|n[1]>>4,i[2]=(n[1]&15)<<2|n[2]>>6,i[3]=n[2]&63;var a=e-(r.length-1);switch(a){case 2:i[3]=64,i[2]=64;break;case 1:i[3]=64;break}for(var o=0;o<i.length;++o)t+=ib.charAt(i[o])}return t}function ab(r,t){if(!r.data){t();return}if(r.xhr&&r.xhrType===Rt.XHR_RESPONSE_TYPE.BLOB){if(!self.Blob||typeof r.data=="string"){var e=r.xhr.getResponseHeader("content-type");if(e&&e.indexOf("image")===0){r.data=new Image,r.data.src="data:"+e+";base64,"+ob(r.xhr.responseText),r.type=Rt.TYPE.IMAGE,r.data.onload=function(){r.data.onload=null,t()};return}}else if(r.data.type.indexOf("image")===0){var n=globalThis.URL||globalThis.webkitURL,i=n.createObjectURL(r.data);r.blob=r.data,r.data=new Image,r.data.src=i,r.type=Rt.TYPE.IMAGE,r.data.onload=function(){n.revokeObjectURL(i),r.data.onload=null,t()};return}}t()}var sb=function(){function r(){}return r.extension=mt.Loader,r.use=ab,r}();Re.add(nb,sb);/*!
635
- * @pixi/compressed-textures - v6.5.10
636
- * Compiled Thu, 06 Jul 2023 15:25:11 UTC
637
- *
638
- * @pixi/compressed-textures is licensed under the MIT License.
639
- * http://www.opensource.org/licenses/mit-license
640
- */var pt,et;(function(r){r[r.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",r[r.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",r[r.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",r[r.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",r[r.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",r[r.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",r[r.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",r[r.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",r[r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",r[r.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",r[r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",r[r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",r[r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",r[r.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",r[r.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",r[r.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",r[r.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",r[r.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR"})(et||(et={}));var Ri=(pt={},pt[et.COMPRESSED_RGB_S3TC_DXT1_EXT]=.5,pt[et.COMPRESSED_RGBA_S3TC_DXT1_EXT]=.5,pt[et.COMPRESSED_RGBA_S3TC_DXT3_EXT]=1,pt[et.COMPRESSED_RGBA_S3TC_DXT5_EXT]=1,pt[et.COMPRESSED_SRGB_S3TC_DXT1_EXT]=.5,pt[et.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT]=.5,pt[et.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT]=1,pt[et.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT]=1,pt[et.COMPRESSED_R11_EAC]=.5,pt[et.COMPRESSED_SIGNED_R11_EAC]=.5,pt[et.COMPRESSED_RG11_EAC]=1,pt[et.COMPRESSED_SIGNED_RG11_EAC]=1,pt[et.COMPRESSED_RGB8_ETC2]=.5,pt[et.COMPRESSED_RGBA8_ETC2_EAC]=1,pt[et.COMPRESSED_SRGB8_ETC2]=.5,pt[et.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC]=1,pt[et.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2]=.5,pt[et.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2]=.5,pt[et.COMPRESSED_RGB_PVRTC_4BPPV1_IMG]=.5,pt[et.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG]=.5,pt[et.COMPRESSED_RGB_PVRTC_2BPPV1_IMG]=.25,pt[et.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG]=.25,pt[et.COMPRESSED_RGB_ETC1_WEBGL]=.5,pt[et.COMPRESSED_RGB_ATC_WEBGL]=.5,pt[et.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL]=1,pt[et.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL]=1,pt[et.COMPRESSED_RGBA_ASTC_4x4_KHR]=1,pt);/*! *****************************************************************************
641
- Copyright (c) Microsoft Corporation.
642
-
643
- Permission to use, copy, modify, and/or distribute this software for any
644
- purpose with or without fee is hereby granted.
645
-
646
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
647
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
648
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
649
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
650
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
651
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
652
- PERFORMANCE OF THIS SOFTWARE.
653
- ***************************************************************************** */var Ca=function(r,t){return Ca=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var i in n)n.hasOwnProperty(i)&&(e[i]=n[i])},Ca(r,t)};function ll(r,t){Ca(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function ub(r,t,e,n){function i(o){return o instanceof e?o:new e(function(a){a(o)})}return new(e||(e=Promise))(function(o,a){function s(l){try{h(n.next(l))}catch(f){a(f)}}function u(l){try{h(n.throw(l))}catch(f){a(f)}}function h(l){l.done?o(l.value):i(l.value).then(s,u)}h((n=n.apply(r,t||[])).next())})}function hb(r,t){var e={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(h){return function(l){return u([h,l])}}function u(h){if(n)throw new TypeError("Generator is already executing.");for(;e;)try{if(n=1,i&&(o=h[0]&2?i.return:h[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,h[1])).done)return o;switch(i=0,o&&(h=[h[0]&2,o.value]),h[0]){case 0:case 1:o=h;break;case 4:return e.label++,{value:h[1],done:!1};case 5:e.label++,i=h[1],h=[0];continue;case 7:h=e.ops.pop(),e.trys.pop();continue;default:if(o=e.trys,!(o=o.length>0&&o[o.length-1])&&(h[0]===6||h[0]===2)){e=0;continue}if(h[0]===3&&(!o||h[1]>o[0]&&h[1]<o[3])){e.label=h[1];break}if(h[0]===6&&e.label<o[1]){e.label=o[1],o=h;break}if(o&&e.label<o[2]){e.label=o[2],e.ops.push(h);break}o[2]&&e.ops.pop(),e.trys.pop();continue}h=t.call(r,e)}catch(l){h=[6,l],i=0}finally{n=o=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}var lb=function(r){ll(t,r);function t(e,n){n===void 0&&(n={width:1,height:1,autoLoad:!0});var i=this,o,a;return typeof e=="string"?(o=e,a=new Uint8Array):(o=null,a=e),i=r.call(this,a,n)||this,i.origin=o,i.buffer=a?new wa(a):null,i.origin&&n.autoLoad!==!1&&i.load(),a&&a.length&&(i.loaded=!0,i.onBlobLoaded(i.buffer.rawBinaryData)),i}return t.prototype.onBlobLoaded=function(e){},t.prototype.load=function(){return ub(this,void 0,Promise,function(){var e,n,i;return hb(this,function(o){switch(o.label){case 0:return[4,fetch(this.origin)];case 1:return e=o.sent(),[4,e.blob()];case 2:return n=o.sent(),[4,n.arrayBuffer()];case 3:return i=o.sent(),this.data=new Uint32Array(i),this.buffer=new wa(i),this.loaded=!0,this.onBlobLoaded(i),this.update(),[2,this]}})})},t}(bn),Ma=function(r){ll(t,r);function t(e,n){var i=r.call(this,e,n)||this;return i.format=n.format,i.levels=n.levels||1,i._width=n.width,i._height=n.height,i._extension=t._formatToExtension(i.format),(n.levelBuffers||i.buffer)&&(i._levelBuffers=n.levelBuffers||t._createLevelBuffers(e instanceof Uint8Array?e:i.buffer.uint8View,i.format,i.levels,4,4,i.width,i.height)),i}return t.prototype.upload=function(e,n,i){var o=e.gl,a=e.context.extensions[this._extension];if(!a)throw new Error(this._extension+" textures are not supported on the current machine");if(!this._levelBuffers)return!1;for(var s=0,u=this.levels;s<u;s++){var h=this._levelBuffers[s],l=h.levelID,f=h.levelWidth,c=h.levelHeight,d=h.levelBuffer;o.compressedTexImage2D(o.TEXTURE_2D,l,this.format,f,c,0,d)}return!0},t.prototype.onBlobLoaded=function(){this._levelBuffers=t._createLevelBuffers(this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height)},t._formatToExtension=function(e){if(e>=33776&&e<=33779)return"s3tc";if(e>=37488&&e<=37497)return"etc";if(e>=35840&&e<=35843)return"pvrtc";if(e>=36196)return"etc1";if(e>=35986&&e<=34798)return"atc";throw new Error("Invalid (compressed) texture format given!")},t._createLevelBuffers=function(e,n,i,o,a,s,u){for(var h=new Array(i),l=e.byteOffset,f=s,c=u,d=f+o-1&~(o-1),p=c+a-1&~(a-1),v=d*p*Ri[n],_=0;_<i;_++)h[_]={levelID:_,levelWidth:i>1?f:d,levelHeight:i>1?c:p,levelBuffer:new Uint8Array(e.buffer,l,v)},l+=v,f=f>>1||1,c=c>>1||1,d=f+o-1&~(o-1),p=c+a-1&~(a-1),v=d*p*Ri[n];return h},t}(lb),fb=function(){function r(){}return r.use=function(t,e){var n=t.data,i=this;if(t.type===Rt.TYPE.JSON&&n&&n.cacheID&&n.textures){for(var o=n.textures,a=void 0,s=void 0,u=0,h=o.length;u<h;u++){var l=o[u],f=l.src,c=l.format;if(c||(s=f),r.textureFormats[c]){a=f;break}}if(a=a||s,!a){e(new Error("Cannot load compressed-textures in "+t.url+", make sure you provide a fallback"));return}if(a===t.url){e(new Error("URL of compressed texture cannot be the same as the manifest's URL"));return}var d={crossOrigin:t.crossOrigin,metadata:t.metadata.imageMetadata,parentResource:t},p=Lr.resolve(t.url.replace(i.baseUrl,""),a),v=n.cacheID;i.add(v,p,d,function(_){if(_.error){e(_.error);return}var m=_.texture,g=m===void 0?null:m,y=_.textures,E=y===void 0?{}:y;Object.assign(t,{texture:g,textures:E}),e()})}else e()},Object.defineProperty(r,"textureExtensions",{get:function(){if(!r._textureExtensions){var t=k.ADAPTER.createCanvas(),e=t.getContext("webgl");if(!e)return console.warn("WebGL not available for compressed textures. Silently failing."),{};var n={s3tc:e.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:e.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:e.getExtension("WEBGL_compressed_texture_etc"),etc1:e.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:e.getExtension("WEBGL_compressed_texture_atc"),astc:e.getExtension("WEBGL_compressed_texture_astc")};r._textureExtensions=n}return r._textureExtensions},enumerable:!1,configurable:!0}),Object.defineProperty(r,"textureFormats",{get:function(){if(!r._textureFormats){var t=r.textureExtensions;r._textureFormats={};for(var e in t){var n=t[e];n&&Object.assign(r._textureFormats,Object.getPrototypeOf(n))}}return r._textureFormats},enumerable:!1,configurable:!0}),r.extension=mt.Loader,r}();function fl(r,t,e){var n={textures:{},texture:null};if(!t)return n;var i=t.map(function(o){return new J(new ut(o,Object.assign({mipmap:ae.OFF,alphaMode:se.NO_PREMULTIPLIED_ALPHA},e)))});return i.forEach(function(o,a){var s=o.baseTexture,u=r+"-"+(a+1);ut.addToCache(s,u),J.addToCache(o,u),a===0&&(ut.addToCache(s,r),J.addToCache(o,r),n.texture=o),n.textures[u]=o}),n}var An,fe,Da=4,Ii=124,cb=32,cl=20,db=542327876,Ci={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},pb={SIZE:0,FLAGS:1,FOURCC:2,RGB_BITCOUNT:3,R_BIT_MASK:4,G_BIT_MASK:5,B_BIT_MASK:6,A_BIT_MASK:7},Mi={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},ce;(function(r){r[r.DXGI_FORMAT_UNKNOWN=0]="DXGI_FORMAT_UNKNOWN",r[r.DXGI_FORMAT_R32G32B32A32_TYPELESS=1]="DXGI_FORMAT_R32G32B32A32_TYPELESS",r[r.DXGI_FORMAT_R32G32B32A32_FLOAT=2]="DXGI_FORMAT_R32G32B32A32_FLOAT",r[r.DXGI_FORMAT_R32G32B32A32_UINT=3]="DXGI_FORMAT_R32G32B32A32_UINT",r[r.DXGI_FORMAT_R32G32B32A32_SINT=4]="DXGI_FORMAT_R32G32B32A32_SINT",r[r.DXGI_FORMAT_R32G32B32_TYPELESS=5]="DXGI_FORMAT_R32G32B32_TYPELESS",r[r.DXGI_FORMAT_R32G32B32_FLOAT=6]="DXGI_FORMAT_R32G32B32_FLOAT",r[r.DXGI_FORMAT_R32G32B32_UINT=7]="DXGI_FORMAT_R32G32B32_UINT",r[r.DXGI_FORMAT_R32G32B32_SINT=8]="DXGI_FORMAT_R32G32B32_SINT",r[r.DXGI_FORMAT_R16G16B16A16_TYPELESS=9]="DXGI_FORMAT_R16G16B16A16_TYPELESS",r[r.DXGI_FORMAT_R16G16B16A16_FLOAT=10]="DXGI_FORMAT_R16G16B16A16_FLOAT",r[r.DXGI_FORMAT_R16G16B16A16_UNORM=11]="DXGI_FORMAT_R16G16B16A16_UNORM",r[r.DXGI_FORMAT_R16G16B16A16_UINT=12]="DXGI_FORMAT_R16G16B16A16_UINT",r[r.DXGI_FORMAT_R16G16B16A16_SNORM=13]="DXGI_FORMAT_R16G16B16A16_SNORM",r[r.DXGI_FORMAT_R16G16B16A16_SINT=14]="DXGI_FORMAT_R16G16B16A16_SINT",r[r.DXGI_FORMAT_R32G32_TYPELESS=15]="DXGI_FORMAT_R32G32_TYPELESS",r[r.DXGI_FORMAT_R32G32_FLOAT=16]="DXGI_FORMAT_R32G32_FLOAT",r[r.DXGI_FORMAT_R32G32_UINT=17]="DXGI_FORMAT_R32G32_UINT",r[r.DXGI_FORMAT_R32G32_SINT=18]="DXGI_FORMAT_R32G32_SINT",r[r.DXGI_FORMAT_R32G8X24_TYPELESS=19]="DXGI_FORMAT_R32G8X24_TYPELESS",r[r.DXGI_FORMAT_D32_FLOAT_S8X24_UINT=20]="DXGI_FORMAT_D32_FLOAT_S8X24_UINT",r[r.DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS=21]="DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS",r[r.DXGI_FORMAT_X32_TYPELESS_G8X24_UINT=22]="DXGI_FORMAT_X32_TYPELESS_G8X24_UINT",r[r.DXGI_FORMAT_R10G10B10A2_TYPELESS=23]="DXGI_FORMAT_R10G10B10A2_TYPELESS",r[r.DXGI_FORMAT_R10G10B10A2_UNORM=24]="DXGI_FORMAT_R10G10B10A2_UNORM",r[r.DXGI_FORMAT_R10G10B10A2_UINT=25]="DXGI_FORMAT_R10G10B10A2_UINT",r[r.DXGI_FORMAT_R11G11B10_FLOAT=26]="DXGI_FORMAT_R11G11B10_FLOAT",r[r.DXGI_FORMAT_R8G8B8A8_TYPELESS=27]="DXGI_FORMAT_R8G8B8A8_TYPELESS",r[r.DXGI_FORMAT_R8G8B8A8_UNORM=28]="DXGI_FORMAT_R8G8B8A8_UNORM",r[r.DXGI_FORMAT_R8G8B8A8_UNORM_SRGB=29]="DXGI_FORMAT_R8G8B8A8_UNORM_SRGB",r[r.DXGI_FORMAT_R8G8B8A8_UINT=30]="DXGI_FORMAT_R8G8B8A8_UINT",r[r.DXGI_FORMAT_R8G8B8A8_SNORM=31]="DXGI_FORMAT_R8G8B8A8_SNORM",r[r.DXGI_FORMAT_R8G8B8A8_SINT=32]="DXGI_FORMAT_R8G8B8A8_SINT",r[r.DXGI_FORMAT_R16G16_TYPELESS=33]="DXGI_FORMAT_R16G16_TYPELESS",r[r.DXGI_FORMAT_R16G16_FLOAT=34]="DXGI_FORMAT_R16G16_FLOAT",r[r.DXGI_FORMAT_R16G16_UNORM=35]="DXGI_FORMAT_R16G16_UNORM",r[r.DXGI_FORMAT_R16G16_UINT=36]="DXGI_FORMAT_R16G16_UINT",r[r.DXGI_FORMAT_R16G16_SNORM=37]="DXGI_FORMAT_R16G16_SNORM",r[r.DXGI_FORMAT_R16G16_SINT=38]="DXGI_FORMAT_R16G16_SINT",r[r.DXGI_FORMAT_R32_TYPELESS=39]="DXGI_FORMAT_R32_TYPELESS",r[r.DXGI_FORMAT_D32_FLOAT=40]="DXGI_FORMAT_D32_FLOAT",r[r.DXGI_FORMAT_R32_FLOAT=41]="DXGI_FORMAT_R32_FLOAT",r[r.DXGI_FORMAT_R32_UINT=42]="DXGI_FORMAT_R32_UINT",r[r.DXGI_FORMAT_R32_SINT=43]="DXGI_FORMAT_R32_SINT",r[r.DXGI_FORMAT_R24G8_TYPELESS=44]="DXGI_FORMAT_R24G8_TYPELESS",r[r.DXGI_FORMAT_D24_UNORM_S8_UINT=45]="DXGI_FORMAT_D24_UNORM_S8_UINT",r[r.DXGI_FORMAT_R24_UNORM_X8_TYPELESS=46]="DXGI_FORMAT_R24_UNORM_X8_TYPELESS",r[r.DXGI_FORMAT_X24_TYPELESS_G8_UINT=47]="DXGI_FORMAT_X24_TYPELESS_G8_UINT",r[r.DXGI_FORMAT_R8G8_TYPELESS=48]="DXGI_FORMAT_R8G8_TYPELESS",r[r.DXGI_FORMAT_R8G8_UNORM=49]="DXGI_FORMAT_R8G8_UNORM",r[r.DXGI_FORMAT_R8G8_UINT=50]="DXGI_FORMAT_R8G8_UINT",r[r.DXGI_FORMAT_R8G8_SNORM=51]="DXGI_FORMAT_R8G8_SNORM",r[r.DXGI_FORMAT_R8G8_SINT=52]="DXGI_FORMAT_R8G8_SINT",r[r.DXGI_FORMAT_R16_TYPELESS=53]="DXGI_FORMAT_R16_TYPELESS",r[r.DXGI_FORMAT_R16_FLOAT=54]="DXGI_FORMAT_R16_FLOAT",r[r.DXGI_FORMAT_D16_UNORM=55]="DXGI_FORMAT_D16_UNORM",r[r.DXGI_FORMAT_R16_UNORM=56]="DXGI_FORMAT_R16_UNORM",r[r.DXGI_FORMAT_R16_UINT=57]="DXGI_FORMAT_R16_UINT",r[r.DXGI_FORMAT_R16_SNORM=58]="DXGI_FORMAT_R16_SNORM",r[r.DXGI_FORMAT_R16_SINT=59]="DXGI_FORMAT_R16_SINT",r[r.DXGI_FORMAT_R8_TYPELESS=60]="DXGI_FORMAT_R8_TYPELESS",r[r.DXGI_FORMAT_R8_UNORM=61]="DXGI_FORMAT_R8_UNORM",r[r.DXGI_FORMAT_R8_UINT=62]="DXGI_FORMAT_R8_UINT",r[r.DXGI_FORMAT_R8_SNORM=63]="DXGI_FORMAT_R8_SNORM",r[r.DXGI_FORMAT_R8_SINT=64]="DXGI_FORMAT_R8_SINT",r[r.DXGI_FORMAT_A8_UNORM=65]="DXGI_FORMAT_A8_UNORM",r[r.DXGI_FORMAT_R1_UNORM=66]="DXGI_FORMAT_R1_UNORM",r[r.DXGI_FORMAT_R9G9B9E5_SHAREDEXP=67]="DXGI_FORMAT_R9G9B9E5_SHAREDEXP",r[r.DXGI_FORMAT_R8G8_B8G8_UNORM=68]="DXGI_FORMAT_R8G8_B8G8_UNORM",r[r.DXGI_FORMAT_G8R8_G8B8_UNORM=69]="DXGI_FORMAT_G8R8_G8B8_UNORM",r[r.DXGI_FORMAT_BC1_TYPELESS=70]="DXGI_FORMAT_BC1_TYPELESS",r[r.DXGI_FORMAT_BC1_UNORM=71]="DXGI_FORMAT_BC1_UNORM",r[r.DXGI_FORMAT_BC1_UNORM_SRGB=72]="DXGI_FORMAT_BC1_UNORM_SRGB",r[r.DXGI_FORMAT_BC2_TYPELESS=73]="DXGI_FORMAT_BC2_TYPELESS",r[r.DXGI_FORMAT_BC2_UNORM=74]="DXGI_FORMAT_BC2_UNORM",r[r.DXGI_FORMAT_BC2_UNORM_SRGB=75]="DXGI_FORMAT_BC2_UNORM_SRGB",r[r.DXGI_FORMAT_BC3_TYPELESS=76]="DXGI_FORMAT_BC3_TYPELESS",r[r.DXGI_FORMAT_BC3_UNORM=77]="DXGI_FORMAT_BC3_UNORM",r[r.DXGI_FORMAT_BC3_UNORM_SRGB=78]="DXGI_FORMAT_BC3_UNORM_SRGB",r[r.DXGI_FORMAT_BC4_TYPELESS=79]="DXGI_FORMAT_BC4_TYPELESS",r[r.DXGI_FORMAT_BC4_UNORM=80]="DXGI_FORMAT_BC4_UNORM",r[r.DXGI_FORMAT_BC4_SNORM=81]="DXGI_FORMAT_BC4_SNORM",r[r.DXGI_FORMAT_BC5_TYPELESS=82]="DXGI_FORMAT_BC5_TYPELESS",r[r.DXGI_FORMAT_BC5_UNORM=83]="DXGI_FORMAT_BC5_UNORM",r[r.DXGI_FORMAT_BC5_SNORM=84]="DXGI_FORMAT_BC5_SNORM",r[r.DXGI_FORMAT_B5G6R5_UNORM=85]="DXGI_FORMAT_B5G6R5_UNORM",r[r.DXGI_FORMAT_B5G5R5A1_UNORM=86]="DXGI_FORMAT_B5G5R5A1_UNORM",r[r.DXGI_FORMAT_B8G8R8A8_UNORM=87]="DXGI_FORMAT_B8G8R8A8_UNORM",r[r.DXGI_FORMAT_B8G8R8X8_UNORM=88]="DXGI_FORMAT_B8G8R8X8_UNORM",r[r.DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM=89]="DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM",r[r.DXGI_FORMAT_B8G8R8A8_TYPELESS=90]="DXGI_FORMAT_B8G8R8A8_TYPELESS",r[r.DXGI_FORMAT_B8G8R8A8_UNORM_SRGB=91]="DXGI_FORMAT_B8G8R8A8_UNORM_SRGB",r[r.DXGI_FORMAT_B8G8R8X8_TYPELESS=92]="DXGI_FORMAT_B8G8R8X8_TYPELESS",r[r.DXGI_FORMAT_B8G8R8X8_UNORM_SRGB=93]="DXGI_FORMAT_B8G8R8X8_UNORM_SRGB",r[r.DXGI_FORMAT_BC6H_TYPELESS=94]="DXGI_FORMAT_BC6H_TYPELESS",r[r.DXGI_FORMAT_BC6H_UF16=95]="DXGI_FORMAT_BC6H_UF16",r[r.DXGI_FORMAT_BC6H_SF16=96]="DXGI_FORMAT_BC6H_SF16",r[r.DXGI_FORMAT_BC7_TYPELESS=97]="DXGI_FORMAT_BC7_TYPELESS",r[r.DXGI_FORMAT_BC7_UNORM=98]="DXGI_FORMAT_BC7_UNORM",r[r.DXGI_FORMAT_BC7_UNORM_SRGB=99]="DXGI_FORMAT_BC7_UNORM_SRGB",r[r.DXGI_FORMAT_AYUV=100]="DXGI_FORMAT_AYUV",r[r.DXGI_FORMAT_Y410=101]="DXGI_FORMAT_Y410",r[r.DXGI_FORMAT_Y416=102]="DXGI_FORMAT_Y416",r[r.DXGI_FORMAT_NV12=103]="DXGI_FORMAT_NV12",r[r.DXGI_FORMAT_P010=104]="DXGI_FORMAT_P010",r[r.DXGI_FORMAT_P016=105]="DXGI_FORMAT_P016",r[r.DXGI_FORMAT_420_OPAQUE=106]="DXGI_FORMAT_420_OPAQUE",r[r.DXGI_FORMAT_YUY2=107]="DXGI_FORMAT_YUY2",r[r.DXGI_FORMAT_Y210=108]="DXGI_FORMAT_Y210",r[r.DXGI_FORMAT_Y216=109]="DXGI_FORMAT_Y216",r[r.DXGI_FORMAT_NV11=110]="DXGI_FORMAT_NV11",r[r.DXGI_FORMAT_AI44=111]="DXGI_FORMAT_AI44",r[r.DXGI_FORMAT_IA44=112]="DXGI_FORMAT_IA44",r[r.DXGI_FORMAT_P8=113]="DXGI_FORMAT_P8",r[r.DXGI_FORMAT_A8P8=114]="DXGI_FORMAT_A8P8",r[r.DXGI_FORMAT_B4G4R4A4_UNORM=115]="DXGI_FORMAT_B4G4R4A4_UNORM",r[r.DXGI_FORMAT_P208=116]="DXGI_FORMAT_P208",r[r.DXGI_FORMAT_V208=117]="DXGI_FORMAT_V208",r[r.DXGI_FORMAT_V408=118]="DXGI_FORMAT_V408",r[r.DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE=119]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE",r[r.DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE=120]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE",r[r.DXGI_FORMAT_FORCE_UINT=121]="DXGI_FORMAT_FORCE_UINT"})(ce||(ce={}));var Fa;(function(r){r[r.DDS_DIMENSION_TEXTURE1D=2]="DDS_DIMENSION_TEXTURE1D",r[r.DDS_DIMENSION_TEXTURE2D=3]="DDS_DIMENSION_TEXTURE2D",r[r.DDS_DIMENSION_TEXTURE3D=6]="DDS_DIMENSION_TEXTURE3D"})(Fa||(Fa={}));var vb=1,_b=2,mb=4,gb=64,yb=512,bb=131072,xb=827611204,Eb=861165636,Tb=894720068,wb=808540228,Sb=4,Ab=(An={},An[xb]=et.COMPRESSED_RGBA_S3TC_DXT1_EXT,An[Eb]=et.COMPRESSED_RGBA_S3TC_DXT3_EXT,An[Tb]=et.COMPRESSED_RGBA_S3TC_DXT5_EXT,An),Pb=(fe={},fe[ce.DXGI_FORMAT_BC1_TYPELESS]=et.COMPRESSED_RGBA_S3TC_DXT1_EXT,fe[ce.DXGI_FORMAT_BC1_UNORM]=et.COMPRESSED_RGBA_S3TC_DXT1_EXT,fe[ce.DXGI_FORMAT_BC2_TYPELESS]=et.COMPRESSED_RGBA_S3TC_DXT3_EXT,fe[ce.DXGI_FORMAT_BC2_UNORM]=et.COMPRESSED_RGBA_S3TC_DXT3_EXT,fe[ce.DXGI_FORMAT_BC3_TYPELESS]=et.COMPRESSED_RGBA_S3TC_DXT5_EXT,fe[ce.DXGI_FORMAT_BC3_UNORM]=et.COMPRESSED_RGBA_S3TC_DXT5_EXT,fe[ce.DXGI_FORMAT_BC1_UNORM_SRGB]=et.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,fe[ce.DXGI_FORMAT_BC2_UNORM_SRGB]=et.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,fe[ce.DXGI_FORMAT_BC3_UNORM_SRGB]=et.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,fe);function Ob(r){var t=new Uint32Array(r),e=t[0];if(e!==db)throw new Error("Invalid DDS file magic word");var n=new Uint32Array(r,0,Ii/Uint32Array.BYTES_PER_ELEMENT),i=n[Ci.HEIGHT],o=n[Ci.WIDTH],a=n[Ci.MIPMAP_COUNT],s=new Uint32Array(r,Ci.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,cb/Uint32Array.BYTES_PER_ELEMENT),u=s[vb];if(u&mb){var h=s[pb.FOURCC];if(h!==wb){var l=Ab[h],f=Da+Ii,c=new Uint8Array(r,f),d=new Ma(c,{format:l,width:o,height:i,levels:a});return[d]}var p=Da+Ii,v=new Uint32Array(t.buffer,p,cl/Uint32Array.BYTES_PER_ELEMENT),_=v[Mi.DXGI_FORMAT],m=v[Mi.RESOURCE_DIMENSION],g=v[Mi.MISC_FLAG],y=v[Mi.ARRAY_SIZE],E=Pb[_];if(E===void 0)throw new Error("DDSParser cannot parse texture data with DXGI format "+_);if(g===Sb)throw new Error("DDSParser does not support cubemap textures");if(m===Fa.DDS_DIMENSION_TEXTURE3D)throw new Error("DDSParser does not supported 3D texture data");var b=new Array,S=Da+Ii+cl;if(y===1)b.push(new Uint8Array(r,S));else{for(var P=Ri[E],T=0,x=o,w=i,O=0;O<a;O++){var I=Math.max(1,x+3&-4),C=Math.max(1,w+3&-4),G=I*C*P;T+=G,x=x>>>1,w=w>>>1}for(var B=S,O=0;O<y;O++)b.push(new Uint8Array(r,B,T)),B+=T}return b.map(function(N){return new Ma(N,{format:E,width:o,height:i,levels:a})})}throw u&gb?new Error("DDSParser does not support uncompressed texture data."):u&yb?new Error("DDSParser does not supported YUV uncompressed texture data."):u&bb?new Error("DDSParser does not support single-channel (lumninance) texture data!"):u&_b?new Error("DDSParser does not support single-channel (alpha) texture data!"):new Error("DDSParser failed to load a texture file due to an unknown reason!")}var Ye,Me,Pn,dl=[171,75,84,88,32,49,49,187,13,10,26,10],Rb=67305985,de={FILE_IDENTIFIER:0,ENDIANNESS:12,GL_TYPE:16,GL_TYPE_SIZE:20,GL_FORMAT:24,GL_INTERNAL_FORMAT:28,GL_BASE_INTERNAL_FORMAT:32,PIXEL_WIDTH:36,PIXEL_HEIGHT:40,PIXEL_DEPTH:44,NUMBER_OF_ARRAY_ELEMENTS:48,NUMBER_OF_FACES:52,NUMBER_OF_MIPMAP_LEVELS:56,BYTES_OF_KEY_VALUE_DATA:60},Ba=64,pl=(Ye={},Ye[H.UNSIGNED_BYTE]=1,Ye[H.UNSIGNED_SHORT]=2,Ye[H.INT]=4,Ye[H.UNSIGNED_INT]=4,Ye[H.FLOAT]=4,Ye[H.HALF_FLOAT]=8,Ye),Ib=(Me={},Me[U.RGBA]=4,Me[U.RGB]=3,Me[U.RG]=2,Me[U.RED]=1,Me[U.LUMINANCE]=1,Me[U.LUMINANCE_ALPHA]=2,Me[U.ALPHA]=1,Me),Cb=(Pn={},Pn[H.UNSIGNED_SHORT_4_4_4_4]=2,Pn[H.UNSIGNED_SHORT_5_5_5_1]=2,Pn[H.UNSIGNED_SHORT_5_6_5]=2,Pn);function Mb(r,t,e){e===void 0&&(e=!1);var n=new DataView(t);if(!Db(r,n))return null;var i=n.getUint32(de.ENDIANNESS,!0)===Rb,o=n.getUint32(de.GL_TYPE,i),a=n.getUint32(de.GL_FORMAT,i),s=n.getUint32(de.GL_INTERNAL_FORMAT,i),u=n.getUint32(de.PIXEL_WIDTH,i),h=n.getUint32(de.PIXEL_HEIGHT,i)||1,l=n.getUint32(de.PIXEL_DEPTH,i)||1,f=n.getUint32(de.NUMBER_OF_ARRAY_ELEMENTS,i)||1,c=n.getUint32(de.NUMBER_OF_FACES,i),d=n.getUint32(de.NUMBER_OF_MIPMAP_LEVELS,i),p=n.getUint32(de.BYTES_OF_KEY_VALUE_DATA,i);if(h===0||l!==1)throw new Error("Only 2D textures are supported");if(c!==1)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(f!==1)throw new Error("WebGL does not support array textures");var v=4,_=4,m=u+3&-4,g=h+3&-4,y=new Array(f),E=u*h;o===0&&(E=m*g);var b;if(o!==0?pl[o]?b=pl[o]*Ib[a]:b=Cb[o]:b=Ri[s],b===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");for(var S=e?Bb(n,p,i):null,P=E*b,T=P,x=u,w=h,O=m,I=g,C=Ba+p,G=0;G<d;G++){for(var B=n.getUint32(C,i),N=C+4,W=0;W<f;W++){var K=y[W];K||(K=y[W]=new Array(d)),K[G]={levelID:G,levelWidth:d>1||o!==0?x:O,levelHeight:d>1||o!==0?w:I,levelBuffer:new Uint8Array(t,N,T)},N+=T}C+=B+4,C=C%4!==0?C+4-C%4:C,x=x>>1||1,w=w>>1||1,O=x+v-1&~(v-1),I=w+_-1&~(_-1),T=O*I*b}return o!==0?{uncompressed:y.map(function(Q){var L=Q[0].levelBuffer,F=!1;return o===H.FLOAT?L=new Float32Array(Q[0].levelBuffer.buffer,Q[0].levelBuffer.byteOffset,Q[0].levelBuffer.byteLength/4):o===H.UNSIGNED_INT?(F=!0,L=new Uint32Array(Q[0].levelBuffer.buffer,Q[0].levelBuffer.byteOffset,Q[0].levelBuffer.byteLength/4)):o===H.INT&&(F=!0,L=new Int32Array(Q[0].levelBuffer.buffer,Q[0].levelBuffer.byteOffset,Q[0].levelBuffer.byteLength/4)),{resource:new bn(L,{width:Q[0].levelWidth,height:Q[0].levelHeight}),type:o,format:F?Fb(a):a}}),kvData:S}:{compressed:y.map(function(Q){return new Ma(null,{format:s,width:u,height:h,levels:d,levelBuffers:Q})}),kvData:S}}function Db(r,t){for(var e=0;e<dl.length;e++)if(t.getUint8(e)!==dl[e])return console.error(r+" is not a valid *.ktx file!"),!1;return!0}function Fb(r){switch(r){case U.RGBA:return U.RGBA_INTEGER;case U.RGB:return U.RGB_INTEGER;case U.RG:return U.RG_INTEGER;case U.RED:return U.RED_INTEGER;default:return r}}function Bb(r,t,e){for(var n=new Map,i=0;i<t;){var o=r.getUint32(Ba+i,e),a=Ba+i+4,s=3-(o+3)%4;if(o===0||o>t-i){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}for(var u=0;u<o&&r.getUint8(a+u)!==0;u++);if(u===-1){console.error("KTXLoader: Failed to find null byte terminating kvData key");break}var h=new TextDecoder().decode(new Uint8Array(r.buffer,a,u)),l=new DataView(r.buffer,a+u+1,o-u-1);n.set(h,l),i+=4+o+s}return n}Rt.setExtensionXhrType("dds",Rt.XHR_RESPONSE_TYPE.BUFFER);var Nb=function(){function r(){}return r.use=function(t,e){if(t.extension==="dds"&&t.data)try{Object.assign(t,fl(t.name||t.url,Ob(t.data),t.metadata))}catch(n){e(n);return}e()},r.extension=mt.Loader,r}();Rt.setExtensionXhrType("ktx",Rt.XHR_RESPONSE_TYPE.BUFFER);var Lb=function(){function r(){}return r.use=function(t,e){if(t.extension==="ktx"&&t.data)try{var n=t.name||t.url,i=Mb(n,t.data,this.loadKeyValueData),o=i.compressed,a=i.uncompressed,s=i.kvData;if(o){var u=fl(n,o,t.metadata);if(s&&u.textures)for(var h in u.textures)u.textures[h].baseTexture.ktxKeyValueData=s;Object.assign(t,u)}else if(a){var l={};a.forEach(function(f,c){var d=new J(new ut(f.resource,{mipmap:ae.OFF,alphaMode:se.NO_PREMULTIPLIED_ALPHA,type:f.type,format:f.format})),p=n+"-"+(c+1);s&&(d.baseTexture.ktxKeyValueData=s),ut.addToCache(d.baseTexture,p),J.addToCache(d,p),c===0&&(l[n]=d,ut.addToCache(d.baseTexture,n),J.addToCache(d,n)),l[p]=d}),Object.assign(t,{textures:l})}}catch(f){e(f);return}e()},r.extension=mt.Loader,r.loadKeyValueData=!1,r}();/*!
654
- * @pixi/particle-container - v6.5.10
655
- * Compiled Thu, 06 Jul 2023 15:25:11 UTC
656
- *
657
- * @pixi/particle-container is licensed under the MIT License.
658
- * http://www.opensource.org/licenses/mit-license
659
- *//*! *****************************************************************************
660
- Copyright (c) Microsoft Corporation.
661
-
662
- Permission to use, copy, modify, and/or distribute this software for any
663
- purpose with or without fee is hereby granted.
664
-
665
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
666
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
667
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
668
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
669
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
670
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
671
- PERFORMANCE OF THIS SOFTWARE.
672
- ***************************************************************************** */var Na=function(r,t){return Na=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var i in n)n.hasOwnProperty(i)&&(e[i]=n[i])},Na(r,t)};function vl(r,t){Na(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}(function(r){vl(t,r);function t(e,n,i,o){e===void 0&&(e=1500),i===void 0&&(i=16384),o===void 0&&(o=!1);var a=r.call(this)||this,s=16384;return i>s&&(i=s),a._properties=[!1,!0,!1,!1,!1],a._maxSize=e,a._batchSize=i,a._buffers=null,a._bufferUpdateIDs=[],a._updateID=0,a.interactiveChildren=!1,a.blendMode=j.NORMAL,a.autoResize=o,a.roundPixels=!0,a.baseTexture=null,a.setProperties(n),a._tint=0,a.tintRgb=new Float32Array(4),a.tint=16777215,a}return t.prototype.setProperties=function(e){e&&(this._properties[0]="vertices"in e||"scale"in e?!!e.vertices||!!e.scale:this._properties[0],this._properties[1]="position"in e?!!e.position:this._properties[1],this._properties[2]="rotation"in e?!!e.rotation:this._properties[2],this._properties[3]="uvs"in e?!!e.uvs:this._properties[3],this._properties[4]="tint"in e||"alpha"in e?!!e.tint||!!e.alpha:this._properties[4])},t.prototype.updateTransform=function(){this.displayObjectUpdateTransform()},Object.defineProperty(t.prototype,"tint",{get:function(){return this._tint},set:function(e){this._tint=e,Ur(e,this.tintRgb)},enumerable:!1,configurable:!0}),t.prototype.render=function(e){var n=this;!this.visible||this.worldAlpha<=0||!this.children.length||!this.renderable||(this.baseTexture||(this.baseTexture=this.children[0]._texture.baseTexture,this.baseTexture.valid||this.baseTexture.once("update",function(){return n.onChildrenChange(0)})),e.batch.setObjectRenderer(e.plugins.particle),e.plugins.particle.render(this))},t.prototype.onChildrenChange=function(e){for(var n=Math.floor(e/this._batchSize);this._bufferUpdateIDs.length<n;)this._bufferUpdateIDs.push(0);this._bufferUpdateIDs[n]=++this._updateID},t.prototype.dispose=function(){if(this._buffers){for(var e=0;e<this._buffers.length;++e)this._buffers[e].destroy();this._buffers=null}},t.prototype.destroy=function(e){r.prototype.destroy.call(this,e),this.dispose(),this._properties=null,this._buffers=null,this._bufferUpdateIDs=null},t})(Ee);var _l=function(){function r(t,e,n){this.geometry=new xn,this.indexBuffer=null,this.size=n,this.dynamicProperties=[],this.staticProperties=[];for(var i=0;i<t.length;++i){var o=t[i];o={attributeName:o.attributeName,size:o.size,uploadFunction:o.uploadFunction,type:o.type||H.FLOAT,offset:o.offset},e[i]?this.dynamicProperties.push(o):this.staticProperties.push(o)}this.staticStride=0,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.dynamicStride=0,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this._updateID=0,this.initBuffers()}return r.prototype.initBuffers=function(){var t=this.geometry,e=0;this.indexBuffer=new Dt(qg(this.size),!0,!0),t.addIndex(this.indexBuffer),this.dynamicStride=0;for(var n=0;n<this.dynamicProperties.length;++n){var i=this.dynamicProperties[n];i.offset=e,e+=i.size,this.dynamicStride+=i.size}var o=new ArrayBuffer(this.size*this.dynamicStride*4*4);this.dynamicData=new Float32Array(o),this.dynamicDataUint32=new Uint32Array(o),this.dynamicBuffer=new Dt(this.dynamicData,!1,!1);var a=0;this.staticStride=0;for(var n=0;n<this.staticProperties.length;++n){var i=this.staticProperties[n];i.offset=a,a+=i.size,this.staticStride+=i.size}var s=new ArrayBuffer(this.size*this.staticStride*4*4);this.staticData=new Float32Array(s),this.staticDataUint32=new Uint32Array(s),this.staticBuffer=new Dt(this.staticData,!0,!1);for(var n=0;n<this.dynamicProperties.length;++n){var i=this.dynamicProperties[n];t.addAttribute(i.attributeName,this.dynamicBuffer,0,i.type===H.UNSIGNED_BYTE,i.type,this.dynamicStride*4,i.offset*4)}for(var n=0;n<this.staticProperties.length;++n){var i=this.staticProperties[n];t.addAttribute(i.attributeName,this.staticBuffer,0,i.type===H.UNSIGNED_BYTE,i.type,this.staticStride*4,i.offset*4)}},r.prototype.uploadDynamic=function(t,e,n){for(var i=0;i<this.dynamicProperties.length;i++){var o=this.dynamicProperties[i];o.uploadFunction(t,e,n,o.type===H.UNSIGNED_BYTE?this.dynamicDataUint32:this.dynamicData,this.dynamicStride,o.offset)}this.dynamicBuffer._updateID++},r.prototype.uploadStatic=function(t,e,n){for(var i=0;i<this.staticProperties.length;i++){var o=this.staticProperties[i];o.uploadFunction(t,e,n,o.type===H.UNSIGNED_BYTE?this.staticDataUint32:this.staticData,this.staticStride,o.offset)}this.staticBuffer._updateID++},r.prototype.destroy=function(){this.indexBuffer=null,this.dynamicProperties=null,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this.staticProperties=null,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.geometry.destroy()},r}(),Ub=`varying vec2 vTextureCoord;
673
- varying vec4 vColor;
544
+ varying vec2 vBlurTexCoords[%size%];
545
+
546
+ uniform vec4 inputSize;
547
+ uniform vec4 outputFrame;
548
+
549
+ vec4 filterVertexPosition( void )
550
+ {
551
+ vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
552
+
553
+ return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
554
+ }
555
+
556
+ vec2 filterTextureCoord( void )
557
+ {
558
+ return aVertexPosition * (outputFrame.zw * inputSize.zw);
559
+ }
560
+
561
+ void main(void)
562
+ {
563
+ gl_Position = filterVertexPosition();
674
564
 
565
+ vec2 textureCoord = filterTextureCoord();
566
+ %blur%
567
+ }`;function z1(r,t){const e=Math.ceil(r/2);let i=V1,s="",n;t?n="vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);":n="vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);";for(let o=0;o<r;o++){let a=n.replace("%index%",o.toString());a=a.replace("%sampleIndex%",`${o-(e-1)}.0`),s+=a,s+=`
568
+ `}return i=i.replace("%blur%",s),i=i.replace("%size%",r.toString()),i}class el extends re{constructor(t,e=8,i=4,s=re.defaultResolution,n=5){const o=z1(n,t),a=X1(n);super(o,a),this.horizontal=t,this.resolution=s,this._quality=0,this.quality=i,this.blur=e}apply(t,e,i,s){if(i?this.horizontal?this.uniforms.strength=1/i.width*(i.width/e.width):this.uniforms.strength=1/i.height*(i.height/e.height):this.horizontal?this.uniforms.strength=1/t.renderer.width*(t.renderer.width/e.width):this.uniforms.strength=1/t.renderer.height*(t.renderer.height/e.height),this.uniforms.strength*=this.strength,this.uniforms.strength/=this.passes,this.passes===1)t.applyFilter(this,e,i,s);else{const n=t.getFilterTexture(),o=t.renderer;let a=e,l=n;this.state.blend=!1,t.applyFilter(this,a,l,Fe.CLEAR);for(let h=1;h<this.passes-1;h++){t.bindAndClear(a,Fe.BLIT),this.uniforms.uSampler=l;const c=l;l=a,a=c,o.shader.bind(this),o.geometry.draw(5)}this.state.blend=!0,t.applyFilter(this,l,i,s),t.returnFilterTexture(n)}}get blur(){return this.strength}set blur(t){this.padding=1+Math.abs(t)*2,this.strength=t}get quality(){return this._quality}set quality(t){this._quality=t,this.passes=t}}class W1 extends re{constructor(t=8,e=4,i=re.defaultResolution,s=5){super(),this._repeatEdgePixels=!1,this.blurXFilter=new el(!0,t,e,i,s),this.blurYFilter=new el(!1,t,e,i,s),this.resolution=i,this.quality=e,this.blur=t,this.repeatEdgePixels=!1}apply(t,e,i,s){const n=Math.abs(this.blurXFilter.strength),o=Math.abs(this.blurYFilter.strength);if(n&&o){const a=t.getFilterTexture();this.blurXFilter.apply(t,e,a,Fe.CLEAR),this.blurYFilter.apply(t,a,i,s),t.returnFilterTexture(a)}else o?this.blurYFilter.apply(t,e,i,s):this.blurXFilter.apply(t,e,i,s)}updatePadding(){this._repeatEdgePixels?this.padding=0:this.padding=Math.max(Math.abs(this.blurXFilter.strength),Math.abs(this.blurYFilter.strength))*2}get blur(){return this.blurXFilter.blur}set blur(t){this.blurXFilter.blur=this.blurYFilter.blur=t,this.updatePadding()}get quality(){return this.blurXFilter.quality}set quality(t){this.blurXFilter.quality=this.blurYFilter.quality=t}get blurX(){return this.blurXFilter.blur}set blurX(t){this.blurXFilter.blur=t,this.updatePadding()}get blurY(){return this.blurYFilter.blur}set blurY(t){this.blurYFilter.blur=t,this.updatePadding()}get blendMode(){return this.blurYFilter.blendMode}set blendMode(t){this.blurYFilter.blendMode=t}get repeatEdgePixels(){return this._repeatEdgePixels}set repeatEdgePixels(t){this._repeatEdgePixels=t,this.updatePadding()}}var j1=`varying vec2 vTextureCoord;
675
569
  uniform sampler2D uSampler;
570
+ uniform float m[20];
571
+ uniform float uAlpha;
676
572
 
677
- void main(void){
678
- vec4 color = texture2D(uSampler, vTextureCoord) * vColor;
679
- gl_FragColor = color;
680
- }`,Gb=`attribute vec2 aVertexPosition;
681
- attribute vec2 aTextureCoord;
682
- attribute vec4 aColor;
573
+ void main(void)
574
+ {
575
+ vec4 c = texture2D(uSampler, vTextureCoord);
683
576
 
684
- attribute vec2 aPositionCoord;
685
- attribute float aRotation;
577
+ if (uAlpha == 0.0) {
578
+ gl_FragColor = c;
579
+ return;
580
+ }
686
581
 
687
- uniform mat3 translationMatrix;
688
- uniform vec4 uColor;
582
+ // Un-premultiply alpha before applying the color matrix. See issue #3539.
583
+ if (c.a > 0.0) {
584
+ c.rgb /= c.a;
585
+ }
689
586
 
690
- varying vec2 vTextureCoord;
691
- varying vec4 vColor;
587
+ vec4 result;
692
588
 
693
- void main(void){
694
- float x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation);
695
- float y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation);
589
+ result.r = (m[0] * c.r);
590
+ result.r += (m[1] * c.g);
591
+ result.r += (m[2] * c.b);
592
+ result.r += (m[3] * c.a);
593
+ result.r += m[4];
696
594
 
697
- vec2 v = vec2(x, y);
698
- v = v + aPositionCoord;
595
+ result.g = (m[5] * c.r);
596
+ result.g += (m[6] * c.g);
597
+ result.g += (m[7] * c.b);
598
+ result.g += (m[8] * c.a);
599
+ result.g += m[9];
699
600
 
700
- gl_Position = vec4((translationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);
601
+ result.b = (m[10] * c.r);
602
+ result.b += (m[11] * c.g);
603
+ result.b += (m[12] * c.b);
604
+ result.b += (m[13] * c.a);
605
+ result.b += m[14];
701
606
 
702
- vTextureCoord = aTextureCoord;
703
- vColor = aColor * uColor;
704
- }
705
- `,kb=function(r){vl(t,r);function t(e){var n=r.call(this,e)||this;return n.shader=null,n.properties=null,n.tempMatrix=new Mt,n.properties=[{attributeName:"aVertexPosition",size:2,uploadFunction:n.uploadVertices,offset:0},{attributeName:"aPositionCoord",size:2,uploadFunction:n.uploadPosition,offset:0},{attributeName:"aRotation",size:1,uploadFunction:n.uploadRotation,offset:0},{attributeName:"aTextureCoord",size:2,uploadFunction:n.uploadUvs,offset:0},{attributeName:"aColor",size:1,type:H.UNSIGNED_BYTE,uploadFunction:n.uploadTint,offset:0}],n.shader=je.from(Gb,Ub,{}),n.state=fr.for2d(),n}return t.prototype.render=function(e){var n=e.children,i=e._maxSize,o=e._batchSize,a=this.renderer,s=n.length;if(s!==0){s>i&&!e.autoResize&&(s=i);var u=e._buffers;u||(u=e._buffers=this.generateBuffers(e));var h=n[0]._texture.baseTexture,l=h.alphaMode>0;this.state.blendMode=ph(e.blendMode,l),a.state.set(this.state);var f=a.gl,c=e.worldTransform.copyTo(this.tempMatrix);c.prepend(a.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=c.toArray(!0),this.shader.uniforms.uColor=Wg(e.tintRgb,e.worldAlpha,this.shader.uniforms.uColor,l),this.shader.uniforms.uSampler=h,this.renderer.shader.bind(this.shader);for(var d=!1,p=0,v=0;p<s;p+=o,v+=1){var _=s-p;_>o&&(_=o),v>=u.length&&u.push(this._generateOneMoreBuffer(e));var m=u[v];m.uploadDynamic(n,p,_);var g=e._bufferUpdateIDs[v]||0;d=d||m._updateID<g,d&&(m._updateID=e._updateID,m.uploadStatic(n,p,_)),a.geometry.bind(m.geometry),f.drawElements(f.TRIANGLES,_*6,f.UNSIGNED_SHORT,0)}}},t.prototype.generateBuffers=function(e){for(var n=[],i=e._maxSize,o=e._batchSize,a=e._properties,s=0;s<i;s+=o)n.push(new _l(this.properties,a,o));return n},t.prototype._generateOneMoreBuffer=function(e){var n=e._batchSize,i=e._properties;return new _l(this.properties,i,n)},t.prototype.uploadVertices=function(e,n,i,o,a,s){for(var u=0,h=0,l=0,f=0,c=0;c<i;++c){var d=e[n+c],p=d._texture,v=d.scale.x,_=d.scale.y,m=p.trim,g=p.orig;m?(h=m.x-d.anchor.x*g.width,u=h+m.width,f=m.y-d.anchor.y*g.height,l=f+m.height):(u=g.width*(1-d.anchor.x),h=g.width*-d.anchor.x,l=g.height*(1-d.anchor.y),f=g.height*-d.anchor.y),o[s]=h*v,o[s+1]=f*_,o[s+a]=u*v,o[s+a+1]=f*_,o[s+a*2]=u*v,o[s+a*2+1]=l*_,o[s+a*3]=h*v,o[s+a*3+1]=l*_,s+=a*4}},t.prototype.uploadPosition=function(e,n,i,o,a,s){for(var u=0;u<i;u++){var h=e[n+u].position;o[s]=h.x,o[s+1]=h.y,o[s+a]=h.x,o[s+a+1]=h.y,o[s+a*2]=h.x,o[s+a*2+1]=h.y,o[s+a*3]=h.x,o[s+a*3+1]=h.y,s+=a*4}},t.prototype.uploadRotation=function(e,n,i,o,a,s){for(var u=0;u<i;u++){var h=e[n+u].rotation;o[s]=h,o[s+a]=h,o[s+a*2]=h,o[s+a*3]=h,s+=a*4}},t.prototype.uploadUvs=function(e,n,i,o,a,s){for(var u=0;u<i;++u){var h=e[n+u]._texture._uvs;h?(o[s]=h.x0,o[s+1]=h.y0,o[s+a]=h.x1,o[s+a+1]=h.y1,o[s+a*2]=h.x2,o[s+a*2+1]=h.y2,o[s+a*3]=h.x3,o[s+a*3+1]=h.y3,s+=a*4):(o[s]=0,o[s+1]=0,o[s+a]=0,o[s+a+1]=0,o[s+a*2]=0,o[s+a*2+1]=0,o[s+a*3]=0,o[s+a*3+1]=0,s+=a*4)}},t.prototype.uploadTint=function(e,n,i,o,a,s){for(var u=0;u<i;++u){var h=e[n+u],l=h._texture.baseTexture.alphaMode>0,f=h.alpha,c=f<1&&l?ea(h._tintRGB,f):h._tintRGB+(f*255<<24);o[s]=c,o[s+a]=c,o[s+a*2]=c,o[s+a*3]=c,s+=a*4}},t.prototype.destroy=function(){r.prototype.destroy.call(this),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null},t.extension={name:"particle",type:mt.RendererPlugin},t}(gi);/*!
706
- * @pixi/graphics - v6.5.10
707
- * Compiled Thu, 06 Jul 2023 15:25:11 UTC
708
- *
709
- * @pixi/graphics is licensed under the MIT License.
710
- * http://www.opensource.org/licenses/mit-license
711
- */var De;(function(r){r.MITER="miter",r.BEVEL="bevel",r.ROUND="round"})(De||(De={}));var ze;(function(r){r.BUTT="butt",r.ROUND="round",r.SQUARE="square"})(ze||(ze={}));var On={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount:function(r,t){if(t===void 0&&(t=20),!this.adaptive||!r||isNaN(r))return t;var e=Math.ceil(r/this.maxLength);return e<this.minSegments?e=this.minSegments:e>this.maxSegments&&(e=this.maxSegments),e}},ml=function(){function r(){this.color=16777215,this.alpha=1,this.texture=J.WHITE,this.matrix=null,this.visible=!1,this.reset()}return r.prototype.clone=function(){var t=new r;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t},r.prototype.reset=function(){this.color=16777215,this.alpha=1,this.texture=J.WHITE,this.matrix=null,this.visible=!1},r.prototype.destroy=function(){this.texture=null,this.matrix=null},r}();/*! *****************************************************************************
712
- Copyright (c) Microsoft Corporation.
713
-
714
- Permission to use, copy, modify, and/or distribute this software for any
715
- purpose with or without fee is hereby granted.
716
-
717
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
718
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
719
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
720
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
721
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
722
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
723
- PERFORMANCE OF THIS SOFTWARE.
724
- ***************************************************************************** */var La=function(r,t){return La=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var i in n)n.hasOwnProperty(i)&&(e[i]=n[i])},La(r,t)};function Ua(r,t){La(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function gl(r,t){var e,n;t===void 0&&(t=!1);var i=r.length;if(!(i<6)){for(var o=0,a=0,s=r[i-2],u=r[i-1];a<i;a+=2){var h=r[a],l=r[a+1];o+=(h-s)*(l+u),s=h,u=l}if(!t&&o>0||t&&o<=0)for(var f=i/2,a=f+f%2;a<i;a+=2){var c=i-a-2,d=i-a-1,p=a,v=a+1;e=[r[p],r[c]],r[c]=e[0],r[p]=e[1],n=[r[v],r[d]],r[d]=n[0],r[v]=n[1]}}}var yl={build:function(r){r.points=r.shape.points.slice()},triangulate:function(r,t){var e=r.points,n=r.holes,i=t.points,o=t.indices;if(e.length>=6){gl(e,!1);for(var a=[],s=0;s<n.length;s++){var u=n[s];gl(u.points,!0),a.push(e.length/2),e=e.concat(u.points)}var h=yu(e,a,2);if(!h)return;for(var l=i.length/2,s=0;s<h.length;s+=3)o.push(h[s]+l),o.push(h[s+1]+l),o.push(h[s+2]+l);for(var s=0;s<e.length;s++)i.push(e[s])}}},Di={build:function(r){var t=r.points,e,n,i,o,a,s;if(r.type===Nt.CIRC){var u=r.shape;e=u.x,n=u.y,a=s=u.radius,i=o=0}else if(r.type===Nt.ELIP){var h=r.shape;e=h.x,n=h.y,a=h.width,s=h.height,i=o=0}else{var l=r.shape,f=l.width/2,c=l.height/2;e=l.x+f,n=l.y+c,a=s=Math.max(0,Math.min(l.radius,Math.min(f,c))),i=f-a,o=c-s}if(!(a>=0&&s>=0&&i>=0&&o>=0)){t.length=0;return}var d=Math.ceil(2.3*Math.sqrt(a+s)),p=d*8+(i?4:0)+(o?4:0);if(t.length=p,p!==0){if(d===0){t.length=8,t[0]=t[6]=e+i,t[1]=t[3]=n+o,t[2]=t[4]=e-i,t[5]=t[7]=n-o;return}var v=0,_=d*4+(i?2:0)+2,m=_,g=p;{var y=i+a,E=o,b=e+y,S=e-y,P=n+E;if(t[v++]=b,t[v++]=P,t[--_]=P,t[--_]=S,o){var T=n-E;t[m++]=S,t[m++]=T,t[--g]=T,t[--g]=b}}for(var x=1;x<d;x++){var w=Math.PI/2*(x/d),y=i+Math.cos(w)*a,E=o+Math.sin(w)*s,b=e+y,S=e-y,P=n+E,T=n-E;t[v++]=b,t[v++]=P,t[--_]=P,t[--_]=S,t[m++]=S,t[m++]=T,t[--g]=T,t[--g]=b}{var y=i,E=o+s,b=e+y,S=e-y,P=n+E,T=n-E;t[v++]=b,t[v++]=P,t[--g]=T,t[--g]=b,i&&(t[v++]=S,t[v++]=P,t[--g]=T,t[--g]=S)}}},triangulate:function(r,t){var e=r.points,n=t.points,i=t.indices;if(e.length!==0){var o=n.length/2,a=o,s,u;if(r.type!==Nt.RREC){var h=r.shape;s=h.x,u=h.y}else{var l=r.shape;s=l.x+l.width/2,u=l.y+l.height/2}var f=r.matrix;n.push(r.matrix?f.a*s+f.c*u+f.tx:s,r.matrix?f.b*s+f.d*u+f.ty:u),o++,n.push(e[0],e[1]);for(var c=2;c<e.length;c+=2)n.push(e[c],e[c+1]),i.push(o++,a,o);i.push(a+1,a,o)}}},Xb={build:function(r){var t=r.shape,e=t.x,n=t.y,i=t.width,o=t.height,a=r.points;a.length=0,a.push(e,n,e+i,n,e+i,n+o,e,n+o)},triangulate:function(r,t){var e=r.points,n=t.points,i=n.length/2;n.push(e[0],e[1],e[2],e[3],e[6],e[7],e[4],e[5]),t.indices.push(i,i+1,i+2,i+1,i+2,i+3)}};function jr(r,t,e){var n=t-r;return r+n*e}function Fi(r,t,e,n,i,o,a){a===void 0&&(a=[]);for(var s=20,u=a,h=0,l=0,f=0,c=0,d=0,p=0,v=0,_=0;v<=s;++v)_=v/s,h=jr(r,e,_),l=jr(t,n,_),f=jr(e,i,_),c=jr(n,o,_),d=jr(h,f,_),p=jr(l,c,_),!(v===0&&u[u.length-2]===d&&u[u.length-1]===p)&&u.push(d,p);return u}var Hb={build:function(r){if(Yr.nextRoundedRectBehavior){Di.build(r);return}var t=r.shape,e=r.points,n=t.x,i=t.y,o=t.width,a=t.height,s=Math.max(0,Math.min(t.radius,Math.min(o,a)/2));e.length=0,s?(Fi(n,i+s,n,i,n+s,i,e),Fi(n+o-s,i,n+o,i,n+o,i+s,e),Fi(n+o,i+a-s,n+o,i+a,n+o-s,i+a,e),Fi(n+s,i+a,n,i+a,n,i+a-s,e)):e.push(n,i,n+o,i,n+o,i+a,n,i+a)},triangulate:function(r,t){if(Yr.nextRoundedRectBehavior){Di.triangulate(r,t);return}for(var e=r.points,n=t.points,i=t.indices,o=n.length/2,a=yu(e,null,2),s=0,u=a.length;s<u;s+=3)i.push(a[s]+o),i.push(a[s+1]+o),i.push(a[s+2]+o);for(var s=0,u=e.length;s<u;s++)n.push(e[s],e[++s])}};function bl(r,t,e,n,i,o,a,s){var u=r-e*i,h=t-n*i,l=r+e*o,f=t+n*o,c,d;a?(c=n,d=-e):(c=-n,d=e);var p=u+c,v=h+d,_=l+c,m=f+d;return s.push(p,v),s.push(_,m),2}function pr(r,t,e,n,i,o,a,s){var u=e-r,h=n-t,l=Math.atan2(u,h),f=Math.atan2(i-r,o-t);s&&l<f?l+=Math.PI*2:!s&&l>f&&(f+=Math.PI*2);var c=l,d=f-l,p=Math.abs(d),v=Math.sqrt(u*u+h*h),_=(15*p*Math.sqrt(v)/Math.PI>>0)+1,m=d/_;if(c+=m,s){a.push(r,t),a.push(e,n);for(var g=1,y=c;g<_;g++,y+=m)a.push(r,t),a.push(r+Math.sin(y)*v,t+Math.cos(y)*v);a.push(r,t),a.push(i,o)}else{a.push(e,n),a.push(r,t);for(var g=1,y=c;g<_;g++,y+=m)a.push(r+Math.sin(y)*v,t+Math.cos(y)*v),a.push(r,t);a.push(i,o),a.push(r,t)}return _*2}function jb(r,t){var e=r.shape,n=r.points||e.points.slice(),i=t.closePointEps;if(n.length!==0){var o=r.lineStyle,a=new Et(n[0],n[1]),s=new Et(n[n.length-2],n[n.length-1]),u=e.type!==Nt.POLY||e.closeStroke,h=Math.abs(a.x-s.x)<i&&Math.abs(a.y-s.y)<i;if(u){n=n.slice(),h&&(n.pop(),n.pop(),s.set(n[n.length-2],n[n.length-1]));var l=(a.x+s.x)*.5,f=(s.y+a.y)*.5;n.unshift(l,f),n.push(l,f)}var c=t.points,d=n.length/2,p=n.length,v=c.length/2,_=o.width/2,m=_*_,g=o.miterLimit*o.miterLimit,y=n[0],E=n[1],b=n[2],S=n[3],P=0,T=0,x=-(E-S),w=y-b,O=0,I=0,C=Math.sqrt(x*x+w*w);x/=C,w/=C,x*=_,w*=_;var G=o.alignment,B=(1-G)*2,N=G*2;u||(o.cap===ze.ROUND?p+=pr(y-x*(B-N)*.5,E-w*(B-N)*.5,y-x*B,E-w*B,y+x*N,E+w*N,c,!0)+2:o.cap===ze.SQUARE&&(p+=bl(y,E,x,w,B,N,!0,c))),c.push(y-x*B,E-w*B),c.push(y+x*N,E+w*N);for(var W=1;W<d-1;++W){y=n[(W-1)*2],E=n[(W-1)*2+1],b=n[W*2],S=n[W*2+1],P=n[(W+1)*2],T=n[(W+1)*2+1],x=-(E-S),w=y-b,C=Math.sqrt(x*x+w*w),x/=C,w/=C,x*=_,w*=_,O=-(S-T),I=b-P,C=Math.sqrt(O*O+I*I),O/=C,I/=C,O*=_,I*=_;var K=b-y,Q=E-S,L=b-P,F=T-S,X=K*L+Q*F,tt=Q*L-F*K,rt=tt<0;if(Math.abs(tt)<.001*Math.abs(X)){c.push(b-x*B,S-w*B),c.push(b+x*N,S+w*N),X>=0&&(o.join===De.ROUND?p+=pr(b,S,b-x*B,S-w*B,b-O*B,S-I*B,c,!1)+4:p+=2,c.push(b-O*N,S-I*N),c.push(b+O*B,S+I*B));continue}var vt=(-x+y)*(-w+S)-(-x+b)*(-w+E),V=(-O+P)*(-I+S)-(-O+b)*(-I+T),ht=(K*V-L*vt)/tt,gt=(F*vt-Q*V)/tt,Tt=(ht-b)*(ht-b)+(gt-S)*(gt-S),q=b+(ht-b)*B,it=S+(gt-S)*B,at=b-(ht-b)*N,ct=S-(gt-S)*N,nt=Math.min(K*K+Q*Q,L*L+F*F),D=rt?B:N,R=nt+D*D*m,dt=Tt<=R;dt?o.join===De.BEVEL||Tt/m>g?(rt?(c.push(q,it),c.push(b+x*N,S+w*N),c.push(q,it),c.push(b+O*N,S+I*N)):(c.push(b-x*B,S-w*B),c.push(at,ct),c.push(b-O*B,S-I*B),c.push(at,ct)),p+=2):o.join===De.ROUND?rt?(c.push(q,it),c.push(b+x*N,S+w*N),p+=pr(b,S,b+x*N,S+w*N,b+O*N,S+I*N,c,!0)+4,c.push(q,it),c.push(b+O*N,S+I*N)):(c.push(b-x*B,S-w*B),c.push(at,ct),p+=pr(b,S,b-x*B,S-w*B,b-O*B,S-I*B,c,!1)+4,c.push(b-O*B,S-I*B),c.push(at,ct)):(c.push(q,it),c.push(at,ct)):(c.push(b-x*B,S-w*B),c.push(b+x*N,S+w*N),o.join===De.ROUND?rt?p+=pr(b,S,b+x*N,S+w*N,b+O*N,S+I*N,c,!0)+2:p+=pr(b,S,b-x*B,S-w*B,b-O*B,S-I*B,c,!1)+2:o.join===De.MITER&&Tt/m<=g&&(rt?(c.push(at,ct),c.push(at,ct)):(c.push(q,it),c.push(q,it)),p+=2),c.push(b-O*B,S-I*B),c.push(b+O*N,S+I*N),p+=2)}y=n[(d-2)*2],E=n[(d-2)*2+1],b=n[(d-1)*2],S=n[(d-1)*2+1],x=-(E-S),w=y-b,C=Math.sqrt(x*x+w*w),x/=C,w/=C,x*=_,w*=_,c.push(b-x*B,S-w*B),c.push(b+x*N,S+w*N),u||(o.cap===ze.ROUND?p+=pr(b-x*(B-N)*.5,S-w*(B-N)*.5,b-x*B,S-w*B,b+x*N,S+w*N,c,!1)+2:o.cap===ze.SQUARE&&(p+=bl(b,S,x,w,B,N,!1,c)));for(var we=t.indices,Jr=On.epsilon*On.epsilon,W=v;W<p+v-2;++W)y=c[W*2],E=c[W*2+1],b=c[(W+1)*2],S=c[(W+1)*2+1],P=c[(W+2)*2],T=c[(W+2)*2+1],!(Math.abs(y*(S-T)+b*(T-E)+P*(E-S))<Jr)&&we.push(W,W+1,W+2)}}function Vb(r,t){var e=0,n=r.shape,i=r.points||n.points,o=n.type!==Nt.POLY||n.closeStroke;if(i.length!==0){var a=t.points,s=t.indices,u=i.length/2,h=a.length/2,l=h;for(a.push(i[0],i[1]),e=1;e<u;e++)a.push(i[e*2],i[e*2+1]),s.push(l,l+1),l++;o&&s.push(l,h)}}function xl(r,t){r.lineStyle.native?Vb(r,t):jb(r,t)}var El=function(){function r(){}return r.curveTo=function(t,e,n,i,o,a){var s=a[a.length-2],u=a[a.length-1],h=u-e,l=s-t,f=i-e,c=n-t,d=Math.abs(h*c-l*f);if(d<1e-8||o===0)return(a[a.length-2]!==t||a[a.length-1]!==e)&&a.push(t,e),null;var p=h*h+l*l,v=f*f+c*c,_=h*f+l*c,m=o*Math.sqrt(p)/d,g=o*Math.sqrt(v)/d,y=m*_/p,E=g*_/v,b=m*c+g*l,S=m*f+g*h,P=l*(g+y),T=h*(g+y),x=c*(m+E),w=f*(m+E),O=Math.atan2(T-S,P-b),I=Math.atan2(w-S,x-b);return{cx:b+t,cy:S+e,radius:o,startAngle:O,endAngle:I,anticlockwise:l*f>c*h}},r.arc=function(t,e,n,i,o,a,s,u,h){for(var l=s-a,f=On._segmentsCount(Math.abs(l)*o,Math.ceil(Math.abs(l)/fi)*40),c=l/(f*2),d=c*2,p=Math.cos(c),v=Math.sin(c),_=f-1,m=_%1/_,g=0;g<=_;++g){var y=g+m*g,E=c+a+d*y,b=Math.cos(E),S=-Math.sin(E);h.push((p*b+v*S)*o+n,(p*-S+v*b)*o+i)}},r}(),Yb=function(){function r(){}return r.curveLength=function(t,e,n,i,o,a,s,u){for(var h=10,l=0,f=0,c=0,d=0,p=0,v=0,_=0,m=0,g=0,y=0,E=0,b=t,S=e,P=1;P<=h;++P)f=P/h,c=f*f,d=c*f,p=1-f,v=p*p,_=v*p,m=_*t+3*v*f*n+3*p*c*o+d*s,g=_*e+3*v*f*i+3*p*c*a+d*u,y=b-m,E=S-g,b=m,S=g,l+=Math.sqrt(y*y+E*E);return l},r.curveTo=function(t,e,n,i,o,a,s){var u=s[s.length-2],h=s[s.length-1];s.length-=2;var l=On._segmentsCount(r.curveLength(u,h,t,e,n,i,o,a)),f=0,c=0,d=0,p=0,v=0;s.push(u,h);for(var _=1,m=0;_<=l;++_)m=_/l,f=1-m,c=f*f,d=c*f,p=m*m,v=p*m,s.push(d*u+3*c*m*t+3*f*p*n+v*o,d*h+3*c*m*e+3*f*p*i+v*a)},r}(),zb=function(){function r(){}return r.curveLength=function(t,e,n,i,o,a){var s=t-2*n+o,u=e-2*i+a,h=2*n-2*t,l=2*i-2*e,f=4*(s*s+u*u),c=4*(s*h+u*l),d=h*h+l*l,p=2*Math.sqrt(f+c+d),v=Math.sqrt(f),_=2*f*v,m=2*Math.sqrt(d),g=c/v;return(_*p+v*c*(p-m)+(4*d*f-c*c)*Math.log((2*v+g+p)/(g+m)))/(4*_)},r.curveTo=function(t,e,n,i,o){for(var a=o[o.length-2],s=o[o.length-1],u=On._segmentsCount(r.curveLength(a,s,t,e,n,i)),h=0,l=0,f=1;f<=u;++f){var c=f/u;h=a+(t-a)*c,l=s+(e-s)*c,o.push(h+(t+(n-t)*c-h)*c,l+(e+(i-e)*c-l)*c)}},r}(),Wb=function(){function r(){this.reset()}return r.prototype.begin=function(t,e,n){this.reset(),this.style=t,this.start=e,this.attribStart=n},r.prototype.end=function(t,e){this.attribSize=e-this.attribStart,this.size=t-this.start},r.prototype.reset=function(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0},r}(),vr,Ga=(vr={},vr[Nt.POLY]=yl,vr[Nt.CIRC]=Di,vr[Nt.ELIP]=Di,vr[Nt.RECT]=Xb,vr[Nt.RREC]=Hb,vr),Tl=[],Bi=[],wl=function(){function r(t,e,n,i){e===void 0&&(e=null),n===void 0&&(n=null),i===void 0&&(i=null),this.points=[],this.holes=[],this.shape=t,this.lineStyle=n,this.fillStyle=e,this.matrix=i,this.type=t.type}return r.prototype.clone=function(){return new r(this.shape,this.fillStyle,this.lineStyle,this.matrix)},r.prototype.destroy=function(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null},r}(),Vr=new Et,qb=function(r){Ua(t,r);function t(){var e=r.call(this)||this;return e.closePointEps=1e-4,e.boundsPadding=0,e.uvsFloat32=null,e.indicesUint16=null,e.batchable=!1,e.points=[],e.colors=[],e.uvs=[],e.indices=[],e.textureIds=[],e.graphicsData=[],e.drawCalls=[],e.batchDirty=-1,e.batches=[],e.dirty=0,e.cacheDirty=-1,e.clearDirty=0,e.shapeIndex=0,e._bounds=new vi,e.boundsDirty=-1,e}return Object.defineProperty(t.prototype,"bounds",{get:function(){return this.updateBatches(),this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds},enumerable:!1,configurable:!0}),t.prototype.invalidate=function(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(var e=0;e<this.drawCalls.length;e++)this.drawCalls[e].texArray.clear(),Bi.push(this.drawCalls[e]);this.drawCalls.length=0;for(var e=0;e<this.batches.length;e++){var n=this.batches[e];n.reset(),Tl.push(n)}this.batches.length=0},t.prototype.clear=function(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this},t.prototype.drawShape=function(e,n,i,o){n===void 0&&(n=null),i===void 0&&(i=null),o===void 0&&(o=null);var a=new wl(e,n,i,o);return this.graphicsData.push(a),this.dirty++,this},t.prototype.drawHole=function(e,n){if(n===void 0&&(n=null),!this.graphicsData.length)return null;var i=new wl(e,null,null,n),o=this.graphicsData[this.graphicsData.length-1];return i.lineStyle=o.lineStyle,o.holes.push(i),this.dirty++,this},t.prototype.destroy=function(){r.prototype.destroy.call(this);for(var e=0;e<this.graphicsData.length;++e)this.graphicsData[e].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null},t.prototype.containsPoint=function(e){for(var n=this.graphicsData,i=0;i<n.length;++i){var o=n[i];if(o.fillStyle.visible&&o.shape&&(o.matrix?o.matrix.applyInverse(e,Vr):Vr.copyFrom(e),o.shape.contains(Vr.x,Vr.y))){var a=!1;if(o.holes)for(var s=0;s<o.holes.length;s++){var u=o.holes[s];if(u.shape.contains(Vr.x,Vr.y)){a=!0;break}}if(!a)return!0}}return!1},t.prototype.updateBatches=function(){if(!this.graphicsData.length){this.batchable=!0;return}if(this.validateBatching()){this.cacheDirty=this.dirty;var e=this.uvs,n=this.graphicsData,i=null,o=null;this.batches.length>0&&(i=this.batches[this.batches.length-1],o=i.style);for(var a=this.shapeIndex;a<n.length;a++){this.shapeIndex++;var s=n[a],u=s.fillStyle,h=s.lineStyle,l=Ga[s.type];l.build(s),s.matrix&&this.transformPoints(s.points,s.matrix),(u.visible||h.visible)&&this.processHoles(s.holes);for(var f=0;f<2;f++){var c=f===0?u:h;if(c.visible){var d=c.texture.baseTexture,p=this.indices.length,v=this.points.length/2;d.wrapMode=me.REPEAT,f===0?this.processFill(s):this.processLine(s);var _=this.points.length/2-v;_!==0&&(i&&!this._compareStyles(o,c)&&(i.end(p,v),i=null),i||(i=Tl.pop()||new Wb,i.begin(c,p,v),this.batches.push(i),o=c),this.addUvs(this.points,e,c.texture,v,_,c.matrix))}}}var m=this.indices.length,g=this.points.length/2;if(i&&i.end(m,g),this.batches.length===0){this.batchable=!0;return}var y=g>65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&y===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=y?new Uint32Array(this.indices):new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}},t.prototype._compareStyles=function(e,n){return!(!e||!n||e.texture.baseTexture!==n.texture.baseTexture||e.color+e.alpha!==n.color+n.alpha||!!e.native!=!!n.native)},t.prototype.validateBatching=function(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(var e=0,n=this.graphicsData.length;e<n;e++){var i=this.graphicsData[e],o=i.fillStyle,a=i.lineStyle;if(o&&!o.texture.baseTexture.valid||a&&!a.texture.baseTexture.valid)return!1}return!0},t.prototype.packBatches=function(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);for(var e=this.batches,n=0,i=e.length;n<i;n++)for(var o=e[n],a=0;a<o.size;a++){var s=o.start+a;this.indicesUint16[s]=this.indicesUint16[s]-o.attribStart}},t.prototype.isBatchable=function(){if(this.points.length>65535*2)return!1;for(var e=this.batches,n=0;n<e.length;n++)if(e[n].style.native)return!1;return this.points.length<t.BATCHABLE_SIZE*2},t.prototype.buildDrawCalls=function(){for(var e=++ut._globalBatch,n=0;n<this.drawCalls.length;n++)this.drawCalls[n].texArray.clear(),Bi.push(this.drawCalls[n]);this.drawCalls.length=0;var i=this.colors,o=this.textureIds,a=Bi.pop();a||(a=new Ea,a.texArray=new Ta),a.texArray.count=0,a.start=0,a.size=0,a.type=oe.TRIANGLES;var s=0,u=null,h=0,l=!1,f=oe.TRIANGLES,c=0;this.drawCalls.push(a);for(var n=0;n<this.batches.length;n++){var d=this.batches[n],p=8,v=d.style,_=v.texture.baseTexture;l!==!!v.native&&(l=!!v.native,f=l?oe.LINES:oe.TRIANGLES,u=null,s=p,e++),u!==_&&(u=_,_._batchEnabled!==e&&(s===p&&(e++,s=0,a.size>0&&(a=Bi.pop(),a||(a=new Ea,a.texArray=new Ta),this.drawCalls.push(a)),a.start=c,a.size=0,a.texArray.count=0,a.type=f),_.touched=1,_._batchEnabled=e,_._batchLocation=s,_.wrapMode=me.REPEAT,a.texArray.elements[a.texArray.count++]=_,s++)),a.size+=d.size,c+=d.size,h=_._batchLocation,this.addColors(i,v.color,v.alpha,d.attribSize,d.attribStart),this.addTextureIds(o,h,d.attribSize,d.attribStart)}ut._globalBatch=e,this.packAttributes()},t.prototype.packAttributes=function(){for(var e=this.points,n=this.uvs,i=this.colors,o=this.textureIds,a=new ArrayBuffer(e.length*3*4),s=new Float32Array(a),u=new Uint32Array(a),h=0,l=0;l<e.length/2;l++)s[h++]=e[l*2],s[h++]=e[l*2+1],s[h++]=n[l*2],s[h++]=n[l*2+1],u[h++]=i[l],s[h++]=o[l];this._buffer.update(a),this._indexBuffer.update(this.indicesUint16)},t.prototype.processFill=function(e){if(e.holes.length)yl.triangulate(e,this);else{var n=Ga[e.type];n.triangulate(e,this)}},t.prototype.processLine=function(e){xl(e,this);for(var n=0;n<e.holes.length;n++)xl(e.holes[n],this)},t.prototype.processHoles=function(e){for(var n=0;n<e.length;n++){var i=e[n],o=Ga[i.type];o.build(i),i.matrix&&this.transformPoints(i.points,i.matrix)}},t.prototype.calculateBounds=function(){var e=this._bounds;e.clear(),e.addVertexData(this.points,0,this.points.length),e.pad(this.boundsPadding,this.boundsPadding)},t.prototype.transformPoints=function(e,n){for(var i=0;i<e.length/2;i++){var o=e[i*2],a=e[i*2+1];e[i*2]=n.a*o+n.c*a+n.tx,e[i*2+1]=n.b*o+n.d*a+n.ty}},t.prototype.addColors=function(e,n,i,o,a){a===void 0&&(a=0);var s=(n>>16)+(n&65280)+((n&255)<<16),u=ea(s,i);e.length=Math.max(e.length,a+o);for(var h=0;h<o;h++)e[a+h]=u},t.prototype.addTextureIds=function(e,n,i,o){o===void 0&&(o=0),e.length=Math.max(e.length,o+i);for(var a=0;a<i;a++)e[o+a]=n},t.prototype.addUvs=function(e,n,i,o,a,s){s===void 0&&(s=null);for(var u=0,h=n.length,l=i.frame;u<a;){var f=e[(o+u)*2],c=e[(o+u)*2+1];if(s){var d=s.a*f+s.c*c+s.tx;c=s.b*f+s.d*c+s.ty,f=d}u++,n.push(f/l.width,c/l.height)}var p=i.baseTexture;(l.width<p.width||l.height<p.height)&&this.adjustUvs(n,i,h,a)},t.prototype.adjustUvs=function(e,n,i,o){for(var a=n.baseTexture,s=1e-6,u=i+o*2,h=n.frame,l=h.width/a.width,f=h.height/a.height,c=h.x/h.width,d=h.y/h.height,p=Math.floor(e[i]+s),v=Math.floor(e[i+1]+s),_=i+2;_<u;_+=2)p=Math.min(p,Math.floor(e[_]+s)),v=Math.min(v,Math.floor(e[_+1]+s));c-=p,d-=v;for(var _=i;_<u;_+=2)e[_]=(e[_]+c)*l,e[_+1]=(e[_+1]+d)*f},t.BATCHABLE_SIZE=100,t}(Jh),$b=function(r){Ua(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.width=0,e.alignment=.5,e.native=!1,e.cap=ze.BUTT,e.join=De.MITER,e.miterLimit=10,e}return t.prototype.clone=function(){var e=new t;return e.color=this.color,e.alpha=this.alpha,e.texture=this.texture,e.matrix=this.matrix,e.visible=this.visible,e.width=this.width,e.alignment=this.alignment,e.native=this.native,e.cap=this.cap,e.join=this.join,e.miterLimit=this.miterLimit,e},t.prototype.reset=function(){r.prototype.reset.call(this),this.color=0,this.alignment=.5,this.width=0,this.native=!1},t}(ml),Kb=new Float32Array(3),ka={},Yr=function(r){Ua(t,r);function t(e){e===void 0&&(e=null);var n=r.call(this)||this;return n.shader=null,n.pluginName="batch",n.currentPath=null,n.batches=[],n.batchTint=-1,n.batchDirty=-1,n.vertexData=null,n._fillStyle=new ml,n._lineStyle=new $b,n._matrix=null,n._holeMode=!1,n.state=fr.for2d(),n._geometry=e||new qb,n._geometry.refCount++,n._transformID=-1,n.tint=16777215,n.blendMode=j.NORMAL,n}return Object.defineProperty(t.prototype,"geometry",{get:function(){return this._geometry},enumerable:!1,configurable:!0}),t.prototype.clone=function(){return this.finishPoly(),new t(this._geometry)},Object.defineProperty(t.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(e){this.state.blendMode=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tint",{get:function(){return this._tint},set:function(e){this._tint=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fill",{get:function(){return this._fillStyle},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"line",{get:function(){return this._lineStyle},enumerable:!1,configurable:!0}),t.prototype.lineStyle=function(e,n,i,o,a){return e===void 0&&(e=null),n===void 0&&(n=0),i===void 0&&(i=1),o===void 0&&(o=.5),a===void 0&&(a=!1),typeof e=="number"&&(e={width:e,color:n,alpha:i,alignment:o,native:a}),this.lineTextureStyle(e)},t.prototype.lineTextureStyle=function(e){e=Object.assign({width:0,texture:J.WHITE,color:e&&e.texture?16777215:0,alpha:1,matrix:null,alignment:.5,native:!1,cap:ze.BUTT,join:De.MITER,miterLimit:10},e),this.currentPath&&this.startPoly();var n=e.width>0&&e.alpha>0;return n?(e.matrix&&(e.matrix=e.matrix.clone(),e.matrix.invert()),Object.assign(this._lineStyle,{visible:n},e)):this._lineStyle.reset(),this},t.prototype.startPoly=function(){if(this.currentPath){var e=this.currentPath.points,n=this.currentPath.points.length;n>2&&(this.drawShape(this.currentPath),this.currentPath=new di,this.currentPath.closeStroke=!1,this.currentPath.points.push(e[n-2],e[n-1]))}else this.currentPath=new di,this.currentPath.closeStroke=!1},t.prototype.finishPoly=function(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)},t.prototype.moveTo=function(e,n){return this.startPoly(),this.currentPath.points[0]=e,this.currentPath.points[1]=n,this},t.prototype.lineTo=function(e,n){this.currentPath||this.moveTo(0,0);var i=this.currentPath.points,o=i[i.length-2],a=i[i.length-1];return(o!==e||a!==n)&&i.push(e,n),this},t.prototype._initCurve=function(e,n){e===void 0&&(e=0),n===void 0&&(n=0),this.currentPath?this.currentPath.points.length===0&&(this.currentPath.points=[e,n]):this.moveTo(e,n)},t.prototype.quadraticCurveTo=function(e,n,i,o){this._initCurve();var a=this.currentPath.points;return a.length===0&&this.moveTo(0,0),zb.curveTo(e,n,i,o,a),this},t.prototype.bezierCurveTo=function(e,n,i,o,a,s){return this._initCurve(),Yb.curveTo(e,n,i,o,a,s,this.currentPath.points),this},t.prototype.arcTo=function(e,n,i,o,a){this._initCurve(e,n);var s=this.currentPath.points,u=El.curveTo(e,n,i,o,a,s);if(u){var h=u.cx,l=u.cy,f=u.radius,c=u.startAngle,d=u.endAngle,p=u.anticlockwise;this.arc(h,l,f,c,d,p)}return this},t.prototype.arc=function(e,n,i,o,a,s){if(s===void 0&&(s=!1),o===a)return this;!s&&a<=o?a+=fi:s&&o<=a&&(o+=fi);var u=a-o;if(u===0)return this;var h=e+Math.cos(o)*i,l=n+Math.sin(o)*i,f=this._geometry.closePointEps,c=this.currentPath?this.currentPath.points:null;if(c){var d=Math.abs(c[c.length-2]-h),p=Math.abs(c[c.length-1]-l);d<f&&p<f||c.push(h,l)}else this.moveTo(h,l),c=this.currentPath.points;return El.arc(h,l,e,n,i,o,a,s,c),this},t.prototype.beginFill=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=1),this.beginTextureFill({texture:J.WHITE,color:e,alpha:n})},t.prototype.beginTextureFill=function(e){e=Object.assign({texture:J.WHITE,color:16777215,alpha:1,matrix:null},e),this.currentPath&&this.startPoly();var n=e.alpha>0;return n?(e.matrix&&(e.matrix=e.matrix.clone(),e.matrix.invert()),Object.assign(this._fillStyle,{visible:n},e)):this._fillStyle.reset(),this},t.prototype.endFill=function(){return this.finishPoly(),this._fillStyle.reset(),this},t.prototype.drawRect=function(e,n,i,o){return this.drawShape(new st(e,n,i,o))},t.prototype.drawRoundedRect=function(e,n,i,o,a){return this.drawShape(new ry(e,n,i,o,a))},t.prototype.drawCircle=function(e,n,i){return this.drawShape(new ty(e,n,i))},t.prototype.drawEllipse=function(e,n,i,o){return this.drawShape(new ey(e,n,i,o))},t.prototype.drawPolygon=function(){for(var e=arguments,n=[],i=0;i<arguments.length;i++)n[i]=e[i];var o,a=!0,s=n[0];s.points?(a=s.closeStroke,o=s.points):Array.isArray(n[0])?o=n[0]:o=n;var u=new di(o);return u.closeStroke=a,this.drawShape(u),this},t.prototype.drawShape=function(e){return this._holeMode?this._geometry.drawHole(e,this._matrix):this._geometry.drawShape(e,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this},t.prototype.clear=function(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this},t.prototype.isFastRect=function(){var e=this._geometry.graphicsData;return e.length===1&&e[0].shape.type===Nt.RECT&&!e[0].matrix&&!e[0].holes.length&&!(e[0].lineStyle.visible&&e[0].lineStyle.width)},t.prototype._render=function(e){this.finishPoly();var n=this._geometry;n.updateBatches(),n.batchable?(this.batchDirty!==n.batchDirty&&this._populateBatches(),this._renderBatched(e)):(e.batch.flush(),this._renderDirect(e))},t.prototype._populateBatches=function(){var e=this._geometry,n=this.blendMode,i=e.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=e.batchDirty,this.batches.length=i,this.vertexData=new Float32Array(e.points);for(var o=0;o<i;o++){var a=e.batches[o],s=a.style.color,u=new Float32Array(this.vertexData.buffer,a.attribStart*4*2,a.attribSize*2),h=new Float32Array(e.uvsFloat32.buffer,a.attribStart*4*2,a.attribSize*2),l=new Uint16Array(e.indicesUint16.buffer,a.start*2,a.size),f={vertexData:u,blendMode:n,indices:l,uvs:h,_batchRGB:Ur(s),_tintRGB:s,_texture:a.style.texture,alpha:a.style.alpha,worldAlpha:1};this.batches[o]=f}},t.prototype._renderBatched=function(e){if(this.batches.length){e.batch.setObjectRenderer(e.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(var n=0,i=this.batches.length;n<i;n++){var o=this.batches[n];o.worldAlpha=this.worldAlpha*o.alpha,e.plugins[this.pluginName].render(o)}}},t.prototype._renderDirect=function(e){var n=this._resolveDirectShader(e),i=this._geometry,o=this.tint,a=this.worldAlpha,s=n.uniforms,u=i.drawCalls;s.translationMatrix=this.transform.worldTransform,s.tint[0]=(o>>16&255)/255*a,s.tint[1]=(o>>8&255)/255*a,s.tint[2]=(o&255)/255*a,s.tint[3]=a,e.shader.bind(n),e.geometry.bind(i,n),e.state.set(this.state);for(var h=0,l=u.length;h<l;h++)this._renderDrawCallDirect(e,i.drawCalls[h])},t.prototype._renderDrawCallDirect=function(e,n){for(var i=n.texArray,o=n.type,a=n.size,s=n.start,u=i.count,h=0;h<u;h++)e.texture.bind(i.elements[h],h);e.geometry.draw(o,a,s)},t.prototype._resolveDirectShader=function(e){var n=this.shader,i=this.pluginName;if(!n){if(!ka[i]){for(var o=e.plugins[i].MAX_TEXTURES,a=new Int32Array(o),s=0;s<o;s++)a[s]=s;var u={tint:new Float32Array([1,1,1,1]),translationMatrix:new Mt,default:lr.from({uSamplers:a},!0)},h=e.plugins[i]._shader.program;ka[i]=new je(h,u)}n=ka[i]}return n},t.prototype._calculateBounds=function(){this.finishPoly();var e=this._geometry;if(e.graphicsData.length){var n=e.bounds,i=n.minX,o=n.minY,a=n.maxX,s=n.maxY;this._bounds.addFrame(this.transform,i,o,a,s)}},t.prototype.containsPoint=function(e){return this.worldTransform.applyInverse(e,t._TEMP_POINT),this._geometry.containsPoint(t._TEMP_POINT)},t.prototype.calculateTints=function(){if(this.batchTint!==this.tint){this.batchTint=this.tint;for(var e=Ur(this.tint,Kb),n=0;n<this.batches.length;n++){var i=this.batches[n],o=i._batchRGB,a=e[0]*o[0]*255,s=e[1]*o[1]*255,u=e[2]*o[2]*255,h=(a<<16)+(s<<8)+(u|0);i._tintRGB=(h>>16)+(h&65280)+((h&255)<<16)}}},t.prototype.calculateVertices=function(){var e=this.transform._worldID;if(this._transformID!==e){this._transformID=e;for(var n=this.transform.worldTransform,i=n.a,o=n.b,a=n.c,s=n.d,u=n.tx,h=n.ty,l=this._geometry.points,f=this.vertexData,c=0,d=0;d<l.length;d+=2){var p=l[d],v=l[d+1];f[c++]=i*p+a*v+u,f[c++]=s*v+o*p+h}}},t.prototype.closePath=function(){var e=this.currentPath;return e&&(e.closeStroke=!0,this.finishPoly()),this},t.prototype.setMatrix=function(e){return this._matrix=e,this},t.prototype.beginHole=function(){return this.finishPoly(),this._holeMode=!0,this},t.prototype.endHole=function(){return this.finishPoly(),this._holeMode=!1,this},t.prototype.destroy=function(e){this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,r.prototype.destroy.call(this,e)},t.nextRoundedRectBehavior=!1,t._TEMP_POINT=new Et,t}(Ee);/*!
725
- * @pixi/sprite - v6.5.10
726
- * Compiled Thu, 06 Jul 2023 15:25:11 UTC
727
- *
728
- * @pixi/sprite is licensed under the MIT License.
729
- * http://www.opensource.org/licenses/mit-license
730
- *//*! *****************************************************************************
731
- Copyright (c) Microsoft Corporation.
732
-
733
- Permission to use, copy, modify, and/or distribute this software for any
734
- purpose with or without fee is hereby granted.
735
-
736
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
737
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
738
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
739
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
740
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
741
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
742
- PERFORMANCE OF THIS SOFTWARE.
743
- ***************************************************************************** */var Xa=function(r,t){return Xa=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var i in n)n.hasOwnProperty(i)&&(e[i]=n[i])},Xa(r,t)};function Zb(r,t){Xa(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var Rn=new Et,Jb=new Uint16Array([0,1,2,0,2,3]),In=function(r){Zb(t,r);function t(e){var n=r.call(this)||this;return n._anchor=new Xr(n._onAnchorUpdate,n,e?e.defaultAnchor.x:0,e?e.defaultAnchor.y:0),n._texture=null,n._width=0,n._height=0,n._tint=null,n._tintRGB=null,n.tint=16777215,n.blendMode=j.NORMAL,n._cachedTint=16777215,n.uvs=null,n.texture=e||J.EMPTY,n.vertexData=new Float32Array(8),n.vertexTrimmedData=null,n._transformID=-1,n._textureID=-1,n._transformTrimmedID=-1,n._textureTrimmedID=-1,n.indices=Jb,n.pluginName="batch",n.isSprite=!0,n._roundPixels=k.ROUND_PIXELS,n}return t.prototype._onTextureUpdate=function(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=kr(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=kr(this.scale.y)*this._height/this._texture.orig.height)},t.prototype._onAnchorUpdate=function(){this._transformID=-1,this._transformTrimmedID=-1},t.prototype.calculateVertices=function(){var e=this._texture;if(!(this._transformID===this.transform._worldID&&this._textureID===e._updateID)){this._textureID!==e._updateID&&(this.uvs=this._texture._uvs.uvsFloat32),this._transformID=this.transform._worldID,this._textureID=e._updateID;var n=this.transform.worldTransform,i=n.a,o=n.b,a=n.c,s=n.d,u=n.tx,h=n.ty,l=this.vertexData,f=e.trim,c=e.orig,d=this._anchor,p=0,v=0,_=0,m=0;if(f?(v=f.x-d._x*c.width,p=v+f.width,m=f.y-d._y*c.height,_=m+f.height):(v=-d._x*c.width,p=v+c.width,m=-d._y*c.height,_=m+c.height),l[0]=i*v+a*m+u,l[1]=s*m+o*v+h,l[2]=i*p+a*m+u,l[3]=s*m+o*p+h,l[4]=i*p+a*_+u,l[5]=s*_+o*p+h,l[6]=i*v+a*_+u,l[7]=s*_+o*v+h,this._roundPixels)for(var g=k.RESOLUTION,y=0;y<l.length;++y)l[y]=Math.round((l[y]*g|0)/g)}},t.prototype.calculateTrimmedVertices=function(){if(!this.vertexTrimmedData)this.vertexTrimmedData=new Float32Array(8);else if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return;this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;var e=this._texture,n=this.vertexTrimmedData,i=e.orig,o=this._anchor,a=this.transform.worldTransform,s=a.a,u=a.b,h=a.c,l=a.d,f=a.tx,c=a.ty,d=-o._x*i.width,p=d+i.width,v=-o._y*i.height,_=v+i.height;n[0]=s*d+h*v+f,n[1]=l*v+u*d+c,n[2]=s*p+h*v+f,n[3]=l*v+u*p+c,n[4]=s*p+h*_+f,n[5]=l*_+u*p+c,n[6]=s*d+h*_+f,n[7]=l*_+u*d+c},t.prototype._render=function(e){this.calculateVertices(),e.batch.setObjectRenderer(e.plugins[this.pluginName]),e.plugins[this.pluginName].render(this)},t.prototype._calculateBounds=function(){var e=this._texture.trim,n=this._texture.orig;!e||e.width===n.width&&e.height===n.height?(this.calculateVertices(),this._bounds.addQuad(this.vertexData)):(this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData))},t.prototype.getLocalBounds=function(e){return this.children.length===0?(this._localBounds||(this._localBounds=new vi),this._localBounds.minX=this._texture.orig.width*-this._anchor._x,this._localBounds.minY=this._texture.orig.height*-this._anchor._y,this._localBounds.maxX=this._texture.orig.width*(1-this._anchor._x),this._localBounds.maxY=this._texture.orig.height*(1-this._anchor._y),e||(this._localBoundsRect||(this._localBoundsRect=new st),e=this._localBoundsRect),this._localBounds.getRectangle(e)):r.prototype.getLocalBounds.call(this,e)},t.prototype.containsPoint=function(e){this.worldTransform.applyInverse(e,Rn);var n=this._texture.orig.width,i=this._texture.orig.height,o=-n*this.anchor.x,a=0;return Rn.x>=o&&Rn.x<o+n&&(a=-i*this.anchor.y,Rn.y>=a&&Rn.y<a+i)},t.prototype.destroy=function(e){r.prototype.destroy.call(this,e),this._texture.off("update",this._onTextureUpdate,this),this._anchor=null;var n=typeof e=="boolean"?e:e&&e.texture;if(n){var i=typeof e=="boolean"?e:e&&e.baseTexture;this._texture.destroy(!!i)}this._texture=null},t.from=function(e,n){var i=e instanceof J?e:J.from(e,n);return new t(i)},Object.defineProperty(t.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(e){this._roundPixels!==e&&(this._transformID=-1),this._roundPixels=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return Math.abs(this.scale.x)*this._texture.orig.width},set:function(e){var n=kr(this.scale.x)||1;this.scale.x=n*e/this._texture.orig.width,this._width=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return Math.abs(this.scale.y)*this._texture.orig.height},set:function(e){var n=kr(this.scale.y)||1;this.scale.y=n*e/this._texture.orig.height,this._height=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"anchor",{get:function(){return this._anchor},set:function(e){this._anchor.copyFrom(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tint",{get:function(){return this._tint},set:function(e){this._tint=e,this._tintRGB=(e>>16)+(e&65280)+((e&255)<<16)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"texture",{get:function(){return this._texture},set:function(e){this._texture!==e&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=e||J.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,e&&(e.baseTexture.valid?this._onTextureUpdate():e.once("update",this._onTextureUpdate,this)))},enumerable:!1,configurable:!0}),t}(Ee);/*!
744
- * @pixi/text - v6.5.10
745
- * Compiled Thu, 06 Jul 2023 15:25:11 UTC
746
- *
747
- * @pixi/text is licensed under the MIT License.
748
- * http://www.opensource.org/licenses/mit-license
749
- *//*! *****************************************************************************
750
- Copyright (c) Microsoft Corporation.
751
-
752
- Permission to use, copy, modify, and/or distribute this software for any
753
- purpose with or without fee is hereby granted.
754
-
755
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
756
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
757
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
758
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
759
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
760
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
761
- PERFORMANCE OF THIS SOFTWARE.
762
- ***************************************************************************** */var Ha=function(r,t){return Ha=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var i in n)n.hasOwnProperty(i)&&(e[i]=n[i])},Ha(r,t)};function Qb(r,t){Ha(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var Cn;(function(r){r[r.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",r[r.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL"})(Cn||(Cn={}));var ja={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:Cn.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100,leading:0},t1=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],zr=function(){function r(t){this.styleID=0,this.reset(),Ya(this,t,t)}return r.prototype.clone=function(){var t={};return Ya(t,this,ja),new r(t)},r.prototype.reset=function(){Ya(this,ja,ja)},Object.defineProperty(r.prototype,"align",{get:function(){return this._align},set:function(t){this._align!==t&&(this._align=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"breakWords",{get:function(){return this._breakWords},set:function(t){this._breakWords!==t&&(this._breakWords=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"dropShadow",{get:function(){return this._dropShadow},set:function(t){this._dropShadow!==t&&(this._dropShadow=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"dropShadowAlpha",{get:function(){return this._dropShadowAlpha},set:function(t){this._dropShadowAlpha!==t&&(this._dropShadowAlpha=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"dropShadowAngle",{get:function(){return this._dropShadowAngle},set:function(t){this._dropShadowAngle!==t&&(this._dropShadowAngle=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"dropShadowBlur",{get:function(){return this._dropShadowBlur},set:function(t){this._dropShadowBlur!==t&&(this._dropShadowBlur=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"dropShadowColor",{get:function(){return this._dropShadowColor},set:function(t){var e=Va(t);this._dropShadowColor!==e&&(this._dropShadowColor=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"dropShadowDistance",{get:function(){return this._dropShadowDistance},set:function(t){this._dropShadowDistance!==t&&(this._dropShadowDistance=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"fill",{get:function(){return this._fill},set:function(t){var e=Va(t);this._fill!==e&&(this._fill=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"fillGradientType",{get:function(){return this._fillGradientType},set:function(t){this._fillGradientType!==t&&(this._fillGradientType=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"fillGradientStops",{get:function(){return this._fillGradientStops},set:function(t){e1(this._fillGradientStops,t)||(this._fillGradientStops=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"fontFamily",{get:function(){return this._fontFamily},set:function(t){this.fontFamily!==t&&(this._fontFamily=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"fontSize",{get:function(){return this._fontSize},set:function(t){this._fontSize!==t&&(this._fontSize=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"fontStyle",{get:function(){return this._fontStyle},set:function(t){this._fontStyle!==t&&(this._fontStyle=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"fontVariant",{get:function(){return this._fontVariant},set:function(t){this._fontVariant!==t&&(this._fontVariant=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"fontWeight",{get:function(){return this._fontWeight},set:function(t){this._fontWeight!==t&&(this._fontWeight=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"letterSpacing",{get:function(){return this._letterSpacing},set:function(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"lineHeight",{get:function(){return this._lineHeight},set:function(t){this._lineHeight!==t&&(this._lineHeight=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"leading",{get:function(){return this._leading},set:function(t){this._leading!==t&&(this._leading=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"lineJoin",{get:function(){return this._lineJoin},set:function(t){this._lineJoin!==t&&(this._lineJoin=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"miterLimit",{get:function(){return this._miterLimit},set:function(t){this._miterLimit!==t&&(this._miterLimit=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"padding",{get:function(){return this._padding},set:function(t){this._padding!==t&&(this._padding=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stroke",{get:function(){return this._stroke},set:function(t){var e=Va(t);this._stroke!==e&&(this._stroke=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"strokeThickness",{get:function(){return this._strokeThickness},set:function(t){this._strokeThickness!==t&&(this._strokeThickness=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"textBaseline",{get:function(){return this._textBaseline},set:function(t){this._textBaseline!==t&&(this._textBaseline=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"trim",{get:function(){return this._trim},set:function(t){this._trim!==t&&(this._trim=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"whiteSpace",{get:function(){return this._whiteSpace},set:function(t){this._whiteSpace!==t&&(this._whiteSpace=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"wordWrap",{get:function(){return this._wordWrap},set:function(t){this._wordWrap!==t&&(this._wordWrap=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"wordWrapWidth",{get:function(){return this._wordWrapWidth},set:function(t){this._wordWrapWidth!==t&&(this._wordWrapWidth=t,this.styleID++)},enumerable:!1,configurable:!0}),r.prototype.toFontString=function(){var t=typeof this.fontSize=="number"?this.fontSize+"px":this.fontSize,e=this.fontFamily;Array.isArray(this.fontFamily)||(e=this.fontFamily.split(","));for(var n=e.length-1;n>=0;n--){var i=e[n].trim();!/([\"\'])[^\'\"]+\1/.test(i)&&t1.indexOf(i)<0&&(i='"'+i+'"'),e[n]=i}return this.fontStyle+" "+this.fontVariant+" "+this.fontWeight+" "+t+" "+e.join(",")},r}();function Sl(r){return typeof r=="number"?ch(r):(typeof r=="string"&&r.indexOf("0x")===0&&(r=r.replace("0x","#")),r)}function Va(r){if(Array.isArray(r)){for(var t=0;t<r.length;++t)r[t]=Sl(r[t]);return r}else return Sl(r)}function e1(r,t){if(!Array.isArray(r)||!Array.isArray(t)||r.length!==t.length)return!1;for(var e=0;e<r.length;++e)if(r[e]!==t[e])return!1;return!0}function Ya(r,t,e){for(var n in e)Array.isArray(t[n])?r[n]=t[n].slice():r[n]=t[n]}var Ni={willReadFrequently:!0},Te=function(){function r(t,e,n,i,o,a,s,u,h){this.text=t,this.style=e,this.width=n,this.height=i,this.lines=o,this.lineWidths=a,this.lineHeight=s,this.maxLineWidth=u,this.fontProperties=h}return r.measureText=function(t,e,n,i){i===void 0&&(i=r._canvas),n=n??e.wordWrap;var o=e.toFontString(),a=r.measureFont(o);a.fontSize===0&&(a.fontSize=e.fontSize,a.ascent=e.fontSize);var s=i.getContext("2d",Ni);s.font=o;for(var u=n?r.wordWrap(t,e,i):t,h=u.split(/(?:\r\n|\r|\n)/),l=new Array(h.length),f=0,c=0;c<h.length;c++){var d=s.measureText(h[c]).width+(h[c].length-1)*e.letterSpacing;l[c]=d,f=Math.max(f,d)}var p=f+e.strokeThickness;e.dropShadow&&(p+=e.dropShadowDistance);var v=e.lineHeight||a.fontSize+e.strokeThickness,_=Math.max(v,a.fontSize+e.strokeThickness)+(h.length-1)*(v+e.leading);return e.dropShadow&&(_+=e.dropShadowDistance),new r(t,e,p,_,h,l,v+e.leading,f,a)},r.wordWrap=function(t,e,n){n===void 0&&(n=r._canvas);for(var i=n.getContext("2d",Ni),o=0,a="",s="",u=Object.create(null),h=e.letterSpacing,l=e.whiteSpace,f=r.collapseSpaces(l),c=r.collapseNewlines(l),d=!f,p=e.wordWrapWidth+h,v=r.tokenize(t),_=0;_<v.length;_++){var m=v[_];if(r.isNewline(m)){if(!c){s+=r.addLine(a),d=!f,a="",o=0;continue}m=" "}if(f){var g=r.isBreakingSpace(m),y=r.isBreakingSpace(a[a.length-1]);if(g&&y)continue}var E=r.getFromCache(m,h,u,i);if(E>p)if(a!==""&&(s+=r.addLine(a),a="",o=0),r.canBreakWords(m,e.breakWords))for(var b=r.wordWrapSplit(m),S=0;S<b.length;S++){for(var P=b[S],T=1;b[S+T];){var x=b[S+T],w=P[P.length-1];if(!r.canBreakChars(w,x,m,S,e.breakWords))P+=x;else break;T++}S+=P.length-1;var O=r.getFromCache(P,h,u,i);O+o>p&&(s+=r.addLine(a),d=!1,a="",o=0),a+=P,o+=O}else{a.length>0&&(s+=r.addLine(a),a="",o=0);var I=_===v.length-1;s+=r.addLine(m,!I),d=!1,a="",o=0}else E+o>p&&(d=!1,s+=r.addLine(a),a="",o=0),(a.length>0||!r.isBreakingSpace(m)||d)&&(a+=m,o+=E)}return s+=r.addLine(a,!1),s},r.addLine=function(t,e){return e===void 0&&(e=!0),t=r.trimRight(t),t=e?t+`
763
- `:t,t},r.getFromCache=function(t,e,n,i){var o=n[t];if(typeof o!="number"){var a=t.length*e;o=i.measureText(t).width+a,n[t]=o}return o},r.collapseSpaces=function(t){return t==="normal"||t==="pre-line"},r.collapseNewlines=function(t){return t==="normal"},r.trimRight=function(t){if(typeof t!="string")return"";for(var e=t.length-1;e>=0;e--){var n=t[e];if(!r.isBreakingSpace(n))break;t=t.slice(0,-1)}return t},r.isNewline=function(t){return typeof t!="string"?!1:r._newlines.indexOf(t.charCodeAt(0))>=0},r.isBreakingSpace=function(t,e){return typeof t!="string"?!1:r._breakingSpaces.indexOf(t.charCodeAt(0))>=0},r.tokenize=function(t){var e=[],n="";if(typeof t!="string")return e;for(var i=0;i<t.length;i++){var o=t[i],a=t[i+1];if(r.isBreakingSpace(o,a)||r.isNewline(o)){n!==""&&(e.push(n),n=""),e.push(o);continue}n+=o}return n!==""&&e.push(n),e},r.canBreakWords=function(t,e){return e},r.canBreakChars=function(t,e,n,i,o){return!0},r.wordWrapSplit=function(t){return t.split("")},r.measureFont=function(t){if(r._fonts[t])return r._fonts[t];var e={ascent:0,descent:0,fontSize:0},n=r._canvas,i=r._context;i.font=t;var o=r.METRICS_STRING+r.BASELINE_SYMBOL,a=Math.ceil(i.measureText(o).width),s=Math.ceil(i.measureText(r.BASELINE_SYMBOL).width),u=Math.ceil(r.HEIGHT_MULTIPLIER*s);s=s*r.BASELINE_MULTIPLIER|0,n.width=a,n.height=u,i.fillStyle="#f00",i.fillRect(0,0,a,u),i.font=t,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(o,0,s);var h=i.getImageData(0,0,a,u).data,l=h.length,f=a*4,c=0,d=0,p=!1;for(c=0;c<s;++c){for(var v=0;v<f;v+=4)if(h[d+v]!==255){p=!0;break}if(!p)d+=f;else break}for(e.ascent=s-c,d=l-f,p=!1,c=u;c>s;--c){for(var v=0;v<f;v+=4)if(h[d+v]!==255){p=!0;break}if(!p)d-=f;else break}return e.descent=c-s,e.fontSize=e.ascent+e.descent,r._fonts[t]=e,e},r.clearMetrics=function(t){t===void 0&&(t=""),t?delete r._fonts[t]:r._fonts={}},Object.defineProperty(r,"_canvas",{get:function(){if(!r.__canvas){var t=void 0;try{var e=new OffscreenCanvas(0,0),n=e.getContext("2d",Ni);if(n&&n.measureText)return r.__canvas=e,e;t=k.ADAPTER.createCanvas()}catch{t=k.ADAPTER.createCanvas()}t.width=t.height=10,r.__canvas=t}return r.__canvas},enumerable:!1,configurable:!0}),Object.defineProperty(r,"_context",{get:function(){return r.__context||(r.__context=r._canvas.getContext("2d",Ni)),r.__context},enumerable:!1,configurable:!0}),r}();Te._fonts={},Te.METRICS_STRING="|ÉqÅ",Te.BASELINE_SYMBOL="M",Te.BASELINE_MULTIPLIER=1.4,Te.HEIGHT_MULTIPLIER=2,Te._newlines=[10,13],Te._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];var r1={texture:!0,children:!1,baseTexture:!0},Al=function(r){Qb(t,r);function t(e,n,i){var o=this,a=!1;i||(i=k.ADAPTER.createCanvas(),a=!0),i.width=3,i.height=3;var s=J.from(i);return s.orig=new st,s.trim=new st,o=r.call(this,s)||this,o._ownCanvas=a,o.canvas=i,o.context=i.getContext("2d",{willReadFrequently:!0}),o._resolution=k.RESOLUTION,o._autoResolution=!0,o._text=null,o._style=null,o._styleListener=null,o._font="",o.text=e,o.style=n,o.localStyleID=-1,o}return t.prototype.updateText=function(e){var n=this._style;if(this.localStyleID!==n.styleID&&(this.dirty=!0,this.localStyleID=n.styleID),!(!this.dirty&&e)){this._font=this._style.toFontString();var i=this.context,o=Te.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),a=o.width,s=o.height,u=o.lines,h=o.lineHeight,l=o.lineWidths,f=o.maxLineWidth,c=o.fontProperties;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,a)+n.padding*2)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,s)+n.padding*2)*this._resolution),i.scale(this._resolution,this._resolution),i.clearRect(0,0,this.canvas.width,this.canvas.height),i.font=this._font,i.lineWidth=n.strokeThickness,i.textBaseline=n.textBaseline,i.lineJoin=n.lineJoin,i.miterLimit=n.miterLimit;for(var d,p,v=n.dropShadow?2:1,_=0;_<v;++_){var m=n.dropShadow&&_===0,g=m?Math.ceil(Math.max(1,s)+n.padding*2):0,y=g*this._resolution;if(m){i.fillStyle="black",i.strokeStyle="black";var E=n.dropShadowColor,b=Ur(typeof E=="number"?E:mn(E)),S=n.dropShadowBlur*this._resolution,P=n.dropShadowDistance*this._resolution;i.shadowColor="rgba("+b[0]*255+","+b[1]*255+","+b[2]*255+","+n.dropShadowAlpha+")",i.shadowBlur=S,i.shadowOffsetX=Math.cos(n.dropShadowAngle)*P,i.shadowOffsetY=Math.sin(n.dropShadowAngle)*P+y}else i.fillStyle=this._generateFillStyle(n,u,o),i.strokeStyle=n.stroke,i.shadowColor="black",i.shadowBlur=0,i.shadowOffsetX=0,i.shadowOffsetY=0;var T=(h-c.fontSize)/2;(!t.nextLineHeightBehavior||h-c.fontSize<0)&&(T=0);for(var x=0;x<u.length;x++)d=n.strokeThickness/2,p=n.strokeThickness/2+x*h+c.ascent+T,n.align==="right"?d+=f-l[x]:n.align==="center"&&(d+=(f-l[x])/2),n.stroke&&n.strokeThickness&&this.drawLetterSpacing(u[x],d+n.padding,p+n.padding-g,!0),n.fill&&this.drawLetterSpacing(u[x],d+n.padding,p+n.padding-g)}this.updateTexture()}},t.prototype.drawLetterSpacing=function(e,n,i,o){o===void 0&&(o=!1);var a=this._style,s=a.letterSpacing,u=t.experimentalLetterSpacing&&("letterSpacing"in CanvasRenderingContext2D.prototype||"textLetterSpacing"in CanvasRenderingContext2D.prototype);if(s===0||u){u&&(this.context.letterSpacing=s,this.context.textLetterSpacing=s),o?this.context.strokeText(e,n,i):this.context.fillText(e,n,i);return}for(var h=n,l=Array.from?Array.from(e):e.split(""),f=this.context.measureText(e).width,c=0,d=0;d<l.length;++d){var p=l[d];o?this.context.strokeText(p,h,i):this.context.fillText(p,h,i);for(var v="",_=d+1;_<l.length;++_)v+=l[_];c=this.context.measureText(v).width,h+=f-c+s,f=c}},t.prototype.updateTexture=function(){var e=this.canvas;if(this._style.trim){var n=Kg(e);n.data&&(e.width=n.width,e.height=n.height,this.context.putImageData(n.data,0,0))}var i=this._texture,o=this._style,a=o.trim?0:o.padding,s=i.baseTexture;i.trim.width=i._frame.width=e.width/this._resolution,i.trim.height=i._frame.height=e.height/this._resolution,i.trim.x=-a,i.trim.y=-a,i.orig.width=i._frame.width-a*2,i.orig.height=i._frame.height-a*2,this._onTextureUpdate(),s.setRealSize(e.width,e.height,this._resolution),i.updateUvs(),this.dirty=!1},t.prototype._render=function(e){this._autoResolution&&this._resolution!==e.resolution&&(this._resolution=e.resolution,this.dirty=!0),this.updateText(!0),r.prototype._render.call(this,e)},t.prototype.updateTransform=function(){this.updateText(!0),r.prototype.updateTransform.call(this)},t.prototype.getBounds=function(e,n){return this.updateText(!0),this._textureID===-1&&(e=!1),r.prototype.getBounds.call(this,e,n)},t.prototype.getLocalBounds=function(e){return this.updateText(!0),r.prototype.getLocalBounds.call(this,e)},t.prototype._calculateBounds=function(){this.calculateVertices(),this._bounds.addQuad(this.vertexData)},t.prototype._generateFillStyle=function(e,n,i){var o=e.fill;if(Array.isArray(o)){if(o.length===1)return o[0]}else return o;var a,s=e.dropShadow?e.dropShadowDistance:0,u=e.padding||0,h=this.canvas.width/this._resolution-s-u*2,l=this.canvas.height/this._resolution-s-u*2,f=o.slice(),c=e.fillGradientStops.slice();if(!c.length)for(var d=f.length+1,p=1;p<d;++p)c.push(p/d);if(f.unshift(o[0]),c.unshift(0),f.push(o[o.length-1]),c.push(1),e.fillGradientType===Cn.LINEAR_VERTICAL){a=this.context.createLinearGradient(h/2,u,h/2,l+u);for(var v=i.fontProperties.fontSize+e.strokeThickness,p=0;p<n.length;p++){var _=i.lineHeight*(p-1)+v,m=i.lineHeight*p,g=m;p>0&&_>m&&(g=(m+_)/2);var y=m+v,E=i.lineHeight*(p+1),b=y;p+1<n.length&&E<y&&(b=(y+E)/2);for(var S=(b-g)/l,P=0;P<f.length;P++){var T=0;typeof c[P]=="number"?T=c[P]:T=P/f.length;var x=Math.min(1,Math.max(0,g/l+T*S));x=Number(x.toFixed(5)),a.addColorStop(x,f[P])}}}else{a=this.context.createLinearGradient(u,l/2,h+u,l/2);for(var w=f.length+1,O=1,p=0;p<f.length;p++){var I=void 0;typeof c[p]=="number"?I=c[p]:I=O/w,a.addColorStop(I,f[p]),O++}}return a},t.prototype.destroy=function(e){typeof e=="boolean"&&(e={children:e}),e=Object.assign({},r1,e),r.prototype.destroy.call(this,e),this._ownCanvas&&(this.canvas.height=this.canvas.width=0),this.context=null,this.canvas=null,this._style=null},Object.defineProperty(t.prototype,"width",{get:function(){return this.updateText(!0),Math.abs(this.scale.x)*this._texture.orig.width},set:function(e){this.updateText(!0);var n=kr(this.scale.x)||1;this.scale.x=n*e/this._texture.orig.width,this._width=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.updateText(!0),Math.abs(this.scale.y)*this._texture.orig.height},set:function(e){this.updateText(!0);var n=kr(this.scale.y)||1;this.scale.y=n*e/this._texture.orig.height,this._height=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"style",{get:function(){return this._style},set:function(e){e=e||{},e instanceof zr?this._style=e:this._style=new zr(e),this.localStyleID=-1,this.dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"text",{get:function(){return this._text},set:function(e){e=String(e??""),this._text!==e&&(this._text=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"resolution",{get:function(){return this._resolution},set:function(e){this._autoResolution=!1,this._resolution!==e&&(this._resolution=e,this.dirty=!0)},enumerable:!1,configurable:!0}),t.nextLineHeightBehavior=!1,t.experimentalLetterSpacing=!1,t}(In);/*!
764
- * @pixi/prepare - v6.5.10
765
- * Compiled Thu, 06 Jul 2023 15:25:11 UTC
766
- *
767
- * @pixi/prepare is licensed under the MIT License.
768
- * http://www.opensource.org/licenses/mit-license
769
- */k.UPLOADS_PER_FRAME=4;/*! *****************************************************************************
770
- Copyright (c) Microsoft Corporation.
771
-
772
- Permission to use, copy, modify, and/or distribute this software for any
773
- purpose with or without fee is hereby granted.
774
-
775
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
776
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
777
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
778
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
779
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
780
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
781
- PERFORMANCE OF THIS SOFTWARE.
782
- ***************************************************************************** */var za=function(r,t){return za=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var i in n)n.hasOwnProperty(i)&&(e[i]=n[i])},za(r,t)};function n1(r,t){za(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var i1=function(){function r(t){this.maxItemsPerFrame=t,this.itemsLeft=0}return r.prototype.beginFrame=function(){this.itemsLeft=this.maxItemsPerFrame},r.prototype.allowedToUpload=function(){return this.itemsLeft-- >0},r}();function o1(r,t){var e=!1;if(r&&r._textures&&r._textures.length){for(var n=0;n<r._textures.length;n++)if(r._textures[n]instanceof J){var i=r._textures[n].baseTexture;t.indexOf(i)===-1&&(t.push(i),e=!0)}}return e}function a1(r,t){if(r.baseTexture instanceof ut){var e=r.baseTexture;return t.indexOf(e)===-1&&t.push(e),!0}return!1}function s1(r,t){if(r._texture&&r._texture instanceof J){var e=r._texture.baseTexture;return t.indexOf(e)===-1&&t.push(e),!0}return!1}function u1(r,t){return t instanceof Al?(t.updateText(!0),!0):!1}function h1(r,t){if(t instanceof zr){var e=t.toFontString();return Te.measureFont(e),!0}return!1}function l1(r,t){if(r instanceof Al){t.indexOf(r.style)===-1&&t.push(r.style),t.indexOf(r)===-1&&t.push(r);var e=r._texture.baseTexture;return t.indexOf(e)===-1&&t.push(e),!0}return!1}function f1(r,t){return r instanceof zr?(t.indexOf(r)===-1&&t.push(r),!0):!1}var c1=function(){function r(t){var e=this;this.limiter=new i1(k.UPLOADS_PER_FRAME),this.renderer=t,this.uploadHookHelper=null,this.queue=[],this.addHooks=[],this.uploadHooks=[],this.completes=[],this.ticking=!1,this.delayedTick=function(){e.queue&&e.prepareItems()},this.registerFindHook(l1),this.registerFindHook(f1),this.registerFindHook(o1),this.registerFindHook(a1),this.registerFindHook(s1),this.registerUploadHook(u1),this.registerUploadHook(h1)}return r.prototype.upload=function(t,e){var n=this;return typeof t=="function"&&(e=t,t=null),e&&le("6.5.0","BasePrepare.upload callback is deprecated, use the return Promise instead."),new Promise(function(i){t&&n.add(t);var o=function(){e==null||e(),i()};n.queue.length?(n.completes.push(o),n.ticking||(n.ticking=!0,Gt.system.addOnce(n.tick,n,Ie.UTILITY))):o()})},r.prototype.tick=function(){setTimeout(this.delayedTick,0)},r.prototype.prepareItems=function(){for(this.limiter.beginFrame();this.queue.length&&this.limiter.allowedToUpload();){var t=this.queue[0],e=!1;if(t&&!t._destroyed){for(var n=0,i=this.uploadHooks.length;n<i;n++)if(this.uploadHooks[n](this.uploadHookHelper,t)){this.queue.shift(),e=!0;break}}e||this.queue.shift()}if(this.queue.length)Gt.system.addOnce(this.tick,this,Ie.UTILITY);else{this.ticking=!1;var o=this.completes.slice(0);this.completes.length=0;for(var n=0,i=o.length;n<i;n++)o[n]()}},r.prototype.registerFindHook=function(t){return t&&this.addHooks.push(t),this},r.prototype.registerUploadHook=function(t){return t&&this.uploadHooks.push(t),this},r.prototype.add=function(t){for(var e=0,n=this.addHooks.length;e<n&&!this.addHooks[e](t,this.queue);e++);if(t instanceof Ee)for(var e=t.children.length-1;e>=0;e--)this.add(t.children[e]);return this},r.prototype.destroy=function(){this.ticking&&Gt.system.remove(this.tick,this),this.ticking=!1,this.addHooks=null,this.uploadHooks=null,this.renderer=null,this.completes=null,this.queue=null,this.limiter=null,this.uploadHookHelper=null},r}();function Pl(r,t){return t instanceof ut?(t._glTextures[r.CONTEXT_UID]||r.texture.bind(t),!0):!1}function d1(r,t){if(!(t instanceof Yr))return!1;var e=t.geometry;t.finishPoly(),e.updateBatches();for(var n=e.batches,i=0;i<n.length;i++){var o=n[i].style.texture;o&&Pl(r,o.baseTexture)}return e.batchable||r.geometry.bind(e,t._resolveDirectShader(r)),!0}function p1(r,t){return r instanceof Yr?(t.push(r),!0):!1}var v1=function(r){n1(t,r);function t(e){var n=r.call(this,e)||this;return n.uploadHookHelper=n.renderer,n.registerFindHook(p1),n.registerUploadHook(Pl),n.registerUploadHook(d1),n}return t.extension={name:"prepare",type:mt.RendererPlugin},t}(c1);/*!
783
- * @pixi/spritesheet - v6.5.10
784
- * Compiled Thu, 06 Jul 2023 15:25:11 UTC
785
- *
786
- * @pixi/spritesheet is licensed under the MIT License.
787
- * http://www.opensource.org/licenses/mit-license
788
- */var _1=function(){function r(t,e,n){n===void 0&&(n=null),this.linkedSheets=[],this._texture=t instanceof J?t:null,this.baseTexture=t instanceof ut?t:this._texture.baseTexture,this.textures={},this.animations={},this.data=e;var i=this.baseTexture.resource;this.resolution=this._updateResolution(n||(i?i.url:null)),this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}return r.prototype._updateResolution=function(t){t===void 0&&(t=null);var e=this.data.meta.scale,n=li(t,null);return n===null&&(n=e!==void 0?parseFloat(e):1),n!==1&&this.baseTexture.setResolution(n),n},r.prototype.parse=function(t){var e=this;return t&&le("6.5.0","Spritesheet.parse callback is deprecated, use the return Promise instead."),new Promise(function(n){e._callback=function(i){t==null||t(i),n(i)},e._batchIndex=0,e._frameKeys.length<=r.BATCH_SIZE?(e._processFrames(0),e._processAnimations(),e._parseComplete()):e._nextBatch()})},r.prototype._processFrames=function(t){for(var e=t,n=r.BATCH_SIZE;e-t<n&&e<this._frameKeys.length;){var i=this._frameKeys[e],o=this._frames[i],a=o.frame;if(a){var s=null,u=null,h=o.trimmed!==!1&&o.sourceSize?o.sourceSize:o.frame,l=new st(0,0,Math.floor(h.w)/this.resolution,Math.floor(h.h)/this.resolution);o.rotated?s=new st(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.h)/this.resolution,Math.floor(a.w)/this.resolution):s=new st(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution),o.trimmed!==!1&&o.spriteSourceSize&&(u=new st(Math.floor(o.spriteSourceSize.x)/this.resolution,Math.floor(o.spriteSourceSize.y)/this.resolution,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution)),this.textures[i]=new J(this.baseTexture,s,l,u,o.rotated?2:0,o.anchor),J.addToCache(this.textures[i],i)}e++}},r.prototype._processAnimations=function(){var t=this.data.animations||{};for(var e in t){this.animations[e]=[];for(var n=0;n<t[e].length;n++){var i=t[e][n];this.animations[e].push(this.textures[i])}}},r.prototype._parseComplete=function(){var t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)},r.prototype._nextBatch=function(){var t=this;this._processFrames(this._batchIndex*r.BATCH_SIZE),this._batchIndex++,setTimeout(function(){t._batchIndex*r.BATCH_SIZE<t._frameKeys.length?t._nextBatch():(t._processAnimations(),t._parseComplete())},0)},r.prototype.destroy=function(t){var e;t===void 0&&(t=!1);for(var n in this.textures)this.textures[n].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&((e=this._texture)===null||e===void 0||e.destroy(),this.baseTexture.destroy()),this._texture=null,this.baseTexture=null,this.linkedSheets=[]},r.BATCH_SIZE=1e3,r}(),m1=function(){function r(){}return r.use=function(t,e){var n,i,o=this,a=t.name+"_image";if(!t.data||t.type!==Rt.TYPE.JSON||!t.data.frames||o.resources[a]){e();return}var s=(i=(n=t.data)===null||n===void 0?void 0:n.meta)===null||i===void 0?void 0:i.related_multi_packs;if(Array.isArray(s))for(var u=function(p){if(typeof p!="string")return"continue";var v=p.replace(".json",""),_=Lr.resolve(t.url.replace(o.baseUrl,""),p);if(o.resources[v]||Object.values(o.resources).some(function(g){return Lr.format(Lr.parse(g.url))===_}))return"continue";var m={crossOrigin:t.crossOrigin,loadType:Rt.LOAD_TYPE.XHR,xhrType:Rt.XHR_RESPONSE_TYPE.JSON,parentResource:t,metadata:t.metadata};o.add(v,_,m)},h=0,l=s;h<l.length;h++){var f=l[h];u(f)}var c={crossOrigin:t.crossOrigin,metadata:t.metadata.imageMetadata,parentResource:t},d=r.getResourcePath(t,o.baseUrl);o.add(a,d,c,function(v){if(v.error){e(v.error);return}var _=new _1(v.texture,t.data,t.url);_.parse().then(function(){t.spritesheet=_,t.textures=_.textures,e()})})},r.getResourcePath=function(t,e){return t.isDataUrl?t.data.meta.image:Lr.resolve(t.url.replace(e,""),t.data.meta.image)},r.extension=mt.Loader,r}();/*!
789
- * @pixi/sprite-tiling - v6.5.10
790
- * Compiled Thu, 06 Jul 2023 15:25:11 UTC
791
- *
792
- * @pixi/sprite-tiling is licensed under the MIT License.
793
- * http://www.opensource.org/licenses/mit-license
794
- *//*! *****************************************************************************
795
- Copyright (c) Microsoft Corporation.
796
-
797
- Permission to use, copy, modify, and/or distribute this software for any
798
- purpose with or without fee is hereby granted.
799
-
800
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
801
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
802
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
803
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
804
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
805
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
806
- PERFORMANCE OF THIS SOFTWARE.
807
- ***************************************************************************** */var Wa=function(r,t){return Wa=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var i in n)n.hasOwnProperty(i)&&(e[i]=n[i])},Wa(r,t)};function Ol(r,t){Wa(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var Mn=new Et;(function(r){Ol(t,r);function t(e,n,i){n===void 0&&(n=100),i===void 0&&(i=100);var o=r.call(this,e)||this;return o.tileTransform=new Th,o._width=n,o._height=i,o.uvMatrix=o.texture.uvMatrix||new ya(e),o.pluginName="tilingSprite",o.uvRespectAnchor=!1,o}return Object.defineProperty(t.prototype,"clampMargin",{get:function(){return this.uvMatrix.clampMargin},set:function(e){this.uvMatrix.clampMargin=e,this.uvMatrix.update(!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tileScale",{get:function(){return this.tileTransform.scale},set:function(e){this.tileTransform.scale.copyFrom(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tilePosition",{get:function(){return this.tileTransform.position},set:function(e){this.tileTransform.position.copyFrom(e)},enumerable:!1,configurable:!0}),t.prototype._onTextureUpdate=function(){this.uvMatrix&&(this.uvMatrix.texture=this._texture),this._cachedTint=16777215},t.prototype._render=function(e){var n=this._texture;!n||!n.valid||(this.tileTransform.updateLocalTransform(),this.uvMatrix.update(),e.batch.setObjectRenderer(e.plugins[this.pluginName]),e.plugins[this.pluginName].render(this))},t.prototype._calculateBounds=function(){var e=this._width*-this._anchor._x,n=this._height*-this._anchor._y,i=this._width*(1-this._anchor._x),o=this._height*(1-this._anchor._y);this._bounds.addFrame(this.transform,e,n,i,o)},t.prototype.getLocalBounds=function(e){return this.children.length===0?(this._bounds.minX=this._width*-this._anchor._x,this._bounds.minY=this._height*-this._anchor._y,this._bounds.maxX=this._width*(1-this._anchor._x),this._bounds.maxY=this._height*(1-this._anchor._y),e||(this._localBoundsRect||(this._localBoundsRect=new st),e=this._localBoundsRect),this._bounds.getRectangle(e)):r.prototype.getLocalBounds.call(this,e)},t.prototype.containsPoint=function(e){this.worldTransform.applyInverse(e,Mn);var n=this._width,i=this._height,o=-n*this.anchor._x;if(Mn.x>=o&&Mn.x<o+n){var a=-i*this.anchor._y;if(Mn.y>=a&&Mn.y<a+i)return!0}return!1},t.prototype.destroy=function(e){r.prototype.destroy.call(this,e),this.tileTransform=null,this.uvMatrix=null},t.from=function(e,n){var i=e instanceof J?e:J.from(e,n);return new t(i,n.width,n.height)},Object.defineProperty(t.prototype,"width",{get:function(){return this._width},set:function(e){this._width=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this._height},set:function(e){this._height=e},enumerable:!1,configurable:!0}),t})(In);var g1=`#version 100
808
- #define SHADER_NAME Tiling-Sprite-Simple-100
607
+ result.a = (m[15] * c.r);
608
+ result.a += (m[16] * c.g);
609
+ result.a += (m[17] * c.b);
610
+ result.a += (m[18] * c.a);
611
+ result.a += m[19];
809
612
 
810
- precision lowp float;
613
+ vec3 rgb = mix(c.rgb, result.rgb, uAlpha);
614
+
615
+ // Premultiply alpha again.
616
+ rgb *= result.a;
811
617
 
618
+ gl_FragColor = vec4(rgb, result.a);
619
+ }
620
+ `;class rl extends re{constructor(){const t={m:new Float32Array([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0]),uAlpha:1};super(_d,j1,t),this.alpha=1}_loadMatrix(t,e=!1){let i=t;e&&(this._multiply(i,this.uniforms.m,t),i=this._colorMatrix(i)),this.uniforms.m=i}_multiply(t,e,i){return t[0]=e[0]*i[0]+e[1]*i[5]+e[2]*i[10]+e[3]*i[15],t[1]=e[0]*i[1]+e[1]*i[6]+e[2]*i[11]+e[3]*i[16],t[2]=e[0]*i[2]+e[1]*i[7]+e[2]*i[12]+e[3]*i[17],t[3]=e[0]*i[3]+e[1]*i[8]+e[2]*i[13]+e[3]*i[18],t[4]=e[0]*i[4]+e[1]*i[9]+e[2]*i[14]+e[3]*i[19]+e[4],t[5]=e[5]*i[0]+e[6]*i[5]+e[7]*i[10]+e[8]*i[15],t[6]=e[5]*i[1]+e[6]*i[6]+e[7]*i[11]+e[8]*i[16],t[7]=e[5]*i[2]+e[6]*i[7]+e[7]*i[12]+e[8]*i[17],t[8]=e[5]*i[3]+e[6]*i[8]+e[7]*i[13]+e[8]*i[18],t[9]=e[5]*i[4]+e[6]*i[9]+e[7]*i[14]+e[8]*i[19]+e[9],t[10]=e[10]*i[0]+e[11]*i[5]+e[12]*i[10]+e[13]*i[15],t[11]=e[10]*i[1]+e[11]*i[6]+e[12]*i[11]+e[13]*i[16],t[12]=e[10]*i[2]+e[11]*i[7]+e[12]*i[12]+e[13]*i[17],t[13]=e[10]*i[3]+e[11]*i[8]+e[12]*i[13]+e[13]*i[18],t[14]=e[10]*i[4]+e[11]*i[9]+e[12]*i[14]+e[13]*i[19]+e[14],t[15]=e[15]*i[0]+e[16]*i[5]+e[17]*i[10]+e[18]*i[15],t[16]=e[15]*i[1]+e[16]*i[6]+e[17]*i[11]+e[18]*i[16],t[17]=e[15]*i[2]+e[16]*i[7]+e[17]*i[12]+e[18]*i[17],t[18]=e[15]*i[3]+e[16]*i[8]+e[17]*i[13]+e[18]*i[18],t[19]=e[15]*i[4]+e[16]*i[9]+e[17]*i[14]+e[18]*i[19]+e[19],t}_colorMatrix(t){const e=new Float32Array(t);return e[4]/=255,e[9]/=255,e[14]/=255,e[19]/=255,e}brightness(t,e){const i=[t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0];this._loadMatrix(i,e)}tint(t,e){const[i,s,n]=xt.shared.setValue(t).toArray(),o=[i,0,0,0,0,0,s,0,0,0,0,0,n,0,0,0,0,0,1,0];this._loadMatrix(o,e)}greyscale(t,e){const i=[t,t,t,0,0,t,t,t,0,0,t,t,t,0,0,0,0,0,1,0];this._loadMatrix(i,e)}blackAndWhite(t){const e=[.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0];this._loadMatrix(e,t)}hue(t,e){t=(t||0)/180*Math.PI;const i=Math.cos(t),s=Math.sin(t),n=Math.sqrt,o=1/3,a=n(o),l=i+(1-i)*o,h=o*(1-i)-a*s,c=o*(1-i)+a*s,u=o*(1-i)+a*s,d=i+o*(1-i),f=o*(1-i)-a*s,p=o*(1-i)-a*s,m=o*(1-i)+a*s,_=i+o*(1-i),y=[l,h,c,0,0,u,d,f,0,0,p,m,_,0,0,0,0,0,1,0];this._loadMatrix(y,e)}contrast(t,e){const i=(t||0)+1,s=-.5*(i-1),n=[i,0,0,0,s,0,i,0,0,s,0,0,i,0,s,0,0,0,1,0];this._loadMatrix(n,e)}saturate(t=0,e){const i=t*2/3+1,s=(i-1)*-.5,n=[i,s,s,0,0,s,i,s,0,0,s,s,i,0,0,0,0,0,1,0];this._loadMatrix(n,e)}desaturate(){this.saturate(-1)}negative(t){const e=[-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0];this._loadMatrix(e,t)}sepia(t){const e=[.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0];this._loadMatrix(e,t)}technicolor(t){const e=[1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0];this._loadMatrix(e,t)}polaroid(t){const e=[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0];this._loadMatrix(e,t)}toBGR(t){const e=[0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0];this._loadMatrix(e,t)}kodachrome(t){const e=[1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0];this._loadMatrix(e,t)}browni(t){const e=[.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0];this._loadMatrix(e,t)}vintage(t){const e=[.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0];this._loadMatrix(e,t)}colorTone(t,e,i,s,n){t=t||.2,e=e||.15,i=i||16770432,s=s||3375104;const o=xt.shared,[a,l,h]=o.setValue(i).toArray(),[c,u,d]=o.setValue(s).toArray(),f=[.3,.59,.11,0,0,a,l,h,t,0,c,u,d,e,0,a-c,l-u,h-d,0,0];this._loadMatrix(f,n)}night(t,e){t=t||.1;const i=[t*-2,-t,0,0,0,-t,0,t,0,0,0,t,t*2,0,0,0,0,0,1,0];this._loadMatrix(i,e)}predator(t,e){const i=[11.224130630493164*t,-4.794486999511719*t,-2.8746118545532227*t,0*t,.40342438220977783*t,-3.6330697536468506*t,9.193157196044922*t,-2.951810836791992*t,0*t,-1.316135048866272*t,-3.2184197902679443*t,-4.2375030517578125*t,7.476448059082031*t,0*t,.8044459223747253*t,0,0,0,1,0];this._loadMatrix(i,e)}lsd(t){const e=[2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0];this._loadMatrix(e,t)}reset(){const t=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0];this._loadMatrix(t,!1)}get matrix(){return this.uniforms.m}set matrix(t){this.uniforms.m=t}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}}rl.prototype.grayscale=rl.prototype.greyscale;var Y1=`varying vec2 vFilterCoord;
812
621
  varying vec2 vTextureCoord;
813
622
 
623
+ uniform vec2 scale;
624
+ uniform mat2 rotation;
814
625
  uniform sampler2D uSampler;
815
- uniform vec4 uColor;
626
+ uniform sampler2D mapSampler;
627
+
628
+ uniform highp vec4 inputSize;
629
+ uniform vec4 inputClamp;
816
630
 
817
631
  void main(void)
818
632
  {
819
- vec4 texSample = texture2D(uSampler, vTextureCoord);
820
- gl_FragColor = texSample * uColor;
821
- }
822
- `,Rl=`#version 100
823
- #define SHADER_NAME Tiling-Sprite-100
633
+ vec4 map = texture2D(mapSampler, vFilterCoord);
824
634
 
825
- precision lowp float;
635
+ map -= 0.5;
636
+ map.xy = scale * inputSize.zw * (rotation * map.xy);
826
637
 
827
- attribute vec2 aVertexPosition;
828
- attribute vec2 aTextureCoord;
638
+ gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));
639
+ }
640
+ `,q1=`attribute vec2 aVertexPosition;
829
641
 
830
642
  uniform mat3 projectionMatrix;
831
- uniform mat3 translationMatrix;
832
- uniform mat3 uTransform;
643
+ uniform mat3 filterMatrix;
833
644
 
834
645
  varying vec2 vTextureCoord;
646
+ varying vec2 vFilterCoord;
835
647
 
836
- void main(void)
648
+ uniform vec4 inputSize;
649
+ uniform vec4 outputFrame;
650
+
651
+ vec4 filterVertexPosition( void )
837
652
  {
838
- gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
653
+ vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
839
654
 
840
- vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;
655
+ return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
841
656
  }
842
- `,y1=`#version 100
843
- #ifdef GL_EXT_shader_texture_lod
844
- #extension GL_EXT_shader_texture_lod : enable
845
- #endif
846
- #define SHADER_NAME Tiling-Sprite-100
847
657
 
848
- precision lowp float;
658
+ vec2 filterTextureCoord( void )
659
+ {
660
+ return aVertexPosition * (outputFrame.zw * inputSize.zw);
661
+ }
849
662
 
850
- varying vec2 vTextureCoord;
663
+ void main(void)
664
+ {
665
+ gl_Position = filterVertexPosition();
666
+ vTextureCoord = filterTextureCoord();
667
+ vFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy;
668
+ }
669
+ `;class K1 extends re{constructor(t,e){const i=new Et;t.renderable=!1,super(q1,Y1,{mapSampler:t._texture,filterMatrix:i,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])}),this.maskSprite=t,this.maskMatrix=i,e==null&&(e=20),this.scale=new pt(e,e)}apply(t,e,i,s){this.uniforms.filterMatrix=t.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;const n=this.maskSprite.worldTransform,o=Math.sqrt(n.a*n.a+n.b*n.b),a=Math.sqrt(n.c*n.c+n.d*n.d);o!==0&&a!==0&&(this.uniforms.rotation[0]=n.a/o,this.uniforms.rotation[1]=n.b/o,this.uniforms.rotation[2]=n.c/a,this.uniforms.rotation[3]=n.d/a),t.applyFilter(this,e,i,s)}get map(){return this.uniforms.mapSampler}set map(t){this.uniforms.mapSampler=t}}var Z1=`varying vec2 v_rgbNW;
670
+ varying vec2 v_rgbNE;
671
+ varying vec2 v_rgbSW;
672
+ varying vec2 v_rgbSE;
673
+ varying vec2 v_rgbM;
851
674
 
675
+ varying vec2 vFragCoord;
852
676
  uniform sampler2D uSampler;
853
- uniform vec4 uColor;
854
- uniform mat3 uMapCoord;
855
- uniform vec4 uClampFrame;
856
- uniform vec2 uClampOffset;
857
-
858
- void main(void)
859
- {
860
- vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);
861
- coord = (uMapCoord * vec3(coord, 1.0)).xy;
862
- vec2 unclamped = coord;
863
- coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
864
-
865
- #ifdef GL_EXT_shader_texture_lod
866
- vec4 texSample = unclamped == coord
867
- ? texture2D(uSampler, coord)
868
- : texture2DLodEXT(uSampler, coord, 0);
869
- #else
870
- vec4 texSample = texture2D(uSampler, coord);
871
- #endif
872
-
873
- gl_FragColor = texSample * uColor;
874
- }
875
- `,b1=`#version 300 es
876
- #define SHADER_NAME Tiling-Sprite-300
877
-
878
- precision lowp float;
879
-
880
- in vec2 aVertexPosition;
881
- in vec2 aTextureCoord;
882
-
883
- uniform mat3 projectionMatrix;
884
- uniform mat3 translationMatrix;
885
- uniform mat3 uTransform;
886
-
887
- out vec2 vTextureCoord;
888
-
889
- void main(void)
890
- {
891
- gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
892
-
893
- vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;
894
- }
895
- `,x1=`#version 300 es
896
- #define SHADER_NAME Tiling-Sprite-100
897
-
898
- precision lowp float;
899
-
900
- in vec2 vTextureCoord;
901
-
902
- out vec4 fragmentColor;
903
-
904
- uniform sampler2D uSampler;
905
- uniform vec4 uColor;
906
- uniform mat3 uMapCoord;
907
- uniform vec4 uClampFrame;
908
- uniform vec2 uClampOffset;
909
-
910
- void main(void)
911
- {
912
- vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);
913
- coord = (uMapCoord * vec3(coord, 1.0)).xy;
914
- vec2 unclamped = coord;
915
- coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
916
-
917
- vec4 texSample = texture(uSampler, coord, unclamped == coord ? 0.0f : -32.0f);// lod-bias very negative to force lod 0
918
-
919
- fragmentColor = texSample * uColor;
920
- }
921
- `,Li=new Mt,E1=function(r){Ol(t,r);function t(e){var n=r.call(this,e)||this;return e.runners.contextChange.add(n),n.quad=new Fh,n.state=fr.for2d(),n}return t.prototype.contextChange=function(){var e=this.renderer,n={globals:e.globalUniforms};this.simpleShader=je.from(Rl,g1,n),this.shader=e.context.webGLVersion>1?je.from(b1,x1,n):je.from(Rl,y1,n)},t.prototype.render=function(e){var n=this.renderer,i=this.quad,o=i.vertices;o[0]=o[6]=e._width*-e.anchor.x,o[1]=o[3]=e._height*-e.anchor.y,o[2]=o[4]=e._width*(1-e.anchor.x),o[5]=o[7]=e._height*(1-e.anchor.y);var a=e.uvRespectAnchor?e.anchor.x:0,s=e.uvRespectAnchor?e.anchor.y:0;o=i.uvs,o[0]=o[6]=-a,o[1]=o[3]=-s,o[2]=o[4]=1-a,o[5]=o[7]=1-s,i.invalidate();var u=e._texture,h=u.baseTexture,l=h.alphaMode>0,f=e.tileTransform.localTransform,c=e.uvMatrix,d=h.isPowerOfTwo&&u.frame.width===h.width&&u.frame.height===h.height;d&&(h._glTextures[n.CONTEXT_UID]?d=h.wrapMode!==me.CLAMP:h.wrapMode===me.CLAMP&&(h.wrapMode=me.REPEAT));var p=d?this.simpleShader:this.shader,v=u.width,_=u.height,m=e._width,g=e._height;Li.set(f.a*v/m,f.b*v/g,f.c*_/m,f.d*_/g,f.tx/m,f.ty/g),Li.invert(),d?Li.prepend(c.mapCoord):(p.uniforms.uMapCoord=c.mapCoord.toArray(!0),p.uniforms.uClampFrame=c.uClampFrame,p.uniforms.uClampOffset=c.uClampOffset),p.uniforms.uTransform=Li.toArray(!0),p.uniforms.uColor=vh(e.tint,e.worldAlpha,p.uniforms.uColor,l),p.uniforms.translationMatrix=e.transform.worldTransform.toArray(!0),p.uniforms.uSampler=u,n.shader.bind(p),n.geometry.bind(i),this.state.blendMode=ph(e.blendMode,l),n.state.set(this.state),n.geometry.draw(this.renderer.gl.TRIANGLES,6,0)},t.extension={name:"tilingSprite",type:mt.RendererPlugin},t}(gi);/*!
922
- * @pixi/mesh - v6.5.10
923
- * Compiled Thu, 06 Jul 2023 15:25:11 UTC
924
- *
925
- * @pixi/mesh is licensed under the MIT License.
926
- * http://www.opensource.org/licenses/mit-license
927
- *//*! *****************************************************************************
928
- Copyright (c) Microsoft Corporation.
929
-
930
- Permission to use, copy, modify, and/or distribute this software for any
931
- purpose with or without fee is hereby granted.
932
-
933
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
934
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
935
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
936
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
937
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
938
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
939
- PERFORMANCE OF THIS SOFTWARE.
940
- ***************************************************************************** */var qa=function(r,t){return qa=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var i in n)n.hasOwnProperty(i)&&(e[i]=n[i])},qa(r,t)};function $a(r,t){qa(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var T1=function(){function r(t,e){this.uvBuffer=t,this.uvMatrix=e,this.data=null,this._bufferUpdateId=-1,this._textureUpdateId=-1,this._updateID=0}return r.prototype.update=function(t){if(!(!t&&this._bufferUpdateId===this.uvBuffer._updateID&&this._textureUpdateId===this.uvMatrix._updateID)){this._bufferUpdateId=this.uvBuffer._updateID,this._textureUpdateId=this.uvMatrix._updateID;var e=this.uvBuffer.data;(!this.data||this.data.length!==e.length)&&(this.data=new Float32Array(e.length)),this.uvMatrix.multiplyUvs(e,this.data),this._updateID++}},r}(),Ka=new Et,Il=new di,Dn=function(r){$a(t,r);function t(e,n,i,o){o===void 0&&(o=oe.TRIANGLES);var a=r.call(this)||this;return a.geometry=e,a.shader=n,a.state=i||fr.for2d(),a.drawMode=o,a.start=0,a.size=0,a.uvs=null,a.indices=null,a.vertexData=new Float32Array(1),a.vertexDirty=-1,a._transformID=-1,a._roundPixels=k.ROUND_PIXELS,a.batchUvs=null,a}return Object.defineProperty(t.prototype,"geometry",{get:function(){return this._geometry},set:function(e){this._geometry!==e&&(this._geometry&&(this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose()),this._geometry=e,this._geometry&&this._geometry.refCount++,this.vertexDirty=-1)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"uvBuffer",{get:function(){return this.geometry.buffers[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"verticesBuffer",{get:function(){return this.geometry.buffers[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"material",{get:function(){return this.shader},set:function(e){this.shader=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(e){this.state.blendMode=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(e){this._roundPixels!==e&&(this._transformID=-1),this._roundPixels=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tint",{get:function(){return"tint"in this.shader?this.shader.tint:null},set:function(e){this.shader.tint=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"texture",{get:function(){return"texture"in this.shader?this.shader.texture:null},set:function(e){this.shader.texture=e},enumerable:!1,configurable:!0}),t.prototype._render=function(e){var n=this.geometry.buffers[0].data,i=this.shader;i.batchable&&this.drawMode===oe.TRIANGLES&&n.length<t.BATCHABLE_SIZE*2?this._renderToBatch(e):this._renderDefault(e)},t.prototype._renderDefault=function(e){var n=this.shader;n.alpha=this.worldAlpha,n.update&&n.update(),e.batch.flush(),n.uniforms.translationMatrix=this.transform.worldTransform.toArray(!0),e.shader.bind(n),e.state.set(this.state),e.geometry.bind(this.geometry,n),e.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)},t.prototype._renderToBatch=function(e){var n=this.geometry,i=this.shader;i.uvMatrix&&(i.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=n.indexBuffer.data,this._tintRGB=i._tintRGB,this._texture=i.texture;var o=this.material.pluginName;e.batch.setObjectRenderer(e.plugins[o]),e.plugins[o].render(this)},t.prototype.calculateVertices=function(){var e=this.geometry,n=e.buffers[0],i=n.data,o=n._updateID;if(!(o===this.vertexDirty&&this._transformID===this.transform._worldID)){this._transformID=this.transform._worldID,this.vertexData.length!==i.length&&(this.vertexData=new Float32Array(i.length));for(var a=this.transform.worldTransform,s=a.a,u=a.b,h=a.c,l=a.d,f=a.tx,c=a.ty,d=this.vertexData,p=0;p<d.length/2;p++){var v=i[p*2],_=i[p*2+1];d[p*2]=s*v+h*_+f,d[p*2+1]=u*v+l*_+c}if(this._roundPixels)for(var m=k.RESOLUTION,p=0;p<d.length;++p)d[p]=Math.round((d[p]*m|0)/m);this.vertexDirty=o}},t.prototype.calculateUvs=function(){var e=this.geometry.buffers[1],n=this.shader;n.uvMatrix.isSimple?this.uvs=e.data:(this.batchUvs||(this.batchUvs=new T1(e,n.uvMatrix)),this.batchUvs.update(),this.uvs=this.batchUvs.data)},t.prototype._calculateBounds=function(){this.calculateVertices(),this._bounds.addVertexData(this.vertexData,0,this.vertexData.length)},t.prototype.containsPoint=function(e){if(!this.getBounds().contains(e.x,e.y))return!1;this.worldTransform.applyInverse(e,Ka);for(var n=this.geometry.getBuffer("aVertexPosition").data,i=Il.points,o=this.geometry.getIndex().data,a=o.length,s=this.drawMode===4?3:1,u=0;u+2<a;u+=s){var h=o[u]*2,l=o[u+1]*2,f=o[u+2]*2;if(i[0]=n[h],i[1]=n[h+1],i[2]=n[l],i[3]=n[l+1],i[4]=n[f],i[5]=n[f+1],Il.contains(Ka.x,Ka.y))return!0}return!1},t.prototype.destroy=function(e){r.prototype.destroy.call(this,e),this._cachedTexture&&(this._cachedTexture.destroy(),this._cachedTexture=null),this.geometry=null,this.shader=null,this.state=null,this.uvs=null,this.indices=null,this.vertexData=null},t.BATCHABLE_SIZE=100,t}(Ee),w1=`varying vec2 vTextureCoord;
941
- uniform vec4 uColor;
942
-
943
- uniform sampler2D uSampler;
944
-
945
- void main(void)
946
- {
947
- gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;
948
- }
949
- `,S1=`attribute vec2 aVertexPosition;
950
- attribute vec2 aTextureCoord;
951
-
952
- uniform mat3 projectionMatrix;
953
- uniform mat3 translationMatrix;
954
- uniform mat3 uTextureMatrix;
955
-
956
- varying vec2 vTextureCoord;
957
-
958
- void main(void)
959
- {
960
- gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
961
-
962
- vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;
963
- }
964
- `,Fn=function(r){$a(t,r);function t(e,n){var i=this,o={uSampler:e,alpha:1,uTextureMatrix:Mt.IDENTITY,uColor:new Float32Array([1,1,1,1])};return n=Object.assign({tint:16777215,alpha:1,pluginName:"batch"},n),n.uniforms&&Object.assign(o,n.uniforms),i=r.call(this,n.program||wn.from(S1,w1),o)||this,i._colorDirty=!1,i.uvMatrix=new ya(e),i.batchable=n.program===void 0,i.pluginName=n.pluginName,i.tint=n.tint,i.alpha=n.alpha,i}return Object.defineProperty(t.prototype,"texture",{get:function(){return this.uniforms.uSampler},set:function(e){this.uniforms.uSampler!==e&&(!this.uniforms.uSampler.baseTexture.alphaMode!=!e.baseTexture.alphaMode&&(this._colorDirty=!0),this.uniforms.uSampler=e,this.uvMatrix.texture=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"alpha",{get:function(){return this._alpha},set:function(e){e!==this._alpha&&(this._alpha=e,this._colorDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tint",{get:function(){return this._tint},set:function(e){e!==this._tint&&(this._tint=e,this._tintRGB=(e>>16)+(e&65280)+((e&255)<<16),this._colorDirty=!0)},enumerable:!1,configurable:!0}),t.prototype.update=function(){if(this._colorDirty){this._colorDirty=!1;var e=this.texture.baseTexture;vh(this._tint,this._alpha,this.uniforms.uColor,e.alphaMode)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)},t}(je),Ui=function(r){$a(t,r);function t(e,n,i){var o=r.call(this)||this,a=new Dt(e),s=new Dt(n,!0),u=new Dt(i,!0,!0);return o.addAttribute("aVertexPosition",a,2,!1,H.FLOAT).addAttribute("aTextureCoord",s,2,!1,H.FLOAT).addIndex(u),o._updateId=-1,o}return Object.defineProperty(t.prototype,"vertexDirtyId",{get:function(){return this.buffers[0]._updateID},enumerable:!1,configurable:!0}),t}(xn);/*!
965
- * @pixi/text-bitmap - v6.5.10
966
- * Compiled Thu, 06 Jul 2023 15:25:11 UTC
967
- *
968
- * @pixi/text-bitmap is licensed under the MIT License.
969
- * http://www.opensource.org/licenses/mit-license
970
- *//*! *****************************************************************************
971
- Copyright (c) Microsoft Corporation.
972
-
973
- Permission to use, copy, modify, and/or distribute this software for any
974
- purpose with or without fee is hereby granted.
975
-
976
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
977
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
978
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
979
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
980
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
981
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
982
- PERFORMANCE OF THIS SOFTWARE.
983
- ***************************************************************************** */var Za=function(r,t){return Za=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var i in n)n.hasOwnProperty(i)&&(e[i]=n[i])},Za(r,t)};function A1(r,t){Za(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var Gi=function(){function r(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}return r}(),P1=function(){function r(){}return r.test=function(t){return typeof t=="string"&&t.indexOf("info face=")===0},r.parse=function(t){var e=t.match(/^[a-z]+\s+.+$/gm),n={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(var i in e){var o=e[i].match(/^[a-z]+/gm)[0],a=e[i].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),s={};for(var u in a){var h=a[u].split("="),l=h[0],f=h[1].replace(/"/gm,""),c=parseFloat(f),d=isNaN(c)?f:c;s[l]=d}n[o].push(s)}var p=new Gi;return n.info.forEach(function(v){return p.info.push({face:v.face,size:parseInt(v.size,10)})}),n.common.forEach(function(v){return p.common.push({lineHeight:parseInt(v.lineHeight,10)})}),n.page.forEach(function(v){return p.page.push({id:parseInt(v.id,10),file:v.file})}),n.char.forEach(function(v){return p.char.push({id:parseInt(v.id,10),page:parseInt(v.page,10),x:parseInt(v.x,10),y:parseInt(v.y,10),width:parseInt(v.width,10),height:parseInt(v.height,10),xoffset:parseInt(v.xoffset,10),yoffset:parseInt(v.yoffset,10),xadvance:parseInt(v.xadvance,10)})}),n.kerning.forEach(function(v){return p.kerning.push({first:parseInt(v.first,10),second:parseInt(v.second,10),amount:parseInt(v.amount,10)})}),n.distanceField.forEach(function(v){return p.distanceField.push({distanceRange:parseInt(v.distanceRange,10),fieldType:v.fieldType})}),p},r}(),Ja=function(){function r(){}return r.test=function(t){return t instanceof XMLDocument&&t.getElementsByTagName("page").length&&t.getElementsByTagName("info")[0].getAttribute("face")!==null},r.parse=function(t){for(var e=new Gi,n=t.getElementsByTagName("info"),i=t.getElementsByTagName("common"),o=t.getElementsByTagName("page"),a=t.getElementsByTagName("char"),s=t.getElementsByTagName("kerning"),u=t.getElementsByTagName("distanceField"),h=0;h<n.length;h++)e.info.push({face:n[h].getAttribute("face"),size:parseInt(n[h].getAttribute("size"),10)});for(var h=0;h<i.length;h++)e.common.push({lineHeight:parseInt(i[h].getAttribute("lineHeight"),10)});for(var h=0;h<o.length;h++)e.page.push({id:parseInt(o[h].getAttribute("id"),10)||0,file:o[h].getAttribute("file")});for(var h=0;h<a.length;h++){var l=a[h];e.char.push({id:parseInt(l.getAttribute("id"),10),page:parseInt(l.getAttribute("page"),10)||0,x:parseInt(l.getAttribute("x"),10),y:parseInt(l.getAttribute("y"),10),width:parseInt(l.getAttribute("width"),10),height:parseInt(l.getAttribute("height"),10),xoffset:parseInt(l.getAttribute("xoffset"),10),yoffset:parseInt(l.getAttribute("yoffset"),10),xadvance:parseInt(l.getAttribute("xadvance"),10)})}for(var h=0;h<s.length;h++)e.kerning.push({first:parseInt(s[h].getAttribute("first"),10),second:parseInt(s[h].getAttribute("second"),10),amount:parseInt(s[h].getAttribute("amount"),10)});for(var h=0;h<u.length;h++)e.distanceField.push({fieldType:u[h].getAttribute("fieldType"),distanceRange:parseInt(u[h].getAttribute("distanceRange"),10)});return e},r}(),O1=function(){function r(){}return r.test=function(t){if(typeof t=="string"&&t.indexOf("<font>")>-1){var e=new globalThis.DOMParser().parseFromString(t,"text/xml");return Ja.test(e)}return!1},r.parse=function(t){var e=new globalThis.DOMParser().parseFromString(t,"text/xml");return Ja.parse(e)},r}(),Qa=[P1,Ja,O1];function Cl(r){for(var t=0;t<Qa.length;t++)if(Qa[t].test(r))return Qa[t];return null}function R1(r,t,e,n,i,o){var a=e.fill;if(Array.isArray(a)){if(a.length===1)return a[0]}else return a;var s,u=e.dropShadow?e.dropShadowDistance:0,h=e.padding||0,l=r.width/n-u-h*2,f=r.height/n-u-h*2,c=a.slice(),d=e.fillGradientStops.slice();if(!d.length)for(var p=c.length+1,v=1;v<p;++v)d.push(v/p);if(c.unshift(a[0]),d.unshift(0),c.push(a[a.length-1]),d.push(1),e.fillGradientType===Cn.LINEAR_VERTICAL){s=t.createLinearGradient(l/2,h,l/2,f+h);for(var _=0,m=o.fontProperties.fontSize+e.strokeThickness,g=m/f,v=0;v<i.length;v++)for(var y=o.lineHeight*v,E=0;E<c.length;E++){var b=0;typeof d[E]=="number"?b=d[E]:b=E/c.length;var S=y/f+b*g,P=Math.max(_,S);P=Math.min(P,1),s.addColorStop(P,c[E]),_=P}}else{s=t.createLinearGradient(h,f/2,l+h,f/2);for(var T=c.length+1,x=1,v=0;v<c.length;v++){var w=void 0;typeof d[v]=="number"?w=d[v]:w=x/T,s.addColorStop(w,c[v]),x++}}return s}function I1(r,t,e,n,i,o,a){var s=e.text,u=e.fontProperties;t.translate(n,i),t.scale(o,o);var h=a.strokeThickness/2,l=-(a.strokeThickness/2);if(t.font=a.toFontString(),t.lineWidth=a.strokeThickness,t.textBaseline=a.textBaseline,t.lineJoin=a.lineJoin,t.miterLimit=a.miterLimit,t.fillStyle=R1(r,t,a,o,[s],e),t.strokeStyle=a.stroke,a.dropShadow){var f=a.dropShadowColor,c=Ur(typeof f=="number"?f:mn(f)),d=a.dropShadowBlur*o,p=a.dropShadowDistance*o;t.shadowColor="rgba("+c[0]*255+","+c[1]*255+","+c[2]*255+","+a.dropShadowAlpha+")",t.shadowBlur=d,t.shadowOffsetX=Math.cos(a.dropShadowAngle)*p,t.shadowOffsetY=Math.sin(a.dropShadowAngle)*p}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0;a.stroke&&a.strokeThickness&&t.strokeText(s,h,l+e.lineHeight-u.descent),a.fill&&t.fillText(s,h,l+e.lineHeight-u.descent),t.setTransform(1,0,0,1,0,0),t.fillStyle="rgba(0, 0, 0, 0)"}function Ml(r){return Array.from?Array.from(r):r.split("")}function C1(r){typeof r=="string"&&(r=[r]);for(var t=[],e=0,n=r.length;e<n;e++){var i=r[e];if(Array.isArray(i)){if(i.length!==2)throw new Error("[BitmapFont]: Invalid character range length, expecting 2 got "+i.length+".");var o=i[0].charCodeAt(0),a=i[1].charCodeAt(0);if(a<o)throw new Error("[BitmapFont]: Invalid character range.");for(var s=o,u=a;s<=u;s++)t.push(String.fromCharCode(s))}else t.push.apply(t,Ml(i))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}function ki(r){return r.codePointAt?r.codePointAt(0):r.charCodeAt(0)}var We=function(){function r(t,e,n){var i,o,a=t.info[0],s=t.common[0],u=t.page[0],h=t.distanceField[0],l=li(u.file),f={};this._ownsTextures=n,this.font=a.face,this.size=a.size,this.lineHeight=s.lineHeight/l,this.chars={},this.pageTextures=f;for(var c=0;c<t.page.length;c++){var d=t.page[c],p=d.id,v=d.file;f[p]=e instanceof Array?e[c]:e[v],h!=null&&h.fieldType&&h.fieldType!=="none"&&(f[p].baseTexture.alphaMode=se.NO_PREMULTIPLIED_ALPHA,f[p].baseTexture.mipmap=ae.OFF)}for(var c=0;c<t.char.length;c++){var _=t.char[c],p=_.id,m=_.page,g=t.char[c],y=g.x,E=g.y,b=g.width,S=g.height,P=g.xoffset,T=g.yoffset,x=g.xadvance;y/=l,E/=l,b/=l,S/=l,P/=l,T/=l,x/=l;var w=new st(y+f[m].frame.x/l,E+f[m].frame.y/l,b,S);this.chars[p]={xOffset:P,yOffset:T,xAdvance:x,kerning:{},texture:new J(f[m].baseTexture,w),page:m}}for(var c=0;c<t.kerning.length;c++){var O=t.kerning[c],I=O.first,C=O.second,G=O.amount;I/=l,C/=l,G/=l,this.chars[C]&&(this.chars[C].kerning[I]=G)}this.distanceFieldRange=h==null?void 0:h.distanceRange,this.distanceFieldType=(o=(i=h==null?void 0:h.fieldType)===null||i===void 0?void 0:i.toLowerCase())!==null&&o!==void 0?o:"none"}return r.prototype.destroy=function(){for(var t in this.chars)this.chars[t].texture.destroy(),this.chars[t].texture=null;for(var t in this.pageTextures)this._ownsTextures&&this.pageTextures[t].destroy(!0),this.pageTextures[t]=null;this.chars=null,this.pageTextures=null},r.install=function(t,e,n){var i;if(t instanceof Gi)i=t;else{var o=Cl(t);if(!o)throw new Error("Unrecognized data format for font.");i=o.parse(t)}e instanceof J&&(e=[e]);var a=new r(i,e,n);return r.available[a.font]=a,a},r.uninstall=function(t){var e=r.available[t];if(!e)throw new Error("No font found named '"+t+"'");e.destroy(),delete r.available[t]},r.from=function(t,e,n){if(!t)throw new Error("[BitmapFont] Property `name` is required.");var i=Object.assign({},r.defaultOptions,n),o=i.chars,a=i.padding,s=i.resolution,u=i.textureWidth,h=i.textureHeight,l=C1(o),f=e instanceof zr?e:new zr(e),c=u,d=new Gi;d.info[0]={face:f.fontFamily,size:f.fontSize},d.common[0]={lineHeight:f.fontSize};for(var p=0,v=0,_,m,g,y=0,E=[],b=0;b<l.length;b++){_||(_=k.ADAPTER.createCanvas(),_.width=u,_.height=h,m=_.getContext("2d"),g=new ut(_,{resolution:s}),E.push(new J(g)),d.page.push({id:E.length-1,file:""}));var S=l[b],P=Te.measureText(S,f,!1,_),T=P.width,x=Math.ceil(P.height),w=Math.ceil((f.fontStyle==="italic"?2:1)*T);if(v>=h-x*s){if(v===0)throw new Error("[BitmapFont] textureHeight "+h+"px is too small "+("(fontFamily: '"+f.fontFamily+"', fontSize: "+f.fontSize+"px, char: '"+S+"')"));--b,_=null,m=null,g=null,v=0,p=0,y=0;continue}if(y=Math.max(x+P.fontProperties.descent,y),w*s+p>=c){if(p===0)throw new Error("[BitmapFont] textureWidth "+u+"px is too small "+("(fontFamily: '"+f.fontFamily+"', fontSize: "+f.fontSize+"px, char: '"+S+"')"));--b,v+=y*s,v=Math.ceil(v),p=0,y=0;continue}I1(_,m,P,p,v,s,f);var O=ki(P.text);d.char.push({id:O,page:E.length-1,x:p/s,y:v/s,width:w,height:x,xoffset:0,yoffset:0,xadvance:Math.ceil(T-(f.dropShadow?f.dropShadowDistance:0)-(f.stroke?f.strokeThickness:0))}),p+=(w+2*a)*s,p=Math.ceil(p)}if(!(n!=null&&n.skipKerning))for(var b=0,I=l.length;b<I;b++)for(var C=l[b],G=0;G<I;G++){var B=l[G],N=m.measureText(C).width,W=m.measureText(B).width,K=m.measureText(C+B).width,Q=K-(N+W);Q&&d.kerning.push({first:ki(C),second:ki(B),amount:Q})}var L=new r(d,E,!0);return r.available[t]!==void 0&&r.uninstall(t),r.available[t]=L,L},r.ALPHA=[["a","z"],["A","Z"]," "],r.NUMERIC=[["0","9"]],r.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],r.ASCII=[[" ","~"]],r.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:r.ALPHANUMERIC},r.available={},r}(),M1=`// Pixi texture info\r
984
- varying vec2 vTextureCoord;\r
985
- uniform sampler2D uSampler;\r
986
- \r
987
- // Tint\r
988
- uniform vec4 uColor;\r
989
- \r
990
- // on 2D applications fwidth is screenScale / glyphAtlasScale * distanceFieldRange\r
991
- uniform float uFWidth;\r
992
- \r
993
- void main(void) {\r
994
- \r
995
- // To stack MSDF and SDF we need a non-pre-multiplied-alpha texture.\r
996
- vec4 texColor = texture2D(uSampler, vTextureCoord);\r
997
- \r
998
- // MSDF\r
999
- float median = texColor.r + texColor.g + texColor.b -\r
1000
- min(texColor.r, min(texColor.g, texColor.b)) -\r
1001
- max(texColor.r, max(texColor.g, texColor.b));\r
1002
- // SDF\r
1003
- median = min(median, texColor.a);\r
1004
- \r
1005
- float screenPxDistance = uFWidth * (median - 0.5);\r
1006
- float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);\r
1007
- if (median < 0.01) {\r
1008
- alpha = 0.0;\r
1009
- } else if (median > 0.99) {\r
1010
- alpha = 1.0;\r
1011
- }\r
1012
- \r
1013
- // NPM Textures, NPM outputs\r
1014
- gl_FragColor = vec4(uColor.rgb, uColor.a * alpha);\r
1015
- \r
1016
- }\r
1017
- `,D1=`// Mesh material default fragment\r
1018
- attribute vec2 aVertexPosition;\r
1019
- attribute vec2 aTextureCoord;\r
1020
- \r
1021
- uniform mat3 projectionMatrix;\r
1022
- uniform mat3 translationMatrix;\r
1023
- uniform mat3 uTextureMatrix;\r
1024
- \r
1025
- varying vec2 vTextureCoord;\r
1026
- \r
1027
- void main(void)\r
1028
- {\r
1029
- gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\r
1030
- \r
1031
- vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\r
1032
- }\r
1033
- `,Dl=[],Fl=[],Bl=[];(function(r){A1(t,r);function t(e,n){n===void 0&&(n={});var i=r.call(this)||this;i._tint=16777215;var o=Object.assign({},t.styleDefaults,n),a=o.align,s=o.tint,u=o.maxWidth,h=o.letterSpacing,l=o.fontName,f=o.fontSize;if(!We.available[l])throw new Error('Missing BitmapFont "'+l+'"');return i._activePagesMeshData=[],i._textWidth=0,i._textHeight=0,i._align=a,i._tint=s,i._font=void 0,i._fontName=l,i._fontSize=f,i.text=e,i._maxWidth=u,i._maxLineHeight=0,i._letterSpacing=h,i._anchor=new Xr(function(){i.dirty=!0},i,0,0),i._roundPixels=k.ROUND_PIXELS,i.dirty=!0,i._resolution=k.RESOLUTION,i._autoResolution=!0,i._textureCache={},i}return t.prototype.updateText=function(){for(var e,n=We.available[this._fontName],i=this.fontSize,o=i/n.size,a=new Et,s=[],u=[],h=[],l=this._text.replace(/(?:\r\n|\r)/g,`
1034
- `)||" ",f=Ml(l),c=this._maxWidth*n.size/i,d=n.distanceFieldType==="none"?Dl:Fl,p=null,v=0,_=0,m=0,g=-1,y=0,E=0,b=0,S=0,P=0;P<f.length;P++){var T=f[P],x=ki(T);if(/(?:\s)/.test(T)&&(g=P,y=v,S++),T==="\r"||T===`
1035
- `){u.push(v),h.push(-1),_=Math.max(_,v),++m,++E,a.x=0,a.y+=n.lineHeight,p=null,S=0;continue}var w=n.chars[x];if(w){p&&w.kerning[p]&&(a.x+=w.kerning[p]);var O=Bl.pop()||{texture:J.EMPTY,line:0,charCode:0,prevSpaces:0,position:new Et};O.texture=w.texture,O.line=m,O.charCode=x,O.position.x=a.x+w.xOffset+this._letterSpacing/2,O.position.y=a.y+w.yOffset,O.prevSpaces=S,s.push(O),v=O.position.x+Math.max(w.xAdvance-w.xOffset,w.texture.orig.width),a.x+=w.xAdvance+this._letterSpacing,b=Math.max(b,w.yOffset+w.texture.height),p=x,g!==-1&&c>0&&a.x>c&&(++E,Gr(s,1+g-E,1+P-g),P=g,g=-1,u.push(y),h.push(s.length>0?s[s.length-1].prevSpaces:0),_=Math.max(_,y),m++,a.x=0,a.y+=n.lineHeight,p=null,S=0)}}var I=f[f.length-1];I!=="\r"&&I!==`
1036
- `&&(/(?:\s)/.test(I)&&(v=y),u.push(v),_=Math.max(_,v),h.push(-1));for(var C=[],P=0;P<=m;P++){var G=0;this._align==="right"?G=_-u[P]:this._align==="center"?G=(_-u[P])/2:this._align==="justify"&&(G=h[P]<0?0:(_-u[P])/h[P]),C.push(G)}var B=s.length,N={},W=[],K=this._activePagesMeshData;d.push.apply(d,K);for(var P=0;P<B;P++){var Q=s[P].texture,L=Q.baseTexture.uid;if(!N[L]){var F=d.pop();if(!F){var X=new Ui,tt=void 0,rt=void 0;n.distanceFieldType==="none"?(tt=new Fn(J.EMPTY),rt=j.NORMAL):(tt=new Fn(J.EMPTY,{program:wn.from(D1,M1),uniforms:{uFWidth:0}}),rt=j.NORMAL_NPM);var vt=new Dn(X,tt);vt.blendMode=rt,F={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:vt,vertices:null,uvs:null,indices:null}}F.index=0,F.indexCount=0,F.vertexCount=0,F.uvsCount=0,F.total=0;var V=this._textureCache;V[L]=V[L]||new J(Q.baseTexture),F.mesh.texture=V[L],F.mesh.tint=this._tint,W.push(F),N[L]=F}N[L].total++}for(var P=0;P<K.length;P++)W.indexOf(K[P])===-1&&this.removeChild(K[P].mesh);for(var P=0;P<W.length;P++)W[P].mesh.parent!==this&&this.addChild(W[P].mesh);this._activePagesMeshData=W;for(var P in N){var F=N[P],ht=F.total;if(!(((e=F.indices)===null||e===void 0?void 0:e.length)>6*ht)||F.vertices.length<Dn.BATCHABLE_SIZE*2)F.vertices=new Float32Array(4*2*ht),F.uvs=new Float32Array(4*2*ht),F.indices=new Uint16Array(6*ht);else for(var gt=F.total,Tt=F.vertices,q=gt*4*2;q<Tt.length;q++)Tt[q]=0;F.mesh.size=6*ht}for(var P=0;P<B;P++){var T=s[P],it=T.position.x+C[T.line]*(this._align==="justify"?T.prevSpaces:1);this._roundPixels&&(it=Math.round(it));var at=it*o,ct=T.position.y*o,Q=T.texture,nt=N[Q.baseTexture.uid],D=Q.frame,R=Q._uvs,dt=nt.index++;nt.indices[dt*6+0]=0+dt*4,nt.indices[dt*6+1]=1+dt*4,nt.indices[dt*6+2]=2+dt*4,nt.indices[dt*6+3]=0+dt*4,nt.indices[dt*6+4]=2+dt*4,nt.indices[dt*6+5]=3+dt*4,nt.vertices[dt*8+0]=at,nt.vertices[dt*8+1]=ct,nt.vertices[dt*8+2]=at+D.width*o,nt.vertices[dt*8+3]=ct,nt.vertices[dt*8+4]=at+D.width*o,nt.vertices[dt*8+5]=ct+D.height*o,nt.vertices[dt*8+6]=at,nt.vertices[dt*8+7]=ct+D.height*o,nt.uvs[dt*8+0]=R.x0,nt.uvs[dt*8+1]=R.y0,nt.uvs[dt*8+2]=R.x1,nt.uvs[dt*8+3]=R.y1,nt.uvs[dt*8+4]=R.x2,nt.uvs[dt*8+5]=R.y2,nt.uvs[dt*8+6]=R.x3,nt.uvs[dt*8+7]=R.y3}this._textWidth=_*o,this._textHeight=(a.y+n.lineHeight)*o;for(var P in N){var F=N[P];if(this.anchor.x!==0||this.anchor.y!==0)for(var we=0,Jr=this._textWidth*this.anchor.x,zi=this._textHeight*this.anchor.y,bf=0;bf<F.total;bf++)F.vertices[we++]-=Jr,F.vertices[we++]-=zi,F.vertices[we++]-=Jr,F.vertices[we++]-=zi,F.vertices[we++]-=Jr,F.vertices[we++]-=zi,F.vertices[we++]-=Jr,F.vertices[we++]-=zi;this._maxLineHeight=b*o;var xf=F.mesh.geometry.getBuffer("aVertexPosition"),Ef=F.mesh.geometry.getBuffer("aTextureCoord"),Tf=F.mesh.geometry.getIndex();xf.data=F.vertices,Ef.data=F.uvs,Tf.data=F.indices,xf.update(),Ef.update(),Tf.update()}for(var P=0;P<s.length;P++)Bl.push(s[P]);this._font=n,this.dirty=!1},t.prototype.updateTransform=function(){this.validate(),this.containerUpdateTransform()},t.prototype._render=function(e){this._autoResolution&&this._resolution!==e.resolution&&(this._resolution=e.resolution,this.dirty=!0);var n=We.available[this._fontName],i=n.distanceFieldRange,o=n.distanceFieldType,a=n.size;if(o!=="none")for(var s=this.worldTransform,u=s.a,h=s.b,l=s.c,f=s.d,c=Math.sqrt(u*u+h*h),d=Math.sqrt(l*l+f*f),p=(Math.abs(c)+Math.abs(d))/2,v=this.fontSize/a,_=0,m=this._activePagesMeshData;_<m.length;_++){var g=m[_];g.mesh.shader.uniforms.uFWidth=p*i*v*this._resolution}r.prototype._render.call(this,e)},t.prototype.getLocalBounds=function(){return this.validate(),r.prototype.getLocalBounds.call(this)},t.prototype.validate=function(){var e=We.available[this._fontName];if(!e)throw new Error('Missing BitmapFont "'+this._fontName+'"');this._font!==e&&(this.dirty=!0),this.dirty&&this.updateText()},Object.defineProperty(t.prototype,"tint",{get:function(){return this._tint},set:function(e){if(this._tint!==e){this._tint=e;for(var n=0;n<this._activePagesMeshData.length;n++)this._activePagesMeshData[n].mesh.tint=e}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"align",{get:function(){return this._align},set:function(e){this._align!==e&&(this._align=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontName",{get:function(){return this._fontName},set:function(e){if(!We.available[e])throw new Error('Missing BitmapFont "'+e+'"');this._fontName!==e&&(this._fontName=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontSize",{get:function(){var e;return(e=this._fontSize)!==null&&e!==void 0?e:We.available[this._fontName].size},set:function(e){this._fontSize!==e&&(this._fontSize=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"anchor",{get:function(){return this._anchor},set:function(e){typeof e=="number"?this._anchor.set(e):this._anchor.copyFrom(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"text",{get:function(){return this._text},set:function(e){e=String(e??""),this._text!==e&&(this._text=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxWidth",{get:function(){return this._maxWidth},set:function(e){this._maxWidth!==e&&(this._maxWidth=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxLineHeight",{get:function(){return this.validate(),this._maxLineHeight},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"textWidth",{get:function(){return this.validate(),this._textWidth},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"letterSpacing",{get:function(){return this._letterSpacing},set:function(e){this._letterSpacing!==e&&(this._letterSpacing=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(e){e!==this._roundPixels&&(this._roundPixels=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"textHeight",{get:function(){return this.validate(),this._textHeight},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"resolution",{get:function(){return this._resolution},set:function(e){this._autoResolution=!1,this._resolution!==e&&(this._resolution=e,this.dirty=!0)},enumerable:!1,configurable:!0}),t.prototype.destroy=function(e){var n=this._textureCache,i=We.available[this._fontName],o=i.distanceFieldType==="none"?Dl:Fl;o.push.apply(o,this._activePagesMeshData);for(var a=0,s=this._activePagesMeshData;a<s.length;a++){var u=s[a];this.removeChild(u.mesh)}this._activePagesMeshData=[],o.filter(function(f){return n[f.mesh.texture.baseTexture.uid]}).forEach(function(f){f.mesh.texture=J.EMPTY});for(var h in n){var l=n[h];l.destroy(),delete n[h]}this._font=null,this._textureCache=null,r.prototype.destroy.call(this,e)},t.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0},t})(Ee);var F1=function(){function r(){}return r.add=function(){Rt.setExtensionXhrType("fnt",Rt.XHR_RESPONSE_TYPE.TEXT)},r.use=function(t,e){var n=Cl(t.data);if(!n){e();return}for(var i=r.getBaseUrl(this,t),o=n.parse(t.data),a={},s=function(v){a[v.metadata.pageFile]=v.texture,Object.keys(a).length===o.page.length&&(t.bitmapFont=We.install(o,a,!0),e())},u=0;u<o.page.length;++u){var h=o.page[u].file,l=i+h,f=!1;for(var c in this.resources){var d=this.resources[c];if(d.url===l){d.metadata.pageFile=h,d.texture?s(d):d.onAfterMiddleware.add(s),f=!0;break}}if(!f){var p={crossOrigin:t.crossOrigin,loadType:Rt.LOAD_TYPE.IMAGE,metadata:Object.assign({pageFile:h},t.metadata.imageMetadata),parentResource:t};this.add(l,p,s)}}},r.getBaseUrl=function(t,e){var n=e.isDataUrl?"":r.dirname(e.url);return e.isDataUrl&&(n==="."&&(n=""),t.baseUrl&&n&&t.baseUrl.charAt(t.baseUrl.length-1)==="/"&&(n+="/")),n=n.replace(t.baseUrl,""),n&&n.charAt(n.length-1)!=="/"&&(n+="/"),n},r.dirname=function(t){var e=t.replace(/\\/g,"/").replace(/\/$/,"").replace(/\/[^\/]*$/,"");return e===t?".":e===""?"/":e},r.extension=mt.Loader,r}();/*!
1037
- * @pixi/filter-alpha - v6.5.10
1038
- * Compiled Thu, 06 Jul 2023 15:25:11 UTC
1039
- *
1040
- * @pixi/filter-alpha is licensed under the MIT License.
1041
- * http://www.opensource.org/licenses/mit-license
1042
- *//*! *****************************************************************************
1043
- Copyright (c) Microsoft Corporation.
1044
-
1045
- Permission to use, copy, modify, and/or distribute this software for any
1046
- purpose with or without fee is hereby granted.
1047
-
1048
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
1049
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
1050
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
1051
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
1052
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1053
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1054
- PERFORMANCE OF THIS SOFTWARE.
1055
- ***************************************************************************** */var ts=function(r,t){return ts=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var i in n)n.hasOwnProperty(i)&&(e[i]=n[i])},ts(r,t)};function B1(r,t){ts(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var N1=`varying vec2 vTextureCoord;
1056
-
1057
- uniform sampler2D uSampler;
1058
- uniform float uAlpha;
1059
-
1060
- void main(void)
1061
- {
1062
- gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;
1063
- }
1064
- `;(function(r){B1(t,r);function t(e){e===void 0&&(e=1);var n=r.call(this,R0,N1,{uAlpha:1})||this;return n.alpha=e,n}return Object.defineProperty(t.prototype,"alpha",{get:function(){return this.uniforms.uAlpha},set:function(e){this.uniforms.uAlpha=e},enumerable:!1,configurable:!0}),t})(Ve);/*!
1065
- * @pixi/filter-blur - v6.5.10
1066
- * Compiled Thu, 06 Jul 2023 15:25:11 UTC
1067
- *
1068
- * @pixi/filter-blur is licensed under the MIT License.
1069
- * http://www.opensource.org/licenses/mit-license
1070
- *//*! *****************************************************************************
1071
- Copyright (c) Microsoft Corporation.
1072
-
1073
- Permission to use, copy, modify, and/or distribute this software for any
1074
- purpose with or without fee is hereby granted.
1075
-
1076
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
1077
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
1078
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
1079
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
1080
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1081
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1082
- PERFORMANCE OF THIS SOFTWARE.
1083
- ***************************************************************************** */var es=function(r,t){return es=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var i in n)n.hasOwnProperty(i)&&(e[i]=n[i])},es(r,t)};function Nl(r,t){es(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var L1=`
1084
- attribute vec2 aVertexPosition;
1085
-
1086
- uniform mat3 projectionMatrix;
1087
-
1088
- uniform float strength;
1089
-
1090
- varying vec2 vBlurTexCoords[%size%];
1091
-
1092
- uniform vec4 inputSize;
1093
- uniform vec4 outputFrame;
1094
-
1095
- vec4 filterVertexPosition( void )
1096
- {
1097
- vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
1098
-
1099
- return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
1100
- }
1101
-
1102
- vec2 filterTextureCoord( void )
1103
- {
1104
- return aVertexPosition * (outputFrame.zw * inputSize.zw);
1105
- }
1106
-
1107
- void main(void)
1108
- {
1109
- gl_Position = filterVertexPosition();
1110
-
1111
- vec2 textureCoord = filterTextureCoord();
1112
- %blur%
1113
- }`;function U1(r,t){var e=Math.ceil(r/2),n=L1,i="",o;t?o="vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);":o="vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);";for(var a=0;a<r;a++){var s=o.replace("%index%",a.toString());s=s.replace("%sampleIndex%",a-(e-1)+".0"),i+=s,i+=`
1114
- `}return n=n.replace("%blur%",i),n=n.replace("%size%",r.toString()),n}var G1={5:[.153388,.221461,.250301],7:[.071303,.131514,.189879,.214607],9:[.028532,.067234,.124009,.179044,.20236],11:[.0093,.028002,.065984,.121703,.175713,.198596],13:[.002406,.009255,.027867,.065666,.121117,.174868,.197641],15:[489e-6,.002403,.009246,.02784,.065602,.120999,.174697,.197448]},k1=["varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{"," gl_FragColor = vec4(0.0);"," %blur%","}"].join(`
1115
- `);function X1(r){for(var t=G1[r],e=t.length,n=k1,i="",o="gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;",a,s=0;s<r;s++){var u=o.replace("%index%",s.toString());a=s,s>=e&&(a=r-s-1),u=u.replace("%value%",t[a].toString()),i+=u,i+=`
1116
- `}return n=n.replace("%blur%",i),n=n.replace("%size%",r.toString()),n}var Ll=function(r){Nl(t,r);function t(e,n,i,o,a){n===void 0&&(n=8),i===void 0&&(i=4),o===void 0&&(o=k.FILTER_RESOLUTION),a===void 0&&(a=5);var s=this,u=U1(a,e),h=X1(a);return s=r.call(this,u,h)||this,s.horizontal=e,s.resolution=o,s._quality=0,s.quality=i,s.blur=n,s}return t.prototype.apply=function(e,n,i,o){if(i?this.horizontal?this.uniforms.strength=1/i.width*(i.width/n.width):this.uniforms.strength=1/i.height*(i.height/n.height):this.horizontal?this.uniforms.strength=1/e.renderer.width*(e.renderer.width/n.width):this.uniforms.strength=1/e.renderer.height*(e.renderer.height/n.height),this.uniforms.strength*=this.strength,this.uniforms.strength/=this.passes,this.passes===1)e.applyFilter(this,n,i,o);else{var a=e.getFilterTexture(),s=e.renderer,u=n,h=a;this.state.blend=!1,e.applyFilter(this,u,h,ue.CLEAR);for(var l=1;l<this.passes-1;l++){e.bindAndClear(u,ue.BLIT),this.uniforms.uSampler=h;var f=h;h=u,u=f,s.shader.bind(this),s.geometry.draw(5)}this.state.blend=!0,e.applyFilter(this,h,i,o),e.returnFilterTexture(a)}},Object.defineProperty(t.prototype,"blur",{get:function(){return this.strength},set:function(e){this.padding=1+Math.abs(e)*2,this.strength=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"quality",{get:function(){return this._quality},set:function(e){this._quality=e,this.passes=e},enumerable:!1,configurable:!0}),t}(Ve);(function(r){Nl(t,r);function t(e,n,i,o){e===void 0&&(e=8),n===void 0&&(n=4),i===void 0&&(i=k.FILTER_RESOLUTION),o===void 0&&(o=5);var a=r.call(this)||this;return a.blurXFilter=new Ll(!0,e,n,i,o),a.blurYFilter=new Ll(!1,e,n,i,o),a.resolution=i,a.quality=n,a.blur=e,a.repeatEdgePixels=!1,a}return t.prototype.apply=function(e,n,i,o){var a=Math.abs(this.blurXFilter.strength),s=Math.abs(this.blurYFilter.strength);if(a&&s){var u=e.getFilterTexture();this.blurXFilter.apply(e,n,u,ue.CLEAR),this.blurYFilter.apply(e,u,i,o),e.returnFilterTexture(u)}else s?this.blurYFilter.apply(e,n,i,o):this.blurXFilter.apply(e,n,i,o)},t.prototype.updatePadding=function(){this._repeatEdgePixels?this.padding=0:this.padding=Math.max(Math.abs(this.blurXFilter.strength),Math.abs(this.blurYFilter.strength))*2},Object.defineProperty(t.prototype,"blur",{get:function(){return this.blurXFilter.blur},set:function(e){this.blurXFilter.blur=this.blurYFilter.blur=e,this.updatePadding()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"quality",{get:function(){return this.blurXFilter.quality},set:function(e){this.blurXFilter.quality=this.blurYFilter.quality=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"blurX",{get:function(){return this.blurXFilter.blur},set:function(e){this.blurXFilter.blur=e,this.updatePadding()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"blurY",{get:function(){return this.blurYFilter.blur},set:function(e){this.blurYFilter.blur=e,this.updatePadding()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"blendMode",{get:function(){return this.blurYFilter.blendMode},set:function(e){this.blurYFilter.blendMode=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"repeatEdgePixels",{get:function(){return this._repeatEdgePixels},set:function(e){this._repeatEdgePixels=e,this.updatePadding()},enumerable:!1,configurable:!0}),t})(Ve);/*!
1117
- * @pixi/filter-color-matrix - v6.5.10
1118
- * Compiled Thu, 06 Jul 2023 15:25:11 UTC
1119
- *
1120
- * @pixi/filter-color-matrix is licensed under the MIT License.
1121
- * http://www.opensource.org/licenses/mit-license
1122
- *//*! *****************************************************************************
1123
- Copyright (c) Microsoft Corporation.
1124
-
1125
- Permission to use, copy, modify, and/or distribute this software for any
1126
- purpose with or without fee is hereby granted.
1127
-
1128
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
1129
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
1130
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
1131
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
1132
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1133
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1134
- PERFORMANCE OF THIS SOFTWARE.
1135
- ***************************************************************************** */var rs=function(r,t){return rs=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var i in n)n.hasOwnProperty(i)&&(e[i]=n[i])},rs(r,t)};function H1(r,t){rs(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var j1=`varying vec2 vTextureCoord;
1136
- uniform sampler2D uSampler;
1137
- uniform float m[20];
1138
- uniform float uAlpha;
1139
-
1140
- void main(void)
1141
- {
1142
- vec4 c = texture2D(uSampler, vTextureCoord);
1143
-
1144
- if (uAlpha == 0.0) {
1145
- gl_FragColor = c;
1146
- return;
1147
- }
1148
-
1149
- // Un-premultiply alpha before applying the color matrix. See issue #3539.
1150
- if (c.a > 0.0) {
1151
- c.rgb /= c.a;
1152
- }
1153
-
1154
- vec4 result;
1155
-
1156
- result.r = (m[0] * c.r);
1157
- result.r += (m[1] * c.g);
1158
- result.r += (m[2] * c.b);
1159
- result.r += (m[3] * c.a);
1160
- result.r += m[4];
1161
-
1162
- result.g = (m[5] * c.r);
1163
- result.g += (m[6] * c.g);
1164
- result.g += (m[7] * c.b);
1165
- result.g += (m[8] * c.a);
1166
- result.g += m[9];
1167
-
1168
- result.b = (m[10] * c.r);
1169
- result.b += (m[11] * c.g);
1170
- result.b += (m[12] * c.b);
1171
- result.b += (m[13] * c.a);
1172
- result.b += m[14];
1173
-
1174
- result.a = (m[15] * c.r);
1175
- result.a += (m[16] * c.g);
1176
- result.a += (m[17] * c.b);
1177
- result.a += (m[18] * c.a);
1178
- result.a += m[19];
1179
-
1180
- vec3 rgb = mix(c.rgb, result.rgb, uAlpha);
1181
-
1182
- // Premultiply alpha again.
1183
- rgb *= result.a;
1184
-
1185
- gl_FragColor = vec4(rgb, result.a);
1186
- }
1187
- `,Ul=function(r){H1(t,r);function t(){var e=this,n={m:new Float32Array([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0]),uAlpha:1};return e=r.call(this,Zh,j1,n)||this,e.alpha=1,e}return t.prototype._loadMatrix=function(e,n){n===void 0&&(n=!1);var i=e;n&&(this._multiply(i,this.uniforms.m,e),i=this._colorMatrix(i)),this.uniforms.m=i},t.prototype._multiply=function(e,n,i){return e[0]=n[0]*i[0]+n[1]*i[5]+n[2]*i[10]+n[3]*i[15],e[1]=n[0]*i[1]+n[1]*i[6]+n[2]*i[11]+n[3]*i[16],e[2]=n[0]*i[2]+n[1]*i[7]+n[2]*i[12]+n[3]*i[17],e[3]=n[0]*i[3]+n[1]*i[8]+n[2]*i[13]+n[3]*i[18],e[4]=n[0]*i[4]+n[1]*i[9]+n[2]*i[14]+n[3]*i[19]+n[4],e[5]=n[5]*i[0]+n[6]*i[5]+n[7]*i[10]+n[8]*i[15],e[6]=n[5]*i[1]+n[6]*i[6]+n[7]*i[11]+n[8]*i[16],e[7]=n[5]*i[2]+n[6]*i[7]+n[7]*i[12]+n[8]*i[17],e[8]=n[5]*i[3]+n[6]*i[8]+n[7]*i[13]+n[8]*i[18],e[9]=n[5]*i[4]+n[6]*i[9]+n[7]*i[14]+n[8]*i[19]+n[9],e[10]=n[10]*i[0]+n[11]*i[5]+n[12]*i[10]+n[13]*i[15],e[11]=n[10]*i[1]+n[11]*i[6]+n[12]*i[11]+n[13]*i[16],e[12]=n[10]*i[2]+n[11]*i[7]+n[12]*i[12]+n[13]*i[17],e[13]=n[10]*i[3]+n[11]*i[8]+n[12]*i[13]+n[13]*i[18],e[14]=n[10]*i[4]+n[11]*i[9]+n[12]*i[14]+n[13]*i[19]+n[14],e[15]=n[15]*i[0]+n[16]*i[5]+n[17]*i[10]+n[18]*i[15],e[16]=n[15]*i[1]+n[16]*i[6]+n[17]*i[11]+n[18]*i[16],e[17]=n[15]*i[2]+n[16]*i[7]+n[17]*i[12]+n[18]*i[17],e[18]=n[15]*i[3]+n[16]*i[8]+n[17]*i[13]+n[18]*i[18],e[19]=n[15]*i[4]+n[16]*i[9]+n[17]*i[14]+n[18]*i[19]+n[19],e},t.prototype._colorMatrix=function(e){var n=new Float32Array(e);return n[4]/=255,n[9]/=255,n[14]/=255,n[19]/=255,n},t.prototype.brightness=function(e,n){var i=[e,0,0,0,0,0,e,0,0,0,0,0,e,0,0,0,0,0,1,0];this._loadMatrix(i,n)},t.prototype.tint=function(e,n){var i=e>>16&255,o=e>>8&255,a=e&255,s=[i/255,0,0,0,0,0,o/255,0,0,0,0,0,a/255,0,0,0,0,0,1,0];this._loadMatrix(s,n)},t.prototype.greyscale=function(e,n){var i=[e,e,e,0,0,e,e,e,0,0,e,e,e,0,0,0,0,0,1,0];this._loadMatrix(i,n)},t.prototype.blackAndWhite=function(e){var n=[.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0];this._loadMatrix(n,e)},t.prototype.hue=function(e,n){e=(e||0)/180*Math.PI;var i=Math.cos(e),o=Math.sin(e),a=Math.sqrt,s=1/3,u=a(s),h=i+(1-i)*s,l=s*(1-i)-u*o,f=s*(1-i)+u*o,c=s*(1-i)+u*o,d=i+s*(1-i),p=s*(1-i)-u*o,v=s*(1-i)-u*o,_=s*(1-i)+u*o,m=i+s*(1-i),g=[h,l,f,0,0,c,d,p,0,0,v,_,m,0,0,0,0,0,1,0];this._loadMatrix(g,n)},t.prototype.contrast=function(e,n){var i=(e||0)+1,o=-.5*(i-1),a=[i,0,0,0,o,0,i,0,0,o,0,0,i,0,o,0,0,0,1,0];this._loadMatrix(a,n)},t.prototype.saturate=function(e,n){e===void 0&&(e=0);var i=e*2/3+1,o=(i-1)*-.5,a=[i,o,o,0,0,o,i,o,0,0,o,o,i,0,0,0,0,0,1,0];this._loadMatrix(a,n)},t.prototype.desaturate=function(){this.saturate(-1)},t.prototype.negative=function(e){var n=[-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0];this._loadMatrix(n,e)},t.prototype.sepia=function(e){var n=[.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0];this._loadMatrix(n,e)},t.prototype.technicolor=function(e){var n=[1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0];this._loadMatrix(n,e)},t.prototype.polaroid=function(e){var n=[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0];this._loadMatrix(n,e)},t.prototype.toBGR=function(e){var n=[0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0];this._loadMatrix(n,e)},t.prototype.kodachrome=function(e){var n=[1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0];this._loadMatrix(n,e)},t.prototype.browni=function(e){var n=[.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0];this._loadMatrix(n,e)},t.prototype.vintage=function(e){var n=[.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0];this._loadMatrix(n,e)},t.prototype.colorTone=function(e,n,i,o,a){e=e||.2,n=n||.15,i=i||16770432,o=o||3375104;var s=(i>>16&255)/255,u=(i>>8&255)/255,h=(i&255)/255,l=(o>>16&255)/255,f=(o>>8&255)/255,c=(o&255)/255,d=[.3,.59,.11,0,0,s,u,h,e,0,l,f,c,n,0,s-l,u-f,h-c,0,0];this._loadMatrix(d,a)},t.prototype.night=function(e,n){e=e||.1;var i=[e*-2,-e,0,0,0,-e,0,e,0,0,0,e,e*2,0,0,0,0,0,1,0];this._loadMatrix(i,n)},t.prototype.predator=function(e,n){var i=[11.224130630493164*e,-4.794486999511719*e,-2.8746118545532227*e,0*e,.40342438220977783*e,-3.6330697536468506*e,9.193157196044922*e,-2.951810836791992*e,0*e,-1.316135048866272*e,-3.2184197902679443*e,-4.2375030517578125*e,7.476448059082031*e,0*e,.8044459223747253*e,0,0,0,1,0];this._loadMatrix(i,n)},t.prototype.lsd=function(e){var n=[2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0];this._loadMatrix(n,e)},t.prototype.reset=function(){var e=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0];this._loadMatrix(e,!1)},Object.defineProperty(t.prototype,"matrix",{get:function(){return this.uniforms.m},set:function(e){this.uniforms.m=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"alpha",{get:function(){return this.uniforms.uAlpha},set:function(e){this.uniforms.uAlpha=e},enumerable:!1,configurable:!0}),t}(Ve);Ul.prototype.grayscale=Ul.prototype.greyscale;/*!
1188
- * @pixi/filter-displacement - v6.5.10
1189
- * Compiled Thu, 06 Jul 2023 15:25:11 UTC
1190
- *
1191
- * @pixi/filter-displacement is licensed under the MIT License.
1192
- * http://www.opensource.org/licenses/mit-license
1193
- *//*! *****************************************************************************
1194
- Copyright (c) Microsoft Corporation.
1195
-
1196
- Permission to use, copy, modify, and/or distribute this software for any
1197
- purpose with or without fee is hereby granted.
1198
-
1199
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
1200
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
1201
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
1202
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
1203
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1204
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1205
- PERFORMANCE OF THIS SOFTWARE.
1206
- ***************************************************************************** */var ns=function(r,t){return ns=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var i in n)n.hasOwnProperty(i)&&(e[i]=n[i])},ns(r,t)};function V1(r,t){ns(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var Y1=`varying vec2 vFilterCoord;
1207
- varying vec2 vTextureCoord;
1208
-
1209
- uniform vec2 scale;
1210
- uniform mat2 rotation;
1211
- uniform sampler2D uSampler;
1212
- uniform sampler2D mapSampler;
1213
-
1214
- uniform highp vec4 inputSize;
1215
- uniform vec4 inputClamp;
1216
-
1217
- void main(void)
1218
- {
1219
- vec4 map = texture2D(mapSampler, vFilterCoord);
1220
-
1221
- map -= 0.5;
1222
- map.xy = scale * inputSize.zw * (rotation * map.xy);
1223
-
1224
- gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));
1225
- }
1226
- `,z1=`attribute vec2 aVertexPosition;
1227
-
1228
- uniform mat3 projectionMatrix;
1229
- uniform mat3 filterMatrix;
1230
-
1231
- varying vec2 vTextureCoord;
1232
- varying vec2 vFilterCoord;
1233
-
1234
- uniform vec4 inputSize;
1235
- uniform vec4 outputFrame;
1236
-
1237
- vec4 filterVertexPosition( void )
1238
- {
1239
- vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
1240
-
1241
- return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
1242
- }
1243
-
1244
- vec2 filterTextureCoord( void )
1245
- {
1246
- return aVertexPosition * (outputFrame.zw * inputSize.zw);
1247
- }
1248
-
1249
- void main(void)
1250
- {
1251
- gl_Position = filterVertexPosition();
1252
- vTextureCoord = filterTextureCoord();
1253
- vFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy;
1254
- }
1255
- `;(function(r){V1(t,r);function t(e,n){var i=this,o=new Mt;return e.renderable=!1,i=r.call(this,z1,Y1,{mapSampler:e._texture,filterMatrix:o,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])})||this,i.maskSprite=e,i.maskMatrix=o,n==null&&(n=20),i.scale=new Et(n,n),i}return t.prototype.apply=function(e,n,i,o){this.uniforms.filterMatrix=e.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;var a=this.maskSprite.worldTransform,s=Math.sqrt(a.a*a.a+a.b*a.b),u=Math.sqrt(a.c*a.c+a.d*a.d);s!==0&&u!==0&&(this.uniforms.rotation[0]=a.a/s,this.uniforms.rotation[1]=a.b/s,this.uniforms.rotation[2]=a.c/u,this.uniforms.rotation[3]=a.d/u),e.applyFilter(this,n,i,o)},Object.defineProperty(t.prototype,"map",{get:function(){return this.uniforms.mapSampler},set:function(e){this.uniforms.mapSampler=e},enumerable:!1,configurable:!0}),t})(Ve);/*!
1256
- * @pixi/filter-fxaa - v6.5.10
1257
- * Compiled Thu, 06 Jul 2023 15:25:11 UTC
1258
- *
1259
- * @pixi/filter-fxaa is licensed under the MIT License.
1260
- * http://www.opensource.org/licenses/mit-license
1261
- *//*! *****************************************************************************
1262
- Copyright (c) Microsoft Corporation.
1263
-
1264
- Permission to use, copy, modify, and/or distribute this software for any
1265
- purpose with or without fee is hereby granted.
1266
-
1267
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
1268
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
1269
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
1270
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
1271
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1272
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1273
- PERFORMANCE OF THIS SOFTWARE.
1274
- ***************************************************************************** */var is=function(r,t){return is=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var i in n)n.hasOwnProperty(i)&&(e[i]=n[i])},is(r,t)};function W1(r,t){is(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var q1=`
1275
- attribute vec2 aVertexPosition;
1276
-
1277
- uniform mat3 projectionMatrix;
1278
-
1279
- varying vec2 v_rgbNW;
1280
- varying vec2 v_rgbNE;
1281
- varying vec2 v_rgbSW;
1282
- varying vec2 v_rgbSE;
1283
- varying vec2 v_rgbM;
1284
-
1285
- varying vec2 vFragCoord;
1286
-
1287
- uniform vec4 inputSize;
1288
- uniform vec4 outputFrame;
1289
-
1290
- vec4 filterVertexPosition( void )
1291
- {
1292
- vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
1293
-
1294
- return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
1295
- }
1296
-
1297
- void texcoords(vec2 fragCoord, vec2 inverseVP,
1298
- out vec2 v_rgbNW, out vec2 v_rgbNE,
1299
- out vec2 v_rgbSW, out vec2 v_rgbSE,
1300
- out vec2 v_rgbM) {
1301
- v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP;
1302
- v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP;
1303
- v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP;
1304
- v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP;
1305
- v_rgbM = vec2(fragCoord * inverseVP);
1306
- }
1307
-
1308
- void main(void) {
1309
-
1310
- gl_Position = filterVertexPosition();
1311
-
1312
- vFragCoord = aVertexPosition * outputFrame.zw;
1313
-
1314
- texcoords(vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);
1315
- }
1316
- `,$1=`varying vec2 v_rgbNW;
1317
- varying vec2 v_rgbNE;
1318
- varying vec2 v_rgbSW;
1319
- varying vec2 v_rgbSE;
1320
- varying vec2 v_rgbM;
1321
-
1322
- varying vec2 vFragCoord;
1323
- uniform sampler2D uSampler;
1324
- uniform highp vec4 inputSize;
677
+ uniform highp vec4 inputSize;
1325
678
 
1326
679
 
1327
680
  /**
@@ -1434,26 +787,49 @@ void main() {
1434
787
 
1435
788
  gl_FragColor = color;
1436
789
  }
1437
- `;(function(r){W1(t,r);function t(){return r.call(this,q1,$1)||this}return t})(Ve);/*!
1438
- * @pixi/filter-noise - v6.5.10
1439
- * Compiled Thu, 06 Jul 2023 15:25:11 UTC
1440
- *
1441
- * @pixi/filter-noise is licensed under the MIT License.
1442
- * http://www.opensource.org/licenses/mit-license
1443
- *//*! *****************************************************************************
1444
- Copyright (c) Microsoft Corporation.
1445
-
1446
- Permission to use, copy, modify, and/or distribute this software for any
1447
- purpose with or without fee is hereby granted.
1448
-
1449
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
1450
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
1451
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
1452
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
1453
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1454
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1455
- PERFORMANCE OF THIS SOFTWARE.
1456
- ***************************************************************************** */var os=function(r,t){return os=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var i in n)n.hasOwnProperty(i)&&(e[i]=n[i])},os(r,t)};function K1(r,t){os(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var Z1=`precision highp float;
790
+ `,J1=`
791
+ attribute vec2 aVertexPosition;
792
+
793
+ uniform mat3 projectionMatrix;
794
+
795
+ varying vec2 v_rgbNW;
796
+ varying vec2 v_rgbNE;
797
+ varying vec2 v_rgbSW;
798
+ varying vec2 v_rgbSE;
799
+ varying vec2 v_rgbM;
800
+
801
+ varying vec2 vFragCoord;
802
+
803
+ uniform vec4 inputSize;
804
+ uniform vec4 outputFrame;
805
+
806
+ vec4 filterVertexPosition( void )
807
+ {
808
+ vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
809
+
810
+ return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
811
+ }
812
+
813
+ void texcoords(vec2 fragCoord, vec2 inverseVP,
814
+ out vec2 v_rgbNW, out vec2 v_rgbNE,
815
+ out vec2 v_rgbSW, out vec2 v_rgbSE,
816
+ out vec2 v_rgbM) {
817
+ v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP;
818
+ v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP;
819
+ v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP;
820
+ v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP;
821
+ v_rgbM = vec2(fragCoord * inverseVP);
822
+ }
823
+
824
+ void main(void) {
825
+
826
+ gl_Position = filterVertexPosition();
827
+
828
+ vFragCoord = aVertexPosition * outputFrame.zw;
829
+
830
+ texcoords(vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);
831
+ }
832
+ `;class Q1 extends re{constructor(){super(J1,Z1)}}var tx=`precision highp float;
1457
833
 
1458
834
  varying vec2 vTextureCoord;
1459
835
  varying vec4 vColor;
@@ -1487,73 +863,286 @@ void main()
1487
863
 
1488
864
  gl_FragColor = color;
1489
865
  }
1490
- `;(function(r){K1(t,r);function t(e,n){e===void 0&&(e=.5),n===void 0&&(n=Math.random());var i=r.call(this,Zh,Z1,{uNoise:0,uSeed:0})||this;return i.noise=e,i.seed=n,i}return Object.defineProperty(t.prototype,"noise",{get:function(){return this.uniforms.uNoise},set:function(e){this.uniforms.uNoise=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"seed",{get:function(){return this.uniforms.uSeed},set:function(e){this.uniforms.uSeed=e},enumerable:!1,configurable:!0}),t})(Ve);/*!
1491
- * @pixi/mixin-cache-as-bitmap - v6.5.10
1492
- * Compiled Thu, 06 Jul 2023 15:25:11 UTC
1493
- *
1494
- * @pixi/mixin-cache-as-bitmap is licensed under the MIT License.
1495
- * http://www.opensource.org/licenses/mit-license
1496
- */var Gl=new Mt;It.prototype._cacheAsBitmap=!1,It.prototype._cacheData=null,It.prototype._cacheAsBitmapResolution=null,It.prototype._cacheAsBitmapMultisample=wt.NONE;var J1=function(){function r(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null}return r}();Object.defineProperties(It.prototype,{cacheAsBitmapResolution:{get:function(){return this._cacheAsBitmapResolution},set:function(r){r!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=r,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get:function(){return this._cacheAsBitmapMultisample},set:function(r){r!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=r,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get:function(){return this._cacheAsBitmap},set:function(r){if(this._cacheAsBitmap!==r){this._cacheAsBitmap=r;var t;r?(this._cacheData||(this._cacheData=new J1),t=this._cacheData,t.originalRender=this.render,t.originalRenderCanvas=this.renderCanvas,t.originalUpdateTransform=this.updateTransform,t.originalCalculateBounds=this.calculateBounds,t.originalGetLocalBounds=this.getLocalBounds,t.originalDestroy=this.destroy,t.originalContainsPoint=this.containsPoint,t.originalMask=this._mask,t.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):(t=this._cacheData,t.sprite&&this._destroyCachedDisplayObject(),this.render=t.originalRender,this.renderCanvas=t.originalRenderCanvas,this.calculateBounds=t.originalCalculateBounds,this.getLocalBounds=t.originalGetLocalBounds,this.destroy=t.originalDestroy,this.updateTransform=t.originalUpdateTransform,this.containsPoint=t.originalContainsPoint,this._mask=t.originalMask,this.filterArea=t.originalFilterArea)}}}}),It.prototype._renderCached=function(t){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(t),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(t))},It.prototype._initCachedDisplayObject=function(t){var e;if(!(this._cacheData&&this._cacheData.sprite)){var n=this.alpha;this.alpha=1,t.batch.flush();var i=this.getLocalBounds(null,!0).clone();if(this.filters&&this.filters.length){var o=this.filters[0].padding;i.pad(o)}i.ceil(k.RESOLUTION);var a=t.renderTexture.current,s=t.renderTexture.sourceFrame.clone(),u=t.renderTexture.destinationFrame.clone(),h=t.projection.transform,l=hr.create({width:i.width,height:i.height,resolution:this.cacheAsBitmapResolution||t.resolution,multisample:(e=this.cacheAsBitmapMultisample)!==null&&e!==void 0?e:t.multisample}),f="cacheAsBitmap_"+nr();this._cacheData.textureCacheId=f,ut.addToCache(l.baseTexture,f),J.addToCache(l,f);var c=this.transform.localTransform.copyTo(Gl).invert().translate(-i.x,-i.y);this.render=this._cacheData.originalRender,t.render(this,{renderTexture:l,clear:!0,transform:c,skipUpdateTransform:!1}),t.framebuffer.blit(),t.projection.transform=h,t.renderTexture.bind(a,s,u),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=n;var d=new In(l);d.transform.worldTransform=this.transform.worldTransform,d.anchor.x=-(i.x/i.width),d.anchor.y=-(i.y/i.height),d.alpha=n,d._bounds=this._bounds,this._cacheData.sprite=d,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=d.containsPoint.bind(d)}},It.prototype._renderCachedCanvas=function(t){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(t),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(t))},It.prototype._initCachedDisplayObjectCanvas=function(t){if(!(this._cacheData&&this._cacheData.sprite)){var e=this.getLocalBounds(null,!0),n=this.alpha;this.alpha=1;var i=t.context,o=t._projTransform;e.ceil(k.RESOLUTION);var a=hr.create({width:e.width,height:e.height}),s="cacheAsBitmap_"+nr();this._cacheData.textureCacheId=s,ut.addToCache(a.baseTexture,s),J.addToCache(a,s);var u=Gl;this.transform.localTransform.copyTo(u),u.invert(),u.tx-=e.x,u.ty-=e.y,this.renderCanvas=this._cacheData.originalRenderCanvas,t.render(this,{renderTexture:a,clear:!0,transform:u,skipUpdateTransform:!1}),t.context=i,t._projTransform=o,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=n;var h=new In(a);h.transform.worldTransform=this.transform.worldTransform,h.anchor.x=-(e.x/e.width),h.anchor.y=-(e.y/e.height),h.alpha=n,h._bounds=this._bounds,this._cacheData.sprite=h,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=t._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=h.containsPoint.bind(h)}},It.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},It.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},It.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,ut.removeFromCache(this._cacheData.textureCacheId),J.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},It.prototype._cacheAsBitmapDestroy=function(t){this.cacheAsBitmap=!1,this.destroy(t)};/*!
1497
- * @pixi/mixin-get-child-by-name - v6.5.10
1498
- * Compiled Thu, 06 Jul 2023 15:25:11 UTC
1499
- *
1500
- * @pixi/mixin-get-child-by-name is licensed under the MIT License.
1501
- * http://www.opensource.org/licenses/mit-license
1502
- */It.prototype.name=null,Ee.prototype.getChildByName=function(t,e){for(var n=0,i=this.children.length;n<i;n++)if(this.children[n].name===t)return this.children[n];if(e)for(var n=0,i=this.children.length;n<i;n++){var o=this.children[n];if(o.getChildByName){var a=o.getChildByName(t,!0);if(a)return a}}return null};/*!
1503
- * @pixi/mixin-get-global-position - v6.5.10
1504
- * Compiled Thu, 06 Jul 2023 15:25:11 UTC
1505
- *
1506
- * @pixi/mixin-get-global-position is licensed under the MIT License.
1507
- * http://www.opensource.org/licenses/mit-license
1508
- */It.prototype.getGlobalPosition=function(t,e){return t===void 0&&(t=new Et),e===void 0&&(e=!1),this.parent?this.parent.toGlobal(this.position,t,e):(t.x=this.position.x,t.y=this.position.y),t};/*!
1509
- * @pixi/app - v6.5.10
1510
- * Compiled Thu, 06 Jul 2023 15:25:11 UTC
1511
- *
1512
- * @pixi/app is licensed under the MIT License.
1513
- * http://www.opensource.org/licenses/mit-license
1514
- */var Q1=function(){function r(){}return r.init=function(t){var e=this;Object.defineProperty(this,"resizeTo",{set:function(n){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=n,n&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get:function(){return this._resizeTo}}),this.queueResize=function(){e._resizeTo&&(e.cancelResize(),e._resizeId=requestAnimationFrame(function(){return e.resize()}))},this.cancelResize=function(){e._resizeId&&(cancelAnimationFrame(e._resizeId),e._resizeId=null)},this.resize=function(){if(e._resizeTo){e.cancelResize();var n,i;if(e._resizeTo===globalThis.window)n=globalThis.innerWidth,i=globalThis.innerHeight;else{var o=e._resizeTo,a=o.clientWidth,s=o.clientHeight;n=a,i=s}e.renderer.resize(n,i)}},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null},r.destroy=function(){globalThis.removeEventListener("resize",this.queueResize),this.cancelResize(),this.cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null},r.extension=mt.Application,r}(),tx=function(){function r(t){var e=this;this.stage=new Ee,t=Object.assign({forceCanvas:!1},t),this.renderer=Kh(t),r._plugins.forEach(function(n){n.init.call(e,t)})}return r.registerPlugin=function(t){le("6.5.0","Application.registerPlugin() is deprecated, use extensions.add()"),Re.add({type:mt.Application,ref:t})},r.prototype.render=function(){this.renderer.render(this.stage)},Object.defineProperty(r.prototype,"view",{get:function(){return this.renderer.view},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"screen",{get:function(){return this.renderer.screen},enumerable:!1,configurable:!0}),r.prototype.destroy=function(t,e){var n=this,i=r._plugins.slice(0);i.reverse(),i.forEach(function(o){o.destroy.call(n)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null},r._plugins=[],r}();Re.handleByList(mt.Application,tx._plugins),Re.add(Q1);/*!
1515
- * @pixi/mesh-extras - v6.5.10
1516
- * Compiled Thu, 06 Jul 2023 15:25:11 UTC
1517
- *
1518
- * @pixi/mesh-extras is licensed under the MIT License.
1519
- * http://www.opensource.org/licenses/mit-license
1520
- *//*! *****************************************************************************
1521
- Copyright (c) Microsoft Corporation.
1522
-
1523
- Permission to use, copy, modify, and/or distribute this software for any
1524
- purpose with or without fee is hereby granted.
1525
-
1526
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
1527
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
1528
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
1529
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
1530
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1531
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1532
- PERFORMANCE OF THIS SOFTWARE.
1533
- ***************************************************************************** */var as=function(r,t){return as=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var i in n)n.hasOwnProperty(i)&&(e[i]=n[i])},as(r,t)};function Wr(r,t){as(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var ex=function(r){Wr(t,r);function t(e,n,i,o){e===void 0&&(e=100),n===void 0&&(n=100),i===void 0&&(i=10),o===void 0&&(o=10);var a=r.call(this)||this;return a.segWidth=i,a.segHeight=o,a.width=e,a.height=n,a.build(),a}return t.prototype.build=function(){for(var e=this.segWidth*this.segHeight,n=[],i=[],o=[],a=this.segWidth-1,s=this.segHeight-1,u=this.width/a,h=this.height/s,l=0;l<e;l++){var f=l%this.segWidth,c=l/this.segWidth|0;n.push(f*u,c*h),i.push(f/a,c/s)}for(var d=a*s,l=0;l<d;l++){var p=l%a,v=l/a|0,_=v*this.segWidth+p,m=v*this.segWidth+p+1,g=(v+1)*this.segWidth+p,y=(v+1)*this.segWidth+p+1;o.push(_,m,g,m,y,g)}this.buffers[0].data=new Float32Array(n),this.buffers[1].data=new Float32Array(i),this.indexBuffer.data=new Uint16Array(o),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()},t}(Ui),rx=function(r){Wr(t,r);function t(e,n,i){e===void 0&&(e=200),i===void 0&&(i=0);var o=r.call(this,new Float32Array(n.length*4),new Float32Array(n.length*4),new Uint16Array((n.length-1)*6))||this;return o.points=n,o._width=e,o.textureScale=i,o.build(),o}return Object.defineProperty(t.prototype,"width",{get:function(){return this._width},enumerable:!1,configurable:!0}),t.prototype.build=function(){var e=this.points;if(e){var n=this.getBuffer("aVertexPosition"),i=this.getBuffer("aTextureCoord"),o=this.getIndex();if(!(e.length<1)){n.data.length/4!==e.length&&(n.data=new Float32Array(e.length*4),i.data=new Float32Array(e.length*4),o.data=new Uint16Array((e.length-1)*6));var a=i.data,s=o.data;a[0]=0,a[1]=0,a[2]=0,a[3]=1;for(var u=0,h=e[0],l=this._width*this.textureScale,f=e.length,c=0;c<f;c++){var d=c*4;if(this.textureScale>0){var p=h.x-e[c].x,v=h.y-e[c].y,_=Math.sqrt(p*p+v*v);h=e[c],u+=_/l}else u=c/(f-1);a[d]=u,a[d+1]=0,a[d+2]=u,a[d+3]=1}for(var m=0,c=0;c<f-1;c++){var d=c*2;s[m++]=d,s[m++]=d+1,s[m++]=d+2,s[m++]=d+2,s[m++]=d+1,s[m++]=d+3}i.update(),o.update(),this.updateVertices()}}},t.prototype.updateVertices=function(){var e=this.points;if(!(e.length<1)){for(var n=e[0],i,o=0,a=0,s=this.buffers[0].data,u=e.length,h=0;h<u;h++){var l=e[h],f=h*4;h<e.length-1?i=e[h+1]:i=l,a=-(i.x-n.x),o=i.y-n.y;var c=Math.sqrt(o*o+a*a),d=this.textureScale>0?this.textureScale*this._width/2:this._width/2;o/=c,a/=c,o*=d,a*=d,s[f]=l.x+o,s[f+1]=l.y+a,s[f+2]=l.x-o,s[f+3]=l.y-a,n=l}this.buffers[0].update()}},t.prototype.update=function(){this.textureScale>0?this.build():this.updateVertices()},t}(Ui);(function(r){Wr(t,r);function t(e,n,i){i===void 0&&(i=0);var o=this,a=new rx(e.height,n,i),s=new Fn(e);return i>0&&(e.baseTexture.wrapMode=me.REPEAT),o=r.call(this,a,s)||this,o.autoUpdate=!0,o}return t.prototype._render=function(e){var n=this.geometry;(this.autoUpdate||n._width!==this.shader.texture.height)&&(n._width=this.shader.texture.height,n.update()),r.prototype._render.call(this,e)},t})(Dn);var nx=function(r){Wr(t,r);function t(e,n,i){var o=this,a=new ex(e.width,e.height,n,i),s=new Fn(J.WHITE);return o=r.call(this,a,s)||this,o.texture=e,o.autoResize=!0,o}return t.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID;var e=this.geometry,n=this.shader.texture,i=n.width,o=n.height;this.autoResize&&(e.width!==i||e.height!==o)&&(e.width=this.shader.texture.width,e.height=this.shader.texture.height,e.build())},Object.defineProperty(t.prototype,"texture",{get:function(){return this.shader.texture},set:function(e){this.shader.texture!==e&&(this.shader.texture=e,this._textureID=-1,e.baseTexture.valid?this.textureUpdated():e.once("update",this.textureUpdated,this))},enumerable:!1,configurable:!0}),t.prototype._render=function(e){this._textureID!==this.shader.texture._updateID&&this.textureUpdated(),r.prototype._render.call(this,e)},t.prototype.destroy=function(e){this.shader.texture.off("update",this.textureUpdated,this),r.prototype.destroy.call(this,e)},t}(Dn);(function(r){Wr(t,r);function t(e,n,i,o,a){e===void 0&&(e=J.EMPTY);var s=this,u=new Ui(n,i,o);u.getBuffer("aVertexPosition").static=!1;var h=new Fn(e);return s=r.call(this,u,h,null,a)||this,s.autoUpdate=!0,s}return Object.defineProperty(t.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(e){this.geometry.getBuffer("aVertexPosition").data=e},enumerable:!1,configurable:!0}),t.prototype._render=function(e){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),r.prototype._render.call(this,e)},t})(Dn);var Xi=10;(function(r){Wr(t,r);function t(e,n,i,o,a){n===void 0&&(n=Xi),i===void 0&&(i=Xi),o===void 0&&(o=Xi),a===void 0&&(a=Xi);var s=r.call(this,J.WHITE,4,4)||this;return s._origWidth=e.orig.width,s._origHeight=e.orig.height,s._width=s._origWidth,s._height=s._origHeight,s._leftWidth=n,s._rightWidth=o,s._topHeight=i,s._bottomHeight=a,s.texture=e,s}return t.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID,this._refresh()},Object.defineProperty(t.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(e){this.geometry.getBuffer("aVertexPosition").data=e},enumerable:!1,configurable:!0}),t.prototype.updateHorizontalVertices=function(){var e=this.vertices,n=this._getMinScale();e[9]=e[11]=e[13]=e[15]=this._topHeight*n,e[17]=e[19]=e[21]=e[23]=this._height-this._bottomHeight*n,e[25]=e[27]=e[29]=e[31]=this._height},t.prototype.updateVerticalVertices=function(){var e=this.vertices,n=this._getMinScale();e[2]=e[10]=e[18]=e[26]=this._leftWidth*n,e[4]=e[12]=e[20]=e[28]=this._width-this._rightWidth*n,e[6]=e[14]=e[22]=e[30]=this._width},t.prototype._getMinScale=function(){var e=this._leftWidth+this._rightWidth,n=this._width>e?1:this._width/e,i=this._topHeight+this._bottomHeight,o=this._height>i?1:this._height/i,a=Math.min(n,o);return a},Object.defineProperty(t.prototype,"width",{get:function(){return this._width},set:function(e){this._width=e,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this._height},set:function(e){this._height=e,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"leftWidth",{get:function(){return this._leftWidth},set:function(e){this._leftWidth=e,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rightWidth",{get:function(){return this._rightWidth},set:function(e){this._rightWidth=e,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"topHeight",{get:function(){return this._topHeight},set:function(e){this._topHeight=e,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bottomHeight",{get:function(){return this._bottomHeight},set:function(e){this._bottomHeight=e,this._refresh()},enumerable:!1,configurable:!0}),t.prototype._refresh=function(){var e=this.texture,n=this.geometry.buffers[1].data;this._origWidth=e.orig.width,this._origHeight=e.orig.height;var i=1/this._origWidth,o=1/this._origHeight;n[0]=n[8]=n[16]=n[24]=0,n[1]=n[3]=n[5]=n[7]=0,n[6]=n[14]=n[22]=n[30]=1,n[25]=n[27]=n[29]=n[31]=1,n[2]=n[10]=n[18]=n[26]=i*this._leftWidth,n[4]=n[12]=n[20]=n[28]=1-i*this._rightWidth,n[9]=n[11]=n[13]=n[15]=o*this._topHeight,n[17]=n[19]=n[21]=n[23]=1-o*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()},t})(nx);/*!
1534
- * @pixi/sprite-animated - v6.5.10
1535
- * Compiled Thu, 06 Jul 2023 15:25:11 UTC
1536
- *
1537
- * @pixi/sprite-animated is licensed under the MIT License.
1538
- * http://www.opensource.org/licenses/mit-license
1539
- *//*! *****************************************************************************
1540
- Copyright (c) Microsoft Corporation.
1541
-
1542
- Permission to use, copy, modify, and/or distribute this software for any
1543
- purpose with or without fee is hereby granted.
1544
-
1545
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
1546
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
1547
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
1548
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
1549
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1550
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1551
- PERFORMANCE OF THIS SOFTWARE.
1552
- ***************************************************************************** */var ss=function(r,t){return ss=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var i in n)n.hasOwnProperty(i)&&(e[i]=n[i])},ss(r,t)};function ix(r,t){ss(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}(function(r){ix(t,r);function t(e,n){n===void 0&&(n=!0);var i=r.call(this,e[0]instanceof J?e[0]:e[0].texture)||this;return i._textures=null,i._durations=null,i._autoUpdate=n,i._isConnectedToTicker=!1,i.animationSpeed=1,i.loop=!0,i.updateAnchor=!1,i.onComplete=null,i.onFrameChange=null,i.onLoop=null,i._currentTime=0,i._playing=!1,i._previousFrame=null,i.textures=e,i}return t.prototype.stop=function(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(Gt.shared.remove(this.update,this),this._isConnectedToTicker=!1))},t.prototype.play=function(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(Gt.shared.add(this.update,this,Ie.HIGH),this._isConnectedToTicker=!0))},t.prototype.gotoAndStop=function(e){this.stop();var n=this.currentFrame;this._currentTime=e,n!==this.currentFrame&&this.updateTexture()},t.prototype.gotoAndPlay=function(e){var n=this.currentFrame;this._currentTime=e,n!==this.currentFrame&&this.updateTexture(),this.play()},t.prototype.update=function(e){if(this._playing){var n=this.animationSpeed*e,i=this.currentFrame;if(this._durations!==null){var o=this._currentTime%1*this._durations[this.currentFrame];for(o+=n/60*1e3;o<0;)this._currentTime--,o+=this._durations[this.currentFrame];var a=Math.sign(this.animationSpeed*e);for(this._currentTime=Math.floor(this._currentTime);o>=this._durations[this.currentFrame];)o-=this._durations[this.currentFrame]*a,this._currentTime+=a;this._currentTime+=o/this._durations[this.currentFrame]}else this._currentTime+=n;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):i!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrame<i?this.onLoop():this.animationSpeed<0&&this.currentFrame>i&&this.onLoop()),this.updateTexture())}},t.prototype.updateTexture=function(){var e=this.currentFrame;this._previousFrame!==e&&(this._previousFrame=e,this._texture=this._textures[e],this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this.uvs=this._texture._uvs.uvsFloat32,this.updateAnchor&&this._anchor.copyFrom(this._texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))},t.prototype.destroy=function(e){this.stop(),r.prototype.destroy.call(this,e),this.onComplete=null,this.onFrameChange=null,this.onLoop=null},t.fromFrames=function(e){for(var n=[],i=0;i<e.length;++i)n.push(J.from(e[i]));return new t(n)},t.fromImages=function(e){for(var n=[],i=0;i<e.length;++i)n.push(J.from(e[i]));return new t(n)},Object.defineProperty(t.prototype,"totalFrames",{get:function(){return this._textures.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"textures",{get:function(){return this._textures},set:function(e){if(e[0]instanceof J)this._textures=e,this._durations=null;else{this._textures=[],this._durations=[];for(var n=0;n<e.length;n++)this._textures.push(e[n].texture),this._durations.push(e[n].time)}this._previousFrame=null,this.gotoAndStop(0),this.updateTexture()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"currentFrame",{get:function(){var e=Math.floor(this._currentTime)%this._textures.length;return e<0&&(e+=this._textures.length),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"playing",{get:function(){return this._playing},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"autoUpdate",{get:function(){return this._autoUpdate},set:function(e){e!==this._autoUpdate&&(this._autoUpdate=e,!this._autoUpdate&&this._isConnectedToTicker?(Gt.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(Gt.shared.add(this.update,this),this._isConnectedToTicker=!0))},enumerable:!1,configurable:!0}),t})(In);/*!
1553
- * pixi.js - v6.5.10
1554
- * Compiled Thu, 06 Jul 2023 15:25:11 UTC
1555
- *
1556
- * pixi.js is licensed under the MIT License.
1557
- * http://www.opensource.org/licenses/mit-license
1558
- */Re.add(k0,q0,Y0,kb,v1,el,E1,F1,fb,Nb,Lb,m1,oy,rb);const Hi=1733608,ox=.25,us=r=>(t,e)=>{const n=e!=null&&e.fill?mn(e.fill):Hi,i=(e==null?void 0:e.fillOpacity)===void 0?ox:e.fillOpacity,o=new Yr;return o.beginFill(16777215,i),o.lineStyle(1,16777215,1,.5,!0),r(t,o),o.endFill(),o.tint=n,o},ax=us((r,t)=>{const{cx:e,cy:n,rx:i,ry:o}=r.geometry;t.drawEllipse(e,n,i,o)}),sx=us((r,t)=>{const e=r.geometry.points.reduce((n,i)=>[...n,...i],[]);t.drawPolygon(e)}),ux=us((r,t)=>{const{x:e,y:n,w:i,h:o}=r.geometry;t.drawRect(e,n,i,o)}),hx=(r,t,e)=>()=>{const n=r.viewport.viewportToImageRectangle(r.viewport.getBounds(!0)),i=r.viewport.getContainerSize().x,a=r.viewport.getZoom(!0)*i/r.world.getContentFactor(),s=Math.PI*r.viewport.getRotation()/180,u=-n.x*a,h=-n.y*a;let l,f;s>0&&s<=Math.PI/2?(l=n.height*a,f=0):s>Math.PI/2&&s<=Math.PI?(l=n.width*a,f=n.height*a):s>Math.PI&&s<=Math.PI*1.5?(l=0,f=n.width*a):(l=0,f=0),t.position.x=l+u*Math.cos(s)-h*Math.sin(s),t.position.y=f+u*Math.sin(s)+h*Math.cos(s),t.scale.set(a,a),t.rotation=s,e.render(t)},lx=(r,t)=>{const e=new Yr,n=Kh({width:t.width,height:t.height,backgroundAlpha:0,view:t,antialias:!0}),i=new Map;let o=new Set,a;const s=v=>{const{selector:_}=v.target,m=typeof a=="function"?a(v):a;let g;_.type===zt.RECTANGLE?g=ux(_,m):_.type===zt.POLYGON?g=sx(_,m):_.type===zt.ELLIPSE?g=ax(_,m):console.warn(`Unsupported shape type: ${_.type}`),g&&(e.addChild(g),i.set(v.id,{g,annotation:v}))},u=v=>{const _=i.get(v.id);_&&(i.delete(v.id),_.g.destroy())},h=(v,_)=>{const m=i.get(v.id);m&&(i.delete(v.id),m.g.destroy(),s(_))},l=(v,_)=>{n.resize(v,_),n.render(e)},f=v=>{const{children:_}=e;i.forEach(({g:m,annotation:g})=>{const y=v?o.has(g.id)||v(g):!0;y&&!_.includes(m)?e.addChild(m):!y&&_.includes(m)&&e.removeChild(m)}),n.render(e)},c=v=>{const{selected:_}=v;o=new Set(_.map(m=>m.id))},d=v=>{if(typeof v=="function")i.forEach(({g:_,annotation:m},g)=>{const y=v(m);y?_.tint=y.fill?mn(y.fill):Hi:_.tint=Hi});else{const _=v!=null&&v.fill?mn(v.fill):Hi;i.forEach(({g:m},g)=>m.tint=_)}a=v,n.render(e)};return{addAnnotation:s,destroy:()=>n.destroy(),redraw:hx(r,e,n),removeAnnotation:u,resize:l,setFilter:f,setSelected:c,setStyle:d,updateAnnotation:h}},eT="";function fx(r,t,e){let n,i,{filter:o=void 0}=t,{state:a}=t,{style:s=void 0}=t,{viewer:u}=t;const{store:h,hover:l,selection:f,viewport:c}=a;Ki(r,l,b=>e(10,n=b)),Ki(r,f,b=>e(7,i=b));const d=yr();let p,v=!1;const _=b=>{const S=new Fe.Point(b.x,b.y),{x:P,y:T}=u.viewport.pointFromPixel(S);return u.viewport.viewportToImageCoordinates(P,T)},m=b=>S=>{const{x:P,y:T}=_(new Fe.Point(S.offsetX,S.offsetY)),x=h.getAt(P,T);x&&(!o||o(x))?(b.classList.add("hover"),n!==x.id&&l.set(x.id)):(b.classList.remove("hover"),n&&l.set(null))},g=b=>{const S=b.originalEvent;if(!v){const{x:P,y:T}=_(b.position),x=h.getAt(P,T);x?d("click",{originalEvent:S,annotation:x}):d("click",{originalEvent:S})}v=!1},y=()=>v=!0;let E;return gr(()=>{const{offsetWidth:b,offsetHeight:S}=u.canvas,P=document.createElement("canvas");P.width=b,P.height=S,P.className="a9s-gl-canvas",u.element.querySelector(".openseadragon-canvas").appendChild(P),e(6,p=lx(u,P));const T=m(P);P.addEventListener("pointermove",T),new ResizeObserver(O=>{try{const{width:I,height:C}=O[0].contentRect;P.width=I,P.height=C,p.resize(I,C)}catch{console.warn("WebGL canvas already disposed")}}).observe(P);const w=()=>{const O=u.viewport.getBounds();E=u.viewport.viewportToImageRectangle(O);const{x:I,y:C,width:G,height:B}=E,N=h.getIntersecting(I,C,G,B);c.set(N.map(W=>W.id))};return u.addHandler("canvas-drag",y),u.addHandler("canvas-release",g),u.addHandler("update-viewport",p.redraw),u.addHandler("animation-finish",w),()=>{P.removeEventListener("pointermove",T),u.removeHandler("canvas-drag",y),u.removeHandler("canvas-release",g),u.removeHandler("update-viewport",p.redraw),u.removeHandler("animation-finish",w),p.destroy(),P.parentNode.removeChild(P)}}),h.observe(b=>{const{created:S,updated:P,deleted:T}=b.changes;if(S.forEach(x=>p.addAnnotation(x)),P.forEach(({oldValue:x,newValue:w})=>p.updateAnnotation(x,w)),T.forEach(x=>p.removeAnnotation(x)),E){const{x,y:w,width:O,height:I}=E,C=h.getIntersecting(x,w,O,I);c.set(C.map(G=>G.id))}else c.set(h.all().map(x=>x.id));p.redraw()}),r.$$set=b=>{"filter"in b&&e(2,o=b.filter),"state"in b&&e(3,a=b.state),"style"in b&&e(4,s=b.style),"viewer"in b&&e(5,u=b.viewer)},r.$$.update=()=>{r.$$.dirty&68&&(p==null||p.setFilter(o)),r.$$.dirty&192&&(p==null||p.setSelected(i)),r.$$.dirty&80&&(p==null||p.setStyle(s))},[l,f,o,a,s,u,p,i]}class cx extends Kt{constructor(t){super(),$t(this,t,fx,null,Ht,{filter:2,state:3,style:4,viewer:5})}}const dx=r=>({transform:r&2,scale:r&1}),kl=r=>({transform:r[1],scale:r[0]});function px(r){let t;const e=r[4].default,n=Ss(e,r,r[3],kl);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),t=!0},p(i,[o]){n&&n.p&&(!t||o&11)&&Os(n,e,i,i[3],t?Ps(e,i[3],o,dx):Rs(i[3]),kl)},i(i){t||(lt(n,i),t=!0)},o(i){_t(n,i),t=!1},d(i){n&&n.d(i)}}}function vx(r,t,e){let{$$slots:n={},$$scope:i}=t,{viewer:o}=t,a=1,s;const u=()=>{const h=o.viewport.getContainerSize().x,l=o.viewport.getZoom(!0),f=o.viewport.getFlip(),c=o.viewport.pixelFromPoint(new Fe.Point(0,0),!0);f&&(c.x=h-c.x);const d=l*h/o.world.getContentFactor(),p=f?-d:d,v=o.viewport.getRotation();e(1,s=`translate(${c.x}, ${c.y}) scale(${p}, ${d}) rotate(${v})`),e(0,a=l*h/o.world.getContentFactor())};return gr(()=>(o.addHandler("update-viewport",u),()=>{o.removeHandler("update-viewport",u)})),r.$$set=h=>{"viewer"in h&&e(2,o=h.viewer),"$$scope"in h&&e(3,i=h.$$scope)},[a,s,o,i,n]}class Xl extends Kt{constructor(t){super(),$t(this,t,vx,px,Ht,{viewer:2})}}function _x(r,t,e){const n=yr();let{drawingMode:i}=t,{target:o}=t,{tool:a}=t,{transform:s}=t,{viewer:u}=t,{viewportScale:h}=t,l;return gr(()=>{const f=o.closest("svg"),c=[],d=(p,v,_)=>{if(f.addEventListener(p,v,_),c.push(()=>f.removeEventListener(p,v,_)),p==="pointerup"||p==="dblclick"){const m=y=>{const{originalEvent:E}=y;v(E)},g=p==="pointerup"?"canvas-click":"canvas-double-click";u.addHandler(g,m),c.push(()=>u.removeHandler(g,m))}else if(p==="pointermove"){const m=g=>{const{originalEvent:y}=g;v(y)};u.addHandler("canvas-drag",m),c.push(()=>u.removeHandler("canvas-drag",m))}};return e(6,l=new a({target:o,props:{addEventListener:d,drawingMode:i,transform:s,viewportScale:h}})),l.$on("create",p=>n("create",p.detail)),()=>{c.forEach(p=>p()),l.$destroy()}}),r.$$set=f=>{"drawingMode"in f&&e(0,i=f.drawingMode),"target"in f&&e(1,o=f.target),"tool"in f&&e(2,a=f.tool),"transform"in f&&e(3,s=f.transform),"viewer"in f&&e(4,u=f.viewer),"viewportScale"in f&&e(5,h=f.viewportScale)},r.$$.update=()=>{r.$$.dirty&72&&l&&l.$set({transform:s}),r.$$.dirty&96&&l&&l.$set({viewportScale:h})},[i,o,a,s,u,h,l]}class mx extends Kt{constructor(t){super(),$t(this,t,_x,null,Ht,{drawingMode:0,target:1,tool:2,transform:3,viewer:4,viewportScale:5})}}const rT="";function Hl(r,t,e){const n=r.slice();return n[24]=t[e],n}function gx(r){let t=r[1],e,n,i=jl(r);return{c(){i.c(),e=Ne()},m(o,a){i.m(o,a),Z(o,e,a),n=!0},p(o,a){a&2&&Ht(t,t=o[1])?(Le(),_t(i,1,1,ee),Ue(),i=jl(o),i.c(),lt(i,1),i.m(e.parentNode,e)):i.p(o,a)},i(o){n||(lt(i),n=!0)},o(o){_t(i),n=!1},d(o){o&&$(e),i.d(o)}}}function yx(r){let t,e,n=r[5],i=[];for(let a=0;a<n.length;a+=1)i[a]=Yl(Hl(r,n,a));const o=a=>_t(i[a],1,1,()=>{i[a]=null});return{c(){for(let a=0;a<i.length;a+=1)i[a].c();t=Ne()},m(a,s){for(let u=0;u<i.length;u+=1)i[u]&&i[u].m(a,s);Z(a,t,s),e=!0},p(a,s){if(s&8392496){n=a[5];let u;for(u=0;u<n.length;u+=1){const h=Hl(a,n,u);i[u]?(i[u].p(h,s),lt(i[u],1)):(i[u]=Yl(h),i[u].c(),lt(i[u],1),i[u].m(t.parentNode,t))}for(Le(),u=n.length;u<i.length;u+=1)o(u);Ue()}},i(a){if(!e){for(let s=0;s<n.length;s+=1)lt(i[s]);e=!0}},o(a){i=i.filter(Boolean);for(let s=0;s<i.length;s+=1)_t(i[s]);e=!1},d(a){Zi(i,a),a&&$(t)}}}function jl(r){let t,e;return t=new mx({props:{target:r[4],tool:r[6],drawingMode:r[3],transform:{elementToImage:r[8]},viewer:r[2],viewportScale:r[23]}}),t.$on("create",r[12]),{c(){ve(t.$$.fragment)},m(n,i){ne(t,n,i),e=!0},p(n,i){const o={};i&16&&(o.target=n[4]),i&64&&(o.tool=n[6]),i&8&&(o.drawingMode=n[3]),i&4&&(o.viewer=n[2]),i&8388608&&(o.viewportScale=n[23]),t.$set(o)},i(n){e||(lt(t.$$.fragment,n),e=!0)},o(n){_t(t.$$.fragment,n),e=!1},d(n){ie(t,n)}}}function Vl(r){let t,e;return t=new Rc({props:{target:r[4],editor:ks(r[24].target.selector),annotation:r[24],transform:{elementToImage:r[8]},viewportScale:r[23]}}),t.$on("grab",r[9]),t.$on("change",function(){Xt(r[11](r[24]))&&r[11](r[24]).apply(this,arguments)}),t.$on("release",r[10]),{c(){ve(t.$$.fragment)},m(n,i){ne(t,n,i),e=!0},p(n,i){r=n;const o={};i&16&&(o.target=r[4]),i&32&&(o.editor=ks(r[24].target.selector)),i&32&&(o.annotation=r[24]),i&8388608&&(o.viewportScale=r[23]),t.$set(o)},i(n){e||(lt(t.$$.fragment,n),e=!0)},o(n){_t(t.$$.fragment,n),e=!1},d(n){ie(t,n)}}}function Yl(r){let t=r[24].id,e,n,i=Vl(r);return{c(){i.c(),e=Ne()},m(o,a){i.m(o,a),Z(o,e,a),n=!0},p(o,a){a&32&&Ht(t,t=o[24].id)?(Le(),_t(i,1,1,ee),Ue(),i=Vl(o),i.c(),lt(i,1),i.m(e.parentNode,e)):i.p(o,a)},i(o){n||(lt(i),n=!0)},o(o){_t(i),n=!1},d(o){o&&$(e),i.d(o)}}}function bx(r){let t,e,n,i,o,a;const s=[yx,gx],u=[];function h(l,f){return l[4]&&l[5]?0:l[4]&&l[6]&&l[0]?1:-1}return~(n=h(r))&&(i=u[n]=s[n](r)),{c(){t=ft("svg"),e=ft("g"),i&&i.c(),A(e,"transform",o=r[22]),A(e,"class","svelte-190cqdf"),A(t,"class","a9s-annotationlayer a9s-osd-drawinglayer svelte-190cqdf"),Is(t,"drawing",r[0])},m(l,f){Z(l,t,f),$e(t,e),~n&&u[n].m(e,null),r[18](e),a=!0},p(l,f){let c=n;n=h(l),n===c?~n&&u[n].p(l,f):(i&&(Le(),_t(u[c],1,1,()=>{u[c]=null}),Ue()),~n?(i=u[n],i?i.p(l,f):(i=u[n]=s[n](l),i.c()),lt(i,1),i.m(e,null)):i=null),(!a||f&4194304&&o!==(o=l[22]))&&A(e,"transform",o),(!a||f&1)&&Is(t,"drawing",l[0])},i(l){a||(lt(i),a=!0)},o(l){_t(i),a=!1},d(l){l&&$(t),~n&&u[n].d(),r[18](null)}}}function xx(r){let t,e;return t=new Xl({props:{viewer:r[2],$$slots:{default:[bx,({transform:n,scale:i})=>({22:n,23:i}),({transform:n,scale:i})=>(n?4194304:0)|(i?8388608:0)]},$$scope:{ctx:r}}}),{c(){ve(t.$$.fragment)},m(n,i){ne(t,n,i),e=!0},p(n,[i]){const o={};i&4&&(o.viewer=n[2]),i&146800767&&(o.$$scope={dirty:i,ctx:n}),t.$set(o)},i(n){e||(lt(t.$$.fragment,n),e=!0)},o(n){_t(t.$$.fragment,n),e=!1},d(n){ie(t,n)}}}function Ex(r,t,e){let n,i,o,a,{drawingEnabled:s}=t,{preferredDrawingMode:u}=t,{state:h}=t,{toolName:l=lo().length>0?lo()[0]:void 0}=t,{user:f}=t,{viewer:c}=t,d;const{store:p,selection:v}=h;Ki(r,v,x=>e(17,a=x));let _=null,m=null;const g=x=>{p.unobserve(_);const w=x.filter(({editable:O})=>O).map(({id:O})=>O);w.length>0?(e(5,m=w.map(O=>p.getAnnotation(O))),_=O=>{const{updated:I}=O.changes;e(5,m=I.map(C=>C.newValue))},p.observe(_,{annotations:w})):e(5,m=null)},y=(x,w)=>{const{x:O,y:I}=c.viewport.viewerElementToImageCoordinates(new Fe.Point(x,w));return[O,I]},E=()=>c.setMouseNavEnabled(!1),b=()=>c.setMouseNavEnabled(!0),S=x=>w=>{var G;const{target:O}=x,I=10*60*1e3,C=((G=O.creator)==null?void 0:G.id)!==f.id||!O.created||new Date().getTime()-O.created.getTime()>I;p.updateTarget({...O,selector:w.detail,created:C?O.created:new Date,updated:C?new Date:null,updatedBy:C?f:null})},P=x=>{const w=Fs(),O={id:w,bodies:[],target:{annotation:w,selector:x.detail,creator:f,created:new Date}};p.addAnnotation(O),v.setSelected(O.id),c.setMouseNavEnabled(!0)};function T(x){Ln[x?"unshift":"push"](()=>{d=x,e(4,d)})}return r.$$set=x=>{"drawingEnabled"in x&&e(0,s=x.drawingEnabled),"preferredDrawingMode"in x&&e(13,u=x.preferredDrawingMode),"state"in x&&e(14,h=x.state),"toolName"in x&&e(1,l=x.toolName),"user"in x&&e(15,f=x.user),"viewer"in x&&e(2,c=x.viewer)},r.$$.update=()=>{r.$$.dirty&2&&e(6,{tool:n,opts:i}=zs(l),n,(e(16,i),e(1,l))),r.$$.dirty&73728&&e(3,o=(i==null?void 0:i.drawingMode)||u),r.$$.dirty&13&&(s&&o==="drag"?c.setMouseNavEnabled(!1):c.setMouseNavEnabled(!0)),r.$$.dirty&1&&s&&v.clear(),r.$$.dirty&131085&&a.selected.length===0&&o==="drag"&&s&&c.setMouseNavEnabled(!1),r.$$.dirty&131072&&g(a.selected)},[s,l,c,o,d,m,n,v,y,E,b,S,P,u,h,f,i,a,T]}class Tx extends Kt{constructor(t){super(),$t(this,t,Ex,xx,Ht,{drawingEnabled:0,preferredDrawingMode:13,state:14,toolName:1,user:15,viewer:2})}}const nT="";function wx(r){let t,e,n,i,o,a,s,u=r[2].appearance.label+"",h,l,f,c;return{c(){t=ft("g"),e=ft("rect"),s=ft("text"),h=Ji(u),A(e,"class","a9s-presence-label-bg svelte-1rehw2p"),A(e,"x",r[0]),A(e,"y",n=r[1]-18/r[3]),A(e,"height",i=18/r[3]),A(e,"fill",o=r[2].appearance.color),A(e,"stroke",a=r[2].appearance.color),A(s,"font-size",l=12/r[3]),A(s,"x",f=r[0]+Math.round(5/r[3])),A(s,"y",c=r[1]-5/r[3]),A(s,"class","svelte-1rehw2p"),A(t,"class","a9s-presence-label")},m(d,p){Z(d,t,p),$e(t,e),$e(t,s),$e(s,h),r[6](t)},p(d,[p]){p&1&&A(e,"x",d[0]),p&10&&n!==(n=d[1]-18/d[3])&&A(e,"y",n),p&8&&i!==(i=18/d[3])&&A(e,"height",i),p&4&&o!==(o=d[2].appearance.color)&&A(e,"fill",o),p&4&&a!==(a=d[2].appearance.color)&&A(e,"stroke",a),p&4&&u!==(u=d[2].appearance.label+"")&&tc(h,u),p&8&&l!==(l=12/d[3])&&A(s,"font-size",l),p&9&&f!==(f=d[0]+Math.round(5/d[3]))&&A(s,"x",f),p&10&&c!==(c=d[1]-5/d[3])&&A(s,"y",c)},i:ee,o:ee,d(d){d&&$(t),r[6](null)}}}function Sx(r,t,e){let{x:n}=t,{y:i}=t,{user:o}=t,{scale:a}=t,{hAlign:s=null}=t,u;const h=f=>{const c=u.querySelector("text"),d=u.querySelector("rect"),p=c.getBBox().width+10/f;s==="CENTER"&&u.setAttribute("style",`transform: translateX(-${p/2}px)`),d.setAttribute("width",`${p}`)};function l(f){Ln[f?"unshift":"push"](()=>{u=f,e(4,u)})}return r.$$set=f=>{"x"in f&&e(0,n=f.x),"y"in f&&e(1,i=f.y),"user"in f&&e(2,o=f.user),"scale"in f&&e(3,a=f.scale),"hAlign"in f&&e(5,s=f.hAlign)},r.$$.update=()=>{r.$$.dirty&24&&u&&h(a)},[n,i,o,a,u,s,l]}class zl extends Kt{constructor(t){super(),$t(this,t,Sx,wx,Ht,{x:0,y:1,user:2,scale:3,hAlign:5})}}const iT="";function Ax(r){let t,e,n,i,o,a;return e=new zl({props:{scale:r[1],user:r[0],x:r[3][0],y:r[3][1],hAlign:"CENTER"}}),{c(){t=ft("g"),ve(e.$$.fragment),n=ft("polygon"),A(n,"class","a9s-presence-shape a9s-presence-polygon svelte-fgq4n0"),A(n,"stroke",i=r[0].appearance.color),A(n,"fill","transparent"),A(n,"points",o=r[2].points.map(Wl).join(" ")),A(t,"class","a9s-presence-overlay")},m(s,u){Z(s,t,u),ne(e,t,null),$e(t,n),a=!0},p(s,[u]){const h={};u&2&&(h.scale=s[1]),u&1&&(h.user=s[0]),u&8&&(h.x=s[3][0]),u&8&&(h.y=s[3][1]),e.$set(h),(!a||u&1&&i!==(i=s[0].appearance.color))&&A(n,"stroke",i),(!a||u&4&&o!==(o=s[2].points.map(Wl).join(" ")))&&A(n,"points",o)},i(s){a||(lt(e.$$.fragment,s),a=!0)},o(s){_t(e.$$.fragment,s),a=!1},d(s){s&&$(t),ie(e)}}}const Wl=r=>r.join(",");function Px(r,t,e){let n,i,{annotation:o}=t,{user:a}=t,{scale:s}=t;const u=h=>{let[l,...f]=h.points;return f.forEach(([c,d])=>{d<l[1]&&(l=[c,d])}),l};return r.$$set=h=>{"annotation"in h&&e(4,o=h.annotation),"user"in h&&e(0,a=h.user),"scale"in h&&e(1,s=h.scale)},r.$$.update=()=>{r.$$.dirty&16&&e(2,n=o.target.selector.geometry),r.$$.dirty&4&&e(3,i=u(n))},[a,s,n,i,o]}class Ox extends Kt{constructor(t){super(),$t(this,t,Px,Ax,Ht,{annotation:4,user:0,scale:1})}}const oT="";function Rx(r){let t,e,n,i,o,a,s,u,h;return e=new zl({props:{scale:r[1],user:r[0],x:r[2].x,y:r[2].y}}),{c(){t=ft("g"),ve(e.$$.fragment),n=ft("rect"),A(n,"class","a9s-presence-shape a9s-presence-rectangle svelte-gze948"),A(n,"stroke",i=r[0].appearance.color),A(n,"fill","transparent"),A(n,"x",o=r[2].x),A(n,"y",a=r[2].y),A(n,"width",s=r[2].w),A(n,"height",u=r[2].h),A(t,"class","a9s-presence-overlay")},m(l,f){Z(l,t,f),ne(e,t,null),$e(t,n),h=!0},p(l,[f]){const c={};f&2&&(c.scale=l[1]),f&1&&(c.user=l[0]),f&4&&(c.x=l[2].x),f&4&&(c.y=l[2].y),e.$set(c),(!h||f&1&&i!==(i=l[0].appearance.color))&&A(n,"stroke",i),(!h||f&4&&o!==(o=l[2].x))&&A(n,"x",o),(!h||f&4&&a!==(a=l[2].y))&&A(n,"y",a),(!h||f&4&&s!==(s=l[2].w))&&A(n,"width",s),(!h||f&4&&u!==(u=l[2].h))&&A(n,"height",u)},i(l){h||(lt(e.$$.fragment,l),h=!0)},o(l){_t(e.$$.fragment,l),h=!1},d(l){l&&$(t),ie(e)}}}function Ix(r,t,e){let n,{annotation:i}=t,{user:o}=t,{scale:a}=t;return r.$$set=s=>{"annotation"in s&&e(3,i=s.annotation),"user"in s&&e(0,o=s.user),"scale"in s&&e(1,a=s.scale)},r.$$.update=()=>{r.$$.dirty&8&&e(2,n=i.target.selector.geometry)},[o,a,n,i]}class Cx extends Kt{constructor(t){super(),$t(this,t,Ix,Rx,Ht,{annotation:3,user:0,scale:1})}}const aT="",{Boolean:Mx}=Jf;function ql(r,t,e){const n=r.slice();return n[8]=t[e],n}function $l(r){let t,e;return t=new Xl({props:{viewer:r[0],$$slots:{default:[Bx,({transform:n,scale:i})=>({6:n,7:i}),({transform:n,scale:i})=>(n?64:0)|(i?128:0)]},$$scope:{ctx:r}}}),{c(){ve(t.$$.fragment)},m(n,i){ne(t,n,i),e=!0},p(n,i){const o={};i&1&&(o.viewer=n[0]),i&2244&&(o.$$scope={dirty:i,ctx:n}),t.$set(o)},i(n){e||(lt(t.$$.fragment,n),e=!0)},o(n){_t(t.$$.fragment,n),e=!1},d(n){ie(t,n)}}}function Kl(r){let t,e,n=r[2],i=[];for(let a=0;a<n.length;a+=1)i[a]=Zl(ql(r,n,a));const o=a=>_t(i[a],1,1,()=>{i[a]=null});return{c(){for(let a=0;a<i.length;a+=1)i[a].c();t=Ne()},m(a,s){for(let u=0;u<i.length;u+=1)i[u]&&i[u].m(a,s);Z(a,t,s),e=!0},p(a,s){if(s&132){n=a[2];let u;for(u=0;u<n.length;u+=1){const h=ql(a,n,u);i[u]?(i[u].p(h,s),lt(i[u],1)):(i[u]=Zl(h),i[u].c(),lt(i[u],1),i[u].m(t.parentNode,t))}for(Le(),u=n.length;u<i.length;u+=1)o(u);Ue()}},i(a){if(!e){for(let s=0;s<n.length;s+=1)lt(i[s]);e=!0}},o(a){i=i.filter(Mx);for(let s=0;s<i.length;s+=1)_t(i[s]);e=!1},d(a){Zi(i,a),a&&$(t)}}}function Dx(r){let t,e;return t=new Ox({props:{annotation:r[8].annotation,user:r[8].selectedBy,scale:r[7]}}),{c(){ve(t.$$.fragment)},m(n,i){ne(t,n,i),e=!0},p(n,i){const o={};i&4&&(o.annotation=n[8].annotation),i&4&&(o.user=n[8].selectedBy),i&128&&(o.scale=n[7]),t.$set(o)},i(n){e||(lt(t.$$.fragment,n),e=!0)},o(n){_t(t.$$.fragment,n),e=!1},d(n){ie(t,n)}}}function Fx(r){let t,e;return t=new Cx({props:{annotation:r[8].annotation,user:r[8].selectedBy,scale:r[7]}}),{c(){ve(t.$$.fragment)},m(n,i){ne(t,n,i),e=!0},p(n,i){const o={};i&4&&(o.annotation=n[8].annotation),i&4&&(o.user=n[8].selectedBy),i&128&&(o.scale=n[7]),t.$set(o)},i(n){e||(lt(t.$$.fragment,n),e=!0)},o(n){_t(t.$$.fragment,n),e=!1},d(n){ie(t,n)}}}function Zl(r){let t,e,n,i;const o=[Fx,Dx],a=[];function s(u,h){return u[8].annotation.target.selector.type===zt.RECTANGLE?0:u[8].annotation.target.selector.type===zt.POLYGON?1:-1}return~(t=s(r))&&(e=a[t]=o[t](r)),{c(){e&&e.c(),n=Ne()},m(u,h){~t&&a[t].m(u,h),Z(u,n,h),i=!0},p(u,h){let l=t;t=s(u),t===l?~t&&a[t].p(u,h):(e&&(Le(),_t(a[l],1,1,()=>{a[l]=null}),Ue()),~t?(e=a[t],e?e.p(u,h):(e=a[t]=o[t](u),e.c()),lt(e,1),e.m(n.parentNode,n)):e=null)},i(u){i||(lt(e),i=!0)},o(u){_t(e),i=!1},d(u){~t&&a[t].d(u),u&&$(n)}}}function Bx(r){let t,e,n,i,o=r[2].length>0&&Kl(r);return{c(){t=ft("svg"),e=ft("g"),o&&o.c(),A(e,"transform",n=r[6]),A(t,"class","a9s-osd-presencelayer svelte-1krwc4m")},m(a,s){Z(a,t,s),$e(t,e),o&&o.m(e,null),i=!0},p(a,s){a[2].length>0?o?(o.p(a,s),s&4&&lt(o,1)):(o=Kl(a),o.c(),lt(o,1),o.m(e,null)):o&&(Le(),_t(o,1,1,()=>{o=null}),Ue()),(!i||s&64&&n!==(n=a[6]))&&A(e,"transform",n)},i(a){i||(lt(o),i=!0)},o(a){_t(o),i=!1},d(a){a&&$(t),o&&o.d()}}}function Nx(r){let t=!!r[1],e,n,i=t&&$l(r);return{c(){i&&i.c(),e=Ne()},m(o,a){i&&i.m(o,a),Z(o,e,a),n=!0},p(o,[a]){a&2&&(t=!!o[1]),t?i?(i.p(o,a),a&2&&lt(i,1)):(i=$l(o),i.c(),lt(i,1),i.m(e.parentNode,e)):i&&(Le(),_t(i,1,1,()=>{i=null}),Ue())},i(o){n||(lt(i),n=!0)},o(o){_t(i),n=!1},d(o){i&&i.d(o),o&&$(e)}}}function Lx(r,t,e){let{store:n}=t,{viewer:i}=t,{provider:o=null}=t,a=[],s=null;const u=(h,l)=>{e(2,a=[...a.filter(({selectedBy:f})=>f.presenceKey!==h.presenceKey),...(l||[]).map(f=>({annotation:n.getAnnotation(f),selectedBy:h}))].filter(({annotation:f})=>(f||console.warn("Selection event on unknown annotation"),!!f))),s&&n.unobserve(s),s=f=>{const{deleted:c,updated:d}=f.changes,p=new Set(c.map(_=>_.id)),v=a.filter(({annotation:_})=>!p.has(_.id)).map(_=>{const m=d.find(g=>g.oldValue.id===_.annotation.id);return m?{selectedBy:_.selectedBy,annotation:m.newValue}:_});e(2,a=v)},n.observe(s,{annotations:a.map(f=>f.annotation.id)})};return rc(()=>{s&&n.unobserve(s)}),r.$$set=h=>{"store"in h&&e(3,n=h.store),"viewer"in h&&e(0,i=h.viewer),"provider"in h&&e(1,o=h.provider)},r.$$.update=()=>{r.$$.dirty&2&&o&&o.on("selectionChange",u)},[i,o,a,n]}class Ux extends Kt{constructor(t){super(),$t(this,t,Lx,Nx,Ht,{store:3,viewer:0,provider:1})}}const Jl=(r,t)=>{t==="auto"?r.addHandler("open",e=>{const n=r.world.getItemCount();r.world.getItemAt(n-1).addOnceHandler("fully-loaded-change",o=>{const{fullyLoaded:a}=o;if(a){const s=r.canvas.querySelector("canvas"),u=$c(s);r.element.setAttribute("data-theme",u)}})}):r.element.setAttribute("data-theme",t)},Ql=(r,t,e)=>(n,i={})=>{const o=typeof n=="string"?n:n.id,a=t.getAnnotation(o);if(!a)return;const s=r.container.getBoundingClientRect(),{padding:u}=i;let[h,l,f,c]=u?Array.isArray(u)?u:[u,u,u,u]:[0,0,0,0];h=h/s.height,l=l/s.width,f=f/s.height,c=c/s.width;const{minX:d,minY:p,maxX:v,maxY:_}=a.target.selector.geometry.bounds,m=v-d,g=_-p,y=d-c*m,E=p-h*g,b=m+(l+c)*m,S=g+(h+f)*g,P=r.viewport.imageToViewportRectangle(y,E,b,S);r.viewport[e](P,i.immediately)},Gx=(r,t)=>Ql(r,t,"fitBounds"),kx=(r,t)=>Ql(r,t,"fitBoundsWithConstraints"),sT="",Xx=(r,t={})=>{const e=Kc(t),n=Wc(e),{hover:i,selection:o,store:a}=n,s=Gf(a),u=Xf(n,s,e.adapter,e.autoSave);let h=qf(),l=e.drawingEnabled,f=e.drawingMode;const c=Zc(s,r.element),d=new cx({target:r.element,props:{state:n,viewer:r,style:e.style}}),p=new Ux({target:r.element.querySelector(".openseadragon-canvas"),props:{store:a,viewer:r,provider:null}}),v=new Tx({target:r.element.querySelector(".openseadragon-canvas"),props:{drawingEnabled:l,preferredDrawingMode:f,state:n,user:h,viewer:r}});d.$on("click",G=>{const{originalEvent:B,annotation:N}=G.detail;N&&!(f==="click"&&l)?o.clickSelect(N.id,B):o.isEmpty()||o.clear()}),r.element.addEventListener("pointerdown",G=>{if(i.current){const B=a.getAnnotation(i.current);u.emit("clickAnnotation",B,G)}}),Jl(r,e.theme);const _=jf(n,s,e.adapter),m=()=>{d.$destroy(),p.$destroy(),v.$destroy(),c.destroy(),s.destroy()},g=Gx(r,a),y=kx(r,a),E=()=>h,b=(G,B,N)=>Lc(G,B,N),S=(G,B)=>Tc(G,B),P=G=>{if(!zs(G))throw`No drawing tool named ${G}`;v.$set({toolName:G})},T=G=>{l=G,v.$set({drawingEnabled:l})},x=G=>d.$set({filter:G}),w=G=>d.$set({style:G}),O=G=>p.$set({provider:G}),I=G=>Jl(r,G),C=G=>{h=G,v.$set({user:G})};return{..._,destroy:m,fitBounds:g,fitBoundsWithConstraints:y,getUser:E,listDrawingTools:lo,on:u.on,off:u.off,registerDrawingTool:b,registerShapeEditor:S,setDrawingEnabled:T,setDrawingTool:P,setFilter:x,setPresenceProvider:O,setStyle:w,setTheme:I,setUser:C,state:n,viewer:r}},Hx=["#ff7c00","#1ac938","#e8000b","#8b2be2","#9f4800","#f14cc1","#ffc400","#00d7ff","#023eff"],jx=()=>{const r=[...Hx];return{assignRandomColor:()=>{const n=Math.floor(Math.random()*r.length),i=r[n];return r.splice(n,1),i},releaseColor:n=>r.push(n)}};((r=21)=>crypto.getRandomValues(new Uint8Array(r)).reduce((t,e)=>(e&=63,e<36?t+=e.toString(36):e<62?t+=(e-26).toString(36).toUpperCase():e>62?t+="-":t+="_",t),""))();var tf=(r=>(r.EDIT="EDIT",r.SELECT="SELECT",r.NONE="NONE",r))(tf||{});const Vx=(r,t,e,n)=>({id:Fs(),annotation:r.id,created:e||new Date,creator:n,...t});function hs(){}function Yx(r,t){for(const e in t)r[e]=t[e];return r}function ef(r){return r()}function rf(){return Object.create(null)}function _r(r){r.forEach(ef)}function Wt(r){return typeof r=="function"}function ls(r,t){return r!=r?t==t:r!==t||r&&typeof r=="object"||typeof r=="function"}function zx(r){return Object.keys(r).length===0}function Wx(r,t,e,n){if(r){const i=nf(r,t,e,n);return r[0](i)}}function nf(r,t,e,n){return r[1]&&n?Yx(e.ctx.slice(),r[1](n(t))):e.ctx}function qx(r,t,e,n){if(r[2]&&n){const i=r[2](n(e));if(t.dirty===void 0)return i;if(typeof i=="object"){const o=[],a=Math.max(t.dirty.length,i.length);for(let s=0;s<a;s+=1)o[s]=t.dirty[s]|i[s];return o}return t.dirty|i}return t.dirty}function $x(r,t,e,n,i,o){if(i){const a=nf(t,e,n,o);r.p(a,i)}}function Kx(r){if(r.ctx.length>32){const t=[],e=r.ctx.length/32;for(let n=0;n<e;n++)t[n]=-1;return t}return-1}function xt(r,t,e){r.insertBefore(t,e||null)}function yt(r){r.parentNode&&r.parentNode.removeChild(r)}function Zx(r,t){for(let e=0;e<r.length;e+=1)r[e]&&r[e].d(t)}function Zt(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function of(r){return document.createTextNode(r)}function pe(){return of(" ")}function Jx(){return of("")}function qt(r,t,e,n){return r.addEventListener(t,e,n),()=>r.removeEventListener(t,e,n)}function M(r,t,e){e==null?r.removeAttribute(t):r.getAttribute(t)!==e&&r.setAttribute(t,e)}function Qx(r){return Array.from(r.childNodes)}function tE(r,t,{bubbles:e=!1,cancelable:n=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(r,e,n,t),i}let Bn;function Nn(r){Bn=r}function eE(){if(!Bn)throw new Error("Function called outside component initialization");return Bn}function rE(){const r=eE();return(t,e,{cancelable:n=!1}={})=>{const i=r.$$.callbacks[t];if(i){const o=tE(t,e,{cancelable:n});return i.slice().forEach(a=>{a.call(r,o)}),!o.defaultPrevented}return!0}}function qr(r,t){const e=r.$$.callbacks[t.type];e&&e.slice().forEach(n=>n.call(this,t))}const $r=[],af=[];let Kr=[];const sf=[],nE=Promise.resolve();let fs=!1;function iE(){fs||(fs=!0,nE.then(uf))}function cs(r){Kr.push(r)}const ds=new Set;let Zr=0;function uf(){if(Zr!==0)return;const r=Bn;do{try{for(;Zr<$r.length;){const t=$r[Zr];Zr++,Nn(t),oE(t.$$)}}catch(t){throw $r.length=0,Zr=0,t}for(Nn(null),$r.length=0,Zr=0;af.length;)af.pop()();for(let t=0;t<Kr.length;t+=1){const e=Kr[t];ds.has(e)||(ds.add(e),e())}Kr.length=0}while($r.length);for(;sf.length;)sf.pop()();fs=!1,ds.clear(),Nn(r)}function oE(r){if(r.fragment!==null){r.update(),_r(r.before_update);const t=r.dirty;r.dirty=[-1],r.fragment&&r.fragment.p(r.ctx,t),r.after_update.forEach(cs)}}function aE(r){const t=[],e=[];Kr.forEach(n=>r.indexOf(n)===-1?t.push(n):e.push(n)),e.forEach(n=>n()),Kr=t}const ji=new Set;let sE;function Vi(r,t){r&&r.i&&(ji.delete(r),r.i(t))}function ps(r,t,e,n){if(r&&r.o){if(ji.has(r))return;ji.add(r),sE.c.push(()=>{ji.delete(r),n&&(e&&r.d(1),n())}),r.o(t)}else n&&n()}function hf(r){r&&r.c()}function vs(r,t,e,n){const{fragment:i,after_update:o}=r.$$;i&&i.m(t,e),n||cs(()=>{const a=r.$$.on_mount.map(ef).filter(Wt);r.$$.on_destroy?r.$$.on_destroy.push(...a):_r(a),r.$$.on_mount=[]}),o.forEach(cs)}function _s(r,t){const e=r.$$;e.fragment!==null&&(aE(e.after_update),_r(e.on_destroy),e.fragment&&e.fragment.d(t),e.on_destroy=e.fragment=null,e.ctx=[])}function uE(r,t){r.$$.dirty[0]===-1&&($r.push(r),iE(),r.$$.dirty.fill(0)),r.$$.dirty[t/31|0]|=1<<t%31}function ms(r,t,e,n,i,o,a,s=[-1]){const u=Bn;Nn(r);const h=r.$$={fragment:null,ctx:[],props:o,update:hs,not_equal:i,bound:rf(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(u?u.$$.context:[])),callbacks:rf(),dirty:s,skip_bound:!1,root:t.target||u.$$.root};a&&a(h.root);let l=!1;if(h.ctx=e?e(r,t.props||{},(f,c,...d)=>{const p=d.length?d[0]:c;return h.ctx&&i(h.ctx[f],h.ctx[f]=p)&&(!h.skip_bound&&h.bound[f]&&h.bound[f](p),l&&uE(r,f)),c}):[],h.update(),l=!0,_r(h.before_update),h.fragment=n?n(h.ctx):!1,t.target){if(t.hydrate){const f=Qx(t.target);h.fragment&&h.fragment.l(f),f.forEach(yt)}else h.fragment&&h.fragment.c();t.intro&&Vi(r.$$.fragment),vs(r,t.target,t.anchor,t.customElement),uf()}Nn(u)}class gs{$destroy(){_s(this,1),this.$destroy=hs}$on(t,e){if(!Wt(e))return hs;const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const i=n.indexOf(e);i!==-1&&n.splice(i,1)}}$set(t){this.$$set&&!zx(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}var Qt=(r=>(r.ELLIPSE="ELLIPSE",r.POLYGON="POLYGON",r.RECTANGLE="RECTANGLE",r))(Qt||{});const ys=(r,t)=>t,lf=r=>{let t=1/0,e=1/0,n=-1/0,i=-1/0;return r.forEach(([o,a])=>{t=Math.min(t,o),e=Math.min(e,a),n=Math.max(n,o),i=Math.max(i,a)}),{minX:t,minY:e,maxX:n,maxY:i}},hE={area:r=>Math.PI*r.geometry.rx*r.geometry.ry,intersects:(r,t,e)=>{const{cx:n,cy:i,rx:o,ry:a}=r.geometry,s=0,u=Math.cos(s),h=Math.sin(s),l=t-n,f=e-i,c=u*l+h*f,d=h*l-u*f;return c*c/(o*o)+d*d/(a*a)<=1}};ys(Qt.ELLIPSE,hE);const lE={area:r=>{const{points:t}=r.geometry;let e=0,n=t.length-1;for(let i=0;i<t.length;i++)e+=(t[n][0]+t[i][0])*(t[n][1]-t[i][1]),n=i;return Math.abs(.5*e)},intersects:(r,t,e)=>{const{points:n}=r.geometry;let i=!1;for(let o=0,a=n.length-1;o<n.length;a=o++){const s=n[o][0],u=n[o][1],h=n[a][0],l=n[a][1];u>e!=l>e&&t<(h-s)*(e-u)/(l-u)+s&&(i=!i)}return i}};ys(Qt.POLYGON,lE);const fE={area:r=>r.geometry.w*r.geometry.h,intersects:(r,t,e)=>t>=r.geometry.x&&t<=r.geometry.x+r.geometry.w&&e>=r.geometry.y&&e<=r.geometry.y+r.geometry.h};ys(Qt.RECTANGLE,fE);const cE=(r,t=!1)=>{const e=typeof r=="string"?r:r.value,n=/^(xywh)=(pixel|percent)?:?(.+?),(.+?),(.+?),(.+)*/g,i=[...e.matchAll(n)][0],[o,a,s,u,h,l,f]=i;if(a!=="xywh")throw new Error("Unsupported MediaFragment: "+e);if(s&&s!=="pixel")throw new Error(`Unsupported MediaFragment unit: ${s}`);const[c,d,p,v]=[u,h,l,f].map(parseFloat);return{type:Qt.RECTANGLE,geometry:{x:c,y:d,w:p,h:v,bounds:{minX:c,minY:t?d-v:d,maxX:c+p,maxY:t?d:d+v}}}},dE=r=>{const{x:t,y:e,w:n,h:i}=r;return{type:"FragmentSelector",conformsTo:"http://www.w3.org/TR/media-frags/",value:`xywh=pixel:${t},${e},${n},${i}`}},ff="http://www.w3.org/2000/svg",cf=r=>{const t=n=>{Array.from(n.attributes).forEach(i=>{i.name.startsWith("on")&&n.removeAttribute(i.name)})},e=r.getElementsByTagName("script");return Array.from(e).reverse().forEach(n=>n.parentNode.removeChild(n)),Array.from(r.querySelectorAll("*")).forEach(t),r},pE=r=>{const t=new XMLSerializer().serializeToString(r.documentElement).replace("<svg>",`<svg xmlns="${ff}">`);return new DOMParser().parseFromString(t,"image/svg+xml").documentElement},vE=r=>{const t=new DOMParser().parseFromString(r,"image/svg+xml"),e=t.lookupPrefix(ff),n=t.lookupNamespaceURI(null);return e||n?cf(t).firstChild:cf(pE(t)).firstChild},_E=r=>{const[t,e,n]=r.match(/(<polygon points=["|'])([^("|')]*)/)||[];if(!n)return;const i=n.split(" ").map(o=>o.split(",").map(parseFloat));return{type:Qt.POLYGON,geometry:{points:i,bounds:lf(i)}}},mE=r=>{const t=vE(r),e=parseFloat(t.getAttribute("cx")),n=parseFloat(t.getAttribute("cy")),i=parseFloat(t.getAttribute("rx")),o=parseFloat(t.getAttribute("ry")),a={minX:e-i,minY:n-o,maxX:e+i,maxY:n+o};return{type:Qt.ELLIPSE,geometry:{cx:e,cy:n,rx:i,ry:o,bounds:a}}},gE=r=>{const t=typeof r=="string"?r:r.value;if(t.includes("<polygon points="))return _E(t);if(t.includes("<ellipse "))return mE(t)},yE=r=>{let t;if(r.type===Qt.POLYGON){const e=r.geometry,{points:n}=e;t=`<svg><polygon points="${n.map(i=>i.join(",")).join(" ")}" /></svg>`}else if(r.type===Qt.ELLIPSE){const e=r.geometry;t=`<svg><ellipse cx="${e.cx}" cy="${e.cy}" rx="${e.rx}" ry="${e.ry}" /></svg>`}if(t)return{type:"SvgSelector",value:t};throw`Unsupported shape type: ${r.type}`};let Yi;const bE=new Uint8Array(16);function xE(){if(!Yi&&(Yi=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Yi))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Yi(bE)}const kt=[];for(let r=0;r<256;++r)kt.push((r+256).toString(16).slice(1));function EE(r,t=0){return kt[r[t+0]]+kt[r[t+1]]+kt[r[t+2]]+kt[r[t+3]]+"-"+kt[r[t+4]]+kt[r[t+5]]+"-"+kt[r[t+6]]+kt[r[t+7]]+"-"+kt[r[t+8]]+kt[r[t+9]]+"-"+kt[r[t+10]]+kt[r[t+11]]+kt[r[t+12]]+kt[r[t+13]]+kt[r[t+14]]+kt[r[t+15]]}const TE=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),df={randomUUID:TE};function wE(r,t,e){if(df.randomUUID&&!t&&!r)return df.randomUUID();r=r||{};const n=r.random||(r.rng||xE)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){e=e||0;for(let i=0;i<16;++i)t[e+i]=n[i];return t}return EE(n)}const SE=[];for(let r=0;r<256;++r)SE.push((r+256).toString(16).slice(1));typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);let AE=(r=21)=>crypto.getRandomValues(new Uint8Array(r)).reduce((t,e)=>(e&=63,e<36?t+=e.toString(36):e<62?t+=(e-26).toString(36).toUpperCase():e>62?t+="-":t+="_",t),"");const PE=r=>{const t=JSON.stringify(r);let e=0;for(let n=0,i=t.length;n<i;n++){let o=t.charCodeAt(n);e=(e<<5)-e+o,e|=0}return`${e}`},OE=(r,t)=>(Array.isArray(r)?r:[r]).map(e=>{const{id:n,type:i,purpose:o,value:a,created:s,creator:u,...h}=e;return{id:n||`temp-${PE(e)}`,annotation:t,type:i,purpose:o,value:a,created:s,creator:u?typeof u=="object"?{...u}:u:void 0,...h}}),RE=r=>r.map(t=>{var e;const n={...t};return delete n.annotation,(e=n.id)!=null&&e.startsWith("temp-")&&delete n.id,n});AE();const IE=(r,t=!1)=>({parse:e=>CE(e,t),serialize:e=>ME(e,r)}),CE=(r,t=!1)=>{const e=r.id||wE(),{body:n,...i}=r,o=OE(n,e),a=Array.isArray(r.target)?r.target[0]:r.target,s=Array.isArray(a.selector)?a.selector[0]:a.selector,u=s.type==="FragmentSelector"?cE(s,t):s.type==="SvgSelector"?gE(s):void 0;return u?{parsed:{...i,id:e,bodies:o,target:{...i.target,annotation:e,selector:u}}}:{error:Error(`Unknown selector type: ${s.type}`)}},ME=(r,t)=>{const e=r.target.selector,n=e.type==Qt.RECTANGLE?dE(e.geometry):yE(e);return{...r,"@context":"http://www.w3.org/ns/anno.jsonld",id:r.id,type:"Annotation",body:RE(r.bodies),target:{source:t,selector:n}}};function pf(r,t,e){const n=r.slice();return n[11]=t[e],n[13]=e,n}function vf(r){let t,e,n,i,o;return{c(){t=Zt("rect"),M(t,"class","a9s-corner-handle"),M(t,"x",e=r[11][0]-r[3]/2),M(t,"y",n=r[11][1]-r[3]/2),M(t,"height",r[3]),M(t,"width",r[3])},m(a,s){xt(a,t,s),i||(o=qt(t,"pointerdown",function(){Wt(r[10](z(r[13])))&&r[10](z(r[13])).apply(this,arguments)}),i=!0)},p(a,s){r=a,s&24&&e!==(e=r[11][0]-r[3]/2)&&M(t,"x",e),s&24&&n!==(n=r[11][1]-r[3]/2)&&M(t,"y",n),s&8&&M(t,"height",r[3]),s&8&&M(t,"width",r[3])},d(a){a&&yt(t),i=!1,o()}}}function DE(r){let t,e,n,i,o,a,s,u,h,l,f=r[4].points,c=[];for(let d=0;d<f.length;d+=1)c[d]=vf(pf(r,f,d));return{c(){t=Zt("polygon"),i=pe(),o=Zt("polygon"),s=pe();for(let d=0;d<c.length;d+=1)c[d].c();u=Jx(),M(t,"class","a9s-outer"),M(t,"style",e=r[1]?"display:none;":void 0),M(t,"points",n=r[4].points.map(_f).join(" ")),M(o,"class","a9s-inner a9s-shape-handle"),M(o,"style",r[1]),M(o,"points",a=r[4].points.map(mf).join(" "))},m(d,p){xt(d,t,p),xt(d,i,p),xt(d,o,p),xt(d,s,p);for(let v=0;v<c.length;v+=1)c[v]&&c[v].m(d,p);xt(d,u,p),h||(l=[qt(t,"pointerdown",function(){Wt(r[10](z.SHAPE))&&r[10](z.SHAPE).apply(this,arguments)}),qt(o,"pointerdown",function(){Wt(r[10](z.SHAPE))&&r[10](z.SHAPE).apply(this,arguments)})],h=!0)},p(d,p){if(r=d,p&2&&e!==(e=r[1]?"display:none;":void 0)&&M(t,"style",e),p&16&&n!==(n=r[4].points.map(_f).join(" "))&&M(t,"points",n),p&2&&M(o,"style",r[1]),p&16&&a!==(a=r[4].points.map(mf).join(" "))&&M(o,"points",a),p&1048){f=r[4].points;let v;for(v=0;v<f.length;v+=1){const _=pf(r,f,v);c[v]?c[v].p(_,p):(c[v]=vf(_),c[v].c(),c[v].m(u.parentNode,u))}for(;v<c.length;v+=1)c[v].d(1);c.length=f.length}},d(d){d&&yt(t),d&&yt(i),d&&yt(o),d&&yt(s),Zx(c,d),d&&yt(u),h=!1,_r(l)}}}function FE(r){let t,e;return t=new yf({props:{shape:r[0],transform:r[2],editor:r[5],$$slots:{default:[DE,({grab:n})=>({10:n}),({grab:n})=>n?1024:0]},$$scope:{ctx:r}}}),t.$on("change",r[7]),t.$on("grab",r[8]),t.$on("release",r[9]),{c(){hf(t.$$.fragment)},m(n,i){vs(t,n,i),e=!0},p(n,[i]){const o={};i&1&&(o.shape=n[0]),i&4&&(o.transform=n[2]),i&17434&&(o.$$scope={dirty:i,ctx:n}),t.$set(o)},i(n){e||(Vi(t.$$.fragment,n),e=!0)},o(n){ps(t.$$.fragment,n),e=!1},d(n){_s(t,n)}}}const _f=r=>r.join(","),mf=r=>r.join(",");function BE(r,t,e){let n,i,{shape:o}=t,{computedStyle:a=void 0}=t,{transform:s}=t,{viewportScale:u=1}=t;const h=(d,p,v)=>{let _;p===z.SHAPE?_=d.geometry.points.map(([g,y])=>[g+v[0],y+v[1]]):_=d.geometry.points.map(([g,y],E)=>p===z(E)?[g+v[0],y+v[1]]:[g,y]);const m=lf(_);return{...d,geometry:{points:_,bounds:m}}};function l(d){qr.call(this,r,d)}function f(d){qr.call(this,r,d)}function c(d){qr.call(this,r,d)}return r.$$set=d=>{"shape"in d&&e(0,o=d.shape),"computedStyle"in d&&e(1,a=d.computedStyle),"transform"in d&&e(2,s=d.transform),"viewportScale"in d&&e(6,u=d.viewportScale)},r.$$.update=()=>{r.$$.dirty&1&&e(4,n=o.geometry),r.$$.dirty&64&&e(3,i=10/u)},[o,a,s,i,n,h,u,l,f,c]}class NE extends gs{constructor(t){super(),ms(this,t,BE,FE,ls,{shape:0,computedStyle:1,transform:2,viewportScale:6})}}function LE(r){let t,e,n,i,o,a,s,u,h,l,f,c,d,p,v,_,m,g,y,E,b,S,P,T,x,w,O,I,C,G,B,N,W,K,Q,L,F,X,tt,rt,vt,V,ht,gt,Tt,q,it,at,ct,nt;return{c(){t=Zt("rect"),s=pe(),u=Zt("rect"),d=pe(),p=Zt("rect"),g=pe(),y=Zt("rect"),P=pe(),T=Zt("rect"),I=pe(),C=Zt("rect"),W=pe(),K=Zt("rect"),F=pe(),X=Zt("rect"),vt=pe(),V=Zt("rect"),Tt=pe(),q=Zt("rect"),M(t,"class","a9s-outer"),M(t,"style",e=r[1]?"display:none;":void 0),M(t,"x",n=r[4].x),M(t,"y",i=r[4].y),M(t,"width",o=r[4].w),M(t,"height",a=r[4].h),M(u,"class","a9s-inner a9s-shape-handle"),M(u,"style",r[1]),M(u,"x",h=r[4].x),M(u,"y",l=r[4].y),M(u,"width",f=r[4].w),M(u,"height",c=r[4].h),M(p,"class","a9s-edge-handle a9s-edge-handle-top"),M(p,"x",v=r[4].x),M(p,"y",_=r[4].y),M(p,"height",1),M(p,"width",m=r[4].w),M(y,"class","a9s-edge-handle a9s-edge-handle-right"),M(y,"x",E=r[4].x+r[4].w),M(y,"y",b=r[4].y),M(y,"height",S=r[4].h),M(y,"width",1),M(T,"class","a9s-edge-handle a9s-edge-handle-bottom"),M(T,"x",x=r[4].x),M(T,"y",w=r[4].y+r[4].h),M(T,"height",1),M(T,"width",O=r[4].w),M(C,"class","a9s-edge-handle a9s-edge-handle-left"),M(C,"x",G=r[4].x),M(C,"y",B=r[4].y),M(C,"height",N=r[4].h),M(C,"width",1),M(K,"class","a9s-corner-handle a9s-corner-handle-topleft"),M(K,"x",Q=r[4].x-r[3]/2),M(K,"y",L=r[4].y-r[3]/2),M(K,"height",r[3]),M(K,"width",r[3]),M(X,"class","a9s-corner-handle a9s-corner-handle-topright"),M(X,"x",tt=r[4].x+r[4].w-r[3]/2),M(X,"y",rt=r[4].y-r[3]/2),M(X,"height",r[3]),M(X,"width",r[3]),M(V,"class","a9s-corner-handle a9s-corner-handle-bottomright"),M(V,"x",ht=r[4].x+r[4].w-r[3]/2),M(V,"y",gt=r[4].y+r[4].h-r[3]/2),M(V,"height",r[3]),M(V,"width",r[3]),M(q,"class","a9s-corner-handle a9s-corner-handle-bottomleft"),M(q,"x",it=r[4].x-r[3]/2),M(q,"y",at=r[4].y+r[4].h-r[3]/2),M(q,"height",r[3]),M(q,"width",r[3])},m(D,R){xt(D,t,R),xt(D,s,R),xt(D,u,R),xt(D,d,R),xt(D,p,R),xt(D,g,R),xt(D,y,R),xt(D,P,R),xt(D,T,R),xt(D,I,R),xt(D,C,R),xt(D,W,R),xt(D,K,R),xt(D,F,R),xt(D,X,R),xt(D,vt,R),xt(D,V,R),xt(D,Tt,R),xt(D,q,R),ct||(nt=[qt(t,"pointerdown",function(){Wt(r[10](z.SHAPE))&&r[10](z.SHAPE).apply(this,arguments)}),qt(u,"pointerdown",function(){Wt(r[10](z.SHAPE))&&r[10](z.SHAPE).apply(this,arguments)}),qt(p,"pointerdown",function(){Wt(r[10](z.TOP))&&r[10](z.TOP).apply(this,arguments)}),qt(y,"pointerdown",function(){Wt(r[10](z.RIGHT))&&r[10](z.RIGHT).apply(this,arguments)}),qt(T,"pointerdown",function(){Wt(r[10](z.BOTTOM))&&r[10](z.BOTTOM).apply(this,arguments)}),qt(C,"pointerdown",function(){Wt(r[10](z.LEFT))&&r[10](z.LEFT).apply(this,arguments)}),qt(K,"pointerdown",function(){Wt(r[10](z.TOP_LEFT))&&r[10](z.TOP_LEFT).apply(this,arguments)}),qt(X,"pointerdown",function(){Wt(r[10](z.TOP_RIGHT))&&r[10](z.TOP_RIGHT).apply(this,arguments)}),qt(V,"pointerdown",function(){Wt(r[10](z.BOTTOM_RIGHT))&&r[10](z.BOTTOM_RIGHT).apply(this,arguments)}),qt(q,"pointerdown",function(){Wt(r[10](z.BOTTOM_LEFT))&&r[10](z.BOTTOM_LEFT).apply(this,arguments)})],ct=!0)},p(D,R){r=D,R&2&&e!==(e=r[1]?"display:none;":void 0)&&M(t,"style",e),R&16&&n!==(n=r[4].x)&&M(t,"x",n),R&16&&i!==(i=r[4].y)&&M(t,"y",i),R&16&&o!==(o=r[4].w)&&M(t,"width",o),R&16&&a!==(a=r[4].h)&&M(t,"height",a),R&2&&M(u,"style",r[1]),R&16&&h!==(h=r[4].x)&&M(u,"x",h),R&16&&l!==(l=r[4].y)&&M(u,"y",l),R&16&&f!==(f=r[4].w)&&M(u,"width",f),R&16&&c!==(c=r[4].h)&&M(u,"height",c),R&16&&v!==(v=r[4].x)&&M(p,"x",v),R&16&&_!==(_=r[4].y)&&M(p,"y",_),R&16&&m!==(m=r[4].w)&&M(p,"width",m),R&16&&E!==(E=r[4].x+r[4].w)&&M(y,"x",E),R&16&&b!==(b=r[4].y)&&M(y,"y",b),R&16&&S!==(S=r[4].h)&&M(y,"height",S),R&16&&x!==(x=r[4].x)&&M(T,"x",x),R&16&&w!==(w=r[4].y+r[4].h)&&M(T,"y",w),R&16&&O!==(O=r[4].w)&&M(T,"width",O),R&16&&G!==(G=r[4].x)&&M(C,"x",G),R&16&&B!==(B=r[4].y)&&M(C,"y",B),R&16&&N!==(N=r[4].h)&&M(C,"height",N),R&24&&Q!==(Q=r[4].x-r[3]/2)&&M(K,"x",Q),R&24&&L!==(L=r[4].y-r[3]/2)&&M(K,"y",L),R&8&&M(K,"height",r[3]),R&8&&M(K,"width",r[3]),R&24&&tt!==(tt=r[4].x+r[4].w-r[3]/2)&&M(X,"x",tt),R&24&&rt!==(rt=r[4].y-r[3]/2)&&M(X,"y",rt),R&8&&M(X,"height",r[3]),R&8&&M(X,"width",r[3]),R&24&&ht!==(ht=r[4].x+r[4].w-r[3]/2)&&M(V,"x",ht),R&24&&gt!==(gt=r[4].y+r[4].h-r[3]/2)&&M(V,"y",gt),R&8&&M(V,"height",r[3]),R&8&&M(V,"width",r[3]),R&24&&it!==(it=r[4].x-r[3]/2)&&M(q,"x",it),R&24&&at!==(at=r[4].y+r[4].h-r[3]/2)&&M(q,"y",at),R&8&&M(q,"height",r[3]),R&8&&M(q,"width",r[3])},d(D){D&&yt(t),D&&yt(s),D&&yt(u),D&&yt(d),D&&yt(p),D&&yt(g),D&&yt(y),D&&yt(P),D&&yt(T),D&&yt(I),D&&yt(C),D&&yt(W),D&&yt(K),D&&yt(F),D&&yt(X),D&&yt(vt),D&&yt(V),D&&yt(Tt),D&&yt(q),ct=!1,_r(nt)}}}function UE(r){let t,e;return t=new yf({props:{shape:r[0],transform:r[2],editor:r[5],$$slots:{default:[LE,({grab:n})=>({10:n}),({grab:n})=>n?1024:0]},$$scope:{ctx:r}}}),t.$on("grab",r[7]),t.$on("change",r[8]),t.$on("release",r[9]),{c(){hf(t.$$.fragment)},m(n,i){vs(t,n,i),e=!0},p(n,[i]){const o={};i&1&&(o.shape=n[0]),i&4&&(o.transform=n[2]),i&3098&&(o.$$scope={dirty:i,ctx:n}),t.$set(o)},i(n){e||(Vi(t.$$.fragment,n),e=!0)},o(n){ps(t.$$.fragment,n),e=!1},d(n){_s(t,n)}}}function GE(r,t,e){let n,i,{shape:o}=t,{computedStyle:a=void 0}=t,{transform:s}=t,{viewportScale:u=1}=t;const h=(d,p,v)=>{const _=d.geometry.bounds;let[m,g]=[_.minX,_.minY],[y,E]=[_.maxX,_.maxY];const[b,S]=v;if(p===z.SHAPE)m+=b,y+=b,g+=S,E+=S;else{switch(p){case z.TOP:case z.TOP_LEFT:case z.TOP_RIGHT:{g+=S;break}case z.BOTTOM:case z.BOTTOM_LEFT:case z.BOTTOM_RIGHT:{E+=S;break}}switch(p){case z.LEFT:case z.TOP_LEFT:case z.BOTTOM_LEFT:{m+=b;break}case z.RIGHT:case z.TOP_RIGHT:case z.BOTTOM_RIGHT:{y+=b;break}}}const P=Math.min(m,y),T=Math.min(g,E),x=Math.abs(y-m),w=Math.abs(E-g);return{...d,geometry:{x:P,y:T,w:x,h:w,bounds:{minX:P,minY:T,maxX:P+x,maxY:T+w}}}};function l(d){qr.call(this,r,d)}function f(d){qr.call(this,r,d)}function c(d){qr.call(this,r,d)}return r.$$set=d=>{"shape"in d&&e(0,o=d.shape),"computedStyle"in d&&e(1,a=d.computedStyle),"transform"in d&&e(2,s=d.transform),"viewportScale"in d&&e(6,u=d.viewportScale)},r.$$.update=()=>{r.$$.dirty&1&&e(4,n=o.geometry),r.$$.dirty&64&&e(3,i=10/u)},[o,a,s,i,n,h,u,l,f,c]}class kE extends gs{constructor(t){super(),ms(this,t,GE,UE,ls,{shape:0,computedStyle:1,transform:2,viewportScale:6})}}Qt.RECTANGLE,Qt.POLYGON;const z=r=>`HANDLE-${r}`;z.SHAPE="SHAPE",z.TOP="TOP",z.RIGHT="RIGHT",z.BOTTOM="BOTTOM",z.LEFT="LEFT",z.TOP_LEFT="TOP_LEFT",z.TOP_RIGHT="TOP_RIGHT",z.BOTTOM_RIGHT="BOTTOM_RIGHT",z.BOTTOM_LEFT="BOTTOM_LEFT";const XE=r=>({}),gf=r=>({grab:r[0]});function HE(r){let t,e,n,i;const o=r[7].default,a=Wx(o,r,r[6],gf);return{c(){t=Zt("g"),a&&a.c(),M(t,"class","a9s-annotation selected")},m(s,u){xt(s,t,u),a&&a.m(t,null),e=!0,n||(i=[qt(t,"pointerup",r[2]),qt(t,"pointermove",r[1])],n=!0)},p(s,[u]){a&&a.p&&(!e||u&64)&&$x(a,o,s,s[6],e?qx(o,s[6],u,XE):Kx(s[6]),gf)},i(s){e||(Vi(a,s),e=!0)},o(s){ps(a,s),e=!1},d(s){s&&yt(t),a&&a.d(s),n=!1,_r(i)}}}function jE(r,t,e){let{$$slots:n={},$$scope:i}=t;const o=rE();let{shape:a}=t,{editor:s}=t,{transform:u}=t,h=null,l,f=null;const c=v=>_=>{h=v,l=u.elementToImage(_.offsetX,_.offsetY),f=a,_.target.setPointerCapture(_.pointerId),o("grab")},d=v=>{if(h){const[_,m]=u.elementToImage(v.offsetX,v.offsetY),g=[_-l[0],m-l[1]];e(3,a=s(f,h,g)),o("change",a)}},p=v=>{v.target.releasePointerCapture(v.pointerId),h=null,f=a,o("release")};return r.$$set=v=>{"shape"in v&&e(3,a=v.shape),"editor"in v&&e(4,s=v.editor),"transform"in v&&e(5,u=v.transform),"$$scope"in v&&e(6,i=v.$$scope)},[c,d,p,a,s,u,i,n]}class yf extends gs{constructor(t){super(),ms(this,t,jE,HE,ls,{shape:3,editor:4,transform:5})}}navigator.userAgent.indexOf("Mac OS X");const VE=jx,YE=tf,zE=Vx,WE=Qt,qE=IE;te.PointerSelectAction=YE,te.ShapeType=WE,te.W3CImageFormat=qE,te.createBody=zE,te.createOSDAnnotator=Xx,te.defaultColorProvider=VE,Object.defineProperty(te,Symbol.toStringTag,{value:"Module"})});
866
+ `;class ex extends re{constructor(t=.5,e=Math.random()){super(_d,tx,{uNoise:0,uSeed:0}),this.noise=t,this.seed=e}get noise(){return this.uniforms.uNoise}set noise(t){this.uniforms.uNoise=t}get seed(){return this.uniforms.uSeed}set seed(t){this.uniforms.uSeed=t}}const Cd={AlphaFilter:G1,BlurFilter:W1,BlurFilterPass:el,ColorMatrixFilter:rl,DisplacementFilter:K1,FXAAFilter:Q1,NoiseFilter:ex};Object.entries(Cd).forEach(([r,t])=>{Object.defineProperty(Cd,r,{get(){return lt("7.1.0",`filters.${r} has moved to ${r}`),t}})});class rx{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this.tickerAdded=!1,this._pauseUpdate=!0}init(t){this.removeTickerListener(),this.events=t,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this.tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(t){this._pauseUpdate=t}addTickerListener(){this.tickerAdded||!this.domElement||(le.system.add(this.tickerUpdate,this,Yr.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(le.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)}pointerMoved(){this._didMove=!0}update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}const t=this.events.rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY}))}tickerUpdate(t){this._deltaTime+=t,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this.update())}}const br=new rx;class gs{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=gs.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new pt,this.page=new pt,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(t,e,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,i,s,n){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}class Pn extends gs{constructor(){super(...arguments),this.client=new pt,this.movement=new pt,this.offset=new pt,this.global=new pt,this.screen=new pt}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(t,e,i){return t.worldTransform.applyInverse(i||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,i,s,n,o,a,l,h,c,u,d,f,p,m){throw new Error("Method not implemented.")}}class Ae extends Pn{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}class Pi extends Pn{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}Pi.DOM_DELTA_PIXEL=0,Pi.DOM_DELTA_LINE=1,Pi.DOM_DELTA_PAGE=2;const ix=2048,sx=new pt,il=new pt;class nx{constructor(t){this.dispatch=new Ji,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((i,s)=>i.priority-s.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(!this.rootTarget)return;const e=this.mappingTable[t.type];if(e)for(let i=0,s=e.length;i<s;i++)e[i].fn(t);else console.warn(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){br.pauseUpdate=!0;const i=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",s=this[i](this.rootTarget,this.rootTarget.eventMode,sx.set(t,e),this.hitTestFn,this.hitPruneFn);return s&&s[0]}propagate(t,e){if(!t.target)return;const i=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let s=0,n=i.length-1;s<n;s++)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!(t.propagationStopped||t.propagationImmediatelyStopped)){t.eventPhase=t.BUBBLING_PHASE;for(let s=i.length-2;s>=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,i=this._allInteractiveElements){if(i.length===0)return;t.eventPhase=t.BUBBLING_PHASE;const s=Array.isArray(e)?e:[e];for(let n=i.length-1;n>=0;n--)s.forEach(o=>{t.currentTarget=i[n],this.notifyTarget(t,o)})}propagationPath(t){const e=[t];for(let i=0;i<ix&&t!==this.rootTarget;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}hitTestMoveRecursive(t,e,i,s,n,o=!1){let a=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(br.pauseUpdate=!1),t.interactiveChildren&&t.children){const c=t.children;for(let u=c.length-1;u>=0;u--){const d=c[u],f=this.hitTestMoveRecursive(d,this._isInteractive(e)?e:d.eventMode,i,s,n,o||n(t,i));if(f){if(f.length>0&&!f[f.length-1].parent)continue;const p=t.isInteractive();(f.length>0||p)&&(p&&this._allInteractiveElements.push(t),f.push(t)),this._hitElements.length===0&&(this._hitElements=f),a=!0}}}const l=this._isInteractive(e),h=t.isInteractive();return l&&h&&this._allInteractiveElements.push(t),o||this._hitElements.length>0?null:a?this._hitElements:l&&!n(t,i)&&s(t,i)?h?[t]:[]:null}hitTestRecursive(t,e,i,s,n){if(this._interactivePrune(t)||n(t,i))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(br.pauseUpdate=!1),t.interactiveChildren&&t.children){const l=t.children;for(let h=l.length-1;h>=0;h--){const c=l[h],u=this.hitTestRecursive(c,this._isInteractive(e)?e:c.eventMode,i,s,n);if(u){if(u.length>0&&!u[u.length-1].parent)continue;const d=t.isInteractive();return(u.length>0||d)&&u.push(t),u}}}const o=this._isInteractive(e),a=t.isInteractive();return o&&s(t,i)?a?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return!!(!t||t.isMask||!t.visible||!t.renderable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren||t.isMask)}hitPruneFn(t,e){var i;if(t.hitArea&&(t.worldTransform.applyInverse(e,il),!t.hitArea.contains(il.x,il.y)))return!0;if(t._mask){const s=t._mask.isMaskData?t._mask.maskObject:t._mask;if(s&&!((i=s.containsPoint)!=null&&i.call(s,e)))return!0}return!1}hitTestFn(t,e){return t.eventMode==="passive"?!1:t.hitArea?!0:t.containsPoint?t.containsPoint(e):!1}notifyTarget(t,e){var n,o;e=e??t.type;const i=`on${e}`;(o=(n=t.currentTarget)[i])==null||o.call(n,t);const s=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,s),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof Ae)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),e.pointerType==="touch")this.dispatchEvent(e,"touchstart");else if(e.pointerType==="mouse"||e.pointerType==="pen"){const s=e.button===2;this.dispatchEvent(e,s?"rightdown":"mousedown")}const i=this.trackingData(t.pointerId);i.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){var l,h;if(!(t instanceof Ae)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;const e=this.createPointerEvent(t);this._isPointerMoveEvent=!1;const i=e.pointerType==="mouse"||e.pointerType==="pen",s=this.trackingData(t.pointerId),n=this.findMountedTarget(s.overTargets);if(((l=s.overTargets)==null?void 0:l.length)>0&&n!==e.target){const c=t.type==="mousemove"?"mouseout":"pointerout",u=this.createPointerEvent(t,c,n);if(this.dispatchEvent(u,"pointerout"),i&&this.dispatchEvent(u,"mouseout"),!e.composedPath().includes(n)){const d=this.createPointerEvent(t,"pointerleave",n);for(d.eventPhase=d.AT_TARGET;d.target&&!e.composedPath().includes(d.target);)d.currentTarget=d.target,this.notifyTarget(d),i&&this.notifyTarget(d,"mouseleave"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(u)}if(n!==e.target){const c=t.type==="mousemove"?"mouseover":"pointerover",u=this.clonePointerEvent(e,c);this.dispatchEvent(u,"pointerover"),i&&this.dispatchEvent(u,"mouseover");let d=n==null?void 0:n.parent;for(;d&&d!==this.rootTarget.parent&&d!==e.target;)d=d.parent;if(!d||d===this.rootTarget.parent){const f=this.clonePointerEvent(e,"pointerenter");for(f.eventPhase=f.AT_TARGET;f.target&&f.target!==n&&f.target!==this.rootTarget.parent;)f.currentTarget=f.target,this.notifyTarget(f),i&&this.notifyTarget(f,"mouseenter"),f.target=f.target.parent;this.freeEvent(f)}this.freeEvent(u)}const o=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?o.push("pointermove"):this.dispatchEvent(e,"pointermove"),a&&o.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?o.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),a&&o.push("globaltouchmove")),i&&(this.moveOnAll?o.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),a&&o.push("globalmousemove"),this.cursor=(h=e.target)==null?void 0:h.cursor),o.length>0&&this.all(e,o),this._allInteractiveElements.length=0,this._hitElements.length=0,s.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){var o;if(!(t instanceof Ae)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId),i=this.createPointerEvent(t),s=i.pointerType==="mouse"||i.pointerType==="pen";this.dispatchEvent(i,"pointerover"),s&&this.dispatchEvent(i,"mouseover"),i.pointerType==="mouse"&&(this.cursor=(o=i.target)==null?void 0:o.cursor);const n=this.clonePointerEvent(i,"pointerenter");for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),s&&this.notifyTarget(n,"mouseenter"),n.target=n.target.parent;e.overTargets=i.composedPath(),this.freeEvent(i),this.freeEvent(n)}mapPointerOut(t){if(!(t instanceof Ae)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId);if(e.overTargets){const i=t.pointerType==="mouse"||t.pointerType==="pen",s=this.findMountedTarget(e.overTargets),n=this.createPointerEvent(t,"pointerout",s);this.dispatchEvent(n),i&&this.dispatchEvent(n,"mouseout");const o=this.createPointerEvent(t,"pointerleave",s);for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),i&&this.notifyTarget(o,"mouseleave"),o.target=o.target.parent;e.overTargets=null,this.freeEvent(n),this.freeEvent(o)}this.cursor=null}mapPointerUp(t){if(!(t instanceof Ae)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=performance.now(),i=this.createPointerEvent(t);if(this.dispatchEvent(i,"pointerup"),i.pointerType==="touch")this.dispatchEvent(i,"touchend");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const a=i.button===2;this.dispatchEvent(i,a?"rightup":"mouseup")}const s=this.trackingData(t.pointerId),n=this.findMountedTarget(s.pressTargetsByButton[t.button]);let o=n;if(n&&!i.composedPath().includes(n)){let a=n;for(;a&&!i.composedPath().includes(a);){if(i.currentTarget=a,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch")this.notifyTarget(i,"touchendoutside");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const l=i.button===2;this.notifyTarget(i,l?"rightupoutside":"mouseupoutside")}a=a.parent}delete s.pressTargetsByButton[t.button],o=a}if(o){const a=this.clonePointerEvent(i,"click");a.target=o,a.path=null,s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:a.target,timeStamp:e});const l=s.clicksByButton[t.button];if(l.target===a.target&&e-l.timeStamp<200?++l.clickCount:l.clickCount=1,l.target=a.target,l.timeStamp=e,a.detail=l.clickCount,a.pointerType==="mouse"){const h=a.button===2;this.dispatchEvent(a,h?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(i)}mapPointerUpOutside(t){if(!(t instanceof Ae)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId),i=this.findMountedTarget(e.pressTargetsByButton[t.button]),s=this.createPointerEvent(t);if(i){let n=i;for(;n;)s.currentTarget=n,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch"?this.notifyTarget(s,"touchendoutside"):(s.pointerType==="mouse"||s.pointerType==="pen")&&this.notifyTarget(s,s.button===2?"rightupoutside":"mouseupoutside"),n=n.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(s)}mapWheel(t){if(!(t instanceof Pi)){console.warn("EventBoundary cannot map a non-wheel event as a wheel event");return}const e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i<t.length&&t[i].parent===e;i++)e=t[i];return e}createPointerEvent(t,e,i){const s=this.allocateEvent(Ae);return this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.nativeEvent=t.nativeEvent,s.originalEvent=t,s.target=i??this.hitTest(s.global.x,s.global.y)??this._hitElements[0],typeof e=="string"&&(s.type=e),s}createWheelEvent(t){const e=this.allocateEvent(Pi);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e}clonePointerEvent(t,e){const i=this.allocateEvent(Ae);return i.nativeEvent=t.nativeEvent,i.originalEvent=t.originalEvent,this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.target=t.target,i.path=t.composedPath().slice(),i.type=e??i.type,i}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof Ae&&e instanceof Ae&&(e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist)}copyMouseData(t,e){t instanceof Pn&&e instanceof Pn&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.screen.copyFrom(t.screen),e.shiftKey=t.shiftKey,e.global.copyFrom(t.global))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page)}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){this.eventPool.has(t)||this.eventPool.set(t,[]);const e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.path=null,e.target=null,e}freeEvent(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");const e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i&&t.currentTarget.isInteractive())if("fn"in i)i.once&&t.currentTarget.removeListener(e,i.fn,void 0,!0),i.fn.call(i.context,t);else for(let s=0,n=i.length;s<n&&!t.propagationImmediatelyStopped;s++)i[s].once&&t.currentTarget.removeListener(e,i[s].fn,void 0,!0),i[s].fn.call(i[s].context,t)}}const ox=1,ax={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},sl=class Ll{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new nx(null),br.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new Ae(null),this.rootWheelEvent=new Pi(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...Ll.defaultEventFeatures},{set:(e,i,s)=>(i==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=s),e[i]=s,!0)}),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOverOut=this.onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(t){const{view:e,resolution:i}=this.renderer;this.setTargetElement(e),this.resolution=i,Ll._defaultEventMode=t.eventMode??"auto",Object.assign(this.features,t.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(t){this.resolution=t}destroy(){this.setTargetElement(null),this.renderer=null}setCursor(t){t=t||"default";let e=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=!1),this.currentCursor===t)return;this.currentCursor=t;const i=this.cursorStyles[t];if(i)switch(typeof i){case"string":e&&(this.domElement.style.cursor=i);break;case"function":i(t);break;case"object":e&&Object.assign(this.domElement.style,i);break}else e&&typeof t=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t)}get pointer(){return this.rootPointerEvent}onPointerDown(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let i=0,s=e.length;i<s;i++){const n=e[i],o=this.bootstrapEvent(this.rootPointerEvent,n);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,br.pointerMoved();const e=this.normalizeToPointerData(t);for(let i=0,s=e.length;i<s;i++){const n=this.bootstrapEvent(this.rootPointerEvent,e[i]);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}onPointerUp(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=t.target;t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]);const i=e!==this.domElement?"outside":"",s=this.normalizeToPointerData(t);for(let n=0,o=s.length;n<o;n++){const a=this.bootstrapEvent(this.rootPointerEvent,s[n]);a.type+=i,this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}onPointerOverOut(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const e=this.normalizeToPointerData(t);for(let i=0,s=e.length;i<s;i++){const n=this.bootstrapEvent(this.rootPointerEvent,e[i]);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}onWheel(t){if(!this.features.wheel)return;const e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(e)}setTargetElement(t){this.removeEvents(),this.domElement=t,br.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;br.addTickerListener();const t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this.onPointerMove,!0),this.domElement.addEventListener("pointerdown",this.onPointerDown,!0),this.domElement.addEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this.onPointerOverOut,!0),globalThis.addEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.addEventListener("mousemove",this.onPointerMove,!0),this.domElement.addEventListener("mousedown",this.onPointerDown,!0),this.domElement.addEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this.onPointerOverOut,!0),globalThis.addEventListener("mouseup",this.onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this.onPointerDown,!0),this.domElement.addEventListener("touchend",this.onPointerUp,!0),this.domElement.addEventListener("touchmove",this.onPointerMove,!0))),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;br.removeTickerListener();const t=this.domElement.style;globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction=""),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this.onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this.onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this.onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this.onPointerMove,!0),this.domElement.removeEventListener("mousedown",this.onPointerDown,!0),this.domElement.removeEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this.onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this.onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this.onPointerDown,!0),this.domElement.removeEventListener("touchend",this.onPointerUp,!0),this.domElement.removeEventListener("touchmove",this.onPointerMove,!0))),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapPositionToPoint(t,e,i){const s=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},n=1/this.resolution;t.x=(e-s.left)*(this.domElement.width/s.width)*n,t.y=(i-s.top)*(this.domElement.height/s.height)*n}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let i=0,s=t.changedTouches.length;i<s;i++){const n=t.changedTouches[i];typeof n.button>"u"&&(n.button=0),typeof n.buttons>"u"&&(n.buttons=1),typeof n.isPrimary>"u"&&(n.isPrimary=t.touches.length===1&&t.type==="touchstart"),typeof n.width>"u"&&(n.width=n.radiusX||1),typeof n.height>"u"&&(n.height=n.radiusY||1),typeof n.tiltX>"u"&&(n.tiltX=0),typeof n.tiltY>"u"&&(n.tiltY=0),typeof n.pointerType>"u"&&(n.pointerType="touch"),typeof n.pointerId>"u"&&(n.pointerId=n.identifier||0),typeof n.pressure>"u"&&(n.pressure=n.force||.5),typeof n.twist>"u"&&(n.twist=0),typeof n.tangentialPressure>"u"&&(n.tangentialPressure=0),typeof n.layerX>"u"&&(n.layerX=n.offsetX=n.clientX),typeof n.layerY>"u"&&(n.layerY=n.offsetY=n.clientY),n.isNormalized=!0,n.type=t.type,e.push(n)}else if(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent))){const i=t;typeof i.isPrimary>"u"&&(i.isPrimary=!0),typeof i.width>"u"&&(i.width=1),typeof i.height>"u"&&(i.height=1),typeof i.tiltX>"u"&&(i.tiltX=0),typeof i.tiltY>"u"&&(i.tiltY=0),typeof i.pointerType>"u"&&(i.pointerType="mouse"),typeof i.pointerId>"u"&&(i.pointerId=ox),typeof i.pressure>"u"&&(i.pressure=.5),typeof i.twist>"u"&&(i.twist=0),typeof i.tangentialPressure>"u"&&(i.tangentialPressure=0),i.isNormalized=!0,e.push(i)}else e.push(t);return e}normalizeWheelEvent(t){const e=this.rootWheelEvent;return this.transferMouseData(e,t),e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ,e.deltaMode=t.deltaMode,this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.nativeEvent=t,e.type=t.type,e}bootstrapEvent(t,e){return t.originalEvent=null,t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this.transferMouseData(t,e),this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.isTrusted=e.isTrusted,t.type==="pointerleave"&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=ax[t.type]||t.type),t}transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.relatedTarget=null,t.shiftKey=e.shiftKey}};sl.extension={name:"events",type:[V.RendererSystem,V.CanvasRendererSystem]},sl.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let nl=sl;j.add(nl);function Id(r){return r==="dynamic"||r==="static"}const lx={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,_internalInteractive:void 0,get interactive(){return this._internalInteractive??Id(nl.defaultEventMode)},set interactive(r){lt("7.2.0","Setting interactive is deprecated, use eventMode = 'none'/'passive'/'auto'/'static'/'dynamic' instead."),this._internalInteractive=r,this.eventMode=r?"static":"auto"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??nl.defaultEventMode},set eventMode(r){this._internalInteractive=Id(r),this._internalEventMode=r},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(r,t,e){const i=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof e=="object"?e.signal:void 0,n=typeof e=="object"?e.once===!0:!1,o=typeof t=="function"?void 0:t;r=i?`${r}capture`:r;const a=typeof t=="function"?t:t.handleEvent,l=this;s&&s.addEventListener("abort",()=>{l.off(r,a,o)}),n?l.once(r,a,o):l.on(r,a,o)},removeEventListener(r,t,e){const i=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof t=="function"?void 0:t;r=i?`${r}capture`:r,t=typeof t=="function"?t:t.handleEvent,this.off(r,t,s)},dispatchEvent(r){if(!(r instanceof gs))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return r.defaultPrevented=!1,r.path=null,r.target=this,r.manager.dispatchEvent(r),!r.defaultPrevented}};Rt.mixin(lx);const hx={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};Rt.mixin(hx);const cx=9,Mn=100,ux=0,dx=0,Rd=2,Pd=1,fx=-1e3,px=-1e3,mx=2;class Md{constructor(t){this.debug=!1,this._isActive=!1,this._isMobileAccessibility=!1,this.pool=[],this.renderId=0,this.children=[],this.androidUpdateCount=0,this.androidUpdateFrequency=500,this._hookDiv=null,(ir.tablet||ir.phone)&&this.createTouchHook();const e=document.createElement("div");e.style.width=`${Mn}px`,e.style.height=`${Mn}px`,e.style.position="absolute",e.style.top=`${ux}px`,e.style.left=`${dx}px`,e.style.zIndex=Rd.toString(),this.div=e,this.renderer=t,this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}createTouchHook(){const t=document.createElement("button");t.style.width=`${Pd}px`,t.style.height=`${Pd}px`,t.style.position="absolute",t.style.top=`${fx}px`,t.style.left=`${px}px`,t.style.zIndex=mx.toString(),t.style.backgroundColor="#FF0000",t.title="select to enable accessibility for this content",t.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this.activate(),this.destroyTouchHook()}),document.body.appendChild(t),this._hookDiv=t}destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}activate(){var t;this._isActive||(this._isActive=!0,globalThis.document.addEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown,!1),this.renderer.on("postrender",this.update,this),(t=this.renderer.view.parentNode)==null||t.appendChild(this.div))}deactivate(){var t;!this._isActive||this._isMobileAccessibility||(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),(t=this.div.parentNode)==null||t.removeChild(this.div))}updateAccessibleObjects(t){if(!t.visible||!t.accessibleChildren)return;t.accessible&&t.isInteractive()&&(t._accessibleActive||this.addChild(t),t.renderId=this.renderId);const e=t.children;if(e)for(let i=0;i<e.length;i++)this.updateAccessibleObjects(e[i])}update(){const t=performance.now();if(ir.android.device&&t<this.androidUpdateCount||(this.androidUpdateCount=t+this.androidUpdateFrequency,!this.renderer.renderingToScreen))return;this.renderer.lastObjectRendered&&this.updateAccessibleObjects(this.renderer.lastObjectRendered);const{x:e,y:i,width:s,height:n}=this.renderer.view.getBoundingClientRect(),{width:o,height:a,resolution:l}=this.renderer,h=s/o*l,c=n/a*l;let u=this.div;u.style.left=`${e}px`,u.style.top=`${i}px`,u.style.width=`${o}px`,u.style.height=`${a}px`;for(let d=0;d<this.children.length;d++){const f=this.children[d];if(f.renderId!==this.renderId)f._accessibleActive=!1,Ai(this.children,d,1),this.div.removeChild(f._accessibleDiv),this.pool.push(f._accessibleDiv),f._accessibleDiv=null,d--;else{u=f._accessibleDiv;let p=f.hitArea;const m=f.worldTransform;f.hitArea?(u.style.left=`${(m.tx+p.x*m.a)*h}px`,u.style.top=`${(m.ty+p.y*m.d)*c}px`,u.style.width=`${p.width*m.a*h}px`,u.style.height=`${p.height*m.d*c}px`):(p=f.getBounds(),this.capHitArea(p),u.style.left=`${p.x*h}px`,u.style.top=`${p.y*c}px`,u.style.width=`${p.width*h}px`,u.style.height=`${p.height*c}px`,u.title!==f.accessibleTitle&&f.accessibleTitle!==null&&(u.title=f.accessibleTitle),u.getAttribute("aria-label")!==f.accessibleHint&&f.accessibleHint!==null&&u.setAttribute("aria-label",f.accessibleHint)),(f.accessibleTitle!==u.title||f.tabIndex!==u.tabIndex)&&(u.title=f.accessibleTitle,u.tabIndex=f.tabIndex,this.debug&&this.updateDebugHTML(u))}}this.renderId++}updateDebugHTML(t){t.innerHTML=`type: ${t.type}</br> title : ${t.title}</br> tabIndex: ${t.tabIndex}`}capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);const{width:e,height:i}=this.renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>i&&(t.height=i-t.y)}addChild(t){let e=this.pool.pop();e||(e=document.createElement("button"),e.style.width=`${Mn}px`,e.style.height=`${Mn}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=Rd.toString(),e.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?e.setAttribute("aria-live","off"):e.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?e.setAttribute("aria-relevant","additions"):e.setAttribute("aria-relevant","text"),e.addEventListener("click",this._onClick.bind(this)),e.addEventListener("focus",this._onFocus.bind(this)),e.addEventListener("focusout",this._onFocusOut.bind(this))),e.style.pointerEvents=t.accessiblePointerEvents,e.type=t.accessibleType,t.accessibleTitle&&t.accessibleTitle!==null?e.title=t.accessibleTitle:(!t.accessibleHint||t.accessibleHint===null)&&(e.title=`displayObject ${t.tabIndex}`),t.accessibleHint&&t.accessibleHint!==null&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this.updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.displayObject=t,this.children.push(t),this.div.appendChild(t._accessibleDiv),t._accessibleDiv.tabIndex=t.tabIndex}_dispatchEvent(t,e){const{displayObject:i}=t.target,s=this.renderer.events.rootBoundary,n=Object.assign(new gs(s),{target:i});s.rootTarget=this.renderer.lastObjectRendered,e.forEach(o=>s.dispatchEvent(n,o))}_onClick(t){this._dispatchEvent(t,["click","pointertap","tap"])}_onFocus(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive"),this._dispatchEvent(t,["mouseover"])}_onFocusOut(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite"),this._dispatchEvent(t,["mouseout"])}_onKeyDown(t){t.keyCode===cx&&this.activate()}_onMouseMove(t){t.movementX===0&&t.movementY===0||this.deactivate()}destroy(){this.destroyTouchHook(),this.div=null,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null}}Md.extension={name:"accessibility",type:[V.RendererPlugin,V.CanvasRendererPlugin]},j.add(Md);const Bd=class Nl{constructor(t){this.stage=new Te,t=Object.assign({forceCanvas:!1},t),this.renderer=yd(t),Nl._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render(this.stage)}get view(){var t;return(t=this.renderer)==null?void 0:t.view}get screen(){var t;return(t=this.renderer)==null?void 0:t.screen}destroy(t,e){const i=Nl._plugins.slice(0);i.reverse(),i.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};Bd._plugins=[];let gx=Bd;j.handleByList(V.Application,gx._plugins);class Dd{static init(t){Object.defineProperty(this,"resizeTo",{set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this.cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this.cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this.cancelResize();let e,i;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,i=globalThis.innerHeight;else{const{clientWidth:s,clientHeight:n}=this._resizeTo;e=s,i=n}this.renderer.resize(e,i),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this.cancelResize(),this.cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}Dd.extension=V.Application,j.add(Dd);const Od={loader:V.LoadParser,resolver:V.ResolveParser,cache:V.CacheParser,detection:V.DetectionParser};j.handle(V.Asset,r=>{const t=r.ref;Object.entries(Od).filter(([e])=>!!t[e]).forEach(([e,i])=>j.add(Object.assign(t[e],{extension:t[e].extension??i})))},r=>{const t=r.ref;Object.keys(Od).filter(e=>!!t[e]).forEach(e=>j.remove(t[e]))});class yx{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(e=>{this._assetList.push(e)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;const t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let i=0;i<e;i++)t.push(this._assetList.pop());await this._loader.load(t),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(t){this._isActive!==t&&(this._isActive=t,t&&!this._isLoading&&this._next())}}function Mi(r,t){if(Array.isArray(t)){for(const e of t)if(r.startsWith(`data:${e}`))return!0;return!1}return r.startsWith(`data:${t}`)}function wr(r,t){const e=r.split("?")[0],i=Gt.extname(e).toLowerCase();return Array.isArray(t)?t.includes(i):i===t}const Se=(r,t,e=!1)=>(Array.isArray(r)||(r=[r]),t?r.map(i=>typeof i=="string"||e?t(i):i):r),ol=(r,t)=>{const e=t.split("?")[1];return e&&(r+=`?${e}`),r};function Fd(r,t,e,i,s){const n=t[e];for(let o=0;o<n.length;o++){const a=n[o];e<t.length-1?Fd(r.replace(i[e],a),t,e+1,i,s):s.push(r.replace(i[e],a))}}function _x(r){const t=/\{(.*?)\}/g,e=r.match(t),i=[];if(e){const s=[];e.forEach(n=>{const o=n.substring(1,n.length-1).split(",");s.push(o)}),Fd(r,s,0,e,i)}else i.push(r);return i}const Bn=r=>!Array.isArray(r);class vx{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){const e=this._cache.get(t);return e||console.warn(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){const i=Se(t);let s;for(let a=0;a<this.parsers.length;a++){const l=this.parsers[a];if(l.test(e)){s=l.getCacheableAssets(i,e);break}}s||(s={},i.forEach(a=>{s[a]=e}));const n=Object.keys(s),o={cacheKeys:n,keys:i};if(i.forEach(a=>{this._cacheMap.set(a,o)}),n.forEach(a=>{this._cache.has(a)&&this._cache.get(a)!==e&&console.warn("[Cache] already has key:",a),this._cache.set(a,s[a])}),e instanceof Y){const a=e;i.forEach(l=>{a.baseTexture!==Y.EMPTY.baseTexture&&it.addToCache(a.baseTexture,l),Y.addToCache(a,l)})}}remove(t){if(!this._cacheMap.has(t)){console.warn(`[Assets] Asset id ${t} was not found in the Cache`);return}const e=this._cacheMap.get(t);e.cacheKeys.forEach(i=>{this._cache.delete(i)}),e.keys.forEach(i=>{this._cacheMap.delete(i)})}get parsers(){return this._parsers}}const qr=new vx;class xx{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,i)=>(this._parsersValidated=!1,t[e]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){const i={promise:null,parser:null};return i.promise=(async()=>{var o,a;let s=null,n=null;if(e.loadParser&&(n=this._parserHash[e.loadParser],n||console.warn(`[Assets] specified load parser "${e.loadParser}" not found while loading ${t}`)),!n){for(let l=0;l<this.parsers.length;l++){const h=this.parsers[l];if(h.load&&((o=h.test)!=null&&o.call(h,t,e,this))){n=h;break}}if(!n)return console.warn(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}s=await n.load(t,e,this),i.parser=n;for(let l=0;l<this.parsers.length;l++){const h=this.parsers[l];h.parse&&h.parse&&await((a=h.testParse)==null?void 0:a.call(h,s,e,this))&&(s=await h.parse(s,e,this)||s,i.parser=h)}return s})(),i}async load(t,e){this._parsersValidated||this._validateParsers();let i=0;const s={},n=Bn(t),o=Se(t,h=>({alias:[h],src:h})),a=o.length,l=o.map(async h=>{const c=Gt.toAbsolute(h.src);if(!s[h.src])try{this.promiseCache[c]||(this.promiseCache[c]=this._getLoadPromiseAndParser(c,h)),s[h.src]=await this.promiseCache[c].promise,e&&e(++i/a)}catch(u){throw delete this.promiseCache[c],delete s[h.src],new Error(`[Loader.load] Failed to load ${c}.
867
+ ${u}`)}});return await Promise.all(l),n?s[o[0].src]:s}async unload(t){const e=Se(t,i=>({alias:[i],src:i})).map(async i=>{var o,a;const s=Gt.toAbsolute(i.src),n=this.promiseCache[s];if(n){const l=await n.promise;delete this.promiseCache[s],(a=(o=n.parser)==null?void 0:o.unload)==null||a.call(o,l,i,this)}});await Promise.all(e)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(t[e.name]&&console.warn(`[Assets] loadParser name conflict "${e.name}"`),{...t,[e.name]:e}),{})}}var Ce=(r=>(r[r.Low=0]="Low",r[r.Normal=1]="Normal",r[r.High=2]="High",r))(Ce||{});const bx=".json",wx="application/json",Ex={extension:{type:V.LoadParser,priority:Ce.Low},name:"loadJson",test(r){return Mi(r,wx)||wr(r,bx)},async load(r){return await(await W.ADAPTER.fetch(r)).json()}};j.add(Ex);const Tx=".txt",Ax="text/plain",Sx={name:"loadTxt",extension:{type:V.LoadParser,priority:Ce.Low},test(r){return Mi(r,Ax)||wr(r,Tx)},async load(r){return await(await W.ADAPTER.fetch(r)).text()}};j.add(Sx);const Cx=["normal","bold","100","200","300","400","500","600","700","800","900"],Ix=[".ttf",".otf",".woff",".woff2"],Rx=["font/ttf","font/otf","font/woff","font/woff2"],Px=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function Mx(r){const t=Gt.extname(r),e=Gt.basename(r,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(n=>n.charAt(0).toUpperCase()+n.slice(1));let i=e.length>0;for(const n of e)if(!n.match(Px)){i=!1;break}let s=e.join(" ");return i||(s=`"${s.replace(/[\\"]/g,"\\$&")}"`),s}const Bx=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function Dx(r){return Bx.test(r)?r:encodeURI(r)}const Ox={extension:{type:V.LoadParser,priority:Ce.Low},name:"loadWebFont",test(r){return Mi(r,Rx)||wr(r,Ix)},async load(r,t){var i,s,n;const e=W.ADAPTER.getFontFaceSet();if(e){const o=[],a=((i=t.data)==null?void 0:i.family)??Mx(r),l=((n=(s=t.data)==null?void 0:s.weights)==null?void 0:n.filter(c=>Cx.includes(c)))??["normal"],h=t.data??{};for(let c=0;c<l.length;c++){const u=l[c],d=new FontFace(a,`url(${Dx(r)})`,{...h,weight:u});await d.load(),e.add(d),o.push(d)}return o.length===1?o[0]:o}return console.warn("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(r){(Array.isArray(r)?r:[r]).forEach(t=>W.ADAPTER.getFontFaceSet().delete(t))}};j.add(Ox);const Fx=`(function() {
868
+ "use strict";
869
+ const WHITE_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=";
870
+ async function checkImageBitmap() {
871
+ try {
872
+ if (typeof createImageBitmap != "function")
873
+ return !1;
874
+ const imageBlob = await (await fetch(WHITE_PNG)).blob(), imageBitmap = await createImageBitmap(imageBlob);
875
+ return imageBitmap.width === 1 && imageBitmap.height === 1;
876
+ } catch {
877
+ return !1;
878
+ }
879
+ }
880
+ checkImageBitmap().then((result) => {
881
+ self.postMessage(result);
882
+ });
883
+ })();
884
+ `;let Bi=null,al=class{constructor(){Bi||(Bi=URL.createObjectURL(new Blob([Fx],{type:"application/javascript"}))),this.worker=new Worker(Bi)}};al.revokeObjectURL=function(){Bi&&(URL.revokeObjectURL(Bi),Bi=null)};const Lx=`(function() {
885
+ "use strict";
886
+ async function loadImageBitmap(url) {
887
+ const response = await fetch(url);
888
+ if (!response.ok)
889
+ throw new Error(\`[WorkerManager.loadImageBitmap] Failed to fetch \${url}: \${response.status} \${response.statusText}\`);
890
+ const imageBlob = await response.blob();
891
+ return await createImageBitmap(imageBlob);
892
+ }
893
+ self.onmessage = async (event) => {
894
+ try {
895
+ const imageBitmap = await loadImageBitmap(event.data.data[0]);
896
+ self.postMessage({
897
+ data: imageBitmap,
898
+ uuid: event.data.uuid,
899
+ id: event.data.id
900
+ }, [imageBitmap]);
901
+ } catch (e) {
902
+ self.postMessage({
903
+ error: e,
904
+ uuid: event.data.uuid,
905
+ id: event.data.id
906
+ });
907
+ }
908
+ };
909
+ })();
910
+ `;let Di=null;class Ld{constructor(){Di||(Di=URL.createObjectURL(new Blob([Lx],{type:"application/javascript"}))),this.worker=new Worker(Di)}}Ld.revokeObjectURL=function(){Di&&(URL.revokeObjectURL(Di),Di=null)};let Nd=0,ll;class Nx{constructor(){this._initialized=!1,this._createdWorkers=0,this.workerPool=[],this.queue=[],this.resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{const{worker:e}=new al;e.addEventListener("message",i=>{e.terminate(),al.revokeObjectURL(),t(i.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t){return this._run("loadImageBitmap",[t])}async _initWorkers(){this._initialized||(this._initialized=!0)}getWorker(){ll===void 0&&(ll=navigator.hardwareConcurrency||4);let t=this.workerPool.pop();return!t&&this._createdWorkers<ll&&(this._createdWorkers++,t=new Ld().worker,t.addEventListener("message",e=>{this.complete(e.data),this.returnWorker(e.target),this.next()})),t}returnWorker(t){this.workerPool.push(t)}complete(t){t.error!==void 0?this.resolveHash[t.uuid].reject(t.error):this.resolveHash[t.uuid].resolve(t.data),this.resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();const i=new Promise((s,n)=>{this.queue.push({id:t,arguments:e,resolve:s,reject:n})});return this.next(),i}next(){if(!this.queue.length)return;const t=this.getWorker();if(!t)return;const e=this.queue.pop(),i=e.id;this.resolveHash[Nd]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:Nd++,id:i})}}const Ud=new Nx;function ys(r,t,e){r.resource.internal=!0;const i=new Y(r),s=()=>{delete t.promiseCache[e],qr.has(e)&&qr.remove(e)};return i.baseTexture.once("destroyed",()=>{e in t.promiseCache&&(console.warn("[Assets] A BaseTexture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the BaseTexture."),s())}),i.once("destroyed",()=>{r.destroyed||(console.warn("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),s())}),i}const Ux=[".jpeg",".jpg",".png",".webp",".avif"],kx=["image/jpeg","image/png","image/webp","image/avif"];async function Gx(r){const t=await W.ADAPTER.fetch(r);if(!t.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${t.status} ${t.statusText}`);const e=await t.blob();return await createImageBitmap(e)}const Dn={name:"loadTextures",extension:{type:V.LoadParser,priority:Ce.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return Mi(r,kx)||wr(r,Ux)},async load(r,t,e){var a;const i=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;let s;i?this.config.preferWorkers&&await Ud.isImageBitmapSupported()?s=await Ud.loadImageBitmap(r):s=await Gx(r):s=await new Promise((l,h)=>{const c=new Image;c.crossOrigin=this.config.crossOrigin,c.src=r,c.complete?l(c):(c.onload=()=>l(c),c.onerror=u=>h(u))});const n={...t.data};n.resolution??(n.resolution=or(r)),i&&((a=n.resourceOptions)==null?void 0:a.ownsImageBitmap)===void 0&&(n.resourceOptions={...n.resourceOptions},n.resourceOptions.ownsImageBitmap=!0);const o=new it(s,n);return o.resource.src=r,ys(o,e,r)},unload(r){r.destroy(!0)}};j.add(Dn);const $x=".svg",Hx="image/svg+xml",Xx={extension:{type:V.LoadParser,priority:Ce.High},name:"loadSVG",test(r){return Mi(r,Hx)||wr(r,$x)},async testParse(r){return Qa.test(r)},async parse(r,t,e){var n;const i=new Qa(r,(n=t==null?void 0:t.data)==null?void 0:n.resourceOptions);await i.load();const s=new it(i,{resolution:or(r),...t==null?void 0:t.data});return s.resource.src=t.src,ys(s,e,t.src)},async load(r,t){return(await W.ADAPTER.fetch(r)).text()},unload:Dn.unload};j.add(Xx);const Vx=[".mp4",".m4v",".webm",".ogv"],zx=["video/mp4","video/webm","video/ogg"],Wx={name:"loadVideo",extension:{type:V.LoadParser,priority:Ce.High},config:{defaultAutoPlay:!0,defaultUpdateFPS:0,defaultLoop:!1,defaultMuted:!1,defaultPlaysinline:!0},test(r){return Mi(r,zx)||wr(r,Vx)},async load(r,t,e){var o;let i;const s=await(await W.ADAPTER.fetch(r)).blob(),n=URL.createObjectURL(s);try{const a={autoPlay:this.config.defaultAutoPlay,updateFPS:this.config.defaultUpdateFPS,loop:this.config.defaultLoop,muted:this.config.defaultMuted,playsinline:this.config.defaultPlaysinline,...(o=t==null?void 0:t.data)==null?void 0:o.resourceOptions,autoLoad:!0},l=new Td(n,a);await l.load();const h=new it(l,{alphaMode:await J_(),resolution:or(r),...t==null?void 0:t.data});h.resource.src=r,i=ys(h,e,r),i.baseTexture.once("destroyed",()=>{URL.revokeObjectURL(n)})}catch(a){throw URL.revokeObjectURL(n),a}return i},unload(r){r.destroy(!0)}};j.add(Wx);class jx{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params))}),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if(typeof t=="string")this._defaultSearchParams=t;else{const e=t;this._defaultSearchParams=Object.keys(e).map(i=>`${encodeURIComponent(i)}=${encodeURIComponent(e[i])}`).join("&")}}getAlias(t){const{alias:e,name:i,src:s,srcs:n}=t;return Se(e||i||s||n,o=>typeof o=="string"?o:Array.isArray(o)?o.map(a=>(a==null?void 0:a.src)??(a==null?void 0:a.srcs)??a):o!=null&&o.src||o!=null&&o.srcs?o.src??o.srcs:o,!0)}addManifest(t){this._manifest&&console.warn("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){const i=[];Array.isArray(e)?e.forEach(s=>{const n=s.src??s.srcs,o=s.alias??s.name;let a;if(typeof o=="string"){const l=this._createBundleAssetId(t,o);i.push(l),a=[o,l]}else{const l=o.map(h=>this._createBundleAssetId(t,h));i.push(...l),a=[...o,...l]}this.add({...s,alias:a,src:n})}):Object.keys(e).forEach(s=>{const n=[s,this._createBundleAssetId(t,s)];if(typeof e[s]=="string")this.add({alias:n,src:e[s]});else if(Array.isArray(e[s]))this.add({alias:n,src:e[s]});else{const o=e[s],a=o.src??o.srcs;this.add({...o,alias:n,src:Array.isArray(a)?a:[a]})}i.push(...n)}),this._bundles[t]=i}add(t,e,i,s,n){const o=[];typeof t=="string"||Array.isArray(t)&&typeof t[0]=="string"?(lt("7.2.0",`Assets.add now uses an object instead of individual parameters.
911
+ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`),o.push({alias:t,src:e,data:i,format:s,loadParser:n})):Array.isArray(t)?o.push(...t):o.push(t);let a;a=l=>{this.hasKey(l)&&console.warn(`[Resolver] already has key: ${l} overwriting`)},Se(o).forEach(l=>{const{src:h,srcs:c}=l;let{data:u,format:d,loadParser:f}=l;const p=Se(h||c).map(y=>typeof y=="string"?_x(y):Array.isArray(y)?y:[y]),m=this.getAlias(l);Array.isArray(m)?m.forEach(a):a(m);const _=[];p.forEach(y=>{y.forEach(x=>{let g={};if(typeof x!="object"){g.src=x;for(let v=0;v<this._parsers.length;v++){const w=this._parsers[v];if(w.test(x)){g=w.parse(x);break}}}else u=x.data??u,d=x.format??d,f=x.loadParser??f,g={...g,...x};if(!m)throw new Error(`[Resolver] alias is undefined for this asset: ${g.src}`);g=this.buildResolvedAsset(g,{aliases:m,data:u,format:d,loadParser:f}),_.push(g)})}),m.forEach(y=>{this._assetMap[y]=_})})}resolveBundle(t){const e=Bn(t);t=Se(t);const i={};return t.forEach(s=>{const n=this._bundles[s];if(n){const o=this.resolve(n),a={};for(const l in o){const h=o[l];a[this._extractAssetIdFromBundle(s,l)]=h}i[s]=a}}),e?i[t[0]]:i}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const i={};for(const s in e)i[s]=e[s].src;return i}return e.src}resolve(t){const e=Bn(t);t=Se(t);const i={};return t.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let n=this._assetMap[s];const o=n[0],a=this._getPreferredOrder(n);a==null||a.priority.forEach(l=>{a.params[l].forEach(h=>{const c=n.filter(u=>u[l]?u[l]===h:!1);c.length&&(n=c)})}),this._resolverHash[s]=n[0]??o}else this._resolverHash[s]=this.buildResolvedAsset({alias:[s],src:s},{});i[s]=this._resolverHash[s]}),e?i[t[0]]:i}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){const i=t[0],s=this._preferredOrder.find(n=>n.params.format.includes(i.format));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;const e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}buildResolvedAsset(t,e){const{aliases:i,data:s,loadParser:n,format:o}=e;return(this._basePath||this._rootPath)&&(t.src=Gt.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=i??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...s||{},...t.data},t.loadParser=n??t.loadParser,t.format=o??t.format??Gt.extname(t.src).slice(1),t.srcs=t.src,t.name=t.alias,t}}class Yx{constructor(){this._detections=[],this._initialized=!1,this.resolver=new jx,this.loader=new xx,this.cache=qr,this._backgroundLoader=new yx(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){var n,o;if(this._initialized){console.warn("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let a=t.manifest;typeof a=="string"&&(a=await this.load(a)),this.resolver.addManifest(a)}const e=((n=t.texturePreference)==null?void 0:n.resolution)??1,i=typeof e=="number"?[e]:e,s=await this._detectFormats({preferredFormats:(o=t.texturePreference)==null?void 0:o.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:i}}),t.preferences&&this.setPreferences(t.preferences)}add(t,e,i,s,n){this.resolver.add(t,e,i,s,n)}async load(t,e){this._initialized||await this.init();const i=Bn(t),s=Se(t).map(a=>{if(typeof a!="string"){const l=this.resolver.getAlias(a);return l.some(h=>!this.resolver.hasKey(h))&&this.add(a),Array.isArray(l)?l[0]:l}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),n=this.resolver.resolve(s),o=await this._mapLoadToResolve(n,e);return i?o[s[0]]:o}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let i=!1;typeof t=="string"&&(i=!0,t=[t]);const s=this.resolver.resolveBundle(t),n={},o=Object.keys(s);let a=0,l=0;const h=()=>{e==null||e(++a/l)},c=o.map(u=>{const d=s[u];return l+=Object.keys(d).length,this._mapLoadToResolve(d,h).then(f=>{n[u]=f})});return await Promise.all(c),i?n[t[0]]:n}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolveBundle(t);Object.values(e).forEach(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return qr.get(t);const e={};for(let i=0;i<t.length;i++)e[i]=qr.get(t[i]);return e}async _mapLoadToResolve(t,e){const i=Object.values(t),s=Object.keys(t);this._backgroundLoader.active=!1;const n=await this.loader.load(i,e);this._backgroundLoader.active=!0;const o={};return i.forEach((a,l)=>{const h=n[a.src],c=[a.src];a.alias&&c.push(...a.alias),o[s[l]]=h,qr.set(c,h)}),o}async unload(t){this._initialized||await this.init();const e=Se(t).map(s=>typeof s!="string"?s.src:s),i=this.resolver.resolve(e);await this._unloadFromResolved(i)}async unloadBundle(t){this._initialized||await this.init(),t=Se(t);const e=this.resolver.resolveBundle(t),i=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(i)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach(i=>{qr.remove(i.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(const i of t.detections)t.skipDetections||await i.test()?e=await i.add(e):t.skipDetections||(e=await i.remove(e));return e=e.filter((i,s)=>e.indexOf(i)===s),e}get detections(){return this._detections}get preferWorkers(){return Dn.config.preferWorkers}set preferWorkers(t){lt("7.2.0","Assets.prefersWorkers is deprecated, use Assets.setPreferences({ preferWorkers: true }) instead."),this.setPreferences({preferWorkers:t})}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(i=>i in t).forEach(i=>{e.config[i]=t[i]})})}}const On=new Yx;j.handleByList(V.LoadParser,On.loader.parsers).handleByList(V.ResolveParser,On.resolver.parsers).handleByList(V.CacheParser,On.cache.parsers).handleByList(V.DetectionParser,On.detections);const qx={extension:V.CacheParser,test:r=>Array.isArray(r)&&r.every(t=>t instanceof Y),getCacheableAssets:(r,t)=>{const e={};return r.forEach(i=>{t.forEach((s,n)=>{e[i+(n===0?"":n+1)]=s})}),e}};j.add(qx);async function kd(r){if("Image"in globalThis)return new Promise(t=>{const e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=r});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const t=await(await fetch(r)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}const Kx={extension:{type:V.DetectionParser,priority:1},test:async()=>kd("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(t=>t!=="avif")};j.add(Kx);const Zx={extension:{type:V.DetectionParser,priority:0},test:async()=>kd("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(t=>t!=="webp")};j.add(Zx);const Gd=["png","jpg","jpeg"],Jx={extension:{type:V.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...Gd],remove:async r=>r.filter(t=>!Gd.includes(t))};j.add(Jx);const Qx="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function hl(r){return Qx?!1:document.createElement("video").canPlayType(r)!==""}const tb={extension:{type:V.DetectionParser,priority:0},test:async()=>hl("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(t=>t!=="webm")};j.add(tb);const eb={extension:{type:V.DetectionParser,priority:0},test:async()=>hl("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(t=>t!=="mp4"&&t!=="m4v")};j.add(eb);const rb={extension:{type:V.DetectionParser,priority:0},test:async()=>hl("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(t=>t!=="ogv")};j.add(rb);const ib={extension:V.ResolveParser,test:Dn.test,parse:r=>{var t;return{resolution:parseFloat(((t=W.RETINA_PREFIX.exec(r))==null?void 0:t[1])??"1"),format:Gt.extname(r).slice(1),src:r}}};j.add(ib);var jt=(r=>(r[r.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",r[r.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",r[r.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",r[r.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",r[r.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",r[r.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",r[r.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",r[r.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",r[r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",r[r.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",r[r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",r[r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",r[r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",r[r.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",r[r.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",r[r.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35987]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",r[r.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",r[r.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",r[r.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",r[r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",r[r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",r[r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",r))(jt||{});const Fn={33776:.5,33777:.5,33778:1,33779:1,35916:.5,35917:.5,35918:1,35919:1,37488:.5,37489:.5,37490:1,37491:1,37492:.5,37496:1,37493:.5,37497:1,37494:.5,37495:.5,35840:.5,35842:.5,35841:.25,35843:.25,36196:.5,35986:.5,35987:1,34798:1,37808:1,36492:1,36493:1,36494:1,36495:1};let Ve,Oi;function $d(){Oi={bptc:Ve.getExtension("EXT_texture_compression_bptc"),astc:Ve.getExtension("WEBGL_compressed_texture_astc"),etc:Ve.getExtension("WEBGL_compressed_texture_etc"),s3tc:Ve.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:Ve.getExtension("WEBGL_compressed_texture_s3tc_srgb"),pvrtc:Ve.getExtension("WEBGL_compressed_texture_pvrtc")||Ve.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),etc1:Ve.getExtension("WEBGL_compressed_texture_etc1"),atc:Ve.getExtension("WEBGL_compressed_texture_atc")}}const sb={extension:{type:V.DetectionParser,priority:2},test:async()=>{const r=W.ADAPTER.createCanvas().getContext("webgl");return r?(Ve=r,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async r=>{Oi||$d();const t=[];for(const e in Oi)Oi[e]&&t.push(e);return[...t,...r]},remove:async r=>(Oi||$d(),r.filter(t=>!(t in Oi)))};j.add(sb);class nb extends hn{constructor(t,e={width:1,height:1,autoLoad:!0}){let i,s;typeof t=="string"?(i=t,s=new Uint8Array):(i=null,s=t),super(s,e),this.origin=i,this.buffer=s?new Ia(s):null,this._load=null,this.loaded=!1,this.origin!==null&&e.autoLoad!==!1&&this.load(),this.origin===null&&this.buffer&&(this._load=Promise.resolve(this),this.loaded=!0,this.onBlobLoaded(this.buffer.rawBinaryData))}onBlobLoaded(t){}load(){return this._load?this._load:(this._load=fetch(this.origin).then(t=>t.blob()).then(t=>t.arrayBuffer()).then(t=>(this.data=new Uint32Array(t),this.buffer=new Ia(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this)),this._load)}}class Kr extends nb{constructor(t,e){super(t,e),this.format=e.format,this.levels=e.levels||1,this._width=e.width,this._height=e.height,this._extension=Kr._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||Kr._createLevelBuffers(t instanceof Uint8Array?t:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(t,e,i){const s=t.gl;if(!t.context.extensions[this._extension])throw new Error(`${this._extension} textures are not supported on the current machine`);if(!this._levelBuffers)return!1;s.pixelStorei(s.UNPACK_ALIGNMENT,4);for(let n=0,o=this.levels;n<o;n++){const{levelID:a,levelWidth:l,levelHeight:h,levelBuffer:c}=this._levelBuffers[n];s.compressedTexImage2D(s.TEXTURE_2D,a,this.format,l,h,0,c)}return!0}onBlobLoaded(){this._levelBuffers=Kr._createLevelBuffers(this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height)}static _formatToExtension(t){if(t>=33776&&t<=33779)return"s3tc";if(t>=35916&&t<=35919)return"s3tc_sRGB";if(t>=37488&&t<=37497)return"etc";if(t>=35840&&t<=35843)return"pvrtc";if(t===36196)return"etc1";if(t===35986||t===35987||t===34798)return"atc";if(t>=36492&&t<=36495)return"bptc";if(t===37808)return"astc";throw new Error(`Invalid (compressed) texture format given: ${t}`)}static _createLevelBuffers(t,e,i,s,n,o,a){const l=new Array(i);let h=t.byteOffset,c=o,u=a,d=c+s-1&~(s-1),f=u+n-1&~(n-1),p=d*f*Fn[e];for(let m=0;m<i;m++)l[m]={levelID:m,levelWidth:i>1?c:d,levelHeight:i>1?u:f,levelBuffer:new Uint8Array(t.buffer,h,p)},h+=p,c=c>>1||1,u=u>>1||1,d=c+s-1&~(s-1),f=u+n-1&~(n-1),p=d*f*Fn[e];return l}}const cl=4,Ln=124,ob=32,Hd=20,ab=542327876,Nn={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},lb={SIZE:0,FLAGS:1,FOURCC:2,RGB_BITCOUNT:3,R_BIT_MASK:4,G_BIT_MASK:5,B_BIT_MASK:6,A_BIT_MASK:7},Un={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},hb=1,cb=2,ub=4,db=64,fb=512,pb=131072,mb=827611204,gb=861165636,yb=894720068,_b=808540228,vb=4,xb={[mb]:jt.COMPRESSED_RGBA_S3TC_DXT1_EXT,[gb]:jt.COMPRESSED_RGBA_S3TC_DXT3_EXT,[yb]:jt.COMPRESSED_RGBA_S3TC_DXT5_EXT},bb={70:jt.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:jt.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:jt.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:jt.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:jt.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:jt.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:jt.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:jt.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:jt.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,96:jt.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,95:jt.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,98:jt.COMPRESSED_RGBA_BPTC_UNORM_EXT,99:jt.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT};function wb(r){const t=new Uint32Array(r);if(t[0]!==ab)throw new Error("Invalid DDS file magic word");const e=new Uint32Array(r,0,Ln/Uint32Array.BYTES_PER_ELEMENT),i=e[Nn.HEIGHT],s=e[Nn.WIDTH],n=e[Nn.MIPMAP_COUNT],o=new Uint32Array(r,Nn.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,ob/Uint32Array.BYTES_PER_ELEMENT),a=o[hb];if(a&ub){const l=o[lb.FOURCC];if(l!==_b){const x=xb[l],g=cl+Ln,v=new Uint8Array(r,g);return[new Kr(v,{format:x,width:s,height:i,levels:n})]}const h=cl+Ln,c=new Uint32Array(t.buffer,h,Hd/Uint32Array.BYTES_PER_ELEMENT),u=c[Un.DXGI_FORMAT],d=c[Un.RESOURCE_DIMENSION],f=c[Un.MISC_FLAG],p=c[Un.ARRAY_SIZE],m=bb[u];if(m===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${u}`);if(f===vb)throw new Error("DDSParser does not support cubemap textures");if(d===6)throw new Error("DDSParser does not supported 3D texture data");const _=new Array,y=cl+Ln+Hd;if(p===1)_.push(new Uint8Array(r,y));else{const x=Fn[m];let g=0,v=s,w=i;for(let T=0;T<n;T++){const C=Math.max(1,v+3&-4),D=Math.max(1,w+3&-4),A=C*D*x;g+=A,v=v>>>1,w=w>>>1}let I=y;for(let T=0;T<p;T++)_.push(new Uint8Array(r,I,g)),I+=g}return _.map(x=>new Kr(x,{format:m,width:s,height:i,levels:n}))}throw a&db?new Error("DDSParser does not support uncompressed texture data."):a&fb?new Error("DDSParser does not supported YUV uncompressed texture data."):a&pb?new Error("DDSParser does not support single-channel (lumninance) texture data!"):a&cb?new Error("DDSParser does not support single-channel (alpha) texture data!"):new Error("DDSParser failed to load a texture file due to an unknown reason!")}const Xd=[171,75,84,88,32,49,49,187,13,10,26,10],Eb=67305985,Ie={FILE_IDENTIFIER:0,ENDIANNESS:12,GL_TYPE:16,GL_TYPE_SIZE:20,GL_FORMAT:24,GL_INTERNAL_FORMAT:28,GL_BASE_INTERNAL_FORMAT:32,PIXEL_WIDTH:36,PIXEL_HEIGHT:40,PIXEL_DEPTH:44,NUMBER_OF_ARRAY_ELEMENTS:48,NUMBER_OF_FACES:52,NUMBER_OF_MIPMAP_LEVELS:56,BYTES_OF_KEY_VALUE_DATA:60},ul=64,Vd={[Z.UNSIGNED_BYTE]:1,[Z.UNSIGNED_SHORT]:2,[Z.INT]:4,[Z.UNSIGNED_INT]:4,[Z.FLOAT]:4,[Z.HALF_FLOAT]:8},Tb={[G.RGBA]:4,[G.RGB]:3,[G.RG]:2,[G.RED]:1,[G.LUMINANCE]:1,[G.LUMINANCE_ALPHA]:2,[G.ALPHA]:1},Ab={[Z.UNSIGNED_SHORT_4_4_4_4]:2,[Z.UNSIGNED_SHORT_5_5_5_1]:2,[Z.UNSIGNED_SHORT_5_6_5]:2};function Sb(r,t,e=!1){const i=new DataView(t);if(!Cb(r,i))return null;const s=i.getUint32(Ie.ENDIANNESS,!0)===Eb,n=i.getUint32(Ie.GL_TYPE,s),o=i.getUint32(Ie.GL_FORMAT,s),a=i.getUint32(Ie.GL_INTERNAL_FORMAT,s),l=i.getUint32(Ie.PIXEL_WIDTH,s),h=i.getUint32(Ie.PIXEL_HEIGHT,s)||1,c=i.getUint32(Ie.PIXEL_DEPTH,s)||1,u=i.getUint32(Ie.NUMBER_OF_ARRAY_ELEMENTS,s)||1,d=i.getUint32(Ie.NUMBER_OF_FACES,s),f=i.getUint32(Ie.NUMBER_OF_MIPMAP_LEVELS,s),p=i.getUint32(Ie.BYTES_OF_KEY_VALUE_DATA,s);if(h===0||c!==1)throw new Error("Only 2D textures are supported");if(d!==1)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(u!==1)throw new Error("WebGL does not support array textures");const m=4,_=4,y=l+3&-4,x=h+3&-4,g=new Array(u);let v=l*h;n===0&&(v=y*x);let w;if(n!==0?Vd[n]?w=Vd[n]*Tb[o]:w=Ab[n]:w=Fn[a],w===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const I=e?Rb(i,p,s):null;let T=v*w,C=l,D=h,A=y,P=x,R=ul+p;for(let b=0;b<f;b++){const M=i.getUint32(R,s);let S=R+4;for(let U=0;U<u;U++){let L=g[U];L||(L=g[U]=new Array(f)),L[b]={levelID:b,levelWidth:f>1||n!==0?C:A,levelHeight:f>1||n!==0?D:P,levelBuffer:new Uint8Array(t,S,T)},S+=T}R+=M+4,R=R%4!==0?R+4-R%4:R,C=C>>1||1,D=D>>1||1,A=C+m-1&~(m-1),P=D+_-1&~(_-1),T=A*P*w}return n!==0?{uncompressed:g.map(b=>{let M=b[0].levelBuffer,S=!1;return n===Z.FLOAT?M=new Float32Array(b[0].levelBuffer.buffer,b[0].levelBuffer.byteOffset,b[0].levelBuffer.byteLength/4):n===Z.UNSIGNED_INT?(S=!0,M=new Uint32Array(b[0].levelBuffer.buffer,b[0].levelBuffer.byteOffset,b[0].levelBuffer.byteLength/4)):n===Z.INT&&(S=!0,M=new Int32Array(b[0].levelBuffer.buffer,b[0].levelBuffer.byteOffset,b[0].levelBuffer.byteLength/4)),{resource:new hn(M,{width:b[0].levelWidth,height:b[0].levelHeight}),type:n,format:S?Ib(o):o}}),kvData:I}:{compressed:g.map(b=>new Kr(null,{format:a,width:l,height:h,levels:f,levelBuffers:b})),kvData:I}}function Cb(r,t){for(let e=0;e<Xd.length;e++)if(t.getUint8(e)!==Xd[e])return console.error(`${r} is not a valid *.ktx file!`),!1;return!0}function Ib(r){switch(r){case G.RGBA:return G.RGBA_INTEGER;case G.RGB:return G.RGB_INTEGER;case G.RG:return G.RG_INTEGER;case G.RED:return G.RED_INTEGER;default:return r}}function Rb(r,t,e){const i=new Map;let s=0;for(;s<t;){const n=r.getUint32(ul+s,e),o=ul+s+4,a=3-(n+3)%4;if(n===0||n>t-s){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let l=0;for(;l<n&&r.getUint8(o+l)!==0;l++);if(l===-1){console.error("KTXLoader: Failed to find null byte terminating kvData key");break}const h=new TextDecoder().decode(new Uint8Array(r.buffer,o,l)),c=new DataView(r.buffer,o+l+1,n-l-1);i.set(h,c),s+=4+n+a}return i}const Pb={extension:{type:V.LoadParser,priority:Ce.High},name:"loadDDS",test(r){return wr(r,".dds")},async load(r,t,e){const i=await(await W.ADAPTER.fetch(r)).arrayBuffer(),s=wb(i).map(n=>{const o=new it(n,{mipmap:Oe.OFF,alphaMode:ie.NO_PREMULTIPLIED_ALPHA,resolution:or(r),...t.data});return ys(o,e,r)});return s.length===1?s[0]:s},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};j.add(Pb);const Mb={extension:{type:V.LoadParser,priority:Ce.High},name:"loadKTX",test(r){return wr(r,".ktx")},async load(r,t,e){const i=await(await W.ADAPTER.fetch(r)).arrayBuffer(),{compressed:s,uncompressed:n,kvData:o}=Sb(r,i),a=s??n,l={mipmap:Oe.OFF,alphaMode:ie.NO_PREMULTIPLIED_ALPHA,resolution:or(r),...t.data},h=a.map(c=>{a===n&&Object.assign(l,{type:c.type,format:c.format});const u=c.resource??c,d=new it(u,l);return d.ktxKeyValueData=o,ys(d,e,r)});return h.length===1?h[0]:h},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};j.add(Mb);const Bb=["s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"],Db={extension:V.ResolveParser,test:r=>{const t=Gt.extname(r).slice(1);return["basis","ktx","dds"].includes(t)},parse:r=>{var i,s;const t=r.split("."),e=t.pop();if(["ktx","dds"].includes(e)){const n=t.pop();if(Bb.includes(n))return{resolution:parseFloat(((i=W.RETINA_PREFIX.exec(r))==null?void 0:i[1])??"1"),format:n,src:r}}return{resolution:parseFloat(((s=W.RETINA_PREFIX.exec(r))==null?void 0:s[1])??"1"),format:e,src:r}}};j.add(Db);const kn=new nt,Ob=4,zd=class Es{constructor(t){this.renderer=t,this._rendererPremultipliedAlpha=!1}contextChange(){var e;const t=(e=this.renderer)==null?void 0:e.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}async image(t,e,i,s){const n=new Image;return n.src=await this.base64(t,e,i,s),n}async base64(t,e,i,s){const n=this.canvas(t,s);if(n.toBlob!==void 0)return new Promise((o,a)=>{n.toBlob(l=>{if(!l){a(new Error("ICanvas.toBlob failed!"));return}const h=new FileReader;h.onload=()=>o(h.result),h.onerror=a,h.readAsDataURL(l)},e,i)});if(n.toDataURL!==void 0)return n.toDataURL(e,i);if(n.convertToBlob!==void 0){const o=await n.convertToBlob({type:e,quality:i});return new Promise((a,l)=>{const h=new FileReader;h.onload=()=>a(h.result),h.onerror=l,h.readAsDataURL(o)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t,e){const{pixels:i,width:s,height:n,flipY:o,premultipliedAlpha:a}=this._rawPixels(t,e);o&&Es._flipY(i,s,n),a&&Es._unpremultiplyAlpha(i);const l=new pv(s,n,1),h=new ImageData(new Uint8ClampedArray(i.buffer),s,n);return l.context.putImageData(h,0,0),l.canvas}pixels(t,e){const{pixels:i,width:s,height:n,flipY:o,premultipliedAlpha:a}=this._rawPixels(t,e);return o&&Es._flipY(i,s,n),a&&Es._unpremultiplyAlpha(i),i}_rawPixels(t,e){const i=this.renderer;if(!i)throw new Error("The Extract has already been destroyed");let s,n=!1,o=!1,a,l=!1;t&&(t instanceof zr?a=t:(a=i.generateTexture(t,{region:e,resolution:i.resolution,multisample:i.multisample}),l=!0,e&&(kn.width=e.width,kn.height=e.height,e=kn)));const h=i.gl;if(a){if(s=a.baseTexture.resolution,e=e??a.frame,n=!1,o=a.baseTexture.alphaMode>0&&a.baseTexture.format===G.RGBA,!l){i.renderTexture.bind(a);const f=a.framebuffer.glFramebuffers[i.CONTEXT_UID];f.blitFramebuffer&&i.framebuffer.bind(f.blitFramebuffer)}}else s=i.resolution,e||(e=kn,e.width=i.width/s,e.height=i.height/s),n=!0,o=this._rendererPremultipliedAlpha,i.renderTexture.bind();const c=Math.max(Math.round(e.width*s),1),u=Math.max(Math.round(e.height*s),1),d=new Uint8Array(Ob*c*u);return h.readPixels(Math.round(e.x*s),Math.round(e.y*s),c,u,h.RGBA,h.UNSIGNED_BYTE,d),l&&(a==null||a.destroy(!0)),{pixels:d,width:c,height:u,flipY:n,premultipliedAlpha:o}}destroy(){this.renderer=null}static _flipY(t,e,i){const s=e<<2,n=i>>1,o=new Uint8Array(s);for(let a=0;a<n;a++){const l=a*s,h=(i-a-1)*s;o.set(t.subarray(l,l+s)),t.copyWithin(l,h,h+s),t.set(o,h)}}static _unpremultiplyAlpha(t){t instanceof Uint8ClampedArray&&(t=new Uint8Array(t.buffer));const e=t.length;for(let i=0;i<e;i+=4){const s=t[i+3];if(s!==0){const n=255.001/s;t[i]=t[i]*n+.5,t[i+1]=t[i+1]*n+.5,t[i+2]=t[i+2]*n+.5}}}};zd.extension={name:"extract",type:V.RendererSystem};let Fb=zd;j.add(Fb);const Gn={build(r){const t=r.points;let e,i,s,n,o,a;if(r.type===Wt.CIRC){const p=r.shape;e=p.x,i=p.y,o=a=p.radius,s=n=0}else if(r.type===Wt.ELIP){const p=r.shape;e=p.x,i=p.y,o=p.width,a=p.height,s=n=0}else{const p=r.shape,m=p.width/2,_=p.height/2;e=p.x+m,i=p.y+_,o=a=Math.max(0,Math.min(p.radius,Math.min(m,_))),s=m-o,n=_-a}if(!(o>=0&&a>=0&&s>=0&&n>=0)){t.length=0;return}const l=Math.ceil(2.3*Math.sqrt(o+a)),h=l*8+(s?4:0)+(n?4:0);if(t.length=h,h===0)return;if(l===0){t.length=8,t[0]=t[6]=e+s,t[1]=t[3]=i+n,t[2]=t[4]=e-s,t[5]=t[7]=i-n;return}let c=0,u=l*4+(s?2:0)+2,d=u,f=h;{const p=s+o,m=n,_=e+p,y=e-p,x=i+m;if(t[c++]=_,t[c++]=x,t[--u]=x,t[--u]=y,n){const g=i-m;t[d++]=y,t[d++]=g,t[--f]=g,t[--f]=_}}for(let p=1;p<l;p++){const m=Math.PI/2*(p/l),_=s+Math.cos(m)*o,y=n+Math.sin(m)*a,x=e+_,g=e-_,v=i+y,w=i-y;t[c++]=x,t[c++]=v,t[--u]=v,t[--u]=g,t[d++]=g,t[d++]=w,t[--f]=w,t[--f]=x}{const p=s,m=n+a,_=e+p,y=e-p,x=i+m,g=i-m;t[c++]=_,t[c++]=x,t[--f]=g,t[--f]=_,s&&(t[c++]=y,t[c++]=x,t[--f]=g,t[--f]=y)}},triangulate(r,t){const e=r.points,i=t.points,s=t.indices;if(e.length===0)return;let n=i.length/2;const o=n;let a,l;if(r.type!==Wt.RREC){const c=r.shape;a=c.x,l=c.y}else{const c=r.shape;a=c.x+c.width/2,l=c.y+c.height/2}const h=r.matrix;i.push(r.matrix?h.a*a+h.c*l+h.tx:a,r.matrix?h.b*a+h.d*l+h.ty:l),n++,i.push(e[0],e[1]);for(let c=2;c<e.length;c+=2)i.push(e[c],e[c+1]),s.push(n++,o,n);s.push(o+1,o,n)}};function Wd(r,t=!1){const e=r.length;if(e<6)return;let i=0;for(let s=0,n=r[e-2],o=r[e-1];s<e;s+=2){const a=r[s],l=r[s+1];i+=(a-n)*(l+o),n=a,o=l}if(!t&&i>0||t&&i<=0){const s=e/2;for(let n=s+s%2;n<e;n+=2){const o=e-n-2,a=e-n-1,l=n,h=n+1;[r[o],r[l]]=[r[l],r[o]],[r[a],r[h]]=[r[h],r[a]]}}}const jd={build(r){r.points=r.shape.points.slice()},triangulate(r,t){let e=r.points;const i=r.holes,s=t.points,n=t.indices;if(e.length>=6){Wd(e,!1);const o=[];for(let h=0;h<i.length;h++){const c=i[h];Wd(c.points,!0),o.push(e.length/2),e=e.concat(c.points)}const a=by(e,o,2);if(!a)return;const l=s.length/2;for(let h=0;h<a.length;h+=3)n.push(a[h]+l),n.push(a[h+1]+l),n.push(a[h+2]+l);for(let h=0;h<e.length;h++)s.push(e[h])}}},Lb={build(r){const t=r.shape,e=t.x,i=t.y,s=t.width,n=t.height,o=r.points;o.length=0,s>=0&&n>=0&&o.push(e,i,e+s,i,e+s,i+n,e,i+n)},triangulate(r,t){const e=r.points,i=t.points;if(e.length===0)return;const s=i.length/2;i.push(e[0],e[1],e[2],e[3],e[6],e[7],e[4],e[5]),t.indices.push(s,s+1,s+2,s+1,s+2,s+3)}},Nb={build(r){Gn.build(r)},triangulate(r,t){Gn.triangulate(r,t)}};var me=(r=>(r.MITER="miter",r.BEVEL="bevel",r.ROUND="round",r))(me||{}),Er=(r=>(r.BUTT="butt",r.ROUND="round",r.SQUARE="square",r))(Er||{});const Fi={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount(r,t=20){if(!this.adaptive||!r||isNaN(r))return t;let e=Math.ceil(r/this.maxLength);return e<this.minSegments?e=this.minSegments:e>this.maxSegments&&(e=this.maxSegments),e}};class Yd{static curveTo(t,e,i,s,n,o){const a=o[o.length-2],l=o[o.length-1]-e,h=a-t,c=s-e,u=i-t,d=Math.abs(l*u-h*c);if(d<1e-8||n===0)return(o[o.length-2]!==t||o[o.length-1]!==e)&&o.push(t,e),null;const f=l*l+h*h,p=c*c+u*u,m=l*c+h*u,_=n*Math.sqrt(f)/d,y=n*Math.sqrt(p)/d,x=_*m/f,g=y*m/p,v=_*u+y*h,w=_*c+y*l,I=h*(y+x),T=l*(y+x),C=u*(_+g),D=c*(_+g),A=Math.atan2(T-w,I-v),P=Math.atan2(D-w,C-v);return{cx:v+t,cy:w+e,radius:n,startAngle:A,endAngle:P,anticlockwise:h*c>u*l}}static arc(t,e,i,s,n,o,a,l,h){const c=a-o,u=Fi._segmentsCount(Math.abs(c)*n,Math.ceil(Math.abs(c)/un)*40),d=c/(u*2),f=d*2,p=Math.cos(d),m=Math.sin(d),_=u-1,y=_%1/_;for(let x=0;x<=_;++x){const g=x+y*x,v=d+o+f*g,w=Math.cos(v),I=-Math.sin(v);h.push((p*w+m*I)*n+i,(p*-I+m*w)*n+s)}}}class Ub{constructor(){this.reset()}begin(t,e,i){this.reset(),this.style=t,this.start=e,this.attribStart=i}end(t,e){this.attribSize=e-this.attribStart,this.size=t-this.start}reset(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0}}class dl{static curveLength(t,e,i,s,n,o,a,l){let h=0,c=0,u=0,d=0,f=0,p=0,m=0,_=0,y=0,x=0,g=0,v=t,w=e;for(let I=1;I<=10;++I)c=I/10,u=c*c,d=u*c,f=1-c,p=f*f,m=p*f,_=m*t+3*p*c*i+3*f*u*n+d*a,y=m*e+3*p*c*s+3*f*u*o+d*l,x=v-_,g=w-y,v=_,w=y,h+=Math.sqrt(x*x+g*g);return h}static curveTo(t,e,i,s,n,o,a){const l=a[a.length-2],h=a[a.length-1];a.length-=2;const c=Fi._segmentsCount(dl.curveLength(l,h,t,e,i,s,n,o));let u=0,d=0,f=0,p=0,m=0;a.push(l,h);for(let _=1,y=0;_<=c;++_)y=_/c,u=1-y,d=u*u,f=d*u,p=y*y,m=p*y,a.push(f*l+3*d*y*t+3*u*p*i+m*n,f*h+3*d*y*e+3*u*p*s+m*o)}}function qd(r,t,e,i,s,n,o,a){const l=r-e*s,h=t-i*s,c=r+e*n,u=t+i*n;let d,f;o?(d=i,f=-e):(d=-i,f=e);const p=l+d,m=h+f,_=c+d,y=u+f;return a.push(p,m,_,y),2}function Zr(r,t,e,i,s,n,o,a){const l=e-r,h=i-t;let c=Math.atan2(l,h),u=Math.atan2(s-r,n-t);a&&c<u?c+=Math.PI*2:!a&&c>u&&(u+=Math.PI*2);let d=c;const f=u-c,p=Math.abs(f),m=Math.sqrt(l*l+h*h),_=(15*p*Math.sqrt(m)/Math.PI>>0)+1,y=f/_;if(d+=y,a){o.push(r,t,e,i);for(let x=1,g=d;x<_;x++,g+=y)o.push(r,t,r+Math.sin(g)*m,t+Math.cos(g)*m);o.push(r,t,s,n)}else{o.push(e,i,r,t);for(let x=1,g=d;x<_;x++,g+=y)o.push(r+Math.sin(g)*m,t+Math.cos(g)*m,r,t);o.push(s,n,r,t)}return _*2}function kb(r,t){const e=r.shape;let i=r.points||e.points.slice();const s=t.closePointEps;if(i.length===0)return;const n=r.lineStyle,o=new pt(i[0],i[1]),a=new pt(i[i.length-2],i[i.length-1]),l=e.type!==Wt.POLY||e.closeStroke,h=Math.abs(o.x-a.x)<s&&Math.abs(o.y-a.y)<s;if(l){i=i.slice(),h&&(i.pop(),i.pop(),a.set(i[i.length-2],i[i.length-1]));const L=(o.x+a.x)*.5,H=(a.y+o.y)*.5;i.unshift(L,H),i.push(L,H)}const c=t.points,u=i.length/2;let d=i.length;const f=c.length/2,p=n.width/2,m=p*p,_=n.miterLimit*n.miterLimit;let y=i[0],x=i[1],g=i[2],v=i[3],w=0,I=0,T=-(x-v),C=y-g,D=0,A=0,P=Math.sqrt(T*T+C*C);T/=P,C/=P,T*=p,C*=p;const R=n.alignment,b=(1-R)*2,M=R*2;l||(n.cap===Er.ROUND?d+=Zr(y-T*(b-M)*.5,x-C*(b-M)*.5,y-T*b,x-C*b,y+T*M,x+C*M,c,!0)+2:n.cap===Er.SQUARE&&(d+=qd(y,x,T,C,b,M,!0,c))),c.push(y-T*b,x-C*b,y+T*M,x+C*M);for(let L=1;L<u-1;++L){y=i[(L-1)*2],x=i[(L-1)*2+1],g=i[L*2],v=i[L*2+1],w=i[(L+1)*2],I=i[(L+1)*2+1],T=-(x-v),C=y-g,P=Math.sqrt(T*T+C*C),T/=P,C/=P,T*=p,C*=p,D=-(v-I),A=g-w,P=Math.sqrt(D*D+A*A),D/=P,A/=P,D*=p,A*=p;const H=g-y,tt=x-v,F=g-w,k=I-v,J=H*F+tt*k,X=tt*F-k*H,K=X<0;if(Math.abs(X)<.001*Math.abs(J)){c.push(g-T*b,v-C*b,g+T*M,v+C*M),J>=0&&(n.join===me.ROUND?d+=Zr(g,v,g-T*b,v-C*b,g-D*b,v-A*b,c,!1)+4:d+=2,c.push(g-D*M,v-A*M,g+D*b,v+A*b));continue}const $=(-T+y)*(-C+v)-(-T+g)*(-C+x),at=(-D+w)*(-A+v)-(-D+g)*(-A+I),vt=(H*at-F*$)/X,N=(k*$-tt*at)/X,O=(vt-g)*(vt-g)+(N-v)*(N-v),bt=g+(vt-g)*b,mt=v+(N-v)*b,yt=g-(vt-g)*M,_t=v-(N-v)*M,We=Math.min(H*H+tt*tt,F*F+k*k),je=K?b:M,xs=We+je*je*m,kE=O<=xs;let Qn=n.join;if(Qn===me.MITER&&O/m>_&&(Qn=me.BEVEL),kE)switch(Qn){case me.MITER:{c.push(bt,mt,yt,_t);break}case me.BEVEL:{K?c.push(bt,mt,g+T*M,v+C*M,bt,mt,g+D*M,v+A*M):c.push(g-T*b,v-C*b,yt,_t,g-D*b,v-A*b,yt,_t),d+=2;break}case me.ROUND:{K?(c.push(bt,mt,g+T*M,v+C*M),d+=Zr(g,v,g+T*M,v+C*M,g+D*M,v+A*M,c,!0)+4,c.push(bt,mt,g+D*M,v+A*M)):(c.push(g-T*b,v-C*b,yt,_t),d+=Zr(g,v,g-T*b,v-C*b,g-D*b,v-A*b,c,!1)+4,c.push(g-D*b,v-A*b,yt,_t));break}}else{switch(c.push(g-T*b,v-C*b,g+T*M,v+C*M),Qn){case me.MITER:{K?c.push(yt,_t,yt,_t):c.push(bt,mt,bt,mt),d+=2;break}case me.ROUND:{K?d+=Zr(g,v,g+T*M,v+C*M,g+D*M,v+A*M,c,!0)+2:d+=Zr(g,v,g-T*b,v-C*b,g-D*b,v-A*b,c,!1)+2;break}}c.push(g-D*b,v-A*b,g+D*M,v+A*M),d+=2}}y=i[(u-2)*2],x=i[(u-2)*2+1],g=i[(u-1)*2],v=i[(u-1)*2+1],T=-(x-v),C=y-g,P=Math.sqrt(T*T+C*C),T/=P,C/=P,T*=p,C*=p,c.push(g-T*b,v-C*b,g+T*M,v+C*M),l||(n.cap===Er.ROUND?d+=Zr(g-T*(b-M)*.5,v-C*(b-M)*.5,g-T*b,v-C*b,g+T*M,v+C*M,c,!1)+2:n.cap===Er.SQUARE&&(d+=qd(g,v,T,C,b,M,!1,c)));const S=t.indices,U=Fi.epsilon*Fi.epsilon;for(let L=f;L<d+f-2;++L)y=c[L*2],x=c[L*2+1],g=c[(L+1)*2],v=c[(L+1)*2+1],w=c[(L+2)*2],I=c[(L+2)*2+1],!(Math.abs(y*(v-I)+g*(I-x)+w*(x-v))<U)&&S.push(L,L+1,L+2)}function Gb(r,t){let e=0;const i=r.shape,s=r.points||i.points,n=i.type!==Wt.POLY||i.closeStroke;if(s.length===0)return;const o=t.points,a=t.indices,l=s.length/2,h=o.length/2;let c=h;for(o.push(s[0],s[1]),e=1;e<l;e++)o.push(s[e*2],s[e*2+1]),a.push(c,c+1),c++;n&&a.push(c,h)}function Kd(r,t){r.lineStyle.native?Gb(r,t):kb(r,t)}class fl{static curveLength(t,e,i,s,n,o){const a=t-2*i+n,l=e-2*s+o,h=2*i-2*t,c=2*s-2*e,u=4*(a*a+l*l),d=4*(a*h+l*c),f=h*h+c*c,p=2*Math.sqrt(u+d+f),m=Math.sqrt(u),_=2*u*m,y=2*Math.sqrt(f),x=d/m;return(_*p+m*d*(p-y)+(4*f*u-d*d)*Math.log((2*m+x+p)/(x+y)))/(4*_)}static curveTo(t,e,i,s,n){const o=n[n.length-2],a=n[n.length-1],l=Fi._segmentsCount(fl.curveLength(o,a,t,e,i,s));let h=0,c=0;for(let u=1;u<=l;++u){const d=u/l;h=o+(t-o)*d,c=a+(e-a)*d,n.push(h+(t+(i-t)*d-h)*d,c+(e+(s-e)*d-c)*d)}}}const pl={[Wt.POLY]:jd,[Wt.CIRC]:Gn,[Wt.ELIP]:Gn,[Wt.RECT]:Lb,[Wt.RREC]:Nb},Zd=[],$n=[];class Hn{constructor(t,e=null,i=null,s=null){this.points=[],this.holes=[],this.shape=t,this.lineStyle=i,this.fillStyle=e,this.matrix=s,this.type=t.type}clone(){return new Hn(this.shape,this.fillStyle,this.lineStyle,this.matrix)}destroy(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null}}const Li=new pt,Jd=class Xf extends Pu{constructor(){super(),this.closePointEps=1e-4,this.boundsPadding=0,this.uvsFloat32=null,this.indicesUint16=null,this.batchable=!1,this.points=[],this.colors=[],this.uvs=[],this.indices=[],this.textureIds=[],this.graphicsData=[],this.drawCalls=[],this.batchDirty=-1,this.batches=[],this.dirty=0,this.cacheDirty=-1,this.clearDirty=0,this.shapeIndex=0,this._bounds=new Rn,this.boundsDirty=-1}get bounds(){return this.updateBatches(),this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds}invalidate(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(let t=0;t<this.drawCalls.length;t++)this.drawCalls[t].texArray.clear(),$n.push(this.drawCalls[t]);this.drawCalls.length=0;for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e.reset(),Zd.push(e)}this.batches.length=0}clear(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this}drawShape(t,e=null,i=null,s=null){const n=new Hn(t,e,i,s);return this.graphicsData.push(n),this.dirty++,this}drawHole(t,e=null){if(!this.graphicsData.length)return null;const i=new Hn(t,null,null,e),s=this.graphicsData[this.graphicsData.length-1];return i.lineStyle=s.lineStyle,s.holes.push(i),this.dirty++,this}destroy(){super.destroy();for(let t=0;t<this.graphicsData.length;++t)this.graphicsData[t].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null}containsPoint(t){const e=this.graphicsData;for(let i=0;i<e.length;++i){const s=e[i];if(s.fillStyle.visible&&s.shape&&(s.matrix?s.matrix.applyInverse(t,Li):Li.copyFrom(t),s.shape.contains(Li.x,Li.y))){let n=!1;if(s.holes){for(let o=0;o<s.holes.length;o++)if(s.holes[o].shape.contains(Li.x,Li.y)){n=!0;break}}if(!n)return!0}}return!1}updateBatches(){if(!this.graphicsData.length){this.batchable=!0;return}if(!this.validateBatching())return;this.cacheDirty=this.dirty;const t=this.uvs,e=this.graphicsData;let i=null,s=null;this.batches.length>0&&(i=this.batches[this.batches.length-1],s=i.style);for(let l=this.shapeIndex;l<e.length;l++){this.shapeIndex++;const h=e[l],c=h.fillStyle,u=h.lineStyle;pl[h.type].build(h),h.matrix&&this.transformPoints(h.points,h.matrix),(c.visible||u.visible)&&this.processHoles(h.holes);for(let d=0;d<2;d++){const f=d===0?c:u;if(!f.visible)continue;const p=f.texture.baseTexture,m=this.indices.length,_=this.points.length/2;p.wrapMode=pr.REPEAT,d===0?this.processFill(h):this.processLine(h);const y=this.points.length/2-_;y!==0&&(i&&!this._compareStyles(s,f)&&(i.end(m,_),i=null),i||(i=Zd.pop()||new Ub,i.begin(f,m,_),this.batches.push(i),s=f),this.addUvs(this.points,t,f.texture,_,y,f.matrix))}}const n=this.indices.length,o=this.points.length/2;if(i&&i.end(n,o),this.batches.length===0){this.batchable=!0;return}const a=o>65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&a===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=a?new Uint32Array(this.indices):new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}_compareStyles(t,e){return!(!t||!e||t.texture.baseTexture!==e.texture.baseTexture||t.color+t.alpha!==e.color+e.alpha||!!t.native!=!!e.native)}validateBatching(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(let t=0,e=this.graphicsData.length;t<e;t++){const i=this.graphicsData[t],s=i.fillStyle,n=i.lineStyle;if(s&&!s.texture.baseTexture.valid||n&&!n.texture.baseTexture.valid)return!1}return!0}packBatches(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);const t=this.batches;for(let e=0,i=t.length;e<i;e++){const s=t[e];for(let n=0;n<s.size;n++){const o=s.start+n;this.indicesUint16[o]=this.indicesUint16[o]-s.attribStart}}}isBatchable(){if(this.points.length>65535*2)return!1;const t=this.batches;for(let e=0;e<t.length;e++)if(t[e].style.native)return!1;return this.points.length<Xf.BATCHABLE_SIZE*2}buildDrawCalls(){let t=++it._globalBatch;for(let u=0;u<this.drawCalls.length;u++)this.drawCalls[u].texArray.clear(),$n.push(this.drawCalls[u]);this.drawCalls.length=0;const e=this.colors,i=this.textureIds;let s=$n.pop();s||(s=new Na,s.texArray=new Xa),s.texArray.count=0,s.start=0,s.size=0,s.type=De.TRIANGLES;let n=0,o=null,a=0,l=!1,h=De.TRIANGLES,c=0;this.drawCalls.push(s);for(let u=0;u<this.batches.length;u++){const d=this.batches[u],f=8,p=d.style,m=p.texture.baseTexture;l!==!!p.native&&(l=!!p.native,h=l?De.LINES:De.TRIANGLES,o=null,n=f,t++),o!==m&&(o=m,m._batchEnabled!==t&&(n===f&&(t++,n=0,s.size>0&&(s=$n.pop(),s||(s=new Na,s.texArray=new Xa),this.drawCalls.push(s)),s.start=c,s.size=0,s.texArray.count=0,s.type=h),m.touched=1,m._batchEnabled=t,m._batchLocation=n,m.wrapMode=pr.REPEAT,s.texArray.elements[s.texArray.count++]=m,n++)),s.size+=d.size,c+=d.size,a=m._batchLocation,this.addColors(e,p.color,p.alpha,d.attribSize,d.attribStart),this.addTextureIds(i,a,d.attribSize,d.attribStart)}it._globalBatch=t,this.packAttributes()}packAttributes(){const t=this.points,e=this.uvs,i=this.colors,s=this.textureIds,n=new ArrayBuffer(t.length*3*4),o=new Float32Array(n),a=new Uint32Array(n);let l=0;for(let h=0;h<t.length/2;h++)o[l++]=t[h*2],o[l++]=t[h*2+1],o[l++]=e[h*2],o[l++]=e[h*2+1],a[l++]=i[h],o[l++]=s[h];this._buffer.update(n),this._indexBuffer.update(this.indicesUint16)}processFill(t){t.holes.length?jd.triangulate(t,this):pl[t.type].triangulate(t,this)}processLine(t){Kd(t,this);for(let e=0;e<t.holes.length;e++)Kd(t.holes[e],this)}processHoles(t){for(let e=0;e<t.length;e++){const i=t[e];pl[i.type].build(i),i.matrix&&this.transformPoints(i.points,i.matrix)}}calculateBounds(){const t=this._bounds;t.clear(),t.addVertexData(this.points,0,this.points.length),t.pad(this.boundsPadding,this.boundsPadding)}transformPoints(t,e){for(let i=0;i<t.length/2;i++){const s=t[i*2],n=t[i*2+1];t[i*2]=e.a*s+e.c*n+e.tx,t[i*2+1]=e.b*s+e.d*n+e.ty}}addColors(t,e,i,s,n=0){const o=xt.shared.setValue(e).toLittleEndianNumber(),a=xt.shared.setValue(o).toPremultiplied(i);t.length=Math.max(t.length,n+s);for(let l=0;l<s;l++)t[n+l]=a}addTextureIds(t,e,i,s=0){t.length=Math.max(t.length,s+i);for(let n=0;n<i;n++)t[s+n]=e}addUvs(t,e,i,s,n,o=null){let a=0;const l=e.length,h=i.frame;for(;a<n;){let u=t[(s+a)*2],d=t[(s+a)*2+1];if(o){const f=o.a*u+o.c*d+o.tx;d=o.b*u+o.d*d+o.ty,u=f}a++,e.push(u/h.width,d/h.height)}const c=i.baseTexture;(h.width<c.width||h.height<c.height)&&this.adjustUvs(e,i,l,n)}adjustUvs(t,e,i,s){const n=e.baseTexture,o=1e-6,a=i+s*2,l=e.frame,h=l.width/n.width,c=l.height/n.height;let u=l.x/l.width,d=l.y/l.height,f=Math.floor(t[i]+o),p=Math.floor(t[i+1]+o);for(let m=i+2;m<a;m+=2)f=Math.min(f,Math.floor(t[m]+o)),p=Math.min(p,Math.floor(t[m+1]+o));u-=f,d-=p;for(let m=i;m<a;m+=2)t[m]=(t[m]+u)*h,t[m+1]=(t[m+1]+d)*c}};Jd.BATCHABLE_SIZE=100;let $b=Jd;class Xn{constructor(){this.color=16777215,this.alpha=1,this.texture=Y.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){const t=new Xn;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t}reset(){this.color=16777215,this.alpha=1,this.texture=Y.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}class ml extends Xn{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=Er.BUTT,this.join=me.MITER,this.miterLimit=10}clone(){const t=new ml;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t.width=this.width,t.alignment=this.alignment,t.native=this.native,t.cap=this.cap,t.join=this.join,t.miterLimit=this.miterLimit,t}reset(){super.reset(),this.color=0,this.alignment=.5,this.width=0,this.native=!1,this.cap=Er.BUTT,this.join=me.MITER,this.miterLimit=10}}const gl={},yl=class so extends Te{constructor(t=null){super(),this.shader=null,this.pluginName="batch",this.currentPath=null,this.batches=[],this.batchTint=-1,this.batchDirty=-1,this.vertexData=null,this._fillStyle=new Xn,this._lineStyle=new ml,this._matrix=null,this._holeMode=!1,this.state=He.for2d(),this._geometry=t||new $b,this._geometry.refCount++,this._transformID=-1,this._tintColor=new xt(16777215),this.blendMode=Q.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new so(this._geometry)}set blendMode(t){this.state.blendMode=t}get blendMode(){return this.state.blendMode}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t)}get fill(){return this._fillStyle}get line(){return this._lineStyle}lineStyle(t=null,e=0,i,s=.5,n=!1){return typeof t=="number"&&(t={width:t,color:e,alpha:i,alignment:s,native:n}),this.lineTextureStyle(t)}lineTextureStyle(t){const e={width:0,texture:Y.WHITE,color:t!=null&&t.texture?16777215:0,matrix:null,alignment:.5,native:!1,cap:Er.BUTT,join:me.MITER,miterLimit:10};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();const i=t.width>0&&t.alpha>0;return i?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._lineStyle,{visible:i},t)):this._lineStyle.reset(),this}startPoly(){if(this.currentPath){const t=this.currentPath.points,e=this.currentPath.points.length;e>2&&(this.drawShape(this.currentPath),this.currentPath=new kr,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new kr,this.currentPath.closeStroke=!1}finishPoly(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)}moveTo(t,e){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this}lineTo(t,e){this.currentPath||this.moveTo(0,0);const i=this.currentPath.points,s=i[i.length-2],n=i[i.length-1];return(s!==t||n!==e)&&i.push(t,e),this}_initCurve(t=0,e=0){this.currentPath?this.currentPath.points.length===0&&(this.currentPath.points=[t,e]):this.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this._initCurve();const n=this.currentPath.points;return n.length===0&&this.moveTo(0,0),fl.curveTo(t,e,i,s,n),this}bezierCurveTo(t,e,i,s,n,o){return this._initCurve(),dl.curveTo(t,e,i,s,n,o,this.currentPath.points),this}arcTo(t,e,i,s,n){this._initCurve(t,e);const o=this.currentPath.points,a=Yd.curveTo(t,e,i,s,n,o);if(a){const{cx:l,cy:h,radius:c,startAngle:u,endAngle:d,anticlockwise:f}=a;this.arc(l,h,c,u,d,f)}return this}arc(t,e,i,s,n,o=!1){if(s===n)return this;if(!o&&n<=s?n+=un:o&&s<=n&&(s+=un),n-s===0)return this;const a=t+Math.cos(s)*i,l=e+Math.sin(s)*i,h=this._geometry.closePointEps;let c=this.currentPath?this.currentPath.points:null;if(c){const u=Math.abs(c[c.length-2]-a),d=Math.abs(c[c.length-1]-l);u<h&&d<h||c.push(a,l)}else this.moveTo(a,l),c=this.currentPath.points;return Yd.arc(a,l,t,e,i,s,n,o,c),this}beginFill(t=0,e){return this.beginTextureFill({texture:Y.WHITE,color:t,alpha:e})}normalizeColor(t){const e=xt.shared.setValue(t.color??0);t.color=e.toNumber(),t.alpha??(t.alpha=e.alpha)}beginTextureFill(t){const e={texture:Y.WHITE,color:16777215,matrix:null};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();const i=t.alpha>0;return i?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:i},t)):this._fillStyle.reset(),this}endFill(){return this.finishPoly(),this._fillStyle.reset(),this}drawRect(t,e,i,s){return this.drawShape(new nt(t,e,i,s))}drawRoundedRect(t,e,i,s,n){return this.drawShape(new mn(t,e,i,s,n))}drawCircle(t,e,i){return this.drawShape(new fn(t,e,i))}drawEllipse(t,e,i,s){return this.drawShape(new pn(t,e,i,s))}drawPolygon(...t){let e,i=!0;const s=t[0];s.points?(i=s.closeStroke,e=s.points):Array.isArray(t[0])?e=t[0]:e=t;const n=new kr(e);return n.closeStroke=i,this.drawShape(n),this}drawShape(t){return this._holeMode?this._geometry.drawHole(t,this._matrix):this._geometry.drawShape(t,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this}clear(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this}isFastRect(){const t=this._geometry.graphicsData;return t.length===1&&t[0].shape.type===Wt.RECT&&!t[0].matrix&&!t[0].holes.length&&!(t[0].lineStyle.visible&&t[0].lineStyle.width)}_render(t){this.finishPoly();const e=this._geometry;e.updateBatches(),e.batchable?(this.batchDirty!==e.batchDirty&&this._populateBatches(),this._renderBatched(t)):(t.batch.flush(),this._renderDirect(t))}_populateBatches(){const t=this._geometry,e=this.blendMode,i=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=i,this.vertexData=new Float32Array(t.points);for(let s=0;s<i;s++){const n=t.batches[s],o=n.style.color,a=new Float32Array(this.vertexData.buffer,n.attribStart*4*2,n.attribSize*2),l=new Float32Array(t.uvsFloat32.buffer,n.attribStart*4*2,n.attribSize*2),h=new Uint16Array(t.indicesUint16.buffer,n.start*2,n.size),c={vertexData:a,blendMode:e,indices:h,uvs:l,_batchRGB:xt.shared.setValue(o).toRgbArray(),_tintRGB:o,_texture:n.style.texture,alpha:n.style.alpha,worldAlpha:1};this.batches[s]=c}}_renderBatched(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(let e=0,i=this.batches.length;e<i;e++){const s=this.batches[e];s.worldAlpha=this.worldAlpha*s.alpha,t.plugins[this.pluginName].render(s)}}}_renderDirect(t){const e=this._resolveDirectShader(t),i=this._geometry,s=this.worldAlpha,n=e.uniforms,o=i.drawCalls;n.translationMatrix=this.transform.worldTransform,xt.shared.setValue(this._tintColor).premultiply(s).toArray(n.tint),t.shader.bind(e),t.geometry.bind(i,e),t.state.set(this.state);for(let a=0,l=o.length;a<l;a++)this._renderDrawCallDirect(t,i.drawCalls[a])}_renderDrawCallDirect(t,e){const{texArray:i,type:s,size:n,start:o}=e,a=i.count;for(let l=0;l<a;l++)t.texture.bind(i.elements[l],l);t.geometry.draw(s,n,o)}_resolveDirectShader(t){let e=this.shader;const i=this.pluginName;if(!e){if(!gl[i]){const{maxTextures:s}=t.plugins[i],n=new Int32Array(s);for(let l=0;l<s;l++)n[l]=l;const o={tint:new Float32Array([1,1,1,1]),translationMatrix:new Et,default:Ee.from({uSamplers:n},!0)},a=t.plugins[i]._shader.program;gl[i]=new Xe(a,o)}e=gl[i]}return e}_calculateBounds(){this.finishPoly();const t=this._geometry;if(!t.graphicsData.length)return;const{minX:e,minY:i,maxX:s,maxY:n}=t.bounds;this._bounds.addFrame(this.transform,e,i,s,n)}containsPoint(t){return this.worldTransform.applyInverse(t,so._TEMP_POINT),this._geometry.containsPoint(so._TEMP_POINT)}calculateTints(){if(this.batchTint!==this.tint){this.batchTint=this._tintColor.toNumber();for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e._tintRGB=xt.shared.setValue(this._tintColor).multiply(e._batchRGB).toLittleEndianNumber()}}}calculateVertices(){const t=this.transform._worldID;if(this._transformID===t)return;this._transformID=t;const e=this.transform.worldTransform,i=e.a,s=e.b,n=e.c,o=e.d,a=e.tx,l=e.ty,h=this._geometry.points,c=this.vertexData;let u=0;for(let d=0;d<h.length;d+=2){const f=h[d],p=h[d+1];c[u++]=i*f+n*p+a,c[u++]=o*p+s*f+l}}closePath(){const t=this.currentPath;return t&&(t.closeStroke=!0,this.finishPoly()),this}setMatrix(t){return this._matrix=t,this}beginHole(){return this.finishPoly(),this._holeMode=!0,this}endHole(){return this.finishPoly(),this._holeMode=!1,this}destroy(t){this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,super.destroy(t)}};yl.curves=Fi,yl._TEMP_POINT=new pt;let _s=yl;class Hb{constructor(t,e){this.uvBuffer=t,this.uvMatrix=e,this.data=null,this._bufferUpdateId=-1,this._textureUpdateId=-1,this._updateID=0}update(t){if(!t&&this._bufferUpdateId===this.uvBuffer._updateID&&this._textureUpdateId===this.uvMatrix._updateID)return;this._bufferUpdateId=this.uvBuffer._updateID,this._textureUpdateId=this.uvMatrix._updateID;const e=this.uvBuffer.data;(!this.data||this.data.length!==e.length)&&(this.data=new Float32Array(e.length)),this.uvMatrix.multiplyUvs(e,this.data),this._updateID++}}const _l=new pt,Qd=new kr,tf=class Vf extends Te{constructor(t,e,i,s=De.TRIANGLES){super(),this.geometry=t,this.shader=e,this.state=i||He.for2d(),this.drawMode=s,this.start=0,this.size=0,this.uvs=null,this.indices=null,this.vertexData=new Float32Array(1),this.vertexDirty=-1,this._transformID=-1,this._roundPixels=W.ROUND_PIXELS,this.batchUvs=null}get geometry(){return this._geometry}set geometry(t){this._geometry!==t&&(this._geometry&&(this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose()),this._geometry=t,this._geometry&&this._geometry.refCount++,this.vertexDirty=-1)}get uvBuffer(){return this.geometry.buffers[1]}get verticesBuffer(){return this.geometry.buffers[0]}set material(t){this.shader=t}get material(){return this.shader}set blendMode(t){this.state.blendMode=t}get blendMode(){return this.state.blendMode}set roundPixels(t){this._roundPixels!==t&&(this._transformID=-1),this._roundPixels=t}get roundPixels(){return this._roundPixels}get tint(){return"tint"in this.shader?this.shader.tint:null}set tint(t){this.shader.tint=t}get tintValue(){return this.shader.tintValue}get texture(){return"texture"in this.shader?this.shader.texture:null}set texture(t){this.shader.texture=t}_render(t){const e=this.geometry.buffers[0].data;this.shader.batchable&&this.drawMode===De.TRIANGLES&&e.length<Vf.BATCHABLE_SIZE*2?this._renderToBatch(t):this._renderDefault(t)}_renderDefault(t){const e=this.shader;e.alpha=this.worldAlpha,e.update&&e.update(),t.batch.flush(),e.uniforms.translationMatrix=this.transform.worldTransform.toArray(!0),t.shader.bind(e),t.state.set(this.state),t.geometry.bind(this.geometry,e),t.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)}_renderToBatch(t){const e=this.geometry,i=this.shader;i.uvMatrix&&(i.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=e.indexBuffer.data,this._tintRGB=i._tintRGB,this._texture=i.texture;const s=this.material.pluginName;t.batch.setObjectRenderer(t.plugins[s]),t.plugins[s].render(this)}calculateVertices(){const t=this.geometry.buffers[0],e=t.data,i=t._updateID;if(i===this.vertexDirty&&this._transformID===this.transform._worldID)return;this._transformID=this.transform._worldID,this.vertexData.length!==e.length&&(this.vertexData=new Float32Array(e.length));const s=this.transform.worldTransform,n=s.a,o=s.b,a=s.c,l=s.d,h=s.tx,c=s.ty,u=this.vertexData;for(let d=0;d<u.length/2;d++){const f=e[d*2],p=e[d*2+1];u[d*2]=n*f+a*p+h,u[d*2+1]=o*f+l*p+c}if(this._roundPixels){const d=W.RESOLUTION;for(let f=0;f<u.length;++f)u[f]=Math.round(u[f]*d)/d}this.vertexDirty=i}calculateUvs(){const t=this.geometry.buffers[1],e=this.shader;e.uvMatrix.isSimple?this.uvs=t.data:(this.batchUvs||(this.batchUvs=new Hb(t,e.uvMatrix)),this.batchUvs.update(),this.uvs=this.batchUvs.data)}_calculateBounds(){this.calculateVertices(),this._bounds.addVertexData(this.vertexData,0,this.vertexData.length)}containsPoint(t){if(!this.getBounds().contains(t.x,t.y))return!1;this.worldTransform.applyInverse(t,_l);const e=this.geometry.getBuffer("aVertexPosition").data,i=Qd.points,s=this.geometry.getIndex().data,n=s.length,o=this.drawMode===4?3:1;for(let a=0;a+2<n;a+=o){const l=s[a]*2,h=s[a+1]*2,c=s[a+2]*2;if(i[0]=e[l],i[1]=e[l+1],i[2]=e[h],i[3]=e[h+1],i[4]=e[c],i[5]=e[c+1],Qd.contains(_l.x,_l.y))return!0}return!1}destroy(t){super.destroy(t),this._cachedTexture&&(this._cachedTexture.destroy(),this._cachedTexture=null),this.geometry=null,this.shader=null,this.state=null,this.uvs=null,this.indices=null,this.vertexData=null}};tf.BATCHABLE_SIZE=100;let ef=tf;class Xb extends xr{constructor(t,e,i){super();const s=new Mt(t),n=new Mt(e,!0),o=new Mt(i,!0,!0);this.addAttribute("aVertexPosition",s,2,!1,Z.FLOAT).addAttribute("aTextureCoord",n,2,!1,Z.FLOAT).addIndex(o),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}var Vb=`varying vec2 vTextureCoord;
912
+ uniform vec4 uColor;
913
+
914
+ uniform sampler2D uSampler;
915
+
916
+ void main(void)
917
+ {
918
+ gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;
919
+ }
920
+ `,zb=`attribute vec2 aVertexPosition;
921
+ attribute vec2 aTextureCoord;
922
+
923
+ uniform mat3 projectionMatrix;
924
+ uniform mat3 translationMatrix;
925
+ uniform mat3 uTextureMatrix;
926
+
927
+ varying vec2 vTextureCoord;
928
+
929
+ void main(void)
930
+ {
931
+ gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
932
+
933
+ vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;
934
+ }
935
+ `;class rf extends Xe{constructor(t,e){const i={uSampler:t,alpha:1,uTextureMatrix:Et.IDENTITY,uColor:new Float32Array([1,1,1,1])};e=Object.assign({tint:16777215,alpha:1,pluginName:"batch"},e),e.uniforms&&Object.assign(i,e.uniforms),super(e.program||lr.from(zb,Vb),i),this._colorDirty=!1,this.uvMatrix=new Zu(t),this.batchable=e.program===void 0,this.pluginName=e.pluginName,this._tintColor=new xt(e.tint),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0,this.alpha=e.alpha}get texture(){return this.uniforms.uSampler}set texture(t){this.uniforms.uSampler!==t&&(!this.uniforms.uSampler.baseTexture.alphaMode!=!t.baseTexture.alphaMode&&(this._colorDirty=!0),this.uniforms.uSampler=t,this.uvMatrix.texture=t)}set alpha(t){t!==this._alpha&&(this._alpha=t,this._colorDirty=!0)}get alpha(){return this._alpha}set tint(t){t!==this.tint&&(this._tintColor.setValue(t),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0)}get tint(){return this._tintColor.value}get tintValue(){return this._tintColor.toNumber()}update(){if(this._colorDirty){this._colorDirty=!1;const t=this.texture.baseTexture.alphaMode;xt.shared.setValue(this._tintColor).premultiply(this._alpha,t).toArray(this.uniforms.uColor)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}}class sf{constructor(t,e,i){this.geometry=new xr,this.indexBuffer=null,this.size=i,this.dynamicProperties=[],this.staticProperties=[];for(let s=0;s<t.length;++s){let n=t[s];n={attributeName:n.attributeName,size:n.size,uploadFunction:n.uploadFunction,type:n.type||Z.FLOAT,offset:n.offset},e[s]?this.dynamicProperties.push(n):this.staticProperties.push(n)}this.staticStride=0,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.dynamicStride=0,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this._updateID=0,this.initBuffers()}initBuffers(){const t=this.geometry;let e=0;this.indexBuffer=new Mt(dv(this.size),!0,!0),t.addIndex(this.indexBuffer),this.dynamicStride=0;for(let o=0;o<this.dynamicProperties.length;++o){const a=this.dynamicProperties[o];a.offset=e,e+=a.size,this.dynamicStride+=a.size}const i=new ArrayBuffer(this.size*this.dynamicStride*4*4);this.dynamicData=new Float32Array(i),this.dynamicDataUint32=new Uint32Array(i),this.dynamicBuffer=new Mt(this.dynamicData,!1,!1);let s=0;this.staticStride=0;for(let o=0;o<this.staticProperties.length;++o){const a=this.staticProperties[o];a.offset=s,s+=a.size,this.staticStride+=a.size}const n=new ArrayBuffer(this.size*this.staticStride*4*4);this.staticData=new Float32Array(n),this.staticDataUint32=new Uint32Array(n),this.staticBuffer=new Mt(this.staticData,!0,!1);for(let o=0;o<this.dynamicProperties.length;++o){const a=this.dynamicProperties[o];t.addAttribute(a.attributeName,this.dynamicBuffer,0,a.type===Z.UNSIGNED_BYTE,a.type,this.dynamicStride*4,a.offset*4)}for(let o=0;o<this.staticProperties.length;++o){const a=this.staticProperties[o];t.addAttribute(a.attributeName,this.staticBuffer,0,a.type===Z.UNSIGNED_BYTE,a.type,this.staticStride*4,a.offset*4)}}uploadDynamic(t,e,i){for(let s=0;s<this.dynamicProperties.length;s++){const n=this.dynamicProperties[s];n.uploadFunction(t,e,i,n.type===Z.UNSIGNED_BYTE?this.dynamicDataUint32:this.dynamicData,this.dynamicStride,n.offset)}this.dynamicBuffer._updateID++}uploadStatic(t,e,i){for(let s=0;s<this.staticProperties.length;s++){const n=this.staticProperties[s];n.uploadFunction(t,e,i,n.type===Z.UNSIGNED_BYTE?this.staticDataUint32:this.staticData,this.staticStride,n.offset)}this.staticBuffer._updateID++}destroy(){this.indexBuffer=null,this.dynamicProperties=null,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this.staticProperties=null,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.geometry.destroy()}}var Wb=`varying vec2 vTextureCoord;
936
+ varying vec4 vColor;
937
+
938
+ uniform sampler2D uSampler;
939
+
940
+ void main(void){
941
+ vec4 color = texture2D(uSampler, vTextureCoord) * vColor;
942
+ gl_FragColor = color;
943
+ }`,jb=`attribute vec2 aVertexPosition;
944
+ attribute vec2 aTextureCoord;
945
+ attribute vec4 aColor;
946
+
947
+ attribute vec2 aPositionCoord;
948
+ attribute float aRotation;
949
+
950
+ uniform mat3 translationMatrix;
951
+ uniform vec4 uColor;
952
+
953
+ varying vec2 vTextureCoord;
954
+ varying vec4 vColor;
955
+
956
+ void main(void){
957
+ float x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation);
958
+ float y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation);
959
+
960
+ vec2 v = vec2(x, y);
961
+ v = v + aPositionCoord;
962
+
963
+ gl_Position = vec4((translationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);
964
+
965
+ vTextureCoord = aTextureCoord;
966
+ vColor = aColor * uColor;
967
+ }
968
+ `;class nf extends xn{constructor(t){super(t),this.shader=null,this.properties=null,this.tempMatrix=new Et,this.properties=[{attributeName:"aVertexPosition",size:2,uploadFunction:this.uploadVertices,offset:0},{attributeName:"aPositionCoord",size:2,uploadFunction:this.uploadPosition,offset:0},{attributeName:"aRotation",size:1,uploadFunction:this.uploadRotation,offset:0},{attributeName:"aTextureCoord",size:2,uploadFunction:this.uploadUvs,offset:0},{attributeName:"aColor",size:1,type:Z.UNSIGNED_BYTE,uploadFunction:this.uploadTint,offset:0}],this.shader=Xe.from(jb,Wb,{}),this.state=He.for2d()}render(t){const e=t.children,i=t._maxSize,s=t._batchSize,n=this.renderer;let o=e.length;if(o===0)return;o>i&&!t.autoResize&&(o=i);let a=t._buffers;a||(a=t._buffers=this.generateBuffers(t));const l=e[0]._texture.baseTexture,h=l.alphaMode>0;this.state.blendMode=vu(t.blendMode,h),n.state.set(this.state);const c=n.gl,u=t.worldTransform.copyTo(this.tempMatrix);u.prepend(n.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=u.toArray(!0),this.shader.uniforms.uColor=xt.shared.setValue(t.tintRgb).premultiply(t.worldAlpha,h).toArray(this.shader.uniforms.uColor),this.shader.uniforms.uSampler=l,this.renderer.shader.bind(this.shader);let d=!1;for(let f=0,p=0;f<o;f+=s,p+=1){let m=o-f;m>s&&(m=s),p>=a.length&&a.push(this._generateOneMoreBuffer(t));const _=a[p];_.uploadDynamic(e,f,m);const y=t._bufferUpdateIDs[p]||0;d=d||_._updateID<y,d&&(_._updateID=t._updateID,_.uploadStatic(e,f,m)),n.geometry.bind(_.geometry),c.drawElements(c.TRIANGLES,m*6,c.UNSIGNED_SHORT,0)}}generateBuffers(t){const e=[],i=t._maxSize,s=t._batchSize,n=t._properties;for(let o=0;o<i;o+=s)e.push(new sf(this.properties,n,s));return e}_generateOneMoreBuffer(t){const e=t._batchSize,i=t._properties;return new sf(this.properties,i,e)}uploadVertices(t,e,i,s,n,o){let a=0,l=0,h=0,c=0;for(let u=0;u<i;++u){const d=t[e+u],f=d._texture,p=d.scale.x,m=d.scale.y,_=f.trim,y=f.orig;_?(l=_.x-d.anchor.x*y.width,a=l+_.width,c=_.y-d.anchor.y*y.height,h=c+_.height):(a=y.width*(1-d.anchor.x),l=y.width*-d.anchor.x,h=y.height*(1-d.anchor.y),c=y.height*-d.anchor.y),s[o]=l*p,s[o+1]=c*m,s[o+n]=a*p,s[o+n+1]=c*m,s[o+n*2]=a*p,s[o+n*2+1]=h*m,s[o+n*3]=l*p,s[o+n*3+1]=h*m,o+=n*4}}uploadPosition(t,e,i,s,n,o){for(let a=0;a<i;a++){const l=t[e+a].position;s[o]=l.x,s[o+1]=l.y,s[o+n]=l.x,s[o+n+1]=l.y,s[o+n*2]=l.x,s[o+n*2+1]=l.y,s[o+n*3]=l.x,s[o+n*3+1]=l.y,o+=n*4}}uploadRotation(t,e,i,s,n,o){for(let a=0;a<i;a++){const l=t[e+a].rotation;s[o]=l,s[o+n]=l,s[o+n*2]=l,s[o+n*3]=l,o+=n*4}}uploadUvs(t,e,i,s,n,o){for(let a=0;a<i;++a){const l=t[e+a]._texture._uvs;l?(s[o]=l.x0,s[o+1]=l.y0,s[o+n]=l.x1,s[o+n+1]=l.y1,s[o+n*2]=l.x2,s[o+n*2+1]=l.y2,s[o+n*3]=l.x3,s[o+n*3+1]=l.y3,o+=n*4):(s[o]=0,s[o+1]=0,s[o+n]=0,s[o+n+1]=0,s[o+n*2]=0,s[o+n*2+1]=0,s[o+n*3]=0,s[o+n*3+1]=0,o+=n*4)}}uploadTint(t,e,i,s,n,o){for(let a=0;a<i;++a){const l=t[e+a],h=xt.shared.setValue(l._tintRGB).toPremultiplied(l.alpha,l.texture.baseTexture.alphaMode>0);s[o]=h,s[o+n]=h,s[o+n*2]=h,s[o+n*3]=h,o+=n*4}}destroy(){super.destroy(),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null}}nf.extension={name:"particle",type:V.RendererPlugin},j.add(nf);var Vn=(r=>(r[r.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",r[r.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",r))(Vn||{});const zn={willReadFrequently:!0},ze=class q{static get experimentalLetterSpacingSupported(){let t=q._experimentalLetterSpacingSupported;if(t!==void 0){const e=W.ADAPTER.getCanvasRenderingContext2D().prototype;t=q._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,i,s,n,o,a,l,h){this.text=t,this.style=e,this.width=i,this.height=s,this.lines=n,this.lineWidths=o,this.lineHeight=a,this.maxLineWidth=l,this.fontProperties=h}static measureText(t,e,i,s=q._canvas){i=i??e.wordWrap;const n=e.toFontString(),o=q.measureFont(n);o.fontSize===0&&(o.fontSize=e.fontSize,o.ascent=e.fontSize);const a=s.getContext("2d",zn);a.font=n;const l=(i?q.wordWrap(t,e,s):t).split(/(?:\r\n|\r|\n)/),h=new Array(l.length);let c=0;for(let p=0;p<l.length;p++){const m=q._measureText(l[p],e.letterSpacing,a);h[p]=m,c=Math.max(c,m)}let u=c+e.strokeThickness;e.dropShadow&&(u+=e.dropShadowDistance);const d=e.lineHeight||o.fontSize+e.strokeThickness;let f=Math.max(d,o.fontSize+e.strokeThickness*2)+e.leading+(l.length-1)*(d+e.leading);return e.dropShadow&&(f+=e.dropShadowDistance),new q(t,e,u,f,l,h,d+e.leading,c,o)}static _measureText(t,e,i){let s=!1;q.experimentalLetterSpacingSupported&&(q.experimentalLetterSpacing?(i.letterSpacing=`${e}px`,i.textLetterSpacing=`${e}px`,s=!0):(i.letterSpacing="0px",i.textLetterSpacing="0px"));let n=i.measureText(t).width;return n>0&&(s?n-=e:n+=(q.graphemeSegmenter(t).length-1)*e),n}static wordWrap(t,e,i=q._canvas){const s=i.getContext("2d",zn);let n=0,o="",a="";const l=Object.create(null),{letterSpacing:h,whiteSpace:c}=e,u=q.collapseSpaces(c),d=q.collapseNewlines(c);let f=!u;const p=e.wordWrapWidth+h,m=q.tokenize(t);for(let _=0;_<m.length;_++){let y=m[_];if(q.isNewline(y)){if(!d){a+=q.addLine(o),f=!u,o="",n=0;continue}y=" "}if(u){const g=q.isBreakingSpace(y),v=q.isBreakingSpace(o[o.length-1]);if(g&&v)continue}const x=q.getFromCache(y,h,l,s);if(x>p)if(o!==""&&(a+=q.addLine(o),o="",n=0),q.canBreakWords(y,e.breakWords)){const g=q.wordWrapSplit(y);for(let v=0;v<g.length;v++){let w=g[v],I=w,T=1;for(;g[v+T];){const D=g[v+T];if(!q.canBreakChars(I,D,y,v,e.breakWords))w+=D;else break;I=D,T++}v+=T-1;const C=q.getFromCache(w,h,l,s);C+n>p&&(a+=q.addLine(o),f=!1,o="",n=0),o+=w,n+=C}}else{o.length>0&&(a+=q.addLine(o),o="",n=0);const g=_===m.length-1;a+=q.addLine(y,!g),f=!1,o="",n=0}else x+n>p&&(f=!1,a+=q.addLine(o),o="",n=0),(o.length>0||!q.isBreakingSpace(y)||f)&&(o+=y,n+=x)}return a+=q.addLine(o,!1),a}static addLine(t,e=!0){return t=q.trimRight(t),t=e?`${t}
969
+ `:t,t}static getFromCache(t,e,i,s){let n=i[t];return typeof n!="number"&&(n=q._measureText(t,e,s)+e,i[t]=n),n}static collapseSpaces(t){return t==="normal"||t==="pre-line"}static collapseNewlines(t){return t==="normal"}static trimRight(t){if(typeof t!="string")return"";for(let e=t.length-1;e>=0;e--){const i=t[e];if(!q.isBreakingSpace(i))break;t=t.slice(0,-1)}return t}static isNewline(t){return typeof t!="string"?!1:q._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:q._breakingSpaces.includes(t.charCodeAt(0))}static tokenize(t){const e=[];let i="";if(typeof t!="string")return e;for(let s=0;s<t.length;s++){const n=t[s],o=t[s+1];if(q.isBreakingSpace(n,o)||q.isNewline(n)){i!==""&&(e.push(i),i=""),e.push(n);continue}i+=n}return i!==""&&e.push(i),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,i,s,n){return!0}static wordWrapSplit(t){return q.graphemeSegmenter(t)}static measureFont(t){if(q._fonts[t])return q._fonts[t];const e={ascent:0,descent:0,fontSize:0},i=q._canvas,s=q._context;s.font=t;const n=q.METRICS_STRING+q.BASELINE_SYMBOL,o=Math.ceil(s.measureText(n).width);let a=Math.ceil(s.measureText(q.BASELINE_SYMBOL).width);const l=Math.ceil(q.HEIGHT_MULTIPLIER*a);if(a=a*q.BASELINE_MULTIPLIER|0,o===0||l===0)return q._fonts[t]=e,e;i.width=o,i.height=l,s.fillStyle="#f00",s.fillRect(0,0,o,l),s.font=t,s.textBaseline="alphabetic",s.fillStyle="#000",s.fillText(n,0,a);const h=s.getImageData(0,0,o,l).data,c=h.length,u=o*4;let d=0,f=0,p=!1;for(d=0;d<a;++d){for(let m=0;m<u;m+=4)if(h[f+m]!==255){p=!0;break}if(!p)f+=u;else break}for(e.ascent=a-d,f=c-u,p=!1,d=l;d>a;--d){for(let m=0;m<u;m+=4)if(h[f+m]!==255){p=!0;break}if(!p)f-=u;else break}return e.descent=d-a,e.fontSize=e.ascent+e.descent,q._fonts[t]=e,e}static clearMetrics(t=""){t?delete q._fonts[t]:q._fonts={}}static get _canvas(){var t;if(!q.__canvas){let e;try{const i=new OffscreenCanvas(0,0);if((t=i.getContext("2d",zn))!=null&&t.measureText)return q.__canvas=i,i;e=W.ADAPTER.createCanvas()}catch{e=W.ADAPTER.createCanvas()}e.width=e.height=10,q.__canvas=e}return q.__canvas}static get _context(){return q.__context||(q.__context=q._canvas.getContext("2d",zn)),q.__context}};ze.METRICS_STRING="|ÉqÅ",ze.BASELINE_SYMBOL="M",ze.BASELINE_MULTIPLIER=1.4,ze.HEIGHT_MULTIPLIER=2,ze.graphemeSegmenter=(()=>{if(typeof(Intl==null?void 0:Intl.Segmenter)=="function"){const r=new Intl.Segmenter;return t=>[...r.segment(t)].map(e=>e.segment)}return r=>[...r]})(),ze.experimentalLetterSpacing=!1,ze._fonts={},ze._newlines=[10,13],ze._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let Tr=ze;const Yb=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],of=class Ts{constructor(t){this.styleID=0,this.reset(),xl(this,t,t)}clone(){const t={};return xl(t,this,Ts.defaultStyle),new Ts(t)}reset(){xl(this,Ts.defaultStyle,Ts.defaultStyle)}get align(){return this._align}set align(t){this._align!==t&&(this._align=t,this.styleID++)}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords!==t&&(this._breakWords=t,this.styleID++)}get dropShadow(){return this._dropShadow}set dropShadow(t){this._dropShadow!==t&&(this._dropShadow=t,this.styleID++)}get dropShadowAlpha(){return this._dropShadowAlpha}set dropShadowAlpha(t){this._dropShadowAlpha!==t&&(this._dropShadowAlpha=t,this.styleID++)}get dropShadowAngle(){return this._dropShadowAngle}set dropShadowAngle(t){this._dropShadowAngle!==t&&(this._dropShadowAngle=t,this.styleID++)}get dropShadowBlur(){return this._dropShadowBlur}set dropShadowBlur(t){this._dropShadowBlur!==t&&(this._dropShadowBlur=t,this.styleID++)}get dropShadowColor(){return this._dropShadowColor}set dropShadowColor(t){const e=vl(t);this._dropShadowColor!==e&&(this._dropShadowColor=e,this.styleID++)}get dropShadowDistance(){return this._dropShadowDistance}set dropShadowDistance(t){this._dropShadowDistance!==t&&(this._dropShadowDistance=t,this.styleID++)}get fill(){return this._fill}set fill(t){const e=vl(t);this._fill!==e&&(this._fill=e,this.styleID++)}get fillGradientType(){return this._fillGradientType}set fillGradientType(t){this._fillGradientType!==t&&(this._fillGradientType=t,this.styleID++)}get fillGradientStops(){return this._fillGradientStops}set fillGradientStops(t){qb(this._fillGradientStops,t)||(this._fillGradientStops=t,this.styleID++)}get fontFamily(){return this._fontFamily}set fontFamily(t){this.fontFamily!==t&&(this._fontFamily=t,this.styleID++)}get fontSize(){return this._fontSize}set fontSize(t){this._fontSize!==t&&(this._fontSize=t,this.styleID++)}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle!==t&&(this._fontStyle=t,this.styleID++)}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant!==t&&(this._fontVariant=t,this.styleID++)}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.styleID++)}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.styleID++)}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight!==t&&(this._lineHeight=t,this.styleID++)}get leading(){return this._leading}set leading(t){this._leading!==t&&(this._leading=t,this.styleID++)}get lineJoin(){return this._lineJoin}set lineJoin(t){this._lineJoin!==t&&(this._lineJoin=t,this.styleID++)}get miterLimit(){return this._miterLimit}set miterLimit(t){this._miterLimit!==t&&(this._miterLimit=t,this.styleID++)}get padding(){return this._padding}set padding(t){this._padding!==t&&(this._padding=t,this.styleID++)}get stroke(){return this._stroke}set stroke(t){const e=vl(t);this._stroke!==e&&(this._stroke=e,this.styleID++)}get strokeThickness(){return this._strokeThickness}set strokeThickness(t){this._strokeThickness!==t&&(this._strokeThickness=t,this.styleID++)}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline!==t&&(this._textBaseline=t,this.styleID++)}get trim(){return this._trim}set trim(t){this._trim!==t&&(this._trim=t,this.styleID++)}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace!==t&&(this._whiteSpace=t,this.styleID++)}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap!==t&&(this._wordWrap=t,this.styleID++)}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth!==t&&(this._wordWrapWidth=t,this.styleID++)}toFontString(){const t=typeof this.fontSize=="number"?`${this.fontSize}px`:this.fontSize;let e=this.fontFamily;Array.isArray(this.fontFamily)||(e=this.fontFamily.split(","));for(let i=e.length-1;i>=0;i--){let s=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!Yb.includes(s)&&(s=`"${s}"`),e[i]=s}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${t} ${e.join(",")}`}};of.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:Vn.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};let Ar=of;function vl(r){const t=xt.shared,e=i=>{const s=t.setValue(i);return s.alpha===1?s.toHex():s.toRgbaString()};return Array.isArray(r)?r.map(e):e(r)}function qb(r,t){if(!Array.isArray(r)||!Array.isArray(t)||r.length!==t.length)return!1;for(let e=0;e<r.length;++e)if(r[e]!==t[e])return!1;return!0}function xl(r,t,e){for(const i in e)Array.isArray(t[i])?r[i]=t[i].slice():r[i]=t[i]}const Kb={texture:!0,children:!1,baseTexture:!0},af=class Ul extends Ri{constructor(t,e,i){let s=!1;i||(i=W.ADAPTER.createCanvas(),s=!0),i.width=3,i.height=3;const n=Y.from(i);n.orig=new nt,n.trim=new nt,super(n),this._ownCanvas=s,this.canvas=i,this.context=i.getContext("2d",{willReadFrequently:!0}),this._resolution=Ul.defaultResolution??W.RESOLUTION,this._autoResolution=Ul.defaultAutoResolution,this._text=null,this._style=null,this._styleListener=null,this._font="",this.text=t,this.style=e,this.localStyleID=-1}static get experimentalLetterSpacing(){return Tr.experimentalLetterSpacing}static set experimentalLetterSpacing(t){lt("7.1.0","Text.experimentalLetterSpacing is deprecated, use TextMetrics.experimentalLetterSpacing"),Tr.experimentalLetterSpacing=t}updateText(t){const e=this._style;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&t)return;this._font=this._style.toFontString();const i=this.context,s=Tr.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),n=s.width,o=s.height,a=s.lines,l=s.lineHeight,h=s.lineWidths,c=s.maxLineWidth,u=s.fontProperties;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,n)+e.padding*2)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,o)+e.padding*2)*this._resolution),i.scale(this._resolution,this._resolution),i.clearRect(0,0,this.canvas.width,this.canvas.height),i.font=this._font,i.lineWidth=e.strokeThickness,i.textBaseline=e.textBaseline,i.lineJoin=e.lineJoin,i.miterLimit=e.miterLimit;let d,f;const p=e.dropShadow?2:1;for(let m=0;m<p;++m){const _=e.dropShadow&&m===0,y=_?Math.ceil(Math.max(1,o)+e.padding*2):0,x=y*this._resolution;if(_){i.fillStyle="black",i.strokeStyle="black";const v=e.dropShadowColor,w=e.dropShadowBlur*this._resolution,I=e.dropShadowDistance*this._resolution;i.shadowColor=xt.shared.setValue(v).setAlpha(e.dropShadowAlpha).toRgbaString(),i.shadowBlur=w,i.shadowOffsetX=Math.cos(e.dropShadowAngle)*I,i.shadowOffsetY=Math.sin(e.dropShadowAngle)*I+x}else i.fillStyle=this._generateFillStyle(e,a,s),i.strokeStyle=e.stroke,i.shadowColor="black",i.shadowBlur=0,i.shadowOffsetX=0,i.shadowOffsetY=0;let g=(l-u.fontSize)/2;l-u.fontSize<0&&(g=0);for(let v=0;v<a.length;v++)d=e.strokeThickness/2,f=e.strokeThickness/2+v*l+u.ascent+g,e.align==="right"?d+=c-h[v]:e.align==="center"&&(d+=(c-h[v])/2),e.stroke&&e.strokeThickness&&this.drawLetterSpacing(a[v],d+e.padding,f+e.padding-y,!0),e.fill&&this.drawLetterSpacing(a[v],d+e.padding,f+e.padding-y)}this.updateTexture()}drawLetterSpacing(t,e,i,s=!1){const n=this._style.letterSpacing;let o=!1;if(Tr.experimentalLetterSpacingSupported&&(Tr.experimentalLetterSpacing?(this.context.letterSpacing=`${n}px`,this.context.textLetterSpacing=`${n}px`,o=!0):(this.context.letterSpacing="0px",this.context.textLetterSpacing="0px")),n===0||o){s?this.context.strokeText(t,e,i):this.context.fillText(t,e,i);return}let a=e;const l=Tr.graphemeSegmenter(t);let h=this.context.measureText(t).width,c=0;for(let u=0;u<l.length;++u){const d=l[u];s?this.context.strokeText(d,a,i):this.context.fillText(d,a,i);let f="";for(let p=u+1;p<l.length;++p)f+=l[p];c=this.context.measureText(f).width,a+=h-c+n,h=c}}updateTexture(){const t=this.canvas;if(this._style.trim){const o=gv(t);o.data&&(t.width=o.width,t.height=o.height,this.context.putImageData(o.data,0,0))}const e=this._texture,i=this._style,s=i.trim?0:i.padding,n=e.baseTexture;e.trim.width=e._frame.width=t.width/this._resolution,e.trim.height=e._frame.height=t.height/this._resolution,e.trim.x=-s,e.trim.y=-s,e.orig.width=e._frame.width-s*2,e.orig.height=e._frame.height-s*2,this._onTextureUpdate(),n.setRealSize(t.width,t.height,this._resolution),e.updateUvs(),this.dirty=!1}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._render(t)}updateTransform(){this.updateText(!0),super.updateTransform()}getBounds(t,e){return this.updateText(!0),this._textureID===-1&&(t=!1),super.getBounds(t,e)}getLocalBounds(t){return this.updateText(!0),super.getLocalBounds.call(this,t)}_calculateBounds(){this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_generateFillStyle(t,e,i){const s=t.fill;if(Array.isArray(s)){if(s.length===1)return s[0]}else return s;let n;const o=t.dropShadow?t.dropShadowDistance:0,a=t.padding||0,l=this.canvas.width/this._resolution-o-a*2,h=this.canvas.height/this._resolution-o-a*2,c=s.slice(),u=t.fillGradientStops.slice();if(!u.length){const d=c.length+1;for(let f=1;f<d;++f)u.push(f/d)}if(c.unshift(s[0]),u.unshift(0),c.push(s[s.length-1]),u.push(1),t.fillGradientType===Vn.LINEAR_VERTICAL){n=this.context.createLinearGradient(l/2,a,l/2,h+a);const d=i.fontProperties.fontSize+t.strokeThickness;for(let f=0;f<e.length;f++){const p=i.lineHeight*(f-1)+d,m=i.lineHeight*f;let _=m;f>0&&p>m&&(_=(m+p)/2);const y=m+d,x=i.lineHeight*(f+1);let g=y;f+1<e.length&&x<y&&(g=(y+x)/2);const v=(g-_)/h;for(let w=0;w<c.length;w++){let I=0;typeof u[w]=="number"?I=u[w]:I=w/c.length;let T=Math.min(1,Math.max(0,_/h+I*v));T=Number(T.toFixed(5)),n.addColorStop(T,c[w])}}}else{n=this.context.createLinearGradient(a,h/2,l+a,h/2);const d=c.length+1;let f=1;for(let p=0;p<c.length;p++){let m;typeof u[p]=="number"?m=u[p]:m=f/d,n.addColorStop(m,c[p]),f++}}return n}destroy(t){typeof t=="boolean"&&(t={children:t}),t=Object.assign({},Kb,t),super.destroy(t),this._ownCanvas&&(this.canvas.height=this.canvas.width=0),this.context=null,this.canvas=null,this._style=null}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this.updateText(!0);const e=_r(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this.updateText(!0);const e=_r(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t}get style(){return this._style}set style(t){t=t||{},t instanceof Ar?this._style=t:this._style=new Ar(t),this.localStyleID=-1,this.dirty=!0}get text(){return this._text}set text(t){t=String(t??""),this._text!==t&&(this._text=t,this.dirty=!0)}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}};af.defaultAutoResolution=!0;let lf=af;class Zb{constructor(t){this.maxItemsPerFrame=t,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function Jb(r,t){var i;let e=!1;if((i=r==null?void 0:r._textures)!=null&&i.length){for(let s=0;s<r._textures.length;s++)if(r._textures[s]instanceof Y){const n=r._textures[s].baseTexture;t.includes(n)||(t.push(n),e=!0)}}return e}function Qb(r,t){if(r.baseTexture instanceof it){const e=r.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function tw(r,t){if(r._texture&&r._texture instanceof Y){const e=r._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function ew(r,t){return t instanceof lf?(t.updateText(!0),!0):!1}function rw(r,t){if(t instanceof Ar){const e=t.toFontString();return Tr.measureFont(e),!0}return!1}function iw(r,t){if(r instanceof lf){t.includes(r.style)||t.push(r.style),t.includes(r)||t.push(r);const e=r._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function sw(r,t){return r instanceof Ar?(t.includes(r)||t.push(r),!0):!1}const hf=class zf{constructor(t){this.limiter=new Zb(zf.uploadsPerFrame),this.renderer=t,this.uploadHookHelper=null,this.queue=[],this.addHooks=[],this.uploadHooks=[],this.completes=[],this.ticking=!1,this.delayedTick=()=>{this.queue&&this.prepareItems()},this.registerFindHook(iw),this.registerFindHook(sw),this.registerFindHook(Jb),this.registerFindHook(Qb),this.registerFindHook(tw),this.registerUploadHook(ew),this.registerUploadHook(rw)}upload(t){return new Promise(e=>{t&&this.add(t),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,le.system.addOnce(this.tick,this,Yr.UTILITY))):e()})}tick(){setTimeout(this.delayedTick,0)}prepareItems(){for(this.limiter.beginFrame();this.queue.length&&this.limiter.allowedToUpload();){const t=this.queue[0];let e=!1;if(t&&!t._destroyed){for(let i=0,s=this.uploadHooks.length;i<s;i++)if(this.uploadHooks[i](this.uploadHookHelper,t)){this.queue.shift(),e=!0;break}}e||this.queue.shift()}if(this.queue.length)le.system.addOnce(this.tick,this,Yr.UTILITY);else{this.ticking=!1;const t=this.completes.slice(0);this.completes.length=0;for(let e=0,i=t.length;e<i;e++)t[e]()}}registerFindHook(t){return t&&this.addHooks.push(t),this}registerUploadHook(t){return t&&this.uploadHooks.push(t),this}add(t){for(let e=0,i=this.addHooks.length;e<i&&!this.addHooks[e](t,this.queue);e++);if(t instanceof Te)for(let e=t.children.length-1;e>=0;e--)this.add(t.children[e]);return this}destroy(){this.ticking&&le.system.remove(this.tick,this),this.ticking=!1,this.addHooks=null,this.uploadHooks=null,this.renderer=null,this.completes=null,this.queue=null,this.limiter=null,this.uploadHookHelper=null}};hf.uploadsPerFrame=4;let bl=hf;Object.defineProperties(W,{UPLOADS_PER_FRAME:{get(){return bl.uploadsPerFrame},set(r){lt("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),bl.uploadsPerFrame=r}}});function cf(r,t){return t instanceof it?(t._glTextures[r.CONTEXT_UID]||r.texture.bind(t),!0):!1}function nw(r,t){if(!(t instanceof _s))return!1;const{geometry:e}=t;t.finishPoly(),e.updateBatches();const{batches:i}=e;for(let s=0;s<i.length;s++){const{texture:n}=i[s].style;n&&cf(r,n.baseTexture)}return e.batchable||r.geometry.bind(e,t._resolveDirectShader(r)),!0}function ow(r,t){return r instanceof _s?(t.push(r),!0):!1}class uf extends bl{constructor(t){super(t),this.uploadHookHelper=this.renderer,this.registerFindHook(ow),this.registerUploadHook(cf),this.registerUploadHook(nw)}}uf.extension={name:"prepare",type:V.RendererSystem},j.add(uf);var aw=`#version 300 es
970
+ #define SHADER_NAME Tiling-Sprite-100
971
+
972
+ precision lowp float;
973
+
974
+ in vec2 vTextureCoord;
975
+
976
+ out vec4 fragmentColor;
977
+
978
+ uniform sampler2D uSampler;
979
+ uniform vec4 uColor;
980
+ uniform mat3 uMapCoord;
981
+ uniform vec4 uClampFrame;
982
+ uniform vec2 uClampOffset;
983
+
984
+ void main(void)
985
+ {
986
+ vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);
987
+ coord = (uMapCoord * vec3(coord, 1.0)).xy;
988
+ vec2 unclamped = coord;
989
+ coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
990
+
991
+ vec4 texSample = texture(uSampler, coord, unclamped == coord ? 0.0f : -32.0f);// lod-bias very negative to force lod 0
992
+
993
+ fragmentColor = texSample * uColor;
994
+ }
995
+ `,lw=`#version 300 es
996
+ #define SHADER_NAME Tiling-Sprite-300
997
+
998
+ precision lowp float;
999
+
1000
+ in vec2 aVertexPosition;
1001
+ in vec2 aTextureCoord;
1002
+
1003
+ uniform mat3 projectionMatrix;
1004
+ uniform mat3 translationMatrix;
1005
+ uniform mat3 uTransform;
1006
+
1007
+ out vec2 vTextureCoord;
1008
+
1009
+ void main(void)
1010
+ {
1011
+ gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
1012
+
1013
+ vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;
1014
+ }
1015
+ `,hw=`#version 100
1016
+ #ifdef GL_EXT_shader_texture_lod
1017
+ #extension GL_EXT_shader_texture_lod : enable
1018
+ #endif
1019
+ #define SHADER_NAME Tiling-Sprite-100
1020
+
1021
+ precision lowp float;
1022
+
1023
+ varying vec2 vTextureCoord;
1024
+
1025
+ uniform sampler2D uSampler;
1026
+ uniform vec4 uColor;
1027
+ uniform mat3 uMapCoord;
1028
+ uniform vec4 uClampFrame;
1029
+ uniform vec2 uClampOffset;
1030
+
1031
+ void main(void)
1032
+ {
1033
+ vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);
1034
+ coord = (uMapCoord * vec3(coord, 1.0)).xy;
1035
+ vec2 unclamped = coord;
1036
+ coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
1037
+
1038
+ #ifdef GL_EXT_shader_texture_lod
1039
+ vec4 texSample = unclamped == coord
1040
+ ? texture2D(uSampler, coord)
1041
+ : texture2DLodEXT(uSampler, coord, 0);
1042
+ #else
1043
+ vec4 texSample = texture2D(uSampler, coord);
1044
+ #endif
1045
+
1046
+ gl_FragColor = texSample * uColor;
1047
+ }
1048
+ `,df=`#version 100
1049
+ #define SHADER_NAME Tiling-Sprite-100
1050
+
1051
+ precision lowp float;
1052
+
1053
+ attribute vec2 aVertexPosition;
1054
+ attribute vec2 aTextureCoord;
1055
+
1056
+ uniform mat3 projectionMatrix;
1057
+ uniform mat3 translationMatrix;
1058
+ uniform mat3 uTransform;
1059
+
1060
+ varying vec2 vTextureCoord;
1061
+
1062
+ void main(void)
1063
+ {
1064
+ gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
1065
+
1066
+ vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;
1067
+ }
1068
+ `,cw=`#version 100
1069
+ #define SHADER_NAME Tiling-Sprite-Simple-100
1070
+
1071
+ precision lowp float;
1072
+
1073
+ varying vec2 vTextureCoord;
1074
+
1075
+ uniform sampler2D uSampler;
1076
+ uniform vec4 uColor;
1077
+
1078
+ void main(void)
1079
+ {
1080
+ vec4 texSample = texture2D(uSampler, vTextureCoord);
1081
+ gl_FragColor = texSample * uColor;
1082
+ }
1083
+ `;const Wn=new Et;class ff extends xn{constructor(t){super(t),t.runners.contextChange.add(this),this.quad=new Wu,this.state=He.for2d()}contextChange(){const t=this.renderer,e={globals:t.globalUniforms};this.simpleShader=Xe.from(df,cw,e),this.shader=t.context.webGLVersion>1?Xe.from(lw,aw,e):Xe.from(df,hw,e)}render(t){const e=this.renderer,i=this.quad;let s=i.vertices;s[0]=s[6]=t._width*-t.anchor.x,s[1]=s[3]=t._height*-t.anchor.y,s[2]=s[4]=t._width*(1-t.anchor.x),s[5]=s[7]=t._height*(1-t.anchor.y);const n=t.uvRespectAnchor?t.anchor.x:0,o=t.uvRespectAnchor?t.anchor.y:0;s=i.uvs,s[0]=s[6]=-n,s[1]=s[3]=-o,s[2]=s[4]=1-n,s[5]=s[7]=1-o,i.invalidate();const a=t._texture,l=a.baseTexture,h=l.alphaMode>0,c=t.tileTransform.localTransform,u=t.uvMatrix;let d=l.isPowerOfTwo&&a.frame.width===l.width&&a.frame.height===l.height;d&&(l._glTextures[e.CONTEXT_UID]?d=l.wrapMode!==pr.CLAMP:l.wrapMode===pr.CLAMP&&(l.wrapMode=pr.REPEAT));const f=d?this.simpleShader:this.shader,p=a.width,m=a.height,_=t._width,y=t._height;Wn.set(c.a*p/_,c.b*p/y,c.c*m/_,c.d*m/y,c.tx/_,c.ty/y),Wn.invert(),d?Wn.prepend(u.mapCoord):(f.uniforms.uMapCoord=u.mapCoord.toArray(!0),f.uniforms.uClampFrame=u.uClampFrame,f.uniforms.uClampOffset=u.uClampOffset),f.uniforms.uTransform=Wn.toArray(!0),f.uniforms.uColor=xt.shared.setValue(t.tint).premultiply(t.worldAlpha,h).toArray(f.uniforms.uColor),f.uniforms.translationMatrix=t.transform.worldTransform.toArray(!0),f.uniforms.uSampler=a,e.shader.bind(f),e.geometry.bind(i),this.state.blendMode=vu(t.blendMode,h),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}ff.extension={name:"tilingSprite",type:V.RendererPlugin},j.add(ff);const pf=class As{constructor(t,e,i){this.linkedSheets=[],(t instanceof it||t instanceof Y)&&(t={texture:t,data:e,resolutionFilename:i});const{texture:s,data:n,resolutionFilename:o=null,cachePrefix:a=""}=t;this.cachePrefix=a,this._texture=s instanceof Y?s:null,this.baseTexture=s instanceof it?s:this._texture.baseTexture,this.textures={},this.animations={},this.data=n;const l=this.baseTexture.resource;this.resolution=this._updateResolution(o||(l?l.url:null)),this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}_updateResolution(t=null){const{scale:e}=this.data.meta;let i=or(t,null);return i===null&&(i=typeof e=="number"?e:parseFloat(e??"1")),i!==1&&this.baseTexture.setResolution(i),i}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=As.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const i=As.BATCH_SIZE;for(;e-t<i&&e<this._frameKeys.length;){const s=this._frameKeys[e],n=this._frames[s],o=n.frame;if(o){let a=null,l=null;const h=n.trimmed!==!1&&n.sourceSize?n.sourceSize:n.frame,c=new nt(0,0,Math.floor(h.w)/this.resolution,Math.floor(h.h)/this.resolution);n.rotated?a=new nt(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 nt(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 nt(Math.floor(n.spriteSourceSize.x)/this.resolution,Math.floor(n.spriteSourceSize.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution)),this.textures[s]=new Y(this.baseTexture,a,c,l,n.rotated?2:0,n.anchor,n.borders),Y.addToCache(this.textures[s],this.cachePrefix+s.toString())}e++}}_processAnimations(){const t=this.data.animations||{};for(const e in t){this.animations[e]=[];for(let i=0;i<t[e].length;i++){const s=t[e][i];this.animations[e].push(this.textures[s])}}}_parseComplete(){const t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*As.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*As.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){var e;for(const i in this.textures)this.textures[i].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&((e=this._texture)==null||e.destroy(),this.baseTexture.destroy()),this._texture=null,this.baseTexture=null,this.linkedSheets=[]}};pf.BATCH_SIZE=1e3;let mf=pf;const uw=["jpg","png","jpeg","avif","webp","s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"];function gf(r,t,e){const i={};if(r.forEach(s=>{i[s]=t}),Object.keys(t.textures).forEach(s=>{i[`${t.cachePrefix}${s}`]=t.textures[s]}),!e){const s=Gt.dirname(r[0]);t.linkedSheets.forEach((n,o)=>{Object.assign(i,gf([`${s}/${t.data.meta.related_multi_packs[o]}`],n,!0))})}return i}const dw={extension:V.Asset,cache:{test:r=>r instanceof mf,getCacheableAssets:(r,t)=>gf(r,t,!1)},resolver:{test:r=>{const t=r.split("?")[0].split("."),e=t.pop(),i=t.pop();return e==="json"&&uw.includes(i)},parse:r=>{var e;const t=r.split(".");return{resolution:parseFloat(((e=W.RETINA_PREFIX.exec(r))==null?void 0:e[1])??"1"),format:t[t.length-2],src:r}}},loader:{name:"spritesheetLoader",extension:{type:V.LoadParser,priority:Ce.Normal},async testParse(r,t){return Gt.extname(t.src).toLowerCase()===".json"&&!!r.frames},async parse(r,t,e){var c,u;const{texture:i,imageFilename:s,cachePrefix:n}=(t==null?void 0:t.data)??{};let o=Gt.dirname(t.src);o&&o.lastIndexOf("/")!==o.length-1&&(o+="/");let a;if(i&&i.baseTexture)a=i;else{const d=ol(o+(s??r.meta.image),t.src);a=(await e.load([d]))[d]}const l=new mf({texture:a.baseTexture,data:r,resolutionFilename:t.src,cachePrefix:n});await l.parse();const h=(c=r==null?void 0:r.meta)==null?void 0:c.related_multi_packs;if(Array.isArray(h)){const d=[];for(const p of h){if(typeof p!="string")continue;let m=o+p;(u=t.data)!=null&&u.ignoreMultiPack||(m=ol(m,t.src),d.push(e.load({src:m,data:{ignoreMultiPack:!0}})))}const f=await Promise.all(d);l.linkedSheets=f,f.forEach(p=>{p.linkedSheets=[l].concat(l.linkedSheets.filter(m=>m!==p))})}return l},unload(r){r.destroy(!0)}}};j.add(dw);class jn{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class Yn{static test(t){return typeof t=="string"&&t.startsWith("info face=")}static parse(t){const e=t.match(/^[a-z]+\s+.+$/gm),i={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(const n in e){const o=e[n].match(/^[a-z]+/gm)[0],a=e[n].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),l={};for(const h in a){const c=a[h].split("="),u=c[0],d=c[1].replace(/"/gm,""),f=parseFloat(d),p=isNaN(f)?d:f;l[u]=p}i[o].push(l)}const s=new jn;return i.info.forEach(n=>s.info.push({face:n.face,size:parseInt(n.size,10)})),i.common.forEach(n=>s.common.push({lineHeight:parseInt(n.lineHeight,10)})),i.page.forEach(n=>s.page.push({id:parseInt(n.id,10),file:n.file})),i.char.forEach(n=>s.char.push({id:parseInt(n.id,10),page:parseInt(n.page,10),x:parseInt(n.x,10),y:parseInt(n.y,10),width:parseInt(n.width,10),height:parseInt(n.height,10),xoffset:parseInt(n.xoffset,10),yoffset:parseInt(n.yoffset,10),xadvance:parseInt(n.xadvance,10)})),i.kerning.forEach(n=>s.kerning.push({first:parseInt(n.first,10),second:parseInt(n.second,10),amount:parseInt(n.amount,10)})),i.distanceField.forEach(n=>s.distanceField.push({distanceRange:parseInt(n.distanceRange,10),fieldType:n.fieldType})),s}}class wl{static test(t){const e=t;return typeof t!="string"&&"getElementsByTagName"in t&&e.getElementsByTagName("page").length&&e.getElementsByTagName("info")[0].getAttribute("face")!==null}static parse(t){const e=new jn,i=t.getElementsByTagName("info"),s=t.getElementsByTagName("common"),n=t.getElementsByTagName("page"),o=t.getElementsByTagName("char"),a=t.getElementsByTagName("kerning"),l=t.getElementsByTagName("distanceField");for(let h=0;h<i.length;h++)e.info.push({face:i[h].getAttribute("face"),size:parseInt(i[h].getAttribute("size"),10)});for(let h=0;h<s.length;h++)e.common.push({lineHeight:parseInt(s[h].getAttribute("lineHeight"),10)});for(let h=0;h<n.length;h++)e.page.push({id:parseInt(n[h].getAttribute("id"),10)||0,file:n[h].getAttribute("file")});for(let h=0;h<o.length;h++){const c=o[h];e.char.push({id:parseInt(c.getAttribute("id"),10),page:parseInt(c.getAttribute("page"),10)||0,x:parseInt(c.getAttribute("x"),10),y:parseInt(c.getAttribute("y"),10),width:parseInt(c.getAttribute("width"),10),height:parseInt(c.getAttribute("height"),10),xoffset:parseInt(c.getAttribute("xoffset"),10),yoffset:parseInt(c.getAttribute("yoffset"),10),xadvance:parseInt(c.getAttribute("xadvance"),10)})}for(let h=0;h<a.length;h++)e.kerning.push({first:parseInt(a[h].getAttribute("first"),10),second:parseInt(a[h].getAttribute("second"),10),amount:parseInt(a[h].getAttribute("amount"),10)});for(let h=0;h<l.length;h++)e.distanceField.push({fieldType:l[h].getAttribute("fieldType"),distanceRange:parseInt(l[h].getAttribute("distanceRange"),10)});return e}}class El{static test(t){return typeof t=="string"&&t.includes("<font>")?wl.test(W.ADAPTER.parseXML(t)):!1}static parse(t){return wl.parse(W.ADAPTER.parseXML(t))}}const Tl=[Yn,wl,El];function fw(r){for(let t=0;t<Tl.length;t++)if(Tl[t].test(r))return Tl[t];return null}function pw(r,t,e,i,s,n){const o=e.fill;if(Array.isArray(o)){if(o.length===1)return o[0]}else return o;let a;const l=e.dropShadow?e.dropShadowDistance:0,h=e.padding||0,c=r.width/i-l-h*2,u=r.height/i-l-h*2,d=o.slice(),f=e.fillGradientStops.slice();if(!f.length){const p=d.length+1;for(let m=1;m<p;++m)f.push(m/p)}if(d.unshift(o[0]),f.unshift(0),d.push(o[o.length-1]),f.push(1),e.fillGradientType===Vn.LINEAR_VERTICAL){a=t.createLinearGradient(c/2,h,c/2,u+h);let p=0;const m=(n.fontProperties.fontSize+e.strokeThickness)/u;for(let _=0;_<s.length;_++){const y=n.lineHeight*_;for(let x=0;x<d.length;x++){let g=0;typeof f[x]=="number"?g=f[x]:g=x/d.length;const v=y/u+g*m;let w=Math.max(p,v);w=Math.min(w,1),a.addColorStop(w,d[x]),p=w}}}else{a=t.createLinearGradient(h,u/2,c+h,u/2);const p=d.length+1;let m=1;for(let _=0;_<d.length;_++){let y;typeof f[_]=="number"?y=f[_]:y=m/p,a.addColorStop(y,d[_]),m++}}return a}function mw(r,t,e,i,s,n,o){const a=e.text,l=e.fontProperties;t.translate(i,s),t.scale(n,n);const h=o.strokeThickness/2,c=-(o.strokeThickness/2);if(t.font=o.toFontString(),t.lineWidth=o.strokeThickness,t.textBaseline=o.textBaseline,t.lineJoin=o.lineJoin,t.miterLimit=o.miterLimit,t.fillStyle=pw(r,t,o,n,[a],e),t.strokeStyle=o.stroke,o.dropShadow){const u=o.dropShadowColor,d=o.dropShadowBlur*n,f=o.dropShadowDistance*n;t.shadowColor=xt.shared.setValue(u).setAlpha(o.dropShadowAlpha).toRgbaString(),t.shadowBlur=d,t.shadowOffsetX=Math.cos(o.dropShadowAngle)*f,t.shadowOffsetY=Math.sin(o.dropShadowAngle)*f}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0;o.stroke&&o.strokeThickness&&t.strokeText(a,h,c+e.lineHeight-l.descent),o.fill&&t.fillText(a,h,c+e.lineHeight-l.descent),t.setTransform(1,0,0,1,0,0),t.fillStyle="rgba(0, 0, 0, 0)"}function qn(r){return r.codePointAt?r.codePointAt(0):r.charCodeAt(0)}function yf(r){return Array.from?Array.from(r):r.split("")}function gw(r){typeof r=="string"&&(r=[r]);const t=[];for(let e=0,i=r.length;e<i;e++){const s=r[e];if(Array.isArray(s)){if(s.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${s.length}.`);const n=s[0].charCodeAt(0),o=s[1].charCodeAt(0);if(o<n)throw new Error("[BitmapFont]: Invalid character range.");for(let a=n,l=o;a<=l;a++)t.push(String.fromCharCode(a))}else t.push(...yf(s))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}const Sr=class Ye{constructor(t,e,i){var c;const[s]=t.info,[n]=t.common,[o]=t.page,[a]=t.distanceField,l=or(o.file),h={};this._ownsTextures=i,this.font=s.face,this.size=s.size,this.lineHeight=n.lineHeight/l,this.chars={},this.pageTextures=h;for(let u=0;u<t.page.length;u++){const{id:d,file:f}=t.page[u];h[d]=e instanceof Array?e[u]:e[f],a!=null&&a.fieldType&&a.fieldType!=="none"&&(h[d].baseTexture.alphaMode=ie.NO_PREMULTIPLIED_ALPHA,h[d].baseTexture.mipmap=Oe.OFF)}for(let u=0;u<t.char.length;u++){const{id:d,page:f}=t.char[u];let{x:p,y:m,width:_,height:y,xoffset:x,yoffset:g,xadvance:v}=t.char[u];p/=l,m/=l,_/=l,y/=l,x/=l,g/=l,v/=l;const w=new nt(p+h[f].frame.x/l,m+h[f].frame.y/l,_,y);this.chars[d]={xOffset:x,yOffset:g,xAdvance:v,kerning:{},texture:new Y(h[f].baseTexture,w),page:f}}for(let u=0;u<t.kerning.length;u++){let{first:d,second:f,amount:p}=t.kerning[u];d/=l,f/=l,p/=l,this.chars[f]&&(this.chars[f].kerning[d]=p)}this.distanceFieldRange=a==null?void 0:a.distanceRange,this.distanceFieldType=((c=a==null?void 0:a.fieldType)==null?void 0:c.toLowerCase())??"none"}destroy(){for(const t in this.chars)this.chars[t].texture.destroy(),this.chars[t].texture=null;for(const t in this.pageTextures)this._ownsTextures&&this.pageTextures[t].destroy(!0),this.pageTextures[t]=null;this.chars=null,this.pageTextures=null}static install(t,e,i){let s;if(t instanceof jn)s=t;else{const o=fw(t);if(!o)throw new Error("Unrecognized data format for font.");s=o.parse(t)}e instanceof Y&&(e=[e]);const n=new Ye(s,e,i);return Ye.available[n.font]=n,n}static uninstall(t){const e=Ye.available[t];if(!e)throw new Error(`No font found named '${t}'`);e.destroy(),delete Ye.available[t]}static from(t,e,i){if(!t)throw new Error("[BitmapFont] Property `name` is required.");const{chars:s,padding:n,resolution:o,textureWidth:a,textureHeight:l,...h}=Object.assign({},Ye.defaultOptions,i),c=gw(s),u=e instanceof Ar?e:new Ar(e),d=a,f=new jn;f.info[0]={face:u.fontFamily,size:u.fontSize},f.common[0]={lineHeight:u.fontSize};let p=0,m=0,_,y,x,g=0;const v=[];for(let I=0;I<c.length;I++){_||(_=W.ADAPTER.createCanvas(),_.width=a,_.height=l,y=_.getContext("2d"),x=new it(_,{resolution:o,...h}),v.push(new Y(x)),f.page.push({id:v.length-1,file:""}));const T=c[I],C=Tr.measureText(T,u,!1,_),D=C.width,A=Math.ceil(C.height),P=Math.ceil((u.fontStyle==="italic"?2:1)*D);if(m>=l-A*o){if(m===0)throw new Error(`[BitmapFont] textureHeight ${l}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${T}')`);--I,_=null,y=null,x=null,m=0,p=0,g=0;continue}if(g=Math.max(A+C.fontProperties.descent,g),P*o+p>=d){if(p===0)throw new Error(`[BitmapFont] textureWidth ${a}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${T}')`);--I,m+=g*o,m=Math.ceil(m),p=0,g=0;continue}mw(_,y,C,p,m,o,u);const R=qn(C.text);f.char.push({id:R,page:v.length-1,x:p/o,y:m/o,width:P,height:A,xoffset:0,yoffset:0,xadvance:D-(u.dropShadow?u.dropShadowDistance:0)-(u.stroke?u.strokeThickness:0)}),p+=(P+2*n)*o,p=Math.ceil(p)}if(!(i!=null&&i.skipKerning))for(let I=0,T=c.length;I<T;I++){const C=c[I];for(let D=0;D<T;D++){const A=c[D],P=y.measureText(C).width,R=y.measureText(A).width,b=y.measureText(C+A).width-(P+R);b&&f.kerning.push({first:qn(C),second:qn(A),amount:b})}}const w=new Ye(f,v,!0);return Ye.available[t]!==void 0&&Ye.uninstall(t),Ye.available[t]=w,w}};Sr.ALPHA=[["a","z"],["A","Z"]," "],Sr.NUMERIC=[["0","9"]],Sr.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],Sr.ASCII=[[" ","~"]],Sr.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:Sr.ALPHANUMERIC},Sr.available={};let Cr=Sr;var yw=`// Pixi texture info\r
1084
+ varying vec2 vTextureCoord;\r
1085
+ uniform sampler2D uSampler;\r
1086
+ \r
1087
+ // Tint\r
1088
+ uniform vec4 uColor;\r
1089
+ \r
1090
+ // on 2D applications fwidth is screenScale / glyphAtlasScale * distanceFieldRange\r
1091
+ uniform float uFWidth;\r
1092
+ \r
1093
+ void main(void) {\r
1094
+ \r
1095
+ // To stack MSDF and SDF we need a non-pre-multiplied-alpha texture.\r
1096
+ vec4 texColor = texture2D(uSampler, vTextureCoord);\r
1097
+ \r
1098
+ // MSDF\r
1099
+ float median = texColor.r + texColor.g + texColor.b -\r
1100
+ min(texColor.r, min(texColor.g, texColor.b)) -\r
1101
+ max(texColor.r, max(texColor.g, texColor.b));\r
1102
+ // SDF\r
1103
+ median = min(median, texColor.a);\r
1104
+ \r
1105
+ float screenPxDistance = uFWidth * (median - 0.5);\r
1106
+ float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);\r
1107
+ if (median < 0.01) {\r
1108
+ alpha = 0.0;\r
1109
+ } else if (median > 0.99) {\r
1110
+ alpha = 1.0;\r
1111
+ }\r
1112
+ \r
1113
+ // Gamma correction for coverage-like alpha\r
1114
+ float luma = dot(uColor.rgb, vec3(0.299, 0.587, 0.114));\r
1115
+ float gamma = mix(1.0, 1.0 / 2.2, luma);\r
1116
+ float coverage = pow(uColor.a * alpha, gamma); \r
1117
+ \r
1118
+ // NPM Textures, NPM outputs\r
1119
+ gl_FragColor = vec4(uColor.rgb, coverage);\r
1120
+ }\r
1121
+ `,_w=`// Mesh material default fragment\r
1122
+ attribute vec2 aVertexPosition;\r
1123
+ attribute vec2 aTextureCoord;\r
1124
+ \r
1125
+ uniform mat3 projectionMatrix;\r
1126
+ uniform mat3 translationMatrix;\r
1127
+ uniform mat3 uTextureMatrix;\r
1128
+ \r
1129
+ varying vec2 vTextureCoord;\r
1130
+ \r
1131
+ void main(void)\r
1132
+ {\r
1133
+ gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\r
1134
+ \r
1135
+ vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\r
1136
+ }\r
1137
+ `;const _f=[],vf=[],xf=[],vw=class Wf extends Te{constructor(t,e={}){super();const{align:i,tint:s,maxWidth:n,letterSpacing:o,fontName:a,fontSize:l}=Object.assign({},Wf.styleDefaults,e);if(!Cr.available[a])throw new Error(`Missing BitmapFont "${a}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=i,this._tintColor=new xt(s),this._font=void 0,this._fontName=a,this._fontSize=l,this.text=t,this._maxWidth=n,this._maxLineHeight=0,this._letterSpacing=o,this._anchor=new ar(()=>{this.dirty=!0},this,0,0),this._roundPixels=W.ROUND_PIXELS,this.dirty=!0,this._resolution=W.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){var P;const t=Cr.available[this._fontName],e=this.fontSize,i=e/t.size,s=new pt,n=[],o=[],a=[],l=this._text.replace(/(?:\r\n|\r)/g,`
1138
+ `)||" ",h=yf(l),c=this._maxWidth*t.size/e,u=t.distanceFieldType==="none"?_f:vf;let d=null,f=0,p=0,m=0,_=-1,y=0,x=0,g=0,v=0;for(let R=0;R<h.length;R++){const b=h[R],M=qn(b);if(/(?:\s)/.test(b)&&(_=R,y=f,v++),b==="\r"||b===`
1139
+ `){o.push(f),a.push(-1),p=Math.max(p,f),++m,++x,s.x=0,s.y+=t.lineHeight,d=null,v=0;continue}const S=t.chars[M];if(!S)continue;d&&S.kerning[d]&&(s.x+=S.kerning[d]);const U=xf.pop()||{texture:Y.EMPTY,line:0,charCode:0,prevSpaces:0,position:new pt};U.texture=S.texture,U.line=m,U.charCode=M,U.position.x=Math.round(s.x+S.xOffset+this._letterSpacing/2),U.position.y=Math.round(s.y+S.yOffset),U.prevSpaces=v,n.push(U),f=U.position.x+Math.max(S.xAdvance-S.xOffset,S.texture.orig.width),s.x+=S.xAdvance+this._letterSpacing,g=Math.max(g,S.yOffset+S.texture.height),d=M,_!==-1&&c>0&&s.x>c&&(++x,Ai(n,1+_-x,1+R-_),R=_,_=-1,o.push(y),a.push(n.length>0?n[n.length-1].prevSpaces:0),p=Math.max(p,y),m++,s.x=0,s.y+=t.lineHeight,d=null,v=0)}const w=h[h.length-1];w!=="\r"&&w!==`
1140
+ `&&(/(?:\s)/.test(w)&&(f=y),o.push(f),p=Math.max(p,f),a.push(-1));const I=[];for(let R=0;R<=m;R++){let b=0;this._align==="right"?b=p-o[R]:this._align==="center"?b=(p-o[R])/2:this._align==="justify"&&(b=a[R]<0?0:(p-o[R])/a[R]),I.push(b)}const T=n.length,C={},D=[],A=this._activePagesMeshData;u.push(...A);for(let R=0;R<T;R++){const b=n[R].texture,M=b.baseTexture.uid;if(!C[M]){let S=u.pop();if(!S){const L=new Xb;let H,tt;t.distanceFieldType==="none"?(H=new rf(Y.EMPTY),tt=Q.NORMAL):(H=new rf(Y.EMPTY,{program:lr.from(_w,yw),uniforms:{uFWidth:0}}),tt=Q.NORMAL_NPM);const F=new ef(L,H);F.blendMode=tt,S={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:F,vertices:null,uvs:null,indices:null}}S.index=0,S.indexCount=0,S.vertexCount=0,S.uvsCount=0,S.total=0;const{_textureCache:U}=this;U[M]=U[M]||new Y(b.baseTexture),S.mesh.texture=U[M],S.mesh.tint=this._tintColor.value,D.push(S),C[M]=S}C[M].total++}for(let R=0;R<A.length;R++)D.includes(A[R])||this.removeChild(A[R].mesh);for(let R=0;R<D.length;R++)D[R].mesh.parent!==this&&this.addChild(D[R].mesh);this._activePagesMeshData=D;for(const R in C){const b=C[R],M=b.total;if(!(((P=b.indices)==null?void 0:P.length)>6*M)||b.vertices.length<ef.BATCHABLE_SIZE*2)b.vertices=new Float32Array(4*2*M),b.uvs=new Float32Array(4*2*M),b.indices=new Uint16Array(6*M);else{const S=b.total,U=b.vertices;for(let L=S*4*2;L<U.length;L++)U[L]=0}b.mesh.size=6*M}for(let R=0;R<T;R++){const b=n[R];let M=b.position.x+I[b.line]*(this._align==="justify"?b.prevSpaces:1);this._roundPixels&&(M=Math.round(M));const S=M*i,U=b.position.y*i,L=b.texture,H=C[L.baseTexture.uid],tt=L.frame,F=L._uvs,k=H.index++;H.indices[k*6+0]=0+k*4,H.indices[k*6+1]=1+k*4,H.indices[k*6+2]=2+k*4,H.indices[k*6+3]=0+k*4,H.indices[k*6+4]=2+k*4,H.indices[k*6+5]=3+k*4,H.vertices[k*8+0]=S,H.vertices[k*8+1]=U,H.vertices[k*8+2]=S+tt.width*i,H.vertices[k*8+3]=U,H.vertices[k*8+4]=S+tt.width*i,H.vertices[k*8+5]=U+tt.height*i,H.vertices[k*8+6]=S,H.vertices[k*8+7]=U+tt.height*i,H.uvs[k*8+0]=F.x0,H.uvs[k*8+1]=F.y0,H.uvs[k*8+2]=F.x1,H.uvs[k*8+3]=F.y1,H.uvs[k*8+4]=F.x2,H.uvs[k*8+5]=F.y2,H.uvs[k*8+6]=F.x3,H.uvs[k*8+7]=F.y3}this._textWidth=p*i,this._textHeight=(s.y+t.lineHeight)*i;for(const R in C){const b=C[R];if(this.anchor.x!==0||this.anchor.y!==0){let L=0;const H=this._textWidth*this.anchor.x,tt=this._textHeight*this.anchor.y;for(let F=0;F<b.total;F++)b.vertices[L++]-=H,b.vertices[L++]-=tt,b.vertices[L++]-=H,b.vertices[L++]-=tt,b.vertices[L++]-=H,b.vertices[L++]-=tt,b.vertices[L++]-=H,b.vertices[L++]-=tt}this._maxLineHeight=g*i;const M=b.mesh.geometry.getBuffer("aVertexPosition"),S=b.mesh.geometry.getBuffer("aTextureCoord"),U=b.mesh.geometry.getIndex();M.data=b.vertices,S.data=b.uvs,U.data=b.indices,M.update(),S.update(),U.update()}for(let R=0;R<n.length;R++)xf.push(n[R]);this._font=t,this.dirty=!1}updateTransform(){this.validate(),this.containerUpdateTransform()}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0);const{distanceFieldRange:e,distanceFieldType:i,size:s}=Cr.available[this._fontName];if(i!=="none"){const{a:n,b:o,c:a,d:l}=this.worldTransform,h=Math.sqrt(n*n+o*o),c=Math.sqrt(a*a+l*l),u=(Math.abs(h)+Math.abs(c))/2,d=this.fontSize/s,f=t._view.resolution;for(const p of this._activePagesMeshData)p.mesh.shader.uniforms.uFWidth=u*e*d*f}super._render(t)}getLocalBounds(){return this.validate(),super.getLocalBounds()}validate(){const t=Cr.available[this._fontName];if(!t)throw new Error(`Missing BitmapFont "${this._fontName}"`);this._font!==t&&(this.dirty=!0),this.dirty&&this.updateText()}get tint(){return this._tintColor.value}set tint(t){if(this.tint!==t){this._tintColor.setValue(t);for(let e=0;e<this._activePagesMeshData.length;e++)this._activePagesMeshData[e].mesh.tint=t}}get align(){return this._align}set align(t){this._align!==t&&(this._align=t,this.dirty=!0)}get fontName(){return this._fontName}set fontName(t){if(!Cr.available[t])throw new Error(`Missing BitmapFont "${t}"`);this._fontName!==t&&(this._fontName=t,this.dirty=!0)}get fontSize(){return this._fontSize??Cr.available[this._fontName].size}set fontSize(t){this._fontSize!==t&&(this._fontSize=t,this.dirty=!0)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get text(){return this._text}set text(t){t=String(t??""),this._text!==t&&(this._text=t,this.dirty=!0)}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth!==t&&(this._maxWidth=t,this.dirty=!0)}get maxLineHeight(){return this.validate(),this._maxLineHeight}get textWidth(){return this.validate(),this._textWidth}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.dirty=!0)}get roundPixels(){return this._roundPixels}set roundPixels(t){t!==this._roundPixels&&(this._roundPixels=t,this.dirty=!0)}get textHeight(){return this.validate(),this._textHeight}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}destroy(t){const{_textureCache:e}=this,i=Cr.available[this._fontName].distanceFieldType==="none"?_f:vf;i.push(...this._activePagesMeshData);for(const s of this._activePagesMeshData)this.removeChild(s.mesh);this._activePagesMeshData=[],i.filter(s=>e[s.mesh.texture.baseTexture.uid]).forEach(s=>{s.mesh.texture=Y.EMPTY});for(const s in e)e[s].destroy(),delete e[s];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(t)}};vw.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};const xw=[".xml",".fnt"],bw={extension:{type:V.LoadParser,priority:Ce.Normal},name:"loadBitmapFont",test(r){return xw.includes(Gt.extname(r).toLowerCase())},async testParse(r){return Yn.test(r)||El.test(r)},async parse(r,t,e){const i=Yn.test(r)?Yn.parse(r):El.parse(r),{src:s}=t,{page:n}=i,o=[];for(let h=0;h<n.length;++h){const c=n[h].file;let u=Gt.join(Gt.dirname(s),c);u=ol(u,s),o.push(u)}const a=await e.load(o),l=o.map(h=>a[h]);return Cr.install(i,l,!0)},async load(r,t){return(await W.ADAPTER.fetch(r)).text()},unload(r){r.destroy()}};j.add(bw);const Al=class Gi extends Ar{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(t){return new Gi(Object.keys(Gi.defaultOptions).reduce((e,i)=>({...e,[i]:t[i]}),{}))}cleanFonts(){this._fonts.length>0&&(this._fonts.forEach(t=>{URL.revokeObjectURL(t.src),t.refs--,t.refs===0&&(t.fontFace&&document.fonts.delete(t.fontFace),delete Gi.availableFonts[t.originalUrl])}),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(t,e={}){const{availableFonts:i}=Gi;if(i[t]){const s=i[t];return this._fonts.push(s),s.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return W.ADAPTER.fetch(t).then(s=>s.blob()).then(async s=>new Promise((n,o)=>{const a=URL.createObjectURL(s),l=new FileReader;l.onload=()=>n([a,l.result]),l.onerror=o,l.readAsDataURL(s)})).then(async([s,n])=>{const o=Object.assign({family:Gt.basename(t,Gt.extname(t)),weight:"normal",style:"normal",display:"auto",src:s,dataSrc:n,refs:1,originalUrl:t,fontFace:null},e);i[t]=o,this._fonts.push(o),this.styleID++;const a=new FontFace(o.family,`url(${o.src})`,{weight:o.weight,style:o.style,display:o.display});o.fontFace=a,await a.load(),document.fonts.add(a),await document.fonts.ready,this.styleID++,this.fontsDirty=!0})}addOverride(...t){const e=t.filter(i=>!this._overrides.includes(i));e.length>0&&(this._overrides.push(...e),this.styleID++)}removeOverride(...t){const e=t.filter(i=>this._overrides.includes(i));e.length>0&&(this._overrides=this._overrides.filter(i=>!e.includes(i)),this.styleID++)}toCSS(t){return[`transform: scale(${t})`,"transform-origin: top left","display: inline-block",`color: ${this.normalizeColor(this.fill)}`,`font-size: ${this.fontSize}px`,`font-family: ${this.fontFamily}`,`font-weight: ${this.fontWeight}`,`font-style: ${this.fontStyle}`,`font-variant: ${this.fontVariant}`,`letter-spacing: ${this.letterSpacing}px`,`text-align: ${this.align}`,`padding: ${this.padding}px`,`white-space: ${this.whiteSpace}`,...this.lineHeight?[`line-height: ${this.lineHeight}px`]:[],...this.wordWrap?[`word-wrap: ${this.breakWords?"break-all":"break-word"}`,`max-width: ${this.wordWrapWidth}px`]:[],...this.strokeThickness?[`-webkit-text-stroke-width: ${this.strokeThickness}px`,`-webkit-text-stroke-color: ${this.normalizeColor(this.stroke)}`,`text-stroke-width: ${this.strokeThickness}px`,`text-stroke-color: ${this.normalizeColor(this.stroke)}`,"paint-order: stroke"]:[],...this.dropShadow?[this.dropShadowToCSS()]:[],...this._overrides].join(";")}toGlobalCSS(){return this._fonts.reduce((t,e)=>`${t}
1141
+ @font-face {
1142
+ font-family: "${e.family}";
1143
+ src: url('${e.dataSrc}');
1144
+ font-weight: ${e.weight};
1145
+ font-style: ${e.style};
1146
+ font-display: ${e.display};
1147
+ }`,this._stylesheet)}get stylesheet(){return this._stylesheet}set stylesheet(t){this._stylesheet!==t&&(this._stylesheet=t,this.styleID++)}normalizeColor(t){return Array.isArray(t)&&(t=cv(t)),typeof t=="number"?hv(t):t}dropShadowToCSS(){let t=this.normalizeColor(this.dropShadowColor);const e=this.dropShadowAlpha,i=Math.round(Math.cos(this.dropShadowAngle)*this.dropShadowDistance),s=Math.round(Math.sin(this.dropShadowAngle)*this.dropShadowDistance);t.startsWith("#")&&e<1&&(t+=(e*255|0).toString(16).padStart(2,"0"));const n=`${i}px ${s}px`;return this.dropShadowBlur>0?`text-shadow: ${n} ${this.dropShadowBlur}px ${t}`:`text-shadow: ${n} ${t}`}reset(){Object.assign(this,Gi.defaultOptions)}onBeforeDraw(){const{fontsDirty:t}=this;return this.fontsDirty=!1,this.isSafari&&this._fonts.length>0&&t?new Promise(e=>setTimeout(e,100)):Promise.resolve()}get isSafari(){const{userAgent:t}=W.ADAPTER.getNavigator();return/^((?!chrome|android).)*safari/i.test(t)}set fillGradientStops(t){console.warn("[HTMLTextStyle] fillGradientStops is not supported by HTMLText")}get fillGradientStops(){return super.fillGradientStops}set fillGradientType(t){console.warn("[HTMLTextStyle] fillGradientType is not supported by HTMLText")}get fillGradientType(){return super.fillGradientType}set miterLimit(t){console.warn("[HTMLTextStyle] miterLimit is not supported by HTMLText")}get miterLimit(){return super.miterLimit}set trim(t){console.warn("[HTMLTextStyle] trim is not supported by HTMLText")}get trim(){return super.trim}set textBaseline(t){console.warn("[HTMLTextStyle] textBaseline is not supported by HTMLText")}get textBaseline(){return super.textBaseline}set leading(t){console.warn("[HTMLTextStyle] leading is not supported by HTMLText")}get leading(){return super.leading}set lineJoin(t){console.warn("[HTMLTextStyle] lineJoin is not supported by HTMLText")}get lineJoin(){return super.lineJoin}};Al.availableFonts={},Al.defaultOptions={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,padding:0,stroke:"black",strokeThickness:0,whiteSpace:"normal",wordWrap:!1,wordWrapWidth:100};let Sl=Al;const Kn=class $i extends Ri{constructor(t="",e={}){super(Y.EMPTY),this._text=null,this._style=null,this._autoResolution=!0,this.localStyleID=-1,this.dirty=!1,this._updateID=0,this.ownsStyle=!1;const i=new Image,s=Y.from(i,{scaleMode:W.SCALE_MODE,resourceOptions:{autoLoad:!1}});s.orig=new nt,s.trim=new nt,this.texture=s;const n="http://www.w3.org/2000/svg",o="http://www.w3.org/1999/xhtml",a=document.createElementNS(n,"svg"),l=document.createElementNS(n,"foreignObject"),h=document.createElementNS(o,"div"),c=document.createElementNS(o,"style");l.setAttribute("width","10000"),l.setAttribute("height","10000"),l.style.overflow="hidden",a.appendChild(l),this.maxWidth=$i.defaultMaxWidth,this.maxHeight=$i.defaultMaxHeight,this._domElement=h,this._styleElement=c,this._svgRoot=a,this._foreignObject=l,this._foreignObject.appendChild(c),this._foreignObject.appendChild(h),this._image=i,this._loadImage=new Image,this._autoResolution=$i.defaultAutoResolution,this._resolution=$i.defaultResolution??W.RESOLUTION,this.text=t,this.style=e}measureText(t){var c,u;const{text:e,style:i,resolution:s}=Object.assign({text:this._text,style:this._style,resolution:this._resolution},t);Object.assign(this._domElement,{innerHTML:e,style:i.toCSS(s)}),this._styleElement.textContent=i.toGlobalCSS(),document.body.appendChild(this._svgRoot);const n=this._domElement.getBoundingClientRect();this._svgRoot.remove();const{width:o,height:a}=n;(o>this.maxWidth||a>this.maxHeight)&&console.warn("[HTMLText] Large expanse of text, increase HTMLText.maxWidth or HTMLText.maxHeight property.");const l=Math.min(this.maxWidth,Math.ceil(o)),h=Math.min(this.maxHeight,Math.ceil(a));return this._svgRoot.setAttribute("width",l.toString()),this._svgRoot.setAttribute("height",h.toString()),e!==this._text&&(this._domElement.innerHTML=this._text),i!==this._style&&(Object.assign(this._domElement,{style:(c=this._style)==null?void 0:c.toCSS(s)}),this._styleElement.textContent=(u=this._style)==null?void 0:u.toGlobalCSS()),{width:l+i.padding*2,height:h+i.padding*2}}async updateText(t=!0){const{style:e,_image:i,_loadImage:s}=this;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&t)return;const{width:n,height:o}=this.measureText();i.width=s.width=Math.ceil(Math.max(1,n)),i.height=s.height=Math.ceil(Math.max(1,o)),this._updateID++;const a=this._updateID;await new Promise(l=>{s.onload=async()=>{if(a<this._updateID){l();return}await e.onBeforeDraw(),i.src=s.src,s.onload=null,s.src="",this.updateTexture(),l()};const h=new XMLSerializer().serializeToString(this._svgRoot);s.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(h)}`})}get source(){return this._image}updateTexture(){const{style:t,texture:e,_image:i,resolution:s}=this,{padding:n}=t,{baseTexture:o}=e;e.trim.width=e._frame.width=i.width/s,e.trim.height=e._frame.height=i.height/s,e.trim.x=-n,e.trim.y=-n,e.orig.width=e._frame.width-n*2,e.orig.height=e._frame.height-n*2,this._onTextureUpdate(),o.setRealSize(i.width,i.height,s),this.dirty=!1}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._render(t)}_renderCanvas(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._renderCanvas(t)}getLocalBounds(t){return this.updateText(!0),super.getLocalBounds(t)}_calculateBounds(){this.updateText(!0),this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_onStyleChange(){this.dirty=!0}destroy(t){var i,s,n,o,a;typeof t=="boolean"&&(t={children:t}),t=Object.assign({},$i.defaultDestroyOptions,t),super.destroy(t);const e=null;this.ownsStyle&&((i=this._style)==null||i.cleanFonts()),this._style=e,(s=this._svgRoot)==null||s.remove(),this._svgRoot=e,(n=this._domElement)==null||n.remove(),this._domElement=e,(o=this._foreignObject)==null||o.remove(),this._foreignObject=e,(a=this._styleElement)==null||a.remove(),this._styleElement=e,this._loadImage.src="",this._loadImage.onload=null,this._loadImage=e,this._image.src="",this._image=e}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._image.width/this.resolution}set width(t){this.updateText(!0);const e=_r(this.scale.x)||1;this.scale.x=e*t/this._image.width/this.resolution,this._width=t}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._image.height/this.resolution}set height(t){this.updateText(!0);const e=_r(this.scale.y)||1;this.scale.y=e*t/this._image.height/this.resolution,this._height=t}get style(){return this._style}set style(t){this._style!==t&&(t=t||{},t instanceof Sl?(this.ownsStyle=!1,this._style=t):t instanceof Ar?(console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle"),this.ownsStyle=!0,this._style=Sl.from(t)):(this.ownsStyle=!0,this._style=new Sl(t)),this.localStyleID=-1,this.dirty=!0)}get text(){return this._text}set text(t){t=String(t===""||t===null||t===void 0?" ":t),t=this.sanitiseText(t),this._text!==t&&(this._text=t,this.dirty=!0)}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}sanitiseText(t){return t.replace(/<br>/gi,"<br/>").replace(/<hr>/gi,"<hr/>").replace(/&nbsp;/gi,"&#160;")}};Kn.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},Kn.defaultMaxWidth=2024,Kn.defaultMaxHeight=2024,Kn.defaultAutoResolution=!0;const ww=16777215,Ew=.25,Tw=16777215,Aw=1.5;let Ir=!1,Zn;const Cl=r=>{const t={tint:r!=null&&r.fill?new xt(r.fill).toNumber():ww,alpha:(r==null?void 0:r.fillOpacity)===void 0?Ew:Math.min(r.fillOpacity,1)},e={tint:r!=null&&r.stroke?new xt(r.stroke).toNumber():Tw,alpha:(r==null?void 0:r.strokeOpacity)===void 0?1:Math.min(r.strokeOpacity,1),lineWidth:(r==null?void 0:r.strokeWidth)===void 0?Aw:r.strokeWidth};return{fillStyle:t,strokeStyle:e}},Il=r=>(t,e,i)=>{const{fillStyle:s,strokeStyle:n}=Cl(i),o=new _s;o.beginFill(16777215),r(e,o),o.endFill(),o.tint=s.tint,o.alpha=s.alpha,t.addChild(o);const a=new _s,l=n.lineWidth===1?1:n.lineWidth/Zn;return a.lineStyle(l,16777215,1,.5,n.lineWidth===1),r(e,a),a.tint=n.tint||16777215,a.alpha=n.alpha,t.addChild(a),{fill:o,stroke:a,strokeWidth:n.lineWidth}},Sw=Il((r,t)=>{const{cx:e,cy:i,rx:s,ry:n}=r.geometry;t.drawEllipse(e,i,s,n)}),Cw=Il((r,t)=>{const e=r.geometry.points.reduce((i,s)=>[...i,...s],[]);t.drawPolygon(e)}),Iw=Il((r,t)=>{const{x:e,y:i,w:s,h:n}=r.geometry;t.drawRect(e,i,s,n)}),bf=r=>{const t=r.viewport.getContainerSize().x;return r.viewport.getZoom(!0)*t/r.world.getContentFactor()},Rw=(r,t,e,i)=>()=>{const s=r.viewport.viewportToImageRectangle(r.viewport.getBounds(!0)),n=bf(r);n!==Zn&&!Ir&&(Ir=!0,e.forEach(({stroke:d,strokeWidth:f})=>{const{lineStyle:p}=d.geometry.graphicsData[0];f>1?(Ir=!1,p.width=f/n,d.geometry.invalidate()):f===1&&!p.native&&(p.width=1,p.native=!0,d.geometry.invalidate())})),Zn=n;const o=r.viewport.getFlip();let a=Math.PI*r.viewport.getRotation(!0)/180;a<0&&(a+=2*Math.PI),a>2*Math.PI&&(a-=2*Math.PI);const l=o?r.viewport._containerInnerSize.x+s.x*n:-s.x*n,h=-s.y*n;let c,u;a>0&&a<=Math.PI/2?(c=s.height*n,u=0):a>Math.PI/2&&a<=Math.PI?(c=s.width*n,u=s.height*n):a>Math.PI&&a<=Math.PI*1.5?(c=0,u=s.width*n):(c=0,u=0),t.position.x=c+l*Math.cos(a)-h*Math.sin(a),t.position.y=u+l*Math.sin(a)+h*Math.cos(a),t.scale.set(o?-n:n,n),t.rotation=a,i.render(t)},Pw=(r,t)=>{const e=new _s,i=yd({width:t.width,height:t.height,backgroundAlpha:0,view:t,antialias:!0,resolution:2}),s=new Map;let n=new Set,o,a;Zn=bf(r);const l=(g,v)=>{Ir=!1;const{selector:w}=g.target,I=typeof a=="function"?a(g,v):a;let T;w.type===wt.RECTANGLE?T=Iw(e,w,I):w.type===wt.POLYGON?T=Cw(e,w,I):w.type===wt.ELLIPSE?T=Sw(e,w,I):console.warn(`Unsupported shape type: ${w.type}`),T&&s.set(g.id,{annotation:g,...T})},h=g=>{const v=s.get(g.id);v&&(s.delete(g.id),v.fill.destroy(),v.stroke.destroy())},c=(g,v,w)=>{Ir=!1;const I=s.get(g.id);I&&(s.delete(g.id),I.fill.destroy(),I.stroke.destroy(),l(v,w))},u=(g,v)=>{const w=s.get(g);w&&(s.delete(g),w.fill.destroy(),w.stroke.destroy(),l(w.annotation,v))},d=(g,v)=>{i.resize(g,v),i.render(e)},f=g=>{Ir=!1;const{children:v}=e;s.forEach(({fill:w,stroke:I,annotation:T})=>{const C=g?n.has(T.id)||g(T):!0;C&&!v.includes(w)?(e.addChild(w),e.addChild(I)):!C&&v.includes(w)&&(e.removeChild(w),e.removeChild(I))}),i.render(e)},p=g=>{o!==g&&(o&&u(o,{selected:n.has(o)}),g&&u(g,{selected:n.has(g),hovered:!0}),o=g,i.render(e))},m=g=>{const v=g.selected.map(T=>T.id),w=v.filter(T=>!n.has(T)),I=[...n].filter(T=>!v.includes(T));[...w,...I].forEach(T=>u(T,{selected:v.includes(T),hovered:T===o})),n=new Set(v),i.render(e)},_=g=>{if(typeof g=="function")s.forEach(({annotation:v,fill:w,stroke:I,strokeWidth:T},C)=>{T>1&&(Ir=!1);const D={selected:n.has(v.id),hovered:o===v.id},{fillStyle:A,strokeStyle:P}=Cl(g(v,D));w.tint=A.tint,w.alpha=A.alpha,I.tint=P.tint||16777215,I.alpha=P.alpha,s.set(v.id,{annotation:v,fill:w,stroke:I,strokeWidth:T})});else{const{fillStyle:v,strokeStyle:w}=Cl(g);w.lineWidth>1&&(Ir=!1),s.forEach(({annotation:I,fill:T,stroke:C,strokeWidth:D},A)=>{T.tint=v.tint,T.alpha=v.alpha,C.tint=w.tint||16777215,C.alpha=w.alpha,s.set(I.id,{annotation:I,fill:T,stroke:C,strokeWidth:D})})}a=g,i.render(e)},y=g=>{g?t.classList.remove("hidden"):t.classList.add("hidden")};return{addAnnotation:l,destroy:()=>i.destroy(),redraw:Rw(r,e,s,i),removeAnnotation:h,resize:d,setFilter:f,setHovered:p,setSelected:m,setStyle:_,setVisible:y,updateAnnotation:c}};function Mw(r,t,e){let i,s,{filter:n}=t,{state:o}=t,{style:a}=t,{viewer:l}=t,{visible:h=!0}=t;const{store:c,hover:u,selection:d,viewport:f}=o;Ro(r,u,I=>e(11,i=I)),Ro(r,d,I=>e(8,s=I));const p=Hs();let m,_;const y=I=>{const T=new Nt.Point(I.x,I.y),{x:C,y:D}=l.viewport.pointFromPixel(T);return l.viewport.viewportToImageCoordinates(C,D)},x=I=>{const{x:T,y:C}=I.position;_={x:T,y:C}},g=I=>T=>{const{x:C,y:D}=y(new Nt.Point(T.offsetX,T.offsetY)),A=c.getAt(C,D);A&&(!n||n(A))?(I.classList.add("hover"),i!==A.id&&(u.set(A.id),m.setHovered(A.id))):(I.classList.remove("hover"),i&&(u.set(void 0),m.setHovered(void 0)))},v=I=>{if(!_)return;const T=I.originalEvent,{x:C,y:D}=I.position,A=C-_.x,P=D-_.y;if(Math.sqrt(A*A+P*P)<5){const{x:b,y:M}=y(I.position),S=c.getAt(b,M);S?p("click",{originalEvent:T,annotation:S}):p("click",{originalEvent:T})}_=void 0};let w;return $s(()=>{var b;const{offsetWidth:I,offsetHeight:T}=l.canvas,C=document.createElement("canvas");C.width=I,C.height=T,C.className="a9s-gl-canvas",(b=l.element.querySelector(".openseadragon-canvas"))==null||b.appendChild(C),e(7,m=Pw(l,C));const D=g(C);C.addEventListener("pointermove",D);const A=new ResizeObserver(M=>{try{const{width:S,height:U}=M[0].contentRect;C.width=S,C.height=U,m.resize(S,U)}catch{console.warn("WebGL canvas already disposed")}});A.observe(C);const P=()=>{const M=l.viewport.getBounds();w=l.viewport.viewportToImageRectangle(M);const{x:S,y:U,width:L,height:H}=w,tt=c.getIntersecting(S,U,L,H);f.set(tt.map(F=>F.id))};l.addHandler("canvas-press",x),l.addHandler("canvas-release",v),l.addHandler("update-viewport",m.redraw),l.addHandler("animation-finish",P);const R=M=>{const{created:S,updated:U,deleted:L}=M.changes;if((S||[]).forEach(H=>m.addAnnotation(H)),(U||[]).forEach(({oldValue:H,newValue:tt})=>m.updateAnnotation(H,tt)),(L||[]).forEach(H=>m.removeAnnotation(H)),w){const{x:H,y:tt,width:F,height:k}=w,J=c.getIntersecting(H,tt,F,k);f.set(J.map(X=>X.id))}else f.set(c.all().map(H=>H.id));m.redraw()};return c.observe(R),()=>{var M;C.removeEventListener("pointermove",D),A.disconnect(),l.removeHandler("canvas-press",x),l.removeHandler("canvas-release",v),l.removeHandler("update-viewport",m.redraw),l.removeHandler("animation-finish",P),c.unobserve(R),m.destroy(),(M=C.parentNode)==null||M.removeChild(C)}}),r.$$set=I=>{"filter"in I&&e(2,n=I.filter),"state"in I&&e(3,o=I.state),"style"in I&&e(4,a=I.style),"viewer"in I&&e(5,l=I.viewer),"visible"in I&&e(6,h=I.visible)},r.$$.update=()=>{r.$$.dirty&132&&(m==null||m.setFilter(n)),r.$$.dirty&384&&(m==null||m.setSelected(s)),r.$$.dirty&144&&(m==null||m.setStyle(a)),r.$$.dirty&192&&(m==null||m.setVisible(h))},[u,d,n,o,a,l,h,m,s]}class Bw extends ae{constructor(t){super(),oe(this,t,Mw,null,te,{filter:2,state:3,style:4,viewer:5,visible:6})}}for(var Yt=[],Rl=0;Rl<256;++Rl)Yt.push((Rl+256).toString(16).slice(1));function Dw(r,t=0){return(Yt[r[t+0]]+Yt[r[t+1]]+Yt[r[t+2]]+Yt[r[t+3]]+"-"+Yt[r[t+4]]+Yt[r[t+5]]+"-"+Yt[r[t+6]]+Yt[r[t+7]]+"-"+Yt[r[t+8]]+Yt[r[t+9]]+"-"+Yt[r[t+10]]+Yt[r[t+11]]+Yt[r[t+12]]+Yt[r[t+13]]+Yt[r[t+14]]+Yt[r[t+15]]).toLowerCase()}var Jn,Ow=new Uint8Array(16);function Fw(){if(!Jn&&(Jn=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Jn))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Jn(Ow)}var Lw=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const wf={randomUUID:Lw};function Nw(r,t,e){if(wf.randomUUID&&!t&&!r)return wf.randomUUID();r=r||{};var i=r.random||(r.rng||Fw)();return i[6]=i[6]&15|64,i[8]=i[8]&63|128,Dw(i)}var Ni=(r=>(r.ELLIPSE="ELLIPSE",r.POLYGON="POLYGON",r.RECTANGLE="RECTANGLE",r))(Ni||{});const Pl=(r,t)=>t,Uw=r=>{let t=1/0,e=1/0,i=-1/0,s=-1/0;return r.forEach(([n,o])=>{t=Math.min(t,n),e=Math.min(e,o),i=Math.max(i,n),s=Math.max(s,o)}),{minX:t,minY:e,maxX:i,maxY:s}},kw={area:r=>Math.PI*r.geometry.rx*r.geometry.ry,intersects:(r,t,e)=>{const{cx:i,cy:s,rx:n,ry:o}=r.geometry,a=0,l=Math.cos(a),h=Math.sin(a),c=t-i,u=e-s,d=l*c+h*u,f=h*c-l*u;return d*d/(n*n)+f*f/(o*o)<=1}};Pl(Ni.ELLIPSE,kw);const Gw={area:r=>{const{points:t}=r.geometry;let e=0,i=t.length-1;for(let s=0;s<t.length;s++)e+=(t[i][0]+t[s][0])*(t[i][1]-t[s][1]),i=s;return Math.abs(.5*e)},intersects:(r,t,e)=>{const{points:i}=r.geometry;let s=!1;for(let n=0,o=i.length-1;n<i.length;o=n++){const a=i[n][0],l=i[n][1],h=i[o][0],c=i[o][1];l>e!=c>e&&t<(h-a)*(e-l)/(c-l)+a&&(s=!s)}return s}};Pl(Ni.POLYGON,Gw);const $w={area:r=>r.geometry.w*r.geometry.h,intersects:(r,t,e)=>t>=r.geometry.x&&t<=r.geometry.x+r.geometry.w&&e>=r.geometry.y&&e<=r.geometry.y+r.geometry.h};Pl(Ni.RECTANGLE,$w);function Ef(r,t,e){const i=r.slice();return i[10]=t[e],i[12]=e,i}function Tf(r){let t,e;return t=new vs({props:{x:r[10][0],y:r[10][1],scale:r[3]}}),t.$on("pointerdown",function(){Kt(r[9](`HANDLE-${r[12]}`))&&r[9](`HANDLE-${r[12]}`).apply(this,arguments)}),{c(){ee(t.$$.fragment)},m(i,s){Zt(t,i,s),e=!0},p(i,s){r=i;const n={};s&16&&(n.x=r[10][0]),s&16&&(n.y=r[10][1]),s&8&&(n.scale=r[3]),t.$set(n)},i(i){e||(ot(t.$$.fragment,i),e=!0)},o(i){ft(t.$$.fragment,i),e=!1},d(i){Jt(t,i)}}}function Hw(r){let t,e,i,s,n,o,a,l,h,c,u,d=ci(r[4].points),f=[];for(let m=0;m<d.length;m+=1)f[m]=Tf(Ef(r,d,m));const p=m=>ft(f[m],1,1,()=>{f[m]=null});return{c(){t=Tt("polygon"),s=xe(),n=Tt("polygon"),a=xe();for(let m=0;m<f.length;m+=1)f[m].c();l=fr(),B(t,"class","a9s-outer"),B(t,"style",e=r[1]?"display:none;":void 0),B(t,"points",i=r[4].points.map(Af).join(" ")),B(n,"class","a9s-inner a9s-shape-handle"),B(n,"style",r[1]),B(n,"points",o=r[4].points.map(Sf).join(" "))},m(m,_){dt(m,t,_),dt(m,s,_),dt(m,n,_),dt(m,a,_);for(let y=0;y<f.length;y+=1)f[y]&&f[y].m(m,_);dt(m,l,_),h=!0,c||(u=[zt(t,"pointerdown",function(){Kt(r[9]("SHAPE"))&&r[9]("SHAPE").apply(this,arguments)}),zt(n,"pointerdown",function(){Kt(r[9]("SHAPE"))&&r[9]("SHAPE").apply(this,arguments)})],c=!0)},p(m,_){if(r=m,(!h||_&2&&e!==(e=r[1]?"display:none;":void 0))&&B(t,"style",e),(!h||_&16&&i!==(i=r[4].points.map(Af).join(" ")))&&B(t,"points",i),(!h||_&2)&&B(n,"style",r[1]),(!h||_&16&&o!==(o=r[4].points.map(Sf).join(" ")))&&B(n,"points",o),_&536){d=ci(r[4].points);let y;for(y=0;y<d.length;y+=1){const x=Ef(r,d,y);f[y]?(f[y].p(x,_),ot(f[y],1)):(f[y]=Tf(x),f[y].c(),ot(f[y],1),f[y].m(l.parentNode,l))}for(Qe(),y=d.length;y<f.length;y+=1)p(y);tr()}},i(m){if(!h){for(let _=0;_<d.length;_+=1)ot(f[_]);h=!0}},o(m){f=f.filter(Boolean);for(let _=0;_<f.length;_+=1)ft(f[_]);h=!1},d(m){m&&(ht(t),ht(s),ht(n),ht(a),ht(l)),Po(f,m),c=!1,Ke(u)}}}function Xw(r){let t,e;return t=new If({props:{shape:r[0],transform:r[2],editor:r[5],$$slots:{default:[Hw,({grab:i})=>({9:i}),({grab:i})=>i?512:0]},$$scope:{ctx:r}}}),t.$on("change",r[6]),t.$on("grab",r[7]),t.$on("release",r[8]),{c(){ee(t.$$.fragment)},m(i,s){Zt(t,i,s),e=!0},p(i,[s]){const n={};s&1&&(n.shape=i[0]),s&4&&(n.transform=i[2]),s&8730&&(n.$$scope={dirty:s,ctx:i}),t.$set(n)},i(i){e||(ot(t.$$.fragment,i),e=!0)},o(i){ft(t.$$.fragment,i),e=!1},d(i){Jt(t,i)}}}const Af=r=>r.join(","),Sf=r=>r.join(",");function Vw(r,t,e){let i,{shape:s}=t,{computedStyle:n}=t,{transform:o}=t,{viewportScale:a=1}=t;const l=(d,f,p)=>{let m;const _=d.geometry;f==="SHAPE"?m=_.points.map(([x,g])=>[x+p[0],g+p[1]]):m=_.points.map(([x,g],v)=>f===`HANDLE-${v}`?[x+p[0],g+p[1]]:[x,g]);const y=Uw(m);return{...d,geometry:{points:m,bounds:y}}};function h(d){Je.call(this,r,d)}function c(d){Je.call(this,r,d)}function u(d){Je.call(this,r,d)}return r.$$set=d=>{"shape"in d&&e(0,s=d.shape),"computedStyle"in d&&e(1,n=d.computedStyle),"transform"in d&&e(2,o=d.transform),"viewportScale"in d&&e(3,a=d.viewportScale)},r.$$.update=()=>{r.$$.dirty&1&&e(4,i=s.geometry)},[s,n,o,a,i,l,h,c,u]}class zw extends ae{constructor(t){super(),oe(this,t,Vw,Xw,te,{shape:0,computedStyle:1,transform:2,viewportScale:3})}}const Ww=typeof window>"u"||typeof navigator>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0;function jw(r){let t,e,i,s,n,o;return{c(){t=Tt("rect"),B(t,"class",e=ks(`a9s-handle ${r[8].class||""}`.trim())+" svelte-1sgkh33"),B(t,"x",i=r[0]-r[5]/2),B(t,"y",s=r[1]-r[5]/2),B(t,"width",r[5]),B(t,"height",r[5])},m(a,l){dt(a,t,l),n||(o=zt(t,"pointerdown",r[11]),n=!0)},p(a,l){l&256&&e!==(e=ks(`a9s-handle ${a[8].class||""}`.trim())+" svelte-1sgkh33")&&B(t,"class",e),l&33&&i!==(i=a[0]-a[5]/2)&&B(t,"x",i),l&34&&s!==(s=a[1]-a[5]/2)&&B(t,"y",s),l&32&&B(t,"width",a[5]),l&32&&B(t,"height",a[5])},d(a){a&&ht(t),n=!1,o()}}}function Yw(r){let t,e,i,s,n,o,a,l,h;return{c(){t=Tt("g"),e=Tt("circle"),s=Tt("rect"),B(e,"cx",r[0]),B(e,"cy",r[1]),B(e,"r",i=r[3]/r[2]),B(e,"class","a9s-touch-halo svelte-1sgkh33"),Gs(e,"touched",r[4]),B(s,"class",n=ks(`a9s-handle ${r[8].class||""}`.trim())+" svelte-1sgkh33"),B(s,"x",o=r[0]-r[5]/2),B(s,"y",a=r[1]-r[5]/2),B(s,"width",r[5]),B(s,"height",r[5]),B(t,"class","a9s-touch-handle")},m(c,u){dt(c,t,u),Ze(t,e),Ze(t,s),l||(h=[zt(e,"pointerdown",r[10]),zt(e,"pointerdown",r[6]),zt(e,"pointerup",r[7]),zt(s,"pointerdown",r[9]),zt(s,"pointerdown",r[6]),zt(s,"pointerup",r[7])],l=!0)},p(c,u){u&1&&B(e,"cx",c[0]),u&2&&B(e,"cy",c[1]),u&12&&i!==(i=c[3]/c[2])&&B(e,"r",i),u&16&&Gs(e,"touched",c[4]),u&256&&n!==(n=ks(`a9s-handle ${c[8].class||""}`.trim())+" svelte-1sgkh33")&&B(s,"class",n),u&33&&o!==(o=c[0]-c[5]/2)&&B(s,"x",o),u&34&&a!==(a=c[1]-c[5]/2)&&B(s,"y",a),u&32&&B(s,"width",c[5]),u&32&&B(s,"height",c[5])},d(c){c&&ht(t),l=!1,Ke(h)}}}function qw(r){let t;function e(n,o){return Ww?Yw:jw}let s=e()(r);return{c(){s.c(),t=fr()},m(n,o){s.m(n,o),dt(n,t,o)},p(n,[o]){s.p(n,o)},i:Be,o:Be,d(n){n&&ht(t),s.d(n)}}}function Kw(r,t,e){let i,{x:s}=t,{y:n}=t,{scale:o}=t,{radius:a=30}=t,l=!1;const h=p=>{p.pointerType==="touch"&&e(4,l=!0)},c=()=>e(4,l=!1);function u(p){Je.call(this,r,p)}function d(p){Je.call(this,r,p)}function f(p){Je.call(this,r,p)}return r.$$set=p=>{e(8,t=Io(Io({},t),jh(p))),"x"in p&&e(0,s=p.x),"y"in p&&e(1,n=p.y),"scale"in p&&e(2,o=p.scale),"radius"in p&&e(3,a=p.radius)},r.$$.update=()=>{r.$$.dirty&4&&e(5,i=10/o)},t=jh(t),[s,n,o,a,l,i,h,c,t,u,d,f]}class vs extends ae{constructor(t){super(),oe(this,t,Kw,qw,te,{x:0,y:1,scale:2,radius:3})}}function Zw(r){let t,e,i,s,n,o,a,l,h,c,u,d,f,p,m,_,y,x,g,v,w,I,T,C,D,A,P,R,b,M,S,U,L,H,tt,F,k,J,X,K,$,at,vt;return H=new vs({props:{class:"a9s-corner-handle-topleft",x:r[4].x,y:r[4].y,scale:r[3]}}),H.$on("pointerdown",function(){Kt(r[9]("TOP_LEFT"))&&r[9]("TOP_LEFT").apply(this,arguments)}),F=new vs({props:{class:"a9s-corner-handle-topright",x:r[4].x+r[4].w,y:r[4].y,scale:r[3]}}),F.$on("pointerdown",function(){Kt(r[9]("TOP_RIGHT"))&&r[9]("TOP_RIGHT").apply(this,arguments)}),J=new vs({props:{class:"a9s-corner-handle-bottomright",x:r[4].x+r[4].w,y:r[4].y+r[4].h,scale:r[3]}}),J.$on("pointerdown",function(){Kt(r[9]("BOTTOM_RIGHT"))&&r[9]("BOTTOM_RIGHT").apply(this,arguments)}),K=new vs({props:{class:"a9s-corner-handle-bottomleft",x:r[4].x,y:r[4].y+r[4].h,scale:r[3]}}),K.$on("pointerdown",function(){Kt(r[9]("BOTTOM_LEFT"))&&r[9]("BOTTOM_LEFT").apply(this,arguments)}),{c(){t=Tt("rect"),a=xe(),l=Tt("rect"),f=xe(),p=Tt("rect"),x=xe(),g=Tt("rect"),T=xe(),C=Tt("rect"),R=xe(),b=Tt("rect"),L=xe(),ee(H.$$.fragment),tt=xe(),ee(F.$$.fragment),k=xe(),ee(J.$$.fragment),X=xe(),ee(K.$$.fragment),B(t,"class","a9s-outer"),B(t,"style",e=r[1]?"display:none;":void 0),B(t,"x",i=r[4].x),B(t,"y",s=r[4].y),B(t,"width",n=r[4].w),B(t,"height",o=r[4].h),B(l,"class","a9s-inner a9s-shape-handle"),B(l,"style",r[1]),B(l,"x",h=r[4].x),B(l,"y",c=r[4].y),B(l,"width",u=r[4].w),B(l,"height",d=r[4].h),B(p,"class","a9s-edge-handle a9s-edge-handle-top"),B(p,"x",m=r[4].x),B(p,"y",_=r[4].y),B(p,"height",1),B(p,"width",y=r[4].w),B(g,"class","a9s-edge-handle a9s-edge-handle-right"),B(g,"x",v=r[4].x+r[4].w),B(g,"y",w=r[4].y),B(g,"height",I=r[4].h),B(g,"width",1),B(C,"class","a9s-edge-handle a9s-edge-handle-bottom"),B(C,"x",D=r[4].x),B(C,"y",A=r[4].y+r[4].h),B(C,"height",1),B(C,"width",P=r[4].w),B(b,"class","a9s-edge-handle a9s-edge-handle-left"),B(b,"x",M=r[4].x),B(b,"y",S=r[4].y),B(b,"height",U=r[4].h),B(b,"width",1)},m(N,O){dt(N,t,O),dt(N,a,O),dt(N,l,O),dt(N,f,O),dt(N,p,O),dt(N,x,O),dt(N,g,O),dt(N,T,O),dt(N,C,O),dt(N,R,O),dt(N,b,O),dt(N,L,O),Zt(H,N,O),dt(N,tt,O),Zt(F,N,O),dt(N,k,O),Zt(J,N,O),dt(N,X,O),Zt(K,N,O),$=!0,at||(vt=[zt(t,"pointerdown",function(){Kt(r[9]("SHAPE"))&&r[9]("SHAPE").apply(this,arguments)}),zt(l,"pointerdown",function(){Kt(r[9]("SHAPE"))&&r[9]("SHAPE").apply(this,arguments)}),zt(p,"pointerdown",function(){Kt(r[9]("TOP"))&&r[9]("TOP").apply(this,arguments)}),zt(g,"pointerdown",function(){Kt(r[9]("RIGHT"))&&r[9]("RIGHT").apply(this,arguments)}),zt(C,"pointerdown",function(){Kt(r[9]("BOTTOM"))&&r[9]("BOTTOM").apply(this,arguments)}),zt(b,"pointerdown",function(){Kt(r[9]("LEFT"))&&r[9]("LEFT").apply(this,arguments)})],at=!0)},p(N,O){r=N,(!$||O&2&&e!==(e=r[1]?"display:none;":void 0))&&B(t,"style",e),(!$||O&16&&i!==(i=r[4].x))&&B(t,"x",i),(!$||O&16&&s!==(s=r[4].y))&&B(t,"y",s),(!$||O&16&&n!==(n=r[4].w))&&B(t,"width",n),(!$||O&16&&o!==(o=r[4].h))&&B(t,"height",o),(!$||O&2)&&B(l,"style",r[1]),(!$||O&16&&h!==(h=r[4].x))&&B(l,"x",h),(!$||O&16&&c!==(c=r[4].y))&&B(l,"y",c),(!$||O&16&&u!==(u=r[4].w))&&B(l,"width",u),(!$||O&16&&d!==(d=r[4].h))&&B(l,"height",d),(!$||O&16&&m!==(m=r[4].x))&&B(p,"x",m),(!$||O&16&&_!==(_=r[4].y))&&B(p,"y",_),(!$||O&16&&y!==(y=r[4].w))&&B(p,"width",y),(!$||O&16&&v!==(v=r[4].x+r[4].w))&&B(g,"x",v),(!$||O&16&&w!==(w=r[4].y))&&B(g,"y",w),(!$||O&16&&I!==(I=r[4].h))&&B(g,"height",I),(!$||O&16&&D!==(D=r[4].x))&&B(C,"x",D),(!$||O&16&&A!==(A=r[4].y+r[4].h))&&B(C,"y",A),(!$||O&16&&P!==(P=r[4].w))&&B(C,"width",P),(!$||O&16&&M!==(M=r[4].x))&&B(b,"x",M),(!$||O&16&&S!==(S=r[4].y))&&B(b,"y",S),(!$||O&16&&U!==(U=r[4].h))&&B(b,"height",U);const bt={};O&16&&(bt.x=r[4].x),O&16&&(bt.y=r[4].y),O&8&&(bt.scale=r[3]),H.$set(bt);const mt={};O&16&&(mt.x=r[4].x+r[4].w),O&16&&(mt.y=r[4].y),O&8&&(mt.scale=r[3]),F.$set(mt);const yt={};O&16&&(yt.x=r[4].x+r[4].w),O&16&&(yt.y=r[4].y+r[4].h),O&8&&(yt.scale=r[3]),J.$set(yt);const _t={};O&16&&(_t.x=r[4].x),O&16&&(_t.y=r[4].y+r[4].h),O&8&&(_t.scale=r[3]),K.$set(_t)},i(N){$||(ot(H.$$.fragment,N),ot(F.$$.fragment,N),ot(J.$$.fragment,N),ot(K.$$.fragment,N),$=!0)},o(N){ft(H.$$.fragment,N),ft(F.$$.fragment,N),ft(J.$$.fragment,N),ft(K.$$.fragment,N),$=!1},d(N){N&&(ht(t),ht(a),ht(l),ht(f),ht(p),ht(x),ht(g),ht(T),ht(C),ht(R),ht(b),ht(L),ht(tt),ht(k),ht(X)),Jt(H,N),Jt(F,N),Jt(J,N),Jt(K,N),at=!1,Ke(vt)}}}function Jw(r){let t,e;return t=new If({props:{shape:r[0],transform:r[2],editor:r[5],$$slots:{default:[Zw,({grab:i})=>({9:i}),({grab:i})=>i?512:0]},$$scope:{ctx:r}}}),t.$on("grab",r[6]),t.$on("change",r[7]),t.$on("release",r[8]),{c(){ee(t.$$.fragment)},m(i,s){Zt(t,i,s),e=!0},p(i,[s]){const n={};s&1&&(n.shape=i[0]),s&4&&(n.transform=i[2]),s&1562&&(n.$$scope={dirty:s,ctx:i}),t.$set(n)},i(i){e||(ot(t.$$.fragment,i),e=!0)},o(i){ft(t.$$.fragment,i),e=!1},d(i){Jt(t,i)}}}function Qw(r,t,e){let i,{shape:s}=t,{computedStyle:n}=t,{transform:o}=t,{viewportScale:a=1}=t;const l=(d,f,p)=>{const m=d.geometry.bounds;let[_,y]=[m.minX,m.minY],[x,g]=[m.maxX,m.maxY];const[v,w]=p;if(f==="SHAPE")_+=v,x+=v,y+=w,g+=w;else{switch(f){case"TOP":case"TOP_LEFT":case"TOP_RIGHT":{y+=w;break}case"BOTTOM":case"BOTTOM_LEFT":case"BOTTOM_RIGHT":{g+=w;break}}switch(f){case"LEFT":case"TOP_LEFT":case"BOTTOM_LEFT":{_+=v;break}case"RIGHT":case"TOP_RIGHT":case"BOTTOM_RIGHT":{x+=v;break}}}const I=Math.min(_,x),T=Math.min(y,g),C=Math.abs(x-_),D=Math.abs(g-y);return{...d,geometry:{x:I,y:T,w:C,h:D,bounds:{minX:I,minY:T,maxX:I+C,maxY:T+D}}}};function h(d){Je.call(this,r,d)}function c(d){Je.call(this,r,d)}function u(d){Je.call(this,r,d)}return r.$$set=d=>{"shape"in d&&e(0,s=d.shape),"computedStyle"in d&&e(1,n=d.computedStyle),"transform"in d&&e(2,o=d.transform),"viewportScale"in d&&e(3,a=d.viewportScale)},r.$$.update=()=>{r.$$.dirty&1&&e(4,i=s.geometry)},[s,n,o,a,i,l,h,c,u]}class tE extends ae{constructor(t){super(),oe(this,t,Qw,Jw,te,{shape:0,computedStyle:1,transform:2,viewportScale:3})}}Ni.RECTANGLE,Ni.POLYGON;const eE=r=>({}),Cf=r=>({grab:r[0]});function rE(r){let t,e,i,s;const n=r[7].default,o=Hh(n,r,r[6],Cf);return{c(){t=Tt("g"),o&&o.c(),B(t,"class","a9s-annotation selected")},m(a,l){dt(a,t,l),o&&o.m(t,null),e=!0,i||(s=[zt(t,"pointerup",r[2]),zt(t,"pointermove",r[1])],i=!0)},p(a,[l]){o&&o.p&&(!e||l&64)&&zh(o,n,a,a[6],e?Vh(n,a[6],l,eE):Wh(a[6]),Cf)},i(a){e||(ot(o,a),e=!0)},o(a){ft(o,a),e=!1},d(a){a&&ht(t),o&&o.d(a),i=!1,Ke(s)}}}function iE(r,t,e){let{$$slots:i={},$$scope:s}=t;const n=Hs();let{shape:o}=t,{editor:a}=t,{transform:l}=t,h,c,u;const d=m=>_=>{h=m,c=l.elementToImage(_.offsetX,_.offsetY),u=o,_.target.setPointerCapture(_.pointerId),n("grab",_)},f=m=>{if(h){const[_,y]=l.elementToImage(m.offsetX,m.offsetY),x=[_-c[0],y-c[1]];e(3,o=a(u,h,x)),n("change",o)}},p=m=>{m.target.releasePointerCapture(m.pointerId),h=void 0,u=o,n("release",m)};return r.$$set=m=>{"shape"in m&&e(3,o=m.shape),"editor"in m&&e(4,a=m.editor),"transform"in m&&e(5,l=m.transform),"$$scope"in m&&e(6,s=m.$$scope)},[d,f,p,o,a,l,s,i]}class If extends ae{constructor(t){super(),oe(this,t,iE,rE,te,{shape:3,editor:4,transform:5})}}const sE=(r,t)=>{const e=typeof t=="function"?t(r):t;if(e){const{fill:i,fillOpacity:s,stroke:n,strokeWidth:o,strokeOpacity:a}=e;let l="";return i&&(l+=`fill:${i};`,l+=`fill-opacity:${s||"0.25"};`),n&&(l+=`stroke:${n};`,l+=`stroke-width:${o||"1"};`,l+=`stroke-opacity:${a||"1"};`),l}};function nE(r,t,e){let i;const s=Hs();let{annotation:n}=t,{editor:o}=t,{style:a}=t,{target:l}=t,{transform:h}=t,{viewportScale:c}=t,u;return $s(()=>(e(6,u=new o({target:l,props:{shape:n.target.selector,computedStyle:i,transform:h,viewportScale:c}})),u.$on("change",d=>{u.$$set({shape:d.detail}),s("change",d.detail)}),u.$on("grab",d=>s("grab",d.detail)),u.$on("release",d=>s("release",d.detail)),()=>{u.$destroy()})),r.$$set=d=>{"annotation"in d&&e(0,n=d.annotation),"editor"in d&&e(1,o=d.editor),"style"in d&&e(2,a=d.style),"target"in d&&e(3,l=d.target),"transform"in d&&e(4,h=d.transform),"viewportScale"in d&&e(5,c=d.viewportScale)},r.$$.update=()=>{r.$$.dirty&5&&(i=sE(n,a)),r.$$.dirty&65&&n&&(u==null||u.$set({shape:n.target.selector})),r.$$.dirty&80&&u&&u.$set({transform:h}),r.$$.dirty&96&&u&&u.$set({viewportScale:c})},[n,o,a,l,h,c,u]}class oE extends ae{constructor(t){super(),oe(this,t,nE,null,te,{annotation:0,editor:1,style:2,target:3,transform:4,viewportScale:5})}}typeof navigator>"u"?!1:navigator.userAgent.indexOf("Mac OS X")!==-1;const aE=r=>({transform:r&2,scale:r&1}),Rf=r=>({transform:r[1],scale:r[0]});function lE(r){let t;const e=r[4].default,i=Hh(e,r,r[3],Rf);return{c(){i&&i.c()},m(s,n){i&&i.m(s,n),t=!0},p(s,[n]){i&&i.p&&(!t||n&11)&&zh(i,e,s,s[3],t?Vh(e,s[3],n,aE):Wh(s[3]),Rf)},i(s){t||(ot(i,s),t=!0)},o(s){ft(i,s),t=!1},d(s){i&&i.d(s)}}}function hE(r,t,e){let{$$slots:i={},$$scope:s}=t,{viewer:n}=t,o=1,a;const l=()=>{const h=n.viewport.getContainerSize().x,c=n.viewport.getZoom(!0),u=n.viewport.getFlip(),d=n.viewport.pixelFromPoint(new Nt.Point(0,0),!0);u&&(d.x=h-d.x);const f=c*h/n.world.getContentFactor(),p=u?-f:f,m=n.viewport.getRotation(!0);e(1,a=`translate(${d.x}, ${d.y}) scale(${p}, ${f}) rotate(${m})`),e(0,o=c*h/n.world.getContentFactor())};return $s(()=>(n.addHandler("update-viewport",l),()=>{n.removeHandler("update-viewport",l)})),r.$$set=h=>{"viewer"in h&&e(2,n=h.viewer),"$$scope"in h&&e(3,s=h.$$scope)},[o,a,n,s,i]}class Pf extends ae{constructor(t){super(),oe(this,t,hE,lE,te,{viewer:2})}}function cE(r,t,e){const i=Hs();let{drawingMode:s}=t,{target:n}=t,{tool:o}=t,{transform:a}=t,{viewer:l}=t,{viewportScale:h}=t,c;return $s(()=>{const u=n.closest("svg"),d=[],f=(p,m,_)=>{if(u==null||u.addEventListener(p,m,_),d.push(()=>u==null?void 0:u.removeEventListener(p,m,_)),p==="pointerup"||p==="dblclick"){const y=g=>{const{originalEvent:v}=g;m(v)},x=p==="pointerup"?"canvas-click":"canvas-double-click";l.addHandler(x,y),d.push(()=>l.removeHandler(x,y))}else if(p==="pointermove"){const y=x=>{const{originalEvent:g}=x;m(g)};l.addHandler("canvas-drag",y),d.push(()=>l.removeHandler("canvas-drag",y))}};return e(6,c=new o({target:n,props:{addEventListener:f,drawingMode:s,transform:a,viewportScale:h}})),c.$on("create",p=>i("create",p.detail)),()=>{d.forEach(p=>p()),c.$destroy()}}),r.$$set=u=>{"drawingMode"in u&&e(0,s=u.drawingMode),"target"in u&&e(1,n=u.target),"tool"in u&&e(2,o=u.tool),"transform"in u&&e(3,a=u.transform),"viewer"in u&&e(4,l=u.viewer),"viewportScale"in u&&e(5,h=u.viewportScale)},r.$$.update=()=>{r.$$.dirty&72&&c&&c.$set({transform:a}),r.$$.dirty&96&&c&&c.$set({viewportScale:h})},[s,n,o,a,l,h,c]}class uE extends ae{constructor(t){super(),oe(this,t,cE,null,te,{drawingMode:0,target:1,tool:2,transform:3,viewer:4,viewportScale:5})}}function Mf(r,t,e){const i=r.slice();return i[30]=t[e],i}function dE(r){let t=r[2],e,i,s=Bf(r);return{c(){s.c(),e=fr()},m(n,o){s.m(n,o),dt(n,e,o),i=!0},p(n,o){o[0]&4&&te(t,t=n[2])?(Qe(),ft(s,1,1,Be),tr(),s=Bf(n),s.c(),ot(s,1),s.m(e.parentNode,e)):s.p(n,o)},i(n){i||(ot(s),i=!0)},o(n){ft(s),i=!1},d(n){n&&ht(e),s.d(n)}}}function fE(r){let t,e,i=ci(r[6]),s=[];for(let o=0;o<i.length;o+=1)s[o]=Of(Mf(r,i,o));const n=o=>ft(s[o],1,1,()=>{s[o]=null});return{c(){for(let o=0;o<s.length;o+=1)s[o].c();t=fr()},m(o,a){for(let l=0;l<s.length;l+=1)s[l]&&s[l].m(o,a);dt(o,t,a),e=!0},p(o,a){if(a[0]&536895074){i=ci(o[6]);let l;for(l=0;l<i.length;l+=1){const h=Mf(o,i,l);s[l]?(s[l].p(h,a),ot(s[l],1)):(s[l]=Of(h),s[l].c(),ot(s[l],1),s[l].m(t.parentNode,t))}for(Qe(),l=i.length;l<s.length;l+=1)n(l);tr()}},i(o){if(!e){for(let a=0;a<i.length;a+=1)ot(s[a]);e=!0}},o(o){s=s.filter(Boolean);for(let a=0;a<s.length;a+=1)ft(s[a]);e=!1},d(o){o&&ht(t),Po(s,o)}}}function Bf(r){let t,e;return t=new uE({props:{target:r[5],tool:r[7],drawingMode:r[4],transform:{elementToImage:r[9]},viewer:r[3],viewportScale:r[29]}}),t.$on("create",r[13]),{c(){ee(t.$$.fragment)},m(i,s){Zt(t,i,s),e=!0},p(i,s){const n={};s[0]&32&&(n.target=i[5]),s[0]&128&&(n.tool=i[7]),s[0]&16&&(n.drawingMode=i[4]),s[0]&8&&(n.viewer=i[3]),s[0]&536870912&&(n.viewportScale=i[29]),t.$set(n)},i(i){e||(ot(t.$$.fragment,i),e=!0)},o(i){ft(t.$$.fragment,i),e=!1},d(i){Jt(t,i)}}}function Df(r){let t,e;return t=new oE({props:{target:r[5],editor:r[14](r[30].target.selector),annotation:r[30],style:r[1],transform:{elementToImage:r[9]},viewportScale:r[29]}}),t.$on("grab",r[10]),t.$on("change",function(){Kt(r[12](r[30]))&&r[12](r[30]).apply(this,arguments)}),t.$on("release",r[11]),{c(){ee(t.$$.fragment)},m(i,s){Zt(t,i,s),e=!0},p(i,s){r=i;const n={};s[0]&32&&(n.target=r[5]),s[0]&64&&(n.editor=r[14](r[30].target.selector)),s[0]&64&&(n.annotation=r[30]),s[0]&2&&(n.style=r[1]),s[0]&536870912&&(n.viewportScale=r[29]),t.$set(n)},i(i){e||(ot(t.$$.fragment,i),e=!0)},o(i){ft(t.$$.fragment,i),e=!1},d(i){Jt(t,i)}}}function Of(r){let t=r[30].id,e,i,s=Df(r);return{c(){s.c(),e=fr()},m(n,o){s.m(n,o),dt(n,e,o),i=!0},p(n,o){o[0]&64&&te(t,t=n[30].id)?(Qe(),ft(s,1,1,Be),tr(),s=Df(n),s.c(),ot(s,1),s.m(e.parentNode,e)):s.p(n,o)},i(n){i||(ot(s),i=!0)},o(n){ft(s),i=!1},d(n){n&&ht(e),s.d(n)}}}function pE(r){let t,e,i,s,n,o;const a=[fE,dE],l=[];function h(c,u){return c[5]&&c[6]?0:c[5]&&c[7]&&c[0]?1:-1}return~(i=h(r))&&(s=l[i]=a[i](r)),{c(){t=Tt("svg"),e=Tt("g"),s&&s.c(),B(e,"transform",n=r[28]),B(e,"class","svelte-190cqdf"),B(t,"class","a9s-annotationlayer a9s-osd-drawinglayer svelte-190cqdf"),Gs(t,"drawing",r[0])},m(c,u){dt(c,t,u),Ze(t,e),~i&&l[i].m(e,null),r[21](e),o=!0},p(c,u){let d=i;i=h(c),i===d?~i&&l[i].p(c,u):(s&&(Qe(),ft(l[d],1,1,()=>{l[d]=null}),tr()),~i?(s=l[i],s?s.p(c,u):(s=l[i]=a[i](c),s.c()),ot(s,1),s.m(e,null)):s=null),(!o||u[0]&268435456&&n!==(n=c[28]))&&B(e,"transform",n),(!o||u[0]&1)&&Gs(t,"drawing",c[0])},i(c){o||(ot(s),o=!0)},o(c){ft(s),o=!1},d(c){c&&ht(t),~i&&l[i].d(),r[21](null)}}}function mE(r){let t,e;return t=new Pf({props:{viewer:r[3],$$slots:{default:[pE,({transform:i,scale:s})=>({28:i,29:s}),({transform:i,scale:s})=>[(i?268435456:0)|(s?536870912:0)]]},$$scope:{ctx:r}}}),{c(){ee(t.$$.fragment)},m(i,s){Zt(t,i,s),e=!0},p(i,s){const n={};s[0]&8&&(n.viewer=i[3]),s[0]&805306623|s[1]&4&&(n.$$scope={dirty:s,ctx:i}),t.$set(n)},i(i){e||(ot(t.$$.fragment,i),e=!0)},o(i){ft(t.$$.fragment,i),e=!1},d(i){Jt(t,i)}}}function gE(r,t,e){let i,s,n,o,{drawingEnabled:a}=t,{filter:l}=t,{preferredDrawingMode:h}=t,{state:c}=t,{style:u=void 0}=t,{toolName:d=Fs()[0]}=t,{user:f}=t,{viewer:p}=t;const m=navigator.userAgent.match(/firefox|fxios/i);let _;const{store:y,selection:x,hover:g}=c;Ro(r,x,S=>e(20,o=S));let v,w,I;const T=S=>{y.unobserve(v);const U=S.filter(({editable:L})=>L).map(({id:L})=>L);if(U.length>0){if(e(6,w=U.map(L=>y.getAnnotation(L))),v=L=>{const{updated:H}=L.changes;e(6,w=(H||[]).map(tt=>tt.newValue))},y.observe(v,{annotations:U}),m){const{width:L}=p.viewport.viewerElementToViewportRectangle(new Nt.Rect(0,0,1,1));p.viewport.panBy(new Nt.Point(Math.abs(L/10),0))}}else e(6,w=void 0)},C=(S,U)=>{const{x:L,y:H}=p.viewport.viewerElementToImageCoordinates(new Nt.Point(S,U));return[L,H]},D=S=>{p.setMouseNavEnabled(!1),I=S.timeStamp},A=S=>{if(p.setMouseNavEnabled(!0),performance.now()-(I||0)<300){const{offsetX:L,offsetY:H}=S.detail,[tt,F]=C(L,H),k=y.getAt(tt,F);k&&(!l||l(k))&&!w.find(X=>X.id===k.id)&&(g.set(k.id),x.setSelected(k.id))}},P=S=>U=>{var F;const{target:L}=S,H=10*60*1e3,tt=((F=L.creator)==null?void 0:F.id)!==f.id||!L.created||new Date().getTime()-L.created.getTime()>H;y.updateTarget({...L,selector:U.detail,created:tt?L.created:new Date,updated:tt?new Date:void 0,updatedBy:tt?f:void 0})},R=S=>{const U=Nw(),L={id:U,bodies:[],target:{annotation:U,selector:S.detail,creator:f,created:new Date}};y.addAnnotation(L),x.setSelected(L.id),p.setMouseNavEnabled(!0)},b=S=>dh(S);function M(S){Xs[S?"unshift":"push"](()=>{_=S,e(5,_)})}return r.$$set=S=>{"drawingEnabled"in S&&e(0,a=S.drawingEnabled),"filter"in S&&e(15,l=S.filter),"preferredDrawingMode"in S&&e(16,h=S.preferredDrawingMode),"state"in S&&e(17,c=S.state),"style"in S&&e(1,u=S.style),"toolName"in S&&e(2,d=S.toolName),"user"in S&&e(18,f=S.user),"viewer"in S&&e(3,p=S.viewer)},r.$$.update=()=>{r.$$.dirty[0]&4&&e(7,{tool:i,opts:s}=Ls(d)||{tool:void 0,opts:void 0},i,(e(19,s),e(2,d))),r.$$.dirty[0]&589824&&e(4,n=(s==null?void 0:s.drawingMode)||h),r.$$.dirty[0]&25&&(a&&n==="drag"?p.setMouseNavEnabled(!1):p.setMouseNavEnabled(!0)),r.$$.dirty[0]&1&&a&&x.clear(),r.$$.dirty[0]&1048601&&o.selected.length===0&&n==="drag"&&a&&p.setMouseNavEnabled(!1),r.$$.dirty[0]&1048576&&T(o.selected)},[a,u,d,p,n,_,w,i,x,C,D,A,P,R,b,l,h,c,f,s,o,M]}class yE extends ae{constructor(t){super(),oe(this,t,gE,mE,te,{drawingEnabled:0,filter:15,preferredDrawingMode:16,state:17,style:1,toolName:2,user:18,viewer:3},null,[-1,-1])}}function _E(r){let t,e,i,s,n,o,a,l=r[2].appearance.label+"",h,c,u,d;return{c(){t=Tt("g"),e=Tt("rect"),a=Tt("text"),h=Mo(l),B(e,"class","a9s-presence-label-bg svelte-1rehw2p"),B(e,"x",r[0]),B(e,"y",i=r[1]-18/r[3]),B(e,"height",s=18/r[3]),B(e,"fill",n=r[2].appearance.color),B(e,"stroke",o=r[2].appearance.color),B(a,"font-size",c=12/r[3]),B(a,"x",u=r[0]+Math.round(5/r[3])),B(a,"y",d=r[1]-5/r[3]),B(a,"class","svelte-1rehw2p"),B(t,"class","a9s-presence-label")},m(f,p){dt(f,t,p),Ze(t,e),Ze(t,a),Ze(a,h),r[6](t)},p(f,[p]){p&1&&B(e,"x",f[0]),p&10&&i!==(i=f[1]-18/f[3])&&B(e,"y",i),p&8&&s!==(s=18/f[3])&&B(e,"height",s),p&4&&n!==(n=f[2].appearance.color)&&B(e,"fill",n),p&4&&o!==(o=f[2].appearance.color)&&B(e,"stroke",o),p&4&&l!==(l=f[2].appearance.label+"")&&Wg(h,l),p&8&&c!==(c=12/f[3])&&B(a,"font-size",c),p&9&&u!==(u=f[0]+Math.round(5/f[3]))&&B(a,"x",u),p&10&&d!==(d=f[1]-5/f[3])&&B(a,"y",d)},i:Be,o:Be,d(f){f&&ht(t),r[6](null)}}}function vE(r,t,e){let{x:i}=t,{y:s}=t,{user:n}=t,{scale:o}=t,{hAlign:a=null}=t,l;const h=u=>{const d=l.querySelector("text"),f=l.querySelector("rect"),p=d.getBBox().width+10/u;a==="CENTER"&&l.setAttribute("style",`transform: translateX(-${p/2}px)`),f.setAttribute("width",`${p}`)};function c(u){Xs[u?"unshift":"push"](()=>{l=u,e(4,l)})}return r.$$set=u=>{"x"in u&&e(0,i=u.x),"y"in u&&e(1,s=u.y),"user"in u&&e(2,n=u.user),"scale"in u&&e(3,o=u.scale),"hAlign"in u&&e(5,a=u.hAlign)},r.$$.update=()=>{r.$$.dirty&24&&l&&h(o)},[i,s,n,o,l,a,c]}class Ff extends ae{constructor(t){super(),oe(this,t,vE,_E,te,{x:0,y:1,user:2,scale:3,hAlign:5})}}function xE(r){let t,e,i,s,n,o;return e=new Ff({props:{scale:r[1],user:r[0],x:r[3][0],y:r[3][1],hAlign:"CENTER"}}),{c(){t=Tt("g"),ee(e.$$.fragment),i=Tt("polygon"),B(i,"class","a9s-presence-shape a9s-presence-polygon svelte-fgq4n0"),B(i,"stroke",s=r[0].appearance.color),B(i,"fill","transparent"),B(i,"points",n=r[2].points.map(Lf).join(" ")),B(t,"class","a9s-presence-overlay")},m(a,l){dt(a,t,l),Zt(e,t,null),Ze(t,i),o=!0},p(a,[l]){const h={};l&2&&(h.scale=a[1]),l&1&&(h.user=a[0]),l&8&&(h.x=a[3][0]),l&8&&(h.y=a[3][1]),e.$set(h),(!o||l&1&&s!==(s=a[0].appearance.color))&&B(i,"stroke",s),(!o||l&4&&n!==(n=a[2].points.map(Lf).join(" ")))&&B(i,"points",n)},i(a){o||(ot(e.$$.fragment,a),o=!0)},o(a){ft(e.$$.fragment,a),o=!1},d(a){a&&ht(t),Jt(e)}}}const Lf=r=>r.join(",");function bE(r,t,e){let i,s,{annotation:n}=t,{user:o}=t,{scale:a}=t;const l=h=>{let[c,...u]=h.points;return u.forEach(([d,f])=>{f<c[1]&&(c=[d,f])}),c};return r.$$set=h=>{"annotation"in h&&e(4,n=h.annotation),"user"in h&&e(0,o=h.user),"scale"in h&&e(1,a=h.scale)},r.$$.update=()=>{r.$$.dirty&16&&e(2,i=n.target.selector.geometry),r.$$.dirty&4&&e(3,s=l(i))},[o,a,i,s,n]}class wE extends ae{constructor(t){super(),oe(this,t,bE,xE,te,{annotation:4,user:0,scale:1})}}function EE(r){let t,e,i,s,n,o,a,l,h;return e=new Ff({props:{scale:r[1],user:r[0],x:r[2].x,y:r[2].y}}),{c(){t=Tt("g"),ee(e.$$.fragment),i=Tt("rect"),B(i,"class","a9s-presence-shape a9s-presence-rectangle svelte-gze948"),B(i,"stroke",s=r[0].appearance.color),B(i,"fill","transparent"),B(i,"x",n=r[2].x),B(i,"y",o=r[2].y),B(i,"width",a=r[2].w),B(i,"height",l=r[2].h),B(t,"class","a9s-presence-overlay")},m(c,u){dt(c,t,u),Zt(e,t,null),Ze(t,i),h=!0},p(c,[u]){const d={};u&2&&(d.scale=c[1]),u&1&&(d.user=c[0]),u&4&&(d.x=c[2].x),u&4&&(d.y=c[2].y),e.$set(d),(!h||u&1&&s!==(s=c[0].appearance.color))&&B(i,"stroke",s),(!h||u&4&&n!==(n=c[2].x))&&B(i,"x",n),(!h||u&4&&o!==(o=c[2].y))&&B(i,"y",o),(!h||u&4&&a!==(a=c[2].w))&&B(i,"width",a),(!h||u&4&&l!==(l=c[2].h))&&B(i,"height",l)},i(c){h||(ot(e.$$.fragment,c),h=!0)},o(c){ft(e.$$.fragment,c),h=!1},d(c){c&&ht(t),Jt(e)}}}function TE(r,t,e){let i,{annotation:s}=t,{user:n}=t,{scale:o}=t;return r.$$set=a=>{"annotation"in a&&e(3,s=a.annotation),"user"in a&&e(0,n=a.user),"scale"in a&&e(1,o=a.scale)},r.$$.update=()=>{r.$$.dirty&8&&e(2,i=s.target.selector.geometry)},[n,o,i,s]}class AE extends ae{constructor(t){super(),oe(this,t,TE,EE,te,{annotation:3,user:0,scale:1})}}const{Boolean:SE}=Vg;function Nf(r,t,e){const i=r.slice();return i[8]=t[e],i}function Uf(r){let t,e;return t=new Pf({props:{viewer:r[0],$$slots:{default:[RE,({transform:i,scale:s})=>({6:i,7:s}),({transform:i,scale:s})=>(i?64:0)|(s?128:0)]},$$scope:{ctx:r}}}),{c(){ee(t.$$.fragment)},m(i,s){Zt(t,i,s),e=!0},p(i,s){const n={};s&1&&(n.viewer=i[0]),s&2244&&(n.$$scope={dirty:s,ctx:i}),t.$set(n)},i(i){e||(ot(t.$$.fragment,i),e=!0)},o(i){ft(t.$$.fragment,i),e=!1},d(i){Jt(t,i)}}}function kf(r){let t,e,i=ci(r[2]),s=[];for(let o=0;o<i.length;o+=1)s[o]=Gf(Nf(r,i,o));const n=o=>ft(s[o],1,1,()=>{s[o]=null});return{c(){for(let o=0;o<s.length;o+=1)s[o].c();t=fr()},m(o,a){for(let l=0;l<s.length;l+=1)s[l]&&s[l].m(o,a);dt(o,t,a),e=!0},p(o,a){if(a&132){i=ci(o[2]);let l;for(l=0;l<i.length;l+=1){const h=Nf(o,i,l);s[l]?(s[l].p(h,a),ot(s[l],1)):(s[l]=Gf(h),s[l].c(),ot(s[l],1),s[l].m(t.parentNode,t))}for(Qe(),l=i.length;l<s.length;l+=1)n(l);tr()}},i(o){if(!e){for(let a=0;a<i.length;a+=1)ot(s[a]);e=!0}},o(o){s=s.filter(SE);for(let a=0;a<s.length;a+=1)ft(s[a]);e=!1},d(o){o&&ht(t),Po(s,o)}}}function CE(r){let t,e;return t=new wE({props:{annotation:r[8].annotation,user:r[8].selectedBy,scale:r[7]}}),{c(){ee(t.$$.fragment)},m(i,s){Zt(t,i,s),e=!0},p(i,s){const n={};s&4&&(n.annotation=i[8].annotation),s&4&&(n.user=i[8].selectedBy),s&128&&(n.scale=i[7]),t.$set(n)},i(i){e||(ot(t.$$.fragment,i),e=!0)},o(i){ft(t.$$.fragment,i),e=!1},d(i){Jt(t,i)}}}function IE(r){let t,e;return t=new AE({props:{annotation:r[8].annotation,user:r[8].selectedBy,scale:r[7]}}),{c(){ee(t.$$.fragment)},m(i,s){Zt(t,i,s),e=!0},p(i,s){const n={};s&4&&(n.annotation=i[8].annotation),s&4&&(n.user=i[8].selectedBy),s&128&&(n.scale=i[7]),t.$set(n)},i(i){e||(ot(t.$$.fragment,i),e=!0)},o(i){ft(t.$$.fragment,i),e=!1},d(i){Jt(t,i)}}}function Gf(r){let t,e,i,s;const n=[IE,CE],o=[];function a(l,h){return l[8].annotation.target.selector.type===wt.RECTANGLE?0:l[8].annotation.target.selector.type===wt.POLYGON?1:-1}return~(t=a(r))&&(e=o[t]=n[t](r)),{c(){e&&e.c(),i=fr()},m(l,h){~t&&o[t].m(l,h),dt(l,i,h),s=!0},p(l,h){let c=t;t=a(l),t===c?~t&&o[t].p(l,h):(e&&(Qe(),ft(o[c],1,1,()=>{o[c]=null}),tr()),~t?(e=o[t],e?e.p(l,h):(e=o[t]=n[t](l),e.c()),ot(e,1),e.m(i.parentNode,i)):e=null)},i(l){s||(ot(e),s=!0)},o(l){ft(e),s=!1},d(l){l&&ht(i),~t&&o[t].d(l)}}}function RE(r){let t,e,i,s,n=r[2].length>0&&kf(r);return{c(){t=Tt("svg"),e=Tt("g"),n&&n.c(),B(e,"transform",i=r[6]),B(t,"class","a9s-osd-presencelayer svelte-1krwc4m")},m(o,a){dt(o,t,a),Ze(t,e),n&&n.m(e,null),s=!0},p(o,a){o[2].length>0?n?(n.p(o,a),a&4&&ot(n,1)):(n=kf(o),n.c(),ot(n,1),n.m(e,null)):n&&(Qe(),ft(n,1,1,()=>{n=null}),tr()),(!s||a&64&&i!==(i=o[6]))&&B(e,"transform",i)},i(o){s||(ot(n),s=!0)},o(o){ft(n),s=!1},d(o){o&&ht(t),n&&n.d()}}}function PE(r){let t=!!r[1],e,i,s=t&&Uf(r);return{c(){s&&s.c(),e=fr()},m(n,o){s&&s.m(n,o),dt(n,e,o),i=!0},p(n,[o]){o&2&&(t=!!n[1]),t?s?(s.p(n,o),o&2&&ot(s,1)):(s=Uf(n),s.c(),ot(s,1),s.m(e.parentNode,e)):s&&(Qe(),ft(s,1,1,()=>{s=null}),tr())},i(n){i||(ot(s),i=!0)},o(n){ft(s),i=!1},d(n){n&&ht(e),s&&s.d(n)}}}function ME(r,t,e){let{store:i}=t,{viewer:s}=t,{provider:n}=t,o=[],a;const l=(h,c)=>{e(2,o=[...o.filter(({selectedBy:u})=>u.presenceKey!==h.presenceKey),...(c||[]).map(u=>({annotation:i.getAnnotation(u),selectedBy:h}))].filter(({annotation:u})=>(u||console.warn("Selection event on unknown annotation"),!!u))),a&&i.unobserve(a),a=u=>{const{deleted:d,updated:f}=u.changes,p=new Set((d||[]).map(_=>_.id)),m=o.filter(({annotation:_})=>!p.has(_.id)).map(_=>{const y=(f||[]).find(x=>x.oldValue.id===_.annotation.id);return y?{selectedBy:_.selectedBy,annotation:y.newValue}:_});e(2,o=m)},i.observe(a,{annotations:o.map(u=>u.annotation.id)})};return Yg(()=>{a&&i.unobserve(a)}),r.$$set=h=>{"store"in h&&e(3,i=h.store),"viewer"in h&&e(0,s=h.viewer),"provider"in h&&e(1,n=h.provider)},r.$$.update=()=>{r.$$.dirty&2&&n&&n.on("selectionChange",l)},[s,n,o,i]}class BE extends ae{constructor(t){super(),oe(this,t,ME,PE,te,{store:3,viewer:0,provider:1})}}const $f=(r,t)=>{t==="auto"?r.addHandler("open",e=>{const i=r.world.getItemCount();r.world.getItemAt(i-1).addOnceHandler("fully-loaded-change",n=>{const{fullyLoaded:o}=n;if(o){const a=r.canvas.querySelector("canvas"),l=Fh(a);r.element.setAttribute("data-theme",l)}})}):r.element.setAttribute("data-theme",t)},Hf=(r,t,e)=>(i,s={})=>{const n=typeof i=="string"?i:i.id,o=t.getAnnotation(n);if(!o)return;const a=r.container.getBoundingClientRect(),{padding:l}=s;let[h,c,u,d]=l?Array.isArray(l)?l:[l,l,l,l]:[0,0,0,0];h=h/a.height,c=c/a.width,u=u/a.height,d=d/a.width;const{minX:f,minY:p,maxX:m,maxY:_}=o.target.selector.geometry.bounds,y=m-f,x=_-p,g=f-d*y,v=p-h*x,w=y+(c+d)*y,I=x+(h+u)*x,T=r.viewport.imageToViewportRectangle(g,v,w,I);r.viewport[e](T,s.immediately)},DE=(r,t)=>Hf(r,t,"fitBounds"),OE=(r,t)=>Hf(r,t,"fitBoundsWithConstraints"),FE=(r,t={})=>{const e=Nh(t,{drawingEnabled:!1,drawingMode:ch?"drag":"click",userSelectAction:no.EDIT,theme:"light"}),i=Oh(e),{hover:s,selection:n,store:o}=i,a=ap(o),l=lp(i,a,e.adapter,e.autoSave);let h=gp(),c=e.drawingEnabled,u=e.drawingMode;const d=kh(a,r.element),f=new Bw({target:r.element,props:{state:i,viewer:r,style:e.style,filter:void 0}}),p=new BE({target:r.element.querySelector(".openseadragon-canvas"),props:{provider:void 0,store:o,viewer:r}}),m=new yE({target:r.element.querySelector(".openseadragon-canvas"),props:{drawingEnabled:!!c,filter:void 0,preferredDrawingMode:u,state:i,style:e.style,user:h,viewer:r}});f.$on("click",S=>{const{originalEvent:U,annotation:L}=S.detail;L&&!(u==="click"&&c)?n.userSelect(L.id,U):n.isEmpty()||n.clear()}),r.element.addEventListener("pointerdown",S=>{if(s.current){const U=o.getAnnotation(s.current);l.emit("clickAnnotation",U,S)}}),$f(r,e.theme);const _=cp(i,a,e.adapter),y=()=>{f.$destroy(),p.$destroy(),m.$destroy(),d.destroy(),a.destroy()},x=DE(r,o),g=OE(r,o),v=()=>h,w=(S,U,L)=>vh(S,U,L),I=(S,U)=>fh(S,U),T=S=>{if(!Ls(S))throw`No drawing tool named ${S}`;m.$set({toolName:S})},C=S=>{c=S,m.$set({drawingEnabled:c})},D=S=>{f.$set({filter:S}),m.$set({filter:S})},A=S=>{f.$set({style:S}),m.$set({style:S})},P=S=>p.$set({provider:S}),R=S=>$f(r,S),b=S=>{h=S,m.$set({user:S})},M=S=>f.$set({visible:S});return{..._,destroy:y,fitBounds:x,fitBoundsWithConstraints:g,getUser:v,listDrawingTools:Fs,on:l.on,off:l.off,registerDrawingTool:w,registerShapeEditor:I,setDrawingEnabled:C,setDrawingTool:T,setFilter:D,setPresenceProvider:P,setStyle:A,setTheme:R,setUser:b,setVisible:M,state:i,viewer:r}},LE=$g,NE=wt,UE=Pm;Ot.ShapeType=NE,Ot.UserSelectAction=no,Ot.W3CImageFormat=UE,Ot.createBody=Jf,Ot.createImageAnnotator=LE,Ot.createOSDAnnotator=FE,Ot.defaultColorProvider=_p,Object.defineProperty(Ot,Symbol.toStringTag,{value:"Module"})});
1559
1148
  //# sourceMappingURL=annotorious-openseadragon.js.map