diff --git "a/assets/index-B2wn0_c0.js" "b/assets/index-B2wn0_c0.js" new file mode 100644--- /dev/null +++ "b/assets/index-B2wn0_c0.js" @@ -0,0 +1,3881 @@ +var zm=Object.defineProperty;var jm=(r,e,t)=>e in r?zm(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var sc=(r,e,t)=>jm(r,typeof e!="symbol"?e+"":e,t);import{g as tu,e as Nn,f as Vm,d as Ne,h as le,i as Ve,j as Xo,k as nd,l as Wo,m as Gm,w as Ge,p as Jt,q as Gt,o as fe,c as _e,s as rd,t as $m,v as ut,r as Eo,x as lt,y as Be,a as Oe,z as Y,A as Kt,B as ft,C as Wr,b as K,D as nt,E as id,I as od,F as Gs,M as qr,G as Vt,V as Re,S as qo,U as nu,H as Hm,T as Xm,J as ad,R as Wm,P as sd,K as Si,L as qm,N as Kr,O as Ln,Z as ru,Q as Sn,W as ld,X as ud,Y as Ym,_ as iu,$ as Km,a0 as hn,a1 as Yo,a2 as ou,a3 as yo,a4 as bt,a5 as Zm,a6 as Bn,a7 as Jm,a8 as cd,a9 as fr,aa as Nr,ab as lc,ac as ma,ad as Qm,ae as eg,af as uc,ag as tg,ah as Ei,ai as au,aj as ng,ak as Cr,al as Co,am as Tn,an as ur,ao as cc,ap as rg,aq as ig,ar as og,as as ag,at as hd,au as fd,av as ga,aw as Ao,ax as sg,ay as cr,az as dd,aA as $s,aB as lg,aC as ug,aD as cg,aE as su,aF as pd,aG as md,aH as Io,aI as gd,aJ as lu,aK as vd,aL as Po,aM as yd,aN as Ko,aO as hg,aP as fg,aQ as hc,aR as Ue,n as Yr,aS as dg,aT as Hs,aU as _d,aV as pg,aW as _i,aX as xd,aY as En,aZ as mg,a_ as gg,a$ as vg,b0 as Ci,b1 as mn,b2 as yg,b3 as _g,b4 as bd,b5 as xg,b6 as bg,b7 as wg,b8 as va,b9 as Tg,ba as wd,bb as Sg,bc as Eg,bd as Cg,be as Ag,bf as Ig,bg as ya,bh as Pg,bi as Mg,bj as kg,bk as fc,bl as Og,bm as dc,bn as pc,bo as mc,bp as Rg,bq as Fg,br as Lg,bs as Zo,bt as Zr,bu as Cn,bv as Jr,bw as Ng,bx as Dg,by as Bg,bz as xi,bA as Br,bB as Td,bC as Un,bD as gr,bE as Sd,bF as Ed,bG as Ug,bH as zg,bI as jg,bJ as Vg,bK as Cd,bL as Qt,bM as Ad,bN as Gg,bO as Id,bP as Pd,bQ as zn,bR as $g,bS as Hg,bT as Xg,bU as _o,bV as Wg,bW as qg,bX as Yg,bY as Kg,bZ as Zg,b_ as _r,b$ as Jg,c0 as Qg,c1 as ev}from"./index-DFlevWxx.js";import{E as tv,a as nv,b as rv,c as iv,d as ov,e as av,f as Md,g as sv,u as lv,h as uv,i as cv,l as hv,j as fv,k as dv,_ as pv}from"./queues-CDqve01H.js";import{V as mv,a as gv,c as vv,b as gc,d as yv,e as vc}from"./index-D3OciMUq.js";import{u as _a}from"./queue-3TmkSyew.js";import{_ as Jo}from"./_plugin-vue_export-helper-DlAUqK2U.js";/*! + * @pixi/constants - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/constants is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */var An;(function(r){r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2"})(An||(An={}));var Ai;(function(r){r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS"})(Ai||(Ai={}));var Mo;(function(r){r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL"})(Mo||(Mo={}));var Ee;(function(r){r[r.NORMAL=0]="NORMAL",r[r.ADD=1]="ADD",r[r.MULTIPLY=2]="MULTIPLY",r[r.SCREEN=3]="SCREEN",r[r.OVERLAY=4]="OVERLAY",r[r.DARKEN=5]="DARKEN",r[r.LIGHTEN=6]="LIGHTEN",r[r.COLOR_DODGE=7]="COLOR_DODGE",r[r.COLOR_BURN=8]="COLOR_BURN",r[r.HARD_LIGHT=9]="HARD_LIGHT",r[r.SOFT_LIGHT=10]="SOFT_LIGHT",r[r.DIFFERENCE=11]="DIFFERENCE",r[r.EXCLUSION=12]="EXCLUSION",r[r.HUE=13]="HUE",r[r.SATURATION=14]="SATURATION",r[r.COLOR=15]="COLOR",r[r.LUMINOSITY=16]="LUMINOSITY",r[r.NORMAL_NPM=17]="NORMAL_NPM",r[r.ADD_NPM=18]="ADD_NPM",r[r.SCREEN_NPM=19]="SCREEN_NPM",r[r.NONE=20]="NONE",r[r.SRC_OVER=0]="SRC_OVER",r[r.SRC_IN=21]="SRC_IN",r[r.SRC_OUT=22]="SRC_OUT",r[r.SRC_ATOP=23]="SRC_ATOP",r[r.DST_OVER=24]="DST_OVER",r[r.DST_IN=25]="DST_IN",r[r.DST_OUT=26]="DST_OUT",r[r.DST_ATOP=27]="DST_ATOP",r[r.ERASE=26]="ERASE",r[r.SUBTRACT=28]="SUBTRACT",r[r.XOR=29]="XOR"})(Ee||(Ee={}));var Ii;(function(r){r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN"})(Ii||(Ii={}));var we;(function(r){r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL"})(we||(we={}));var dr;(function(r){r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z"})(dr||(dr={}));var $e;(function(r){r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT"})($e||($e={}));var ko;(function(r){r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT"})(ko||(ko={}));var Bt;(function(r){r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR"})(Bt||(Bt={}));var Oo;(function(r){r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"})(Oo||(Oo={}));var fn;(function(r){r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL"})(fn||(fn={}));var jn;(function(r){r[r.NPM=0]="NPM",r[r.UNPACK=1]="UNPACK",r[r.PMA=2]="PMA",r[r.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",r[r.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",r[r.PREMULTIPLY_ALPHA=2]="PREMULTIPLY_ALPHA",r[r.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA"})(jn||(jn={}));var nn;(function(r){r[r.NO=0]="NO",r[r.YES=1]="YES",r[r.AUTO=2]="AUTO",r[r.BLEND=0]="BLEND",r[r.CLEAR=1]="CLEAR",r[r.BLIT=2]="BLIT"})(nn||(nn={}));var Ro;(function(r){r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL"})(Ro||(Ro={}));var Ut;(function(r){r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp"})(Ut||(Ut={}));var mt;(function(r){r[r.NONE=0]="NONE",r[r.SCISSOR=1]="SCISSOR",r[r.STENCIL=2]="STENCIL",r[r.SPRITE=3]="SPRITE",r[r.COLOR=4]="COLOR"})(mt||(mt={}));var yc;(function(r){r[r.RED=1]="RED",r[r.GREEN=2]="GREEN",r[r.BLUE=4]="BLUE",r[r.ALPHA=8]="ALPHA"})(yc||(yc={}));var dt;(function(r){r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH"})(dt||(dt={}));var cn;(function(r){r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER"})(cn||(cn={}));/*! + * @pixi/settings - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/settings is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */var _v={createCanvas:function(r,e){var t=document.createElement("canvas");return t.width=r,t.height=e,t},getWebGLRenderingContext:function(){return WebGLRenderingContext},getNavigator:function(){return navigator},getBaseUrl:function(){var r;return(r=document.baseURI)!==null&&r!==void 0?r:window.location.href},fetch:function(r,e){return fetch(r,e)}},xa=/iPhone/i,_c=/iPod/i,xc=/iPad/i,bc=/\biOS-universal(?:.+)Mac\b/i,ba=/\bAndroid(?:.+)Mobile\b/i,wc=/Android/i,Ar=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,ji=/Silk/i,vn=/Windows Phone/i,Tc=/\bWindows(?:.+)ARM\b/i,Sc=/BlackBerry/i,Ec=/BB10/i,Cc=/Opera Mini/i,Ac=/\b(CriOS|Chrome)(?:.+)Mobile/i,Ic=/Mobile(?:.+)Firefox\b/i,Pc=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"};function xv(r){return function(e){return e.test(r)}}function bv(r){var e={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator<"u"?e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?e.userAgent=r:r&&r.userAgent&&(e={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var t=e.userAgent,n=t.split("[FBAN");typeof n[1]<"u"&&(t=n[0]),n=t.split("Twitter"),typeof n[1]<"u"&&(t=n[0]);var i=xv(t),o={apple:{phone:i(xa)&&!i(vn),ipod:i(_c),tablet:!i(xa)&&(i(xc)||Pc(e))&&!i(vn),universal:i(bc),device:(i(xa)||i(_c)||i(xc)||i(bc)||Pc(e))&&!i(vn)},amazon:{phone:i(Ar),tablet:!i(Ar)&&i(ji),device:i(Ar)||i(ji)},android:{phone:!i(vn)&&i(Ar)||!i(vn)&&i(ba),tablet:!i(vn)&&!i(Ar)&&!i(ba)&&(i(ji)||i(wc)),device:!i(vn)&&(i(Ar)||i(ji)||i(ba)||i(wc))||i(/\bokhttp\b/i)},windows:{phone:i(vn),tablet:i(Tc),device:i(vn)||i(Tc)},other:{blackberry:i(Sc),blackberry10:i(Ec),opera:i(Cc),firefox:i(Ic),chrome:i(Ac),device:i(Sc)||i(Ec)||i(Cc)||i(Ic)||i(Ac)},any:!1,phone:!1,tablet:!1};return o.any=o.apple.device||o.android.device||o.windows.device||o.other.device,o.phone=o.apple.phone||o.android.phone||o.windows.phone,o.tablet=o.apple.tablet||o.android.tablet||o.windows.tablet,o}var hr=bv(globalThis.navigator);function wv(){return!hr.apple.device}function Tv(r){var e=!0;if(hr.tablet||hr.phone){if(hr.apple.device){var t=navigator.userAgent.match(/OS (\d+)_(\d+)?/);if(t){var n=parseInt(t[1],10);n<11&&(e=!1)}}if(hr.android.device){var t=navigator.userAgent.match(/Android\s([0-9.]*)/);if(t){var n=parseInt(t[1],10);n<7&&(e=!1)}}}return e?r:4}var Te={ADAPTER:_v,MIPMAP_TEXTURES:fn.POW2,ANISOTROPIC_LEVEL:0,RESOLUTION:1,FILTER_RESOLUTION:1,FILTER_MULTISAMPLE:dt.NONE,SPRITE_MAX_TEXTURES:Tv(32),SPRITE_BATCH_SIZE:4096,RENDER_OPTIONS:{view:null,width:800,height:600,autoDensity:!1,backgroundColor:0,backgroundAlpha:1,useContextAlpha:!0,clearBeforeRender:!0,antialias:!1,preserveDrawingBuffer:!1},GC_MODE:Ro.AUTO,GC_MAX_IDLE:60*60,GC_MAX_CHECK_COUNT:60*10,WRAP_MODE:Oo.CLAMP,SCALE_MODE:Bt.LINEAR,PRECISION_VERTEX:Ut.HIGH,PRECISION_FRAGMENT:hr.apple.device?Ut.HIGH:Ut.MEDIUM,CAN_UPLOAD_SAME_BUFFER:wv(),CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1},wa={exports:{}},Mc;function Sv(){return Mc||(Mc=1,function(r){var e=Object.prototype.hasOwnProperty,t="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(t=!1));function i(l,u,c){this.fn=l,this.context=u,this.once=c||!1}function o(l,u,c,h,p){if(typeof c!="function")throw new TypeError("The listener must be a function");var f=new i(c,h||l,p),g=t?t+u:u;return l._events[g]?l._events[g].fn?l._events[g]=[l._events[g],f]:l._events[g].push(f):(l._events[g]=f,l._eventsCount++),l}function a(l,u){--l._eventsCount===0?l._events=new n:delete l._events[u]}function s(){this._events=new n,this._eventsCount=0}s.prototype.eventNames=function(){var u=[],c,h;if(this._eventsCount===0)return u;for(h in c=this._events)e.call(c,h)&&u.push(t?h.slice(1):h);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(c)):u},s.prototype.listeners=function(u){var c=t?t+u:u,h=this._events[c];if(!h)return[];if(h.fn)return[h.fn];for(var p=0,f=h.length,g=new Array(f);p80*N){k=Q=R[0],ee=ue=R[1];for(var B=N;BQ&&(Q=de),ne>ue&&(ue=ne);O=Math.max(Q-k,ue-ee),O=O!==0?32767/O:0}return n(D,j,N,k,ee,O,0),j}function e(R,L,N,$,P){var D,j;if(P===G(R,L,N,$)>0)for(D=L;D=L;D-=$)j=S(D,R[D],R[D+1],j);return j&&E(j,j.next)&&(X(j),j=j.next),j}function t(R,L){if(!R)return R;L||(L=R);var N=R,$;do if($=!1,!N.steiner&&(E(N,N.next)||_(N.prev,N,N.next)===0)){if(X(N),N=L=N.prev,N===N.next)break;$=!0}else N=N.next;while($||N!==L);return L}function n(R,L,N,$,P,D,j){if(R){!j&&D&&f(R,$,P,D);for(var k=R,ee,Q;R.prev!==R.next;){if(ee=R.prev,Q=R.next,D?o(R,$,P,D):i(R)){L.push(ee.i/N|0),L.push(R.i/N|0),L.push(Q.i/N|0),X(R),R=Q.next,k=Q.next;continue}if(R=Q,R===k){j?j===1?(R=a(t(R),L,N),n(R,L,N,$,P,D,2)):j===2&&s(R,L,N,$,P,D):n(t(R),L,N,$,P,D,1);break}}}}function i(R){var L=R.prev,N=R,$=R.next;if(_(L,N,$)>=0)return!1;for(var P=L.x,D=N.x,j=$.x,k=L.y,ee=N.y,Q=$.y,ue=PD?P>j?P:j:D>j?D:j,O=k>ee?k>Q?k:Q:ee>Q?ee:Q,B=$.next;B!==L;){if(B.x>=ue&&B.x<=ne&&B.y>=de&&B.y<=O&&m(P,k,D,ee,j,Q,B.x,B.y)&&_(B.prev,B,B.next)>=0)return!1;B=B.next}return!0}function o(R,L,N,$){var P=R.prev,D=R,j=R.next;if(_(P,D,j)>=0)return!1;for(var k=P.x,ee=D.x,Q=j.x,ue=P.y,de=D.y,ne=j.y,O=kee?k>Q?k:Q:ee>Q?ee:Q,oe=ue>de?ue>ne?ue:ne:de>ne?de:ne,ie=v(O,B,L,N,$),T=v(W,oe,L,N,$),J=R.prevZ,H=R.nextZ;J&&J.z>=ie&&H&&H.z<=T;){if(J.x>=O&&J.x<=W&&J.y>=B&&J.y<=oe&&J!==P&&J!==j&&m(k,ue,ee,de,Q,ne,J.x,J.y)&&_(J.prev,J,J.next)>=0||(J=J.prevZ,H.x>=O&&H.x<=W&&H.y>=B&&H.y<=oe&&H!==P&&H!==j&&m(k,ue,ee,de,Q,ne,H.x,H.y)&&_(H.prev,H,H.next)>=0))return!1;H=H.nextZ}for(;J&&J.z>=ie;){if(J.x>=O&&J.x<=W&&J.y>=B&&J.y<=oe&&J!==P&&J!==j&&m(k,ue,ee,de,Q,ne,J.x,J.y)&&_(J.prev,J,J.next)>=0)return!1;J=J.prevZ}for(;H&&H.z<=T;){if(H.x>=O&&H.x<=W&&H.y>=B&&H.y<=oe&&H!==P&&H!==j&&m(k,ue,ee,de,Q,ne,H.x,H.y)&&_(H.prev,H,H.next)>=0)return!1;H=H.nextZ}return!0}function a(R,L,N){var $=R;do{var P=$.prev,D=$.next.next;!E(P,D)&&x(P,$,$.next,D)&&M(P,D)&&M(D,P)&&(L.push(P.i/N|0),L.push($.i/N|0),L.push(D.i/N|0),X($),X($.next),$=R=D),$=$.next}while($!==R);return t($)}function s(R,L,N,$,P,D){var j=R;do{for(var k=j.next.next;k!==j.prev;){if(j.i!==k.i&&y(j,k)){var ee=F(j,k);j=t(j,j.next),ee=t(ee,ee.next),n(j,L,N,$,P,D,0),n(ee,L,N,$,P,D,0);return}k=k.next}j=j.next}while(j!==R)}function l(R,L,N,$){var P=[],D,j,k,ee,Q;for(D=0,j=L.length;D=N.next.y&&N.next.y!==N.y){var k=N.x+(P-N.y)*(N.next.x-N.x)/(N.next.y-N.y);if(k<=$&&k>D&&(D=k,j=N.x=N.x&&N.x>=Q&&$!==N.x&&m(Pj.x||N.x===j.x&&p(j,N)))&&(j=N,de=ne)),N=N.next;while(N!==ee);return j}function p(R,L){return _(R.prev,R,L.prev)<0&&_(L.next,R,R.next)<0}function f(R,L,N,$){var P=R;do P.z===0&&(P.z=v(P.x,P.y,L,N,$)),P.prevZ=P.prev,P.nextZ=P.next,P=P.next;while(P!==R);P.prevZ.nextZ=null,P.prevZ=null,g(P)}function g(R){var L,N,$,P,D,j,k,ee,Q=1;do{for(N=R,R=null,D=null,j=0;N;){for(j++,$=N,k=0,L=0;L0||ee>0&&$;)k!==0&&(ee===0||!$||N.z<=$.z)?(P=N,N=N.nextZ,k--):(P=$,$=$.nextZ,ee--),D?D.nextZ=P:R=P,P.prevZ=D,D=P;N=$}D.nextZ=null,Q*=2}while(j>1);return R}function v(R,L,N,$,P){return R=(R-N)*P|0,L=(L-$)*P|0,R=(R|R<<8)&16711935,R=(R|R<<4)&252645135,R=(R|R<<2)&858993459,R=(R|R<<1)&1431655765,L=(L|L<<8)&16711935,L=(L|L<<4)&252645135,L=(L|L<<2)&858993459,L=(L|L<<1)&1431655765,R|L<<1}function d(R){var L=R,N=R;do(L.x=(R-j)*(D-k)&&(R-j)*($-k)>=(N-j)*(L-k)&&(N-j)*(D-k)>=(P-j)*($-k)}function y(R,L){return R.next.i!==L.i&&R.prev.i!==L.i&&!A(R,L)&&(M(R,L)&&M(L,R)&&I(R,L)&&(_(R.prev,R,L.prev)||_(R,L.prev,L))||E(R,L)&&_(R.prev,R,R.next)>0&&_(L.prev,L,L.next)>0)}function _(R,L,N){return(L.y-R.y)*(N.x-L.x)-(L.x-R.x)*(N.y-L.y)}function E(R,L){return R.x===L.x&&R.y===L.y}function x(R,L,N,$){var P=C(_(R,L,N)),D=C(_(R,L,$)),j=C(_(N,$,R)),k=C(_(N,$,L));return!!(P!==D&&j!==k||P===0&&b(R,N,L)||D===0&&b(R,$,L)||j===0&&b(N,R,$)||k===0&&b(N,L,$))}function b(R,L,N){return L.x<=Math.max(R.x,N.x)&&L.x>=Math.min(R.x,N.x)&&L.y<=Math.max(R.y,N.y)&&L.y>=Math.min(R.y,N.y)}function C(R){return R>0?1:R<0?-1:0}function A(R,L){var N=R;do{if(N.i!==R.i&&N.next.i!==R.i&&N.i!==L.i&&N.next.i!==L.i&&x(N,N.next,R,L))return!0;N=N.next}while(N!==R);return!1}function M(R,L){return _(R.prev,R,R.next)<0?_(R,L,R.next)>=0&&_(R,R.prev,L)>=0:_(R,L,R.prev)<0||_(R,R.next,L)<0}function I(R,L){var N=R,$=!1,P=(R.x+L.x)/2,D=(R.y+L.y)/2;do N.y>D!=N.next.y>D&&N.next.y!==N.y&&P<(N.next.x-N.x)*(D-N.y)/(N.next.y-N.y)+N.x&&($=!$),N=N.next;while(N!==R);return $}function F(R,L){var N=new w(R.i,R.x,R.y),$=new w(L.i,L.x,L.y),P=R.next,D=L.prev;return R.next=L,L.prev=R,N.next=P,P.prev=N,$.next=N,N.prev=$,D.next=$,$.prev=D,$}function S(R,L,N,$){var P=new w(R,L,N);return $?(P.next=$.next,P.prev=$,$.next.prev=P,$.next=P):(P.prev=P,P.next=P),P}function X(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 w(R,L,N){this.i=R,this.x=L,this.y=N,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}r.deviation=function(R,L,N,$){var P=L&&L.length,D=P?L[0]*N:R.length,j=Math.abs(G(R,0,D,N));if(P)for(var k=0,ee=L.length;k0&&($+=R[P-1].length,N.holes.push($))}return N},Vi.exports}Cv();var Wn={},di={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */var Av=di.exports,Oc;function Iv(){return Oc||(Oc=1,function(r,e){(function(t){var n=e&&!e.nodeType&&e,i=!r.nodeType&&r,o=typeof Nn=="object"&&Nn;(o.global===o||o.window===o||o.self===o)&&(t=o);var a,s=2147483647,l=36,u=1,c=26,h=38,p=700,f=72,g=128,v="-",d=/^xn--/,m=/[^\x20-\x7E]/,y=/[\x2E\u3002\uFF0E\uFF61]/g,_={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},E=l-u,x=Math.floor,b=String.fromCharCode,C;function A(P){throw new RangeError(_[P])}function M(P,D){for(var j=P.length,k=[];j--;)k[j]=D(P[j]);return k}function I(P,D){var j=P.split("@"),k="";j.length>1&&(k=j[0]+"@",P=j[1]),P=P.replace(y,".");var ee=P.split("."),Q=M(ee,D).join(".");return k+Q}function F(P){for(var D=[],j=0,k=P.length,ee,Q;j=55296&&ee<=56319&&j65535&&(D-=65536,j+=b(D>>>10&1023|55296),D=56320|D&1023),j+=b(D),j}).join("")}function X(P){return P-48<10?P-22:P-65<26?P-65:P-97<26?P-97:l}function w(P,D){return P+22+75*(P<26)-((D!=0)<<5)}function G(P,D,j){var k=0;for(P=j?x(P/p):P>>1,P+=x(P/D);P>E*c>>1;k+=l)P=x(P/E);return x(k+(E+1)*P/(P+h))}function R(P){var D=[],j=P.length,k,ee=0,Q=g,ue=f,de,ne,O,B,W,oe,ie,T,J;for(de=P.lastIndexOf(v),de<0&&(de=0),ne=0;ne=128&&A("not-basic"),D.push(P.charCodeAt(ne));for(O=de>0?de+1:0;O=j&&A("invalid-input"),ie=X(P.charCodeAt(O++)),(ie>=l||ie>x((s-ee)/W))&&A("overflow"),ee+=ie*W,T=oe<=ue?u:oe>=ue+c?c:oe-ue,!(iex(s/J)&&A("overflow"),W*=J;k=D.length+1,ue=G(ee-B,k,B==0),x(ee/k)>s-Q&&A("overflow"),Q+=x(ee/k),ee%=k,D.splice(ee++,0,Q)}return S(D)}function L(P){var D,j,k,ee,Q,ue,de,ne,O,B,W,oe=[],ie,T,J,H;for(P=F(P),ie=P.length,D=g,j=0,Q=f,ue=0;ue=D&&Wx((s-j)/T)&&A("overflow"),j+=(de-D)*T,D=de,ue=0;ues&&A("overflow"),W==D){for(ne=j,O=l;B=O<=Q?u:O>=Q+c?c:O-Q,!(ne"u"||!v?r:v(Uint8Array),y={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?r:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?r:ArrayBuffer,"%ArrayIteratorPrototype%":f&&v?v([][Symbol.iterator]()):r,"%AsyncFromSyncIteratorPrototype%":r,"%AsyncFunction%":d,"%AsyncGenerator%":d,"%AsyncGeneratorFunction%":d,"%AsyncIteratorPrototype%":d,"%Atomics%":typeof Atomics>"u"?r:Atomics,"%BigInt%":typeof BigInt>"u"?r:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?r:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?r:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?r:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":e,"%eval%":eval,"%EvalError%":t,"%Float32Array%":typeof Float32Array>"u"?r:Float32Array,"%Float64Array%":typeof Float64Array>"u"?r:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?r:FinalizationRegistry,"%Function%":l,"%GeneratorFunction%":d,"%Int8Array%":typeof Int8Array>"u"?r:Int8Array,"%Int16Array%":typeof Int16Array>"u"?r:Int16Array,"%Int32Array%":typeof Int32Array>"u"?r:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":f&&v?v(v([][Symbol.iterator]())):r,"%JSON%":typeof JSON=="object"?JSON:r,"%Map%":typeof Map>"u"?r:Map,"%MapIteratorPrototype%":typeof Map>"u"||!f||!v?r:v(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?r:Promise,"%Proxy%":typeof Proxy>"u"?r:Proxy,"%RangeError%":n,"%ReferenceError%":i,"%Reflect%":typeof Reflect>"u"?r:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?r:Set,"%SetIteratorPrototype%":typeof Set>"u"||!f||!v?r:v(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?r:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":f&&v?v(""[Symbol.iterator]()):r,"%Symbol%":f?Symbol:r,"%SyntaxError%":o,"%ThrowTypeError%":p,"%TypedArray%":m,"%TypeError%":a,"%Uint8Array%":typeof Uint8Array>"u"?r:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?r:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?r:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?r:Uint32Array,"%URIError%":s,"%WeakMap%":typeof WeakMap>"u"?r:WeakMap,"%WeakRef%":typeof WeakRef>"u"?r:WeakRef,"%WeakSet%":typeof WeakSet>"u"?r:WeakSet};if(v)try{null.error}catch(L){var _=v(v(L));y["%Error.prototype%"]=_}var E=function L(N){var $;if(N==="%AsyncFunction%")$=u("async function () {}");else if(N==="%GeneratorFunction%")$=u("function* () {}");else if(N==="%AsyncGeneratorFunction%")$=u("async function* () {}");else if(N==="%AsyncGenerator%"){var P=L("%AsyncGeneratorFunction%");P&&($=P.prototype)}else if(N==="%AsyncIteratorPrototype%"){var D=L("%AsyncGenerator%");D&&v&&($=v(D.prototype))}return y[N]=$,$},x={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},b=uu(),C=Bv(),A=b.call(Function.call,Array.prototype.concat),M=b.call(Function.apply,Array.prototype.splice),I=b.call(Function.call,String.prototype.replace),F=b.call(Function.call,String.prototype.slice),S=b.call(Function.call,RegExp.prototype.exec),X=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,w=/\\(\\)?/g,G=function(N){var $=F(N,0,1),P=F(N,-1);if($==="%"&&P!=="%")throw new o("invalid intrinsic syntax, expected closing `%`");if(P==="%"&&$!=="%")throw new o("invalid intrinsic syntax, expected opening `%`");var D=[];return I(N,X,function(j,k,ee,Q){D[D.length]=ee?I(Q,w,"$1"):k||j}),D},R=function(N,$){var P=N,D;if(C(x,P)&&(D=x[P],P="%"+D[0]+"%"),C(y,P)){var j=y[P];if(j===d&&(j=E(P)),typeof j>"u"&&!$)throw new a("intrinsic "+N+" exists, but is not available. Please file an issue!");return{alias:D,name:P,value:j}}throw new o("intrinsic "+N+" does not exist!")};return Na=function(N,$){if(typeof N!="string"||N.length===0)throw new a("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof $!="boolean")throw new a('"allowMissing" argument must be a boolean');if(S(/^%?[^%]*%?$/,N)===null)throw new o("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var P=G(N),D=P.length>0?P[0]:"",j=R("%"+D+"%",$),k=j.name,ee=j.value,Q=!1,ue=j.alias;ue&&(D=ue[0],M(P,A([0,1],ue)));for(var de=1,ne=!0;de=P.length){var oe=c(ee,O);ne=!!oe,ne&&"get"in oe&&!("originalValue"in oe.get)?ee=oe.get:ee=ee[O]}else ne=C(ee,O),ee=ee[O];ne&&!Q&&(y[k]=ee)}}return ee},Na}var Da={exports:{}},Ba,Wc;function cu(){if(Wc)return Ba;Wc=1;var r=Qr(),e=r("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return Ba=e,Ba}var Ua,qc;function Od(){if(qc)return Ua;qc=1;var r=Qr(),e=r("%Object.getOwnPropertyDescriptor%",!0);if(e)try{e([],"length")}catch{e=null}return Ua=e,Ua}var za,Yc;function Uv(){if(Yc)return za;Yc=1;var r=cu(),e=kd(),t=Fi(),n=Od();return za=function(o,a,s){if(!o||typeof o!="object"&&typeof o!="function")throw new t("`obj` must be an object or a function`");if(typeof a!="string"&&typeof a!="symbol")throw new t("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new t("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new t("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new t("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new t("`loose`, if provided, must be a boolean");var l=arguments.length>3?arguments[3]:null,u=arguments.length>4?arguments[4]:null,c=arguments.length>5?arguments[5]:null,h=arguments.length>6?arguments[6]:!1,p=!!n&&n(o,a);if(r)r(o,a,{configurable:c===null&&p?p.configurable:!c,enumerable:l===null&&p?p.enumerable:!l,value:s,writable:u===null&&p?p.writable:!u});else if(h||!l&&!u&&!c)o[a]=s;else throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},za}var ja,Kc;function zv(){if(Kc)return ja;Kc=1;var r=cu(),e=function(){return!!r};return e.hasArrayLengthDefineBug=function(){if(!r)return null;try{return r([],"length",{value:1}).length!==1}catch{return!0}},ja=e,ja}var Va,Zc;function jv(){if(Zc)return Va;Zc=1;var r=Qr(),e=Uv(),t=zv()(),n=Od(),i=Fi(),o=r("%Math.floor%");return Va=function(s,l){if(typeof s!="function")throw new i("`fn` is not a function");if(typeof l!="number"||l<0||l>4294967295||o(l)!==l)throw new i("`length` must be a positive 32-bit integer");var u=arguments.length>2&&!!arguments[2],c=!0,h=!0;if("length"in s&&n){var p=n(s,"length");p&&!p.configurable&&(c=!1),p&&!p.writable&&(h=!1)}return(c||h||!u)&&(t?e(s,"length",l,!0,!0):e(s,"length",l)),s},Va}var Jc;function Vv(){return Jc||(Jc=1,function(r){var e=uu(),t=Qr(),n=jv(),i=Fi(),o=t("%Function.prototype.apply%"),a=t("%Function.prototype.call%"),s=t("%Reflect.apply%",!0)||e.call(a,o),l=cu(),u=t("%Math.max%");r.exports=function(p){if(typeof p!="function")throw new i("a function is required");var f=s(e,a,arguments);return n(f,1+u(0,p.length-(arguments.length-1)),!0)};var c=function(){return s(e,o,arguments)};l?l(r.exports,"apply",{value:c}):r.exports.apply=c}(Da)),Da.exports}var Ga,Qc;function Gv(){if(Qc)return Ga;Qc=1;var r=Qr(),e=Vv(),t=e(r("String.prototype.indexOf"));return Ga=function(i,o){var a=r(i,!!o);return typeof a=="function"&&t(i,".prototype.")>-1?e(a):a},Ga}const $v={},Hv=Object.freeze(Object.defineProperty({__proto__:null,default:$v},Symbol.toStringTag,{value:"Module"})),Xv=Vm(Hv);var $a,eh;function Wv(){if(eh)return $a;eh=1;var r=typeof Map=="function"&&Map.prototype,e=Object.getOwnPropertyDescriptor&&r?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,t=r&&e&&typeof e.get=="function"?e.get:null,n=r&&Map.prototype.forEach,i=typeof Set=="function"&&Set.prototype,o=Object.getOwnPropertyDescriptor&&i?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,a=i&&o&&typeof o.get=="function"?o.get:null,s=i&&Set.prototype.forEach,l=typeof WeakMap=="function"&&WeakMap.prototype,u=l?WeakMap.prototype.has:null,c=typeof WeakSet=="function"&&WeakSet.prototype,h=c?WeakSet.prototype.has:null,p=typeof WeakRef=="function"&&WeakRef.prototype,f=p?WeakRef.prototype.deref:null,g=Boolean.prototype.valueOf,v=Object.prototype.toString,d=Function.prototype.toString,m=String.prototype.match,y=String.prototype.slice,_=String.prototype.replace,E=String.prototype.toUpperCase,x=String.prototype.toLowerCase,b=RegExp.prototype.test,C=Array.prototype.concat,A=Array.prototype.join,M=Array.prototype.slice,I=Math.floor,F=typeof BigInt=="function"?BigInt.prototype.valueOf:null,S=Object.getOwnPropertySymbols,X=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,w=typeof Symbol=="function"&&typeof Symbol.iterator=="object",G=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===w||!0)?Symbol.toStringTag:null,R=Object.prototype.propertyIsEnumerable,L=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(U){return U.__proto__}:null);function N(U,q){if(U===1/0||U===-1/0||U!==U||U&&U>-1e3&&U<1e3||b.call(/e/,q))return q;var ve=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof U=="number"){var be=U<0?-I(-U):I(U);if(be!==U){var Le=String(be),Se=y.call(q,Le.length+1);return _.call(Le,ve,"$&_")+"."+_.call(_.call(Se,/([0-9]{3})/g,"$&_"),/_$/,"")}}return _.call(q,ve,"$&_")}var $=Xv,P=$.custom,D=ie(P)?P:null,j={__proto__:null,double:'"',single:"'"},k={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};$a=function U(q,ve,be,Le){var Se=ve||{};if(H(Se,"quoteStyle")&&!H(j,Se.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(H(Se,"maxStringLength")&&(typeof Se.maxStringLength=="number"?Se.maxStringLength<0&&Se.maxStringLength!==1/0:Se.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var Ct=H(Se,"customInspect")?Se.customInspect:!0;if(typeof Ct!="boolean"&&Ct!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(H(Se,"indent")&&Se.indent!==null&&Se.indent!==" "&&!(parseInt(Se.indent,10)===Se.indent&&Se.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(H(Se,"numericSeparator")&&typeof Se.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var At=Se.numericSeparator;if(typeof q>"u")return"undefined";if(q===null)return"null";if(typeof q=="boolean")return q?"true":"false";if(typeof q=="string")return re(q,Se);if(typeof q=="number"){if(q===0)return 1/0/q>0?"0":"-0";var We=String(q);return At?N(q,We):We}if(typeof q=="bigint"){var xt=String(q)+"n";return At?N(q,xt):xt}var gn=typeof Se.depth>"u"?5:Se.depth;if(typeof be>"u"&&(be=0),be>=gn&&gn>0&&typeof q=="object")return ue(q)?"[Array]":"[Object]";var $t=tt(Se,be);if(typeof Le>"u")Le=[];else if(Z(Le,q)>=0)return"[Circular]";function wt(Er,zi,Um){if(zi&&(Le=M.call(Le),Le.push(zi)),Um){var ac={depth:Se.depth};return H(Se,"quoteStyle")&&(ac.quoteStyle=Se.quoteStyle),U(Er,ac,be+1,Le)}return U(Er,Se,be+1,Le)}if(typeof q=="function"&&!ne(q)){var Xn=V(q),ec=ht(q,wt);return"[Function"+(Xn?": "+Xn:" (anonymous)")+"]"+(ec.length>0?" { "+A.call(ec,", ")+" }":"")}if(ie(q)){var tc=w?_.call(String(q),/^(Symbol\(.*\))_[^)]*$/,"$1"):X.call(q);return typeof q=="object"&&!w?me(tc):tc}if(pe(q)){for(var ri="<"+x.call(String(q.nodeName)),ua=q.attributes||[],Ui=0;Ui",ri}if(ue(q)){if(q.length===0)return"[]";var ca=ht(q,wt);return $t&&!Xe(ca)?"["+ke(ca,$t)+"]":"[ "+A.call(ca,", ")+" ]"}if(O(q)){var ha=ht(q,wt);return!("cause"in Error.prototype)&&"cause"in q&&!R.call(q,"cause")?"{ ["+String(q)+"] "+A.call(C.call("[cause]: "+wt(q.cause),ha),", ")+" }":ha.length===0?"["+String(q)+"]":"{ ["+String(q)+"] "+A.call(ha,", ")+" }"}if(typeof q=="object"&&Ct){if(D&&typeof q[D]=="function"&&$)return $(q,{depth:gn-be});if(Ct!=="symbol"&&typeof q.inspect=="function")return q.inspect()}if(ae(q)){var nc=[];return n&&n.call(q,function(Er,zi){nc.push(wt(zi,q,!0)+" => "+wt(Er,q))}),Ce("Map",t.call(q),nc,$t)}if(he(q)){var rc=[];return s&&s.call(q,function(Er){rc.push(wt(Er,q))}),Ce("Set",a.call(q),rc,$t)}if(se(q))return xe("WeakMap");if(ye(q))return xe("WeakSet");if(te(q))return xe("WeakRef");if(W(q))return me(wt(Number(q)));if(T(q))return me(wt(F.call(q)));if(oe(q))return me(g.call(q));if(B(q))return me(wt(String(q)));if(typeof window<"u"&&q===window)return"{ [object Window] }";if(typeof globalThis<"u"&&q===globalThis||typeof Nn<"u"&&q===Nn)return"{ [object globalThis] }";if(!de(q)&&!ne(q)){var fa=ht(q,wt),ic=L?L(q)===Object.prototype:q instanceof Object||q.constructor===Object,da=q instanceof Object?"":"null prototype",oc=!ic&&G&&Object(q)===q&&G in q?y.call(z(q),8,-1):da?"Object":"",Bm=ic||typeof q.constructor!="function"?"":q.constructor.name?q.constructor.name+" ":"",pa=Bm+(oc||da?"["+A.call(C.call([],oc||[],da||[]),": ")+"] ":"");return fa.length===0?pa+"{}":$t?pa+"{"+ke(fa,$t)+"}":pa+"{ "+A.call(fa,", ")+" }"}return String(q)};function ee(U,q,ve){var be=ve.quoteStyle||q,Le=j[be];return Le+U+Le}function Q(U){return _.call(String(U),/"/g,""")}function ue(U){return z(U)==="[object Array]"&&(!G||!(typeof U=="object"&&G in U))}function de(U){return z(U)==="[object Date]"&&(!G||!(typeof U=="object"&&G in U))}function ne(U){return z(U)==="[object RegExp]"&&(!G||!(typeof U=="object"&&G in U))}function O(U){return z(U)==="[object Error]"&&(!G||!(typeof U=="object"&&G in U))}function B(U){return z(U)==="[object String]"&&(!G||!(typeof U=="object"&&G in U))}function W(U){return z(U)==="[object Number]"&&(!G||!(typeof U=="object"&&G in U))}function oe(U){return z(U)==="[object Boolean]"&&(!G||!(typeof U=="object"&&G in U))}function ie(U){if(w)return U&&typeof U=="object"&&U instanceof Symbol;if(typeof U=="symbol")return!0;if(!U||typeof U!="object"||!X)return!1;try{return X.call(U),!0}catch{}return!1}function T(U){if(!U||typeof U!="object"||!F)return!1;try{return F.call(U),!0}catch{}return!1}var J=Object.prototype.hasOwnProperty||function(U){return U in this};function H(U,q){return J.call(U,q)}function z(U){return v.call(U)}function V(U){if(U.name)return U.name;var q=m.call(d.call(U),/^function\s*([\w$]+)/);return q?q[1]:null}function Z(U,q){if(U.indexOf)return U.indexOf(q);for(var ve=0,be=U.length;veq.maxStringLength){var ve=U.length-q.maxStringLength,be="... "+ve+" more character"+(ve>1?"s":"");return re(y.call(U,0,q.maxStringLength),q)+be}var Le=k[q.quoteStyle||"single"];Le.lastIndex=0;var Se=_.call(_.call(U,Le,"\\$1"),/[\x00-\x1f]/g,ce);return ee(Se,"single",q)}function ce(U){var q=U.charCodeAt(0),ve={8:"b",9:"t",10:"n",12:"f",13:"r"}[q];return ve?"\\"+ve:"\\x"+(q<16?"0":"")+E.call(q.toString(16))}function me(U){return"Object("+U+")"}function xe(U){return U+" { ? }"}function Ce(U,q,ve,be){var Le=be?ke(ve,be):A.call(ve,", ");return U+" ("+q+") {"+Le+"}"}function Xe(U){for(var q=0;q=0)return!1;return!0}function tt(U,q){var ve;if(U.indent===" ")ve=" ";else if(typeof U.indent=="number"&&U.indent>0)ve=A.call(Array(U.indent+1)," ");else return null;return{base:ve,prev:A.call(Array(q+1),ve)}}function ke(U,q){if(U.length===0)return"";var ve=` +`+q.prev+q.base;return ve+A.call(U,","+ve)+` +`+q.prev}function ht(U,q){var ve=ue(U),be=[];if(ve){be.length=U.length;for(var Le=0;Le1;){var y=m.pop(),_=y.obj[y.prop];if(t(_)){for(var E=[],x=0;x<_.length;++x)typeof _[x]<"u"&&E.push(_[x]);y.obj[y.prop]=E}}},o=function(m,y){for(var _=y&&y.plainObjects?{__proto__:null}:{},E=0;E=u?b.slice(A,A+u):b,I=[],F=0;F=48&&S<=57||S>=65&&S<=90||S>=97&&S<=122||x===r.RFC1738&&(S===40||S===41)){I[I.length]=M.charAt(F);continue}if(S<128){I[I.length]=n[S];continue}if(S<2048){I[I.length]=n[192|S>>6]+n[128|S&63];continue}if(S<55296||S>=57344){I[I.length]=n[224|S>>12]+n[128|S>>6&63]+n[128|S&63];continue}F+=1,S=65536+((S&1023)<<10|M.charCodeAt(F)&1023),I[I.length]=n[240|S>>18]+n[128|S>>12&63]+n[128|S>>6&63]+n[128|S&63]}C+=I.join("")}return C},h=function(m){for(var y=[{obj:{o:m},prop:"o"}],_=[],E=0;E"u"&&(P=0)}if(typeof M=="function"?N=M(m,N):N instanceof Date?N=S(N):y==="comma"&&o(N)&&(N=e.maybeMap(N,function(J){return J instanceof Date?S(J):J})),N===null){if(x)return A&&!G?A(m,c.encoder,R,"key",X):m;N=""}if(h(N)||e.isBuffer(N)){if(A){var k=G?m:A(m,c.encoder,R,"key",X);return[w(k)+"="+w(A(N,c.encoder,R,"value",X))]}return[w(m)+"="+w(String(N))]}var ee=[];if(typeof N>"u")return ee;var Q;if(y==="comma"&&o(N))G&&A&&(N=e.maybeMap(N,A)),Q=[{value:N.length>0?N.join(",")||null:void 0}];else if(o(M))Q=M;else{var ue=Object.keys(N);Q=I?ue.sort(I):ue}var de=C?String(m).replace(/\./g,"%2E"):String(m),ne=_&&o(N)&&N.length===1?de+"[]":de;if(E&&o(N)&&N.length===0)return ne+"[]";for(var O=0;O"u"?d.encodeDotInKeys===!0?!0:c.allowDots:!!d.allowDots;return{addQueryPrefix:typeof d.addQueryPrefix=="boolean"?d.addQueryPrefix:c.addQueryPrefix,allowDots:b,allowEmptyArrays:typeof d.allowEmptyArrays=="boolean"?!!d.allowEmptyArrays:c.allowEmptyArrays,arrayFormat:x,charset:m,charsetSentinel:typeof d.charsetSentinel=="boolean"?d.charsetSentinel:c.charsetSentinel,commaRoundTrip:!!d.commaRoundTrip,delimiter:typeof d.delimiter>"u"?c.delimiter:d.delimiter,encode:typeof d.encode=="boolean"?d.encode:c.encode,encodeDotInKeys:typeof d.encodeDotInKeys=="boolean"?d.encodeDotInKeys:c.encodeDotInKeys,encoder:typeof d.encoder=="function"?d.encoder:c.encoder,encodeValuesOnly:typeof d.encodeValuesOnly=="boolean"?d.encodeValuesOnly:c.encodeValuesOnly,filter:E,format:y,formatter:_,serializeDate:typeof d.serializeDate=="function"?d.serializeDate:c.serializeDate,skipNulls:typeof d.skipNulls=="boolean"?d.skipNulls:c.skipNulls,sort:typeof d.sort=="function"?d.sort:null,strictNullHandling:typeof d.strictNullHandling=="boolean"?d.strictNullHandling:c.strictNullHandling}};return qa=function(v,d){var m=v,y=g(d),_,E;typeof y.filter=="function"?(E=y.filter,m=E("",m)):o(y.filter)&&(E=y.filter,_=E);var x=[];if(typeof m!="object"||m===null)return"";var b=i[y.arrayFormat],C=b==="comma"&&y.commaRoundTrip;_||(_=Object.keys(m)),y.sort&&_.sort(y.sort);for(var A=r(),M=0;M<_.length;++M){var I=_[M],F=m[I];y.skipNulls&&F===null||s(x,f(F,I,b,C,y.allowEmptyArrays,y.strictNullHandling,y.skipNulls,y.encodeDotInKeys,y.encode?y.encoder:null,y.filter,y.sort,y.allowDots,y.serializeDate,y.format,y.formatter,y.encodeValuesOnly,y.charset,A))}var S=x.join(y.delimiter),X=y.addQueryPrefix===!0?"?":"";return y.charsetSentinel&&(y.charset==="iso-8859-1"?X+="utf8=%26%2310003%3B&":X+="utf8=%E2%9C%93&"),S.length>0?X+S:""},qa}var Ya,oh;function Kv(){if(oh)return Ya;oh=1;var r=Rd(),e=Object.prototype.hasOwnProperty,t=Array.isArray,n={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:r.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1},i=function(p){return p.replace(/&#(\d+);/g,function(f,g){return String.fromCharCode(parseInt(g,10))})},o=function(p,f){return p&&typeof p=="string"&&f.comma&&p.indexOf(",")>-1?p.split(","):p},a="utf8=%26%2310003%3B",s="utf8=%E2%9C%93",l=function(f,g){var v={__proto__:null},d=g.ignoreQueryPrefix?f.replace(/^\?/,""):f;d=d.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var m=g.parameterLimit===1/0?void 0:g.parameterLimit,y=d.split(g.delimiter,m),_=-1,E,x=g.charset;if(g.charsetSentinel)for(E=0;E-1&&(I=t(I)?[I]:I);var F=e.call(v,M);F&&g.duplicates==="combine"?v[M]=r.combine(v[M],I):(!F||g.duplicates==="last")&&(v[M]=I)}return v},u=function(p,f,g,v){for(var d=v?f:o(f,g),m=p.length-1;m>=0;--m){var y,_=p[m];if(_==="[]"&&g.parseArrays)y=g.allowEmptyArrays&&(d===""||g.strictNullHandling&&d===null)?[]:[].concat(d);else{y=g.plainObjects?{__proto__:null}:{};var E=_.charAt(0)==="["&&_.charAt(_.length-1)==="]"?_.slice(1,-1):_,x=g.decodeDotInKeys?E.replace(/%2E/g,"."):E,b=parseInt(x,10);!g.parseArrays&&x===""?y={0:d}:!isNaN(b)&&_!==x&&String(b)===x&&b>=0&&g.parseArrays&&b<=g.arrayLimit?(y=[],y[b]=d):x!=="__proto__"&&(y[x]=d)}d=y}return d},c=function(f,g,v,d){if(f){var m=v.allowDots?f.replace(/\.([^.[]+)/g,"[$1]"):f,y=/(\[[^[\]]*])/,_=/(\[[^[\]]*])/g,E=v.depth>0&&y.exec(m),x=E?m.slice(0,E.index):m,b=[];if(x){if(!v.plainObjects&&e.call(Object.prototype,x)&&!v.allowPrototypes)return;b.push(x)}for(var C=0;v.depth>0&&(E=_.exec(m))!==null&&C"u"?n.charset:f.charset,v=typeof f.duplicates>"u"?n.duplicates:f.duplicates;if(v!=="combine"&&v!=="first"&&v!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var d=typeof f.allowDots>"u"?f.decodeDotInKeys===!0?!0:n.allowDots:!!f.allowDots;return{allowDots:d,allowEmptyArrays:typeof f.allowEmptyArrays=="boolean"?!!f.allowEmptyArrays:n.allowEmptyArrays,allowPrototypes:typeof f.allowPrototypes=="boolean"?f.allowPrototypes:n.allowPrototypes,allowSparse:typeof f.allowSparse=="boolean"?f.allowSparse:n.allowSparse,arrayLimit:typeof f.arrayLimit=="number"?f.arrayLimit:n.arrayLimit,charset:g,charsetSentinel:typeof f.charsetSentinel=="boolean"?f.charsetSentinel:n.charsetSentinel,comma:typeof f.comma=="boolean"?f.comma:n.comma,decodeDotInKeys:typeof f.decodeDotInKeys=="boolean"?f.decodeDotInKeys:n.decodeDotInKeys,decoder:typeof f.decoder=="function"?f.decoder:n.decoder,delimiter:typeof f.delimiter=="string"||r.isRegExp(f.delimiter)?f.delimiter:n.delimiter,depth:typeof f.depth=="number"||f.depth===!1?+f.depth:n.depth,duplicates:v,ignoreQueryPrefix:f.ignoreQueryPrefix===!0,interpretNumericEntities:typeof f.interpretNumericEntities=="boolean"?f.interpretNumericEntities:n.interpretNumericEntities,parameterLimit:typeof f.parameterLimit=="number"?f.parameterLimit:n.parameterLimit,parseArrays:f.parseArrays!==!1,plainObjects:typeof f.plainObjects=="boolean"?f.plainObjects:n.plainObjects,strictDepth:typeof f.strictDepth=="boolean"?!!f.strictDepth:n.strictDepth,strictNullHandling:typeof f.strictNullHandling=="boolean"?f.strictNullHandling:n.strictNullHandling}};return Ya=function(p,f){var g=h(f);if(p===""||p===null||typeof p>"u")return g.plainObjects?{__proto__:null}:{};for(var v=typeof p=="string"?l(p,g):p,d=g.plainObjects?{__proto__:null}:{},m=Object.keys(v),y=0;y",'"',"`"," ","\r",` +`," "],a=["{","}","|","\\","^","`"].concat(o),s=["'"].concat(a),l=["%","/","?",";","#"].concat(s),u=["/","?","#"],c=255,h=/^[+a-z0-9A-Z_-]{0,63}$/,p=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,f={javascript:!0,"javascript:":!0},g={javascript:!0,"javascript:":!0},v={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},d=Zv();function m(x,b,C){if(x&&typeof x=="object"&&x instanceof e)return x;var A=new e;return A.parse(x,b,C),A}e.prototype.parse=function(x,b,C){if(typeof x!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof x);var A=x.indexOf("?"),M=A!==-1&&A127?ue+="x":ue+=Q[de];if(!ue.match(h)){var O=k.slice(0,N),B=k.slice(N+1),W=Q.match(p);W&&(O.push(W[1]),B.unshift(W[2])),B.length&&(S="/"+B.join(".")+S),this.hostname=O.join(".");break}}}this.hostname.length>c?this.hostname="":this.hostname=this.hostname.toLowerCase(),j||(this.hostname=r.toASCII(this.hostname));var oe=this.port?":"+this.port:"",ie=this.hostname||"";this.host=ie+oe,this.href+=this.host,j&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),S[0]!=="/"&&(S="/"+S))}if(!f[G])for(var N=0,ee=s.length;N0?C.host.split("@"):!1;ue&&(C.auth=ue.shift(),C.hostname=ue.shift(),C.host=C.hostname)}return C.search=x.search,C.query=x.query,(C.pathname!==null||C.search!==null)&&(C.path=(C.pathname?C.pathname:"")+(C.search?C.search:"")),C.href=C.format(),C}if(!k.length)return C.pathname=null,C.search?C.path="/"+C.search:C.path=null,C.href=C.format(),C;for(var de=k.slice(-1)[0],ne=(C.host||x.host||k.length>1)&&(de==="."||de==="..")||de==="",O=0,B=k.length;B>=0;B--)de=k[B],de==="."?k.splice(B,1):de===".."?(k.splice(B,1),O++):O&&(k.splice(B,1),O--);if(!D&&!j)for(;O--;O)k.unshift("..");D&&k[0]!==""&&(!k[0]||k[0].charAt(0)!=="/")&&k.unshift(""),ne&&k.join("/").substr(-1)!=="/"&&k.push("");var W=k[0]===""||k[0]&&k[0].charAt(0)==="/";if(Q){C.hostname=W?"":k.length?k.shift():"",C.host=C.hostname;var ue=C.host&&C.host.indexOf("@")>0?C.host.split("@"):!1;ue&&(C.auth=ue.shift(),C.hostname=ue.shift(),C.host=C.hostname)}return D=D||C.host&&k.length,D&&!W&&k.unshift(""),k.length>0?C.pathname=k.join("/"):(C.pathname=null,C.path=null),(C.pathname!==null||C.search!==null)&&(C.path=(C.pathname?C.pathname:"")+(C.search?C.search:"")),C.auth=x.auth||C.auth,C.slashes=C.slashes||x.slashes,C.href=C.format(),C},e.prototype.parseHost=function(){var x=this.host,b=n.exec(x);b&&(b=b[0],b!==":"&&(this.port=b.substr(1)),x=x.substr(0,x.length-b.length)),x&&(this.hostname=x)},Wn.parse=m,Wn.resolve=_,Wn.resolveObject=E,Wn.format=y,Wn.Url=e,Wn}var Za=Jv();/*! + * @pixi/utils - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/utils is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */var Qo={parse:Za.parse,format:Za.format,resolve:Za.resolve};Te.RETINA_PREFIX=/@([0-9\.]+)x/;Te.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var lh=!1,uh="6.5.10";function Qv(r){var e;if(!lh){if(Te.ADAPTER.getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){var t=[` + %c %c %c PixiJS `+uh+" - ✰ "+r+` ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ + +`,"background: #ff66a5; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff66a5; background: #030307; padding:5px 0;","background: #ff66a5; padding:5px 0;","background: #ffc3dc; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;"];(e=globalThis.console).log.apply(e,t)}else globalThis.console&&globalThis.console.log("PixiJS "+uh+" - "+r+" - http://www.pixijs.com/");lh=!0}}var Ja;function ey(){return typeof Ja>"u"&&(Ja=function(){var e={stencil:!0,failIfMajorPerformanceCaveat:Te.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!Te.ADAPTER.getWebGLRenderingContext())return!1;var t=Te.ADAPTER.createCanvas(),n=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),i=!!(n&&n.getContextAttributes().stencil);if(n){var o=n.getExtension("WEBGL_lose_context");o&&o.loseContext()}return n=null,i}catch{return!1}}()),Ja}function en(r,e){return e===void 0&&(e=[]),e[0]=(r>>16&255)/255,e[1]=(r>>8&255)/255,e[2]=(r&255)/255,e}function ty(r){var e=r.toString(16);return e="000000".substring(0,6-e.length)+e,"#"+e}function rn(r){return(r[0]*255<<16)+(r[1]*255<<8)+(r[2]*255|0)}function ny(){for(var r=[],e=[],t=0;t<32;t++)r[t]=t,e[t]=t;r[Ee.NORMAL_NPM]=Ee.NORMAL,r[Ee.ADD_NPM]=Ee.ADD,r[Ee.SCREEN_NPM]=Ee.SCREEN,e[Ee.NORMAL]=Ee.NORMAL_NPM,e[Ee.ADD]=Ee.ADD_NPM,e[Ee.SCREEN]=Ee.SCREEN_NPM;var n=[];return n.push(e),n.push(r),n}var ry=ny();function iy(r,e){if(e===1)return(e*255<<24)+r;if(e===0)return 0;var t=r>>16&255,n=r>>8&255,i=r&255;return t=t*e+.5|0,n=n*e+.5|0,i=i*e+.5|0,(e*255<<24)+(t<<16)+(n<<8)+i}function Fd(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 Fo(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 ch(r){return!(r&r-1)&&!!r}function hh(r){var e=(r>65535?1:0)<<4;r>>>=e;var t=(r>255?1:0)<<3;return r>>>=t,e|=t,t=(r>15?1:0)<<2,r>>>=t,e|=t,t=(r>3?1:0)<<1,r>>>=t,e|=t,e|r>>1}function xo(r,e,t){var n=r.length,i;if(!(e>=n||t===0)){t=e+t>n?n-e:t;var o=n-t;for(i=e;i"u"?console.warn("PixiJS Deprecation Warning: ",e+` +Deprecated since v`+r):(n=n.split(` +`).splice(t).join(` +`),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",e+` +Deprecated since v`+r),console.warn(n),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",e+` +Deprecated since v`+r),console.warn(n))),fh[e]=!0}}var dh={},xn=Object.create(null),qn=Object.create(null);(function(){function r(e,t,n){this.canvas=Te.ADAPTER.createCanvas(),this.context=this.canvas.getContext("2d"),this.resolution=n||Te.RESOLUTION,this.resize(e,t)}return r.prototype.clear=function(){this.context.setTransform(1,0,0,1,0,0),this.context.clearRect(0,0,this.canvas.width,this.canvas.height)},r.prototype.resize=function(e,t){this.canvas.width=Math.round(e*this.resolution),this.canvas.height=Math.round(t*this.resolution)},r.prototype.destroy=function(){this.context=null,this.canvas=null},Object.defineProperty(r.prototype,"width",{get:function(){return this.canvas.width},set:function(e){this.canvas.width=Math.round(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"height",{get:function(){return this.canvas.height},set:function(e){this.canvas.height=Math.round(e)},enumerable:!1,configurable:!0}),r})();var Gi;function ay(r,e){if(e===void 0&&(e=globalThis.location),r.indexOf("data:")===0)return"";e=e||globalThis.location,Gi||(Gi=document.createElement("a")),Gi.href=r;var t=Qo.parse(Gi.href),n=!t.port&&e.port===""||t.port===e.port;return t.hostname!==e.hostname||!n||t.protocol!==e.protocol?"anonymous":""}function ph(r,e){var t=Te.RETINA_PREFIX.exec(r);return t?parseFloat(t[1]):e!==void 0?e:1}/*! + * @pixi/extensions - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/extensions is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var bi=function(){return bi=Object.assign||function(e){for(var t=arguments,n,i=1,o=arguments.length;i8)throw new Error("max arguments reached");var u=this,c=u.name,h=u.items;this._aliasCount++;for(var p=0,f=h.length;p0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))},r.prototype.add=function(e){return e[this._name]&&(this.ensureNonAliasedItems(),this.remove(e),this.items.push(e)),this},r.prototype.remove=function(e){var t=this.items.indexOf(e);return t!==-1&&(this.ensureNonAliasedItems(),this.items.splice(t,1)),this},r.prototype.contains=function(e){return this.items.indexOf(e)!==-1},r.prototype.removeAll=function(){return this.ensureNonAliasedItems(),this.items.length=0,this},r.prototype.destroy=function(){this.removeAll(),this.items=null,this._name=null},Object.defineProperty(r.prototype,"empty",{get:function(){return this.items.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),r}();Object.defineProperties(St.prototype,{dispatch:{value:St.prototype.emit},run:{value:St.prototype.emit}});/*! + * @pixi/ticker - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/ticker is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */Te.TARGET_FPMS=.06;var Mi;(function(r){r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY"})(Mi||(Mi={}));var Qa=function(){function r(e,t,n,i){t===void 0&&(t=null),n===void 0&&(n=0),i===void 0&&(i=!1),this.next=null,this.previous=null,this._destroyed=!1,this.fn=e,this.context=t,this.priority=n,this.once=i}return r.prototype.match=function(e,t){return t===void 0&&(t=null),this.fn===e&&this.context===t},r.prototype.emit=function(e){this.fn&&(this.context?this.fn.call(this.context,e):this.fn(e));var t=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),t},r.prototype.connect=function(e){this.previous=e,e.next&&(e.next.previous=this),this.next=e.next,e.next=this},r.prototype.destroy=function(e){e===void 0&&(e=!1),this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);var t=this.next;return this.next=e?null:t,this.previous=null,t},r}(),wn=function(){function r(){var e=this;this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new Qa(null,null,1/0),this.deltaMS=1/Te.TARGET_FPMS,this.elapsedMS=1/Te.TARGET_FPMS,this._tick=function(t){e._requestId=null,e.started&&(e.update(t),e.started&&e._requestId===null&&e._head.next&&(e._requestId=requestAnimationFrame(e._tick)))}}return r.prototype._requestIfNeeded=function(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))},r.prototype._cancelIfNeeded=function(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)},r.prototype._startIfPossible=function(){this.started?this._requestIfNeeded():this.autoStart&&this.start()},r.prototype.add=function(e,t,n){return n===void 0&&(n=Mi.NORMAL),this._addListener(new Qa(e,t,n))},r.prototype.addOnce=function(e,t,n){return n===void 0&&(n=Mi.NORMAL),this._addListener(new Qa(e,t,n,!0))},r.prototype._addListener=function(e){var t=this._head.next,n=this._head;if(!t)e.connect(n);else{for(;t;){if(e.priority>t.priority){e.connect(n);break}n=t,t=t.next}e.previous||e.connect(n)}return this._startIfPossible(),this},r.prototype.remove=function(e,t){for(var n=this._head.next;n;)n.match(e,t)?n=n.destroy():n=n.next;return this._head.next||this._cancelIfNeeded(),this},Object.defineProperty(r.prototype,"count",{get:function(){if(!this._head)return 0;for(var e=0,t=this._head;t=t.next;)e++;return e},enumerable:!1,configurable:!0}),r.prototype.start=function(){this.started||(this.started=!0,this._requestIfNeeded())},r.prototype.stop=function(){this.started&&(this.started=!1,this._cancelIfNeeded())},r.prototype.destroy=function(){if(!this._protected){this.stop();for(var e=this._head.next;e;)e=e.destroy(!0);this._head.destroy(),this._head=null}},r.prototype.update=function(e){e===void 0&&(e=performance.now());var t;if(e>this.lastTime){if(t=this.elapsedMS=e-this.lastTime,t>this._maxElapsedMS&&(t=this._maxElapsedMS),t*=this.speed,this._minElapsedMS){var n=e-this._lastFrame|0;if(n=this.x&&e=this.y&&te.right?e.right:this.right;if(i<=n)return!1;var o=this.ye.bottom?e.bottom:this.bottom;return a>o}var s=this.left,l=this.right,u=this.top,c=this.bottom;if(l<=s||c<=u)return!1;var h=$i[0].set(e.left,e.top),p=$i[1].set(e.left,e.bottom),f=$i[2].set(e.right,e.top),g=$i[3].set(e.right,e.bottom);if(f.x<=h.x||p.y<=h.y)return!1;var v=Math.sign(t.a*t.d-t.b*t.c);if(v===0||(t.apply(h,h),t.apply(p,p),t.apply(f,f),t.apply(g,g),Math.max(h.x,p.x,f.x,g.x)<=s||Math.min(h.x,p.x,f.x,g.x)>=l||Math.max(h.y,p.y,f.y,g.y)<=u||Math.min(h.y,p.y,f.y,g.y)>=c))return!1;var d=v*(p.y-h.y),m=v*(h.x-p.x),y=d*s+m*u,_=d*l+m*u,E=d*s+m*c,x=d*l+m*c;if(Math.max(y,_,E,x)<=d*h.x+m*h.y||Math.min(y,_,E,x)>=d*g.x+m*g.y)return!1;var b=v*(h.y-f.y),C=v*(f.x-h.x),A=b*s+C*u,M=b*l+C*u,I=b*s+C*c,F=b*l+C*c;return!(Math.max(A,M,I,F)<=b*h.x+C*h.y||Math.min(A,M,I,F)>=b*g.x+C*g.y)},r.prototype.pad=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=e),this.x-=e,this.y-=t,this.width+=e*2,this.height+=t*2,this},r.prototype.fit=function(e){var t=Math.max(this.x,e.x),n=Math.min(this.x+this.width,e.x+e.width),i=Math.max(this.y,e.y),o=Math.min(this.y+this.height,e.y+e.height);return this.x=t,this.width=Math.max(n-t,0),this.y=i,this.height=Math.max(o-i,0),this},r.prototype.ceil=function(e,t){e===void 0&&(e=1),t===void 0&&(t=.001);var n=Math.ceil((this.x+this.width-t)*e)/e,i=Math.ceil((this.y+this.height-t)*e)/e;return this.x=Math.floor((this.x+t)*e)/e,this.y=Math.floor((this.y+t)*e)/e,this.width=n-this.x,this.height=i-this.y,this},r.prototype.enlarge=function(e){var t=Math.min(this.x,e.x),n=Math.max(this.x+this.width,e.x+e.width),i=Math.min(this.y,e.y),o=Math.max(this.y+this.height,e.y+e.height);return this.x=t,this.width=n-t,this.y=i,this.height=o-i,this},r.prototype.toString=function(){return"[@pixi/math:Rectangle x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+"]"},r}(),Dr=function(){function r(e,t,n,i){n===void 0&&(n=0),i===void 0&&(i=0),this._x=n,this._y=i,this.cb=e,this.scope=t}return r.prototype.clone=function(e,t){return e===void 0&&(e=this.cb),t===void 0&&(t=this.scope),new r(e,t,this._x,this._y)},r.prototype.set=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=e),(this._x!==e||this._y!==t)&&(this._x=e,this._y=t,this.cb.call(this.scope)),this},r.prototype.copyFrom=function(e){return(this._x!==e.x||this._y!==e.y)&&(this._x=e.x,this._y=e.y,this.cb.call(this.scope)),this},r.prototype.copyTo=function(e){return e.set(this._x,this._y),e},r.prototype.equals=function(e){return e.x===this._x&&e.y===this._y},r.prototype.toString=function(){return"[@pixi/math:ObservablePoint x=0 y=0 scope="+this.scope+"]"},Object.defineProperty(r.prototype,"x",{get:function(){return this._x},set:function(e){this._x!==e&&(this._x=e,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"y",{get:function(){return this._y},set:function(e){this._y!==e&&(this._y=e,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),r}(),Et=function(){function r(e,t,n,i,o,a){e===void 0&&(e=1),t===void 0&&(t=0),n===void 0&&(n=0),i===void 0&&(i=1),o===void 0&&(o=0),a===void 0&&(a=0),this.array=null,this.a=e,this.b=t,this.c=n,this.d=i,this.tx=o,this.ty=a}return r.prototype.fromArray=function(e){this.a=e[0],this.b=e[1],this.c=e[3],this.d=e[4],this.tx=e[2],this.ty=e[5]},r.prototype.set=function(e,t,n,i,o,a){return this.a=e,this.b=t,this.c=n,this.d=i,this.tx=o,this.ty=a,this},r.prototype.toArray=function(e,t){this.array||(this.array=new Float32Array(9));var n=t||this.array;return e?(n[0]=this.a,n[1]=this.b,n[2]=0,n[3]=this.c,n[4]=this.d,n[5]=0,n[6]=this.tx,n[7]=this.ty,n[8]=1):(n[0]=this.a,n[1]=this.c,n[2]=this.tx,n[3]=this.b,n[4]=this.d,n[5]=this.ty,n[6]=0,n[7]=0,n[8]=1),n},r.prototype.apply=function(e,t){t=t||new st;var n=e.x,i=e.y;return t.x=this.a*n+this.c*i+this.tx,t.y=this.b*n+this.d*i+this.ty,t},r.prototype.applyInverse=function(e,t){t=t||new st;var n=1/(this.a*this.d+this.c*-this.b),i=e.x,o=e.y;return t.x=this.d*n*i+-this.c*n*o+(this.ty*this.c-this.tx*this.d)*n,t.y=this.a*n*o+-this.b*n*i+(-this.ty*this.a+this.tx*this.b)*n,t},r.prototype.translate=function(e,t){return this.tx+=e,this.ty+=t,this},r.prototype.scale=function(e,t){return this.a*=e,this.d*=t,this.c*=e,this.b*=t,this.tx*=e,this.ty*=t,this},r.prototype.rotate=function(e){var t=Math.cos(e),n=Math.sin(e),i=this.a,o=this.c,a=this.tx;return this.a=i*t-this.b*n,this.b=i*n+this.b*t,this.c=o*t-this.d*n,this.d=o*n+this.d*t,this.tx=a*t-this.ty*n,this.ty=a*n+this.ty*t,this},r.prototype.append=function(e){var t=this.a,n=this.b,i=this.c,o=this.d;return this.a=e.a*t+e.b*i,this.b=e.a*n+e.b*o,this.c=e.c*t+e.d*i,this.d=e.c*n+e.d*o,this.tx=e.tx*t+e.ty*i+this.tx,this.ty=e.tx*n+e.ty*o+this.ty,this},r.prototype.setTransform=function(e,t,n,i,o,a,s,l,u){return this.a=Math.cos(s+u)*o,this.b=Math.sin(s+u)*o,this.c=-Math.sin(s-l)*a,this.d=Math.cos(s-l)*a,this.tx=e-(n*this.a+i*this.c),this.ty=t-(n*this.b+i*this.d),this},r.prototype.prepend=function(e){var t=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){var n=this.a,i=this.c;this.a=n*e.a+this.b*e.c,this.b=n*e.b+this.b*e.d,this.c=i*e.a+this.d*e.c,this.d=i*e.b+this.d*e.d}return this.tx=t*e.a+this.ty*e.c+e.tx,this.ty=t*e.b+this.ty*e.d+e.ty,this},r.prototype.decompose=function(e){var t=this.a,n=this.b,i=this.c,o=this.d,a=e.pivot,s=-Math.atan2(-i,o),l=Math.atan2(n,t),u=Math.abs(s+l);return u<1e-5||Math.abs(ly-u)<1e-5?(e.rotation=l,e.skew.x=e.skew.y=0):(e.rotation=0,e.skew.x=s,e.skew.y=l),e.scale.x=Math.sqrt(t*t+n*n),e.scale.y=Math.sqrt(i*i+o*o),e.position.x=this.tx+(a.x*t+a.y*i),e.position.y=this.ty+(a.x*n+a.y*o),e},r.prototype.invert=function(){var e=this.a,t=this.b,n=this.c,i=this.d,o=this.tx,a=e*i-t*n;return this.a=i/a,this.b=-t/a,this.c=-n/a,this.d=e/a,this.tx=(n*this.ty-i*o)/a,this.ty=-(e*this.ty-t*o)/a,this},r.prototype.identity=function(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this},r.prototype.clone=function(){var e=new r;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e},r.prototype.copyTo=function(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e},r.prototype.copyFrom=function(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this},r.prototype.toString=function(){return"[@pixi/math:Matrix a="+this.a+" b="+this.b+" c="+this.c+" d="+this.d+" tx="+this.tx+" ty="+this.ty+"]"},Object.defineProperty(r,"IDENTITY",{get:function(){return new r},enumerable:!1,configurable:!0}),Object.defineProperty(r,"TEMP_MATRIX",{get:function(){return new r},enumerable:!1,configurable:!0}),r}(),tr=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],nr=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],rr=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],ir=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Ws=[],Ld=[],Hi=Math.sign;function cy(){for(var r=0;r<16;r++){var e=[];Ws.push(e);for(var t=0;t<16;t++)for(var n=Hi(tr[r]*tr[t]+rr[r]*nr[t]),i=Hi(nr[r]*tr[t]+ir[r]*nr[t]),o=Hi(tr[r]*rr[t]+rr[r]*ir[t]),a=Hi(nr[r]*rr[t]+ir[r]*ir[t]),s=0;s<16;s++)if(tr[s]===n&&nr[s]===i&&rr[s]===o&&ir[s]===a){e.push(s);break}}for(var r=0;r<16;r++){var l=new Et;l.set(tr[r],nr[r],rr[r],ir[r],0,0),Ld.push(l)}}cy();var ot={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:function(r){return tr[r]},uY:function(r){return nr[r]},vX:function(r){return rr[r]},vY:function(r){return ir[r]},inv:function(r){return r&8?r&15:-r&7},add:function(r,e){return Ws[r][e]},sub:function(r,e){return Ws[r][ot.inv(e)]},rotate180:function(r){return r^4},isVertical:function(r){return(r&3)===2},byDirection:function(r,e){return Math.abs(r)*2<=Math.abs(e)?e>=0?ot.S:ot.N:Math.abs(e)*2<=Math.abs(r)?r>0?ot.E:ot.W:e>0?r>0?ot.SE:ot.SW:r>0?ot.NE:ot.NW},matrixAppendRotationInv:function(r,e,t,n){t===void 0&&(t=0),n===void 0&&(n=0);var i=Ld[ot.inv(e)];i.tx=t,i.ty=n,r.append(i)}},Nd=function(){function r(){this.worldTransform=new Et,this.localTransform=new Et,this.position=new Dr(this.onChange,this,0,0),this.scale=new Dr(this.onChange,this,1,1),this.pivot=new Dr(this.onChange,this,0,0),this.skew=new Dr(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}return r.prototype.onChange=function(){this._localID++},r.prototype.updateSkew=function(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++},r.prototype.toString=function(){return"[@pixi/math:Transform "+("position=("+this.position.x+", "+this.position.y+") ")+("rotation="+this.rotation+" ")+("scale=("+this.scale.x+", "+this.scale.y+") ")+("skew=("+this.skew.x+", "+this.skew.y+") ")+"]"},r.prototype.updateLocalTransform=function(){var e=this.localTransform;this._localID!==this._currentLocalID&&(e.a=this._cx*this.scale.x,e.b=this._sx*this.scale.x,e.c=this._cy*this.scale.y,e.d=this._sy*this.scale.y,e.tx=this.position.x-(this.pivot.x*e.a+this.pivot.y*e.c),e.ty=this.position.y-(this.pivot.x*e.b+this.pivot.y*e.d),this._currentLocalID=this._localID,this._parentID=-1)},r.prototype.updateTransform=function(e){var 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!==e._worldID){var n=e.worldTransform,i=this.worldTransform;i.a=t.a*n.a+t.b*n.c,i.b=t.a*n.b+t.b*n.d,i.c=t.c*n.a+t.d*n.c,i.d=t.c*n.b+t.d*n.d,i.tx=t.tx*n.a+t.ty*n.c+n.tx,i.ty=t.tx*n.b+t.ty*n.d+n.ty,this._parentID=e._worldID,this._worldID++}},r.prototype.setFromMatrix=function(e){e.decompose(this),this._localID++},Object.defineProperty(r.prototype,"rotation",{get:function(){return this._rotation},set:function(e){this._rotation!==e&&(this._rotation=e,this.updateSkew())},enumerable:!1,configurable:!0}),r.IDENTITY=new r,r}();/*! + * @pixi/core - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/core is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */Te.PREFER_ENV=hr.any?An.WEBGL:An.WEBGL2;Te.STRICT_TEXTURE_CACHE=!1;var qs=[];function Dd(r,e){if(!r)return null;var t="";if(typeof r=="string"){var n=/\.(\w{3,4})(?:$|\?|#)/i.exec(r);n&&(t=n[1].toLowerCase())}for(var i=qs.length-1;i>=0;--i){var o=qs[i];if(o.test&&o.test(r,t))return new o(r,e)}throw new Error("Unrecognized source type to auto-detect Resource")}/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var Ys=function(r,e){return Ys=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])},Ys(r,e)};function et(r,e){Ys(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Ks=function(){return Ks=Object.assign||function(e){for(var t=arguments,n,i=1,o=arguments.length;i0&&c>0,i.textureCacheIds=[],i.destroyed=!1,i.resource=null,i._batchEnabled=0,i._batchLocation=0,i.parentTextureArray=null,i.setResource(t),i}return Object.defineProperty(e.prototype,"realWidth",{get:function(){return Math.round(this.width*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"realHeight",{get:function(){return Math.round(this.height*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mipmap",{get:function(){return this._mipmap},set:function(t){this._mipmap!==t&&(this._mipmap=t,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scaleMode",{get:function(){return this._scaleMode},set:function(t){this._scaleMode!==t&&(this._scaleMode=t,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"wrapMode",{get:function(){return this._wrapMode},set:function(t){this._wrapMode!==t&&(this._wrapMode=t,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),e.prototype.setStyle=function(t,n){var i;return t!==void 0&&t!==this.scaleMode&&(this.scaleMode=t,i=!0),n!==void 0&&n!==this.mipmap&&(this.mipmap=n,i=!0),i&&this.dirtyStyleId++,this},e.prototype.setSize=function(t,n,i){return i=i||this.resolution,this.setRealSize(t*i,n*i,i)},e.prototype.setRealSize=function(t,n,i){return this.resolution=i||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(n)/this.resolution,this._refreshPOT(),this.update(),this},e.prototype._refreshPOT=function(){this.isPowerOfTwo=ch(this.realWidth)&&ch(this.realHeight)},e.prototype.setResolution=function(t){var n=this.resolution;return n===t?this:(this.resolution=t,this.valid&&(this.width=Math.round(this.width*n)/t,this.height=Math.round(this.height*n)/t,this.emit("update",this)),this._refreshPOT(),this)},e.prototype.setResource=function(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},e.prototype.update=function(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))},e.prototype.onError=function(t){this.emit("error",this,t)},e.prototype.destroy=function(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete qn[this.cacheId],delete xn[this.cacheId],this.cacheId=null),this.dispose(),e.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0},e.prototype.dispose=function(){this.emit("dispose",this)},e.prototype.castToBaseTexture=function(){return this},e.from=function(t,n,i){i===void 0&&(i=Te.STRICT_TEXTURE_CACHE);var o=typeof t=="string",a=null;if(o)a=t;else{if(!t._pixiId){var s=n&&n.pixiIdPrefix||"pixiid";t._pixiId=s+"_"+Pi()}a=t._pixiId}var l=qn[a];if(o&&i&&!l)throw new Error('The cacheId "'+a+'" does not exist in BaseTextureCache.');return l||(l=new e(t,n),l.cacheId=a,e.addToCache(l,a)),l},e.fromBuffer=function(t,n,i,o){t=t||new Float32Array(n*i*4);var a=new fu(t,{width:n,height:i}),s=t instanceof Float32Array?$e.FLOAT:$e.UNSIGNED_BYTE;return new e(a,Object.assign({},fy,o||{width:n,height:i,type:s}))},e.addToCache=function(t,n){n&&(t.textureCacheIds.indexOf(n)===-1&&t.textureCacheIds.push(n),qn[n]&&console.warn("BaseTexture added to the cache with an id ["+n+"] that already had an entry"),qn[n]=t)},e.removeFromCache=function(t){if(typeof t=="string"){var n=qn[t];if(n){var i=n.textureCacheIds.indexOf(t);return i>-1&&n.textureCacheIds.splice(i,1),delete qn[t],n}}else if(t&&t.textureCacheIds){for(var o=0;o0)if(t.resource)this.addResourceAt(t.resource,n);else throw new Error("CubeResource does not support copying of renderTexture.");else t.target=dr.TEXTURE_CUBE_MAP_POSITIVE_X+n,t.parentTextureArray=this.baseTexture,this.items[n]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[n]=t,this},e.prototype.upload=function(t,n,i){for(var o=this.itemDirtyIds,a=0;a)?\s*()]*-->)?\s*\]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i,e}(Vn),vy=function(r){et(e,r);function e(t,n){var i=this;if(n=n||{},!(t instanceof HTMLVideoElement)){var o=document.createElement("video");o.setAttribute("preload","auto"),o.setAttribute("webkit-playsinline",""),o.setAttribute("playsinline",""),typeof t=="string"&&(t=[t]);var a=t[0].src||t[0];Vn.crossOrigin(o,a,n.crossorigin);for(var s=0;s2},e.prototype._onPlayStart=function(){this.valid||this._onCanPlay(),this.autoUpdate&&!this._isConnectedToTicker&&(wn.shared.add(this.update,this),this._isConnectedToTicker=!0)},e.prototype._onPlayStop=function(){this._isConnectedToTicker&&(wn.shared.remove(this.update,this),this._isConnectedToTicker=!1)},e.prototype._onCanPlay=function(){var t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);var n=this.valid;this.resize(t.videoWidth,t.videoHeight),!n&&this._resolve&&(this._resolve(this),this._resolve=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()},e.prototype.dispose=function(){this._isConnectedToTicker&&(wn.shared.remove(this.update,this),this._isConnectedToTicker=!1);var t=this.source;t&&(t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),r.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"autoUpdate",{get:function(){return this._autoUpdate},set:function(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(wn.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._isSourcePlaying()&&(wn.shared.add(this.update,this),this._isConnectedToTicker=!0))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"updateFPS",{get:function(){return this._updateFPS},set:function(t){t!==this._updateFPS&&(this._updateFPS=t)},enumerable:!1,configurable:!0}),e.test=function(t,n){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||e.TYPES.indexOf(n)>-1},e.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],e.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"},e}(Vn),yy=function(r){et(e,r);function e(t){return r.call(this,t)||this}return e.test=function(t){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&t instanceof ImageBitmap},e}(Vn);qs.push(Ud,yy,py,vy,gy,fu,my,dy);var _y=function(r){et(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.upload=function(t,n,i){var o=t.gl;o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.alphaMode===jn.UNPACK);var a=n.realWidth,s=n.realHeight;return i.width===a&&i.height===s?o.texSubImage2D(n.target,0,0,0,a,s,n.format,i.type,this.data):(i.width=a,i.height=s,o.texImage2D(n.target,0,i.internalFormat,a,s,0,n.format,i.type,this.data)),!0},e}(fu),Zs=function(){function r(e,t){this.width=Math.round(e||100),this.height=Math.round(t||100),this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new St("disposeFramebuffer"),this.multisample=dt.NONE}return Object.defineProperty(r.prototype,"colorTexture",{get:function(){return this.colorTextures[0]},enumerable:!1,configurable:!0}),r.prototype.addColorTexture=function(e,t){return e===void 0&&(e=0),this.colorTextures[e]=t||new yt(null,{scaleMode:Bt.NEAREST,resolution:1,mipmap:fn.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this},r.prototype.addDepthTexture=function(e){return this.depthTexture=e||new yt(new _y(null,{width:this.width,height:this.height}),{scaleMode:Bt.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:fn.OFF,format:we.DEPTH_COMPONENT,type:$e.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this},r.prototype.enableDepth=function(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this},r.prototype.enableStencil=function(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this},r.prototype.resize=function(e,t){if(e=Math.round(e),t=Math.round(t),!(e===this.width&&t===this.height)){this.width=e,this.height=t,this.dirtyId++,this.dirtySize++;for(var n=0;n-1&&n.textureCacheIds.splice(i,1),delete xn[t],n}}else if(t&&t.textureCacheIds){for(var o=0;othis.baseTexture.width,l=i+a>this.baseTexture.height;if(s||l){var u=s&&l?"and":"or",c="X: "+n+" + "+o+" = "+(n+o)+" > "+this.baseTexture.width,h="Y: "+i+" + "+a+" = "+(i+a)+" > "+this.baseTexture.height;throw new Error("Texture Error: frame does not fit inside the base Texture dimensions: "+(c+" "+u+" "+h))}this.valid=o&&a&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=t),this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rotate",{get:function(){return this._rotate},set:function(t){this._rotate=t,this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this.orig.width},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.orig.height},enumerable:!1,configurable:!0}),e.prototype.castToBaseTexture=function(){return this.baseTexture},Object.defineProperty(e,"EMPTY",{get:function(){return e._EMPTY||(e._EMPTY=new e(new yt),Xi(e._EMPTY),Xi(e._EMPTY.baseTexture)),e._EMPTY},enumerable:!1,configurable:!0}),Object.defineProperty(e,"WHITE",{get:function(){if(!e._WHITE){var t=Te.ADAPTER.createCanvas(16,16),n=t.getContext("2d");t.width=16,t.height=16,n.fillStyle="white",n.fillRect(0,0,16,16),e._WHITE=new e(yt.from(t)),Xi(e._WHITE),Xi(e._WHITE.baseTexture)}return e._WHITE},enumerable:!1,configurable:!0}),e}(xr),du=function(r){et(e,r);function e(t,n){var i=r.call(this,t,n)||this;return i.valid=!0,i.filterFrame=null,i.filterPoolKey=null,i.updateUvs(),i}return Object.defineProperty(e.prototype,"framebuffer",{get:function(){return this.baseTexture.framebuffer},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"multisample",{get:function(){return this.framebuffer.multisample},set:function(t){this.framebuffer.multisample=t},enumerable:!1,configurable:!0}),e.prototype.resize=function(t,n,i){i===void 0&&(i=!0);var o=this.baseTexture.resolution,a=Math.round(t*o)/o,s=Math.round(n*o)/o;this.valid=a>0&&s>0,this._frame.width=this.orig.width=a,this._frame.height=this.orig.height=s,i&&this.baseTexture.resize(a,s),this.updateUvs()},e.prototype.setResolution=function(t){var n=this.baseTexture;n.resolution!==t&&(n.setResolution(t),this.resize(n.width,n.height,!1))},e.create=function(t){for(var n=arguments,i=[],o=1;o>>0,i>1&&(o+=i*4294967296)):o=i>1?-i:-1,this.texturePool[o]||(this.texturePool[o]=[]);var a=this.texturePool[o].pop();return a||(a=this.createTexture(e,t,i)),a.filterPoolKey=o,a.setResolution(n),a},r.prototype.getFilterTexture=function(e,t,n){var i=this.getOptimalTexture(e.width,e.height,t||e.resolution,n||dt.NONE);return i.filterFrame=e.filterFrame,i},r.prototype.returnTexture=function(e){var t=e.filterPoolKey;e.filterFrame=null,this.texturePool[t].push(e)},r.prototype.returnFilterTexture=function(e){this.returnTexture(e)},r.prototype.clear=function(e){if(e=e!==!1,e)for(var t in this.texturePool){var n=this.texturePool[t];if(n)for(var i=0;i0&&e.height>0;for(var t in this.texturePool)if(Number(t)<0){var n=this.texturePool[t];if(n)for(var i=0;i1){for(var c=0;c1&&(h=this.getOptimalFilterTexture(c.width,c.height,t.resolution),h.filterFrame=c.filterFrame),n[p].apply(this,c,h,nn.CLEAR,t);var f=c;c=h,h=f}n[p].apply(this,c,u.renderTexture,nn.BLEND,t),p>1&&t.multisample>1&&this.returnFilterTexture(t.renderTexture),this.returnFilterTexture(c),this.returnFilterTexture(h)}t.clear(),this.statePool.push(t)},r.prototype.bindAndClear=function(e,t){t===void 0&&(t=nn.CLEAR);var n=this.renderer,i=n.renderTexture,o=n.state;if(e===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,e&&e.filterFrame){var a=this.tempRect;a.x=0,a.y=0,a.width=e.filterFrame.width,a.height=e.filterFrame.height,i.bind(e,e.filterFrame,a)}else e!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?i.bind(e):this.renderer.renderTexture.bind(e,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);var s=o.stateId&1||this.forceClear;(t===nn.CLEAR||t===nn.BLIT&&s)&&this.renderer.framebuffer.clear(0,0,0,0)},r.prototype.applyFilter=function(e,t,n,i){var o=this.renderer;o.state.set(e.state),this.bindAndClear(n,i),e.uniforms.uSampler=t,e.uniforms.filterGlobals=this.globalUniforms,o.shader.bind(e),e.legacy=!!e.program.attributeData.aTextureCoord,e.legacy?(this.quadUv.map(t._frame,t.filterFrame),o.geometry.bind(this.quadUv),o.geometry.draw(Ii.TRIANGLES)):(o.geometry.bind(this.quad),o.geometry.draw(Ii.TRIANGLE_STRIP))},r.prototype.calculateSpriteMatrix=function(e,t){var n=this.activeState,i=n.sourceFrame,o=n.destinationFrame,a=t._texture.orig,s=e.set(o.width,0,0,o.height,i.x,i.y),l=t.worldTransform.copyTo(Et.TEMP_MATRIX);return l.invert(),s.prepend(l),s.scale(1/a.width,1/a.height),s.translate(t.anchor.x,t.anchor.y),s},r.prototype.destroy=function(){this.renderer=null,this.texturePool.clear(!1)},r.prototype.getOptimalFilterTexture=function(e,t,n,i){return n===void 0&&(n=1),i===void 0&&(i=dt.NONE),this.texturePool.getOptimalTexture(e,t,n,i)},r.prototype.getFilterTexture=function(e,t,n){if(typeof e=="number"){var i=e;e=t,t=i}e=e||this.activeState.renderTexture;var o=this.texturePool.getOptimalTexture(e.width,e.height,t||e.resolution,n||dt.NONE);return o.filterFrame=e.filterFrame,o},r.prototype.returnFilterTexture=function(e){this.texturePool.returnTexture(e)},r.prototype.emptyPool=function(){this.texturePool.clear(!0)},r.prototype.resize=function(){this.texturePool.setScreenSize(this.renderer.view)},r.prototype.transformAABB=function(e,t){var n=Wi[0],i=Wi[1],o=Wi[2],a=Wi[3];n.set(t.left,t.top),i.set(t.left,t.bottom),o.set(t.right,t.top),a.set(t.right,t.bottom),e.apply(n,n),e.apply(i,i),e.apply(o,o),e.apply(a,a);var s=Math.min(n.x,i.x,o.x,a.x),l=Math.min(n.y,i.y,o.y,a.y),u=Math.max(n.x,i.x,o.x,a.x),c=Math.max(n.y,i.y,o.y,a.y);t.x=s,t.y=l,t.width=u-s,t.height=c-l},r.prototype.roundFrame=function(e,t,n,i,o){if(!(e.width<=0||e.height<=0||n.width<=0||n.height<=0)){if(o){var a=o.a,s=o.b,l=o.c,u=o.d;if((Math.abs(s)>1e-4||Math.abs(l)>1e-4)&&(Math.abs(a)>1e-4||Math.abs(u)>1e-4))return}o=o?es.copyFrom(o):es.identity(),o.translate(-n.x,-n.y).scale(i.width/n.width,i.height/n.height).translate(i.x,i.y),this.transformAABB(o,e),e.ceil(t),this.transformAABB(o.invert(),e)}},r}(),Vd=function(){function r(e){this.renderer=e}return r.prototype.flush=function(){},r.prototype.destroy=function(){this.renderer=null},r.prototype.start=function(){},r.prototype.stop=function(){this.flush()},r.prototype.render=function(e){},r}(),ky=function(){function r(e){this.renderer=e,this.emptyRenderer=new Vd(e),this.currentRenderer=this.emptyRenderer}return r.prototype.setObjectRenderer=function(e){this.currentRenderer!==e&&(this.currentRenderer.stop(),this.currentRenderer=e,this.currentRenderer.start())},r.prototype.flush=function(){this.setObjectRenderer(this.emptyRenderer)},r.prototype.reset=function(){this.setObjectRenderer(this.emptyRenderer)},r.prototype.copyBoundTextures=function(e,t){for(var n=this.renderer.texture.boundTextures,i=t-1;i>=0;--i)e[i]=n[i]||null,e[i]&&(e[i]._batchLocation=i)},r.prototype.boundArray=function(e,t,n,i){for(var o=e.elements,a=e.ids,s=e.count,l=0,u=0;u=0&&h=An.WEBGL2&&(n=e.getContext("webgl2",t)),n)this.webGLVersion=2;else if(this.webGLVersion=1,n=e.getContext("webgl",t)||e.getContext("experimental-webgl",t),!n)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=n,this.getExtensions(),this.gl},r.prototype.getExtensions=function(){var e=this.gl,t={loseContext:e.getExtension("WEBGL_lose_context"),anisotropicFiltering:e.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),s3tc:e.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:e.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:e.getExtension("WEBGL_compressed_texture_etc"),etc1:e.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:e.getExtension("WEBGL_compressed_texture_atc"),astc:e.getExtension("WEBGL_compressed_texture_astc")};this.webGLVersion===1?Object.assign(this.extensions,t,{drawBuffers:e.getExtension("WEBGL_draw_buffers"),depthTexture:e.getExtension("WEBGL_depth_texture"),vertexArrayObject:e.getExtension("OES_vertex_array_object")||e.getExtension("MOZ_OES_vertex_array_object")||e.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:e.getExtension("OES_element_index_uint"),floatTexture:e.getExtension("OES_texture_float"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),textureHalfFloat:e.getExtension("OES_texture_half_float"),textureHalfFloatLinear:e.getExtension("OES_texture_half_float_linear")}):this.webGLVersion===2&&Object.assign(this.extensions,t,{colorBufferFloat:e.getExtension("EXT_color_buffer_float")})},r.prototype.handleContextLost=function(e){var t=this;e.preventDefault(),setTimeout(function(){t.gl.isContextLost()&&t.extensions.loseContext&&t.extensions.loseContext.restoreContext()},0)},r.prototype.handleContextRestored=function(){this.renderer.runners.contextChange.emit(this.gl)},r.prototype.destroy=function(){var e=this.renderer.view;this.renderer=null,e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()},r.prototype.postrender=function(){this.renderer.renderingToScreen&&this.gl.flush()},r.prototype.validateContext=function(e){var t=e.getContextAttributes(),n="WebGL2RenderingContext"in globalThis&&e instanceof globalThis.WebGL2RenderingContext;n&&(this.webGLVersion=2),t&&!t.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");var i=n||!!e.getExtension("OES_element_index_uint");this.supports.uint32Indices=i,i||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")},r}(),Ry=function(){function r(e){this.framebuffer=e,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=dt.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}return r}(),Fy=new pt,Ly=function(){function r(e){this.renderer=e,this.managedFramebuffers=[],this.unknownFramebuffer=new Zs(10,10),this.msaaSamples=null}return r.prototype.contextChange=function(){this.disposeAll(!0);var e=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new pt,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){var t=this.renderer.context.extensions.drawBuffers,n=this.renderer.context.extensions.depthTexture;Te.PREFER_ENV===An.WEBGL_LEGACY&&(t=null,n=null),t?e.drawBuffers=function(i){return t.drawBuffersWEBGL(i)}:(this.hasMRT=!1,e.drawBuffers=function(){}),n||(this.writeDepthTexture=!1)}else this.msaaSamples=e.getInternalformatParameter(e.RENDERBUFFER,e.RGBA8,e.SAMPLES)},r.prototype.bind=function(e,t,n){n===void 0&&(n=0);var i=this.gl;if(e){var o=e.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(e);this.current!==e&&(this.current=e,i.bindFramebuffer(i.FRAMEBUFFER,o.framebuffer)),o.mipLevel!==n&&(e.dirtyId++,e.dirtyFormat++,o.mipLevel=n),o.dirtyId!==e.dirtyId&&(o.dirtyId=e.dirtyId,o.dirtyFormat!==e.dirtyFormat?(o.dirtyFormat=e.dirtyFormat,o.dirtySize=e.dirtySize,this.updateFramebuffer(e,n)):o.dirtySize!==e.dirtySize&&(o.dirtySize=e.dirtySize,this.resizeFramebuffer(e)));for(var a=0;a>n,u=t.height>>n,c=l/t.width;this.setViewport(t.x*c,t.y*c,l,u)}else{var l=e.width>>n,u=e.height>>n;this.setViewport(0,0,l,u)}}else this.current&&(this.current=null,i.bindFramebuffer(i.FRAMEBUFFER,null)),t?this.setViewport(t.x,t.y,t.width,t.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)},r.prototype.setViewport=function(e,t,n,i){var o=this.viewport;e=Math.round(e),t=Math.round(t),n=Math.round(n),i=Math.round(i),(o.width!==n||o.height!==i||o.x!==e||o.y!==t)&&(o.x=e,o.y=t,o.width=n,o.height=i,this.gl.viewport(e,t,n,i))},Object.defineProperty(r.prototype,"size",{get:function(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}},enumerable:!1,configurable:!0}),r.prototype.clear=function(e,t,n,i,o){o===void 0&&(o=Mo.COLOR|Mo.DEPTH);var a=this.gl;a.clearColor(e,t,n,i),a.clear(o)},r.prototype.initFramebuffer=function(e){var t=this.gl,n=new Ry(t.createFramebuffer());return n.multisample=this.detectSamples(e.multisample),e.glFramebuffers[this.CONTEXT_UID]=n,this.managedFramebuffers.push(e),e.disposeRunner.add(this),n},r.prototype.resizeFramebuffer=function(e){var t=this.gl,n=e.glFramebuffers[this.CONTEXT_UID];n.msaaBuffer&&(t.bindRenderbuffer(t.RENDERBUFFER,n.msaaBuffer),t.renderbufferStorageMultisample(t.RENDERBUFFER,n.multisample,t.RGBA8,e.width,e.height)),n.stencil&&(t.bindRenderbuffer(t.RENDERBUFFER,n.stencil),n.msaaBuffer?t.renderbufferStorageMultisample(t.RENDERBUFFER,n.multisample,t.DEPTH24_STENCIL8,e.width,e.height):t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,e.width,e.height));var i=e.colorTextures,o=i.length;t.drawBuffers||(o=Math.min(o,1));for(var a=0;a1&&this.canMultisampleFramebuffer(e)?(i.msaaBuffer=i.msaaBuffer||n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,i.msaaBuffer),n.renderbufferStorageMultisample(n.RENDERBUFFER,i.multisample,n.RGBA8,e.width,e.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,i.msaaBuffer)):i.msaaBuffer&&(n.deleteRenderbuffer(i.msaaBuffer),i.msaaBuffer=null,i.blitFramebuffer&&(i.blitFramebuffer.dispose(),i.blitFramebuffer=null));for(var s=[],l=0;l1&&n.drawBuffers(s),e.depthTexture){var h=this.writeDepthTexture;if(h){var p=e.depthTexture;this.renderer.texture.bind(p,0),n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,p._glTextures[this.CONTEXT_UID].texture,t)}}(e.stencil||e.depth)&&!(e.depthTexture&&this.writeDepthTexture)?(i.stencil=i.stencil||n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,i.stencil),i.msaaBuffer?n.renderbufferStorageMultisample(n.RENDERBUFFER,i.multisample,n.DEPTH24_STENCIL8,e.width,e.height):n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,e.width,e.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,i.stencil)):i.stencil&&(n.deleteRenderbuffer(i.stencil),i.stencil=null)},r.prototype.canMultisampleFramebuffer=function(e){return this.renderer.context.webGLVersion!==1&&e.colorTextures.length<=1&&!e.depthTexture},r.prototype.detectSamples=function(e){var t=this.msaaSamples,n=dt.NONE;if(e<=1||t===null)return n;for(var i=0;i=0&&this.managedFramebuffers.splice(o,1),e.disposeRunner.remove(this),t||(i.deleteFramebuffer(n.framebuffer),n.msaaBuffer&&i.deleteRenderbuffer(n.msaaBuffer),n.stencil&&i.deleteRenderbuffer(n.stencil)),n.blitFramebuffer&&n.blitFramebuffer.dispose()}},r.prototype.disposeAll=function(e){var t=this.managedFramebuffers;this.managedFramebuffers=[];for(var n=0;n=An.WEBGL2&&(e=r.getContext("webgl2",{})),e||(e=r.getContext("webgl",{})||r.getContext("experimental-webgl",{}),e?e.getExtension("WEBGL_draw_buffers"):e=null),ii=e}return ii}var qi;function zy(){if(!qi){qi=Ut.MEDIUM;var r=Uy();if(r&&r.getShaderPrecisionFormat){var e=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);qi=e.precision?Ut.HIGH:Ut.MEDIUM}}return qi}function wh(r,e,t){if(r.substring(0,9)!=="precision"){var n=e;return e===Ut.HIGH&&t!==Ut.HIGH&&(n=Ut.MEDIUM),"precision "+n+` float; +`+r}else if(t!==Ut.HIGH&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}var jy={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 Hd(r){return jy[r]}var Yi=null,Th={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 Xd(r,e){if(!Yi){var t=Object.keys(Th);Yi={};for(var n=0;n0&&(e+=` +else `),t"u"?.5:t,this.isSimple=!1}return Object.defineProperty(r.prototype,"texture",{get:function(){return this._texture},set:function(e){this._texture=e,this._textureID=-1},enumerable:!1,configurable:!0}),r.prototype.multiplyUvs=function(e,t){t===void 0&&(t=e);for(var n=this.mapCoord,i=0;i0?this.maskStack[this.maskStack.length-1]._colorMask:15;n!==t&&this.renderer.gl.colorMask((n&1)!==0,(n&2)!==0,(n&4)!==0,(n&8)!==0)},r.prototype.destroy=function(){this.renderer=null},r}(),qd=function(){function r(e){this.renderer=e,this.maskStack=[],this.glConst=0}return r.prototype.getStackLength=function(){return this.maskStack.length},r.prototype.setMaskStack=function(e){var t=this.renderer.gl,n=this.getStackLength();this.maskStack=e;var i=this.getStackLength();i!==n&&(i===0?t.disable(this.glConst):(t.enable(this.glConst),this._useCurrent()))},r.prototype._useCurrent=function(){},r.prototype.destroy=function(){this.renderer=null,this.maskStack=null},r}(),Eh=new Et,Ch=[],o0=function(r){et(e,r);function e(t){var n=r.call(this,t)||this;return n.glConst=Te.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST,n}return e.prototype.getStackLength=function(){var t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0},e.prototype.calcScissorRect=function(t){var n;if(!t._scissorRectLocal){var i=t._scissorRect,o=t.maskObject,a=this.renderer,s=a.renderTexture,l=o.getBounds(!0,(n=Ch.pop())!==null&&n!==void 0?n:new pt);this.roundFrameToPixels(l,s.current?s.current.resolution:a.resolution,s.sourceFrame,s.destinationFrame,a.projection.transform),i&&l.fit(i),t._scissorRectLocal=l}},e.isMatrixRotated=function(t){if(!t)return!1;var n=t.a,i=t.b,o=t.c,a=t.d;return(Math.abs(i)>1e-4||Math.abs(o)>1e-4)&&(Math.abs(n)>1e-4||Math.abs(a)>1e-4)},e.prototype.testScissor=function(t){var n=t.maskObject;if(!n.isFastRect||!n.isFastRect()||e.isMatrixRotated(n.worldTransform)||e.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);var i=t._scissorRectLocal;return i.width>0&&i.height>0},e.prototype.roundFrameToPixels=function(t,n,i,o,a){e.isMatrixRotated(a)||(a=a?Eh.copyFrom(a):Eh.identity(),a.translate(-i.x,-i.y).scale(o.width/i.width,o.height/i.height).translate(o.x,o.y),this.renderer.filter.transformAABB(a,t),t.fit(o),t.x=Math.round(t.x*n),t.y=Math.round(t.y*n),t.width=Math.round(t.width*n),t.height=Math.round(t.height*n))},e.prototype.push=function(t){t._scissorRectLocal||this.calcScissorRect(t);var n=this.renderer.gl;t._scissorRect||n.enable(n.SCISSOR_TEST),t._scissorCounter++,t._scissorRect=t._scissorRectLocal,this._useCurrent()},e.prototype.pop=function(t){var n=this.renderer.gl;t&&Ch.push(t._scissorRectLocal),this.getStackLength()>0?this._useCurrent():n.disable(n.SCISSOR_TEST)},e.prototype._useCurrent=function(){var t=this.maskStack[this.maskStack.length-1]._scissorRect,n;this.renderer.renderTexture.current?n=t.y:n=this.renderer.height-t.height-t.y,this.renderer.gl.scissor(t.x,n,t.width,t.height)},e}(qd),a0=function(r){et(e,r);function e(t){var n=r.call(this,t)||this;return n.glConst=Te.ADAPTER.getWebGLRenderingContext().STENCIL_TEST,n}return e.prototype.getStackLength=function(){var t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0},e.prototype.push=function(t){var n=t.maskObject,i=this.renderer.gl,o=t._stencilCounter;o===0&&(this.renderer.framebuffer.forceStencil(),i.clearStencil(0),i.clear(i.STENCIL_BUFFER_BIT),i.enable(i.STENCIL_TEST)),t._stencilCounter++;var a=t._colorMask;a!==0&&(t._colorMask=0,i.colorMask(!1,!1,!1,!1)),i.stencilFunc(i.EQUAL,o,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.INCR),n.renderable=!0,n.render(this.renderer),this.renderer.batch.flush(),n.renderable=!1,a!==0&&(t._colorMask=a,i.colorMask((a&1)!==0,(a&2)!==0,(a&4)!==0,(a&8)!==0)),this._useCurrent()},e.prototype.pop=function(t){var n=this.renderer.gl;if(this.getStackLength()===0)n.disable(n.STENCIL_TEST);else{var i=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,o=i?i._colorMask:15;o!==0&&(i._colorMask=0,n.colorMask(!1,!1,!1,!1)),n.stencilOp(n.KEEP,n.KEEP,n.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,o!==0&&(i._colorMask=o,n.colorMask((o&1)!==0,(o&2)!==0,(o&4)!==0,(o&8)!==0)),this._useCurrent()}},e.prototype._useCurrent=function(){var t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)},e}(qd),s0=function(){function r(e){this.renderer=e,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new Et,this.transform=null}return r.prototype.update=function(e,t,n,i){this.destinationFrame=e||this.destinationFrame||this.defaultFrame,this.sourceFrame=t||this.sourceFrame||e,this.calculateProjection(this.destinationFrame,this.sourceFrame,n,i),this.transform&&this.projectionMatrix.append(this.transform);var o=this.renderer;o.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,o.globalUniforms.update(),o.shader.shader&&o.shader.syncUniformGroup(o.shader.shader.uniforms.globals)},r.prototype.calculateProjection=function(e,t,n,i){var o=this.projectionMatrix,a=i?-1:1;o.identity(),o.a=1/t.width*2,o.d=a*(1/t.height*2),o.tx=-1-t.x*o.a,o.ty=-a-t.y*o.d},r.prototype.setTransform=function(e){},r.prototype.destroy=function(){this.renderer=null},r}(),Yn=new pt,ai=new pt,l0=function(){function r(e){this.renderer=e,this.clearColor=e._backgroundColorRgba,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new pt,this.destinationFrame=new pt,this.viewportFrame=new pt}return r.prototype.bind=function(e,t,n){e===void 0&&(e=null);var i=this.renderer;this.current=e;var o,a,s;e?(o=e.baseTexture,s=o.resolution,t||(Yn.width=e.frame.width,Yn.height=e.frame.height,t=Yn),n||(ai.x=e.frame.x,ai.y=e.frame.y,ai.width=t.width,ai.height=t.height,n=ai),a=o.framebuffer):(s=i.resolution,t||(Yn.width=i.screen.width,Yn.height=i.screen.height,t=Yn),n||(n=Yn,n.width=t.width,n.height=t.height));var l=this.viewportFrame;l.x=n.x*s,l.y=n.y*s,l.width=n.width*s,l.height=n.height*s,e||(l.y=i.view.height-(l.y+l.height)),l.ceil(),this.renderer.framebuffer.bind(a,l),this.renderer.projection.update(n,t,s,!a),e?this.renderer.mask.setMaskStack(o.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(t),this.destinationFrame.copyFrom(n)},r.prototype.clear=function(e,t){this.current?e=e||this.current.baseTexture.clearColor:e=e||this.clearColor;var n=this.destinationFrame,i=this.current?this.current.baseTexture:this.renderer.screen,o=n.width!==i.width||n.height!==i.height;if(o){var a=this.viewportFrame,s=a.x,l=a.y,u=a.width,c=a.height;s=Math.round(s),l=Math.round(l),u=Math.round(u),c=Math.round(c),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(s,l,u,c)}this.renderer.framebuffer.clear(e[0],e[1],e[2],e[3],t),o&&this.renderer.scissor.pop()},r.prototype.resize=function(){this.bind(null)},r.prototype.reset=function(){this.bind(null)},r.prototype.destroy=function(){this.renderer=null},r}();function u0(r,e,t,n,i){t.buffer.update(i)}var c0={float:` + data[offset] = v; + `,vec2:` + data[offset] = v[0]; + data[offset+1] = v[1]; + `,vec3:` + data[offset] = v[0]; + data[offset+1] = v[1]; + data[offset+2] = v[2]; + + `,vec4:` + data[offset] = v[0]; + data[offset+1] = v[1]; + data[offset+2] = v[2]; + data[offset+3] = v[3]; + `,mat2:` + data[offset] = v[0]; + data[offset+1] = v[1]; + + data[offset+4] = v[2]; + data[offset+5] = v[3]; + `,mat3:` + data[offset] = v[0]; + data[offset+1] = v[1]; + data[offset+2] = v[2]; + + data[offset + 4] = v[3]; + data[offset + 5] = v[4]; + data[offset + 6] = v[5]; + + data[offset + 8] = v[6]; + data[offset + 9] = v[7]; + data[offset + 10] = v[8]; + `,mat4:` + for(var i = 0; i < 16; i++) + { + data[offset + i] = v[i]; + } + `},Yd={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 h0(r){for(var e=r.map(function(l){return{data:l,offset:0,dataLen:0,dirty:0}}),t=0,n=0,i=0,o=0;o1&&(t=Math.max(t,16)*a.data.size),a.dataLen=t,n%t!==0&&n<16){var s=n%t%16;n+=s,i+=s}n+t>16?(i=Math.ceil(i/16)*16,a.offset=i,i+=t,n=t):(a.offset=i,n+=t,i+=t)}return i=Math.ceil(i/16)*16,{uboElements:e,size:i}}function f0(r,e){var t=[];for(var n in r)e[n]&&t.push(e[n]);return t.sort(function(i,o){return i.index-o.index}),t}function d0(r,e){if(!r.autoManage)return{size:0,syncFunc:u0};for(var t=f0(r.uniforms,e),n=h0(t),i=n.uboElements,o=n.size,a=[` + var v = null; + var v2 = null; + var cv = null; + var t = 0; + var gl = renderer.gl + var index = 0; + var data = buffer.data; + `],s=0;s1){var g=Hd(l.data.type),v=Math.max(Yd[l.data.type]/16,1),d=g/v,m=(4-d%4)%4;a.push(` + cv = ud.`+c+`.value; + v = uv.`+c+`; + offset = `+l.offset/4+`; + + t = 0; + + for(var i=0; i < `+l.data.size*v+`; i++) + { + for(var j = 0; j < `+d+`; j++) + { + data[offset++] = v[t++]; + } + offset += `+m+`; + } + + `)}else{var y=c0[l.data.type];a.push(` + cv = ud.`+c+`.value; + v = uv.`+c+`; + offset = `+l.offset/4+`; + `+y+`; + `)}}return a.push(` + renderer.buffer.update(buffer); + `),{size:o,syncFunc:new Function("ud","uv","renderer","syncData","buffer",a.join(` +`))}}var p0=function(){function r(e,t){this.program=e,this.uniformData=t,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}return r.prototype.destroy=function(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null},r}();function m0(r,e){for(var t={},n=e.getProgramParameter(r,e.ACTIVE_ATTRIBUTES),i=0;ih?1:-1});for(var a=0;a>1,n++;this.stateId=e.data}for(var n=0;nthis.checkCountMax&&(this.checkCount=0,this.run())))},r.prototype.run=function(){for(var e=this.renderer.texture,t=e.managedTextures,n=!1,i=0;ithis.maxIdle&&(e.destroyTexture(o,!0),t[i]=null,n=!0)}if(n){for(var a=0,i=0;i=0;i--)this.unload(e.children[i])},r.prototype.destroy=function(){this.renderer=null},r}();function P0(r){var e,t,n,i,o,a,s,l,u,c,h,p,f,g,v,d,m,y,_,E,x,b,C;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?C=(e={},e[$e.UNSIGNED_BYTE]=(t={},t[we.RGBA]=r.RGBA8,t[we.RGB]=r.RGB8,t[we.RG]=r.RG8,t[we.RED]=r.R8,t[we.RGBA_INTEGER]=r.RGBA8UI,t[we.RGB_INTEGER]=r.RGB8UI,t[we.RG_INTEGER]=r.RG8UI,t[we.RED_INTEGER]=r.R8UI,t[we.ALPHA]=r.ALPHA,t[we.LUMINANCE]=r.LUMINANCE,t[we.LUMINANCE_ALPHA]=r.LUMINANCE_ALPHA,t),e[$e.BYTE]=(n={},n[we.RGBA]=r.RGBA8_SNORM,n[we.RGB]=r.RGB8_SNORM,n[we.RG]=r.RG8_SNORM,n[we.RED]=r.R8_SNORM,n[we.RGBA_INTEGER]=r.RGBA8I,n[we.RGB_INTEGER]=r.RGB8I,n[we.RG_INTEGER]=r.RG8I,n[we.RED_INTEGER]=r.R8I,n),e[$e.UNSIGNED_SHORT]=(i={},i[we.RGBA_INTEGER]=r.RGBA16UI,i[we.RGB_INTEGER]=r.RGB16UI,i[we.RG_INTEGER]=r.RG16UI,i[we.RED_INTEGER]=r.R16UI,i[we.DEPTH_COMPONENT]=r.DEPTH_COMPONENT16,i),e[$e.SHORT]=(o={},o[we.RGBA_INTEGER]=r.RGBA16I,o[we.RGB_INTEGER]=r.RGB16I,o[we.RG_INTEGER]=r.RG16I,o[we.RED_INTEGER]=r.R16I,o),e[$e.UNSIGNED_INT]=(a={},a[we.RGBA_INTEGER]=r.RGBA32UI,a[we.RGB_INTEGER]=r.RGB32UI,a[we.RG_INTEGER]=r.RG32UI,a[we.RED_INTEGER]=r.R32UI,a[we.DEPTH_COMPONENT]=r.DEPTH_COMPONENT24,a),e[$e.INT]=(s={},s[we.RGBA_INTEGER]=r.RGBA32I,s[we.RGB_INTEGER]=r.RGB32I,s[we.RG_INTEGER]=r.RG32I,s[we.RED_INTEGER]=r.R32I,s),e[$e.FLOAT]=(l={},l[we.RGBA]=r.RGBA32F,l[we.RGB]=r.RGB32F,l[we.RG]=r.RG32F,l[we.RED]=r.R32F,l[we.DEPTH_COMPONENT]=r.DEPTH_COMPONENT32F,l),e[$e.HALF_FLOAT]=(u={},u[we.RGBA]=r.RGBA16F,u[we.RGB]=r.RGB16F,u[we.RG]=r.RG16F,u[we.RED]=r.R16F,u),e[$e.UNSIGNED_SHORT_5_6_5]=(c={},c[we.RGB]=r.RGB565,c),e[$e.UNSIGNED_SHORT_4_4_4_4]=(h={},h[we.RGBA]=r.RGBA4,h),e[$e.UNSIGNED_SHORT_5_5_5_1]=(p={},p[we.RGBA]=r.RGB5_A1,p),e[$e.UNSIGNED_INT_2_10_10_10_REV]=(f={},f[we.RGBA]=r.RGB10_A2,f[we.RGBA_INTEGER]=r.RGB10_A2UI,f),e[$e.UNSIGNED_INT_10F_11F_11F_REV]=(g={},g[we.RGB]=r.R11F_G11F_B10F,g),e[$e.UNSIGNED_INT_5_9_9_9_REV]=(v={},v[we.RGB]=r.RGB9_E5,v),e[$e.UNSIGNED_INT_24_8]=(d={},d[we.DEPTH_STENCIL]=r.DEPTH24_STENCIL8,d),e[$e.FLOAT_32_UNSIGNED_INT_24_8_REV]=(m={},m[we.DEPTH_STENCIL]=r.DEPTH32F_STENCIL8,m),e):C=(y={},y[$e.UNSIGNED_BYTE]=(_={},_[we.RGBA]=r.RGBA,_[we.RGB]=r.RGB,_[we.ALPHA]=r.ALPHA,_[we.LUMINANCE]=r.LUMINANCE,_[we.LUMINANCE_ALPHA]=r.LUMINANCE_ALPHA,_),y[$e.UNSIGNED_SHORT_5_6_5]=(E={},E[we.RGB]=r.RGB,E),y[$e.UNSIGNED_SHORT_4_4_4_4]=(x={},x[we.RGBA]=r.RGBA,x),y[$e.UNSIGNED_SHORT_5_5_5_1]=(b={},b[we.RGBA]=r.RGBA,b),y),C}var us=function(){function r(e){this.texture=e,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=$e.UNSIGNED_BYTE,this.internalFormat=we.RGBA,this.samplerType=0}return r}(),M0=function(){function r(e){this.renderer=e,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new yt,this.hasIntegerTextures=!1}return r.prototype.contextChange=function(){var e=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=P0(e);var t=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=t;for(var n=0;n=0;--a){var s=n[a];if(s){var l=s._glTextures[o];l.samplerType!==ko.FLOAT&&this.renderer.texture.unbind(s)}}},r.prototype.initTexture=function(e){var t=new us(this.gl.createTexture());return t.dirtyId=-1,e._glTextures[this.CONTEXT_UID]=t,this.managedTextures.push(e),e.on("dispose",this.destroyTexture,this),t},r.prototype.initTextureType=function(e,t){var n,i;t.internalFormat=(i=(n=this.internalFormats[e.type])===null||n===void 0?void 0:n[e.format])!==null&&i!==void 0?i:e.format,this.webGLVersion===2&&e.type===$e.HALF_FLOAT?t.type=this.gl.HALF_FLOAT:t.type=e.type},r.prototype.updateTexture=function(e){var t=e._glTextures[this.CONTEXT_UID];if(t){var n=this.renderer;if(this.initTextureType(e,t),e.resource&&e.resource.upload(n,e,t))t.samplerType!==ko.FLOAT&&(this.hasIntegerTextures=!0);else{var i=e.realWidth,o=e.realHeight,a=n.gl;(t.width!==i||t.height!==o||t.dirtyId<0)&&(t.width=i,t.height=o,a.texImage2D(e.target,0,t.internalFormat,i,o,0,e.format,t.type,null))}e.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(e),t.dirtyId=e.dirtyId}},r.prototype.destroyTexture=function(e,t){var n=this.gl;if(e=e.castToBaseTexture(),e._glTextures[this.CONTEXT_UID]&&(this.unbind(e),n.deleteTexture(e._glTextures[this.CONTEXT_UID].texture),e.off("dispose",this.destroyTexture,this),delete e._glTextures[this.CONTEXT_UID],!t)){var i=this.managedTextures.indexOf(e);i!==-1&&xo(this.managedTextures,i,1)}},r.prototype.updateTextureStyle=function(e){var t=e._glTextures[this.CONTEXT_UID];t&&((e.mipmap===fn.POW2||this.webGLVersion!==2)&&!e.isPowerOfTwo?t.mipmap=!1:t.mipmap=e.mipmap>=1,this.webGLVersion!==2&&!e.isPowerOfTwo?t.wrapMode=Oo.CLAMP:t.wrapMode=e.wrapMode,e.resource&&e.resource.style(this.renderer,e,t)||this.setStyle(e,t),t.dirtyStyleId=e.dirtyStyleId)},r.prototype.setStyle=function(e,t){var n=this.gl;if(t.mipmap&&e.mipmap!==fn.ON_MANUAL&&n.generateMipmap(e.target),n.texParameteri(e.target,n.TEXTURE_WRAP_S,t.wrapMode),n.texParameteri(e.target,n.TEXTURE_WRAP_T,t.wrapMode),t.mipmap){n.texParameteri(e.target,n.TEXTURE_MIN_FILTER,e.scaleMode===Bt.LINEAR?n.LINEAR_MIPMAP_LINEAR:n.NEAREST_MIPMAP_NEAREST);var i=this.renderer.context.extensions.anisotropicFiltering;if(i&&e.anisotropicLevel>0&&e.scaleMode===Bt.LINEAR){var o=Math.min(e.anisotropicLevel,n.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT));n.texParameterf(e.target,i.TEXTURE_MAX_ANISOTROPY_EXT,o)}}else n.texParameteri(e.target,n.TEXTURE_MIN_FILTER,e.scaleMode===Bt.LINEAR?n.LINEAR:n.NEAREST);n.texParameteri(e.target,n.TEXTURE_MAG_FILTER,e.scaleMode===Bt.LINEAR?n.LINEAR:n.NEAREST)},r.prototype.destroy=function(){this.renderer=null},r}(),cs=new Et,k0=function(r){et(e,r);function e(t,n){t===void 0&&(t=Ai.UNKNOWN);var i=r.call(this)||this;return n=Object.assign({},Te.RENDER_OPTIONS,n),i.options=n,i.type=t,i.screen=new pt(0,0,n.width,n.height),i.view=n.view||Te.ADAPTER.createCanvas(),i.resolution=n.resolution||Te.RESOLUTION,i.useContextAlpha=n.useContextAlpha,i.autoDensity=!!n.autoDensity,i.preserveDrawingBuffer=n.preserveDrawingBuffer,i.clearBeforeRender=n.clearBeforeRender,i._backgroundColor=0,i._backgroundColorRgba=[0,0,0,1],i._backgroundColorString="#000000",i.backgroundColor=n.backgroundColor||i._backgroundColor,i.backgroundAlpha=n.backgroundAlpha,n.transparent!==void 0&&(pr("6.0.0","Option transparent is deprecated, please use backgroundAlpha instead."),i.useContextAlpha=n.transparent,i.backgroundAlpha=n.transparent?0:1),i._lastObjectRendered=null,i.plugins={},i}return e.prototype.initPlugins=function(t){for(var n in t)this.plugins[n]=new t[n](this)},Object.defineProperty(e.prototype,"width",{get:function(){return this.view.width},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.view.height},enumerable:!1,configurable:!0}),e.prototype.resize=function(t,n){this.view.width=Math.round(t*this.resolution),this.view.height=Math.round(n*this.resolution);var i=this.view.width/this.resolution,o=this.view.height/this.resolution;this.screen.width=i,this.screen.height=o,this.autoDensity&&(this.view.style.width=i+"px",this.view.style.height=o+"px"),this.emit("resize",i,o)},e.prototype.generateTexture=function(t,n,i,o){n===void 0&&(n={}),typeof n=="number"&&(pr("6.1.0","generateTexture options (scaleMode, resolution, region) are now object options."),n={scaleMode:n,resolution:i,region:o});var a=n.region,s=hy(n,["region"]);o=a||t.getLocalBounds(null,!0),o.width===0&&(o.width=1),o.height===0&&(o.height=1);var l=du.create(Ks({width:o.width,height:o.height},s));return cs.tx=-o.x,cs.ty=-o.y,this.render(t,{renderTexture:l,clear:!1,transform:cs,skipUpdateTransform:!!t.parent}),l},e.prototype.destroy=function(t){for(var n in this.plugins)this.plugins[n].destroy(),this.plugins[n]=null;t&&this.view.parentNode&&this.view.parentNode.removeChild(this.view);var i=this;i.plugins=null,i.type=Ai.UNKNOWN,i.view=null,i.screen=null,i._tempDisplayObjectParent=null,i.options=null,this._backgroundColorRgba=null,this._backgroundColorString=null,this._lastObjectRendered=null},Object.defineProperty(e.prototype,"backgroundColor",{get:function(){return this._backgroundColor},set:function(t){this._backgroundColor=t,this._backgroundColorString=ty(t),en(t,this._backgroundColorRgba)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backgroundAlpha",{get:function(){return this._backgroundColorRgba[3]},set:function(t){this._backgroundColorRgba[3]=t},enumerable:!1,configurable:!0}),e}(xr),O0=function(){function r(e){this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}return r}(),R0=function(){function r(e){this.renderer=e,this.managedBuffers={},this.boundBufferBases={}}return r.prototype.destroy=function(){this.renderer=null},r.prototype.contextChange=function(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID},r.prototype.bind=function(e){var t=this,n=t.gl,i=t.CONTEXT_UID,o=e._glBuffers[i]||this.createGLBuffer(e);n.bindBuffer(e.type,o.buffer)},r.prototype.bindBufferBase=function(e,t){var n=this,i=n.gl,o=n.CONTEXT_UID;if(this.boundBufferBases[t]!==e){var a=e._glBuffers[o]||this.createGLBuffer(e);this.boundBufferBases[t]=e,i.bindBufferBase(i.UNIFORM_BUFFER,t,a.buffer)}},r.prototype.bindBufferRange=function(e,t,n){var i=this,o=i.gl,a=i.CONTEXT_UID;n=n||0;var s=e._glBuffers[a]||this.createGLBuffer(e);o.bindBufferRange(o.UNIFORM_BUFFER,t||0,s.buffer,n*256,256)},r.prototype.update=function(e){var t=this,n=t.gl,i=t.CONTEXT_UID,o=e._glBuffers[i];if(e._updateID!==o.updateID)if(o.updateID=e._updateID,n.bindBuffer(e.type,o.buffer),o.byteLength>=e.data.byteLength)n.bufferSubData(e.type,0,e.data);else{var a=e.static?n.STATIC_DRAW:n.DYNAMIC_DRAW;o.byteLength=e.data.byteLength,n.bufferData(e.type,e.data,a)}},r.prototype.dispose=function(e,t){if(this.managedBuffers[e.id]){delete this.managedBuffers[e.id];var n=e._glBuffers[this.CONTEXT_UID],i=this.gl;e.disposeRunner.remove(this),n&&(t||i.deleteBuffer(n.buffer),delete e._glBuffers[this.CONTEXT_UID])}},r.prototype.disposeAll=function(e){for(var t=Object.keys(this.managedBuffers),n=0;n=dt.HIGH?this.multisample=dt.HIGH:n>=dt.MEDIUM?this.multisample=dt.MEDIUM:n>=dt.LOW?this.multisample=dt.LOW:this.multisample=dt.NONE},e.prototype.addSystem=function(t,n){var i=new t(this);if(this[n])throw new Error('Whoops! The name "'+n+'" is already in use');this[n]=i;for(var o in this.runners)this.runners[o].add(i);return this},e.prototype.render=function(t,n){var i,o,a,s;if(n&&(n instanceof du?(pr("6.0.0","Renderer#render arguments changed, use options instead."),i=n,o=arguments[2],a=arguments[3],s=arguments[4]):(i=n.renderTexture,o=n.clear,a=n.transform,s=n.skipUpdateTransform)),this.renderingToScreen=!i,this.runners.prerender.emit(),this.emit("prerender"),this.projection.transform=a,!this.context.isLost){if(i||(this._lastObjectRendered=t),!s){var l=t.enableTempParent();t.updateTransform(),t.disableTempParent(l)}this.renderTexture.bind(i),this.batch.currentRenderer.start(),(o!==void 0?o:this.clearBeforeRender)&&this.renderTexture.clear(),t.render(this),this.batch.currentRenderer.flush(),i&&i.baseTexture.update(),this.runners.postrender.emit(),this.projection.transform=null,this.emit("postrender")}},e.prototype.generateTexture=function(t,n,i,o){n===void 0&&(n={});var a=r.prototype.generateTexture.call(this,t,n,i,o);return this.framebuffer.blit(),a},e.prototype.resize=function(t,n){r.prototype.resize.call(this,t,n),this.runners.resize.emit(this.screen.height,this.screen.width)},e.prototype.reset=function(){return this.runners.reset.emit(),this},e.prototype.clear=function(){this.renderTexture.bind(),this.renderTexture.clear()},e.prototype.destroy=function(t){this.runners.destroy.emit();for(var n in this.runners)this.runners[n].destroy();r.prototype.destroy.call(this,t),this.gl=null},Object.defineProperty(e.prototype,"extract",{get:function(){return pr("6.0.0","Renderer#extract has been deprecated, please use Renderer#plugins.extract instead."),this.plugins.extract},enumerable:!1,configurable:!0}),e.registerPlugin=function(t,n){pr("6.5.0","Renderer.registerPlugin() has been deprecated, please use extensions.add() instead."),ei.add({name:t,type:dn.RendererPlugin,ref:n})},e.__plugins={},e}(k0);ei.handleByMap(dn.RendererPlugin,Kd.__plugins);function F0(r){return Kd.create(r)}var L0=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,N0=L0,D0=function(){function r(){this.texArray=null,this.blend=0,this.type=Ii.TRIANGLES,this.start=0,this.size=0,this.data=null}return r}(),B0=function(){function r(){this.elements=[],this.ids=[],this.count=0}return r.prototype.clear=function(){for(var e=0;ethis.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)},e.prototype.buildTexturesAndDrawCalls=function(){var t=this,n=t._bufferedTextures,i=t.MAX_TEXTURES,o=e._textureArrayPool,a=this.renderer.batch,s=this._tempBoundTextures,l=this.renderer.textureGC.count,u=++yt._globalBatch,c=0,h=o[0],p=0;a.copyBoundTextures(s,i);for(var f=0;f=i&&(a.boundArray(h,s,u,i),this.buildDrawCalls(h,p,f),p=f,h=o[++c],++u),g._batchEnabled=u,g.touched=l,h.elements[h.count++]=g)}h.count>0&&(a.boundArray(h,s,u,i),this.buildDrawCalls(h,p,this._bufferSize),++c,++u);for(var f=0;f0&&(t+=` +else `),nthis.maxX||this.minY>this.maxY},r.prototype.clear=function(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0},r.prototype.getRectangle=function(e){return this.minX>this.maxX||this.minY>this.maxY?pt.EMPTY:(e=e||new pt(0,0,1,1),e.x=this.minX,e.y=this.minY,e.width=this.maxX-this.minX,e.height=this.maxY-this.minY,e)},r.prototype.addPoint=function(e){this.minX=Math.min(this.minX,e.x),this.maxX=Math.max(this.maxX,e.x),this.minY=Math.min(this.minY,e.y),this.maxY=Math.max(this.maxY,e.y)},r.prototype.addPointMatrix=function(e,t){var n=e.a,i=e.b,o=e.c,a=e.d,s=e.tx,l=e.ty,u=n*t.x+o*t.y+s,c=i*t.x+a*t.y+l;this.minX=Math.min(this.minX,u),this.maxX=Math.max(this.maxX,u),this.minY=Math.min(this.minY,c),this.maxY=Math.max(this.maxY,c)},r.prototype.addQuad=function(e){var t=this.minX,n=this.minY,i=this.maxX,o=this.maxY,a=e[0],s=e[1];t=ai?a:i,o=s>o?s:o,a=e[2],s=e[3],t=ai?a:i,o=s>o?s:o,a=e[4],s=e[5],t=ai?a:i,o=s>o?s:o,a=e[6],s=e[7],t=ai?a:i,o=s>o?s:o,this.minX=t,this.minY=n,this.maxX=i,this.maxY=o},r.prototype.addFrame=function(e,t,n,i,o){this.addFrameMatrix(e.worldTransform,t,n,i,o)},r.prototype.addFrameMatrix=function(e,t,n,i,o){var a=e.a,s=e.b,l=e.c,u=e.d,c=e.tx,h=e.ty,p=this.minX,f=this.minY,g=this.maxX,v=this.maxY,d=a*t+l*n+c,m=s*t+u*n+h;p=dg?d:g,v=m>v?m:v,d=a*i+l*n+c,m=s*i+u*n+h,p=dg?d:g,v=m>v?m:v,d=a*t+l*o+c,m=s*t+u*o+h,p=dg?d:g,v=m>v?m:v,d=a*i+l*o+c,m=s*i+u*o+h,p=dg?d:g,v=m>v?m:v,this.minX=p,this.minY=f,this.maxX=g,this.maxY=v},r.prototype.addVertexData=function(e,t,n){for(var i=this.minX,o=this.minY,a=this.maxX,s=this.maxY,l=t;la?u:a,s=c>s?c:s}this.minX=i,this.minY=o,this.maxX=a,this.maxY=s},r.prototype.addVertices=function(e,t,n,i){this.addVerticesMatrix(e.worldTransform,t,n,i)},r.prototype.addVerticesMatrix=function(e,t,n,i,o,a){o===void 0&&(o=0),a===void 0&&(a=o);for(var s=e.a,l=e.b,u=e.c,c=e.d,h=e.tx,p=e.ty,f=this.minX,g=this.minY,v=this.maxX,d=this.maxY,m=n;mi?e.maxX:i,this.maxY=e.maxY>o?e.maxY:o},r.prototype.addBoundsMask=function(e,t){var n=e.minX>t.minX?e.minX:t.minX,i=e.minY>t.minY?e.minY:t.minY,o=e.maxXu?o:u,this.maxY=a>c?a:c}},r.prototype.addBoundsMatrix=function(e,t){this.addFrameMatrix(t,e.minX,e.minY,e.maxX,e.maxY)},r.prototype.addBoundsArea=function(e,t){var n=e.minX>t.x?e.minX:t.x,i=e.minY>t.y?e.minY:t.y,o=e.maxXu?o:u,this.maxY=a>c?a:c}},r.prototype.pad=function(e,t){e===void 0&&(e=0),t===void 0&&(t=e),this.isEmpty()||(this.minX-=e,this.maxX+=e,this.minY-=t,this.maxY+=t)},r.prototype.addFramePad=function(e,t,n,i,o,a){e-=o,t-=a,n+=o,i+=a,this.minX=this.minXn?this.maxX:n,this.minY=this.minYi?this.maxY:i},r}();/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var Js=function(r,e){return Js=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])},Js(r,e)};function vu(r,e){Js(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Lo=function(r){vu(e,r);function e(){var t=r.call(this)||this;return t.tempDisplayObjectParent=null,t.transform=new Nd,t.alpha=1,t.visible=!0,t.renderable=!0,t.cullable=!1,t.cullArea=null,t.parent=null,t.worldAlpha=1,t._lastSortedIndex=0,t._zIndex=0,t.filterArea=null,t.filters=null,t._enabledFilters=null,t._bounds=new Ph,t._localBounds=null,t._boundsID=0,t._boundsRect=null,t._localBoundsRect=null,t._mask=null,t._maskRefCount=0,t._destroyed=!1,t.isSprite=!1,t.isMask=!1,t}return e.mixin=function(t){for(var n=Object.keys(t),i=0;i1)for(var o=0;othis.children.length)throw new Error(t+"addChildAt: The index "+n+" 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(n,0,t),this._boundsID++,this.onChildrenChange(n),t.emit("added",this),this.emit("childAdded",t,this,n),t},e.prototype.swapChildren=function(t,n){if(t!==n){var i=this.getChildIndex(t),o=this.getChildIndex(n);this.children[i]=n,this.children[o]=t,this.onChildrenChange(i=this.children.length)throw new Error("The index "+n+" supplied is out of bounds "+this.children.length);var i=this.getChildIndex(t);xo(this.children,i,1),this.children.splice(n,0,t),this.onChildrenChange(n)},e.prototype.getChildAt=function(t){if(t<0||t>=this.children.length)throw new Error("getChildAt: Index ("+t+") does not exist.");return this.children[t]},e.prototype.removeChild=function(){for(var t=arguments,n=[],i=0;i1)for(var o=0;o0&&a<=o){s=this.children.splice(i,a);for(var l=0;l1&&this.children.sort(X0),this.sortDirty=!1},e.prototype.updateTransform=function(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(var t=0,n=this.children.length;t0&&n.height>0){var i,o;if(this.cullArea?(i=this.cullArea,o=this.worldTransform):this._render!==e.prototype._render&&(i=this.getBounds(!0)),i&&n.intersects(i,o))this._render(t);else if(this.cullArea)return;for(var a=0,s=this.children.length;a 0.0) { + c.rgb /= c.a; + + vec3 rgb = pow(c.rgb, vec3(1. / gamma)); + rgb = mix(vec3(.5), mix(vec3(dot(vec3(.2125, .7154, .0721), rgb)), rgb, saturation), contrast); + rgb.r *= red; + rgb.g *= green; + rgb.b *= blue; + c.rgb = rgb * brightness; + + c.rgb *= c.a; + } + + gl_FragColor = c * alpha; +} +`;(function(r){q0(e,r);function e(t){var n=r.call(this,Y0,K0)||this;return n.gamma=1,n.saturation=1,n.contrast=1,n.brightness=1,n.red=1,n.green=1,n.blue=1,n.alpha=1,Object.assign(n,t),n}return e.prototype.apply=function(t,n,i,o){this.uniforms.gamma=Math.max(this.gamma,1e-4),this.uniforms.saturation=this.saturation,this.uniforms.contrast=this.contrast,this.uniforms.brightness=this.brightness,this.uniforms.red=this.red,this.uniforms.green=this.green,this.uniforms.blue=this.blue,this.uniforms.alpha=this.alpha,t.applyFilter(this,n,i,o)},e})(De);/*! + * @pixi/filter-kawase-blur - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-kawase-blur is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var el=function(r,e){return el=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},el(r,e)};function Z0(r,e){el(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var J0=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,Q0=` +varying vec2 vTextureCoord; +uniform sampler2D uSampler; + +uniform vec2 uOffset; + +void main(void) +{ + vec4 color = vec4(0.0); + + // Sample top left pixel + color += texture2D(uSampler, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y)); + + // Sample top right pixel + color += texture2D(uSampler, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y)); + + // Sample bottom right pixel + color += texture2D(uSampler, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y)); + + // Sample bottom left pixel + color += texture2D(uSampler, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y)); + + // Average + color *= 0.25; + + gl_FragColor = color; +}`,e_=` +varying vec2 vTextureCoord; +uniform sampler2D uSampler; + +uniform vec2 uOffset; +uniform vec4 filterClamp; + +void main(void) +{ + vec4 color = vec4(0.0); + + // Sample top left pixel + color += texture2D(uSampler, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y), filterClamp.xy, filterClamp.zw)); + + // Sample top right pixel + color += texture2D(uSampler, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y), filterClamp.xy, filterClamp.zw)); + + // Sample bottom right pixel + color += texture2D(uSampler, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y), filterClamp.xy, filterClamp.zw)); + + // Sample bottom left pixel + color += texture2D(uSampler, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y), filterClamp.xy, filterClamp.zw)); + + // Average + color *= 0.25; + + gl_FragColor = color; +} +`,Do=function(r){Z0(e,r);function e(t,n,i){t===void 0&&(t=4),n===void 0&&(n=3),i===void 0&&(i=!1);var o=r.call(this,J0,i?e_:Q0)||this;return o._kernels=[],o._blur=4,o._quality=3,o.uniforms.uOffset=new Float32Array(2),o._pixelSize=new st,o.pixelSize=1,o._clamp=i,Array.isArray(t)?o.kernels=t:(o._blur=t,o.quality=n),o}return e.prototype.apply=function(t,n,i,o){var a=this._pixelSize.x/n._frame.width,s=this._pixelSize.y/n._frame.height,l;if(this._quality===1||this._blur===0)l=this._kernels[0]+.5,this.uniforms.uOffset[0]=l*a,this.uniforms.uOffset[1]=l*s,t.applyFilter(this,n,i,o);else{for(var u=t.getFilterTexture(),c=n,h=u,p=void 0,f=this._quality-1,g=0;g0)for(var o=t,a=t/n,s=1;s0?(this._kernels=t,this._quality=t.length,this._blur=Math.max.apply(Math,t)):(this._kernels=[0],this._quality=1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clamp",{get:function(){return this._clamp},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pixelSize",{get:function(){return this._pixelSize},set:function(t){typeof t=="number"?(this._pixelSize.x=t,this._pixelSize.y=t):Array.isArray(t)?(this._pixelSize.x=t[0],this._pixelSize.y=t[1]):t instanceof st?(this._pixelSize.x=t.x,this._pixelSize.y=t.y):(this._pixelSize.x=1,this._pixelSize.y=1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"quality",{get:function(){return this._quality},set:function(t){this._quality=Math.max(1,Math.round(t)),this._generateKernels()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blur",{get:function(){return this._blur},set:function(t){this._blur=t,this._generateKernels()},enumerable:!1,configurable:!0}),e}(De);/*! + * @pixi/filter-advanced-bloom - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-advanced-bloom is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var tl=function(r,e){return tl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},tl(r,e)};function Jd(r,e){tl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Qd=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,t_=` +uniform sampler2D uSampler; +varying vec2 vTextureCoord; + +uniform float threshold; + +void main() { + vec4 color = texture2D(uSampler, vTextureCoord); + + // A simple & fast algorithm for getting brightness. + // It's inaccuracy , but good enought for this feature. + float _max = max(max(color.r, color.g), color.b); + float _min = min(min(color.r, color.g), color.b); + float brightness = (_max + _min) * 0.5; + + if(brightness > threshold) { + gl_FragColor = color; + } else { + gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); + } +} +`,n_=function(r){Jd(e,r);function e(t){t===void 0&&(t=.5);var n=r.call(this,Qd,t_)||this;return n.threshold=t,n}return Object.defineProperty(e.prototype,"threshold",{get:function(){return this.uniforms.threshold},set:function(t){this.uniforms.threshold=t},enumerable:!1,configurable:!0}),e}(De),r_=`uniform sampler2D uSampler; +varying vec2 vTextureCoord; + +uniform sampler2D bloomTexture; +uniform float bloomScale; +uniform float brightness; + +void main() { + vec4 color = texture2D(uSampler, vTextureCoord); + color.rgb *= brightness; + vec4 bloomColor = vec4(texture2D(bloomTexture, vTextureCoord).rgb, 0.0); + bloomColor.rgb *= bloomScale; + gl_FragColor = color + bloomColor; +} +`;(function(r){Jd(e,r);function e(t){var n=r.call(this,Qd,r_)||this;n.bloomScale=1,n.brightness=1,n._resolution=Te.FILTER_RESOLUTION,typeof t=="number"&&(t={threshold:t});var i=Object.assign(e.defaults,t);n.bloomScale=i.bloomScale,n.brightness=i.brightness;var o=i.kernels,a=i.blur,s=i.quality,l=i.pixelSize,u=i.resolution;return n._extractFilter=new n_(i.threshold),n._extractFilter.resolution=u,n._blurFilter=o?new Do(o):new Do(a,s),n.pixelSize=l,n.resolution=u,n}return e.prototype.apply=function(t,n,i,o,a){var s=t.getFilterTexture();this._extractFilter.apply(t,n,s,1,a);var l=t.getFilterTexture();this._blurFilter.apply(t,s,l,1),this.uniforms.bloomScale=this.bloomScale,this.uniforms.brightness=this.brightness,this.uniforms.bloomTexture=l,t.applyFilter(this,n,i,o),t.returnFilterTexture(l),t.returnFilterTexture(s)},Object.defineProperty(e.prototype,"resolution",{get:function(){return this._resolution},set:function(t){this._resolution=t,this._extractFilter&&(this._extractFilter.resolution=t),this._blurFilter&&(this._blurFilter.resolution=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"threshold",{get:function(){return this._extractFilter.threshold},set:function(t){this._extractFilter.threshold=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"kernels",{get:function(){return this._blurFilter.kernels},set:function(t){this._blurFilter.kernels=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blur",{get:function(){return this._blurFilter.blur},set:function(t){this._blurFilter.blur=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"quality",{get:function(){return this._blurFilter.quality},set:function(t){this._blurFilter.quality=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pixelSize",{get:function(){return this._blurFilter.pixelSize},set:function(t){this._blurFilter.pixelSize=t},enumerable:!1,configurable:!0}),e.defaults={threshold:.5,bloomScale:1,brightness:1,kernels:null,blur:8,quality:4,pixelSize:1,resolution:Te.FILTER_RESOLUTION},e})(De);/*! + * @pixi/filter-ascii - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-ascii is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var nl=function(r,e){return nl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},nl(r,e)};function i_(r,e){nl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var o_=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,a_=`varying vec2 vTextureCoord; + +uniform vec4 filterArea; +uniform float pixelSize; +uniform sampler2D uSampler; + +vec2 mapCoord( vec2 coord ) +{ + coord *= filterArea.xy; + coord += filterArea.zw; + + return coord; +} + +vec2 unmapCoord( vec2 coord ) +{ + coord -= filterArea.zw; + coord /= filterArea.xy; + + return coord; +} + +vec2 pixelate(vec2 coord, vec2 size) +{ + return floor( coord / size ) * size; +} + +vec2 getMod(vec2 coord, vec2 size) +{ + return mod( coord , size) / size; +} + +float character(float n, vec2 p) +{ + p = floor(p*vec2(4.0, -4.0) + 2.5); + + if (clamp(p.x, 0.0, 4.0) == p.x) + { + if (clamp(p.y, 0.0, 4.0) == p.y) + { + if (int(mod(n/exp2(p.x + 5.0*p.y), 2.0)) == 1) return 1.0; + } + } + return 0.0; +} + +void main() +{ + vec2 coord = mapCoord(vTextureCoord); + + // get the rounded color.. + vec2 pixCoord = pixelate(coord, vec2(pixelSize)); + pixCoord = unmapCoord(pixCoord); + + vec4 color = texture2D(uSampler, pixCoord); + + // determine the character to use + float gray = (color.r + color.g + color.b) / 3.0; + + float n = 65536.0; // . + if (gray > 0.2) n = 65600.0; // : + if (gray > 0.3) n = 332772.0; // * + if (gray > 0.4) n = 15255086.0; // o + if (gray > 0.5) n = 23385164.0; // & + if (gray > 0.6) n = 15252014.0; // 8 + if (gray > 0.7) n = 13199452.0; // @ + if (gray > 0.8) n = 11512810.0; // # + + // get the mod.. + vec2 modd = getMod(coord, vec2(pixelSize)); + + gl_FragColor = color * character( n, vec2(-1.0) + modd * 2.0); + +} +`;(function(r){i_(e,r);function e(t){t===void 0&&(t=8);var n=r.call(this,o_,a_)||this;return n.size=t,n}return Object.defineProperty(e.prototype,"size",{get:function(){return this.uniforms.pixelSize},set:function(t){this.uniforms.pixelSize=t},enumerable:!1,configurable:!0}),e})(De);/*! + * @pixi/filter-bevel - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-bevel is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var rl=function(r,e){return rl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},rl(r,e)};function s_(r,e){rl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var l_=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,u_=`precision mediump float; + +varying vec2 vTextureCoord; +uniform sampler2D uSampler; +uniform vec4 filterArea; + +uniform float transformX; +uniform float transformY; +uniform vec3 lightColor; +uniform float lightAlpha; +uniform vec3 shadowColor; +uniform float shadowAlpha; + +void main(void) { + vec2 transform = vec2(1.0 / filterArea) * vec2(transformX, transformY); + vec4 color = texture2D(uSampler, vTextureCoord); + float light = texture2D(uSampler, vTextureCoord - transform).a; + float shadow = texture2D(uSampler, vTextureCoord + transform).a; + + color.rgb = mix(color.rgb, lightColor, clamp((color.a - light) * lightAlpha, 0.0, 1.0)); + color.rgb = mix(color.rgb, shadowColor, clamp((color.a - shadow) * shadowAlpha, 0.0, 1.0)); + gl_FragColor = vec4(color.rgb * color.a, color.a); +} +`;(function(r){s_(e,r);function e(t){var n=r.call(this,l_,u_)||this;return n._thickness=2,n._angle=0,n.uniforms.lightColor=new Float32Array(3),n.uniforms.shadowColor=new Float32Array(3),Object.assign(n,{rotation:45,thickness:2,lightColor:16777215,lightAlpha:.7,shadowColor:0,shadowAlpha:.7},t),n.padding=1,n}return e.prototype._updateTransform=function(){this.uniforms.transformX=this._thickness*Math.cos(this._angle),this.uniforms.transformY=this._thickness*Math.sin(this._angle)},Object.defineProperty(e.prototype,"rotation",{get:function(){return this._angle/vr},set:function(t){this._angle=t*vr,this._updateTransform()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness=t,this._updateTransform()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lightColor",{get:function(){return rn(this.uniforms.lightColor)},set:function(t){en(t,this.uniforms.lightColor)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lightAlpha",{get:function(){return this.uniforms.lightAlpha},set:function(t){this.uniforms.lightAlpha=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shadowColor",{get:function(){return rn(this.uniforms.shadowColor)},set:function(t){en(t,this.uniforms.shadowColor)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shadowAlpha",{get:function(){return this.uniforms.shadowAlpha},set:function(t){this.uniforms.shadowAlpha=t},enumerable:!1,configurable:!0}),e})(De);/*! + * @pixi/filter-alpha - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/filter-alpha is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var il=function(r,e){return il=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])},il(r,e)};function c_(r,e){il(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var h_=`varying vec2 vTextureCoord; + +uniform sampler2D uSampler; +uniform float uAlpha; + +void main(void) +{ + gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha; +} +`,f_=function(r){c_(e,r);function e(t){t===void 0&&(t=1);var n=r.call(this,N0,h_,{uAlpha:1})||this;return n.alpha=t,n}return Object.defineProperty(e.prototype,"alpha",{get:function(){return this.uniforms.uAlpha},set:function(t){this.uniforms.uAlpha=t},enumerable:!1,configurable:!0}),e}(De);/*! + * @pixi/filter-blur - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/filter-blur is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var ol=function(r,e){return ol=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])},ol(r,e)};function ep(r,e){ol(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var d_=` + attribute vec2 aVertexPosition; + + uniform mat3 projectionMatrix; + + uniform float strength; + + varying vec2 vBlurTexCoords[%size%]; + + uniform vec4 inputSize; + uniform vec4 outputFrame; + + vec4 filterVertexPosition( void ) + { + vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; + + return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); + } + + vec2 filterTextureCoord( void ) + { + return aVertexPosition * (outputFrame.zw * inputSize.zw); + } + + void main(void) + { + gl_Position = filterVertexPosition(); + + vec2 textureCoord = filterTextureCoord(); + %blur% + }`;function p_(r,e){var t=Math.ceil(r/2),n=d_,i="",o;e?o="vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);":o="vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);";for(var a=0;a=t&&(a=r-s-1),l=l.replace("%value%",e[a].toString()),i+=l,i+=` +`}return n=n.replace("%blur%",i),n=n.replace("%size%",r.toString()),n}var Bo=function(r){ep(e,r);function e(t,n,i,o,a){n===void 0&&(n=8),i===void 0&&(i=4),o===void 0&&(o=Te.FILTER_RESOLUTION),a===void 0&&(a=5);var s=this,l=p_(a,t),u=v_(a);return s=r.call(this,l,u)||this,s.horizontal=t,s.resolution=o,s._quality=0,s.quality=i,s.blur=n,s}return e.prototype.apply=function(t,n,i,o){if(i?this.horizontal?this.uniforms.strength=1/i.width*(i.width/n.width):this.uniforms.strength=1/i.height*(i.height/n.height):this.horizontal?this.uniforms.strength=1/t.renderer.width*(t.renderer.width/n.width):this.uniforms.strength=1/t.renderer.height*(t.renderer.height/n.height),this.uniforms.strength*=this.strength,this.uniforms.strength/=this.passes,this.passes===1)t.applyFilter(this,n,i,o);else{var a=t.getFilterTexture(),s=t.renderer,l=n,u=a;this.state.blend=!1,t.applyFilter(this,l,u,nn.CLEAR);for(var c=1;c 0.0) { + coord *= mix(1.0, smoothstep(0.0, radius / distance, percent), strength * 0.75); + } else { + coord *= mix(1.0, pow(percent, 1.0 + strength * 0.75) * radius / distance, 1.0 - percent); + } + } + coord += center * dimensions.xy; + coord /= filterArea.xy; + vec2 clampedCoord = clamp(coord, filterClamp.xy, filterClamp.zw); + vec4 color = texture2D(uSampler, clampedCoord); + if (coord != clampedCoord) { + color *= max(0.0, 1.0 - length(coord - clampedCoord)); + } + + gl_FragColor = color; +} +`;(function(r){__(e,r);function e(t){var n=r.call(this,x_,b_)||this;return n.uniforms.dimensions=new Float32Array(2),Object.assign(n,e.defaults,t),n}return e.prototype.apply=function(t,n,i,o){var a=n.filterFrame,s=a.width,l=a.height;this.uniforms.dimensions[0]=s,this.uniforms.dimensions[1]=l,t.applyFilter(this,n,i,o)},Object.defineProperty(e.prototype,"radius",{get:function(){return this.uniforms.radius},set:function(t){this.uniforms.radius=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"strength",{get:function(){return this.uniforms.strength},set:function(t){this.uniforms.strength=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"center",{get:function(){return this.uniforms.center},set:function(t){this.uniforms.center=t},enumerable:!1,configurable:!0}),e.defaults={center:[.5,.5],radius:100,strength:1},e})(De);/*! + * @pixi/filter-color-map - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-color-map is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var ll=function(r,e){return ll=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},ll(r,e)};function w_(r,e){ll(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var T_=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,S_=`varying vec2 vTextureCoord; +uniform sampler2D uSampler; +uniform sampler2D colorMap; +uniform float _mix; +uniform float _size; +uniform float _sliceSize; +uniform float _slicePixelSize; +uniform float _sliceInnerSize; +void main() { + vec4 color = texture2D(uSampler, vTextureCoord.xy); + + vec4 adjusted; + if (color.a > 0.0) { + color.rgb /= color.a; + float innerWidth = _size - 1.0; + float zSlice0 = min(floor(color.b * innerWidth), innerWidth); + float zSlice1 = min(zSlice0 + 1.0, innerWidth); + float xOffset = _slicePixelSize * 0.5 + color.r * _sliceInnerSize; + float s0 = xOffset + (zSlice0 * _sliceSize); + float s1 = xOffset + (zSlice1 * _sliceSize); + float yOffset = _sliceSize * 0.5 + color.g * (1.0 - _sliceSize); + vec4 slice0Color = texture2D(colorMap, vec2(s0,yOffset)); + vec4 slice1Color = texture2D(colorMap, vec2(s1,yOffset)); + float zOffset = fract(color.b * innerWidth); + adjusted = mix(slice0Color, slice1Color, zOffset); + + color.rgb *= color.a; + } + gl_FragColor = vec4(mix(color, adjusted, _mix).rgb, color.a); + +}`;(function(r){w_(e,r);function e(t,n,i){n===void 0&&(n=!1),i===void 0&&(i=1);var o=r.call(this,T_,S_)||this;return o.mix=1,o._size=0,o._sliceSize=0,o._slicePixelSize=0,o._sliceInnerSize=0,o._nearest=!1,o._scaleMode=null,o._colorMap=null,o._scaleMode=null,o.nearest=n,o.mix=i,o.colorMap=t,o}return e.prototype.apply=function(t,n,i,o){this.uniforms._mix=this.mix,t.applyFilter(this,n,i,o)},Object.defineProperty(e.prototype,"colorSize",{get:function(){return this._size},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"colorMap",{get:function(){return this._colorMap},set:function(t){var n;t&&(t instanceof mr||(t=mr.from(t)),!((n=t)===null||n===void 0)&&n.baseTexture&&(t.baseTexture.scaleMode=this._scaleMode,t.baseTexture.mipmap=fn.OFF,this._size=t.height,this._sliceSize=1/this._size,this._slicePixelSize=this._sliceSize/this._size,this._sliceInnerSize=this._slicePixelSize*(this._size-1),this.uniforms._size=this._size,this.uniforms._sliceSize=this._sliceSize,this.uniforms._slicePixelSize=this._slicePixelSize,this.uniforms._sliceInnerSize=this._sliceInnerSize,this.uniforms.colorMap=t),this._colorMap=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"nearest",{get:function(){return this._nearest},set:function(t){this._nearest=t,this._scaleMode=t?Bt.NEAREST:Bt.LINEAR;var n=this._colorMap;n&&n.baseTexture&&(n.baseTexture._glTextures={},n.baseTexture.scaleMode=this._scaleMode,n.baseTexture.mipmap=fn.OFF,n._updateID++,n.baseTexture.emit("update",n.baseTexture))},enumerable:!1,configurable:!0}),e.prototype.updateColorMap=function(){var t=this._colorMap;t&&t.baseTexture&&(t._updateID++,t.baseTexture.emit("update",t.baseTexture),this.colorMap=t)},e.prototype.destroy=function(t){t===void 0&&(t=!1),this._colorMap&&this._colorMap.destroy(t),r.prototype.destroy.call(this)},e})(De);/*! + * @pixi/filter-color-overlay - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-color-overlay is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var ul=function(r,e){return ul=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},ul(r,e)};function E_(r,e){ul(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var C_=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,A_=`varying vec2 vTextureCoord; +uniform sampler2D uSampler; +uniform vec3 color; +uniform float alpha; + +void main(void) { + vec4 currentColor = texture2D(uSampler, vTextureCoord); + gl_FragColor = vec4(mix(currentColor.rgb, color.rgb, currentColor.a * alpha), currentColor.a); +} +`;(function(r){E_(e,r);function e(t,n){t===void 0&&(t=0),n===void 0&&(n=1);var i=r.call(this,C_,A_)||this;return i._color=0,i._alpha=1,i.uniforms.color=new Float32Array(3),i.color=t,i.alpha=n,i}return Object.defineProperty(e.prototype,"color",{get:function(){return this._color},set:function(t){var n=this.uniforms.color;typeof t=="number"?(en(t,n),this._color=t):(n[0]=t[0],n[1]=t[1],n[2]=t[2],this._color=rn(n))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alpha",{get:function(){return this._alpha},set:function(t){this.uniforms.alpha=t,this._alpha=t},enumerable:!1,configurable:!0}),e})(De);/*! + * @pixi/filter-color-replace - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-color-replace is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var cl=function(r,e){return cl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},cl(r,e)};function I_(r,e){cl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var P_=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,M_=`varying vec2 vTextureCoord; +uniform sampler2D uSampler; +uniform vec3 originalColor; +uniform vec3 newColor; +uniform float epsilon; +void main(void) { + vec4 currentColor = texture2D(uSampler, vTextureCoord); + vec3 colorDiff = originalColor - (currentColor.rgb / max(currentColor.a, 0.0000000001)); + float colorDistance = length(colorDiff); + float doReplace = step(colorDistance, epsilon); + gl_FragColor = vec4(mix(currentColor.rgb, (newColor + colorDiff) * currentColor.a, doReplace), currentColor.a); +} +`;(function(r){I_(e,r);function e(t,n,i){t===void 0&&(t=16711680),n===void 0&&(n=0),i===void 0&&(i=.4);var o=r.call(this,P_,M_)||this;return o._originalColor=16711680,o._newColor=0,o.uniforms.originalColor=new Float32Array(3),o.uniforms.newColor=new Float32Array(3),o.originalColor=t,o.newColor=n,o.epsilon=i,o}return Object.defineProperty(e.prototype,"originalColor",{get:function(){return this._originalColor},set:function(t){var n=this.uniforms.originalColor;typeof t=="number"?(en(t,n),this._originalColor=t):(n[0]=t[0],n[1]=t[1],n[2]=t[2],this._originalColor=rn(n))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"newColor",{get:function(){return this._newColor},set:function(t){var n=this.uniforms.newColor;typeof t=="number"?(en(t,n),this._newColor=t):(n[0]=t[0],n[1]=t[1],n[2]=t[2],this._newColor=rn(n))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"epsilon",{get:function(){return this.uniforms.epsilon},set:function(t){this.uniforms.epsilon=t},enumerable:!1,configurable:!0}),e})(De);/*! + * @pixi/filter-convolution - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-convolution is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var hl=function(r,e){return hl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},hl(r,e)};function k_(r,e){hl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var O_=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,R_=`precision mediump float; + +varying mediump vec2 vTextureCoord; + +uniform sampler2D uSampler; +uniform vec2 texelSize; +uniform float matrix[9]; + +void main(void) +{ + vec4 c11 = texture2D(uSampler, vTextureCoord - texelSize); // top left + vec4 c12 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - texelSize.y)); // top center + vec4 c13 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y - texelSize.y)); // top right + + vec4 c21 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y)); // mid left + vec4 c22 = texture2D(uSampler, vTextureCoord); // mid center + vec4 c23 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y)); // mid right + + vec4 c31 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y + texelSize.y)); // bottom left + vec4 c32 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + texelSize.y)); // bottom center + vec4 c33 = texture2D(uSampler, vTextureCoord + texelSize); // bottom right + + gl_FragColor = + c11 * matrix[0] + c12 * matrix[1] + c13 * matrix[2] + + c21 * matrix[3] + c22 * matrix[4] + c23 * matrix[5] + + c31 * matrix[6] + c32 * matrix[7] + c33 * matrix[8]; + + gl_FragColor.a = c22.a; +} +`;(function(r){k_(e,r);function e(t,n,i){n===void 0&&(n=200),i===void 0&&(i=200);var o=r.call(this,O_,R_)||this;return o.uniforms.texelSize=new Float32Array(2),o.uniforms.matrix=new Float32Array(9),t!==void 0&&(o.matrix=t),o.width=n,o.height=i,o}return Object.defineProperty(e.prototype,"matrix",{get:function(){return this.uniforms.matrix},set:function(t){var n=this;t.forEach(function(i,o){n.uniforms.matrix[o]=i})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return 1/this.uniforms.texelSize[0]},set:function(t){this.uniforms.texelSize[0]=1/t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return 1/this.uniforms.texelSize[1]},set:function(t){this.uniforms.texelSize[1]=1/t},enumerable:!1,configurable:!0}),e})(De);/*! + * @pixi/filter-cross-hatch - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-cross-hatch is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var fl=function(r,e){return fl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},fl(r,e)};function F_(r,e){fl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var L_=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,N_=`precision mediump float; + +varying vec2 vTextureCoord; + +uniform sampler2D uSampler; + +void main(void) +{ + float lum = length(texture2D(uSampler, vTextureCoord.xy).rgb); + + gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0); + + if (lum < 1.00) + { + if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0) + { + gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0); + } + } + + if (lum < 0.75) + { + if (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0) + { + gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0); + } + } + + if (lum < 0.50) + { + if (mod(gl_FragCoord.x + gl_FragCoord.y - 5.0, 10.0) == 0.0) + { + gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0); + } + } + + if (lum < 0.3) + { + if (mod(gl_FragCoord.x - gl_FragCoord.y - 5.0, 10.0) == 0.0) + { + gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0); + } + } +} +`;(function(r){F_(e,r);function e(){return r.call(this,L_,N_)||this}return e})(De);/*! + * @pixi/filter-crt - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-crt is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var dl=function(r,e){return dl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},dl(r,e)};function D_(r,e){dl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var B_=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,U_=`varying vec2 vTextureCoord; +uniform sampler2D uSampler; + +uniform vec4 filterArea; +uniform vec2 dimensions; + +const float SQRT_2 = 1.414213; + +const float light = 1.0; + +uniform float curvature; +uniform float lineWidth; +uniform float lineContrast; +uniform bool verticalLine; +uniform float noise; +uniform float noiseSize; + +uniform float vignetting; +uniform float vignettingAlpha; +uniform float vignettingBlur; + +uniform float seed; +uniform float time; + +float rand(vec2 co) { + return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453); +} + +void main(void) +{ + vec2 pixelCoord = vTextureCoord.xy * filterArea.xy; + vec2 dir = vec2(vTextureCoord.xy * filterArea.xy / dimensions - vec2(0.5, 0.5)); + + gl_FragColor = texture2D(uSampler, vTextureCoord); + vec3 rgb = gl_FragColor.rgb; + + if (noise > 0.0 && noiseSize > 0.0) + { + pixelCoord.x = floor(pixelCoord.x / noiseSize); + pixelCoord.y = floor(pixelCoord.y / noiseSize); + float _noise = rand(pixelCoord * noiseSize * seed) - 0.5; + rgb += _noise * noise; + } + + if (lineWidth > 0.0) + { + float _c = curvature > 0. ? curvature : 1.; + float k = curvature > 0. ?(length(dir * dir) * 0.25 * _c * _c + 0.935 * _c) : 1.; + vec2 uv = dir * k; + + float v = (verticalLine ? uv.x * dimensions.x : uv.y * dimensions.y) * min(1.0, 2.0 / lineWidth ) / _c; + float j = 1. + cos(v * 1.2 - time) * 0.5 * lineContrast; + rgb *= j; + float segment = verticalLine ? mod((dir.x + .5) * dimensions.x, 4.) : mod((dir.y + .5) * dimensions.y, 4.); + rgb *= 0.99 + ceil(segment) * 0.015; + } + + if (vignetting > 0.0) + { + float outter = SQRT_2 - vignetting * SQRT_2; + float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + vignettingBlur * SQRT_2), 0.0, 1.0); + rgb *= darker + (1.0 - darker) * (1.0 - vignettingAlpha); + } + + gl_FragColor.rgb = rgb; +} +`;(function(r){D_(e,r);function e(t){var n=r.call(this,B_,U_)||this;return n.time=0,n.seed=0,n.uniforms.dimensions=new Float32Array(2),Object.assign(n,e.defaults,t),n}return e.prototype.apply=function(t,n,i,o){var a=n.filterFrame,s=a.width,l=a.height;this.uniforms.dimensions[0]=s,this.uniforms.dimensions[1]=l,this.uniforms.seed=this.seed,this.uniforms.time=this.time,t.applyFilter(this,n,i,o)},Object.defineProperty(e.prototype,"curvature",{get:function(){return this.uniforms.curvature},set:function(t){this.uniforms.curvature=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lineWidth",{get:function(){return this.uniforms.lineWidth},set:function(t){this.uniforms.lineWidth=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lineContrast",{get:function(){return this.uniforms.lineContrast},set:function(t){this.uniforms.lineContrast=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"verticalLine",{get:function(){return this.uniforms.verticalLine},set:function(t){this.uniforms.verticalLine=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"noise",{get:function(){return this.uniforms.noise},set:function(t){this.uniforms.noise=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"noiseSize",{get:function(){return this.uniforms.noiseSize},set:function(t){this.uniforms.noiseSize=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vignetting",{get:function(){return this.uniforms.vignetting},set:function(t){this.uniforms.vignetting=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vignettingAlpha",{get:function(){return this.uniforms.vignettingAlpha},set:function(t){this.uniforms.vignettingAlpha=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vignettingBlur",{get:function(){return this.uniforms.vignettingBlur},set:function(t){this.uniforms.vignettingBlur=t},enumerable:!1,configurable:!0}),e.defaults={curvature:1,lineWidth:1,lineContrast:.25,verticalLine:!1,noise:0,noiseSize:1,seed:0,vignetting:.3,vignettingAlpha:1,vignettingBlur:.3,time:0},e})(De);/*! + * @pixi/filter-dot - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-dot is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var pl=function(r,e){return pl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},pl(r,e)};function z_(r,e){pl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var j_=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,V_=`precision mediump float; + +varying vec2 vTextureCoord; +varying vec4 vColor; + +uniform vec4 filterArea; +uniform sampler2D uSampler; + +uniform float angle; +uniform float scale; + +float pattern() +{ + float s = sin(angle), c = cos(angle); + vec2 tex = vTextureCoord * filterArea.xy; + vec2 point = vec2( + c * tex.x - s * tex.y, + s * tex.x + c * tex.y + ) * scale; + return (sin(point.x) * sin(point.y)) * 4.0; +} + +void main() +{ + vec4 color = texture2D(uSampler, vTextureCoord); + float average = (color.r + color.g + color.b) / 3.0; + gl_FragColor = vec4(vec3(average * 10.0 - 5.0 + pattern()), color.a); +} +`;(function(r){z_(e,r);function e(t,n){t===void 0&&(t=1),n===void 0&&(n=5);var i=r.call(this,j_,V_)||this;return i.scale=t,i.angle=n,i}return Object.defineProperty(e.prototype,"scale",{get:function(){return this.uniforms.scale},set:function(t){this.uniforms.scale=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"angle",{get:function(){return this.uniforms.angle},set:function(t){this.uniforms.angle=t},enumerable:!1,configurable:!0}),e})(De);/*! + * @pixi/filter-drop-shadow - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-drop-shadow is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var ml=function(r,e){return ml=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},ml(r,e)};function G_(r,e){ml(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Uo=function(){return Uo=Object.assign||function(e){for(var t=arguments,n,i=1,o=arguments.length;i 1.0 || coord.y > 1.0) { + return; + } + + float cx = coord.x - 0.5; + float cy = (coord.y - 0.5) * aspect; + float ny = (-sinDir * cx + cosDir * cy) / aspect + 0.5; + + // displacementMap: repeat + // ny = ny > 1.0 ? ny - 1.0 : (ny < 0.0 ? 1.0 + ny : ny); + + // displacementMap: mirror + ny = ny > 1.0 ? 2.0 - ny : (ny < 0.0 ? -ny : ny); + + vec4 dc = texture2D(displacementMap, vec2(0.5, ny)); + + float displacement = (dc.r - dc.g) * (offset / filterArea.x); + + coord = vTextureCoord + vec2(cosDir * displacement, sinDir * displacement * aspect); + + if (fillMode == CLAMP) { + coord = clamp(coord, filterClamp.xy, filterClamp.zw); + } else { + if( coord.x > filterClamp.z ) { + if (fillMode == TRANSPARENT) { + discard; + } else if (fillMode == LOOP) { + coord.x -= filterClamp.z; + } else if (fillMode == MIRROR) { + coord.x = filterClamp.z * 2.0 - coord.x; + } + } else if( coord.x < filterClamp.x ) { + if (fillMode == TRANSPARENT) { + discard; + } else if (fillMode == LOOP) { + coord.x += filterClamp.z; + } else if (fillMode == MIRROR) { + coord.x *= -filterClamp.z; + } + } + + if( coord.y > filterClamp.w ) { + if (fillMode == TRANSPARENT) { + discard; + } else if (fillMode == LOOP) { + coord.y -= filterClamp.w; + } else if (fillMode == MIRROR) { + coord.y = filterClamp.w * 2.0 - coord.y; + } + } else if( coord.y < filterClamp.y ) { + if (fillMode == TRANSPARENT) { + discard; + } else if (fillMode == LOOP) { + coord.y += filterClamp.w; + } else if (fillMode == MIRROR) { + coord.y *= -filterClamp.w; + } + } + } + + gl_FragColor.r = texture2D(uSampler, coord + red * (1.0 - seed * 0.4) / filterArea.xy).r; + gl_FragColor.g = texture2D(uSampler, coord + green * (1.0 - seed * 0.3) / filterArea.xy).g; + gl_FragColor.b = texture2D(uSampler, coord + blue * (1.0 - seed * 0.2) / filterArea.xy).b; + gl_FragColor.a = texture2D(uSampler, coord).a; +} +`;(function(r){K_(e,r);function e(t){var n=r.call(this,Z_,J_)||this;return n.offset=100,n.fillMode=e.TRANSPARENT,n.average=!1,n.seed=0,n.minSize=8,n.sampleSize=512,n._slices=0,n._offsets=new Float32Array(1),n._sizes=new Float32Array(1),n._direction=-1,n.uniforms.dimensions=new Float32Array(2),n._canvas=document.createElement("canvas"),n._canvas.width=4,n._canvas.height=n.sampleSize,n.texture=mr.from(n._canvas,{scaleMode:Bt.NEAREST}),Object.assign(n,e.defaults,t),n}return e.prototype.apply=function(t,n,i,o){var a=n.filterFrame,s=a.width,l=a.height;this.uniforms.dimensions[0]=s,this.uniforms.dimensions[1]=l,this.uniforms.aspect=l/s,this.uniforms.seed=this.seed,this.uniforms.offset=this.offset,this.uniforms.fillMode=this.fillMode,t.applyFilter(this,n,i,o)},e.prototype._randomizeSizes=function(){var t=this._sizes,n=this._slices-1,i=this.sampleSize,o=Math.min(this.minSize/i,.9/this._slices);if(this.average){for(var a=this._slices,s=1,l=0;l0;i--){var o=Math.random()*i>>0,a=t[i];t[i]=t[o],t[o]=a}},e.prototype._randomizeOffsets=function(){for(var t=0;t0?o:0,c=o<0?-o:0;i.fillStyle="rgba("+u+", "+c+", 0, 1)",i.fillRect(0,a>>0,t,l+1>>0),a+=l}n.baseTexture.update(),this.uniforms.displacementMap=n},Object.defineProperty(e.prototype,"sizes",{get:function(){return this._sizes},set:function(t){for(var n=Math.min(this._slices,t.length),i=0;i>0)+1},Object.defineProperty(e.prototype,"offset",{get:function(){return this.uniforms.uOffset},set:function(t){this.uniforms.uOffset=t},enumerable:!1,configurable:!0}),e})(De);/*! + * @pixi/filter-multi-color-replace - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-multi-color-replace is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var bl=function(r,e){return bl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},bl(r,e)};function ux(r,e){bl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var cx=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,hx=`varying vec2 vTextureCoord; +uniform sampler2D uSampler; + +uniform float epsilon; + +const int MAX_COLORS = %maxColors%; + +uniform vec3 originalColors[MAX_COLORS]; +uniform vec3 targetColors[MAX_COLORS]; + +void main(void) +{ + gl_FragColor = texture2D(uSampler, vTextureCoord); + + float alpha = gl_FragColor.a; + if (alpha < 0.0001) + { + return; + } + + vec3 color = gl_FragColor.rgb / alpha; + + for(int i = 0; i < MAX_COLORS; i++) + { + vec3 origColor = originalColors[i]; + if (origColor.r < 0.0) + { + break; + } + vec3 colorDiff = origColor - color; + if (length(colorDiff) < epsilon) + { + vec3 targetColor = targetColors[i]; + gl_FragColor = vec4((targetColor + colorDiff) * alpha, alpha); + return; + } + } +} +`;(function(r){ux(e,r);function e(t,n,i){n===void 0&&(n=.05),i===void 0&&(i=t.length);var o=r.call(this,cx,hx.replace(/%maxColors%/g,i.toFixed(0)))||this;return o._replacements=[],o._maxColors=0,o.epsilon=n,o._maxColors=i,o.uniforms.originalColors=new Float32Array(i*3),o.uniforms.targetColors=new Float32Array(i*3),o.replacements=t,o}return Object.defineProperty(e.prototype,"replacements",{get:function(){return this._replacements},set:function(t){var n=this.uniforms.originalColors,i=this.uniforms.targetColors,o=t.length;if(o>this._maxColors)throw new Error("Length of replacements ("+o+") exceeds the maximum colors length ("+this._maxColors+")");n[o*3]=-1;for(var a=0;a 0.5) then: 1 - 2 * (1 - dst) * (1 - src) + return vec3((dst.x <= 0.5) ? (2.0 * src.x * dst.x) : (1.0 - 2.0 * (1.0 - dst.x) * (1.0 - src.x)), + (dst.y <= 0.5) ? (2.0 * src.y * dst.y) : (1.0 - 2.0 * (1.0 - dst.y) * (1.0 - src.y)), + (dst.z <= 0.5) ? (2.0 * src.z * dst.z) : (1.0 - 2.0 * (1.0 - dst.z) * (1.0 - src.z))); +} + + +void main() +{ + gl_FragColor = texture2D(uSampler, vTextureCoord); + vec3 color = gl_FragColor.rgb; + + if (sepia > 0.0) + { + float gray = (color.x + color.y + color.z) / 3.0; + vec3 grayscale = vec3(gray); + + color = Overlay(SEPIA_RGB, grayscale); + + color = grayscale + sepia * (color - grayscale); + } + + vec2 coord = vTextureCoord * filterArea.xy / dimensions.xy; + + if (vignetting > 0.0) + { + float outter = SQRT_2 - vignetting * SQRT_2; + vec2 dir = vec2(vec2(0.5, 0.5) - coord); + dir.y *= dimensions.y / dimensions.x; + float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + vignettingBlur * SQRT_2), 0.0, 1.0); + color.rgb *= darker + (1.0 - darker) * (1.0 - vignettingAlpha); + } + + if (scratchDensity > seed && scratch != 0.0) + { + float phase = seed * 256.0; + float s = mod(floor(phase), 2.0); + float dist = 1.0 / scratchDensity; + float d = distance(coord, vec2(seed * dist, abs(s - seed * dist))); + if (d < seed * 0.6 + 0.4) + { + highp float period = scratchDensity * 10.0; + + float xx = coord.x * period + phase; + float aa = abs(mod(xx, 0.5) * 4.0); + float bb = mod(floor(xx / 0.5), 2.0); + float yy = (1.0 - bb) * aa + bb * (2.0 - aa); + + float kk = 2.0 * period; + float dw = scratchWidth / dimensions.x * (0.75 + seed); + float dh = dw * kk; + + float tine = (yy - (2.0 - dh)); + + if (tine > 0.0) { + float _sign = sign(scratch); + + tine = s * tine / period + scratch + 0.1; + tine = clamp(tine + 1.0, 0.5 + _sign * 0.5, 1.5 + _sign * 0.5); + + color.rgb *= tine; + } + } + } + + if (noise > 0.0 && noiseSize > 0.0) + { + vec2 pixelCoord = vTextureCoord.xy * filterArea.xy; + pixelCoord.x = floor(pixelCoord.x / noiseSize); + pixelCoord.y = floor(pixelCoord.y / noiseSize); + // vec2 d = pixelCoord * noiseSize * vec2(1024.0 + seed * 512.0, 1024.0 - seed * 512.0); + // float _noise = snoise(d) * 0.5; + float _noise = rand(pixelCoord * noiseSize * seed) - 0.5; + color += _noise * noise; + } + + gl_FragColor.rgb = color; +} +`;(function(r){fx(e,r);function e(t,n){n===void 0&&(n=0);var i=r.call(this,dx,px)||this;return i.seed=0,i.uniforms.dimensions=new Float32Array(2),typeof t=="number"?(i.seed=t,t=void 0):i.seed=n,Object.assign(i,e.defaults,t),i}return e.prototype.apply=function(t,n,i,o){var a,s;this.uniforms.dimensions[0]=(a=n.filterFrame)===null||a===void 0?void 0:a.width,this.uniforms.dimensions[1]=(s=n.filterFrame)===null||s===void 0?void 0:s.height,this.uniforms.seed=this.seed,t.applyFilter(this,n,i,o)},Object.defineProperty(e.prototype,"sepia",{get:function(){return this.uniforms.sepia},set:function(t){this.uniforms.sepia=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"noise",{get:function(){return this.uniforms.noise},set:function(t){this.uniforms.noise=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"noiseSize",{get:function(){return this.uniforms.noiseSize},set:function(t){this.uniforms.noiseSize=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scratch",{get:function(){return this.uniforms.scratch},set:function(t){this.uniforms.scratch=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scratchDensity",{get:function(){return this.uniforms.scratchDensity},set:function(t){this.uniforms.scratchDensity=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scratchWidth",{get:function(){return this.uniforms.scratchWidth},set:function(t){this.uniforms.scratchWidth=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vignetting",{get:function(){return this.uniforms.vignetting},set:function(t){this.uniforms.vignetting=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vignettingAlpha",{get:function(){return this.uniforms.vignettingAlpha},set:function(t){this.uniforms.vignettingAlpha=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vignettingBlur",{get:function(){return this.uniforms.vignettingBlur},set:function(t){this.uniforms.vignettingBlur=t},enumerable:!1,configurable:!0}),e.defaults={sepia:.3,noise:.3,noiseSize:1,scratch:.5,scratchDensity:.3,scratchWidth:1,vignetting:.3,vignettingAlpha:1,vignettingBlur:.3},e})(De);/*! + * @pixi/filter-outline - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-outline is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var Tl=function(r,e){return Tl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},Tl(r,e)};function mx(r,e){Tl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var gx=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,vx=`varying vec2 vTextureCoord; +uniform sampler2D uSampler; + +uniform vec2 thickness; +uniform vec4 outlineColor; +uniform vec4 filterClamp; + +const float DOUBLE_PI = 3.14159265358979323846264 * 2.; + +void main(void) { + vec4 ownColor = texture2D(uSampler, vTextureCoord); + vec4 curColor; + float maxAlpha = 0.; + vec2 displaced; + for (float angle = 0.; angle <= DOUBLE_PI; angle += \${angleStep}) { + displaced.x = vTextureCoord.x + thickness.x * cos(angle); + displaced.y = vTextureCoord.y + thickness.y * sin(angle); + curColor = texture2D(uSampler, clamp(displaced, filterClamp.xy, filterClamp.zw)); + maxAlpha = max(maxAlpha, curColor.a); + } + float resultAlpha = max(maxAlpha, ownColor.a); + gl_FragColor = vec4((ownColor.rgb + outlineColor.rgb * (1. - ownColor.a)) * resultAlpha, resultAlpha); +} +`;(function(r){mx(e,r);function e(t,n,i){t===void 0&&(t=1),n===void 0&&(n=0),i===void 0&&(i=.1);var o=r.call(this,gx,vx.replace(/\$\{angleStep\}/,e.getAngleStep(i)))||this;return o._thickness=1,o.uniforms.thickness=new Float32Array([0,0]),o.uniforms.outlineColor=new Float32Array([0,0,0,1]),Object.assign(o,{thickness:t,color:n,quality:i}),o}return e.getAngleStep=function(t){var n=Math.max(t*e.MAX_SAMPLES,e.MIN_SAMPLES);return(Math.PI*2/n).toFixed(7)},e.prototype.apply=function(t,n,i,o){this.uniforms.thickness[0]=this._thickness/n._frame.width,this.uniforms.thickness[1]=this._thickness/n._frame.height,t.applyFilter(this,n,i,o)},Object.defineProperty(e.prototype,"color",{get:function(){return rn(this.uniforms.outlineColor)},set:function(t){en(t,this.uniforms.outlineColor)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness=t,this.padding=t},enumerable:!1,configurable:!0}),e.MIN_SAMPLES=1,e.MAX_SAMPLES=100,e})(De);/*! + * @pixi/filter-pixelate - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-pixelate is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var Sl=function(r,e){return Sl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},Sl(r,e)};function yx(r,e){Sl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var _x=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,xx=`precision mediump float; + +varying vec2 vTextureCoord; + +uniform vec2 size; +uniform sampler2D uSampler; + +uniform vec4 filterArea; + +vec2 mapCoord( vec2 coord ) +{ + coord *= filterArea.xy; + coord += filterArea.zw; + + return coord; +} + +vec2 unmapCoord( vec2 coord ) +{ + coord -= filterArea.zw; + coord /= filterArea.xy; + + return coord; +} + +vec2 pixelate(vec2 coord, vec2 size) +{ + return floor( coord / size ) * size; +} + +void main(void) +{ + vec2 coord = mapCoord(vTextureCoord); + + coord = pixelate(coord, size); + + coord = unmapCoord(coord); + + gl_FragColor = texture2D(uSampler, coord); +} +`;(function(r){yx(e,r);function e(t){t===void 0&&(t=10);var n=r.call(this,_x,xx)||this;return n.size=t,n}return Object.defineProperty(e.prototype,"size",{get:function(){return this.uniforms.size},set:function(t){typeof t=="number"&&(t=[t,t]),this.uniforms.size=t},enumerable:!1,configurable:!0}),e})(De);/*! + * @pixi/filter-radial-blur - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-radial-blur is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var El=function(r,e){return El=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},El(r,e)};function bx(r,e){El(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var wx=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,Tx=`varying vec2 vTextureCoord; +uniform sampler2D uSampler; +uniform vec4 filterArea; + +uniform float uRadian; +uniform vec2 uCenter; +uniform float uRadius; +uniform int uKernelSize; + +const int MAX_KERNEL_SIZE = 2048; + +void main(void) +{ + vec4 color = texture2D(uSampler, vTextureCoord); + + if (uKernelSize == 0) + { + gl_FragColor = color; + return; + } + + float aspect = filterArea.y / filterArea.x; + vec2 center = uCenter.xy / filterArea.xy; + float gradient = uRadius / filterArea.x * 0.3; + float radius = uRadius / filterArea.x - gradient * 0.5; + int k = uKernelSize - 1; + + vec2 coord = vTextureCoord; + vec2 dir = vec2(center - coord); + float dist = length(vec2(dir.x, dir.y * aspect)); + + float radianStep = uRadian; + if (radius >= 0.0 && dist > radius) { + float delta = dist - radius; + float gap = gradient; + float scale = 1.0 - abs(delta / gap); + if (scale <= 0.0) { + gl_FragColor = color; + return; + } + radianStep *= scale; + } + radianStep /= float(k); + + float s = sin(radianStep); + float c = cos(radianStep); + mat2 rotationMatrix = mat2(vec2(c, -s), vec2(s, c)); + + for(int i = 0; i < MAX_KERNEL_SIZE - 1; i++) { + if (i == k) { + break; + } + + coord -= center; + coord.y *= aspect; + coord = rotationMatrix * coord; + coord.y /= aspect; + coord += center; + + vec4 sample = texture2D(uSampler, coord); + + // switch to pre-multiplied alpha to correctly blur transparent images + // sample.rgb *= sample.a; + + color += sample; + } + + gl_FragColor = color / float(uKernelSize); +} +`;(function(r){bx(e,r);function e(t,n,i,o){t===void 0&&(t=0),n===void 0&&(n=[0,0]),i===void 0&&(i=5),o===void 0&&(o=-1);var a=r.call(this,wx,Tx)||this;return a._angle=0,a.angle=t,a.center=n,a.kernelSize=i,a.radius=o,a}return e.prototype.apply=function(t,n,i,o){this.uniforms.uKernelSize=this._angle!==0?this.kernelSize:0,t.applyFilter(this,n,i,o)},Object.defineProperty(e.prototype,"angle",{get:function(){return this._angle},set:function(t){this._angle=t,this.uniforms.uRadian=t*Math.PI/180},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"center",{get:function(){return this.uniforms.uCenter},set:function(t){this.uniforms.uCenter=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"radius",{get:function(){return this.uniforms.uRadius},set:function(t){(t<0||t===1/0)&&(t=-1),this.uniforms.uRadius=t},enumerable:!1,configurable:!0}),e})(De);/*! + * @pixi/filter-reflection - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-reflection is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var Cl=function(r,e){return Cl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},Cl(r,e)};function Sx(r,e){Cl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Ex=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,Cx=`varying vec2 vTextureCoord; +uniform sampler2D uSampler; + +uniform vec4 filterArea; +uniform vec4 filterClamp; +uniform vec2 dimensions; + +uniform bool mirror; +uniform float boundary; +uniform vec2 amplitude; +uniform vec2 waveLength; +uniform vec2 alpha; +uniform float time; + +float rand(vec2 co) { + return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453); +} + +void main(void) +{ + vec2 pixelCoord = vTextureCoord.xy * filterArea.xy; + vec2 coord = pixelCoord / dimensions; + + if (coord.y < boundary) { + gl_FragColor = texture2D(uSampler, vTextureCoord); + return; + } + + float k = (coord.y - boundary) / (1. - boundary + 0.0001); + float areaY = boundary * dimensions.y / filterArea.y; + float v = areaY + areaY - vTextureCoord.y; + float y = mirror ? v : vTextureCoord.y; + + float _amplitude = ((amplitude.y - amplitude.x) * k + amplitude.x ) / filterArea.x; + float _waveLength = ((waveLength.y - waveLength.x) * k + waveLength.x) / filterArea.y; + float _alpha = (alpha.y - alpha.x) * k + alpha.x; + + float x = vTextureCoord.x + cos(v * 6.28 / _waveLength - time) * _amplitude; + x = clamp(x, filterClamp.x, filterClamp.z); + + vec4 color = texture2D(uSampler, vec2(x, y)); + + gl_FragColor = color * _alpha; +} +`;(function(r){Sx(e,r);function e(t){var n=r.call(this,Ex,Cx)||this;return n.time=0,n.uniforms.amplitude=new Float32Array(2),n.uniforms.waveLength=new Float32Array(2),n.uniforms.alpha=new Float32Array(2),n.uniforms.dimensions=new Float32Array(2),Object.assign(n,e.defaults,t),n}return e.prototype.apply=function(t,n,i,o){var a,s;this.uniforms.dimensions[0]=(a=n.filterFrame)===null||a===void 0?void 0:a.width,this.uniforms.dimensions[1]=(s=n.filterFrame)===null||s===void 0?void 0:s.height,this.uniforms.time=this.time,t.applyFilter(this,n,i,o)},Object.defineProperty(e.prototype,"mirror",{get:function(){return this.uniforms.mirror},set:function(t){this.uniforms.mirror=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"boundary",{get:function(){return this.uniforms.boundary},set:function(t){this.uniforms.boundary=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"amplitude",{get:function(){return this.uniforms.amplitude},set:function(t){this.uniforms.amplitude[0]=t[0],this.uniforms.amplitude[1]=t[1]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"waveLength",{get:function(){return this.uniforms.waveLength},set:function(t){this.uniforms.waveLength[0]=t[0],this.uniforms.waveLength[1]=t[1]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alpha",{get:function(){return this.uniforms.alpha},set:function(t){this.uniforms.alpha[0]=t[0],this.uniforms.alpha[1]=t[1]},enumerable:!1,configurable:!0}),e.defaults={mirror:!0,boundary:.5,amplitude:[0,20],waveLength:[30,100],alpha:[1,1],time:0},e})(De);/*! + * @pixi/filter-rgb-split - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-rgb-split is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var Al=function(r,e){return Al=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},Al(r,e)};function Ax(r,e){Al(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Ix=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,Px=`precision mediump float; + +varying vec2 vTextureCoord; + +uniform sampler2D uSampler; +uniform vec4 filterArea; +uniform vec2 red; +uniform vec2 green; +uniform vec2 blue; + +void main(void) +{ + gl_FragColor.r = texture2D(uSampler, vTextureCoord + red/filterArea.xy).r; + gl_FragColor.g = texture2D(uSampler, vTextureCoord + green/filterArea.xy).g; + gl_FragColor.b = texture2D(uSampler, vTextureCoord + blue/filterArea.xy).b; + gl_FragColor.a = texture2D(uSampler, vTextureCoord).a; +} +`;(function(r){Ax(e,r);function e(t,n,i){t===void 0&&(t=[-10,0]),n===void 0&&(n=[0,10]),i===void 0&&(i=[0,0]);var o=r.call(this,Ix,Px)||this;return o.red=t,o.green=n,o.blue=i,o}return Object.defineProperty(e.prototype,"red",{get:function(){return this.uniforms.red},set:function(t){this.uniforms.red=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"green",{get:function(){return this.uniforms.green},set:function(t){this.uniforms.green=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blue",{get:function(){return this.uniforms.blue},set:function(t){this.uniforms.blue=t},enumerable:!1,configurable:!0}),e})(De);/*! + * @pixi/filter-shockwave - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-shockwave is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var Il=function(r,e){return Il=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},Il(r,e)};function Mx(r,e){Il(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var kx=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,Ox=`varying vec2 vTextureCoord; +uniform sampler2D uSampler; +uniform vec4 filterArea; +uniform vec4 filterClamp; + +uniform vec2 center; + +uniform float amplitude; +uniform float wavelength; +// uniform float power; +uniform float brightness; +uniform float speed; +uniform float radius; + +uniform float time; + +const float PI = 3.14159; + +void main() +{ + float halfWavelength = wavelength * 0.5 / filterArea.x; + float maxRadius = radius / filterArea.x; + float currentRadius = time * speed / filterArea.x; + + float fade = 1.0; + + if (maxRadius > 0.0) { + if (currentRadius > maxRadius) { + gl_FragColor = texture2D(uSampler, vTextureCoord); + return; + } + fade = 1.0 - pow(currentRadius / maxRadius, 2.0); + } + + vec2 dir = vec2(vTextureCoord - center / filterArea.xy); + dir.y *= filterArea.y / filterArea.x; + float dist = length(dir); + + if (dist <= 0.0 || dist < currentRadius - halfWavelength || dist > currentRadius + halfWavelength) { + gl_FragColor = texture2D(uSampler, vTextureCoord); + return; + } + + vec2 diffUV = normalize(dir); + + float diff = (dist - currentRadius) / halfWavelength; + + float p = 1.0 - pow(abs(diff), 2.0); + + // float powDiff = diff * pow(p, 2.0) * ( amplitude * fade ); + float powDiff = 1.25 * sin(diff * PI) * p * ( amplitude * fade ); + + vec2 offset = diffUV * powDiff / filterArea.xy; + + // Do clamp : + vec2 coord = vTextureCoord + offset; + vec2 clampedCoord = clamp(coord, filterClamp.xy, filterClamp.zw); + vec4 color = texture2D(uSampler, clampedCoord); + if (coord != clampedCoord) { + color *= max(0.0, 1.0 - length(coord - clampedCoord)); + } + + // No clamp : + // gl_FragColor = texture2D(uSampler, vTextureCoord + offset); + + color.rgb *= 1.0 + (brightness - 1.0) * p * fade; + + gl_FragColor = color; +} +`;(function(r){Mx(e,r);function e(t,n,i){t===void 0&&(t=[0,0]),i===void 0&&(i=0);var o=r.call(this,kx,Ox)||this;return o.center=t,Object.assign(o,e.defaults,n),o.time=i,o}return e.prototype.apply=function(t,n,i,o){this.uniforms.time=this.time,t.applyFilter(this,n,i,o)},Object.defineProperty(e.prototype,"center",{get:function(){return this.uniforms.center},set:function(t){this.uniforms.center=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"amplitude",{get:function(){return this.uniforms.amplitude},set:function(t){this.uniforms.amplitude=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"wavelength",{get:function(){return this.uniforms.wavelength},set:function(t){this.uniforms.wavelength=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"brightness",{get:function(){return this.uniforms.brightness},set:function(t){this.uniforms.brightness=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"speed",{get:function(){return this.uniforms.speed},set:function(t){this.uniforms.speed=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"radius",{get:function(){return this.uniforms.radius},set:function(t){this.uniforms.radius=t},enumerable:!1,configurable:!0}),e.defaults={amplitude:30,wavelength:160,brightness:1,speed:500,radius:-1},e})(De);/*! + * @pixi/filter-simple-lightmap - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-simple-lightmap is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var Pl=function(r,e){return Pl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},Pl(r,e)};function Rx(r,e){Pl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Fx=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,Lx=`varying vec2 vTextureCoord; +uniform sampler2D uSampler; +uniform sampler2D uLightmap; +uniform vec4 filterArea; +uniform vec2 dimensions; +uniform vec4 ambientColor; +void main() { + vec4 diffuseColor = texture2D(uSampler, vTextureCoord); + vec2 lightCoord = (vTextureCoord * filterArea.xy) / dimensions; + vec4 light = texture2D(uLightmap, lightCoord); + vec3 ambient = ambientColor.rgb * ambientColor.a; + vec3 intensity = ambient + light.rgb; + vec3 finalColor = diffuseColor.rgb * intensity; + gl_FragColor = vec4(finalColor, diffuseColor.a); +} +`;(function(r){Rx(e,r);function e(t,n,i){n===void 0&&(n=0),i===void 0&&(i=1);var o=r.call(this,Fx,Lx)||this;return o._color=0,o.uniforms.dimensions=new Float32Array(2),o.uniforms.ambientColor=new Float32Array([0,0,0,i]),o.texture=t,o.color=n,o}return e.prototype.apply=function(t,n,i,o){var a,s;this.uniforms.dimensions[0]=(a=n.filterFrame)===null||a===void 0?void 0:a.width,this.uniforms.dimensions[1]=(s=n.filterFrame)===null||s===void 0?void 0:s.height,t.applyFilter(this,n,i,o)},Object.defineProperty(e.prototype,"texture",{get:function(){return this.uniforms.uLightmap},set:function(t){this.uniforms.uLightmap=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"color",{get:function(){return this._color},set:function(t){var n=this.uniforms.ambientColor;typeof t=="number"?(en(t,n),this._color=t):(n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],this._color=rn(n))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alpha",{get:function(){return this.uniforms.ambientColor[3]},set:function(t){this.uniforms.ambientColor[3]=t},enumerable:!1,configurable:!0}),e})(De);/*! + * @pixi/filter-tilt-shift - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-tilt-shift is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var Ml=function(r,e){return Ml=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},Ml(r,e)};function ea(r,e){Ml(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Nx=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,Dx=`varying vec2 vTextureCoord; + +uniform sampler2D uSampler; +uniform float blur; +uniform float gradientBlur; +uniform vec2 start; +uniform vec2 end; +uniform vec2 delta; +uniform vec2 texSize; + +float random(vec3 scale, float seed) +{ + return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed); +} + +void main(void) +{ + vec4 color = vec4(0.0); + float total = 0.0; + + float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0); + vec2 normal = normalize(vec2(start.y - end.y, end.x - start.x)); + float radius = smoothstep(0.0, 1.0, abs(dot(vTextureCoord * texSize - start, normal)) / gradientBlur) * blur; + + for (float t = -30.0; t <= 30.0; t++) + { + float percent = (t + offset - 0.5) / 30.0; + float weight = 1.0 - abs(percent); + vec4 sample = texture2D(uSampler, vTextureCoord + delta / texSize * percent * radius); + sample.rgb *= sample.a; + color += sample * weight; + total += weight; + } + + color /= total; + color.rgb /= color.a + 0.00001; + + gl_FragColor = color; +} +`,tp=function(r){ea(e,r);function e(t,n,i,o){t===void 0&&(t=100),n===void 0&&(n=600);var a=r.call(this,Nx,Dx)||this;return a.uniforms.blur=t,a.uniforms.gradientBlur=n,a.uniforms.start=i||new st(0,window.innerHeight/2),a.uniforms.end=o||new st(600,window.innerHeight/2),a.uniforms.delta=new st(30,30),a.uniforms.texSize=new st(window.innerWidth,window.innerHeight),a.updateDelta(),a}return e.prototype.updateDelta=function(){this.uniforms.delta.x=0,this.uniforms.delta.y=0},Object.defineProperty(e.prototype,"blur",{get:function(){return this.uniforms.blur},set:function(t){this.uniforms.blur=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"gradientBlur",{get:function(){return this.uniforms.gradientBlur},set:function(t){this.uniforms.gradientBlur=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"start",{get:function(){return this.uniforms.start},set:function(t){this.uniforms.start=t,this.updateDelta()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"end",{get:function(){return this.uniforms.end},set:function(t){this.uniforms.end=t,this.updateDelta()},enumerable:!1,configurable:!0}),e}(De),Bx=function(r){ea(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.updateDelta=function(){var t=this.uniforms.end.x-this.uniforms.start.x,n=this.uniforms.end.y-this.uniforms.start.y,i=Math.sqrt(t*t+n*n);this.uniforms.delta.x=t/i,this.uniforms.delta.y=n/i},e}(tp),Ux=function(r){ea(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.updateDelta=function(){var t=this.uniforms.end.x-this.uniforms.start.x,n=this.uniforms.end.y-this.uniforms.start.y,i=Math.sqrt(t*t+n*n);this.uniforms.delta.x=-n/i,this.uniforms.delta.y=t/i},e}(tp);(function(r){ea(e,r);function e(t,n,i,o){t===void 0&&(t=100),n===void 0&&(n=600);var a=r.call(this)||this;return a.tiltShiftXFilter=new Bx(t,n,i,o),a.tiltShiftYFilter=new Ux(t,n,i,o),a}return e.prototype.apply=function(t,n,i,o){var a=t.getFilterTexture();this.tiltShiftXFilter.apply(t,n,a,1),this.tiltShiftYFilter.apply(t,a,i,o),t.returnFilterTexture(a)},Object.defineProperty(e.prototype,"blur",{get:function(){return this.tiltShiftXFilter.blur},set:function(t){this.tiltShiftXFilter.blur=this.tiltShiftYFilter.blur=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"gradientBlur",{get:function(){return this.tiltShiftXFilter.gradientBlur},set:function(t){this.tiltShiftXFilter.gradientBlur=this.tiltShiftYFilter.gradientBlur=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"start",{get:function(){return this.tiltShiftXFilter.start},set:function(t){this.tiltShiftXFilter.start=this.tiltShiftYFilter.start=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"end",{get:function(){return this.tiltShiftXFilter.end},set:function(t){this.tiltShiftXFilter.end=this.tiltShiftYFilter.end=t},enumerable:!1,configurable:!0}),e})(De);/*! + * @pixi/filter-twist - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-twist is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var kl=function(r,e){return kl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},kl(r,e)};function zx(r,e){kl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var jx=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,Vx=`varying vec2 vTextureCoord; + +uniform sampler2D uSampler; +uniform float radius; +uniform float angle; +uniform vec2 offset; +uniform vec4 filterArea; + +vec2 mapCoord( vec2 coord ) +{ + coord *= filterArea.xy; + coord += filterArea.zw; + + return coord; +} + +vec2 unmapCoord( vec2 coord ) +{ + coord -= filterArea.zw; + coord /= filterArea.xy; + + return coord; +} + +vec2 twist(vec2 coord) +{ + coord -= offset; + + float dist = length(coord); + + if (dist < radius) + { + float ratioDist = (radius - dist) / radius; + float angleMod = ratioDist * ratioDist * angle; + float s = sin(angleMod); + float c = cos(angleMod); + coord = vec2(coord.x * c - coord.y * s, coord.x * s + coord.y * c); + } + + coord += offset; + + return coord; +} + +void main(void) +{ + + vec2 coord = mapCoord(vTextureCoord); + + coord = twist(coord); + + coord = unmapCoord(coord); + + gl_FragColor = texture2D(uSampler, coord ); + +} +`;(function(r){zx(e,r);function e(t){var n=r.call(this,jx,Vx)||this;return Object.assign(n,e.defaults,t),n}return Object.defineProperty(e.prototype,"offset",{get:function(){return this.uniforms.offset},set:function(t){this.uniforms.offset=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"radius",{get:function(){return this.uniforms.radius},set:function(t){this.uniforms.radius=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"angle",{get:function(){return this.uniforms.angle},set:function(t){this.uniforms.angle=t},enumerable:!1,configurable:!0}),e.defaults={radius:200,angle:4,padding:20,offset:new st},e})(De);/*! + * @pixi/filter-zoom-blur - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-zoom-blur is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var Ol=function(r,e){return Ol=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},Ol(r,e)};function Gx(r,e){Ol(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function $x(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i= 0.0 && dist > radius) { // radius < 0 means it's infinity + delta = dist - radius; + gap = gradient; + } + + if (delta > 0.0) { + float normalCount = gap / filterArea.x; + delta = (normalCount - delta) / normalCount; + countLimit *= delta; + strength *= delta; + if (countLimit < 1.0) + { + gl_FragColor = texture2D(uSampler, vTextureCoord); + return; + } + } + + // randomize the lookup values to hide the fixed number of samples + float offset = rand(vTextureCoord, 0.0); + + float total = 0.0; + vec4 color = vec4(0.0); + + dir *= strength; + + for (float t = 0.0; t < MAX_KERNEL_SIZE; t++) { + float percent = (t + offset) / MAX_KERNEL_SIZE; + float weight = 4.0 * (percent - percent * percent); + vec2 p = vTextureCoord + dir * percent; + vec4 sample = texture2D(uSampler, p); + + // switch to pre-multiplied alpha to correctly blur transparent images + // sample.rgb *= sample.a; + + color += sample * weight; + total += weight; + + if (t > countLimit){ + break; + } + } + + color /= total; + // switch back from pre-multiplied alpha + // color.rgb /= color.a + 0.00001; + + gl_FragColor = color; +} +`;(function(r){Gx(e,r);function e(t){var n=this,i=Object.assign(e.defaults,t),o=i.maxKernelSize,a=$x(i,["maxKernelSize"]);return n=r.call(this,Hx,Xx.replace("${maxKernelSize}",o.toFixed(1)))||this,Object.assign(n,a),n}return Object.defineProperty(e.prototype,"center",{get:function(){return this.uniforms.uCenter},set:function(t){this.uniforms.uCenter=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"strength",{get:function(){return this.uniforms.uStrength},set:function(t){this.uniforms.uStrength=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"innerRadius",{get:function(){return this.uniforms.uInnerRadius},set:function(t){this.uniforms.uInnerRadius=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"radius",{get:function(){return this.uniforms.uRadius},set:function(t){(t<0||t===1/0)&&(t=-1),this.uniforms.uRadius=t},enumerable:!1,configurable:!0}),e.defaults={strength:.1,center:[0,0],innerRadius:0,radius:-1,maxKernelSize:32},e})(De);var Kn=Math.pow,at=(r,e,t)=>new Promise((n,i)=>{var o=l=>{try{s(t.next(l))}catch(u){i(u)}},a=l=>{try{s(t.throw(l))}catch(u){i(u)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,a);s((t=t.apply(r,e)).next())});class yu{constructor(){this._breathParameters=[],this._currentTime=0}static create(){return new yu}setParameters(e){this._breathParameters=e}getParameters(){return this._breathParameters}updateParameters(e,t){this._currentTime+=t;const n=this._currentTime*2*3.14159;for(let i=0;i=1&&(n=1,this._blinkingState=Xt.EyeState_Closed,this._stateStartTimeSeconds=this._userTimeSeconds),t=1-n;break;case Xt.EyeState_Closed:n=(this._userTimeSeconds-this._stateStartTimeSeconds)/this._closedSeconds,n>=1&&(this._blinkingState=Xt.EyeState_Opening,this._stateStartTimeSeconds=this._userTimeSeconds),t=0;break;case Xt.EyeState_Opening:n=(this._userTimeSeconds-this._stateStartTimeSeconds)/this._openingSeconds,n>=1&&(n=1,this._blinkingState=Xt.EyeState_Interval,this._nextBlinkingTime=this.determinNextBlinkingTiming()),t=n;break;case Xt.EyeState_Interval:this._nextBlinkingTime(r[r.EyeState_First=0]="EyeState_First",r[r.EyeState_Interval=1]="EyeState_Interval",r[r.EyeState_Closing=2]="EyeState_Closing",r[r.EyeState_Closed=3]="EyeState_Closed",r[r.EyeState_Opening=4]="EyeState_Opening",r))(Xt||{});const Wx=.001,Mh=.5;class _u{static create(e){const t=new _u;typeof e.FadeInTime=="number"&&(t._fadeTimeSeconds=e.FadeInTime,t._fadeTimeSeconds<=0&&(t._fadeTimeSeconds=Mh));const n=e.Groups,i=n.length;for(let o=0;oWx){if(o>=0)break;o=u,a=e.getPartOpacityByIndex(c),a+=t/this._fadeTimeSeconds,a>1&&(a=1)}}o<0&&(o=0,a=1);for(let u=n;ul&&(p=1-l/(1-a)),h>p&&(h=p),e.setPartOpacityByIndex(c,h)}}}constructor(){this._fadeTimeSeconds=Mh,this._lastModel=void 0,this._partGroups=[],this._partGroupCounts=[]}}class zo{constructor(e){this.parameterIndex=0,this.partIndex=0,this.partId="",this.link=[],e!=null&&this.assignment(e)}assignment(e){return this.partId=e.partId,this.link=e.link.map(t=>t.clone()),this}initialize(e){this.parameterIndex=e.getParameterIndex(this.partId),this.partIndex=e.getPartIndex(this.partId),e.setParameterValueByIndex(this.parameterIndex,1)}clone(){const e=new zo;return e.partId=this.partId,e.parameterIndex=this.parameterIndex,e.partIndex=this.partIndex,e.link=this.link.map(t=>t.clone()),e}}class Me{constructor(e,t){this.x=e||0,this.y=t||0}add(e){const t=new Me(0,0);return t.x=this.x+e.x,t.y=this.y+e.y,t}substract(e){const t=new Me(0,0);return t.x=this.x-e.x,t.y=this.y-e.y,t}multiply(e){const t=new Me(0,0);return t.x=this.x*e.x,t.y=this.y*e.y,t}multiplyByScaler(e){return this.multiply(new Me(e,e))}division(e){const t=new Me(0,0);return t.x=this.x/e.x,t.y=this.y/e.y,t}divisionByScalar(e){return this.division(new Me(e,e))}getLength(){return Math.sqrt(this.x*this.x+this.y*this.y)}getDistanceWith(e){return Math.sqrt((this.x-e.x)*(this.x-e.x)+(this.y-e.y)*(this.y-e.y))}dot(e){return this.x*e.x+this.y*e.y}normalize(){const e=Math.pow(this.x*this.x+this.y*this.y,.5);this.x=this.x/e,this.y=this.y/e}isEqual(e){return this.x==e.x&&this.y==e.y}isNotEqual(e){return!this.isEqual(e)}}const bo=class{static range(r,e,t){return rt&&(r=t),r}static sin(r){return Math.sin(r)}static cos(r){return Math.cos(r)}static abs(r){return Math.abs(r)}static sqrt(r){return Math.sqrt(r)}static cbrt(r){if(r===0)return r;let e=r;const t=e<0;t&&(e=-e);let n;return e===1/0?n=1/0:(n=Math.exp(Math.log(e)/3),n=(e/(n*n)+2*n)/3),t?-n:n}static getEasingSine(r){return r<0?0:r>1?1:.5-.5*this.cos(r*Math.PI)}static max(r,e){return r>e?r:e}static min(r,e){return r>e?e:r}static degreesToRadian(r){return r/180*Math.PI}static radianToDegrees(r){return r*180/Math.PI}static directionToRadian(r,e){const t=Math.atan2(e.y,e.x),n=Math.atan2(r.y,r.x);let i=t-n;for(;i<-Math.PI;)i+=Math.PI*2;for(;i>Math.PI;)i-=Math.PI*2;return i}static directionToDegrees(r,e){const t=this.directionToRadian(r,e);let n=this.radianToDegrees(t);return e.x-r.x>0&&(n=-n),n}static radianToDirection(r){const e=new Me;return e.x=this.sin(r),e.y=this.cos(r),e}static quadraticEquation(r,e,t){return this.abs(r)1&&(e=1),t<0?t=0:t>1&&(t=1),n<0?n=0:n>1&&(n=1),i<0?i=0:i>1&&(i=1),this._modelColor.R=e,this._modelColor.G=t,this._modelColor.B=n,this._modelColor.A=i}getModelColor(){return Object.assign({},this._modelColor)}setIsPremultipliedAlpha(e){this._isPremultipliedAlpha=e}isPremultipliedAlpha(){return this._isPremultipliedAlpha}setIsCulling(e){this._isCulling=e}isCulling(){return this._isCulling}setAnisotropy(e){this._anisortopy=e}getAnisotropy(){return this._anisortopy}getModel(){return this._model}constructor(){this._isCulling=!1,this._isPremultipliedAlpha=!1,this._anisortopy=0,this._modelColor=new pi,this._mvpMatrix4x4=new Zt,this._mvpMatrix4x4.loadIdentity()}}var Dn=(r=>(r[r.CubismBlendMode_Normal=0]="CubismBlendMode_Normal",r[r.CubismBlendMode_Additive=1]="CubismBlendMode_Additive",r[r.CubismBlendMode_Multiplicative=2]="CubismBlendMode_Multiplicative",r))(Dn||{});class pi{constructor(){this.R=1,this.G=1,this.B=1,this.A=1}}let on=!1,Ir=!1,Pr;const hs={vertexOffset:0,vertexStep:2};class Oi{static startUp(e){if(on)return li("CubismFramework.startUp() is already done."),on;if(Live2DCubismCore._isStarted)return on=!0,!0;if(Live2DCubismCore._isStarted=!0,Pr=e,Pr&&Live2DCubismCore.Logging.csmSetLogFunction(Pr.logFunction),on=!0,on){const t=Live2DCubismCore.Version.csmGetVersion(),n=(t&4278190080)>>24,i=(t&16711680)>>16,o=t&65535,a=t;li("Live2D Cubism Core version: {0}.{1}.{2} ({3})",("00"+n).slice(-2),("00"+i).slice(-2),("0000"+o).slice(-4),a)}return li("CubismFramework.startUp() is complete."),on}static cleanUp(){on=!1,Ir=!1,Pr=void 0}static initialize(){if(!on){mi("CubismFramework is not started.");return}if(Ir){mi("CubismFramework.initialize() skipped, already initialized.");return}Ir=!0,li("CubismFramework.initialize() is complete.")}static dispose(){if(!on){mi("CubismFramework is not started.");return}if(!Ir){mi("CubismFramework.dispose() skipped, not initialized.");return}xu.staticRelease(),Ir=!1,li("CubismFramework.dispose() is complete.")}static isStarted(){return on}static isInitialized(){return Ir}static coreLogFunction(e){Live2DCubismCore.Logging.csmGetLogFunction()&&Live2DCubismCore.Logging.csmGetLogFunction()(e)}static getLoggingLevel(){return Pr!=null?Pr.loggingLevel:br.LogLevel_Off}constructor(){}}var br=(r=>(r[r.LogLevel_Verbose=0]="LogLevel_Verbose",r[r.LogLevel_Debug=1]="LogLevel_Debug",r[r.LogLevel_Info=2]="LogLevel_Info",r[r.LogLevel_Warning=3]="LogLevel_Warning",r[r.LogLevel_Error=4]="LogLevel_Error",r[r.LogLevel_Off=5]="LogLevel_Off",r))(br||{});const Ji=()=>{};function kh(r,...e){ta.print(br.LogLevel_Debug,"[CSM][D]"+r+` +`,e)}function li(r,...e){ta.print(br.LogLevel_Info,"[CSM][I]"+r+` +`,e)}function mi(r,...e){ta.print(br.LogLevel_Warning,"[CSM][W]"+r+` +`,e)}function Lr(r,...e){ta.print(br.LogLevel_Error,"[CSM][E]"+r+` +`,e)}class ta{static print(e,t,n){if(en[s]);i(o)}static dumpBytes(e,t,n){for(let i=0;i0?this.print(e,` +`):i%8==0&&i>0&&this.print(e," "),this.print(e,"{0} ",[t[i]&255]);this.print(e,` +`)}constructor(){}}class qx{update(){this._model.update(),this._model.drawables.resetDynamicFlags()}getCanvasWidth(){return this._model==null?0:this._model.canvasinfo.CanvasWidth/this._model.canvasinfo.PixelsPerUnit}getCanvasHeight(){return this._model==null?0:this._model.canvasinfo.CanvasHeight/this._model.canvasinfo.PixelsPerUnit}saveParameters(){const e=this._model.parameters.count,t=this._savedParameters.length;for(let n=0;nt&&(t=this._model.parameters.minimumValues[e]),this._parameterValues[e]=n==1?t:this._parameterValues[e]=this._parameterValues[e]*(1-n)+t*n}setParameterValueById(e,t,n=1){const i=this.getParameterIndex(e);this.setParameterValueByIndex(i,t,n)}addParameterValueByIndex(e,t,n=1){this.setParameterValueByIndex(e,this.getParameterValueByIndex(e)+t*n)}addParameterValueById(e,t,n=1){const i=this.getParameterIndex(e);this.addParameterValueByIndex(i,t,n)}multiplyParameterValueById(e,t,n=1){const i=this.getParameterIndex(e);this.multiplyParameterValueByIndex(i,t,n)}multiplyParameterValueByIndex(e,t,n=1){this.setParameterValueByIndex(e,this.getParameterValueByIndex(e)*(1+(t-1)*n))}getDrawableIds(){return this._drawableIds.slice()}getDrawableIndex(e){const t=this._model.drawables.count;for(let n=0;nt&&(e=t);for(let n=0;n0&&t.getEndTime()(r[r.ExpressionBlendType_Add=0]="ExpressionBlendType_Add",r[r.ExpressionBlendType_Multiply=1]="ExpressionBlendType_Multiply",r[r.ExpressionBlendType_Overwrite=2]="ExpressionBlendType_Overwrite",r))(or||{}),Ri;(r=>{r.supportMoreMaskDivisions=!0,r.setOpacityFromMotion=!1})(Ri||(Ri={}));var ar=(r=>(r[r.CubismMotionCurveTarget_Model=0]="CubismMotionCurveTarget_Model",r[r.CubismMotionCurveTarget_Parameter=1]="CubismMotionCurveTarget_Parameter",r[r.CubismMotionCurveTarget_PartOpacity=2]="CubismMotionCurveTarget_PartOpacity",r))(ar||{}),an=(r=>(r[r.CubismMotionSegmentType_Linear=0]="CubismMotionSegmentType_Linear",r[r.CubismMotionSegmentType_Bezier=1]="CubismMotionSegmentType_Bezier",r[r.CubismMotionSegmentType_Stepped=2]="CubismMotionSegmentType_Stepped",r[r.CubismMotionSegmentType_InverseStepped=3]="CubismMotionSegmentType_InverseStepped",r))(an||{});class Rn{constructor(e=0,t=0){this.time=e,this.value=t}}class Yx{constructor(){this.basePointIndex=0,this.segmentType=0}}class Kx{constructor(){this.id="",this.type=0,this.segmentCount=0,this.baseSegmentIndex=0,this.fadeInTime=0,this.fadeOutTime=0}}class Zx{constructor(){this.fireTime=0,this.value=""}}class Jx{constructor(){this.duration=0,this.loop=!1,this.curveCount=0,this.eventCount=0,this.fps=0,this.curves=[],this.segments=[],this.points=[],this.events=[]}}class ip{constructor(e){this._json=e}release(){this._json=void 0}getMotionDuration(){return this._json.Meta.Duration}isMotionLoop(){return this._json.Meta.Loop||!1}getEvaluationOptionFlag(e){return Tu.EvaluationOptionFlag_AreBeziersRistricted==e?!!this._json.Meta.AreBeziersRestricted:!1}getMotionCurveCount(){return this._json.Meta.CurveCount}getMotionFps(){return this._json.Meta.Fps}getMotionTotalSegmentCount(){return this._json.Meta.TotalSegmentCount}getMotionTotalPointCount(){return this._json.Meta.TotalPointCount}getMotionFadeInTime(){return this._json.Meta.FadeInTime}getMotionFadeOutTime(){return this._json.Meta.FadeOutTime}getMotionCurveTarget(e){return this._json.Curves[e].Target}getMotionCurveId(e){return this._json.Curves[e].Id}getMotionCurveFadeInTime(e){return this._json.Curves[e].FadeInTime}getMotionCurveFadeOutTime(e){return this._json.Curves[e].FadeOutTime}getMotionCurveSegmentCount(e){return this._json.Curves[e].Segments.length}getMotionCurveSegment(e,t){return this._json.Curves[e].Segments[t]}getEventCount(){return this._json.Meta.UserDataCount||0}getTotalEventValueSize(){return this._json.Meta.TotalUserDataSize}getEventTime(e){return this._json.UserData[e].Time}getEventValue(e){return this._json.UserData[e].Value}}var Tu=(r=>(r[r.EvaluationOptionFlag_AreBeziersRistricted=0]="EvaluationOptionFlag_AreBeziersRistricted",r))(Tu||{});const Qx="EyeBlink",eb="LipSync",tb="Model",nb="Parameter",rb="PartOpacity",ib=!1;function qt(r,e,t){const n=new Rn;return n.time=r.time+(e.time-r.time)*t,n.value=r.value+(e.value-r.value)*t,n}function ob(r,e){let t=(e-r[0].time)/(r[1].time-r[0].time);return t<0&&(t=0),r[0].value+(r[1].value-r[0].value)*t}function ab(r,e){let t=(e-r[0].time)/(r[3].time-r[0].time);t<0&&(t=0);const n=qt(r[0],r[1],t),i=qt(r[1],r[2],t),o=qt(r[2],r[3],t),a=qt(n,i,t),s=qt(i,o,t);return qt(a,s,t).value}function sb(r,e){const t=e,n=r[0].time,i=r[3].time,o=r[1].time,a=r[2].time,s=i-3*a+3*o-n,l=3*a-6*o+3*n,u=3*o-3*n,c=n-t,h=Je.cardanoAlgorithmForBezier(s,l,u,c),p=qt(r[0],r[1],h),f=qt(r[1],r[2],h),g=qt(r[2],r[3],h),v=qt(p,f,h),d=qt(f,g,h);return qt(v,d,h).value}function lb(r,e){return r[0].value}function ub(r,e){return r[1].value}function fs(r,e,t){const n=r.curves[e];let i=-1;const o=n.baseSegmentIndex+n.segmentCount;let a=0;for(let l=n.baseSegmentIndex;lt){i=l;break}if(i==-1)return r.points[a].value;const s=r.segments[i];return s.evaluate(r.points.slice(s.basePointIndex),t)}class Su extends rp{constructor(){super(),this._eyeBlinkParameterIds=[],this._lipSyncParameterIds=[],this._sourceFrameRate=30,this._loopDurationSeconds=-1,this._isLoop=!1,this._isLoopFadeIn=!0,this._lastWeight=0}static create(e,t){const n=new Su;return n.parse(e),n._sourceFrameRate=n._motionData.fps,n._loopDurationSeconds=n._motionData.duration,n._onFinishedMotion=t,n}doUpdateParameters(e,t,n,i){this._modelCurveIdEyeBlink==null&&(this._modelCurveIdEyeBlink=Qx),this._modelCurveIdLipSync==null&&(this._modelCurveIdLipSync=eb);let o=t-i.getStartTime();o<0&&(o=0);let a=Number.MAX_VALUE,s=Number.MAX_VALUE;const l=64;let u=0,c=0;this._eyeBlinkParameterIds.length>l&&kh("too many eye blink targets : {0}",this._eyeBlinkParameterIds.length),this._lipSyncParameterIds.length>l&&kh("too many lip sync targets : {0}",this._lipSyncParameterIds.length);const h=this._fadeInSeconds<=0?1:Je.getEasingSine((t-i.getFadeInStartTime())/this._fadeInSeconds),p=this._fadeOutSeconds<=0||i.getEndTime()<0?1:Je.getEasingSine((i.getEndTime()-t)/this._fadeOutSeconds);let f,g,v,d=o;if(this._isLoop)for(;d>this._motionData.duration;)d-=this._motionData.duration;const m=this._motionData.curves;for(g=0;g>y&1)continue;const E=_+(s-_)*n;e.setParameterValueById(this._eyeBlinkParameterIds[y],E)}if(a!=Number.MAX_VALUE)for(let y=0;y>y&1)continue;const E=_+(a-_)*n;e.setParameterValueById(this._lipSyncParameterIds[y],E)}}for(;g=this._motionData.duration&&(this._isLoop?(i.setStartTime(t),this._isLoopFadeIn&&i.setFadeInStartTime(t)):(this._onFinishedMotion&&this._onFinishedMotion(this),i.setIsFinished(!0))),this._lastWeight=n}setIsLoop(e){this._isLoop=e}isLoop(){return this._isLoop}setIsLoopFadeIn(e){this._isLoopFadeIn=e}isLoopFadeIn(){return this._isLoopFadeIn}getDuration(){return this._isLoop?-1:this._loopDurationSeconds}getLoopDuration(){return this._loopDurationSeconds}setParameterFadeInTime(e,t){const n=this._motionData.curves;for(let i=0;inew Kx),this._motionData.segments=Array.from({length:t.getMotionTotalSegmentCount()}).map(()=>new Yx),this._motionData.events=Array.from({length:this._motionData.eventCount}).map(()=>new Zx),this._motionData.points=[];let a=0,s=0;for(let l=0;le&&this._motionData.events[n].fireTime<=t&&this._firedEventValues.push(this._motionData.events[n].value);return this._firedEventValues}}class cb{constructor(){this._autoDelete=!1,this._available=!0,this._finished=!1,this._started=!1,this._startTimeSeconds=-1,this._fadeInStartTimeSeconds=0,this._endTimeSeconds=-1,this._stateTimeSeconds=0,this._stateWeight=0,this._lastEventCheckSeconds=0,this._motionQueueEntryHandle=this,this._fadeOutSeconds=0,this._isTriggeredFadeOut=!1}release(){this._autoDelete&&this._motion&&this._motion.release()}setFadeOut(e){this._fadeOutSeconds=e,this._isTriggeredFadeOut=!0}startFadeOut(e,t){const n=t+e;this._isTriggeredFadeOut=!0,(this._endTimeSeconds<0||nt!=null&&t._motionQueueEntryHandle==e)}setEventCallback(e,t=null){this._eventCallBack=e,this._eventCustomData=t}doUpdateMotion(e,t){let n=!1,i=0;for(;i(r[r.CubismPhysicsTargetType_Parameter=0]="CubismPhysicsTargetType_Parameter",r))(Fl||{}),sr=(r=>(r[r.CubismPhysicsSource_X=0]="CubismPhysicsSource_X",r[r.CubismPhysicsSource_Y=1]="CubismPhysicsSource_Y",r[r.CubismPhysicsSource_Angle=2]="CubismPhysicsSource_Angle",r))(sr||{});class fb{constructor(){this.initialPosition=new Me(0,0),this.position=new Me(0,0),this.lastPosition=new Me(0,0),this.lastGravity=new Me(0,0),this.force=new Me(0,0),this.velocity=new Me(0,0)}}class db{constructor(){this.normalizationPosition={},this.normalizationAngle={}}}class pb{constructor(){this.source={}}}class mb{constructor(){this.destination={},this.translationScale=new Me(0,0)}}class gb{constructor(){this.settings=[],this.inputs=[],this.outputs=[],this.particles=[],this.gravity=new Me(0,0),this.wind=new Me(0,0)}}class vb{constructor(e){this._json=e}release(){this._json=void 0}getGravity(){const e=new Me(0,0);return e.x=this._json.Meta.EffectiveForces.Gravity.X,e.y=this._json.Meta.EffectiveForces.Gravity.Y,e}getWind(){const e=new Me(0,0);return e.x=this._json.Meta.EffectiveForces.Wind.X,e.y=this._json.Meta.EffectiveForces.Wind.Y,e}getSubRigCount(){return this._json.Meta.PhysicsSettingCount}getTotalInputCount(){return this._json.Meta.TotalInputCount}getTotalOutputCount(){return this._json.Meta.TotalOutputCount}getVertexCount(){return this._json.Meta.VertexCount}getNormalizationPositionMinimumValue(e){return this._json.PhysicsSettings[e].Normalization.Position.Minimum}getNormalizationPositionMaximumValue(e){return this._json.PhysicsSettings[e].Normalization.Position.Maximum}getNormalizationPositionDefaultValue(e){return this._json.PhysicsSettings[e].Normalization.Position.Default}getNormalizationAngleMinimumValue(e){return this._json.PhysicsSettings[e].Normalization.Angle.Minimum}getNormalizationAngleMaximumValue(e){return this._json.PhysicsSettings[e].Normalization.Angle.Maximum}getNormalizationAngleDefaultValue(e){return this._json.PhysicsSettings[e].Normalization.Angle.Default}getInputCount(e){return this._json.PhysicsSettings[e].Input.length}getInputWeight(e,t){return this._json.PhysicsSettings[e].Input[t].Weight}getInputReflect(e,t){return this._json.PhysicsSettings[e].Input[t].Reflect}getInputType(e,t){return this._json.PhysicsSettings[e].Input[t].Type}getInputSourceId(e,t){return this._json.PhysicsSettings[e].Input[t].Source.Id}getOutputCount(e){return this._json.PhysicsSettings[e].Output.length}getOutputVertexIndex(e,t){return this._json.PhysicsSettings[e].Output[t].VertexIndex}getOutputAngleScale(e,t){return this._json.PhysicsSettings[e].Output[t].Scale}getOutputWeight(e,t){return this._json.PhysicsSettings[e].Output[t].Weight}getOutputDestinationId(e,t){return this._json.PhysicsSettings[e].Output[t].Destination.Id}getOutputType(e,t){return this._json.PhysicsSettings[e].Output[t].Type}getOutputReflect(e,t){return this._json.PhysicsSettings[e].Output[t].Reflect}getParticleCount(e){return this._json.PhysicsSettings[e].Vertices.length}getParticleMobility(e,t){return this._json.PhysicsSettings[e].Vertices[t].Mobility}getParticleDelay(e,t){return this._json.PhysicsSettings[e].Vertices[t].Delay}getParticleAcceleration(e,t){return this._json.PhysicsSettings[e].Vertices[t].Acceleration}getParticleRadius(e,t){return this._json.PhysicsSettings[e].Vertices[t].Radius}getParticlePosition(e,t){const n=new Me(0,0);return n.x=this._json.PhysicsSettings[e].Vertices[t].Position.X,n.y=this._json.PhysicsSettings[e].Vertices[t].Position.Y,n}}const Rh="X",Fh="Y",Lh="Angle",yb=5,ap=100,_b=.001;class Eu{static create(e){const t=new Eu;return t.parse(e),t._physicsRig.gravity.y=0,t}evaluate(e,t){let n,i,o,a;const s=new Me;let l,u,c,h,p,f,g,v;p=e.getModel().parameters.values,f=e.getModel().parameters.maximumValues,g=e.getModel().parameters.minimumValues,v=e.getModel().parameters.defaultValues;for(let d=0;d=l.particleCount)break;c[m].destinationParameterIndex==-1&&(c[m].destinationParameterIndex=e.getParameterIndex(c[m].destination.id));const _=new Me;_.x=h[y].position.x-h[y-1].position.x,_.y=h[y].position.y-h[y-1].position.y,a=c[m].getValue(_,h,y,c[m].reflect,this._options.gravity);const E=c[m].destinationParameterIndex,x=!Float32Array.prototype.slice&&"subarray"in Float32Array.prototype?JSON.parse(JSON.stringify(p.subarray(E))):p.slice(E);Rb(x,g[E],f[E],a,c[m]);for(let b=E,C=0;b=2?i=e[t-1].position.substract(e[t-2].position):i=i.multiplyByScaler(-1),o=Je.directionToRadian(i,r),n&&(o*=-1),o}function Ab(r,e){return Math.abs(Math.max(r,e)-Math.min(r,e))}function Ib(r,e){return Math.min(r,e)+Ab(r,e)/2}function Pb(r,e){return r.x}function Mb(r,e){return r.y}function kb(r,e){return e}function Ob(r,e,t,n,i,o,a,s){let l,u,c,h,p=new Me(0,0),f=new Me(0,0),g=new Me(0,0),v=new Me(0,0);r[0].position=new Me(t.x,t.y),l=Je.degreesToRadian(n),h=Je.radianToDirection(l),h.normalize();for(let d=1;dt&&(a>i.valueExceededMaximum&&(i.valueExceededMaximum=a),a=t),s=i.weight/ap,s>=1||(a=r[0]*(1-s)+a*s),r[0]=a}function Cu(r,e,t,n,i,o,a,s){let l=0;const u=Je.max(t,e);ur&&(r=c);const h=Je.min(i,o),p=Je.max(i,o),f=a,g=Ib(c,u),v=r-g;switch(Math.sign(v)){case 1:{const d=p-f,m=u-g;m!=0&&(l=v*(d/m),l+=f);break}case-1:{const d=h-f,m=c-g;m!=0&&(l=v*(d/m),l+=f);break}case 0:{l=f;break}}return s?l:l*-1}class Ll{constructor(e=0,t=0,n=0,i=0){this.x=e,this.y=t,this.width=n,this.height=i}getCenterX(){return this.x+.5*this.width}getCenterY(){return this.y+.5*this.height}getRight(){return this.x+this.width}getBottom(){return this.y+this.height}setRect(e){this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height}expand(e,t){this.x-=e,this.y-=t,this.width+=e*2,this.height+=t*2}}const ds=4,Fb=10;let Zn,gi,Nl;class ps{getChannelFlagAsColor(e){return this._channelColors[e]}getMaskRenderTexture(){let e=0;if(this._maskTexture&&this._maskTexture.texture!=0&&(this._maskTexture.frameNo=this._currentFrameNo,e=this._maskTexture.texture),e==0){const t=this._clippingMaskBufferSize;this._colorBuffer=this.gl.createTexture(),this.gl.bindTexture(this.gl.TEXTURE_2D,this._colorBuffer),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,t,t,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,null),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.gl.bindTexture(this.gl.TEXTURE_2D,null),e=this.gl.createFramebuffer(),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,e),this.gl.framebufferTexture2D(this.gl.FRAMEBUFFER,this.gl.COLOR_ATTACHMENT0,this.gl.TEXTURE_2D,this._colorBuffer,0),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,Nl),this._maskTexture=new Lb(this._currentFrameNo,e)}return e}setGL(e){this.gl=e}calcClippedDrawTotalBounds(e,t){let n=Number.MAX_VALUE,i=Number.MAX_VALUE,o=Number.MIN_VALUE,a=Number.MIN_VALUE;const s=t._clippedDrawableIndexList.length;for(let l=0;lg&&(g=y),_v&&(v=_)}if(p!=Number.MAX_VALUE)if(po&&(o=g),v>a&&(a=v),n==Number.MAX_VALUE)t._allClippedDrawRect.x=0,t._allClippedDrawRect.y=0,t._allClippedDrawRect.width=0,t._allClippedDrawRect.height=0,t._isUsing=!1;else{t._isUsing=!0;const m=o-n,y=a-i;t._allClippedDrawRect.x=n,t._allClippedDrawRect.y=i,t._allClippedDrawRect.width=m,t._allClippedDrawRect.height=y}}}constructor(){this._maskRenderTexture=null,this._colorBuffer=null,this._currentFrameNo=0,this._clippingMaskBufferSize=256,this._clippingContextListForMask=[],this._clippingContextListForDraw=[],this._channelColors=[],this._tmpBoundsOnModel=new Ll,this._tmpMatrix=new Zt,this._tmpMatrixForMask=new Zt,this._tmpMatrixForDraw=new Zt;let e=new pi;e.R=1,e.G=0,e.B=0,e.A=0,this._channelColors.push(e),e=new pi,e.R=0,e.G=1,e.B=0,e.A=0,this._channelColors.push(e),e=new pi,e.R=0,e.G=0,e.B=1,e.A=0,this._channelColors.push(e),e=new pi,e.R=0,e.G=0,e.B=0,e.A=1,this._channelColors.push(e)}release(){var e,t,n;const i=this;for(let o=0;o0){this.gl.viewport(0,0,this._clippingMaskBufferSize,this._clippingMaskBufferSize),this._maskRenderTexture=this.getMaskRenderTexture(),t.getMvpMatrix(),t.preDraw(),this.setupLayoutBounds(n),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this._maskRenderTexture),this.gl.clearColor(1,1,1,1),this.gl.clear(this.gl.COLOR_BUFFER_BIT);for(let i=0;i(r[r.ShaderNames_SetupMask=0]="ShaderNames_SetupMask",r[r.ShaderNames_NormalPremultipliedAlpha=1]="ShaderNames_NormalPremultipliedAlpha",r[r.ShaderNames_NormalMaskedPremultipliedAlpha=2]="ShaderNames_NormalMaskedPremultipliedAlpha",r[r.ShaderNames_NomralMaskedInvertedPremultipliedAlpha=3]="ShaderNames_NomralMaskedInvertedPremultipliedAlpha",r[r.ShaderNames_AddPremultipliedAlpha=4]="ShaderNames_AddPremultipliedAlpha",r[r.ShaderNames_AddMaskedPremultipliedAlpha=5]="ShaderNames_AddMaskedPremultipliedAlpha",r[r.ShaderNames_AddMaskedPremultipliedAlphaInverted=6]="ShaderNames_AddMaskedPremultipliedAlphaInverted",r[r.ShaderNames_MultPremultipliedAlpha=7]="ShaderNames_MultPremultipliedAlpha",r[r.ShaderNames_MultMaskedPremultipliedAlpha=8]="ShaderNames_MultMaskedPremultipliedAlpha",r[r.ShaderNames_MultMaskedPremultipliedAlphaInverted=9]="ShaderNames_MultMaskedPremultipliedAlphaInverted",r))(vi||{});const Db="attribute vec4 a_position;attribute vec2 a_texCoord;varying vec2 v_texCoord;varying vec4 v_myPos;uniform mat4 u_clipMatrix;void main(){ gl_Position = u_clipMatrix * a_position; v_myPos = u_clipMatrix * a_position; v_texCoord = a_texCoord; v_texCoord.y = 1.0 - v_texCoord.y;}",Bb="precision mediump float;varying vec2 v_texCoord;varying vec4 v_myPos;uniform vec4 u_baseColor;uniform vec4 u_channelFlag;uniform sampler2D s_texture0;void main(){ float isInside = step(u_baseColor.x, v_myPos.x/v_myPos.w) * step(u_baseColor.y, v_myPos.y/v_myPos.w) * step(v_myPos.x/v_myPos.w, u_baseColor.z) * step(v_myPos.y/v_myPos.w, u_baseColor.w); gl_FragColor = u_channelFlag * texture2D(s_texture0, v_texCoord).a * isInside;}",Ub="attribute vec4 a_position;attribute vec2 a_texCoord;varying vec2 v_texCoord;uniform mat4 u_matrix;void main(){ gl_Position = u_matrix * a_position; v_texCoord = a_texCoord; v_texCoord.y = 1.0 - v_texCoord.y;}",Nh="attribute vec4 a_position;attribute vec2 a_texCoord;varying vec2 v_texCoord;varying vec4 v_clipPos;uniform mat4 u_matrix;uniform mat4 u_clipMatrix;void main(){ gl_Position = u_matrix * a_position; v_clipPos = u_clipMatrix * a_position; v_texCoord = a_texCoord; v_texCoord.y = 1.0 - v_texCoord.y;}",zb="precision mediump float;varying vec2 v_texCoord;uniform vec4 u_baseColor;uniform sampler2D s_texture0;void main(){ gl_FragColor = texture2D(s_texture0 , v_texCoord) * u_baseColor;}",jb="precision mediump float;varying vec2 v_texCoord;varying vec4 v_clipPos;uniform vec4 u_baseColor;uniform vec4 u_channelFlag;uniform sampler2D s_texture0;uniform sampler2D s_texture1;void main(){ vec4 col_formask = texture2D(s_texture0 , v_texCoord) * u_baseColor; vec4 clipMask = (1.0 - texture2D(s_texture1, v_clipPos.xy / v_clipPos.w)) * u_channelFlag; float maskVal = clipMask.r + clipMask.g + clipMask.b + clipMask.a; col_formask = col_formask * maskVal; gl_FragColor = col_formask;}",Vb="precision mediump float;varying vec2 v_texCoord;varying vec4 v_clipPos;uniform sampler2D s_texture0;uniform sampler2D s_texture1;uniform vec4 u_channelFlag;uniform vec4 u_baseColor;void main(){vec4 col_formask = texture2D(s_texture0, v_texCoord) * u_baseColor;vec4 clipMask = (1.0 - texture2D(s_texture1, v_clipPos.xy / v_clipPos.w)) * u_channelFlag;float maskVal = clipMask.r + clipMask.g + clipMask.b + clipMask.a;col_formask = col_formask * (1.0 - maskVal);gl_FragColor = col_formask;}";class sp extends xu{constructor(){super(),this._clippingContextBufferForMask=null,this._clippingContextBufferForDraw=null,this._clippingManager=new ps,this.firstDraw=!0,this._textures={},this._sortedDrawableIndexList=[],this._bufferData={vertex:null,uv:null,index:null}}initialize(e){e.isUsingMasking()&&(this._clippingManager=new ps,this._clippingManager.initialize(e,e.getDrawableCount(),e.getDrawableMasks(),e.getDrawableMaskCounts()));for(let t=e.getDrawableCount()-1;t>=0;t--)this._sortedDrawableIndexList[t]=0;super.initialize(e)}bindTexture(e,t){this._textures[e]=t}getBindedTextures(){return this._textures}setClippingMaskBufferSize(e){this._clippingManager.release(),this._clippingManager=new ps,this._clippingManager.setClippingMaskBufferSize(e),this._clippingManager.initialize(this.getModel(),this.getModel().getDrawableCount(),this.getModel().getDrawableMasks(),this.getModel().getDrawableMaskCounts())}getClippingMaskBufferSize(){return this._clippingManager.getClippingMaskBufferSize()}release(){var e,t,n;const i=this;this._clippingManager.release(),i._clippingManager=void 0,(e=this.gl)==null||e.deleteBuffer(this._bufferData.vertex),this._bufferData.vertex=null,(t=this.gl)==null||t.deleteBuffer(this._bufferData.uv),this._bufferData.uv=null,(n=this.gl)==null||n.deleteBuffer(this._bufferData.index),this._bufferData.index=null,i._bufferData=void 0,i._textures=void 0}doDrawModel(){this.preDraw(),this._clippingManager!=null&&this._clippingManager.setupClippingContext(this.getModel(),this);const e=this.getModel().getDrawableCount(),t=this.getModel().getDrawableRenderOrders();for(let n=0;n{sp.doStaticRelease()};class lp{constructor(e){this.groups=e.Groups,this.hitAreas=e.HitAreas,this.layout=e.Layout,this.moc=e.FileReferences.Moc,this.expressions=e.FileReferences.Expressions,this.motions=e.FileReferences.Motions,this.textures=e.FileReferences.Textures,this.physics=e.FileReferences.Physics,this.pose=e.FileReferences.Pose}getEyeBlinkParameters(){var e,t;return(t=(e=this.groups)==null?void 0:e.find(n=>n.Name==="EyeBlink"))==null?void 0:t.Ids}getLipSyncParameters(){var e,t;return(t=(e=this.groups)==null?void 0:e.find(n=>n.Name==="LipSync"))==null?void 0:t.Ids}}const Gb="ParamAngleX",$b="ParamAngleY",Hb="ParamAngleZ",Xb="ParamEyeBallX",Wb="ParamEyeBallY",qb="ParamBodyAngleX",Yb="ParamBreath",Dh=2,Bh=2;var Dt;(r=>{r.LOG_LEVEL_VERBOSE=0,r.LOG_LEVEL_WARNING=1,r.LOG_LEVEL_ERROR=2,r.LOG_LEVEL_NONE=999,r.logLevel=r.LOG_LEVEL_WARNING,r.sound=!0,r.motionSync=!0,r.motionFadingDuration=500,r.idleMotionFadingDuration=2e3,r.expressionFadingDuration=500,r.preserveExpressionOnMotion=!0,r.cubism4=Ri})(Dt||(Dt={}));const Ke={log(r,...e){Dt.logLevel<=Dt.LOG_LEVEL_VERBOSE&&console.log(`[${r}]`,...e)},warn(r,...e){Dt.logLevel<=Dt.LOG_LEVEL_WARNING&&console.warn(`[${r}]`,...e)},error(r,...e){Dt.logLevel<=Dt.LOG_LEVEL_ERROR&&console.error(`[${r}]`,...e)}};function Uh(r,e,t){return rt?t:r}function up(r,e){e.forEach(t=>{Object.getOwnPropertyNames(t.prototype).forEach(n=>{n!=="constructor"&&Object.defineProperty(r.prototype,n,Object.getOwnPropertyDescriptor(t.prototype,n))})})}function Kb(r){let e=r.lastIndexOf("/");return e!=-1&&(r=r.slice(0,e)),e=r.lastIndexOf("/"),e!==-1&&(r=r.slice(e+1)),r}function Zb(r,e){const t=r.indexOf(e);t!==-1&&r.splice(t,1)}class cp extends xr{constructor(e,t){super(),this.expressions=[],this.reserveExpressionIndex=-1,this.destroyed=!1,this.settings=e,this.tag=`ExpressionManager(${e.name})`}init(){this.defaultExpression=this.createExpression({},void 0),this.currentExpression=this.defaultExpression,this.stopAllExpressions()}loadExpression(e){return at(this,null,function*(){if(!this.definitions[e]){Ke.warn(this.tag,`Undefined expression at [${e}]`);return}if(this.expressions[e]===null){Ke.warn(this.tag,`Cannot set expression at [${e}] because it's already failed in loading.`);return}if(this.expressions[e])return this.expressions[e];const t=yield this._loadExpression(e);return this.expressions[e]=t,t})}_loadExpression(e){throw new Error("Not implemented.")}setRandomExpression(){return at(this,null,function*(){if(this.definitions.length){const e=[];for(let t=0;t-1&&eu&&(a*=u/l,s*=u/l),this.vx+=a,this.vy+=s;const c=Math.sqrt(Kn(this.vx,2)+Kn(this.vy,2)),h=.5*(Math.sqrt(Kn(u,2)+8*u*i)-u);c>h&&(this.vx*=h/c,this.vy*=h/c),this.x+=this.vx,this.y+=this.vy}}class Au{constructor(e){this.json=e;let t=e.url;if(typeof t!="string")throw new TypeError("The `url` field in settings JSON must be defined as a string.");this.url=t,this.name=Kb(this.url)}resolveURL(e){return Qo.resolve(this.url,e)}replaceFiles(e){this.moc=e(this.moc,"moc"),this.pose!==void 0&&(this.pose=e(this.pose,"pose")),this.physics!==void 0&&(this.physics=e(this.physics,"physics"));for(let t=0;t(e.push(t),t)),e}validateFiles(e){const t=(o,a)=>{const s=this.resolveURL(o);if(!e.includes(s)){if(a)throw new Error(`File "${o}" is defined in settings, but doesn't exist in given files`);return!1}return!0};return[this.moc,...this.textures].forEach(o=>t(o,!0)),this.getDefinedFiles().filter(o=>t(o,!1))}}var jo=(r=>(r[r.NONE=0]="NONE",r[r.IDLE=1]="IDLE",r[r.NORMAL=2]="NORMAL",r[r.FORCE=3]="FORCE",r))(jo||{});class t1{constructor(){this.debug=!1,this.currentPriority=0,this.reservePriority=0}reserve(e,t,n){if(n<=0)return Ke.log(this.tag,"Cannot start a motion with MotionPriority.NONE."),!1;if(e===this.currentGroup&&t===this.currentIndex)return Ke.log(this.tag,"Motion is already playing.",this.dump(e,t)),!1;if(e===this.reservedGroup&&t===this.reservedIndex||e===this.reservedIdleGroup&&t===this.reservedIdleIndex)return Ke.log(this.tag,"Motion is already reserved.",this.dump(e,t)),!1;if(n===1){if(this.currentPriority!==0)return Ke.log(this.tag,"Cannot start idle motion because another motion is playing.",this.dump(e,t)),!1;if(this.reservedIdleGroup!==void 0)return Ke.log(this.tag,"Cannot start idle motion because another idle motion has reserved.",this.dump(e,t)),!1;this.setReservedIdle(e,t)}else{if(n<3){if(n<=this.currentPriority)return Ke.log(this.tag,"Cannot start motion because another motion is playing as an equivalent or higher priority.",this.dump(e,t)),!1;if(n<=this.reservePriority)return Ke.log(this.tag,"Cannot start motion because another motion has reserved as an equivalent or higher priority.",this.dump(e,t)),!1}this.setReserved(e,t,n)}return!0}start(e,t,n,i){if(i===1){if(this.setReservedIdle(void 0,void 0),this.currentPriority!==0)return Ke.log(this.tag,"Cannot start idle motion because another motion is playing.",this.dump(t,n)),!1}else{if(t!==this.reservedGroup||n!==this.reservedIndex)return Ke.log(this.tag,"Cannot start motion because another motion has taken the place.",this.dump(t,n)),!1;this.setReserved(void 0,void 0,0)}return e?(this.setCurrent(t,n,i),!0):!1}complete(){this.setCurrent(void 0,void 0,0)}setCurrent(e,t,n){this.currentPriority=n,this.currentGroup=e,this.currentIndex=t}setReserved(e,t,n){this.reservePriority=n,this.reservedGroup=e,this.reservedIndex=t}setReservedIdle(e,t){this.reservedIdleGroup=e,this.reservedIdleIndex=t}isActive(e,t){return e===this.currentGroup&&t===this.currentIndex||e===this.reservedGroup&&t===this.reservedIndex||e===this.reservedIdleGroup&&t===this.reservedIdleIndex}reset(){this.setCurrent(void 0,void 0,0),this.setReserved(void 0,void 0,0),this.setReservedIdle(void 0,void 0)}shouldRequestIdleMotion(){return this.currentGroup===void 0&&this.reservedIdleGroup===void 0}shouldOverrideExpression(){return!Dt.preserveExpressionOnMotion&&this.currentPriority>1}dump(e,t){if(this.debug){const n=["currentPriority","reservePriority","currentGroup","currentIndex","reservedGroup","reservedIndex","reservedIdleGroup","reservedIdleIndex"];return` + group = "${e}", index = ${t} +`+n.map(i=>"["+i+"] "+this[i]).join(` +`)}return""}}const n1="SoundManager",r1=.5;class lr{static get volume(){return this._volume}static set volume(e){this._volume=(e>1?1:e<0?0:e)||0,this.audios.forEach(t=>t.volume=this._volume)}static add(e,t,n){const i=new Audio(e);return i.volume=this._volume,i.preload="auto",i.addEventListener("ended",()=>{this.dispose(i),t==null||t()}),i.addEventListener("error",o=>{this.dispose(i),Ke.warn(n1,`Error occurred on "${e}"`,o.error),n==null||n(o.error)}),this.audios.push(i),i}static play(e){return new Promise((t,n)=>{var i;(i=e.play())==null||i.catch(o=>{e.dispatchEvent(new ErrorEvent("error",{error:o})),n(o)}),e.readyState===e.HAVE_ENOUGH_DATA?t():e.addEventListener("canplaythrough",t)})}static dispose(e){e.pause(),e.removeAttribute("src"),Zb(this.audios,e)}static destroy(){for(let e=this.audios.length-1;e>=0;e--)this.dispose(this.audios[e])}}lr.audios=[];lr._volume=r1;var hp=(r=>(r.ALL="ALL",r.IDLE="IDLE",r.NONE="NONE",r))(hp||{});class Iu extends xr{constructor(e,t){super(),this.motionGroups={},this.state=new t1,this.playing=!1,this.destroyed=!1,this.settings=e,this.tag=`MotionManager(${e.name})`,this.state.tag=this.tag}init(e){e!=null&&e.idleMotionGroup&&(this.groups.idle=e.idleMotionGroup),this.setupMotions(e),this.stopAllMotions()}setupMotions(e){for(const n of Object.keys(this.definitions))this.motionGroups[n]=[];let t;switch(e==null?void 0:e.motionPreload){case"NONE":return;case"ALL":t=Object.keys(this.definitions);break;case"IDLE":default:t=[this.groups.idle];break}for(const n of t)if(this.definitions[n])for(let i=0;ithis.currentAudio=void 0,()=>this.currentAudio=void 0),this.currentAudio=l}catch(h){Ke.warn(this.tag,"Failed to create audio",c,h)}}const u=yield this.loadMotion(n,i);if(l){const c=lr.play(l).catch(h=>Ke.warn(this.tag,"Failed to play audio",l.src,h));Dt.motionSync&&(yield c)}return this.state.start(u,n,i,o)?(Ke.log(this.tag,"Start motion:",this.getMotionName(s)),this.emit("motionStart",n,i,l),this.state.shouldOverrideExpression()&&this.expressionManager&&this.expressionManager.resetExpression(),this.playing=!0,this._startMotion(u),!0):(l&&(lr.dispose(l),this.currentAudio=void 0),!1)})}startRandomMotion(e,t){return at(this,null,function*(){const n=this.definitions[e];if(n!=null&&n.length){const i=[];for(let o=0;ot.index>=0);for(const t of e)this.hitAreas[t.name]=t}hitTest(e,t){return Object.keys(this.hitAreas).filter(n=>this.isHit(n,e,t))}isHit(e,t,n){if(!this.hitAreas[e])return!1;const i=this.hitAreas[e].index,o=this.getDrawableBounds(i,i1);return o.x<=t&&t<=o.x+o.width&&o.y<=n&&n<=o.y+o.height}getDrawableBounds(e,t){const n=this.getDrawableVertices(e);let i=n[0],o=n[0],a=n[1],s=n[1];for(let l=0;l{(o.status===200||o.status===0)&&o.response?n(o.response):o.onerror()},o.onerror=()=>{Ke.warn(a1,`Failed to load resource as ${o.responseType} (Status ${o.status}): ${e}`),i(new jh("Network error.",e,o.status))},o.onabort=()=>i(new jh("Aborted.",e,o.status,!0)),o.onloadend=()=>{var a;It.allXhrSet.delete(o),r&&((a=It.xhrMap.get(r))==null||a.delete(o))},o}static cancelXHRs(){var r;(r=It.xhrMap.get(this))==null||r.forEach(e=>{e.abort(),It.allXhrSet.delete(e)}),It.xhrMap.delete(this)}static release(){It.allXhrSet.forEach(r=>r.abort()),It.allXhrSet.clear(),It.xhrMap=new WeakMap}};let na=It;na.xhrMap=new WeakMap;na.allXhrSet=new Set;na.loader=(r,e)=>new Promise((t,n)=>{It.createXHR(r.target,r.settings?r.settings.resolveURL(r.url):r.url,r.type,o=>{r.result=o,t()},n).send()});function fp(r,e){let t=-1;return n(0);function n(i,o){if(o)return Promise.reject(o);if(i<=t)return Promise.reject(new Error("next() called multiple times"));t=i;const a=r[i];if(!a)return Promise.resolve();try{return Promise.resolve(a(e,n.bind(null,i+1)))}catch(s){return Promise.reject(s)}}}class Gn{static load(e){return fp(this.middlewares,e).then(()=>e.result)}}Gn.middlewares=[na.loader];function s1(r,e={}){var t;const n={resourceOptions:{crossorigin:e.crossOrigin}};if(mr.fromURL)return mr.fromURL(r,n).catch(a=>{if(a instanceof Error)throw a;const s=new Error("Texture loading error");throw s.event=a,s});n.resourceOptions.autoLoad=!1;const i=mr.from(r,n);if(i.baseTexture.valid)return Promise.resolve(i);const o=i.baseTexture.resource;return(t=o._live2d_load)!=null||(o._live2d_load=new Promise((a,s)=>{const l=u=>{o.source.removeEventListener("error",l);const c=new Error("Texture loading error");c.event=u,s(c)};o.source.addEventListener("error",l),o.load().then(()=>a(i)).catch(l)})),o._live2d_load}const Vh="Live2DFactory",dp=(r,e)=>at(void 0,null,function*(){if(typeof r.source=="string"){const t=yield Gn.load({url:r.source,type:"json",target:r.live2dModel});t.url=r.source,r.source=t,r.live2dModel.emit("settingsJSONLoaded",t)}return e()}),pp=(r,e)=>at(void 0,null,function*(){if(r.source instanceof Au)return r.settings=r.source,e();if(typeof r.source=="object"){const t=ct.findRuntime(r.source);if(t){const n=t.createModelSettings(r.source);return r.settings=n,r.live2dModel.emit("settingsLoaded",n),e()}}throw new TypeError("Unknown settings format.")}),mp=(r,e)=>{if(r.settings){const t=ct.findRuntime(r.settings);if(t)return t.ready().then(e)}return e()},gp=(r,e)=>at(void 0,null,function*(){yield e();const t=r.internalModel;if(t){const n=r.settings,i=ct.findRuntime(n);if(i){const o=[];n.pose&&o.push(Gn.load({settings:n,url:n.pose,type:"json",target:t}).then(a=>{t.pose=i.createPose(t.coreModel,a),r.live2dModel.emit("poseLoaded",t.pose)}).catch(a=>{r.live2dModel.emit("poseLoadError",a),Ke.warn(Vh,"Failed to load pose.",a)})),n.physics&&o.push(Gn.load({settings:n,url:n.physics,type:"json",target:t}).then(a=>{t.physics=i.createPhysics(t.coreModel,a),r.live2dModel.emit("physicsLoaded",t.physics)}).catch(a=>{r.live2dModel.emit("physicsLoadError",a),Ke.warn(Vh,"Failed to load physics.",a)})),o.length&&(yield Promise.all(o))}}}),vp=(r,e)=>at(void 0,null,function*(){if(r.settings){const t=r.live2dModel,n=r.settings.textures.map(i=>{const o=r.settings.resolveURL(i);return s1(o,{crossOrigin:r.options.crossOrigin})});if(yield e(),r.internalModel)t.internalModel=r.internalModel,t.emit("modelLoaded",r.internalModel);else throw new TypeError("Missing internal model.");t.textures=yield Promise.all(n),t.emit("textureLoaded",t.textures)}else throw new TypeError("Missing settings.")}),yp=(r,e)=>at(void 0,null,function*(){const t=r.settings;if(t instanceof Au){const n=ct.findRuntime(t);if(!n)throw new TypeError("Unknown model settings.");const i=yield Gn.load({settings:t,url:t.moc,type:"arraybuffer",target:r.live2dModel});if(!n.isValidMoc(i))throw new Error("Invalid moc data");const o=n.createCoreModel(i);return r.internalModel=n.createInternalModel(o,t,r.options),e()}throw new TypeError("Missing settings.")}),Tt=class{static registerRuntime(r){Tt.runtimes.push(r),Tt.runtimes.sort((e,t)=>t.version-e.version)}static findRuntime(r){for(const e of Tt.runtimes)if(e.test(r))return e}static setupLive2DModel(r,e,t){return at(this,null,function*(){const n=new Promise(a=>r.once("textureLoaded",a)),i=new Promise(a=>r.once("modelLoaded",a)),o=Promise.all([n,i]).then(()=>r.emit("ready"));yield fp(Tt.live2DModelMiddlewares,{live2dModel:r,source:e,options:t||{}}),yield o,r.emit("load")})}static loadMotion(r,e,t){var n,i;const o=a=>r.emit("motionLoadError",e,t,a);try{const a=(n=r.definitions[e])==null?void 0:n[t];if(!a)return Promise.resolve(void 0);r.listeners("destroy").includes(Tt.releaseTasks)||r.once("destroy",Tt.releaseTasks);let s=Tt.motionTasksMap.get(r);s||(s={},Tt.motionTasksMap.set(r,s));let l=s[e];l||(l=[],s[e]=l);const u=r.getMotionFile(a);return(i=l[t])!=null||(l[t]=Gn.load({url:u,settings:r.settings,type:r.motionDataType,target:r}).then(c=>{var h;const p=(h=Tt.motionTasksMap.get(r))==null?void 0:h[e];p&&delete p[t];const f=r.createMotion(c,e,a);return r.emit("motionLoaded",e,t,f),f}).catch(c=>{Ke.warn(r.tag,`Failed to load motion: ${u} +`,c),o(c)})),l[t]}catch(a){Ke.warn(r.tag,`Failed to load motion at "${e}"[${t}] +`,a),o(a)}return Promise.resolve(void 0)}static loadExpression(r,e){var t;const n=i=>r.emit("expressionLoadError",e,i);try{const i=r.definitions[e];if(!i)return Promise.resolve(void 0);r.listeners("destroy").includes(Tt.releaseTasks)||r.once("destroy",Tt.releaseTasks);let o=Tt.expressionTasksMap.get(r);o||(o=[],Tt.expressionTasksMap.set(r,o));const a=r.getExpressionFile(i);return(t=o[e])!=null||(o[e]=Gn.load({url:a,settings:r.settings,type:"json",target:r}).then(s=>{const l=Tt.expressionTasksMap.get(r);l&&delete l[e];const u=r.createExpression(s,i);return r.emit("expressionLoaded",e,u),u}).catch(s=>{Ke.warn(r.tag,`Failed to load expression: ${a} +`,s),n(s)})),o[e]}catch(i){Ke.warn(r.tag,`Failed to load expression at [${e}] +`,i),n(i)}return Promise.resolve(void 0)}static releaseTasks(){this instanceof Iu?Tt.motionTasksMap.delete(this):Tt.expressionTasksMap.delete(this)}};let ct=Tt;ct.runtimes=[];ct.urlToJSON=dp;ct.jsonToSettings=pp;ct.waitUntilReady=mp;ct.setupOptionals=gp;ct.setupEssentials=vp;ct.createInternalModel=yp;ct.live2DModelMiddlewares=[dp,pp,mp,gp,vp,yp];ct.motionTasksMap=new WeakMap;ct.expressionTasksMap=new WeakMap;Iu.prototype._loadMotion=function(r,e){return ct.loadMotion(this,r,e)};cp.prototype._loadExpression=function(r){return ct.loadExpression(this,r)};class l1{constructor(){this._autoInteract=!1}get autoInteract(){return this._autoInteract}set autoInteract(e){e!==this._autoInteract&&(e?this.on("pointertap",Gh,this):this.off("pointertap",Gh,this),this._autoInteract=e)}registerInteraction(e){e!==this.interactionManager&&(this.unregisterInteraction(),this._autoInteract&&e&&(this.interactionManager=e,e.on("pointermove",$h,this)))}unregisterInteraction(){var e;this.interactionManager&&((e=this.interactionManager)==null||e.off("pointermove",$h,this),this.interactionManager=void 0)}}function Gh(r){this.tap(r.data.global.x,r.data.global.y)}function $h(r){this.focus(r.data.global.x,r.data.global.y)}class u1 extends Nd{}const Ht=new st,c1=new Et;let Pn;class Dl extends No{constructor(e){super(),this.tag="Live2DModel(uninitialized)",this.textures=[],this.transform=new u1,this.anchor=new Dr(this.onAnchorChange,this,0,0),this.glContextID=-1,this.elapsedTime=performance.now(),this.deltaTime=0,this._autoUpdate=!1,this.once("modelLoaded",()=>this.init(e))}static from(e,t){const n=new this(t);return ct.setupLive2DModel(n,e,t).then(()=>n)}static fromSync(e,t){const n=new this(t);return ct.setupLive2DModel(n,e,t).then(t==null?void 0:t.onLoad).catch(t==null?void 0:t.onError),n}static registerTicker(e){Pn=e}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){var t;Pn||(Pn=(t=window.PIXI)==null?void 0:t.Ticker),e?this._destroyed||(Pn?(Pn.shared.add(this.onTickerUpdate,this),this._autoUpdate=!0):Ke.warn(this.tag,"No Ticker registered, please call Live2DModel.registerTicker(Ticker).")):(Pn==null||Pn.shared.remove(this.onTickerUpdate,this),this._autoUpdate=!1)}init(e){this.tag=`Live2DModel(${this.internalModel.settings.name})`;const t=Object.assign({autoUpdate:!0,autoInteract:!0},e);t.autoInteract&&(this.interactive=!0),this.autoInteract=t.autoInteract,this.autoUpdate=t.autoUpdate}onAnchorChange(){this.pivot.set(this.anchor.x*this.internalModel.width,this.anchor.y*this.internalModel.height)}motion(e,t,n){return t===void 0?this.internalModel.motionManager.startRandomMotion(e,n):this.internalModel.motionManager.startMotion(e,t,n)}expression(e){return this.internalModel.motionManager.expressionManager?e===void 0?this.internalModel.motionManager.expressionManager.setRandomExpression():this.internalModel.motionManager.expressionManager.setExpression(e):Promise.resolve(!1)}focus(e,t,n=!1){Ht.x=e,Ht.y=t,this.toModelPosition(Ht,Ht,!0);let i=Ht.x/this.internalModel.originalWidth*2-1,o=Ht.y/this.internalModel.originalHeight*2-1,a=Math.atan2(o,i);this.internalModel.focusController.focus(Math.cos(a),-Math.sin(a),n)}tap(e,t){const n=this.hitTest(e,t);n.length&&(Ke.log(this.tag,"Hit",n),this.emit("hit",n))}hitTest(e,t){return Ht.x=e,Ht.y=t,this.toModelPosition(Ht,Ht),this.internalModel.hitTest(Ht.x,Ht.y)}toModelPosition(e,t=e.clone(),n){return n||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.transform.worldTransform.applyInverse(e,t),this.internalModel.localTransform.applyInverse(t,t),t}containsPoint(e){return this.getBounds(!0).contains(e.x,e.y)}_calculateBounds(){this._bounds.addFrame(this.transform,0,0,this.internalModel.width,this.internalModel.height)}onTickerUpdate(){this.update(Pn.shared.deltaMS)}update(e){this.deltaTime+=e,this.elapsedTime+=e}_render(e){this.registerInteraction(e.plugins.interaction),e.batch.reset(),e.geometry.reset(),e.shader.reset(),e.state.reset();let t=!1;this.glContextID!==e.CONTEXT_UID&&(this.glContextID=e.CONTEXT_UID,this.internalModel.updateWebGLContext(e.gl,this.glContextID),t=!0);for(let o=0;ot.destroy(e.baseTexture)),this.internalModel.destroy(),super.destroy(e)}}up(Dl,[l1]);const ln=class{static resolveURL(r,e){var t;const n=(t=ln.filesMap[r])==null?void 0:t[e];if(n===void 0)throw new Error("Cannot find this file from uploaded files: "+e);return n}static upload(r,e){return at(this,null,function*(){const t={};for(const n of e.getDefinedFiles()){const i=decodeURI(Qo.resolve(e.url,n)),o=r.find(a=>a.webkitRelativePath===i);o&&(t[n]=URL.createObjectURL(o))}ln.filesMap[e._objectURL]=t})}static createSettings(r){return at(this,null,function*(){const e=r.find(a=>a.name.endsWith("model.json")||a.name.endsWith("model3.json"));if(!e)throw new TypeError("Settings file not found");const t=yield ln.readText(e),n=JSON.parse(t);n.url=e.webkitRelativePath;const i=ct.findRuntime(n);if(!i)throw new Error("Unknown settings JSON");const o=i.createModelSettings(n);return o._objectURL=URL.createObjectURL(e),o})}static readText(r){return at(this,null,function*(){return new Promise((e,t)=>{const n=new FileReader;n.onload=()=>e(n.result),n.onerror=t,n.readAsText(r,"utf8")})})}};let Pu=ln;Pu.filesMap={};Pu.factory=(r,e)=>at(void 0,null,function*(){if(Array.isArray(r.source)&&r.source[0]instanceof File){const t=r.source;let n=t.settings;if(!n)n=yield ln.createSettings(t);else if(!n._objectURL)throw new Error('"_objectURL" must be specified in ModelSettings');n.validateFiles(t.map(i=>encodeURI(i.webkitRelativePath))),yield ln.upload(t,n),n.resolveURL=function(i){return ln.resolveURL(this._objectURL,i)},r.source=n,r.live2dModel.once("modelLoaded",i=>{i.once("destroy",function(){const o=this.settings._objectURL;if(URL.revokeObjectURL(o),ln.filesMap[o])for(const a of Object.values(ln.filesMap[o]))URL.revokeObjectURL(a);delete ln.filesMap[o]})})}return e()});ct.live2DModelMiddlewares.unshift(Pu.factory);const Ot=class{static unzip(r,e){return at(this,null,function*(){const t=yield Ot.getFilePaths(r),n=[];for(const o of e.getDefinedFiles()){const a=decodeURI(Qo.resolve(e.url,o));t.includes(a)&&n.push(a)}const i=yield Ot.getFiles(r,n);for(let o=0;oa.endsWith("model.json")||a.endsWith("model3.json"));if(!t)throw new Error("Settings file not found");const n=yield Ot.readText(r,t);if(!n)throw new Error("Empty settings file: "+t);const i=JSON.parse(n);i.url=t;const o=ct.findRuntime(i);if(!o)throw new Error("Unknown settings JSON");return o.createModelSettings(i)})}static zipReader(r,e){return at(this,null,function*(){throw new Error("Not implemented")})}static getFilePaths(r){return at(this,null,function*(){throw new Error("Not implemented")})}static getFiles(r,e){return at(this,null,function*(){throw new Error("Not implemented")})}static readText(r,e){return at(this,null,function*(){throw new Error("Not implemented")})}static releaseReader(r){}};let $n=Ot;$n.ZIP_PROTOCOL="zip://";$n.uid=0;$n.factory=(r,e)=>at(void 0,null,function*(){const t=r.source;let n,i,o;if(typeof t=="string"&&(t.endsWith(".zip")||t.startsWith(Ot.ZIP_PROTOCOL))?(t.startsWith(Ot.ZIP_PROTOCOL)?n=t.slice(Ot.ZIP_PROTOCOL.length):n=t,i=yield Gn.load({url:n,type:"blob",target:r.live2dModel})):Array.isArray(t)&&t.length===1&&t[0]instanceof File&&t[0].name.endsWith(".zip")&&(i=t[0],n=URL.createObjectURL(i),o=t.settings),i){if(!i.size)throw new Error("Empty zip file");const a=yield Ot.zipReader(i,n);o||(o=yield Ot.createSettings(a)),o._objectURL=Ot.ZIP_PROTOCOL+Ot.uid+"/"+o.url;const s=yield Ot.unzip(a,o);s.settings=o,r.source=s,n.startsWith("blob:")&&r.live2dModel.once("modelLoaded",l=>{l.once("destroy",function(){URL.revokeObjectURL(n)})}),Ot.releaseReader(a)}return e()});ct.live2DModelMiddlewares.unshift($n.factory);if(!window.Live2DCubismCore)throw new Error("Could not find Cubism 4 runtime. This plugin requires live2dcubismcore.js to be loaded.");class h1 extends cp{constructor(e,t){var n;super(e,t),this.queueManager=new op,this.definitions=(n=e.expressions)!=null?n:[],this.init()}isFinished(){return this.queueManager.isFinished()}getExpressionIndex(e){return this.definitions.findIndex(t=>t.Name===e)}getExpressionFile(e){return e.File}createExpression(e,t){return wu.create(e)}_setExpression(e){return this.queueManager.startMotion(e,!1,performance.now())}stopAllExpressions(){this.queueManager.stopAllMotions()}updateParameters(e,t){return this.queueManager.doUpdateMotion(e,t)}}class Vr extends Au{constructor(e){if(super(e),!Vr.isValidJSON(e))throw new TypeError("Invalid JSON.");Object.assign(this,new lp(e))}static isValidJSON(e){var t;return!!(e!=null&&e.FileReferences)&&typeof e.FileReferences.Moc=="string"&&((t=e.FileReferences.Textures)==null?void 0:t.length)>0&&e.FileReferences.Textures.every(n=>typeof n=="string")}replaceFiles(e){if(super.replaceFiles(e),this.motions)for(const[t,n]of Object.entries(this.motions))for(let i=0;i{this.emit("motion:"+n)})}isFinished(){return this.queueManager.isFinished()}_startMotion(e,t){return e.setFinishedMotionHandler(t),this.queueManager.stopAllMotions(),this.queueManager.startMotion(e,!1,performance.now())}_stopAllMotions(){this.queueManager.stopAllMotions()}createMotion(e,t,n){const i=Su.create(e),o=new ip(e),a=(t===this.groups.idle?Dt.idleMotionFadingDuration:Dt.motionFadingDuration)/1e3;return o.getMotionFadeInTime()===void 0&&i.setFadeInTime(n.FadeInTime>0?n.FadeInTime:a),o.getMotionFadeOutTime()===void 0&&i.setFadeOutTime(n.FadeOutTime>0?n.FadeOutTime:a),i.setEffectIds(this.eyeBlinkIds,this.lipSyncIds),i}getMotionFile(e){return e.File}getMotionName(e){return e.File}getSoundFile(e){return e.Sound}updateParameters(e,t){return this.queueManager.doUpdateMotion(e,t)}destroy(){super.destroy(),this.queueManager.release(),this.queueManager=void 0}}const Hh=new Zt;class d1 extends o1{constructor(e,t,n){super(),this.lipSync=!0,this.breath=yu.create(),this.renderer=new sp,this.idParamAngleX=Gb,this.idParamAngleY=$b,this.idParamAngleZ=Hb,this.idParamEyeBallX=Xb,this.idParamEyeBallY=Wb,this.idParamBodyAngleX=qb,this.idParamBreath=Yb,this.pixelsPerUnit=1,this.centeringTransform=new Et,this.coreModel=e,this.settings=t,this.motionManager=new f1(t,n),this.init()}init(){var e;super.init(),((e=this.settings.getEyeBlinkParameters())==null?void 0:e.length)>0&&(this.eyeBlink=np.create(this.settings)),this.breath.setParameters([new si(this.idParamAngleX,0,15,6.5345,.5),new si(this.idParamAngleY,0,8,3.5345,.5),new si(this.idParamAngleZ,0,10,5.5345,.5),new si(this.idParamBodyAngleX,0,4,15.5345,.5),new si(this.idParamBreath,0,.5,3.2345,.5)]),this.renderer.initialize(this.coreModel),this.renderer.setIsPremultipliedAlpha(!0)}getSize(){return[this.coreModel.getModel().canvasinfo.CanvasWidth,this.coreModel.getModel().canvasinfo.CanvasHeight]}getLayout(){const e={};if(this.settings.layout)for(const t of Object.keys(this.settings.layout)){const n=t.charAt(0).toLowerCase()+t.slice(1);e[n]=this.settings.layout[t]}return e}setupLayout(){super.setupLayout(),this.pixelsPerUnit=this.coreModel.getModel().canvasinfo.PixelsPerUnit,this.centeringTransform.scale(this.pixelsPerUnit,this.pixelsPerUnit).translate(this.originalWidth/2,this.originalHeight/2)}updateWebGLContext(e,t){this.renderer.firstDraw=!0,this.renderer._bufferData={vertex:null,uv:null,index:null},this.renderer.startUp(e),this.renderer._clippingManager._currentFrameNo=t,this.renderer._clippingManager._maskTexture=void 0,jr.getInstance()._shaderSets=[]}bindTexture(e,t){this.renderer.bindTexture(e,t)}getHitAreaDefs(){var e,t;return(t=(e=this.settings.hitAreas)==null?void 0:e.map(n=>({id:n.Id,name:n.Name,index:this.coreModel.getDrawableIndex(n.Id)})))!=null?t:[]}getDrawableIDs(){return this.coreModel.getDrawableIds()}getDrawableIndex(e){return this.coreModel.getDrawableIndex(e)}getDrawableVertices(e){if(typeof e=="string"&&(e=this.coreModel.getDrawableIndex(e),e===-1))throw new TypeError("Unable to find drawable ID: "+e);const t=this.coreModel.getDrawableVertices(e).slice();for(let n=0;n{function t(){try{m1(),r()}catch(n){if(Xh--,Xh<0){const i=new Error("Failed to start up Cubism 4 framework.");i.cause=n,e(i);return}Ke.log("Cubism4","Startup failed, retrying 10ms later..."),setTimeout(t,10)}}t()})),Qi)}function m1(r){r=Object.assign({logFunction:console.log,loggingLevel:br.LogLevel_Verbose},r),Oi.startUp(r),Oi.initialize()}ct.registerRuntime({version:4,ready:p1,test(r){return r instanceof Vr||Vr.isValidJSON(r)},isValidMoc(r){if(r.byteLength<4)return!1;const e=new Int8Array(r,0,4);return String.fromCharCode(...e)==="MOC3"},createModelSettings(r){return new Vr(r)},createCoreModel(r){const e=bu.create(r);try{const t=e.createModel();return t.__moc=e,t}catch(t){try{e.release()}catch{}throw t}},createInternalModel(r,e,t){const n=new d1(r,e,t),i=r;return i.__moc&&(n.__moc=i.__moc,delete i.__moc,n.once("destroy",g1)),n},createPhysics(r,e){return Eu.create(e)},createPose(r,e){return _u.create(e)}});function g1(){var r;(r=this.__moc)==null||r.release()}const v1=Ne({__name:"Viewer",props:{model:null,mouthOpenSize:{default:0}},setup(r,{expose:e}){const t=r,n=le(),i=le(),o=le(),a=le(),s=le(0),l=le(0),u=Ve(()=>Math.max(0,Math.min(100,t.mouthOpenSize))),c=Xo(),h=nd(rd),p=Ve(()=>h.between("sm","md").value||h.smaller("sm").value),{height:f,width:g}=Wo(n,{immediate:!0,windowResize:!0,reset:!0});function v(){return a.value.internalModel.coreModel}function d(x){if(!x.value)return;let b=2.2;p.value&&(b=2.2);const C=f.value*.95/l.value*b,A=g.value*.95/s.value*b,M=Math.min(C,A);x.value.scale.set(M,M)}async function m(x){Dl.registerTicker(wn),ei.add(sy),i.value=new Zd({width:g.value,height:f.value,backgroundAlpha:0}),o.value=i.value.view,o.value.style.objectFit="contain",x.appendChild(i.value.view),a.value=await Dl.from(t.model,{motionPreload:hp.ALL}),i.value.stage.addChild(a.value),s.value=a.value.width,l.value=a.value.height,a.value.x=g.value/2,a.value.y=f.value,a.value.rotation=Math.PI,a.value.skew.x=Math.PI,a.value.anchor.set(.5,.5),d(a),a.value.on("hit",C=>{a.value&&C.includes("body")&&a.value.motion("tap_body")}),a.value.internalModel.coreModel.setParameterValueById("ParamMouthOpenY",u.value)}async function y(x){await a.value.motion(x,void 0,jo.FORCE)}const _=Gm(()=>{i.value&&i.value.renderer.resize(g.value,f.value),o.value&&(o.value.width=g.value,o.value.height=f.value),a.value&&(a.value.x=g.value/2,a.value.y=f.value,d(a))},100);function E(){a.value&&(a.value.filters=[new X_({color:c.value?10053247:14662098,alpha:.3,blur:0,distance:20,rotation:45})])}return Ge([g,f],()=>{_()}),Ge(c,E,{immediate:!0}),Ge(a,E),Jt(E),Jt(async()=>{n.value&&await m(n.value)}),Gt(()=>{var x;(x=i.value)==null||x.destroy()}),Ge(u,x=>{v().setParameterValueById("ParamMouthOpenY",x)}),e({setMotion:y}),(x,b)=>(fe(),_e("div",{ref_key:"containerRef",ref:n,"h-full":"","w-full":""},null,512))}}),_p=Ne({__name:"Screen",setup(r){const e=le(),t=nd(rd),{width:n,height:i}=$m(),o=Wo(e,{immediate:!0,windowResize:!0,reset:!0}),a=Ve(()=>t.between("sm","md").value||t.smaller("sm").value),s=Ve(()=>t.between("md","lg").value),l=Ve(()=>t.greaterOrEqual("lg").value),u=Ve(()=>l.value?o.width.value:a.value||s.value?n.value-16:o.width.value),c=le(0);return Ge([n,i,e],()=>{var p,f;const h=(f=(p=e.value)==null?void 0:p.parentElement)==null?void 0:f.getBoundingClientRect();l.value||a.value||s.value?c.value=(h==null?void 0:h.height)||0:c.value=600}),Ge([o.width,o.height],()=>{l.value||a.value||s.value?c.value=o.height.value:c.value=600}),Jt(async()=>{e.value&&o.update()}),(h,p)=>(fe(),_e("div",{ref_key:"containerRef",ref:e,"h-full":"","w-full":""},[ut(h.$slots,"default",{width:u.value,height:c.value})],512))}}),y1={absolute:"",bottom:"2",right:"2"},_1={flex:"~ row",bg:"zinc-100 dark:zinc-700",text:"sm zinc-400 dark:zinc-500","h-fit":"","w-fit":"","appearance-none":"","gap-1":"","rounded-lg":"","rounded-md":"","border-none":""},x1=["checked","aria-checked"],b1={key:0,absolute:"","w-full":"","min-w":"50vw",z:"{var o;await((o=t.value)==null?void 0:o.setMotion(i))}}),(i,o)=>{const a=Eo("TransitionVertical");return fe(),lt(_p,{relative:""},{default:Be(({width:s,height:l})=>[Oe(v1,{ref_key:"modelRef",ref:t,"canvas-width":s,"canvas-height":l,model:r.model,"mouth-open-size":r.mouthOpenSize},null,8,["canvas-width","canvas-height","model","mouth-open-size"]),Y("div",y1,[Y("div",_1,[Y("label",{"h-fit":"","cursor-pointer":"",class:Kt([n.value?"bg-zinc-300 text-zinc-900 dark:bg-zinc-200 dark:text-zinc-800":""]),transition:"all ease-in-out duration-500","rounded-md":"","px-2":"","py-2":"",z:"n.value=u),checked:n.value,"aria-checked":n.value,name:"showLive2DViewerInspector",type:"checkbox",hidden:"","appearance-none":"","outline-none":""},null,8,x1),[[Wr,n.value]]),o[8]||(o[8]=Y("div",{"select-none":""},[Y("div",{"i-solar:bug-bold-duotone":"",text:"text-zinc-900 dark:text-zinc-800"})],-1))],2)]),Oe(a,null,{default:Be(()=>[n.value?(fe(),_e("div",b1,[Y("div",w1,[o[9]||(o[9]=Y("div",{"font-mono":""},[Y("span",null,"Emotions")],-1)),Y("div",T1,[Y("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[1]||(o[1]=u=>{var c;return(c=t.value)==null?void 0:c.setMotion(K(tv))})}," 🤯 Surprised "),Y("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[2]||(o[2]=u=>{var c;return(c=t.value)==null?void 0:c.setMotion(K(nv))})}," 😫 Sad "),Y("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[3]||(o[3]=u=>{var c;return(c=t.value)==null?void 0:c.setMotion(K(rv))})}," 😠 Angry "),Y("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[4]||(o[4]=u=>{var c;return(c=t.value)==null?void 0:c.setMotion(K(iv))})}," 😄 Happy "),Y("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[5]||(o[5]=u=>{var c;return(c=t.value)==null?void 0:c.setMotion(K(ov))})}," 😳 Awkward "),Y("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[6]||(o[6]=u=>{var c;return(c=t.value)==null?void 0:c.setMotion(K(av))})}," 🤔 Question "),Y("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[7]||(o[7]=u=>{var c;return(c=t.value)==null?void 0:c.setMotion(K(Md))})}," 🤨 Think ")])])])):nt("",!0)]),_:1})])]),_:1})}}});function E1(r){return hd()?(fd(r),!0):!1}function xp(r){return typeof r=="function"?r():K(r)}const C1=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const A1=Object.prototype.toString,I1=r=>A1.call(r)==="[object Object]",P1=()=>{};function M1(r){var e;const t=xp(r);return(e=t==null?void 0:t.$el)!=null?e:t}const k1=C1?window:void 0;function ms(...r){let e,t,n,i;if(typeof r[0]=="string"||Array.isArray(r[0])?([t,n,i]=r,e=k1):[e,t,n,i]=r,!e)return P1;Array.isArray(t)||(t=[t]),Array.isArray(n)||(n=[n]);const o=[],a=()=>{o.forEach(c=>c()),o.length=0},s=(c,h,p,f)=>(c.addEventListener(h,p,f),()=>c.removeEventListener(h,p,f)),l=Ge(()=>[M1(e),xp(i)],([c,h])=>{if(a(),!c)return;const p=I1(h)?{...h}:h;o.push(...t.flatMap(f=>n.map(g=>s(c,f,g,p))))},{immediate:!0,flush:"post"}),u=()=>{l(),a()};return E1(u),u}class Vo extends fr{constructor(){super(Vo.Geometry,new Nr({opacity:0,transparent:!0})),this.isLensflare=!0,this.type="Lensflare",this.frustumCulled=!1,this.renderOrder=1/0;const e=new Re,t=new Re,n=new lc(16,16),i=new lc(16,16);let o=uc;const a=Vo.Geometry,s=new ma({uniforms:{scale:{value:null},screenPosition:{value:null}},vertexShader:` + + precision highp float; + + uniform vec3 screenPosition; + uniform vec2 scale; + + attribute vec3 position; + + void main() { + + gl_Position = vec4( position.xy * scale + screenPosition.xy, screenPosition.z, 1.0 ); + + }`,fragmentShader:` + + precision highp float; + + void main() { + + gl_FragColor = vec4( 1.0, 0.0, 1.0, 1.0 ); + + }`,depthTest:!0,depthWrite:!1,transparent:!1}),l=new ma({uniforms:{map:{value:n},scale:{value:null},screenPosition:{value:null}},vertexShader:` + + precision highp float; + + uniform vec3 screenPosition; + uniform vec2 scale; + + attribute vec3 position; + attribute vec2 uv; + + varying vec2 vUV; + + void main() { + + vUV = uv; + + gl_Position = vec4( position.xy * scale + screenPosition.xy, screenPosition.z, 1.0 ); + + }`,fragmentShader:` + + precision highp float; + + uniform sampler2D map; + + varying vec2 vUV; + + void main() { + + gl_FragColor = texture2D( map, vUV ); + + }`,depthTest:!1,depthWrite:!1,transparent:!1}),u=new fr(a,s),c=[],h=bp.Shader,p=new ma({name:h.name,uniforms:{map:{value:null},occlusionMap:{value:i},color:{value:new Vt(16777215)},scale:{value:new bt},screenPosition:{value:new Re}},vertexShader:h.vertexShader,fragmentShader:h.fragmentShader,blending:Qm,transparent:!0,depthWrite:!1}),f=new fr(a,p);this.addElement=function(y){c.push(y)};const g=new bt,v=new bt,d=new eg,m=new Bn;this.onBeforeRender=function(y,_,E){y.getCurrentViewport(m);const x=y.getRenderTarget(),b=x!==null?x.texture.type:uc;o!==b&&(n.dispose(),i.dispose(),n.type=i.type=b,o=b);const C=m.w/m.z,A=m.z/2,M=m.w/2;let I=16/m.w;if(g.set(I*C,I),d.min.set(m.x,m.y),d.max.set(m.x+(m.z-16),m.y+(m.w-16)),t.setFromMatrixPosition(this.matrixWorld),t.applyMatrix4(E.matrixWorldInverse),!(t.z>0)&&(e.copy(t).applyMatrix4(E.projectionMatrix),v.x=m.x+e.x*A+A-8,v.y=m.y+e.y*M+M-8,d.containsPoint(v))){y.copyFramebufferToTexture(n,v);let F=s.uniforms;F.scale.value=g,F.screenPosition.value=e,y.renderBufferDirect(E,null,a,s,u,null),y.copyFramebufferToTexture(i,v),F=l.uniforms,F.scale.value=g,F.screenPosition.value=e,y.renderBufferDirect(E,null,a,l,u,null);const S=-e.x*2,X=-e.y*2;for(let w=0,G=c.length;we in r?O1(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,F1=(r,e,t)=>(R1(r,e+"",t),t);async function Wh(r){const e=await r.arrayBuffer(),t=btoa(String.fromCharCode(...new Uint8Array(e)));return`data:${r.type||""};base64,${t}`}let eo,gs,Mr,to;function vs(r,e=1/0,t=null){gs||(gs=new ld(2,2,1,1)),Mr||(Mr=new qo({uniforms:{blitTexture:new ug(r)},vertexShader:` + varying vec2 vUv; + void main(){ + vUv = uv; + gl_Position = vec4(position.xy * 1.0,0.,.999999); + } + `,fragmentShader:` + uniform sampler2D blitTexture; + varying vec2 vUv; + + void main(){ + gl_FragColor = vec4(vUv.xy, 0, 1); + + #ifdef IS_SRGB + gl_FragColor = LinearTosRGB( texture2D( blitTexture, vUv) ); + #else + gl_FragColor = texture2D( blitTexture, vUv); + #endif + } + `})),Mr.uniforms.blitTexture.value=r,Mr.defines.IS_SRGB="colorSpace"in r?r.colorSpace==="srgb":r.encoding===3001,Mr.needsUpdate=!0,to||(to=new fr(gs,Mr),to.frustrumCulled=!1);const n=new Tn,i=new $s;i.add(to),t||(t=eo=new cg({antialias:!1})),t.setSize(Math.min(r.image.width,e),Math.min(r.image.height,e)),t.clear(),t.render(i,n);const o=new Ao(t.domElement);return o.minFilter=r.minFilter,o.magFilter=r.magFilter,o.wrapS=r.wrapS,o.wrapT=r.wrapT,o.name=r.name,eo&&(eo.dispose(),eo=null),o}const qh={POSITION:["byte","byte normalized","unsigned byte","unsigned byte normalized","short","short normalized","unsigned short","unsigned short normalized"],NORMAL:["byte normalized","short normalized"],TANGENT:["byte normalized","short normalized"],TEXCOORD:["byte","byte normalized","unsigned byte","short","short normalized","unsigned short"]};class wp{constructor(){this.pluginCallbacks=[],this.register(function(e){return new $1(e)}),this.register(function(e){return new H1(e)}),this.register(function(e){return new q1(e)}),this.register(function(e){return new Y1(e)}),this.register(function(e){return new K1(e)}),this.register(function(e){return new Z1(e)}),this.register(function(e){return new X1(e)}),this.register(function(e){return new W1(e)}),this.register(function(e){return new J1(e)}),this.register(function(e){return new Q1(e)}),this.register(function(e){return new ew(e)})}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,i){const o=new G1,a=[];for(let s=0,l=this.pluginCallbacks.length;sr.times[r.times.length-1]){if(Math.abs(r.times[r.times.length-1]-e)<.001)return r.times.length-1;n[n.length-1]=e,n.set(r.times,0),i.set(r.values,0),i.set(o.evaluate(e),r.values.length),a=n.length-1}else for(let s=0;se){n.set(r.times.slice(0,s+1),0),n[s+1]=e,n.set(r.times.slice(s+1),s+2),i.set(r.values.slice(0,(s+1)*t),0),i.set(o.evaluate(e),(s+1)*t),i.set(r.values.slice((s+1)*t),(s+2)*t),a=s+1;break}}return r.times=n,r.values=i,a},mergeMorphTargetTracks:function(r,e){const t=[],n={},i=r.tracks;for(let o=0;o4?a=r.array[i*r.itemSize+o]:(o===0?a=r.getX(i):o===1?a=r.getY(i):o===2?a=r.getZ(i):o===3&&(a=r.getW(i)),r.normalized===!0&&(a=qr.normalize(a,r.array))),n.min[o]=Math.min(n.min[o],a),n.max[o]=Math.max(n.max[o],a)}return n}function Tp(r){return Math.ceil(r/4)*4}function _s(r,e=0){const t=Tp(r.byteLength);if(t!==r.byteLength){const n=new Uint8Array(t);if(n.set(new Uint8Array(r)),e!==0)for(let i=r.byteLength;i"u"&&typeof OffscreenCanvas<"u"?new OffscreenCanvas(1,1):document.createElement("canvas")}function Qh(r,e){if(r.toBlob!==void 0)return new Promise(n=>r.toBlob(n,e));let t;return e==="image/jpeg"?t=.92:e==="image/webp"&&(t=.8),r.convertToBlob({type:e,quality:t})}class G1{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}setPlugins(e){this.plugins=e}async write(e,t,n={}){this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},n),this.options.animations.length>0&&(this.options.trs=!0),this.processInput(e),await Promise.all(this.pending);const i=this,o=i.buffers,a=i.json;n=i.options;const s=i.extensionsUsed,l=i.extensionsRequired,u=new Blob(o,{type:"application/octet-stream"}),c=Object.keys(s),h=Object.keys(l);c.length>0&&(a.extensionsUsed=c),h.length>0&&(a.extensionsRequired=h),a.buffers&&a.buffers.length>0&&(a.buffers[0].byteLength=u.size),n.binary===!0?u.arrayBuffer().then(p=>{const f=_s(p),g=new DataView(new ArrayBuffer(Zh));g.setUint32(0,f.byteLength,!0),g.setUint32(4,U1,!0);const v=_s(z1(JSON.stringify(a)),32),d=new DataView(new ArrayBuffer(Zh));d.setUint32(0,v.byteLength,!0),d.setUint32(4,B1,!0);const m=new ArrayBuffer(Kh),y=new DataView(m);y.setUint32(0,N1,!0),y.setUint32(4,D1,!0);const _=Kh+d.byteLength+v.byteLength+g.byteLength+f.byteLength;y.setUint32(8,_,!0),new Blob([m,d,v,g,f],{type:"application/octet-stream"}).arrayBuffer().then(t)}):a.buffers&&a.buffers.length>0?Wh(u).then(p=>{a.buffers[0].uri=p,t(a)}):t(a)}serializeUserData(e,t){if(Object.keys(e.userData).length===0)return;const n=this.options,i=this.extensionsUsed;try{const o=JSON.parse(JSON.stringify(e.userData));if(n.includeCustomExtensions&&o.gltfExtensions){t.extensions===void 0&&(t.extensions={});for(const a in o.gltfExtensions)t.extensions[a]=o.gltfExtensions[a],i[a]=!0;delete o.gltfExtensions}Object.keys(o).length>0&&(t.extras=o)}catch(o){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+o.message)}}getUID(e,t=!1){if(this.uids.has(e)===!1){const n=new Map;n.set(!0,this.uid++),n.set(!1,this.uid++),this.uids.set(e,n)}return this.uids.get(e).get(t)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;const t=new Re;for(let n=0,i=e.count;n5e-4)return!1;return!0}createNormalizedNormalAttribute(e){const t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);const n=e.clone(),i=new Re;for(let o=0,a=n.count;o4?g=e.array[p*e.itemSize+f]:(f===0?g=e.getX(p):f===1?g=e.getY(p):f===2?g=e.getZ(p):f===3&&(g=e.getW(p)),e.normalized===!0&&(g=qr.normalize(g,e.array))),t===je.FLOAT?u.setFloat32(c,g,!0):t===je.INT?u.setInt32(c,g,!0):t===je.UNSIGNED_INT?u.setUint32(c,g,!0):t===je.SHORT?u.setInt16(c,g,!0):t===je.UNSIGNED_SHORT?u.setUint16(c,g,!0):t===je.BYTE?u.setInt8(c,g):t===je.UNSIGNED_BYTE&&u.setUint8(c,g),c+=s}const h={buffer:this.processBuffer(u.buffer),byteOffset:this.byteOffset,byteLength:l};return o!==void 0&&(h.target=o),o===je.ARRAY_BUFFER&&(h.byteStride=e.itemSize*s),this.byteOffset+=l,a.bufferViews.push(h),{id:a.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){const t=this,n=t.json;return n.bufferViews||(n.bufferViews=[]),e.arrayBuffer().then(i=>{const o=_s(i),a={buffer:t.processBuffer(o),byteOffset:t.byteOffset,byteLength:o.byteLength};return t.byteOffset+=o.byteLength,n.bufferViews.push(a)-1})}processAccessor(e,t,n,i){const o=this.json,a={1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"};let s;if(e.array.constructor===Float32Array)s=je.FLOAT;else if(e.array.constructor===Int32Array)s=je.INT;else if(e.array.constructor===Uint32Array)s=je.UNSIGNED_INT;else if(e.array.constructor===Int16Array)s=je.SHORT;else if(e.array.constructor===Uint16Array)s=je.UNSIGNED_SHORT;else if(e.array.constructor===Int8Array)s=je.BYTE;else if(e.array.constructor===Uint8Array)s=je.UNSIGNED_BYTE;else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: "+e.array.constructor.name);if(n===void 0&&(n=0),i===void 0&&(i=e.count),i===0)return null;const l=V1(e,n,i);let u;t!==void 0&&(u=e===t.index?je.ELEMENT_ARRAY_BUFFER:je.ARRAY_BUFFER);const c=this.processBufferView(e,s,n,i,u),h={bufferView:c.id,byteOffset:c.byteOffset,componentType:s,count:i,max:l.max,min:l.min,type:a[e.itemSize]};return e.normalized===!0&&(h.normalized=!0),o.accessors||(o.accessors=[]),o.accessors.push(h)-1}processImage(e,t,n,i="image/png"){if(e!==null){const o=this,a=o.cache,s=o.json,l=o.options,u=o.pending;a.images.has(e)||a.images.set(e,{});const c=a.images.get(e),h=i+":flipY/"+n.toString();if(c[h]!==void 0)return c[h];s.images||(s.images=[]);const p={mimeType:i},f=Jh();f.width=Math.min(e.width,l.maxTextureSize),f.height=Math.min(e.height,l.maxTextureSize);const g=f.getContext("2d");if(n===!0&&(g.translate(0,f.height),g.scale(1,-1)),e.data!==void 0){t!==sg&&console.error("GLTFExporter: Only RGBAFormat is supported.",t),(e.width>l.maxTextureSize||e.height>l.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);const d=new Uint8ClampedArray(e.height*e.width*4);for(let m=0;mo.processBufferViewImage(d)).then(d=>{p.bufferView=d})):f.toDataURL!==void 0?p.uri=f.toDataURL(i):u.push(Qh(f,i).then(Wh).then(d=>{p.uri=d}));const v=s.images.push(p)-1;return c[h]=v,v}else throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.")}processSampler(e){const t=this.json;t.samplers||(t.samplers=[]);const n={magFilter:zt[e.magFilter],minFilter:zt[e.minFilter],wrapS:zt[e.wrapS],wrapT:zt[e.wrapT]};return t.samplers.push(n)-1}processTexture(e){const t=this.options,n=this.cache,i=this.json;if(n.textures.has(e))return n.textures.get(e);i.textures||(i.textures=[]),e instanceof ga&&(e=vs(e,t.maxTextureSize));let o=e.userData.mimeType;o==="image/webp"&&(o="image/png");const a={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,o)};e.name&&(a.name=e.name),this._invokeAll(function(l){l.writeTexture&&l.writeTexture(e,a)});const s=i.textures.push(a)-1;return n.textures.set(e,s),s}processMaterial(e){const t=this.cache,n=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;n.materials||(n.materials=[]);const i={pbrMetallicRoughness:{}};e.isMeshStandardMaterial!==!0&&e.isMeshBasicMaterial!==!0&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");const o=e.color.toArray().concat([e.opacity]);if(yi(o,[1,1,1,1])||(i.pbrMetallicRoughness.baseColorFactor=o),e.isMeshStandardMaterial?(i.pbrMetallicRoughness.metallicFactor=e.metalness,i.pbrMetallicRoughness.roughnessFactor=e.roughness):(i.pbrMetallicRoughness.metallicFactor=.5,i.pbrMetallicRoughness.roughnessFactor=.5),e.metalnessMap||e.roughnessMap){const s=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),l={index:this.processTexture(s),channel:s.channel};this.applyTextureTransform(l,s),i.pbrMetallicRoughness.metallicRoughnessTexture=l}if(e.map){const s={index:this.processTexture(e.map),texCoord:e.map.channel};this.applyTextureTransform(s,e.map),i.pbrMetallicRoughness.baseColorTexture=s}if(e.emissive){const s=e.emissive;if(Math.max(s.r,s.g,s.b)>0&&(i.emissiveFactor=e.emissive.toArray()),e.emissiveMap){const l={index:this.processTexture(e.emissiveMap),texCoord:e.emissiveMap.channel};this.applyTextureTransform(l,e.emissiveMap),i.emissiveTexture=l}}if(e.normalMap){const s={index:this.processTexture(e.normalMap),texCoord:e.normalMap.channel};e.normalScale&&e.normalScale.x!==1&&(s.scale=e.normalScale.x),this.applyTextureTransform(s,e.normalMap),i.normalTexture=s}if(e.aoMap){const s={index:this.processTexture(e.aoMap),texCoord:e.aoMap.channel};e.aoMapIntensity!==1&&(s.strength=e.aoMapIntensity),this.applyTextureTransform(s,e.aoMap),i.occlusionTexture=s}e.transparent?i.alphaMode="BLEND":e.alphaTest>0&&(i.alphaMode="MASK",i.alphaCutoff=e.alphaTest),e.side===Yo&&(i.doubleSided=!0),e.name!==""&&(i.name=e.name),this.serializeUserData(e,i),this._invokeAll(function(s){s.writeMaterial&&s.writeMaterial(e,i)});const a=n.materials.push(i)-1;return t.materials.set(e,a),a}processMesh(e){const t=this.cache,n=this.json,i=[e.geometry.uuid];if(Array.isArray(e.material))for(let _=0,E=e.material.length;_=152?{uv:"TEXCOORD_0",uv1:"TEXCOORD_1",uv2:"TEXCOORD_2",uv3:"TEXCOORD_3"}:{uv:"TEXCOORD_0",uv2:"TEXCOORD_1"},color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},f=a.getAttribute("normal");f!==void 0&&!this.isNormalizedNormalAttribute(f)&&(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),a.setAttribute("normal",this.createNormalizedNormalAttribute(f)));let g=null;for(let _ in a.attributes){if(_.slice(0,5)==="morph")continue;const E=a.attributes[_];if(_=p[_]||_.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(_)||(_="_"+_),t.attributes.has(this.getUID(E))){u[_]=t.attributes.get(this.getUID(E));continue}g=null;const x=E.array;_==="JOINTS_0"&&!(x instanceof Uint16Array)&&!(x instanceof Uint8Array)&&(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),g=new cr(new Uint16Array(x),E.itemSize,E.normalized));const b=this.processAccessor(g||E,a);b!==null&&(_.startsWith("_")||this.detectMeshQuantization(_,E),u[_]=b,t.attributes.set(this.getUID(E),b))}if(f!==void 0&&a.setAttribute("normal",f),Object.keys(u).length===0)return null;if(e.morphTargetInfluences!==void 0&&e.morphTargetInfluences.length>0){const _=[],E=[],x={};if(e.morphTargetDictionary!==void 0)for(const b in e.morphTargetDictionary)x[e.morphTargetDictionary[b]]=b;for(let b=0;b0&&(l.extras={},l.extras.targetNames=E)}const v=Array.isArray(e.material);if(v&&a.groups.length===0)return null;const d=v?e.material:[e.material],m=v?a.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let _=0,E=m.length;_0&&(x.targets=h),a.index!==null){let C=this.getUID(a.index);(m[_].start!==void 0||m[_].count!==void 0)&&(C+=":"+m[_].start+":"+m[_].count),t.attributes.has(C)?x.indices=t.attributes.get(C):(x.indices=this.processAccessor(a.index,a,m[_].start,m[_].count),t.attributes.set(C,x.indices)),x.indices===null&&delete x.indices}const b=this.processMaterial(d[m[_].materialIndex]);b!==null&&(x.material=b),c.push(x)}l.primitives=c,n.meshes||(n.meshes=[]),this._invokeAll(function(_){_.writeMesh&&_.writeMesh(e,l)});const y=n.meshes.push(l)-1;return t.meshes.set(o,y),y}detectMeshQuantization(e,t){if(this.extensionsUsed[ys])return;let n;switch(t.array.constructor){case Int8Array:n="byte";break;case Uint8Array:n="unsigned byte";break;case Int16Array:n="short";break;case Uint16Array:n="unsigned short";break;default:return}t.normalized&&(n+=" normalized");const i=e.split("_",1)[0];qh[i]&&qh[i].includes(n)&&(this.extensionsUsed[ys]=!0,this.extensionsRequired[ys]=!0)}processCamera(e){const t=this.json;t.cameras||(t.cameras=[]);const n=e.isOrthographicCamera,i={type:n?"orthographic":"perspective"};return n?i.orthographic={xmag:e.right*2,ymag:e.top*2,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:i.perspective={aspectRatio:e.aspect,yfov:qr.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},e.name!==""&&(i.name=e.type),t.cameras.push(i)-1}processAnimation(e,t){const n=this.json,i=this.nodeMap;n.animations||(n.animations=[]),e=wp.Utils.mergeMorphTargetTracks(e.clone(),t);const o=e.tracks,a=[],s=[];for(let l=0;l0){const s=[];for(let l=0,u=e.children.length;l0&&(o.children=s)}this._invokeAll(function(s){s.writeNode&&s.writeNode(e,o)});const a=t.nodes.push(o)-1;return i.set(e,a),a}processScene(e){const t=this.json,n=this.options;t.scenes||(t.scenes=[],t.scene=0);const i={};e.name!==""&&(i.name=e.name),t.scenes.push(i);const o=[];for(let a=0,s=e.children.length;a0&&(i.nodes=o),this.serializeUserData(e,i)}processObjects(e){const t=new $s;t.name="AuxScene";for(let n=0;n0&&this.processObjects(n);for(let i=0;i0&&(a.range=e.distance)):e.isSpotLight&&(a.type="spot",e.distance>0&&(a.range=e.distance),a.spot={},a.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,a.spot.outerConeAngle=e.angle),e.decay!==void 0&&e.decay!==2&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),e.target&&(e.target.parent!==e||e.target.position.x!==0||e.target.position.y!==0||e.target.position.z!==-1)&&console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),o[this.name]||(i.extensions=i.extensions||{},i.extensions[this.name]={lights:[]},o[this.name]=!0);const s=i.extensions[this.name].lights;s.push(a),t.extensions=t.extensions||{},t.extensions[this.name]={light:s.length-1}}}let H1=class{constructor(r){this.writer=r,this.name="KHR_materials_unlit"}writeMaterial(r,e){if(!r.isMeshBasicMaterial)return;const t=this.writer.extensionsUsed;e.extensions=e.extensions||{},e.extensions[this.name]={},t[this.name]=!0,e.pbrMetallicRoughness.metallicFactor=0,e.pbrMetallicRoughness.roughnessFactor=.9}},X1=class{constructor(r){this.writer=r,this.name="KHR_materials_clearcoat"}writeMaterial(r,e){if(!r.isMeshPhysicalMaterial||r.clearcoat===0)return;const t=this.writer,n=t.extensionsUsed,i={};if(i.clearcoatFactor=r.clearcoat,r.clearcoatMap){const o={index:t.processTexture(r.clearcoatMap),texCoord:r.clearcoatMap.channel};t.applyTextureTransform(o,r.clearcoatMap),i.clearcoatTexture=o}if(i.clearcoatRoughnessFactor=r.clearcoatRoughness,r.clearcoatRoughnessMap){const o={index:t.processTexture(r.clearcoatRoughnessMap),texCoord:r.clearcoatRoughnessMap.channel};t.applyTextureTransform(o,r.clearcoatRoughnessMap),i.clearcoatRoughnessTexture=o}if(r.clearcoatNormalMap){const o={index:t.processTexture(r.clearcoatNormalMap),texCoord:r.clearcoatNormalMap.channel};t.applyTextureTransform(o,r.clearcoatNormalMap),i.clearcoatNormalTexture=o}e.extensions=e.extensions||{},e.extensions[this.name]=i,n[this.name]=!0}},W1=class{constructor(r){this.writer=r,this.name="KHR_materials_iridescence"}writeMaterial(r,e){if(!r.isMeshPhysicalMaterial||r.iridescence===0)return;const t=this.writer,n=t.extensionsUsed,i={};if(i.iridescenceFactor=r.iridescence,r.iridescenceMap){const o={index:t.processTexture(r.iridescenceMap),texCoord:r.iridescenceMap.channel};t.applyTextureTransform(o,r.iridescenceMap),i.iridescenceTexture=o}if(i.iridescenceIor=r.iridescenceIOR,i.iridescenceThicknessMinimum=r.iridescenceThicknessRange[0],i.iridescenceThicknessMaximum=r.iridescenceThicknessRange[1],r.iridescenceThicknessMap){const o={index:t.processTexture(r.iridescenceThicknessMap),texCoord:r.iridescenceThicknessMap.channel};t.applyTextureTransform(o,r.iridescenceThicknessMap),i.iridescenceThicknessTexture=o}e.extensions=e.extensions||{},e.extensions[this.name]=i,n[this.name]=!0}},q1=class{constructor(r){this.writer=r,this.name="KHR_materials_transmission"}writeMaterial(r,e){if(!r.isMeshPhysicalMaterial||r.transmission===0)return;const t=this.writer,n=t.extensionsUsed,i={};if(i.transmissionFactor=r.transmission,r.transmissionMap){const o={index:t.processTexture(r.transmissionMap),texCoord:r.transmissionMap.channel};t.applyTextureTransform(o,r.transmissionMap),i.transmissionTexture=o}e.extensions=e.extensions||{},e.extensions[this.name]=i,n[this.name]=!0}},Y1=class{constructor(r){this.writer=r,this.name="KHR_materials_volume"}writeMaterial(r,e){if(!r.isMeshPhysicalMaterial||r.transmission===0)return;const t=this.writer,n=t.extensionsUsed,i={};if(i.thicknessFactor=r.thickness,r.thicknessMap){const o={index:t.processTexture(r.thicknessMap),texCoord:r.thicknessMap.channel};t.applyTextureTransform(o,r.thicknessMap),i.thicknessTexture=o}i.attenuationDistance=r.attenuationDistance,i.attenuationColor=r.attenuationColor.toArray(),e.extensions=e.extensions||{},e.extensions[this.name]=i,n[this.name]=!0}},K1=class{constructor(r){this.writer=r,this.name="KHR_materials_ior"}writeMaterial(r,e){if(!r.isMeshPhysicalMaterial||r.ior===1.5)return;const t=this.writer.extensionsUsed,n={};n.ior=r.ior,e.extensions=e.extensions||{},e.extensions[this.name]=n,t[this.name]=!0}},Z1=class{constructor(r){this.writer=r,this.name="KHR_materials_specular"}writeMaterial(r,e){if(!r.isMeshPhysicalMaterial||r.specularIntensity===1&&r.specularColor.equals(L1)&&!r.specularIntensityMap&&!r.specularColorTexture)return;const t=this.writer,n=t.extensionsUsed,i={};if(r.specularIntensityMap){const o={index:t.processTexture(r.specularIntensityMap),texCoord:r.specularIntensityMap.channel};t.applyTextureTransform(o,r.specularIntensityMap),i.specularTexture=o}if(r.specularColorMap){const o={index:t.processTexture(r.specularColorMap),texCoord:r.specularColorMap.channel};t.applyTextureTransform(o,r.specularColorMap),i.specularColorTexture=o}i.specularFactor=r.specularIntensity,i.specularColorFactor=r.specularColor.toArray(),e.extensions=e.extensions||{},e.extensions[this.name]=i,n[this.name]=!0}},J1=class{constructor(r){this.writer=r,this.name="KHR_materials_sheen"}writeMaterial(r,e){if(!r.isMeshPhysicalMaterial||r.sheen==0)return;const t=this.writer,n=t.extensionsUsed,i={};if(r.sheenRoughnessMap){const o={index:t.processTexture(r.sheenRoughnessMap),texCoord:r.sheenRoughnessMap.channel};t.applyTextureTransform(o,r.sheenRoughnessMap),i.sheenRoughnessTexture=o}if(r.sheenColorMap){const o={index:t.processTexture(r.sheenColorMap),texCoord:r.sheenColorMap.channel};t.applyTextureTransform(o,r.sheenColorMap),i.sheenColorTexture=o}i.sheenRoughnessFactor=r.sheenRoughness,i.sheenColorFactor=r.sheenColor.toArray(),e.extensions=e.extensions||{},e.extensions[this.name]=i,n[this.name]=!0}},Q1=class{constructor(r){this.writer=r,this.name="KHR_materials_anisotropy"}writeMaterial(r,e){if(!r.isMeshPhysicalMaterial||r.anisotropy==0)return;const t=this.writer,n=t.extensionsUsed,i={};if(r.anisotropyMap){const o={index:t.processTexture(r.anisotropyMap)};t.applyTextureTransform(o,r.anisotropyMap),i.anisotropyTexture=o}i.anisotropyStrength=r.anisotropy,i.anisotropyRotation=r.anisotropyRotation,e.extensions=e.extensions||{},e.extensions[this.name]=i,n[this.name]=!0}},ew=class{constructor(r){this.writer=r,this.name="KHR_materials_emissive_strength"}writeMaterial(r,e){if(!r.isMeshStandardMaterial||r.emissiveIntensity===1)return;const t=this.writer.extensionsUsed,n={};n.emissiveStrength=r.emissiveIntensity,e.extensions=e.extensions||{},e.extensions[this.name]=n,t[this.name]=!0}};var Li=Uint8Array,Sp=Uint16Array,tw=Uint32Array,nw=new Li([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),rw=new Li([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Ep=function(r,e){for(var t=new Sp(31),n=0;n<31;++n)t[n]=e+=1<>>1|(rt&21845)<<1;Mn=(Mn&52428)>>>2|(Mn&13107)<<2,Mn=(Mn&61680)>>>4|(Mn&3855)<<4,aw[rt]=((Mn&65280)>>>8|(Mn&255)<<8)>>>1}var ra=new Li(288);for(var rt=0;rt<144;++rt)ra[rt]=8;for(var rt=144;rt<256;++rt)ra[rt]=9;for(var rt=256;rt<280;++rt)ra[rt]=7;for(var rt=280;rt<288;++rt)ra[rt]=8;var sw=new Li(32);for(var rt=0;rt<32;++rt)sw[rt]=5;var lw=new Li(0),uw=typeof TextDecoder<"u"&&new TextDecoder,cw=0;try{uw.decode(lw,{stream:!0}),cw=1}catch{}var hw=Object.defineProperty,fw=(r,e,t)=>e in r?hw(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,dw=(r,e,t)=>(fw(r,e+"",t),t);const Ap=class extends fr{constructor(e,t={}){super(e),this.isReflector=!0,this.type="Reflector",this.camera=new Tn;const n=this,i=t.color!==void 0?new Vt(t.color):new Vt(8355711),o=t.textureWidth||512,a=t.textureHeight||512,s=t.clipBias||0,l=t.shader||Ap.ReflectorShader,u=t.multisample!==void 0?t.multisample:4,c=new sd,h=new Re,p=new Re,f=new Re,g=new Sn,v=new Re(0,0,-1),d=new Bn,m=new Re,y=new Re,_=new Bn,E=new Sn,x=this.camera,b=new rg(o,a,{samples:u,type:ig}),C=new qo({uniforms:nu.clone(l.uniforms),fragmentShader:l.fragmentShader,vertexShader:l.vertexShader});C.uniforms.tDiffuse.value=b.texture,C.uniforms.color.value=i,C.uniforms.textureMatrix.value=E,this.material=C,this.onBeforeRender=function(A,M,I){if(p.setFromMatrixPosition(n.matrixWorld),f.setFromMatrixPosition(I.matrixWorld),g.extractRotation(n.matrixWorld),h.set(0,0,1),h.applyMatrix4(g),m.subVectors(p,f),m.dot(h)>0)return;m.reflect(h).negate(),m.add(p),g.extractRotation(I.matrixWorld),v.set(0,0,-1),v.applyMatrix4(g),v.add(f),y.subVectors(p,v),y.reflect(h).negate(),y.add(p),x.position.copy(m),x.up.set(0,1,0),x.up.applyMatrix4(g),x.up.reflect(h),x.lookAt(y),x.far=I.far,x.updateMatrixWorld(),x.projectionMatrix.copy(I.projectionMatrix),E.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),E.multiply(x.projectionMatrix),E.multiply(x.matrixWorldInverse),E.multiply(n.matrixWorld),c.setFromNormalAndCoplanarPoint(h,p),c.applyMatrix4(x.matrixWorldInverse),d.set(c.normal.x,c.normal.y,c.normal.z,c.constant);const F=x.projectionMatrix;_.x=(Math.sign(d.x)+F.elements[8])/F.elements[0],_.y=(Math.sign(d.y)+F.elements[9])/F.elements[5],_.z=-1,_.w=(1+F.elements[10])/F.elements[14],d.multiplyScalar(2/d.dot(_)),F.elements[2]=d.x,F.elements[6]=d.y,F.elements[10]=d.z+1-s,F.elements[14]=d.w,n.visible=!1;const S=A.getRenderTarget(),X=A.xr.enabled,w=A.shadowMap.autoUpdate,G=A.toneMapping;let R=!1;"outputColorSpace"in A?R=A.outputColorSpace==="srgb":R=A.outputEncoding===3001,A.xr.enabled=!1,A.shadowMap.autoUpdate=!1,"outputColorSpace"in A?A.outputColorSpace="srgb-linear":A.outputEncoding=3e3,A.toneMapping=og,A.setRenderTarget(b),A.state.buffers.depth.setMask(!0),A.autoClear===!1&&A.clear(),A.render(M,x),A.xr.enabled=X,A.shadowMap.autoUpdate=w,A.toneMapping=G,"outputColorSpace"in A?A.outputColorSpace=R?"srgb":"srgb-linear":A.outputEncoding=R?3001:3e3,A.setRenderTarget(S);const L=I.viewport;L!==void 0&&A.state.viewport(L),n.visible=!0},this.getRenderTarget=function(){return b},this.dispose=function(){b.dispose(),n.material.dispose()}}};let Bl=Ap;dw(Bl,"ReflectorShader",{uniforms:{color:{value:null},tDiffuse:{value:null},textureMatrix:{value:null}},vertexShader:` + uniform mat4 textureMatrix; + varying vec4 vUv; + + #include + #include + + void main() { + + vUv = textureMatrix * vec4( position, 1.0 ); + + gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); + + #include + + }`,fragmentShader:` + uniform vec3 color; + uniform sampler2D tDiffuse; + varying vec4 vUv; + + #include + + float blendOverlay( float base, float blend ) { + + return( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) ); + + } + + vec3 blendOverlay( vec3 base, vec3 blend ) { + + return vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) ); + + } + + void main() { + + #include + + vec4 base = texture2DProj( tDiffuse, vUv ); + gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 ); + + #include + #include <${Mu>=154?"colorspace_fragment":"encodings_fragment"}> + + }`});var pw=Object.defineProperty,mw=(r,e,t)=>e in r?pw(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ip=(r,e,t)=>(mw(r,typeof e!="symbol"?e+"":e,t),t);const wo={uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new Re},up:{value:new Re(0,1,0)}},vertexShader:` + uniform vec3 sunPosition; + uniform float rayleigh; + uniform float turbidity; + uniform float mieCoefficient; + uniform vec3 up; + + varying vec3 vWorldPosition; + varying vec3 vSunDirection; + varying float vSunfade; + varying vec3 vBetaR; + varying vec3 vBetaM; + varying float vSunE; + + // constants for atmospheric scattering + const float e = 2.71828182845904523536028747135266249775724709369995957; + const float pi = 3.141592653589793238462643383279502884197169; + + // wavelength of used primaries, according to preetham + const vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 ); + // this pre-calcuation replaces older TotalRayleigh(vec3 lambda) function: + // (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn)) + const vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 ); + + // mie stuff + // K coefficient for the primaries + const float v = 4.0; + const vec3 K = vec3( 0.686, 0.678, 0.666 ); + // MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K + const vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 ); + + // earth shadow hack + // cutoffAngle = pi / 1.95; + const float cutoffAngle = 1.6110731556870734; + const float steepness = 1.5; + const float EE = 1000.0; + + float sunIntensity( float zenithAngleCos ) { + zenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 ); + return EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) ); + } + + vec3 totalMie( float T ) { + float c = ( 0.2 * T ) * 10E-18; + return 0.434 * c * MieConst; + } + + void main() { + + vec4 worldPosition = modelMatrix * vec4( position, 1.0 ); + vWorldPosition = worldPosition.xyz; + + gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); + gl_Position.z = gl_Position.w; // set z to camera.far + + vSunDirection = normalize( sunPosition ); + + vSunE = sunIntensity( dot( vSunDirection, up ) ); + + vSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 ); + + float rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) ); + + // extinction (absorbtion + out scattering) + // rayleigh coefficients + vBetaR = totalRayleigh * rayleighCoefficient; + + // mie coefficients + vBetaM = totalMie( turbidity ) * mieCoefficient; + + } + `,fragmentShader:` + varying vec3 vWorldPosition; + varying vec3 vSunDirection; + varying float vSunfade; + varying vec3 vBetaR; + varying vec3 vBetaM; + varying float vSunE; + + uniform float mieDirectionalG; + uniform vec3 up; + + const vec3 cameraPos = vec3( 0.0, 0.0, 0.0 ); + + // constants for atmospheric scattering + const float pi = 3.141592653589793238462643383279502884197169; + + const float n = 1.0003; // refractive index of air + const float N = 2.545E25; // number of molecules per unit volume for air at 288.15K and 1013mb (sea level -45 celsius) + + // optical length at zenith for molecules + const float rayleighZenithLength = 8.4E3; + const float mieZenithLength = 1.25E3; + // 66 arc seconds -> degrees, and the cosine of that + const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324; + + // 3.0 / ( 16.0 * pi ) + const float THREE_OVER_SIXTEENPI = 0.05968310365946075; + // 1.0 / ( 4.0 * pi ) + const float ONE_OVER_FOURPI = 0.07957747154594767; + + float rayleighPhase( float cosTheta ) { + return THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) ); + } + + float hgPhase( float cosTheta, float g ) { + float g2 = pow( g, 2.0 ); + float inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 ); + return ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse ); + } + + void main() { + + vec3 direction = normalize( vWorldPosition - cameraPos ); + + // optical length + // cutoff angle at 90 to avoid singularity in next formula. + float zenithAngle = acos( max( 0.0, dot( up, direction ) ) ); + float inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) ); + float sR = rayleighZenithLength * inverse; + float sM = mieZenithLength * inverse; + + // combined extinction factor + vec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) ); + + // in scattering + float cosTheta = dot( direction, vSunDirection ); + + float rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 ); + vec3 betaRTheta = vBetaR * rPhase; + + float mPhase = hgPhase( cosTheta, mieDirectionalG ); + vec3 betaMTheta = vBetaM * mPhase; + + vec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) ); + Lin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) ); + + // nightsky + float theta = acos( direction.y ); // elevation --> y-axis, [-pi/2, pi/2] + float phi = atan( direction.z, direction.x ); // azimuth --> x-axis [-pi/2, pi/2] + vec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 ); + vec3 L0 = vec3( 0.1 ) * Fex; + + // composition + solar disc + float sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta ); + L0 += ( vSunE * 19000.0 * Fex ) * sundisk; + + vec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 ); + + vec3 retColor = pow( texColor, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) ); + + gl_FragColor = vec4( retColor, 1.0 ); + + #include + #include <${Mu>=154?"colorspace_fragment":"encodings_fragment"}> + + } + `},Pp=new qo({name:"SkyShader",fragmentShader:wo.fragmentShader,vertexShader:wo.vertexShader,uniforms:nu.clone(wo.uniforms),side:Hm,depthWrite:!1});class Mp extends fr{constructor(){super(new ag(1,1,1),Pp)}}Ip(Mp,"SkyShader",wo);Ip(Mp,"material",Pp);new Xm;new Re;new ad(0,0,0,"YXZ");new Re;var gw=Object.defineProperty,vw=(r,e,t)=>e in r?gw(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ae=(r,e,t)=>(vw(r,typeof e!="symbol"?e+"":e,t),t);const no=new Wm,ef=new sd,yw=Math.cos(70*(Math.PI/180)),tf=(r,e)=>(r%e+e)%e;class _w extends ng{constructor(e,t){super(),Ae(this,"object"),Ae(this,"domElement"),Ae(this,"enabled",!0),Ae(this,"target",new Re),Ae(this,"minDistance",0),Ae(this,"maxDistance",1/0),Ae(this,"minZoom",0),Ae(this,"maxZoom",1/0),Ae(this,"minPolarAngle",0),Ae(this,"maxPolarAngle",Math.PI),Ae(this,"minAzimuthAngle",-1/0),Ae(this,"maxAzimuthAngle",1/0),Ae(this,"enableDamping",!1),Ae(this,"dampingFactor",.05),Ae(this,"enableZoom",!0),Ae(this,"zoomSpeed",1),Ae(this,"enableRotate",!0),Ae(this,"rotateSpeed",1),Ae(this,"enablePan",!0),Ae(this,"panSpeed",1),Ae(this,"screenSpacePanning",!0),Ae(this,"keyPanSpeed",7),Ae(this,"zoomToCursor",!1),Ae(this,"autoRotate",!1),Ae(this,"autoRotateSpeed",2),Ae(this,"reverseOrbit",!1),Ae(this,"reverseHorizontalOrbit",!1),Ae(this,"reverseVerticalOrbit",!1),Ae(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),Ae(this,"mouseButtons",{LEFT:Cr.ROTATE,MIDDLE:Cr.DOLLY,RIGHT:Cr.PAN}),Ae(this,"touches",{ONE:Ln.ROTATE,TWO:Ln.DOLLY_PAN}),Ae(this,"target0"),Ae(this,"position0"),Ae(this,"zoom0"),Ae(this,"_domElementKeyEvents",null),Ae(this,"getPolarAngle"),Ae(this,"getAzimuthalAngle"),Ae(this,"setPolarAngle"),Ae(this,"setAzimuthalAngle"),Ae(this,"getDistance"),Ae(this,"listenToKeyEvents"),Ae(this,"stopListenToKeyEvents"),Ae(this,"saveState"),Ae(this,"reset"),Ae(this,"update"),Ae(this,"connect"),Ae(this,"dispose"),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>c.phi,this.getAzimuthalAngle=()=>c.theta,this.setPolarAngle=U=>{let q=tf(U,2*Math.PI),ve=c.phi;ve<0&&(ve+=2*Math.PI),q<0&&(q+=2*Math.PI);let be=Math.abs(q-ve);2*Math.PI-be{let q=tf(U,2*Math.PI),ve=c.theta;ve<0&&(ve+=2*Math.PI),q<0&&(q+=2*Math.PI);let be=Math.abs(q-ve);2*Math.PI-ben.object.position.distanceTo(n.target),this.listenToKeyEvents=U=>{U.addEventListener("keydown",ce),this._domElementKeyEvents=U},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",ce),this._domElementKeyEvents=null},this.saveState=()=>{n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=()=>{n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(i),n.update(),l=s.NONE},this.update=(()=>{const U=new Re,q=new Re(0,1,0),ve=new Co().setFromUnitVectors(e.up,q),be=ve.clone().invert(),Le=new Re,Se=new Co,Ct=2*Math.PI;return function(){const At=n.object.position;ve.setFromUnitVectors(e.up,q),be.copy(ve).invert(),U.copy(At).sub(n.target),U.applyQuaternion(ve),c.setFromVector3(U),n.autoRotate&&l===s.NONE&&w(S()),n.enableDamping?(c.theta+=h.theta*n.dampingFactor,c.phi+=h.phi*n.dampingFactor):(c.theta+=h.theta,c.phi+=h.phi);let We=n.minAzimuthAngle,xt=n.maxAzimuthAngle;isFinite(We)&&isFinite(xt)&&(We<-Math.PI?We+=Ct:We>Math.PI&&(We-=Ct),xt<-Math.PI?xt+=Ct:xt>Math.PI&&(xt-=Ct),We<=xt?c.theta=Math.max(We,Math.min(xt,c.theta)):c.theta=c.theta>(We+xt)/2?Math.max(We,c.theta):Math.min(xt,c.theta)),c.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,c.phi)),c.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(f,n.dampingFactor):n.target.add(f),n.zoomToCursor&&M||n.object.isOrthographicCamera?c.radius=j(c.radius):c.radius=j(c.radius*p),U.setFromSpherical(c),U.applyQuaternion(be),At.copy(n.target).add(U),n.object.matrixAutoUpdate||n.object.updateMatrix(),n.object.lookAt(n.target),n.enableDamping===!0?(h.theta*=1-n.dampingFactor,h.phi*=1-n.dampingFactor,f.multiplyScalar(1-n.dampingFactor)):(h.set(0,0,0),f.set(0,0,0));let gn=!1;if(n.zoomToCursor&&M){let $t=null;if(n.object instanceof Tn&&n.object.isPerspectiveCamera){const wt=U.length();$t=j(wt*p);const Xn=wt-$t;n.object.position.addScaledVector(C,Xn),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){const wt=new Re(A.x,A.y,0);wt.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/p)),n.object.updateProjectionMatrix(),gn=!0;const Xn=new Re(A.x,A.y,0);Xn.unproject(n.object),n.object.position.sub(Xn).add(wt),n.object.updateMatrixWorld(),$t=U.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;$t!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar($t).add(n.object.position):(no.origin.copy(n.object.position),no.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(no.direction))u||8*(1-Se.dot(n.object.quaternion))>u?(n.dispatchEvent(i),Le.copy(n.object.position),Se.copy(n.object.quaternion),gn=!1,!0):!1}})(),this.connect=U=>{n.domElement=U,n.domElement.style.touchAction="none",n.domElement.addEventListener("contextmenu",Ce),n.domElement.addEventListener("pointerdown",se),n.domElement.addEventListener("pointercancel",he),n.domElement.addEventListener("wheel",re)},this.dispose=()=>{var U,q,ve,be,Le,Se;n.domElement&&(n.domElement.style.touchAction="auto"),(U=n.domElement)==null||U.removeEventListener("contextmenu",Ce),(q=n.domElement)==null||q.removeEventListener("pointerdown",se),(ve=n.domElement)==null||ve.removeEventListener("pointercancel",he),(be=n.domElement)==null||be.removeEventListener("wheel",re),(Le=n.domElement)==null||Le.ownerDocument.removeEventListener("pointermove",te),(Se=n.domElement)==null||Se.ownerDocument.removeEventListener("pointerup",he),n._domElementKeyEvents!==null&&n._domElementKeyEvents.removeEventListener("keydown",ce)};const n=this,i={type:"change"},o={type:"start"},a={type:"end"},s={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let l=s.NONE;const u=1e-6,c=new cc,h=new cc;let p=1;const f=new Re,g=new bt,v=new bt,d=new bt,m=new bt,y=new bt,_=new bt,E=new bt,x=new bt,b=new bt,C=new Re,A=new bt;let M=!1;const I=[],F={};function S(){return 2*Math.PI/60/60*n.autoRotateSpeed}function X(){return Math.pow(.95,n.zoomSpeed)}function w(U){n.reverseOrbit||n.reverseHorizontalOrbit?h.theta+=U:h.theta-=U}function G(U){n.reverseOrbit||n.reverseVerticalOrbit?h.phi+=U:h.phi-=U}const R=(()=>{const U=new Re;return function(q,ve){U.setFromMatrixColumn(ve,0),U.multiplyScalar(-q),f.add(U)}})(),L=(()=>{const U=new Re;return function(q,ve){n.screenSpacePanning===!0?U.setFromMatrixColumn(ve,1):(U.setFromMatrixColumn(ve,0),U.crossVectors(n.object.up,U)),U.multiplyScalar(q),f.add(U)}})(),N=(()=>{const U=new Re;return function(q,ve){const be=n.domElement;if(be&&n.object instanceof Tn&&n.object.isPerspectiveCamera){const Le=n.object.position;U.copy(Le).sub(n.target);let Se=U.length();Se*=Math.tan(n.object.fov/2*Math.PI/180),R(2*q*Se/be.clientHeight,n.object.matrix),L(2*ve*Se/be.clientHeight,n.object.matrix)}else be&&n.object instanceof ur&&n.object.isOrthographicCamera?(R(q*(n.object.right-n.object.left)/n.object.zoom/be.clientWidth,n.object.matrix),L(ve*(n.object.top-n.object.bottom)/n.object.zoom/be.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}})();function $(U){n.object instanceof Tn&&n.object.isPerspectiveCamera||n.object instanceof ur&&n.object.isOrthographicCamera?p/=U:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function P(U){n.object instanceof Tn&&n.object.isPerspectiveCamera||n.object instanceof ur&&n.object.isOrthographicCamera?p*=U:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function D(U){if(!n.zoomToCursor||!n.domElement)return;M=!0;const q=n.domElement.getBoundingClientRect(),ve=U.clientX-q.left,be=U.clientY-q.top,Le=q.width,Se=q.height;A.x=ve/Le*2-1,A.y=-(be/Se)*2+1,C.set(A.x,A.y,1).unproject(n.object).sub(n.object.position).normalize()}function j(U){return Math.max(n.minDistance,Math.min(n.maxDistance,U))}function k(U){g.set(U.clientX,U.clientY)}function ee(U){D(U),E.set(U.clientX,U.clientY)}function Q(U){m.set(U.clientX,U.clientY)}function ue(U){v.set(U.clientX,U.clientY),d.subVectors(v,g).multiplyScalar(n.rotateSpeed);const q=n.domElement;q&&(w(2*Math.PI*d.x/q.clientHeight),G(2*Math.PI*d.y/q.clientHeight)),g.copy(v),n.update()}function de(U){x.set(U.clientX,U.clientY),b.subVectors(x,E),b.y>0?$(X()):b.y<0&&P(X()),E.copy(x),n.update()}function ne(U){y.set(U.clientX,U.clientY),_.subVectors(y,m).multiplyScalar(n.panSpeed),N(_.x,_.y),m.copy(y),n.update()}function O(U){D(U),U.deltaY<0?P(X()):U.deltaY>0&&$(X()),n.update()}function B(U){let q=!1;switch(U.code){case n.keys.UP:N(0,n.keyPanSpeed),q=!0;break;case n.keys.BOTTOM:N(0,-n.keyPanSpeed),q=!0;break;case n.keys.LEFT:N(n.keyPanSpeed,0),q=!0;break;case n.keys.RIGHT:N(-n.keyPanSpeed,0),q=!0;break}q&&(U.preventDefault(),n.update())}function W(){if(I.length==1)g.set(I[0].pageX,I[0].pageY);else{const U=.5*(I[0].pageX+I[1].pageX),q=.5*(I[0].pageY+I[1].pageY);g.set(U,q)}}function oe(){if(I.length==1)m.set(I[0].pageX,I[0].pageY);else{const U=.5*(I[0].pageX+I[1].pageX),q=.5*(I[0].pageY+I[1].pageY);m.set(U,q)}}function ie(){const U=I[0].pageX-I[1].pageX,q=I[0].pageY-I[1].pageY,ve=Math.sqrt(U*U+q*q);E.set(0,ve)}function T(){n.enableZoom&&ie(),n.enablePan&&oe()}function J(){n.enableZoom&&ie(),n.enableRotate&&W()}function H(U){if(I.length==1)v.set(U.pageX,U.pageY);else{const ve=ht(U),be=.5*(U.pageX+ve.x),Le=.5*(U.pageY+ve.y);v.set(be,Le)}d.subVectors(v,g).multiplyScalar(n.rotateSpeed);const q=n.domElement;q&&(w(2*Math.PI*d.x/q.clientHeight),G(2*Math.PI*d.y/q.clientHeight)),g.copy(v)}function z(U){if(I.length==1)y.set(U.pageX,U.pageY);else{const q=ht(U),ve=.5*(U.pageX+q.x),be=.5*(U.pageY+q.y);y.set(ve,be)}_.subVectors(y,m).multiplyScalar(n.panSpeed),N(_.x,_.y),m.copy(y)}function V(U){const q=ht(U),ve=U.pageX-q.x,be=U.pageY-q.y,Le=Math.sqrt(ve*ve+be*be);x.set(0,Le),b.set(0,Math.pow(x.y/E.y,n.zoomSpeed)),$(b.y),E.copy(x)}function Z(U){n.enableZoom&&V(U),n.enablePan&&z(U)}function ae(U){n.enableZoom&&V(U),n.enableRotate&&H(U)}function se(U){var q,ve;n.enabled!==!1&&(I.length===0&&((q=n.domElement)==null||q.ownerDocument.addEventListener("pointermove",te),(ve=n.domElement)==null||ve.ownerDocument.addEventListener("pointerup",he)),Xe(U),U.pointerType==="touch"?me(U):ye(U))}function te(U){n.enabled!==!1&&(U.pointerType==="touch"?xe(U):pe(U))}function he(U){var q,ve,be;tt(U),I.length===0&&((q=n.domElement)==null||q.releasePointerCapture(U.pointerId),(ve=n.domElement)==null||ve.ownerDocument.removeEventListener("pointermove",te),(be=n.domElement)==null||be.ownerDocument.removeEventListener("pointerup",he)),n.dispatchEvent(a),l=s.NONE}function ye(U){let q;switch(U.button){case 0:q=n.mouseButtons.LEFT;break;case 1:q=n.mouseButtons.MIDDLE;break;case 2:q=n.mouseButtons.RIGHT;break;default:q=-1}switch(q){case Cr.DOLLY:if(n.enableZoom===!1)return;ee(U),l=s.DOLLY;break;case Cr.ROTATE:if(U.ctrlKey||U.metaKey||U.shiftKey){if(n.enablePan===!1)return;Q(U),l=s.PAN}else{if(n.enableRotate===!1)return;k(U),l=s.ROTATE}break;case Cr.PAN:if(U.ctrlKey||U.metaKey||U.shiftKey){if(n.enableRotate===!1)return;k(U),l=s.ROTATE}else{if(n.enablePan===!1)return;Q(U),l=s.PAN}break;default:l=s.NONE}l!==s.NONE&&n.dispatchEvent(o)}function pe(U){if(n.enabled!==!1)switch(l){case s.ROTATE:if(n.enableRotate===!1)return;ue(U);break;case s.DOLLY:if(n.enableZoom===!1)return;de(U);break;case s.PAN:if(n.enablePan===!1)return;ne(U);break}}function re(U){n.enabled===!1||n.enableZoom===!1||l!==s.NONE&&l!==s.ROTATE||(U.preventDefault(),n.dispatchEvent(o),O(U),n.dispatchEvent(a))}function ce(U){n.enabled===!1||n.enablePan===!1||B(U)}function me(U){switch(ke(U),I.length){case 1:switch(n.touches.ONE){case Ln.ROTATE:if(n.enableRotate===!1)return;W(),l=s.TOUCH_ROTATE;break;case Ln.PAN:if(n.enablePan===!1)return;oe(),l=s.TOUCH_PAN;break;default:l=s.NONE}break;case 2:switch(n.touches.TWO){case Ln.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;T(),l=s.TOUCH_DOLLY_PAN;break;case Ln.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;J(),l=s.TOUCH_DOLLY_ROTATE;break;default:l=s.NONE}break;default:l=s.NONE}l!==s.NONE&&n.dispatchEvent(o)}function xe(U){switch(ke(U),l){case s.TOUCH_ROTATE:if(n.enableRotate===!1)return;H(U),n.update();break;case s.TOUCH_PAN:if(n.enablePan===!1)return;z(U),n.update();break;case s.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Z(U),n.update();break;case s.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;ae(U),n.update();break;default:l=s.NONE}}function Ce(U){n.enabled!==!1&&U.preventDefault()}function Xe(U){I.push(U)}function tt(U){delete F[U.pointerId];for(let q=0;qe in r?xw(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ku=(r,e,t)=>(bw(r,typeof e!="symbol"?e+"":e,t),t);class kp{constructor(e){ku(this,"data"),this.data=e}generateShapes(e,t=100,n){const i=[],o={letterSpacing:0,lineHeight:1,...n},a=ww(e,t,this.data,o);for(let s=0,l=a.length;s[0,0,0]},enableDamping:{type:Boolean,default:!0},dampingFactor:{default:.05},autoRotate:{type:Boolean,default:!1},autoRotateSpeed:{default:2},enablePan:{type:Boolean,default:!0},keyPanSpeed:{default:7},keys:{},maxAzimuthAngle:{default:Number.POSITIVE_INFINITY},minAzimuthAngle:{default:Number.NEGATIVE_INFINITY},maxPolarAngle:{default:Math.PI},minPolarAngle:{default:0},minDistance:{default:0},maxDistance:{default:Number.POSITIVE_INFINITY},minZoom:{default:0},maxZoom:{default:Number.POSITIVE_INFINITY},touches:{default:()=>({ONE:Ln.ROTATE,TWO:Ln.DOLLY_PAN})},enableZoom:{type:Boolean,default:!0},zoomSpeed:{default:1},enableRotate:{type:Boolean,default:!0},rotateSpeed:{default:1}},emits:["change","start","end"],setup(r,{expose:e,emit:t}){const n=r,i=t,{makeDefault:o,autoRotate:a,autoRotateSpeed:s,enableDamping:l,dampingFactor:u,enablePan:c,keyPanSpeed:h,maxAzimuthAngle:p,minAzimuthAngle:f,maxPolarAngle:g,minPolarAngle:v,minDistance:d,maxDistance:m,minZoom:y,maxZoom:_,enableZoom:E,zoomSpeed:x,enableRotate:b,touches:C,rotateSpeed:A,target:M}=Kr(n),{camera:I,renderer:F,extend:S,controls:X,invalidate:w}=Si(),G=le(null);S({OrbitControls:_w}),Ge(G,N=>{R(),N&&o.value?X.value=N:X.value=null});function R(){ms(G.value,"change",()=>{i("change",G.value),w()}),ms(G.value,"start",()=>i("start",G.value)),ms(G.value,"end",()=>i("end",G.value))}const{onBeforeRender:L}=ru();return L(({invalidate:N})=>{G.value&&(l.value||a.value)&&(G.value.update(),a.value&&N())}),Gt(()=>{G.value&&G.value.dispose()}),e({instance:G}),(N,$)=>(N.camera||K(I))&&(N.domElement||K(F))?(fe(),_e("TresOrbitControls",{key:0,ref_key:"controlsRef",ref:G,target:K(M),"auto-rotate":K(a),"auto-rotate-speed":K(s),"enable-damping":K(l),"damping-factor":K(u),"enable-pan":K(c),"key-pan-speed":K(h),keys:N.keys,"max-azimuth-angle":K(p),"min-azimuth-angle":K(f),"max-polar-angle":K(g),"min-polar-angle":K(v),"min-distance":K(d),"max-distance":K(m),"min-zoom":K(y),"max-zoom":K(_),touches:K(C),"enable-zoom":K(E),"zoom-speed":K(x),"enable-rotate":K(b),"rotate-speed":K(A),args:[N.camera||K(I),N.domElement||K(F).domElement]},null,8,Ew)):nt("",!0)}});new Sn;var Aw=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ro(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Iw={exports:{}};(function(r,e){(function(t){r.exports=t()})(function(){return function t(n,i,o){function a(u,c){if(!i[u]){if(!n[u]){var h=typeof ro=="function"&&ro;if(!c&&h)return h(u,!0);if(s)return s(u,!0);throw new Error("Cannot find module '"+u+"'")}c=i[u]={exports:{}},n[u][0].call(c.exports,function(p){var f=n[u][1][p];return a(f||p)},c,c.exports,t,n,i,o)}return i[u].exports}for(var s=typeof ro=="function"&&ro,l=0;l>16),G((65280&I)>>8),G(255&I);return F==2?G(255&(I=C(A.charAt(M))<<2|C(A.charAt(M+1))>>4)):F==1&&(G((I=C(A.charAt(M))<<10|C(A.charAt(M+1))<<4|C(A.charAt(M+2))>>2)>>8&255),G(255&I)),S},g.fromByteArray=function(A){var M,I,F,S,X=A.length%3,w="";function G(R){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(R)}for(M=0,F=A.length-X;M>18&63)+G(S>>12&63)+G(S>>6&63)+G(63&S);switch(X){case 1:w=(w+=G((I=A[A.length-1])>>2))+G(I<<4&63)+"==";break;case 2:w=(w=(w+=G((I=(A[A.length-2]<<8)+A[A.length-1])>>10))+G(I>>4&63))+G(I<<2&63)+"="}return w}})(i===void 0?this.base64js={}:i)}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js","/node_modules/gulp-browserify/node_modules/base64-js/lib")},{buffer:3,lYpoI2:11}],3:[function(t,n,i){(function(o,a,d,l,u,c,h,p,f){var g=t("base64-js"),v=t("ieee754");function d(O,B,W){if(!(this instanceof d))return new d(O,B,W);var oe,ie,T,J,H=typeof O;if(B==="base64"&&H=="string")for(O=(J=O).trim?J.trim():J.replace(/^\s+|\s+$/g,"");O.length%4!=0;)O+="=";if(H=="number")oe=N(O);else if(H=="string")oe=d.byteLength(O,B);else{if(H!="object")throw new Error("First argument needs to be a number, array or string.");oe=N(O.length)}if(d._useTypedArrays?ie=d._augment(new Uint8Array(oe)):((ie=this).length=oe,ie._isBuffer=!0),d._useTypedArrays&&typeof O.byteLength=="number")ie._set(O);else if($(J=O)||d.isBuffer(J)||J&&typeof J=="object"&&typeof J.length=="number")for(T=0;T>8,J=J%256,H.push(J),H.push(T);return H}(B),O,W,oe)}function _(O,B,W){var oe="";W=Math.min(O.length,W);for(var ie=B;ie>>0)):(B+1>>0),ie}function b(O,B,W,oe){if(oe||(ne(typeof W=="boolean","missing or invalid endian"),ne(B!=null,"missing offset"),ne(B+1>>8*(oe?T:1-T)}function F(O,B,W,oe,ie){if(ie||(ne(B!=null,"missing value"),ne(typeof oe=="boolean","missing or invalid endian"),ne(W!=null,"missing offset"),ne(W+3>>8*(oe?T:3-T)&255}function S(O,B,W,oe,ie){ie||(ne(B!=null,"missing value"),ne(typeof oe=="boolean","missing or invalid endian"),ne(W!=null,"missing offset"),ne(W+1this.length&&(oe=this.length);var ie=(oe=O.length-B=this.length))return this[O]},d.prototype.readUInt16LE=function(O,B){return E(this,O,!0,B)},d.prototype.readUInt16BE=function(O,B){return E(this,O,!1,B)},d.prototype.readUInt32LE=function(O,B){return x(this,O,!0,B)},d.prototype.readUInt32BE=function(O,B){return x(this,O,!1,B)},d.prototype.readInt8=function(O,B){if(B||(ne(O!=null,"missing offset"),ne(O=this.length))return 128&this[O]?-1*(255-this[O]+1):this[O]},d.prototype.readInt16LE=function(O,B){return b(this,O,!0,B)},d.prototype.readInt16BE=function(O,B){return b(this,O,!1,B)},d.prototype.readInt32LE=function(O,B){return C(this,O,!0,B)},d.prototype.readInt32BE=function(O,B){return C(this,O,!1,B)},d.prototype.readFloatLE=function(O,B){return A(this,O,!0,B)},d.prototype.readFloatBE=function(O,B){return A(this,O,!1,B)},d.prototype.readDoubleLE=function(O,B){return M(this,O,!0,B)},d.prototype.readDoubleBE=function(O,B){return M(this,O,!1,B)},d.prototype.writeUInt8=function(O,B,W){W||(ne(O!=null,"missing value"),ne(B!=null,"missing offset"),ne(B=this.length||(this[B]=O)},d.prototype.writeUInt16LE=function(O,B,W){I(this,O,B,!0,W)},d.prototype.writeUInt16BE=function(O,B,W){I(this,O,B,!1,W)},d.prototype.writeUInt32LE=function(O,B,W){F(this,O,B,!0,W)},d.prototype.writeUInt32BE=function(O,B,W){F(this,O,B,!1,W)},d.prototype.writeInt8=function(O,B,W){W||(ne(O!=null,"missing value"),ne(B!=null,"missing offset"),ne(B=this.length||(0<=O?this.writeUInt8(O,B,W):this.writeUInt8(255+O+1,B,W))},d.prototype.writeInt16LE=function(O,B,W){S(this,O,B,!0,W)},d.prototype.writeInt16BE=function(O,B,W){S(this,O,B,!1,W)},d.prototype.writeInt32LE=function(O,B,W){X(this,O,B,!0,W)},d.prototype.writeInt32BE=function(O,B,W){X(this,O,B,!1,W)},d.prototype.writeFloatLE=function(O,B,W){w(this,O,B,!0,W)},d.prototype.writeFloatBE=function(O,B,W){w(this,O,B,!1,W)},d.prototype.writeDoubleLE=function(O,B,W){G(this,O,B,!0,W)},d.prototype.writeDoubleBE=function(O,B,W){G(this,O,B,!1,W)},d.prototype.fill=function(O,B,W){if(B=B||0,W=W||this.length,ne(typeof(O=typeof(O=O||0)=="string"?O.charCodeAt(0):O)=="number"&&!isNaN(O),"value is not a number"),ne(B<=W,"end < start"),W!==B&&this.length!==0){ne(0<=B&&B"},d.prototype.toArrayBuffer=function(){if(typeof Uint8Array>"u")throw new Error("Buffer.toArrayBuffer not supported in this browser");if(d._useTypedArrays)return new d(this).buffer;for(var O=new Uint8Array(this.length),B=0,W=O.length;B=B.length||ie>=O.length);ie++)B[ie+W]=O[ie];return ie}function ee(O){try{return decodeURIComponent(O)}catch{return"�"}}function Q(O,B){ne(typeof O=="number","cannot write a non-number as a number"),ne(0<=O,"specified a negative value for writing an unsigned value"),ne(O<=B,"value is larger than maximum value for type"),ne(Math.floor(O)===O,"value has a fractional component")}function ue(O,B,W){ne(typeof O=="number","cannot write a non-number as a number"),ne(O<=B,"value larger than maximum allowed value"),ne(W<=O,"value smaller than minimum allowed value"),ne(Math.floor(O)===O,"value has a fractional component")}function de(O,B,W){ne(typeof O=="number","cannot write a non-number as a number"),ne(O<=B,"value larger than maximum allowed value"),ne(W<=O,"value smaller than minimum allowed value")}function ne(O,B){if(!O)throw new Error(B||"Failed assertion")}d._augment=function(O){return O._isBuffer=!0,O._get=O.get,O._set=O.set,O.get=R.get,O.set=R.set,O.write=R.write,O.toString=R.toString,O.toLocaleString=R.toString,O.toJSON=R.toJSON,O.copy=R.copy,O.slice=R.slice,O.readUInt8=R.readUInt8,O.readUInt16LE=R.readUInt16LE,O.readUInt16BE=R.readUInt16BE,O.readUInt32LE=R.readUInt32LE,O.readUInt32BE=R.readUInt32BE,O.readInt8=R.readInt8,O.readInt16LE=R.readInt16LE,O.readInt16BE=R.readInt16BE,O.readInt32LE=R.readInt32LE,O.readInt32BE=R.readInt32BE,O.readFloatLE=R.readFloatLE,O.readFloatBE=R.readFloatBE,O.readDoubleLE=R.readDoubleLE,O.readDoubleBE=R.readDoubleBE,O.writeUInt8=R.writeUInt8,O.writeUInt16LE=R.writeUInt16LE,O.writeUInt16BE=R.writeUInt16BE,O.writeUInt32LE=R.writeUInt32LE,O.writeUInt32BE=R.writeUInt32BE,O.writeInt8=R.writeInt8,O.writeInt16LE=R.writeInt16LE,O.writeInt16BE=R.writeInt16BE,O.writeInt32LE=R.writeInt32LE,O.writeInt32BE=R.writeInt32BE,O.writeFloatLE=R.writeFloatLE,O.writeFloatBE=R.writeFloatBE,O.writeDoubleLE=R.writeDoubleLE,O.writeDoubleBE=R.writeDoubleBE,O.fill=R.fill,O.inspect=R.inspect,O.toArrayBuffer=R.toArrayBuffer,O}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/buffer/index.js","/node_modules/gulp-browserify/node_modules/buffer")},{"base64-js":2,buffer:3,ieee754:10,lYpoI2:11}],4:[function(t,n,i){(function(o,a,g,l,u,c,h,p,f){var g=t("buffer").Buffer,v=4,d=new g(v);d.fill(0),n.exports={hash:function(m,y,_,E){for(var x=y(function(I,F){I.length%v!=0&&(S=I.length+(v-I.length%v),I=g.concat([I,d],S));for(var S,X=[],w=F?I.readInt32BE:I.readInt32LE,G=0;G_?L=R(L):L.length<_&&(L=g.concat([L,E],_));for(var $=new g(_),P=new g(_),D=0;D<_;D++)$[D]=54^L[D],P[D]=92^L[D];return N=R(g.concat([$,N])),R(g.concat([P,N]))}(S,F,G):S(G);return X=null,w?G.toString(w):G}}}function b(){var I=[].slice.call(arguments).join(" ");throw new Error([I,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join(` +`))}E.fill(0),i.createHash=function(I){return x(I)},i.createHmac=x,i.randomBytes=function(I,F){if(!F||!F.call)return new g(m(I));try{F.call(this,void 0,new g(m(I)))}catch(S){F(S)}};var C,A=["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],M=function(I){i[I]=function(){b("sorry,",I,"is not implemented yet")}};for(C in A)M(A[C])}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/index.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./md5":6,"./rng":7,"./sha":8,"./sha256":9,buffer:3,lYpoI2:11}],6:[function(t,n,i){(function(o,a,s,l,u,c,h,p,f){var g=t("./helpers");function v(b,C){b[C>>5]|=128<>>9<<4)]=C;for(var A=1732584193,M=-271733879,I=-1732584194,F=271733878,S=0;S>>32-I,A)}function m(b,C,A,M,I,F,S){return d(C&A|~C&M,b,C,I,F,S)}function y(b,C,A,M,I,F,S){return d(C&M|A&~M,b,C,I,F,S)}function _(b,C,A,M,I,F,S){return d(C^A^M,b,C,I,F,S)}function E(b,C,A,M,I,F,S){return d(A^(C|~M),b,C,I,F,S)}function x(b,C){var A=(65535&b)+(65535&C);return(b>>16)+(C>>16)+(A>>16)<<16|65535&A}n.exports=function(b){return g.hash(b,v,16)}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],7:[function(t,n,i){(function(o,a,s,l,u,c,h,p,f){n.exports=function(g){for(var v,d=new Array(g),m=0;m>>((3&m)<<3)&255;return d}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],8:[function(t,n,i){(function(o,a,s,l,u,c,h,p,f){var g=t("./helpers");function v(y,_){y[_>>5]|=128<<24-_%32,y[15+(_+64>>9<<4)]=_;for(var E,x,b,C=Array(80),A=1732584193,M=-271733879,I=-1732584194,F=271733878,S=-1009589776,X=0;X>16)+(_>>16)+(E>>16)<<16|65535&E}function m(y,_){return y<<_|y>>>32-_}n.exports=function(y){return g.hash(y,v,20,!0)}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],9:[function(t,n,i){(function(o,a,s,l,u,c,h,p,f){function g(_,E){var x=(65535&_)+(65535&E);return(_>>16)+(E>>16)+(x>>16)<<16|65535&x}function v(_,E){var x,b=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),C=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),A=new Array(64);_[E>>5]|=128<<24-E%32,_[15+(E+64>>9<<4)]=E;for(var M,I,F=0;F<_.length;F+=16){for(var S=C[0],X=C[1],w=C[2],G=C[3],R=C[4],L=C[5],N=C[6],$=C[7],P=0;P<64;P++)A[P]=P<16?_[P+F]:g(g(g((I=A[P-2],m(I,17)^m(I,19)^y(I,10)),A[P-7]),(I=A[P-15],m(I,7)^m(I,18)^y(I,3))),A[P-16]),x=g(g(g(g($,m(I=R,6)^m(I,11)^m(I,25)),R&L^~R&N),b[P]),A[P]),M=g(m(M=S,2)^m(M,13)^m(M,22),S&X^S&w^X&w),$=N,N=L,L=R,R=g(G,x),G=w,w=X,X=S,S=g(x,M);C[0]=g(S,C[0]),C[1]=g(X,C[1]),C[2]=g(w,C[2]),C[3]=g(G,C[3]),C[4]=g(R,C[4]),C[5]=g(L,C[5]),C[6]=g(N,C[6]),C[7]=g($,C[7])}return C}var d=t("./helpers"),m=function(_,E){return _>>>E|_<<32-E},y=function(_,E){return _>>>E};n.exports=function(_){return d.hash(_,v,32,!0)}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha256.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],10:[function(t,n,i){(function(o,a,s,l,u,c,h,p,f){i.read=function(g,v,d,m,F){var _,E,x=8*F-m-1,b=(1<>1,A=-7,M=d?F-1:0,I=d?-1:1,F=g[v+M];for(M+=I,_=F&(1<<-A)-1,F>>=-A,A+=x;0>=-A,A+=m;0>1,M=y===23?Math.pow(2,-24)-Math.pow(2,-77):0,I=m?0:S-1,F=m?1:-1,S=v<0||v===0&&1/v<0?1:0;for(v=Math.abs(v),isNaN(v)||v===1/0?(x=isNaN(v)?1:0,E=C):(E=Math.floor(Math.log(v)/Math.LN2),v*(m=Math.pow(2,-E))<1&&(E--,m*=2),2<=(v+=1<=E+A?M/m:M*Math.pow(2,1-A))*m&&(E++,m/=2),C<=E+A?(x=0,E=C):1<=E+A?(x=(v*m-1)*Math.pow(2,y),E+=A):(x=v*Math.pow(2,A-1)*Math.pow(2,y),E=0));8<=y;g[d+I]=255&x,I+=F,x/=256,y-=8);for(E=E<":` + vec3 objectNormal = `.concat(Pe.normal,`; + #ifdef USE_TANGENT + vec3 objectTangent = vec3( tangent.xyz ); + #endif + `)}),qe(Pt,"".concat(Pe.position),{"#include ":` + vec3 transformed = `.concat(Pe.position,`; + `)}),qe(Pt,"".concat(Pe.positionRaw),{"#include ":` + vec4 csm_internal_positionUnprojected = `.concat(Pe.positionRaw,`; + mat4x4 csm_internal_unprojectMatrix = projectionMatrix * modelViewMatrix; + #ifdef USE_INSTANCING + csm_internal_unprojectMatrix = csm_internal_unprojectMatrix * instanceMatrix; + #endif + csm_internal_positionUnprojected = inverse(csm_internal_unprojectMatrix) * csm_internal_positionUnprojected; + vec3 transformed = csm_internal_positionUnprojected.xyz; + `)}),qe(Pt,"".concat(Pe.pointSize),{"gl_PointSize = size;":` + gl_PointSize = `.concat(Pe.pointSize,`; + `)}),qe(Pt,"".concat(Pe.diffuseColor),{"#include ":` + #include + diffuseColor = `.concat(Pe.diffuseColor,`; + `)}),qe(Pt,"".concat(Pe.fragColor),{"#include ":` + #include + gl_FragColor = `.concat(Pe.fragColor,`; + `)}),qe(Pt,"".concat(Pe.emissive),{"vec3 totalEmissiveRadiance = emissive;":` + vec3 totalEmissiveRadiance = `.concat(Pe.emissive,`; + `)}),qe(Pt,"".concat(Pe.roughness),{"#include ":` + #include + roughnessFactor = `.concat(Pe.roughness,`; + `)}),qe(Pt,"".concat(Pe.metalness),{"#include ":` + #include + metalnessFactor = `.concat(Pe.metalness,`; + `)}),qe(Pt,"".concat(Pe.ao),{"#include ":` + #include + reflectedLight.indirectDiffuse *= 1. - `.concat(Pe.ao,`; + `)}),qe(Pt,"".concat(Pe.bump),{"#include ":` + #include + + vec3 csm_internal_orthogonal = `.concat(Pe.bump," - (dot(").concat(Pe.bump,`, normal) * normal); + vec3 csm_internal_projectedbump = mat3(csm_internal_vModelViewMatrix) * csm_internal_orthogonal; + normal = normalize(normal - csm_internal_projectedbump); + `)}),qe(Pt,"".concat(Pe.depthAlpha),{"gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );":` + gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity * `.concat(Pe.depthAlpha,` ); + `),"gl_FragColor = packDepthToRGBA( fragCoordZ );":` + gl_FragColor = packDepthToRGBA( fragCoordZ ); + gl_FragColor.a *= `.concat(Pe.depthAlpha,`; + `)});kr={},qe(kr,"".concat(Pe.position),{"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );":` + gl_Position = projectionMatrix * modelViewMatrix * vec4( `.concat(Pe.position,`, 1.0 ); + `)}),qe(kr,"".concat(Pe.positionRaw),{"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );":` + gl_Position = `.concat(Pe.position,`; + `)}),qe(kr,"".concat(Pe.diffuseColor),{"gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );":` + gl_FragColor = `.concat(Pe.diffuseColor,`; + `)}),qe(kr,"".concat(Pe.fragColor),{"gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );":` + gl_FragColor = `.concat(Pe.fragColor,`; + `)});var Mt;Mt={},qe(Mt,"".concat(Pe.position),"*"),qe(Mt,"".concat(Pe.positionRaw),"*"),qe(Mt,"".concat(Pe.normal),"*"),qe(Mt,"".concat(Pe.pointSize),["PointsMaterial"]),qe(Mt,"".concat(Pe.diffuseColor),"*"),qe(Mt,"".concat(Pe.fragColor),"*"),qe(Mt,"".concat(Pe.emissive),["MeshStandardMaterial","MeshPhysicalMaterial"]),qe(Mt,"".concat(Pe.roughness),["MeshStandardMaterial","MeshPhysicalMaterial"]),qe(Mt,"".concat(Pe.metalness),["MeshStandardMaterial","MeshPhysicalMaterial"]),qe(Mt,"".concat(Pe.ao),["MeshStandardMaterial","MeshPhysicalMaterial","MeshBasicMaterial","MeshLambertMaterial","MeshPhongMaterial","MeshToonMaterial"]),qe(Mt,"".concat(Pe.bump),["MeshLambertMaterial","MeshMatcapMaterial","MeshNormalMaterial","MeshPhongMaterial","MeshPhysicalMaterial","MeshStandardMaterial","MeshToonMaterial","ShadowMaterial"]),qe(Mt,"".concat(Pe.depthAlpha),"*");var Ow=`void main() { + gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); +}`,Rw=`#include + +void main() { + vec2 center = vec2(0., 1.); + float rotation = 0.0; + + + + float size = 0.03; + + vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); + vec2 scale; + scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); + scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); + + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) scale *= - mvPosition.z; + + vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale * size; + vec2 rotatedPosition; + rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; + rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; + mvPosition.xy += rotatedPosition; + + gl_Position = projectionMatrix * mvPosition; +}`;const Ni=new Re(0,0,0),Ou=new Re(0,0,0),Fw=new Re(0,0,0);function nf(r,e,t){const n=Ni.setFromMatrixPosition(r.matrixWorld);n.project(e);const i=t.width/2,o=t.height/2;return[(Number.isNaN(n.x)?0:n.x)*i+i,-(n.y*o)+o]}function Lw(r,e){const t=Ni.setFromMatrixPosition(r.matrixWorld),n=Ou.setFromMatrixPosition(e.matrixWorld),i=t.sub(n),o=e.getWorldDirection(Fw);return i.angleTo(o)>Math.PI/2}function Nw(r,e,t,n){const i=Ni.setFromMatrixPosition(r.matrixWorld),o=i.clone();o.project(e),t.setFromCamera(new bt(o.x,o.y),e);const a=t.intersectObjects(n,!0);if(a.length>0){const s=a[0].distance;return i.distanceTo(t.ray.origin)Math.abs(r)<1e-10?0:r;function Op(r,e,t=""){let n="matrix3d(";for(let i=0;i!==16;i++)n+=zl(e[i]*r.elements[i])+(i!==15?",":")");return t+n}const Uw=(r=>e=>Op(e,r))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),zw=(r=>(e,t)=>Op(e,r(t),"translate(-50%,-50%)"))(r=>[1/r,1/r,1/r,1,-1/r,-1/r,-1/r,-1,1/r,1/r,1/r,1,1,1,1,1]),jw=["geometry","material"];new ld;var Vw={exports:{}};(function(r,e){(function(t,n){r.exports=n()})(Aw,function(){var t=function(){function n(f){return a.appendChild(f.dom),f}function i(f){for(var g=0;gl+1e3&&(c.update(1e3*u/(f-l),100),l=f,u=0,p)){var g=performance.memory;p.update(g.usedJSHeapSize/1048576,g.jsHeapSizeLimit/1048576)}return f},update:function(){s=this.end()},domElement:a,setMode:i}};return t.Panel=function(n,i,o){var a=1/0,s=0,l=Math.round,u=l(window.devicePixelRatio||1),c=80*u,h=48*u,p=3*u,f=2*u,g=3*u,v=15*u,d=74*u,m=30*u,y=document.createElement("canvas");y.width=c,y.height=h,y.style.cssText="width:80px;height:48px";var _=y.getContext("2d");return _.font="bold "+9*u+"px Helvetica,Arial,sans-serif",_.textBaseline="top",_.fillStyle=o,_.fillRect(0,0,c,h),_.fillStyle=i,_.fillText(n,p,f),_.fillRect(g,v,d,m),_.fillStyle=o,_.globalAlpha=.9,_.fillRect(g,v,d,m),{dom:y,update:function(E,x){a=Math.min(a,E),s=Math.max(s,E),_.fillStyle=o,_.globalAlpha=1,_.fillRect(0,0,c,v),_.fillStyle=i,_.fillText(l(E)+" "+n+" ("+l(a)+"-"+l(s)+")",p,f),_.drawImage(y,g+u,v,d-u,m,g,v,d-u,m),_.fillRect(g+d-u,v,u,m),_.fillStyle=o,_.globalAlpha=.9,_.fillRect(g+d-u,v,u,l((1-E/x)*m))}}},t})})(Vw);new ou;new Re;yo.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new bt(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};Zm.line={uniforms:nu.merge([yo.common,yo.fog,yo.line]),vertexShader:` + #include + #include + #include + #include + #include + + uniform float linewidth; + uniform vec2 resolution; + + attribute vec3 instanceStart; + attribute vec3 instanceEnd; + + attribute vec3 instanceColorStart; + attribute vec3 instanceColorEnd; + + #ifdef WORLD_UNITS + + varying vec4 worldPos; + varying vec3 worldStart; + varying vec3 worldEnd; + + #ifdef USE_DASH + + varying vec2 vUv; + + #endif + + #else + + varying vec2 vUv; + + #endif + + #ifdef USE_DASH + + uniform float dashScale; + attribute float instanceDistanceStart; + attribute float instanceDistanceEnd; + varying float vLineDistance; + + #endif + + void trimSegment( const in vec4 start, inout vec4 end ) { + + // trim end segment so it terminates between the camera plane and the near plane + + // conservative estimate of the near plane + float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column + float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column + float nearEstimate = - 0.5 * b / a; + + float alpha = ( nearEstimate - start.z ) / ( end.z - start.z ); + + end.xyz = mix( start.xyz, end.xyz, alpha ); + + } + + void main() { + + #ifdef USE_COLOR + + vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd; + + #endif + + #ifdef USE_DASH + + vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd; + vUv = uv; + + #endif + + float aspect = resolution.x / resolution.y; + + // camera space + vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 ); + vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 ); + + #ifdef WORLD_UNITS + + worldStart = start.xyz; + worldEnd = end.xyz; + + #else + + vUv = uv; + + #endif + + // special case for perspective projection, and segments that terminate either in, or behind, the camera plane + // clearly the gpu firmware has a way of addressing this issue when projecting into ndc space + // but we need to perform ndc-space calculations in the shader, so we must address this issue directly + // perhaps there is a more elegant solution -- WestLangley + + bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column + + if ( perspective ) { + + if ( start.z < 0.0 && end.z >= 0.0 ) { + + trimSegment( start, end ); + + } else if ( end.z < 0.0 && start.z >= 0.0 ) { + + trimSegment( end, start ); + + } + + } + + // clip space + vec4 clipStart = projectionMatrix * start; + vec4 clipEnd = projectionMatrix * end; + + // ndc space + vec3 ndcStart = clipStart.xyz / clipStart.w; + vec3 ndcEnd = clipEnd.xyz / clipEnd.w; + + // direction + vec2 dir = ndcEnd.xy - ndcStart.xy; + + // account for clip-space aspect ratio + dir.x *= aspect; + dir = normalize( dir ); + + #ifdef WORLD_UNITS + + vec3 worldDir = normalize( end.xyz - start.xyz ); + vec3 tmpFwd = normalize( mix( start.xyz, end.xyz, 0.5 ) ); + vec3 worldUp = normalize( cross( worldDir, tmpFwd ) ); + vec3 worldFwd = cross( worldDir, worldUp ); + worldPos = position.y < 0.5 ? start: end; + + // height offset + float hw = linewidth * 0.5; + worldPos.xyz += position.x < 0.0 ? hw * worldUp : - hw * worldUp; + + // don't extend the line if we're rendering dashes because we + // won't be rendering the endcaps + #ifndef USE_DASH + + // cap extension + worldPos.xyz += position.y < 0.5 ? - hw * worldDir : hw * worldDir; + + // add width to the box + worldPos.xyz += worldFwd * hw; + + // endcaps + if ( position.y > 1.0 || position.y < 0.0 ) { + + worldPos.xyz -= worldFwd * 2.0 * hw; + + } + + #endif + + // project the worldpos + vec4 clip = projectionMatrix * worldPos; + + // shift the depth of the projected points so the line + // segments overlap neatly + vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd; + clip.z = clipPose.z * clip.w; + + #else + + vec2 offset = vec2( dir.y, - dir.x ); + // undo aspect ratio adjustment + dir.x /= aspect; + offset.x /= aspect; + + // sign flip + if ( position.x < 0.0 ) offset *= - 1.0; + + // endcaps + if ( position.y < 0.0 ) { + + offset += - dir; + + } else if ( position.y > 1.0 ) { + + offset += dir; + + } + + // adjust for linewidth + offset *= linewidth; + + // adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ... + offset /= resolution.y; + + // select end + vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd; + + // back to clip space + offset *= clip.w; + + clip.xy += offset; + + #endif + + gl_Position = clip; + + vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation + + #include + #include + #include + + } + `,fragmentShader:` + uniform vec3 diffuse; + uniform float opacity; + uniform float linewidth; + + #ifdef USE_DASH + + uniform float dashOffset; + uniform float dashSize; + uniform float gapSize; + + #endif + + varying float vLineDistance; + + #ifdef WORLD_UNITS + + varying vec4 worldPos; + varying vec3 worldStart; + varying vec3 worldEnd; + + #ifdef USE_DASH + + varying vec2 vUv; + + #endif + + #else + + varying vec2 vUv; + + #endif + + #include + #include + #include + #include + #include + + vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) { + + float mua; + float mub; + + vec3 p13 = p1 - p3; + vec3 p43 = p4 - p3; + + vec3 p21 = p2 - p1; + + float d1343 = dot( p13, p43 ); + float d4321 = dot( p43, p21 ); + float d1321 = dot( p13, p21 ); + float d4343 = dot( p43, p43 ); + float d2121 = dot( p21, p21 ); + + float denom = d2121 * d4343 - d4321 * d4321; + + float numer = d1343 * d4321 - d1321 * d4343; + + mua = numer / denom; + mua = clamp( mua, 0.0, 1.0 ); + mub = ( d1343 + d4321 * ( mua ) ) / d4343; + mub = clamp( mub, 0.0, 1.0 ); + + return vec2( mua, mub ); + + } + + void main() { + + #include + + #ifdef USE_DASH + + if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps + + if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX + + #endif + + float alpha = opacity; + + #ifdef WORLD_UNITS + + // Find the closest points on the view ray and the line segment + vec3 rayEnd = normalize( worldPos.xyz ) * 1e5; + vec3 lineDir = worldEnd - worldStart; + vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd ); + + vec3 p1 = worldStart + lineDir * params.x; + vec3 p2 = rayEnd * params.y; + vec3 delta = p1 - p2; + float len = length( delta ); + float norm = len / linewidth; + + #ifndef USE_DASH + + #ifdef USE_ALPHA_TO_COVERAGE + + float dnorm = fwidth( norm ); + alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm ); + + #else + + if ( norm > 0.5 ) { + + discard; + + } + + #endif + + #endif + + #else + + #ifdef USE_ALPHA_TO_COVERAGE + + // artifacts appear on some hardware if a derivative is taken within a conditional + float a = vUv.x; + float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0; + float len2 = a * a + b * b; + float dlen = fwidth( len2 ); + + if ( abs( vUv.y ) > 1.0 ) { + + alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 ); + + } + + #else + + if ( abs( vUv.y ) > 1.0 ) { + + float a = vUv.x; + float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0; + float len2 = a * a + b * b; + + if ( len2 > 1.0 ) discard; + + } + + #endif + + #endif + + vec4 diffuseColor = vec4( diffuse, alpha ); + + #include + #include + + gl_FragColor = vec4( diffuseColor.rgb, alpha ); + + #include + #include + #include + #include + + } + `};new Bn;new Re;new Re;new Bn;new Bn;new Bn;new Re;new Sn;new Jm;new Re;new ou;new cd;new Bn;const Gw={key:0,args:[0,1,64]},$w={key:1,args:[.5,1,64]},Hw={key:2},Xw=["tone-mapped","map","side","color"];new Vt(16777215);const yn="0px",Rp=Ne({__name:"TransitionVertical",props:{duration:{default:250},easingEnter:{default:"ease-in-out"},easingLeave:{default:"ease-in-out"},opacityClosed:{default:0},opacityOpened:{default:1}},setup(r){const e=r;function t(l){return{height:l.style.height,width:l.style.width,position:l.style.position,visibility:l.style.visibility,overflow:l.style.overflow,paddingTop:l.style.paddingTop,paddingBottom:l.style.paddingBottom,borderTopWidth:l.style.borderTopWidth,borderBottomWidth:l.style.borderBottomWidth,marginTop:l.style.marginTop,marginBottom:l.style.marginBottom}}function n(l,u){const{width:c}=getComputedStyle(l);l.style.width=c,l.style.position="absolute",l.style.visibility="hidden",l.style.height="";const{height:h}=getComputedStyle(l);return l.style.width=u.width,l.style.position=u.position,l.style.visibility=u.visibility,l.style.height=yn,l.style.overflow="hidden",u.height&&u.height!==yn?u.height:h}function i(l,u,c,h,p){const f=l.animate(h,p);l.style.height=u.height,f.onfinish=()=>{l.style.overflow=u.overflow,c()}}function o(l,u){return[{height:yn,opacity:e.opacityClosed,paddingTop:yn,paddingBottom:yn,borderTopWidth:yn,borderBottomWidth:yn,marginTop:yn,marginBottom:yn},{height:l,opacity:e.opacityOpened,paddingTop:u.paddingTop,paddingBottom:u.paddingBottom,borderTopWidth:u.borderTopWidth,borderBottomWidth:u.borderBottomWidth,marginTop:u.marginTop,marginBottom:u.marginBottom}]}function a(l,u){const c=l,h=t(c),p=n(c,h),f=o(p,h),g={duration:e.duration,easing:e.easingEnter};i(c,h,u,f,g)}function s(l,u){const c=l,h=t(c),{height:p}=getComputedStyle(c);c.style.height=p,c.style.overflow="hidden";const f=o(p,h).reverse(),g={duration:e.duration,easing:e.easingLeave};i(c,h,u,f,g)}return(l,u)=>(fe(),lt(Ko,{css:!1,onEnter:a,onLeave:s},{default:Be(()=>[ut(l.$slots,"default")]),_:3}))}}),Ww={flex:"~ col",border:"~ gray/25 rounded-lg",divide:"y dashed gray/25","of-clip":"","shadow-sm":""},qw={op50:""},Yw={key:0,"w-full":""},rf=Ne({__name:"Collapsable",props:hg({default:{type:Boolean},label:null},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const e=r,t=fg(r,"modelValue");return hn(()=>{e.default!=null&&(t.value=!!e.default)}),(n,i)=>(fe(),_e("div",Ww,[Y("button",{sticky:"","top-0":"","z-10":"",flex:"","items-center":"","justify-between":"",px2:"",py1:"","text-sm":"","backdrop-blur-xl":"",onClick:i[0]||(i[0]=o=>t.value=!t.value)},[Y("span",null,[ut(n.$slots,"label",{},()=>[hc(Ue(e.label??"Collapsable"),1)])]),i[1]||(i[1]=hc()),Y("span",qw,Ue(t.value?"▲":"▼"),1)]),Oe(Rp,null,{default:Be(()=>[t.value?(fe(),_e("div",Yw,[ut(n.$slots,"default")])):nt("",!0)]),_:3})]))}}),Or=Ne({__name:"Range",props:{modelValue:null,min:{default:0},max:{default:100},step:{default:1},disabled:{type:Boolean,default:!1}},emits:["update:modelValue","mousedown"],setup(r,{emit:e}){const t=r,n=e,i=le(null);function o(g,v,d){return Math.min(Math.max(g,v),d)}function a(g){const v=g.toString();return v.includes("e-")?Number.parseInt(v.split("e-")[1],10):v.includes(".")?v.split(".")[1].length:0}function s(g,v){const d=a(v),m=10**(d+3);return Number.parseFloat((g*m/m).toFixed(d))}const l=Ve(()=>s(o(t.modelValue,t.min,t.max),t.step)),u=Ve(()=>{const g=(l.value-t.min)/(t.max-t.min)*100;return{width:`${g}%`,backgroundSize:`${g}% 100%`}});function c(g){if(!i.value)return l.value;const v=i.value.getBoundingClientRect(),m=(g.clientX-v.left)/v.width,y=t.max-t.min,_=t.min+y*m,E=Math.round(_/t.step)*t.step;return Math.min(Math.max(E,t.min),t.max)}function h(g){if(t.disabled)return;const v=c(g);n("update:modelValue",v)}function p(g){if(t.disabled)return;g.preventDefault();const v=c(g);n("update:modelValue",v),window.addEventListener("mousemove",h),window.addEventListener("mouseup",f)}function f(g){window.removeEventListener("mousemove",h),window.removeEventListener("mouseup",f)}return Gt(()=>{window.removeEventListener("mousemove",h),window.removeEventListener("mouseup",f)}),(g,v)=>(fe(),_e("span",{ref_key:"sliderRef",ref:i,class:Kt(["range-slider disabled:pointer-events-none disabled:cursor-default disabled:opacity-50",{disabled:r.disabled}]),bg:"[#e6e1fc] dark:[#676085]","touch-action-none":"",relative:"","inline-block":"","w-full":"","cursor-ew-resize":"","rounded-sm":"",onMousedown:p},[Y("span",{style:Yr(u.value),bg:"[#cabeff] dark:[#4e34b9]",relative:"",block:"","rounded-sm":"",h:"[14px]"},null,4),Y("span",{role:"slider",class:"slider-thumb",style:Yr({left:`${(l.value-r.min)/(r.max-r.min)*100}%`}),absolute:"","rounded-sm":"",w:"[1px]",h:"[14px]",bg:"zinc-100 dark:zinc-400",top:"50%",transform:"translate-x-[50%] translate-y-[-50%]"},null,4)],34))}});function of(r,e){if(e===dg)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),r;if(e===Hs||e===_d){let t=r.getIndex();if(t===null){const a=[],s=r.getAttribute("position");if(s!==void 0){for(let l=0;l=2.0 are supported."));return}const u=new PT(o,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});u.fileLoader.setRequestHeader(this.requestHeader);for(let c=0;c=0&&s[h]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+h+'".')}}u.setExtensions(a),u.setPlugins(s),u.parse(n,i)}parseAsync(e,t){const n=this;return new Promise(function(i,o){n.parse(e,t,i,o)})}}function Zw(){let r={};return{get:function(e){return r[e]},add:function(e,t){r[e]=t},remove:function(e){delete r[e]},removeAll:function(){r={}}}}const ze={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class Jw{constructor(e){this.parser=e,this.name=ze.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,o.source,a)}}class fT{constructor(e){this.parser=e,this.name=ze.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,o=i.textures[e];if(!o.extensions||!o.extensions[t])return null;const a=o.extensions[t],s=i.images[a.source];let l=n.textureLoader;if(s.uri){const u=n.options.manager.getHandler(s.uri);u!==null&&(l=u)}return this.detectSupport().then(function(u){if(u)return n.loadTextureImage(e,a.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class dT{constructor(e){this.parser=e,this.name=ze.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,o=i.textures[e];if(!o.extensions||!o.extensions[t])return null;const a=o.extensions[t],s=i.images[a.source];let l=n.textureLoader;if(s.uri){const u=n.options.manager.getHandler(s.uri);u!==null&&(l=u)}return this.detectSupport().then(function(u){if(u)return n.loadTextureImage(e,a.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class pT{constructor(e){this.name=ze.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const i=n.extensions[this.name],o=this.parser.getDependency("buffer",i.buffer),a=this.parser.options.meshoptDecoder;if(!a||!a.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return o.then(function(s){const l=i.byteOffset||0,u=i.byteLength||0,c=i.count,h=i.byteStride,p=new Uint8Array(s,l,u);return a.decodeGltfBufferAsync?a.decodeGltfBufferAsync(c,h,p,i.mode,i.filter).then(function(f){return f.buffer}):a.ready.then(function(){const f=new ArrayBuffer(c*h);return a.decodeGltfBuffer(new Uint8Array(f),c,h,p,i.mode,i.filter),f})})}else return null}}class mT{constructor(e){this.name=ze.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;const i=t.meshes[n.mesh];for(const u of i.primitives)if(u.mode!==Wt.TRIANGLES&&u.mode!==Wt.TRIANGLE_STRIP&&u.mode!==Wt.TRIANGLE_FAN&&u.mode!==void 0)return null;const a=n.extensions[this.name].attributes,s=[],l={};for(const u in a)s.push(this.parser.getDependency("accessor",a[u]).then(c=>(l[u]=c,l[u])));return s.length<1?null:(s.push(this.parser.createNodeMesh(e)),Promise.all(s).then(u=>{const c=u.pop(),h=c.isGroup?c.children:[c],p=u[0].count,f=[];for(const g of h){const v=new Sn,d=new Re,m=new Co,y=new Re(1,1,1),_=new yg(g.geometry,g.material,p);for(let E=0;E0||r.search(/^data\:image\/jpeg/)===0?"image/jpeg":r.search(/\.webp($|\?)/i)>0||r.search(/^data\:image\/webp/)===0?"image/webp":r.search(/\.ktx2($|\?)/i)>0||r.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const IT=new Sn;class PT{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new Zw,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=-1,o=!1,a=-1;if(typeof navigator<"u"){const s=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(s)===!0;const l=s.match(/Version\/(\d+)/);i=n&&l?parseInt(l[1],10):-1,o=s.indexOf("Firefox")>-1,a=o?s.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||n&&i<17||o&&a<98?this.textureLoader=new xg(this.options.manager):this.textureLoader=new bg(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new xd(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const n=this,i=this.json,o=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(a){return a._markDefs&&a._markDefs()}),Promise.all(this._invokeAll(function(a){return a.beforeRoot&&a.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(a){const s={scene:a[0][i.scene||0],scenes:a[0],animations:a[1],cameras:a[2],asset:i.asset,parser:n,userData:{}};return Jn(o,s,i),bn(s,i),Promise.all(n._invokeAll(function(l){return l.afterRoot&&l.afterRoot(s)})).then(function(){for(const l of s.scenes)l.updateMatrixWorld();e(s)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let i=0,o=t.length;i{const l=this.associations.get(a);l!=null&&this.associations.set(s,l);for(const[u,c]of a.children.entries())o(c,s.children[u])};return o(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n=2&&d.setY(M,b[C*l+1]),l>=3&&d.setZ(M,b[C*l+2]),l>=4&&d.setW(M,b[C*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}d.normalized=g}return d})}loadTexture(e){const t=this.json,n=this.options,o=t.textures[e].source,a=t.images[o];let s=this.textureLoader;if(a.uri){const l=n.manager.getHandler(a.uri);l!==null&&(s=l)}return this.loadTextureImage(e,o,s)}loadTextureImage(e,t,n){const i=this,o=this.json,a=o.textures[e],s=o.images[t],l=(s.uri||s.bufferView)+":"+a.sampler;if(this.textureCache[l])return this.textureCache[l];const u=this.loadImageSource(t,n).then(function(c){c.flipY=!1,c.name=a.name||s.name||"",c.name===""&&typeof s.uri=="string"&&s.uri.startsWith("data:image/")===!1&&(c.name=s.uri);const p=(o.samplers||{})[a.sampler]||{};return c.magFilter=sf[p.magFilter]||Io,c.minFilter=sf[p.minFilter]||lu,c.wrapS=lf[p.wrapS]||Po,c.wrapT=lf[p.wrapT]||Po,c.generateMipmaps=!c.isCompressedTexture&&c.minFilter!==su&&c.minFilter!==Io,i.associations.set(c,{textures:e}),c}).catch(function(){return null});return this.textureCache[l]=u,u}loadImageSource(e,t){const n=this,i=this.json,o=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(h=>h.clone());const a=i.images[e],s=self.URL||self.webkitURL;let l=a.uri||"",u=!1;if(a.bufferView!==void 0)l=n.getDependency("bufferView",a.bufferView).then(function(h){u=!0;const p=new Blob([h],{type:a.mimeType});return l=s.createObjectURL(p),l});else if(a.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const c=Promise.resolve(l).then(function(h){return new Promise(function(p,f){let g=p;t.isImageBitmapLoader===!0&&(g=function(v){const d=new Ao(v);d.needsUpdate=!0,p(d)}),t.load(_i.resolveURL(h,o.path),g,void 0,f)})}).then(function(h){return u===!0&&s.revokeObjectURL(l),bn(h,a),h.userData.mimeType=a.mimeType||AT(a.uri),h}).catch(function(h){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),h});return this.sourceCache[e]=c,c}assignTexture(e,t,n,i){const o=this;return this.getDependency("texture",n.index).then(function(a){if(!a)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(a=a.clone(),a.channel=n.texCoord),o.extensions[ze.KHR_TEXTURE_TRANSFORM]){const s=n.extensions!==void 0?n.extensions[ze.KHR_TEXTURE_TRANSFORM]:void 0;if(s){const l=o.associations.get(a);a=o.extensions[ze.KHR_TEXTURE_TRANSFORM].extendTexture(a,s),o.associations.set(a,l)}}return i!==void 0&&(a.colorSpace=i),e[t]=a,a})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const i=t.attributes.tangent===void 0,o=t.attributes.color!==void 0,a=t.attributes.normal===void 0;if(e.isPoints){const s="PointsMaterial:"+n.uuid;let l=this.cache.get(s);l||(l=new wg,va.prototype.copy.call(l,n),l.color.copy(n.color),l.map=n.map,l.sizeAttenuation=!1,this.cache.add(s,l)),n=l}else if(e.isLine){const s="LineBasicMaterial:"+n.uuid;let l=this.cache.get(s);l||(l=new Tg,va.prototype.copy.call(l,n),l.color.copy(n.color),l.map=n.map,this.cache.add(s,l)),n=l}if(i||o||a){let s="ClonedMaterial:"+n.uuid+":";i&&(s+="derivative-tangents:"),o&&(s+="vertex-colors:"),a&&(s+="flat-shading:");let l=this.cache.get(s);l||(l=n.clone(),o&&(l.vertexColors=!0),a&&(l.flatShading=!0),i&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(s,l),this.associations.set(l,this.associations.get(n))),n=l}e.material=n}getMaterialType(){return wd}loadMaterial(e){const t=this,n=this.json,i=this.extensions,o=n.materials[e];let a;const s={},l=o.extensions||{},u=[];if(l[ze.KHR_MATERIALS_UNLIT]){const h=i[ze.KHR_MATERIALS_UNLIT];a=h.getMaterialType(),u.push(h.extendParams(s,o,t))}else{const h=o.pbrMetallicRoughness||{};if(s.color=new Vt(1,1,1),s.opacity=1,Array.isArray(h.baseColorFactor)){const p=h.baseColorFactor;s.color.setRGB(p[0],p[1],p[2],En),s.opacity=p[3]}h.baseColorTexture!==void 0&&u.push(t.assignTexture(s,"map",h.baseColorTexture,Ci)),s.metalness=h.metallicFactor!==void 0?h.metallicFactor:1,s.roughness=h.roughnessFactor!==void 0?h.roughnessFactor:1,h.metallicRoughnessTexture!==void 0&&(u.push(t.assignTexture(s,"metalnessMap",h.metallicRoughnessTexture)),u.push(t.assignTexture(s,"roughnessMap",h.metallicRoughnessTexture))),a=this._invokeOne(function(p){return p.getMaterialType&&p.getMaterialType(e)}),u.push(Promise.all(this._invokeAll(function(p){return p.extendMaterialParams&&p.extendMaterialParams(e,s)})))}o.doubleSided===!0&&(s.side=Yo);const c=o.alphaMode||ws.OPAQUE;if(c===ws.BLEND?(s.transparent=!0,s.depthWrite=!1):(s.transparent=!1,c===ws.MASK&&(s.alphaTest=o.alphaCutoff!==void 0?o.alphaCutoff:.5)),o.normalTexture!==void 0&&a!==Nr&&(u.push(t.assignTexture(s,"normalMap",o.normalTexture)),s.normalScale=new bt(1,1),o.normalTexture.scale!==void 0)){const h=o.normalTexture.scale;s.normalScale.set(h,h)}if(o.occlusionTexture!==void 0&&a!==Nr&&(u.push(t.assignTexture(s,"aoMap",o.occlusionTexture)),o.occlusionTexture.strength!==void 0&&(s.aoMapIntensity=o.occlusionTexture.strength)),o.emissiveFactor!==void 0&&a!==Nr){const h=o.emissiveFactor;s.emissive=new Vt().setRGB(h[0],h[1],h[2],En)}return o.emissiveTexture!==void 0&&a!==Nr&&u.push(t.assignTexture(s,"emissiveMap",o.emissiveTexture,Ci)),Promise.all(u).then(function(){const h=new a(s);return o.name&&(h.name=o.name),bn(h,o),t.associations.set(h,{materials:e}),o.extensions&&Jn(i,h,o),h})}createUniqueName(e){const t=Ei.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,i=this.primitiveCache;function o(s){return n[ze.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(s,t).then(function(l){return uf(l,s,t)})}const a=[];for(let s=0,l=e.length;s0&&ET(m,o),m.name=t.createUniqueName(o.name||"mesh_"+e),bn(m,o),d.extensions&&Jn(i,m,d),t.assignFinalMaterial(m),h.push(m)}for(let f=0,g=h.length;f1?c=new ya:u.length===1?c=u[0]:c=new bd,c!==u[0])for(let h=0,p=u.length;h{const h=new Map;for(const[p,f]of i.associations)(p instanceof va||p instanceof Ao)&&h.set(p,f);return c.traverse(p=>{const f=i.associations.get(p);f!=null&&h.set(p,f)}),h};return i.associations=u(o),o})}_createAnimationTracks(e,t,n,i,o){const a=[],s=e.name?e.name:e.uuid,l=[];kn[o.path]===kn.weights?e.traverse(function(p){p.morphTargetInfluences&&l.push(p.name?p.name:p.uuid)}):l.push(s);let u;switch(kn[o.path]){case kn.weights:u=pc;break;case kn.rotation:u=mc;break;case kn.position:case kn.scale:u=dc;break;default:switch(n.itemSize){case 1:u=pc;break;case 2:case 3:default:u=dc;break}break}const c=i.interpolation!==void 0?wT[i.interpolation]:au,h=this._getArrayFromAccessor(n);for(let p=0,f=l.length;pnew mv(r)),Qn.register(r=>new gv(r)),Qn)}async function kT(r){const n=(await Np().loadAsync(r)).userData;if(!n.vrmAnimations){console.warn("No VRM animations found in the .vrma file");return}if(n.vrmAnimations.length===0){console.warn("No VRM animations found in the .vrma file");return}return n.vrmAnimations[0]}async function OT(r,e){if(!r){console.warn("No VRM found");return}if(e)return vv(e,r)}function RT(){const r=le(!1),e=le(0),t=le(0),n=.2,i=1,o=6,a=le(Math.random()*(o-i)+i);function s(l,u){if(l!=null&&l.expressionManager&&(t.value+=u,!r.value&&t.value>=a.value&&(r.value=!0,e.value=0),r.value)){e.value+=u/n;const c=Math.sin(Math.PI*e.value);l.expressionManager.setValue("blink",c),e.value>=1&&(r.value=!1,t.value=0,l.expressionManager.setValue("blink",0),a.value=Math.random()*(o-i)+i)}}return{update:s}}async function FT(r,e){const i=(await Np().loadAsync(r,a=>{var s;return(s=e==null?void 0:e.onProgress)==null?void 0:s.call(e,a)})).userData;if(!i.vrm)return;const o=i.vrm;if(gc.removeUnnecessaryVertices(o.scene),gc.combineSkeletons(o.scene),o.scene.traverse(a=>{a.frustumCulled=!1}),o.lookAt){const a=new yv(o.lookAt);a.name="lookAtQuaternionProxy",o.scene.add(a)}return e!=null&&e.scene&&e.scene.add(o.scene),e!=null&&e.position&&o.scene.position.set(...e.position),o}function LT(r){const e=le(null),t=le(!1),n=le(0),i=le(new Map),o=le(new Map),a=le(),s=(m,y,_)=>m+(y-m)*_,l=m=>m<.5?4*m*m*m:1-(-2*m+2)**3/2,u=new Map([["happy",{expression:[{name:"happy",value:1,duration:.3},{name:"aa",value:.3}],blendDuration:.3}],["sad",{expression:[{name:"sad",value:1},{name:"oh",value:.2}],blendDuration:.3}],["angry",{expression:[{name:"angry",value:1},{name:"ee",value:.4}],blendDuration:.2}],["surprised",{expression:[{name:"Surprised",value:1},{name:"oh",value:.6}],blendDuration:.1}],["neutral",{expression:[{name:"neutral",value:1}],blendDuration:.5}]]),c=()=>{a.value&&(clearTimeout(a.value),a.value=void 0)},h=m=>{var _;if(c(),!u.has(m)){console.warn(`Emotion ${m} not found`);return}const y=u.get(m);if(e.value=m,t.value=!0,n.value=0,r.expressionManager){const E=Object.keys(r.expressionManager.expressionMap);for(const x of E)r.expressionManager.setValue(x,0)}i.value.clear(),o.value.clear();for(const E of y.expression||[]){const x=((_=r.expressionManager)==null?void 0:_.getValue(E.name))||0;i.value.set(E.name,x),o.value.set(E.name,E.value)}};return{currentEmotion:e,isTransitioning:t,setEmotion:h,setEmotionWithResetAfter:(m,y)=>{c(),h(m),a.value=setTimeout(()=>{h("neutral"),a.value=void 0},y)},update:m=>{var E;if(!t.value||!e.value)return;const _=u.get(e.value).blendDuration||.3;n.value+=m/_,n.value>=1&&(n.value=1,t.value=!1);for(const[x,b]of o.value){const C=i.value.get(x)||0,A=s(C,b,l(n.value));(E=r.expressionManager)==null||E.setValue(x,A)}},addEmotionState:(m,y)=>{u.set(m,y)},removeEmotionState:m=>{u.delete(m)},dispose:()=>{c()}}}const NT=Ne({__name:"Model",props:{model:null,idleAnimation:null,loadAnimations:null,position:null},emits:["loadModelProgress","error"],setup(r,{expose:e,emit:t}){const n=r,i=t,o=le(),a=le(),{scene:s}=Si(),{onBeforeRender:l}=ru(),u=RT(),c=le();return Ge(()=>n.position,([h,p,f])=>{o.value&&o.value.scene.position.set(h,p,f)}),Jt(async()=>{if(s.value)try{const h=await FT(n.model,{scene:s.value,lookAt:!0,position:n.position,onProgress:g=>i("loadModelProgress",Number.parseFloat((100*(g.loaded/g.total)).toFixed(2)))});if(!h){console.warn("No VRM model loaded");return}const p=await kT(n.idleAnimation),f=await OT(h,p);if(!f){console.warn("No VRM animation loaded");return}a.value=new Fg(h.scene),a.value.clipAction(f).play(),c.value=LT(h),l(({delta:g})=>{var v,d,m;(v=a.value)==null||v.update(g),(d=o.value)==null||d.update(g),u.update(o.value,g),(m=c.value)==null||m.update(g)}),o.value=h}catch(h){i("error",h)}}),Gt(()=>{if(o.value){const{scene:h}=Si();h.value.remove(o.value.scene)}}),e({setExpression(h){var p;(p=c.value)==null||p.setEmotionWithResetAfter(h,1e3)}}),(h,p)=>ut(h.$slots,"default")}}),DT=["position"],BT={absolute:"",bottom:"2",right:"2"},UT={flex:"~ row",bg:"zinc-100 dark:zinc-700",text:"sm zinc-400 dark:zinc-500","h-fit":"","w-fit":"","appearance-none":"","gap-1":"","rounded-lg":"","rounded-md":"","border-none":""},zT=["checked","aria-checked"],jT={key:0,absolute:"","w-full":"","min-w":"50vw",z:"{var g;(g=p.value)==null||g.setExpression(f)}}),(f,g)=>{const v=Eo("TransitionVertical");return fe(),lt(_p,{relative:""},{default:Be(({height:d,width:m})=>[Oe(K(Lg),{alpha:!0,antialias:!0,width:m,height:d},{default:Be(()=>[Oe(K(Cw)),Y("TresPerspectiveCamera",{position:[a.value,s.value,l.value]},null,8,DT),g[14]||(g[14]=Y("TresDirectionalLight",{color:16777215,intensity:1.2,position:[1,1,1]},null,-1)),g[15]||(g[15]=Y("TresAmbientLight",{color:16777215,intensity:1.5},null,-1)),Oe(NT,{ref_key:"modelRef",ref:p,model:n.model,"idle-animation":n.idleAnimation,position:[u.value,c.value,h.value],onLoadModelProgress:g[0]||(g[0]=y=>i("loadModelProgress",y)),onError:g[1]||(g[1]=y=>i("error",y))},null,8,["model","idle-animation","position"])]),_:2},1032,["width","height"]),Y("div",BT,[Y("div",UT,[Y("label",{"h-fit":"","cursor-pointer":"",class:Kt([o.value?"bg-zinc-300 text-zinc-900 dark:bg-zinc-200 dark:text-zinc-800":""]),transition:"all ease-in-out duration-500","rounded-md":"","px-2":"","py-2":"",z:"o.value=y),checked:o.value,"aria-checked":o.value,name:"showLive2DViewerInspector",type:"checkbox",hidden:"","appearance-none":"","outline-none":""},null,8,zT),[[Wr,o.value]]),g[16]||(g[16]=Y("div",{"select-none":""},[Y("div",{"i-solar:bug-bold-duotone":"",text:"text-zinc-900 dark:text-zinc-800"})],-1))],2)]),Oe(v,null,{default:Be(()=>[o.value?(fe(),_e("div",jT,[Y("div",VT,[g[25]||(g[25]=Y("div",{"font-mono":""},[Y("span",null,"Model")],-1)),Oe(rf,{"h-fit":"","w-full":""},{label:Be(()=>g[17]||(g[17]=[Y("span",{"font-mono":""},"Camera",-1)])),default:Be(()=>[Y("div",GT,[g[18]||(g[18]=Y("div",{text:"zinc-400 dark:zinc-500"},[Y("span",null,"X")],-1)),Y("label",$T,[Oe(Or,{modelValue:a.value,"onUpdate:modelValue":g[3]||(g[3]=y=>a.value=y),min:-10,max:10,step:.01},null,8,["modelValue"])]),Y("div",HT,[Y("span",null,Ue(a.value),1)]),g[19]||(g[19]=Y("div",{text:"zinc-400 dark:zinc-500"},[Y("span",null,"Y")],-1)),Y("label",XT,[Oe(Or,{modelValue:s.value,"onUpdate:modelValue":g[4]||(g[4]=y=>s.value=y),min:-10,max:10,step:.01},null,8,["modelValue"])]),Y("div",WT,[Y("span",null,Ue(s.value),1)]),g[20]||(g[20]=Y("div",{text:"zinc-400 dark:zinc-500"},[Y("span",null,"Z")],-1)),Y("label",qT,[Oe(Or,{modelValue:l.value,"onUpdate:modelValue":g[5]||(g[5]=y=>l.value=y),min:-10,max:10,step:.01},null,8,["modelValue"])]),Y("div",YT,[Y("span",null,Ue(l.value),1)])])]),_:1}),Oe(rf,{"h-fit":"","w-full":""},{label:Be(()=>g[21]||(g[21]=[Y("span",{"font-mono":""},"Model",-1)])),default:Be(()=>[Y("div",KT,[g[22]||(g[22]=Y("div",{text:"zinc-400 dark:zinc-500"},[Y("span",null,"X")],-1)),Y("label",ZT,[Oe(Or,{modelValue:u.value,"onUpdate:modelValue":g[6]||(g[6]=y=>u.value=y),min:-10,max:10,step:.01},null,8,["modelValue"])]),Y("div",JT,[Y("span",null,Ue(u.value),1)]),g[23]||(g[23]=Y("div",{text:"zinc-400 dark:zinc-500"},[Y("span",null,"Y")],-1)),Y("label",QT,[Oe(Or,{modelValue:c.value,"onUpdate:modelValue":g[7]||(g[7]=y=>c.value=y),min:-10,max:10,step:.01},null,8,["modelValue"])]),Y("div",eS,[Y("span",null,Ue(c.value),1)]),g[24]||(g[24]=Y("div",{text:"zinc-400 dark:zinc-500"},[Y("span",null,"Z")],-1)),Y("label",tS,[Oe(Or,{modelValue:h.value,"onUpdate:modelValue":g[8]||(g[8]=y=>h.value=y),min:-10,max:10,step:.01},null,8,["modelValue"])]),Y("div",nS,[Y("span",null,Ue(h.value),1)])])]),_:1}),g[26]||(g[26]=Y("div",{"font-mono":""},[Y("span",null,"Emotions")],-1)),Y("div",rS,[Y("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:g[9]||(g[9]=y=>{var _;return(_=p.value)==null?void 0:_.setExpression("neutral")})}," 🙂 Neutral "),Y("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:g[10]||(g[10]=y=>{var _;return(_=p.value)==null?void 0:_.setExpression("surprised")})}," 🤯 Surprised "),Y("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:g[11]||(g[11]=y=>{var _;return(_=p.value)==null?void 0:_.setExpression("sad")})}," 😫 Sad "),Y("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:g[12]||(g[12]=y=>{var _;return(_=p.value)==null?void 0:_.setExpression("angry")})}," 😠 Angry "),Y("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:g[13]||(g[13]=y=>{var _;return(_=p.value)==null?void 0:_.setExpression("happy")})}," 😄 Happy ")])])])):nt("",!0)]),_:1})])]),_:1})}}});class Ss extends Error{constructor(t,n){super(t);sc(this,"response");this.name="XSAIError",this.response=n}}const oS=r=>r.replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`),To=r=>Object.fromEntries(Object.entries(r).map(([e,t])=>[oS(e),t])),Dp=r=>Object.fromEntries(Object.entries(r).filter(([,e])=>e!==void 0)),Bp=r=>JSON.stringify(To(Dp({...r,abortSignal:void 0,apiKey:void 0,baseURL:void 0,fetch:void 0,headers:void 0}))),Ru=(r,e)=>Dp({Authorization:e?`Bearer ${e}`:void 0,...r}),Fu=(r,e)=>{const t=e.toString();return new URL(r,t.endsWith("/")?t:`${t}/`)},Lu=async r=>{if(!r.ok){const e=new Ss(`Remote sent ${r.status} response`,r);throw e.cause=new Error(await r.text()),e}if(!r.body)throw new Ss("Response body is empty from remote server",r);if(!(r.body instanceof ReadableStream)){const e=new Ss(`Expected Response body to be a ReadableStream, but got ${String(r.body)}`,r);throw e.cause=new Error(`Content-Type is ${r.headers.get("Content-Type")}`),e}return r},aS=async r=>Lu(r).then(e=>e.json()),sS=async r=>await(r.fetch??globalThis.fetch)(Fu("audio/speech",r.baseURL),{body:Bp(r),headers:Ru({"Content-Type":"application/json",...r.headers},r.apiKey),method:"POST",signal:r.abortSignal}).then(Lu).then(e=>e.arrayBuffer()),Up=(r,{apiKey:e,baseURL:t,headers:n})=>({apiKey:e,baseURL:t,headers:n,model:r}),lS=r=>{const e={...r,baseURL:new URL("http://localhost:11434/v1/")},t=n=>Up(n,e);return{chat:t,embed:t,model:()=>e}};lS();const uS=r=>{const e=({applyTextNormalization:t,languageCode:n,nextRequestIds:i,nextText:o,previousRequestIds:a,previousText:s,pronunciationDictionaryLocators:l,seed:u,voiceSettings:c})=>({extraBody:To({applyTextNormalization:t,languageCode:n,nextRequestIds:i,nextText:o,previousRequestIds:a,previousText:s,pronunciationDictionaryLocators:l?l.map(h=>To(h)):void 0,seed:u,voiceSettings:c?To(c):void 0})});return{speech:(t,n)=>({...n?e(n):{},...Up(`elevenlabs/${t}`,{...r,baseURL:(r==null?void 0:r.baseURL)??new URL("http://localhost:5933/v1/")})})}},cS=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class Di{constructor(e,t,n){this.property=e,this.normal=t,n&&(this.space=n)}}Di.prototype.property={};Di.prototype.normal={};Di.prototype.space=null;function zp(r,e){const t={},n={};let i=-1;for(;++i4&&t.slice(0,4)==="data"&&mS.test(e)){if(e.charAt(4)==="-"){const o=e.slice(5).replace(hf,_S);n="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=e.slice(4);if(!hf.test(o)){let a=o.replace(gS,yS);a.charAt(0)!=="-"&&(a="-"+a),e="data"+a}}i=Nu}return new i(n,e)}function yS(r){return"-"+r.toLowerCase()}function _S(r){return r.charAt(1).toUpperCase()}const xS=zp([Gp,Vp,Xp,Wp,dS],"html"),qp=zp([Gp,Vp,Xp,Wp,pS],"svg"),ff={}.hasOwnProperty;function bS(r,e){const t=e;function n(i,...o){let a=n.invalid;const s=n.handlers;if(i&&ff.call(i,r)){const l=String(i[r]);a=ff.call(s,l)?s[l]:n.unknown}if(a)return a.call(this,i,...o)}return n.handlers=t.handlers||{},n.invalid=t.invalid,n.unknown=t.unknown,n}const wS=/["&'<>`]/g,TS=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,SS=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,ES=/[|\\{}()[\]^$+*?.]/g,df=new WeakMap;function CS(r,e){if(r=r.replace(e.subset?AS(e.subset):wS,n),e.subset||e.escapeOnly)return r;return r.replace(TS,t).replace(SS,n);function t(i,o,a){return e.format((i.charCodeAt(0)-55296)*1024+i.charCodeAt(1)-56320+65536,a.charCodeAt(o+2),e)}function n(i,o,a){return e.format(i.charCodeAt(0),a.charCodeAt(o+1),e)}}function AS(r){let e=df.get(r);return e||(e=IS(r),df.set(r,e)),e}function IS(r){const e=[];let t=-1;for(;++t",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},FS=["cent","copy","divide","gt","lt","not","para","times"],Yp={}.hasOwnProperty,Hl={};let io;for(io in Cs)Yp.call(Cs,io)&&(Hl[Cs[io]]=io);const LS=/[^\dA-Za-z]/;function NS(r,e,t,n){const i=String.fromCharCode(r);if(Yp.call(Hl,i)){const o=Hl[i],a="&"+o;return t&&RS.includes(o)&&!FS.includes(o)&&(!n||e&&e!==61&&LS.test(String.fromCharCode(e)))?a:a+";"}return""}function DS(r,e,t){let n=MS(r,e,t.omitOptionalSemicolons),i;if((t.useNamedReferences||t.useShortestReferences)&&(i=NS(r,e,t.omitOptionalSemicolons,t.attribute)),(t.useShortestReferences||!i)&&t.useShortestReferences){const o=OS(r,e,t.omitOptionalSemicolons);o.length|^->||--!>|"],zS=["<",">"];function jS(r,e,t,n){return n.settings.bogusComments?"":"";function i(o){return Hr(o,Object.assign({},n.settings.characterReferences,{subset:zS}))}}function VS(r,e,t,n){return""}function pf(r,e){const t=String(r);if(typeof e!="string")throw new TypeError("Expected character");let n=0,i=t.indexOf(e);for(;i!==-1;)n++,i=t.indexOf(e,i+e.length);return n}function GS(r,e){const t=e||{};return(r[r.length-1]===""?[...r,""]:r).join((t.padRight?" ":"")+","+(t.padLeft===!1?"":" ")).trim()}function $S(r){return r.join(" ").trim()}const HS=/[ \t\n\f\r]/g;function Du(r){return typeof r=="object"?r.type==="text"?mf(r.value):!1:mf(r)}function mf(r){return r.replace(HS,"")===""}const _t=Zp(1),Kp=Zp(-1),XS=[];function Zp(r){return e;function e(t,n,i){const o=t?t.children:XS;let a=(n||0)+r,s=o[a];if(!i)for(;s&&Du(s);)a+=r,s=o[a];return s}}const WS={}.hasOwnProperty;function Jp(r){return e;function e(t,n,i){return WS.call(r,t.tagName)&&r[t.tagName](t,n,i)}}const Bu=Jp({body:YS,caption:As,colgroup:As,dd:QS,dt:JS,head:As,html:qS,li:ZS,optgroup:e2,option:t2,p:KS,rp:gf,rt:gf,tbody:r2,td:vf,tfoot:i2,th:vf,thead:n2,tr:o2});function As(r,e,t){const n=_t(t,e,!0);return!n||n.type!=="comment"&&!(n.type==="text"&&Du(n.value.charAt(0)))}function qS(r,e,t){const n=_t(t,e);return!n||n.type!=="comment"}function YS(r,e,t){const n=_t(t,e);return!n||n.type!=="comment"}function KS(r,e,t){const n=_t(t,e);return n?n.type==="element"&&(n.tagName==="address"||n.tagName==="article"||n.tagName==="aside"||n.tagName==="blockquote"||n.tagName==="details"||n.tagName==="div"||n.tagName==="dl"||n.tagName==="fieldset"||n.tagName==="figcaption"||n.tagName==="figure"||n.tagName==="footer"||n.tagName==="form"||n.tagName==="h1"||n.tagName==="h2"||n.tagName==="h3"||n.tagName==="h4"||n.tagName==="h5"||n.tagName==="h6"||n.tagName==="header"||n.tagName==="hgroup"||n.tagName==="hr"||n.tagName==="main"||n.tagName==="menu"||n.tagName==="nav"||n.tagName==="ol"||n.tagName==="p"||n.tagName==="pre"||n.tagName==="section"||n.tagName==="table"||n.tagName==="ul"):!t||!(t.type==="element"&&(t.tagName==="a"||t.tagName==="audio"||t.tagName==="del"||t.tagName==="ins"||t.tagName==="map"||t.tagName==="noscript"||t.tagName==="video"))}function ZS(r,e,t){const n=_t(t,e);return!n||n.type==="element"&&n.tagName==="li"}function JS(r,e,t){const n=_t(t,e);return!!(n&&n.type==="element"&&(n.tagName==="dt"||n.tagName==="dd"))}function QS(r,e,t){const n=_t(t,e);return!n||n.type==="element"&&(n.tagName==="dt"||n.tagName==="dd")}function gf(r,e,t){const n=_t(t,e);return!n||n.type==="element"&&(n.tagName==="rp"||n.tagName==="rt")}function e2(r,e,t){const n=_t(t,e);return!n||n.type==="element"&&n.tagName==="optgroup"}function t2(r,e,t){const n=_t(t,e);return!n||n.type==="element"&&(n.tagName==="option"||n.tagName==="optgroup")}function n2(r,e,t){const n=_t(t,e);return!!(n&&n.type==="element"&&(n.tagName==="tbody"||n.tagName==="tfoot"))}function r2(r,e,t){const n=_t(t,e);return!n||n.type==="element"&&(n.tagName==="tbody"||n.tagName==="tfoot")}function i2(r,e,t){return!_t(t,e)}function o2(r,e,t){const n=_t(t,e);return!n||n.type==="element"&&n.tagName==="tr"}function vf(r,e,t){const n=_t(t,e);return!n||n.type==="element"&&(n.tagName==="td"||n.tagName==="th")}const a2=Jp({body:u2,colgroup:c2,head:l2,html:s2,tbody:h2});function s2(r){const e=_t(r,-1);return!e||e.type!=="comment"}function l2(r){const e=new Set;for(const n of r.children)if(n.type==="element"&&(n.tagName==="base"||n.tagName==="title")){if(e.has(n.tagName))return!1;e.add(n.tagName)}const t=r.children[0];return!t||t.type==="element"}function u2(r){const e=_t(r,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&Du(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function c2(r,e,t){const n=Kp(t,e),i=_t(r,-1,!0);return t&&n&&n.type==="element"&&n.tagName==="colgroup"&&Bu(n,t.children.indexOf(n),t)?!1:!!(i&&i.type==="element"&&i.tagName==="col")}function h2(r,e,t){const n=Kp(t,e),i=_t(r,-1);return t&&n&&n.type==="element"&&(n.tagName==="thead"||n.tagName==="tbody")&&Bu(n,t.children.indexOf(n),t)?!1:!!(i&&i.type==="element"&&i.tagName==="tr")}const oo={name:[[` +\f\r &/=>`.split(""),` +\f\r "&'/=>\``.split("")],[`\0 +\f\r "&'/<=>`.split(""),`\0 +\f\r "&'/<=>\``.split("")]],unquoted:[[` +\f\r &>`.split(""),`\0 +\f\r "&'<=>\``.split("")],[`\0 +\f\r "&'<=>\``.split(""),`\0 +\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function f2(r,e,t,n){const i=n.schema,o=i.space==="svg"?!1:n.settings.omitOptionalTags;let a=i.space==="svg"?n.settings.closeEmptyElements:n.settings.voids.includes(r.tagName.toLowerCase());const s=[];let l;i.space==="html"&&r.tagName==="svg"&&(n.schema=qp);const u=d2(n,r.properties),c=n.all(i.space==="html"&&r.tagName==="template"?r.content:r);return n.schema=i,c&&(a=!1),(u||!o||!a2(r,e,t))&&(s.push("<",r.tagName,u?" "+u:""),a&&(i.space==="svg"||n.settings.closeSelfClosing)&&(l=u.charAt(u.length-1),(!n.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&s.push(" "),s.push("/")),s.push(">")),s.push(c),!a&&(!o||!Bu(r,e,t))&&s.push(""),s.join("")}function d2(r,e){const t=[];let n=-1,i;if(e){for(i in e)if(e[i]!==null&&e[i]!==void 0){const o=p2(r,i,e[i]);o&&t.push(o)}}for(;++npf(t,r.alternative)&&(a=r.alternative),s=a+Hr(t,Object.assign({},r.settings.characterReferences,{subset:(a==="'"?oo.single:oo.double)[i][o],attribute:!0}))+a),l+(s&&"="+s))}const m2=["<","&"];function Qp(r,e,t,n){return t&&t.type==="element"&&(t.tagName==="script"||t.tagName==="style")?r.value:Hr(r.value,Object.assign({},n.settings.characterReferences,{subset:m2}))}function g2(r,e,t,n){return n.settings.allowDangerousHtml?r.value:Qp(r,e,t,n)}function v2(r,e,t,n){return n.all(r)}const y2=bS("type",{invalid:_2,unknown:x2,handlers:{comment:jS,doctype:VS,element:f2,raw:g2,root:v2,text:Qp}});function _2(r){throw new Error("Expected node, not `"+r+"`")}function x2(r){const e=r;throw new Error("Cannot compile unknown node `"+e.type+"`")}const b2={},w2=[];function T2(r,e){const t=e,n=t.quote||'"',i=n==='"'?"'":'"';if(n!=='"'&&n!=="'")throw new Error("Invalid quote `"+n+"`, expected `'` or `\"`");return{one:S2,all:E2,settings:{omitOptionalTags:t.omitOptionalTags||!1,allowParseErrors:t.allowParseErrors||!1,allowDangerousCharacters:t.allowDangerousCharacters||!1,quoteSmart:t.quoteSmart||!1,preferUnquoted:t.preferUnquoted||!1,tightAttributes:t.tightAttributes||!1,upperDoctype:t.upperDoctype||!1,tightDoctype:t.tightDoctype||!1,bogusComments:t.bogusComments||!1,tightCommaSeparatedLists:t.tightCommaSeparatedLists||!1,tightSelfClosing:t.tightSelfClosing||!1,collapseEmptyAttributes:t.collapseEmptyAttributes||!1,allowDangerousHtml:t.allowDangerousHtml||!1,voids:t.voids||cS,characterReferences:t.characterReferences||b2,closeSelfClosing:t.closeSelfClosing||!1,closeEmptyElements:t.closeEmptyElements||!1},schema:t.space==="svg"?qp:xS,quote:n,alternative:i}.one(Array.isArray(r)?{type:"root",children:r}:r,void 0,void 0)}function S2(r,e,t){return y2(r,e,t,this)}function E2(r){const e=[],t=r&&r.children||w2;let n=-1;for(;++ni?0:i+e:e=e>i?i:e,t=t>0?t:0,n.length<1e4)a=Array.from(n),a.unshift(e,t),r.splice(...a);else for(t&&r.splice(e,t);o0?(pn(r,r.length,0,e),r):e}const xf={}.hasOwnProperty;function M2(r){const e={};let t=-1;for(;++t13&&t<32||t>126&&t<160||t>55295&&t<57344||t>64975&&t<65008||(t&65535)===65535||(t&65535)===65534||t>1114111?"�":String.fromCodePoint(t)}function Xr(r){return r.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const un=Hn(/[A-Za-z]/),jt=Hn(/[\dA-Za-z]/),R2=Hn(/[#-'*+\--9=?A-Z^-~]/);function Xl(r){return r!==null&&(r<32||r===127)}const Wl=Hn(/\d/),F2=Hn(/[\dA-Fa-f]/),L2=Hn(/[!-/:-@[-`{-~]/);function Ie(r){return r!==null&&r<-2}function Rt(r){return r!==null&&(r<0||r===32)}function He(r){return r===-2||r===-1||r===32}const N2=Hn(new RegExp("\\p{P}|\\p{S}","u")),D2=Hn(/\s/);function Hn(r){return e;function e(t){return t!==null&&t>-1&&r.test(String.fromCharCode(t))}}function ni(r){const e=[];let t=-1,n=0,i=0;for(;++t55295&&o<57344){const s=r.charCodeAt(t+1);o<56320&&s>56319&&s<57344?(a=String.fromCharCode(o,s),i=1):a="�"}else a=String.fromCharCode(o);a&&(e.push(r.slice(n,t),encodeURIComponent(a)),n=t+i+1,a=""),i&&(t+=i,i=0)}return e.join("")+r.slice(n)}function Qe(r,e,t,n){const i=n?n-1:Number.POSITIVE_INFINITY;let o=0;return a;function a(l){return He(l)?(r.enter(t),s(l)):e(l)}function s(l){return He(l)&&o++a))return;const C=e.events.length;let A=C,M,I;for(;A--;)if(e.events[A][0]==="exit"&&e.events[A][1].type==="chunkFlow"){if(M){I=e.events[A][1].end;break}M=!0}for(m(n),b=C;b_;){const x=t[E];e.containerState=x[1],x[0].exit.call(e,r)}t.length=_}function y(){i.write([null]),o=void 0,i=void 0,e.containerState._closeFlow=void 0}}function V2(r,e,t){return Qe(r,r.attempt(this.parser.constructs.document,e,t),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function wf(r){if(r===null||Rt(r)||D2(r))return 1;if(N2(r))return 2}function zu(r,e,t){const n=[];let i=-1;for(;++i1&&r[t][1].end.offset-r[t][1].start.offset>1?2:1;const h={...r[n][1].end},p={...r[t][1].start};Tf(h,-l),Tf(p,l),a={type:l>1?"strongSequence":"emphasisSequence",start:h,end:{...r[n][1].end}},s={type:l>1?"strongSequence":"emphasisSequence",start:{...r[t][1].start},end:p},o={type:l>1?"strongText":"emphasisText",start:{...r[n][1].end},end:{...r[t][1].start}},i={type:l>1?"strong":"emphasis",start:{...a.start},end:{...s.end}},r[n][1].end={...a.start},r[t][1].start={...s.end},u=[],r[n][1].end.offset-r[n][1].start.offset&&(u=Yt(u,[["enter",r[n][1],e],["exit",r[n][1],e]])),u=Yt(u,[["enter",i,e],["enter",a,e],["exit",a,e],["enter",o,e]]),u=Yt(u,zu(e.parser.constructs.insideSpan.null,r.slice(n+1,t),e)),u=Yt(u,[["exit",o,e],["enter",s,e],["exit",s,e],["exit",i,e]]),r[t][1].end.offset-r[t][1].start.offset?(c=2,u=Yt(u,[["enter",r[t][1],e],["exit",r[t][1],e]])):c=0,pn(r,n-1,t-n+3,u),t=n+u.length-c-2;break}}for(t=-1;++t0&&He(b)?Qe(r,y,"linePrefix",o+1)(b):y(b)}function y(b){return b===null||Ie(b)?r.check(Sf,v,E)(b):(r.enter("codeFlowValue"),_(b))}function _(b){return b===null||Ie(b)?(r.exit("codeFlowValue"),y(b)):(r.consume(b),_)}function E(b){return r.exit("codeFenced"),e(b)}function x(b,C,A){let M=0;return I;function I(G){return b.enter("lineEnding"),b.consume(G),b.exit("lineEnding"),F}function F(G){return b.enter("codeFencedFence"),He(G)?Qe(b,S,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(G):S(G)}function S(G){return G===s?(b.enter("codeFencedFenceSequence"),X(G)):A(G)}function X(G){return G===s?(M++,b.consume(G),X):M>=a?(b.exit("codeFencedFenceSequence"),He(G)?Qe(b,w,"whitespace")(G):w(G)):A(G)}function w(G){return G===null||Ie(G)?(b.exit("codeFencedFence"),C(G)):A(G)}}}function eE(r,e,t){const n=this;return i;function i(a){return a===null?t(a):(r.enter("lineEnding"),r.consume(a),r.exit("lineEnding"),o)}function o(a){return n.parser.lazy[n.now().line]?t(a):e(a)}}const Is={name:"codeIndented",tokenize:nE},tE={partial:!0,tokenize:rE};function nE(r,e,t){const n=this;return i;function i(u){return r.enter("codeIndented"),Qe(r,o,"linePrefix",5)(u)}function o(u){const c=n.events[n.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?a(u):t(u)}function a(u){return u===null?l(u):Ie(u)?r.attempt(tE,a,l)(u):(r.enter("codeFlowValue"),s(u))}function s(u){return u===null||Ie(u)?(r.exit("codeFlowValue"),a(u)):(r.consume(u),s)}function l(u){return r.exit("codeIndented"),e(u)}}function rE(r,e,t){const n=this;return i;function i(a){return n.parser.lazy[n.now().line]?t(a):Ie(a)?(r.enter("lineEnding"),r.consume(a),r.exit("lineEnding"),i):Qe(r,o,"linePrefix",5)(a)}function o(a){const s=n.events[n.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?e(a):Ie(a)?i(a):t(a)}}const iE={name:"codeText",previous:aE,resolve:oE,tokenize:sE};function oE(r){let e=r.length-4,t=3,n,i;if((r[t][1].type==="lineEnding"||r[t][1].type==="space")&&(r[e][1].type==="lineEnding"||r[e][1].type==="space")){for(n=t;++n=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length)return this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse();const i=this.left.slice(e);return i.push(...this.right.slice(this.right.length-n+this.left.length).reverse()),i}splice(e,t,n){const i=t||0;this.setCursor(Math.trunc(e));const o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return n&&ci(this.left,n),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),ci(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),ci(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e=4?e(a):r.interrupt(n.parser.constructs.flow,t,e)(a)}}function am(r,e,t,n,i,o,a,s,l){const u=l||Number.POSITIVE_INFINITY;let c=0;return h;function h(m){return m===60?(r.enter(n),r.enter(i),r.enter(o),r.consume(m),r.exit(o),p):m===null||m===32||m===41||Xl(m)?t(m):(r.enter(n),r.enter(a),r.enter(s),r.enter("chunkString",{contentType:"string"}),v(m))}function p(m){return m===62?(r.enter(o),r.consume(m),r.exit(o),r.exit(i),r.exit(n),e):(r.enter(s),r.enter("chunkString",{contentType:"string"}),f(m))}function f(m){return m===62?(r.exit("chunkString"),r.exit(s),p(m)):m===null||m===60||Ie(m)?t(m):(r.consume(m),m===92?g:f)}function g(m){return m===60||m===62||m===92?(r.consume(m),f):f(m)}function v(m){return!c&&(m===null||m===41||Rt(m))?(r.exit("chunkString"),r.exit(s),r.exit(a),r.exit(n),e(m)):c999||f===null||f===91||f===93&&!l||f===94&&!s&&"_hiddenFootnoteSupport"in a.parser.constructs?t(f):f===93?(r.exit(o),r.enter(i),r.consume(f),r.exit(i),r.exit(n),e):Ie(f)?(r.enter("lineEnding"),r.consume(f),r.exit("lineEnding"),c):(r.enter("chunkString",{contentType:"string"}),h(f))}function h(f){return f===null||f===91||f===93||Ie(f)||s++>999?(r.exit("chunkString"),c(f)):(r.consume(f),l||(l=!He(f)),f===92?p:h)}function p(f){return f===91||f===92||f===93?(r.consume(f),s++,h):h(f)}}function lm(r,e,t,n,i,o){let a;return s;function s(p){return p===34||p===39||p===40?(r.enter(n),r.enter(i),r.consume(p),r.exit(i),a=p===40?41:p,l):t(p)}function l(p){return p===a?(r.enter(i),r.consume(p),r.exit(i),r.exit(n),e):(r.enter(o),u(p))}function u(p){return p===a?(r.exit(o),l(a)):p===null?t(p):Ie(p)?(r.enter("lineEnding"),r.consume(p),r.exit("lineEnding"),Qe(r,u,"linePrefix")):(r.enter("chunkString",{contentType:"string"}),c(p))}function c(p){return p===a||p===null||Ie(p)?(r.exit("chunkString"),u(p)):(r.consume(p),p===92?h:c)}function h(p){return p===a||p===92?(r.consume(p),c):c(p)}}function wi(r,e){let t;return n;function n(i){return Ie(i)?(r.enter("lineEnding"),r.consume(i),r.exit("lineEnding"),t=!0,n):He(i)?Qe(r,n,t?"linePrefix":"lineSuffix")(i):e(i)}}const mE={name:"definition",tokenize:vE},gE={partial:!0,tokenize:yE};function vE(r,e,t){const n=this;let i;return o;function o(f){return r.enter("definition"),a(f)}function a(f){return sm.call(n,r,s,t,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function s(f){return i=Xr(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),f===58?(r.enter("definitionMarker"),r.consume(f),r.exit("definitionMarker"),l):t(f)}function l(f){return Rt(f)?wi(r,u)(f):u(f)}function u(f){return am(r,c,t,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function c(f){return r.attempt(gE,h,h)(f)}function h(f){return He(f)?Qe(r,p,"whitespace")(f):p(f)}function p(f){return f===null||Ie(f)?(r.exit("definition"),n.parser.defined.push(i),e(f)):t(f)}}function yE(r,e,t){return n;function n(s){return Rt(s)?wi(r,i)(s):t(s)}function i(s){return lm(r,o,t,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function o(s){return He(s)?Qe(r,a,"whitespace")(s):a(s)}function a(s){return s===null||Ie(s)?e(s):t(s)}}const _E={name:"hardBreakEscape",tokenize:xE};function xE(r,e,t){return n;function n(o){return r.enter("hardBreakEscape"),r.consume(o),i}function i(o){return Ie(o)?(r.exit("hardBreakEscape"),e(o)):t(o)}}const bE={name:"headingAtx",resolve:wE,tokenize:TE};function wE(r,e){let t=r.length-2,n=3,i,o;return r[n][1].type==="whitespace"&&(n+=2),t-2>n&&r[t][1].type==="whitespace"&&(t-=2),r[t][1].type==="atxHeadingSequence"&&(n===t-1||t-4>n&&r[t-2][1].type==="whitespace")&&(t-=n+1===t?2:4),t>n&&(i={type:"atxHeadingText",start:r[n][1].start,end:r[t][1].end},o={type:"chunkText",start:r[n][1].start,end:r[t][1].end,contentType:"text"},pn(r,n,t-n+1,[["enter",i,e],["enter",o,e],["exit",o,e],["exit",i,e]])),r}function TE(r,e,t){let n=0;return i;function i(c){return r.enter("atxHeading"),o(c)}function o(c){return r.enter("atxHeadingSequence"),a(c)}function a(c){return c===35&&n++<6?(r.consume(c),a):c===null||Rt(c)?(r.exit("atxHeadingSequence"),s(c)):t(c)}function s(c){return c===35?(r.enter("atxHeadingSequence"),l(c)):c===null||Ie(c)?(r.exit("atxHeading"),e(c)):He(c)?Qe(r,s,"whitespace")(c):(r.enter("atxHeadingText"),u(c))}function l(c){return c===35?(r.consume(c),l):(r.exit("atxHeadingSequence"),s(c))}function u(c){return c===null||c===35||Rt(c)?(r.exit("atxHeadingText"),s(c)):(r.consume(c),u)}}const SE=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Cf=["pre","script","style","textarea"],EE={concrete:!0,name:"htmlFlow",resolveTo:IE,tokenize:PE},CE={partial:!0,tokenize:kE},AE={partial:!0,tokenize:ME};function IE(r){let e=r.length;for(;e--&&!(r[e][0]==="enter"&&r[e][1].type==="htmlFlow"););return e>1&&r[e-2][1].type==="linePrefix"&&(r[e][1].start=r[e-2][1].start,r[e+1][1].start=r[e-2][1].start,r.splice(e-2,2)),r}function PE(r,e,t){const n=this;let i,o,a,s,l;return u;function u(k){return c(k)}function c(k){return r.enter("htmlFlow"),r.enter("htmlFlowData"),r.consume(k),h}function h(k){return k===33?(r.consume(k),p):k===47?(r.consume(k),o=!0,v):k===63?(r.consume(k),i=3,n.interrupt?e:P):un(k)?(r.consume(k),a=String.fromCharCode(k),d):t(k)}function p(k){return k===45?(r.consume(k),i=2,f):k===91?(r.consume(k),i=5,s=0,g):un(k)?(r.consume(k),i=4,n.interrupt?e:P):t(k)}function f(k){return k===45?(r.consume(k),n.interrupt?e:P):t(k)}function g(k){const ee="CDATA[";return k===ee.charCodeAt(s++)?(r.consume(k),s===ee.length?n.interrupt?e:S:g):t(k)}function v(k){return un(k)?(r.consume(k),a=String.fromCharCode(k),d):t(k)}function d(k){if(k===null||k===47||k===62||Rt(k)){const ee=k===47,Q=a.toLowerCase();return!ee&&!o&&Cf.includes(Q)?(i=1,n.interrupt?e(k):S(k)):SE.includes(a.toLowerCase())?(i=6,ee?(r.consume(k),m):n.interrupt?e(k):S(k)):(i=7,n.interrupt&&!n.parser.lazy[n.now().line]?t(k):o?y(k):_(k))}return k===45||jt(k)?(r.consume(k),a+=String.fromCharCode(k),d):t(k)}function m(k){return k===62?(r.consume(k),n.interrupt?e:S):t(k)}function y(k){return He(k)?(r.consume(k),y):I(k)}function _(k){return k===47?(r.consume(k),I):k===58||k===95||un(k)?(r.consume(k),E):He(k)?(r.consume(k),_):I(k)}function E(k){return k===45||k===46||k===58||k===95||jt(k)?(r.consume(k),E):x(k)}function x(k){return k===61?(r.consume(k),b):He(k)?(r.consume(k),x):_(k)}function b(k){return k===null||k===60||k===61||k===62||k===96?t(k):k===34||k===39?(r.consume(k),l=k,C):He(k)?(r.consume(k),b):A(k)}function C(k){return k===l?(r.consume(k),l=null,M):k===null||Ie(k)?t(k):(r.consume(k),C)}function A(k){return k===null||k===34||k===39||k===47||k===60||k===61||k===62||k===96||Rt(k)?x(k):(r.consume(k),A)}function M(k){return k===47||k===62||He(k)?_(k):t(k)}function I(k){return k===62?(r.consume(k),F):t(k)}function F(k){return k===null||Ie(k)?S(k):He(k)?(r.consume(k),F):t(k)}function S(k){return k===45&&i===2?(r.consume(k),R):k===60&&i===1?(r.consume(k),L):k===62&&i===4?(r.consume(k),D):k===63&&i===3?(r.consume(k),P):k===93&&i===5?(r.consume(k),$):Ie(k)&&(i===6||i===7)?(r.exit("htmlFlowData"),r.check(CE,j,X)(k)):k===null||Ie(k)?(r.exit("htmlFlowData"),X(k)):(r.consume(k),S)}function X(k){return r.check(AE,w,j)(k)}function w(k){return r.enter("lineEnding"),r.consume(k),r.exit("lineEnding"),G}function G(k){return k===null||Ie(k)?X(k):(r.enter("htmlFlowData"),S(k))}function R(k){return k===45?(r.consume(k),P):S(k)}function L(k){return k===47?(r.consume(k),a="",N):S(k)}function N(k){if(k===62){const ee=a.toLowerCase();return Cf.includes(ee)?(r.consume(k),D):S(k)}return un(k)&&a.length<8?(r.consume(k),a+=String.fromCharCode(k),N):S(k)}function $(k){return k===93?(r.consume(k),P):S(k)}function P(k){return k===62?(r.consume(k),D):k===45&&i===2?(r.consume(k),P):S(k)}function D(k){return k===null||Ie(k)?(r.exit("htmlFlowData"),j(k)):(r.consume(k),D)}function j(k){return r.exit("htmlFlow"),e(k)}}function ME(r,e,t){const n=this;return i;function i(a){return Ie(a)?(r.enter("lineEnding"),r.consume(a),r.exit("lineEnding"),o):t(a)}function o(a){return n.parser.lazy[n.now().line]?t(a):e(a)}}function kE(r,e,t){return n;function n(i){return r.enter("lineEnding"),r.consume(i),r.exit("lineEnding"),r.attempt(ia,e,t)}}const OE={name:"htmlText",tokenize:RE};function RE(r,e,t){const n=this;let i,o,a;return s;function s(P){return r.enter("htmlText"),r.enter("htmlTextData"),r.consume(P),l}function l(P){return P===33?(r.consume(P),u):P===47?(r.consume(P),x):P===63?(r.consume(P),_):un(P)?(r.consume(P),A):t(P)}function u(P){return P===45?(r.consume(P),c):P===91?(r.consume(P),o=0,g):un(P)?(r.consume(P),y):t(P)}function c(P){return P===45?(r.consume(P),f):t(P)}function h(P){return P===null?t(P):P===45?(r.consume(P),p):Ie(P)?(a=h,L(P)):(r.consume(P),h)}function p(P){return P===45?(r.consume(P),f):h(P)}function f(P){return P===62?R(P):P===45?p(P):h(P)}function g(P){const D="CDATA[";return P===D.charCodeAt(o++)?(r.consume(P),o===D.length?v:g):t(P)}function v(P){return P===null?t(P):P===93?(r.consume(P),d):Ie(P)?(a=v,L(P)):(r.consume(P),v)}function d(P){return P===93?(r.consume(P),m):v(P)}function m(P){return P===62?R(P):P===93?(r.consume(P),m):v(P)}function y(P){return P===null||P===62?R(P):Ie(P)?(a=y,L(P)):(r.consume(P),y)}function _(P){return P===null?t(P):P===63?(r.consume(P),E):Ie(P)?(a=_,L(P)):(r.consume(P),_)}function E(P){return P===62?R(P):_(P)}function x(P){return un(P)?(r.consume(P),b):t(P)}function b(P){return P===45||jt(P)?(r.consume(P),b):C(P)}function C(P){return Ie(P)?(a=C,L(P)):He(P)?(r.consume(P),C):R(P)}function A(P){return P===45||jt(P)?(r.consume(P),A):P===47||P===62||Rt(P)?M(P):t(P)}function M(P){return P===47?(r.consume(P),R):P===58||P===95||un(P)?(r.consume(P),I):Ie(P)?(a=M,L(P)):He(P)?(r.consume(P),M):R(P)}function I(P){return P===45||P===46||P===58||P===95||jt(P)?(r.consume(P),I):F(P)}function F(P){return P===61?(r.consume(P),S):Ie(P)?(a=F,L(P)):He(P)?(r.consume(P),F):M(P)}function S(P){return P===null||P===60||P===61||P===62||P===96?t(P):P===34||P===39?(r.consume(P),i=P,X):Ie(P)?(a=S,L(P)):He(P)?(r.consume(P),S):(r.consume(P),w)}function X(P){return P===i?(r.consume(P),i=void 0,G):P===null?t(P):Ie(P)?(a=X,L(P)):(r.consume(P),X)}function w(P){return P===null||P===34||P===39||P===60||P===61||P===96?t(P):P===47||P===62||Rt(P)?M(P):(r.consume(P),w)}function G(P){return P===47||P===62||Rt(P)?M(P):t(P)}function R(P){return P===62?(r.consume(P),r.exit("htmlTextData"),r.exit("htmlText"),e):t(P)}function L(P){return r.exit("htmlTextData"),r.enter("lineEnding"),r.consume(P),r.exit("lineEnding"),N}function N(P){return He(P)?Qe(r,$,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):$(P)}function $(P){return r.enter("htmlTextData"),a(P)}}const ju={name:"labelEnd",resolveAll:DE,resolveTo:BE,tokenize:UE},FE={tokenize:zE},LE={tokenize:jE},NE={tokenize:VE};function DE(r){let e=-1;const t=[];for(;++e=3&&(u===null||Ie(u))?(r.exit("thematicBreak"),e(u)):t(u)}function l(u){return u===i?(r.consume(u),n++,l):(r.exit("thematicBreakSequence"),He(u)?Qe(r,s,"whitespace")(u):s(u))}}const kt={continuation:{tokenize:JE},exit:eC,name:"list",tokenize:ZE},YE={partial:!0,tokenize:tC},KE={partial:!0,tokenize:QE};function ZE(r,e,t){const n=this,i=n.events[n.events.length-1];let o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,a=0;return s;function s(f){const g=n.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!n.containerState.marker||f===n.containerState.marker:Wl(f)){if(n.containerState.type||(n.containerState.type=g,r.enter(g,{_container:!0})),g==="listUnordered")return r.enter("listItemPrefix"),f===42||f===45?r.check(So,t,u)(f):u(f);if(!n.interrupt||f===49)return r.enter("listItemPrefix"),r.enter("listItemValue"),l(f)}return t(f)}function l(f){return Wl(f)&&++a<10?(r.consume(f),l):(!n.interrupt||a<2)&&(n.containerState.marker?f===n.containerState.marker:f===41||f===46)?(r.exit("listItemValue"),u(f)):t(f)}function u(f){return r.enter("listItemMarker"),r.consume(f),r.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||f,r.check(ia,n.interrupt?t:c,r.attempt(YE,p,h))}function c(f){return n.containerState.initialBlankLine=!0,o++,p(f)}function h(f){return He(f)?(r.enter("listItemPrefixWhitespace"),r.consume(f),r.exit("listItemPrefixWhitespace"),p):t(f)}function p(f){return n.containerState.size=o+n.sliceSerialize(r.exit("listItemPrefix"),!0).length,e(f)}}function JE(r,e,t){const n=this;return n.containerState._closeFlow=void 0,r.check(ia,i,o);function i(s){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,Qe(r,e,"listItemIndent",n.containerState.size+1)(s)}function o(s){return n.containerState.furtherBlankLines||!He(s)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,a(s)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,r.attempt(KE,e,a)(s))}function a(s){return n.containerState._closeFlow=!0,n.interrupt=void 0,Qe(r,r.attempt(kt,e,t),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function QE(r,e,t){const n=this;return Qe(r,i,"listItemIndent",n.containerState.size+1);function i(o){const a=n.events[n.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===n.containerState.size?e(o):t(o)}}function eC(r){r.exit(this.containerState.type)}function tC(r,e,t){const n=this;return Qe(r,i,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const a=n.events[n.events.length-1];return!He(o)&&a&&a[1].type==="listItemPrefixWhitespace"?e(o):t(o)}}const Af={name:"setextUnderline",resolveTo:nC,tokenize:rC};function nC(r,e){let t=r.length,n,i,o;for(;t--;)if(r[t][0]==="enter"){if(r[t][1].type==="content"){n=t;break}r[t][1].type==="paragraph"&&(i=t)}else r[t][1].type==="content"&&r.splice(t,1),!o&&r[t][1].type==="definition"&&(o=t);const a={type:"setextHeading",start:{...r[i][1].start},end:{...r[r.length-1][1].end}};return r[i][1].type="setextHeadingText",o?(r.splice(i,0,["enter",a,e]),r.splice(o+1,0,["exit",r[n][1],e]),r[n][1].end={...r[o][1].end}):r[n][1]=a,r.push(["exit",a,e]),r}function rC(r,e,t){const n=this;let i;return o;function o(u){let c=n.events.length,h;for(;c--;)if(n.events[c][1].type!=="lineEnding"&&n.events[c][1].type!=="linePrefix"&&n.events[c][1].type!=="content"){h=n.events[c][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||h)?(r.enter("setextHeadingLine"),i=u,a(u)):t(u)}function a(u){return r.enter("setextHeadingLineSequence"),s(u)}function s(u){return u===i?(r.consume(u),s):(r.exit("setextHeadingLineSequence"),He(u)?Qe(r,l,"lineSuffix")(u):l(u))}function l(u){return u===null||Ie(u)?(r.exit("setextHeadingLine"),e(u)):t(u)}}const iC={tokenize:oC};function oC(r){const e=this,t=r.attempt(ia,n,r.attempt(this.parser.constructs.flowInitial,i,Qe(r,r.attempt(this.parser.constructs.flow,i,r.attempt(cE,i)),"linePrefix")));return t;function n(o){if(o===null){r.consume(o);return}return r.enter("lineEndingBlank"),r.consume(o),r.exit("lineEndingBlank"),e.currentConstruct=void 0,t}function i(o){if(o===null){r.consume(o);return}return r.enter("lineEnding"),r.consume(o),r.exit("lineEnding"),e.currentConstruct=void 0,t}}const aC={resolveAll:cm()},sC=um("string"),lC=um("text");function um(r){return{resolveAll:cm(r==="text"?uC:void 0),tokenize:e};function e(t){const n=this,i=this.parser.constructs[r],o=t.attempt(i,a,s);return a;function a(c){return u(c)?o(c):s(c)}function s(c){if(c===null){t.consume(c);return}return t.enter("data"),t.consume(c),l}function l(c){return u(c)?(t.exit("data"),o(c)):(t.consume(c),l)}function u(c){if(c===null)return!0;const h=i[c];let p=-1;if(h)for(;++p-1){const s=a[0];typeof s=="string"?a[0]=s.slice(n):a.shift()}o>0&&a.push(r[i].slice(0,o))}return a}function wC(r,e){let t=-1;const n=[];let i;for(;++t0){const Xe=me.tokenStack[me.tokenStack.length-1];(Xe[1]||kf).call(me,void 0,Xe[0])}for(ce.position={start:On(re.length>0?re[0][1].start:{line:1,column:1,offset:0}),end:On(re.length>0?re[re.length-2][1].end:{line:1,column:1,offset:0})},Ce=-1;++Ce1?"-"+s:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};r.patch(e,l);const u={type:"element",tagName:"sup",properties:{},children:[l]};return r.patch(e,u),r.applyData(e,u)}function UC(r,e){const t={type:"element",tagName:"h"+e.depth,properties:{},children:r.all(e)};return r.patch(e,t),r.applyData(e,t)}function zC(r,e){if(r.options.allowDangerousHtml){const t={type:"raw",value:e.value};return r.patch(e,t),r.applyData(e,t)}}function dm(r,e){const t=e.referenceType;let n="]";if(t==="collapsed"?n+="[]":t==="full"&&(n+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+n}];const i=r.all(e),o=i[0];o&&o.type==="text"?o.value="["+o.value:i.unshift({type:"text",value:"["});const a=i[i.length-1];return a&&a.type==="text"?a.value+=n:i.push({type:"text",value:n}),i}function jC(r,e){const t=String(e.identifier).toUpperCase(),n=r.definitionById.get(t);if(!n)return dm(r,e);const i={src:ni(n.url||""),alt:e.alt};n.title!==null&&n.title!==void 0&&(i.title=n.title);const o={type:"element",tagName:"img",properties:i,children:[]};return r.patch(e,o),r.applyData(e,o)}function VC(r,e){const t={src:ni(e.url)};e.alt!==null&&e.alt!==void 0&&(t.alt=e.alt),e.title!==null&&e.title!==void 0&&(t.title=e.title);const n={type:"element",tagName:"img",properties:t,children:[]};return r.patch(e,n),r.applyData(e,n)}function GC(r,e){const t={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};r.patch(e,t);const n={type:"element",tagName:"code",properties:{},children:[t]};return r.patch(e,n),r.applyData(e,n)}function $C(r,e){const t=String(e.identifier).toUpperCase(),n=r.definitionById.get(t);if(!n)return dm(r,e);const i={href:ni(n.url||"")};n.title!==null&&n.title!==void 0&&(i.title=n.title);const o={type:"element",tagName:"a",properties:i,children:r.all(e)};return r.patch(e,o),r.applyData(e,o)}function HC(r,e){const t={href:ni(e.url)};e.title!==null&&e.title!==void 0&&(t.title=e.title);const n={type:"element",tagName:"a",properties:t,children:r.all(e)};return r.patch(e,n),r.applyData(e,n)}function XC(r,e,t){const n=r.all(e),i=t?WC(t):pm(e),o={},a=[];if(typeof e.checked=="boolean"){const c=n[0];let h;c&&c.type==="element"&&c.tagName==="p"?h=c:(h={type:"element",tagName:"p",properties:{},children:[]},n.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let s=-1;for(;++s1}function qC(r,e){const t={},n=r.all(e);let i=-1;for(typeof e.start=="number"&&e.start!==1&&(t.start=e.start);++i0&&typeof n.column=="number"&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset=="number"&&n.offset>-1?n.offset:void 0}}}function JC(r){const e=gm(r),t=mm(r);if(e&&t)return{start:e,end:t}}function QC(r,e){const t=r.all(e),n=t.shift(),i=[];if(n){const a={type:"element",tagName:"thead",properties:{},children:r.wrap([n],!0)};r.patch(e.children[0],a),i.push(a)}if(t.length>0){const a={type:"element",tagName:"tbody",properties:{},children:r.wrap(t,!0)},s=gm(e.children[1]),l=mm(e.children[e.children.length-1]);s&&l&&(a.position={start:s,end:l}),i.push(a)}const o={type:"element",tagName:"table",properties:{},children:r.wrap(i,!0)};return r.patch(e,o),r.applyData(e,o)}function eA(r,e,t){const n=t?t.children:void 0,o=(n?n.indexOf(e):1)===0?"th":"td",a=t&&t.type==="table"?t.align:void 0,s=a?a.length:e.children.length;let l=-1;const u=[];for(;++l0,!0),n[0]),i=n.index+n[0].length,n=t.exec(e);return o.push(Ff(e.slice(i),i>0,!1)),o.join("")}function Ff(r,e,t){let n=0,i=r.length;if(e){let o=r.codePointAt(n);for(;o===Of||o===Rf;)n++,o=r.codePointAt(n)}if(t){let o=r.codePointAt(i-1);for(;o===Of||o===Rf;)i--,o=r.codePointAt(i-1)}return i>n?r.slice(n,i):""}function rA(r,e){const t={type:"text",value:nA(String(e.value))};return r.patch(e,t),r.applyData(e,t)}function iA(r,e){const t={type:"element",tagName:"hr",properties:{},children:[]};return r.patch(e,t),r.applyData(e,t)}const oA={blockquote:RC,break:FC,code:LC,delete:NC,emphasis:DC,footnoteReference:BC,heading:UC,html:zC,imageReference:jC,image:VC,inlineCode:GC,linkReference:$C,link:HC,listItem:XC,list:qC,paragraph:YC,root:KC,strong:ZC,table:QC,tableCell:tA,tableRow:eA,text:rA,thematicBreak:iA,toml:ao,yaml:ao,definition:ao,footnoteDefinition:ao};function ao(){}const ym=-1,oa=0,Go=1,$o=2,Vu=3,Gu=4,$u=5,Hu=6,_m=7,xm=8,Lf=typeof self=="object"?self:globalThis,aA=(r,e)=>{const t=(i,o)=>(r.set(o,i),i),n=i=>{if(r.has(i))return r.get(i);const[o,a]=e[i];switch(o){case oa:case ym:return t(a,i);case Go:{const s=t([],i);for(const l of a)s.push(n(l));return s}case $o:{const s=t({},i);for(const[l,u]of a)s[n(l)]=n(u);return s}case Vu:return t(new Date(a),i);case Gu:{const{source:s,flags:l}=a;return t(new RegExp(s,l),i)}case $u:{const s=t(new Map,i);for(const[l,u]of a)s.set(n(l),n(u));return s}case Hu:{const s=t(new Set,i);for(const l of a)s.add(n(l));return s}case _m:{const{name:s,message:l}=a;return t(new Lf[s](l),i)}case xm:return t(BigInt(a),i);case"BigInt":return t(Object(BigInt(a)),i)}return t(new Lf[o](a),i)};return n},Nf=r=>aA(new Map,r)(0),Rr="",{toString:sA}={},{keys:lA}=Object,hi=r=>{const e=typeof r;if(e!=="object"||!r)return[oa,e];const t=sA.call(r).slice(8,-1);switch(t){case"Array":return[Go,Rr];case"Object":return[$o,Rr];case"Date":return[Vu,Rr];case"RegExp":return[Gu,Rr];case"Map":return[$u,Rr];case"Set":return[Hu,Rr]}return t.includes("Array")?[Go,t]:t.includes("Error")?[_m,t]:[$o,t]},so=([r,e])=>r===oa&&(e==="function"||e==="symbol"),uA=(r,e,t,n)=>{const i=(a,s)=>{const l=n.push(a)-1;return t.set(s,l),l},o=a=>{if(t.has(a))return t.get(a);let[s,l]=hi(a);switch(s){case oa:{let c=a;switch(l){case"bigint":s=xm,c=a.toString();break;case"function":case"symbol":if(r)throw new TypeError("unable to serialize "+l);c=null;break;case"undefined":return i([ym],a)}return i([s,c],a)}case Go:{if(l)return i([l,[...a]],a);const c=[],h=i([s,c],a);for(const p of a)c.push(o(p));return h}case $o:{if(l)switch(l){case"BigInt":return i([l,a.toString()],a);case"Boolean":case"Number":case"String":return i([l,a.valueOf()],a)}if(e&&"toJSON"in a)return o(a.toJSON());const c=[],h=i([s,c],a);for(const p of lA(a))(r||!so(hi(a[p])))&&c.push([o(p),o(a[p])]);return h}case Vu:return i([s,a.toISOString()],a);case Gu:{const{source:c,flags:h}=a;return i([s,{source:c,flags:h}],a)}case $u:{const c=[],h=i([s,c],a);for(const[p,f]of a)(r||!(so(hi(p))||so(hi(f))))&&c.push([o(p),o(f)]);return h}case Hu:{const c=[],h=i([s,c],a);for(const p of a)(r||!so(hi(p)))&&c.push(o(p));return h}}const{message:u}=a;return i([s,{name:l,message:u}],a)};return o},Df=(r,{json:e,lossy:t}={})=>{const n=[];return uA(!(e||t),!!e,new Map,n)(r),n},Ho=typeof structuredClone=="function"?(r,e)=>e&&("json"in e||"lossy"in e)?Nf(Df(r,e)):structuredClone(r):(r,e)=>Nf(Df(r,e));function cA(r,e){const t=[{type:"text",value:"↩"}];return e>1&&t.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),t}function hA(r,e){return"Back to reference "+(r+1)+(e>1?"-"+e:"")}function fA(r){const e=typeof r.options.clobberPrefix=="string"?r.options.clobberPrefix:"user-content-",t=r.options.footnoteBackContent||cA,n=r.options.footnoteBackLabel||hA,i=r.options.footnoteLabel||"Footnotes",o=r.options.footnoteLabelTagName||"h2",a=r.options.footnoteLabelProperties||{className:["sr-only"]},s=[];let l=-1;for(;++l0&&g.push({type:"text",value:" "});let y=typeof t=="string"?t:t(l,f);typeof y=="string"&&(y={type:"text",value:y}),g.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+p+(f>1?"-"+f:""),dataFootnoteBackref:"",ariaLabel:typeof n=="string"?n:n(l,f),className:["data-footnote-backref"]},children:Array.isArray(y)?y:[y]})}const d=c[c.length-1];if(d&&d.type==="element"&&d.tagName==="p"){const y=d.children[d.children.length-1];y&&y.type==="text"?y.value+=" ":d.children.push({type:"text",value:" "}),d.children.push(...g)}else c.push(...g);const m={type:"element",tagName:"li",properties:{id:e+"fn-"+p},children:r.wrap(c,!0)};r.patch(u,m),s.push(m)}if(s.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...Ho(a),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:` +`},{type:"element",tagName:"ol",properties:{},children:r.wrap(s,!0)},{type:"text",value:` +`}]}}const bm=function(r){if(r==null)return gA;if(typeof r=="function")return aa(r);if(typeof r=="object")return Array.isArray(r)?dA(r):pA(r);if(typeof r=="string")return mA(r);throw new Error("Expected function, string, or object as test")};function dA(r){const e=[];let t=-1;for(;++t":""))+")"})}return p;function p(){let f=wm,g,v,d;if((!e||o(l,u,c[c.length-1]||void 0))&&(f=bA(t(l,c)),f[0]===Bf))return f;if("children"in l&&l.children){const m=l;if(m.children&&f[0]!==_A)for(v=(n?m.children.length:-1)+a,d=c.concat(m);v>-1&&v0&&t.push({type:"text",value:` +`}),t}function Uf(r){let e=0,t=r.charCodeAt(e);for(;t===9||t===32;)e++,t=r.charCodeAt(e);return r.slice(e)}function zf(r,e){const t=SA(r,e),n=t.one(r,void 0),i=fA(t),o=Array.isArray(n)?{type:"root",children:n}:n||{type:"root",children:[]};return i&&o.children.push({type:"text",value:` +`},i),o}function PA(r,e){return r&&"run"in r?async function(t,n){const i=zf(t,{file:n,...e});await r.run(i,n)}:function(t,n){return zf(t,{file:n,...r||e})}}function jf(r){if(r)throw r}var Ms,Vf;function MA(){if(Vf)return Ms;Vf=1;var r=Object.prototype.hasOwnProperty,e=Object.prototype.toString,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,i=function(u){return typeof Array.isArray=="function"?Array.isArray(u):e.call(u)==="[object Array]"},o=function(u){if(!u||e.call(u)!=="[object Object]")return!1;var c=r.call(u,"constructor"),h=u.constructor&&u.constructor.prototype&&r.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!c&&!h)return!1;var p;for(p in u);return typeof p>"u"||r.call(u,p)},a=function(u,c){t&&c.name==="__proto__"?t(u,c.name,{enumerable:!0,configurable:!0,value:c.newValue,writable:!0}):u[c.name]=c.newValue},s=function(u,c){if(c==="__proto__")if(r.call(u,c)){if(n)return n(u,c).value}else return;return u[c]};return Ms=function l(){var u,c,h,p,f,g,v=arguments[0],d=1,m=arguments.length,y=!1;for(typeof v=="boolean"&&(y=v,v=arguments[1]||{},d=2),(v==null||typeof v!="object"&&typeof v!="function")&&(v={});da.length;let l;s&&a.push(i);try{l=r.apply(this,a)}catch(u){const c=u;if(s&&t)throw c;return i(c)}s||(l&&l.then&&typeof l.then=="function"?l.then(o,i):l instanceof Error?i(l):o(l))}function i(a,...s){t||(t=!0,e(a,...s))}function o(a){i(null,a)}}class Ft extends Error{constructor(e,t,n){super(),typeof t=="string"&&(n=t,t=void 0);let i="",o={},a=!1;if(t&&("line"in t&&"column"in t?o={place:t}:"start"in t&&"end"in t?o={place:t}:"type"in t?o={ancestors:[t],place:t.position}:o={...t}),typeof e=="string"?i=e:!o.cause&&e&&(a=!0,i=e.message,o.cause=e),!o.ruleId&&!o.source&&typeof n=="string"){const l=n.indexOf(":");l===-1?o.ruleId=n:(o.source=n.slice(0,l),o.ruleId=n.slice(l+1))}if(!o.place&&o.ancestors&&o.ancestors){const l=o.ancestors[o.ancestors.length-1];l&&(o.place=l.position)}const s=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file,this.message=i,this.line=s?s.line:void 0,this.name=Ti(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=a&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual,this.expected,this.note,this.url}}Ft.prototype.file="";Ft.prototype.name="";Ft.prototype.reason="";Ft.prototype.message="";Ft.prototype.stack="";Ft.prototype.column=void 0;Ft.prototype.line=void 0;Ft.prototype.ancestors=void 0;Ft.prototype.cause=void 0;Ft.prototype.fatal=void 0;Ft.prototype.place=void 0;Ft.prototype.ruleId=void 0;Ft.prototype.source=void 0;const sn={basename:FA,dirname:LA,extname:NA,join:DA,sep:"/"};function FA(r,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Bi(r);let t=0,n=-1,i=r.length,o;if(e===void 0||e.length===0||e.length>r.length){for(;i--;)if(r.codePointAt(i)===47){if(o){t=i+1;break}}else n<0&&(o=!0,n=i+1);return n<0?"":r.slice(t,n)}if(e===r)return"";let a=-1,s=e.length-1;for(;i--;)if(r.codePointAt(i)===47){if(o){t=i+1;break}}else a<0&&(o=!0,a=i+1),s>-1&&(r.codePointAt(i)===e.codePointAt(s--)?s<0&&(n=i):(s=-1,n=a));return t===n?n=a:n<0&&(n=r.length),r.slice(t,n)}function LA(r){if(Bi(r),r.length===0)return".";let e=-1,t=r.length,n;for(;--t;)if(r.codePointAt(t)===47){if(n){e=t;break}}else n||(n=!0);return e<0?r.codePointAt(0)===47?"/":".":e===1&&r.codePointAt(0)===47?"//":r.slice(0,e)}function NA(r){Bi(r);let e=r.length,t=-1,n=0,i=-1,o=0,a;for(;e--;){const s=r.codePointAt(e);if(s===47){if(a){n=e+1;break}continue}t<0&&(a=!0,t=e+1),s===46?i<0?i=e:o!==1&&(o=1):i>-1&&(o=-1)}return i<0||t<0||o===0||o===1&&i===t-1&&i===n+1?"":r.slice(i,t)}function DA(...r){let e=-1,t;for(;++e0&&r.codePointAt(r.length-1)===47&&(t+="/"),e?"/"+t:t}function UA(r,e){let t="",n=0,i=-1,o=0,a=-1,s,l;for(;++a<=r.length;){if(a2){if(l=t.lastIndexOf("/"),l!==t.length-1){l<0?(t="",n=0):(t=t.slice(0,l),n=t.length-1-t.lastIndexOf("/")),i=a,o=0;continue}}else if(t.length>0){t="",n=0,i=a,o=0;continue}}e&&(t=t.length>0?t+"/..":"..",n=2)}else t.length>0?t+="/"+r.slice(i+1,a):t=r.slice(i+1,a),n=a-i-1;i=a,o=0}else s===46&&o>-1?o++:o=-1}return t}function Bi(r){if(typeof r!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(r))}const zA={cwd:jA};function jA(){return"/"}function Jl(r){return!!(r!==null&&typeof r=="object"&&"href"in r&&r.href&&"protocol"in r&&r.protocol&&r.auth===void 0)}function VA(r){if(typeof r=="string")r=new URL(r);else if(!Jl(r)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+r+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(r.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return GA(r)}function GA(r){if(r.hostname!==""){const n=new TypeError('File URL host must be "localhost" or empty on darwin');throw n.code="ERR_INVALID_FILE_URL_HOST",n}const e=r.pathname;let t=-1;for(;++t0){let[f,...g]=c;const v=n[p][1];Zl(v)&&Zl(f)&&(f=ks(!0,v,f)),n[p]=[u,f,...g]}}}}const qA=new Xu().freeze();function Ls(r,e){if(typeof e!="function")throw new TypeError("Cannot `"+r+"` without `parser`")}function Ns(r,e){if(typeof e!="function")throw new TypeError("Cannot `"+r+"` without `compiler`")}function Ds(r,e){if(e)throw new Error("Cannot call `"+r+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function $f(r){if(!Zl(r)||typeof r.type!="string")throw new TypeError("Expected node, got `"+r+"`")}function Hf(r,e,t){if(!t)throw new Error("`"+r+"` finished async. Use `"+e+"` instead")}function lo(r){return YA(r)?r:new $A(r)}function YA(r){return!!(r&&typeof r=="object"&&"message"in r&&"messages"in r)}function KA(r){return typeof r=="string"||ZA(r)}function ZA(r){return!!(r&&typeof r=="object"&&"byteLength"in r&&"byteOffset"in r)}function Wu(){const r=qA().use(OC).use(PA).use(C2);return{process:e=>r.processSync(e).toString()}}function JA(r,e){return{role:"system",content:[r,sv.map(t=>`- ${t}`).join(` +`),e].join(` + +`)}}function QA(r){const e=new Uint8Array(r.frequencyBinCount);r.getByteFrequencyData(e);const t=[];for(let i=0;i<700;i+=80)t.push(e[i]);return e.map(i=>i**1.2).map(i=>i*1.2).reduce((i,o)=>i+o,0)/e.length/100}function eI(r){const e=new Uint8Array(r.frequencyBinCount);r.getByteFrequencyData(e);const t=[];for(let u=0;u<700;u+=80)t.push(e[u]);const n=e.map(u=>u**1.5),i=Math.min(...n),a=Math.max(...n)-i;let s;return a===0?s=n.map(()=>0):s=n.map(u=>(u-i)/a),s.reduce((u,c)=>u+c,0)/e.length}function tI(r,e="linear"){switch(e){case"linear":return QA(r);case"minmax":return eI(r)}}const Tm=Zo("AudioContext",()=>({audioContext:new AudioContext,calculateVolume:tI})),nI=Zo("SpeakingStore",()=>{const t=le(0),n=le(!1),i=Ve(()=>n.value?(30+70*t.value)/100:30);return{mouthOpenSize:t,nowSpeaking:n,nowSpeakingAvatarBorderOpacity:i}});function uo(r,e,t){return e+t<0||e+t>=r.length-1?"":r[e+t]}function rI(r){let e="literal",t="";return{async consume(n){var i,o,a;for(let s=0;s"?(l+=uo(n,s,1),u="literal",s++):l==="<"?u="special":l===">"&&(u="literal"),e==="literal"&&u==="special"?t!==""&&(await((i=r.onLiteral)==null?void 0:i.call(r,t)),t=""):e==="special"&&u==="literal"&&t!==""&&(t+=l,await((o=r.onSpecial)==null?void 0:o.call(r,t)),t=""),e==="literal"&&u==="literal"?(await((a=r.onLiteral)==null?void 0:a.call(r,l)),t=""):e==="special"&&u==="literal"?t="":t+=l,e=u}},async end(){var n,i;t!==""&&(e==="literal"?await((n=r.onLiteral)==null?void 0:n.call(r,t)):t.endsWith("|>")&&await((i=r.onSpecial)==null?void 0:i.call(r,t)))}}}const iI=async r=>await(r.fetch??globalThis.fetch)(Fu("models",r.baseURL),{headers:Ru({"Content-Type":"application/json",...r.headers},r.apiKey),signal:r.abortSignal}).then(aS).then(({data:e})=>e),oI=async r=>{var e;return await(r.fetch??globalThis.fetch)(Fu("chat/completions",r.baseURL),{body:Bp({...r,tools:(e=r.tools)==null?void 0:e.map(t=>({function:t.function,type:"function"}))}),headers:Ru({"Content-Type":"application/json",...r.headers},r.apiKey),method:"POST",signal:r.abortSignal}).then(Lu)},Xf="data: ",aI='{"error":',sI=async r=>await oI({...r,stream:!0}).then(async e=>{const t=new TextDecoder;let n,i,o="";const a=e.body.pipeThrough(new TransformStream({transform:(c,h)=>{o+=t.decode(c);const p=o.split(` + +`);o=p.pop()||"";for(const f of p){if(!f||!f.startsWith(Xf))continue;if(f.startsWith(aI)){h.error(new Error(`Error from server: ${f}`));break}const g=f.slice(Xf.length);if(g==="[DONE]"){h.terminate();break}const v=JSON.parse(g);h.enqueue(v),v.choices[0].finish_reason&&(n=v.choices[0].finish_reason),v.usage&&(i=v.usage)}}})),[s,l]=a.tee(),u=l.pipeThrough(new TransformStream({transform:(c,h)=>h.enqueue(c.choices[0].delta.content)}));return{chunkStream:s,finishReason:n,textStream:u,usage:i}}),qu=Zo("llm",()=>{async function r(t,n,i,o){return await sI({baseURL:t.endsWith("/")?t:`${t}/`,apiKey:n,model:i,messages:o,streamOptions:{usage:!0}})}async function e(t,n){if(t==="")return[];try{return await iI({baseURL:t.endsWith("/")?t:`${t}/`,apiKey:n})}catch(i){if(String(i).includes("Failed to construct 'URL': Invalid URL"))return[];throw i}}return{models:e,stream:r}});async function*lI(r,e){const t=r.getReader();try{for(;;){const{done:n,value:i}=await t.read();if(n)return;yield e(i)}}finally{t.releaseLock()}}const yr=Zo("chat",()=>{const{stream:r}=qu(),{t:e}=Zr(),{openAiApiBaseURL:t,openAiApiKey:n,openAiModel:i}=Cn(Jr()),o=le([]),a=le([]),s=le([]),l=le([]),u=le([]),c=le([]),h=le([]);function p(b){o.value.push(b)}function f(b){a.value.push(b)}function g(b){s.value.push(b)}function v(b){l.value.push(b)}function d(b){u.value.push(b)}function m(b){c.value.push(b)}function y(b){h.value.push(b)}const _=le([JA(e("prompt.prefix"),e("prompt.suffix"))]),E=le({role:"assistant",content:""});async function x(b,C){if(!b)return;for(const G of o.value)await G(b);const{baseUrl:A=t.value,apiKey:M=n.value,model:I=i.value}=C??{};E.value={role:"assistant",content:""},_.value.push({role:"user",content:b}),_.value.push(E.value);const F=_.value.slice(0,_.value.length-1);for(const G of a.value)await G(b);for(const G of s.value)await G(b);const S=await r(A,M,I.id,F);for(const G of l.value)await G(b);let X="";const w=rI({onLiteral:async G=>{for(const R of u.value)await R(G);E.value.content+=G},onSpecial:async G=>{for(const R of c.value)await R(G)}});for await(const G of lI(S.textStream,async R=>R))X+=G,await w.consume(G);await w.end();for(const G of h.value)await G();console.debug("LLM output:",X)}return{messages:_,streamingMessage:E,send:x,onBeforeMessageComposed:p,onAfterMessageComposed:f,onBeforeSend:g,onAfterSend:v,onTokenLiteral:d,onTokenSpecial:m,onStreamEnd:y}});function co(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Bs={exports:{}};/*! + +JSZip v3.10.1 - A JavaScript class for generating and reading zip files + + +(c) 2009-2016 Stuart Knightley +Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown. + +JSZip uses the library pako released under the MIT license : +https://github.com/nodeca/pako/blob/main/LICENSE +*/var Wf;function uI(){return Wf||(Wf=1,function(r,e){(function(t){r.exports=t()})(function(){return function t(n,i,o){function a(u,c){if(!i[u]){if(!n[u]){var h=typeof co=="function"&&co;if(!c&&h)return h(u,!0);if(s)return s(u,!0);var p=new Error("Cannot find module '"+u+"'");throw p.code="MODULE_NOT_FOUND",p}var f=i[u]={exports:{}};n[u][0].call(f.exports,function(g){var v=n[u][1][g];return a(v||g)},f,f.exports,t,n,i,o)}return i[u].exports}for(var s=typeof co=="function"&&co,l=0;l>2,f=(3&u)<<4|c>>4,g=1<_?(15&c)<<2|h>>6:64,v=2<_?63&h:64,d.push(s.charAt(p)+s.charAt(f)+s.charAt(g)+s.charAt(v));return d.join("")},i.decode=function(l){var u,c,h,p,f,g,v=0,d=0,m="data:";if(l.substr(0,m.length)===m)throw new Error("Invalid base64 input, it looks like a data url.");var y,_=3*(l=l.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(l.charAt(l.length-1)===s.charAt(64)&&_--,l.charAt(l.length-2)===s.charAt(64)&&_--,_%1!=0)throw new Error("Invalid base64 input, bad content length.");for(y=a.uint8array?new Uint8Array(0|_):new Array(0|_);v>4,c=(15&p)<<4|(f=s.indexOf(l.charAt(v++)))>>2,h=(3&f)<<6|(g=s.indexOf(l.charAt(v++))),y[d++]=u,f!==64&&(y[d++]=c),g!==64&&(y[d++]=h);return y}},{"./support":30,"./utils":32}],2:[function(t,n,i){var o=t("./external"),a=t("./stream/DataWorker"),s=t("./stream/Crc32Probe"),l=t("./stream/DataLengthProbe");function u(c,h,p,f,g){this.compressedSize=c,this.uncompressedSize=h,this.crc32=p,this.compression=f,this.compressedContent=g}u.prototype={getContentWorker:function(){var c=new a(o.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),h=this;return c.on("end",function(){if(this.streamInfo.data_length!==h.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),c},getCompressedWorker:function(){return new a(o.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(c,h,p){return c.pipe(new s).pipe(new l("uncompressedSize")).pipe(h.compressWorker(p)).pipe(new l("compressedSize")).withStreamInfo("compression",h)},n.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,n,i){var o=t("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new o("STORE compression")},uncompressWorker:function(){return new o("STORE decompression")}},i.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,n,i){var o=t("./utils"),a=function(){for(var s,l=[],u=0;u<256;u++){s=u;for(var c=0;c<8;c++)s=1&s?3988292384^s>>>1:s>>>1;l[u]=s}return l}();n.exports=function(s,l){return s!==void 0&&s.length?o.getTypeOf(s)!=="string"?function(u,c,h,p){var f=a,g=p+h;u^=-1;for(var v=p;v>>8^f[255&(u^c[v])];return-1^u}(0|l,s,s.length,0):function(u,c,h,p){var f=a,g=p+h;u^=-1;for(var v=p;v>>8^f[255&(u^c.charCodeAt(v))];return-1^u}(0|l,s,s.length,0):0}},{"./utils":32}],5:[function(t,n,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(t,n,i){var o=null;o=typeof Promise<"u"?Promise:t("lie"),n.exports={Promise:o}},{lie:37}],7:[function(t,n,i){var o=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",a=t("pako"),s=t("./utils"),l=t("./stream/GenericWorker"),u=o?"uint8array":"array";function c(h,p){l.call(this,"FlateWorker/"+h),this._pako=null,this._pakoAction=h,this._pakoOptions=p,this.meta={}}i.magic="\b\0",s.inherits(c,l),c.prototype.processChunk=function(h){this.meta=h.meta,this._pako===null&&this._createPako(),this._pako.push(s.transformTo(u,h.data),!1)},c.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},c.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},c.prototype._createPako=function(){this._pako=new a[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var h=this;this._pako.onData=function(p){h.push({data:p,meta:h.meta})}},i.compressWorker=function(h){return new c("Deflate",h)},i.uncompressWorker=function(){return new c("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,n,i){function o(f,g){var v,d="";for(v=0;v>>=8;return d}function a(f,g,v,d,m,y){var _,E,x=f.file,b=f.compression,C=y!==u.utf8encode,A=s.transformTo("string",y(x.name)),M=s.transformTo("string",u.utf8encode(x.name)),I=x.comment,F=s.transformTo("string",y(I)),S=s.transformTo("string",u.utf8encode(I)),X=M.length!==x.name.length,w=S.length!==I.length,G="",R="",L="",N=x.dir,$=x.date,P={crc32:0,compressedSize:0,uncompressedSize:0};g&&!v||(P.crc32=f.crc32,P.compressedSize=f.compressedSize,P.uncompressedSize=f.uncompressedSize);var D=0;g&&(D|=8),C||!X&&!w||(D|=2048);var j=0,k=0;N&&(j|=16),m==="UNIX"?(k=798,j|=function(Q,ue){var de=Q;return Q||(de=ue?16893:33204),(65535&de)<<16}(x.unixPermissions,N)):(k=20,j|=function(Q){return 63&(Q||0)}(x.dosPermissions)),_=$.getUTCHours(),_<<=6,_|=$.getUTCMinutes(),_<<=5,_|=$.getUTCSeconds()/2,E=$.getUTCFullYear()-1980,E<<=4,E|=$.getUTCMonth()+1,E<<=5,E|=$.getUTCDate(),X&&(R=o(1,1)+o(c(A),4)+M,G+="up"+o(R.length,2)+R),w&&(L=o(1,1)+o(c(F),4)+S,G+="uc"+o(L.length,2)+L);var ee="";return ee+=` +\0`,ee+=o(D,2),ee+=b.magic,ee+=o(_,2),ee+=o(E,2),ee+=o(P.crc32,4),ee+=o(P.compressedSize,4),ee+=o(P.uncompressedSize,4),ee+=o(A.length,2),ee+=o(G.length,2),{fileRecord:h.LOCAL_FILE_HEADER+ee+A+G,dirRecord:h.CENTRAL_FILE_HEADER+o(k,2)+ee+o(F.length,2)+"\0\0\0\0"+o(j,4)+o(d,4)+A+G+F}}var s=t("../utils"),l=t("../stream/GenericWorker"),u=t("../utf8"),c=t("../crc32"),h=t("../signature");function p(f,g,v,d){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=g,this.zipPlatform=v,this.encodeFileName=d,this.streamFiles=f,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}s.inherits(p,l),p.prototype.push=function(f){var g=f.meta.percent||0,v=this.entriesCount,d=this._sources.length;this.accumulate?this.contentBuffer.push(f):(this.bytesWritten+=f.data.length,l.prototype.push.call(this,{data:f.data,meta:{currentFile:this.currentFile,percent:v?(g+100*(v-d-1))/v:100}}))},p.prototype.openedSource=function(f){this.currentSourceOffset=this.bytesWritten,this.currentFile=f.file.name;var g=this.streamFiles&&!f.file.dir;if(g){var v=a(f,g,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:v.fileRecord,meta:{percent:0}})}else this.accumulate=!0},p.prototype.closedSource=function(f){this.accumulate=!1;var g=this.streamFiles&&!f.file.dir,v=a(f,g,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(v.dirRecord),g)this.push({data:function(d){return h.DATA_DESCRIPTOR+o(d.crc32,4)+o(d.compressedSize,4)+o(d.uncompressedSize,4)}(f),meta:{percent:100}});else for(this.push({data:v.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},p.prototype.flush=function(){for(var f=this.bytesWritten,g=0;g=this.index;l--)u=(u<<8)+this.byteAt(l);return this.index+=s,u},readString:function(s){return o.transformTo("string",this.readData(s))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var s=this.readInt(4);return new Date(Date.UTC(1980+(s>>25&127),(s>>21&15)-1,s>>16&31,s>>11&31,s>>5&63,(31&s)<<1))}},n.exports=a},{"../utils":32}],19:[function(t,n,i){var o=t("./Uint8ArrayReader");function a(s){o.call(this,s)}t("../utils").inherits(a,o),a.prototype.readData=function(s){this.checkOffset(s);var l=this.data.slice(this.zero+this.index,this.zero+this.index+s);return this.index+=s,l},n.exports=a},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,n,i){var o=t("./DataReader");function a(s){o.call(this,s)}t("../utils").inherits(a,o),a.prototype.byteAt=function(s){return this.data.charCodeAt(this.zero+s)},a.prototype.lastIndexOfSignature=function(s){return this.data.lastIndexOf(s)-this.zero},a.prototype.readAndCheckSignature=function(s){return s===this.readData(4)},a.prototype.readData=function(s){this.checkOffset(s);var l=this.data.slice(this.zero+this.index,this.zero+this.index+s);return this.index+=s,l},n.exports=a},{"../utils":32,"./DataReader":18}],21:[function(t,n,i){var o=t("./ArrayReader");function a(s){o.call(this,s)}t("../utils").inherits(a,o),a.prototype.readData=function(s){if(this.checkOffset(s),s===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+s);return this.index+=s,l},n.exports=a},{"../utils":32,"./ArrayReader":17}],22:[function(t,n,i){var o=t("../utils"),a=t("../support"),s=t("./ArrayReader"),l=t("./StringReader"),u=t("./NodeBufferReader"),c=t("./Uint8ArrayReader");n.exports=function(h){var p=o.getTypeOf(h);return o.checkSupport(p),p!=="string"||a.uint8array?p==="nodebuffer"?new u(h):a.uint8array?new c(o.transformTo("uint8array",h)):new s(o.transformTo("array",h)):new l(h)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,n,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(t,n,i){var o=t("./GenericWorker"),a=t("../utils");function s(l){o.call(this,"ConvertWorker to "+l),this.destType=l}a.inherits(s,o),s.prototype.processChunk=function(l){this.push({data:a.transformTo(this.destType,l.data),meta:l.meta})},n.exports=s},{"../utils":32,"./GenericWorker":28}],25:[function(t,n,i){var o=t("./GenericWorker"),a=t("../crc32");function s(){o.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(s,o),s.prototype.processChunk=function(l){this.streamInfo.crc32=a(l.data,this.streamInfo.crc32||0),this.push(l)},n.exports=s},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,n,i){var o=t("../utils"),a=t("./GenericWorker");function s(l){a.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}o.inherits(s,a),s.prototype.processChunk=function(l){if(l){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+l.data.length}a.prototype.processChunk.call(this,l)},n.exports=s},{"../utils":32,"./GenericWorker":28}],27:[function(t,n,i){var o=t("../utils"),a=t("./GenericWorker");function s(l){a.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(c){u.dataIsReady=!0,u.data=c,u.max=c&&c.length||0,u.type=o.getTypeOf(c),u.isPaused||u._tickAndRepeat()},function(c){u.error(c)})}o.inherits(s,a),s.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this.data=null},s.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,o.delay(this._tickAndRepeat,[],this)),!0)},s.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(o.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},s.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,u);break;case"uint8array":l=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":l=this.data.slice(this.index,u)}return this.index=u,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},n.exports=s},{"../utils":32,"./GenericWorker":28}],28:[function(t,n,i){function o(a){this.name=a||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}o.prototype={push:function(a){this.emit("data",a)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(a){this.emit("error",a)}return!0},error:function(a){return!this.isFinished&&(this.isPaused?this.generatedError=a:(this.isFinished=!0,this.emit("error",a),this.previous&&this.previous.error(a),this.cleanUp()),!0)},on:function(a,s){return this._listeners[a].push(s),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(a,s){if(this._listeners[a])for(var l=0;l "+a:a}},n.exports=o},{}],29:[function(t,n,i){var o=t("../utils"),a=t("./ConvertWorker"),s=t("./GenericWorker"),l=t("../base64"),u=t("../support"),c=t("../external"),h=null;if(u.nodestream)try{h=t("../nodejs/NodejsStreamOutputAdapter")}catch{}function p(g,v){return new c.Promise(function(d,m){var y=[],_=g._internalType,E=g._outputType,x=g._mimeType;g.on("data",function(b,C){y.push(b),v&&v(C)}).on("error",function(b){y=[],m(b)}).on("end",function(){try{var b=function(C,A,M){switch(C){case"blob":return o.newBlob(o.transformTo("arraybuffer",A),M);case"base64":return l.encode(A);default:return o.transformTo(C,A)}}(E,function(C,A){var M,I=0,F=null,S=0;for(M=0;M"u")i.blob=!1;else{var o=new ArrayBuffer(0);try{i.blob=new Blob([o],{type:"application/zip"}).size===0}catch{try{var a=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);a.append(o),i.blob=a.getBlob("application/zip").size===0}catch{i.blob=!1}}}try{i.nodestream=!!t("readable-stream").Readable}catch{i.nodestream=!1}},{"readable-stream":16}],31:[function(t,n,i){for(var o=t("./utils"),a=t("./support"),s=t("./nodejsUtils"),l=t("./stream/GenericWorker"),u=new Array(256),c=0;c<256;c++)u[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;u[254]=u[254]=1;function h(){l.call(this,"utf-8 decode"),this.leftOver=null}function p(){l.call(this,"utf-8 encode")}i.utf8encode=function(f){return a.nodebuffer?s.newBufferFrom(f,"utf-8"):function(g){var v,d,m,y,_,E=g.length,x=0;for(y=0;y>>6:(d<65536?v[_++]=224|d>>>12:(v[_++]=240|d>>>18,v[_++]=128|d>>>12&63),v[_++]=128|d>>>6&63),v[_++]=128|63&d);return v}(f)},i.utf8decode=function(f){return a.nodebuffer?o.transformTo("nodebuffer",f).toString("utf-8"):function(g){var v,d,m,y,_=g.length,E=new Array(2*_);for(v=d=0;v<_;)if((m=g[v++])<128)E[d++]=m;else if(4<(y=u[m]))E[d++]=65533,v+=y-1;else{for(m&=y===2?31:y===3?15:7;1>10&1023,E[d++]=56320|1023&m)}return E.length!==d&&(E.subarray?E=E.subarray(0,d):E.length=d),o.applyFromCharCode(E)}(f=o.transformTo(a.uint8array?"uint8array":"array",f))},o.inherits(h,l),h.prototype.processChunk=function(f){var g=o.transformTo(a.uint8array?"uint8array":"array",f.data);if(this.leftOver&&this.leftOver.length){if(a.uint8array){var v=g;(g=new Uint8Array(v.length+this.leftOver.length)).set(this.leftOver,0),g.set(v,this.leftOver.length)}else g=this.leftOver.concat(g);this.leftOver=null}var d=function(y,_){var E;for((_=_||y.length)>y.length&&(_=y.length),E=_-1;0<=E&&(192&y[E])==128;)E--;return E<0||E===0?_:E+u[y[E]]>_?E:_}(g),m=g;d!==g.length&&(a.uint8array?(m=g.subarray(0,d),this.leftOver=g.subarray(d,g.length)):(m=g.slice(0,d),this.leftOver=g.slice(d,g.length))),this.push({data:i.utf8decode(m),meta:f.meta})},h.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=h,o.inherits(p,l),p.prototype.processChunk=function(f){this.push({data:i.utf8encode(f.data),meta:f.meta})},i.Utf8EncodeWorker=p},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,n,i){var o=t("./support"),a=t("./base64"),s=t("./nodejsUtils"),l=t("./external");function u(v){return v}function c(v,d){for(var m=0;m>8;this.dir=!!(16&this.externalFileAttributes),f==0&&(this.dosPermissions=63&this.externalFileAttributes),f==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var f=o(this.extraFields[1].value);this.uncompressedSize===a.MAX_VALUE_32BITS&&(this.uncompressedSize=f.readInt(8)),this.compressedSize===a.MAX_VALUE_32BITS&&(this.compressedSize=f.readInt(8)),this.localHeaderOffset===a.MAX_VALUE_32BITS&&(this.localHeaderOffset=f.readInt(8)),this.diskNumberStart===a.MAX_VALUE_32BITS&&(this.diskNumberStart=f.readInt(4))}},readExtraFields:function(f){var g,v,d,m=f.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});f.index+4>>6:(f<65536?p[d++]=224|f>>>12:(p[d++]=240|f>>>18,p[d++]=128|f>>>12&63),p[d++]=128|f>>>6&63),p[d++]=128|63&f);return p},i.buf2binstring=function(h){return c(h,h.length)},i.binstring2buf=function(h){for(var p=new o.Buf8(h.length),f=0,g=p.length;f>10&1023,y[g++]=56320|1023&v)}return c(y,g)},i.utf8border=function(h,p){var f;for((p=p||h.length)>h.length&&(p=h.length),f=p-1;0<=f&&(192&h[f])==128;)f--;return f<0||f===0?p:f+l[h[f]]>p?f:p}},{"./common":41}],43:[function(t,n,i){n.exports=function(o,a,s,l){for(var u=65535&o|0,c=o>>>16&65535|0,h=0;s!==0;){for(s-=h=2e3>>1:a>>>1;s[l]=a}return s}();n.exports=function(a,s,l,u){var c=o,h=u+l;a^=-1;for(var p=u;p>>8^c[255&(a^s[p])];return-1^a}},{}],46:[function(t,n,i){var o,a=t("../utils/common"),s=t("./trees"),l=t("./adler32"),u=t("./crc32"),c=t("./messages"),h=0,p=4,f=0,g=-2,v=-1,d=4,m=2,y=8,_=9,E=286,x=30,b=19,C=2*E+1,A=15,M=3,I=258,F=I+M+1,S=42,X=113,w=1,G=2,R=3,L=4;function N(T,J){return T.msg=c[J],J}function $(T){return(T<<1)-(4T.avail_out&&(H=T.avail_out),H!==0&&(a.arraySet(T.output,J.pending_buf,J.pending_out,H,T.next_out),T.next_out+=H,J.pending_out+=H,T.total_out+=H,T.avail_out-=H,J.pending-=H,J.pending===0&&(J.pending_out=0))}function j(T,J){s._tr_flush_block(T,0<=T.block_start?T.block_start:-1,T.strstart-T.block_start,J),T.block_start=T.strstart,D(T.strm)}function k(T,J){T.pending_buf[T.pending++]=J}function ee(T,J){T.pending_buf[T.pending++]=J>>>8&255,T.pending_buf[T.pending++]=255&J}function Q(T,J){var H,z,V=T.max_chain_length,Z=T.strstart,ae=T.prev_length,se=T.nice_match,te=T.strstart>T.w_size-F?T.strstart-(T.w_size-F):0,he=T.window,ye=T.w_mask,pe=T.prev,re=T.strstart+I,ce=he[Z+ae-1],me=he[Z+ae];T.prev_length>=T.good_match&&(V>>=2),se>T.lookahead&&(se=T.lookahead);do if(he[(H=J)+ae]===me&&he[H+ae-1]===ce&&he[H]===he[Z]&&he[++H]===he[Z+1]){Z+=2,H++;do;while(he[++Z]===he[++H]&&he[++Z]===he[++H]&&he[++Z]===he[++H]&&he[++Z]===he[++H]&&he[++Z]===he[++H]&&he[++Z]===he[++H]&&he[++Z]===he[++H]&&he[++Z]===he[++H]&&Zte&&--V!=0);return ae<=T.lookahead?ae:T.lookahead}function ue(T){var J,H,z,V,Z,ae,se,te,he,ye,pe=T.w_size;do{if(V=T.window_size-T.lookahead-T.strstart,T.strstart>=pe+(pe-F)){for(a.arraySet(T.window,T.window,pe,pe,0),T.match_start-=pe,T.strstart-=pe,T.block_start-=pe,J=H=T.hash_size;z=T.head[--J],T.head[J]=pe<=z?z-pe:0,--H;);for(J=H=pe;z=T.prev[--J],T.prev[J]=pe<=z?z-pe:0,--H;);V+=pe}if(T.strm.avail_in===0)break;if(ae=T.strm,se=T.window,te=T.strstart+T.lookahead,he=V,ye=void 0,ye=ae.avail_in,he=M)for(Z=T.strstart-T.insert,T.ins_h=T.window[Z],T.ins_h=(T.ins_h<=M&&(T.ins_h=(T.ins_h<=M)if(z=s._tr_tally(T,T.strstart-T.match_start,T.match_length-M),T.lookahead-=T.match_length,T.match_length<=T.max_lazy_match&&T.lookahead>=M){for(T.match_length--;T.strstart++,T.ins_h=(T.ins_h<=M&&(T.ins_h=(T.ins_h<=M&&T.match_length<=T.prev_length){for(V=T.strstart+T.lookahead-M,z=s._tr_tally(T,T.strstart-1-T.prev_match,T.prev_length-M),T.lookahead-=T.prev_length-1,T.prev_length-=2;++T.strstart<=V&&(T.ins_h=(T.ins_h<T.pending_buf_size-5&&(H=T.pending_buf_size-5);;){if(T.lookahead<=1){if(ue(T),T.lookahead===0&&J===h)return w;if(T.lookahead===0)break}T.strstart+=T.lookahead,T.lookahead=0;var z=T.block_start+H;if((T.strstart===0||T.strstart>=z)&&(T.lookahead=T.strstart-z,T.strstart=z,j(T,!1),T.strm.avail_out===0)||T.strstart-T.block_start>=T.w_size-F&&(j(T,!1),T.strm.avail_out===0))return w}return T.insert=0,J===p?(j(T,!0),T.strm.avail_out===0?R:L):(T.strstart>T.block_start&&(j(T,!1),T.strm.avail_out),w)}),new O(4,4,8,4,de),new O(4,5,16,8,de),new O(4,6,32,32,de),new O(4,4,16,16,ne),new O(8,16,32,32,ne),new O(8,16,128,128,ne),new O(8,32,128,256,ne),new O(32,128,258,1024,ne),new O(32,258,258,4096,ne)],i.deflateInit=function(T,J){return ie(T,J,y,15,8,0)},i.deflateInit2=ie,i.deflateReset=oe,i.deflateResetKeep=W,i.deflateSetHeader=function(T,J){return T&&T.state?T.state.wrap!==2?g:(T.state.gzhead=J,f):g},i.deflate=function(T,J){var H,z,V,Z;if(!T||!T.state||5>8&255),k(z,z.gzhead.time>>16&255),k(z,z.gzhead.time>>24&255),k(z,z.level===9?2:2<=z.strategy||z.level<2?4:0),k(z,255&z.gzhead.os),z.gzhead.extra&&z.gzhead.extra.length&&(k(z,255&z.gzhead.extra.length),k(z,z.gzhead.extra.length>>8&255)),z.gzhead.hcrc&&(T.adler=u(T.adler,z.pending_buf,z.pending,0)),z.gzindex=0,z.status=69):(k(z,0),k(z,0),k(z,0),k(z,0),k(z,0),k(z,z.level===9?2:2<=z.strategy||z.level<2?4:0),k(z,3),z.status=X);else{var ae=y+(z.w_bits-8<<4)<<8;ae|=(2<=z.strategy||z.level<2?0:z.level<6?1:z.level===6?2:3)<<6,z.strstart!==0&&(ae|=32),ae+=31-ae%31,z.status=X,ee(z,ae),z.strstart!==0&&(ee(z,T.adler>>>16),ee(z,65535&T.adler)),T.adler=1}if(z.status===69)if(z.gzhead.extra){for(V=z.pending;z.gzindex<(65535&z.gzhead.extra.length)&&(z.pending!==z.pending_buf_size||(z.gzhead.hcrc&&z.pending>V&&(T.adler=u(T.adler,z.pending_buf,z.pending-V,V)),D(T),V=z.pending,z.pending!==z.pending_buf_size));)k(z,255&z.gzhead.extra[z.gzindex]),z.gzindex++;z.gzhead.hcrc&&z.pending>V&&(T.adler=u(T.adler,z.pending_buf,z.pending-V,V)),z.gzindex===z.gzhead.extra.length&&(z.gzindex=0,z.status=73)}else z.status=73;if(z.status===73)if(z.gzhead.name){V=z.pending;do{if(z.pending===z.pending_buf_size&&(z.gzhead.hcrc&&z.pending>V&&(T.adler=u(T.adler,z.pending_buf,z.pending-V,V)),D(T),V=z.pending,z.pending===z.pending_buf_size)){Z=1;break}Z=z.gzindexV&&(T.adler=u(T.adler,z.pending_buf,z.pending-V,V)),Z===0&&(z.gzindex=0,z.status=91)}else z.status=91;if(z.status===91)if(z.gzhead.comment){V=z.pending;do{if(z.pending===z.pending_buf_size&&(z.gzhead.hcrc&&z.pending>V&&(T.adler=u(T.adler,z.pending_buf,z.pending-V,V)),D(T),V=z.pending,z.pending===z.pending_buf_size)){Z=1;break}Z=z.gzindexV&&(T.adler=u(T.adler,z.pending_buf,z.pending-V,V)),Z===0&&(z.status=103)}else z.status=103;if(z.status===103&&(z.gzhead.hcrc?(z.pending+2>z.pending_buf_size&&D(T),z.pending+2<=z.pending_buf_size&&(k(z,255&T.adler),k(z,T.adler>>8&255),T.adler=0,z.status=X)):z.status=X),z.pending!==0){if(D(T),T.avail_out===0)return z.last_flush=-1,f}else if(T.avail_in===0&&$(J)<=$(H)&&J!==p)return N(T,-5);if(z.status===666&&T.avail_in!==0)return N(T,-5);if(T.avail_in!==0||z.lookahead!==0||J!==h&&z.status!==666){var se=z.strategy===2?function(te,he){for(var ye;;){if(te.lookahead===0&&(ue(te),te.lookahead===0)){if(he===h)return w;break}if(te.match_length=0,ye=s._tr_tally(te,0,te.window[te.strstart]),te.lookahead--,te.strstart++,ye&&(j(te,!1),te.strm.avail_out===0))return w}return te.insert=0,he===p?(j(te,!0),te.strm.avail_out===0?R:L):te.last_lit&&(j(te,!1),te.strm.avail_out===0)?w:G}(z,J):z.strategy===3?function(te,he){for(var ye,pe,re,ce,me=te.window;;){if(te.lookahead<=I){if(ue(te),te.lookahead<=I&&he===h)return w;if(te.lookahead===0)break}if(te.match_length=0,te.lookahead>=M&&0te.lookahead&&(te.match_length=te.lookahead)}if(te.match_length>=M?(ye=s._tr_tally(te,1,te.match_length-M),te.lookahead-=te.match_length,te.strstart+=te.match_length,te.match_length=0):(ye=s._tr_tally(te,0,te.window[te.strstart]),te.lookahead--,te.strstart++),ye&&(j(te,!1),te.strm.avail_out===0))return w}return te.insert=0,he===p?(j(te,!0),te.strm.avail_out===0?R:L):te.last_lit&&(j(te,!1),te.strm.avail_out===0)?w:G}(z,J):o[z.level].func(z,J);if(se!==R&&se!==L||(z.status=666),se===w||se===R)return T.avail_out===0&&(z.last_flush=-1),f;if(se===G&&(J===1?s._tr_align(z):J!==5&&(s._tr_stored_block(z,0,0,!1),J===3&&(P(z.head),z.lookahead===0&&(z.strstart=0,z.block_start=0,z.insert=0))),D(T),T.avail_out===0))return z.last_flush=-1,f}return J!==p?f:z.wrap<=0?1:(z.wrap===2?(k(z,255&T.adler),k(z,T.adler>>8&255),k(z,T.adler>>16&255),k(z,T.adler>>24&255),k(z,255&T.total_in),k(z,T.total_in>>8&255),k(z,T.total_in>>16&255),k(z,T.total_in>>24&255)):(ee(z,T.adler>>>16),ee(z,65535&T.adler)),D(T),0=H.w_size&&(Z===0&&(P(H.head),H.strstart=0,H.block_start=0,H.insert=0),he=new a.Buf8(H.w_size),a.arraySet(he,J,ye-H.w_size,H.w_size,0),J=he,ye=H.w_size),ae=T.avail_in,se=T.next_in,te=T.input,T.avail_in=ye,T.next_in=0,T.input=J,ue(H);H.lookahead>=M;){for(z=H.strstart,V=H.lookahead-(M-1);H.ins_h=(H.ins_h<>>=M=A>>>24,_-=M,(M=A>>>16&255)===0)G[c++]=65535&A;else{if(!(16&M)){if(!(64&M)){A=E[(65535&A)+(y&(1<>>=M,_-=M),_<15&&(y+=w[l++]<<_,_+=8,y+=w[l++]<<_,_+=8),A=x[y&C];n:for(;;){if(y>>>=M=A>>>24,_-=M,!(16&(M=A>>>16&255))){if(!(64&M)){A=x[(65535&A)+(y&(1<>>=M,_-=M,(M=c-h)>3,y&=(1<<(_-=I<<3))-1,o.next_in=l,o.next_out=c,o.avail_in=l>>24&255)+(S>>>8&65280)+((65280&S)<<8)+((255&S)<<24)}function y(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new o.Buf16(320),this.work=new o.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function _(S){var X;return S&&S.state?(X=S.state,S.total_in=S.total_out=X.total=0,S.msg="",X.wrap&&(S.adler=1&X.wrap),X.mode=g,X.last=0,X.havedict=0,X.dmax=32768,X.head=null,X.hold=0,X.bits=0,X.lencode=X.lendyn=new o.Buf32(v),X.distcode=X.distdyn=new o.Buf32(d),X.sane=1,X.back=-1,p):f}function E(S){var X;return S&&S.state?((X=S.state).wsize=0,X.whave=0,X.wnext=0,_(S)):f}function x(S,X){var w,G;return S&&S.state?(G=S.state,X<0?(w=0,X=-X):(w=1+(X>>4),X<48&&(X&=15)),X&&(X<8||15=L.wsize?(o.arraySet(L.window,X,w-L.wsize,L.wsize,0),L.wnext=0,L.whave=L.wsize):(G<(R=L.wsize-L.wnext)&&(R=G),o.arraySet(L.window,X,w-G,R,L.wnext),(G-=R)?(o.arraySet(L.window,X,w-G,G,0),L.wnext=G,L.whave=L.wsize):(L.wnext+=R,L.wnext===L.wsize&&(L.wnext=0),L.whave>>8&255,w.check=s(w.check,Z,2,0),j=D=0,w.mode=2;break}if(w.flags=0,w.head&&(w.head.done=!1),!(1&w.wrap)||(((255&D)<<8)+(D>>8))%31){S.msg="incorrect header check",w.mode=30;break}if((15&D)!=8){S.msg="unknown compression method",w.mode=30;break}if(j-=4,T=8+(15&(D>>>=4)),w.wbits===0)w.wbits=T;else if(T>w.wbits){S.msg="invalid window size",w.mode=30;break}w.dmax=1<>8&1),512&w.flags&&(Z[0]=255&D,Z[1]=D>>>8&255,w.check=s(w.check,Z,2,0)),j=D=0,w.mode=3;case 3:for(;j<32;){if($===0)break e;$--,D+=G[L++]<>>8&255,Z[2]=D>>>16&255,Z[3]=D>>>24&255,w.check=s(w.check,Z,4,0)),j=D=0,w.mode=4;case 4:for(;j<16;){if($===0)break e;$--,D+=G[L++]<>8),512&w.flags&&(Z[0]=255&D,Z[1]=D>>>8&255,w.check=s(w.check,Z,2,0)),j=D=0,w.mode=5;case 5:if(1024&w.flags){for(;j<16;){if($===0)break e;$--,D+=G[L++]<>>8&255,w.check=s(w.check,Z,2,0)),j=D=0}else w.head&&(w.head.extra=null);w.mode=6;case 6:if(1024&w.flags&&($<(Q=w.length)&&(Q=$),Q&&(w.head&&(T=w.head.extra_len-w.length,w.head.extra||(w.head.extra=new Array(w.head.extra_len)),o.arraySet(w.head.extra,G,L,Q,T)),512&w.flags&&(w.check=s(w.check,G,Q,L)),$-=Q,L+=Q,w.length-=Q),w.length))break e;w.length=0,w.mode=7;case 7:if(2048&w.flags){if($===0)break e;for(Q=0;T=G[L+Q++],w.head&&T&&w.length<65536&&(w.head.name+=String.fromCharCode(T)),T&&Q<$;);if(512&w.flags&&(w.check=s(w.check,G,Q,L)),$-=Q,L+=Q,T)break e}else w.head&&(w.head.name=null);w.length=0,w.mode=8;case 8:if(4096&w.flags){if($===0)break e;for(Q=0;T=G[L+Q++],w.head&&T&&w.length<65536&&(w.head.comment+=String.fromCharCode(T)),T&&Q<$;);if(512&w.flags&&(w.check=s(w.check,G,Q,L)),$-=Q,L+=Q,T)break e}else w.head&&(w.head.comment=null);w.mode=9;case 9:if(512&w.flags){for(;j<16;){if($===0)break e;$--,D+=G[L++]<>9&1,w.head.done=!0),S.adler=w.check=0,w.mode=12;break;case 10:for(;j<32;){if($===0)break e;$--,D+=G[L++]<>>=7&j,j-=7&j,w.mode=27;break}for(;j<3;){if($===0)break e;$--,D+=G[L++]<>>=1)){case 0:w.mode=14;break;case 1:if(I(w),w.mode=20,X!==6)break;D>>>=2,j-=2;break e;case 2:w.mode=17;break;case 3:S.msg="invalid block type",w.mode=30}D>>>=2,j-=2;break;case 14:for(D>>>=7&j,j-=7&j;j<32;){if($===0)break e;$--,D+=G[L++]<>>16^65535)){S.msg="invalid stored block lengths",w.mode=30;break}if(w.length=65535&D,j=D=0,w.mode=15,X===6)break e;case 15:w.mode=16;case 16:if(Q=w.length){if($>>=5,j-=5,w.ndist=1+(31&D),D>>>=5,j-=5,w.ncode=4+(15&D),D>>>=4,j-=4,286>>=3,j-=3}for(;w.have<19;)w.lens[ae[w.have++]]=0;if(w.lencode=w.lendyn,w.lenbits=7,H={bits:w.lenbits},J=u(0,w.lens,0,19,w.lencode,0,w.work,H),w.lenbits=H.bits,J){S.msg="invalid code lengths set",w.mode=30;break}w.have=0,w.mode=19;case 19:for(;w.have>>16&255,B=65535&V,!((ne=V>>>24)<=j);){if($===0)break e;$--,D+=G[L++]<>>=ne,j-=ne,w.lens[w.have++]=B;else{if(B===16){for(z=ne+2;j>>=ne,j-=ne,w.have===0){S.msg="invalid bit length repeat",w.mode=30;break}T=w.lens[w.have-1],Q=3+(3&D),D>>>=2,j-=2}else if(B===17){for(z=ne+3;j>>=ne)),D>>>=3,j-=3}else{for(z=ne+7;j>>=ne)),D>>>=7,j-=7}if(w.have+Q>w.nlen+w.ndist){S.msg="invalid bit length repeat",w.mode=30;break}for(;Q--;)w.lens[w.have++]=T}}if(w.mode===30)break;if(w.lens[256]===0){S.msg="invalid code -- missing end-of-block",w.mode=30;break}if(w.lenbits=9,H={bits:w.lenbits},J=u(c,w.lens,0,w.nlen,w.lencode,0,w.work,H),w.lenbits=H.bits,J){S.msg="invalid literal/lengths set",w.mode=30;break}if(w.distbits=6,w.distcode=w.distdyn,H={bits:w.distbits},J=u(h,w.lens,w.nlen,w.ndist,w.distcode,0,w.work,H),w.distbits=H.bits,J){S.msg="invalid distances set",w.mode=30;break}if(w.mode=20,X===6)break e;case 20:w.mode=21;case 21:if(6<=$&&258<=P){S.next_out=N,S.avail_out=P,S.next_in=L,S.avail_in=$,w.hold=D,w.bits=j,l(S,ee),N=S.next_out,R=S.output,P=S.avail_out,L=S.next_in,G=S.input,$=S.avail_in,D=w.hold,j=w.bits,w.mode===12&&(w.back=-1);break}for(w.back=0;O=(V=w.lencode[D&(1<>>16&255,B=65535&V,!((ne=V>>>24)<=j);){if($===0)break e;$--,D+=G[L++]<>W)])>>>16&255,B=65535&V,!(W+(ne=V>>>24)<=j);){if($===0)break e;$--,D+=G[L++]<>>=W,j-=W,w.back+=W}if(D>>>=ne,j-=ne,w.back+=ne,w.length=B,O===0){w.mode=26;break}if(32&O){w.back=-1,w.mode=12;break}if(64&O){S.msg="invalid literal/length code",w.mode=30;break}w.extra=15&O,w.mode=22;case 22:if(w.extra){for(z=w.extra;j>>=w.extra,j-=w.extra,w.back+=w.extra}w.was=w.length,w.mode=23;case 23:for(;O=(V=w.distcode[D&(1<>>16&255,B=65535&V,!((ne=V>>>24)<=j);){if($===0)break e;$--,D+=G[L++]<>W)])>>>16&255,B=65535&V,!(W+(ne=V>>>24)<=j);){if($===0)break e;$--,D+=G[L++]<>>=W,j-=W,w.back+=W}if(D>>>=ne,j-=ne,w.back+=ne,64&O){S.msg="invalid distance code",w.mode=30;break}w.offset=B,w.extra=15&O,w.mode=24;case 24:if(w.extra){for(z=w.extra;j>>=w.extra,j-=w.extra,w.back+=w.extra}if(w.offset>w.dmax){S.msg="invalid distance too far back",w.mode=30;break}w.mode=25;case 25:if(P===0)break e;if(Q=ee-P,w.offset>Q){if((Q=w.offset-Q)>w.whave&&w.sane){S.msg="invalid distance too far back",w.mode=30;break}ue=Q>w.wnext?(Q-=w.wnext,w.wsize-Q):w.wnext-Q,Q>w.length&&(Q=w.length),de=w.window}else de=R,ue=N-w.offset,Q=w.length;for(PC?(M=ue[de+d[X]],j[k+d[X]]):(M=96,0),y=1<>N)+(_-=y)]=A<<24|M<<16|I|0,_!==0;);for(y=1<>=1;if(y!==0?(D&=y-1,D+=y):D=0,X++,--ee[S]==0){if(S===G)break;S=h[p+d[X]]}if(R>>7)]}function k(V,Z){V.pending_buf[V.pending++]=255&Z,V.pending_buf[V.pending++]=Z>>>8&255}function ee(V,Z,ae){V.bi_valid>m-ae?(V.bi_buf|=Z<>m-V.bi_valid,V.bi_valid+=ae-m):(V.bi_buf|=Z<>>=1,ae<<=1,0<--Z;);return ae>>>1}function de(V,Z,ae){var se,te,he=new Array(d+1),ye=0;for(se=1;se<=d;se++)he[se]=ye=ye+ae[se-1]<<1;for(te=0;te<=Z;te++){var pe=V[2*te+1];pe!==0&&(V[2*te]=ue(he[pe]++,pe))}}function ne(V){var Z;for(Z=0;Z>1;1<=ae;ae--)W(V,he,ae);for(te=re;ae=V.heap[1],V.heap[1]=V.heap[V.heap_len--],W(V,he,1),se=V.heap[1],V.heap[--V.heap_max]=ae,V.heap[--V.heap_max]=se,he[2*te]=he[2*ae]+he[2*se],V.depth[te]=(V.depth[ae]>=V.depth[se]?V.depth[ae]:V.depth[se])+1,he[2*ae+1]=he[2*se+1]=te,V.heap[1]=te++,W(V,he,1),2<=V.heap_len;);V.heap[--V.heap_max]=V.heap[1],function(me,xe){var Ce,Xe,tt,ke,ht,U,q=xe.dyn_tree,ve=xe.max_code,be=xe.stat_desc.static_tree,Le=xe.stat_desc.has_stree,Se=xe.stat_desc.extra_bits,Ct=xe.stat_desc.extra_base,At=xe.stat_desc.max_length,We=0;for(ke=0;ke<=d;ke++)me.bl_count[ke]=0;for(q[2*me.heap[me.heap_max]+1]=0,Ce=me.heap_max+1;Ce>=7;te>>=1)if(1&ce&&pe.dyn_ltree[2*re]!==0)return a;if(pe.dyn_ltree[18]!==0||pe.dyn_ltree[20]!==0||pe.dyn_ltree[26]!==0)return s;for(re=32;re>>3,(he=V.static_len+3+7>>>3)<=te&&(te=he)):te=he=ae+5,ae+4<=te&&Z!==-1?z(V,Z,ae,se):V.strategy===4||he===te?(ee(V,2+(se?1:0),3),oe(V,F,S)):(ee(V,4+(se?1:0),3),function(pe,re,ce,me){var xe;for(ee(pe,re-257,5),ee(pe,ce-1,5),ee(pe,me-4,4),xe=0;xe>>8&255,V.pending_buf[V.d_buf+2*V.last_lit+1]=255&Z,V.pending_buf[V.l_buf+V.last_lit]=255&ae,V.last_lit++,Z===0?V.dyn_ltree[2*ae]++:(V.matches++,Z--,V.dyn_ltree[2*(w[ae]+h+1)]++,V.dyn_dtree[2*j(Z)]++),V.last_lit===V.lit_bufsize-1},i._tr_align=function(V){ee(V,2,3),Q(V,_,F),function(Z){Z.bi_valid===16?(k(Z,Z.bi_buf),Z.bi_buf=0,Z.bi_valid=0):8<=Z.bi_valid&&(Z.pending_buf[Z.pending++]=255&Z.bi_buf,Z.bi_buf>>=8,Z.bi_valid-=8)}(V)}},{"../utils/common":41}],53:[function(t,n,i){n.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(t,n,i){(function(o){(function(a,s){if(!a.setImmediate){var l,u,c,h,p=1,f={},g=!1,v=a.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(a);d=d&&d.setTimeout?d:a,l={}.toString.call(a.process)==="[object process]"?function(E){process.nextTick(function(){y(E)})}:function(){if(a.postMessage&&!a.importScripts){var E=!0,x=a.onmessage;return a.onmessage=function(){E=!1},a.postMessage("","*"),a.onmessage=x,E}}()?(h="setImmediate$"+Math.random()+"$",a.addEventListener?a.addEventListener("message",_,!1):a.attachEvent("onmessage",_),function(E){a.postMessage(h+E,"*")}):a.MessageChannel?((c=new MessageChannel).port1.onmessage=function(E){y(E.data)},function(E){c.port2.postMessage(E)}):v&&"onreadystatechange"in v.createElement("script")?(u=v.documentElement,function(E){var x=v.createElement("script");x.onreadystatechange=function(){y(E),x.onreadystatechange=null,u.removeChild(x),x=null},u.appendChild(x)}):function(E){setTimeout(y,0,E)},d.setImmediate=function(E){typeof E!="function"&&(E=new Function(""+E));for(var x=new Array(arguments.length-1),b=0;b"u"?o===void 0?this:o:self)}).call(this,typeof Nn<"u"?Nn:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})}(Bs)),Bs.exports}var cI=uI();const hI=tu(cI);$n.zipReader=(r,e)=>hI.loadAsync(r);$n.readText=(r,e)=>{const t=r.file(e);if(!t)throw new Error(`Cannot find file: ${e}`);return t.async("text")};$n.getFilePaths=r=>{const e=[];return r.forEach(t=>e.push(t)),Promise.resolve(e)};$n.getFiles=(r,e)=>Promise.all(e.map(async t=>{const n=t.slice(t.lastIndexOf("/")+1),i=await r.file(t).async("blob");return new File([i],n)}));const fI={relative:""},dI={"h-full":"","w-full":""},pI={key:0,class:"animate-stripe",absolute:"",left:"1/2",bottom:"20%",z:"20","rounded-2xl":"",text:"pink-600","px-2":"","py-2":"",transform:"translate-x--1/2"},mI={bg:"pink-50","rounded-xl":"","px-10":"","py-6":""},gI=["innerHTML"],vI=Ne({__name:"Stage",setup(r){const e=le(),t=le(),{stageView:n,elevenLabsApiKey:i,elevenlabsVoiceEnglish:o,elevenlabsVoiceJapanese:a}=Cn(Jr()),{mouthOpenSize:s}=Cn(nI()),{audioContext:l,calculateVolume:u}=Tm(),{onBeforeMessageComposed:c,onBeforeSend:h,onTokenLiteral:p,onTokenSpecial:f,onStreamEnd:g,streamingMessage:v}=yr(),{process:d}=Wu(),{locale:m}=Zr(),y=le(),_=le(!1),E=le(!1),x=_a({handlers:[w=>new Promise(G=>{const R=l.createBufferSource();R.buffer=w.data.audioBuffer,R.connect(l.destination),R.connect(y.value),_.value=!0,R.start(0),R.onended=()=>{_.value=!1,G()}})]}),b=_a({handlers:[async w=>{let G=Ng.Camilla_KM;m.value==="jp"||m.value==="jp-JP"?G=a.value:G=o.value;const R=Date.now(),L=uS({apiKey:i.value,baseURL:"https://unspeech.hyp3r.link/v1/"}),N=await sS({...L.speech("eleven_multilingual_v2",{voiceSettings:{stability:.4,similarityBoost:.5}}),input:w.data,voice:Dg[G]}),$=Date.now()-R;console.debug("TTS took",$,"ms");const P=await l.decodeAudioData(N);await x.add({audioBuffer:P,text:w.data})}]});b.on("add",w=>{console.debug("ttsQueue added",w)});const C=lv(b),A=_a({handlers:[async w=>{if(n.value==="3d"){const G=fv[w.data];if(!G)return;await t.value.setExpression(G)}else n.value==="2d"&&await e.value.setMotion(dv[w.data])}]}),M=uv(A);M.onHandlerEvent("emotion",w=>{console.debug("emotion detected",w)});const I=cv();I.onHandlerEvent("delay",w=>{console.debug("delay detected",w)});function F(){requestAnimationFrame(F),_.value&&(s.value=u(y.value,"linear"))}function S(){E.value||(F(),l.resume(),E.value=!0)}function X(){y.value||(y.value=l.createAnalyser())}return c(async()=>{X(),S()}),h(async()=>{var w;(w=e.value)==null||w.setMotion(Md)}),p(async w=>{await C.add(w)}),f(async w=>{await I.add(w),await M.add(w)}),g(async()=>{await I.add(hv)}),Gt(()=>{E.value=!1}),(w,G)=>(fe(),_e("div",fI,[Y("div",dI,[K(n)==="2d"?(fe(),lt(S1,{key:0,ref_key:"live2DViewerRef",ref:e,"mouth-open-size":K(s),model:"./assets/live2d/models/hiyori_pro_zh.zip","min-w":"50% =s.value&&(v.value+=s.value),n.value&&(n.value.style.transform=`translateX(${v.value}px)`),f=requestAnimationFrame(d)}return Ge(()=>[e.height,e.amplitude,e.waveLength,e.fillColor,e.direction],()=>{o.value=e.height,a.value=e.amplitude,s.value=e.waveLength,u.value=e.fillColor,c.value=e.direction,p()},{immediate:!0}),Bg("resize",p),Jt(()=>{p(),d()}),Gt(()=>{cancelAnimationFrame(f)}),(m,y)=>(fe(),_e("div",TI,[ut(m.$slots,"default"),Y("div",{ref_key:"container",ref:t,absolute:"","left-0":"","right-0":"","top-0":"","w-full":"","overflow-hidden":""},[c.value==="down"?(fe(),_e("div",{key:0,style:Yr({backgroundColor:u.value,height:`${o.value}px`}),"w-full":""},null,4)):nt("",!0),(fe(),_e("svg",{ref_key:"svg",ref:n,width:s.value*Math.ceil(i.value*2/s.value),height:o.value,viewBox:`0 0 ${s.value*Math.ceil(i.value*2/s.value)} ${o.value}`,xmlns:"http://www.w3.org/2000/svg",h:"[100%]",w:"[200%]",style:{willChange:"transform"}},[Y("path",{d:l.value,fill:u.value},null,8,EI)],8,SI)),c.value==="up"?(fe(),_e("div",{key:1,style:Yr({backgroundColor:u.value,height:`${o.value}px`}),"w-full":""},null,4)):nt("",!0)],512)]))}}),AI={flex:"~","gap-2":""},II={flex:"~ row",bg:"zinc-100 dark:zinc-700",text:"sm zinc-400 dark:zinc-500","appearance-none":"","gap-1":"","rounded-lg":"","rounded-md":"","border-none":"","p-1":""},PI=["checked","aria-checked"],MI=["checked","aria-checked"],kI={relative:""},OI={flex:"~ row",bg:"zinc-100 dark:zinc-700",text:"sm zinc-400 dark:zinc-500","h-fit":"","w-fit":"","appearance-none":"","gap-1":"","rounded-lg":"","rounded-md":"","border-none":"","p-1":""},RI=["checked","aria-checked"],FI={key:0,w:"120 y.id===d.value);if(!m){l.value=void 0;return}l.value=m}function g(v){const d=v.target.value;switch(t.value){case"en":case"en-US":h.value=d;break;case"zh":case"zh-CN":case"zh-TW":case"zh-HK":h.value=d;break;case"jp":case"jp-JP":p.value=d;break}}return Ge([u,c],async([v,d])=>{if(!v||!d){a.value=[];return}a.value=await s(v,d)}),Jt(async()=>{!u.value||!c.value||(a.value=await s(u.value,c.value))}),(v,d)=>(fe(),_e("div",AI,[Y("fieldset",II,[Y("label",{"h-fit":"","cursor-pointer":"",class:Kt([K(n).stageView==="2d"?"bg-zinc-300 text-zinc-900 dark:bg-zinc-200 dark:text-zinc-800":""]),"rounded-md":"","px-4":"","py-2":""},[ft(Y("input",{"onUpdate:modelValue":d[0]||(d[0]=m=>K(n).stageView=m),checked:K(n).stageView==="2d","aria-checked":K(n).stageView==="2d",name:"settings.stageView",type:"radio",role:"radio",value:"2d",hidden:"","appearance-none":"","outline-none":""},null,8,PI),[[xi,K(n).stageView]]),Y("div",{"select-none":"",class:Kt([K(n).stageView==="2d"?"font-semibold":""])}," 2D ",2)],2),Y("label",{"h-fit":"","cursor-pointer":"",class:Kt([K(n).stageView==="3d"?"bg-zinc-300 text-zinc-900 dark:bg-zinc-200 dark:text-zinc-800":""]),"rounded-md":"","px-4":"","py-2":""},[ft(Y("input",{"onUpdate:modelValue":d[1]||(d[1]=m=>K(n).stageView=m),checked:K(n).stageView==="3d","aria-checked":K(n).stageView==="3d",name:"stageView",type:"radio",role:"radio",value:"3d",hidden:"","appearance-none":"","outline-none":""},null,8,MI),[[xi,K(n).stageView]]),Y("div",{"select-none":"",class:Kt([K(n).stageView==="3d"?"font-semibold":""])}," 3D ",2)],2)]),Y("div",kI,[Y("div",OI,[Y("label",{"h-fit":"","cursor-pointer":"",class:Kt([i.value?"bg-zinc-300 text-zinc-900 dark:bg-zinc-200 dark:text-zinc-800":""]),transition:"all ease-in-out duration-500","rounded-md":"","px-2":"","py-2":""},[ft(Y("input",{"onUpdate:modelValue":d[2]||(d[2]=m=>i.value=m),checked:i.value,"aria-checked":i.value,name:"stageView",type:"checkbox",hidden:"","appearance-none":"","outline-none":""},null,8,RI),[[Wr,i.value]]),d[8]||(d[8]=Y("div",{"select-none":""},[Y("div",{"i-solar:settings-minimalistic-bold-duotone":"",text:"text-zinc-900 dark:text-zinc-800 lg"})],-1))],2)]),Oe(K(Rp),null,{default:Be(()=>[i.value?(fe(),_e("div",FI,[Y("div",LI,[Y("span",null,Ue(K(e)("settings.openai-base-url.label")),1)]),Y("div",NI,[ft(Y("input",{"onUpdate:modelValue":d[3]||(d[3]=m=>K(n).openAiApiBaseURL=m),type:"text",placeholder:K(e)("settings.openai-base-url.placeholder"),bg:"zinc-200 dark:zinc-800/50","w-full":"","rounded-md":"","px-2":"","py-1":"","font-mono":"","outline-none":""},null,8,DI),[[Br,K(n).openAiApiBaseURL]])]),Y("div",BI,[Y("span",null,Ue(K(e)("settings.openai-api-key.label")),1)]),Y("div",UI,[ft(Y("input",{"onUpdate:modelValue":d[4]||(d[4]=m=>K(n).openAiApiKey=m),type:"text",placeholder:K(e)("settings.openai-api-key.placeholder"),bg:"zinc-200 dark:zinc-800/50","w-full":"","rounded-md":"","px-2":"","py-1":"","font-mono":"","outline-none":""},null,8,zI),[[Br,K(n).openAiApiKey]])]),Y("div",jI,[Y("span",null,Ue(K(e)("settings.elevenlabs-api-key.label")),1)]),Y("div",VI,[ft(Y("input",{"onUpdate:modelValue":d[5]||(d[5]=m=>K(n).elevenLabsApiKey=m),type:"text",placeholder:K(e)("settings.elevenlabs-api-key.placeholder"),bg:"zinc-200 dark:zinc-800/50","w-full":"","rounded-md":"","px-2":"","py-1":"","font-mono":"","outline-none":""},null,8,GI),[[Br,K(n).elevenLabsApiKey]])]),Y("div",$I,[Y("span",null,Ue(K(e)("settings.language")),1)]),Y("div",HI,[ft(Y("select",{"onUpdate:modelValue":d[6]||(d[6]=m=>K(n).language=m),bg:"zinc-200 dark:zinc-800/50","w-full":"","rounded-md":"","px-2":"","py-1":"","font-mono":"","outline-none":""},d[9]||(d[9]=[Y("option",{value:"en-US"}," English ",-1),Y("option",{value:"zh-CN"}," 简体中文 ",-1)]),512),[[Td,K(n).language]])]),Y("div",XI,[Y("span",null,Ue(K(e)("settings.models")),1)]),Y("div",WI,[Y("select",{bg:"zinc-200 dark:zinc-800/50","w-full":"","rounded-md":"","px-2":"","py-1":"","font-mono":"","outline-none":"",onChange:f},[Y("option",qI,Ue(K(e)("stage.select-a-model")),1),K(n).openAiModel?(fe(),_e("option",{key:0,value:K(n).openAiModel.id},Ue("name"in K(n).openAiModel?`${K(n).openAiModel.name} (${K(n).openAiModel.id})`:K(n).openAiModel.id),9,YI)):nt("",!0),(fe(!0),_e(Un,null,gr(a.value,m=>(fe(),_e("option",{key:m.id,value:m.id},Ue("name"in m?`${m.name} (${m.id})`:m.id),9,KI))),128))],32)]),Y("div",ZI,[Y("span",null,Ue(K(e)("settings.voices")),1)]),Y("div",JI,[Y("select",{bg:"zinc-200 dark:zinc-800/50","w-full":"","rounded-md":"","px-2":"","py-1":"","font-mono":"","outline-none":"",onChange:g},[Y("option",QI,Ue(K(e)("stage.select-a-voice")),1),["en","en-US"].indexOf(K(t))!==-1&&K(h)?(fe(),_e("option",{key:0,value:K(h)},Ue(K(h)),9,eP)):nt("",!0),["zh","zh-CN","zh-TW","zh-HK"].indexOf(K(t))!==-1&&K(h)?(fe(),_e("option",{key:1,value:K(h)},Ue(K(h)),9,tP)):nt("",!0),["jp","jp-JP"].indexOf(K(t))!==-1&&K(p)?(fe(),_e("option",{key:2,value:K(p)},Ue(K(p)),9,nP)):nt("",!0),(fe(!0),_e(Un,null,gr(K(Sd)[K(t)],(m,y)=>(fe(),_e("option",{key:y,value:m},Ue(m),9,rP))),128))],32)])])):nt("",!0)]),_:1})]),Y("div",null,[Y("div",iP,[Y("label",oP,[ft(Y("input",{"onUpdate:modelValue":d[7]||(d[7]=m=>iu(o)?o.value=m:null),checked:K(o),"aria-checked":K(o),name:"stageView",type:"checkbox",hidden:"","appearance-none":"","outline-none":""},null,8,aP),[[Wr,K(o)]]),Y("div",sP,[Oe(Ko,{name:"slide-away",mode:"out-in"},{default:Be(()=>[K(o)?(fe(),_e("div",lP)):(fe(),_e("div",uP))]),_:1})])])])])]))}}),hP={"mb-1":"","w-full":"","gap-2":""},fP=Ne({__name:"Header",setup(r){return(e,t)=>(fe(),_e("header",hP,[t[0]||(t[0]=Y("div",{flex:"~ 1","w-full":"","items-center":"","gap-2":"","px-2":"","text-nowrap":"","text-2xl":""},[Y("div",{"i-solar:cat-outline":"",text:"[#ed869d]"}),Y("div",{"font-cute":""},[Y("span",null,"アイリ")])],-1)),Oe(cP)]))}});function Sm(r,e){const t=Ed(e??{},{...vc.getDefaultRealTimeVADOptions("v5"),preSpeechPadFrames:30,positiveSpeechThreshold:.5,negativeSpeechThreshold:.35,minSpeechFrames:30,auto:!0}),n=le(),i=Ug("microphone");async function o(){if(n.value&&(n.value.destroy(),n.value=void 0,console.warn("existing MicVAD destroyed")),!i.value)return;const a=K(r);if(!a)return;const s=await navigator.mediaDevices.getUserMedia({audio:{deviceId:a}});n.value=await vc.MicVAD.new({...t,stream:s}),t.auto&&n.value.start()}return Ge(i,o,{immediate:!0}),Ge(zg(r),o,{immediate:!0}),jg(o),Gt(()=>{n.value&&(n.value.destroy(),n.value=void 0)}),{destroy:()=>{n.value&&(n.value.destroy(),n.value=void 0)},start:()=>{n.value&&n.value.start()}}}function dP(r,e){const t=Ed(e,{onLoading:()=>{},onInitiate:()=>{},onProgress:()=>{},onDone:()=>{},onReady:()=>{},onStart:()=>{},onUpdate:()=>{},onComplete:()=>{}}),{post:n,data:i,terminate:o}=Vg(r,{type:"module"}),a=le(null),s=le(""),l=le([]),u=le(!1),c=le(0),h=le("");return Ge(i,p=>{var f,g,v,d,m,y,_,E;switch(p.status){case"loading":a.value="loading",s.value=p.data,(f=t.onLoading)==null||f.call(t,p.data);break;case"initiate":l.value.push(p),(g=t.onInitiate)==null||g.call(t,p);break;case"progress":l.value=l.value.map(x=>x.file===p.file?{...x,...p}:x),(v=t.onProgress)==null||v.call(t,p);break;case"done":l.value=l.value.filter(x=>x.file!==p.file),(d=t.onDone)==null||d.call(t,p);break;case"ready":a.value="ready",(m=t.onReady)==null||m.call(t);break;case"start":u.value=!0,(y=t.onStart)==null||y.call(t);break;case"update":c.value=p.tps,(_=t.onUpdate)==null||_.call(t,p.tps);break;case"complete":u.value=!1,h.value=p.output[0]||"",console.debug("Whisper result:",h.value),(E=t.onComplete)==null||E.call(t,p.output[0]);break}}),Gt(()=>{o()}),{transcribe:p=>n(p),status:a,loadingMessage:s,loadingProgress:l,transcribing:u,tps:c,result:h,load:()=>n({type:"load"}),terminate:o}}const pP="/assets/worker--0RkW31s.js";async function mP(r,e){const t=new ArrayBuffer(44+r.length*2),n=new DataView(t);ho(n,0,"RIFF"),n.setUint32(4,36+r.length*2,!0),ho(n,8,"WAVE"),ho(n,12,"fmt "),n.setUint32(16,16,!0),n.setUint16(20,1,!0),n.setUint16(22,1,!0),n.setUint32(24,e,!0),n.setUint32(28,e*2,!0),n.setUint16(32,2,!0),n.setUint16(34,16,!0),ho(n,36,"data"),n.setUint32(40,r.length*2,!0),gP(n,44,r);const i=new Blob([n],{type:"audio/wav"});return new Promise((o,a)=>{const s=new FileReader;s.onload=()=>{const l=s.result.split(",")[1];o(l)},s.onerror=a,s.readAsDataURL(i)})}function ho(r,e,t){for(let n=0;n{Qt().then(()=>{n.update(),i.value=n.height.value})}),s(async()=>{Qt().then(()=>{n.update(),i.value=n.height.value})}),(l,u)=>{const c=Ad("auto-animate");return fe(),_e("div",vP,[u[3]||(u[3]=Y("div",{"flex-1":""},null,-1)),ft((fe(),_e("div",{ref_key:"chatHistoryRef",ref:e,"h-full":"","w-full":"",flex:"~ col","overflow-scroll":""},[u[2]||(u[2]=Y("div",{"flex-1":""},null,-1)),(fe(!0),_e(Un,null,gr(K(t),(h,p)=>(fe(),_e("div",{key:p,"mb-2":""},[h.role==="assistant"?(fe(),_e("div",yP,[Y("div",_P,[u[0]||(u[0]=Y("div",null,[Y("span",{"text-xs":"",text:"pink-400/90 dark:pink-600/90","font-semibold":"",class:"inline {await u(C)}});async function m(){await u(e.value)}const{destroy:y,start:_}=Sm(l,{onSpeechStart:()=>{t.value=!0},onVADMisfire:()=>{t.value=!1},onSpeechEnd:C=>{t.value=!1,x(C)},auto:!1});function E(){v.value!=="loading"&&(g(),_())}async function x(C){await h.resume();const A=await mP(C,h.sampleRate);f({type:"generate",data:{audio:A,language:"en"}})}async function b(C){const A=C.target,M=o.value.find(I=>I.deviceId===A.value);if(!M){a.value=void 0;return}a.value=M}return Ge(s,async C=>{C==="false"&&(y(),d())}),c(async()=>{e.value=""}),(C,A)=>{const M=Eo("BasicTextarea"),I=Eo("TransitionVertical");return fe(),_e("div",AP,[Y("fieldset",IP,[Y("label",{class:Kt([n.value==="chat"?"bg-pink-100 dark:bg-[#3c2632]":"bg-white dark:bg-[#121212]",n.value==="chat"?"text-pink-500 dark:text-pink-500":""]),flex:"~ row",checked:n.value==="chat","aria-checked":n.value==="chat",border:"solid l-2 t-2 b-2 pink-100 dark:[#3c2632]",bg:"hover:pink-100 dark:hover:[#3c2632]",text:"pink-300 hover:pink-500 dark:pink-300/50 dark:hover:pink-500",transition:"all duration-250 ease-in-out","cursor-pointer":"","items-center":"","gap-1":"","rounded-l-lg":"","px-2":""},[ft(Y("input",{"onUpdate:modelValue":A[0]||(A[0]=F=>n.value=F),type:"radio",name:"tab",value:"chat",hidden:""},null,512),[[xi,n.value]]),A[5]||(A[5]=Y("div",{"i-solar:dialog-2-bold-duotone":"",text:"2xl",transform:"translate-y--2"},null,-1)),A[6]||(A[6]=Y("div",{flex:"~ row","items-center":""},[Y("span",{"min-w":"3em"},"Chat")],-1))],10,PP),Y("label",{class:Kt([n.value==="custom"?"bg-pink-100 dark:bg-[#3c2632]":"bg-white dark:bg-[#121212]",n.value==="custom"?"text-pink-500 dark:text-pink-500":""]),flex:"~ row",checked:n.value==="custom","aria-checked":n.value==="custom",border:"solid t-2 b-2 pink-100 dark:[#3c2632]",bg:"hover:pink-100 dark:hover:[#3c2632]",text:"pink-300 hover:pink-500 dark:pink-300/50 dark:hover:pink-500",transition:"all duration-250 ease-in-out","cursor-pointer":"","items-center":"","gap-1":"","px-2":""},[ft(Y("input",{"onUpdate:modelValue":A[1]||(A[1]=F=>n.value=F),type:"radio",name:"tab",value:"custom",hidden:""},null,512),[[xi,n.value]]),A[7]||(A[7]=Y("div",{"i-solar:star-fall-2-bold-duotone":"",text:"2xl",transform:"translate-y--2"},null,-1)),A[8]||(A[8]=Y("div",{flex:"~ row","items-center":""},[Y("span",null,"Custom")],-1))],10,MP),Y("label",{class:Kt([n.value==="clothes"?"bg-pink-100 dark:bg-[#3c2632]":"bg-white dark:bg-[#121212]",n.value==="clothes"?"text-pink-500 dark:text-pink-500":""]),flex:"~ row",checked:n.value==="clothes","aria-checked":n.value==="clothes",border:"solid r-2 t-2 b-2 pink-100 dark:[#3c2632]",bg:"hover:pink-100 dark:hover:[#3c2632]",text:"pink-300 hover:pink-500 dark:pink-300/50 dark:hover:pink-500",transition:"all duration-250 ease-in-out","cursor-pointer":"","items-center":"","gap-1":"","rounded-r-lg":"","px-2":""},[ft(Y("input",{"onUpdate:modelValue":A[2]||(A[2]=F=>n.value=F),type:"radio",name:"tab",value:"clothes",hidden:""},null,512),[[xi,n.value]]),A[9]||(A[9]=Y("div",{"i-solar:magic-stick-3-bold-duotone":"",text:"2xl",transform:"translate-y--2"},null,-1)),A[10]||(A[10]=Y("div",{flex:"~ row","items-center":""},[Y("span",null,"Clothes")],-1))],10,kP)]),Y("div",OP,[Y("div",RP,[Oe(CP,{"h-full":"","flex-1":"","p-4":"",w:"full","max-h":"e.value=F),placeholder:K(p)("stage.message"),text:"pink-300 hover:pink-500 dark:pink-300/50 dark:hover:pink-500 placeholder:pink-300 placeholder:hover:pink-500 placeholder:dark:pink-300/50 placeholder:dark:hover:pink-500",bg:"pink-100 dark:pink-400/20","min-h":"[100px]","w-full":"","rounded-t-xl":"","p-4":"","font-medium":"","outline-none":"",transition:"all duration-250 ease-in-out placeholder:all placeholder:duration-250 placeholder:ease-in-out",onSubmit:m},null,8,["modelValue","placeholder"])])])]),Y("div",LP,[Y("button",{bg:"cyan-100 hover:cyan-200 dark:cyan-800 dark:hover:cyan-700",transition:"all duration-250 ease-in-out",text:"cyan-400","mb-6":"",flex:"","cursor-pointer":"","items-center":"","justify-center":"","gap-2":"","rounded-full":"","px-4":"","py-2":"",onClick:E},[Oe(Ko,{mode:"out-in"},{default:Be(()=>[K(v)===null?(fe(),_e("div",NP," Load Models ")):K(v)==="loading"?(fe(),_e("div",DP,A[11]||(A[11]=[Y("div",{"i-svg-spinners:bouncing-ball":"",class:"text-cyan"},null,-1),Y("span",null,"Loading",-1)]))):K(v)==="ready"?(fe(),_e("div",BP,A[12]||(A[12]=[Y("div",{"i-lucide:check":"",class:"text-cyan"},null,-1),Y("span",null,"Ready",-1)]))):nt("",!0)]),_:1})]),Y("div",UP,[Oe(I,null,{default:Be(()=>[i.value?(fe(),_e("fieldset",zP,[(fe(!0),_e(Un,null,gr(K(o),(F,S)=>(fe(),_e("label",{key:S,class:"[&_div_span]:dark:hover:bg-cyan-300 [&_div_span]:dark:hover:bg-cyan-900"},[Y("input",{type:"radio",name:"audioInput",value:F.deviceId,hidden:"",onChange:b},null,40,jP),Y("div",VP,[Y("div",GP,[F.deviceId===K(l)?(fe(),_e("div",$P)):nt("",!0)]),Y("span",{"inline-block":"",class:Kt([F.deviceId===K(l)?"cyan-400 dark:text-white":"cyan-400/50 dark:text-white/50"]),transition:"all duration-250 ease-in-out"},Ue(F.label),3)])]))),128))])):nt("",!0)]),_:1}),Y("label",HP,[ft(Y("input",{"onUpdate:modelValue":A[4]||(A[4]=F=>i.value=F),type:"checkbox",hidden:""},null,512),[[Wr,i.value]]),A[13]||(A[13]=Y("div",{"i-solar:microphone-2-bold-duotone":""},null,-1)),Y("div",null,[t.value?(fe(),_e("span",WP,"Listening...")):(fe(),_e("span",XP,"Microphone"))])])])])])}}}),YP=Jo(qP,[["__scopeId","data-v-b137ad14"]]),KP={},ZP={"mb-1":"","w-full":"","gap-2":""};function JP(r,e){return fe(),_e("header",ZP,e[0]||(e[0]=[Y("div",{flex:"~ 1","w-full":"","items-center":"","justify-center":"","gap-2":"","px-2":"","text-nowrap":"","text-lg":""},[Y("div",{"i-solar:cat-outline":"",text:"[#ed869d]"}),Y("div",{"font-cute":""},[Y("span",null,"アイリ")])],-1)]))}const QP=Jo(KP,[["render",JP]]);function Yu(r,e){const t=typeof r=="string"&&!e?`${r}Context`:e,n=Symbol(t);return[i=>{const o=qg(n,i);if(o||o===null)return o;throw new Error(`Injection \`${n.toString()}\` not found. Component must be used within ${Array.isArray(r)?`one of the following components: ${r.join(", ")}`:`\`${r}\``}`)},i=>(Yg(n,i),i)]}function Em(r,e,t){const n=t.originalEvent.target,i=new CustomEvent(r,{bubbles:!1,cancelable:!0,detail:t});e&&n.addEventListener(r,e,{once:!0}),n.dispatchEvent(i)}function Cm(r){return hd()?(fd(r),!0):!1}function eM(r){let e=!1,t;const n=Pd(!0);return(...i)=>(e||(t=n.run(()=>r(...i)),e=!0),t)}function tM(r){let e=0,t,n;const i=()=>{e-=1,n&&e<=0&&(n.stop(),t=void 0,n=void 0)};return(...o)=>(e+=1,t||(n=Pd(!0),t=n.run(()=>r(...o))),Cm(i),t)}function Ku(r){return typeof r=="function"?r():K(r)}const Tr=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const nM=r=>typeof r<"u",rM=Object.prototype.toString,iM=r=>rM.call(r)==="[object Object]",oM=()=>{},qf=aM();function aM(){var r,e;return Tr&&((r=window==null?void 0:window.navigator)==null?void 0:r.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((e=window==null?void 0:window.navigator)==null?void 0:e.maxTouchPoints)>2&&/iPad|Macintosh/.test(window==null?void 0:window.navigator.userAgent))}function sM(r){return _r()}function lM(r,e){sM()&&ev(r,e)}function sa(r){var e;const t=Ku(r);return(e=t==null?void 0:t.$el)!=null?e:t}const Zu=Tr?window:void 0;function Am(...r){let e,t,n,i;if(typeof r[0]=="string"||Array.isArray(r[0])?([t,n,i]=r,e=Zu):[e,t,n,i]=r,!e)return oM;Array.isArray(t)||(t=[t]),Array.isArray(n)||(n=[n]);const o=[],a=()=>{o.forEach(c=>c()),o.length=0},s=(c,h,p,f)=>(c.addEventListener(h,p,f),()=>c.removeEventListener(h,p,f)),l=Ge(()=>[sa(e),Ku(i)],([c,h])=>{if(a(),!c)return;const p=iM(h)?{...h}:h;o.push(...t.flatMap(f=>n.map(g=>s(c,f,g,p))))},{immediate:!0,flush:"post"}),u=()=>{l(),a()};return Cm(u),u}function uM(r){return typeof r=="function"?r:typeof r=="string"?e=>e.key===r:Array.isArray(r)?e=>r.includes(e.key):()=>!0}function cM(...r){let e,t,n={};r.length===3?(e=r[0],t=r[1],n=r[2]):r.length===2?typeof r[1]=="object"?(e=!0,t=r[0],n=r[1]):(e=r[0],t=r[1]):(e=!0,t=r[0]);const{target:i=Zu,eventName:o="keydown",passive:a=!1,dedupe:s=!1}=n,l=uM(e);return Am(i,o,u=>{u.repeat&&Ku(s)||l(u)&&t(u)},a)}function hM(){const r=le(!1),e=_r();return e&&Jt(()=>{r.value=!0},e),r}function fM(r){return JSON.parse(JSON.stringify(r))}function dM(r,e,t,n={}){var i,o,a;const{clone:s=!1,passive:l=!1,eventName:u,deep:c=!1,defaultValue:h,shouldEmit:p}=n,f=_r(),g=t||(f==null?void 0:f.emit)||((i=f==null?void 0:f.$emit)==null?void 0:i.bind(f))||((a=(o=f==null?void 0:f.proxy)==null?void 0:o.$emit)==null?void 0:a.bind(f==null?void 0:f.proxy));let v=u;v=v||`update:${e.toString()}`;const d=_=>s?typeof s=="function"?s(_):fM(_):_,m=()=>nM(r[e])?d(r[e]):h,y=_=>{p?p(_)&&g(v,_):g(v,_)};if(l){const _=m(),E=le(_);let x=!1;return Ge(()=>r[e],b=>{x||(x=!0,E.value=d(b),Qt(()=>x=!1))}),Ge(E,b=>{!x&&(b!==r[e]||c)&&y(b)},{deep:c}),E}else return Ve({get(){return m()},set(_){y(_)}})}function Ju(r){return r?r.flatMap(e=>e.type===Un?Ju(e.children):[e]):[]}function Us(r){if(r===null||typeof r!="object")return!1;const e=Object.getPrototypeOf(r);return e!==null&&e!==Object.prototype&&Object.getPrototypeOf(e)!==null||Symbol.iterator in r?!1:Symbol.toStringTag in r?Object.prototype.toString.call(r)==="[object Module]":!0}function Ql(r,e,t=".",n){if(!Us(e))return Ql(r,{},t);const i=Object.assign({},e);for(const o in r){if(o==="__proto__"||o==="constructor")continue;const a=r[o];a!=null&&(Array.isArray(a)&&Array.isArray(i[o])?i[o]=[...a,...i[o]]:Us(a)&&Us(i[o])?i[o]=Ql(a,i[o],(t?`${t}.`:"")+o.toString()):i[o]=a)}return i}function pM(r){return(...e)=>e.reduce((t,n)=>Ql(t,n,""),{})}const mM=pM(),[Im,vO]=Yu("ConfigProvider");let gM="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",vM=(r=21)=>{let e="",t=r;for(;t--;)e+=gM[Math.random()*64|0];return e};const yM=tM(()=>{const r=le(new Map),e=le(),t=Ve(()=>{for(const a of r.value.values())if(a)return!0;return!1}),n=Im({scrollBody:le(!0)});let i=null;const o=()=>{document.body.style.paddingRight="",document.body.style.marginRight="",document.body.style.pointerEvents="",document.body.style.removeProperty("--scrollbar-width"),document.body.style.overflow=e.value??"",qf&&(i==null||i()),e.value=void 0};return Ge(t,(a,s)=>{var l;if(!Tr)return;if(!a){s&&o();return}e.value===void 0&&(e.value=document.body.style.overflow);const u=window.innerWidth-document.documentElement.clientWidth,c={padding:u,margin:0},h=(l=n.scrollBody)!=null&&l.value?typeof n.scrollBody.value=="object"?mM({padding:n.scrollBody.value.padding===!0?u:n.scrollBody.value.padding,margin:n.scrollBody.value.margin===!0?u:n.scrollBody.value.margin},c):c:{padding:0,margin:0};u>0&&(document.body.style.paddingRight=typeof h.padding=="number"?`${h.padding}px`:String(h.padding),document.body.style.marginRight=typeof h.margin=="number"?`${h.margin}px`:String(h.margin),document.body.style.setProperty("--scrollbar-width",`${u}px`),document.body.style.overflow="hidden"),qf&&(i=Am(document,"touchmove",p=>xM(p),{passive:!1})),Qt(()=>{document.body.style.pointerEvents="none",document.body.style.overflow="hidden"})},{immediate:!0,flush:"sync"}),r});function _M(r){const e=vM(6),t=yM();t.value.set(e,r);const n=Ve({get:()=>t.value.get(e)??!1,set:i=>t.value.set(e,i)});return lM(()=>{t.value.delete(e)}),n}function Pm(r){const e=window.getComputedStyle(r);if(e.overflowX==="scroll"||e.overflowY==="scroll"||e.overflowX==="auto"&&r.clientWidth1?!0:(e.preventDefault&&e.cancelable&&e.preventDefault(),!1)}function Qu(r){const e=_r(),t=e==null?void 0:e.type.emits,n={};return t!=null&&t.length||console.warn(`No emitted event found. Please check component: ${e==null?void 0:e.type.__name}`),t==null||t.forEach(i=>{n[Kg(Zg(i))]=(...o)=>r(i,...o)}),n}function In(){const r=_r(),e=le(),t=Ve(()=>{var a,s;return["#text","#comment"].includes((a=e.value)==null?void 0:a.$el.nodeName)?(s=e.value)==null?void 0:s.$el.nextElementSibling:sa(e)}),n=Object.assign({},r.exposed),i={};for(const a in r.props)Object.defineProperty(i,a,{enumerable:!0,configurable:!0,get:()=>r.props[a]});if(Object.keys(n).length>0)for(const a in n)Object.defineProperty(i,a,{enumerable:!0,configurable:!0,get:()=>n[a]});Object.defineProperty(i,"$el",{enumerable:!0,configurable:!0,get:()=>r.vnode.el}),r.exposed=i;function o(a){e.value=a,!(a instanceof Element||!a)&&(Object.defineProperty(i,"$el",{enumerable:!0,configurable:!0,get:()=>a.$el}),r.exposed=i)}return{forwardRef:o,currentRef:e,currentElement:t}}var bM=function(r){if(typeof document>"u")return null;var e=Array.isArray(r)?r[0]:r;return e.ownerDocument.body},Fr=new WeakMap,fo=new WeakMap,po={},zs=0,Mm=function(r){return r&&(r.host||Mm(r.parentNode))},wM=function(r,e){return e.map(function(t){if(r.contains(t))return t;var n=Mm(t);return n&&r.contains(n)?n:(console.error("aria-hidden",t,"in not contained inside",r,". Doing nothing"),null)}).filter(function(t){return!!t})},TM=function(r,e,t,n){var i=wM(e,Array.isArray(r)?r:[r]);po[t]||(po[t]=new WeakMap);var o=po[t],a=[],s=new Set,l=new Set(i),u=function(h){!h||s.has(h)||(s.add(h),u(h.parentNode))};i.forEach(u);var c=function(h){!h||l.has(h)||Array.prototype.forEach.call(h.children,function(p){if(s.has(p))c(p);else try{var f=p.getAttribute(n),g=f!==null&&f!=="false",v=(Fr.get(p)||0)+1,d=(o.get(p)||0)+1;Fr.set(p,v),o.set(p,d),a.push(p),v===1&&g&&fo.set(p,!0),d===1&&p.setAttribute(t,"true"),g||p.setAttribute(n,"true")}catch(m){console.error("aria-hidden: cannot operate on ",p,m)}})};return c(e),s.clear(),zs++,function(){a.forEach(function(h){var p=Fr.get(h)-1,f=o.get(h)-1;Fr.set(h,p),o.set(h,f),p||(fo.has(h)||h.removeAttribute(n),fo.delete(h)),f||h.removeAttribute(t)}),zs--,zs||(Fr=new WeakMap,Fr=new WeakMap,fo=new WeakMap,po={})}},SM=function(r,e,t){t===void 0&&(t="data-aria-hidden");var n=Array.from(Array.isArray(r)?r:[r]),i=bM(r);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live]"))),TM(n,i,t,"aria-hidden")):function(){return null}};function EM(r){let e;Ge(()=>sa(r),t=>{t?e=SM(t):e&&e()}),Gt(()=>{e&&e()})}function eu(r,e="radix"){return Im({useId:void 0}),`${e}-${Xg()}`}function CM(r,e){const t=le(r);function n(i){return e[t.value][i]??t.value}return{state:t,dispatch:i=>{t.value=n(i)}}}const AM=Ne({name:"PrimitiveSlot",inheritAttrs:!1,setup(r,{attrs:e,slots:t}){return()=>{var n,i;if(!t.default)return null;const o=Ju(t.default()),a=o.findIndex(c=>c.type!==Jg);if(a===-1)return o;const s=o[a];(n=s.props)==null||delete n.ref;const l=s.props?zn(e,s.props):e;e.class&&(i=s.props)!=null&&i.class&&delete s.props.class;const u=Qg(s,l);for(const c in l)c.startsWith("on")&&(u.props||(u.props={}),u.props[c]=l[c]);return o.length===1?u:(o[a]=u,o)}}}),la=Ne({name:"Primitive",inheritAttrs:!1,props:{asChild:{type:Boolean,default:!1},as:{type:[String,Object],default:"div"}},setup(r,{attrs:e,slots:t}){const n=r.asChild?"template":r.as;return typeof n=="string"&&["area","img","input"].includes(n)?()=>_o(n,e):n!=="template"?()=>_o(r.as,e,{default:t.default}):()=>_o(AM,e,{default:t.default})}});function IM(r,e){var t;const n=le({}),i=le("none"),o=le(r),a=r.value?"mounted":"unmounted";let s;const l=((t=e.value)==null?void 0:t.ownerDocument.defaultView)??Zu,{state:u,dispatch:c}=CM(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}}),h=d=>{var m;if(Tr){const y=new CustomEvent(d,{bubbles:!1,cancelable:!1});(m=e.value)==null||m.dispatchEvent(y)}};Ge(r,async(d,m)=>{var y;const _=m!==d;if(await Qt(),_){const E=i.value,x=mo(e.value);d?(c("MOUNT"),h("enter"),x==="none"&&h("after-enter")):x==="none"||((y=n.value)==null?void 0:y.display)==="none"?(c("UNMOUNT"),h("leave"),h("after-leave")):m&&E!==x?(c("ANIMATION_OUT"),h("leave")):(c("UNMOUNT"),h("after-leave"))}},{immediate:!0});const p=d=>{const m=mo(e.value),y=m.includes(d.animationName),_=u.value==="mounted"?"enter":"leave";if(d.target===e.value&&y&&(h(`after-${_}`),c("ANIMATION_END"),!o.value)){const E=e.value.style.animationFillMode;e.value.style.animationFillMode="forwards",s=l==null?void 0:l.setTimeout(()=>{var x;((x=e.value)==null?void 0:x.style.animationFillMode)==="forwards"&&(e.value.style.animationFillMode=E)})}d.target===e.value&&m==="none"&&c("ANIMATION_END")},f=d=>{d.target===e.value&&(i.value=mo(e.value))},g=Ge(e,(d,m)=>{d?(n.value=getComputedStyle(d),d.addEventListener("animationstart",f),d.addEventListener("animationcancel",p),d.addEventListener("animationend",p)):(c("ANIMATION_END"),l==null||l.clearTimeout(s),m==null||m.removeEventListener("animationstart",f),m==null||m.removeEventListener("animationcancel",p),m==null||m.removeEventListener("animationend",p))},{immediate:!0}),v=Ge(u,()=>{const d=mo(e.value);i.value=u.value==="mounted"?d:"none"});return Gt(()=>{g(),v()}),{isPresent:Ve(()=>["mounted","unmountSuspended"].includes(u.value))}}function mo(r){return r&&getComputedStyle(r).animationName||"none"}const km=Ne({name:"Presence",props:{present:{type:Boolean,required:!0},forceMount:{type:Boolean}},slots:{},setup(r,{slots:e,expose:t}){var n;const{present:i,forceMount:o}=Kr(r),a=le(),{isPresent:s}=IM(i,a);t({present:s});let l=e.default({present:s});l=Ju(l||[]);const u=_r();if(l&&(l==null?void 0:l.length)>1){const c=(n=u==null?void 0:u.parent)!=null&&n.type.name?`<${u.parent.type.name} />`:"component";throw new Error([`Detected an invalid children for \`${c}\` for \`Presence\` component.`,"","Note: Presence works similarly to `v-if` directly, but it waits for animation/transition to finished before unmounting. So it expect only one direct child of valid VNode type.","You can apply a few solutions:",["Provide a single child element so that `presence` directive attach correctly.","Ensure the first child is an actual element instead of a raw text node or comment node."].map(h=>` - ${h}`).join(` +`)].join(` +`))}return()=>o.value||i.value||s.value?_o(e.default({present:s})[0],{ref:c=>{const h=sa(c);return typeof(h==null?void 0:h.hasAttribute)>"u"||(h!=null&&h.hasAttribute("data-radix-popper-content-wrapper")?a.value=h.firstElementChild:a.value=h),h}}):null}}),[Sr,PM]=Yu("DialogRoot"),MM=Ne({inheritAttrs:!1,__name:"DialogRoot",props:{open:{type:Boolean,default:void 0},defaultOpen:{type:Boolean,default:!1},modal:{type:Boolean,default:!0}},emits:["update:open"],setup(r,{emit:e}){const t=r,n=dM(t,"open",e,{defaultValue:t.defaultOpen,passive:t.open===void 0}),i=le(),o=le(),{modal:a}=Kr(t);return PM({open:n,modal:a,openModal:()=>{n.value=!0},onOpenChange:s=>{n.value=s},onOpenToggle:()=>{n.value=!n.value},contentId:"",titleId:"",descriptionId:"",triggerElement:i,contentElement:o}),(s,l)=>ut(s.$slots,"default",{open:K(n)})}}),kM=Ne({__name:"DialogTrigger",props:{asChild:{type:Boolean},as:{default:"button"}},setup(r){const e=r,t=Sr(),{forwardRef:n,currentElement:i}=In();return t.contentId||(t.contentId=eu(void 0,"radix-vue-dialog-content")),Jt(()=>{t.triggerElement.value=i.value}),(o,a)=>(fe(),lt(K(la),zn(e,{ref:K(n),type:o.as==="button"?"button":void 0,"aria-haspopup":"dialog","aria-expanded":K(t).open.value||!1,"aria-controls":K(t).open.value?K(t).contentId:void 0,"data-state":K(t).open.value?"open":"closed",onClick:K(t).onOpenToggle}),{default:Be(()=>[ut(o.$slots,"default")]),_:3},16,["type","aria-expanded","aria-controls","data-state","onClick"]))}}),OM=Ne({__name:"Teleport",props:{to:{default:"body"},disabled:{type:Boolean},forceMount:{type:Boolean}},setup(r){const e=hM();return(t,n)=>K(e)||t.forceMount?(fe(),lt(Wg,{key:0,to:t.to,disabled:t.disabled},[ut(t.$slots,"default")],8,["to","disabled"])):nt("",!0)}}),RM=Ne({__name:"DialogPortal",props:{to:{},disabled:{type:Boolean},forceMount:{type:Boolean}},setup(r){const e=r;return(t,n)=>(fe(),lt(K(OM),$g(Hg(e)),{default:Be(()=>[ut(t.$slots,"default")]),_:3},16))}}),FM="dismissableLayer.pointerDownOutside",LM="dismissableLayer.focusOutside";function Om(r,e){const t=e.closest("[data-dismissable-layer]"),n=r.dataset.dismissableLayer===""?r:r.querySelector("[data-dismissable-layer]"),i=Array.from(r.ownerDocument.querySelectorAll("[data-dismissable-layer]"));return!!(t&&n===t||i.indexOf(n){});return hn(a=>{if(!Tr)return;const s=async u=>{const c=u.target;if(e!=null&&e.value){if(Om(e.value,c)){i.value=!1;return}if(u.target&&!i.value){let h=function(){Em(FM,r,p)};const p={originalEvent:u};u.pointerType==="touch"?(n.removeEventListener("click",o.value),o.value=h,n.addEventListener("click",o.value,{once:!0})):h()}else n.removeEventListener("click",o.value);i.value=!1}},l=window.setTimeout(()=>{n.addEventListener("pointerdown",s)},0);a(()=>{window.clearTimeout(l),n.removeEventListener("pointerdown",s),n.removeEventListener("click",o.value)})}),{onPointerDownCapture:()=>i.value=!0}}function DM(r,e){var t;const n=((t=e==null?void 0:e.value)==null?void 0:t.ownerDocument)??(globalThis==null?void 0:globalThis.document),i=le(!1);return hn(o=>{if(!Tr)return;const a=async s=>{e!=null&&e.value&&(await Qt(),!(!e.value||Om(e.value,s.target))&&s.target&&!i.value&&Em(LM,r,{originalEvent:s}))};n.addEventListener("focusin",a),o(()=>n.removeEventListener("focusin",a))}),{onFocusCapture:()=>i.value=!0,onBlurCapture:()=>i.value=!1}}const _n=Id({layersRoot:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),BM=Ne({__name:"DismissableLayer",props:{disableOutsidePointerEvents:{type:Boolean,default:!1},asChild:{type:Boolean},as:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","dismiss"],setup(r,{emit:e}){const t=r,n=e,{forwardRef:i,currentElement:o}=In(),a=Ve(()=>{var g;return((g=o.value)==null?void 0:g.ownerDocument)??globalThis.document}),s=Ve(()=>_n.layersRoot),l=Ve(()=>o.value?Array.from(s.value).indexOf(o.value):-1),u=Ve(()=>_n.layersWithOutsidePointerEventsDisabled.size>0),c=Ve(()=>{const g=Array.from(s.value),[v]=[..._n.layersWithOutsidePointerEventsDisabled].slice(-1),d=g.indexOf(v);return l.value>=d}),h=NM(async g=>{const v=[..._n.branches].some(d=>d==null?void 0:d.contains(g.target));!c.value||v||(n("pointerDownOutside",g),n("interactOutside",g),await Qt(),g.defaultPrevented||n("dismiss"))},o),p=DM(g=>{[..._n.branches].some(v=>v==null?void 0:v.contains(g.target))||(n("focusOutside",g),n("interactOutside",g),g.defaultPrevented||n("dismiss"))},o);cM("Escape",g=>{l.value===s.value.size-1&&(n("escapeKeyDown",g),g.defaultPrevented||n("dismiss"))});let f;return hn(g=>{o.value&&(t.disableOutsidePointerEvents&&(_n.layersWithOutsidePointerEventsDisabled.size===0&&(f=a.value.body.style.pointerEvents,a.value.body.style.pointerEvents="none"),_n.layersWithOutsidePointerEventsDisabled.add(o.value)),s.value.add(o.value),g(()=>{t.disableOutsidePointerEvents&&_n.layersWithOutsidePointerEventsDisabled.size===1&&(a.value.body.style.pointerEvents=f)}))}),hn(g=>{g(()=>{o.value&&(s.value.delete(o.value),_n.layersWithOutsidePointerEventsDisabled.delete(o.value))})}),(g,v)=>(fe(),lt(K(la),{ref:K(i),"as-child":g.asChild,as:g.as,"data-dismissable-layer":"",style:Yr({pointerEvents:u.value?c.value?"auto":"none":void 0}),onFocusCapture:K(p).onFocusCapture,onBlurCapture:K(p).onBlurCapture,onPointerdownCapture:K(h).onPointerDownCapture},{default:Be(()=>[ut(g.$slots,"default")]),_:3},8,["as-child","as","style","onFocusCapture","onBlurCapture","onPointerdownCapture"]))}}),js="focusScope.autoFocusOnMount",Vs="focusScope.autoFocusOnUnmount",Yf={bubbles:!1,cancelable:!0};function UM(r,{select:e=!1}={}){const t=document.activeElement;for(const n of r)if(Fn(n,{select:e}),document.activeElement!==t)return!0}function zM(r){const e=Rm(r),t=Kf(e,r),n=Kf(e.reverse(),r);return[t,n]}function Rm(r){const e=[],t=document.createTreeWalker(r,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const i=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||i?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;t.nextNode();)e.push(t.currentNode);return e}function Kf(r,e){for(const t of r)if(!jM(t,{upTo:e}))return t}function jM(r,{upTo:e}){if(getComputedStyle(r).visibility==="hidden")return!0;for(;r;){if(e!==void 0&&r===e)return!1;if(getComputedStyle(r).display==="none")return!0;r=r.parentElement}return!1}function VM(r){return r instanceof HTMLInputElement&&"select"in r}function Fn(r,{select:e=!1}={}){if(r&&r.focus){const t=document.activeElement;r.focus({preventScroll:!0}),r!==t&&VM(r)&&e&&r.select()}}const GM=eM(()=>le([]));function $M(){const r=GM();return{add(e){const t=r.value[0];e!==t&&(t==null||t.pause()),r.value=Zf(r.value,e),r.value.unshift(e)},remove(e){var t;r.value=Zf(r.value,e),(t=r.value[0])==null||t.resume()}}}function Zf(r,e){const t=[...r],n=t.indexOf(e);return n!==-1&&t.splice(n,1),t}function HM(r){return r.filter(e=>e.tagName!=="A")}const XM=Ne({__name:"FocusScope",props:{loop:{type:Boolean,default:!1},trapped:{type:Boolean,default:!1},asChild:{type:Boolean},as:{}},emits:["mountAutoFocus","unmountAutoFocus"],setup(r,{emit:e}){const t=r,n=e,{currentRef:i,currentElement:o}=In(),a=le(null),s=$M(),l=Id({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}});hn(c=>{if(!Tr)return;const h=o.value;if(!t.trapped)return;function p(d){if(l.paused||!h)return;const m=d.target;h.contains(m)?a.value=m:Fn(a.value,{select:!0})}function f(d){if(l.paused||!h)return;const m=d.relatedTarget;m!==null&&(h.contains(m)||Fn(a.value,{select:!0}))}function g(d){h.contains(a.value)||Fn(h)}document.addEventListener("focusin",p),document.addEventListener("focusout",f);const v=new MutationObserver(g);h&&v.observe(h,{childList:!0,subtree:!0}),c(()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",f),v.disconnect()})}),hn(async c=>{const h=o.value;if(await Qt(),!h)return;s.add(l);const p=document.activeElement;if(!h.contains(p)){const f=new CustomEvent(js,Yf);h.addEventListener(js,g=>n("mountAutoFocus",g)),h.dispatchEvent(f),f.defaultPrevented||(UM(HM(Rm(h)),{select:!0}),document.activeElement===p&&Fn(h))}c(()=>{h.removeEventListener(js,v=>n("mountAutoFocus",v));const f=new CustomEvent(Vs,Yf),g=v=>{n("unmountAutoFocus",v)};h.addEventListener(Vs,g),h.dispatchEvent(f),setTimeout(()=>{f.defaultPrevented||Fn(p??document.body,{select:!0}),h.removeEventListener(Vs,g),s.remove(l)},0)})});function u(c){if(!t.loop&&!t.trapped||l.paused)return;const h=c.key==="Tab"&&!c.altKey&&!c.ctrlKey&&!c.metaKey,p=document.activeElement;if(h&&p){const f=c.currentTarget,[g,v]=zM(f);g&&v?!c.shiftKey&&p===v?(c.preventDefault(),t.loop&&Fn(g,{select:!0})):c.shiftKey&&p===g&&(c.preventDefault(),t.loop&&Fn(v,{select:!0})):p===f&&c.preventDefault()}}return(c,h)=>(fe(),lt(K(la),{ref_key:"currentRef",ref:i,tabindex:"-1","as-child":c.asChild,as:c.as,onKeydown:u},{default:Be(()=>[ut(c.$slots,"default")]),_:3},8,["as-child","as"]))}});function WM(r){return r?"open":"closed"}const Fm=Ne({__name:"DialogContentImpl",props:{forceMount:{type:Boolean},trapFocus:{type:Boolean},disableOutsidePointerEvents:{type:Boolean},asChild:{type:Boolean},as:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(r,{emit:e}){const t=r,n=e,i=Sr(),{forwardRef:o,currentElement:a}=In();return i.titleId||(i.titleId=eu(void 0,"radix-vue-dialog-title")),i.descriptionId||(i.descriptionId=eu(void 0,"radix-vue-dialog-description")),Jt(()=>{i.contentElement=a,document.activeElement!==document.body&&(i.triggerElement.value=document.activeElement)}),(s,l)=>(fe(),lt(K(XM),{"as-child":"",loop:"",trapped:t.trapFocus,onMountAutoFocus:l[5]||(l[5]=u=>n("openAutoFocus",u)),onUnmountAutoFocus:l[6]||(l[6]=u=>n("closeAutoFocus",u))},{default:Be(()=>[Oe(K(BM),zn({id:K(i).contentId,ref:K(o),as:s.as,"as-child":s.asChild,"disable-outside-pointer-events":s.disableOutsidePointerEvents,role:"dialog","aria-describedby":K(i).descriptionId,"aria-labelledby":K(i).titleId,"data-state":K(WM)(K(i).open.value)},s.$attrs,{onDismiss:l[0]||(l[0]=u=>K(i).onOpenChange(!1)),onEscapeKeyDown:l[1]||(l[1]=u=>n("escapeKeyDown",u)),onFocusOutside:l[2]||(l[2]=u=>n("focusOutside",u)),onInteractOutside:l[3]||(l[3]=u=>n("interactOutside",u)),onPointerDownOutside:l[4]||(l[4]=u=>n("pointerDownOutside",u))}),{default:Be(()=>[ut(s.$slots,"default")]),_:3},16,["id","as","as-child","disable-outside-pointer-events","aria-describedby","aria-labelledby","data-state"])]),_:3},8,["trapped"]))}}),qM=Ne({__name:"DialogContentModal",props:{forceMount:{type:Boolean},trapFocus:{type:Boolean},disableOutsidePointerEvents:{type:Boolean},asChild:{type:Boolean},as:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(r,{emit:e}){const t=r,n=e,i=Sr(),o=Qu(n),{forwardRef:a,currentElement:s}=In();return EM(s),(l,u)=>(fe(),lt(Fm,zn({...t,...K(o)},{ref:K(a),"trap-focus":K(i).open.value,"disable-outside-pointer-events":!0,onCloseAutoFocus:u[0]||(u[0]=c=>{var h;c.defaultPrevented||(c.preventDefault(),(h=K(i).triggerElement.value)==null||h.focus())}),onPointerDownOutside:u[1]||(u[1]=c=>{const h=c.detail.originalEvent,p=h.button===0&&h.ctrlKey===!0;(h.button===2||p)&&c.preventDefault()}),onFocusOutside:u[2]||(u[2]=c=>{c.preventDefault()})}),{default:Be(()=>[ut(l.$slots,"default")]),_:3},16,["trap-focus"]))}}),YM=Ne({__name:"DialogContentNonModal",props:{forceMount:{type:Boolean},trapFocus:{type:Boolean},disableOutsidePointerEvents:{type:Boolean},asChild:{type:Boolean},as:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(r,{emit:e}){const t=r,n=Qu(e);In();const i=Sr(),o=le(!1),a=le(!1);return(s,l)=>(fe(),lt(Fm,zn({...t,...K(n)},{"trap-focus":!1,"disable-outside-pointer-events":!1,onCloseAutoFocus:l[0]||(l[0]=u=>{var c;u.defaultPrevented||(o.value||(c=K(i).triggerElement.value)==null||c.focus(),u.preventDefault()),o.value=!1,a.value=!1}),onInteractOutside:l[1]||(l[1]=u=>{var c;u.defaultPrevented||(o.value=!0,u.detail.originalEvent.type==="pointerdown"&&(a.value=!0));const h=u.target;(c=K(i).triggerElement.value)!=null&&c.contains(h)&&u.preventDefault(),u.detail.originalEvent.type==="focusin"&&a.value&&u.preventDefault()})}),{default:Be(()=>[ut(s.$slots,"default")]),_:3},16))}}),KM=Ne({__name:"DialogContent",props:{forceMount:{type:Boolean},trapFocus:{type:Boolean},disableOutsidePointerEvents:{type:Boolean},asChild:{type:Boolean},as:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(r,{emit:e}){const t=r,n=e,i=Sr(),o=Qu(n),{forwardRef:a}=In();return(s,l)=>(fe(),lt(K(km),{present:s.forceMount||K(i).open.value},{default:Be(()=>[K(i).modal.value?(fe(),lt(qM,zn({key:0,ref:K(a)},{...t,...K(o),...s.$attrs}),{default:Be(()=>[ut(s.$slots,"default")]),_:3},16)):(fe(),lt(YM,zn({key:1,ref:K(a)},{...t,...K(o),...s.$attrs}),{default:Be(()=>[ut(s.$slots,"default")]),_:3},16))]),_:3},8,["present"]))}}),ZM=Ne({__name:"DialogOverlayImpl",props:{asChild:{type:Boolean},as:{}},setup(r){const e=Sr();return _M(!0),In(),(t,n)=>(fe(),lt(K(la),{as:t.as,"as-child":t.asChild,"data-state":K(e).open.value?"open":"closed",style:{"pointer-events":"auto"}},{default:Be(()=>[ut(t.$slots,"default")]),_:3},8,["as","as-child","data-state"]))}}),JM=Ne({__name:"DialogOverlay",props:{forceMount:{type:Boolean},asChild:{type:Boolean},as:{}},setup(r){const e=Sr(),{forwardRef:t}=In();return(n,i)=>{var o;return(o=K(e))!=null&&o.modal.value?(fe(),lt(K(km),{key:0,present:n.forceMount||K(e).open.value},{default:Be(()=>[Oe(ZM,zn(n.$attrs,{ref:K(t),as:n.as,"as-child":n.asChild}),{default:Be(()=>[ut(n.$slots,"default")]),_:3},16,["as","as-child"])]),_:3},8,["present"])):nt("",!0)}}});function QM(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}QM();(function(){try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode('[vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32,.72,0,1)}[vaul-drawer][vaul-drawer-direction=bottom]{transform:translate3d(0,100%,0)}[vaul-drawer][vaul-drawer-direction=top]{transform:translate3d(0,-100%,0)}[vaul-drawer][vaul-drawer-direction=left]{transform:translate3d(-100%,0,0)}[vaul-drawer][vaul-drawer-direction=right]{transform:translate3d(100%,0,0)}.vaul-dragging .vaul-scrollable [vault-drawer-direction=top],.vaul-dragging .vaul-scrollable [vault-drawer-direction=bottom]{overflow-y:hidden!important}.vaul-dragging .vaul-scrollable [vault-drawer-direction=left],.vaul-dragging .vaul-scrollable [vault-drawer-direction=right]{overflow-x:hidden!important}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=top],[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height, 0),0)}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=left],[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height, 0),0,0)}[vaul-overlay]{opacity:0;transition:opacity .5s cubic-bezier(.32,.72,0,1)}[vaul-overlay][vaul-drawer-visible=true]{opacity:1}[vaul-drawer]:after{content:"";position:absolute;background:inherit;background-color:inherit}[vaul-drawer][vaul-drawer-direction=top]:after{top:initial;bottom:100%;left:0;right:0;height:200%}[vaul-drawer][vaul-drawer-direction=bottom]:after{top:100%;bottom:initial;left:0;right:0;height:200%}[vaul-drawer][vaul-drawer-direction=left]:after{left:initial;right:100%;top:0;bottom:0;width:200%}[vaul-drawer][vaul-drawer-direction=right]:after{left:100%;right:initial;top:0;bottom:0;width:200%}[vaul-overlay][vaul-snap-points=true]:not([vaul-snap-points-overlay=true]):not([data-state=closed]){opacity:0}[vaul-overlay][vaul-snap-points-overlay=true]:not([vaul-drawer-visible=false]){opacity:1}@keyframes fake-animation{}@media (hover: hover) and (pointer: fine){[vaul-drawer]{-webkit-user-select:none;user-select:none}}')),document.head.appendChild(r)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();const ek=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const tk=r=>typeof r<"u";function nk(r){return JSON.parse(JSON.stringify(r))}function Jf(r,e,t,n={}){var i,o,a;const{clone:s=!1,passive:l=!1,eventName:u,deep:c=!1,defaultValue:h,shouldEmit:p}=n,f=_r(),g=t||(f==null?void 0:f.emit)||((i=f==null?void 0:f.$emit)==null?void 0:i.bind(f))||((a=(o=f==null?void 0:f.proxy)==null?void 0:o.$emit)==null?void 0:a.bind(f==null?void 0:f.proxy));let v=u;e||(e="modelValue"),v=v||`update:${e.toString()}`;const d=_=>s?typeof s=="function"?s(_):nk(_):_,m=()=>tk(r[e])?d(r[e]):h,y=_=>{p?p(_)&&g(v,_):g(v,_)};if(l){const _=m(),E=le(_);let x=!1;return Ge(()=>r[e],b=>{x||(x=!0,E.value=d(b),Qt(()=>x=!1))}),Ge(E,b=>{!x&&(b!==r[e]||c)&&y(b)},{deep:c}),E}else return Ve({get(){return m()},set(_){y(_)}})}const[Lm,rk]=Yu("DrawerRoot"),Nm=new WeakMap;function it(r,e,t=!1){if(!r||!(r instanceof HTMLElement)||!e)return;const n={};Object.entries(e).forEach(([i,o])=>{if(i.startsWith("--")){r.style.setProperty(i,o);return}n[i]=r.style[i],r.style[i]=o}),!t&&Nm.set(r,n)}function go(r,e){if(!r||!(r instanceof HTMLElement))return;const t=Nm.get(r);t&&(e?r.style[e]=t[e]:Object.entries(t).forEach(([n,i])=>{r.style[n]=i}))}function vo(r,e){const t=window.getComputedStyle(r),n=t.transform||t.webkitTransform||t.mozTransform;let i=n.match(/^matrix3d\((.+)\)$/);return i?Number.parseFloat(i[1].split(", ")[vt(e)?13:12]):(i=n.match(/^matrix\((.+)\)$/),i?Number.parseFloat(i[1].split(", ")[vt(e)?5:4]):null)}function ik(r){return 8*(Math.log(r+1)-2)}function vt(r){switch(r){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return r}}const Ye={DURATION:.5,EASE:[.32,.72,0,1]},Dm=.4;function ok({activeSnapPoint:r,snapPoints:e,drawerRef:t,overlayRef:n,fadeFromIndex:i,onSnapPointChange:o,direction:a}){const s=Ve(()=>(e.value&&r.value===e.value[e.value.length-1])??null),l=Ve(()=>e.value&&e.value.length>0&&((i==null?void 0:i.value)||(i==null?void 0:i.value)===0)&&!Number.isNaN(i==null?void 0:i.value)&&e.value[(i==null?void 0:i.value)??-1]===r.value||!e.value),u=Ve(()=>{var d;return((d=e.value)==null?void 0:d.findIndex(m=>m===r.value))??null}),c=Ve(()=>{var d;return((d=e.value)==null?void 0:d.map(m=>{const y=typeof window<"u",_=typeof m=="string";let E=0;if(_&&(E=Number.parseInt(m,10)),vt(a.value)){const b=_?E:y?m*window.innerHeight:0;return y?a.value==="bottom"?window.innerHeight-b:-window.innerHeight+b:b}const x=_?E:y?m*window.innerWidth:0;return y?a.value==="right"?window.innerWidth-x:-window.innerWidth+x:x}))??[]}),h=Ve(()=>{var d;return u.value!==null?(d=c.value)==null?void 0:d[u.value]:null}),p=d=>{var m,y,_,E;const x=((m=c.value)==null?void 0:m.findIndex(b=>b===d))??null;Qt(()=>{var b;o(x,c.value),it((b=t.value)==null?void 0:b.$el,{transition:`transform ${Ye.DURATION}s cubic-bezier(${Ye.EASE.join(",")})`,transform:vt(a.value)?`translate3d(0, ${d}px, 0)`:`translate3d(${d}px, 0, 0)`})}),c.value&&x!==c.value.length-1&&x!==(i==null?void 0:i.value)?it((y=n.value)==null?void 0:y.$el,{transition:`opacity ${Ye.DURATION}s cubic-bezier(${Ye.EASE.join(",")})`,opacity:"0"}):it((_=n.value)==null?void 0:_.$el,{transition:`opacity ${Ye.DURATION}s cubic-bezier(${Ye.EASE.join(",")})`,opacity:"1"}),r.value=x!==null?((E=e.value)==null?void 0:E[x])??null:null};Ge([r,c,e],()=>{var d;if(r.value){const m=((d=e.value)==null?void 0:d.findIndex(y=>y===r.value))??-1;c.value&&m!==-1&&typeof c.value[m]=="number"&&p(c.value[m])}},{immediate:!0});function f({draggedDistance:d,closeDrawer:m,velocity:y,dismissible:_}){var E,x,b;if(i===void 0)return;const C=a.value==="bottom"||a.value==="right"?(h.value??0)-d:(h.value??0)+d,A=u.value===(i.value??0)-1,M=u.value===0,I=d>0;if(A&&it((E=n.value)==null?void 0:E.$el,{transition:`opacity ${Ye.DURATION}s cubic-bezier(${Ye.EASE.join(",")})`}),y>2&&!I){_?m():p(c.value[0]);return}if(y>2&&I&&c&&e.value){p(c.value[e.value.length-1]);return}const F=(x=c.value)==null?void 0:x.reduce((X,w)=>typeof X!="number"||typeof w!="number"?X:Math.abs(w-C)Dm&&Math.abs(d)0&&s){p(c.value[(((b=e.value)==null?void 0:b.length)??0)-1]);return}if(M&&X<0&&_&&m(),u.value===null)return;p(c.value[u.value+X]);return}p(F)}function g({draggedDistance:d}){var m;if(h.value===null)return;const y=a.value==="bottom"||a.value==="right"?(h.value??0)-d:(h.value??0)+d;(a.value==="bottom"||a.value==="right")&&yc.value[c.value.length-1]||it((m=t.value)==null?void 0:m.$el,{transform:vt(a.value)?`translate3d(0, ${y}px, 0)`:`translate3d(${y}px, 0, 0)`})}function v(d,m){if(!e||typeof u.value!="number"||!c.value||i===void 0)return null;const y=u.value===(i.value??0)-1;if(u.value>=(i.value??0)&&m)return 0;if(y&&!m)return 1;if(!l.value&&!y)return null;const _=y?u.value+1:u.value-1,E=y?c.value[_]-c.value[_-1]:c.value[_+1]-c.value[_],x=d/Math.abs(E);return y?1-x:x}return{isLastSnapPoint:s,shouldFade:l,getPercentageDragged:v,activeSnapPointIndex:u,onRelease:f,onDrag:g,snapPointsOffset:c}}let fi=null;function ak(r){const{isOpen:e,modal:t,nested:n,hasBeenOpened:i}=r,o=le(typeof window<"u"?window.location.href:""),a=le(0);function s(){if(fi===null&&e.value){fi={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height};const{scrollX:u,innerHeight:c}=window;document.body.style.position="fixed",document.body.style.top=`-${a.value}px`,document.body.style.left=`-${u}px`,document.body.style.right="0px",document.body.style.height="auto",setTimeout(()=>{requestAnimationFrame(()=>{const h=c-window.innerHeight;h&&a.value>=c&&(document.body.style.top=`-${a.value+h}px`)})},300)}}function l(){if(fi!==null){const u=-Number.parseInt(document.body.style.top,10),c=-Number.parseInt(document.body.style.left,10);Object.assign(document.body.style,fi),requestAnimationFrame(()=>{if(o.value!==window.location.href){o.value=window.location.href;return}window.scrollTo(c,u)}),fi=null}}return Jt(()=>{function u(){a.value=window.scrollY}u(),window.addEventListener("scroll",u),Gt(()=>{window.removeEventListener("scroll",u)})}),Ge([e,i,o],()=>{n.value||!i.value||(e.value?(!window.matchMedia("(display-mode: standalone)").matches&&s(),t.value||setTimeout(()=>{l()},500)):l())}),{restorePositionSetting:l}}const sk=.25,lk=100,Qf=8,er=16,uk=26,ed="vaul-dragging";function ck(r,e){return r&&r.value?r:e}function hk(r){const{emitDrag:e,emitRelease:t,emitClose:n,emitOpenChange:i,open:o,dismissible:a,nested:s,fixed:l,modal:u,shouldScaleBackground:c,scrollLockTimeout:h,closeThreshold:p,activeSnapPoint:f,fadeFromIndex:g,direction:v}=r,d=le(o.value??!1),m=le(!1),y=le(!1),_=le(!1),E=le(!1),x=le(null),b=le(null),C=le(null),A=le(null),M=le(null),I=le(!0),F=le(null),S=le(0),X=le(!1);le(0);const w=le(null);le(0);const G=Ve(()=>{var H;return((H=w.value)==null?void 0:H.$el.getBoundingClientRect().height)||0}),R=ck(r.snapPoints,le(void 0)),{activeSnapPointIndex:L,onRelease:N,snapPointsOffset:$,onDrag:P,shouldFade:D,getPercentageDragged:j}=ok({snapPoints:R,activeSnapPoint:f,drawerRef:w,fadeFromIndex:g,overlayRef:x,onSnapPointChange:k,direction:v});function k(H,z){R.value&&H===z.length-1&&(b.value=new Date)}const{restorePositionSetting:ee}=ak({isOpen:d,modal:u,nested:s,hasBeenOpened:m});function Q(){return(window.innerWidth-uk)/window.innerWidth}function ue(H,z){var V;if(!H)return!1;let Z=H;const ae=(V=window.getSelection())==null?void 0:V.toString(),se=w.value?vo(w.value.$el,v.value):null,te=new Date;if(Z.hasAttribute("data-vaul-no-drag")||Z.closest("[data-vaul-no-drag]"))return!1;if(v.value==="right"||v.value==="left")return!0;if(b.value&&te.getTime()-b.value.getTime()<500)return!1;if(se!==null&&(v.value==="bottom"?se>0:se<0))return!0;if(ae&&ae.length>0)return!1;if(M.value&&te.getTime()-M.value.getTime()Z.clientHeight){if(Z.scrollTop!==0)return M.value=new Date,!1;if(Z.getAttribute("role")==="dialog")return!0}Z=Z.parentNode}return!0}function de(H){!a.value&&!R.value||w.value&&!w.value.$el.contains(H.target)||(_.value=!0,C.value=new Date,H.target.setPointerCapture(H.pointerId),S.value=vt(v.value)?H.clientY:H.clientX)}function ne(H){var z,V,Z,ae,se,te;if(w.value&&_.value){const he=v.value==="bottom"||v.value==="right"?1:-1,ye=(S.value-(vt(v.value)?H.clientY:H.clientX))*he,pe=ye>0,re=R.value&&!a.value&&!pe;if(re&&L.value===0)return;const ce=Math.abs(ye),me=document.querySelector("[vaul-drawer-wrapper]");let xe=ce/G.value;const Ce=j(ce,pe);if(Ce!==null&&(xe=Ce),re&&xe>=1||!I.value&&!ue(H.target,pe))return;if((z=w==null?void 0:w.value)==null||z.$el.classList.add(ed),I.value=!0,it((V=w.value)==null?void 0:V.$el,{transition:"none"}),it((Z=x.value)==null?void 0:Z.$el,{transition:"none"}),R.value&&P({draggedDistance:ye}),pe&&!R.value){const tt=ik(ye),ke=Math.min(tt*-1,0)*he;it((ae=w.value)==null?void 0:ae.$el,{transform:vt(v.value)?`translate3d(0, ${ke}px, 0)`:`translate3d(${ke}px, 0, 0)`});return}const Xe=1-xe;if((D.value||g.value&&L.value===g.value-1)&&(e(xe),it((se=x.value)==null?void 0:se.$el,{opacity:`${Xe}`,transition:"none"},!0)),me&&x.value&&c.value){const tt=Math.min(Q()+xe*(1-Q()),1),ke=8-xe*8,ht=Math.max(0,14-xe*14);it(me,{borderRadius:`${ke}px`,transform:vt(v.value)?`scale(${tt}) translate3d(0, ${ht}px, 0)`:`scale(${tt}) translate3d(${ht}px, 0, 0)`,transition:"none"},!0)}if(!R.value){const tt=ce*he;it((te=w.value)==null?void 0:te.$el,{transform:vt(v.value)?`translate3d(0, ${tt}px, 0)`:`translate3d(${tt}px, 0, 0)`})}}}function O(){var H;if(!w.value)return;const z=document.querySelector("[vaul-drawer-wrapper]"),V=vo(w.value.$el,v.value);it(w.value.$el,{transform:"translate3d(0, 0, 0)",transition:`transform ${Ye.DURATION}s cubic-bezier(${Ye.EASE.join(",")})`}),it((H=x.value)==null?void 0:H.$el,{transition:`opacity ${Ye.DURATION}s cubic-bezier(${Ye.EASE.join(",")})`,opacity:"1"}),c.value&&V&&V>0&&d.value&&it(z,{borderRadius:`${Qf}px`,overflow:"hidden",...vt(v.value)?{transform:`scale(${Q()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${Q()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${Ye.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Ye.EASE.join(",")})`},!0)}function B(){var H;w.value&&(it(w.value.$el,{transform:vt(v.value)?`translate3d(0, ${v.value==="bottom"?"100%":"-100%"}, 0)`:`translate3d(${v.value==="right"?"100%":"-100%"}, 0, 0)`,transition:`transform ${Ye.DURATION}s cubic-bezier(${Ye.EASE.join(",")})`}),it((H=x.value)==null?void 0:H.$el,{opacity:"0",transition:`opacity ${Ye.DURATION}s cubic-bezier(${Ye.EASE.join(",")})`}),oe(!1),window.setTimeout(()=>{y.value=!1,d.value=!1},300),window.setTimeout(()=>{R.value&&(f.value=R.value[0])},Ye.DURATION*1e3))}hn(()=>{if(!d.value&&c.value&&ek){const H=setTimeout(()=>{go(document.body)},200);return()=>clearTimeout(H)}}),Gt(()=>{oe(!1),ee()});function W(H){if(!_.value||!w.value)return;w.value.$el.classList.remove(ed),I.value=!1,_.value=!1,A.value=new Date;const z=vo(w.value.$el,v.value);if(!ue(H.target,!1)||!z||Number.isNaN(z)||C.value===null)return;const V=A.value.getTime()-C.value.getTime(),Z=S.value-(vt(v.value)?H.clientY:H.clientX),ae=Math.abs(Z)/V;if(ae>.05&&(E.value=!0,window.setTimeout(()=>{E.value=!1},200)),R.value){const te=v.value==="bottom"||v.value==="right"?1:-1;N({draggedDistance:Z*te,closeDrawer:B,velocity:ae,dismissible:a.value}),t(!0);return}if(v.value==="bottom"||v.value==="right"?Z>0:Z<0){O(),t(!0);return}if(ae>Dm){B(),t(!1);return}const se=Math.min(w.value.$el.getBoundingClientRect().height??0,window.innerHeight);if(z>=se*p.value){B(),t(!1);return}t(!0),O()}Ge(d,H=>{H&&(b.value=new Date,oe(!0)),i(H)},{immediate:!0}),Ge(o,H=>{H?(d.value=H,m.value=!0):B()},{immediate:!0});function oe(H){const z=document.querySelector("[vaul-drawer-wrapper]");!z||!c.value||(H?(it(document.body,{background:document.body.style.backgroundColor||document.body.style.background}),it(document.body,{background:"black"},!0),it(z,{borderRadius:`${Qf}px`,overflow:"hidden",...vt(v.value)?{transform:`scale(${Q()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${Q()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${Ye.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Ye.EASE.join(",")})`})):(go(z,"overflow"),go(z,"transform"),go(z,"borderRadius"),it(z,{transitionProperty:"transform, border-radius",transitionDuration:`${Ye.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Ye.EASE.join(",")})`})))}function ie(H){var z,V;const Z=H?(window.innerWidth-er)/window.innerWidth:1,ae=H?-er:0;F.value&&window.clearTimeout(F.value),it((z=w.value)==null?void 0:z.$el,{transition:`transform ${Ye.DURATION}s cubic-bezier(${Ye.EASE.join(",")})`,transform:`scale(${Z}) translate3d(0, ${ae}px, 0)`}),!H&&(V=w.value)!=null&&V.$el&&(F.value=window.setTimeout(()=>{var se,te;const he=vo((se=w.value)==null?void 0:se.$el,v.value);it((te=w.value)==null?void 0:te.$el,{transition:"none",transform:vt(v.value)?`translate3d(0, ${he}px, 0)`:`translate3d(${he}px, 0, 0)`})},500))}function T(H){var z;if(H<0)return;const V=vt(v.value)?window.innerHeight:window.innerWidth,Z=(V-er)/V,ae=Z+H*(1-Z),se=-er+H*er;it((z=w.value)==null?void 0:z.$el,{transform:vt(v.value)?`scale(${ae}) translate3d(0, ${se}px, 0)`:`scale(${ae}) translate3d(${se}px, 0, 0)`,transition:"none"})}function J(H){var z;const V=vt(v.value)?window.innerHeight:window.innerWidth,Z=H?(V-er)/V:1,ae=H?-er:0;H&&it((z=w.value)==null?void 0:z.$el,{transition:`transform ${Ye.DURATION}s cubic-bezier(${Ye.EASE.join(",")})`,transform:vt(v.value)?`scale(${Z}) translate3d(0, ${ae}px, 0)`:`scale(${Z}) translate3d(${ae}px, 0, 0)`})}return{open:o,isOpen:d,modal:u,keyboardIsOpen:X,hasBeenOpened:m,isVisible:y,drawerRef:w,drawerHeightRef:G,overlayRef:x,isDragging:_,dragStartTime:C,isAllowedToDrag:I,snapPoints:R,activeSnapPoint:f,pointerStart:S,dismissible:a,snapPointsOffset:$,direction:v,shouldFade:D,fadeFromIndex:g,shouldScaleBackground:c,onPress:de,onDrag:ne,onRelease:W,closeDrawer:B,onNestedDrag:T,onNestedRelease:J,onNestedOpenChange:ie,emitClose:n,emitDrag:e,emitRelease:t,emitOpenChange:i,nested:s}}const fk=Ne({__name:"DrawerRoot",props:{activeSnapPoint:{default:void 0},closeThreshold:{default:sk},shouldScaleBackground:{type:Boolean,default:void 0},scrollLockTimeout:{default:lk},fixed:{type:Boolean,default:void 0},dismissible:{type:Boolean,default:!0},modal:{type:Boolean,default:!0},open:{type:Boolean,default:void 0},defaultOpen:{type:Boolean,default:void 0},nested:{type:Boolean,default:!1},direction:{default:"bottom"},snapPoints:{default:void 0},fadeFromIndex:{default:void 0}},emits:["drag","release","close","update:open","update:activeSnapPoint"],setup(r,{expose:e,emit:t}){const n=r,i=t;ud();const o=Ve(()=>n.fadeFromIndex??(n.snapPoints&&n.snapPoints.length-1)),a=Jf(n,"open",i,{defaultValue:n.defaultOpen,passive:n.open===void 0}),s=Jf(n,"activeSnapPoint",i,{passive:n.activeSnapPoint===void 0}),l={emitDrag:g=>i("drag",g),emitRelease:g=>i("release",g),emitClose:()=>i("close"),emitOpenChange:g=>{i("update:open",g)}},{closeDrawer:u,hasBeenOpened:c,modal:h,isOpen:p}=rk(hk({...l,...Kr(n),activeSnapPoint:s,fadeFromIndex:o,open:a}));function f(g){if(a.value!==void 0){l.emitOpenChange(g);return}g?(c.value=!0,p.value=g):u()}return e({open:p}),(g,v)=>(fe(),lt(K(MM),{open:K(p),modal:K(h),"onUpdate:open":f},{default:Be(()=>[ut(g.$slots,"default",{open:K(p)})]),_:3},8,["open","modal"]))}}),dk=Ne({__name:"DrawerOverlay",setup(r){const{overlayRef:e,snapPoints:t,isVisible:n,isOpen:i,shouldFade:o}=Lm(),a=Ve(()=>{var s;return t&&(((s=t.value)==null?void 0:s.length)??0)>0});return(s,l)=>(fe(),lt(K(JM),{ref_key:"overlayRef",ref:e,"vaul-drawer-visible":K(n)?"true":"false","vaul-overlay":"","vaul-snap-points":K(i)&&a.value?"true":"false","vaul-snap-points-overlay":K(i)&&K(o)?"true":"false"},null,8,["vaul-drawer-visible","vaul-snap-points","vaul-snap-points-overlay"]))}}),pk=Ne({__name:"DrawerContent",setup(r){const{open:e,isOpen:t,isVisible:n,snapPointsOffset:i,drawerRef:o,onPress:a,onDrag:s,onRelease:l,modal:u,emitOpenChange:c,dismissible:h,keyboardIsOpen:p,closeDrawer:f,direction:g}=Lm(),v=Ve(()=>i.value&&i.value.length>0?`${i.value[0]}px`:"0");function d(m){if(!u.value||m.defaultPrevented){m.preventDefault();return}p.value&&(p.value=!1),m.preventDefault(),h.value&&c(!1),!(!h.value||e.value!==void 0)&&f()}return Ge(t,m=>{m&&setTimeout(()=>{n.value=!0},1)},{immediate:!0}),(m,y)=>(fe(),lt(K(KM),{ref_key:"drawerRef",ref:o,"vaul-drawer":"","vaul-drawer-direction":K(g),"vaul-drawer-visible":K(n)?"true":"false",style:Yr({"--snap-point-height":v.value}),onPointerdown:K(a),onPointermove:K(s),onPointerup:K(l),onPointerDownOutside:d,onEscapeKeyDown:y[0]||(y[0]=_=>{K(h)||_.preventDefault()})},{default:Be(()=>[ut(m.$slots,"default")]),_:3},8,["vaul-drawer-direction","vaul-drawer-visible","style","onPointerdown","onPointermove","onPointerup"]))}}),mk={py:"1",flex:"~ col",rounded:"lg","overflow-hidden":""},gk={key:0,flex:"",mr:"12"},vk={flex:"~ col",border:"4 solid pink-200/50 dark:pink-500/50",shadow:"md pink-200/50 dark:none","min-w-20":"","rounded-lg":"","px-2":"","py-1":"",h:"unset {Qt().then(()=>{n.update(),i.value=n.height.value})}),s(async()=>{Qt().then(()=>{n.update(),i.value=n.height.value})}),(l,u)=>{const c=Ad("auto-animate");return fe(),_e("div",mk,[u[3]||(u[3]=Y("div",{"flex-1":""},null,-1)),ft((fe(),_e("div",{ref_key:"chatHistoryRef",ref:e,"h-full":"","w-full":"","max-h":"30vh",flex:"~ col","overflow-scroll":""},[u[2]||(u[2]=Y("div",{"flex-1":""},null,-1)),(fe(!0),_e(Un,null,gr(K(t),(h,p)=>(fe(),_e("div",{key:p,"mb-2":""},[h.role==="assistant"?(fe(),_e("div",gk,[Y("div",vk,[u[0]||(u[0]=Y("div",null,[Y("span",{"text-xs":"",text:"pink-400/90 dark:pink-600/90","font-semibold":"",class:"inline y.id===d.value);if(!m){s.value=void 0;return}s.value=m}function f(v){const d=v.target;n.stageView=d.value}function g(v){const d=v.target.value;switch(t.value){case"en":case"en-US":c.value=d;break;case"zh":case"zh-CN":case"zh-TW":case"zh-HK":c.value=d;break;case"jp":case"jp-JP":h.value=d;break}}return Ge([l,u],async([v,d])=>{if(!v||!d){o.value=[];return}o.value=await a(v,d)}),Jt(async()=>{!l.value||!u.value||(o.value=await a(l.value,u.value))}),(v,d)=>(fe(),_e("div",null,[d[9]||(d[9]=Y("h2",{text:"slate-800/80 dark:slate-200/80 xl","font-bold":""}," Settings ",-1)),Y("div",null,[Y("div",Ek,[Y("div",Ck,[Y("span",null,Ue(K(e)("settings.openai-base-url.label")),1)]),Y("div",Ak,[ft(Y("input",{"onUpdate:modelValue":d[0]||(d[0]=m=>K(n).openAiApiBaseURL=m),type:"text",placeholder:K(e)("settings.openai-base-url.placeholder_mobile"),"h-8":"","w-full":"","rounded-md":"","bg-transparent":"","px-2":"","py-1":"","text-right":"","font-mono":"","outline-none":""},null,8,Ik),[[Br,K(n).openAiApiBaseURL]])]),Y("div",Pk,[Y("span",null,Ue(K(e)("settings.openai-api-key.label")),1)]),Y("div",Mk,[ft(Y("input",{"onUpdate:modelValue":d[1]||(d[1]=m=>K(n).openAiApiKey=m),type:"text",placeholder:K(e)("settings.openai-api-key.placeholder_mobile"),"h-8":"","w-full":"","rounded-md":"","bg-transparent":"","px-2":"","py-1":"","text-right":"","font-mono":"","outline-none":""},null,8,kk),[[Br,K(n).openAiApiKey]])]),Y("div",Ok,[Y("span",null,Ue(K(e)("settings.elevenlabs-api-key.label")),1)]),Y("div",Rk,[ft(Y("input",{"onUpdate:modelValue":d[2]||(d[2]=m=>K(n).elevenLabsApiKey=m),type:"text",placeholder:K(e)("settings.elevenlabs-api-key.placeholder_mobile"),"h-8":"","w-full":"","rounded-md":"","bg-transparent":"","px-2":"","py-1":"","text-right":"","font-mono":"","outline-none":""},null,8,Fk),[[Br,K(n).elevenLabsApiKey]])]),Y("div",Lk,[Y("span",null,Ue(K(e)("settings.language")),1)]),Y("div",Nk,[ft(Y("select",{"onUpdate:modelValue":d[3]||(d[3]=m=>K(n).language=m),"h-8":"","w-full":"","rounded-md":"","bg-transparent":"","px-2":"","py-1":"","text-right":"","font-mono":"","outline-none":""},d[5]||(d[5]=[Y("option",{value:"en-US"}," English ",-1),Y("option",{value:"zh-CN"}," 简体中文 ",-1)]),512),[[Td,K(n).language]])]),Y("div",Dk,[Y("span",null,Ue(K(e)("settings.models")),1)]),Y("div",Bk,[Y("select",{"h-8":"","w-full":"","rounded-md":"","bg-transparent":"","px-2":"","py-1":"","text-right":"","font-mono":"","outline-none":"",onChange:p},[Y("option",Uk,Ue(K(e)("stage.select-a-model")),1),K(n).openAiModel?(fe(),_e("option",{key:0,value:K(n).openAiModel.id},Ue("name"in K(n).openAiModel?`${K(n).openAiModel.name} (${K(n).openAiModel.id})`:K(n).openAiModel.id),9,zk)):nt("",!0),(fe(!0),_e(Un,null,gr(o.value,m=>(fe(),_e("option",{key:m.id,value:m.id},Ue("name"in m?`${m.name} (${m.id})`:m.id),9,jk))),128))],32)]),Y("div",Vk,[Y("span",null,Ue(K(e)("settings.voices")),1)]),Y("div",Gk,[Y("select",{"h-8":"","w-full":"","rounded-md":"","bg-transparent":"","px-2":"","py-1":"","text-right":"","font-mono":"","outline-none":"",onChange:g},[Y("option",$k,Ue(K(e)("stage.select-a-voice")),1),["en","en-US"].indexOf(K(t))!==-1&&K(c)?(fe(),_e("option",{key:0,value:K(c)},Ue(K(c)),9,Hk)):nt("",!0),["zh","zh-CN","zh-TW","zh-HK"].indexOf(K(t))!==-1&&K(c)?(fe(),_e("option",{key:1,value:K(c)},Ue(K(c)),9,Xk)):nt("",!0),["jp","jp-JP"].indexOf(K(t))!==-1&&K(h)?(fe(),_e("option",{key:2,value:K(h)},Ue(K(h)),9,Wk)):nt("",!0),(fe(!0),_e(Un,null,gr(K(Sd)[K(t)],(m,y)=>(fe(),_e("option",{key:y,value:m},Ue(m),9,qk))),128))],32)])])]),d[10]||(d[10]=Y("h2",{text:"slate-800/80 dark:slate-200/80 xl","font-bold":""}," View ",-1)),Y("div",null,[Y("div",Yk,[d[7]||(d[7]=Y("div",{text:"sm pink-500"},[Y("span",null,"Viewer")],-1)),Y("select",{"h-8":"","w-full":"","rounded-md":"","bg-transparent":"","px-2":"","py-1":"","text-right":"","font-mono":"","outline-none":"",onChange:f},d[6]||(d[6]=[Y("option",{value:"2d"}," 2D ",-1),Y("option",{value:"3d"}," 3D ",-1)]),32),d[8]||(d[8]=Y("div",{text:"sm pink-500"},[Y("span",null,"Theme")],-1)),Y("label",Kk,[ft(Y("input",{"onUpdate:modelValue":d[4]||(d[4]=m=>iu(i)?i.value=m:null),checked:K(i),"aria-checked":K(i),name:"stageView",type:"checkbox",hidden:"","appearance-none":"","outline-none":""},null,8,Zk),[[Wr,K(i)]]),Y("div",Jk,[Oe(Ko,{name:"slide-away",mode:"out-in"},{default:Be(()=>[K(i)?(fe(),_e("div",Qk)):(fe(),_e("div",eO))]),_:1})])])])])]))}}),nO={relative:"","w-full":"",flex:"","gap-1":""},rO={flex:"","flex-1":""},iO={class:"flex flex-1 flex-col rounded-t-lg p-5",bg:"[#fffbff] dark:[#1f1a1d]","gap-2":""},oO=Ne({__name:"MobileInteractiveArea",setup(r){const e=le(""),t=le(!1),{isAudioInputOn:n,selectedAudioDeviceId:i}=Cn(Jr()),{send:o,onAfterSend:a}=yr(),{t:s}=Zr();async function l(){e.value.trim()&&await o(e.value)}const{destroy:u,start:c}=Sm(i,{onSpeechStart:()=>{t.value=!0},onVADMisfire:()=>{t.value=!1},onSpeechEnd:p=>{t.value=!1,h()},auto:!1});function h(p){alert("Transcription is not implemented yet")}return Ge(n,async p=>{p==="false"&&u()}),a(async()=>{e.value=""}),Jt(()=>{c()}),(p,f)=>(fe(),_e("div",null,[Y("div",nO,[Oe(Sk,{absolute:"","left-0":"","top-0":"",transform:"translate-y-[-100%]","w-full":""}),Y("div",rO,[Oe(K(pv),{modelValue:e.value,"onUpdate:modelValue":f[0]||(f[0]=g=>e.value=g),placeholder:K(s)("stage.message"),border:"solid 2 pink-100 dark:pink-400/20",text:"pink-400 hover:pink-600 dark:[#905073] dark:hover:pink-600 placeholder:pink-400 placeholder:hover:pink-600 placeholder:dark:[#905073] placeholder:dark:hover:pink-600",bg:"pink-50 dark:[#3c2632]","max-h":"[10lh]","min-h":"[1lh]","w-full":"","resize-none":"","overflow-y-scroll":"","rounded-l-xl":"","p-2":"","font-medium":"","outline-none":"",transition:"all duration-250 ease-in-out placeholder:all placeholder:duration-250 placeholder:ease-in-out",onSubmit:l},null,8,["modelValue","placeholder"])]),Oe(K(fk),{"should-scale-background":""},{default:Be(()=>[Oe(K(kM),{class:"px-4 py-2.5",border:"solid 2 pink-100 dark:pink-400/20",text:"lg pink-400 hover:pink-600 dark:[#905073] dark:hover:pink-600 placeholder:pink-400 placeholder:hover:pink-600 placeholder:dark:[#905073] placeholder:dark:hover:pink-600",bg:"pink-50 dark:[#3c2632]","max-h":"[10lh]","min-h":"[1lh]","rounded-r-xl":""},{default:Be(()=>f[1]||(f[1]=[Y("div",{"i-solar:settings-bold-duotone":""},null,-1)])),_:1}),Oe(K(RM),null,{default:Be(()=>[Oe(K(dk),{class:"fixed inset-0 z-50 bg-black/40"}),Oe(K(pk),{"max-h":"[75%]",fixed:"","bottom-0":"","left-0":"","right-0":"","z-50":"","mt-24":"","h-full":"",flex:"","flex-col":"","rounded-t-lg":"",bg:"[#fffbff] dark:[#1f1a1d]"},{default:Be(()=>[Y("div",iO,[Oe(tO)])]),_:1})]),_:1})]),_:1})])]))}}),aO={relative:"","max-h":"[100vh]","max-w":"[100vw]",p:"2",flex:"~ col","z-2":"","h-full":"","overflow-hidden":""},sO={flex:"~ 1 row (fe(),lt(wI,{"h-full":"","w-full":""},{default:Be(()=>[Oe(CI,{"h-full":"","w-full":"","fill-color":K(e)?"#563544":"#f8e8f2"},{default:Be(()=>[Y("div",aO,[Oe(fP,{class:"flex