1import{W as B_,S as D_}from"./ImageUploader-BRasVFRt.js";import{B as nf}from"./Button-DdWstpV4.js";import{w as zt,I as Ri,a as of,c as _n,h as F_,j as af,S as lf}from"./Index-DVb_ROzf.js";import"./Image-BmjJrZwS.js";/* empty css */import{p as zo}from"./index-DmVQEACr.js";import{_ as O_}from"./__vite-browser-external-DFe-p4yY.js";import{C as N_}from"./Check-Ck0iADAu.js";import{U as L_}from"./Undo-CpmTQw3B.js";import{U as U_}from"./ModifyUpload.svelte_svelte_type_style_lang-CKQj79RQ.js";import{I as xh}from"./Image-Bsh8Umrh.js";import{I as G_}from"./Upload-Cp8Go_XF.js";import{W as H_}from"./SelectSource-BUTGd0YI.js";import{B as $_}from"./BlockLabel-Cka8cDd-.js";import"./Blocks-q6GtJ689.js";import"./Empty-DafbIC7e.js";import"./ShareButton-SPG99KZL.js";import"./DownloadLink-J4qcANcf.js";import"./file-url-DBUt_EAT.js";import"./DropdownArrow-BWSlJ6Xw.js";import"./svelte/svelte.js";const{SvelteComponent:z_,append:jh,attr:Br,detach:X_,init:V_,insert:W_,noop:Xo,safe_not_equal:j_,svg_element:Vo}=window.__gradio__svelte__internal;function Y_(r){let t,e,i;return{c(){t=Vo("svg"),e=Vo("path"),i=Vo("path"),Br(e,"d","M28.828 3.172a4.094 4.094 0 0 0-5.656 0L4.05 22.292A6.954 6.954 0 0 0 2 27.242V30h2.756a6.952 6.952 0 0 0 4.95-2.05L28.828 8.829a3.999 3.999 0 0 0 0-5.657zM10.91 18.26l2.829 2.829l-2.122 2.121l-2.828-2.828zm-2.619 8.276A4.966 4.966 0 0 1 4.756 28H4v-.759a4.967 4.967 0 0 1 1.464-3.535l1.91-1.91l2.829 2.828zM27.415 7.414l-12.261 12.26l-2.829-2.828l12.262-12.26a2.047 2.047 0 0 1 2.828 0a2 2 0 0 1 0 2.828z"),Br(e,"fill","currentColor"),Br(i,"d","M6.5 15a3.5 3.5 0 0 1-2.475-5.974l3.5-3.5a1.502 1.502 0 0 0 0-2.121a1.537 1.537 0 0 0-2.121 0L3.415 5.394L2 3.98l1.99-1.988a3.585 3.585 0 0 1 4.95 0a3.504 3.504 0 0 1 0 4.949L5.439 10.44a1.502 1.502 0 0 0 0 2.121a1.537 1.537 0 0 0 2.122 0l4.024-4.024L13 9.95l-4.025 4.024A3.475 3.475 0 0 1 6.5 15z"),Br(i,"fill","currentColor"),Br(t,"width","100%"),Br(t,"height","100%"),Br(t,"viewBox","0 0 32 32")},m(s,n){W_(s,t,n),jh(t,e),jh(t,i)},p:Xo,i:Xo,o:Xo,d(s){s&&X_(t)}}}let q_=class extends z_{constructor(t){super(),V_(this,t,null,Y_,j_,{})}};const{SvelteComponent:Z_,append:K_,attr:ni,detach:J_,init:Q_,insert:tm,noop:Wo,safe_not_equal:em,svg_element:Yh}=window.__gradio__svelte__internal;function rm(r){let t,e;return{c(){t=Yh("svg"),e=Yh("path"),ni(e,"fill","currentColor"),ni(e,"d","M2.753 2.933a.75.75 0 0 1 .814-.68l3.043.272c2.157.205 4.224.452 5.922.732c1.66.273 3.073.594 3.844.983c.197.1.412.233.578.415c.176.192.352.506.28.9c-.067.356-.304.59-.487.729a3.001 3.001 0 0 1-.695.369c-1.02.404-2.952.79-5.984 1.169c-1.442.18-2.489.357-3.214.522c.205.045.43.089.674.132c.992.174 2.241.323 3.568.437a31.21 31.21 0 0 1 3.016.398c.46.087.893.186 1.261.296c.352.105.707.236.971.412c.13.086.304.225.42.437a.988.988 0 0 1 .063.141A1.75 1.75 0 0 0 14.5 12.25v.158c-.758.154-1.743.302-2.986.444c-2.124.243-3.409.55-4.117.859c-.296.128-.442.236-.508.3c.026.037.073.094.156.17c.15.138.369.29.65.45c.56.316 1.282.61 1.979.838l2.637.814a.75.75 0 1 1-.443 1.433l-2.655-.819c-.754-.247-1.58-.578-2.257-.96a5.082 5.082 0 0 1-.924-.65c-.255-.233-.513-.544-.62-.935c-.12-.441-.016-.88.274-1.244c.261-.328.656-.574 1.113-.773c.92-.4 2.387-.727 4.545-.974c1.366-.156 2.354-.313 3.041-.462a16.007 16.007 0 0 0-.552-.114a29.716 29.716 0 0 0-2.865-.378c-1.352-.116-2.649-.27-3.7-.454c-.524-.092-1-.194-1.395-.307c-.376-.106-.75-.241-1.021-.426a1.186 1.186 0 0 1-.43-.49a.934.934 0 0 1 .059-.873c.13-.213.32-.352.472-.442a3.23 3.23 0 0 1 .559-.251c.807-.287 2.222-.562 4.37-.83c2.695-.338 4.377-.666 5.295-.962c-.638-.21-1.623-.427-2.89-.635c-1.65-.273-3.679-.515-5.816-.718l-3.038-.272a.75.75 0 0 1-.68-.814M17 12.25a.75.75 0 0 0-1.5 0v4.19l-.72-.72a.75.75 0 1 0-1.06 1.06l2 2a.75.75 0 0 0 1.06 0l2-2a.75.75 0 1 0-1.06-1.06l-.72.72z"),ni(t,"xmlns","http://www.w3.org/2000/svg"),ni(t,"width","100%"),ni(t,"height","100%"),ni(t,"viewBox","0 0 24 24")},m(i,s){tm(i,t,s),K_(t,e)},p:Wo,i:Wo,o:Wo,d(i){i&&J_(t)}}}class im extends Z_{constructor(t){super(),Q_(this,t,null,rm,em,{})}}const{SvelteComponent:sm,append:nm,attr:oi,detach:om,init:am,insert:lm,noop:jo,safe_not_equal:hm,svg_element:qh}=window.__gradio__svelte__internal;function cm(r){let t,e;return{c(){t=qh("svg"),e=qh("path"),oi(e,"fill","currentColor"),oi(e,"d","M17 23v-4H7q-.825 0-1.413-.588T5 17V7H1V5h4V1h2v16h16v2h-4v4h-2Zm0-8V7H9V5h8q.825 0 1.413.588T19 7v8h-2Z"),oi(t,"xmlns","http://www.w3.org/2000/svg"),oi(t,"width","100%"),oi(t,"height","100%"),oi(t,"viewBox","0 0 24 24")},m(i,s){lm(i,t,s),nm(t,e)},p:jo,i:jo,o:jo,d(i){i&&om(t)}}}let um=class extends sm{constructor(t){super(),am(this,t,null,cm,hm,{})}};const{SvelteComponent:dm,append:Yo,attr:ue,detach:fm,init:pm,insert:_m,noop:qo,safe_not_equal:mm,svg_element:Bs}=window.__gradio__svelte__internal;function gm(r){let t,e,i,s;return{c(){t=Bs("svg"),e=Bs("g"),i=Bs("path"),s=Bs("path"),ue(i,"fill","currentColor"),ue(i,"d","m5.505 11.41l.53.53l-.53-.53ZM3 14.952h-.75H3ZM9.048 21v.75V21ZM11.41 5.505l-.53-.53l.53.53Zm1.831 12.34a.75.75 0 0 0 1.06-1.061l-1.06 1.06ZM7.216 9.697a.75.75 0 1 0-1.06 1.061l1.06-1.06Zm10.749 2.362l-5.905 5.905l1.06 1.06l5.905-5.904l-1.06-1.06Zm-11.93-.12l5.905-5.905l-1.06-1.06l-5.905 5.904l1.06 1.06Zm0 6.025c-.85-.85-1.433-1.436-1.812-1.933c-.367-.481-.473-.79-.473-1.08h-1.5c0 .749.312 1.375.78 1.99c.455.596 1.125 1.263 1.945 2.083l1.06-1.06Zm-1.06-7.086c-.82.82-1.49 1.488-1.945 2.084c-.468.614-.78 1.24-.78 1.99h1.5c0-.29.106-.6.473-1.08c.38-.498.962-1.083 1.812-1.933l-1.06-1.06Zm7.085 7.086c-.85.85-1.435 1.433-1.933 1.813c-.48.366-.79.472-1.08.472v1.5c.75 0 1.376-.312 1.99-.78c.596-.455 1.264-1.
1125 2.084-1.945l-1.06-1.06Zm-7.085 1.06c.82.82 1.487 1.49 2.084 1.945c.614.468 1.24.78 1.989.78v-1.5c-.29 0-.599-.106-1.08-.473c-.497-.38-1.083-.962-1.933-1.812l-1.06 1.06Zm12.99-12.99c.85.85 1.433 1.436 1.813 1.933c.366.481.472.79.472 1.08h1.5c0-.749-.312-1.375-.78-1.99c-.455-.596-1.125-1.263-1.945-2.083l-1.06 1.06Zm1.06 7.086c.82-.82 1.49-1.488 1.945-2.084c.468-.614.78-1.24.78-1.99h-1.5c0 .29-.106.6-.473 1.08c-.38.498-.962 1.083-1.812 1.933l1.06 1.06Zm0-8.146c-.82-.82-1.487-1.49-2.084-1.945c-.614-.468-1.24-.78-1.989-.78v1.5c.29 0 .599.106 1.08.473c.497.38 1.083.962 1.933 1.812l1.06-1.06Zm-7.085 1.06c.85-.85 1.435-1.433 1.933-1.812c.48-.367.79-.473 1.08-.473v-1.5c-.75 0-1.376.312-1.99.78c-.596.455-1.264 1.125-2.084 1.945l1.06 1.06Zm2.362 10.749L7.216 9.698l-1.06 1.061l7.085 7.085l1.06-1.06Z"),ue(s,"stroke","currentColor"),ue(s,"stroke-linecap","round"),ue(s,"stroke-width","1.5"),ue(s,"d","M9 21h12"),ue(e,"fill","none"),ue(t,"xmlns","http://www.w3.org/2000/svg"),ue(t,"width","100%"),ue(t,"height","100%"),ue(t,"viewBox","0 0 24 24")},m(n,o){_m(n,t,o),Yo(t,e),Yo(e,i),Yo(e,s)},p:qo,i:qo,o:qo,d(n){n&&fm(t)}}}class ym extends dm{constructor(t){super(),pm(this,t,null,gm,mm,{})}}const{SvelteComponent:vm,append:bm,attr:ai,detach:xm,init:wm,insert:Tm,noop:Zo,safe_not_equal:Em,svg_element:Zh}=window.__gradio__svelte__internal;function Am(r){let t,e;return{c(){t=Zh("svg"),e=Zh("path"),ai(e,"fill","currentColor"),ai(e,"d","M21.03 2.97a3.578 3.578 0 0 0-5.06 0L14 4.94l-.013-.013a1.75 1.75 0 0 0-2.475 0l-.585.586a1.75 1.75 0 0 0 0 2.475l.012.012l-6.78 6.78a2.25 2.25 0 0 0-.659 1.592v.687l-1.28 2.347c-.836 1.533.841 3.21 2.374 2.375l2.347-1.28h.688a2.25 2.25 0 0 0 1.59-.66L16 13.061l.012.012a1.75 1.75 0 0 0 2.475 0l.586-.585a1.75 1.75 0 0 0 0-2.475L19.061 10l1.97-1.97a3.578 3.578 0 0 0 0-5.06ZM12 9.061l2.94 2.94l-6.78 6.78a.75.75 0 0 1-.531.22H6.75a.75.75 0 0 0-.359.09l-2.515 1.373a.234.234 0 0 1-.159.032a.264.264 0 0 1-.138-.075a.264.264 0 0 1-.075-.138a.234.234 0 0 1 .033-.158l1.372-2.515A.75.75 0 0 0 5 17.25v-.878a.75.75 0 0 1 .22-.53L12 9.06Z"),ai(t,"xmlns","http://www.w3.org/2000/svg"),ai(t,"width","100%"),ai(t,"height","100%"),ai(t,"viewBox","0 0 24 24")},m(i,s){Tm(i,t,s),bm(t,e)},p:Zo,i:Zo,o:Zo,d(i){i&&xm(t)}}}class Sm extends vm{constructor(t){super(),wm(this,t,null,Am,Em,{})}}const{SvelteComponent:Cm,append:Kh,attr:ee,detach:Im,init:Rm,insert:Pm,noop:Ko,safe_not_equal:Mm,svg_element:Jo}=window.__gradio__svelte__internal;function km(r){let t,e,i;return{c(){t=Jo("svg"),e=Jo("path"),i=Jo("path"),ee(e,"d","M1.35327 10.9495L6.77663 15.158C7.12221 15.4229 7.50051 15.5553 7.91154 15.5553C8.32258 15.5553 8.70126 15.4229 9.0476 15.158L14.471 10.9495"),ee(e,"stroke","currentColor"),ee(e,"stroke-width","1.5"),ee(e,"stroke-linecap","round"),ee(i,"d","M7.23461 11.4324C7.23406 11.432 7.2335 11.4316 7.23295 11.4312L1.81496 7.2268C1.81471 7.22661 1.81446 7.22641 1.8142 7.22621C1.52269 6.99826 1.39429 6.73321 1.39429 6.37014C1.39429 6.00782 1.52236 5.74301 1.81325 5.51507C1.8136 5.5148 1.81394 5.51453 1.81428 5.51426L7.2331 1.30812C7.45645 1.13785 7.67632 1.06653 7.91159 1.06653C8.14692 1.06653 8.36622 1.13787 8.58861 1.30787C8.58915 1.30828 8.58969 1.30869 8.59023 1.30911L14.0082 5.51462C14.0085 5.51485 14.0088 5.51507 14.0091 5.51529C14.3008 5.74345 14.4289 6.00823 14.4289 6.37014C14.4289 6.73356 14.3006 6.99862 14.01 7.22634C14.0096 7.22662 14.0093 7.22689 14.0089 7.22717L8.59007 11.4322C8.36672 11.6024 8.14686 11.6738 7.91159 11.6738C7.67628 11.6738 7.45699 11.6024 7.23461 11.4324Z"),ee(i,"stroke","currentColor"),ee(i,"stroke-width","1.5"),ee(t,"width","100%"),ee(t,"height","100%"),ee(t,"viewBox","0 0 17 17"),ee(t,"fill","none"),ee(t,"xmlns","http://www.w3.org/2000/svg")},m(s,n){Pm(s,t,n),Kh(t,e),Kh(t,i)},p:Ko,i:Ko,o:Ko,d(s){s&&Im(t)}}}class Bm extends Cm{constructor(t){super(),Rm(this,t,null,km,Mm,{})}}const{SvelteComponent:Dm,append:Ji,attr:Gt,detach:Fm,init:Om,insert:Nm,noop:Qo,safe_not_equal:Lm,svg_element:li}=window.__gradio__svelte__internal;function Um(r){let t,e,i,s,n,o;return{c(){t=li("svg"),e=li("g"),i=li("path"),s=li("circle"),n=li("circle"),o=li("path"),Gt(i,"d","M2 12.026c0 5.146 3.867 9.387 8.847 9.96c.735.085 1.447-.228 1.97-.753a1.
168 1.68 0 0 0 0-2.372c-.523-.525-.95-1.307-.555-1.934c1.576-2.508 9.738 3.251 9.738-4.9C22 6.488 17.523 2 12 2S2 6.489 2 12.026Z"),Gt(s,"cx","17.5"),Gt(s,"cy","11.5"),Gt(s,"r",".75"),Gt(n,"cx","6.5"),Gt(n,"cy","11.5"),Gt(n,"r",".75"),Gt(o,"d","M10.335 7a.75.75 0 1 1-1.5 0a.75.75 0 0 1 1.5 0Zm4.915 0a.75.75 0 1 1-1.5 0a.75.75 0 0 1 1.5 0Z"),Gt(e,"fill","none"),Gt(e,"stroke","currentColor"),Gt(e,"stroke-width","1.5"),Gt(t,"xmlns","http://www.w3.org/2000/svg"),Gt(t,"width","100%"),Gt(t,"height","100%"),Gt(t,"viewBox","0 0 24 24")},m(a,l){Nm(a,t,l),Ji(t,e),Ji(e,i),Ji(e,s),Ji(e,n),Ji(e,o)},p:Qo,i:Qo,o:Qo,d(a){a&&Fm(t)}}}class Gm extends Dm{constructor(t){super(),Om(this,t,null,Um,Lm,{})}}const{SvelteComponent:Hm,append:Jh,attr:re,detach:$m,init:zm,insert:Xm,noop:ta,safe_not_equal:Vm,set_style:Wm,svg_element:ea}=window.__gradio__svelte__internal;function jm(r){let t,e,i;return{c(){t=ea("svg"),e=ea("polyline"),i=ea("path"),re(e,"points","1 4 1 10 7 10"),re(i,"d","M3.51 15a9 9 0 1 0 2.13-9.36L1 10"),re(t,"xmlns","http://www.w3.org/2000/svg"),re(t,"width","100%"),re(t,"height","100%"),re(t,"viewBox","0 0 24 24"),re(t,"fill","none"),re(t,"stroke","currentColor"),re(t,"stroke-width","2"),re(t,"stroke-linecap","round"),re(t,"stroke-linejoin","round"),re(t,"class","feather feather-rotate-ccw"),Wm(t,"transform","rotateY(180deg)")},m(s,n){Xm(s,t,n),Jh(t,e),Jh(t,i)},p:ta,i:ta,o:ta,d(s){s&&$m(t)}}}class Ym extends Hm{constructor(t){super(),zm(this,t,null,jm,Vm,{})}}const{SvelteComponent:qm,append:sr,attr:Tt,detach:Zm,init:Km,insert:Jm,noop:ra,safe_not_equal:Qm,svg_element:nr,text:tg}=window.__gradio__svelte__internal;function eg(r){let t,e,i,s,n,o,a,l,h;return{c(){t=nr("svg"),e=nr("defs"),i=nr("style"),s=tg(`.cls-1 { 2 fill: none; 3 }`),n=nr("rect"),o=nr("rect"),a=nr("path"),l=nr("rect"),h=nr("rect"),Tt(n,"x","12"),Tt(n,"y","12"),Tt(n,"width","2"),Tt(n,"height","12"),Tt(o,"x","18"),Tt(o,"y","12"),Tt(o,"width","2"),Tt(o,"height","12"),Tt(a,"d","M4,6V8H6V28a2,2,0,0,0,2,2H24a2,2,0,0,0,2-2V8h2V6ZM8,28V8H24V28Z"),Tt(l,"x","12"),Tt(l,"y","2"),Tt(l,"width","8"),Tt(l,"height","2"),Tt(h,"id","_Transparent_Rectangle_"),Tt(h,"data-name","<Transparent Rectangle>"),Tt(h,"class","cls-1"),Tt(h,"width","32"),Tt(h,"height","32"),Tt(t,"id","icon"),Tt(t,"xmlns","http://www.w3.org/2000/svg"),Tt(t,"viewBox","0 0 32 32"),Tt(t,"fill","currentColor")},m(c,u){Jm(c,t,u),sr(t,e),sr(e,i),sr(i,s),sr(t,n),sr(t,o),sr(t,a),sr(t,l),sr(t,h)},p:ra,i:ra,o:ra,d(c){c&&Zm(t)}}}class rg extends qm{constructor(t){super(),Km(this,t,null,eg,Qm,{})}}const{SvelteComponent:ig,attr:sg,create_slot:ng,detach:og,element:ag,flush:lg,get_all_dirty_from_scope:hg,get_slot_changes:cg,init:ug,insert:dg,safe_not_equal:fg,toggle_class:Qh,transition_in:pg,transition_out:_g,update_slot_base:mg}=window.__gradio__svelte__internal;function gg(r){let t,e;const i=r[2].default,s=ng(i,r,r[1],null);return{c(){t=ag("div"),s&&s.c(),sg(t,"class","svelte-1ua59x3"),Qh(t,"show_border",r[0])},m(n,o){dg(n,t,o),s&&s.m(t,null),e=!0},p(n,[o]){s&&s.p&&(!e||o&2)&&mg(s,i,n,n[1],e?cg(i,n[1],o,null):hg(n[1]),null),(!e||o&1)&&Qh(t,"show_border",n[0])},i(n){e||(pg(s,n),e=!0)},o(n){_g(s,n),e=!1},d(n){n&&og(t),s&&s.d(n)}}}function yg(r,t,e){let{$$slots:i={},$$scope:s}=t,{show_border:n=!1}=t;return r.$$set=o=>{"show_border"in o&&e(0,n=o.show_border),"$$scope"in o&&e(1,s=o.$$scope)},[n,s,i]}class vg extends ig{constructor(t){super(),ug(this,t,yg,gg,fg,{show_border:0})}get show_border(){return this.$$.ctx[0]}set show_border(t){this.$$set({show_border:t}),lg()}}const{SvelteComponent:bg,add_iframe_resize_listener:xg,add_render_callback:wg,attr:Tg,binding_callbacks:Eg,check_outros:Ag,component_subscribe:ia,create_component:hf,create_slot:Sg,destroy_component:cf,detach:Hn,element:Cg,empty:uf,ensure_array_like:tc,flush:Ig,get_all_dirty_from_scope:Rg,get_slot_changes:Pg,group_outros:Mg,init:kg,insert:$n,mount_component:df,outro_and_destroy_block:Bg,safe_not_equal:Dg,set_store_value:ec,space:Fg,transition_in:zn,transition_out:Xn,update_keyed_each:Og,update_slot_base:Ng}=window.__gradio__svelte__internal,{getContext:Lg,setContext:Ug}=window.__gradio__svelte__internal;function rc(r,t,e){const i=r.slice();return i[21]=t[e],i}function ic(r,t){let e,i,s;function n(...o){return t[12](t[21],...o)}return i=new Ri({props:{highlight:t[3]===t[21],Icon:t[7][t[21]].icon,size:"medium",padded:!1,label:t[7][t[21]].label+" button",transparent:!0,offset:t[21]==="draw"?-2:t[21]==="erase"?-6:0}}),i.$on("click",n),{key:r,first:null,c(){e=uf(),hf(i.$$.fragment),this.first=e},m(o,a){$n(o,e,a),df(i,o,a),s=!0},p(o,a){t=o;const l={};a&10&&(l.highlight=t[3]===t[21]),a&2&&(l.Icon=t[7][t[21]].icon),a&2&&(l.label=t[7][t[21]].label+" button"),a&2&&(l.offset=t[21]==="draw"?-2:t[21]==="erase"?-6:0),i.$set(l)},i(o){s||(zn(i.$$.fragment,o),s=!0)},o(o){Xn(i.$$.fragment,o),s=!1},d(o){o&&Hn(e),cf(i,o)}}}function Gg(r){let t=[],e=new Map,i,s,n=tc(r[1]);const o=a=>a[21];for(let a=0;a<n.length;a+=1){let l=rc(r,n,a),h=o(l);e.set(h,t[a]=ic(h,l))}return{c(){for(let a=0;a<t.length;a+=1)t[a].c();i=uf()},m(a,l){for(let h=0;h<t.length;h+=1)t[h]&&t[h].m(a,l);$n(a,i,l),s=!0},p(a,l){l&394&&(n=tc(a[1]),Mg(),t=Og(t,l,o,1,a,n,e,i.parentNode,Bg,ic,i,rc),Ag())},i(a){if(!s){for(let l=0;l<n.length;l+=1)zn(t[l]);s=!0}},o(a){for(let l=0;l<t.length;l+=1)Xn(t[l]);s=!1},d(a){a&&Hn(i);for(let l=0;l<t.length;l+=1)t[l].d(a)}}}function Hg(r){let t,e,i,s,n;const o=r[11].default,a=Sg(o,r,r[15],null);return i=new vg({props:{show_border:!1,$$slots:{default:[Gg]},$$scope:{ctx:r}}}),{c(){a&&a.c(),t=Fg(),e=Cg("div"),hf(i.$$.fragment),Tg(e,"class","toolbar-wrap svelte-k9d7m2"),wg(()=>r[13].call(e))},m(l,h){a&&a.m(l,h),$n(l,t,h),$n(l,e,h),df(i,e,null),s=xg(e,r[13].bind(e)),r[14](e),n=!0},p(l,[h]){a&&a.p&&(!n||h&32768)&&Ng(a,o,l,l[15],n?Pg(o,l[15],h,null):Rg(l[15]),null);const c={};h&32778&&(c.$$scope={dirty:h,ctx:l}),i.$set(c)},i(l){n||(zn(a,l),zn(i.$$.fragment,l),n=!0)},o(l){Xn(a,l),Xn(i.$$.fragment,l),n=!1},d(l){l&&(Hn(t),Hn(e)),a&&a.d(l),cf(i),s(),r[14](null)}}}const xo=Symbol("tool");function $g(r,t,e){let i,s,n,{$$slots:o={},$$scope:a}=t;const{active_tool:l,toolbar_box:h,editor_box:c}=Lg(Zi);ia(r,l,A=>e(3,i=A)),ia(r,h,A=>e(17,s=A)),ia(r,c,A=>e(10,n=A));let{i18n:u}=t,d=[];const f={},_={current_color:zt("#000000"),register_tool:(A,I)=>(e(1,d=[...d,A]),I?.cb&&(f[A]=I.cb),()=>{e(1,d=d.filter(R=>R!==A))}),active_tool:{subscribe:l.subscribe,set:l.set}};
vendor: 12,194 bytes, line 3
3Ug(xo,_);const m={crop:{order:1,label:u("Transform"),icon:um},draw:{order:2,label:u("Draw"),icon:q_},erase:{order:2,label:u("Erase"),icon:ym},bg:{order:0,label:u("Background"),icon:xh}};let g,v;function y(){v&&ec(h,s=v.getBoundingClientRect(),s)}function b(A,I){A.stopPropagation(),ec(l,i=I,i),f[I]&&f[I]()}const E=(A,I)=>b(I,A);function x(){g=this.clientWidth,e(0,g)}function T(A){Eg[A?"unshift":"push"](()=>{v=A,e(2,v)})}return r.$$set=A=>{"i18n"in A&&e(9,u=A.i18n),"$$scope"in A&&e(15,a=A.$$scope)},r.$$.update=()=>{r.$$.dirty&1025&&y()},[g,d,v,i,l,h,c,m,b,u,n,o,E,x,T,a]}class zg extends bg{constructor(t){super(),kg(this,t,$g,Hg,Dg,{i18n:9})}get i18n(){return this.$$.ctx[9]}set i18n(t){this.$$set({i18n:t}),Ig()}}function Vn(r){"@babel/helpers - typeof";return Vn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vn(r)}var Xg=/^\s+/,Vg=/\s+$/;function j(r,t){if(r=r||"",t=t||{},r instanceof j)return r;if(!(this instanceof j))return new j(r,t);var e=Wg(r);this._originalInput=r,this._r=e.r,this._g=e.g,this._b=e.b,this._a=e.a,this._roundA=Math.round(100*this._a)/100,this._format=t.format||e.format,this._gradientType=t.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=e.ok}j.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(t.r*299+t.g*587+t.b*114)/1e3},getLuminance:function(){var t=this.toRgb(),e,i,s,n,o,a;return e=t.r/255,i=t.g/255,s=t.b/255,e<=.03928?n=e/12.92:n=Math.pow((e+.055)/1.055,2.4),i<=.03928?o=i/12.92:o=Math.pow((i+.055)/1.055,2.4),s<=.03928?a=s/12.92:a=Math.pow((s+.055)/1.055,2.4),.2126*n+.7152*o+.0722*a},setAlpha:function(t){return this._a=ff(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=nc(this._r,this._g,this._b);return{h:t.h*360,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=nc(this._r,this._g,this._b),e=Math.round(t.h*360),i=Math.round(t.s*100),s=Math.round(t.v*100);return this._a==1?"hsv("+e+", "+i+"%, "+s+"%)":"hsva("+e+", "+i+"%, "+s+"%, "+this._roundA+")"},toHsl:function(){var t=sc(this._r,this._g,this._b);return{h:t.h*360,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=sc(this._r,this._g,this._b),e=Math.round(t.h*360),i=Math.round(t.s*100),s=Math.round(t.l*100);return this._a==1?"hsl("+e+", "+i+"%, "+s+"%)":"hsla("+e+", "+i+"%, "+s+"%, "+this._roundA+")"},toHex:function(t){return oc(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return Zg(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(yt(this._r,255)*100)+"%",g:Math.round(yt(this._g,255)*100)+"%",b:Math.round(yt(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(yt(this._r,255)*100)+"%, "+Math.round(yt(this._g,255)*100)+"%, "+Math.round(yt(this._b,255)*100)+"%)":"rgba("+Math.round(yt(this._r,255)*100)+"%, "+Math.round(yt(this._g,255)*100)+"%, "+Math.round(yt(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:l0[oc(this._r,this._g,this._b,!0)]||!1},toFilter:function(t){var e="#"+ac(this._r,this._g,this._b,this._a),i=e,s=this._gradientType?"GradientType = 1, ":"";if(t){var n=j(t);i="#"+ac(n._r,n._g,n._b,n._a)}return"progid:DXImageTransform.Microsoft.gradient("+s+"startColorstr="+e+",endColorstr="+i+")"},toString:function(t){var e=!!t;t=t||this._format;var i=!1,s=this._a<1&&this._a>=0,n=!e&&s&&(t==="hex"||t==="hex6"||t==="hex3"||t==="hex4"||t==="hex8"||t==="name");return n?t==="name"&&this._a===0?this.toName():this.toRgbString():(t==="rgb"&&(i=this.toRgbString()),t==="prgb"&&(i=this.toPercentageRgbString()),(t==="hex"||t==="hex6")&&(i=this.toHexString()),t==="hex3"&&(i=this.toHexString(!0)),t==="hex4"&&(i=this.toHex8String(!0)),t==="hex8"&&(i=this.toHex8String()),t==="name"&&(i=this.toName()),t==="hsl"&&(i=this.toHslString()),t==="hsv"&&(i=this.toHsvString()),i||this.toHexString())},clone:function(){return j(this.toString())},_applyModification:function(t,e){var i=t.apply(null,[this].concat([].slice.call(e)));return this._r=i._r,this._g=i._g,this._b=i._b,this.setAlpha(i._a),this},lighten:function(){return this._applyModification(t0,arguments)},brighten:function(){return this._applyModification(e0,arguments)},darken:function(){return this._applyModification(r0,arguments)},desaturate:function(){return this._applyModification(Kg,arguments)},saturate:function(){return this._applyModification(Jg,arguments)},greyscale:function(){return this._applyModification(Qg,arguments)},spin:function(){return this._applyModification(i0,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(o0,arguments)},complement:function(){return this._applyCombination(s0,arguments)},monochromatic:function(){return this._applyCombination(a0,arguments)},splitcomplement:function(){return this._applyCombination(n0,arguments)},triad:function(){return this._applyCombination(lc,[3])},tetrad:function(){return this._applyCombination(lc,[4])}};j.fromRatio=function(r,t){if(Vn(r)=="object"){var e={};for(var i in r)r.hasOwnProperty(i)&&(i==="a"?e[i]=r[i]:e[i]=as(r[i]));r=e}return j(r,t)};function Wg(r){var t={r:0,g:0,b:0},e=1,i=null,s=null,n=null,o=!1,a=!1;return typeof r=="string"&&(r=d0(r)),Vn(r)=="object"&&(He(r.r)&&He(r.g)&&He(r.b)?(t=jg(r.r,r.g,r.b),o=!0,a=String(r.r).substr(-1)==="%"?"prgb":"rgb"):He(r.h)&&He(r.s)&&He(r.v)?(i=as(r.s),s=as(r.v),t=qg(r.h,i,s),o=!0,a="hsv"):He(r.h)&&He(r.s)&&He(r.l)&&(i=as(r.s),n=as(r.l),t=Yg(r.h,i,n),o=!0,a="hsl"),r.hasOwnProperty("a")&&(e=r.a)),e=ff(e),{ok:o,format:r.format||a,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:e}}function jg(r,t,e){return{r:yt(r,255)*255,g:yt(t,255)*255,b:yt(e,255)*255}}function sc(r,t,e){r=yt(r,255),t=yt(t,255),e=yt(e,255);var i=Math.max(r,t,e),s=Math.min(r,t,e),n,o,a=(i+s)/2;if(i==s)n=o=0;else{var l=i-s;switch(o=a>.5?l/(2-i-s):l/(i+s),i){case r:n=(t-e)/l+(t<e?6:0);break;case t:n=(e-r)/l+2;break;case e:n=(r-t)/l+4;break}n/=6}return{h:n,s:o,l:a}}function Yg(r,t,e){var i,s,n;r=yt(r,360),t=yt(t,100),e=yt(e,100);function o(h,c,u){return u<0&&(u+=1),u>1&&(u-=1),u<1/6?h+(c-h)*6*u:u<1/2?c:u<2/3?h+(c-h)*(2/3-u)*6:h}if(t===0)i=s=n=e;else{var a=e<.5?e*(1+t):e+t-e*t,l=2*e-a;i=o(l,a,r+1/3),s=o(l,a,r),n=o(l,a,r-1/3)}return{r:i*255,g:s*255,b:n*255}}function nc(r,t,e){r=yt(r,255),t=yt(t,255),e=yt(e,255);var i=Math.max(r,t,e),s=Math.min(r,t,e),n,o,a=i,l=i-s;if(o=i===0?0:l/i,i==s)n=0;else{switch(i){case r:n=(t-e)/l+(t<e?6:0);break;case t:n=(e-r)/l+2;break;case e:n=(r-t)/l+4;break}n/=6}return{h:n,s:o,v:a}}function qg(r,t,e){r=yt(r,360)*6,t=yt(t,100),e=yt(e,100);var i=Math.floor(r),s=r-i,n=e*(1-t),o=e*(1-s*t),a=e*(1-(1-s)*t),l=i%6,h=[e,o,n,n,a,e][l],c=[a,e,e,o,n,n][l],u=[n,n,a,e,e,o][l];return{r:h*255,g:c*255,b:u*255}}function oc(r,t,e,i){var s=[be(Math.round(r).toString(16)),be(Math.round(t).toString(16)),be(Math.round(e).toString(16))];return i&&s[0].charAt(0)==s[0].charAt(1)&&s[1].charAt(0)==s[1].charAt(1)&&s[2].charAt(0)==s[2].charAt(1)?s[0].charAt(0)+s[1].charAt(0)+s[2].charAt(0):s.join("")}function Zg(r,t,e,i,s){var n=[be(Math.round(r).toString(16)),be(Math.round(t).toString(16)),be(Math.round(e).toString(16)),be(pf(i))];return s&&n[0].charAt(0)==n[0].charAt(1)&&n[1].charAt(0)==n[1].charAt(1)&&n[2].charAt(0)==n[2].charAt(1)&&n[3].charAt(0)==n[3].charAt(1)?n[0].charAt(0)+n[1].charAt(0)+n[2].charAt(0)+n[3].charAt(0):n.join("")}function ac(r,t,e,i){var s=[be(pf(i)),be(Math.round(r).toString(16)),be(Math.round(t).toString(16)),be(Math.round(e).toString(16))];return s.join("")}j.equals=function(r,t){return!r||!t?!1:j(r).toRgbString()==j(t).toRgbString()};j.random=function(){return j.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function Kg(r,t){t=t===0?0:t||10;var e=j(r).toHsl();return e.s-=t/100,e.s=wo(e.s),j(e)}function Jg(r,t){t=t===0?0:t||10;var e=j(r).toHsl();return e.s+=t/100,e.s=wo(e.s),j(e)}function Qg(r){return j(r).desaturate(100)}function t0(r,t){t=t===0?0:t||10;var e=j(r).toHsl();return e.l+=t/100,e.l=wo(e.l),j(e)}function e0(r,t){t=t===0?0:t||10;var e=j(r).toRgb();return e.r=Math.max(0,Math.min(255,e.r-Math.round(255*-(t/100)))),e.g=Math.max(0,Math.min(255,e.g-Math.round(255*-(t/100)))),e.b=Math.max(0,Math.min(255,e.b-Math.round(255*-(t/100)))),j(e)}function r0(r,t){t=t===0?0:t||10;var e=j(r).toHsl();return e.l-=t/100,e.l=wo(e.l),j(e)}function i0(r,t){var e=j(r).toHsl(),i=(e.h+t)%360;return e.h=i<0?360+i:i,j(e)}function s0(r){var t=j(r).toHsl();return t.h=(t.h+180)%360,j(t)}function lc(r,t){if(isNaN(t)||t<=0)throw new Error("Argument to polyad must be a positive number");for(var e=j(r).toHsl(),i=[j(r)],s=360/t,n=1;n<t;n++)i.push(j({h:(e.h+n*s)%360,s:e.s,l:e.l}));return i}function n0(r){var t=j(r).toHsl(),e=t.h;return[j(r),j({h:(e+72)%360,s:t.s,l:t.l}),j({h:(e+216)%360,s:t.s,l:t.l})]}function o0(r,t,e){t=t||6,e=e||30;var i=j(r).toHsl(),s=360/e,n=[j(r)];for(i.h=(i.h-(s*t>>1)+720)%360;--t;)i.h=(i.h+s)%360,n.push(j(i));return n}function a0(r,t){t=t||6;for(var e=j(r).toHsv(),i=e.h,s=e.s,n=e.v,o=[],a=1/t;t--;)o.push(j({h:i,s,v:n})),n=(n+a)%1;return o}j.mix=function(r,t,e){e=e===0?0:e||50;var i=j(r).toRgb(),s=j(t).toRgb(),n=e/100,o={r:(s.r-i.r)*n+i.r,g:(s.g-i.g)*n+i.g,b:(s.b-i.b)*n+i.b,a:(s.a-i.a)*n+i.a};return j(o)};j.readability=function(r,t){var e=j(r),i=j(t);return(Math.max(e.getLuminance(),i.getLuminance())+.05)/(Math.min(e.getLuminance(),i.getLuminance())+.05)};j.isReadable=function(r,t,e){var i=j.readability(r,t),s,n;switch(n=!1,s=f0(e),s.level+s.size){case"AAsmall":case"AAAlarge":n=i>=4.5;break;case"AAlarge":n=i>=3;break;case"AAAsmall":n=i>=7;break}return n};j.mostReadable=function(r,t,e){var i=null,s=0,n,o,a,l;e=e||{},o=e.includeFallbackColors,a=e.level,l=e.size;for(var h=0;h<t.length;h++)n=j.readability(r,t[h]),n>s&&(s=n,i=j(t[h]));return j.isReadable(r,i,{level:a,size:l})||!o?i:(e.includeFallbackColors=!1,j.mostReadable(r,["#fff","#000"],e))};var dl=j.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee9
30",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},l0=j.hexNames=h0(dl);function h0(r){var t={};for(var e in r)r.hasOwnProperty(e)&&(t[r[e]]=e);return t}function ff(r){return r=parseFloat(r),(isNaN(r)||r<0||r>1)&&(r=1),r}function yt(r,t){c0(r)&&(r="100%");var e=u0(r);return r=Math.min(t,Math.max(0,parseFloat(r))),e&&(r=parseInt(r*t,10)/100),Math.abs(r-t)<1e-6?1:r%t/parseFloat(t)}function wo(r){return Math.min(1,Math.max(0,r))}function Yt(r){return parseInt(r,16)}function c0(r){return typeof r=="string"&&r.indexOf(".")!=-1&&parseFloat(r)===1}function u0(r){return typeof r=="string"&&r.indexOf("%")!=-1}function be(r){return r.length==1?"0"+r:""+r}function as(r){return r<=1&&(r=r*100+"%"),r}function pf(r){return Math.round(parseFloat(r)*255).toString(16)}function hc(r){return Yt(r)/255}var _e=function(){var r="[-\\+]?\\d+%?",t="[-\\+]?\\d*\\.\\d+%?",e="(?:"+t+")|(?:"+r+")",i="[\\s|\\(]+("+e+")[,|\\s]+("+e+")[,|\\s]+("+e+")\\s*\\)?",s="[\\s|\\(]+("+e+")[,|\\s]+("+e+")[,|\\s]+("+e+")[,|\\s]+("+e+")\\s*\\)?";return{CSS_UNIT:new RegExp(e),rgb:new RegExp("rgb"+i),rgba:new RegExp("rgba"+s),hsl:new RegExp("hsl"+i),hsla:new RegExp("hsla"+s),hsv:new RegExp("hsv"+i),hsva:new RegExp("hsva"
3+s),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function He(r){return!!_e.CSS_UNIT.exec(r)}function d0(r){r=r.replace(Xg,"").replace(Vg,"").toLowerCase();var t=!1;if(dl[r])r=dl[r],t=!0;else if(r=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var e;return(e=_e.rgb.exec(r))?{r:e[1],g:e[2],b:e[3]}:(e=_e.rgba.exec(r))?{r:e[1],g:e[2],b:e[3],a:e[4]}:(e=_e.hsl.exec(r))?{h:e[1],s:e[2],l:e[3]}:(e=_e.hsla.exec(r))?{h:e[1],s:e[2],l:e[3],a:e[4]}:(e=_e.hsv.exec(r))?{h:e[1],s:e[2],v:e[3]}:(e=_e.hsva.exec(r))?{h:e[1],s:e[2],v:e[3],a:e[4]}:(e=_e.hex8.exec(r))?{r:Yt(e[1]),g:Yt(e[2]),b:Yt(e[3]),a:hc(e[4]),format:t?"name":"hex8"}:(e=_e.hex6.exec(r))?{r:Yt(e[1]),g:Yt(e[2]),b:Yt(e[3]),format:t?"name":"hex"}:(e=_e.hex4.exec(r))?{r:Yt(e[1]+""+e[1]),g:Yt(e[2]+""+e[2]),b:Yt(e[3]+""+e[3]),a:hc(e[4]+""+e[4]),format:t?"name":"hex8"}:(e=_e.hex3.exec(r))?{r:Yt(e[1]+""+e[1]),g:Yt(e[2]+""+e[2]),b:Yt(e[3]+""+e[3]),format:t?"name":"hex"}:!1}function f0(r){var t,e;return r=r||{level:"AA",size:"small"},t=(r.level||"AA").toUpperCase(),e=(r.size||"small").toLowerCase(),t!=="AA"&&t!=="AAA"&&(t="AA"),e!=="small"&&e!=="large"&&(e="small"),{level:t,size:e}}var ii=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(ii||{}),_f=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(_f||{}),fl=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(fl||{}),J=(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))(J||{}),Oe=(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))(Oe||{}),N=(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))(N||{}),Pi=(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))(Pi||{}),K=(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))(K||{}),$=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))($||{}),Ze=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(Ze||{}),br=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(br||{}),Ue=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(Ue||{}),Wt=(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))(Wt||{}),ke=(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))(ke||{}),wh=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(wh||{}),le=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(le||{}),Ct=(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))(Ct||{}),At=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(At||{}),Ne=(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))(Ne||{});const p0={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")},z={ADAPTER:p0,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};var sa=/iPhone/i,cc=/iPod/i,uc=/iPad/i,dc=/\biOS-universal(?:.+)Mac\b/i,na=/\bAndroid(?:.+)Mobile\b/i,fc=/Android/i,hi=/(?:SD4930UR|\bSilk(?:.
vendor: 5,234 bytes, line 3
3+)Mobile\b)/i,Ds=/Silk/i,$e=/Windows Phone/i,pc=/\bWindows(?:.+)ARM\b/i,_c=/BlackBerry/i,mc=/BB10/i,gc=/Opera Mini/i,yc=/\b(CriOS|Chrome)(?:.+)Mobile/i,vc=/Mobile(?:.+)Firefox\b/i,bc=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"};function _0(r){return function(t){return t.test(r)}}function xc(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=_0(e),n={apple:{phone:s(sa)&&!s($e),ipod:s(cc),tablet:!s(sa)&&(s(uc)||bc(t))&&!s($e),universal:s(dc),device:(s(sa)||s(cc)||s(uc)||s(dc)||bc(t))&&!s($e)},amazon:{phone:s(hi),tablet:!s(hi)&&s(Ds),device:s(hi)||s(Ds)},android:{phone:!s($e)&&s(hi)||!s($e)&&s(na),tablet:!s($e)&&!s(hi)&&!s(na)&&(s(Ds)||s(fc)),device:!s($e)&&(s(hi)||s(Ds)||s(na)||s(fc))||s(/\bokhttp\b/i)},windows:{phone:s($e),tablet:s(pc),device:s($e)||s(pc)},other:{blackberry:s(_c),blackberry10:s(mc),opera:s(gc),firefox:s(vc),chrome:s(yc),device:s(_c)||s(mc)||s(gc)||s(vc)||s(yc)},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 m0=xc.default??xc,Ke=m0(globalThis.navigator);z.RETINA_PREFIX=/@([0-9\.]+)x/;z.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var mf={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 _=e?e+h:h;if(!this._events[_])return!1;var m=this._events[_],g=arguments.length,v,y;if(m.fn){switch(m.once&&this.removeListener(h,m.fn,void 0,!0),g){case 1:return m.fn.call(m.context),!0;case 2:return m.fn.call(m.context,c),!0;case 3:return m.fn.call(m.context,c,u),!0;case 4:return m.fn.call(m.context,c,u,d),!0;case 5:return m.fn.call(m.context,c,u,d,f),!0;case 6:return m.fn.call(m.context,c,u,d,f,p),!0}for(y=1,v=new Array(g-1);y<g;y++)v[y-1]=arguments[y];m.fn.apply(m.context,v)}else{var b=m.length,E;for(y=0;y<b;y++)switch(m[y].once&&this.removeListener(h,m[y].fn,void 0,!0),g){case 1:m[y].fn.call(m[y].context);break;case 2:m[y].fn.call(m[y].context,c);break;case 3:m[y].fn.call(m[y].context,c,u);break;case 4:m[y].fn.call(m[y].context,c,u,d);break;default:if(!v)for(E=1,v=new Array(g-1);E<g;E++)v[E-1]=arguments[E];m[y].fn.apply(m[y].context,v)}}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 _=0,m=[],g=p.length;_<g;_++)(p[_].fn!==c||d&&!p[_].once||u&&p[_].context!==u)&&m.push(p[_]);m.length?this._events[f]=m.length===1?m[0]:m: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})(mf);var g0=mf.exports;const Rs=of(g0);var Th={exports:{}};Th.exports=To;Th.exports.default=To;function To(r,t,e){e=e||2;var i=t&&t.length,s=i?t[0]*e:r.length,n=gf(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=w0(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 Es(n,o,e,a,l,f,0),o}function gf(r,t,e,i,s){var n,o;if(s===ml(r,t,e,i)>0)for(n=t;n<e;n+=i)o=wc(n,r[n],r[n+1],o);else for(n=e-i;n>=t;n-=i)o=wc(n,r[n],r[n+1],o);return o&&Eo(o,o.next)&&(Ss(o),o=o.next),o}function Qr(r,t){if(!r)return r;t||(t=r);var e=r,i;do if(i=!1,!e.steiner&&(Eo(e,e.next)||bt(e.prev,e,e.next)===0)){if(Ss(e),e=t=e.prev,e===e.next)break;
vendor: 4,917 bytes, line 3
3i=!0}else e=e.next;while(i||e!==t);return t}function Es(r,t,e,i,s,n,o){if(r){!o&&n&&C0(r,i,s,n);for(var a=r,l,h;r.prev!==r.next;){if(l=r.prev,h=r.next,n?v0(r,i,s,n):y0(r)){t.push(l.i/e|0),t.push(r.i/e|0),t.push(h.i/e|0),Ss(r),r=h.next,a=h.next;continue}if(r=h,r===a){o?o===1?(r=b0(Qr(r),t,e),Es(r,t,e,i,s,n,2)):o===2&&x0(r,t,e,i,s,n):Es(Qr(r),t,e,i,s,n,1);break}}}}function y0(r){var t=r.prev,e=r,i=r.next;if(bt(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&&Ci(s,a,n,l,o,h,p.x,p.y)&&bt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function v0(r,t,e,i){var s=r.prev,n=r,o=r.next;if(bt(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,_=a>l?a>h?a:h:l>h?l:h,m=c>u?c>d?c:d:u>d?u:d,g=pl(f,p,t,e,i),v=pl(_,m,t,e,i),y=r.prevZ,b=r.nextZ;y&&y.z>=g&&b&&b.z<=v;){if(y.x>=f&&y.x<=_&&y.y>=p&&y.y<=m&&y!==s&&y!==o&&Ci(a,c,l,u,h,d,y.x,y.y)&&bt(y.prev,y,y.next)>=0||(y=y.prevZ,b.x>=f&&b.x<=_&&b.y>=p&&b.y<=m&&b!==s&&b!==o&&Ci(a,c,l,u,h,d,b.x,b.y)&&bt(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;y&&y.z>=g;){if(y.x>=f&&y.x<=_&&y.y>=p&&y.y<=m&&y!==s&&y!==o&&Ci(a,c,l,u,h,d,y.x,y.y)&&bt(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;b&&b.z<=v;){if(b.x>=f&&b.x<=_&&b.y>=p&&b.y<=m&&b!==s&&b!==o&&Ci(a,c,l,u,h,d,b.x,b.y)&&bt(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function b0(r,t,e){var i=r;do{var s=i.prev,n=i.next.next;!Eo(s,n)&&yf(s,i,i.next,n)&&As(s,n)&&As(n,s)&&(t.push(s.i/e|0),t.push(i.i/e|0),t.push(n.i/e|0),Ss(i),Ss(i.next),i=r=n),i=i.next}while(i!==r);return Qr(i)}function x0(r,t,e,i,s,n){var o=r;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&P0(o,a)){var l=vf(o,a);o=Qr(o,o.next),l=Qr(l,l.next),Es(o,t,e,i,s,n,0),Es(l,t,e,i,s,n,0);return}a=a.next}o=o.next}while(o!==r)}function w0(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=gf(r,a,l,i,!1),h===h.next&&(h.steiner=!0),s.push(R0(h));for(s.sort(T0),n=0;n<s.length;n++)e=E0(s[n],e);return e}function T0(r,t){return r.x-t.x}function E0(r,t){var e=A0(r,t);if(!e)return t;var i=vf(e,r);return Qr(i,i.next),Qr(e,e.next)}function A0(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&&Ci(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),As(e,r)&&(d<u||d===u&&(e.x>o.x||e.x===o.x&&S0(o,e)))&&(o=e,u=d)),e=e.next;while(e!==l);return o}function S0(r,t){return bt(r.prev,r,t.prev)<0&&bt(t.next,r,r.next)<0}function C0(r,t,e,i){var s=r;do s.z===0&&(s.z=pl(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,I0(s)}function I0(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 pl(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 R0(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 Ci(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 P0(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!M0(r,t)&&(As(r,t)&&As(t,r)&&k0(r,t)&&(bt(r.prev,r,t.prev)||bt(r,t.prev,t))||Eo(r,t)&&bt(r.prev,r,r.next)>0&&bt(t.prev,t,t.next)>0)}function bt(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function Eo(r,t){return r.x===t.x&&r.y===t.y}function yf(r,t,e,i){var s=Os(bt(r,t,e)),n=Os(bt(r,t,i)),o=Os(bt(e,i,r)),a=Os(bt(e,i,t));return!!(s!==n&&o!==a||s===0&&Fs(r,e,t)||n===0&&Fs(r,i,t)||o===0&&Fs(e,r,i)||a===0&&Fs(e,t,i))}function Fs(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 Os(r){return r>0?1:r<0?-1:0}function M0(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&&yf(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function As(r,t){return bt(r.prev,r,r.next)<0?bt(r,t,r.next)>=0&&bt(r,r.prev,t)>=0:bt(r,t,r.prev)<0||bt(r,r.next,t)<0}function k0(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 vf(r,t){var e=new _l(r.i,r.x,r.y),i=new _l(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 wc(r,t,e,i){var s=new _l(r,t,e);
3return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function Ss(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 _l(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}To.deviation=function(r,t,e,i){var s=t&&t.length,n=s?t[0]*e:r.length,o=Math.abs(ml(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(ml(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 ml(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}To.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 B0=Th.exports;const D0=of(B0);var Wn={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */Wn.exports;(function(r,t){(function(e){var i=t&&!t.nodeType&&t,s=r&&!r.nodeType&&r,n=typeof _n=="object"&&_n;(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--/,g=/[^\x20-\x7E]/,v=/[\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"},b=l-h,E=Math.floor,x=String.fromCharCode,T;function A(w){throw new RangeError(y[w])}function I(w,L){for(var V=w.length,B=[];V--;)B[V]=L(w[V]);return B}function R(w,L){var V=w.split("@"),B="";V.length>1&&(B=V[0]+"@",w=V[1]),w=w.replace(v,".");var tt=w.split("."),lt=I(tt,L).join(".");return B+lt}function P(w){for(var L=[],V=0,B=w.length,tt,lt;V<B;)tt=w.charCodeAt(V++),tt>=55296&&tt<=56319&&V<B?(lt=w.charCodeAt(V++),(lt&64512)==56320?L.push(((tt&1023)<<10)+(lt&1023)+65536):(L.push(tt),V--)):L.push(tt);return L}function M(w){return I(w,function(L){var V="";return L>65535&&(L-=65536,V+=x(L>>>10&1023|55296),L=56320|L&1023),V+=x(L),V}).join("")}function S(w){return w-48<10?w-22:w-65<26?w-65:w-97<26?w-97:l}function C(w,L){return w+22+75*(w<26)-((L!=0)<<5)}function H(w,L,V){var B=0;for(w=V?E(w/d):w>>1,w+=E(w/L);w>b*c>>1;B+=l)w=E(w/b);return E(B+(b+1)*w/(w+u))}function X(w){var L=[],V=w.length,B,tt=0,lt=p,F=f,st,dt,ct,nt,it,ut,D,mt,wt;for(st=w.lastIndexOf(_),st<0&&(st=0),dt=0;dt<st;++dt)w.charCodeAt(dt)>=128&&A("not-basic"),L.push(w.charCodeAt(dt));for(ct=st>0?st+1:0;ct<V;){for(nt=tt,it=1,ut=l;ct>=V&&A("invalid-input"),D=S(w.charCodeAt(ct++)),(D>=l||D>E((a-tt)/it))&&A("overflow"),tt+=D*it,mt=ut<=F?h:ut>=F+c?c:ut-F,!(D<mt);ut+=l)wt=l-mt,it>E(a/wt)&&A("overflow"),it*=wt;B=L.length+1,F=H(tt-nt,B,nt==0),E(tt/B)>a-lt&&A("overflow"),lt+=E(tt/B),tt%=B,L.splice(tt++,0,lt)}return M(L)}function O(w){var L,V,B,tt,lt,F,st,dt,ct,nt,it,ut=[],D,mt,wt,te;for(w=P(w),D=w.length,L=p,V=0,lt=f,F=0;F<D;++F)it=w[F],it<128&&ut.push(x(it));for(B=tt=ut.length,tt&&ut.push(_);B<D;){for(st=a,F=0;F<D;++F)it=w[F],it>=L&&it<st&&(st=it);for(mt=B+1,st-L>E((a-V)/mt)&&A("overflow"),V+=(st-L)*mt,L=st,F=0;F<D;++F)if(it=w[F],it<L&&++V>a&&A("overflow"),it==L){for(dt=V,ct=l;nt=ct<=lt?h:ct>=lt+c?c:ct-lt,!(dt<nt);ct+=l)te=dt-nt,wt=l-nt,ut.push(x(C(nt+te%wt,0))),dt=E(te/wt);ut.push(x(C(dt,0))),lt=H(V,mt,B==tt),V=0,++B}++V,++L}return ut.join("")}function Q(w){return R(w,function(L){return m.test(L)?X(L.slice(4).toLowerCase()):L})}function k(w){return R(w,function(L){return g.test(L)?"xn--"+O(L):L})}if(o={version:"1.4.1",ucs2:{decode:P,encode:M},decode:X,encode:O,toASCII:k,toUnicode:Q},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})(_n)})(Wn,Wn.exports);var F0=Wn.exports,O0=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},Tc=typeof Symbol<"u"&&Symbol,N0=O0,L0=function(){return typeof Tc!="function"||typeof Symbol!="function"||typeof Tc("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:N0()},Ec={foo:{}},U0=Object,G0=function(){return{__proto__:Ec}.foo===Ec.foo&&!({__proto__:null}instanceof U0)},H0="Function.prototype.bind called on incompatible ",$0=Object.prototype.toString,z0=Math.max,X0="[object Function]",Ac=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},V0=function(t,e){for(var i=[],s=e,n=0;s<t.length;s+=1,n+=1)i[n]=t[s];return i},W0=function(r,t){for(var e="",i=0;i<r.length;i+=1)e+=r[i],i+1<r.length&&(e+=t);return e},j0=function(t){var e=this;if(typeof e!="function"||$0.apply(e)!==X0)throw new TypeError(H0+e);
3for(var i=V0(arguments,1),s,n=function(){if(this instanceof s){var c=e.apply(this,Ac(i,arguments));return Object(c)===c?c:this}return e.apply(t,Ac(i,arguments))},o=z0(0,e.length-i.length),a=[],l=0;l<o;l++)a[l]="$"+l;if(s=Function("binder","return function ("+W0(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},Y0=j0,Eh=Function.prototype.bind||Y0,q0=Function.prototype.call,Z0=Object.prototype.hasOwnProperty,K0=Eh,J0=K0.call(q0,Z0),at,Ui=SyntaxError,bf=Function,Mi=TypeError,oa=function(r){try{return bf('"use strict"; return ('+r+").constructor;")()}catch{}},qr=Object.getOwnPropertyDescriptor;if(qr)try{qr({},"")}catch{qr=null}var aa=function(){throw new Mi},Q0=qr?function(){try{return arguments.callee,aa}catch{try{return qr(arguments,"callee").get}catch{return aa}}}():aa,ci=L0(),t1=G0(),Pt=Object.getPrototypeOf||(t1?function(r){return r.__proto__}:null),vi={},e1=typeof Uint8Array>"u"||!Pt?at:Pt(Uint8Array),Zr={"%AggregateError%":typeof AggregateError>"u"?at:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?at:ArrayBuffer,"%ArrayIteratorPrototype%":ci&&Pt?Pt([][Symbol.iterator]()):at,"%AsyncFromSyncIteratorPrototype%":at,"%AsyncFunction%":vi,"%AsyncGenerator%":vi,"%AsyncGeneratorFunction%":vi,"%AsyncIteratorPrototype%":vi,"%Atomics%":typeof Atomics>"u"?at:Atomics,"%BigInt%":typeof BigInt>"u"?at:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?at:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?at:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?at:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?at:Float32Array,"%Float64Array%":typeof Float64Array>"u"?at:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?at:FinalizationRegistry,"%Function%":bf,"%GeneratorFunction%":vi,"%Int8Array%":typeof Int8Array>"u"?at:Int8Array,"%Int16Array%":typeof Int16Array>"u"?at:Int16Array,"%Int32Array%":typeof Int32Array>
vendor: 6,421 bytes, line 3
3"u"?at:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":ci&&Pt?Pt(Pt([][Symbol.iterator]())):at,"%JSON%":typeof JSON=="object"?JSON:at,"%Map%":typeof Map>"u"?at:Map,"%MapIteratorPrototype%":typeof Map>"u"||!ci||!Pt?at:Pt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?at:Promise,"%Proxy%":typeof Proxy>"u"?at:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?at:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?at:Set,"%SetIteratorPrototype%":typeof Set>"u"||!ci||!Pt?at:Pt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?at:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":ci&&Pt?Pt(""[Symbol.iterator]()):at,"%Symbol%":ci?Symbol:at,"%SyntaxError%":Ui,"%ThrowTypeError%":Q0,"%TypedArray%":e1,"%TypeError%":Mi,"%Uint8Array%":typeof Uint8Array>"u"?at:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?at:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?at:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?at:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?at:WeakMap,"%WeakRef%":typeof WeakRef>"u"?at:WeakRef,"%WeakSet%":typeof WeakSet>"u"?at:WeakSet};if(Pt)try{null.error}catch(r){var r1=Pt(Pt(r));Zr["%Error.prototype%"]=r1}var i1=function r(t){var e;if(t==="%AsyncFunction%")e=oa("async function () {}");else if(t==="%GeneratorFunction%")e=oa("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=oa("async function* () {}");else if(t==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(e=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=r("%AsyncGenerator%");s&&Pt&&(e=Pt(s.prototype))}return Zr[t]=e,e},Sc={"%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"]},Ps=Eh,jn=J0,s1=Ps.call(Function.call,Array.prototype.concat),n1=Ps.call(Function.apply,Array.prototype.splice),Cc=Ps.call(Function.call,String.prototype.replace),Yn=Ps.call(Function.call,String.prototype.slice),o1=Ps.call(Function.call,RegExp.prototype.exec),a1=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,l1=/\\(\\)?/g,h1=function(t){var e=Yn(t,0,1),i=Yn(t,-1);if(e==="%"&&i!=="%")throw new Ui("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&e!=="%")throw new Ui("invalid intrinsic syntax, expected opening `%`");var s=[];return Cc(t,a1,function(n,o,a,l){s[s.length]=a?Cc(l,l1,"$1"):o||n}),s},c1=function(t,e){var i=t,s;if(jn(Sc,i)&&(s=Sc[i],i="%"+s[0]+"%"),jn(Zr,i)){var n=Zr[i];if(n===vi&&(n=i1(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 Ui("intrinsic "+t+" does not exist!")},si=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(o1(/^%?[^%]*%?$/,t)===null)throw new Ui("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=h1(t),s=i.length>0?i[0]:"",n=c1("%"+s+"%",e),o=n.name,a=n.value,l=!1,h=n.alias;h&&(s=h[0],n1(i,s1([0,1],h)));for(var c=1,u=!0;c<i.length;c+=1){var d=i[c],f=Yn(d,0,1),p=Yn(d,-1);if((f==='"'||f==="'"||f==="`"||p==='"'||p==="'"||p==="`")&&f!==p)throw new Ui("property names with quotes must have matching quotes");if((d==="constructor"||!u)&&(l=!0),s+="."+d,o="%"+s+"%",jn(Zr,o))a=Zr[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(qr&&c+1>=i.length){var _=qr(a,d);u=!!_,u&&"get"in _&&!("originalValue"in _.get)?a=_.get:a=a[d]}else u=jn(a,d),a=a[d];u&&!l&&(Zr[o]=a)}}return a},xf={exports:{}},u1=si,gl=u1("%Object.defineProperty%",!0),yl=function(){if(gl)try{return gl({},"a",{value:1}),!0}catch{return!1}return!1};
3yl.hasArrayLengthDefineBug=function(){if(!yl())return null;try{return gl([],"length",{value:1}).length!==1}catch{return!0}};var wf=yl,d1=si,mn=d1("%Object.getOwnPropertyDescriptor%",!0);if(mn)try{mn([],"length")}catch{mn=null}var Tf=mn,f1=wf(),Ah=si,_s=f1&&Ah("%Object.defineProperty%",!0);if(_s)try{_s({},"a",{value:1})}catch{_s=!1}var p1=Ah("%SyntaxError%"),ui=Ah("%TypeError%"),Ic=Tf,_1=function(t,e,i){if(!t||typeof t!="object"&&typeof t!="function")throw new ui("`obj` must be an object or a function`");if(typeof e!="string"&&typeof e!="symbol")throw new ui("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new ui("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new ui("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new ui("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new ui("`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=!!Ic&&Ic(t,e);if(_s)_s(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 p1("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Ef=si,Rc=_1,m1=wf(),Pc=Tf,Mc=Ef("%TypeError%"),g1=Ef("%Math.floor%"),y1=function(t,e){if(typeof t!="function")throw new Mc("`fn` is not a function");if(typeof e!="number"||e<0||e>4294967295||g1(e)!==e)throw new Mc("`length` must be a positive 32-bit integer");var i=arguments.length>2&&!!arguments[2],s=!0,n=!0;if("length"in t&&Pc){var o=Pc(t,"length");o&&!o.configurable&&(s=!1),o&&!o.writable&&(n=!1)}return(s||n||!i)&&(m1?Rc(t,"length",e,!0,!0):Rc(t,"length",e)),t};(function(r){var t=Eh,e=si,i=y1,s=e("%TypeError%"),n=e("%Function.prototype.apply%"),o=e("%Function.prototype.call%"),a=e("%Reflect.apply%",!0)||t.call(o,n),l=e("%Object.defineProperty%",!0),h=e("%Math.max%");if(l)try{l({},"a",{value:1})}catch{l=null}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})(xf);var v1=xf.exports,Af=si,Sf=v1,b1=Sf(Af("String.prototype.indexOf")),x1=function(t,e){var i=Af(t,!!e);return typeof i=="function"&&b1(t,".prototype.")>-1?Sf(i):i};const w1=F_(O_);var Sh=typeof Map=="function"&&Map.prototype,la=Object.getOwnPropertyDescriptor&&Sh?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,qn=Sh&&la&&typeof la.get=="function"?la.get:null,kc=Sh&&Map.prototype.forEach,Ch=typeof Set=="function"&&Set.prototype,ha=Object.getOwnPropertyDescriptor&&Ch?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Zn=Ch&&ha&&typeof ha.get=="function"?ha.get:null,Bc=Ch&&Set.prototype.forEach,T1=typeof WeakMap=="function"&&WeakMap.prototype,ms=T1?WeakMap.prototype.has:null,E1=typeof WeakSet=="function"&&WeakSet.prototype,gs=E1?WeakSet.prototype.has:null,A1=typeof WeakRef=="function"&&WeakRef.prototype,Dc=A1?WeakRef.prototype.deref:null,S1=Boolean.prototype.valueOf,C1=Object.prototype.toString,I1=Function.prototype.toString,R1=String.prototype.match,Ih=String.prototype.slice,_r=String.prototype.replace,P1=String.prototype.toUpperCase,Fc=String.prototype.toLowerCase,Cf=RegExp.prototype.test,Oc=Array.prototype.concat,Be=Array.prototype.join,M1=Array.prototype.slice,Nc=Math.floor,vl=typeof BigInt=="function"?BigInt.prototype.valueOf:null,ca=Object.getOwnPropertySymbols,bl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Gi=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Ut=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Gi||!0)?Symbol.toStringTag:null,If=Object.prototype.propertyIsEnumerable,Lc=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function Uc(r,t){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||Cf.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-Nc(-r):Nc(r);if(i!==r){var s=String(i),n=Ih.call(t,s.length+1);return _r.call(s,e,"$&_")+"."+_r.call(_r.call(n,/([0-9]{3})/g,"$&_"),/_$/,"")}}return _r.call(t,e,"$&_")}var xl=w1,Gc=xl.custom,Hc=Pf(Gc)?Gc:null,k1=function r(t,e,i,s){var n=e||{};if(dr(n,"quoteStyle")&&n.quoteStyle!=="single"&&n.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(dr(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=dr(n,"customInspect")?n.customInspect:!0;if(typeof o!="boolean"&&o!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");
vendor: 11,982 bytes, lines 3-6
3if(dr(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(dr(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 kf(t,n);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var l=String(t);return a?Uc(t,l):l}if(typeof t=="bigint"){var h=String(t)+"n";return a?Uc(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 wl(t)?"[Array]":"[Object]";var u=Z1(n,i);if(typeof s>"u")s=[];else if(Mf(s,t)>=0)return"[Circular]";function d(S,C,H){if(C&&(s=M1.call(s),s.push(C)),H){var X={depth:n.depth};return dr(n,"quoteStyle")&&(X.quoteStyle=n.quoteStyle),r(S,X,i+1,s)}return r(S,n,i+1,s)}if(typeof t=="function"&&!$c(t)){var f=H1(t),p=Ns(t,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+Be.call(p,", ")+" }":"")}if(Pf(t)){var _=Gi?_r.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):bl.call(t);return typeof t=="object"&&!Gi?Qi(_):_}if(j1(t)){for(var m="<"+Fc.call(String(t.nodeName)),g=t.attributes||[],v=0;v<g.length;v++)m+=" "+g[v].name+"="+Rf(B1(g[v].value),"double",n);return m+=">",t.childNodes&&t.childNodes.length&&(m+="..."),m+="</"+Fc.call(String(t.nodeName))+">",m}if(wl(t)){if(t.length===0)return"[]";var y=Ns(t,d);return u&&!q1(y)?"["+Tl(y,u)+"]":"[ "+Be.call(y,", ")+" ]"}if(F1(t)){var b=Ns(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!If.call(t,"cause")?"{ ["+String(t)+"] "+Be.call(Oc.call("[cause]: "+d(t.cause),b),", ")+" }":b.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+Be.call(b,", ")+" }"}if(typeof t=="object"&&o){if(Hc&&typeof t[Hc]=="function"&&xl)return xl(t,{depth:c-i});if(o!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if($1(t)){var E=[];return kc&&kc.call(t,function(S,C){E.push(d(C,t,!0)+" => "+d(S,t))}),zc("Map",qn.call(t),E,u)}if(V1(t)){var x=[];return Bc&&Bc.call(t,function(S){x.push(d(S,t))}),zc("Set",Zn.call(t),x,u)}if(z1(t))return ua("WeakMap");if(W1(t))return ua("WeakSet");if(X1(t))return ua("WeakRef");if(N1(t))return Qi(d(Number(t)));if(U1(t))return Qi(d(vl.call(t)));if(L1(t))return Qi(S1.call(t));if(O1(t))return Qi(d(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(t===_n)return"{ [object globalThis] }";if(!D1(t)&&!$c(t)){var T=Ns(t,d),A=Lc?Lc(t)===Object.prototype:t instanceof Object||t.constructor===Object,I=t instanceof Object?"":"null prototype",R=!A&&Ut&&Object(t)===t&&Ut in t?Ih.call(Pr(t),8,-1):I?"Object":"",P=A||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",M=P+(R||I?"["+Be.call(Oc.call([],R||[],I||[]),": ")+"] ":"");return T.length===0?M+"{}":u?M+"{"+Tl(T,u)+"}":M+"{ "+Be.call(T,", ")+" }"}return String(t)};function Rf(r,t,e){var i=(e.quoteStyle||t)==="double"?'"':"'";return i+r+i}function B1(r){return _r.call(String(r),/"/g,""")}function wl(r){return Pr(r)==="[object Array]"&&(!Ut||!(typeof r=="object"&&Ut in r))}function D1(r){return Pr(r)==="[object Date]"&&(!Ut||!(typeof r=="object"&&Ut in r))}function $c(r){return Pr(r)==="[object RegExp]"&&(!Ut||!(typeof r=="object"&&Ut in r))}function F1(r){return Pr(r)==="[object Error]"&&(!Ut||!(typeof r=="object"&&Ut in r))}function O1(r){return Pr(r)==="[object String]"&&(!Ut||!(typeof r=="object"&&Ut in r))}function N1(r){return Pr(r)==="[object Number]"&&(!Ut||!(typeof r=="object"&&Ut in r))}function L1(r){return Pr(r)==="[object Boolean]"&&(!Ut||!(typeof r=="object"&&Ut in r))}function Pf(r){if(Gi)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!bl)return!1;try{return bl.call(r),!0}catch{}return!1}function U1(r){if(!r||typeof r!="object"||!vl)return!1;try{return vl.call(r),!0}catch{}return!1}var G1=Object.prototype.hasOwnProperty||function(r){return r in this};function dr(r,t){return G1.call(r,t)}function Pr(r){return C1.call(r)}function H1(r){if(r.name)return r.name;var t=R1.call(I1.call(r),/^function\s*([\w$]+)/);return t?t[1]:null}function Mf(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 $1(r){if(!qn||!r||typeof r!="object")return!1;try{qn.call(r);try{Zn.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function z1(r){if(!ms||!r||typeof r!="object")return!1;try{ms.call(r,ms);try{gs.call(r,gs)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function X1(r){if(!Dc||!r||typeof r!="object")return!1;try{return Dc.call(r),!0}catch{}return!1}function V1(r){if(!Zn||!r||typeof r!="object")return!1;try{Zn.call(r);try{qn.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function W1(r){if(!gs||!r||typeof r!="object")return!1;try{gs.call(r,gs);try{ms.call(r,ms)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function j1(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function kf(r,t){if(r.length>t.maxStringLength){var e=r.length-t.maxStringLength,i="... "+e+" more character"+(e>1?"s":"");return kf(Ih.call(r,0,t.maxStringLength),t)+i}var s=_r.call(_r.call(r,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,Y1);return Rf(s,"single",t)}function Y1(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":"")+P1.call(t.toString(16))}function Qi(r){return"Object("+r+")"}function ua(r){return r+" { ? }"}function zc(r,t,e,i){var s=i?Tl(e,i):Be.call(e,", ");return r+" ("+t+") {"+s+"}"}function q1(r){for(var t=0;t<r.length;t++)if(Mf(r[t],` 4`)>=0)return!1;return!0}function Z1(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 Tl(r,t){if(r.length===0)return"";var e=` 5`+t.prev+t.base;return e+Be.call(r,","+e)+` 6`+t.prev}function Ns(r,t){var e=wl(r),i=[];if(e){i.length=r.length;for(var s=0;s<r.length;s++)i[s]=dr(r,s)?t(r[s],r):""}var n=typeof ca=="function"?ca(r):[],o;if(Gi){o={};for(var a=0;a<n.length;a++)o["$"+n[a]]=n[a]}for(var l in r)dr(r,l)&&(e&&String(Number(l))===l&&l<r.length||Gi&&o["$"+l]instanceof Symbol||(Cf.call(/[^\w$]/,l)?i.push(t(l,r)+": "+t(r[l],r)):i.push(l+": "+t(r[l],r))));if(typeof ca=="function")for(var h=0;h<n.length;h++)If.call(r,n[h])&&i.push("["+t(n[h])+"]: "+t(r[n[h]],r));return i}var Rh=si,Yi=x1,K1=k1,J1=Rh("%TypeError%"),Ls=Rh("%WeakMap%",!0),Us=Rh("%Map%",!0),Q1=Yi("WeakMap.prototype.get",!0),ty=Yi("WeakMap.prototype.set",!0),ey=Yi("WeakMap.prototype.has",!0),ry=Yi("Map.prototype.get",!0),iy=Yi("Map.prototype.set",!0),sy=Yi("Map.prototype.has",!0),Ph=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},ny=function(r,t){var e=Ph(r,t);return e&&e.value},oy=function(r,t,e){var i=Ph(r,t);i?i.value=e:r.next={key:t,next:r.next,value:e}},ay=function(r,t){return!!Ph(r,t)},ly=function(){var t,e,i,s={assert:function(n){if(!s.has(n))throw new J1("Side channel does not contain "+K1(n))},get:function(n){if(Ls&&n&&(typeof n=="object"||typeof n=="function")){if(t)return Q1(t,n)}else if(Us){if(e)return ry(e,n)}else if(i)return ny(i,n)},has:function(n){if(Ls&&n&&(typeof n=="object"||typeof n=="function")){if(t)return ey(t,n)}else if(Us){if(e)return sy(e,n)}else if(i)return ay(i,n);return!1},set:function(n,o){Ls&&n&&(typeof n=="object"||typeof n=="function")?(t||(t=new Ls),ty(t,n,o)):Us?(e||(e=new Us),iy(e,n,o)):(i||(i={key:{},next:null}),oy(i,n,o))}};return s},hy=String.prototype.replace,cy=/%20/g,da={RFC1738:"RFC1738",RFC3986:"RFC3986"},Mh={default:da.RFC3986,formatters:{RFC1738:function(r){return hy.call(r,cy,"+")},RFC3986:function(r){return String(r)}},RFC1738:da.RFC1738,RFC3986:da.RFC3986},uy=Mh,fa=Object.prototype.hasOwnProperty,Wr=Array.isArray,Ee=function(){for(var r=[],t=0;t<256;++t)r.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return r}(),dy=function(t){for(;t.length>1;){var e=t.pop(),i=e.obj[e.prop];if(Wr(i)){for(var s=[],n=0;n<i.length;++n)typeof i[n]<"u"&&s.push(i[n]);e.obj[e.prop]=s}}},Bf=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},fy=function r(t,e,i){if(!e)return t;if(typeof e!="object"){if(Wr(t))t.push(e);else if(t&&typeof t=="object")(i&&(i.plainObjects||i.allowPrototypes)||!fa.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 Wr(t)&&!Wr(e)&&(s=Bf(t,i)),Wr(t)&&Wr(e)?(e.forEach(function(n,o){if(fa.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 fa.call(n,o)?n[o]=r(n[o],a,i):n[o]=a,n},s)},py=function(t,e){return Object.keys(e).reduce(function(i,s){return i[s]=e[s],i},t)},_y=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}},my=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(c){return"%26%23"+parseInt(c.slice(2),16)+"%3B"});for(var a="",l=0;l<o.length;++l){var h=o.charCodeAt(l);if(h===45||h===46||h===95||h===126||h>=48&&h<=57||h>=65&&h<=90||h>=97&&h<=122||n===uy.RFC1738&&(h===40||h===41)){a+=o.charAt(l);continue}if(h<128){a=a+Ee[h];continue}if(h<2048){a=a+(Ee[192|h>>6]+Ee[128|h&63]);continue}if(h<55296||h>=57344){a=a+(Ee[224|h>>12]+Ee[128|h>>6&63]+Ee[128|h&63]);continue}l+=1,h=65536+((h&1023)<<10|o.charCodeAt(l)&1023),a+=Ee[240|h>>18]+Ee[128|h>>12&63]+Ee[128|h>>6&63]+Ee[128|h&63]}return a},gy=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 dy(e),t},yy=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},vy=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},by=function(t,e){return[].concat(t,e)},xy=function(t,e){if(Wr(t)){for(var i=[],s=0;s<t.length;s+=1)i.push(e(t[s]));return i}return e(t)},Df={arrayToObject:Bf,assign:py,combine:by,compact:gy,decode:_y,encode:my,isBuffer:vy,isRegExp:yy,maybeMap:xy,merge:fy},Ff=ly,gn=Df,ys=Mh,wy=Object.prototype.hasOwnProperty,Xc={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},qe=Array.isArray,Ty=Array.prototype.push,Of=function(r,t){Ty.apply(r,qe(t)?t:[t])},Ey=Date.prototype.toISOString,Vc=ys.default,Ft={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:gn.encode,encodeValuesOnly:!1,format:Vc,formatter:ys.formatters[Vc],indices:!1,serializeDate:function(t){return Ey.call(t)},skipNulls:!1,strictNullHandling:!1},Ay=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},pa={},Sy=function r(t,e,i,s,n,o,a,l,h,c,u,d,f,p,_,m){for(var g=t,v=m,y=0,b=!1;(v=v.get(pa))!==void 0&&!b;){var E=v.get(t);if(y+=1,typeof E<"u"){if(E===y)throw new RangeError("Cyclic object value");b=!0}typeof v.get(pa)>"u"&&(y=0)}if(typeof l=="function"?g=l(e,g):g instanceof Date?g=u(g):i==="comma"&&qe(g)&&(g=gn.maybeMap(g,function(X){return X instanceof Date?u(X):X})),g===null){if(n)return a&&!p?a(e,Ft.encoder,_,"key",d):e;g=""}if(Ay(g)||gn.isBuffer(g)){if(a){var x=p?e:a(e,Ft.encoder,_,"key",d);return[f(x)+"="+f(a(g,Ft.encoder,_,"value",d))]}return[f(e)+"="+f(String(g))]}var T=[];
6if(typeof g>"u")return T;var A;if(i==="comma"&&qe(g))p&&a&&(g=gn.maybeMap(g,a)),A=[{value:g.length>0?g.join(",")||null:void 0}];else if(qe(l))A=l;else{var I=Object.keys(g);A=h?I.sort(h):I}for(var R=s&&qe(g)&&g.length===1?e+"[]":e,P=0;P<A.length;++P){var M=A[P],S=typeof M=="object"&&typeof M.value<"u"?M.value:g[M];if(!(o&&S===null)){var C=qe(g)?typeof i=="function"?i(R,M):R:R+(c?"."+M:"["+M+"]");m.set(t,y);var H=Ff();H.set(pa,m),Of(T,r(S,C,i,s,n,o,i==="comma"&&p&&qe(g)?null:a,l,h,c,u,d,f,p,_,H))}}return T},Cy=function(t){if(!t)return Ft;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||Ft.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=ys.default;if(typeof t.format<"u"){if(!wy.call(ys.formatters,t.format))throw new TypeError("Unknown format option provided.");i=t.format}var s=ys.formatters[i],n=Ft.filter;return(typeof t.filter=="function"||qe(t.filter))&&(n=t.filter),{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:Ft.addQueryPrefix,allowDots:typeof t.allowDots>"u"?Ft.allowDots:!!t.allowDots,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Ft.charsetSentinel,delimiter:typeof t.delimiter>"u"?Ft.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:Ft.encode,encoder:typeof t.encoder=="function"?t.encoder:Ft.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:Ft.encodeValuesOnly,filter:n,format:i,formatter:s,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:Ft.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:Ft.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Ft.strictNullHandling}},Iy=function(r,t){var e=r,i=Cy(t),s,n;typeof i.filter=="function"?(n=i.filter,e=n("",e)):qe(i.filter)&&(n=i.filter,s=n);var o=[];if(typeof e!="object"||e===null)return"";var a;t&&t.arrayFormat in Xc?a=t.arrayFormat:t&&"indices"in t?a=t.indices?"indices":"repeat":a="indices";var l=Xc[a];if(t&&"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var h=l==="comma"&&t&&t.commaRoundTrip;s||(s=Object.keys(e)),i.sort&&s.sort(i.sort);for(var c=Ff(),u=0;u<s.length;++u){var d=s[u];i.skipNulls&&e[d]===null||Of(o,Sy(e[d],d,l,h,i.strictNullHandling,i.skipNulls,i.encode?i.encoder:null,i.filter,i.sort,i.allowDots,i.serializeDate,i.format,i.formatter,i.encodeValuesOnly,i.charset,c))}var f=o.join(i.delimiter),p=i.addQueryPrefix===!0?"?":"";return i.charsetSentinel&&(i.charset==="iso-8859-1"?p+="utf8=%26%2310003%3B&":p+="utf8=%E2%9C%93&"),f.length>0?p+f:""},Hi=Df,El=Object.prototype.hasOwnProperty,Ry=Array.isArray,Rt={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:Hi.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},Py=function(r){return r.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},Nf=function(r,t){return r&&typeof r=="string"&&t.comma&&r.indexOf(",")>-1?r.split(","):r},My="utf8=%26%2310003%3B",ky="utf8=%E2%9C%93",By=function(t,e){var i={__proto__:null},s=e.ignoreQueryPrefix?t.replace(/^\?/,""):t,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]===ky?h="utf-8":o[l]===My&&(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,Rt.decoder,h,"key"),p=e.strictNullHandling?null:""):(f=e.decoder(c.slice(0,d),Rt.decoder,h,"key"),p=Hi.maybeMap(Nf(c.slice(d+1),e),function(_){return e.decoder(_,Rt.decoder,h,"value")})),p&&e.interpretNumericEntities&&h==="iso-8859-1"&&(p=Py(p)),c.indexOf("[]=")>
vendor: 9,186 bytes, lines 6-7
6-1&&(p=Ry(p)?[p]:p),El.call(i,f)?i[f]=Hi.combine(i[f],p):i[f]=p}return i},Dy=function(r,t,e,i){for(var s=i?t:Nf(t,e),n=r.length-1;n>=0;--n){var o,a=r[n];if(a==="[]"&&e.parseArrays)o=[].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=parseInt(l,10);!e.parseArrays&&l===""?o={0:s}:!isNaN(h)&&a!==l&&String(h)===l&&h>=0&&e.parseArrays&&h<=e.arrayLimit?(o=[],o[h]=s):l!=="__proto__"&&(o[l]=s)}s=o}return s},Fy=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&&El.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&&El.call(Object.prototype,l[1].slice(1,-1))&&!i.allowPrototypes)return;c.push(l[1])}return l&&c.push("["+n.slice(l.index)+"]"),Dy(c,e,i,s)}},Oy=function(t){if(!t)return Rt;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"?Rt.charset:t.charset;return{allowDots:typeof t.allowDots>"u"?Rt.allowDots:!!t.allowDots,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:Rt.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:Rt.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:Rt.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Rt.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:Rt.comma,decoder:typeof t.decoder=="function"?t.decoder:Rt.decoder,delimiter:typeof t.delimiter=="string"||Hi.isRegExp(t.delimiter)?t.delimiter:Rt.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:Rt.depth,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:Rt.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:Rt.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:Rt.plainObjects,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Rt.strictNullHandling}},Ny=function(r,t){var e=Oy(t);if(r===""||r===null||typeof r>"u")return e.plainObjects?Object.create(null):{};for(var i=typeof r=="string"?By(r,e):r,s=e.plainObjects?Object.create(null):{},n=Object.keys(i),o=0;o<n.length;++o){var a=n[o],l=Fy(a,i[a],e,typeof r=="string");s=Hi.merge(s,l,e)}return e.allowSparse===!0?s:Hi.compact(s)},Ly=Iy,Uy=Ny,Gy=Mh,Hy={formats:Gy,parse:Uy,stringify:Ly},$y=F0;function rr(){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 zy=/^([a-z0-9.+-]+:)/i,Xy=/:[0-9]*$/,Vy=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,Wy=["<",">",'"',"`"," ","\r",` 7`," "],jy=["{","}","|","\\","^","`"].concat(Wy),Al=["'"].concat(jy),Wc=["%","/","?",";","#"].concat(Al),jc=["/","?","#"],Yy=255,Yc=/^[+a-z0-9A-Z_-]{0,63}$/,qy=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,Zy={javascript:!0,"javascript:":!0},Sl={javascript:!0,"javascript:":!0},ki={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Cl=Hy;function Ky(r,t,e){if(r&&typeof r=="object"&&r instanceof rr)return r;var i=new rr;return i.parse(r,t,e),i}rr.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=Vy.exec(a);if(l)return this.path=a,this.href=a,this.pathname=l[1],l[2]?(this.search=l[2],t?this.query=Cl.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var h=zy.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&&Sl[h])&&(a=a.substr(2),this.slashes=!0)}if(!Sl[h]&&(u||h&&!ki[h])){for(var d=-1,f=0;f<jc.length;f++){var p=a.indexOf(jc[f]);p!==-1&&(d===-1||p<d)&&(d=p)}var _,m;d===-1?m=a.lastIndexOf("@"):m=a.lastIndexOf("@",d),m!==-1&&(_=a.slice(0,m),a=a.slice(m+1),this.auth=decodeURIComponent(_)),d=-1;for(var f=0;f<Wc.length;f++){var p=a.indexOf(Wc[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 g=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!g)for(var v=this.hostname.split(/\./),f=0,y=v.length;f<y;f++){var b=v[f];if(b&&!b.match(Yc)){for(var E="",x=0,T=b.length;x<T;x++)b.charCodeAt(x)>127?E+="x":E+=b[x];if(!E.match(Yc)){var A=v.slice(0,f),I=v.slice(f+1),R=b.match(qy);R&&(A.push(R[1]),I.unshift(R[2])),I.length&&(a="/"+I.join(".")+a),this.hostname=A.join(".");break}}}this.hostname.length>Yy?this.hostname="":this.hostname=this.hostname.toLowerCase(),g||(this.hostname=$y.toASCII(this.hostname));var P=this.port?":"+this.port:"",M=this.hostname||"";this.host=M+P,this.href+=this.host,g&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!Zy[c])for(var f=0,y=Al.length;f<y;f++){var S=Al[f];if(a.indexOf(S)!==-1){var C=encodeURIComponent(S);C===S&&(C=escape(S)),a=a.split(S).join(C)}}var H=a.indexOf("#");H!==-1&&(this.hash=a.substr(H),a=a.slice(0,H));var X=a.indexOf("?");if(X!==-1?(this.search=a.substr(X),this.query=a.substr(X+1),t&&(this.query=Cl.parse(this.query)),a=a.slice(0,X)):t&&(this.search="",this.query={}),a&&(this.pathname=a),ki[c]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var P=this.pathname||"",O=this.search||"";this.path=P+O}return this.href=this.format(),this};rr.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=Cl.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var o=this.search||n&&"?"+n||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||ki[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};rr.prototype.resolve=function(r){return this.resolveObject(Ky(r,!1,!0)).format()};rr.prototype.resolveObject=function(r){if(typeof r=="string"){var t=new rr;t.parse(r,!1,!0),r=t}for(var e=new rr,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 ki[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(!ki[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&&!Sl[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 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)==="/",_=r.host||r.pathname&&r.pathname.charAt(0)==="/",m=_||p||e.host&&r.pathname,g=m,v=e.pathname&&e.pathname.split("/")||[],y=r.pathname&&r.pathname.split("/")||[],b=e.protocol&&!ki[e.protocol];if(b&&(e.hostname="",e.port=null,e.host&&(v[0]===""?v[0]=e.host:v.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),m=m&&(y[0]===""||v[0]==="")),_)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,v=y;else if(y.length)v||(v=[]),v.pop(),v=v.concat(y),e.search=r.search,e.query=r.query;else if(r.search!=null){if(b){e.host=v.shift(),e.hostname=e.host;var E=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;E&&(e.auth=E.shift(),e.hostname=E.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(!v.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;
vendor: 5,926 bytes, lines 7-12
7for(var x=v.slice(-1)[0],T=(e.host||r.host||v.length>1)&&(x==="."||x==="..")||x==="",A=0,I=v.length;I>=0;I--)x=v[I],x==="."?v.splice(I,1):x===".."?(v.splice(I,1),A++):A&&(v.splice(I,1),A--);if(!m&&!g)for(;A--;A)v.unshift("..");m&&v[0]!==""&&(!v[0]||v[0].charAt(0)!=="/")&&v.unshift(""),T&&v.join("/").substr(-1)!=="/"&&v.push("");var R=v[0]===""||v[0]&&v[0].charAt(0)==="/";if(b){e.hostname=R?"":v.length?v.shift():"",e.host=e.hostname;var E=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;E&&(e.auth=E.shift(),e.hostname=E.shift(),e.host=e.hostname)}return m=m||e.host&&v.length,m&&!R&&v.unshift(""),v.length>0?e.pathname=v.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};rr.prototype.parseHost=function(){var r=this.host,t=Xy.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 qc={};function ot(r,t,e=3){if(qc[t])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${t} 8Deprecated since v${r}`):(i=i.split(` 9`).splice(e).join(` 10`),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t} 11Deprecated since v${r}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t} 12Deprecated since v${r}`),console.warn(i))),qc[t]=!0}function de(r){if(typeof r!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(r)}`)}function ts(r){return r.split("?")[0].split("#")[0]}function Jy(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Qy(r,t,e){return r.replace(new RegExp(Jy(t),"g"),e)}function tv(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 It={toPosix(r){return Qy(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){de(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(de(r),this.isDataUrl(r)||this.isBlobUrl(r))return r;const i=ts(this.toPosix(t??z.ADAPTER.getBaseUrl())),s=ts(this.toPosix(e??this.rootname(i)));return r=this.toPosix(r),r.startsWith("/")?It.join(s,r.slice(1)):this.isAbsolute(r)?r:this.join(i,r)},normalize(r){if(de(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=tv(r),r.length>0&&i&&(r+="/"),e?`/${r}`:t+r},isAbsolute(r){return de(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(de(i),i.length>0)if(t===void 0)t=i;else{const s=r[e-1]??"";this.extname(s)?t+=`/../${i}`:t+=`/${i}`}}return t===void 0?".":this.normalize(t)},dirname(r){if(de(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){de(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){de(r),t&&de(t),r=ts(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){de(r),r=ts(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){de(r);const t={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return t;r=ts(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:":"};let _a;async function ev(){return _a??(_a=(async()=>{const r=document.createElement("canvas").getContext("webgl");
vendor: 7,787 bytes, line 12
12if(!r)return Wt.UNPACK;const t=await new Promise(n=>{const o=document.createElement("video");o.onloadeddata=()=>n(o),o.onerror=()=>n(null),o.autoplay=!1,o.crossOrigin="anonymous",o.preload="auto",o.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",o.load()});if(!t)return Wt.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),r.getExtension("WEBGL_lose_context")?.loseContext(),s[0]<=s[3]?Wt.PMA:Wt.UNPACK})()),_a}let ma;function rv(){return typeof ma>"u"&&(ma=function(){const r={stencil:!0,failIfMajorPerformanceCaveat:z.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!z.ADAPTER.getWebGLRenderingContext())return!1;const t=z.ADAPTER.createCanvas();let e=t.getContext("webgl",r)||t.getContext("experimental-webgl",r);const i=!!e?.getContextAttributes()?.stencil;if(e){const s=e.getExtension("WEBGL_lose_context");s&&s.loseContext()}return e=null,i}catch{return!1}}()),ma}var iv={grad:.9,turn:360,rad:360/(2*Math.PI)},ze=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},Mt=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*r)/e+0},he=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),r>e?e:r>t?r:t},Lf=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},Zc=function(r){return{r:he(r.r,0,255),g:he(r.g,0,255),b:he(r.b,0,255),a:he(r.a)}},ga=function(r){return{r:Mt(r.r),g:Mt(r.g),b:Mt(r.b),a:Mt(r.a,3)}},sv=/^#([0-9a-f]{3,8})$/i,Gs=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},Uf=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}},Gf=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}},Kc=function(r){return{h:Lf(r.h),s:he(r.s,0,100),l:he(r.l,0,100),a:he(r.a)}},Jc=function(r){return{h:Mt(r.h),s:Mt(r.s),l:Mt(r.l),a:Mt(r.a,3)}},Qc=function(r){return Gf((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},vs=function(r){return{h:(t=Uf(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},nv=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ov=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,av=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,lv=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Il={string:[[function(r){var t=sv.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?Mt(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?Mt(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=av.exec(r)||lv.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:Zc({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=nv.exec(r)||ov.exec(r);if(!t)return null;var e,i,s=Kc({h:(e=t[1],i=t[2],i===void 0&&(i="deg"),Number(e)*(iv[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Qc(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 ze(t)&&ze(e)&&ze(i)?Zc({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(!ze(t)||!ze(e)||!ze(i))return null;var o=Kc({h:Number(t),s:Number(e),l:Number(i),a:Number(n)});return Qc(o)},"hsl"],[function(r){var t=r.h,e=r.s,i=r.v,s=r.a,n=s===void 0?1:s;if(!ze(t)||!ze(e)||!ze(i))return null;var o=function(a){return{h:Lf(a.h),s:he(a.s,0,100),v:he(a.v,0,100),a:he(a.a)}}({h:Number(t),s:Number(e),v:Number(i),a:Number(n)});return Gf(o)},"hsv"]]},tu=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]},hv=function(r){return typeof r=="string"?tu(r.trim(),Il.string):typeof r=="object"&&r!==null?tu(r,Il.object):[null,void 0]},ya=function(r,t){var e=vs(r);return{h:e.h,s:he(e.s+100*t,0,100),l:e.l,a:e.a}},va=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},eu=function(r,t){var e=vs(r);return{h:e.h,s:e.s,l:he(e.l+100*t,0,100),a:e.a}},Rl=function(){function r(t){this.parsed=hv(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 Mt(va(this.rgba),2)},r.prototype.isDark=function(){return va(this.rgba)<.5},r.prototype.isLight=function(){return va(this.rgba)>=.5},r.prototype.toHex=function(){return t=ga(this.rgba),e=t.r,i=t.g,s=t.b,o=(n=t.a)<1?Gs(Mt(255*n)):"","#"+Gs(e)+Gs(i)+Gs(s)+o;var t,e,i,s,n,o},r.prototype.toRgb=function(){return ga(this.rgba)},r.prototype.toRgbString=function(){return t=ga(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 Jc(vs(this.rgba))},r.prototype.toHslString=function(){return t=Jc(vs(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=Uf(this.rgba),{h:Mt(t.h),s:Mt(t.s),v:Mt(t.v),a:Mt(t.a,3)};var t},r.prototype.invert=function(){return Ie({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),Ie(ya(this.rgba,t))},r.prototype.desaturate=function(t){return t===void 0&&(t=.1),Ie(ya(this.rgba,-t))},r.prototype.grayscale=function(){return Ie(ya(this.rgba,-1))},r.prototype.lighten=function(t){return t===void 0&&(t=.1),Ie(eu(this.rgba,t))},r.prototype.darken=function(t){return t===void 0&&(t=.1),Ie(eu(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"?Ie({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):Mt(this.rgba.a,3);var e},r.prototype.hue=function(t){var e=vs(this.rgba);return typeof t=="number"?Ie({h:t,s:e.s,l:e.l,a:e.a}):Mt(e.h)},r.prototype.isEqual=function(t){return this.toHex()===Ie(t).toHex()},r}(),Ie=function(r){return r instanceof Rl?r:new Rl(r)},ru=[],cv=function(r){r.forEach(function(t){ru.indexOf(t)<0&&(t(Rl,Il),ru.push(t))})};
vendor: 4,443 bytes, line 12
12function uv(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?.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 _=(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));_<u&&(u=_,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"])}cv([uv]);const bi=class yn{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 yn)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;
vendor: 4,962 bytes, line 12
12if(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]=yn.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=yn.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}const o=Ie(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)}};bi.shared=new bi,bi.temp=new bi,bi.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let ft=bi;function dv(r){return ot("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),ft.shared.setValue(r).toHex()}function fv(r){return ot("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),ft.shared.setValue(r).toNumber()}function pv(){const r=[],t=[];for(let i=0;i<32;i++)r[i]=i,t[i]=i;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;const e=[];return e.push(t),e.push(r),e}const Hf=pv();function $f(r,t){return Hf[t?1:0][r]}function _v(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 zf(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 Kn(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 iu(r){return!(r&r-1)&&!!r}function su(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 Bi(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 mr(r){return r===0?0:r<0?-1:1}let mv=0;function ti(){return++mv}const Pl=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}};
12Pl.EMPTY=new Pl(0,0,0,0);let nu=Pl;const ou={},Re=Object.create(null),or=Object.create(null);class gv{constructor(t,e,i){this._canvas=z.ADAPTER.createCanvas(),this._context=this._canvas.getContext("2d"),this.resolution=i||z.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 lu(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 yv(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 nu.EMPTY;for(;au(s,t,l);)--l;for(;lu(s,t,n,o,l);)++n;for(;lu(s,t,a,o,l);)--a;return++a,++l,new nu(n,o,a,l)}function vv(r){const t=yv(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 bv(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 ir(r,t=1){const e=z.RETINA_PREFIX?.exec(r);return e?parseFloat(e[1]):t}var G=(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))(G||{});const Ml=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},hu=(r,t)=>Ml(r).priority??t,q={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(Ml).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...r){return r.map(Ml).forEach(t=>{t.type.forEach(e=>{const i=this._addHandlers,s=this._queue;i[e]?i[e](t):(s[e]=s[e]||[],s[e].push(t))})}),this},handle(r,t,e){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]&&(n[r].forEach(o=>t(o)),delete n[r]),this},handleByMap(r,t){return this.handle(r,e=>{t[e.name]=e.ref},e=>{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)=>hu(n,e)-hu(s,e)))},i=>{const s=t.indexOf(i.ref);s!==-1&&t.splice(s,1)})}};class kl{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 xv=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(` 13`);function wv(r){let t="";for(let e=0;e<r;++e)e>0&&(t+=` 14else `),e<r-1&&(t+=`if(test == ${e}.0){}`);return t}function Tv(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=xv.replace(/%forloop%/gi,wv(r));if(t.shaderSource(e,i),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))r=r/2|0;else break}return r}const ba=0,xa=1,wa=2,Ta=3,Ea=4,Aa=5;class Ge{constructor(){this.data=0,this.blendMode=J.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<ba)}set blend(t){!!(this.data&1<<ba)!==t&&(this.data^=1<<ba)}get offsets(){return!!(this.data&1<<xa)}set offsets(t){!!(this.data&1<<xa)!==t&&(this.data^=1<<xa)}
vendor: 25,832 bytes, lines 14-20
14get culling(){return!!(this.data&1<<wa)}set culling(t){!!(this.data&1<<wa)!==t&&(this.data^=1<<wa)}get depthTest(){return!!(this.data&1<<Ta)}set depthTest(t){!!(this.data&1<<Ta)!==t&&(this.data^=1<<Ta)}get depthMask(){return!!(this.data&1<<Aa)}set depthMask(t){!!(this.data&1<<Aa)!==t&&(this.data^=1<<Aa)}get clockwiseFrontFace(){return!!(this.data&1<<Ea)}set clockwiseFrontFace(t){!!(this.data&1<<Ea)!==t&&(this.data^=1<<Ea)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==J.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){const t=new Ge;return t.depthTest=!1,t.blend=!0,t}}Ge.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};const Bl=[];function Xf(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=Bl.length-1;i>=0;--i){const s=Bl[i];if(s.test&&s.test(r,e))return new s(r,t)}throw new Error("Unrecognized source type to auto-detect Resource")}class xe{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=null,this._name=null}get empty(){return this.items.length===0}get name(){return this._name}}Object.defineProperties(xe.prototype,{dispatch:{value:xe.prototype.emit},run:{value:xe.prototype.emit}});class Cs{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new xe("setRealSize"),this.onUpdate=new xe("update"),this.onError=new xe("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 Ao 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===Wt.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 Ev={scaleMode:Ze.NEAREST,alphaMode:Wt.NPM},Dl=class xi extends Rs{constructor(t=null,e=null){super(),e=Object.assign({},xi.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=Xf(t,p),t.internal=!0),this.resolution=f||z.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=ti(),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=iu(this.realWidth)&&iu(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 or[this.cacheId],delete Re[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),xi.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=z.STRICT_TEXTURE_CACHE){const s=typeof t=="string";let n=null;if(s)n=t;else{if(!t._pixiId){const a=e?.pixiIdPrefix||"pixiid";t._pixiId=`${a}_${ti()}`}n=t._pixiId}let o=or[n];if(s&&i&&!o)throw new Error(`The cacheId "${n}" does not exist in BaseTextureCache.`);return o||(o=new xi(t,e),o.cacheId=n,xi.addToCache(o,n)),o}static fromBuffer(t,e,i,s){t=t||new Float32Array(e*i*4);const n=new Ao(t,{width:e,height:i,...s?.resourceOptions});let o,a;return t instanceof Float32Array?(o=N.RGBA,a=K.FLOAT):t instanceof Int32Array?(o=N.RGBA_INTEGER,a=K.INT):t instanceof Uint32Array?(o=N.RGBA_INTEGER,a=K.UNSIGNED_INT):t instanceof Int16Array?(o=N.RGBA_INTEGER,a=K.SHORT):t instanceof Uint16Array?(o=N.RGBA_INTEGER,a=K.UNSIGNED_SHORT):t instanceof Int8Array?(o=N.RGBA,a=K.BYTE):(o=N.RGBA,a=K.UNSIGNED_BYTE),n.internal=!0,new xi(n,Object.assign({},Ev,{type:a,format:o},s))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),or[e]&&or[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),or[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=or[t];if(e){const i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete or[t],e}}else if(t?.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete or[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};Dl.defaultOptions={mipmap:Ue.POW2,anisotropicLevel:0,scaleMode:Ze.LINEAR,wrapMode:br.CLAMP,alphaMode:Wt.UNPACK,target:Pi.TEXTURE_2D,format:N.RGBA,type:K.UNSIGNED_BYTE},Dl._globalBatch=0;let rt=Dl;class Fl{constructor(){this.texArray=null,this.blend=0,this.type=Oe.TRIANGLES,this.start=0,this.size=0,this.data=null}}let Av=0;class Et{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=Av++,this.disposeRunner=new xe("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?Ne.ELEMENT_ARRAY_BUFFER:Ne.ARRAY_BUFFER}get index(){return this.type===Ne.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new Et(t)}}class Jn{constructor(t,e=0,i=!1,s=K.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 Jn(t,e,i,s,n)}}const Sv={Float32Array,Uint32Array,Int32Array,Uint8Array};function Cv(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=zf(c);s[u]||(s[u]=new Sv[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 cu={5126:4,5123:2,5121:1};let Iv=0;const Rv={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array};class wr{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=Iv++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new xe("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 Et||(e instanceof Array&&(e=new Float32Array(e)),e=new Et(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 Jn(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 Et||(t instanceof Array&&(t=new Uint16Array(t)),t=new Et(t)),t.type=Ne.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 Et;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*cu[n.type]/4),n.buffer=0}for(i.data=Cv(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 wr;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new Et(this.buffers[e].data.slice(0));for(const e in this.attributes){const i=this.attributes[e];t.attributes[e]=new Jn(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=Ne.ELEMENT_ARRAY_BUFFER),t}static merge(t){const e=new wr,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 Rv[zf(o.buffers[a].data)](s[a]),e.buffers[a]=new Et(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=Ne.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*cu[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 Vf extends wr{constructor(t=!1){super(),this._buffer=new Et(null,t,!1),this._indexBuffer=new Et(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,K.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,K.FLOAT).addAttribute("aColor",this._buffer,4,!0,K.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,K.FLOAT).addIndex(this._indexBuffer)}}const Qn=Math.PI*2,Pv=180/Math.PI,Mv=Math.PI/180;var Dt=(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))(Dt||{});class ht{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new ht(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}}ht.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};const Hs=[new ht,new ht,new ht,new ht];class et{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=Dt.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 et(0,0,0,0)}clone(){return new et(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 A=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=A)return!1;const I=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>I}const i=this.left,s=this.right,n=this.top,o=this.bottom;if(s<=i||o<=n)return!1;const a=Hs[0].set(t.left,t.top),l=Hs[1].set(t.left,t.bottom),h=Hs[2].set(t.right,t.top),c=Hs[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,_=d*s+f*n,m=d*i+f*o,g=d*s+f*o;if(Math.max(p,_,m,g)<=d*a.x+f*a.y||Math.min(p,_,m,g)>=d*c.x+f*c.y)return!1;const v=u*(a.y-h.y),y=u*(h.x-a.x),b=v*i+y*n,E=v*s+y*n,x=v*i+y*o,T=v*s+y*o;return!(Math.max(b,E,x,T)<=v*a.x+y*a.y||Math.min(b,E,x,T)>=v*c.x+y*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}}et.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class So{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.radius=i,this.type=Dt.CIRC}clone(){return new So(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 et(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}So.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};class Co{constructor(t=0,e=0,i=0,s=0){this.x=t,this.y=e,this.width=i,this.height=s,this.type=Dt.ELIP}clone(){return new Co(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 et(this.x-this.width,this.y-this.height,this.width,this.height)}}Co.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=Dt.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 Io{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=Dt.RREC}clone(){return new Io(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}}Io.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};class gt{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 ht;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 ht;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(Qn-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 gt;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 gt}static get TEMP_MATRIX(){return new gt}}gt.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 Ur=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Gr=[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],$r=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Ol=[],Wf=[],$s=Math.sign;function kv(){for(let r=0;r<16;r++){const t=[];Ol.push(t);for(let e=0;e<16;e++){const i=$s(Ur[r]*Ur[e]+Hr[r]*Gr[e]),s=$s(Gr[r]*Ur[e]+$r[r]*Gr[e]),n=$s(Ur[r]*Hr[e]+Hr[r]*$r[e]),o=$s(Gr[r]*Hr[e]+$r[r]*$r[e]);for(let a=0;a<16;a++)if(Ur[a]===i&&Gr[a]===s&&Hr[a]===n&&$r[a]===o){t.push(a);break}}}for(let r=0;r<16;r++){const t=new gt;t.set(Ur[r],Gr[r],Hr[r],$r[r],0,0),Wf.push(t)}}kv();const vt={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=>Ur[r],uY:r=>Gr[r],vX:r=>Hr[r],vY:r=>$r[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>Ol[r][t],sub:(r,t)=>Ol[r][vt.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?vt.S:vt.N:Math.abs(t)*2<=Math.abs(r)?r>0?vt.E:vt.W:t>0?r>0?vt.SE:vt.SW:r>0?vt.NE:vt.NW,matrixAppendRotationInv:(r,t,e=0,i=0)=>{const s=Wf[vt.inv(t)];s.tx=e,s.ty=i,r.append(s)}};class Je{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 Je(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))}}Je.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};const Nl=class{constructor(){this.worldTransform=new gt,this.localTransform=new gt,this.position=new Je(this.onChange,this,0,0),this.scale=new Je(this.onChange,this,1,1),this.pivot=new Je(this.onChange,this,0,0),this.skew=new Je(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())}};Nl.IDENTITY=new Nl;let kh=Nl;kh.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 Bv=`varying vec2 vTextureCoord; 15 16uniform sampler2D uSampler; 17 18void main(void){ 19 gl_FragColor *= texture2D(uSampler, vTextureCoord); 20}
20`,Dv=`attribute vec2 aVertexPosition; 21attribute vec2 aTextureCoord; 22 23uniform mat3 projectionMatrix; 24 25varying vec2 vTextureCoord; 26 27void main(void){ 28 gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); 29 vTextureCoord = aTextureCoord; 30} 31`;function uu(r,t,e){const i=r.createShader(t);return r.shaderSource(i,e),r.compileShader(i),i}function Sa(r){const t=new Array(r);for(let e=0;e<t.length;e++)t[e]=!1;return t}function jf(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 Sa(2*t);case"bvec3":return Sa(3*t);case"bvec4":return Sa(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 Di=[{test:r=>r.type==="float"&&r.size===1&&!r.isArray,code:r=>` 32 if(uv["${r}"] !== ud["${r}"].value) 33 { 34 ud["${r}"].value = uv["${r}"] 35 gl.uniform1f(ud["${r}"].location, uv["${r}"]) 36 } 37 `},{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++; 38 39 renderer.texture.bind(uv["${r}"], t); 40 41 if(ud["${r}"].value !== t) 42 { 43 ud["${r}"].value = t; 44 gl.uniform1i(ud["${r}"].location, t); 45; // eslint-disable-line max-len 46 }`},{test:(r,t)=>r.type==="mat3"&&r.size===1&&!r.isArray&&t.a!==void 0,code:r=>` 47 gl.uniformMatrix3fv(ud["${r}"].location, false, uv["${r}"].toArray(true)); 48 `,codeUbo:r=>` 49 var ${r}_matrix = uv.${r}.toArray(true); 50 51 data[offset] = ${r}_matrix[0]; 52 data[offset+1] = ${r}_matrix[1]; 53 data[offset+2] = ${r}_matrix[2]; 54 55 data[offset + 4] = ${r}_matrix[3]; 56 data[offset + 5] = ${r}_matrix[4]; 57 data[offset + 6] = ${r}_matrix[5]; 58 59 data[offset + 8] = ${r}_matrix[6]; 60 data[offset + 9] = ${r}_matrix[7]; 61 data[offset + 10] = ${r}_matrix[8]; 62 `},{test:(r,t)=>r.type==="vec2"&&r.size===1&&!r.isArray&&t.x!==void 0,code:r=>` 63 cv = ud["${r}"].value; 64 v = uv["${r}"]; 65 66 if(cv[0] !== v.x || cv[1] !== v.y) 67 { 68 cv[0] = v.x; 69 cv[1] = v.y; 70 gl.uniform2f(ud["${r}"].location, v.x, v.y); 71 }`,codeUbo:r=>` 72 v = uv.${r}; 73 74 data[offset] = v.x; 75 data[offset+1] = v.y; 76 `},{test:r=>r.type==="vec2"&&r.size===1&&!r.isArray,code:r=>` 77 cv = ud["${r}"].value; 78 v = uv["${r}"]; 79 80 if(cv[0] !== v[0] || cv[1] !== v[1]) 81 { 82 cv[0] = v[0]; 83 cv[1] = v[1]; 84 gl.uniform2f(ud["${r}"].location, v[0], v[1]); 85 } 86 `},{test:(r,t)=>r.type==="vec4"&&r.size===1&&!r.isArray&&t.width!==void 0,code:r=>` 87 cv = ud["${r}"].value; 88 v = uv["${r}"]; 89 90 if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height) 91 { 92 cv[0] = v.x; 93 cv[1] = v.y; 94 cv[2] = v.width; 95 cv[3] = v.height; 96 gl.uniform4f(ud["${r}"].location, v.x, v.y, v.width, v.height) 97 }`,codeUbo:r=>` 98 v = uv.${r}; 99 100 data[offset] = v.x; 101 data[offset+1] = v.y; 102 data[offset+2] = v.width; 103 data[offset+3] = v.height; 104 `},{test:(r,t)=>r.type==="vec4"&&r.size===1&&!r.isArray&&t.red!==void 0,code:r=>` 105 cv = ud["${r}"].value; 106 v = uv["${r}"]; 107 108 if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha) 109 { 110 cv[0] = v.red; 111 cv[1] = v.green; 112 cv[2] = v.blue; 113 cv[3] = v.alpha; 114 gl.uniform4f(ud["${r}"].location, v.red, v.green, v.blue, v.alpha) 115 }`,codeUbo:r=>` 116 v = uv.${r}; 117 118 data[offset] = v.red; 119 data[offset+1] = v.green; 120 data[offset+2] = v.blue; 121 data[offset+3] = v.alpha; 122 `},{test:(r,t)=>r.type==="vec3"&&r.size===1&&!r.isArray&&t.red!==void 0,code:r=>` 123 cv = ud["${r}"].value; 124 v = uv["${r}"]; 125 126 if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.a) 127 { 128 cv[0] = v.red; 129 cv[1] = v.green; 130 cv[2] = v.blue; 131 132 gl.uniform3f(ud["${r}"].location, v.red, v.green, v.blue) 133 }`,codeUbo:r=>` 134 v = uv.${r}; 135 136 data[offset] = v.red; 137 data[offset+1] = v.green; 138 data[offset+2] = v.blue; 139 `},{test:r=>r.type==="vec4"&&r.size===1&&!r.isArray,code:r=>` 140 cv = ud["${r}"].value; 141 v = uv["${r}"]; 142 143 if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) 144 { 145 cv[0] = v[0]; 146 cv[1] = v[1]; 147 cv[2] = v[2]; 148 cv[3] = v[3]; 149 150 gl.uniform4f(ud["${r}"].location, v[0], v[1], v[2], v[3]) 151 }`}],Fv={float:` 152 if (cv !== v) 153 { 154 cu.value = v; 155 gl.uniform1f(location, v); 156 }`,vec2:` 157 if (cv[0] !== v[0] || cv[1] !== v[1]) 158 { 159 cv[0] = v[0]; 160 cv[1] = v[1]; 161 162 gl.uniform2f(location, v[0], v[1]) 163 }`,vec3:` 164 if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) 165 { 166 cv[0] = v[0]; 167 cv[1] = v[1]; 168 cv[2] = v[2]; 169 170 gl.uniform3f(location, v[0], v[1], v[2]) 171 }`,vec4:` 172 if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) 173 { 174 cv[0] = v[0]; 175 cv[1] = v[1]; 176 cv[2] = v[2]; 177 cv[3] = v[3]; 178 179 gl.uniform4f(location, v[0], v[1], v[2], v[3]); 180 }`,int:` 181 if (cv !== v) 182 { 183 cu.value = v; 184 185 gl.uniform1i(location, v); 186 }`,ivec2:` 187 if (cv[0] !== v[0] || cv[1] !== v[1]) 188 { 189 cv[0] = v[0]; 190 cv[1] = v[1]; 191 192 gl.uniform2i(location, v[0], v[1]); 193 }`,ivec3:` 194 if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) 195 { 196 cv[0] = v[0]; 197 cv[1] = v[1]; 198 cv[2] = v[2]; 199 200 gl.uniform3i(location, v[0], v[1], v[2]); 201 }`,ivec4:` 202 if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) 203 { 204 cv[0] = v[0]; 205 cv[1] = v[1]; 206 cv[2] = v[2]; 207 cv[3] = v[3]; 208 209 gl.uniform4i(location, v[0], v[1], v[2], v[3]); 210 }`,uint:` 211 if (cv !== v) 212 { 213 cu.value = v; 214 215 gl.uniform1ui(location, v); 216 }`,uvec2:` 217 if (cv[0] !== v[0] || cv[1] !== v[1]) 218 { 219 cv[0] = v[0]; 220 cv[1] = v[1]; 221 222 gl.uniform2ui(location, v[0], v[1]); 223 }`,uvec3:` 224 if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) 225 { 226 cv[0] = v[0]; 227 cv[1] = v[1]; 228 cv[2] = v[2]; 229 230 gl.uniform3ui(location, v[0], v[1], v[2]); 231 }`,uvec4:` 232 if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) 233 { 234 cv[0] = v[0]; 235 cv[1] = v[1]; 236 cv[2] = v[2]; 237 cv[3] = v[3]; 238 239 gl.uniform4ui(location, v[0], v[1], v[2], v[3]); 240 }`,bool:` 241 if (cv !== v) 242 { 243 cu.value = v; 244 gl.uniform1i(location, v); 245 }`,bvec2:` 246 if (cv[0] != v[0] || cv[1] != v[1]) 247 { 248 cv[0] = v[0]; 249 cv[1] = v[1]; 250 251 gl.uniform2i(location, v[0], v[1]); 252 }`,bvec3:` 253 if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) 254 { 255 cv[0] = v[0]; 256 cv[1] = v[1]; 257 cv[2] = v[2]; 258 259 gl.uniform3i(location, v[0], v[1], v[2]); 260 }`,bvec4:` 261 if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) 262 { 263 cv[0] = v[0]; 264 cv[1] = v[1]; 265 cv[2] = v[2]; 266 cv[3] = v[3]; 267 268 gl.uniform4i(location, v[0], v[1], v[2], v[3]); 269 }`,mat2:"gl.uniformMatrix2fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",sampler2D:` 270 if (cv !== v) 271 { 272 cu.value = v; 273 274 gl.uniform1i(location, v); 275 }`,samplerCube:` 276 if (cv !== v) 277 { 278 cu.value = v; 279 280 gl.uniform1i(location, v); 281 }`,sampler2DArray:` 282 if (cv !== v) 283 { 284 cu.value = v; 285 286 gl.uniform1i(location, v); 287 }`},Ov={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 Nv(r,t){const e=[` 288 var v = null; 289 var cv = null; 290 var cu = null; 291 var t = 0; 292 var gl = renderer.gl; 293 `];for(const i in r.uniforms){const s=t[i];if(!s){r.uniforms[i]?.group===!0&&(r.uniforms[i].ubo?e.push(` 294 renderer.shader.syncUniformBufferGroup(uv.${i}, '${i}'); 295 `):e.push(` 296 renderer.shader.syncUniformGroup(uv.${i}, syncData); 297 `));continue}const n=r.uniforms[i];let o=!1;for(let a=0;a<Di.length;a++)if(Di[a].test(s,n)){e.push(Di[a].code(i,n)),o=!0;break}if(!o){const a=(s.size===1&&!s.isArray?Fv:Ov)[s.type].replace("location",`ud["${i}"].location`);e.push(` 298 cu = ud["${i}"]; 299 cv = cu.value; 300 v = uv["${i}"]; 301 ${a};`)}}return new Function("ud","uv","renderer","syncData",e.join(` 302`))}const Yf={};let zs=Yf;function Lv(){if(zs===Yf||zs?.isContextLost()){const r=z.ADAPTER.createCanvas();let t;z.PREFER_ENV>=ii.WEBGL2&&(t=r.getContext("webgl2",{})),t||(t=r.getContext("webgl",{})||r.getContext("experimental-webgl",{}),t?t.getExtension("WEBGL_draw_buffers"):t=null),zs=t}return zs}let Xs;function Uv(){if(!Xs){Xs=le.MEDIUM;const r=Lv();if(r&&r.getShaderPrecisionFormat){const t=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);t&&(Xs=t.precision?le.HIGH:le.MEDIUM)}}return Xs}function du(r,t){const e=r.getShaderSource(t).split(` 303`).map((h,c)=>`${c}: ${h}`),i=r.getShaderInfoLog(t),s=i.split(` 304`),n={},o=s.map(h=>
vendor: 6,481 bytes, lines 304-341
304parseFloat(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(` 305`);a[0]=l,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function Gv(r,t,e,i){r.getProgramParameter(t,r.LINK_STATUS)||(r.getShaderParameter(e,r.COMPILE_STATUS)||du(r,e),r.getShaderParameter(i,r.COMPILE_STATUS)||du(r,i),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(t)))}const Hv={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 qf(r){return Hv[r]}let Vs=null;const fu={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 Zf(r,t){if(!Vs){const e=Object.keys(fu);Vs={};for(let i=0;i<e.length;++i){const s=e[i];Vs[r[s]]=fu[s]}}return Vs[t]}function pu(r,t,e){if(r.substring(0,9)!=="precision"){let i=t;return t===le.HIGH&&e!==le.HIGH&&(i=le.MEDIUM),`precision ${i} float; 306${r}`}else if(e!==le.HIGH&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}let es;function $v(){if(typeof es=="boolean")return es;try{es=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{es=!1}return es}let zv=0;const Ws={},Ll=class wi{constructor(t,e,i="pixi-shader",s={}){this.extra={},this.id=zv++,this.vertexSrc=t||wi.defaultVertexSrc,this.fragmentSrc=e||wi.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,"-"),Ws[i]?(Ws[i]++,i+=`-${Ws[i]}`):Ws[i]=1,this.vertexSrc=`#define SHADER_NAME ${i} 307${this.vertexSrc}`,this.fragmentSrc=`#define SHADER_NAME ${i} 308${this.fragmentSrc}`,this.vertexSrc=pu(this.vertexSrc,wi.defaultVertexPrecision,le.HIGH),this.fragmentSrc=pu(this.fragmentSrc,wi.defaultFragmentPrecision,Uv())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return Dv}static get defaultFragmentSrc(){return Bv}static from(t,e,i){const s=t+e;let n=ou[s];return n||(ou[s]=n=new wi(t,e,i)),n}};Ll.defaultVertexPrecision=le.HIGH,Ll.defaultFragmentPrecision=Ke.apple.device?le.HIGH:le.MEDIUM;let Qe=Ll,Xv=0;class we{constructor(t,e,i){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=Xv++,this.static=!!e,this.ubo=!!i,t instanceof Et?(this.buffer=t,this.buffer.type=Ne.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=t,this.ubo&&(this.buffer=new Et(new Float32Array(1)),this.buffer.type=Ne.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 we(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 we(t,e,i)}static uboFrom(t,e){return new we(t,e??!0,!0)}}class Le{constructor(t,e){this.uniformBindCount=0,this.program=t,e?e instanceof we?this.uniformGroup=e:this.uniformGroup=new we(e):this.uniformGroup=new we({}),this.disposeRunner=new xe("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=Qe.from(t,e);return new Le(s,i)}}class Vv{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]=we.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 Qe(this.vertexSrc,s)}const e={tint:new Float32Array([1,1,1,1]),translationMatrix:new gt,default:this.defaultGroupCache[t]};return new Le(this.programCache[t],e)}generateSampleSrc(t){let e="";e+=` 309`,e+=` 310`;for(let i=0;i<t;i++)i>0&&(e+=` 311else `),i<t-1&&(e+=`if(vTextureId < ${i}.5)`),e+=` 312{`,e+=` 313 color = texture2D(uSamplers[${i}], vTextureCoord);`,e+=` 314}`;return e+=` 315`,e+=` 316`,e}}class Ul{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 Wv(){return!Ke.apple.device}function jv(r){let t=!0;const e=z.ADAPTER.getNavigator();if(Ke.tablet||Ke.phone){if(Ke.apple.device){const i=e.userAgent.match(/OS (\d+)_(\d+)?/);i&&parseInt(i[1],10)<11&&(t=!1)}if(Ke.android.device){const i=e.userAgent.match(/Android\s([0-9.]*)/);i&&parseInt(i[1],10)<7&&(t=!1)}}return t?r:4}class Ro{constructor(t){this.renderer=t}flush(){}destroy(){this.renderer=null}start(){}stop(){this.flush()}render(t){}}var Yv=`varying vec2 vTextureCoord; 317varying vec4 vColor; 318varying float vTextureId; 319uniform sampler2D uSamplers[%count%]; 320 321void main(void){ 322 vec4 color; 323 %forloop% 324 gl_FragColor = color * vColor; 325} 326`,qv=`precision highp float; 327attribute vec2 aVertexPosition; 328attribute vec2 aTextureCoord; 329attribute vec4 aColor; 330attribute float aTextureId; 331 332uniform mat3 projectionMatrix; 333uniform mat3 translationMatrix; 334uniform vec4 tint; 335 336varying vec2 vTextureCoord; 337varying vec4 vColor; 338varying float vTextureId; 339 340void main(void){ 341 gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0
341)).xy, 0.0, 1.0); 342 343 vTextureCoord = aTextureCoord; 344 vTextureId = aTextureId; 345 vColor = aColor * tint; 346} 347`;const ls=class me extends Ro{constructor(t){super(t),this.setShaderGenerator(),this.geometryClass=Vf,this.vertexSize=6,this.state=Ge.for2d(),this.size=me.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??jv(32),this._defaultMaxTextures}static set defaultMaxTextures(t){this._defaultMaxTextures=t}static get canUploadSameBuffer(){return this._canUploadSameBuffer=this._canUploadSameBuffer??Wv(),this._canUploadSameBuffer}static set canUploadSameBuffer(t){this._canUploadSameBuffer=t}get MAX_TEXTURES(){return ot("7.1.0","BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures"),this.maxTextures}static get defaultVertexSrc(){return qv}static get defaultFragmentTemplate(){return Yv}setShaderGenerator({vertex:t=me.defaultVertexSrc,fragment:e=me.defaultFragmentTemplate}={}){this.shaderGenerator=new Vv(t,e)}contextChange(){const t=this.renderer.gl;z.PREFER_ENV===ii.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),me.defaultMaxTextures),this.maxTextures=Tv(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}=me,i=this.size/4,s=Math.floor(i/this.maxTextures)+1;for(;t.length<i;)t.push(new Fl);for(;e.length<s;)e.push(new Ul);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=me._textureArrayPool,s=this.renderer.batch,n=this._tempBoundTextures,o=this.renderer.textureGC.count;let a=++rt._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;rt._globalBatch=a}buildDrawCalls(t,e,i){const{_bufferedElements:s,_attributeBuffer:n,_indexBuffer:o,vertexSize:a}=this,l=me._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],_=p._texture.baseTexture,m=Hf[_.alphaMode?1:0][p.blendMode];s[f]=null,e<f&&d.blend!==m&&(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=m}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;me.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=me._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),me.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=Kn(Math.ceil(t/8)),i=su(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 kl(s*this.vertexSize*4)),n}getIndexBuffer(t){const e=Kn(Math.ceil(t/12)),i=su(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=ft.shared.setValue(t._tintRGB).toPremultiplied(f,t._texture.baseTexture.alphaMode>0);for(let _=0;_<u.length;_+=2)a[s++]=u[_],a[s++]=u[_+1],a[s++]=h[_],a[s++]=h[_+1],o[s++]=p,a[s++]=d;for(let _=0;_<c.length;_++)i[n++]=l+c[_]}};ls.defaultBatchSize=4096,ls.extension={name:"batch",type:G.RendererPlugin},ls._drawCallPool=[],ls._textureArrayPool=[];let zr=ls;q.add(zr);var Zv=`varying vec2 vTextureCoord; 348 349uniform sampler2D uSampler; 350 351void main(void){ 352 gl_FragColor = texture2D(uSampler, vTextureCoord); 353} 354`,Kv=`attribute vec2 aVertexPosition; 355 356uniform mat3 projectionMatrix; 357 358varying vec2 vTextureCoord; 359 360uniform vec4 inputSize; 361uniform vec4 outputFrame; 362 363vec4 filterVertexPosition( void ) 364{ 365 vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; 366
367 return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); 368} 369 370vec2 filterTextureCoord( void ) 371{ 372 return aVertexPosition * (outputFrame.zw * inputSize.zw); 373} 374 375void main(void) 376{ 377 gl_Position = filterVertexPosition(); 378 vTextureCoord = filterTextureCoord(); 379} 380`;const Gl=class hs extends Le{constructor(t,e,i){const s=Qe.from(t||hs.defaultVertexSrc,e||hs.defaultFragmentSrc);super(s,i),this.padding=0,this.resolution=hs.defaultResolution,this.multisample=hs.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new Ge}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 Kv}static get defaultFragmentSrc(){return Zv}};Gl.defaultResolution=1,Gl.defaultMultisample=At.NONE;let Ot=Gl;class to{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new ft(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(){}}to.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},to.extension={type:[G.RendererSystem,G.CanvasRendererSystem],name:"background"};q.add(to);class Kf{constructor(t){this.renderer=t,this.emptyRenderer=new Ro(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}}Kf.extension={type:G.RendererSystem,name:"batch"};q.add(Kf);let _u=0;class eo{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(z.PREFER_ENV>=ii.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")};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")}}eo.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},eo.extension={type:G.RendererSystem,name:"context"};q.add(eo);class Hl{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 xe("disposeFramebuffer"),this.multisample=At.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new rt(null,{scaleMode:Ze.NEAREST,resolution:1,mipmap:Ue.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new rt(null,{scaleMode:Ze.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:Ue.OFF,format:N.DEPTH_COMPONENT,type:K.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 Jf extends rt{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=At.NONE),super(null,t),this.mipmap=Ue.OFF,this.valid=!0,this._clear=new ft([0,0,0,0]),this.framebuffer=new Hl(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.he
vendor: 18,315 bytes, line 380
380ight)}dispose(){this.framebuffer.dispose(),super.dispose()}destroy(){super.destroy(),this.framebuffer.destroyDepthTexture(),this.framebuffer=null}}class Tr extends Cs{constructor(t){const e=t,i=e.naturalWidth||e.videoWidth||e.width,s=e.naturalHeight||e.videoHeight||e.height;super(i,s),this.source=t,this.noSubImage=!1}static crossOrigin(t,e,i){i===void 0&&!e.startsWith("data:")?t.crossOrigin=bv(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===Wt.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 Qf extends Tr{constructor(t,e){if(e=e||{},typeof t=="string"){const i=new Image;Tr.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??z.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===Wt.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 Bh{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=vt.add(i,vt.NW),this.x0=l+o*vt.uX(i),this.y0=h+a*vt.uY(i),i=vt.add(i,2),this.x1=l+o*vt.uX(i),this.y1=h+a*vt.uY(i),i=vt.add(i,2),this.x2=l+o*vt.uX(i),this.y2=h+a*vt.uY(i),i=vt.add(i,2),this.x3=l+o*vt.uX(i),this.y3=h+a*vt.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}}Bh.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 mu=new Bh;function js(r){r.destroy=function(){},r.on=function(){},r.once=function(){},r.emit=function(){}}class Y extends Rs{constructor(t,e,i,s,n,o,a){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new et(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=mu,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 ht(o.x,o.y):new ht(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?.url&&Re[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(){const t=this._frame.clone(),e=this._frame===this.orig?t:this.orig.clone(),i=new Y(this.baseTexture,!this.noFrame&&t,e,this.trim?.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(i._frame=t),i}updateUvs(){this._uvs===mu&&(this._uvs=new Bh),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},i=z.STRICT_TEXTURE_CACHE){const s=typeof t=="string";let n=null;if(s)n=t;else if(t instanceof rt){if(!t.cacheId){const a=e?.pixiIdPrefix||"pixiid";t.cacheId=`${a}-${ti()}`,rt.addToCache(t,t.cacheId)}n=t.cacheId}else{if(!t._pixiId){const a=e?.pixiIdPrefix||"pixiid";t._pixiId=`${a}_${ti()}`}n=t._pixiId}let o=Re[n];if(s&&i&&!o)throw new Error(`The cacheId "${n}" does not exist in TextureCache.`);return!o&&!(t instanceof rt)?(e.resolution||(e.resolution=ir(t)),o=new Y(new rt(t,e)),o.baseTexture.cacheId=n,rt.addToCache(o.baseTexture,n),Y.addToCache(o,n)):!o&&t instanceof rt&&(o=new Y(t),Y.addToCache(o,n)),o}static fromURL(t,e){const i=Object.assign({autoLoad:!1},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(rt.fromBuffer(t,e,i,s))}static fromLoader(t,e,i,s){const n=new rt(t,Object.assign({scaleMode:rt.defaultOptions.scaleMode,resolution:ir(e)},s)),{resource:o}=n;o instanceof Qf&&(o.url=e);const a=new Y(n);return i||(i=e),rt.addToCache(a.baseTexture,i),Y.addToCache(a,i),i!==e&&(rt.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),Re[e]&&Re[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),Re[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=Re[t];if(e){const i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete Re[t],e}}else if(t?.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)Re[t.textureCacheIds[e]]===t&&delete Re[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 rt),js(Y._EMPTY),js(Y._EMPTY.baseTexture)),Y._EMPTY}static get WHITE(){if(!Y._WHITE){const t=z.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(rt.from(t)),js(Y._WHITE),js(Y._WHITE.baseTexture)}return Y._WHITE}}class Lt 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 Lt(new Jf(t))}}class tp{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,i=At.NONE){const s=new Jf(Object.assign({width:t,height:e,resolution:1,multisample:i},this.textureOptions));return new Lt(s)}getOptimalTexture(t,e,i=1,s=At.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=Kn(t),e=Kn(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||At.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}}}tp.SCREEN_KEY=-1;class Jv extends wr{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}}class ep extends wr{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 Et(this.vertices),this.uvBuffer=new Et(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 Qv{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=At.NONE,this.sourceFrame=new et,this.destinationFrame=new et,this.bindingSourceFrame=new et,this.bindingDestinationFrame=new et,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}}const Ys=[new ht,new ht,new ht,new ht],Ca=new gt;class rp{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new tp,this.statePool=[],this.quad=new Jv,this.quadUv=new ep,this.tempRect=new et,this.activeState={},this.globalUniforms=new we({outputFrame:new et,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 Qv,o=i.renderTexture;let a,l;if(o.current){const m=o.current;a=m.resolution,l=m.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 m=1;m<e.length;m++){const g=e[m];h=Math.min(h,g.resolution||a),c=Math.min(c,g.multisample??l),u=this.useMaxPadding?Math.max(u,g.padding):u+g.padding,d=d&&g.autoFit,f=f||(g.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(Ca.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 _=this.tempRect;_.x=0,_.y=0,_.width=n.sourceFrame.width,_.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,_),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,ke.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,ke.CLEAR,e);const d=h;h=c,c=d}i[u].apply(this,h,l.renderTexture,ke.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=ke.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?.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===ke.CLEAR||e===ke.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(Oe.TRIANGLES)):(n.geometry.bind(this.quad),n.geometry.draw(Oe.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(gt.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=At.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||At.NONE);return s.filterFrame=t.filterFrame,s}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}
vendor: 5,277 bytes, line 380
380resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){const i=Ys[0],s=Ys[1],n=Ys[2],o=Ys[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?Ca.copyFrom(n):Ca.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)}}}rp.extension={type:G.RendererSystem,name:"filter"};q.add(rp);class tb{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=At.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const eb=new et;class ip{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Hl(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 et,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;z.PREFER_ENV===ii.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=fl.COLOR|fl.DEPTH){const{gl:o}=this;o.clearColor(t,e,i,s),o.clear(n)}initFramebuffer(t){const{gl:e}=this,i=new tb(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))}
vendor: 2,294 bytes, line 380
380if(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=At.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=At.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 Hl(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=eb,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>
vendor: 7,862 bytes, lines 380-397
380=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 et}destroy(){this.renderer=null}}ip.extension={type:G.RendererSystem,name:"framebuffer"};q.add(ip);const Ia={5126:4,5123:2,5121:1};class sp{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;z.PREFER_ENV===ii.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 _ in u)f[_]=0,p[_]=0;for(const _ in d)!d[_].size&&a.attributeData[_]?d[_].size=a.attributeData[_].size:d[_].size||console.warn(`PIXI Geometry attribute '${_}' size cannot be determined (likely the bound shader does not have the attribute)`),f[d[_].buffer]+=d[_].size*Ia[d[_].type];for(const _ in d){const m=d[_],g=m.size;m.stride===void 0&&(f[m.buffer]===g*Ia[m.type]?m.stride=0:m.stride=f[m.buffer]),m.start===void 0&&(m.start=p[m.buffer],p[m.buffer]+=g*Ia[m.type])}c=s.createVertexArray(),s.bindVertexArray(c);for(let _=0;_<u.length;_++){const m=u[_];o.bind(m),i&&m._glBuffers[n].refCount++}return this.activateVao(t,a),h[a.id]=c,h[l]=c,s.bindVertexArray(null),o.unbind(Ne.ARRAY_BUFFER),c}disposeGeometry(t,e){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=this.renderer?.buffer;if(t.disposeRunner.remove(this),!!i){if(o)for(let a=0;a<n.length;a++){const l=n[a]._glBuffers[this.CONTEXT_UID];l&&(l.refCount--,l.refCount===0&&!e&&o.dispose(n[a],e))}if(!e){for(const a in i)if(a[0]==="g"){const l=i[a];this._activeVao===l&&this.unbind(),s.deleteVertexArray(l)}}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}}sp.extension={type:G.RendererSystem,name:"geometry"};q.add(sp);const gu=new gt;class np{constructor(t,e){this._texture=t,this.mapCoord=new gt,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&&(gu.set(s.width/n.width,0,0,s.height/n.height,-n.x/n.width,-n.y/n.height),this.mapCoord.append(gu));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 rb=`varying vec2 vMaskCoord; 381varying vec2 vTextureCoord; 382 383uniform sampler2D uSampler; 384uniform sampler2D mask; 385uniform float alpha; 386uniform float npmAlpha; 387uniform vec4 maskClamp; 388 389void main(void) 390{ 391 float clip = step(3.5, 392 step(maskClamp.x, vMaskCoord.x) + 393 step(maskClamp.y, vMaskCoord.y) + 394 step(vMaskCoord.x, maskClamp.z) + 395 step(vMaskCoord.y, maskClamp.w)); 396 397 vec4 original = texture2D(uSampler, vTextureCoord);
398 vec4 masky = texture2D(mask, vMaskCoord); 399 float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a); 400 401 original *= (alphaMul * masky.r * alpha * clip); 402 403 gl_FragColor = original; 404} 405`,ib=`attribute vec2 aVertexPosition; 406attribute vec2 aTextureCoord; 407 408uniform mat3 projectionMatrix; 409uniform mat3 otherMatrix; 410 411varying vec2 vMaskCoord; 412varying vec2 vTextureCoord; 413 414void main(void) 415{ 416 gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); 417 418 vTextureCoord = aTextureCoord; 419 vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy; 420} 421`;class sb extends Ot{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||ib,e||rb,i),this.maskSprite=s,this.maskMatrix=new gt}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 np(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 nb{constructor(t=null){this.type=Ct.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=Ot.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=Ct.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 op{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 nb;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!==Ct.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case Ct.SCISSOR:this.renderer.scissor.push(i);break;case Ct.STENCIL:this.renderer.stencil.push(i);break;case Ct.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case Ct.COLOR:this.pushColorMask(i);break}i.type===Ct.SPRITE&&this.maskStack.push(i)}pop(t){const 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){const i=this.maskStack[this.maskStack.length-1];i.type===Ct.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}}detect(t){const 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}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 sb])),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}}op.extension={type:G.RendererSystem,name:"mask"};q.add(op);class ap{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 yu=new gt,vu=[],lp=class vn extends ap{constructor(t){super(t),this.glConst=z.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0}
vendor: 8,671 bytes, line 421
421calcScissorRect(t){if(t._scissorRectLocal)return;const e=t._scissorRect,{maskObject:i}=t,{renderer:s}=this,n=s.renderTexture,o=i.getBounds(!0,vu.pop()??new et);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()||vn.isMatrixRotated(e.worldTransform)||vn.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){vn.isMatrixRotated(n)||(n=n?yu.copyFrom(n):yu.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&&vu.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)}};lp.extension={type:G.RendererSystem,name:"scissor"};let ob=lp;q.add(ob);class hp extends ap{constructor(t){super(t),this.glConst=z.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)}}hp.extension={type:G.RendererSystem,name:"stencil"};q.add(hp);class cp{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return ot("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract}},prepare:{enumerable:!1,get(){return ot("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare}},interaction:{enumerable:!1,get(){return ot("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}}cp.extension={type:[G.RendererSystem,G.CanvasRendererSystem],name:"_plugin"};q.add(cp);class up{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new gt,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}}up.extension={type:G.RendererSystem,name:"projection"};q.add(up);const ab=new kh,bu=new et;class dp{constructor(t){this.renderer=t,this._tempMatrix=new gt}generateTexture(t,e){const{region:i,...s}=e||{},n=i?.copyTo(bu)||t.getLocalBounds(bu,!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=Lt.create(s);this._tempMatrix.tx=-n.x,this._tempMatrix.ty=-n.y;const l=t.transform;return t.transform=ab,this.renderer.render(t,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=l,a}destroy(){}}dp.extension={type:[G.RendererSystem,G.CanvasRendererSystem],name:"textureGenerator"};q.add(dp);const Dr=new et,rs=new et;class fp{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new et,this.destinationFrame=new et,this.viewportFrame=new et}contextChange(){const t=this.renderer?.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||(Dr.width=t.frame.width,Dr.height=t.frame.height,e=Dr),i||(rs.x=t.frame.x,rs.y=t.frame.y,rs.width=e.width,rs.height=e.height,i=rs),o=n.framebuffer):(a=s.resolution,e||(Dr.width=s._view.screen.width,Dr.height=s._view.screen.height,e=Dr),i||(i=Dr,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=ft.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}}fp.extension={type:G.RendererSystem,name:"renderTexture"};q.add(fp);class lb{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 hb(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=Zf(t,n.type),a={type:o,name:n.name,size:qf(o),location:t.getAttribLocation(r,n.name)};e[n.name]=a}return e}function cb(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=Zf(t,n.type);e[o]={name:o,index:s,type:l,size:n.size,isArray:a,value:jf(l,n.size)}}return e}function ub(r,t){const e=uu(r,r.VERTEX_SHADER,t.vertexSrc),i=uu(r,r.FRAGMENT_SHADER,t.fragmentSrc),s=r.createProgram();r.attachShader(s,e),r.attachShader(s,i);const n=t.extra?.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)||Gv(r,s,e,i),t.attributeData=hb
vendor: 5,018 bytes, lines 421-491
421(s,r),t.uniformData=cb(s,r),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertexSrc)){const a=Object.keys(t.attributeData);a.sort((l,h)=>l>h?1:-1);for(let l=0;l<a.length;l++)t.attributeData[a[l]].location=l,r.bindAttribLocation(s,l,a[l]);r.linkProgram(s)}r.deleteShader(e),r.deleteShader(i);const o={};for(const a in t.uniformData){const l=t.uniformData[a];o[a]={location:r.getUniformLocation(s,a),value:jf(l.type,l.size)}}return new lb(s,o)}function db(r,t,e,i,s){e.buffer.update(s)}const fb={float:` 422 data[offset] = v; 423 `,vec2:` 424 data[offset] = v[0]; 425 data[offset+1] = v[1]; 426 `,vec3:` 427 data[offset] = v[0]; 428 data[offset+1] = v[1]; 429 data[offset+2] = v[2]; 430 431 `,vec4:` 432 data[offset] = v[0]; 433 data[offset+1] = v[1]; 434 data[offset+2] = v[2]; 435 data[offset+3] = v[3]; 436 `,mat2:` 437 data[offset] = v[0]; 438 data[offset+1] = v[1]; 439 440 data[offset+4] = v[2]; 441 data[offset+5] = v[3]; 442 `,mat3:` 443 data[offset] = v[0]; 444 data[offset+1] = v[1]; 445 data[offset+2] = v[2]; 446 447 data[offset + 4] = v[3]; 448 data[offset + 5] = v[4]; 449 data[offset + 6] = v[5]; 450 451 data[offset + 8] = v[6]; 452 data[offset + 9] = v[7]; 453 data[offset + 10] = v[8]; 454 `,mat4:` 455 for(var i = 0; i < 16; i++) 456 { 457 data[offset + i] = v[i]; 458 } 459 `},pp={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 pb(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=pp[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 _b(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 mb(r,t){if(!r.autoManage)return{size:0,syncFunc:db};const e=_b(r.uniforms,t),{uboElements:i,size:s}=pb(e),n=[` 460 var v = null; 461 var v2 = null; 462 var cv = null; 463 var t = 0; 464 var gl = renderer.gl 465 var index = 0; 466 var data = buffer.data; 467 `];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<Di.length;u++){const d=Di[u];if(d.codeUbo&&d.test(a.data,l)){n.push(`offset = ${a.offset/4};`,Di[u].codeUbo(a.data.name,l)),c=!0;break}}if(!c)if(a.data.size>1){const u=qf(a.data.type),d=Math.max(pp[a.data.type]/16,1),f=u/d,p=(4-f%4)%4;n.push(` 468 cv = ud.${h}.value; 469 v = uv.${h}; 470 offset = ${a.offset/4}; 471 472 t = 0; 473 474 for(var i=0; i < ${a.data.size*d}; i++) 475 { 476 for(var j = 0; j < ${f}; j++) 477 { 478 data[offset++] = v[t++]; 479 } 480 offset += ${p}; 481 } 482 483 `)}else{const u=fb[a.data.type];n.push(` 484 cv = ud.${h}.value; 485 v = uv.${h}; 486 offset = ${a.offset/4}; 487 ${u}; 488 `)}}return n.push(` 489 renderer.buffer.update(buffer); 490 `),{size:s,syncFunc:new Function("ud","uv","renderer","syncData","buffer",n.join(` 491`))}}let gb=0;const qs={textureCount:0,uboCount:0};class _p{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=gb++}systemCheck(){if(!$v())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||(qs.textureCount=0,qs.uboCount=0,this.syncUniformGroup(t.uniformGroup,qs)),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]=Nv(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);
vendor: 16,844 bytes, line 491
491t.buffer.update(),s(i.uniformData,t.uniforms,this.renderer,qs,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]=mb(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=ub(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}}_p.extension={type:G.RendererSystem,name:"shader"};q.add(_p);class ro{constructor(t){this.renderer=t}run(t){const{renderer:e}=this;e.runners.init.emit(e.options),t.hello&&console.log(`PixiJS 7.3.2 - ${e.rendererLogId} - https://pixijs.com`),e.resize(e.screen.width,e.screen.height)}destroy(){}}ro.defaultOptions={hello:!1},ro.extension={type:[G.RendererSystem,G.CanvasRendererSystem],name:"startup"};q.add(ro);function yb(r,t=[]){return 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}const vb=0,bb=1,xb=2,wb=3,Tb=4,Eb=5,mp=class $l{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=J.NONE,this._blendEq=!1,this.map=[],this.map[vb]=this.setBlend,this.map[bb]=this.setOffset,this.map[xb]=this.setCullFace,this.map[wb]=this.setDepthTest,this.map[Tb]=this.setFrontFace,this.map[Eb]=this.setDepthMask,this.checks=[],this.defaultState=new Ge,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=yb(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($l.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck($l.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}};mp.extension={type:G.RendererSystem,name:"state"};let Ab=mp;q.add(Ab);class Sb extends Rs{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 xe(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 cs=class bn{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=bn.defaultMaxIdle,this.checkCountMax=bn.defaultCheckCountMax,this.mode=bn.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==wh.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}};cs.defaultMode=wh.AUTO,cs.defaultMaxIdle=60*60,cs.defaultCheckCountMax=60*10,cs.extension={type:G.RendererSystem,name:"textureGC"};let Xr=cs;q.add(Xr);class Ra{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=K.UNSIGNED_BYTE,this.internalFormat=N.RGBA,this.samplerType=0}}function Cb(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[r.RGB]:$.FLOAT,[r.RGBA]:$.FLOAT,[r.ALPHA]:$.FLOAT,[r.LUMINANCE]:$.FLOAT,[r.LUMINANCE_ALPHA]:$.FLOAT,[r.R8]:$.FLOAT,[r.R8_SNORM]:$.FLOAT,[r.RG8]:$.FLOAT,[r.RG8_SNORM]:$.FLOAT,[r.RGB8]:$.FLOAT,[r.RGB8_SNORM]:$.FLOAT,[r.RGB565]:$.FLOAT,[r.RGBA4]:$.FLOAT,[r.RGB5_A1]:$.FLOAT,[r.RGBA8]:$.FLOAT,[r.RGBA8_SNORM]:$.FLOAT,[r.RGB10_A2]:$.FLOAT,[r.RGB10_A2UI]:$.FLOAT,[r.SRGB8]:$.FLOAT,[r.SRGB8_ALPHA8]:$.FLOAT,[r.R16F]:$.FLOAT,[r.RG16F]:$.FLOAT,[r.RGB16F]:$.FLOAT,[r.RGBA16F]:$.FLOAT,[r.R32F]:$.FLOAT,[r.RG32F]:$.FLOAT,[r.RGB32F]:$.FLOAT,[r.RGBA32F]:$.FLOAT,[r.R11F_G11F_B10F]:$.FLOAT,[r.RGB9_E5]:$.FLOAT,[r.R8I]:$.INT,[r.R8UI]:$.UINT,[r.R16I]:$.INT,[r.R16UI]:$.UINT,[r.R32I]:$.INT,[r.R32UI]:$.UINT,[r.RG8I]:$.INT,[r.RG8UI]:$.UINT,[r.RG16I]:$.INT,[r.RG16UI]:$.UINT,[r.RG32I]:$.INT,[r.RG32UI]:$.UINT,[r.RGB8I]:$.INT,[r.RGB8UI]:$.UINT,[r.RGB16I]:$.INT,[r.RGB16UI]:$.UINT,[r.RGB32I]:$.INT,[r.RGB32UI]:$.UINT,[r.RGBA8I]:$.INT,[r.RGBA8UI]:$.UINT,[r.RGBA16I]:$.INT,[r.RGBA16UI]:$.UINT,[r.RGBA32I]:$.INT,[r.RGBA32UI]:$.UINT,[r.DEPTH_COMPONENT16]:$.FLOAT,[r.DEPTH_COMPONENT24]:$.FLOAT,[r.DEPTH_COMPONENT32F]:$.FLOAT,[r.DEPTH_STENCIL]:$.FLOAT,[r.DEPTH24_STENCIL8]:$.FLOAT,[r.DEPTH32F_STENCIL8]:$.FLOAT}:t={[r.RGB]:$.FLOAT,[r.RGBA]:$.FLOAT,[r.ALPHA]:$.FLOAT,[r.LUMINANCE]:$.FLOAT,[r.LUMINANCE_ALPHA]:$.FLOAT,[r.DEPTH_STENCIL]:$.FLOAT},t}function Ib(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[K.UNSIGNED_BYTE]:{[N.RGBA]:r.RGBA8,[N.RGB]:r.RGB8,[N.RG]:r.RG8,[N.RED]:r.R8,[N.RGBA_INTEGER]:r.RGBA8UI,[N.RGB_INTEGER]:r.RGB8UI,[N.RG_INTEGER]:r.RG8UI,[N.RED_INTEGER]:r.R8UI,[N.ALPHA]:r.ALPHA,[N.LUMINANCE]:r.LUMINANCE,[N.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[K.BYTE]:{[N.RGBA]:r.RGBA8_SNORM,[N.RGB]:r.RGB8_SNORM,[N.RG]:r.RG8_SNORM,[N.RED]:r.R8_SNORM,[N.RGBA_INTEGER]:r.RGBA8I,[N.RGB_INTEGER]:r.RGB8I,[N.RG_INTEGER]:r.RG8I,[N.RED_INTEGER]:r.R8I},[K.UNSIGNED_SHORT]:{[N.RGBA_INTEGER]:r.RGBA16UI,[N.RGB_INTEGER]:r.RGB16UI,[N.RG_INTEGER]:r.RG16UI,[N.RED_INTEGER]:r.R16UI,[N.DEPTH_COMPONENT]:r.DEPTH_COMPONENT16},[K.SHORT]:{[N.RGBA_INTEGER]:r.RGBA16I,[N.RGB_INTEGER]:r.RGB16I,[N.RG_INTEGER]:r.RG16I,[N.RED_INTEGER]:r.R16I},[K.UNSIGNED_INT]:{[N.RGBA_INTEGER]:r.RGBA32UI,[N.RGB_INTEGER]:r.RGB32UI,[N.RG_INTEGER]:r.RG32UI,[N.RED_INTEGER]:r.R32UI,[N.DEPTH_COMPONENT]:r.DEPTH_COMPONENT24},[K.INT]:{[N.RGBA_INTEGER]:r.RGBA32I,[N.RGB_INTEGER]:r.RGB32I,[N.RG_INTEGER]:r.RG32I,[N.RED_INTEGER]:r.R32I},[K.FLOAT]:{[N.RGBA]:r.RGBA32F,[N.RGB]:r.RGB32F,[N.RG]:r.RG32F,[N.RED]:r.R32F,[N.DEPTH_COMPONENT]:r.DEPTH_COMPONENT32F},[K.HALF_FLOAT]:{[N.RGBA]:r.RGBA16F,[N.RGB]:r.RGB16F,[N.RG]:r.RG16F,[N.RED]:r.R16F},[K.UNSIGNED_SHORT_5_6_5]:{[N.RGB]:r.RGB565},[K.UNSIGNED_SHORT_4_4_4_4]:{[N.RGBA]:r.RGBA4},[K.UNSIGNED_SHORT_5_5_5_1]:{[N.RGBA]:r.RGB5_A1},[K.UNSIGNED_INT_2_10_10_10_REV]:{[N.RGBA]:r.RGB10_A2,[N.RGBA_INTEGER]:r.RGB10_A2UI},[K.UNSIGNED_INT_10F_11F_11F_REV]:{[N.RGB]:r.R11F_G11F_B10F},[K.UNSIGNED_INT_5_9_9_9_REV]:{[N.RGB]:r.RGB9_E5},[K.UNSIGNED_INT_24_8]:{[N.DEPTH_STENCIL]:r.DEPTH24_STENCIL8},[K.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[N.DEPTH_STENCIL]:r.DEPTH32F_STENCIL8}}:t={[K.UNSIGNED_BYTE]:{[N.RGBA]:r.RGBA,[N.RGB]:r.RGB,[N.ALPHA]:r.ALPHA,[N.LUMINANCE]:r.LUMINANCE,[N.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[K.UNSIGNED_SHORT_5_6_5]:{[N.RGB]:r.RGB},[K.UNSIGNED_SHORT_4_4_4_4]:{[N.RGBA]:r.RGBA},[K.UNSIGNED_SHORT_5_5_5_1]:{[N.RGBA]:r.RGBA}},t}class gp{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new rt,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=Ib(t),this.samplerTypes=Cb(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 Ra(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 Ra(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?.castToBaseTexture(),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!==$.FLOAT&&this.renderer.texture.unbind(o)}}initTexture(t){const e=new Ra(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){e.internalFormat=this.internalFormats[t.type]?.[t.format]??t.format,e.samplerType=this.samplerTypes[e.internalFormat]??$.FLOAT,this.webGLVersion===2&&t.type===K.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){const e=t._glTextures[this.CONTEXT_UID];if(!e)return;const i=this.renderer;if(this.initTextureType(t,e),t.resource?.upload(i,t,e))e.samplerType!==$.FLOAT&&(this.hasIntegerTextures=!0);else{const s=t.realWidth,n=t.realHeight,o=i.gl;(e.width!==s||e.height!==n||e.dirtyId<0)&&(e.width=s,e.height=n,o.texImage2D(t.target,0,e.internalFormat,s,n,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&&Bi(this.managedTextures,s,1)}}updateTextureStyle(t){const e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===Ue.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=br.CLAMP:e.wrapMode=t.wrapMode,t.resource?.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!==Ue.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===Ze.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);const s=this.renderer.context.extensions.anisotropicFiltering;if(s&&t.anisotropicLevel>0&&t.scaleMode===Ze.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===Ze.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(t.target,i.TEXTURE_MAG_FILTER,t.scaleMode===Ze.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}}gp.extension={type:G.RendererSystem,name:"texture"};q.add(gp);class yp{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;
491t.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}}yp.extension={type:G.RendererSystem,name:"transformFeedback"};q.add(yp);class io{constructor(t){this.renderer=t}init(t){this.screen=new et(0,0,t.width,t.height),this.element=t.view||z.ADAPTER.createCanvas(),this.resolution=t.resolution||z.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){t&&this.element.parentNode?.removeChild(this.element),this.renderer=null,this.element=null,this.screen=null}}io.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},io.extension={type:[G.RendererSystem,G.CanvasRendererSystem],name:"_view"};q.add(io);z.PREFER_ENV=ii.WEBGL2;z.STRICT_TEXTURE_CACHE=!1;z.RENDER_OPTIONS={...eo.defaultOptions,...to.defaultOptions,...io.defaultOptions,...ro.defaultOptions};Object.defineProperties(z,{WRAP_MODE:{get(){return rt.defaultOptions.wrapMode},set(r){ot("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),rt.defaultOptions.wrapMode=r}},SCALE_MODE:{get(){return rt.defaultOptions.scaleMode},set(r){ot("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),rt.defaultOptions.scaleMode=r}},MIPMAP_TEXTURES:{get(){return rt.defaultOptions.mipmap},set(r){ot("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),rt.defaultOptions.mipmap=r}},ANISOTROPIC_LEVEL:{get(){return rt.defaultOptions.anisotropicLevel},set(r){ot("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),rt.defaultOptions.anisotropicLevel=r}},FILTER_RESOLUTION:{get(){return ot("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),Ot.defaultResolution},set(r){Ot.defaultResolution=r}},FILTER_MULTISAMPLE:{get(){return ot("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),Ot.defaultMultisample},set(r){Ot.defaultMultisample=r}},SPRITE_MAX_TEXTURES:{get(){return zr.defaultMaxTextures},set(r){ot("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),zr.defaultMaxTextures=r}},SPRITE_BATCH_SIZE:{get(){return zr.defaultBatchSize},set(r){ot("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),zr.defaultBatchSize=r}},CAN_UPLOAD_SAME_BUFFER:{get(){return zr.canUploadSameBuffer},set(r){ot("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),zr.canUploadSameBuffer=r}},GC_MODE:{get(){return Xr.defaultMode},set(r){ot("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),Xr.defaultMode=r}},GC_MAX_IDLE:{get(){return Xr.defaultMaxIdle},set(r){ot("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),Xr.defaultMaxIdle=r}},GC_MAX_CHECK_COUNT:{get(){return Xr.defaultCheckCountMax},set(r){ot("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),Xr.defaultCheckCountMax=r}},PRECISION_VERTEX:{get(){return Qe.defaultVertexPrecision},set(r){ot("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),Qe.defaultVertexPrecision=r}},PRECISION_FRAGMENT:{get(){return Qe.defaultFragmentPrecision},set(r){ot("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),Qe.defaultFragmentPrecision=r}}});var ei=(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))(ei||{});class Pa{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.
vendor: 4,087 bytes, lines 491-500
491next,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 vp=class qt{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 Pa(null,null,1/0),this.deltaMS=1/qt.targetFPMS,this.elapsedMS=1/qt.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=ei.NORMAL){return this._addListener(new Pa(t,e,i))}addOnce(t,e,i=ei.NORMAL){return this._addListener(new Pa(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*qt.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,qt.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(!qt._shared){const t=qt._shared=new qt;t.autoStart=!0,t._protected=!0}return qt._shared}static get system(){if(!qt._system){const t=qt._system=new qt;t.autoStart=!0,t._protected=!0}return qt._system}};vp.targetFPMS=.06;let Qt=vp;Object.defineProperties(z,{TARGET_FPMS:{get(){return Qt.targetFPMS},set(r){ot("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),Qt.targetFPMS=r}}});class bp{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,ei.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?Qt.shared:new Qt,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}bp.extension=G.Application;q.add(bp);const xp=[];q.handleByList(G.Renderer,xp);function Rb(r){for(const t of xp)if(t.test(r))return new t(r);throw new Error("Unable to auto-detect a suitable renderer.")}var Pb=`attribute vec2 aVertexPosition; 492attribute vec2 aTextureCoord; 493 494uniform mat3 projectionMatrix; 495 496varying vec2 vTextureCoord; 497 498void main(void) 499{ 500 gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0
500)).xy, 0.0, 1.0); 501 vTextureCoord = aTextureCoord; 502}`,Mb=`attribute vec2 aVertexPosition; 503 504uniform mat3 projectionMatrix; 505 506varying vec2 vTextureCoord; 507 508uniform vec4 inputSize; 509uniform vec4 outputFrame; 510 511vec4 filterVertexPosition( void ) 512{ 513 vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; 514 515 return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); 516} 517 518vec2 filterTextureCoord( void ) 519{ 520 return aVertexPosition * (outputFrame.zw * inputSize.zw); 521} 522 523void main(void) 524{ 525 gl_Position = filterVertexPosition(); 526 vTextureCoord = filterTextureCoord(); 527} 528`;const kb=Pb,wp=Mb;class Tp{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>=At.HIGH?this.multisample=At.HIGH:e>=At.MEDIUM?this.multisample=At.MEDIUM:e>=At.LOW?this.multisample=At.LOW:this.multisample=At.NONE}destroy(){}}Tp.extension={type:G.RendererSystem,name:"_multisample"};q.add(Tp);class Bb{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class Ep{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 Bb(i.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}}Ep.extension={type:G.RendererSystem,name:"buffer"};q.add(Ep);class Ap{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}}Ap.extension={type:G.RendererSystem,name:"objectRenderer"};q.add(Ap);const xn=class zl extends Sb{constructor(t){super(),this.type=_f.WEBGL,t=Object.assign({},z.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new we({projectionMatrix:new gt},!0);const e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:zl.__systems,priority:["_view","textureGenerator","background","_plugin","startup","context","state","texture","buffer","geometry","framebuffer","transformFeedback","mask","scissor","stencil","projection","textureGC","filter","renderTexture","batch","objectRenderer","_multisample"]};
528this.setup(e),"useContextAlpha"in t&&(ot("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=zl.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t?.forceCanvas?!1:rv()}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 ot("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return ot("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return ot("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return ot("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){ot("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return ot("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){ot("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return ot("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)}};xn.extension={type:G.Renderer,priority:1},xn.__plugins={},xn.__systems={};let Dh=xn;
vendor: 4,446 bytes, line 528
528q.handleByMap(G.RendererPlugin,Dh.__plugins);q.handleByMap(G.RendererSystem,Dh.__systems);q.add(Dh);class Sp 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 rt;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(Xf(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 Db extends Sp{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=Pi.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 Fb extends Tr{constructor(t){super(t)}static test(t){const{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}}const Cp=class us extends Sp{constructor(t,e){const{width:i,height:s,autoLoad:n,linkBaseTexture:o}=e||{};if(t&&t.length!==us.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:i,height:s});for(let a=0;a<us.SIDES;a++)this.items[a].target=Pi.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=Pi.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=Pi.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<us.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===us.SIDES}};Cp.SIDES=6;let Ob=Cp;class Ii extends Tr{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 z.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===Wt.
vendor: 18,524 bytes, line 528
528UNPACK?"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??z.ADAPTER.createCanvas(0,0),Ii._EMPTY}}const Xl=class wn extends Tr{constructor(t,e){e=e||{},super(z.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)},wn.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;Tr.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_${ti()}`,o.getContext("2d").drawImage(t,0,0,e,i,0,0,s,n),this._resolve(),this._resolve=null}}static getSize(t){const e=wn.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"&&wn.SVG_XML.test(t)}};Xl.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,Xl.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let Vl=Xl;const Wl=class jl extends Tr{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];Tr.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||jl.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=Qt.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&&(Qt.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||(Qt.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Qt.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||jl.TYPES.includes(e)}};Wl.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Wl.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let Ip=Wl;Bl.push(Ii,Qf,Fb,Ip,Vl,Ao,Ob,Db);class so{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?et.EMPTY:(t=t||new et(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,_=this.maxY,m=o*e+l*i+c,g=a*e+h*i+u;d=m<d?m:d,f=g<f?g:f,p=m>p?m:p,_=g>_?g:_,m=o*s+l*i+c,g=a*s+h*i+u,d=m<d?m:d,f=g<f?g:f,p=m>p?m:p,_=g>_?g:_,m=o*e+l*n+c,g=a*e+h*n+u,d=m<d?m:d,f=g<f?g:f,p=m>p?m:p,_=g>_?g:_,m=o*s+l*n+c,g=a*s+h*n+u,d=m<d?m:d,f=g<f?g:f,p=m>p?m:p,_=g>_?g:_,this.minX=d,this.minY=f,this.maxX=p,this.maxY=_}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,_=this.maxX,m=this.maxY;for(let g=i;g<s;g+=2){const v=e[g],y=e[g+1],b=a*v+h*y+u,E=c*y+l*v+d;f=Math.min(f,b-n),_=Math.max(_,b+n),p=Math.min(p,E-o),m=Math.max(m,E+o)}this.minX=f,this.minY=p,this.maxX=_,this.maxY=m}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 xt extends Rs{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new kh,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 so,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(xt.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 et),e=this._boundsRect),this._bounds.getRectangle(e)}getLocalBounds(t){t||(this._localBoundsRect||(this._localBoundsRect=new et),t=this._localBoundsRect),this._localBounds||(this._localBounds=new so);const e=this.transform,i=this.parent;this.parent=null,this._tempDisplayObjectParent.worldAlpha=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(){this.parent?.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 Nb),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*Pv}set angle(t){this.transform.rotation=t*Mv}get zIndex(){return this._zIndex}set 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 Nb extends xt{constructor(){super(...arguments),this.sortDirty=null}}xt.prototype.displayObjectUpdateTransform=xt.prototype.updateTransform;const Lb=new gt;function Ub(r,t){return r.zIndex===t.zIndex?r._lastSortedIndex-t._lastSortedIndex:r.zIndex-t.zIndex}const Rp=class Yl extends xt{constructor(){super(),this.children=[],this.sortableChildren=Yl.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);Bi(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,Bi(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,Bi(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;
vendor: 17,648 bytes, lines 528-570
528++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(Ub),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!==Yl.prototype._render&&(i=this.getBounds(!0));const n=t.projection.transform;if(n&&(s?(s=Lb.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){if(!(!this.visible||this.worldAlpha<=0||!this.renderable))if(this._mask||this.filters?.length)this.renderAdvanced(t);else if(this.cullable)this._renderWithCulling(t);else{this._render(t);for(let e=0,i=this.children.length;e<i;++e)this.children[e].render(t)}}renderAdvanced(t){const e=this.filters,i=this._mask;if(e){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(let n=0;n<e.length;n++)e[n].enabled&&this._enabledFilters.push(e[n])}const s=e&&this._enabledFilters?.length||i&&(!i.isMaskData||i.enabled&&(i.autoDetect||i.type!==Ct.NONE));if(s&&t.batch.flush(),e&&this._enabledFilters?.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 n=0,o=this.children.length;n<o;++n)this.children[n].render(t)}s&&t.batch.flush(),i&&t.mask.pop(this),e&&this._enabledFilters?.length&&t.filter.pop()}_render(t){}destroy(t){super.destroy(),this.sortDirty=!1;const e=typeof t=="boolean"?t: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}};Rp.defaultSortableChildren=!1;let Nt=Rp;Nt.prototype.containerUpdateTransform=Nt.prototype.updateTransform;Object.defineProperties(z,{SORTABLE_CHILDREN:{get(){return Nt.defaultSortableChildren},set(r){ot("7.1.0","settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),Nt.defaultSortableChildren=r}}});const is=new ht,Gb=new Uint16Array([0,1,2,0,2,3]);class Ht extends Nt{constructor(t){super(),this._anchor=new Je(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 ft(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=J.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=Gb,this.pluginName="batch",this.isSprite=!0,this._roundPixels=z.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=mr(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=mr(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,_=0,m=0;if(c?(p=c.x-d._x*u.width,f=p+c.width,m=c.y-d._y*u.height,_=m+c.height):(p=-d._x*u.width,f=p+u.width,m=-d._y*u.height,_=m+u.height),h[0]=i*p+n*m+a,h[1]=o*m+s*p+l,h[2]=i*f+n*m+a,h[3]=o*m+s*f+l,h[4]=i*f+n*_+a,h[5]=o*_+s*f+l,h[6]=i*p+n*_+a,h[7]=o*_+s*p+l,this._roundPixels){const g=z.RESOLUTION;for(let v=0;v<h.length;++v)h[v]=Math.round(h[v]*g)/g}}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,_=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*_+c,e[5]=h*_+a*f+u,e[6]=o*d+l*_+c,e[7]=h*_+a*d+u,this._roundPixels){const m=z.RESOLUTION;for(let g=0;g<e.length;++g)e[g]=Math.round(e[g]*m)/m}}_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 so),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 et),t=this._localBoundsRect),this._localBounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,is);const e=this._texture.orig.width,i=this._texture.orig.height,s=-e*this.anchor.x;let n=0;return is.x>=s&&is.x<s+e&&(n=-i*this.anchor.y,is.y>=n&&is.y<n+i)}destroy(t){if(super.destroy(t),this._texture.off("update",this._onTextureUpdate,this),this._anchor=null,typeof t=="boolean"?t:t?.texture){const e=typeof t=="boolean"?t: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 Ht(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=mr(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=mr(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 Pp=new gt;xt.prototype._cacheAsBitmap=!1;xt.prototype._cacheData=null;xt.prototype._cacheAsBitmapResolution=null;xt.prototype._cacheAsBitmapMultisample=null;class Hb{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(xt.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 Hb),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)}}});xt.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))};xt.prototype._initCachedDisplayObject=function(r){if(this._cacheData?.sprite)return;const t=this.alpha;this.alpha=1,r.batch.flush();const e=this.getLocalBounds(new et,!0);if(this.filters?.length){const d=this.filters[0].padding;e.pad(d)}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=Lt.create({width:e.width,height:e.height,resolution:i,multisample:this.cacheAsBitmapMultisample??r.multisample}),h=`cacheAsBitmap_${ti()}`;this._cacheData.textureCacheId=h,rt.addToCache(l.baseTexture,h),Y.addToCache(l,h);const c=this.transform.localTransform.copyTo(Pp).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 Ht(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)};xt.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))};xt.prototype._initCachedDisplayObjectCanvas=function(r){if(this._cacheData?.sprite)return;const t=this.getLocalBounds(new et,!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=Lt.create({width:t.width,height:t.height,resolution:n}),a=`cacheAsBitmap_${ti()}`;this._cacheData.textureCacheId=a,rt.addToCache(o.baseTexture,a),Y.addToCache(o,a);const l=Pp;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 Ht(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)};xt.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID};xt.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)};xt.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,rt.removeFromCache(this._cacheData.textureCacheId),Y.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null};xt.prototype._cacheAsBitmapDestroy=function(r){this.cacheAsBitmap=!1,this.destroy(r)};xt.prototype.name=null;Nt.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};xt.prototype.getGlobalPosition=function(r=new ht,t=!1){return this.parent?this.parent.toGlobal(this.position,r,t):(r.x=this.position.x,r.y=this.position.y),r};var $b=`varying vec2 vTextureCoord; 529 530uniform sampler2D uSampler; 531uniform float uAlpha; 532 533void main(void) 534{ 535 gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha; 536} 537`;class zb extends Ot{constructor(t=1){super(kb,$b,{uAlpha:1}),this.alpha=t}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}}const Xb={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]},Vb=["varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{"," gl_FragColor = vec4(0.0);"," %blur%","}"].join(` 538`);function Wb(r){const t=Xb[r],e=t.length;let i=Vb,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+=` 539`}return i=i.replace("%blur%",s),i=i.replace("%size%",r.toString()),i}const jb=` 540 attribute vec2 aVertexPosition; 541 542 uniform mat3 projectionMatrix; 543 544 uniform float strength; 545 546 varying vec2 vBlurTexCoords[%size%]; 547 548 uniform vec4 inputSize; 549 uniform vec4 outputFrame; 550 551 vec4 filterVertexPosition( void ) 552 { 553 vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; 554 555 return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); 556 } 557 558 vec2 filterTextureCoord( void ) 559 { 560 return aVertexPosition * (outputFrame.zw * inputSize.zw); 561 } 562 563 void main(void) 564 { 565 gl_Position = filterVertexPosition(); 566 567 vec2 textureCoord = filterTextureCoord(); 568 %blur% 569 }`;function Yb(r,t){const e=Math.ceil(r/2);let i=jb,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+=` 570`}return i=i.replace("%blur%",s),i=i.replace("%size%",r.toString()),i}class ql extends Ot{constructor(t,e=8,i=4,s=Ot.defaultResolution,n=5){const o=Yb(n,t),a=Wb(n);super(o,a),this.horizontal=t,this.resolution=s,this._quality=0,this.qual
vendor: 11,735 bytes, lines 570-716
570ity=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,ke.CLEAR);for(let h=1;h<this.passes-1;h++){t.bindAndClear(a,ke.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 qb extends Ot{constructor(t=8,e=4,i=Ot.defaultResolution,s=5){super(),this._repeatEdgePixels=!1,this.blurXFilter=new ql(!0,t,e,i,s),this.blurYFilter=new ql(!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,ke.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 Zb=`varying vec2 vTextureCoord; 571uniform sampler2D uSampler; 572uniform float m[20]; 573uniform float uAlpha; 574 575void main(void) 576{ 577 vec4 c = texture2D(uSampler, vTextureCoord); 578 579 if (uAlpha == 0.0) { 580 gl_FragColor = c; 581 return; 582 } 583 584 // Un-premultiply alpha before applying the color matrix. See issue #3539. 585 if (c.a > 0.0) { 586 c.rgb /= c.a; 587 } 588 589 vec4 result; 590 591 result.r = (m[0] * c.r); 592 result.r += (m[1] * c.g); 593 result.r += (m[2] * c.b); 594 result.r += (m[3] * c.a); 595 result.r += m[4]; 596 597 result.g = (m[5] * c.r); 598 result.g += (m[6] * c.g); 599 result.g += (m[7] * c.b); 600 result.g += (m[8] * c.a); 601 result.g += m[9]; 602 603 result.b = (m[10] * c.r); 604 result.b += (m[11] * c.g); 605 result.b += (m[12] * c.b); 606 result.b += (m[13] * c.a); 607 result.b += m[14]; 608 609 result.a = (m[15] * c.r); 610 result.a += (m[16] * c.g); 611 result.a += (m[17] * c.b); 612 result.a += (m[18] * c.a); 613 result.a += m[19]; 614 615 vec3 rgb = mix(c.rgb, result.rgb, uAlpha); 616 617 // Premultiply alpha again. 618 rgb *= result.a; 619 620 gl_FragColor = vec4(rgb, result.a); 621} 622`;class Zl extends Ot{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(wp,Zb,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]=ft.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,_=o*(1-i)+a*s,m=i+o*(1-i),g=[l,h,c,0,0,u,d,f,0,0,p,_,m,0,0,0,0,0,1,0];this._loadMatrix(g,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=ft.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}}Zl.prototype.grayscale=Zl.prototype.greyscale;var Kb=`varying vec2 vFilterCoord; 623varying vec2 vTextureCoord; 624 625uniform vec2 scale; 626uniform mat2 rotation; 627uniform sampler2D uSampler; 628uniform sampler2D mapSampler; 629 630uniform highp vec4 inputSize; 631uniform vec4 inputClamp; 632 633void main(void) 634{ 635 vec4 map = texture2D(mapSampler, vFilterCoord); 636 637 map -= 0.5; 638 map.xy = scale * inputSize.zw * (rotation * map.xy); 639 640 gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw)); 641} 642`,Jb=`attribute vec2 aVertexPosition; 643 644uniform mat3 projectionMatrix; 645uniform mat3 filterMatrix; 646 647varying vec2 vTextureCoord; 648varying vec2 vFilterCoord; 649 650uniform vec4 inputSize; 651uniform vec4 outputFrame; 652 653vec4 filterVertexPosition( void ) 654{ 655 vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; 656 657 return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); 658} 659 660vec2 filterTextureCoord( void ) 661{ 662 return aVertexPosition * (outputFrame.zw * inputSize.zw); 663} 664 665void main(void) 666{ 667 gl_Position = filterVertexPosition(); 668 vTextureCoord = filterTextureCoord(); 669 vFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy; 670} 671`;class Qb extends Ot{constructor(t,e){const i=new gt;t.renderable=!1,super(Jb,Kb,{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 ht(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 tx=`varying vec2 v_rgbNW; 672varying vec2 v_rgbNE; 673varying vec2 v_rgbSW; 674varying vec2 v_rgbSE; 675varying vec2 v_rgbM; 676 677varying vec2 vFragCoord; 678uniform sampler2D uSampler; 679uniform highp vec4 inputSize; 680 681 682/** 683 Basic FXAA implementation based on the code on geeks3d.com with the 684 modification that the texture2DLod stuff was removed since it's 685 unsupported by WebGL. 686 687 -- 688 689 From: 690 https://github.com/mitsuhiko/webgl-meincraft 691 692 Copyright (c) 2011 by Armin Ronacher. 693 694 Some rights reserved. 695 696 Redistribution and use in source and binary forms, with or without 697 modification, are permitted provided that the following conditions are 698 met: 699 700 * Redistributions of source code must retain the above copyright 701 notice, this list of conditions and the following disclaimer. 702 703 * Redistributions in binary form must reproduce the above 704 copyright notice, this list of conditions and the following 705 disclaimer in the documentation and/or other materials provided 706 with the distribution. 707 708 * The names of the contributors may not be used to endorse or 709 promote products derived from this software without specific 710 prior written permission. 711 712 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 713 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 714 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 715 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 716 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
717 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 718 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 719 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 720 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 721 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 722 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 723 */ 724 725#ifndef FXAA_REDUCE_MIN 726#define FXAA_REDUCE_MIN (1.0/ 128.0) 727#endif 728#ifndef FXAA_REDUCE_MUL 729#define FXAA_REDUCE_MUL (1.0 / 8.0) 730#endif 731#ifndef FXAA_SPAN_MAX 732#define FXAA_SPAN_MAX 8.0 733#endif 734 735//optimized version for mobile, where dependent 736//texture reads can be a bottleneck 737vec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 inverseVP, 738 vec2 v_rgbNW, vec2 v_rgbNE, 739 vec2 v_rgbSW, vec2 v_rgbSE, 740 vec2 v_rgbM) { 741 vec4 color; 742 vec3 rgbNW = texture2D(tex, v_rgbNW).xyz; 743 vec3 rgbNE = texture2D(tex, v_rgbNE).xyz; 744 vec3 rgbSW = texture2D(tex, v_rgbSW).xyz; 745 vec3 rgbSE = texture2D(tex, v_rgbSE).xyz; 746 vec4 texColor = texture2D(tex, v_rgbM); 747 vec3 rgbM = texColor.xyz; 748 vec3 luma = vec3(0.299, 0.587, 0.114); 749 float lumaNW = dot(rgbNW, luma); 750 float lumaNE = dot(rgbNE, luma); 751 float lumaSW = dot(rgbSW, luma); 752 float lumaSE = dot(rgbSE, luma); 753 float lumaM = dot(rgbM, luma); 754 float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE))); 755 float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE))); 756 757 mediump vec2 dir; 758 dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE)); 759 dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE)); 760 761 float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) * 762 (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN); 763 764 float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce); 765 dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX), 766 max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX), 767 dir * rcpDirMin)) * inverseVP; 768 769 vec3 rgbA = 0.5 * ( 770 texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz + 771 texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz); 772 vec3 rgbB = rgbA * 0.5 + 0.25 * ( 773 texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz + 774 texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz); 775 776 float lumaB = dot(rgbB, luma); 777 if ((lumaB < lumaMin) || (lumaB > lumaMax)) 778 color = vec4(rgbA, texColor.a); 779 else 780 color = vec4(rgbB, texColor.a); 781 return color; 782} 783 784void main() { 785 786 vec4 color; 787 788 color = fxaa(uSampler, vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM); 789 790 gl_FragColor = color; 791} 792`,ex=` 793attribute vec2 aVertexPosition; 794 795uniform mat3 projectionMatrix; 796 797varying vec2 v_rgbNW; 798varying vec2 v_rgbNE; 799varying vec2 v_rgbSW; 800varying vec2 v_rgbSE; 801varying vec2 v_rgbM; 802 803varying vec2 vFragCoord; 804 805uniform vec4 inputSize; 806uniform vec4 outputFrame; 807 808vec4 filterVertexPosition( void ) 809{ 810 vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; 811 812 return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); 813} 814 815void texcoords(vec2 fragCoord, vec2 inverseVP, 816 out vec2 v_rgbNW, out vec2 v_rgbNE, 817 out vec2 v_rgbSW, out vec2 v_rgbSE, 818 out vec2 v_rgbM) { 819 v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP; 820 v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP; 821 v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP; 822 v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP; 823 v_rgbM = vec2(fragCoord * inverseVP); 824} 825 826void main(void) { 827 828 gl_Position = filterVertexPosition(); 829 830 vFragCoord = aVertexPosition * outputFrame.zw; 831 832 texcoords(vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM); 833} 834`;class rx extends Ot{constructor(){super(ex,tx)}}var ix=`precision highp float; 835 836varying vec2 vTextureCoord; 837varying vec4 vColor; 838 839uniform float uNoise; 840uniform float uSeed; 841uniform sampler2D uSampler; 842 843float rand(vec2 co) 844{ 845 return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453); 846} 847 848void main() 849{ 850 vec4 color = texture2D(uSampler, vTextureCoord); 851 float randomValue = rand(gl_FragCoord.xy * uSeed); 852 float diff = (randomValue - 0.5) * uNoise; 853 854 // Un-premultiply alpha before applying the color matrix. See issue #3539. 855 if (color.a > 0.0) { 856 color.rgb /= color.a; 857 } 858 859 color.r += diff; 860 color.g += diff; 861 color.b += diff; 862 863 // Premultiply alpha again. 864 color.rgb *= color.a; 865 866 gl_FragColor = color; 867} 868`;class sx extends Ot{constructor(t=.5,e=Math.random()){super(wp,ix,{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 xu={AlphaFilter:zb,BlurFilter:qb,BlurFilterPass:ql,ColorMatrixFilter:Zl,DisplacementFilter:Qb,FXAAFilter:rx,NoiseFilter:sx};Object.entries(xu).forEach(([r,t])=>{Object.defineProperty(xu,r,{get(){return ot("7.1.0",`filters.${r} has moved to ${r}`),t}})});
vendor: 4,977 bytes, line 868
868class nx{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||(Qt.system.add(this.tickerUpdate,this,ei.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(Qt.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 pr=new nx;class Ms{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=Ms.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new ht,this.page=new ht,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 no extends Ms{constructor(){super(...arguments),this.client=new ht,this.movement=new ht,this.offset=new ht,this.global=new ht,this.screen=new ht}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,_){throw new Error("Method not implemented.")}}class ge extends no{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 Fi extends no{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}Fi.DOM_DELTA_PIXEL=0,Fi.DOM_DELTA_LINE=1,Fi.DOM_DELTA_PAGE=2;const ox=2048,ax=new ht,Ma=new ht;class lx{constructor(t){this.dispatch=new Rs,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.prop
vendor: 10,784 bytes, line 868
868agate(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){pr.pauseUpdate=!0;const i=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",s=this[i](this.rootTarget,this.rootTarget.eventMode,ax.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<ox&&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")&&(pr.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")&&(pr.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){if(t.hitArea&&(t.worldTransform.applyInverse(e,Ma),!t.hitArea.contains(Ma.x,Ma.y)))return!0;if(t._mask){const i=t._mask.isMaskData?t._mask.maskObject:t._mask;if(i&&!i.containsPoint?.(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){e=e??t.type;const i=`on${e}`;t.currentTarget[i]?.(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 ge)){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){if(!(t instanceof ge)){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(s.overTargets?.length>0&&n!==e.target){const l=t.type==="mousemove"?"mouseout":"pointerout",h=this.createPointerEvent(t,l,n);if(this.dispatchEvent(h,"pointerout"),i&&this.dispatchEvent(h,"mouseout"),!e.composedPath().includes(n)){const c=this.createPointerEvent(t,"pointerleave",n);for(c.eventPhase=c.AT_TARGET;c.target&&!e.composedPath().includes(c.target);)c.currentTarget=c.target,this.notifyTarget(c),i&&this.notifyTarget(c,"mouseleave"),c.target=c.target.parent;this.freeEvent(c)}this.freeEvent(h)}if(n!==e.target){const l=t.type==="mousemove"?"mouseover":"pointerover",h=this.clonePointerEvent(e,l);this.dispatchEvent(h,"pointerover"),i&&this.dispatchEvent(h,"mouseover");let c=n?.parent;for(;c&&c!==this.rootTarget.parent&&c!==e.target;)c=c.parent;if(!c||c===this.rootTarget.parent){const u=this.clonePointerEvent(e,"pointerenter");for(u.eventPhase=u.AT_TARGET;u.target&&u.target!==n&&u.target!==this.rootTarget.parent;)u.currentTarget=u.target,this.notifyTarget(u),i&&this.notifyTarget(u,"mouseenter"),u.target=u.target.parent;this.freeEvent(u)}this.freeEvent(h)}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=e.target?.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){if(!(t instanceof ge)){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=i.target?.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 ge)){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 ge)){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 ge)){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 Fi)){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(ge);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(Fi);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(ge);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 ge&&e instanceof ge&&(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.t
vendor: 17,793 bytes, line 868
868iltY=t.tiltY,e.twist=t.twist)}copyMouseData(t,e){t instanceof no&&e instanceof no&&(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 hx=1,cx={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Kl=class Jl{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new lx(null),pr.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new ge(null),this.rootWheelEvent=new Fi(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...Jl.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,Jl._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,pr.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,pr.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;pr.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;pr.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=hx),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=cx[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}};Kl.extension={name:"events",type:[G.RendererSystem,G.CanvasRendererSystem]},Kl.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let Ql=Kl;q.add(Ql);function wu(r){return r==="dynamic"||r==="static"}const ux={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??wu(Ql.defaultEventMode)},set interactive(r){ot("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??Ql.defaultEventMode},set eventMode(r){this._internalInteractive=wu(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 t=="function"?void 0:t;r=i?`${r}capture`:r,t=typeof t=="function"?t:t.handleEvent,this.on(r,t,s)},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 Ms))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}};xt.mixin(ux);const dx={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};xt.mixin(dx);const fx=9,Zs=100,px=0,_x=0,Tu=2,Eu=1,mx=-1e3,gx=-1e3,yx=2;class Mp{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,(Ke.tablet||Ke.phone)&&this.createTouchHook();const e=document.createElement("div");e.style.width=`${Zs}px`,e.style.height=`${Zs}px`,e.style.position="absolute",e.style.top=`${px}px`,e.style.left=`${_x}px`,e.style.zIndex=Tu.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=`${Eu}px`,t.style.height=`${Eu}px`,t.style.position="absolute",t.style.top=`${mx}px`,t.style.left=`${gx}px`,t.style.zIndex=yx.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(){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),this.renderer.view.parentNode?.appendChild(this.div))}deactivate(){!this._isActive||this._isMobileAccessibility||(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),this.div.parentNode?.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(Ke.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,Bi(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 _=f.worldTransform;f.hitArea?(u.style.left=`${(_.tx+p.x*_.a)*h}px`,u.style.top=`${(_.ty+p.y*_.d)*c}px`,u.style.width=`${p.width*_.a*h}px`,u.style.height=`${p.height*_.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=`${Zs}px`,e.style.height=`${Zs}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=Tu.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.t
vendor: 1,684 bytes, line 868
868itle=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 Ms(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===fx&&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}}Mp.extension={name:"accessibility",type:[G.RendererPlugin,G.CanvasRendererPlugin]};q.add(Mp);const kp=class th{constructor(t){this.stage=new Nt,t=Object.assign({forceCanvas:!1},t),this.renderer=Rb(t),th._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render(this.stage)}get view(){return this.renderer?.view}get screen(){return this.renderer?.screen}destroy(t,e){const i=th._plugins.slice(0);
868i.reverse(),i.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};kp._plugins=[];let Bp=kp;q.handleByList(G.Application,Bp._plugins);class Dp{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}}Dp.extension=G.Application;q.add(Dp);const Au={loader:G.LoadParser,resolver:G.ResolveParser,cache:G.CacheParser,detection:G.DetectionParser};q.handle(G.Asset,r=>{const t=r.ref;Object.entries(Au).filter(([e])=>!!t[e]).forEach(([e,i])=>q.add(Object.assign(t[e],{extension:t[e].extension??i})))},r=>{const t=r.ref;Object.keys(Au).filter(e=>!!t[e]).forEach(e=>q.remove(t[e]))});class vx{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 qi(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 Mr(r,t){const e=r.split("?")[0],i=It.extname(e).toLowerCase();return Array.isArray(t)?t.includes(i):i===t}const ye=(r,t,e=!1)=>(Array.isArray(r)||(r=[r]),t?r.map(i=>typeof i=="string"||e?t(i):i):r),eh=(r,t)=>{const e=t.split("?")[1];return e&&(r+=`?${e}`),r};function Fp(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?Fp(r.replace(i[e],a),t,e+1,i,s):s.push(r.replace(i[e],a))}}function bx(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)}),Fp(r,s,0,e,i)}else i.push(r);return i}const oo=r=>!Array.isArray(r);class xx{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=ye(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&&rt.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 jr=new xx;class wx{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()=>{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 o=0;o<this.parsers.length;o++){const a=this.parsers[o];if(a.load&&a.test?.(t,e,this)){n=a;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 o=0;o<this.parsers.length;o++){const a=this.parsers[o];a.parse&&a.parse&&await a.testParse?.(s,e,this)&&(s=await a.parse(s,e,this)||s,i.parser=a)}return s})(),i}
vendor: 9,569 bytes, lines 868-924
868async load(t,e){this._parsersValidated||this._validateParsers();let i=0;const s={},n=oo(t),o=ye(t,h=>({alias:[h],src:h})),a=o.length,l=o.map(async h=>{const c=It.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}. 869${u}`)}});return await Promise.all(l),n?s[o[0].src]:s}async unload(t){const e=ye(t,i=>({alias:[i],src:i})).map(async i=>{const s=It.toAbsolute(i.src),n=this.promiseCache[s];if(n){const o=await n.promise;delete this.promiseCache[s],n.parser?.unload?.(o,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 Te=(r=>(r[r.Low=0]="Low",r[r.Normal=1]="Normal",r[r.High=2]="High",r))(Te||{});const Tx=".json",Ex="application/json",Ax={extension:{type:G.LoadParser,priority:Te.Low},name:"loadJson",test(r){return qi(r,Ex)||Mr(r,Tx)},async load(r){return await(await z.ADAPTER.fetch(r)).json()}};q.add(Ax);const Sx=".txt",Cx="text/plain",Ix={name:"loadTxt",extension:{type:G.LoadParser,priority:Te.Low},test(r){return qi(r,Cx)||Mr(r,Sx)},async load(r){return await(await z.ADAPTER.fetch(r)).text()}};q.add(Ix);const Rx=["normal","bold","100","200","300","400","500","600","700","800","900"],Px=[".ttf",".otf",".woff",".woff2"],Mx=["font/ttf","font/otf","font/woff","font/woff2"],kx=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function Bx(r){const t=It.extname(r),e=It.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(kx)){i=!1;break}let s=e.join(" ");return i||(s=`"${s.replace(/[\\"]/g,"\\$&")}"`),s}const Dx=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function Fx(r){return Dx.test(r)?r:encodeURI(r)}const Ox={extension:{type:G.LoadParser,priority:Te.Low},name:"loadWebFont",test(r){return qi(r,Mx)||Mr(r,Px)},async load(r,t){const e=z.ADAPTER.getFontFaceSet();if(e){const i=[],s=t.data?.family??Bx(r),n=t.data?.weights?.filter(a=>Rx.includes(a))??["normal"],o=t.data??{};for(let a=0;a<n.length;a++){const l=n[a],h=new FontFace(s,`url(${Fx(r)})`,{...o,weight:l});await h.load(),e.add(h),i.push(h)}return i.length===1?i[0]:i}return console.warn("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(r){(Array.isArray(r)?r:[r]).forEach(t=>z.ADAPTER.getFontFaceSet().delete(t))}};q.add(Ox);let Su=0,ka;const Nx="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=",Lx={id:"checkImageBitmap",code:` 870 async function checkImageBitmap() 871 { 872 try 873 { 874 if (typeof createImageBitmap !== 'function') return false; 875 876 const response = await fetch('${Nx}'); 877 const imageBlob = await response.blob(); 878 const imageBitmap = await createImageBitmap(imageBlob); 879 880 return imageBitmap.width === 1 && imageBitmap.height === 1; 881 } 882 catch (e) 883 { 884 return false; 885 } 886 } 887 checkImageBitmap().then((result) => { self.postMessage(result); }); 888 `},Ux={id:"loadImageBitmap",code:` 889 async function loadImageBitmap(url) 890 { 891 const response = await fetch(url); 892 893 if (!response.ok) 894 { 895 throw new Error(\`[WorkerManager.loadImageBitmap] Failed to fetch \${url}: \` 896 + \`\${response.status} \${response.statusText}\`); 897 } 898 899 const imageBlob = await response.blob(); 900 const imageBitmap = await createImageBitmap(imageBlob); 901 902 return imageBitmap; 903 } 904 self.onmessage = async (event) => 905 { 906 try 907 { 908 const imageBitmap = await loadImageBitmap(event.data.data[0]); 909 910 self.postMessage({ 911 data: imageBitmap, 912 uuid: event.data.uuid, 913 id: event.data.id, 914 }, [imageBitmap]); 915 } 916 catch(e) 917 { 918 self.postMessage({ 919 error: e, 920 uuid: event.data.uuid, 921 id: event.data.id, 922 }); 923 } 924 };`};let Ba;class Gx{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 e=URL.createObjectURL(new Blob([Lx.code],{type:"application/javascript"})),i=new Worker(e);i.addEventListener("message",s=>{i.terminate(),URL.revokeObjectURL(e),t(s.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t){return this._run("loadImageBitmap",[t])}async _initWorkers(){this._initialized||(this._initialized=!0)}getWorker(){ka===void 0&&(ka=navigator.hardwareConcurrency||4);let t=this.workerPool.pop();return!t&&this._createdWorkers<ka&&(Ba||(Ba=URL.createObjectURL(new Blob([Ux.code],{type:"application/javascript"}))),this._createdWorkers++,t=new Worker(Ba),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[Su]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:Su++,id:i})}}const Cu=new Gx;function ks(r,t,e){r.resource.internal=!0;const i=new Y(r),s=()=>{delete t.promiseCache[e],jr.has(e)&&jr.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 Hx=[".jpeg",".jpg",".png",".webp",".avif"],$x=["image/jpeg","image/png","image/webp","image/avif"];async function zx(r){const t=await z.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 Po={name:"loadTextures",extension:{type:G.LoadParser,priority:Te.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return qi(r,$x)||Mr(r,Hx)},async load(r,t,e){const i=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;let s;i?this.config.preferWorkers&&await Cu.isImageBitmapSupported()?s=await Cu.loadImageBitmap(r):s=await zx(r):s=await new Promise((a,l)=>{const h=new Image;h.crossOrigin=this.config.crossOrigin,h.src=r,h.complete?a(h):(h.onload=()=>a(h),h.onerror=c=>l(c))});const n={...t.data};n.resolution??(n.resolution=ir(r)),i&&n.resourceOptions?.ownsImageBitmap===void 0&&(n.resourceOptions={...n.resourceOptions},n.resourceOptions.ownsImageBitmap=!0);const o=new rt(s,n);return o.resource.src=r,ks(o,e,r)},unload(r){r.destroy(!0)}};q.add(Po);const Xx=".svg",Vx="image/svg+xml",Wx={extension:{type:G.LoadParser,priority:Te.High},name:"loadSVG",test(r){return qi(r,Vx)||Mr(r,Xx)},async testParse(r){return Vl.test(r)},async parse(r,t,e){const i=new Vl(r,t?.data?.resourceOptions);await i.load();const s=new rt(i,{resolution:ir(r),...t?.data});return s.resource.src=t.src,ks(s,e,t.src)},async load(r,t){return(await z.ADAPTER.fetch(r)).text()},unload:Po.unload};q.add(Wx);const jx=[".mp4",".m4v",".webm",".ogv"],Yx=["video/mp4","video/webm","video/ogg"],qx={name:"loadVideo",extension:{type:G.LoadParser,priority:Te.High},config:{defaultAutoPlay:!0},test(r){return qi(r,Yx)||Mr(r,jx)},async load(r,t,e){let i;const s=await(await z.ADAPTER.fetch(r)).blob(),n=URL.createObjectURL(s);try{const o={autoPlay:this.config.defaultAutoPlay,...t?.data?.resourceOptions},a=new Ip(n,o);await a.load();const l=new rt(a,{alphaMode:await ev(),resolution:ir(r),...t?.data});l.resource.src=r,i=ks(l,e,r),i.baseTexture.once("destroyed",()=>{URL.revokeObjectURL(n)})}catch(o){throw URL.revokeObjectURL(n),o}return i},unload(r){r.destroy(!0)}};q.add(qx);class Zx{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")}
924prefer(...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 ye(e||i||s||n,o=>typeof o=="string"?o:Array.isArray(o)?o.map(a=>a?.src??a?.srcs??a):o?.src||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"?(ot("7.2.0",`Assets.add now uses an object instead of individual parameters. 925Please 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`)},ye(o).forEach(l=>{const{src:h,srcs:c}=l;let{data:u,format:d,loadParser:f}=l;const p=ye(h||c).map(g=>typeof g=="string"?bx(g):Array.isArray(g)?g:[g]),_=this.getAlias(l);Array.isArray(_)?_.forEach(a):a(_);const m=[];p.forEach(g=>{g.forEach(v=>{let y={};if(typeof v!="object"){y.src=v;for(let b=0;b<this._parsers.length;b++){const E=this._parsers[b];if(E.test(v)){y=E.parse(v);break}}}else u=v.data??u,d=v.format??d,f=v.loadParser??f,y={...y,...v};if(!_)throw new Error(`[Resolver] alias is undefined for this asset: ${y.src}`);y=this.buildResolvedAsset(y,{aliases:_,data:u,format:d,loadParser:f}),m.push(y)})}),_.forEach(g=>{this._assetMap[g]=m})})}resolveBundle(t){const e=oo(t);t=ye(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=oo(t);t=ye(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?.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=It.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??It.extname(t.src).slice(1),t.srcs=t.src,t.name=t.alias,t}}class Kx{constructor(){this._detections=[],this._initialized=!1,this.resolver=new Zx,this.loader=new wx,this.cache=jr,this._backgroundLoader=new vx(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(this._initialized){console.warn("[Assets]AssetManager already initialized, did you load before calling this Asset.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 n=t.manifest;typeof n=="string"&&(n=await this.load(n)),this.resolver.addManifest(n)}const e=t.texturePreference?.resolution??1,i=typeof e=="number"?[e]:e,s=await this._detectFormats({preferredFormats:t.texturePreference?.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=oo(t),s=ye(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}
925addBundle(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?.(++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 jr.get(t);const e={};for(let i=0;i<t.length;i++)e[i]=jr.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,jr.set(c,h)}),o}async unload(t){this._initialized||await this.init();const e=ye(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=ye(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=>{jr.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 Po.config.preferWorkers}set preferWorkers(t){ot("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 Ks=new Kx;q.handleByList(G.LoadParser,Ks.loader.parsers).handleByList(G.ResolveParser,Ks.resolver.parsers).handleByList(G.CacheParser,Ks.cache.parsers).handleByList(G.DetectionParser,Ks.detections);const Jx={extension:G.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}};q.add(Jx);async function Op(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 Qx={extension:{type:G.DetectionParser,priority:1},test:async()=>Op("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(t=>t!=="avif")};q.add(Qx);const tw={extension:{type:G.DetectionParser,priority:0},test:async()=>Op("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(t=>t!=="webp")};q.add(tw);const Iu=["png","jpg","jpeg"],ew={extension:{type:G.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...Iu],remove:async r=>r.filter(t=>!Iu.includes(t))};q.add(ew);const rw="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function Fh(r){return rw?!1:document.createElement("video").canPlayType(r)!==""}const iw={extension:{type:G.DetectionParser,priority:0},test:async()=>Fh("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(t=>t!=="webm")};q.add(iw);const sw={extension:{type:G.DetectionParser,priority:0},test:async()=>Fh("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(t=>t!=="mp4"&&t!=="m4v")};q.add(sw);const nw={extension:{type:G.DetectionParser,priority:0},test:async()=>Fh("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(t=>t!=="ogv")};q.add(nw);const ow={extension:G.ResolveParser,test:Po.test,parse:r=>({resolution:parseFloat(z.RETINA_PREFIX.exec(r)?.[1]??"1"),format:It.extname(r).slice(1),src:r})};q.add(ow);var Zt=(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_
925EAC=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",r))(Zt||{});const ao={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,35986:1,34798:1,37808:1};let Ye,Ti;function Ru(){Ti={s3tc:Ye.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:Ye.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:Ye.getExtension("WEBGL_compressed_texture_etc"),etc1:Ye.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:Ye.getExtension("WEBGL_compressed_texture_pvrtc")||Ye.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:Ye.getExtension("WEBGL_compressed_texture_atc"),astc:Ye.getExtension("WEBGL_compressed_texture_astc")}}const aw={extension:{type:G.DetectionParser,priority:2},test:async()=>{const r=z.ADAPTER.createCanvas().getContext("webgl");return r?(Ye=r,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async r=>{Ti||Ru();const t=[];for(const e in Ti)Ti[e]&&t.push(e);return[...t,...r]},remove:async r=>(Ti||Ru(),r.filter(t=>!(t in Ti)))};q.add(aw);class lw extends Ao{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 kl(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 kl(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this)),this._load)}}class Jr extends lw{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=Jr._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||Jr._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=Jr._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>=37488&&t<=37497)return"etc";if(t>=35840&&t<=35843)return"pvrtc";if(t>=36196)return"etc1";if(t>=35986&&t<=34798)return"atc";throw new Error("Invalid (compressed) texture format given!")}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*ao[e];for(let _=0;_<i;_++)l[_]={levelID:_,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*ao[e];return l}}const Da=4,Js=124,hw=32,Pu=20,cw=542327876,Qs={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},uw={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},tn={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},dw=1,fw=2,pw=4,_w=64,mw=512,gw=131072,yw=827611204,vw=861165636,bw=894720068,xw=808540228,ww=4,Tw={[yw]:Zt.COMPRESSED_RGBA_S3TC_DXT1_EXT,[vw]:Zt.COMPRESSED_RGBA_S3TC_DXT3_EXT,[bw]:Zt.COMPRESSED_RGBA_S3TC_DXT5_EXT},Ew={70:Zt.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:Zt.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:Zt.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:Zt.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:Zt.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:Zt.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:Zt.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:Zt.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:Zt.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT};function Aw(r){const t=new Uint32Array(r);if(t[0]!==cw)throw new Error("Invalid DDS file magic word");const e=new Uint32Array(r,0,Js/Uint32Array.BYTES_PER_ELEMENT),i=e[Qs.HEIGHT],s=e[Qs.WIDTH],n=e[Qs.MIPMAP_COUNT],o=new Uint32Array(r,Qs.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,hw/Uint32Array.BYTES_PER_ELEMENT),a=o[dw];if(a&pw){const l=o[uw.FOURCC];if(l!==xw){const v=Tw[l],y=Da+Js,b=new Uint8Array(r,y);return[new Jr(b,{format:v,width:s,height:i,levels:n})]}const h=Da+Js,c=new Uint32Array(t.buffer,h,Pu/Uint32Array.BYTES_PER_ELEMENT),u=c[tn.DXGI_FORMAT],d=c[tn.RESOURCE_DIMENSION],f=c[tn.MISC_FLAG],p=c[tn.ARRAY_SIZE],_=Ew[u];if(_===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${u}`);if(f===ww)throw new Error("DDSParser does not support cubemap textures");if(d===6)throw new Error("DDSParser does not supported 3D texture data");const m=new Array,g=Da+Js+Pu;if(p===1)m.push(new Uint8Array(r,g));else{const v=ao[_];let y=0,b=s,E=i;for(let T=0;T<n;T++){const A=Math.max(1,b+3&-4),I=Math.max(1,E+3&-4),R=A*I*v;y+=R,b=b>>>1,E=E>>>1}let x=g;
925for(let T=0;T<p;T++)m.push(new Uint8Array(r,x,y)),x+=y}return m.map(v=>new Jr(v,{format:_,width:s,height:i,levels:n}))}throw a&_w?new Error("DDSParser does not support uncompressed texture data."):a&mw?new Error("DDSParser does not supported YUV uncompressed texture data."):a&gw?new Error("DDSParser does not support single-channel (lumninance) texture data!"):a&fw?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 Mu=[171,75,84,88,32,49,49,187,13,10,26,10],Sw=67305985,fe={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},rh=64,ku={[K.UNSIGNED_BYTE]:1,[K.UNSIGNED_SHORT]:2,[K.INT]:4,[K.UNSIGNED_INT]:4,[K.FLOAT]:4,[K.HALF_FLOAT]:8},Cw={[N.RGBA]:4,[N.RGB]:3,[N.RG]:2,[N.RED]:1,[N.LUMINANCE]:1,[N.LUMINANCE_ALPHA]:2,[N.ALPHA]:1},Iw={[K.UNSIGNED_SHORT_4_4_4_4]:2,[K.UNSIGNED_SHORT_5_5_5_1]:2,[K.UNSIGNED_SHORT_5_6_5]:2};function Rw(r,t,e=!1){const i=new DataView(t);if(!Pw(r,i))return null;const s=i.getUint32(fe.ENDIANNESS,!0)===Sw,n=i.getUint32(fe.GL_TYPE,s),o=i.getUint32(fe.GL_FORMAT,s),a=i.getUint32(fe.GL_INTERNAL_FORMAT,s),l=i.getUint32(fe.PIXEL_WIDTH,s),h=i.getUint32(fe.PIXEL_HEIGHT,s)||1,c=i.getUint32(fe.PIXEL_DEPTH,s)||1,u=i.getUint32(fe.NUMBER_OF_ARRAY_ELEMENTS,s)||1,d=i.getUint32(fe.NUMBER_OF_FACES,s),f=i.getUint32(fe.NUMBER_OF_MIPMAP_LEVELS,s),p=i.getUint32(fe.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 _=4,m=4,g=l+3&-4,v=h+3&-4,y=new Array(u);let b=l*h;n===0&&(b=g*v);let E;if(n!==0?ku[n]?E=ku[n]*Cw[o]:E=Iw[n]:E=ao[a],E===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const x=e?kw(i,p,s):null;let T=b*E,A=l,I=h,R=g,P=v,M=rh+p;for(let S=0;S<f;S++){const C=i.getUint32(M,s);let H=M+4;for(let X=0;X<u;X++){let O=y[X];O||(O=y[X]=new Array(f)),O[S]={levelID:S,levelWidth:f>1||n!==0?A:R,levelHeight:f>1||n!==0?I:P,levelBuffer:new Uint8Array(t,H,T)},H+=T}M+=C+4,M=M%4!==0?M+4-M%4:M,A=A>>1||1,I=I>>1||1,R=A+_-1&~(_-1),P=I+m-1&~(m-1),T=R*P*E}return n!==0?{uncompressed:y.map(S=>{let C=S[0].levelBuffer,H=!1;return n===K.FLOAT?C=new Float32Array(S[0].levelBuffer.buffer,S[0].levelBuffer.byteOffset,S[0].levelBuffer.byteLength/4):n===K.UNSIGNED_INT?(H=!0,C=new Uint32Array(S[0].levelBuffer.buffer,S[0].levelBuffer.byteOffset,S[0].levelBuffer.byteLength/4)):n===K.INT&&(H=!0,C=new Int32Array(S[0].levelBuffer.buffer,S[0].levelBuffer.byteOffset,S[0].levelBuffer.byteLength/4)),{resource:new Ao(C,{width:S[0].levelWidth,height:S[0].levelHeight}),type:n,format:H?Mw(o):o}}),kvData:x}:{compressed:y.map(S=>new Jr(null,{format:a,width:l,height:h,levels:f,levelBuffers:S})),kvData:x}}function Pw(r,t){for(let e=0;e<Mu.length;e++)if(t.getUint8(e)!==Mu[e])return console.error(`${r} is not a valid *.ktx file!`),!1;return!0}function Mw(r){switch(r){case N.RGBA:return N.RGBA_INTEGER;case N.RGB:return N.RGB_INTEGER;case N.RG:return N.RG_INTEGER;case N.RED:return N.RED_INTEGER;default:return r}}function kw(r,t,e){const i=new Map;let s=0;for(;s<t;){const n=r.getUint32(rh+s,e),o=rh+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 Bw={extension:{type:G.LoadParser,priority:Te.High},name:"loadDDS",test(r){return Mr(r,".dds")},async load(r,t,e){const i=await(await z.ADAPTER.fetch(r)).arrayBuffer(),s=Aw(i).map(n=>{const o=new rt(n,{mipmap:Ue.OFF,alphaMode:Wt.NO_PREMULTIPLIED_ALPHA,resolution:ir(r),...t.data});return ks(o,e,r)});return s.length===1?s[0]:s},unload(r){Array.isArray(r)?r.forEach(t=>
925t.destroy(!0)):r.destroy(!0)}};q.add(Bw);const Dw={extension:{type:G.LoadParser,priority:Te.High},name:"loadKTX",test(r){return Mr(r,".ktx")},async load(r,t,e){const i=await(await z.ADAPTER.fetch(r)).arrayBuffer(),{compressed:s,uncompressed:n,kvData:o}=Rw(r,i),a=s??n,l={mipmap:Ue.OFF,alphaMode:Wt.NO_PREMULTIPLIED_ALPHA,resolution:ir(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 rt(u,l);return d.ktxKeyValueData=o,ks(d,e,r)});return h.length===1?h[0]:h},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};q.add(Dw);const Fw={extension:G.ResolveParser,test:r=>{const t=It.extname(r).slice(1);return["basis","ktx","dds"].includes(t)},parse:r=>{const t=It.extname(r).slice(1);if(t==="ktx"){const e=[".s3tc.ktx",".s3tc_sRGB.ktx",".etc.ktx",".etc1.ktx",".pvrt.ktx",".atc.ktx",".astc.ktx"];if(e.some(i=>r.endsWith(i)))return{resolution:parseFloat(z.RETINA_PREFIX.exec(r)?.[1]??"1"),format:e.find(i=>r.endsWith(i)),src:r}}return{resolution:parseFloat(z.RETINA_PREFIX.exec(r)?.[1]??"1"),format:t,src:r}}};q.add(Fw);const en=new et,Ow=4,Np=class ds{constructor(t){this.renderer=t,this._rendererPremultipliedAlpha=!1}contextChange(){const t=this.renderer?.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&&ds._flipY(i,s,n),a&&ds._unpremultiplyAlpha(i);const l=new gv(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&&ds._flipY(i,s,n),a&&ds._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 Lt?a=t:(a=i.generateTexture(t,{region:e,resolution:i.resolution,multisample:i.multisample}),l=!0,e&&(en.width=e.width,en.height=e.height,e=en)));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===N.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=en,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(Ow*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?.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}}}};Np.extension={name:"extract",type:G.RendererSystem};let Nw=Np;q.add(Nw);const lo={build(r){const t=r.points;let e,i,s,n,o,a;if(r.type===Dt.CIRC){const p=r.shape;e=p.x,i=p.y,o=a=p.radius,s=n=0}else if(r.type===Dt.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,_=p.width/2,m=p.height/2;e=p.x+_,i=p.y+m,o=a=Math.max(0,Math.min(p.radius,Math.min(_,m))),s=_-o,n=m-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,_=n,m=e+p,g=e-p,v=i+_;if(t[c++]=m,t[c++]=v,t[--u]=v,t[--u]=g,n){const y=i-_;t[d++]=g,t[d++]=y,t[--f]=y,t[--f]=m}}for(let p=1;p<l;p++){const _=Math.PI/2*(p/l),m=s+Math.cos(_)*o,g=n+Math.sin(_)*a,v=e+m,y=e-m,b=i+g,E=i-g;t[c++]=v,t[c++]=b,t[--u]=b,t[--u]=y,t[d++]=y,t[d++]=E,t[--f]=E,t[--f]=v}{const p=s,_=n+a,m=e+p,g=e-p,v=i+_,y=i-_;t[c++]=m,t[c++]=v,t[--f]=y,t[--f]=m,s&&(t[c++]=g,t[c++]=v,t[--f]=y,t[--f]=g)}},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!==Dt.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 Bu(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 Lp={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){Bu(e,!1);const o=[];for(let h=0;h<i.length;h++){const c=i[h];Bu(c.points,!0),o.push(e.length/2),e=e.concat(c.points)}const a=D0(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])}}},Lw={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)}},Uw={build(r){lo.build(r)},triangulate(r,t){lo.triangulate(r,t)}};var ne=(r=>(r.MITER="miter",r.BEVEL="bevel",r.ROUND="round",r))(ne||{}),gr=(r=>(r.BUTT="butt",r.ROUND="round",r.SQUARE="square",r))(gr||{});const $i={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 Du{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,_=l*c+h*u,m=n*Math.sqrt(f)/d,g=n*Math.sqrt(p)/d,v=m*_/f,y=g*_/p,b=m*u+g*h,E=m*c+g*l,x=h*(g+v),T=l*(g+v),A=u*(m+y),I=c*(m+y),R=Math.atan2(T-E,x-b),P=Math.atan2(I-E,A-b);
925return{cx:b+t,cy:E+e,radius:n,startAngle:R,endAngle:P,anticlockwise:h*c>u*l}}static arc(t,e,i,s,n,o,a,l,h){const c=a-o,u=$i._segmentsCount(Math.abs(c)*n,Math.ceil(Math.abs(c)/Qn)*40),d=c/(u*2),f=d*2,p=Math.cos(d),_=Math.sin(d),m=u-1,g=m%1/m;for(let v=0;v<=m;++v){const y=v+g*v,b=d+o+f*y,E=Math.cos(b),x=-Math.sin(b);h.push((p*E+_*x)*n+i,(p*-x+_*E)*n+s)}}}class Gw{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 Oh{static curveLength(t,e,i,s,n,o,a,l){let h=0,c=0,u=0,d=0,f=0,p=0,_=0,m=0,g=0,v=0,y=0,b=t,E=e;for(let x=1;x<=10;++x)c=x/10,u=c*c,d=u*c,f=1-c,p=f*f,_=p*f,m=_*t+3*p*c*i+3*f*u*n+d*a,g=_*e+3*p*c*s+3*f*u*o+d*l,v=b-m,y=E-g,b=m,E=g,h+=Math.sqrt(v*v+y*y);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=$i._segmentsCount(Oh.curveLength(l,h,t,e,i,s,n,o));let u=0,d=0,f=0,p=0,_=0;a.push(l,h);for(let m=1,g=0;m<=c;++m)g=m/c,u=1-g,d=u*u,f=d*u,p=g*g,_=p*g,a.push(f*l+3*d*g*t+3*u*p*i+_*n,f*h+3*d*g*e+3*u*p*s+_*o)}}function Fu(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,_=h+f,m=c+d,g=u+f;return a.push(p,_,m,g),2}function Fr(r,t,e,i,s,n,o,a){const l=e-r,h=i-t;
925let 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),_=Math.sqrt(l*l+h*h),m=(15*p*Math.sqrt(_)/Math.PI>>0)+1,g=f/m;if(d+=g,a){o.push(r,t,e,i);for(let v=1,y=d;v<m;v++,y+=g)o.push(r,t,r+Math.sin(y)*_,t+Math.cos(y)*_);o.push(r,t,s,n)}else{o.push(e,i,r,t);for(let v=1,y=d;v<m;v++,y+=g)o.push(r+Math.sin(y)*_,t+Math.cos(y)*_,r,t);o.push(s,n,r,t)}return m*2}function Hw(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 ht(i[0],i[1]),a=new ht(i[i.length-2],i[i.length-1]),l=e.type!==Dt.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 O=(o.x+a.x)*.5,Q=(a.y+o.y)*.5;i.unshift(O,Q),i.push(O,Q)}const c=t.points,u=i.length/2;let d=i.length;const f=c.length/2,p=n.width/2,_=p*p,m=n.miterLimit*n.miterLimit;let g=i[0],v=i[1],y=i[2],b=i[3],E=0,x=0,T=-(v-b),A=g-y,I=0,R=0,P=Math.sqrt(T*T+A*A);T/=P,A/=P,T*=p,A*=p;const M=n.alignment,S=(1-M)*2,C=M*2;l||(n.cap===gr.ROUND?d+=Fr(g-T*(S-C)*.5,v-A*(S-C)*.5,g-T*S,v-A*S,g+T*C,v+A*C,c,!0)+2:n.cap===gr.SQUARE&&(d+=Fu(g,v,T,A,S,C,!0,c))),c.push(g-T*S,v-A*S,g+T*C,v+A*C);for(let O=1;O<u-1;++O){g=i[(O-1)*2],v=i[(O-1)*2+1],y=i[O*2],b=i[O*2+1],E=i[(O+1)*2],x=i[(O+1)*2+1],T=-(v-b),A=g-y,P=Math.sqrt(T*T+A*A),T/=P,A/=P,T*=p,A*=p,I=-(b-x),R=y-E,P=Math.sqrt(I*I+R*R),I/=P,R/=P,I*=p,R*=p;const Q=y-g,k=v-b,w=y-E,L=x-b,V=Q*w+k*L,B=k*w-L*Q,tt=B<0;if(Math.abs(B)<.001*Math.abs(V)){c.push(y-T*S,b-A*S,y+T*C,b+A*C),V>=0&&(n.join===ne.ROUND?d+=Fr(y,b,y-T*S,b-A*S,y-I*S,b-R*S,c,!1)+4:d+=2,c.push(y-I*C,b-R*C,y+I*S,b+R*S));continue}const lt=(-T+g)*(-A+b)-(-T+y)*(-A+v),F=(-I+E)*(-R+b)-(-I+y)*(-R+x),st=(Q*F-w*lt)/B,dt=(L*lt-k*F)/B,ct=(st-y)*(st-y)+(dt-b)*(dt-b),nt=y+(st-y)*S,it=b+(dt-b)*S,ut=y-(st-y)*C,D=b-(dt-b)*C,mt=Math.min(Q*Q+k*k,w*w+L*L),wt=tt?S:C,te=mt+wt*wt*_,Ki=ct<=te;let U=n.join;if(U===ne.MITER&&ct/_>m&&(U=ne.BEVEL),Ki)switch(U){case ne.MITER:{c.push(nt,it,ut,D);break}case ne.BEVEL:{tt?c.push(nt,it,y+T*C,b+A*C,nt,it,y+I*C,b+R*C):c.push(y-T*S,b-A*S,ut,D,y-I*S,b-R*S,ut,D),d+=2;break}case ne.ROUND:{tt?(c.push(nt,it,y+T*C,b+A*C),d+=Fr(y,b,y+T*C,b+A*C,y+I*C,b+R*C,c,!0)+4,c.push(nt,it,y+I*C,b+R*C)):(c.push(y-T*S,b-A*S,ut,D),d+=Fr(y,b,y-T*S,b-A*S,y-I*S,b-R*S,c,!1)+4,c.push(y-I*S,b-R*S,ut,D));break}}else{switch(c.push(y-T*S,b-A*S,y+T*C,b+A*C),U){case ne.MITER:{tt?c.push(ut,D,ut,D):c.push(nt,it,nt,it),d+=2;break}case ne.ROUND:{tt?d+=Fr(y,b,y+T*C,b+A*C,y+I*C,b+R*C,c,!0)+2:d+=Fr(y,b,y-T*S,b-A*S,y-I*S,b-R*S,c,!1)+2;break}}c.push(y-I*S,b-R*S,y+I*C,b+R*C),d+=2}}g=i[(u-2)*2],v=i[(u-2)*2+1],y=i[(u-1)*2],b=i[(u-1)*2+1],T=-(v-b),A=g-y,P=Math.sqrt(T*T+A*A),T/=P,A/=P,T*=p,A*=p,c.push(y-T*S,b-A*S,y+T*C,b+A*C),l||(n.cap===gr.ROUND?d+=Fr(y-T*(S-C)*.5,b-A*(S-C)*.5,y-T*S,b-A*S,y+T*C,b+A*C,c,!1)+2:n.cap===gr.SQUARE&&(d+=Fu(y,b,T,A,S,C,!1,c)));const H=t.indices,X=$i.epsilon*$i.epsilon;for(let O=f;O<d+f-2;++O)g=c[O*2],v=c[O*2+1],y=c[(O+1)*2],b=c[(O+1)*2+1],E=c[(O+2)*2],x=c[(O+2)*2+1],!(Math.abs(g*(b-x)+y*(x-v)+E*(v-b))<X)&&H.push(O,O+1,O+2)}function $w(r,t){let e=0;const i=r.shape,s=r.points||i.points,n=i.type!==Dt.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 Ou(r,t){r.lineStyle.native?$w(r,t):Hw(r,t)}class Nh{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),_=Math.sqrt(u),m=2*u*_,g=2*Math.sqrt(f),v=d/_;return(m*p+_*d*(p-g)+(4*f*u-d*d)*Math.log((2*_+v+p)/(v+g)))/(4*m)}static curveTo(t,e,i,s,n){const o=n[n.length-2],a=n[n.length-1],l=$i._segmentsCount(Nh.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 Fa={[Dt.POLY]:Lp,[Dt.CIRC]:lo,[Dt.ELIP]:lo,[Dt.RECT]:Lw,[Dt.RREC]:Uw},Nu=[],rn=[];class ho{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 ho(this.shape,this.fillStyle,this.lineStyle,this.matrix
925)}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 di=new ht,Up=class Gp extends Vf{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 so,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(),rn.push(this.drawCalls[t]);this.drawCalls.length=0;for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e.reset(),Nu.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 ho(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 ho(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,di):di.copyFrom(t),s.shape.contains(di.x,di.y))){let n=!1;if(s.holes){for(let o=0;o<s.holes.length;o++)if(s.holes[o].shape.contains(di.x,di.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;Fa[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,_=this.indices.length,m=this.points.length/2;p.wrapMode=br.REPEAT,d===0?this.processFill(h):this.processLine(h);const g=this.points.length/2-m;g!==0&&(i&&!this._compareStyles(s,f)&&(i.end(_,m),i=null),i||(i=Nu.pop()||new Gw,i.begin(f,_,m),this.batches.push(i),s=f),this.addUvs(this.points,t,f.texture,m,g,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<Gp.BATCHABLE_SIZE*2}buildDrawCalls(){let t=++rt._globalBatch;for(let u=0;u<this.drawCalls.length;u++)this.drawCalls[u].texArray.clear(),rn.push(this.drawCalls[u]);this.drawCalls.length=0;const e=this.colors,i=this.textureIds;let s=rn.pop();s||(s=new Fl,s.texArray=new Ul),s.texArray.count=0,s.start=0,s.size=0,s.type=Oe.TRIANGLES;let n=0,o=null,a=0,l=!1,h=Oe.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,_=p.texture.baseTexture;l!==!!p.native&&(l=!!p.native,h=l?Oe.LINES:Oe.TRIANGLES,o=null,n=f,t++),o!==_&&(o=_,_._batchEnabled!==t&&(n===f&&(t++,n=0,s.size>0&&(s=rn.pop(),s||(s=new Fl,s.texArray=new Ul),this.drawCalls.push(s)),s.start=c,s.size=0,s.texArray.count=0,s.type=h),_.touched=1,_._batchEnabled=t,_._batchLocation=n,_.wrapMode=br.REPEAT,s.texArray.elements[s.texArray.count++
925]=_,n++)),s.size+=d.size,c+=d.size,a=_._batchLocation,this.addColors(e,p.color,p.alpha,d.attribSize,d.attribStart),this.addTextureIds(i,a,d.attribSize,d.attribStart)}rt._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?Lp.triangulate(t,this):Fa[t.type].triangulate(t,this)}processLine(t){Ou(t,this);for(let e=0;e<t.holes.length;e++)Ou(t.holes[e],this)}processHoles(t){for(let e=0;e<t.length;e++){const i=t[e];Fa[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=ft.shared.setValue(e).toLittleEndianNumber(),a=ft.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 _=i+2;_<a;_+=2)f=Math.min(f,Math.floor(t[_]+o)),p=Math.min(p,Math.floor(t[_+1]+o));u-=f,d-=p;for(let _=i;_<a;_+=2)t[_]=(t[_]+u)*h,t[_+1]=(t[_+1]+d)*c}};Up.BATCHABLE_SIZE=100;let zw=Up;class Mo{constructor(){this.color=16777215,this.alpha=1,this.texture=Y.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){const t=new Mo;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 Lh extends Mo{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=gr.BUTT,this.join=ne.MITER,this.miterLimit=10}clone(){const t=new Lh;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=gr.BUTT,this.join=ne.MITER,this.miterLimit=10}}const Oa={},ih=class Tn extends Nt{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 Mo,this._lineStyle=new Lh,this._matrix=null,this._holeMode=!1,this.state=Ge.for2d(),this._geometry=t||new zw,this._geometry.refCount++,this._transformID=-1,this._tintColor=new ft(16777215),this.blendMode=J.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new Tn(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?.texture?16777215:0,matrix:null,alignment:.5,native:!1,cap:gr.BUTT,join:ne.MITER,miterLimit:10};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();
925const 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),Nh.curveTo(t,e,i,s,n),this}bezierCurveTo(t,e,i,s,n,o){return this._initCurve(),Oh.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=Du.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+=Qn:o&&s<=n&&(s+=Qn),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 Du.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=ft.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 et(t,e,i,s))}drawRoundedRect(t,e,i,s,n){return this.drawShape(new Io(t,e,i,s,n))}drawCircle(t,e,i){return this.drawShape(new So(t,e,i))}drawEllipse(t,e,i,s){return this.drawShape(new Co(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===Dt.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:ft.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,ft.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(!Oa[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 gt,default:we.from({uSamplers:n},!0)},a=t.plugins[i]._shader.program;Oa[i]=new Le(a,o)}e=Oa[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,Tn._TEMP_POINT),this._geometry.containsPoint(Tn._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=ft.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,
925super.destroy(t)}};ih.curves=$i,ih._TEMP_POINT=new ht;let ri=ih;class Xw{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 Na=new ht,Lu=new Kr,Hp=class $p extends Nt{constructor(t,e,i,s=Oe.TRIANGLES){super(),this.geometry=t,this.shader=e,this.state=i||Ge.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=z.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===Oe.TRIANGLES&&e.length<$p.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=z.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 Xw(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,Na);const e=this.geometry.getBuffer("aVertexPosition").data,i=Lu.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],Lu.contains(Na.x,Na.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}};Hp.BATCHABLE_SIZE=100;let Uu=Hp;class Vw extends wr{constructor(t,e,i){super();
925const s=new Et(t),n=new Et(e,!0),o=new Et(i,!0,!0);this.addAttribute("aVertexPosition",s,2,!1,K.FLOAT).addAttribute("aTextureCoord",n,2,!1,K.FLOAT).addIndex(o),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}var Ww=`varying vec2 vTextureCoord; 926uniform vec4 uColor; 927 928uniform sampler2D uSampler; 929 930void main(void) 931{ 932 gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor; 933} 934`,jw=`attribute vec2 aVertexPosition; 935attribute vec2 aTextureCoord; 936 937uniform mat3 projectionMatrix; 938uniform mat3 translationMatrix; 939uniform mat3 uTextureMatrix; 940 941varying vec2 vTextureCoord; 942 943void main(void) 944{ 945 gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); 946 947 vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy; 948} 949`;class Gu extends Le{constructor(t,e){const i={uSampler:t,alpha:1,uTextureMatrix:gt.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||Qe.from(jw,Ww),i),this._colorDirty=!1,this.uvMatrix=new np(t),this.batchable=e.program===void 0,this.pluginName=e.pluginName,this._tintColor=new ft(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;ft.shared.setValue(this._tintColor).premultiply(this._alpha,t).toArray(this.uniforms.uColor)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}}class Hu{constructor(t,e,i){this.geometry=new wr,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||K.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 Et(_v(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 Et(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 Et(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===K.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===K.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===K.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];
vendor: 5,030 bytes, lines 949-982
949n.uploadFunction(t,e,i,n.type===K.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 Yw=`varying vec2 vTextureCoord; 950varying vec4 vColor; 951 952uniform sampler2D uSampler; 953 954void main(void){ 955 vec4 color = texture2D(uSampler, vTextureCoord) * vColor; 956 gl_FragColor = color; 957}`,qw=`attribute vec2 aVertexPosition; 958attribute vec2 aTextureCoord; 959attribute vec4 aColor; 960 961attribute vec2 aPositionCoord; 962attribute float aRotation; 963 964uniform mat3 translationMatrix; 965uniform vec4 uColor; 966 967varying vec2 vTextureCoord; 968varying vec4 vColor; 969 970void main(void){ 971 float x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation); 972 float y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation); 973 974 vec2 v = vec2(x, y); 975 v = v + aPositionCoord; 976 977 gl_Position = vec4((translationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0); 978 979 vTextureCoord = aTextureCoord; 980 vColor = aColor * uColor; 981} 982`;class zp extends Ro{constructor(t){super(t),this.shader=null,this.properties=null,this.tempMatrix=new gt,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:K.UNSIGNED_BYTE,uploadFunction:this.uploadTint,offset:0}],this.shader=Le.from(qw,Yw,{}),this.state=Ge.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=$f(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=ft.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 _=o-f;_>s&&(_=s),p>=a.length&&a.push(this._generateOneMoreBuffer(t));const m=a[p];m.uploadDynamic(e,f,_);const g=t._bufferUpdateIDs[p]||0;d=d||m._updateID<g,d&&(m._updateID=t._updateID,m.uploadStatic(e,f,_)),n.geometry.bind(m.geometry),c.drawElements(c.TRIANGLES,_*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 Hu(this.properties,n,s));return e}_generateOneMoreBuffer(t){const e=t._batchSize,i=t._properties;return new Hu(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,_=d.scale.y,m=f.trim,g=f.orig;m?(l=m.x-d.anchor.x*g.width,a=l+m.width,c=m.y-d.anchor.y*g.height,h=c+m.height):(a=g.width*(1-d.anchor.x),l=g.width*-d.anchor.x,h=g.height*(1-d.anchor.y),c=g.height*-d.anchor.y),s[o]=l*p,s[o+1]=c*_,s[o+n]=a*p,s[o+n+1]=c*_,s[o+n*2]=a*p,s[o+n*2+1]=h*_,s[o+n*3]=l*p,s[o+n*3+1]=h*_,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=ft.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}}zp.extension={name:"particle",type:G.RendererPlugin};q.add(zp);var ko=(r=>(r[r.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",r[r.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",r))(ko||{});const sn={willReadFrequently:!0},Pe=class Z{static get experimentalLetterSpacingSupported(){let t=Z._experimentalLetterSpacingSupported;if(t!==void 0){const e=z.ADAPTER.getCanvasRenderingContext2D().prototype;t=Z._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}
vendor: 9,422 bytes, lines 982-983
982static measureText(t,e,i,s=Z._canvas){i=i??e.wordWrap;const n=e.toFontString(),o=Z.measureFont(n);o.fontSize===0&&(o.fontSize=e.fontSize,o.ascent=e.fontSize);const a=s.getContext("2d",sn);a.font=n;const l=(i?Z.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 _=Z._measureText(l[p],e.letterSpacing,a);h[p]=_,c=Math.max(c,_)}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 Z(t,e,u,f,l,h,d+e.leading,c,o)}static _measureText(t,e,i){let s=!1;Z.experimentalLetterSpacingSupported&&(Z.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+=(Z.graphemeSegmenter(t).length-1)*e),n}static wordWrap(t,e,i=Z._canvas){const s=i.getContext("2d",sn);let n=0,o="",a="";const l=Object.create(null),{letterSpacing:h,whiteSpace:c}=e,u=Z.collapseSpaces(c),d=Z.collapseNewlines(c);let f=!u;const p=e.wordWrapWidth+h,_=Z.tokenize(t);for(let m=0;m<_.length;m++){let g=_[m];if(Z.isNewline(g)){if(!d){a+=Z.addLine(o),f=!u,o="",n=0;continue}g=" "}if(u){const y=Z.isBreakingSpace(g),b=Z.isBreakingSpace(o[o.length-1]);if(y&&b)continue}const v=Z.getFromCache(g,h,l,s);if(v>p)if(o!==""&&(a+=Z.addLine(o),o="",n=0),Z.canBreakWords(g,e.breakWords)){const y=Z.wordWrapSplit(g);for(let b=0;b<y.length;b++){let E=y[b],x=E,T=1;for(;y[b+T];){const I=y[b+T];if(!Z.canBreakChars(x,I,g,b,e.breakWords))E+=I;else break;x=I,T++}b+=T-1;const A=Z.getFromCache(E,h,l,s);A+n>p&&(a+=Z.addLine(o),f=!1,o="",n=0),o+=E,n+=A}}else{o.length>0&&(a+=Z.addLine(o),o="",n=0);const y=m===_.length-1;a+=Z.addLine(g,!y),f=!1,o="",n=0}else v+n>p&&(f=!1,a+=Z.addLine(o),o="",n=0),(o.length>0||!Z.isBreakingSpace(g)||f)&&(o+=g,n+=v)}return a+=Z.addLine(o,!1),a}static addLine(t,e=!0){return t=Z.trimRight(t),t=e?`${t} 983`:t,t}static getFromCache(t,e,i,s){let n=i[t];return typeof n!="number"&&(n=Z._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(!Z.isBreakingSpace(i))break;t=t.slice(0,-1)}return t}static isNewline(t){return typeof t!="string"?!1:Z._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:Z._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(Z.isBreakingSpace(n,o)||Z.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 Z.graphemeSegmenter(t)}static measureFont(t){if(Z._fonts[t])return Z._fonts[t];const e={ascent:0,descent:0,fontSize:0},i=Z._canvas,s=Z._context;s.font=t;const n=Z.METRICS_STRING+Z.BASELINE_SYMBOL,o=Math.ceil(s.measureText(n).width);let a=Math.ceil(s.measureText(Z.BASELINE_SYMBOL).width);const l=Math.ceil(Z.HEIGHT_MULTIPLIER*a);if(a=a*Z.BASELINE_MULTIPLIER|0,o===0||l===0)return Z._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 _=0;_<u;_+=4)if(h[f+_]!==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 _=0;_<u;_+=4)if(h[f+_]!==255){p=!0;break}if(!p)f-=u;else break}return e.descent=d-a,e.fontSize=e.ascent+e.descent,Z._fonts[t]=e,e}static clearMetrics(t=""){t?delete Z._fonts[t]:Z._fonts={}}static get _canvas(){if(!Z.__canvas){let t;try{const e=new OffscreenCanvas(0,0);if(e.getContext("2d",sn)?.measureText)return Z.__canvas=e,e;t=z.ADAPTER.createCanvas()}catch{t=z.ADAPTER.createCanvas()}t.width=t.height=10,Z.__canvas=t}return Z.__canvas}static get _context(){return Z.__context||(Z.__context=Z._canvas.getContext("2d",sn)),Z.__context}};Pe.METRICS_STRING="|ÉqÅ",Pe.BASELINE_SYMBOL="M",Pe.BASELINE_MULTIPLIER=1.4,Pe.HEIGHT_MULTIPLIER=2,Pe.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter=="function"){const r=new Intl.Segmenter;return t=>[...r.segment(t)].map(e=>e.segment)}return r=>[...r]})(),Pe.experimentalLetterSpacing=!1,Pe._fonts={},Pe._newlines=[10,13],Pe._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let fr=Pe;const Zw=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],Xp=class fs{constructor(t){this.styleID=0,this.reset(),Ua(this,t,t)}clone(){const t={};return Ua(t,this,fs.defaultStyle),new fs(t)}reset(){Ua(this,fs.defaultStyle,fs.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=La(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=La(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){Kw(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=La(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)&&!Zw.includes(s)&&(s=`"${s}"`),e[i]=s}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${t} ${e.join(",")}`}};Xp.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:ko.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 Er=Xp;function La(r){const t=ft.shared,e=i=>{const s=t.setValue(i);
983return s.alpha===1?s.toHex():s.toRgbaString()};return Array.isArray(r)?r.map(e):e(r)}function Kw(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 Ua(r,t,e){for(const i in e)Array.isArray(t[i])?r[i]=t[i].slice():r[i]=t[i]}const Jw={texture:!0,children:!1,baseTexture:!0},Vp=class sh extends Ht{constructor(t,e,i){let s=!1;i||(i=z.ADAPTER.createCanvas(),s=!0),i.width=3,i.height=3;const n=Y.from(i);n.orig=new et,n.trim=new et,super(n),this._ownCanvas=s,this.canvas=i,this.context=i.getContext("2d",{willReadFrequently:!0}),this._resolution=sh.defaultResolution??z.RESOLUTION,this._autoResolution=sh.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 fr.experimentalLetterSpacing}static set experimentalLetterSpacing(t){ot("7.1.0","Text.experimentalLetterSpacing is deprecated, use TextMetrics.experimentalLetterSpacing"),fr.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=fr.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 _=0;_<p;++_){const m=e.dropShadow&&_===0,g=m?Math.ceil(Math.max(1,o)+e.padding*2):0,v=g*this._resolution;if(m){i.fillStyle="black",i.strokeStyle="black";const b=e.dropShadowColor,E=e.dropShadowBlur*this._resolution,x=e.dropShadowDistance*this._resolution;i.shadowColor=ft.shared.setValue(b).setAlpha(e.dropShadowAlpha).toRgbaString(),i.shadowBlur=E,i.shadowOffsetX=Math.cos(e.dropShadowAngle)*x,i.shadowOffsetY=Math.sin(e.dropShadowAngle)*x+v}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 y=(l-u.fontSize)/2;l-u.fontSize<0&&(y=0);for(let b=0;b<a.length;b++)d=e.strokeThickness/2,f=e.strokeThickness/2+b*l+u.ascent+y,e.align==="right"?d+=c-h[b]:e.align==="center"&&(d+=(c-h[b])/2),e.stroke&&e.strokeThickness&&this.drawLetterSpacing(a[b],d+e.padding,f+e.padding-g,!0),e.fill&&this.drawLetterSpacing(a[b],d+e.padding,f+e.padding-g)}this.updateTexture()}drawLetterSpacing(t,e,i,s=!1){const n=this._style.letterSpacing;let o=!1;if(fr.experimentalLetterSpacingSupported&&(fr.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=fr.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=vv(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===ko.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,_=i.lineHeight*f;let m=_;f>0&&p>_&&(m=(_+p)/2);const g=_+d,v=i.lineHeight*(f+1);let y=g;f+1<e.length&&v<g&&(y=(g+v)/2);const b=(y-m)/h;for(let E=0;E<c.length;E++){let x=0;typeof u[E]=="number"?x=u[E]:x=E/c.length;let T=Math.min(1,Math.max(0,m/h+x*b));T=Number(T.toFixed(5)),n.addColorStop(T,c[E])}}}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 _;typeof u[p]=="number"?_=u[p]:_=f/d,n.addColorStop(_,c[p]),f++}}return n}destroy(t){typeof t=="boolean"&&(t={children:t}),t=Object.assign({},Jw,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=mr(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=mr(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 Er?this._style=t:this._style=new Er(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)}};Vp.defaultAutoResolution=!0;let Wp=Vp;class Qw{constructor(t){this.maxItemsPerFrame=t,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function tT(r,t){let e=!1;if(r?._textures?.length){for(let i=0;i<r._textures.length;i++)if(r._textures[i]instanceof Y){const s=r._textures[i].baseTexture;t.includes(s)||(t.push(s),e=!0)}}return e}function eT(r,t){if(r.baseTexture instanceof rt){const e=r.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function rT(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 iT(r,t){return t instanceof Wp?(t.updateText(!0),!0):!1}function sT(r,t){if(t instanceof Er){const e=t.toFontString();return fr.measureFont(e),!0}return!1}function nT(r,t){if(r instanceof Wp){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 oT(r,t){return r instanceof Er?(t.includes(r)||t.push(r),!0):!1}const jp=class Yp{constructor(t){this.limiter=new Qw(Yp.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(nT),this.registerFindHook(oT),this.registerFindHook(tT),this.registerFindHook(eT),this.registerFindHook(rT),this.registerUploadHook(iT),this.registerUploadHook(sT)}upload(t){return new Promise(e=>{t&&this.add(t),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,Qt.system.addOnce(this.tick,this,ei.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)Qt.system.addOnce(this.tick,this,ei.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 Nt)for(let e=t.children.length-1;e>=0;e--)this.add(t.children[e]);return this}destroy(){this.ticking&&Qt.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}};jp.uploadsPerFrame=4;let nh=jp;Object.defineProperties(z,{UPLOADS_PER_FRAME:{get(){return nh.uploadsPerFrame},set(r){ot("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),nh.uploadsPerFrame=r}}});function qp(r,t){return t instanceof rt?(t._glTextures[r.CONTEXT_UID]||r.texture.bind(t),!0):!1}function aT(r,t){if(!(t instanceof ri))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&&qp(r,n.baseTexture)}return e.batchable||r.geometry.bind(e,t._resolveDirectShader(r)),!0}function lT(r,t){return r instanceof ri?(t.push(r),!0):!1}class Zp extends nh{constructor(t){super(t),this.uploadHookHelper=this.renderer,this.registerFindHook(lT),this.registerUploadHook(qp),this.registerUploadHook(aT)}}Zp.extension={name:"prepare",type:G.RendererSystem};q.add(Zp);var hT=`#version 300 es 984#define SHADER_NAME Tiling-Sprite-100 985 986precision lowp float; 987 988in vec2 vTextureCoord; 989 990out vec4 fragmentColor; 991 992uniform sampler2D uSampler; 993uniform vec4 uColor; 994uniform mat3 uMapCoord; 995uniform vec4 uClampFrame; 996uniform vec2 uClampOffset; 997 998void main(void) 999{ 1000 vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord); 1001 coord = (uMapCoord * vec3(coord, 1.0)).xy;
1002 vec2 unclamped = coord; 1003 coord = clamp(coord, uClampFrame.xy, uClampFrame.zw); 1004 1005 vec4 texSample = texture(uSampler, coord, unclamped == coord ? 0.0f : -32.0f);// lod-bias very negative to force lod 0 1006 1007 fragmentColor = texSample * uColor; 1008} 1009`,cT=`#version 300 es 1010#define SHADER_NAME Tiling-Sprite-300 1011 1012precision lowp float; 1013 1014in vec2 aVertexPosition; 1015in vec2 aTextureCoord; 1016 1017uniform mat3 projectionMatrix; 1018uniform mat3 translationMatrix; 1019uniform mat3 uTransform; 1020 1021out vec2 vTextureCoord; 1022 1023void main(void) 1024{ 1025 gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); 1026 1027 vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy; 1028} 1029`,uT=`#version 100 1030#ifdef GL_EXT_shader_texture_lod 1031 #extension GL_EXT_shader_texture_lod : enable 1032#endif 1033#define SHADER_NAME Tiling-Sprite-100 1034 1035precision lowp float; 1036 1037varying vec2 vTextureCoord; 1038 1039uniform sampler2D uSampler; 1040uniform vec4 uColor; 1041uniform mat3 uMapCoord; 1042uniform vec4 uClampFrame; 1043uniform vec2 uClampOffset; 1044 1045void main(void) 1046{ 1047 vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord); 1048 coord = (uMapCoord * vec3(coord, 1.0)).xy; 1049 vec2 unclamped = coord; 1050 coord = clamp(coord, uClampFrame.xy, uClampFrame.zw); 1051 1052 #ifdef GL_EXT_shader_texture_lod 1053 vec4 texSample = unclamped == coord 1054 ? texture2D(uSampler, coord) 1055 : texture2DLodEXT(uSampler, coord, 0); 1056 #else 1057 vec4 texSample = texture2D(uSampler, coord); 1058 #endif 1059 1060 gl_FragColor = texSample * uColor; 1061} 1062`,$u=`#version 100 1063#define SHADER_NAME Tiling-Sprite-100 1064 1065precision lowp float; 1066 1067attribute vec2 aVertexPosition; 1068attribute vec2 aTextureCoord; 1069 1070uniform mat3 projectionMatrix; 1071uniform mat3 translationMatrix; 1072uniform mat3 uTransform; 1073 1074varying vec2 vTextureCoord; 1075 1076void main(void) 1077{ 1078 gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0
1078)).xy, 0.0, 1.0); 1079 1080 vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy; 1081} 1082`,dT=`#version 100 1083#define SHADER_NAME Tiling-Sprite-Simple-100 1084 1085precision lowp float; 1086 1087varying vec2 vTextureCoord; 1088 1089uniform sampler2D uSampler; 1090uniform vec4 uColor; 1091 1092void main(void) 1093{ 1094 vec4 texSample = texture2D(uSampler, vTextureCoord); 1095 gl_FragColor = texSample * uColor; 1096} 1097`;const nn=new gt;class Kp extends Ro{constructor(t){super(t),t.runners.contextChange.add(this),this.quad=new ep,this.state=Ge.for2d()}contextChange(){const t=this.renderer,e={globals:t.globalUniforms};this.simpleShader=Le.from($u,dT,e),this.shader=t.context.webGLVersion>1?Le.from(cT,hT,e):Le.from($u,uT,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!==br.CLAMP:l.wrapMode===br.CLAMP&&(l.wrapMode=br.REPEAT));const f=d?this.simpleShader:this.shader,p=a.width,_=a.height,m=t._width,g=t._height;nn.set(c.a*p/m,c.b*p/g,c.c*_/m,c.d*_/g,c.tx/m,c.ty/g),nn.invert(),d?nn.prepend(u.mapCoord):(f.uniforms.uMapCoord=u.mapCoord.toArray(!0),f.uniforms.uClampFrame=u.uClampFrame,f.uniforms.uClampOffset=u.uClampOffset),f.uniforms.uTransform=nn.toArray(!0),f.uniforms.uColor=ft.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=$f(t.blendMode,h),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}Kp.extension={name:"tilingSprite",type:G.RendererPlugin};q.add(Kp);const Jp=class ps{constructor(t,e,i=null){this.linkedSheets=[],this._texture=t instanceof Y?t:null,this.baseTexture=t instanceof rt?t:this._texture.baseTexture,this.textures={},this.animations={},this.data=e;const s=this.baseTexture.resource;this.resolution=this._updateResolution(i||(s?s.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=ir(t,null);return i===null&&(i=parseFloat(e??"1")),i!==1&&this.baseTexture.setResolution(i),i}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=ps.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const i=ps.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 et(0,0,Math.floor(h.w)/this.resolution,Math.floor(h.h)/this.resolution);n.rotated?a=new et(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 et(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 et(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],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*ps.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*ps.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){for(const e in this.textures)this.textures[e].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&(this._texture?.destroy(),this.baseTexture.destroy()),this._texture=null,this.baseTexture=null,this.linkedSheets=[]}};Jp.BATCH_SIZE=1e3;let zu=Jp;const fT=["jpg","png","jpeg","avif","webp"];function Qp(r,t,e){const i={};if(r.forEach(s=>{i[s]=t}
1097),Object.keys(t.textures).forEach(s=>{i[s]=t.textures[s]}),!e){const s=It.dirname(r[0]);t.linkedSheets.forEach((n,o)=>{const a=Qp([`${s}/${t.data.meta.related_multi_packs[o]}`],n,!0);Object.assign(i,a)})}return i}const pT={extension:G.Asset,cache:{test:r=>r instanceof zu,getCacheableAssets:(r,t)=>Qp(r,t,!1)},resolver:{test:r=>{const t=r.split("?")[0].split("."),e=t.pop(),i=t.pop();return e==="json"&&fT.includes(i)},parse:r=>{const t=r.split(".");return{resolution:parseFloat(z.RETINA_PREFIX.exec(r)?.[1]??"1"),format:t[t.length-2],src:r}}},loader:{name:"spritesheetLoader",extension:{type:G.LoadParser,priority:Te.Normal},async testParse(r,t){return It.extname(t.src).toLowerCase()===".json"&&!!r.frames},async parse(r,t,e){let i=It.dirname(t.src);i&&i.lastIndexOf("/")!==i.length-1&&(i+="/");let s=i+r.meta.image;s=eh(s,t.src);const n=(await e.load([s]))[s],o=new zu(n.baseTexture,r,t.src);await o.parse();const a=r?.meta?.related_multi_packs;if(Array.isArray(a)){const l=[];for(const c of a){if(typeof c!="string")continue;let u=i+c;t.data?.ignoreMultiPack||(u=eh(u,t.src),l.push(e.load({src:u,data:{ignoreMultiPack:!0}})))}const h=await Promise.all(l);o.linkedSheets=h,h.forEach(c=>{c.linkedSheets=[o].concat(o.linkedSheets.filter(u=>u!==c))})}return o},unload(r){r.destroy(!0)}}};q.add(pT);class co{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class En{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 co;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 oh{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 co,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 ah{static test(t){return typeof t=="string"&&t.includes("<font>")?oh.test(z.ADAPTER.parseXML(t)):!1}static parse(t){return oh.parse(z.ADAPTER.parseXML(t))}}const Ga=[En,oh,ah];function _T(r){for(let t=0;t<Ga.length;t++)if(Ga[t].test(r))return Ga[t];return null}function mT(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
1097*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 _=1;_<p;++_)f.push(_/p)}if(d.unshift(o[0]),f.unshift(0),d.push(o[o.length-1]),f.push(1),e.fillGradientType===ko.LINEAR_VERTICAL){a=t.createLinearGradient(c/2,h,c/2,u+h);let p=0;const _=(n.fontProperties.fontSize+e.strokeThickness)/u;for(let m=0;m<s.length;m++){const g=n.lineHeight*m;for(let v=0;v<d.length;v++){let y=0;typeof f[v]=="number"?y=f[v]:y=v/d.length;const b=g/u+y*_;let E=Math.max(p,b);E=Math.min(E,1),a.addColorStop(E,d[v]),p=E}}}else{a=t.createLinearGradient(h,u/2,c+h,u/2);const p=d.length+1;let _=1;for(let m=0;m<d.length;m++){let g;typeof f[m]=="number"?g=f[m]:g=_/p,a.addColorStop(g,d[m]),_++}}return a}function gT(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=mT(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=ft.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 An(r){return r.codePointAt?r.codePointAt(0):r.charCodeAt(0)}function t_(r){return Array.from?Array.from(r):r.split("")}function yT(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(...t_(s))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}const lr=class Me{constructor(t,e,i){const[s]=t.info,[n]=t.common,[o]=t.page,[a]=t.distanceField,l=ir(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 c=0;c<t.page.length;c++){const{id:u,file:d}=t.page[c];h[u]=e instanceof Array?e[c]:e[d],a?.fieldType&&a.fieldType!=="none"&&(h[u].baseTexture.alphaMode=Wt.NO_PREMULTIPLIED_ALPHA,h[u].baseTexture.mipmap=Ue.OFF)}for(let c=0;c<t.char.length;c++){const{id:u,page:d}=t.char[c];let{x:f,y:p,width:_,height:m,xoffset:g,yoffset:v,xadvance:y}=t.char[c];f/=l,p/=l,_/=l,m/=l,g/=l,v/=l,y/=l;const b=new et(f+h[d].frame.x/l,p+h[d].frame.y/l,_,m);this.chars[u]={xOffset:g,yOffset:v,xAdvance:y,kerning:{},texture:new Y(h[d].baseTexture,b),page:d}}for(let c=0;c<t.kerning.length;c++){let{first:u,second:d,amount:f}=t.kerning[c];u/=l,d/=l,f/=l,this.chars[d]&&(this.chars[d].kerning[u]=f)}this.distanceFieldRange=a?.distanceRange,this.distanceFieldType=a?.fieldType?.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 co)s=t;else{const o=_T(t);if(!o)throw new Error("Unrecognized data format for font.");s=o.parse(t)}e instanceof Y&&(e=[e]);const n=new Me(s,e,i);return Me.available[n.font]=n,n}static uninstall(t){const e=Me.available[t];if(!e)throw new Error(`No font found named '${t}'`);e.destroy(),delete Me.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({},Me.defaultOptions,i),c=yT(s),u=e instanceof Er?e:new Er(e),d=a,f=new co;f.info[0]={face:u.fontFamily,size:u.fontSize},f.common[0]={lineHeight:u.fontSize};let p=0,_=0,m,g,v,y=0;const b=[];for(let x=0;x<c.length;x++){m||(m=z.ADAPTER.createCanvas(),m.width=a,m.height=l,g=m.getContext("2d"),v=new rt(m,{resolution:o,...h}
1097),b.push(new Y(v)),f.page.push({id:b.length-1,file:""}));const T=c[x],A=fr.measureText(T,u,!1,m),I=A.width,R=Math.ceil(A.height),P=Math.ceil((u.fontStyle==="italic"?2:1)*I);if(_>=l-R*o){if(_===0)throw new Error(`[BitmapFont] textureHeight ${l}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${T}')`);--x,m=null,g=null,v=null,_=0,p=0,y=0;continue}if(y=Math.max(R+A.fontProperties.descent,y),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}')`);--x,_+=y*o,_=Math.ceil(_),p=0,y=0;continue}gT(m,g,A,p,_,o,u);const M=An(A.text);f.char.push({id:M,page:b.length-1,x:p/o,y:_/o,width:P,height:R,xoffset:0,yoffset:0,xadvance:I-(u.dropShadow?u.dropShadowDistance:0)-(u.stroke?u.strokeThickness:0)}),p+=(P+2*n)*o,p=Math.ceil(p)}if(!i?.skipKerning)for(let x=0,T=c.length;x<T;x++){const A=c[x];for(let I=0;I<T;I++){const R=c[I],P=g.measureText(A).width,M=g.measureText(R).width,S=g.measureText(A+R).width-(P+M);S&&f.kerning.push({first:An(A),second:An(R),amount:S})}}const E=new Me(f,b,!0);return Me.available[t]!==void 0&&Me.uninstall(t),Me.available[t]=E,E}};lr.ALPHA=[["a","z"],["A","Z"]," "],lr.NUMERIC=[["0","9"]],lr.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],lr.ASCII=[[" ","~"]],lr.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:lr.ALPHANUMERIC},lr.available={};let hr=lr;var vT=`// Pixi texture info\r 1098varying vec2 vTextureCoord;\r 1099uniform sampler2D uSampler;\r 1100\r 1101// Tint\r 1102uniform vec4 uColor;\r 1103\r 1104// on 2D applications fwidth is screenScale / glyphAtlasScale * distanceFieldRange\r 1105uniform float uFWidth;\r 1106\r 1107void main(void) {\r 1108\r 1109 // To stack MSDF and SDF we need a non-pre-multiplied-alpha texture.\r 1110 vec4 texColor = texture2D(uSampler, vTextureCoord);\r 1111\r 1112 // MSDF\r 1113 float median = texColor.r + texColor.g + texColor.b -\r 1114 min(texColor.r, min(texColor.g, texColor.b)) -\r 1115 max(texColor.r, max(texColor.g, texColor.b));\r 1116 // SDF\r 1117 median = min(median, texColor.a);\r 1118\r 1119 float screenPxDistance = uFWidth * (median - 0.5);\r 1120 float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);\r 1121 if (median < 0.01) {\r 1122 alpha = 0.0;\r 1123 } else if (median > 0.99) {\r 1124 alpha = 1.0;\r 1125 }\r 1126\r 1127 // Gamma correction for coverage-like alpha\r 1128 float luma = dot(uColor.rgb, vec3(0.299, 0.587, 0.114));\r 1129 float gamma = mix(1.0, 1.0 / 2.2, luma);\r 1130 float coverage = pow(uColor.a * alpha, gamma); \r 1131\r 1132 // NPM Textures, NPM outputs\r 1133 gl_FragColor = vec4(uColor.rgb, coverage);\r 1134}\r 1135`,bT=`// Mesh material default fragment\r 1136attribute vec2 aVertexPosition;\r 1137attribute vec2 aTextureCoord;\r 1138\r 1139uniform mat3 projectionMatrix;\r 1140uniform mat3 translationMatrix;\r 1141uniform mat3 uTextureMatrix;\r 1142\r 1143varying vec2 vTextureCoord;\r 1144\r 1145void main(void)\r 1146{\r 1147 gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0
1147)).xy, 0.0, 1.0);\r 1148\r 1149 vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\r 1150}\r 1151`;const Xu=[],Vu=[],Wu=[],xT=class e_ extends Nt{constructor(t,e={}){super();const{align:i,tint:s,maxWidth:n,letterSpacing:o,fontName:a,fontSize:l}=Object.assign({},e_.styleDefaults,e);if(!hr.available[a])throw new Error(`Missing BitmapFont "${a}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=i,this._tintColor=new ft(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 Je(()=>{this.dirty=!0},this,0,0),this._roundPixels=z.ROUND_PIXELS,this.dirty=!0,this._resolution=z.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){const t=hr.available[this._fontName],e=this.fontSize,i=e/t.size,s=new ht,n=[],o=[],a=[],l=this._text.replace(/(?:\r\n|\r)/g,` 1152`)||" ",h=t_(l),c=this._maxWidth*t.size/e,u=t.distanceFieldType==="none"?Xu:Vu;let d=null,f=0,p=0,_=0,m=-1,g=0,v=0,y=0,b=0;for(let P=0;P<h.length;P++){const M=h[P],S=An(M);
1152if(/(?:\s)/.test(M)&&(m=P,g=f,b++),M==="\r"||M===` 1153`){o.push(f),a.push(-1),p=Math.max(p,f),++_,++v,s.x=0,s.y+=t.lineHeight,d=null,b=0;continue}const C=t.chars[S];if(!C)continue;d&&C.kerning[d]&&(s.x+=C.kerning[d]);const H=Wu.pop()||{texture:Y.EMPTY,line:0,charCode:0,prevSpaces:0,position:new ht};H.texture=C.texture,H.line=_,H.charCode=S,H.position.x=Math.round(s.x+C.xOffset+this._letterSpacing/2),H.position.y=Math.round(s.y+C.yOffset),H.prevSpaces=b,n.push(H),f=H.position.x+Math.max(C.xAdvance-C.xOffset,C.texture.orig.width),s.x+=C.xAdvance+this._letterSpacing,y=Math.max(y,C.yOffset+C.texture.height),d=S,m!==-1&&c>0&&s.x>c&&(++v,Bi(n,1+m-v,1+P-m),P=m,m=-1,o.push(g),a.push(n.length>0?n[n.length-1].prevSpaces:0),p=Math.max(p,g),_++,s.x=0,s.y+=t.lineHeight,d=null,b=0)}const E=h[h.length-1];E!=="\r"&&E!==` 1154`&&(/(?:\s)/.test(E)&&(f=g),o.push(f),p=Math.max(p,f),a.push(-1));const x=[];for(let P=0;P<=_;P++){let M=0;this._align==="right"?M=p-o[P]:this._align==="center"?M=(p-o[P])/2:this._align==="justify"&&(M=a[P]<0?0:(p-o[P])/a[P]),x.push(M)}const T=n.length,A={},I=[],R=this._activePagesMeshData;u.push(...R);for(let P=0;P<T;P++){const M=n[P].texture,S=M.baseTexture.uid;if(!A[S]){let C=u.pop();if(!C){const X=new Vw;let O,Q;t.distanceFieldType==="none"?(O=new Gu(Y.EMPTY),Q=J.NORMAL):(O=new Gu(Y.EMPTY,{program:Qe.from(bT,vT),uniforms:{uFWidth:0}}),Q=J.NORMAL_NPM);const k=new Uu(X,O);k.blendMode=Q,C={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:k,vertices:null,uvs:null,indices:null}}C.index=0,C.indexCount=0,C.vertexCount=0,C.uvsCount=0,C.total=0;const{_textureCache:H}=this;H[S]=H[S]||new Y(M.baseTexture),C.mesh.texture=H[S],C.mesh.tint=this._tintColor.value,I.push(C),A[S]=C}A[S].total++}for(let P=0;P<R.length;P++)I.includes(R[P])||this.removeChild(R[P].mesh);for(let P=0;P<I.length;P++)I[P].mesh.parent!==this&&this.addChild(I[P].mesh);this._activePagesMeshData=I;for(const P in A){const M=A[P],S=M.total;if(!(M.indices?.length>6*S)||M.vertices.length<Uu.BATCHABLE_SIZE*2)M.vertices=new Float32Array(4*2*S),M.uvs=new Float32Array(4*2*S),M.indices=new Uint16Array(6*S);else{const C=M.total,H=M.vertices;for(let X=C*4*2;X<H.length;X++)H[X]=0}M.mesh.size=6*S}for(let P=0;P<T;P++){const M=n[P];let S=M.position.x+x[M.line]*(this._align==="justify"?M.prevSpaces:1);this._roundPixels&&(S=Math.round(S));const C=S*i,H=M.position.y*i,X=M.texture,O=A[X.baseTexture.uid],Q=X.frame,k=X._uvs,w=O.index++;O.indices[w*6+0]=0+w*4,O.indices[w*6+1]=1+w*4,O.indices[w*6+2]=2+w*4,O.indices[w*6+3]=0+w*4,O.indices[w*6+4]=2+w*4,O.indices[w*6+5]=3+w*4,O.vertices[w*8+0]=C,O.vertices[w*8+1]=H,O.vertices[w*8+2]=C+Q.width*i,O.vertices[w*8+3]=H,O.vertices[w*8+4]=C+Q.width*i,O.vertices[w*8+5]=H+Q.height*i,O.vertices[w*8+6]=C,O.vertices[w*8+7]=H+Q.height*i,O.uvs[w*8+0]=k.x0,O.uvs[w*8+1]=k.y0,O.uvs[w*8+2]=k.x1,O.uvs[w*8+3]=k.y1,O.uvs[w*8+4]=k.x2,O.uvs[w*8+5]=k.y2,O.uvs[w*8+6]=k.x3,O.uvs[w*8+7]=k.y3}this._textWidth=p*i,this._textHeight=(s.y+t.lineHeight)*i;for(const P in A){const M=A[P];if(this.anchor.x!==0||this.anchor.y!==0){let X=0;const O=this._textWidth*this.anchor.x,Q=this._textHeight*this.anchor.y;for(let k=0;k<M.total;k++)M.vertices[X++]-=O,M.vertices[X++]-=Q,M.vertices[X++]-=O,M.vertices[X++]-=Q,M.vertices[X++]-=O,M.vertices[X++]-=Q,M.vertices[X++]-=O,M.vertices[X++]-=Q}this._maxLineHeight=y*i;const S=M.mesh.geometry.getBuffer("aVertexPosition"),C=M.mesh.geometry.getBuffer("aTextureCoord"),H=M.mesh.geometry.getIndex();S.data=M.vertices,C.data=M.uvs,H.data=M.indices,S.update(),C.update(),H.update()}for(let P=0;P<n.length;P++)Wu.push(n[P]);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}=hr.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=hr.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(!hr.available[t])throw new Error(`Missing BitmapFont "${t}"`);this._fontName!==t&&(this._fontName=t,this.dirty=!0)}get fontSize(){return this._fontSize??hr.available[this._fontName].size}set fontSize(t){this._fontSize!==t&&(this._fontSize=t,this.dirty=!0)}get anchor(){return this._anchor}
1154set 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=hr.available[this._fontName].distanceFieldType==="none"?Xu:Vu;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)}};xT.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};const wT=[".xml",".fnt"],TT={extension:{type:G.LoadParser,priority:Te.Normal},name:"loadBitmapFont",test(r){return wT.includes(It.extname(r).toLowerCase())},async testParse(r){return En.test(r)||ah.test(r)},async parse(r,t,e){const i=En.test(r)?En.parse(r):ah.parse(r),{src:s}=t,{page:n}=i,o=[];for(let h=0;h<n.length;++h){const c=n[h].file;let u=It.join(It.dirname(s),c);u=eh(u,s),o.push(u)}const a=await e.load(o),l=o.map(h=>a[h]);return hr.install(i,l,!0)},async load(r,t){return(await z.ADAPTER.fetch(r)).text()},unload(r){r.destroy()}};q.add(TT);
1154const lh=class Ei extends Er{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(t){return new Ei(Object.keys(Ei.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 Ei.availableFonts[t.originalUrl])}),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(t,e={}){const{availableFonts:i}=Ei;if(i[t]){const s=i[t];return this._fonts.push(s),s.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return z.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:It.basename(t,It.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} 1155 @font-face { 1156 font-family: "${e.family}"; 1157 src: url('${e.dataSrc}'); 1158 font-weight: ${e.weight}; 1159 font-style: ${e.style}; 1160 font-display: ${e.display}; 1161 }`,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=fv(t)),typeof t=="number"?dv(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,Ei.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}=z.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}};lh.availableFonts={},lh.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 Ha=lh;const on=class Ai extends Ht{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:z.SCALE_MODE,resourceOptions:{autoLoad:!1}});s.orig=new et,s.trim=new et,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=Ai.defaultMaxWidth,this.maxHeight=Ai.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=Ai.defaultAutoResolution,this._resolution=Ai.defaultResolution??z.RESOLUTION,this.text=t,this.style=e}measureText(t){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:this._style?.toCSS(s)}),this._styleElement.textContent=this._style?.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()=>
1161{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){typeof t=="boolean"&&(t={children:t}),t=Object.assign({},Ai.defaultDestroyOptions,t),super.destroy(t);const e=null;this.ownsStyle&&this._style?.cleanFonts(),this._style=e,this._svgRoot?.remove(),this._svgRoot=e,this._domElement?.remove(),this._domElement=e,this._foreignObject?.remove(),this._foreignObject=e,this._styleElement?.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=mr(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=mr(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 Ha?(this.ownsStyle=!1,this._style=t):t instanceof Er?(console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle"),this.ownsStyle=!0,this._style=Ha.from(t)):(this.ownsStyle=!0,this._style=new Ha(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(/ /gi," ")}};on.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},on.defaultMaxWidth=2024,on.defaultMaxHeight=2024,on.defaultAutoResolution=!0;const ET=` 1162precision highp float; 1163 1164uniform sampler2D uDrawingTexture; 1165uniform sampler2D uEraserTexture; 1166 1167varying vec2 vTextureCoord; 1168 1169void main(void) { 1170 vec4 drawingColor = texture2D(uDrawingTexture,vTextureCoord); 1171 vec4 eraserColor = texture2D(uEraserTexture, vTextureCoord); 1172 1173 // Use the alpha of the eraser to determine how much to "erase" from the drawing 1174 float alpha = 1.0 - eraserColor.a; 1175 gl_FragColor = vec4(drawingColor.rgb * alpha, drawingColor.a * alpha); 1176}`;function ju(r,t){if(t<0||t>=r.length-1)throw new Error("Index out of bounds");[r[t],r[t+1]]=[r[t+1],r[t]]}function AT(){let r=[],t=0;return{add_layer:function(e,i,s,n){const o=new Nt;t++,o.zIndex=t;const a=Lt.create({width:s,height:n}),l=new Ht(a);o.addChild(l),l.zIndex=t;const h={draw_texture:Lt.create({width:s,height:n}),erase_texture:Lt.create({width:s,height:n}),composite:l},c=new Ot(void 0,ET,{uEraserTexture:h.erase_texture,uDrawingTexture:h.draw_texture});return l.filters=[c],e.addChild(o),r.push(h),[h,r]},swap_layers:function(e,i){return i==="up"?ju(r,e):ju(r,e-1),r[e]},change_active_layer:function(e){return r[e]},reset(){r.forEach(e=>{e.draw_texture.destroy(!0),e.erase_texture.destroy(!0),e.composite.destroy(!0)}),r=[],t=0},async add_layer_from_blob(e,i,s,n){const o=await createImageBitmap(s),a=Y.from(o),[l,h]=ST(a.width,a.height,n.width,n.height),c=new Ht(a);c.zIndex=0,c.width=l,c.height=h;const[u,d]=this.add_layer(e,i,n.width,n.height);return i.render(c,{renderTexture:u.draw_texture}),[u,d]},get_layers(){return r}}}function ST(r,t,e,i){if(r<=e&&t<=i)return[r,t];const s=r/t,n=e/i;let o,a;return s>n?(o=e,a=e/s):(a=i,o=i*s),[o,a]}function CT({target:r,dimensions:[t,e],antialias:i}){const s=window.devicePixelRatio||1,n=new Bp({width:t,height:e,antialias:i,backgroundAlpha:0,eventMode:"static"}),o=n.view;n.stage.sortableChildren=!0,o.style.maxWidth=`${t/s}px`,o.style.maxHeight=`${e/s}px`,o.style.width="100%",o.style.height="100%",r.appendChild(n.view);const a=new Nt;a.zIndex=0;const l=new Nt;l.zIndex=1,l.sortableChildren=!0;const h=new Nt;h.zIndex=1;const c=new Nt;c.zIndex=0,h.addChild(a),h.addChild(l),n.stage.addChild(h),n.stage.addChild(c);const u=new ri;let d=Lt.create({width:t,height:e});const f=new Ht(d);h.mask=f,n.render();function p(g,v){a.removeChildren(),u.beginFill(16777215,1),u.drawRect(0,0,g,v),u.endFill(),d=Lt.create({width:g,height:v}),n.renderer.render(u,{renderTexture:d});const y=new Ht(d);h.mask=y}function _(g,v){n.renderer.resize(g,v),o.style.maxWidth=`${g/s}px`,o.style.maxHeight=`${v/s}px`,p(g,v)}async function m(g,v,[y,b]){const E=await $a(n.renderer,a,v,y,b),x=await Promise.all(g.map(A=>$a(n.renderer,A.composite,v,y,b))),T=await $a(n.renderer,h,v,y,b);return{background:E,layers:x,composite:T}}return{layer_container:l,renderer:n.renderer,destroy:()=>n.destroy(!0),view:n.view,background_container:a,mask_container:h,resize:_,get_blobs:m}}function r_(r){const t=new ri;return t.eventMode="none",t.zIndex=r,t}function Xt(r,t,e){return r<t?t:r>e?e:r}function $a(r,t,e,i,s){return new Promise(n=>
1176{const o=r.extract.canvas(t,new et(0,0,i,s));let a=document.createElement("canvas");a.width=e.width,a.height=e.height;let l=a.getContext("2d");if(!l)throw n(null),new Error("Could not create canvas context");l.drawImage(o,e.x,e.y,e.width,e.height,0,0,e.width,e.height),a.toBlob?.(h=>{h||n(null),n(h)})})}function hh(r){return{command:r||null,next:null,previous:null,push:function(t){const e=hh(t);e.previous=this,this.next=e}}}function IT(){let r=hh();const t=zt(!1),e=zt(!1),i=zt(r);return{undo:function(){r.previous&&(r.command?.undo(),r=r.previous),t.set(!!r.previous),e.set(!!r.next),i.set(r)},redo:function(){r.next&&(r.next.command?.execute(),r=r.next),t.set(!!r.previous),e.set(!!r.next),i.set(r)},execute:function(s){s.execute(),r.push(s),r=r.next,t.set(!!r.previous),e.set(!!r.next),i.set(r)},can_undo:t,can_redo:e,current_history:i,reset:function(){r=hh(),t.set(!1),e.set(!1),i.set(r)}}}function za(r,t,e,i=new ft("black"),s){const n=new ft(i);r.beginFill(n),r.drawCircle(t,e,s),r.endFill()}function RT(r,t){let e=[];const i=t.x-r.x,s=t.y-r.y,n=Math.sqrt(i*i+s*s),o=Math.ceil(n/2),a=i/o,l=s/o;for(let h=0;h<o;h++){const c=r.x+h*a,u=r.y+h*l;e.push({x:c,y:u})}return e}function PT(r,t,e,i){const s=[];let n,o,a,l=!1,h=0;return{drawing:!1,start:function({x:c,y:u,size:d,color:f=new ft("black"),opacity:p,set_initial_texture:_=!0}){_&&(a=Lt.create({width:e.draw_texture.width,height:e.draw_texture.height}),r.render(e.composite,{renderTexture:a})),n={x:c,y:u,size:d,color:f,opacity:p},s.push({x:c,y:u}),o=r_(h++),za(o,c,u,f,d),r.render(o,{renderTexture:i==="draw"?e.draw_texture:e.erase_texture,clear:!1}),this.drawing=!0},continue:function({x:c,y:u}){const d=s[s.length-1],f=RT(d,{x:c,y:u});for(let p=0;p<f.length;p++){const{x:_,y:m}=f[p];za(o,_,m,n.color,n.size),s.push({x:_,y:m})}r.render(o,{renderTexture:i==="draw"?e.draw_texture:e.erase_texture,clear:!1}),o.clear()},stop:function(){const c=Lt.create({width:e.draw_texture.width,height:e.draw_texture.height});r.render(e.composite,{renderTexture:c}),r.render(new Ht(c),{renderTexture:e.draw_texture});const u=new ri().beginFill(0,0).drawRect(0,0,e.erase_texture.width,e.erase_texture.height).endFill();r.render(u,{renderTexture:e.erase_texture,clear:!0}),l=!0,this.drawing=!1},execute:function(){if(!l){for(let c=1;c<s.length;c++){const{x:u,y:d}=s[c];za(o,u,d,n.color,n.size)}r.render(o,{renderTexture:i==="draw"?e.draw_texture:e.erase_texture,clear:!1}),this.stop()}},undo:function(){const c=new ri().beginFill(0,0).drawRect(0,0,e.erase_texture.width,e.erase_texture.height).endFill();r.render(new Ht(a),{renderTexture:e.draw_texture}),r.render(c,{renderTexture:e.erase_texture,clear:!0}),this.stop(),l=!1}}}function Uh(r,t){const e=i=>{r&&!r.contains(i.target)&&!i.defaultPrevented&&t(i)};return document.addEventListener("mousedown",e,!0),{destroy(){document.removeEventListener("mousedown",e,!0)}}}const{SvelteComponent:MT,append:Yu,attr:an,binding_callbacks:qu,detach:Xa,element:ln,flush:kT,init:BT,insert:Va,listen:hn,noop:Zu,run_all:DT,safe_not_equal:FT,set_style:Ae,space:OT}=window.__gradio__svelte__internal,{tick:NT}=window.__gradio__svelte__internal;function LT(r){let t,e,i=`translate(${r[1][0]}px,${r[1][1]}px)`,s,n,o,a=`translateX(${r[3]}px)`,l,h;return{c(){t=ln("div"),e=ln("div"),s=OT(),n=ln("div"),o=ln("div"),an(e,"class","marker svelte-90y9cx"),Ae(e,"transform",i),Ae(e,"background",r[0]),an(t,"class","color-gradient svelte-90y9cx"),Ae(t,"--hue",r[2]),an(o,"class","marker svelte-90y9cx"),Ae(o,"background","hsl("+r[2]+", 100%, 50%)"),Ae(o,"transform",a),an(n,"class","hue-slider svelte-90y9cx")},m(c,u){Va(c,t,u),Yu(t,e),r[10](t),Va(c,s,u),Va(c,n,u),Yu(n,o),r[11](n),l||(h=[hn(window,"mousemove",r[8]),hn(window,"mouseup",r[9]),hn(t,"mousedown",r[7]),hn(n,"mousedown",r[6])],l=!0)},p(c,[u]){u&2&&i!==(i=`translate(${c[1][0]}px,${c[1][1]}px)`)&&Ae(e,"transform",i),u&1&&Ae(e,"background",c[0]),u&4&&Ae(t,"--hue",c[2]),u&4&&Ae(o,"background","hsl("+c[2]+", 100%, 50%)"),u&8&&a!==(a=`translateX(${c[3]}px)`)&&Ae(o,"transform",a)},i:Zu,o:Zu,d(c){c&&(Xa(t),Xa(s),Xa(n)),r[10](null),r[11](null),l=!1,DT(h)}}}function Ku(r){const t=r.s,e=r.v;let i=t*e;const s=r.h/60;let n=i*(1-Math.abs(s%2-1));const o=e-i;i=i+o,n=n+o;const a=Math.floor(s)%6,l=[i,n,o,o,n,i][a],h=[n,i,i,n,o,o][a],c=[o,o,n,i,i,n][a];return`rgba(${l*255}, ${h*255}, ${c*255}, ${r.a})`}function UT(r,t,e){let{color:i="rgb(255, 255, 255)"}=t,s=[0,0],n=null,o=!1,a=[0,0],l=0,h=0,c=null,u=!1;function d(T){c=T.currentTarget.getBoundingClientRect(),u=!0,f(T.clientX)}function f(T){if(!c)return;const A=Xt(T-c.left,0,c.width);e(3,h=A);const I=A/c.width*360;e(2,l=I),e(0,i=Ku({h:I,s:a[0],v:a[1],a:1}))}function p(T,A){if(!n)return;const I=Xt(T-n.left,0,n.width),R=Xt(A-n.top,0,n.height);e(1,s=[I,R]);const P={h:l*1,s:I/n.width,v:1-R/n.height,a:1};a=[P.s,P.v],e(0,i=Ku(P))}function _(T){o=!0,n=T.currentTarget.getBoundingClientRect(),p(T.clientX,T.clientY)}function m(T){o&&p(T.clientX,T.clientY),u&&f(T.clientX)}function g(){o&&(o=!1),u&&(u=!1)}async function v(T){if(o||u||(await NT(),!T))return;n||(n=y.getBoundingClientRect()),c||(c=b.getBoundingClientRect());const A=j(T).toHsv(),I=A.s*n.width,R=(1-A.v)*n.height;e(1,s=[I,R]),a=[A.s,A.v],e(2,l=A.h),e(3,h=A.h/360*c.width)}let y,b;function E(T){qu[T?"unshift":"push"](()=>{y=T,e(4,y)})}function x(T){qu[T?"unshift":"push"](()=>{b=T,e(5,b)})}return r.$$set=T=>{"color"in T&&e(0,i=T.color)},r.$$.update=()=>{r.$$.dirty&1&&v(i)},[i,s,l,h,y,b,d,_,m,g,E,x]}class GT extends MT{constructor(t){super(),BT(this,t,UT,LT,FT,{color:0})}get color(){return this.$$.ctx[0]}set color(t){this.$$set({color:t}),kT()}}const{SvelteComponent:HT,append:Yr,attr:xr,create_component:$T,destroy_component:zT,destroy_each:i_,detach:zi,element:tr,ensure_array_like:uo,flush:fi,init:XT,insert:Xi,listen:Gh,mount_component:VT,safe_not_equal:WT,set_style:fo,space:Sn,toggle_class:ce,transition_in:jT,transition_out:YT}=window.__gradio__svelte__internal,{createEventDispatcher:qT}=window.__gradio__svelte__internal;function Ju(r,t,e){const i=r.slice();return i[14]=t[e],i[16]=e,i}function Qu(r,t,e){const i=r.slice();return i[14]=t[e],i[16]=e,i}function td(r){let t;return{c(){t=tr("span"),xr(t,"class","svelte-287ern"),ce(t,"lg",r[1])},m(e,i){Xi(e,t,i)},p(e,i){i&2&&ce(t,"lg",e[1])},d(e){e&&zi(t)}}}function ed(r){let t,e,i,s,n,o=uo(r[1]),a=[];for(let l=0;l<o.length;l+=1)a[l]=rd(Qu(r,o,l));return{c(){t=tr("div");for(let l=0;l<a.length;l+=1)a[l].c();e=Sn(),i=tr("button"),xr(i,"class","color colorpicker svelte-287ern"),ce(i,"hidden",!r[0]),xr(t,"class","swatch svelte-287ern")},m(l,h){Xi(l,t,h);for(let c=0;c<a.length;c+=1)a[c]&&a[c].m(t,null);
1176Yr(t,e),Yr(t,i),s||(n=Gh(i,"click",r[5]),s=!0)},p(l,h){if(h&22){o=uo(l[1]);let c;for(c=0;c<o.length;c+=1){const u=Qu(l,o,c);a[c]?a[c].p(u,h):(a[c]=rd(u),a[c].c(),a[c].m(t,e))}for(;c<a.length;c+=1)a[c].d(1);a.length=o.length}h&1&&ce(i,"hidden",!l[0])},d(l){l&&zi(t),i_(a,l),s=!1,n()}}}function rd(r){let t,e,i;function s(){return r[10](r[16],r[14])}return{c(){t=tr("button"),xr(t,"class","color svelte-287ern"),fo(t,"background-color",r[14]),ce(t,"empty",r[14]===null),ce(t,"selected",`edit-${r[16]}`===r[2])},m(n,o){Xi(n,t,o),e||(i=Gh(t,"click",s),e=!0)},p(n,o){r=n,o&2&&fo(t,"background-color",r[14]),o&2&&ce(t,"empty",r[14]===null),o&4&&ce(t,"selected",`edit-${r[16]}`===r[2])},d(n){n&&zi(t),e=!1,i()}}}function id(r){let t,e,i;function s(){return r[11](r[16],r[14])}return{c(){t=tr("button"),xr(t,"class","color svelte-287ern"),fo(t,"background-color",r[14]),ce(t,"empty",r[14]===null),ce(t,"selected",`select-${r[16]}`===r[2])},m(n,o){Xi(n,t,o),e||(i=Gh(t,"click",s),e=!0)},p(n,o){r=n,o&8&&fo(t,"background-color",r[14]),o&8&&ce(t,"empty",r[14]===null),o&4&&ce(t,"selected",`select-${r[16]}`===r[2])},d(n){n&&zi(t),e=!1,i()}}}function ZT(r){let t,e,i,s,n,o,a,l,h,c=!r[0]&&td(r);s=new Gm({});let u=r[1]&&ed(r),d=uo(r[3]),f=[];for(let p=0;p<d.length;p+=1)f[p]=id(Ju(r,d,p));return{c(){c&&c.c(),t=Sn(),e=tr("div"),i=tr("span"),$T(s.$$.fragment),n=Sn(),o=tr("div"),u&&u.c(),a=Sn(),l=tr("menu");for(let p=0;p<f.length;p+=1)f[p].c();xr(i,"class","icon-wrap svelte-287ern"),xr(l,"class","swatch svelte-287ern"),xr(e,"class","swatch-wrap svelte-287ern")},m(p,_){c&&c.m(p,_),Xi(p,t,_),Xi(p,e,_),Yr(e,i),VT(s,i,null),Yr(e,n),Yr(e,o),u&&u.m(o,null),Yr(o,a),Yr(o,l);for(let m=0;m<f.length;m+=1)f[m]&&f[m].m(l,null);h=!0},p(p,[_]){if(p[0]?c&&(c.d(1),c=null):c?c.p(p,_):(c=td(p),c.c(),c.m(t.parentNode,t)),p[1]?u?u.p(p,_):(u=ed(p),u.c(),u.m(o,a)):u&&(u.d(1),u=null),_&28){d=uo(p[3]);let m;for(m=0;m<d.length;m+=1){const g=Ju(p,d,m);f[m]?f[m].p(g,_):(f[m]=id(g),f[m].c(),f[m].m(l,null))}for(;m<f.length;m+=1)f[m].d(1);f.length=d.length}},i(p){h||(jT(s.$$.fragment,p),h=!0)},o(p){YT(s.$$.fragment,p),h=!1}
1176,d(p){p&&(zi(t),zi(e)),c&&c.d(p),zT(s),u&&u.d(),i_(f,p)}}}function KT(r,t,e){let i,{selected_color:s}=t,{colors:n}=t,{user_colors:o=[]}=t,{show_empty:a=!1}=t,{current_mode:l="hex"}=t,{color_picker:h=!1}=t;const c=qT();function u(g,v){return v==="hex"?j(g).toHexString():v==="rgb"?j(g).toRgbString():j(g).toHslString()}let d=`select-${n.findIndex(g=>u(g,l)===u(s,l))}`;function f(g,v){e(2,d=`${g}-${v.index}`),c(g,v)}function p(){c("select",{index:null,color:s}),e(0,h=!h)}const _=(g,v)=>f("edit",{index:g,color:v}),m=(g,v)=>f("select",{index:g,color:v});return r.$$set=g=>{"selected_color"in g&&e(6,s=g.selected_color),"colors"in g&&e(7,n=g.colors),"user_colors"in g&&e(1,o=g.user_colors),"show_empty"in g&&e(8,a=g.show_empty),"current_mode"in g&&e(9,l=g.current_mode),"color_picker"in g&&e(0,h=g.color_picker)},r.$$.update=()=>{r.$$.dirty&384&&e(3,i=a?n:n.filter(g=>g))},[h,o,d,i,f,p,s,n,a,l,_,m]}class JT extends HT{constructor(t){super(),XT(this,t,KT,ZT,WT,{selected_color:6,colors:7,user_colors:1,show_empty:8,current_mode:9,color_picker:0})}get selected_color(){return this.$$.ctx[6]}set selected_color(t){this.$$set({selected_color:t}),fi()}get colors(){return this.$$.ctx[7]}set colors(t){this.$$set({colors:t}),fi()}get user_colors(){return this.$$.ctx[1]}set user_colors(t){this.$$set({user_colors:t}),fi()}get show_empty(){return this.$$.ctx[8]}set show_empty(t){this.$$set({show_empty:t}),fi()}get current_mode(){return this.$$.ctx[9]}set current_mode(t){this.$$set({current_mode:t}),fi()}get color_picker(){return this.$$.ctx[0]}set color_picker(t){this.$$set({color_picker:t}),fi()}}const{SvelteComponent:QT,append:Xe,attr:cr,create_component:tE,destroy_component:eE,destroy_each:rE,detach:s_,element:ur,ensure_array_like:sd,flush:nd,init:iE,insert:n_,listen:Cn,mount_component:sE,run_all:nE,safe_not_equal:oE,set_style:od,space:Wa,toggle_class:ad,transition_in:o_,transition_out:a_}=window.__gradio__svelte__internal,{createEventDispatcher:aE}=window.__gradio__svelte__internal;function ld(r,t,e){const i=r.slice();return i[11]=t[e][0],i[12]=t[e][1],i}function lE(r){let t,e;return t=new Sm({}),{c(){tE(t.$$.fragment)},m(i,s){sE(t,i,s),e=!0},i(i){e||(o_(t.$$.fragment,i),e=!0)},o(i){a_(t.$$.fragment,i),e=!1},d(i){eE(t,i)}}}function hd(r){let t,e,i;function s(){return r[8](r[12])}return{c(){t=ur("button"),t.textContent=`${r[11]}`,cr(t,"class","button svelte-w84deg"),ad(t,"active",r[1]===r[12])},m(n,o){n_(n,t,o),e||(i=Cn(t,"click",s),e=!0)},p(n,o){r=n,o&10&&ad(t,"active",r[1]===r[12])},d(n){n&&s_(t),e=!1,i()}}}function hE(r){let t,e,i,s,n,o,a,l,h,c,u,d,f,p=r[5]&&lE(),_=sd(r[3]),m=[];for(let g=0;g<_.length;g+=1)m[g]=hd(ld(r,_,g));return{c(){t=ur("div"),e=ur("button"),i=Wa(),s=ur("div"),n=ur("div"),o=ur("input"),a=Wa(),l=ur("button"),p&&p.c(),h=Wa(),c=ur("div");for(let g=0;g<m.length;g+=1)m[g].c();cr(e,"class","swatch svelte-w84deg"),od(e,"background",r[0]),cr(o,"type","text"),o.value=r[2],cr(o,"class","svelte-w84deg"),cr(l,"class","eyedropper svelte-w84deg"),cr(n,"class","input-wrap svelte-w84deg"),cr(c,"class","buttons svelte-w84deg"),cr(t,"class","input svelte-w84deg")},m(g,v){n_(g,t,v),Xe(t,e),Xe(t,i),Xe(t,s),Xe(s,n),Xe(n,o),Xe(n,a),Xe(n,l),p&&p.m(l,null),Xe(s,h),Xe(s,c);for(let y=0;y<m.length;y+=1)m[y]&&m[y].m(c,null);u=!0,d||(f=[Cn(e,"click",r[6]),Cn(o,"change",r[7]),Cn(l,"click",r[4])],d=!0)},p(g,[v]){if(v&1&&od(e,"background",g[0]),(!u||v&4&&o.value!==g[2])&&(o.value=g[2]),v&10){_=sd(g[3]);let y;for(y=0;y<_.length;y+=1){const b=ld(g,_,y);m[y]?m[y].p(b,v):(m[y]=hd(b),m[y].c(),m[y].m(c,null))}for(;y<m.length;y+=1)m[y].d(1);m.length=_.length}},i(g){u||(o_(p),u=!0)},o(g){a_(p),u=!1},d(g){g&&s_(t),p&&p.d(),rE(m,g),d=!1,nE(f)}}}function cE(r,t,e){let i,{color:s}=t,{current_mode:n="hex"}=t;const o=aE(),a=[["Hex","hex"],["RGB","rgb"],["HSL","hsl"]];function l(p,_){return _==="hex"?j(p).toHexString():_==="rgb"?j(p).toRgbString():j(p).toHslString()}function h(){new EyeDropper().open().then(_=>{e(0,s=_.sRGBHex)})}const c=!!window.EyeDropper;function u(){o("selected",i),o("close")}const d=p=>e(0,s=p.currentTarget.value),f=p=>e(1,n=p);return r.$$set=p=>{"color"in p&&e(0,s=p.color),"current_mode"in p&&e(1,n=p.current_mode)},r.$$.update=()=>{r.$$.dirty&3&&e(2,i=l(s,n)),r.$$.dirty&4&&i&&o("selected",i)},[s,n,i,a,h,c,u,d,f]}class uE extends QT{constructor(t){super(),iE(this,t,cE,hE,oE,{color:0,current_mode:1})}get color(){return this.$$.ctx[0]}set color(t){this.$$set({color:t}),nd()}get current_mode(){return this.$$.ctx[1]}set current_mode(t){this.$$set({current_mode:t}),nd()}}const{SvelteComponent:dE,action_destroyer:fE,add_iframe_resize_listener:pE,add_render_callback:cd,append:ja,attr:Ve,binding_callbacks:_E,create_component:mE,destroy_component:gE,detach:yE,element:Ya,flush:qa,init:vE,insert:bE,listen:Za,mount_component:xE,run_all:wE,safe_not_equal:TE,set_input_value:ud,space:EE,to_number:AE,toggle_class:pi,transition_in:SE,transition_out:CE}=window.__gradio__svelte__internal,{createEventDispatcher:IE}
1176=window.__gradio__svelte__internal;function RE(r){let t,e,i,s,n,o,a,l,h;return cd(r[11]),i=new im({}),{c(){t=Ya("div"),e=Ya("span"),mE(i.$$.fragment),s=EE(),n=Ya("input"),Ve(e,"class","svelte-12m4nbd"),Ve(n,"type","range"),Ve(n,"min",r[1]),Ve(n,"max",r[2]),Ve(n,"step",1),Ve(n,"class","svelte-12m4nbd"),Ve(t,"class","wrap svelte-12m4nbd"),cd(()=>r[15].call(t)),pi(t,"right",r[8]),pi(t,"top",r[9]),pi(t,"bottom",!r[9])},m(c,u){bE(c,t,u),ja(t,e),xE(i,e,null),ja(t,s),ja(t,n),ud(n,r[0]),r[14](t),o=pE(t,r[15].bind(t)),a=!0,l||(h=[Za(window,"resize",r[11]),Za(n,"change",r[12]),Za(n,"input",r[12]),fE(Uh.call(null,t,r[13]))],l=!0)},p(c,[u]){(!a||u&2)&&Ve(n,"min",c[1]),(!a||u&4)&&Ve(n,"max",c[2]),u&1&&ud(n,c[0]),(!a||u&256)&&pi(t,"right",c[8]),(!a||u&512)&&pi(t,"top",c[9]),(!a||u&512)&&pi(t,"bottom",!c[9])},i(c){a||(SE(i.$$.fragment,c),a=!0)},o(c){CE(i.$$.fragment,c),a=!1},d(c){c&&yE(t),gE(i),r[14](null),o(),l=!1,wE(h)}}}function PE(r,t,e){let{selected_size:i}=t,{min:s}=t,{max:n}=t;const o=IE();let a=0,l=0,h=0,c=0,u,d=!1,f=!1;function p(){e(4,l=window.innerHeight),e(3,a=window.innerWidth)}function _(){i=AE(this.value),e(0,i)}const m=()=>o("click_outside");function g(y){_E[y?"unshift":"push"](()=>{u=y,e(7,u)})}function v(){h=this.clientWidth,c=this.clientHeight,e(5,h),e(6,c)}return r.$$set=y=>{"selected_size"in y&&e(0,i=y.selected_size),"min"in y&&e(1,s=y.min),"max"in y&&e(2,n=y.max)},r.$$.update=()=>{if(r.$$.dirty&248&&u&&(a||l||c||h)){const y=u.getBoundingClientRect();e(8,d=y.width+30>a/2),e(9,f=y.y<80)}},[i,s,n,a,l,h,c,u,d,f,o,p,_,m,g,v]}class ME extends dE{constructor(t){super(),vE(this,t,PE,RE,TE,{selected_size:0,min:1,max:2})}get selected_size(){return this.$$.ctx[0]}set selected_size(t){this.$$set({selected_size:t}),qa()}get min(){return this.$$.ctx[1]}set min(t){this.$$set({min:t}),qa()}get max(){return this.$$.ctx[2]}set max(t){this.$$set({max:t}),qa()}}const{SvelteComponent:kE,action_destroyer:BE,add_flush_callback:po,add_iframe_resize_listener:DE,add_render_callback:dd,append:Ka,attr:l_,bind:_o,binding_callbacks:Is,check_outros:ch,create_component:mo,destroy_component:go,detach:Bo,element:h_,empty:FE,flush:pe,group_outros:uh,init:OE,insert:Do,listen:NE,mount_component:yo,run_all:LE,safe_not_equal:UE,space:In,toggle_class:Se,transition_in:Kt,transition_out:De}=window.__gradio__svelte__internal,{createEventDispatcher:GE}=window.__gradio__svelte__internal;function fd(r){let t,e,i=r[7]&&pd(r);return{c(){i&&i.c(),t=FE()},m(s,n){i&&i.m(s,n),Do(s,t,n),e=!0},p(s,n){s[7]?i?(i.p(s,n),n[0]&128&&Kt(i,1)):(i=pd(s),i.c(),Kt(i,1),i.m(t.parentNode,t)):i&&(uh(),De(i,1,1,()=>{i=null}),ch())},i(s){e||(Kt(i),e=!0)},o(s){De(i),e=!1},d(s){s&&Bo(t),i&&i.d(s)}}}function pd(r){let t,e,i,s,n,o;function a(u){r[23](u)}let l={};r[0]!==void 0&&(l.color=r[0]),t=new GT({props:l}),Is.push(()=>_o(t,"color",a));function h(u){r[24](u)}let c={color:r[0]};return r[13]!==void 0&&(c.current_mode=r[13]),s=new uE({props:c}),Is.push(()=>_o(s,"current_mode",h)),s.$on("close",r[25]),s.$on("selected",r[26]),{c(){mo(t.$$.fragment),i=In(),mo(s.$$.fragment)},m(u,d){yo(t,u,d),Do(u,i,d),yo(s,u,d),o=!0},p(u,d){const f={};!e&&d[0]&1&&(e=!0,f.color=u[0],po(()=>e=!1)),t.$set(f);const p={};d[0]&1&&(p.color=u[0]),!n&&d[0]&8192&&(n=!0,p.current_mode=u[13],po(()=>n=!1)),s.$set(p)},i(u){o||(Kt(t.$$.fragment,u),Kt(s.$$.fragment,u),o=!0)},o(u){De(t.$$.fragment,u),De(s.$$.fragment,u),o=!1},d(u){u&&Bo(i),go(t,u),go(s,u)}}}function _d(r){let t,e,i;function s(o){r[27](o)}let n={colors:r[3],user_colors:r[4]==="defaults"?r[1]:null,selected_color:r[0],current_mode:r[13]};return r[7]!==void 0&&(n.color_picker=r[7]),t=new JT({props:n}),Is.push(()=>_o(t,"color_picker",s)),t.$on("select",r[28]),t.$on("edit",r[29]),{c(){mo(t.$$.fragment)},m(o,a){yo(t,o,a),i=!0},p(o,a){const l={};a[0]&8&&(l.colors=o[3]),a[0]&18&&(l.user_colors=o[4]==="defaults"?o[1]:null),a[0]&1&&(l.selected_color=o[0]),a[0]&8192&&(l.current_mode=o[13]),!e&&a[0]&128&&(e=!0,l.color_picker=o[7],po(()=>e=!1)),t.$set(l)},i(o){i||(Kt(t.$$.fragment,o),i=!0)},o(o){De(t.$$.fragment,o),i=!1},d(o){go(t,o)}}}function md(r){let t;return{c(){t=h_("div"),l_(t,"class","sep svelte-gtuiq3")},m(e,i){Do(e,t,i)},d(e){e&&Bo(t)}}}function HE(r){let t,e,i,s,n,o,a,l,h,c;dd(r[22]);let u=r[4]==="defaults"&&fd(r),d=r[6]&&_d(r),f=(r[7]||r[6])&&md();function p(m){r[30](m)}let _={max:r[5][0]/10,min:1};return r[2]!==void 0&&(_.selected_size=r[2]),n=new ME({props:_}),Is.push(()=>_o(n,"selected_size",p)),{c(){t=h_("div"),u&&u.c(),e=In(),d&&d.c(),i=In(),f&&f.c(),s=In(),mo(n.$$.fragment),l_(t,"class","wrap svelte-gtuiq3"),dd(()=>
1176r[33].call(t)),Se(t,"padded",!r[7]),Se(t,"anchor_default",r[14]==="default"),Se(t,"anchor_center",r[14]==="center"),Se(t,"anchor_top",r[14]==="top"),Se(t,"anchor",`${r[15]}px`)},m(m,g){Do(m,t,g),u&&u.m(t,null),Ka(t,e),d&&d.m(t,null),Ka(t,i),f&&f.m(t,null),Ka(t,s),yo(n,t,null),r[32](t),a=DE(t,r[33].bind(t)),l=!0,h||(c=[NE(window,"resize",r[22]),BE(Uh.call(null,t,r[31]))],h=!0)},p(m,g){m[4]==="defaults"?u?(u.p(m,g),g[0]&16&&Kt(u,1)):(u=fd(m),u.c(),Kt(u,1),u.m(t,e)):u&&(uh(),De(u,1,1,()=>{u=null}),ch()),m[6]?d?(d.p(m,g),g[0]&64&&Kt(d,1)):(d=_d(m),d.c(),Kt(d,1),d.m(t,i)):d&&(uh(),De(d,1,1,()=>{d=null}),ch()),m[7]||m[6]?f||(f=md(),f.c(),f.m(t,s)):f&&(f.d(1),f=null);const v={};g[0]&32&&(v.max=m[5][0]/10),!o&&g[0]&4&&(o=!0,v.selected_size=m[2],po(()=>o=!1)),n.$set(v),(!l||g[0]&128)&&Se(t,"padded",!m[7]),(!l||g[0]&16384)&&Se(t,"anchor_default",m[14]==="default"),(!l||g[0]&16384)&&Se(t,"anchor_center",m[14]==="center"),(!l||g[0]&16384)&&Se(t,"anchor_top",m[14]==="top"),(!l||g[0]&32768)&&Se(t,"anchor",`${m[15]}px`)},i(m){l||(Kt(u),Kt(d),Kt(n.$$.fragment,m),l=!0)},o(m){De(u),De(d),De(n.$$.fragment,m),l=!1},d(m){m&&Bo(t),u&&u.d(),d&&d.d(),f&&f.d(),go(n),r[32](null),a(),h=!1,LE(c)}}}function $E(r,t,e){let{colors:i}=t,{selected_color:s}=t,{color_mode:n=void 0}=t,{recent_colors:o=[]}=t,{selected_size:a}=t,{dimensions:l}=t,{parent_width:h}=t,{parent_height:c}=t,{parent_left:u}=t,{toolbar_box:d}=t,{show_swatch:f}=t,p=!1,_="hex",m=null;const g=GE();function v({index:B,color:tt},lt){lt==="user"&&!tt&&(m=B,e(7,p=!0)),tt&&(e(0,s=tt),lt==="core"&&e(7,p=!1))}function y(B){m!==null&&e(1,o[m]=B,o)}let b=0,E=0,x=0,T=0,A,I="default",R=0;function P(){e(9,E=window.innerHeight),e(8,b=window.innerWidth)}function M(B){s=B,e(0,s)}function S(B){_=B,e(13,_)}const C=()=>e(7,p=!1),H=({detail:B})=>e(0,s=B);function X(B){p=B,e(7,p)}const O=({detail:B})=>v(B,"core"),Q=({detail:B})=>v(B,"user");function k(B){a=B,e(2,a)}const w=()=>g("click_outside");function L(B){Is[B?"unshift":"push"](()=>{A=B,e(12,A)})}function V(){x=this.clientWidth,T=this.clientHeight,e(10,x),e(11,T)}return r.$$set=B=>{"colors"in B&&e(3,i=B.colors),"selected_color"in B&&e(0,s=B.selected_color),"color_mode"in B&&e(4,n=B.color_mode),"recent_colors"in B&&e(1,o=B.recent_colors),"selected_size"in B&&e(2,a=B.selected_size),"dimensions"in B&&e(5,l=B.dimensions),"parent_width"in B&&e(18,h=B.parent_width),"parent_height"in B&&e(19,c=B.parent_height),"parent_left"in B&&e(20,u=B.parent_left),"toolbar_box"in B&&e(21,d=B.toolbar_box),"show_swatch"in B&&e(6,f=B.show_swatch)},r.$$.update=()=>{if(r.$$.dirty[0]&1&&y(s),r.$$.dirty[0]&3940224&&A&&(b||E||T||x)){const B=A.getBoundingClientRect();B.width>h||(h>B.width+230*2+25?(e(14,I="default"),e(15,R=d.right-u+24)):e(14,I="center")),B.height+50>c&&e(14,I="top")}},[s,o,a,i,n,l,f,p,b,E,x,T,A,_,I,R,g,v,h,c,u,d,P,M,S,C,H,X,O,Q,k,w,L,V]}class zE extends kE{constructor(t){super(),OE(this,t,$E,HE,UE,{colors:3,selected_color:0,color_mode:4,recent_colors:1,selected_size:2,dimensions:5,parent_width:18,parent_height:19,parent_left:20,toolbar_box:21,show_swatch:6},null,[-1,-1])}get colors(){return this.$$.ctx[3]}set colors(t){this.$$set({colors:t}),pe()}get selected_color(){return this.$$.ctx[0]}set selected_color(t){this.$$set({selected_color:t}),pe()}get color_mode(){return this.$$.ctx[4]}set color_mode(t){this.$$set({color_mode:t}),pe()}get recent_colors(){return this.$$.ctx[1]}set recent_colors(t){this.$$set({recent_colors:t}),pe()}get selected_size(){return this.$$.ctx[2]}set selected_size(t){this.$$set({selected_size:t}),pe()}get dimensions(){return this.$$.ctx[5]}set dimensions(t){this.$$set({dimensions:t}),pe()}get parent_width(){return this.$$.ctx[18]}set parent_width(t){this.$$set({parent_width:t}),pe()}get parent_height(){return this.$$.ctx[19]}set parent_height(t){this.$$set({parent_height:t}),pe()}get parent_left(){return this.$$.ctx[20]}set parent_left(t){this.$$set({parent_left:t}),pe()}get toolbar_box(){return this.$$.ctx[21]}set toolbar_box(t){this.$$set({toolbar_box:t}),pe()}get show_swatch(){return this.$$.ctx[6]}set show_swatch(t){this.$$set({show_swatch:t}),pe()}}const{SvelteComponent:XE,add_flush_callback:Ja,attr:VE,bind:Qa,binding_callbacks:tl,check_outros:WE,component_subscribe:Or,create_component:jE,destroy_component:YE,detach:Rn,element:c_,empty:qE,flush:ss,group_outros:ZE,init:KE,insert:Pn,listen:JE,mount_component:QE,safe_not_equal:tA,set_style:ie,space:eA,transition_in:Mn,transition_out:dh}=window.__gradio__svelte__internal,{getContext:gd,onMount:rA,tick:lC}=window.__gradio__svelte__internal;function yd(r){let t,e,i,s,n,o;function a(u){r[25](u)}function l(u){r[26](u)}function h(u){r[27](u)}let c={show_swatch:r[1]==="draw",colors:r[12],color_mode:r[0],dimensions:r[5],parent_width:r[4].parent_width,parent_height:r[4].parent_height,parent_left:r[4].parent_left,toolbar_box:r[11]};return r[2]!==void 0&&(c.selected_color=r[2]),r[8]!==void 0&&(c.recent_colors=r[8]),r[3]!==void 0&&(c.selected_size=r[3]),e=new zE({props:c}),tl.push(()=>Qa(e,"selected_color",a)),tl.push(()=>Qa(e,"recent_colors",l)),tl.push(()=>Qa(e,"selected_size",h)),e.$on("click_outside",r[28]),{c(){t=c_("div"),jE(e.$$.fragment)},m(u,d){Pn(u,t,d),QE(e,t,null),o=!0},p(u,d){const f={};d[0]&2&&(f.show_swatch=u[1]==="draw"),d[0]&1&&(f.color_mode=u[0]),d[0]&32&&(f.dimensions=u[5]),d[0]&16&&(f.parent_width=u[4].parent_width),d[0]&16&&(f.parent_height=u[4].parent_height),d[0]&16&&(f.parent_left=u[4].parent_left),d[0]&2048&&(f.toolbar_box=u[11]),!i&&d[0]&4&&(i=!0,f.selected_color=u[2],Ja(()=>i=!1)),!s&&d[0]&256&&(s=!0,f.recent_colors=u[8],Ja(()=>s=!1)),!n&&d[0]&8&&(n=!0,f.selected_size=u[3],Ja(()=>n=!1)),e.$set(f)},i(u){o||(Mn(e.$$.fragment,u),o=!0)},o(u){dh(e.$$.fragment,u),o=!1},d(u){u&&Rn(t),YE(e)}}}function iA(r){let t,e=`translate(${r[9].x}px, ${r[9].y}px)`,i=`${r[4].child_top-r[4].parent_top-r[10]/2}px`,s=`${r[4].child_left-r[4].parent_left-r[10]/2}px`,n=`${r[10]}
1176px`,o=`${r[10]}px`,a,l,h,c,u,d=r[6]&&yd(r);return{c(){t=c_("span"),a=eA(),d&&d.c(),l=qE(),VE(t,"class","svelte-btgkrd"),ie(t,"transform",e),ie(t,"top",i),ie(t,"left",s),ie(t,"width",n),ie(t,"height",o),ie(t,"opacity",r[7]?1:0)},m(f,p){Pn(f,t,p),Pn(f,a,p),d&&d.m(f,p),Pn(f,l,p),h=!0,c||(u=JE(window,"keydown",r[24]),c=!0)},p(f,p){p[0]&512&&e!==(e=`translate(${f[9].x}px, ${f[9].y}px)`)&&ie(t,"transform",e),p[0]&1040&&i!==(i=`${f[4].child_top-f[4].parent_top-f[10]/2}px`)&&ie(t,"top",i),p[0]&1040&&s!==(s=`${f[4].child_left-f[4].parent_left-f[10]/2}px`)&&ie(t,"left",s),p[0]&1024&&n!==(n=`${f[10]}px`)&&ie(t,"width",n),p[0]&1024&&o!==(o=`${f[10]}px`)&&ie(t,"height",o),p[0]&128&&ie(t,"opacity",f[7]?1:0),f[6]?d?(d.p(f,p),p[0]&64&&Mn(d,1)):(d=yd(f),d.c(),Mn(d,1),d.m(l.parentNode,l)):d&&(ZE(),dh(d,1,1,()=>{d=null}),WE())},i(f){h||(Mn(d),h=!0)},o(f){dh(d),h=!1},d(f){f&&(Rn(t),Rn(a),Rn(l)),d&&d.d(f),c=!1,u()}}}function sA(r,t,e){let i,s,n,o,a,l,h,c,{default_size:u}=t,{default_color:d=void 0}=t,{colors:f=void 0}=t,{color_mode:p=void 0}=t,{mode:_}=t;const m=f?f.map(tt).filter((D,mt)=>mt<4):[];let g=d==="auto"?m[0]:d?tt(d):"black",v=!1;const{pixi:y,dimensions:b,current_layer:E,command_manager:x,register_context:T,editor_box:A,crop:I,toolbar_box:R}=gd(Zi);Or(r,y,D=>e(31,o=D)),Or(r,b,D=>e(5,n=D)),Or(r,E,D=>e(34,h=D)),Or(r,A,D=>e(4,s=D)),Or(r,I,D=>e(33,l=D)),Or(r,R,D=>e(11,c=D));const{active_tool:P,register_tool:M,current_color:S}=gd(xo);Or(r,P,D=>e(32,a=D));let C=!1,H;function X(D,mt){const wt=Xt(Math.min(D,mt),500,1e3);return Math.round(wt*2/100)}let O=u==="auto"?X(...n):u;function Q(D){a===_&&(C=!0,!(!o||!h)&&(H=PT(o.renderer,o.layer_container,h,_),H.start({x:D.screen.x,y:D.screen.y,color:g||void 0,size:O,opacity:1})))}function k(D){!o||!h||a===_&&(H.stop(),x.execute(H),C=!1)}function w(D){if(a!==_)return;C&&H.continue({x:D.screen.x,y:D.screen.y});const mt=l[0]*n[0],wt=l[1]*n[1];mt>D.screen.x||wt>D.screen.y||D.screen.x>mt+l[2]*n[0]||D.screen.y>wt+l[3]*n[1]?(e(7,L=!1),document.body.style.cursor="auto"):(e(7,L=!0),document.body.style.cursor="none"),L&&e(9,lt={x:D.clientX-s.child_left,y:D.clientY-s.child_top})}let L=!1;async function V(D){o?.layer_container[D]("pointerdown",Q),o?.layer_container[D]("pointerup",k),o?.layer_container[D]("pointermove",w),o?.layer_container[D]("pointerenter",mt=>{a===_&&(e(7,L=!0),document.body.style.cursor="none")}),o?.layer_container[D]("pointerleave",()=>(e(7,L=!1),document.body.style.cursor="auto"))}T(_,{init_fn:()=>{V("on")},reset_fn:()=>{V("off")}}),rA(()=>{const D=M(_,{cb:st});return()=>{D(),V("off")}});let B=[null,null,null];function tt(D){return j(D).toRgbString()}let lt={x:0,y:0};function F(){let D=null;return function(wt){const te=()=>{if(D&&clearTimeout(D),wt!==void 0){e(6,v=wt);return}e(6,v=!v)};D&&clearTimeout(D),D=setTimeout(te,100)}}const st=F(),dt=({key:D})=>D==="Escape"&&st(!1);function ct(D){g=D,e(2,g)}function nt(D){B=D,e(8,B)}function it(D){O=D,e(3,O)}const ut=()=>st();return r.$$set=D=>{"default_size"in D&&e(21,u=D.default_size),"default_color"in D&&e(22,d=D.default_color),"colors"in D&&e(23,f=D.colors),"color_mode"in D&&e(0,p=D.color_mode),"mode"in D&&e(1,_=D.mode)},r.$$.update=()=>{r.$$.dirty[0]&6&&_==="draw"&&S.set(g),r.$$.dirty[0]&56&&e(10,i=O/n[0]*s.child_width*2)},[p,_,g,O,s,n,v,L,B,lt,i,c,m,y,b,E,A,I,R,P,st,u,d,f,dt,ct,nt,it,ut]}class u_ extends XE{constructor(t){super(),KE(this,t,sA,iA,tA,{default_size:21,default_color:22,colors:23,color_mode:0,mode:1},null,[-1,-1])}get default_size(){return this.$$.ctx[21]}set default_size(t){this.$$set({default_size:t}),ss()}get default_color(){return this.$$.ctx[22]}set default_color(t){this.$$set({default_color:t}),ss()}get colors(){return this.$$.ctx[23]}set colors(t){this.$$set({colors:t}),ss()}get color_mode(){return this.$$.ctx[0]}set color_mode(t){this.$$set({color_mode:t}),ss()}get mode(){return this.$$.ctx[1]}set mode(t){this.$$set({mode:t}),ss()}}function vd(r,t,e,i=0){let s,n;const o=new ri;let a,l,h,c,u=af(i,{stiffness:.1,damping:.5}),d=i;u.subscribe(m=>{l&&(d=m,f(h,c,l,!0))});function f(m,g,v,y){o.clear(),y&&(o.beginFill(16777215,d),o.drawRect(0,0,m,g),o.endFill()),o.beginFill(16777215,1),o.drawRect(...v),o.endFill(),r.render(o,{renderTexture:s})}let p=!0,_=!1;return{start:(m,g,v,y=!0,b=!0)=>{p=!1,s=Lt.create({width:m,height:g}),f(m,g,v,y),n=new Ht(s),t.mask=n,h=m,c=g,b&&(a=JSON.parse(JSON.stringify(v)))},continue:(m,g=!0)=>{l=JSON.parse(JSON.stringify(m)),d===.2?f(h,c,l,g):u.set(.2)},undo(){this.start(h,c,a,!1),e.set([a[0]/h,a[1]/c,a[2]/h,a[3]/c]),p=!0},stop(){return _=!0,d},execute(){p?(this.start(h,c,l,!1),e.set([l[0]/h,l[1]/c,l[2]/h,l[3]/c]),p=!0):(_||u.set(0),e.set([l[0]/h,l[1]/c,l[2]/h,l[3]/c]),p=!0)}}}function d_(r,t,e,i,s,n){let o=r,a=t;(e.includes("t")||e.includes("b")||e=="c")&&(o=t*i),(e.includes("l")||e.includes("r")||e=="c")&&(a=r/i),a=a||o/i,o=o||a*i,o>s&&(o=s,a=o/i),a>n&&(a=n,o=a*i);let l=0,h=0;return e.includes("r")?l=r-o:e.includes("l")?l=0:l=(r-o)/2,e.includes("b")?h=t-a:e.includes("t")?h=0:h=(t-a)/2,{new_width:o,new_height:a,x_offset:l,
1176y_offset:h}}const{SvelteComponent:nA,append:oA,attr:cn,binding_callbacks:aA,detach:lA,element:bd,flush:Nr,init:hA,insert:cA,listen:el,noop:xd,run_all:uA,safe_not_equal:dA,set_style:wd}=window.__gradio__svelte__internal,{tick:fA,createEventDispatcher:pA}=window.__gradio__svelte__internal;function _A(r){let t,e,i,s,n,o;return{c(){t=bd("div"),e=bd("div"),cn(e,"class",i="handle "+r[0]+" "+r[1]+" svelte-1x33xzn"),cn(t,"class",s="hitbox "+r[1]+" svelte-1x33xzn"),wd(t,"transform",r[3])},m(a,l){cA(a,t,l),oA(t,e),r[12](e),n||(o=[el(window,"mousemove",r[5]),el(window,"mouseup",r[6]),el(t,"mousedown",r[4])],n=!0)},p(a,[l]){l&3&&i!==(i="handle "+a[0]+" "+a[1]+" svelte-1x33xzn")&&cn(e,"class",i),l&2&&s!==(s="hitbox "+a[1]+" svelte-1x33xzn")&&cn(t,"class",s),l&8&&wd(t,"transform",a[3])},i:xd,o:xd,d(a){a&&lA(t),r[12](null),n=!1,uA(o)}}}function mA(r,t,e){let i,{type:s="corner"}=t,{location:n}=t,{x1:o=0}=t,{y1:a=0}=t,{x2:l=0}=t,{y2:h=0}=t,c,u=0,d=0,f=!1;const p=pA();let{dragging:_=!1}=t,m;function g(x){c=m.getBoundingClientRect(),f=!0,e(11,_=!0),["tl","bl","l"].includes(n)&&(d=x.clientX-c.right),["tl","tr","t"].includes(n)&&(u=x.clientY-c.bottom),["tr","r","br"].includes(n)&&(d=x.clientX-c.left),["br","b","bl"].includes(n)&&(u=x.clientY-c.top)}function v(x){if(!f)return;const T=x.clientY-u,A=x.clientY-u,I=x.clientX-d,R=x.clientX-d;["tl","bl","l"].includes(n)&&e(7,o=I),["tl","tr","t"].includes(n)&&e(8,a=T),["tr","r","br"].includes(n)&&e(9,l=R),["br","b","bl"].includes(n)&&e(10,h=A)}async function y(x){await fA(),f=!1,e(11,_=!1)}function b(x,T,A,I,R){let P,M,S,C;return c&&(["tl","l","bl"].includes(x)&&(M=T),["tl","t","tr"].includes(x)&&(P=I),["tr","r","br"].includes(x)&&(S=A),["br","b","bl"].includes(x)&&(C=R)),p("change",{top:P,bottom:C,left:M,right:S}),""}function E(x){aA[x?"unshift":"push"](()=>{m=x,e(2,m)})}return r.$$set=x=>{"type"in x&&e(0,s=x.type),"location"in x&&e(1,n=x.location),"x1"in x&&e(7,o=x.x1),"y1"in x&&e(8,a=x.y1),"x2"in x&&e(9,l=x.x2),"y2"in x&&e(10,h=x.y2),"dragging"in x&&e(11,_=x.dragging)},r.$$.update=()=>{r.$$.dirty&1922&&e(3,i=b(n,o,l,a,h))},[s,n,m,i,g,v,y,o,a,l,h,_,E]}class gA extends nA{constructor(t){super(),hA(this,t,mA,_A,dA,{type:0,location:1,x1:7,y1:8,x2:9,y2:10,dragging:11})}get type(){return this.$$.ctx[0]}set type(t){this.$$set({type:t}),Nr()}get location(){return this.$$.ctx[1]}set location(t){this.$$set({location:t}),Nr()}get x1(){return this.$$.ctx[7]}set x1(t){this.$$set({x1:t}),Nr()}get y1(){return this.$$.ctx[8]}set y1(t){this.$$set({y1:t}),Nr()}get x2(){return this.$$.ctx[9]}set x2(t){this.$$set({x2:t}),Nr()}get y2(){return this.$$.ctx[10]}set y2(t){this.$$set({y2:t}),Nr()}get dragging(){return this.$$.ctx[11]}set dragging(t){this.$$set({dragging:t}),Nr()}}const{SvelteComponent:yA,add_flush_callback:vA,append:rl,attr:kn,bind:bA,binding_callbacks:xA,check_outros:wA,create_component:TA,destroy_component:EA,destroy_each:Td,detach:f_,element:Bn,ensure_array_like:il,flush:_i,group_outros:AA,init:SA,insert:p_,listen:sl,mount_component:CA,noop:__,run_all:IA,safe_not_equal:RA,set_style:ar,space:PA,subscribe:MA,toggle_class:Ed,transition_in:Dn,transition_out:fh}=window.__gradio__svelte__internal,{createEventDispatcher:kA}=window.__gradio__svelte__internal;function BA(r,t,e){const i=r.slice();return i[30]=t[e],i}function Ad(r,t,e){const i=r.slice();return i[33]=t[e],i}function Sd(r){let t,e,i;function s(a){r[20](a)}function n(...a){return r[21](r[33],...a)}let o={location:r[33]};return r[1]!==void 0&&(o.dragging=r[1]),t=new gA({props:o}),xA.push(()=>bA(t,"dragging",s)),t.$on("change",n),{c(){TA(t.$$.fragment)},m(a,l){CA(t,a,l),i=!0},p(a,l){r=a;const h={};!e&&l[0]&2&&(e=!0,h.dragging=r[1],vA(()=>e=!1)),t.$set(h)},i(a){i||(Dn(t.$$.fragment,a),i=!0)},o(a){fh(t.$$.fragment,a),i=!1},d(a){EA(t,a)}}}function DA(r){let t;return{c(){t=Bn("div"),kn(t,"class","svelte-12y7ld0")},m(e,i){p_(e,t,i)},p:__,d(e){e&&f_(t)}}}function FA(r){let t,e,i,s,n=`${r[3]}px`,o=`${r[2]}px`,a=`${r[4]}px`,l=`${r[5]}px`,h,c,u,d=il(r[7]),f=[];for(let g=0;g<d.length;g+=1)f[g]=Sd(Ad(r,d,g));const p=g=>fh(f[g],1,1,()=>{f[g]=null});let _=il({length:25}
1176),m=[];for(let g=0;g<_.length;g+=1)m[g]=DA(BA(r,_,g));return{c(){t=Bn("div"),e=Bn("div");for(let g=0;g<f.length;g+=1)f[g].c();i=PA(),s=Bn("div");for(let g=0;g<m.length;g+=1)m[g].c();kn(s,"class","grid svelte-12y7ld0"),Ed(s,"finished",r[6]),kn(e,"class","box svelte-12y7ld0"),ar(e,"width",n),ar(e,"height",o),ar(e,"top",a),ar(e,"left",l),kn(t,"class","wrap svelte-12y7ld0")},m(g,v){p_(g,t,v),rl(t,e);for(let y=0;y<f.length;y+=1)f[y]&&f[y].m(e,null);rl(e,i),rl(e,s);for(let y=0;y<m.length;y+=1)m[y]&&m[y].m(s,null);h=!0,c||(u=[sl(window,"mousemove",r[11]),sl(window,"mouseup",r[10]),sl(s,"mousedown",r[9])],c=!0)},p(g,v){if(v[0]&386){d=il(g[7]);let y;for(y=0;y<d.length;y+=1){const b=Ad(g,d,y);f[y]?(f[y].p(b,v),Dn(f[y],1)):(f[y]=Sd(b),f[y].c(),Dn(f[y],1),f[y].m(e,i))}for(AA(),y=d.length;y<f.length;y+=1)p(y);wA()}(!h||v[0]&64)&&Ed(s,"finished",g[6]),v[0]&8&&n!==(n=`${g[3]}px`)&&ar(e,"width",n),v[0]&4&&o!==(o=`${g[2]}px`)&&ar(e,"height",o),v[0]&16&&a!==(a=`${g[4]}px`)&&ar(e,"top",a),v[0]&32&&l!==(l=`${g[5]}px`)&&ar(e,"left",l)},i(g){if(!h){for(let v=0;v<d.length;v+=1)Dn(f[v]);h=!0}},o(g){f=f.filter(Boolean);for(let v=0;v<f.length;v+=1)fh(f[v]);h=!1},d(g){g&&f_(t),Td(f,g),Td(m,g),c=!1,IA(u)}}}function OA(r,t,e){let i,s=__,n=()=>(s(),s=MA(o,k=>e(19,i=k)),o);r.$$.on_destroy.push(()=>s());let{editor_box:o}=t;n();let{crop_constraint:a}=t;const l=kA();let h=i.child_height,c=i.child_width,u=i.child_top-i.parent_top,d=i.child_left-i.parent_left,f=i.child_right-i.parent_left,p=0,_=!1,{w_p:m}=t,{h_p:g}=t,{l_p:v}=t,{t_p:y}=t;const b=["tl","br","tr","bl","t","b","l","r"];let E,x,T=!1;function A(){x&&clearTimeout(x),e(17,x=setTimeout(()=>{T&&(l("crop_end",{x:v,y,width:m,height:g}),T=!1),e(6,E=!0),e(18,S=!1)},1e3))}function I({top:k,bottom:w,left:L,right:V},B){e(4,u=Xt(k?k-i.parent_top:u,i.child_top-i.parent_top,i.child_bottom-i.parent_top)),e(5,d=Xt(L?L-i.parent_left:d,i.child_left-i.parent_left,i.child_right-i.parent_left)),f=Xt(V?V-i.parent_left:f,i.child_left-i.parent_left,i.child_right-i.parent_left),p=Xt(w?w-i.parent_top:p,i.child_top-i.parent_top,i.child_bottom-i.parent_top),e(3,c=Xt(V?V-d-i.parent_left:c,0,f-d)),e(3,c=Xt(L?f-L+i.parent_left:c,0,f-d)),e(2,h=Xt(w?w-u-i.parent_top:h,0,p-u)),e(2,h=Xt(k?p-k+i.parent_top:h,0,p-u));const tt={tl:"br",tr:"bl",bl:"tr",br:"tl",t:"b",b:"t",l:"r",r:"l",c:"c"};if(a){const lt=["t","b"].includes(B)?i.child_width:f-d,F=["l","r"].includes(B)?i.child_height:p-u;let st=d_(c,h,tt[B],a,lt,F);e(3,c=st.new_width),e(2,h=st.new_height),e(5,d=d+st.x_offset),e(4,u=u+st.y_offset),f=d+c,p=u+h}e(12,m=c/i.child_width),e(13,g=h/i.child_height),e(14,v=(d-i.child_left+i.parent_left)/i.child_width),e(15,y=(u-i.child_top+i.parent_top)/i.child_height),l(T?"crop_continue":"crop_start",{x:v,y,width:m,height:g}),T=!0}function R(){e(3,c=m*i.child_width),e(2,h=g*i.child_height),e(5,d=v*i.child_width+(i.child_left-i.parent_left)),e(4,u=y*i.child_height+(i.child_top-i.parent_top)),f=d+c,p=u+h}let P=0,M=0,S=!1;function C(k){e(18,S=!0),P=k.clientX,M=k.clientY,E&&(e(6,E=!1),l("crop_start",{x:v,y,width:m,height:g}))}function H(k){S&&e(18,S=!1)}function X(k){if(!S)return;const w=k.clientX-P,L=k.clientY-M;e(5,d=Xt(d+w,i.child_left-i.parent_left,i.child_right-i.parent_left-c)),e(4,u=Xt(u+L,i.child_top-i.parent_top,i.child_bottom-i.parent_top-h)),f=d+c,p=u+h,e(14,v=(d-i.child_left+i.parent_left)/i.child_width),e(15,y=(u-i.child_top+i.parent_top)/i.child_height),P=k.clientX,M=k.clientY,l("crop_continue",{x:v,y,width:m,height:g}),T=!0}function O(k){_=k,e(1,_)}const Q=(k,{detail:w})=>I(w,k);return r.$$set=k=>{"editor_box"in k&&n(e(0,o=k.editor_box)),"crop_constraint"in k&&e(16,a=k.crop_constraint),"w_p"in k&&e(12,m=k.w_p),"h_p"in k&&e(13,g=k.h_p),"l_p"in k&&e(14,v=k.l_p),"t_p"in k&&e(15,y=k.t_p)},r.$$.update=()=>{r.$$.dirty[0]&393218&&(_||S?(clearTimeout(x),e(6,E=!1)):A()),r.$$.dirty[0]&524288&&i&&R()},[o,_,h,c,u,d,E,b,I,C,H,X,m,g,v,y,a,x,S,i,O,Q]}class NA extends yA{constructor(t){super(),SA(this,t,OA,FA,RA,{editor_box:0,crop_constraint:16,w_p:12,h_p:13,l_p:14,t_p:15},null,[-1,-1])}get editor_box(){return this.$$.ctx[0]}set editor_box(t){this.$$set({editor_box:t}),_i()}get crop_constraint(){return this.$$.ctx[16]}set crop_constraint(t){this.$$set({crop_constraint:t}),_i()}get w_p(){return this.$$.ctx[12]}set w_p(t){this.$$set({w_p:t}),_i()}get h_p(){return this.$$.ctx[13]}set h_p(t){this.$$set({h_p:t}),_i()}get l_p(){return this.$$.ctx[14]}set l_p(t){this.$$set({l_p:t}),_i()}get t_p(){return this.$$.ctx[15]}set t_p(t){this.$$set({t_p:t}),_i()}}const{SvelteComponent:LA,check_outros:UA,component_subscribe:mi,create_component:GA,destroy_component:HA,detach:$A,empty:zA,flush:XA,group_outros:VA,init:WA,insert:jA,mount_component:YA,safe_not_equal:qA,transition_in:Fn,transition_out:ph}=window.__gradio__svelte__internal,{getContext:Cd,onDestroy:hC,onMount:ZA,tick:cC}=window.__gradio__svelte__internal;function Id(r){let t,e;return t=new NA({props:{crop_constraint:r[0],w_p:r[1],h_p:r[2],l_p:r[3],t_p:r[4],editor_box:r[9]}}),t.$on("crop_start",r[20]),t.$on("crop_continue",r[21]),t.$on("crop_end",r[22]),{c(){GA(t.$$.fragment)},m(i,s){YA(t,i,s),e=!0},p(i,s){const n={};s[0]&1&&(n.crop_constraint=i[0]),s[0]&2&&(n.w_p=i[1]),s[0]&4&&(n.h_p=i[2]),s[0]&8&&(n.l_p=i[3]),s[0]&16&&(n.t_p=i[4]),t.$set(n)},i(i){e||(Fn(t.$$.fragment,i),e=!0)},o(i){ph(t.$$.fragment,i),e=!1},d(i){HA(t,i)}}}function KA(r){let t,e,i=r[5]==="crop"&&r[6]&&Id(r);return{c(){i&&i.c(),t=zA()},m(s,n){i&&i.m(s,n),jA(s,t,n),e=!0}
1176,p(s,n){s[5]==="crop"&&s[6]?i?(i.p(s,n),n[0]&96&&Fn(i,1)):(i=Id(s),i.c(),Fn(i,1),i.m(t.parentNode,t)):i&&(VA(),ph(i,1,1,()=>{i=null}),UA())},i(s){e||(Fn(i),e=!0)},o(s){ph(i),e=!1},d(s){s&&$A(t),i&&i.d(s)}}}function JA(r,t,e){let i,s,n,o,a,l;const{active_tool:h,register_tool:c}=Cd(xo);mi(r,h,k=>e(5,l=k));const{dimensions:u,editor_box:d,pixi:f,crop:p,command_manager:_,current_history:m}=Cd(Zi);mi(r,u,k=>e(18,n=k)),mi(r,d,k=>e(16,i=k)),mi(r,f,k=>e(19,o=k)),mi(r,p,k=>e(17,s=k)),mi(r,m,k=>e(27,a=k));let g,{crop_constraint:v}=t,y=null,b=1,E=1,x=0,T=0,A=0,I=!1,R=null;async function P(){if(R||a.previous)return;const{new_height:k,new_width:w,x_offset:L,y_offset:V}=d_(i.child_width,i.child_height,"c",y,i.child_width,i.child_height);e(1,b=w/i.child_width),e(2,E=k/i.child_height),e(3,x=L/i.child_width),e(4,T=V/i.child_height),R=vd(o.renderer,o.mask_container,p,.2),R.start(...n,H,!1),R.continue([x*n[0],T*n[1],b*n[0],E*n[1]],!1),R.stop(),R.execute(),R=null,A=0}function M(k,{x:w,y:L,width:V,height:B}){if(o){if(k==="start")g&&(A=g.stop(),g=null),g=vd(o?.renderer,o.mask_container,p,A),g.start(...n,H);else if(k==="continue"){if(!g)return;g.continue([w*n[0],L*n[1],V*n[0],B*n[1]])}else if(k==="stop"){if(!g)return;_.execute(g)}e(15,I=!0)}}let S=!1;function C(){if(S||!i.child_height)return;const k=i.child_height,w=i.child_width,L=i.child_top-i.parent_top,V=i.child_left-i.parent_left;e(1,b=w/i.child_width),e(2,E=k/i.child_height),e(3,x=(V-i.child_left+i.parent_left)/i.child_width),e(4,T=(L-i.child_top+i.parent_top)/i.child_height),e(6,S=!0)}let H;ZA(()=>c("crop"));const X=({detail:k})=>M("start",k),O=({detail:k})=>M("continue",k),Q=({detail:k})=>M("stop",k);return r.$$set=k=>{"crop_constraint"in k&&e(14,v=k.crop_constraint)},r.$$.update=()=>{if(r.$$.dirty[0]&16384)if(typeof v=="string"){const[k,w]=v.split(":");e(0,y=parseInt(k)/parseInt(w))}else Array.isArray(v)&&e(0,y=v[0]/v[1]);r.$$.dirty[0]&557089&&!I&&y&&o&&l&&requestAnimationFrame(()=>{P()}),r.$$.dirty[0]&131072&&(e(3,x=s[0]),e(4,T=s[1]),e(1,b=s[2]),e(2,E=s[3])),r.$$.dirty[0]&262174&&(H=[x*n[0],T*n[1],b*n[0],E*n[1]]),r.$$.dirty[0]&65536&&i&&C()},[y,b,E,x,T,l,S,h,u,d,f,p,m,M,v,I,i,s,n,o,X,O,Q]}class QA extends LA{constructor(t){super(),WA(this,t,JA,KA,qA,{crop_constraint:14},null,[-1,-1])}get crop_constraint(){return this.$$.ctx[14]}set crop_constraint(t){this.$$set({crop_constraint:t}),XA()}}function t2(r,t,e,i){let s;return{async start(){r.removeChildren();const n=await createImageBitmap(e),o=Y.from(n);return s=new Ht(o),[s.width,s.height]},async execute(){i(s.width,s.height),s.zIndex=0,r.addChild(s)},undo(){r.removeChildAt(0)}}}function e2(r,t,e,i,s,n){let o;return{start(){r.removeChildren();const a=r_(1),l=Lt.create({width:i,height:s});return a.beginFill(new ft(e)),a.drawRect(0,0,i,s),a.endFill(),t.render(a,{renderTexture:l}),o=new Ht(l),[o.width,o.height]},async execute(){n(o.width,o.height),o.zIndex=1,r.addChild(o)},undo(){r.removeChildren()}}}const{SvelteComponent:r2,append:On,attr:bs,binding_callbacks:i2,bubble:nl,check_outros:_h,component_subscribe:un,create_component:Hh,destroy_component:$h,detach:Oi,element:xs,empty:m_,ensure_array_like:Rd,flush:We,group_outros:mh,init:s2,insert:Ni,is_function:n2,listen:o2,mount_component:zh,outro_and_destroy_block:a2,safe_not_equal:l2,set_store_value:ns,set_style:gi,space:ol,transition_in:Fe,transition_out:yr,update_keyed_each:h2}=window.__gradio__svelte__internal,{getContext:Pd,onMount:uC,tick:c2,createEventDispatcher:u2}=window.__gradio__svelte__internal;function Md(r,t,e){const i=r.slice();return i[34]=t[e].icon,i[35]=t[e].label,i[36]=t[e].id,i[37]=t[e].cb,
1176i}function kd(r){let t,e=[],i=new Map,s,n,o,a,l,h,c,u=Rd(r[8]);const d=_=>_[36];for(let _=0;_<u.length;_+=1){let m=Md(r,u,_),g=d(m);i.set(g,e[_]=Bd(g,m))}let f={hidden:!0,filetype:"image/*",root:r[1],disable_click:!r[2].includes("upload"),format:"blob",upload:r[5],stream_handler:r[6]};l=new U_({props:f}),r[19](l),l.$on("load",r[14]),l.$on("error",r[20]);let p=r[0]==="webcam"&&Dd(r);return{c(){t=xs("div");for(let _=0;_<e.length;_+=1)e[_].c();s=ol(),n=xs("span"),o=ol(),a=xs("div"),Hh(l.$$.fragment),h=ol(),p&&p.c(),bs(n,"class","sep svelte-14kbe6e"),bs(t,"class","source-wrap svelte-14kbe6e"),bs(a,"class","upload-container")},m(_,m){Ni(_,t,m);for(let g=0;g<e.length;g+=1)e[g]&&e[g].m(t,null);On(t,s),On(t,n),Ni(_,o,m),Ni(_,a,m),zh(l,a,null),On(a,h),p&&p.m(a,null),c=!0},p(_,m){m[0]&256&&(u=Rd(_[8]),mh(),e=h2(e,m,d,1,_,u,i,t,a2,Bd,s,Md),_h());const g={};m[0]&2&&(g.root=_[1]),m[0]&4&&(g.disable_click=!_[2].includes("upload")),m[0]&32&&(g.upload=_[5]),m[0]&64&&(g.stream_handler=_[6]),l.$set(g),_[0]==="webcam"?p?(p.p(_,m),m[0]&1&&Fe(p,1)):(p=Dd(_),p.c(),Fe(p,1),p.m(a,null)):p&&(mh(),yr(p,1,1,()=>{p=null}),_h())},i(_){if(!c){for(let m=0;m<u.length;m+=1)Fe(e[m]);Fe(l.$$.fragment,_),Fe(p),c=!0}},o(_){for(let m=0;m<e.length;m+=1)yr(e[m]);yr(l.$$.fragment,_),yr(p),c=!1},d(_){_&&(Oi(t),Oi(o),Oi(a));for(let m=0;m<e.length;m+=1)e[m].d();r[19](null),$h(l),p&&p.d()}}}function Bd(r,t){let e,i,s;return i=new Ri({props:{Icon:t[34],size:"medium",padded:!1,label:t[35]+" button",hasPopup:!0,transparent:!0}}),i.$on("click",function(){n2(t[37])&&t[37].apply(this,arguments)}),{key:r,first:null,c(){e=m_(),Hh(i.$$.fragment),this.first=e},m(n,o){Ni(n,e,o),zh(i,n,o),s=!0},p(n,o){t=n;const a={};o[0]&256&&(a.Icon=t[34]),o[0]&256&&(a.label=t[35]+" button"),i.$set(a)},i(n){s||(Fe(i.$$.fragment,n),s=!0)},o(n){yr(i.$$.fragment,n),s=!1},d(n){n&&Oi(e),$h(i,n)}}}function Dd(r){let t,e,i,s=`${r[9].child_width}px`,n=`${r[9].child_height}px`,o=`${r[9].child_top-r[9].parent_top}px`,a;return i=new B_({props:{upload:r[5],root:r[1],mirror_webcam:r[3],streaming:!1,mode:"image",include_audio:!1,i18n:r[4]}}),i.$on("capture",r[14]),i.$on("error",r[21]),i.$on("drag",r[22]),{c(){t=xs("div"),e=xs("div"),Hh(i.$$.fragment),bs(e,"class","modal-inner svelte-14kbe6e"),bs(t,"class","modal svelte-14kbe6e"),gi(t,"max-width",s),gi(t,"max-height",n),gi(t,"top",o)},m(l,h){Ni(l,t,h),On(t,e),zh(i,e,null),a=!0},p(l,h){const c={};h[0]&32&&(c.upload=l[5]),h[0]&2&&(c.root=l[1]),h[0]&8&&(c.mirror_webcam=l[3]),h[0]&16&&(c.i18n=l[4]),i.$set(c),h[0]&512&&s!==(s=`${l[9].child_width}px`)&&gi(t,"max-width",s),h[0]&512&&n!==(n=`${l[9].child_height}px`)&&gi(t,"max-height",n),h[0]&512&&o!==(o=`${l[9].child_top-l[9].parent_top}px`)&&gi(t,"top",o)},i(l){a||(Fe(i.$$.fragment,l),a=!0)},o(l){yr(i.$$.fragment,l),a=!1},d(l){l&&Oi(t),$h(i)}}}function d2(r){let t,e,i,s,n=r[2].length&&kd(r);return{c(){n&&n.c(),t=m_()},m(o,a){n&&n.m(o,a),Ni(o,t,a),e=!0,i||(s=o2(window,"keydown",r[15]),i=!0)},p(o,a){o[2].length?n?(n.p(o,a),a[0]&4&&Fe(n,1)):(n=kd(o),n.c(),Fe(n,1),n.m(t.parentNode,t)):n&&(mh(),yr(n,1,1,()=>{n=null}),_h())},i(o){e||(Fe(n),e=!0)},o(o){yr(n),e=!1},d(o){o&&Oi(t),n&&n.d(o),i=!1,s()}}}function f2(r,t,e){let i,s,n,o,a,{background_file:l}=t,{root:h}=t,{sources:c=["upload","webcam","clipboard"]}=t,{mirror_webcam:u=!0}=t,{i18n:d}=t,{upload:f}=t,{stream_handler:p}=t;const{active_tool:_}=Pd(xo);un(r,_,w=>e(26,o=w));const{pixi:m,dimensions:g,register_context:v,reset:y,editor_box:b}=Pd(Zi);un(r,m,w=>e(25,n=w)),un(r,g,w=>e(24,s=w)),un(r,b,w=>e(9,a=w));let{active_mode:E=null}=t,x;u2();const T={upload:{icon:xh,label:"Upload",order:0,id:"bg_upload",cb(){A.open_file_upload(),ns(_,o="bg",o)}},webcam:{icon:H_,label:"Webcam",order:1,id:"bg_webcam",cb(){e(0,E="webcam"),ns(_,o="bg",o)}},clipboard:{icon:G_,label:"Paste",order:2,id:"bg_clipboard",cb(){I(),ns(_,o=null,o)}}};let A;async function I(){const w=await navigator.clipboard.read();for(let L=0;L<w.length;L++){const V=w[L].types.find(B=>B.startsWith("image/"));if(V){const B=await w[L].getType(V);e(18,x=B||null)}}}function R(w){const L=w.detail;e(18,x=L),e(0,E=null)}let P=!0;async function M(){if(n&&x){const w=t2(n.background_container,n.renderer,x,n.resize);
1176ns(g,s=await w.start(),s),P&&y(!1,s),w.execute(),P=!0,await c2(),e(16,H=!0)}}async function S(w){if(!w||!w.url)return;P=!1;const V=await(await fetch(w.url)).blob();e(18,x=V)}function C(w){w.key==="Escape"&&e(0,E=null)}let{bg:H=!1}=t;v("bg",{init_fn:()=>{if(!n)return;const w=e2(n.background_container,n.renderer,"black",...s,n.resize);ns(g,s=w.start(),s),w.execute()},reset_fn:()=>{}});function X(w){i2[w?"unshift":"push"](()=>{A=w,e(7,A)})}function O(w){nl.call(this,r,w)}function Q(w){nl.call(this,r,w)}function k(w){nl.call(this,r,w)}return r.$$set=w=>{"background_file"in w&&e(17,l=w.background_file),"root"in w&&e(1,h=w.root),"sources"in w&&e(2,c=w.sources),"mirror_webcam"in w&&e(3,u=w.mirror_webcam),"i18n"in w&&e(4,d=w.i18n),"upload"in w&&e(5,f=w.upload),"stream_handler"in w&&e(6,p=w.stream_handler),"active_mode"in w&&e(0,E=w.active_mode),"bg"in w&&e(16,H=w.bg)},r.$$.update=()=>{r.$$.dirty[0]&4&&e(8,i=c.map(w=>T[w]).sort((w,L)=>w.order-L.order)),r.$$.dirty[0]&262144&&x&&M(),r.$$.dirty[0]&131072&&S(l)},[E,h,c,u,d,f,p,A,i,a,_,m,g,b,R,C,H,l,x,X,O,Q,k]}class p2 extends r2{constructor(t){super(),s2(this,t,f2,d2,l2,{background_file:17,root:1,sources:2,mirror_webcam:3,i18n:4,upload:5,stream_handler:6,active_mode:0,bg:16},null,[-1,-1])}get background_file(){return this.$$.ctx[17]}set background_file(t){this.$$set({background_file:t}),We()}get root(){return this.$$.ctx[1]}set root(t){this.$$set({root:t}),We()}get sources(){return this.$$.ctx[2]}set sources(t){this.$$set({sources:t}),We()}get mirror_webcam(){return this.$$.ctx[3]}set mirror_webcam(t){this.$$set({mirror_webcam:t}),We()}get i18n(){return this.$$.ctx[4]}set i18n(t){this.$$set({i18n:t}),We()}get upload(){return this.$$.ctx[5]}set upload(t){this.$$set({upload:t}),We()}get stream_handler(){return this.$$.ctx[6]}set stream_handler(t){this.$$set({stream_handler:t}),We()}get active_mode(){return this.$$.ctx[0]}set active_mode(t){this.$$set({active_mode:t}),We()}get bg(){return this.$$.ctx[16]}set bg(t){this.$$set({bg:t}),We()}}const{SvelteComponent:_2,append:dn,attr:gh,check_outros:m2,create_component:Nn,destroy_component:Ln,detach:g_,element:yh,flush:fn,group_outros:g2,init:y2,insert:y_,mount_component:Un,safe_not_equal:v2,space:al,transition_in:Vr,transition_out:Si}=window.__gradio__svelte__internal,{createEventDispatcher:b2}=window.__gradio__svelte__internal;function Fd(r){let t,e,i;return e=new Ri({props:{disabled:!r[2],Icon:N_,label:"Save changes",background:"var(--color-green-500)",color:"#fff"}}),e.$on("click",r[8]),{c(){t=yh("div"),Nn(e.$$.fragment),gh(t,"class","row-wrap save svelte-4lttvb")},m(s,n){y_(s,t,n),Un(e,t,null),i=!0},p(s,n){const o={};n&4&&(o.disabled=!s[2]),e.$set(o)},i(s){i||(Vr(e.$$.fragment,s),i=!0)},o(s){Si(e.$$.fragment,s),i=!1},d(s){s&&g_(t),Ln(e)}}}function x2(r){let t,e,i,s,n,o,a,l,h;i=new Ri({props:{disabled:!r[0],Icon:L_,label:"Undo"}}),i.$on("click",r[5]),n=new Ri({props:{disabled:!r[1],Icon:Ym,label:"Redo"}}),n.$on("click",r[6]),a=new Ri({props:{Icon:rg,label:"Clear canvas"}}),a.$on("click",r[7]);let c=r[3]&&Fd(r);return{c(){t=yh("div"),e=yh("div"),Nn(i.$$.fragment),s=al(),Nn(n.$$.fragment),o=al(),Nn(a.$$.fragment),l=al(),c&&c.c(),gh(e,"class","row-wrap svelte-4lttvb"),gh(t,"class","controls-wrap svelte-4lttvb")},m(u,d){y_(u,t,d),dn(t,e),Un(i,e,null),dn(e,s),Un(n,e,null),dn(e,o),Un(a,e,null),dn(t,l),c&&c.m(t,null),h=!0},p(u,[d]){const f={};d&1&&(f.disabled=!u[0]),i.$set(f);const p={};d&2&&(p.disabled=!u[1]),n.$set(p),u[3]?c?(c.p(u,d),d&8&&Vr(c,1)):(c=Fd(u),c.c(),Vr(c,1),c.m(t,null)):c&&(g2(),Si(c,1,1,()=>{c=null}),m2())},i(u){h||(Vr(i.$$.fragment,u),Vr(n.$$.fragment,u),Vr(a.$$.fragment,u),Vr(c),h=!0)},o(u){Si(i.$$.fragment,u),Si(n.$$.fragment,u),Si(a.$$.fragment,u),Si(c),h=!1},d(u){u&&g_(t),Ln(i),Ln(n),Ln(a),c&&c.d()}}}function w2(r,t,e){let{can_undo:i=!1}=t,{can_redo:s=!1}=t,{can_save:n=!1}=t,{changeable:o=!1}=t;const a=b2(),l=d=>{a("undo"),d.stopPropagation()},h=d=>{a("redo"),d.stopPropagation()},c=d=>{a("remove_image"),d.stopPropagation()},u=d=>{a("save"),d.stopPropagation()};return r.$$set=d=>{"can_undo"in d&&e(0,i=d.can_undo),"can_redo"in d&&e(1,s=d.can_redo),"can_save"in d&&e(2,n=d.can_save),"changeable"in d&&e(3,o=d.changeable)},[i,s,n,o,a,l,h,c,u]}class T2 extends _2{constructor(t){super(),y2(this,t,w2,x2,v2,{can_undo:0,can_redo:1,can_save:2,changeable:3})}get can_undo(){return this.$$.ctx[0]}set can_undo(t){this.$$set({can_undo:t}),fn()}get can_redo(){return this.$$.ctx[1]}set can_redo(t){this.$$set({can_redo:t}),fn()}get can_save(){return this.$$.ctx[2]}set can_save(t){this.$$set({can_save:t}),fn()}get changeable(){return this.$$.ctx[3]}set changeable(t){this.$$set({changeable:t}),fn()}}const{SvelteComponent:E2,append:Lr,attr:yi,binding_callbacks:Od,component_subscribe:se,create_component:A2,create_slot:S2,destroy_component:C2,detach:I2,element:os,flush:je,get_all_dirty_from_scope:R2,get_slot_changes:P2,init:M2,insert:k2,listen:B2,mount_component:D2,safe_not_equal:F2,set_store_value:Nd,set_style:Ce,space:ll,toggle_class:Ld,transition_in:Ud,transition_out:Gd,update_slot_base:O2}=window.__gradio__svelte__internal,{onMount:N2,setContext:L2,createEventDispatcher:U2,tick:G2}=window.__gradio__svelte__internal;function H2(r){let t,e,i,s,n,o=`translate(${r[6].x}px, ${r[6].y}px)`,a,l,h,c,u=`${r[7][2]*r[8].child_width+1}px`,d=`${r[7][3]*r[8].child_height+1}px`,f=`${r[7][1]*r[8].child_height+(r[8].child_top-r[8].parent_top)-.5}px`,p=`${r[7][0]*r[8].child_width+(r[8].child_left-r[8].parent_left)-.5}px`,_,m,g;e=new T2({props:{can_undo:r[10],can_redo:r[11],can_save:r[9]!==r[5],changeable:r[1]}}
1176),e.$on("undo",r[17].undo),e.$on("redo",r[17].redo),e.$on("remove_image",r[2]),e.$on("save",r[26]);const v=r[38].default,y=S2(v,r,r[37],null);return{c(){t=os("div"),A2(e.$$.fragment),i=ll(),s=os("div"),n=os("div"),a=ll(),l=os("div"),y&&y.c(),h=ll(),c=os("div"),yi(n,"class","stage-wrap svelte-1sbaaot"),Ld(n,"bg",!r[0]),Ce(n,"transform",o),yi(s,"class","wrap svelte-1sbaaot"),yi(l,"class","tools-wrap svelte-1sbaaot"),yi(c,"class","border svelte-1sbaaot"),Ce(c,"width",u),Ce(c,"height",d),Ce(c,"top",f),Ce(c,"left",p),yi(t,"data-testid","image"),yi(t,"class","image-container svelte-1sbaaot")},m(b,E){k2(b,t,E),D2(e,t,null),Lr(t,i),Lr(t,s),Lr(s,n),r[40](n),r[41](s),Lr(t,a),Lr(t,l),y&&y.m(l,null),Lr(t,h),Lr(t,c),_=!0,m||(g=B2(window,"scroll",r[39]),m=!0)},p(b,E){const x={};E[0]&1024&&(x.can_undo=b[10]),E[0]&2048&&(x.can_redo=b[11]),E[0]&544&&(x.can_save=b[9]!==b[5]),E[0]&2&&(x.changeable=b[1]),e.$set(x),(!_||E[0]&1)&&Ld(n,"bg",!b[0]),E[0]&64&&o!==(o=`translate(${b[6].x}px, ${b[6].y}px)`)&&Ce(n,"transform",o),y&&y.p&&(!_||E[1]&64)&&O2(y,v,b,b[37],_?P2(v,b[37],E,null):R2(b[37]),null),E[0]&384&&u!==(u=`${b[7][2]*b[8].child_width+1}px`)&&Ce(c,"width",u),E[0]&384&&d!==(d=`${b[7][3]*b[8].child_height+1}px`)&&Ce(c,"height",d),E[0]&384&&f!==(f=`${b[7][1]*b[8].child_height+(b[8].child_top-b[8].parent_top)-.5}px`)&&Ce(c,"top",f),E[0]&384&&p!==(p=`${b[7][0]*b[8].child_width+(b[8].child_left-b[8].parent_left)-.5}px`)&&Ce(c,"left",p)},i(b){_||(Ud(e.$$.fragment,b),Ud(y,b),_=!0)},o(b){Gd(e.$$.fragment,b),Gd(y,b),_=!1},d(b){b&&I2(t),C2(e),r[40](null),r[41](null),y&&y.d(b),m=!1,g()}}}const Zi=Symbol("editor");function $2(r,t,e){let i,s,n,o,a,l,h,c,u,d,f,p,_,{$$slots:m={},$$scope:g}=t,{antialias:v=!0}=t,{crop_size:y}=t,{changeable:b=!1}=t,{history:E}=t,{bg:x=!1}=t,{sources:T}=t;const A=U2();let{crop_constraint:I=!1}=t,{canvas_size:R}=t,M=zt(R||[800,600]);se(r,M,W=>e(46,h=W));let{height:S=0}=t,C=zt({parent_width:0,parent_height:0,parent_top:0,parent_left:0,parent_right:0,parent_bottom:0,child_width:0,child_height:0,child_top:0,child_left:0,child_right:0,child_bottom:0});se(r,C,W=>e(8,f=W));const H=zt([0,0,1,1]);se(r,H,W=>e(7,d=W));const X=af({x:0,y:0},{stiffness:.1,damping:.5});se(r,X,W=>e(6,u=W));const O=zt(null);se(r,O,W=>e(45,l=W));const Q=IT(),{can_redo:k,can_undo:w,current_history:L}=Q;se(r,k,W=>e(11,_=W)),se(r,w,W=>e(10,p=W)),se(r,L,W=>e(5,n=W));const V=zt("bg");se(r,V,W=>e(36,s=W));const B=zt({});se(r,B,W=>e(43,o=W));const tt=zt({});se(r,tt,W=>e(47,c=W));const lt=zt([]);se(r,lt,W=>e(44,a=W));const F=zt(new DOMRect),st=["bg","layers","crop","draw","erase"],dt=L2(Zi,{pixi:O,current_layer:zt(null),dimensions:M,editor_box:C,toolbar_box:F,active_tool:V,crop:H,position_spring:X,command_manager:Q,current_history:L,register_context:(W,{reset_fn:$t,init_fn:jt})=>{lt.update(_t=>[..._t,W]),tt.update(_t=>({..._t,[W]:jt})),B.update(_t=>({..._t,[W]:$t}))},reset:(W,$t)=>{e(0,x=!1);const jt=a.sort((_t,kt)=>st.indexOf(_t)-st.indexOf(kt));for(const _t of jt)_t in o&&typeof o[_t]=="function"&&o[_t]?.();for(const _t of jt){if(_t in c&&typeof c[_t]=="function"){if(_t==="bg"&&!W)continue;c[_t]?.($t)}Q.reset(),l?.resize?.(...$t)}}});let ct,nt;function it(W,$t){if(!W||!$t)return;const{width:jt,height:_t,top:kt,left:kr,right:Uo,bottom:Go}=nt.getBoundingClientRect(),{width:Ho,height:$o,top:R_,left:P_,right:M_,bottom:k_}=$t.getBoundingClientRect();C.set({child_width:Ho,child_height:$o,child_left:P_,child_right:M_,child_top:R_,child_bottom:k_,parent_width:jt,parent_height:_t,parent_left:kr,parent_right:Uo,parent_top:kt,parent_bottom:Go})}function ut(){requestAnimationFrame(()=>{G2().then(W=>Nd(V,s="crop",s))})}function D(){if(!f)return;const[W,$t,jt,_t]=d,kt=W*f.child_width,kr=$t*f.child_height,Uo=jt*f.child_width,Go=_t*f.child_height,Ho=.5*f.child_width-kt-Uo/2,$o=.5*f.child_height-kr-Go/2;X.set({x:Ho,y:$o})}async function mt(){if(!l||!l.get_layers)return{background:null,layers:[],composite:null};const[W,$t,jt,_t]=d;return l?.get_blobs(l.get_layers(),new et(Math.round(W*h[0]),Math.round($t*h[1]),Math.round(jt*h[0]),Math.round(_t*h[1])),h)}function wt(){dt.reset(!0,i||h),T.length?U("bg"):U("draw"),A("clear")}N2(()=>
1176{const $t=CT({target:ct,dimensions:R||y||[800,600],antialias:v});function jt(kt,kr){$t.resize(kt,kr),M.set([kt,kr])}O.set({...$t,resize:jt});const _t=new ResizeObserver(kt=>{for(const kr of kt)it(nt,ct)});_t.observe(nt),_t.observe(ct);for(const kt of a)kt in c&&typeof c[kt]=="function"&&c[kt]?.(h);return jt(...h),()=>{l?.destroy(),_t.disconnect();for(const kt of a)kt in o&&o[kt]?.()}});let te=n;function Ki(){e(9,te=n),A("save")}function U(W){Nd(V,s=W,s)}const Lo=()=>it(nt,ct);function C_(W){Od[W?"unshift":"push"](()=>{ct=W,e(3,ct)})}function I_(W){Od[W?"unshift":"push"](()=>{nt=W,e(4,nt)})}return r.$$set=W=>{"antialias"in W&&e(29,v=W.antialias),"crop_size"in W&&e(30,y=W.crop_size),"changeable"in W&&e(1,b=W.changeable),"history"in W&&e(27,E=W.history),"bg"in W&&e(0,x=W.bg),"sources"in W&&e(31,T=W.sources),"crop_constraint"in W&&e(32,I=W.crop_constraint),"canvas_size"in W&&e(33,R=W.canvas_size),"height"in W&&e(28,S=W.height),"$$scope"in W&&e(37,g=W.$$scope)},r.$$.update=()=>{r.$$.dirty[1]&4&&(i=R),r.$$.dirty[0]&256&&e(28,S=f.child_height),r.$$.dirty[0]&32&&(n.previous,A("change")),r.$$.dirty[0]&32|r.$$.dirty[1]&32&&e(27,E=!!n.previous||s!=="bg"),r.$$.dirty[0]&134217729|r.$$.dirty[1]&2&&I&&x&&!E&&ut(),r.$$.dirty[0]&128&&d&&D(),r.$$.dirty[0]&88&&u&&it(nt,ct)},[x,b,wt,ct,nt,n,u,d,f,te,p,_,M,C,H,X,O,Q,k,w,L,V,B,tt,lt,it,Ki,E,S,v,y,T,I,R,mt,U,s,g,m,Lo,C_,I_]}class z2 extends E2{constructor(t){super(),M2(this,t,$2,H2,F2,{antialias:29,crop_size:30,changeable:1,history:27,bg:0,sources:31,crop_constraint:32,canvas_size:33,height:28,get_blobs:34,handle_remove:2,set_tool:35},null,[-1,-1])}get antialias(){return this.$$.ctx[29]}set antialias(t){this.$$set({antialias:t}),je()}get crop_size(){return this.$$.ctx[30]}set crop_size(t){this.$$set({crop_size:t}),je()}get changeable(){return this.$$.ctx[1]}set changeable(t){this.$$set({changeable:t}),je()}get history(){return this.$$.ctx[27]}set history(t){this.$$set({history:t}),je()}get bg(){return this.$$.ctx[0]}set bg(t){this.$$set({bg:t}),je()}get sources(){return this.$$.ctx[31]}set sources(t){this.$$set({sources:t}),je()}get crop_constraint(){return this.$$.ctx[32]}set crop_constraint(t){this.$$set({crop_constraint:t}),je()}get canvas_size(){return this.$$.ctx[33]}set canvas_size(t){this.$$set({canvas_size:t}),je()}get height(){return this.$$.ctx[28]}set height(t){this.$$set({height:t}),je()}get get_blobs(){return this.$$.ctx[34]}get handle_remove(){return this.$$.ctx[2]}get set_tool(){return this.$$.ctx[35]}}const{SvelteComponent:X2,action_destroyer:V2,append:Jt,attr:ve,check_outros:W2,component_subscribe:hl,create_component:j2,destroy_block:Y2,destroy_component:q2,detach:Fo,element:er,empty:Z2,ensure_array_like:Hd,flush:$d,group_outros:K2,init:J2,insert:Oo,is_function:Q2,listen:Xh,mount_component:tS,run_all:eS,safe_not_equal:rS,set_data:v_,set_store_value:pn,space:vh,text:vo,toggle_class:bo,transition_in:Gn,transition_out:bh,update_keyed_each:iS}=window.__gradio__svelte__internal,{getContext:sS,onMount:nS,tick:zd}=window.__gradio__svelte__internal;function Xd(r,t,e){const i=r.slice();return i[19]=t[e],i[21]=e,i}function Vd(r){let t,e,i,s,n,o=r[2].findIndex(r[11])+1+"",a,l,h,c,u,d,f,p;s=new Bm({});let _=r[1]&&Wd(r);return{c(){t=er("div"),e=er("button"),i=er("span"),j2(s.$$.fragment),n=vo(" Layer "),a=vo(o),l=vh(),_&&_.c(),h=vh(),c=er("span"),ve(i,"class","icon svelte-wbw3z5"),ve(e,"aria-label","Show Layers"),ve(e,"class","svelte-wbw3z5"),ve(c,"class","sep svelte-wbw3z5"),ve(t,"class","layer-wrap svelte-wbw3z5"),bo(t,"closed",!r[1])},m(m,g){Oo(m,t,g),Jt(t,e),Jt(e,i),tS(s,i,null),Jt(e,n),Jt(e,a),Jt(t,l),_&&_.m(t,null),Jt(t,h),Jt(t,c),d=!0,f||(p=[Xh(e,"click",r[12]),V2(u=Uh.call(null,t,r[14]))],f=!0)},p(m,g){(!d||g&12)&&o!==(o=m[2].findIndex(m[11])+1+"")&&v_(a,o),m[1]?_?_.p(m,g):(_=Wd(m),_.c(),_.m(t,h)):_&&(_.d(1),_=null),u&&Q2(u.update)&&g&2&&u.update.call(null,m[14]),(!d||g&2)&&bo(t,"closed",!m[1])},i(m){d||(Gn(s.$$.fragment,m),d=!0)},o(m){bh(s.$$.fragment,m),d=!1},d(m){m&&Fo(t),q2(s),_&&_.d(),f=!1,eS(p)}}}function Wd(r){let t,e=[],i=new Map,s,n,o,a,l,h=Hd(r[2]);const c=u=>u[21];for(let u=0;u<h.length;u+=1){let d=Xd(r,h,u),f=c(d);i.set(f,e[u]=jd(f,d))}return{c(){t=er("ul");for(let u=0;u<e.length;u+=1)e[u].c();s=vh(),n=er("li"),o=er("button"),o.textContent="+",ve(o,"aria-label","Add Layer"),ve(o,"class","svelte-wbw3z5"),ve(n,"class","svelte-wbw3z5"),ve(t,"class","svelte-wbw3z5")},m(u,d){Oo(u,t,d);for(let f=0;f<e.length;f+=1)e[f]&&e[f].m(t,null);Jt(t,s),Jt(t,n),Jt(n,o),a||(l=Xh(o,"click",r[8]),a=!0)},p(u,d){d&140&&(h=Hd(u[2]),e=iS(e,d,c,1,u,h,i,t,Y2,jd,s,Xd))},d(u){u&&Fo(t);for(let d=0;d<e.length;d+=1)e[d].d();a=!1,l()}}}
1176function jd(r,t){let e,i,s,n=t[21]+1+"",o,a,l;function h(){return t[13](t[21])}return{key:r,first:null,c(){e=er("li"),i=er("button"),s=vo("Layer "),o=vo(n),ve(i,"class","svelte-wbw3z5"),bo(i,"selected_layer",t[3]===t[19]),ve(e,"class","svelte-wbw3z5"),this.first=e},m(c,u){Oo(c,e,u),Jt(e,i),Jt(i,s),Jt(i,o),a||(l=Xh(i,"click",h),a=!0)},p(c,u){t=c,u&4&&n!==(n=t[21]+1+"")&&v_(o,n),u&12&&bo(i,"selected_layer",t[3]===t[19])},d(c){c&&Fo(e),a=!1,l()}}}function oS(r){let t,e,i=r[0]&&Vd(r);return{c(){i&&i.c(),t=Z2()},m(s,n){i&&i.m(s,n),Oo(s,t,n),e=!0},p(s,[n]){s[0]?i?(i.p(s,n),n&1&&Gn(i,1)):(i=Vd(s),i.c(),Gn(i,1),i.m(t.parentNode,t)):i&&(K2(),bh(i,1,1,()=>{i=null}),W2())},i(s){e||(Gn(i),e=!0)},o(s){bh(i),e=!1},d(s){s&&Fo(t),i&&i.d(s)}}}function aS(r){return r!==null}function lS(r,t,e){let i,s,n,o=!1,{layer_files:a=[]}=t,{enable_layers:l=!0}=t;const{pixi:h,current_layer:c,dimensions:u,register_context:d}=sS(Zi);hl(r,h,x=>e(15,i=x)),hl(r,c,x=>e(3,s=x)),hl(r,u,x=>e(10,n=x));const f=AT();let p=[];d("layers",{init_fn:()=>{m()},reset_fn:()=>{f.reset()}});async function _(){p.some(T=>T.composite.texture?.width!=n[0]||T.composite.texture?.height!=n[1])&&(f.reset(),!a||a.length==0?m():g(a))}async function m(){if(!i)return;const[x,T]=f.add_layer(i.layer_container,i.renderer,...n);pn(c,s=x,s),e(2,p=T)}async function g(x){if(await zd(),!x||x.length==0){f.reset(),m();return}if(!i)return;const T=await Promise.all(x.map(R=>!R||!R.url?null:fetch(R.url))),A=await Promise.all(T.map(R=>R?R.blob():null));f.reset();let I=null;for(const R of A.filter(aS))I=await f.add_layer_from_blob(i.layer_container,i.renderer,R,i.view);I&&(pn(c,s=I[0],s),e(2,p=I[1]))}nS(async()=>{await zd(),i&&pn(h,i={...i,get_layers:f.get_layers},i)});const v=x=>x===s,y=()=>e(1,o=!o),b=x=>pn(c,s=f.change_active_layer(x),s),E=()=>e(1,o=!1);return r.$$set=x=>{"layer_files"in x&&e(9,a=x.layer_files),"enable_layers"in x&&e(0,l=x.enable_layers)},r.$$.update=()=>{r.$$.dirty&1024&&_(),r.$$.dirty&512&&g(a)},[l,o,p,s,h,c,u,f,m,a,n,v,y,b,E]}class hS extends X2{constructor(t){super(),J2(this,t,lS,oS,rS,{layer_files:9,enable_layers:0})}get layer_files(){return this.$$.ctx[9]}set layer_files(t){this.$$set({layer_files:t}),$d()}get enable_layers(){return this.$$.ctx[0]}set enable_layers(t){this.$$set({enable_layers:t}),$d()}}const{SvelteComponent:cS,add_flush_callback:ws,append:Yd,attr:b_,bind:Ts,binding_callbacks:Li,bubble:uS,check_outros:cl,create_component:Ar,destroy_component:Sr,detach:oe,element:No,empty:x_,flush:St,group_outros:ul,init:dS,insert:ae,mount_component:Cr,safe_not_equal:fS,set_style:qd,space:vr,transition_in:Bt,transition_out:Vt}=window.__gradio__svelte__internal,{createEventDispatcher:pS}=window.__gradio__svelte__internal;function Zd(r){let t,e;return t=new QA({props:{crop_constraint:r[21]}}),{c(){Ar(t.$$.fragment)},m(i,s){Cr(t,i,s),e=!0},p(i,s){const n={};s[0]&2097152&&(n.crop_constraint=i[21]),t.$set(n)},i(i){e||(Bt(t.$$.fragment,i),e=!0)},o(i){Vt(t.$$.fragment,i),e=!1},d(i){Sr(t,i)}}}function Kd(r){let t,e;return t=new u_({props:{color_mode:r[0].color_mode,default_color:r[0].default_color,default_size:r[0].default_size,colors:r[0].colors,mode:"draw"}}),{c(){Ar(t.$$.fragment)},m(i,s){Cr(t,i,s),e=!0},p(i,s){const n={};s[0]&1&&(n.color_mode=i[0].color_mode),s[0]&1&&(n.default_color=i[0].default_color),s[0]&1&&(n.default_size=i[0].default_size),s[0]&1&&(n.colors=i[0].colors),t.$set(n)},i(i){e||(Bt(t.$$.fragment,i),e=!0)},o(i){Vt(t.$$.fragment,i),e=!1},d(i){Sr(t,i)}}}function Jd(r){let t,e;return t=new u_({props:{default_size:r[1].default_size,mode:"erase"}}),{c(){Ar(t.$$.fragment)},m(i,s){Cr(t,i,s),e=!0},p(i,s){const n={};s[0]&2&&(n.default_size=i[1].default_size),t.$set(n)},i(i){e||(Bt(t.$$.fragment,i),e=!0)},o(i){Vt(t.$$.fragment,i),e=!1},d(i){Sr(t,i)}}}function _S(r){let t,e,i,s,n,o,a=r[10].includes("crop"),l,h,c,u;t=new hS({props:{layer_files:r[9]?.layers||null,enable_layers:r[11]}});function d(v){r[28](v)}function f(v){r[29](v)}let p={i18n:r[4],root:r[5],sources:r[2],upload:r[14],stream_handler:r[15],background_file:r[9]?.background||r[9]?.composite||null};r[17]!==void 0&&(p.bg=r[17]),r[19]!==void 0&&(p.active_mode=r[19]),i=new p2({props:p}),Li.push(()=>Ts(i,"bg",d)),Li.push(()=>Ts(i,"active_mode",f));let _=a&&Zd(r),m=r[0]&&Kd(r),g=r[0]&&r[1]&&Jd(r);return{c(){Ar(t.$$.fragment),e=vr(),Ar(i.$$.fragment),o=vr(),_&&_.c(),l=vr(),m&&m.c(),h=vr(),g&&g.c(),c=x_()},m(v,y){Cr(t,v,y),ae(v,e,y),Cr(i,v,y),ae(v,o,y),_&&_.m(v,y),ae(v,l,y),m&&m.m(v,y),ae(v,h,y),g&&g.m(v,y),ae(v,c,y),u=!0},p(v,y){const b={};y[0]&512&&(b.layer_files=v[9]?.layers||null),y[0]&2048&&(b.enable_layers=v[11]),t.$set(b);const E={};y[0]&16&&(E.i18n=v[4]),y[0]&32&&(E.root=v[5]),y[0]&4&&(E.sources=v[2]),y[0]&16384&&(E.upload=v[14]),y[0]&32768&&(E.stream_handler=v[15]),y[0]&512&&(E.background_file=v[9]?.background||v[9]?.composite||null),!s&&y[0]&131072&&(s=!0,E.bg=v[17],ws(()=>s=!1)),!n&&y[0]&524288&&(n=!0,E.active_mode=v[19],ws(()=>n=!1)),i.$set(E),y[0]&1024&&(a=v[10].includes("crop")),a?_?(_.p(v,y),y[0]&1024&&Bt(_,1)):(_=Zd(v),_.c(),Bt(_,1),_.m(l.parentNode,l)):_&&(ul(),Vt(_,1,1,()=>{_=null}),cl()),v[0]?m?(m.p(v,y),y[0]&1&&Bt(m,1)):(m=Kd(v),m.c(),Bt(m,1),m.m(h.parentNode,h)):m&&(ul(),Vt(m,1,1,()=>{m=null}),cl()),v[0]&&v[1]?g?(g.p(v,y),y[0]&3&&Bt(g,1)):(g=Jd(v),g.c(),Bt(g,1),g.m(c.parentNode,c)):g&&(ul(),Vt(g,1,1,()=>{g=null}),cl())},i(v){u||(Bt(t.$$.fragment,v),Bt(i.$$.fragment,v),Bt(_),Bt(m),Bt(g),u=!0)},o(v){Vt(t.$$.fragment,v),Vt(i.$$.fragment,v),Vt(_),Vt(m),Vt(g),u=!1},d(v){v&&(oe(e),oe(o),oe(l),oe(h),oe(c)),Sr(t,v),Sr(i,v),_&&_.d(v),m&&m.d(v),g&&g.d(v)}}}function Qd(r){let t,e,i,s=r[2]&&r[2].length&&tf(),n=r[2]&&r[2].length&&r[0]&&ef(),o=r[0]&&rf();return{c(){t=No("div"),s&&s.c(),e=vr(),n&&n.c(),i=vr(),o&&o.c(),b_(t,"class","empty wrap svelte-af64j7"),qd(t,"height",`${r[20]}px`)},m(a,l){ae(a,t,l),s&&s.m(t,null),Yd(t,e),n&&n.m(t,null),Yd(t,i),o&&o.m(t,null)},p(a,l){a[2]&&a[2].length?s||(s=tf(),s.c(),s.m(t,e)):s&&(s.d(1),s=null),a[2]&&a[2].length&&a[0]?n||(n=ef(),n.c(),n.m(t,i)):n&&(n.d(1),n=null),a[0]?o||(o=rf(),o.c(),o.m(t,null)):o&&(o.d(1),o=null),l[0]&1048576&&qd(t,"height",`${a[20]}px`)},d(a){a&&oe(t),s&&s.d(),n&&n.d(),o&&o.d()}}}function tf(r){let t;return{c(){t=No("div"),t.textContent="Upload an image"},m(e,i){ae(e,t,i)},d(e){e&&oe(t)}}}function ef(r){let t;return{c(){t=No("div"),t.textContent="or",b_(t,"class","or svelte-af64j7")},m(e,i){ae(e,t,i)},d(e){e&&oe(t)}}}function rf(r){let t;return{c(){t=No("div"),t.textContent="select the draw tool to start"},m(e,i){ae(e,t,i)},d(e){e&&oe(t)}}}function mS(r){let t,e,i,s;t=new zg({props:{i18n:r[4],$$slots:{default:[_S]},$$scope:{ctx:r}}});let n=!r[17]&&!r[18]&&r[19]!=="webcam"&&r[12]!=="error"&&Qd(r);return{c(){Ar(t.$$.fragment),e=vr(),n&&n.c(),i=x_()},m(o,a){Cr(t,o,a),ae(o,e,a),n&&n.m(o,a),ae(o,i,a),s=!0},p(o,a){const l={};a[0]&16&&(l.i18n=o[4]),a[0]&2805303|a[1]&256&&(l.$$scope={dirty:a,ctx:o}),t.$set(l),!o[17]&&!o[18]&&o[19]!=="webcam"&&o[12]!=="error"?n?n.p(o,a):(n=Qd(o),n.c(),n.m(i.parentNode,i)):n&&(n.d(1),n=null)},i(o){s||(Bt(t.$$.fragment,o),s=!0)},o(o){Vt(t.$$.fragment,o),s=!1},d(o){o&&(oe(e),oe(i)),Sr(t,o),n&&n.d(o)}}}function gS(r){let t,e,i,s,n,o,a;t=new $_({props:{show_label:r[7],Icon:xh,label:r[6]||r[4]("image.image")}});function l(d){r[31](d)}function h(d){r[32](d)}function c(d){r[33](d)}let u={canvas_size:r[13],crop_size:Array.isArray(r[3])?r[3]:void 0,changeable:r[8],sources:r[2],crop_constraint:!!r[21],$$slots:{default:[mS]},$$scope:{ctx:r}};return r[20]!==void 0&&(u.height=r[20]),r[18]!==void 0&&(u.history=r[18]),r[17]!==void 0&&(u.bg=r[17]),i=new z2({props:u}),r[30](i),Li.push(()=>Ts(i,"height",l)),Li.push(()=>Ts(i,"history",h)),Li.push(()=>Ts(i,"bg",c)),i.$on("save",r[34]),i.$on("change",r[23]),i.$on("clear",r[35]),{c(){Ar(t.$$.fragment),e=vr(),Ar(i.$$.fragment)},m(d,f){Cr(t,d,f),ae(d,e,f),Cr(i,d,f),a=!0}
1176,p(d,f){const p={};f[0]&128&&(p.show_label=d[7]),f[0]&80&&(p.label=d[6]||d[4]("image.image")),t.$set(p);const _={};f[0]&8192&&(_.canvas_size=d[13]),f[0]&8&&(_.crop_size=Array.isArray(d[3])?d[3]:void 0),f[0]&256&&(_.changeable=d[8]),f[0]&4&&(_.sources=d[2]),f[0]&2097152&&(_.crop_constraint=!!d[21]),f[0]&4120119|f[1]&256&&(_.$$scope={dirty:f,ctx:d}),!s&&f[0]&1048576&&(s=!0,_.height=d[20],ws(()=>s=!1)),!n&&f[0]&262144&&(n=!0,_.history=d[18],ws(()=>n=!1)),!o&&f[0]&131072&&(o=!0,_.bg=d[17],ws(()=>o=!1)),i.$set(_)},i(d){a||(Bt(t.$$.fragment,d),Bt(i.$$.fragment,d),a=!0)},o(d){Vt(t.$$.fragment,d),Vt(i.$$.fragment,d),a=!1},d(d){d&&oe(e),Sr(t,d),r[30](null),Sr(i,d)}}}function yS(r){return!!r}function vS(r){return!!r}function sf(){return new Promise(r=>setTimeout(()=>r(),30))}function bS(r,t,e){let i,{brush:s}=t,{eraser:n}=t,{sources:o}=t,{crop_size:a=null}=t,{i18n:l}=t,{root:h}=t,{label:c=void 0}=t,{show_label:u}=t,{changeable:d=!1}=t,{value:f={background:null,layers:[],composite:null}}=t,{transforms:p=["crop"]}=t,{layers:_}=t,{accept_blobs:m}=t,{status:g="complete"}=t,{canvas_size:v}=t,{realtime:y}=t,{upload:b}=t,{stream_handler:E}=t;const x=pS();let T;async function A(){const F=await T.get_blobs(),st=F.background?b(await zo([new File([F.background],"background.png")]),h):Promise.resolve(null),dt=F.layers.filter(yS).map(async(D,mt)=>b(await zo([new File([D],`layer_${mt}.png`)]),h)),ct=F.composite?b(await zo([new File([F.composite],"composite.png")]),h):Promise.resolve(null),[nt,it,...ut]=await Promise.all([st,ct,...dt]);return{background:Array.isArray(nt)?nt[0]:nt,layers:ut.flatMap(D=>Array.isArray(D)?D:[D]).filter(vS),composite:Array.isArray(it)?it[0]:it}}function I(F){T&&F==null&&T.handle_remove()}let R=!1,P=!1,{image_id:M=null}=t,S=!1,C=!1;async function H(F){if(!y)return;if(S){C=!0;return}S=!0,await sf();const st=await T.get_blobs(),dt=[];let ct=Math.random().toString(36).substring(2);st.background&&dt.push([ct,"background",new File([st.background],"background.png"),null]),st.composite&&dt.push([ct,"composite",new File([st.composite],"composite.png"),null]),st.layers.forEach((nt,it)=>{nt&&dt.push([ct,"layer",new File([nt],`layer_${it}.png`),it])}),await Promise.all(dt.map(async([nt,it,ut,D])=>m({binary:!0,data:{file:ut,id:nt,type:it,index:D}}))),e(24,M=ct),x("change"),await sf(),S=!1,C&&(C=!1,S=!1,H())}let X=null,O=0;function Q(F){R=F,e(17,R)}function k(F){X=F,e(19,X)}function w(F){Li[F?"unshift":"push"](()=>{T=F,e(16,T)})}function L(F){O=F,e(20,O)}function V(F){P=F,e(18,P)}function B(F){R=F,e(17,R)}function tt(F){uS.call(this,r,F)}const lt=()=>x("clear");return r.$$set=F=>{"brush"in F&&e(0,s=F.brush),"eraser"in F&&e(1,n=F.eraser),"sources"in F&&e(2,o=F.sources),"crop_size"in F&&e(3,a=F.crop_size),"i18n"in F&&e(4,l=F.i18n),"root"in F&&e(5,h=F.root),"label"in F&&e(6,c=F.label),"show_label"in F&&e(7,u=F.show_label),"changeable"in F&&e(8,d=F.changeable),"value"in F&&e(9,f=F.value),"transforms"in F&&e(10,p=F.transforms),"layers"in F&&e(11,_=F.layers),"accept_blobs"in F&&e(25,m=F.accept_blobs),"status"in F&&e(12,g=F.status),"canvas_size"in F&&e(13,v=F.canvas_size),"realtime"in F&&e(26,y=F.realtime),"upload"in F&&e(14,b=F.upload),"stream_handler"in F&&e(15,E=F.stream_handler),"image_id"in F&&e(24,M=F.image_id)},r.$$.update=()=>{r.$$.dirty[0]&131072&&R&&x("upload"),r.$$.dirty[0]&512&&I(f),r.$$.dirty[0]&8&&e(21,i=a),r.$$.dirty[0]&65540&&T&&T.set_tool&&(o&&o.length?T.set_tool("bg"):T.set_tool("draw"))},[s,n,o,a,l,h,c,u,d,f,p,_,g,v,b,E,T,R,P,X,O,i,x,H,M,m,y,A,Q,k,w,L,V,B,tt,lt]}class xS extends cS{constructor(t){super(),dS(this,t,bS,gS,fS,{brush:0,eraser:1,sources:2,crop_size:3,i18n:4,root:5,label:6,show_label:7,changeable:8,value:9,transforms:10,layers:11,accept_blobs:25,status:12,canvas_size:13,realtime:26,upload:14,stream_handler:15,get_data:27,image_id:24},null,[-1,-1])}get brush(){return this.$$.ctx[0]}set brush(t){this.$$set({brush:t}),St()}get eraser(){return this.$$.ctx[1]}set eraser(t){this.$$set({eraser:t}),St()}get sources(){return this.$$.ctx[2]}set sources(t){this.$$set({sources:t}),St()}get crop_size(){return this.$$.ctx[3]}set crop_size(t){this.$$set({crop_size:t}),St()}get i18n(){return this.$$.ctx[4]}set i18n(t){this.$$set({i18n:t}),St()}get root(){return this.$$.ctx[5]}set root(t){this.$$set({root:t}),St()}get label(){return this.$$.ctx[6]}set label(t){this.$$set({label:t}),St()}get show_label(){return this.$$.ctx[7]}set show_label(t){this.$$set({show_label:t}),St()}get changeable(){return this.$$.ctx[8]}set changeable(t){this.$$set({changeable:t}),St()}get value(){return this.$$.ctx[9]}set value(t){this.$$set({value:t}),St()}get transforms(){return this.$$.ctx[10]}set transforms(t){this.$$set({transforms:t}),St()}get layers(){return this.$$.ctx[11]}set layers(t){this.$$set({layers:t}),St()}get accept_blobs(){return this.$$.ctx[25]}set accept_blobs(t){this.$$set({accept_blobs:t}),St()}get status(){return this.$$.ctx[12]}set status(t){this.$$set({status:t}),St()}get canvas_size(){return this.$$.ctx[13]}set canvas_size(t){this.$$set({canvas_size:t}),St()}get realtime(){return this.$$.ctx[26]}set realtime(t){this.$$set({realtime:t}),St()}get upload(){return this.$$.ctx[14]}set upload(t){this.$$set({upload:t}),St()}get stream_handler(){return this.$$.ctx[15]}set stream_handler(t){this.$$set({stream_handler:t}),St()}get get_data(){return this.$$.ctx[27]}get image_id(){return this.$$.ctx[24]}set image_id(t){this.$$set({image_id:t}),St()}}const{SvelteComponent:wS,add_flush_callback:TS,assign:w_,bind:ES,binding_callbacks:T_,bubble:AS,check_outros:SS,create_component:Vi,destroy_component:Wi,detach:Vh,empty:CS,flush:pt,get_spread_object:E_,get_spread_update:A_,group_outros:IS,init:RS,insert:Wh,mount_component:ji,not_equal:PS,space:S_,transition_in:Ir,transition_out:Rr}=window.__gradio__svelte__internal,{tick:MS}=window.__gradio__svelte__internal;function kS(r){let t,e;return t=new nf({props:{visible:r[3],variant:r[4]===null?"dashed":"solid",border_mode:r[29]?"focus":"base",padding:!1,elem_id:r[1],elem_classes:r[2],height:r[9]||void 0,width:r[10],allow_overflow:!1,container:r[12],scale:r[13],min_width:r[14],$$slots:{default:[DS]},$$scope:{ctx:r}}}),{c(){Vi(t.$$.fragment)},m(i,s){ji(t,i,s),e=!0},p(i,s){const n={};s[0]&8&&(n.visible=i[3]),s[0]&16&&(n.variant=i[4]===null?"dashed":"solid"),s[0]&536870912&&(n.border_mode=i[29]?"focus":"base"),s[0]&2&&(n.elem_id=i[1]),s[0]&4&&(n.elem_classes=i[2]),s[0]&512&&(n.height=i[9]||void 0),s[0]&1024&&(n.width=i[10]),s[0]&4096&&(n.container=i[12]),s[0]&8192&&(n.scale=i[13]),s[0]&16384&&(n.min_width=i[14]),s[0]&1073545585|s[1]&1048576&&(n.$$scope={dirty:s,ctx:i}),t.$set(n)},i(i){e||(Ir(t.$$.fragment,i),e=!0)},o(i){Rr(t.$$.fragment,i),e=!1},d(i){Wi(t,i)}}}function BS(r){let t,e;return t=new nf({props:{visible:r[3],variant:"solid",border_mode:r[29]?"focus":"base",padding:!1,elem_id:r[1],elem_classes:r[2],height:r[9]||void 0,width:r[10],allow_overflow:!1,container:r[12],scale:r[13],min_width:r[14],$$slots:{default:[FS]},$$scope:{ctx:r}}}),{c(){Vi(t.$$.fragment)},m(i,s){ji(t,i,s),e=!0},p(i,s){const n={};s[0]&8&&(n.visible=i[3]),s[0]&536870912&&(n.border_mode=i[29]?"focus":"base"),s[0]&2&&(n.elem_id=i[1]),s[0]&4&&(n.elem_classes=i[2]),s[0]&512&&(n.height=i[9]||void 0),s[0]&1024&&(n.width=i[10]),s[0]&4096&&(n.container=i[12]),s[0]&8192&&(n.scale=i[13]),s[0]&16384&&(n.min_width=i[14]),s[0]&67143921|s[1]&1048576&&(n.$$scope={dirty:s,ctx:i}),t.$set(n)},i(i){e||(Ir(t.$$.fragment,i),e=!0)},o(i){Rr(t.$$.fragment,i),e=!1},d(i){Wi(t,i)}}}function DS(r){let t,e,i,s,n;const o=[{autoscroll:r[26].autoscroll},{i18n:r[26].i18n},r[0]];let a={};for(let c=0;c<o.length;c+=1)a=w_(a,o[c]);t=new lf({props:a}),t.$on("clear_status",r[38]);function l(c){r[39](c)}let h={canvas_size:r[25],crop_size:r[20],value:r[4],root:r[8],sources:r[16],label:r[5],show_label:r[6],brush:r[18],eraser:r[19],changeable:r[23].includes("apply"),realtime:r[23].includes("change"),i18n:r[26].i18n,transforms:r[21],accept_blobs:r[24].accept_blobs,layers:r[22],status:r[0]?.status,upload:r[26].client.upload,stream_handler:r[26].client.stream};return r[28]!==void 0&&(h.image_id=r[28]),i=new xS({props:h}),T_.push(()=>ES(i,"image_id",l)),r[40](i),i.$on("change",r[41]),i.$on("save",r[42]),i.$on("edit",r[43]),i.$on("clear",r[44]),i.$on("drag",r[45]),i.$on("upload",r[46]),i.$on("share",r[47]),i.$on("error",r[48]),i.$on("error",r[49]),{c(){Vi(t.$$.fragment),e=S_(),Vi(i.$$.fragment)},m(c,u){ji(t,c,u),Wh(c,e,u),ji(i,c,u),n=!0},p(c,u){const d=u[0]&67108865?A_(o,[u[0]&67108864&&{autoscroll:c[26].autoscroll},u[0]&67108864&&{i18n:c[26].i18n},u[0]&1&&E_(c[0])]):{};t.$set(d);const f={};u[0]&33554432&&(f.canvas_size=c[25]),u[0]&1048576&&(f.crop_size=c[20]),u[0]&16&&(f.value=c[4]),u[0]&256&&(f.root=c[8]),u[0]&65536&&(f.sources=c[16]),u[0]&32&&(f.label=c[5]),u[0]&64&&(f.show_label=c[6]),u[0]&262144&&(f.brush=c[18]),u[0]&524288&&(f.eraser=c[19]),u[0]&8388608&&(f.changeable=c[23].includes("apply")),u[0]&8388608&&(f.realtime=c[23].includes("change")),u[0]&67108864&&(f.i18n=c[26].i18n),u[0]&2097152&&(f.transforms=c[21]),u[0]&16777216&&(f.accept_blobs=c[24].accept_blobs),u[0]&4194304&&(f.layers=c[22]),u[0]&1&&(f.status=c[0]?.status),u[0]&67108864&&(f.upload=c[26].client.upload),u[0]&67108864&&(f.
1176stream_handler=c[26].client.stream),!s&&u[0]&268435456&&(s=!0,f.image_id=c[28],TS(()=>s=!1)),i.$set(f)},i(c){n||(Ir(t.$$.fragment,c),Ir(i.$$.fragment,c),n=!0)},o(c){Rr(t.$$.fragment,c),Rr(i.$$.fragment,c),n=!1},d(c){c&&Vh(e),Wi(t,c),r[40](null),Wi(i,c)}}}function FS(r){let t,e,i,s;const n=[{autoscroll:r[26].autoscroll},{i18n:r[26].i18n},r[0]];let o={};for(let a=0;a<n.length;a+=1)o=w_(o,n[a]);return t=new lf({props:o}),t.$on("clear_status",r[34]),i=new D_({props:{value:r[4]?.composite||null,label:r[5],show_label:r[6],show_download_button:r[7],selectable:r[11],show_share_button:r[15],i18n:r[26].i18n}}),i.$on("select",r[35]),i.$on("share",r[36]),i.$on("error",r[37]),{c(){Vi(t.$$.fragment),e=S_(),Vi(i.$$.fragment)},m(a,l){ji(t,a,l),Wh(a,e,l),ji(i,a,l),s=!0},p(a,l){const h=l[0]&67108865?A_(n,[l[0]&67108864&&{autoscroll:a[26].autoscroll},l[0]&67108864&&{i18n:a[26].i18n},l[0]&1&&E_(a[0])]):{};t.$set(h);const c={};l[0]&16&&(c.value=a[4]?.composite||null),l[0]&32&&(c.label=a[5]),l[0]&64&&(c.show_label=a[6]),l[0]&128&&(c.show_download_button=a[7]),l[0]&2048&&(c.selectable=a[11]),l[0]&32768&&(c.show_share_button=a[15]),l[0]&67108864&&(c.i18n=a[26].i18n),i.$set(c)},i(a){s||(Ir(t.$$.fragment,a),Ir(i.$$.fragment,a),s=!0)},o(a){Rr(t.$$.fragment,a),Rr(i.$$.fragment,a),s=!1},d(a){a&&Vh(e),Wi(t,a),Wi(i,a)}}}function OS(r){let t,e,i,s;const n=[BS,kS],o=[];function a(l,h){return l[17]?1:0}return t=a(r),e=o[t]=n[t](r),{c(){e.c(),i=CS()},m(l,h){o[t].m(l,h),Wh(l,i,h),s=!0},p(l,h){let c=t;t=a(l),t===c?o[t].p(l,h):(IS(),Rr(o[c],1,1,()=>{o[c]=null}),SS(),e=o[t],e?e.p(l,h):(e=o[t]=n[t](l),e.c()),Ir(e,1),e.m(i.parentNode,i))},i(l){s||(Ir(e),s=!0)},o(l){Rr(e),s=!1},d(l){l&&Vh(i),o[t].d(l)}}}function NS(){return new Promise(r=>{requestAnimationFrame(()=>requestAnimationFrame(()=>r()))})}function LS(r,t,e){let{elem_id:i=""}=t,{elem_classes:s=[]}=t,{visible:n=!0}=t,{value:o={background:null,layers:[],composite:null}}=t,{label:a}=t,{show_label:l}=t,{show_download_button:h}=t,{root:c}=t,{value_is_output:u=!1}=t,{height:d}=t,{width:f}=t,{_selectable:p=!1}=t,{container:_=!0}=t,{scale:m=null}=t,{min_width:g=void 0}=t,{loading_status:v}=t,{show_share_button:y=!1}=t,{sources:b=["upload","clipboard","webcam"]}=t,{interactive:E}=t,{brush:x}=t,{eraser:T}=t,{crop_size:A=null}=t,{transforms:I=["crop"]}=t,{layers:R=!0}=t,{attached_events:P=[]}=t,{server:M}=t,{canvas_size:S}=t,{gradio:C}=t,H,X=null;async function O(){if(X){const Lo={id:X};return e(28,X=null),Lo}return await H.get_data()}let Q;async function k(){await NS(),o&&(o.background||o.layers?.length||o.composite)&&C.dispatch("change")}function w(){C.dispatch("apply")}function L(){C.dispatch("change"),u||(C.dispatch("input"),MS().then(U=>e(32,u=!1)))}const V=()=>C.dispatch("clear_status",v),B=({detail:U})=>C.dispatch("select",U),tt=({detail:U})=>C.dispatch("share",U),lt=({detail:U})=>C.dispatch("error",U),F=()=>C.dispatch("clear_status",v);function st(U){X=U,e(28,X)}function dt(U){T_[U?"unshift":"push"](()=>{H=U,e(27,H)})}const ct=()=>L(),nt=U=>w(),it=()=>C.dispatch("edit"),ut=()=>C.dispatch("clear"),D=({detail:U})=>e(29,Q=U),mt=()=>C.dispatch("upload"),wt=({detail:U})=>C.dispatch("share",U),te=({detail:U})=>{e(0,v=v||{}),e(0,v.status="error",v),C.dispatch("error",U)};function Ki(U){AS.call(this,r,U)}return r.$$set=U=>{"elem_id"in U&&e(1,i=U.elem_id),"elem_classes"in U&&e(2,s=U.elem_classes),"visible"in U&&e(3,n=U.visible),"value"in U&&e(4,o=U.value),"label"in U&&e(5,a=U.label),"show_label"in U&&e(6,l=U.show_label),"show_download_button"in U&&e(7,h=U.show_download_button),"root"in U&&e(8,c=U.root),"value_is_output"in U&&e(32,u=U.value_is_output),"height"in U&&e(9,d=U.height),"width"in U&&e(10,f=U.width),"_selectable"in U&&e(11,p=U._selectable),"container"in U&&e(12,_=U.container),"scale"in U&&e(13,m=U.scale),"min_width"in U&&e(14,g=U.min_width),"loading_status"in U&&e(0,v=U.loading_status),"show_share_button"in U&&e(15,y=U.show_share_button),"sources"in U&&e(16,b=U.sources),"interactive"in U&&e(17,E=U.interactive),"brush"in U&&e(18,x=U.brush),"eraser"in U&&e(19,T=U.eraser),"crop_size"in U&&e(20,A=U.crop_size),"transforms"in U&&e(21,I=U.transforms),"layers"in U&&e(22,R=U.layers),"attached_events"in U&&e(23,P=U.attached_events),"server"in U&&e(24,M=U.server),"canvas_size"in U&&e(25,S=U.canvas_size),"gradio"in U&&e(26,C=U.gradio)},r.$$.update=()=>{r.$$.dirty[0]&16&&o&&k()},[v,i,s,n,o,a,l,h,c,d,f,p,_,m,g,y,b,E,x,T,A,I,R,P,M,S,C,H,X,Q,w,L,u,O,V,B,tt,lt,F,st,dt,ct,nt,it,ut,D,mt,wt,te,Ki]}class dC extends wS{constructor(t){super(),RS(this,t,LS,OS,PS,{elem_id:1,elem_classes:2,visible:3,value:4,label:5,show_label:6,show_download_button:7,root:8,value_is_output:32,height:9,width:10,_selectable:11,container:12,scale:13,min_width:14,loading_status:0,show_share_button:15,sources:16,interactive:17,brush:18,eraser:19,crop_size:20,transforms:21,layers:22,attached_events:23,server:24,canvas_size:25,gradio:26,get_value:33},null,[-1,-1])}get elem_id(){return this.$$.ctx[1]}set elem_id(t){this.$$set({elem_id:t}),pt()}get elem_classes(){return this.$$.ctx[2]}set elem_classes(t){this.$$set({elem_classes:t}),pt()}get visible(){return this.$$.ctx[3]}set visible(t){this.$$set({visible:t}),pt()}get value(){return this.$$.ctx[4]}set value(t){this.$$set({value:t}),pt()}get label(){return this.$$.ctx[5]}set label(t){this.$$set({label:t}),pt()}get show_label(){return this.$$.ctx[6]}set show_label(t){this.$$set({show_label:t}),pt()}get show_download_button(){return this.$$.ctx[7]}set show_download_button(t){this.$$set({show_download_button:t}),pt()}get root(){return this.$$.ctx[8]}set root(t){this.$$set({root:t}),pt()}get value_is_output(){return this.$$.ctx[32]}set value_is_output(t){this.$$set({value_is_output:t}),pt()}get height(){return this.$$.ctx[9]}set height(t){this.$$set({height:t}),pt()}get width(){return this.$$.ctx[10]}set width(t){this.$$set({width:t}),pt()}get _selectable(){return this.$$.ctx[11]}set _selectable(t){this.$$set({_selectable:t}),pt()}get container(){return this.$$.ctx[12]}set container(t){this.$$set({container:t}),pt()}get scale(){return this.$$.ctx[13]}set scale(t){this.$$set({scale:t}),pt()}get min_width(){return this.$$.ctx[14]}set min_width(t){this.$$set({min_width:t}),pt()}get loading_status(){return this.$$.ctx[0]}set loading_status(t){this.$$set({loading_status:t}),pt()}get show_share_button(){return this.$$.ctx[15]}set show_share_button(t){this.$$set({show_share_button:t}),pt()}get sources(){return this.$$.ctx[16]}set sources(t){this.$$set({sources:t}),pt()}get interactive(){return this.$$.ctx[17]}set interactive(t){this.$$set({interactive:t}),pt()}get brush(){return this.$$.ctx[18]}set brush(t){this.$$set({brush:t}),pt()}get eraser(){return this.$$.ctx[19]}set eraser(t){this.$$set({eraser:t}),pt()}get crop_size(){return this.$$.ctx[20]}set crop_size(t){this.$$set({crop_size:t}),pt()}get transforms(){return this.$$.ctx[21]}set transforms(t){this.$$set({transforms:t}),pt()}get layers(){return this.$$.ctx[22]}set layers(t){this.$$set({layers:t}),pt()}get attached_events(){return this.$$.ctx[23]}set attached_events(t){this.$$set({attached_events:t}),pt()}get server(){return this.$$.ctx[24]}set server(t){this.$$set({server:t}),pt()}get canvas_size(){return this.$$.ctx[25]}set canvas_size(t){this.$$set({canvas_size:t}),pt()}get gradio(){return this.$$.ctx[26]}set gradio(t){this.$$set({gradio:t}),pt()}get get_value(){return this.$$.ctx[33]}}
1176export{dC as default}; 1177//# sourceMappingURL=Index-Bjj4logA.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.