diff --git "a/assets/index-B1vl_W8b.js" "b/assets/index-B1vl_W8b.js" new file mode 100644--- /dev/null +++ "b/assets/index-B1vl_W8b.js" @@ -0,0 +1,536 @@ +var Ql=Object.defineProperty;var Zl=(t,e,n)=>e in t?Ql(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var po=(t,e,n)=>Zl(t,typeof e!="symbol"?e+"":e,n);import{r as Ga,e as Jl,T as eu,A as tu,L as ho,M as nu,a as ru,D as iu,b as ou,E as au,c as su,d as lu,f as uu,g as cu,h as du,i as Ka,V as fu,j as pu,k as hu,l as ui,m as mu,n as gu,u as vu,o as yu,p as bu,q as xu,s as wu,t as Tu,_ as Au}from"./Stage.vue_vue_type_style_index_0_scoped_af8e2d0b_lang-8eZCGnaz.js";import{d as be,e as j,f as Me,g as Ni,h as qa,i as Oi,w as Se,j as ku,k as dt,l as lt,c as ue,o as Q,m as Wa,p as Eu,q as ze,r as _u,s as Fe,t as we,a as me,v as B,x as Pi,y as Dt,z as Li,A as Ye,B as he,b as L,T as Lt,C as hn,D as mr,E as Ya,Z as Di,F as Mu,V as ce,M as Jt,S as mo,Q as sr,O as ln,G as Ge,P as Bt,R as Su,H as Xa,I as Sn,J as Bi,K as Xe,L as Qa,N as Za,U as Fi,W as Cn,X as Iu,Y as zi,_ as Ru,$ as Ja,a0 as _t,a1 as Ui,a2 as Ft,a3 as Cu,a4 as es,a5 as qt,a6 as ts,a7 as ns,a8 as Nu,a9 as rs,aa as Ou,ab as gt,ac as gr,ad as is,ae as os,af as Pu,ag as Kt,ah as Lu,ai as Du,aj as Bu,ak as Fu,al as _r,am as lr,an as ci,ao as Ht,ap as as,aq as di,ar as an,as as go,at as Gt,au as sn,av as Mr,aw as zu,ax as Uu,ay as ju,az as $u,aA as ss,aB as ls,aC as ur,aD as us,aE as ji,aF as cr,aG as cs,aH as Vu,aI as ds,aJ as Hu,aK as Gu,aL as vo,n as pn,aM as Ku,aN as fi,aO as fs,aP as qu,aQ as En,aR as ps,aS as bt,aT as Mt,aU as In,aV as Wu,aW as Yu,aX as Xu,aY as Qu,aZ as Zu,a_ as $i,a$ as Ju,b0 as ec,b1 as tc,b2 as Sr,b3 as nc,b4 as hs,b5 as rc,b6 as ic,b7 as oc,b8 as ac,b9 as sc,ba as Ir,bb as lc,bc as uc,bd as cc,be as yo,bf as bo,bg as xo,bh as wo,bi as dc,bj as fc,bk as pc,bl as hc,bm as mc,bn as vr,bo as Nn,bp as Wt,bq as On,br as gc,bs as vc,bt as yc,bu as zt,bv as bc,bw as xc,bx as wc,by as Yt,bz as To,bA as rr,bB as Tc,bC as vt,bD as Ac,bE as kc,bF as Ec,bG as _c,bH as dr,bI as ms,bJ as gs,bK as vs,bL as Mc,bM as Rr,bN as Sc,bO as pi,bP as Ic,bQ as ys,bR as Rc,bS as Cc,bT as Nc,bU as Oc,bV as Pc,bW as Lc,bX as Dc}from"./index-CV2bBDUP.js";import{u as Cr}from"./queue-DUpuYx3Y.js";import{_ as yr}from"./_plugin-vue_export-helper-DlAUqK2U.js";import{d as Ao}from"./index-izzxg2sS.js";function ko(t,e,n){return(1-n)*t+n*e}function Vt(t,e){return t+Math.random()*(e-t)}async function*Bc(t,e){const n=t.getReader();try{for(;;){const{done:r,value:i}=await n.read();if(r)return;yield e(i)}}finally{n.releaseLock()}}function Fc(){let t=-1,e,n=-1;function r(i,o){(o>=t||oMath.max(0,Math.min(100,n.mouthOpenSize))),c=Ni(),d=qa(Wa),p=Me(()=>d.between("sm","md").value||d.smaller("sm").value),{height:f,width:h}=Oi(r,{immediate:!0,windowResize:!0,reset:!0}),w=Fc();function g(){return a.value.internalModel.coreModel}function y(m){if(!m.value)return;let M=2.2;p.value&&(M=2.2);const x=f.value*.95/l.value*M,b=h.value*.95/s.value*M,v=Math.min(x,b);m.value.scale.set(v,v)}async function E(m){var k;ho.registerTicker(ou),Jl.add(eu),i.value=new tu({width:h.value,height:f.value,backgroundAlpha:0}),o.value=i.value.view,o.value.style.objectFit="contain",m.appendChild(i.value.view),a.value=await ho.from(n.model,{motionPreload:nu.ALL}),i.value.stage.addChild(a.value),s.value=a.value.width,l.value=a.value.height,a.value.x=h.value/2,a.value.y=f.value,a.value.rotation=Math.PI,a.value.skew.x=Math.PI,a.value.anchor.set(.5,.5),y(a),a.value.on("hit",R=>{a.value&&R.includes("body")&&a.value.motion("tap_body")});const M=a.value.internalModel,x=M.coreModel,b=M.motionManager;x.setParameterValueById("ParamMouthOpenY",u.value),b.groups.idle&&((k=b.motionGroups[b.groups.idle])==null||k.forEach(R=>{R._motionData.curves.forEach(F=>{(F.id==="ParamEyeBallX"||F.id==="ParamEyeBallY")&&(F.id=`_${F.id}`)})}));const v=b.update;b.update=function(R,F){return v==null||v.call(this,R,F),b.state.currentGroup===b.groups.idle&&w.update(M,F),!0}}async function A(m){await a.value.motion(m,void 0,ru.FORCE)}const _=ku(()=>{i.value&&i.value.renderer.resize(h.value,f.value),o.value&&(o.value.width=h.value,o.value.height=f.value),a.value&&(a.value.x=h.value/2,a.value.y=f.value,y(a))},100);function N(){a.value&&(a.value.filters=[new iu({color:c.value?10053247:14662098,alpha:.3,blur:0,distance:20,rotation:45})])}return Se([h,f],()=>{_()}),Se(c,N,{immediate:!0}),Se(a,N),dt(N),dt(async()=>{r.value&&await E(r.value)}),lt(()=>{var m;(m=i.value)==null||m.destroy()}),Se(u,m=>{g().setParameterValueById("ParamMouthOpenY",m)}),e({setMotion:A}),(m,M)=>(Q(),ue("div",{ref_key:"containerRef",ref:r,"h-full":"","w-full":""},null,512))}}),bs=be({__name:"Screen",setup(t){const e=j(),n=qa(Wa),{width:r,height:i}=Eu(),o=Oi(e,{immediate:!0,windowResize:!0,reset:!0}),a=Me(()=>n.between("sm","md").value||n.smaller("sm").value),s=Me(()=>n.between("md","lg").value),l=Me(()=>n.greaterOrEqual("lg").value),u=Me(()=>l.value?o.width.value:a.value||s.value?r.value-16:o.width.value),c=j(0);return Se([r,i,e],()=>{var p,f;const d=(f=(p=e.value)==null?void 0:p.parentElement)==null?void 0:f.getBoundingClientRect();l.value||a.value||s.value?c.value=(d==null?void 0:d.height)||0:c.value=600}),Se([o.width,o.height],()=>{l.value||a.value||s.value?c.value=o.height.value:c.value=600}),dt(async()=>{e.value&&o.update()}),(d,p)=>(Q(),ue("div",{ref_key:"containerRef",ref:e,"h-full":"","w-full":""},[ze(d.$slots,"default",{width:u.value,height:c.value})],512))}}),Uc={absolute:"",bottom:"3",right:"3"},jc={flex:"~ row","cursor-pointer":""},$c=["checked","aria-checked"],Vc={key:0,"min-w":"50vw",z:"{var o;await((o=n.value)==null?void 0:o.setMotion(i))}}),(i,o)=>{const a=_u("TransitionVertical");return Q(),Fe(bs,{relative:""},{default:we(({width:s,height:l})=>[me(zc,{ref_key:"modelRef",ref:n,"canvas-width":s,"canvas-height":l,model:t.model,"mouth-open-size":t.mouthOpenSize},null,8,["canvas-width","canvas-height","model","mouth-open-size"]),B("div",Uc,[B("div",jc,[B("label",{class:Pi([r.value?"bg-zinc-300 dark:bg-zinc-200":"bg-zinc-100 dark:bg-zinc-700"]),transition:"all ease-in-out duration-500",text:"lg zinc-500 dark:zinc-400","m-1":"","h-fit":"","w-fit":"","cursor-pointer":"","appearance-none":"","gap-1":"","rounded-lg":"","rounded-md":"","border-none":"","p-2":"","outline-none":""},[Dt(B("input",{"onUpdate:modelValue":o[0]||(o[0]=u=>r.value=u),checked:r.value,"aria-checked":r.value,name:"showLive2DViewerInspector",type:"checkbox",hidden:"","appearance-none":"","outline-none":""},null,8,$c),[[Li,r.value]]),o[8]||(o[8]=B("div",{"select-none":""},[B("div",{"i-solar:bug-bold-duotone":""})],-1))],2)]),me(a,null,{default:we(()=>[r.value?(Q(),ue("div",Vc,[B("div",Hc,[B("div",Gc,[B("span",null,he(i.$t("stage.viewers.debug-menu.emotions")),1)]),B("div",Kc,[B("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=n.value)==null?void 0:c.setMotion(L(au))})},he(i.$t("stage.viewers.debug-menu.emotions-btn.surprised")),1),B("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=n.value)==null?void 0:c.setMotion(L(su))})},he(i.$t("stage.viewers.debug-menu.emotions-btn.sad")),1),B("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=n.value)==null?void 0:c.setMotion(L(lu))})},he(i.$t("stage.viewers.debug-menu.emotions-btn.angry")),1),B("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=n.value)==null?void 0:c.setMotion(L(uu))})},he(i.$t("stage.viewers.debug-menu.emotions-btn.happy")),1),B("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=n.value)==null?void 0:c.setMotion(L(cu))})},he(i.$t("stage.viewers.debug-menu.emotions-btn.awkward")),1),B("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=n.value)==null?void 0:c.setMotion(L(du))})},he(i.$t("stage.viewers.debug-menu.emotions-btn.question")),1),B("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=n.value)==null?void 0:c.setMotion(L(Ka))})},he(i.$t("stage.viewers.debug-menu.emotions-btn.think")),1)])])])):Ye("",!0)]),_:1})])]),_:1})}}});var Wc=Object.defineProperty,Yc=(t,e,n)=>e in t?Wc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Xc=(t,e,n)=>Yc(t,e+"",n);function Qc(t){return is()?(os(t),!0):!1}function xs(t){return typeof t=="function"?t():L(t)}const Zc=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Jc=Object.prototype.toString,ed=t=>Jc.call(t)==="[object Object]",td=()=>{},nd=Zc?window:void 0;function rd(t){var e;const n=xs(t);return(e=n==null?void 0:n.$el)!=null?e:n}function Nr(...t){let e,n,r,i;if(typeof t[0]=="string"||Array.isArray(t[0])?([n,r,i]=t,e=nd):[e,n,r,i]=t,!e)return td;Array.isArray(n)||(n=[n]),Array.isArray(r)||(r=[r]);const o=[],a=()=>{o.forEach(c=>c()),o.length=0},s=(c,d,p,f)=>(c.addEventListener(d,p,f),()=>c.removeEventListener(d,p,f)),l=Se(()=>[rd(e),xs(i)],([c,d])=>{if(a(),!c)return;const p=ed(d)?{...d}:d;o.push(...n.flatMap(f=>r.map(h=>s(c,f,h,p))))},{immediate:!0,flush:"post"}),u=()=>{l(),a()};return Qc(u),u}function ws(t,e,n,r){const i=class extends Cn{constructor(o={}){const a=Object.entries(t);super({uniforms:a.reduce((s,[l,u])=>{const c=zi.clone({[l]:{value:u}});return{...s,...c}},{}),vertexShader:e,fragmentShader:n}),Xc(this,"key",""),a.forEach(([s])=>Object.defineProperty(this,s,{get:()=>this.uniforms[s].value,set:l=>this.uniforms[s].value=l})),Object.assign(this,o)}};return i.key=qt.generateUUID(),i}ws({color:new Xe("white"),scale:new Ge(1,1),imageBounds:new Ge(1,1),resolution:1024,map:null,zoom:1,radius:0,grayscale:0,opacity:1},` + varying vec2 vUv; + varying vec2 vPos; + void main() { + gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position, 1.); + vUv = uv; + vPos = position.xy; + } + `,` + // mostly from https://gist.github.com/statico/df64c5d167362ecf7b34fca0b1459a44 + varying vec2 vUv; + varying vec2 vPos; + uniform vec2 scale; + uniform vec2 imageBounds; + uniform float resolution; + uniform vec3 color; + uniform sampler2D map; + uniform float radius; + uniform float zoom; + uniform float grayscale; + uniform float opacity; + const vec3 luma = vec3(.299, 0.587, 0.114); + vec4 toGrayscale(vec4 color, float intensity) { + return vec4(mix(color.rgb, vec3(dot(color.rgb, luma)), intensity), color.a); + } + vec2 aspect(vec2 size) { + return size / min(size.x, size.y); + } + + const float PI = 3.14159265; + + // from https://iquilezles.org/articles/distfunctions + float udRoundBox( vec2 p, vec2 b, float r ) { + return length(max(abs(p)-b+r,0.0))-r; + } + + void main() { + vec2 s = aspect(scale); + vec2 i = aspect(imageBounds); + float rs = s.x / s.y; + float ri = i.x / i.y; + vec2 new = rs < ri ? vec2(i.x * s.y / i.y, s.y) : vec2(s.x, i.y * s.x / i.x); + vec2 offset = (rs < ri ? vec2((new.x - s.x) / 2.0, 0.0) : vec2(0.0, (new.y - s.y) / 2.0)) / new; + vec2 uv = vUv * s / new + offset; + vec2 zUv = (uv - vec2(0.5, 0.5)) / zoom + vec2(0.5, 0.5); + + vec2 res = vec2(scale * resolution); + vec2 halfRes = 0.5 * res; + float b = udRoundBox(vUv.xy * res - halfRes, halfRes, resolution * radius); + vec3 a = mix(vec3(1.0,0.0,0.0), vec3(0.0,0.0,0.0), smoothstep(0.0, 1.0, b)); + gl_FragColor = toGrayscale(texture2D(map, zUv) * vec4(color, opacity * a), grayscale); + + #include + #include + } + `);const Vi=parseInt(Pu.replace(/\D+/g,""));var id=Object.defineProperty,od=(t,e,n)=>e in t?id(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ad=(t,e,n)=>(od(t,e+"",n),n);async function Eo(t){const e=await t.arrayBuffer(),n=btoa(String.fromCharCode(...new Uint8Array(e)));return`data:${t.type||""};base64,${n}`}let Un,Or,en,jn;function Pr(t,e=1/0,n=null){Or||(Or=new ts(2,2,1,1)),en||(en=new Cn({uniforms:{blitTexture:new ju(t)},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 + } + `})),en.uniforms.blitTexture.value=t,en.defines.IS_SRGB="colorSpace"in t?t.colorSpace==="srgb":t.encoding===3001,en.needsUpdate=!0,jn||(jn=new Kt(Or,en),jn.frustrumCulled=!1);const r=new Bt,i=new di;i.add(jn),n||(n=Un=new $u({antialias:!1})),n.setSize(Math.min(t.image.width,e),Math.min(t.image.height,e)),n.clear(),n.render(i,r);const o=new lr(n.domElement);return o.minFilter=t.minFilter,o.magFilter=t.magFilter,o.wrapS=t.wrapS,o.wrapT=t.wrapT,o.name=t.name,Un&&(Un.dispose(),Un=null),o}const _o={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 Ts{constructor(){this.pluginCallbacks=[],this.register(function(e){return new gd(e)}),this.register(function(e){return new vd(e)}),this.register(function(e){return new xd(e)}),this.register(function(e){return new wd(e)}),this.register(function(e){return new Td(e)}),this.register(function(e){return new Ad(e)}),this.register(function(e){return new yd(e)}),this.register(function(e){return new bd(e)}),this.register(function(e){return new kd(e)}),this.register(function(e){return new Ed(e)}),this.register(function(e){return new _d(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,n,r,i){const o=new md,a=[];for(let s=0,l=this.pluginCallbacks.length;st.times[t.times.length-1]){if(Math.abs(t.times[t.times.length-1]-e)<.001)return t.times.length-1;r[r.length-1]=e,r.set(t.times,0),i.set(t.values,0),i.set(o.evaluate(e),t.values.length),a=r.length-1}else for(let s=0;se){r.set(t.times.slice(0,s+1),0),r[s+1]=e,r.set(t.times.slice(s+1),s+2),i.set(t.values.slice(0,(s+1)*n),0),i.set(o.evaluate(e),(s+1)*n),i.set(t.values.slice((s+1)*n),(s+2)*n),a=s+1;break}}return t.times=r,t.values=i,a},mergeMorphTargetTracks:function(t,e){const n=[],r={},i=t.tracks;for(let o=0;o4?a=t.array[i*t.itemSize+o]:(o===0?a=t.getX(i):o===1?a=t.getY(i):o===2?a=t.getZ(i):o===3&&(a=t.getW(i)),t.normalized===!0&&(a=qt.normalize(a,t.array))),r.min[o]=Math.min(r.min[o],a),r.max[o]=Math.max(r.max[o],a)}return r}function As(t){return Math.ceil(t/4)*4}function Dr(t,e=0){const n=As(t.byteLength);if(n!==t.byteLength){const r=new Uint8Array(n);if(r.set(new Uint8Array(t)),e!==0)for(let i=t.byteLength;i"u"&&typeof OffscreenCanvas<"u"?new OffscreenCanvas(1,1):document.createElement("canvas")}function Co(t,e){if(t.toBlob!==void 0)return new Promise(r=>t.toBlob(r,e));let n;return e==="image/jpeg"?n=.92:e==="image/webp"&&(n=.8),t.convertToBlob({type:e,quality:n})}let md=class{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,n,r={}){this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},r),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;r=i.options;const s=i.extensionsUsed,l=i.extensionsRequired,u=new Blob(o,{type:"application/octet-stream"}),c=Object.keys(s),d=Object.keys(l);c.length>0&&(a.extensionsUsed=c),d.length>0&&(a.extensionsRequired=d),a.buffers&&a.buffers.length>0&&(a.buffers[0].byteLength=u.size),r.binary===!0?u.arrayBuffer().then(p=>{const f=Dr(p),h=new DataView(new ArrayBuffer(Io));h.setUint32(0,f.byteLength,!0),h.setUint32(4,dd,!0);const w=Dr(fd(JSON.stringify(a)),32),g=new DataView(new ArrayBuffer(Io));g.setUint32(0,w.byteLength,!0),g.setUint32(4,cd,!0);const y=new ArrayBuffer(So),E=new DataView(y);E.setUint32(0,ld,!0),E.setUint32(4,ud,!0);const A=So+g.byteLength+w.byteLength+h.byteLength+f.byteLength;E.setUint32(8,A,!0),new Blob([y,g,w,h,f],{type:"application/octet-stream"}).arrayBuffer().then(n)}):a.buffers&&a.buffers.length>0?Eo(u).then(p=>{a.buffers[0].uri=p,n(a)}):n(a)}serializeUserData(e,n){if(Object.keys(e.userData).length===0)return;const r=this.options,i=this.extensionsUsed;try{const o=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&o.gltfExtensions){n.extensions===void 0&&(n.extensions={});for(const a in o.gltfExtensions)n.extensions[a]=o.gltfExtensions[a],i[a]=!0;delete o.gltfExtensions}Object.keys(o).length>0&&(n.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,n=!1){if(this.uids.has(e)===!1){const r=new Map;r.set(!0,this.uid++),r.set(!1,this.uid++),this.uids.set(e,r)}return this.uids.get(e).get(n)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;const n=new ce;for(let r=0,i=e.count;r5e-4)return!1;return!0}createNormalizedNormalAttribute(e){const n=this.cache;if(n.attributesNormalized.has(e))return n.attributesNormalized.get(e);const r=e.clone(),i=new ce;for(let o=0,a=r.count;o4?h=e.array[p*e.itemSize+f]:(f===0?h=e.getX(p):f===1?h=e.getY(p):f===2?h=e.getZ(p):f===3&&(h=e.getW(p)),e.normalized===!0&&(h=qt.normalize(h,e.array))),n===ke.FLOAT?u.setFloat32(c,h,!0):n===ke.INT?u.setInt32(c,h,!0):n===ke.UNSIGNED_INT?u.setUint32(c,h,!0):n===ke.SHORT?u.setInt16(c,h,!0):n===ke.UNSIGNED_SHORT?u.setUint16(c,h,!0):n===ke.BYTE?u.setInt8(c,h):n===ke.UNSIGNED_BYTE&&u.setUint8(c,h),c+=s}const d={buffer:this.processBuffer(u.buffer),byteOffset:this.byteOffset,byteLength:l};return o!==void 0&&(d.target=o),o===ke.ARRAY_BUFFER&&(d.byteStride=e.itemSize*s),this.byteOffset+=l,a.bufferViews.push(d),{id:a.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){const n=this,r=n.json;return r.bufferViews||(r.bufferViews=[]),e.arrayBuffer().then(i=>{const o=Dr(i),a={buffer:n.processBuffer(o),byteOffset:n.byteOffset,byteLength:o.byteLength};return n.byteOffset+=o.byteLength,r.bufferViews.push(a)-1})}processAccessor(e,n,r,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=ke.FLOAT;else if(e.array.constructor===Int32Array)s=ke.INT;else if(e.array.constructor===Uint32Array)s=ke.UNSIGNED_INT;else if(e.array.constructor===Int16Array)s=ke.SHORT;else if(e.array.constructor===Uint16Array)s=ke.UNSIGNED_SHORT;else if(e.array.constructor===Int8Array)s=ke.BYTE;else if(e.array.constructor===Uint8Array)s=ke.UNSIGNED_BYTE;else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: "+e.array.constructor.name);if(r===void 0&&(r=0),i===void 0&&(i=e.count),i===0)return null;const l=hd(e,r,i);let u;n!==void 0&&(u=e===n.index?ke.ELEMENT_ARRAY_BUFFER:ke.ARRAY_BUFFER);const c=this.processBufferView(e,s,r,i,u),d={bufferView:c.id,byteOffset:c.byteOffset,componentType:s,count:i,max:l.max,min:l.min,type:a[e.itemSize]};return e.normalized===!0&&(d.normalized=!0),o.accessors||(o.accessors=[]),o.accessors.push(d)-1}processImage(e,n,r,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),d=i+":flipY/"+r.toString();if(c[d]!==void 0)return c[d];s.images||(s.images=[]);const p={mimeType:i},f=Ro();f.width=Math.min(e.width,l.maxTextureSize),f.height=Math.min(e.height,l.maxTextureSize);const h=f.getContext("2d");if(r===!0&&(h.translate(0,f.height),h.scale(1,-1)),e.data!==void 0){n!==ci&&console.error("GLTFExporter: Only RGBAFormat is supported.",n),(e.width>l.maxTextureSize||e.height>l.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);const g=new Uint8ClampedArray(e.height*e.width*4);for(let y=0;yo.processBufferViewImage(g)).then(g=>{p.bufferView=g})):f.toDataURL!==void 0?p.uri=f.toDataURL(i):u.push(Co(f,i).then(Eo).then(g=>{p.uri=g}));const w=s.images.push(p)-1;return c[d]=w,w}else throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.")}processSampler(e){const n=this.json;n.samplers||(n.samplers=[]);const r={magFilter:at[e.magFilter],minFilter:at[e.minFilter],wrapS:at[e.wrapS],wrapT:at[e.wrapT]};return n.samplers.push(r)-1}processTexture(e){const n=this.options,r=this.cache,i=this.json;if(r.textures.has(e))return r.textures.get(e);i.textures||(i.textures=[]),e instanceof _r&&(e=Pr(e,n.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 r.textures.set(e,s),s}processMaterial(e){const n=this.cache,r=this.json;if(n.materials.has(e))return n.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.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(kn(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===gr&&(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=r.materials.push(i)-1;return n.materials.set(e,a),a}processMesh(e){const n=this.cache,r=this.json,i=[e.geometry.uuid];if(Array.isArray(e.material))for(let A=0,_=e.material.length;A<_;A++)i.push(e.material[A].uuid);else i.push(e.material.uuid);const o=i.join(":");if(n.meshes.has(o))return n.meshes.get(o);const a=e.geometry;let s;e.isLineSegments?s=ke.LINES:e.isLineLoop?s=ke.LINE_LOOP:e.isLine?s=ke.LINE_STRIP:e.isPoints?s=ke.POINTS:s=e.material.wireframe?ke.LINES:ke.TRIANGLES;const l={},u={},c=[],d=[],p={...Vi>=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 h=null;for(let A in a.attributes){if(A.slice(0,5)==="morph")continue;const _=a.attributes[A];if(A=p[A]||A.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(A)||(A="_"+A),n.attributes.has(this.getUID(_))){u[A]=n.attributes.get(this.getUID(_));continue}h=null;const N=_.array;A==="JOINTS_0"&&!(N instanceof Uint16Array)&&!(N instanceof Uint8Array)&&(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),h=new Ht(new Uint16Array(N),_.itemSize,_.normalized));const m=this.processAccessor(h||_,a);m!==null&&(A.startsWith("_")||this.detectMeshQuantization(A,_),u[A]=m,n.attributes.set(this.getUID(_),m))}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 A=[],_=[],N={};if(e.morphTargetDictionary!==void 0)for(const m in e.morphTargetDictionary)N[e.morphTargetDictionary[m]]=m;for(let m=0;m0&&(l.extras={},l.extras.targetNames=_)}const w=Array.isArray(e.material);if(w&&a.groups.length===0)return null;const g=w?e.material:[e.material],y=w?a.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let A=0,_=y.length;A<_;A++){const N={mode:s,attributes:u};if(this.serializeUserData(a,N),d.length>0&&(N.targets=d),a.index!==null){let M=this.getUID(a.index);(y[A].start!==void 0||y[A].count!==void 0)&&(M+=":"+y[A].start+":"+y[A].count),n.attributes.has(M)?N.indices=n.attributes.get(M):(N.indices=this.processAccessor(a.index,a,y[A].start,y[A].count),n.attributes.set(M,N.indices)),N.indices===null&&delete N.indices}const m=this.processMaterial(g[y[A].materialIndex]);m!==null&&(N.material=m),c.push(N)}l.primitives=c,r.meshes||(r.meshes=[]),this._invokeAll(function(A){A.writeMesh&&A.writeMesh(e,l)});const E=r.meshes.push(l)-1;return n.meshes.set(o,E),E}detectMeshQuantization(e,n){if(this.extensionsUsed[Lr])return;let r;switch(n.array.constructor){case Int8Array:r="byte";break;case Uint8Array:r="unsigned byte";break;case Int16Array:r="short";break;case Uint16Array:r="unsigned short";break;default:return}n.normalized&&(r+=" normalized");const i=e.split("_",1)[0];_o[i]&&_o[i].includes(r)&&(this.extensionsUsed[Lr]=!0,this.extensionsRequired[Lr]=!0)}processCamera(e){const n=this.json;n.cameras||(n.cameras=[]);const r=e.isOrthographicCamera,i={type:r?"orthographic":"perspective"};return r?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:qt.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},e.name!==""&&(i.name=e.type),n.cameras.push(i)-1}processAnimation(e,n){const r=this.json,i=this.nodeMap;r.animations||(r.animations=[]),e=Ts.Utils.mergeMorphTargetTracks(e.clone(),n);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=n.nodes.push(o)-1;return i.set(e,a),a}processScene(e){const n=this.json,r=this.options;n.scenes||(n.scenes=[],n.scene=0);const i={};e.name!==""&&(i.name=e.name),n.scenes.push(i);const o=[];for(let a=0,s=e.children.length;a0&&(i.nodes=o),this.serializeUserData(e,i)}processObjects(e){const n=new di;n.name="AuxScene";for(let r=0;r0&&this.processObjects(r);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),n.extensions=n.extensions||{},n.extensions[this.name]={light:s.length-1}}}let vd=class{constructor(t){this.writer=t,this.name="KHR_materials_unlit"}writeMaterial(t,e){if(!t.isMeshBasicMaterial)return;const n=this.writer.extensionsUsed;e.extensions=e.extensions||{},e.extensions[this.name]={},n[this.name]=!0,e.pbrMetallicRoughness.metallicFactor=0,e.pbrMetallicRoughness.roughnessFactor=.9}},yd=class{constructor(t){this.writer=t,this.name="KHR_materials_clearcoat"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||t.clearcoat===0)return;const n=this.writer,r=n.extensionsUsed,i={};if(i.clearcoatFactor=t.clearcoat,t.clearcoatMap){const o={index:n.processTexture(t.clearcoatMap),texCoord:t.clearcoatMap.channel};n.applyTextureTransform(o,t.clearcoatMap),i.clearcoatTexture=o}if(i.clearcoatRoughnessFactor=t.clearcoatRoughness,t.clearcoatRoughnessMap){const o={index:n.processTexture(t.clearcoatRoughnessMap),texCoord:t.clearcoatRoughnessMap.channel};n.applyTextureTransform(o,t.clearcoatRoughnessMap),i.clearcoatRoughnessTexture=o}if(t.clearcoatNormalMap){const o={index:n.processTexture(t.clearcoatNormalMap),texCoord:t.clearcoatNormalMap.channel};n.applyTextureTransform(o,t.clearcoatNormalMap),i.clearcoatNormalTexture=o}e.extensions=e.extensions||{},e.extensions[this.name]=i,r[this.name]=!0}},bd=class{constructor(t){this.writer=t,this.name="KHR_materials_iridescence"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||t.iridescence===0)return;const n=this.writer,r=n.extensionsUsed,i={};if(i.iridescenceFactor=t.iridescence,t.iridescenceMap){const o={index:n.processTexture(t.iridescenceMap),texCoord:t.iridescenceMap.channel};n.applyTextureTransform(o,t.iridescenceMap),i.iridescenceTexture=o}if(i.iridescenceIor=t.iridescenceIOR,i.iridescenceThicknessMinimum=t.iridescenceThicknessRange[0],i.iridescenceThicknessMaximum=t.iridescenceThicknessRange[1],t.iridescenceThicknessMap){const o={index:n.processTexture(t.iridescenceThicknessMap),texCoord:t.iridescenceThicknessMap.channel};n.applyTextureTransform(o,t.iridescenceThicknessMap),i.iridescenceThicknessTexture=o}e.extensions=e.extensions||{},e.extensions[this.name]=i,r[this.name]=!0}},xd=class{constructor(e){this.writer=e,this.name="KHR_materials_transmission"}writeMaterial(e,n){if(!e.isMeshPhysicalMaterial||e.transmission===0)return;const r=this.writer,i=r.extensionsUsed,o={};if(o.transmissionFactor=e.transmission,e.transmissionMap){const a={index:r.processTexture(e.transmissionMap),texCoord:e.transmissionMap.channel};r.applyTextureTransform(a,e.transmissionMap),o.transmissionTexture=a}n.extensions=n.extensions||{},n.extensions[this.name]=o,i[this.name]=!0}},wd=class{constructor(t){this.writer=t,this.name="KHR_materials_volume"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||t.transmission===0)return;const n=this.writer,r=n.extensionsUsed,i={};if(i.thicknessFactor=t.thickness,t.thicknessMap){const o={index:n.processTexture(t.thicknessMap),texCoord:t.thicknessMap.channel};n.applyTextureTransform(o,t.thicknessMap),i.thicknessTexture=o}i.attenuationDistance=t.attenuationDistance,i.attenuationColor=t.attenuationColor.toArray(),e.extensions=e.extensions||{},e.extensions[this.name]=i,r[this.name]=!0}},Td=class{constructor(t){this.writer=t,this.name="KHR_materials_ior"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||t.ior===1.5)return;const n=this.writer.extensionsUsed,r={};r.ior=t.ior,e.extensions=e.extensions||{},e.extensions[this.name]=r,n[this.name]=!0}},Ad=class{constructor(t){this.writer=t,this.name="KHR_materials_specular"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||t.specularIntensity===1&&t.specularColor.equals(sd)&&!t.specularIntensityMap&&!t.specularColorTexture)return;const n=this.writer,r=n.extensionsUsed,i={};if(t.specularIntensityMap){const o={index:n.processTexture(t.specularIntensityMap),texCoord:t.specularIntensityMap.channel};n.applyTextureTransform(o,t.specularIntensityMap),i.specularTexture=o}if(t.specularColorMap){const o={index:n.processTexture(t.specularColorMap),texCoord:t.specularColorMap.channel};n.applyTextureTransform(o,t.specularColorMap),i.specularColorTexture=o}i.specularFactor=t.specularIntensity,i.specularColorFactor=t.specularColor.toArray(),e.extensions=e.extensions||{},e.extensions[this.name]=i,r[this.name]=!0}},kd=class{constructor(e){this.writer=e,this.name="KHR_materials_sheen"}writeMaterial(e,n){if(!e.isMeshPhysicalMaterial||e.sheen==0)return;const r=this.writer,i=r.extensionsUsed,o={};if(e.sheenRoughnessMap){const a={index:r.processTexture(e.sheenRoughnessMap),texCoord:e.sheenRoughnessMap.channel};r.applyTextureTransform(a,e.sheenRoughnessMap),o.sheenRoughnessTexture=a}if(e.sheenColorMap){const a={index:r.processTexture(e.sheenColorMap),texCoord:e.sheenColorMap.channel};r.applyTextureTransform(a,e.sheenColorMap),o.sheenColorTexture=a}o.sheenRoughnessFactor=e.sheenRoughness,o.sheenColorFactor=e.sheenColor.toArray(),n.extensions=n.extensions||{},n.extensions[this.name]=o,i[this.name]=!0}},Ed=class{constructor(t){this.writer=t,this.name="KHR_materials_anisotropy"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||t.anisotropy==0)return;const n=this.writer,r=n.extensionsUsed,i={};if(t.anisotropyMap){const o={index:n.processTexture(t.anisotropyMap)};n.applyTextureTransform(o,t.anisotropyMap),i.anisotropyTexture=o}i.anisotropyStrength=t.anisotropy,i.anisotropyRotation=t.anisotropyRotation,e.extensions=e.extensions||{},e.extensions[this.name]=i,r[this.name]=!0}},_d=class{constructor(t){this.writer=t,this.name="KHR_materials_emissive_strength"}writeMaterial(t,e){if(!t.isMeshStandardMaterial||t.emissiveIntensity===1)return;const n=this.writer.extensionsUsed,r={};r.emissiveStrength=t.emissiveIntensity,e.extensions=e.extensions||{},e.extensions[this.name]=r,n[this.name]=!0}};var Pn=Uint8Array,ks=Uint16Array,Md=Uint32Array,Sd=new Pn([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]),Id=new Pn([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]),Es=function(t,e){for(var n=new ks(31),r=0;r<31;++r)n[r]=e+=1<>>1|(De&21845)<<1;Ct=(Ct&52428)>>>2|(Ct&13107)<<2,Ct=(Ct&61680)>>>4|(Ct&3855)<<4,Nd[De]=((Ct&65280)>>>8|(Ct&255)<<8)>>>1}var br=new Pn(288);for(var De=0;De<144;++De)br[De]=8;for(var De=144;De<256;++De)br[De]=9;for(var De=256;De<280;++De)br[De]=7;for(var De=280;De<288;++De)br[De]=8;var Od=new Pn(32);for(var De=0;De<32;++De)Od[De]=5;var Pd=new Pn(0),Ld=typeof TextDecoder<"u"&&new TextDecoder,Dd=0;try{Ld.decode(Pd,{stream:!0}),Dd=1}catch{}var Bd=Object.defineProperty,Fd=(t,e,n)=>e in t?Bd(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,zd=(t,e,n)=>(Fd(t,e+"",n),n);const Ms=class extends Kt{constructor(t,e={}){super(t),this.isReflector=!0,this.type="Reflector",this.camera=new Bt;const n=this,r=e.color!==void 0?new Xe(e.color):new Xe(8355711),i=e.textureWidth||512,o=e.textureHeight||512,a=e.clipBias||0,s=e.shader||Ms.ReflectorShader,l=e.multisample!==void 0?e.multisample:4,u=new Xa,c=new ce,d=new ce,p=new ce,f=new _t,h=new ce(0,0,-1),w=new Ft,g=new ce,y=new ce,E=new Ft,A=new _t,_=this.camera,N=new Du(i,o,{samples:l,type:Bu}),m=new Cn({uniforms:zi.clone(s.uniforms),fragmentShader:s.fragmentShader,vertexShader:s.vertexShader});m.uniforms.tDiffuse.value=N.texture,m.uniforms.color.value=r,m.uniforms.textureMatrix.value=A,this.material=m,this.onBeforeRender=function(M,x,b){if(d.setFromMatrixPosition(n.matrixWorld),p.setFromMatrixPosition(b.matrixWorld),f.extractRotation(n.matrixWorld),c.set(0,0,1),c.applyMatrix4(f),g.subVectors(d,p),g.dot(c)>0)return;g.reflect(c).negate(),g.add(d),f.extractRotation(b.matrixWorld),h.set(0,0,-1),h.applyMatrix4(f),h.add(p),y.subVectors(d,h),y.reflect(c).negate(),y.add(d),_.position.copy(g),_.up.set(0,1,0),_.up.applyMatrix4(f),_.up.reflect(c),_.lookAt(y),_.far=b.far,_.updateMatrixWorld(),_.projectionMatrix.copy(b.projectionMatrix),A.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),A.multiply(_.projectionMatrix),A.multiply(_.matrixWorldInverse),A.multiply(n.matrixWorld),u.setFromNormalAndCoplanarPoint(c,d),u.applyMatrix4(_.matrixWorldInverse),w.set(u.normal.x,u.normal.y,u.normal.z,u.constant);const v=_.projectionMatrix;E.x=(Math.sign(w.x)+v.elements[8])/v.elements[0],E.y=(Math.sign(w.y)+v.elements[9])/v.elements[5],E.z=-1,E.w=(1+v.elements[10])/v.elements[14],w.multiplyScalar(2/w.dot(E)),v.elements[2]=w.x,v.elements[6]=w.y,v.elements[10]=w.z+1-a,v.elements[14]=w.w,n.visible=!1;const k=M.getRenderTarget(),R=M.xr.enabled,F=M.shadowMap.autoUpdate,z=M.toneMapping;let D=!1;"outputColorSpace"in M?D=M.outputColorSpace==="srgb":D=M.outputEncoding===3001,M.xr.enabled=!1,M.shadowMap.autoUpdate=!1,"outputColorSpace"in M?M.outputColorSpace="srgb-linear":M.outputEncoding=3e3,M.toneMapping=Fu,M.setRenderTarget(N),M.state.buffers.depth.setMask(!0),M.autoClear===!1&&M.clear(),M.render(x,_),M.xr.enabled=R,M.shadowMap.autoUpdate=F,M.toneMapping=z,"outputColorSpace"in M?M.outputColorSpace=D?"srgb":"srgb-linear":M.outputEncoding=D?3001:3e3,M.setRenderTarget(k);const V=b.viewport;V!==void 0&&M.state.viewport(V),n.visible=!0},this.getRenderTarget=function(){return N},this.dispose=function(){N.dispose(),n.material.dispose()}}};let hi=Ms;zd(hi,"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 <${Vi>=154?"colorspace_fragment":"encodings_fragment"}> + + }`});var Ud=Object.defineProperty,jd=(t,e,n)=>e in t?Ud(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ss=(t,e,n)=>(jd(t,typeof e!="symbol"?e+"":e,n),n);const xr=new Qa,$d=new Float32Array([-1,-1,0,0,0,1,-1,0,1,0,1,1,0,1,1,-1,1,0,0,1]),Is=new Za($d,5);xr.setIndex([0,1,2,0,2,3]);xr.setAttribute("position",new Fi(Is,3,0,!1));xr.setAttribute("uv",new Fi(Is,2,3,!1));const mi=class extends Kt{constructor(){super(mi.Geometry,new an({opacity:0,transparent:!0})),this.isLensflare=!0,this.type="Lensflare",this.frustumCulled=!1,this.renderOrder=1/0;const t=new ce,e=new ce,n=new go(new Uint8Array(16*16*3),16,16,ci);n.minFilter=Gt,n.magFilter=Gt,n.wrapS=sn,n.wrapT=sn;const r=new go(new Uint8Array(16*16*3),16,16,ci);r.minFilter=Gt,r.magFilter=Gt,r.wrapS=sn,r.wrapT=sn;const i=mi.Geometry,o=new Mr({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}),a=new Mr({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}),s=new Kt(i,o),l=[],u=Rs.Shader,c=new Mr({uniforms:{map:{value:null},occlusionMap:{value:r},color:{value:new Xe(16777215)},scale:{value:new Ge},screenPosition:{value:new ce}},vertexShader:u.vertexShader,fragmentShader:u.fragmentShader,blending:zu,transparent:!0,depthWrite:!1}),d=new Kt(i,c);this.addElement=function(g){l.push(g)};const p=new Ge,f=new Ge,h=new Uu,w=new Ft;this.onBeforeRender=function(g,y,E){g.getCurrentViewport(w);const A=w.w/w.z,_=w.z/2,N=w.w/2;let m=16/w.w;if(p.set(m*A,m),h.min.set(w.x,w.y),h.max.set(w.x+(w.z-16),w.y+(w.w-16)),e.setFromMatrixPosition(this.matrixWorld),e.applyMatrix4(E.matrixWorldInverse),!(e.z>0)&&(t.copy(e).applyMatrix4(E.projectionMatrix),f.x=w.x+t.x*_+_-8,f.y=w.y+t.y*N+N-8,h.containsPoint(f))){g.copyFramebufferToTexture(f,n);let M=o.uniforms;M.scale.value=p,M.screenPosition.value=t,g.renderBufferDirect(E,null,i,o,s,null),g.copyFramebufferToTexture(f,r),M=a.uniforms,M.scale.value=p,M.screenPosition.value=t,g.renderBufferDirect(E,null,i,a,s,null);const x=-t.x*2,b=-t.y*2;for(let v=0,k=l.length;ve in t?Hd(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Cs=(t,e,n)=>(Gd(t,typeof e!="symbol"?e+"":e,n),n);const ir={uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new ce},up:{value:new ce(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 <${Vi>=154?"colorspace_fragment":"encodings_fragment"}> + + } + `},Ns=new Cn({name:"SkyShader",fragmentShader:ir.fragmentShader,vertexShader:ir.vertexShader,uniforms:zi.clone(ir.uniforms),side:Iu,depthWrite:!1});let Os=class extends Kt{constructor(){super(new Lu(1,1,1),Ns)}};Cs(Os,"SkyShader",ir);Cs(Os,"material",Ns);new Ru;new ce;new Ja(0,0,0,"YXZ");new ce;var Kd=Object.defineProperty,qd=(t,e,n)=>e in t?Kd(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ie=(t,e,n)=>(qd(t,typeof e!="symbol"?e+"":e,n),n);const $n=new Su,No=new Xa,Wd=Math.cos(70*(Math.PI/180)),Oo=(t,e)=>(t%e+e)%e;class Yd extends Mu{constructor(e,n){super(),ie(this,"object"),ie(this,"domElement"),ie(this,"enabled",!0),ie(this,"target",new ce),ie(this,"minDistance",0),ie(this,"maxDistance",1/0),ie(this,"minZoom",0),ie(this,"maxZoom",1/0),ie(this,"minPolarAngle",0),ie(this,"maxPolarAngle",Math.PI),ie(this,"minAzimuthAngle",-1/0),ie(this,"maxAzimuthAngle",1/0),ie(this,"enableDamping",!1),ie(this,"dampingFactor",.05),ie(this,"enableZoom",!0),ie(this,"zoomSpeed",1),ie(this,"enableRotate",!0),ie(this,"rotateSpeed",1),ie(this,"enablePan",!0),ie(this,"panSpeed",1),ie(this,"screenSpacePanning",!0),ie(this,"keyPanSpeed",7),ie(this,"zoomToCursor",!1),ie(this,"autoRotate",!1),ie(this,"autoRotateSpeed",2),ie(this,"reverseOrbit",!1),ie(this,"reverseHorizontalOrbit",!1),ie(this,"reverseVerticalOrbit",!1),ie(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),ie(this,"mouseButtons",{LEFT:Jt.ROTATE,MIDDLE:Jt.DOLLY,RIGHT:Jt.PAN}),ie(this,"touches",{ONE:Lt.ROTATE,TWO:Lt.DOLLY_PAN}),ie(this,"target0"),ie(this,"position0"),ie(this,"zoom0"),ie(this,"_domElementKeyEvents",null),ie(this,"getPolarAngle"),ie(this,"getAzimuthalAngle"),ie(this,"setPolarAngle"),ie(this,"setAzimuthalAngle"),ie(this,"getDistance"),ie(this,"getZoomScale"),ie(this,"listenToKeyEvents"),ie(this,"stopListenToKeyEvents"),ie(this,"saveState"),ie(this,"reset"),ie(this,"update"),ie(this,"connect"),ie(this,"dispose"),ie(this,"dollyIn"),ie(this,"dollyOut"),ie(this,"getScale"),ie(this,"setScale"),this.object=e,this.domElement=n,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=P=>{let Y=Oo(P,2*Math.PI),ne=c.phi;ne<0&&(ne+=2*Math.PI),Y<0&&(Y+=2*Math.PI);let Ce=Math.abs(Y-ne);2*Math.PI-Ce{let Y=Oo(P,2*Math.PI),ne=c.theta;ne<0&&(ne+=2*Math.PI),Y<0&&(Y+=2*Math.PI);let Ce=Math.abs(Y-ne);2*Math.PI-Cer.object.position.distanceTo(r.target),this.listenToKeyEvents=P=>{P.addEventListener("keydown",te),this._domElementKeyEvents=P},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",te),this._domElementKeyEvents=null},this.saveState=()=>{r.target0.copy(r.target),r.position0.copy(r.object.position),r.zoom0=r.object.zoom},this.reset=()=>{r.target.copy(r.target0),r.object.position.copy(r.position0),r.object.zoom=r.zoom0,r.object.updateProjectionMatrix(),r.dispatchEvent(i),r.update(),l=s.NONE},this.update=(()=>{const P=new ce,Y=new ce(0,1,0),ne=new sr().setFromUnitVectors(e.up,Y),Ce=ne.clone().invert(),it=new ce,pt=new sr,Fn=2*Math.PI;return function(){const fo=r.object.position;ne.setFromUnitVectors(e.up,Y),Ce.copy(ne).invert(),P.copy(fo).sub(r.target),P.applyQuaternion(ne),c.setFromVector3(P),r.autoRotate&&l===s.NONE&&z(R()),r.enableDamping?(c.theta+=d.theta*r.dampingFactor,c.phi+=d.phi*r.dampingFactor):(c.theta+=d.theta,c.phi+=d.phi);let wt=r.minAzimuthAngle,Tt=r.maxAzimuthAngle;isFinite(wt)&&isFinite(Tt)&&(wt<-Math.PI?wt+=Fn:wt>Math.PI&&(wt-=Fn),Tt<-Math.PI?Tt+=Fn:Tt>Math.PI&&(Tt-=Fn),wt<=Tt?c.theta=Math.max(wt,Math.min(Tt,c.theta)):c.theta=c.theta>(wt+Tt)/2?Math.max(wt,c.theta):Math.min(Tt,c.theta)),c.phi=Math.max(r.minPolarAngle,Math.min(r.maxPolarAngle,c.phi)),c.makeSafe(),r.enableDamping===!0?r.target.addScaledVector(f,r.dampingFactor):r.target.add(f),r.zoomToCursor&&b||r.object.isOrthographicCamera?c.radius=C(c.radius):c.radius=C(c.radius*p),P.setFromSpherical(c),P.applyQuaternion(Ce),fo.copy(r.target).add(P),r.object.matrixAutoUpdate||r.object.updateMatrix(),r.object.lookAt(r.target),r.enableDamping===!0?(d.theta*=1-r.dampingFactor,d.phi*=1-r.dampingFactor,f.multiplyScalar(1-r.dampingFactor)):(d.set(0,0,0),f.set(0,0,0));let vn=!1;if(r.zoomToCursor&&b){let yn=null;if(r.object instanceof Bt&&r.object.isPerspectiveCamera){const bn=P.length();yn=C(bn*p);const zn=bn-yn;r.object.position.addScaledVector(M,zn),r.object.updateMatrixWorld()}else if(r.object.isOrthographicCamera){const bn=new ce(x.x,x.y,0);bn.unproject(r.object),r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/p)),r.object.updateProjectionMatrix(),vn=!0;const zn=new ce(x.x,x.y,0);zn.unproject(r.object),r.object.position.sub(zn).add(bn),r.object.updateMatrixWorld(),yn=P.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),r.zoomToCursor=!1;yn!==null&&(r.screenSpacePanning?r.target.set(0,0,-1).transformDirection(r.object.matrix).multiplyScalar(yn).add(r.object.position):($n.origin.copy(r.object.position),$n.direction.set(0,0,-1).transformDirection(r.object.matrix),Math.abs(r.object.up.dot($n.direction))u||8*(1-pt.dot(r.object.quaternion))>u?(r.dispatchEvent(i),it.copy(r.object.position),pt.copy(r.object.quaternion),vn=!1,!0):!1}})(),this.connect=P=>{r.domElement=P,r.domElement.style.touchAction="none",r.domElement.addEventListener("contextmenu",je),r.domElement.addEventListener("pointerdown",_e),r.domElement.addEventListener("pointercancel",We),r.domElement.addEventListener("wheel",X)},this.dispose=()=>{var P,Y,ne,Ce,it,pt;r.domElement&&(r.domElement.style.touchAction="auto"),(P=r.domElement)==null||P.removeEventListener("contextmenu",je),(Y=r.domElement)==null||Y.removeEventListener("pointerdown",_e),(ne=r.domElement)==null||ne.removeEventListener("pointercancel",We),(Ce=r.domElement)==null||Ce.removeEventListener("wheel",X),(it=r.domElement)==null||it.ownerDocument.removeEventListener("pointermove",Ke),(pt=r.domElement)==null||pt.ownerDocument.removeEventListener("pointerup",We),r._domElementKeyEvents!==null&&r._domElementKeyEvents.removeEventListener("keydown",te)};const r=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 mo,d=new mo;let p=1;const f=new ce,h=new Ge,w=new Ge,g=new Ge,y=new Ge,E=new Ge,A=new Ge,_=new Ge,N=new Ge,m=new Ge,M=new ce,x=new Ge;let b=!1;const v=[],k={};function R(){return 2*Math.PI/60/60*r.autoRotateSpeed}function F(){return Math.pow(.95,r.zoomSpeed)}function z(P){r.reverseOrbit||r.reverseHorizontalOrbit?d.theta+=P:d.theta-=P}function D(P){r.reverseOrbit||r.reverseVerticalOrbit?d.phi+=P:d.phi-=P}const V=(()=>{const P=new ce;return function(Y,ne){P.setFromMatrixColumn(ne,0),P.multiplyScalar(-Y),f.add(P)}})(),re=(()=>{const P=new ce;return function(Y,ne){r.screenSpacePanning===!0?P.setFromMatrixColumn(ne,1):(P.setFromMatrixColumn(ne,0),P.crossVectors(r.object.up,P)),P.multiplyScalar(Y),f.add(P)}})(),ee=(()=>{const P=new ce;return function(Y,ne){const Ce=r.domElement;if(Ce&&r.object instanceof Bt&&r.object.isPerspectiveCamera){const it=r.object.position;P.copy(it).sub(r.target);let pt=P.length();pt*=Math.tan(r.object.fov/2*Math.PI/180),V(2*Y*pt/Ce.clientHeight,r.object.matrix),re(2*ne*pt/Ce.clientHeight,r.object.matrix)}else Ce&&r.object instanceof ln&&r.object.isOrthographicCamera?(V(Y*(r.object.right-r.object.left)/r.object.zoom/Ce.clientWidth,r.object.matrix),re(ne*(r.object.top-r.object.bottom)/r.object.zoom/Ce.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}})();function se(P){r.object instanceof Bt&&r.object.isPerspectiveCamera||r.object instanceof ln&&r.object.isOrthographicCamera?p=P:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function S(P){se(p/P)}function xe(P){se(p*P)}function Ue(P){if(!r.zoomToCursor||!r.domElement)return;b=!0;const Y=r.domElement.getBoundingClientRect(),ne=P.clientX-Y.left,Ce=P.clientY-Y.top,it=Y.width,pt=Y.height;x.x=ne/it*2-1,x.y=-(Ce/pt)*2+1,M.set(x.x,x.y,1).unproject(r.object).sub(r.object.position).normalize()}function C(P){return Math.max(r.minDistance,Math.min(r.maxDistance,P))}function ye(P){h.set(P.clientX,P.clientY)}function Ie(P){Ue(P),_.set(P.clientX,P.clientY)}function Ee(P){y.set(P.clientX,P.clientY)}function $e(P){w.set(P.clientX,P.clientY),g.subVectors(w,h).multiplyScalar(r.rotateSpeed);const Y=r.domElement;Y&&(z(2*Math.PI*g.x/Y.clientHeight),D(2*Math.PI*g.y/Y.clientHeight)),h.copy(w),r.update()}function K(P){N.set(P.clientX,P.clientY),m.subVectors(N,_),m.y>0?S(F()):m.y<0&&xe(F()),_.copy(N),r.update()}function T(P){E.set(P.clientX,P.clientY),A.subVectors(E,y).multiplyScalar(r.panSpeed),ee(A.x,A.y),y.copy(E),r.update()}function I(P){Ue(P),P.deltaY<0?xe(F()):P.deltaY>0&&S(F()),r.update()}function O(P){let Y=!1;switch(P.code){case r.keys.UP:ee(0,r.keyPanSpeed),Y=!0;break;case r.keys.BOTTOM:ee(0,-r.keyPanSpeed),Y=!0;break;case r.keys.LEFT:ee(r.keyPanSpeed,0),Y=!0;break;case r.keys.RIGHT:ee(-r.keyPanSpeed,0),Y=!0;break}Y&&(P.preventDefault(),r.update())}function H(){if(v.length==1)h.set(v[0].pageX,v[0].pageY);else{const P=.5*(v[0].pageX+v[1].pageX),Y=.5*(v[0].pageY+v[1].pageY);h.set(P,Y)}}function U(){if(v.length==1)y.set(v[0].pageX,v[0].pageY);else{const P=.5*(v[0].pageX+v[1].pageX),Y=.5*(v[0].pageY+v[1].pageY);y.set(P,Y)}}function W(){const P=v[0].pageX-v[1].pageX,Y=v[0].pageY-v[1].pageY,ne=Math.sqrt(P*P+Y*Y);_.set(0,ne)}function G(){r.enableZoom&&W(),r.enablePan&&U()}function J(){r.enableZoom&&W(),r.enableRotate&&H()}function oe(P){if(v.length==1)w.set(P.pageX,P.pageY);else{const ne=xt(P),Ce=.5*(P.pageX+ne.x),it=.5*(P.pageY+ne.y);w.set(Ce,it)}g.subVectors(w,h).multiplyScalar(r.rotateSpeed);const Y=r.domElement;Y&&(z(2*Math.PI*g.x/Y.clientHeight),D(2*Math.PI*g.y/Y.clientHeight)),h.copy(w)}function Z(P){if(v.length==1)E.set(P.pageX,P.pageY);else{const Y=xt(P),ne=.5*(P.pageX+Y.x),Ce=.5*(P.pageY+Y.y);E.set(ne,Ce)}A.subVectors(E,y).multiplyScalar(r.panSpeed),ee(A.x,A.y),y.copy(E)}function ae(P){const Y=xt(P),ne=P.pageX-Y.x,Ce=P.pageY-Y.y,it=Math.sqrt(ne*ne+Ce*Ce);N.set(0,it),m.set(0,Math.pow(N.y/_.y,r.zoomSpeed)),S(m.y),_.copy(N)}function ge(P){r.enableZoom&&ae(P),r.enablePan&&Z(P)}function pe(P){r.enableZoom&&ae(P),r.enableRotate&&oe(P)}function _e(P){var Y,ne;r.enabled!==!1&&(v.length===0&&((Y=r.domElement)==null||Y.ownerDocument.addEventListener("pointermove",Ke),(ne=r.domElement)==null||ne.ownerDocument.addEventListener("pointerup",We)),Qe(P),P.pointerType==="touch"?le(P):It(P))}function Ke(P){r.enabled!==!1&&(P.pointerType==="touch"?Ae(P):$(P))}function We(P){var Y,ne,Ce;Ze(P),v.length===0&&((Y=r.domElement)==null||Y.releasePointerCapture(P.pointerId),(ne=r.domElement)==null||ne.ownerDocument.removeEventListener("pointermove",Ke),(Ce=r.domElement)==null||Ce.ownerDocument.removeEventListener("pointerup",We)),r.dispatchEvent(a),l=s.NONE}function It(P){let Y;switch(P.button){case 0:Y=r.mouseButtons.LEFT;break;case 1:Y=r.mouseButtons.MIDDLE;break;case 2:Y=r.mouseButtons.RIGHT;break;default:Y=-1}switch(Y){case Jt.DOLLY:if(r.enableZoom===!1)return;Ie(P),l=s.DOLLY;break;case Jt.ROTATE:if(P.ctrlKey||P.metaKey||P.shiftKey){if(r.enablePan===!1)return;Ee(P),l=s.PAN}else{if(r.enableRotate===!1)return;ye(P),l=s.ROTATE}break;case Jt.PAN:if(P.ctrlKey||P.metaKey||P.shiftKey){if(r.enableRotate===!1)return;ye(P),l=s.ROTATE}else{if(r.enablePan===!1)return;Ee(P),l=s.PAN}break;default:l=s.NONE}l!==s.NONE&&r.dispatchEvent(o)}function $(P){if(r.enabled!==!1)switch(l){case s.ROTATE:if(r.enableRotate===!1)return;$e(P);break;case s.DOLLY:if(r.enableZoom===!1)return;K(P);break;case s.PAN:if(r.enablePan===!1)return;T(P);break}}function X(P){r.enabled===!1||r.enableZoom===!1||l!==s.NONE&&l!==s.ROTATE||(P.preventDefault(),r.dispatchEvent(o),I(P),r.dispatchEvent(a))}function te(P){r.enabled===!1||r.enablePan===!1||O(P)}function le(P){switch(Rt(P),v.length){case 1:switch(r.touches.ONE){case Lt.ROTATE:if(r.enableRotate===!1)return;H(),l=s.TOUCH_ROTATE;break;case Lt.PAN:if(r.enablePan===!1)return;U(),l=s.TOUCH_PAN;break;default:l=s.NONE}break;case 2:switch(r.touches.TWO){case Lt.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;G(),l=s.TOUCH_DOLLY_PAN;break;case Lt.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;J(),l=s.TOUCH_DOLLY_ROTATE;break;default:l=s.NONE}break;default:l=s.NONE}l!==s.NONE&&r.dispatchEvent(o)}function Ae(P){switch(Rt(P),l){case s.TOUCH_ROTATE:if(r.enableRotate===!1)return;oe(P),r.update();break;case s.TOUCH_PAN:if(r.enablePan===!1)return;Z(P),r.update();break;case s.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;ge(P),r.update();break;case s.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;pe(P),r.update();break;default:l=s.NONE}}function je(P){r.enabled!==!1&&P.preventDefault()}function Qe(P){v.push(P)}function Ze(P){delete k[P.pointerId];for(let Y=0;Y{xe(P),r.update()},this.dollyOut=(P=F())=>{S(P),r.update()},this.getScale=()=>p,this.setScale=P=>{se(P),r.update()},this.getZoomScale=()=>F(),n!==void 0&&this.connect(n),this.update()}}new _t;new ce;new Ja;new ce;var Xd=Object.defineProperty,Qd=(t,e,n)=>e in t?Xd(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Hi=(t,e,n)=>(Qd(t,typeof e!="symbol"?e+"":e,n),n);class Ps{constructor(e){Hi(this,"data"),this.data=e}generateShapes(e,n=100,r){const i=[],o={letterSpacing:0,lineHeight:1,...r},a=Zd(e,n,this.data,o);for(let s=0,l=a.length;s + #include + #include + uniform float thickness; + uniform bool screenspace; + uniform vec2 size; + void main() { + #if defined (USE_SKINNING) + #include + #include + #include + #include + #include + #endif + #include + #include + #include + #include + vec4 tNormal = vec4(normal, 0.0); + vec4 tPosition = vec4(transformed, 1.0); + #ifdef USE_INSTANCING + tNormal = instanceMatrix * tNormal; + tPosition = instanceMatrix * tPosition; + #endif + if (screenspace) { + vec3 newPosition = tPosition.xyz + tNormal.xyz * thickness; + gl_Position = projectionMatrix * modelViewMatrix * vec4(newPosition, 1.0); + } else { + vec4 clipPosition = projectionMatrix * modelViewMatrix * tPosition; + vec4 clipNormal = projectionMatrix * modelViewMatrix * tNormal; + vec2 offset = normalize(clipNormal.xy) * thickness / size * clipPosition.w * 2.0; + clipPosition.xy += offset; + gl_Position = clipPosition; + } + }`,`uniform vec3 color; + uniform float opacity; + void main(){ + gl_FragColor = vec4(color, opacity); + #include + #include + }`);const ef=["args","material-uniforms-color-value"];hi.ReflectorShader;new ce;new ce;new ce;var Br;/Mac/.test((Br=globalThis==null?void 0:globalThis.navigator)===null||Br===void 0?void 0:Br.platform);const tf=["target","auto-rotate","auto-rotate-speed","enable-damping","damping-factor","enable-pan","key-pan-speed","keys","max-azimuth-angle","min-azimuth-angle","max-polar-angle","min-polar-angle","min-distance","max-distance","min-zoom","max-zoom","touches","enable-zoom","zoom-speed","enable-rotate","rotate-speed","args"],nf=be({__name:"OrbitControls",props:{makeDefault:{type:Boolean,default:!1},camera:{},domElement:{},target:{default:()=>[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:Lt.ROTATE,TWO:Lt.DOLLY_PAN})},enableZoom:{type:Boolean,default:!0},zoomSpeed:{default:1},enableRotate:{type:Boolean,default:!0},rotateSpeed:{default:1}},emits:["change","start","end"],setup(t,{expose:e,emit:n}){const r=t,i=n,{makeDefault:o,autoRotate:a,autoRotateSpeed:s,enableDamping:l,dampingFactor:u,enablePan:c,keyPanSpeed:d,maxAzimuthAngle:p,minAzimuthAngle:f,maxPolarAngle:h,minPolarAngle:w,minDistance:g,maxDistance:y,minZoom:E,maxZoom:A,enableZoom:_,zoomSpeed:N,enableRotate:m,touches:M,rotateSpeed:x,target:b}=hn(r),{camera:v,renderer:k,extend:R,controls:F,invalidate:z}=mr(),D=Ya(null);R({OrbitControls:Yd}),Se(D,ee=>{V(),ee&&o.value?F.value=ee:F.value=null});function V(){Nr(D.value,"change",()=>{i("change",D.value),z()}),Nr(D.value,"start",()=>i("start",D.value)),Nr(D.value,"end",()=>i("end",D.value))}const{onBeforeRender:re}=Di();return re(({invalidate:ee})=>{D.value&&(l.value||a.value)&&(D.value.update(),a.value&&ee())}),lt(()=>{D.value&&D.value.dispose()}),e({instance:D}),(ee,se)=>(ee.camera||L(v))&&(ee.domElement||L(k))?(Q(),ue("TresOrbitControls",{key:0,ref_key:"controlsRef",ref:D,target:L(b),"auto-rotate":L(a),"auto-rotate-speed":L(s),"enable-damping":L(l),"damping-factor":L(u),"enable-pan":L(c),"key-pan-speed":L(d),keys:ee.keys,"max-azimuth-angle":L(p),"min-azimuth-angle":L(f),"max-polar-angle":L(h),"min-polar-angle":L(w),"min-distance":L(g),"max-distance":L(y),"min-zoom":L(E),"max-zoom":L(A),touches:L(M),"enable-zoom":L(_),"zoom-speed":L(N),"enable-rotate":L(m),"rotate-speed":L(x),args:[ee.camera||L(v),ee.domElement||L(k).domElement]},null,8,tf)):Ye("",!0)}});function Vn(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Po={exports:{}},Lo;function rf(){return Lo||(Lo=1,function(t,e){(function(n){t.exports=n()})(function(){return function n(r,i,o){function a(u,c){if(!i[u]){if(!r[u]){var d=typeof Vn=="function"&&Vn;if(!c&&d)return d(u,!0);if(s)return s(u,!0);throw new Error("Cannot find module '"+u+"'")}c=i[u]={exports:{}},r[u][0].call(c.exports,function(p){var f=r[u][1][p];return a(f||p)},c,c.exports,n,r,i,o)}return i[u].exports}for(var s=typeof Vn=="function"&&Vn,l=0;l>16),D((65280&v)>>8),D(255&v);return k==2?D(255&(v=M(x.charAt(b))<<2|M(x.charAt(b+1))>>4)):k==1&&(D((v=M(x.charAt(b))<<10|M(x.charAt(b+1))<<4|M(x.charAt(b+2))>>2)>>8&255),D(255&v)),R},h.fromByteArray=function(x){var b,v,k,R,F=x.length%3,z="";function D(V){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(V)}for(b=0,k=x.length-F;b>18&63)+D(R>>12&63)+D(R>>6&63)+D(63&R);switch(F){case 1:z=(z+=D((v=x[x.length-1])>>2))+D(v<<4&63)+"==";break;case 2:z=(z=(z+=D((v=(x[x.length-2]<<8)+x[x.length-1])>>10))+D(v>>4&63))+D(v<<2&63)+"="}return z}})(i===void 0?this.base64js={}:i)}).call(this,n("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},n("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(n,r,i){(function(o,a,g,l,u,c,d,p,f){var h=n("base64-js"),w=n("ieee754");function g(T,I,O){if(!(this instanceof g))return new g(T,I,O);var H,U,W,G,J=typeof T;if(I==="base64"&&J=="string")for(T=(G=T).trim?G.trim():G.replace(/^\s+|\s+$/g,"");T.length%4!=0;)T+="=";if(J=="number")H=ee(T);else if(J=="string")H=g.byteLength(T,I);else{if(J!="object")throw new Error("First argument needs to be a number, array or string.");H=ee(T.length)}if(g._useTypedArrays?U=g._augment(new Uint8Array(H)):((U=this).length=H,U._isBuffer=!0),g._useTypedArrays&&typeof T.byteLength=="number")U._set(T);else if(se(G=T)||g.isBuffer(G)||G&&typeof G=="object"&&typeof G.length=="number")for(W=0;W>8,G=G%256,J.push(G),J.push(W);return J}(I),T,O,H)}function A(T,I,O){var H="";O=Math.min(T.length,O);for(var U=I;U>>0)):(I+1>>0),U}function m(T,I,O,H){if(H||(K(typeof O=="boolean","missing or invalid endian"),K(I!=null,"missing offset"),K(I+1>>8*(H?W:1-W)}function k(T,I,O,H,U){if(U||(K(I!=null,"missing value"),K(typeof H=="boolean","missing or invalid endian"),K(O!=null,"missing offset"),K(O+3>>8*(H?W:3-W)&255}function R(T,I,O,H,U){U||(K(I!=null,"missing value"),K(typeof H=="boolean","missing or invalid endian"),K(O!=null,"missing offset"),K(O+1this.length&&(H=this.length);var U=(H=T.length-I=this.length))return this[T]},g.prototype.readUInt16LE=function(T,I){return _(this,T,!0,I)},g.prototype.readUInt16BE=function(T,I){return _(this,T,!1,I)},g.prototype.readUInt32LE=function(T,I){return N(this,T,!0,I)},g.prototype.readUInt32BE=function(T,I){return N(this,T,!1,I)},g.prototype.readInt8=function(T,I){if(I||(K(T!=null,"missing offset"),K(T=this.length))return 128&this[T]?-1*(255-this[T]+1):this[T]},g.prototype.readInt16LE=function(T,I){return m(this,T,!0,I)},g.prototype.readInt16BE=function(T,I){return m(this,T,!1,I)},g.prototype.readInt32LE=function(T,I){return M(this,T,!0,I)},g.prototype.readInt32BE=function(T,I){return M(this,T,!1,I)},g.prototype.readFloatLE=function(T,I){return x(this,T,!0,I)},g.prototype.readFloatBE=function(T,I){return x(this,T,!1,I)},g.prototype.readDoubleLE=function(T,I){return b(this,T,!0,I)},g.prototype.readDoubleBE=function(T,I){return b(this,T,!1,I)},g.prototype.writeUInt8=function(T,I,O){O||(K(T!=null,"missing value"),K(I!=null,"missing offset"),K(I=this.length||(this[I]=T)},g.prototype.writeUInt16LE=function(T,I,O){v(this,T,I,!0,O)},g.prototype.writeUInt16BE=function(T,I,O){v(this,T,I,!1,O)},g.prototype.writeUInt32LE=function(T,I,O){k(this,T,I,!0,O)},g.prototype.writeUInt32BE=function(T,I,O){k(this,T,I,!1,O)},g.prototype.writeInt8=function(T,I,O){O||(K(T!=null,"missing value"),K(I!=null,"missing offset"),K(I=this.length||(0<=T?this.writeUInt8(T,I,O):this.writeUInt8(255+T+1,I,O))},g.prototype.writeInt16LE=function(T,I,O){R(this,T,I,!0,O)},g.prototype.writeInt16BE=function(T,I,O){R(this,T,I,!1,O)},g.prototype.writeInt32LE=function(T,I,O){F(this,T,I,!0,O)},g.prototype.writeInt32BE=function(T,I,O){F(this,T,I,!1,O)},g.prototype.writeFloatLE=function(T,I,O){z(this,T,I,!0,O)},g.prototype.writeFloatBE=function(T,I,O){z(this,T,I,!1,O)},g.prototype.writeDoubleLE=function(T,I,O){D(this,T,I,!0,O)},g.prototype.writeDoubleBE=function(T,I,O){D(this,T,I,!1,O)},g.prototype.fill=function(T,I,O){if(I=I||0,O=O||this.length,K(typeof(T=typeof(T=T||0)=="string"?T.charCodeAt(0):T)=="number"&&!isNaN(T),"value is not a number"),K(I<=O,"end < start"),O!==I&&this.length!==0){K(0<=I&&I"},g.prototype.toArrayBuffer=function(){if(typeof Uint8Array>"u")throw new Error("Buffer.toArrayBuffer not supported in this browser");if(g._useTypedArrays)return new g(this).buffer;for(var T=new Uint8Array(this.length),I=0,O=T.length;I=I.length||U>=T.length);U++)I[U+O]=T[U];return U}function ye(T){try{return decodeURIComponent(T)}catch{return"�"}}function Ie(T,I){K(typeof T=="number","cannot write a non-number as a number"),K(0<=T,"specified a negative value for writing an unsigned value"),K(T<=I,"value is larger than maximum value for type"),K(Math.floor(T)===T,"value has a fractional component")}function Ee(T,I,O){K(typeof T=="number","cannot write a non-number as a number"),K(T<=I,"value larger than maximum allowed value"),K(O<=T,"value smaller than minimum allowed value"),K(Math.floor(T)===T,"value has a fractional component")}function $e(T,I,O){K(typeof T=="number","cannot write a non-number as a number"),K(T<=I,"value larger than maximum allowed value"),K(O<=T,"value smaller than minimum allowed value")}function K(T,I){if(!T)throw new Error(I||"Failed assertion")}g._augment=function(T){return T._isBuffer=!0,T._get=T.get,T._set=T.set,T.get=V.get,T.set=V.set,T.write=V.write,T.toString=V.toString,T.toLocaleString=V.toString,T.toJSON=V.toJSON,T.copy=V.copy,T.slice=V.slice,T.readUInt8=V.readUInt8,T.readUInt16LE=V.readUInt16LE,T.readUInt16BE=V.readUInt16BE,T.readUInt32LE=V.readUInt32LE,T.readUInt32BE=V.readUInt32BE,T.readInt8=V.readInt8,T.readInt16LE=V.readInt16LE,T.readInt16BE=V.readInt16BE,T.readInt32LE=V.readInt32LE,T.readInt32BE=V.readInt32BE,T.readFloatLE=V.readFloatLE,T.readFloatBE=V.readFloatBE,T.readDoubleLE=V.readDoubleLE,T.readDoubleBE=V.readDoubleBE,T.writeUInt8=V.writeUInt8,T.writeUInt16LE=V.writeUInt16LE,T.writeUInt16BE=V.writeUInt16BE,T.writeUInt32LE=V.writeUInt32LE,T.writeUInt32BE=V.writeUInt32BE,T.writeInt8=V.writeInt8,T.writeInt16LE=V.writeInt16LE,T.writeInt16BE=V.writeInt16BE,T.writeInt32LE=V.writeInt32LE,T.writeInt32BE=V.writeInt32BE,T.writeFloatLE=V.writeFloatLE,T.writeFloatBE=V.writeFloatBE,T.writeDoubleLE=V.writeDoubleLE,T.writeDoubleBE=V.writeDoubleBE,T.fill=V.fill,T.inspect=V.inspect,T.toArrayBuffer=V.toArrayBuffer,T}}).call(this,n("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},n("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(n,r,i){(function(o,a,h,l,u,c,d,p,f){var h=n("buffer").Buffer,w=4,g=new h(w);g.fill(0),r.exports={hash:function(y,E,A,_){for(var N=E(function(v,k){v.length%w!=0&&(R=v.length+(w-v.length%w),v=h.concat([v,g],R));for(var R,F=[],z=k?v.readInt32BE:v.readInt32LE,D=0;DA?re=V(re):re.length>5]|=128<>>9<<4)]=M;for(var x=1732584193,b=-271733879,v=-1732584194,k=271733878,R=0;R>>32-v,x)}function y(m,M,x,b,v,k,R){return g(M&x|~M&b,m,M,v,k,R)}function E(m,M,x,b,v,k,R){return g(M&b|x&~b,m,M,v,k,R)}function A(m,M,x,b,v,k,R){return g(M^x^b,m,M,v,k,R)}function _(m,M,x,b,v,k,R){return g(x^(M|~b),m,M,v,k,R)}function N(m,M){var x=(65535&m)+(65535&M);return(m>>16)+(M>>16)+(x>>16)<<16|65535&x}r.exports=function(m){return h.hash(m,w,16)}}).call(this,n("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},n("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(n,r,i){(function(o,a,s,l,u,c,d,p,f){r.exports=function(h){for(var w,g=new Array(h),y=0;y>>((3&y)<<3)&255;return g}}).call(this,n("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},n("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(n,r,i){(function(o,a,s,l,u,c,d,p,f){var h=n("./helpers");function w(E,A){E[A>>5]|=128<<24-A%32,E[15+(A+64>>9<<4)]=A;for(var _,N,m,M=Array(80),x=1732584193,b=-271733879,v=-1732584194,k=271733878,R=-1009589776,F=0;F>16)+(A>>16)+(_>>16)<<16|65535&_}function y(E,A){return E<>>32-A}r.exports=function(E){return h.hash(E,w,20,!0)}}).call(this,n("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},n("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(n,r,i){(function(o,a,s,l,u,c,d,p,f){function h(A,_){var N=(65535&A)+(65535&_);return(A>>16)+(_>>16)+(N>>16)<<16|65535&N}function w(A,_){var N,m=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),M=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),x=new Array(64);A[_>>5]|=128<<24-_%32,A[15+(_+64>>9<<4)]=_;for(var b,v,k=0;k>>_|A<<32-_},E=function(A,_){return A>>>_};r.exports=function(A){return g.hash(A,w,32,!0)}}).call(this,n("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},n("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(n,r,i){(function(o,a,s,l,u,c,d,p,f){i.read=function(h,w,g,y,k){var A,_,N=8*k-y-1,m=(1<>1,x=-7,b=g?k-1:0,v=g?-1:1,k=h[w+b];for(b+=v,A=k&(1<<-x)-1,k>>=-x,x+=N;0>=-x,x+=y;0>1,b=E===23?Math.pow(2,-24)-Math.pow(2,-77):0,v=y?0:R-1,k=y?1:-1,R=w<0||w===0&&1/w<0?1:0;for(w=Math.abs(w),isNaN(w)||w===1/0?(N=isNaN(w)?1:0,_=M):(_=Math.floor(Math.log(w)/Math.LN2),w*(y=Math.pow(2,-_))<1&&(_--,y*=2),2<=(w+=1<=_+x?b/y:b*Math.pow(2,1-x))*y&&(_++,y/=2),M<=_+x?(N=0,_=M):1<=_+x?(N=(w*y-1)*Math.pow(2,E),_+=x):(N=w*Math.pow(2,x-1)*Math.pow(2,E),_=0));8<=E;h[g+v]=255&N,v+=k,N/=256,E-=8);for(_=_<>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]),Fo}var Uo,jo;function Ds(){return jo||(jo=1,Uo=["abs","acos","all","any","asin","atan","ceil","clamp","cos","cross","dFdx","dFdy","degrees","distance","dot","equal","exp","exp2","faceforward","floor","fract","gl_BackColor","gl_BackLightModelProduct","gl_BackLightProduct","gl_BackMaterial","gl_BackSecondaryColor","gl_ClipPlane","gl_ClipVertex","gl_Color","gl_DepthRange","gl_DepthRangeParameters","gl_EyePlaneQ","gl_EyePlaneR","gl_EyePlaneS","gl_EyePlaneT","gl_Fog","gl_FogCoord","gl_FogFragCoord","gl_FogParameters","gl_FragColor","gl_FragCoord","gl_FragData","gl_FragDepth","gl_FragDepthEXT","gl_FrontColor","gl_FrontFacing","gl_FrontLightModelProduct","gl_FrontLightProduct","gl_FrontMaterial","gl_FrontSecondaryColor","gl_LightModel","gl_LightModelParameters","gl_LightModelProducts","gl_LightProducts","gl_LightSource","gl_LightSourceParameters","gl_MaterialParameters","gl_MaxClipPlanes","gl_MaxCombinedTextureImageUnits","gl_MaxDrawBuffers","gl_MaxFragmentUniformComponents","gl_MaxLights","gl_MaxTextureCoords","gl_MaxTextureImageUnits","gl_MaxTextureUnits","gl_MaxVaryingFloats","gl_MaxVertexAttribs","gl_MaxVertexTextureImageUnits","gl_MaxVertexUniformComponents","gl_ModelViewMatrix","gl_ModelViewMatrixInverse","gl_ModelViewMatrixInverseTranspose","gl_ModelViewMatrixTranspose","gl_ModelViewProjectionMatrix","gl_ModelViewProjectionMatrixInverse","gl_ModelViewProjectionMatrixInverseTranspose","gl_ModelViewProjectionMatrixTranspose","gl_MultiTexCoord0","gl_MultiTexCoord1","gl_MultiTexCoord2","gl_MultiTexCoord3","gl_MultiTexCoord4","gl_MultiTexCoord5","gl_MultiTexCoord6","gl_MultiTexCoord7","gl_Normal","gl_NormalMatrix","gl_NormalScale","gl_ObjectPlaneQ","gl_ObjectPlaneR","gl_ObjectPlaneS","gl_ObjectPlaneT","gl_Point","gl_PointCoord","gl_PointParameters","gl_PointSize","gl_Position","gl_ProjectionMatrix","gl_ProjectionMatrixInverse","gl_ProjectionMatrixInverseTranspose","gl_ProjectionMatrixTranspose","gl_SecondaryColor","gl_TexCoord","gl_TextureEnvColor","gl_TextureMatrix","gl_TextureMatrixInverse","gl_TextureMatrixInverseTranspose","gl_TextureMatrixTranspose","gl_Vertex","greaterThan","greaterThanEqual","inversesqrt","length","lessThan","lessThanEqual","log","log2","matrixCompMult","max","min","mix","mod","normalize","not","notEqual","pow","radians","reflect","refract","sign","sin","smoothstep","sqrt","step","tan","texture2D","texture2DLod","texture2DProj","texture2DProjLod","textureCube","textureCubeLod","texture2DLodEXT","texture2DProjLodEXT","textureCubeLodEXT","texture2DGradEXT","texture2DProjGradEXT","textureCubeGradEXT"]),Uo}var Fr,$o;function af(){if($o)return Fr;$o=1;var t=Ls();return Fr=t.slice().concat(["layout","centroid","smooth","case","mat2x2","mat2x3","mat2x4","mat3x2","mat3x3","mat3x4","mat4x2","mat4x3","mat4x4","uvec2","uvec3","uvec4","samplerCubeShadow","sampler2DArray","sampler2DArrayShadow","isampler2D","isampler3D","isamplerCube","isampler2DArray","usampler2D","usampler3D","usamplerCube","usampler2DArray","coherent","restrict","readonly","writeonly","resource","atomic_uint","noperspective","patch","sample","subroutine","common","partition","active","filter","image1D","image2D","image3D","imageCube","iimage1D","iimage2D","iimage3D","iimageCube","uimage1D","uimage2D","uimage3D","uimageCube","image1DArray","image2DArray","iimage1DArray","iimage2DArray","uimage1DArray","uimage2DArray","image1DShadow","image2DShadow","image1DArrayShadow","image2DArrayShadow","imageBuffer","iimageBuffer","uimageBuffer","sampler1DArray","sampler1DArrayShadow","isampler1D","isampler1DArray","usampler1D","usampler1DArray","isampler2DRect","usampler2DRect","samplerBuffer","isamplerBuffer","usamplerBuffer","sampler2DMS","isampler2DMS","usampler2DMS","sampler2DMSArray","isampler2DMSArray","usampler2DMSArray"]),Fr}var zr,Vo;function sf(){if(Vo)return zr;Vo=1;var t=Ds();return t=t.slice().filter(function(e){return!/^(gl\_|texture)/.test(e)}),zr=t.concat(["gl_VertexID","gl_InstanceID","gl_Position","gl_PointSize","gl_FragCoord","gl_FrontFacing","gl_FragDepth","gl_PointCoord","gl_MaxVertexAttribs","gl_MaxVertexUniformVectors","gl_MaxVertexOutputVectors","gl_MaxFragmentInputVectors","gl_MaxVertexTextureImageUnits","gl_MaxCombinedTextureImageUnits","gl_MaxTextureImageUnits","gl_MaxFragmentUniformVectors","gl_MaxDrawBuffers","gl_MinProgramTexelOffset","gl_MaxProgramTexelOffset","gl_DepthRangeParameters","gl_DepthRange","trunc","round","roundEven","isnan","isinf","floatBitsToInt","floatBitsToUint","intBitsToFloat","uintBitsToFloat","packSnorm2x16","unpackSnorm2x16","packUnorm2x16","unpackUnorm2x16","packHalf2x16","unpackHalf2x16","outerProduct","transpose","determinant","inverse","texture","textureSize","textureProj","textureLod","textureOffset","texelFetch","texelFetchOffset","textureProjOffset","textureLodOffset","textureProjLod","textureProjLodOffset","textureGrad","textureGradOffset","textureProjGrad","textureProjGradOffset"]),zr}var Ur,Ho;function lf(){if(Ho)return Ur;Ho=1,Ur=_;var t=Ls(),e=of(),n=Ds(),r=af(),i=sf(),o=999,a=9999,s=0,l=1,u=2,c=3,d=4,p=5,f=6,h=7,w=8,g=9,y=10,E=11,A=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"];function _(N){var m=0,M=0,x=o,b,v,k=[],R=[],F=1,z=0,D=0,V=!1,re=!1,ee="",se;N=N||{};var S=n,xe=t;N.version==="300 es"&&(S=i,xe=r);for(var Ue={},C={},m=0;m0)continue;pe=Z.slice(0,1).join("")}return ye(pe),D+=pe.length,k=k.slice(pe.length),k.length}while(!0)}function W(){return/[^a-fA-F0-9]/.test(b)?(ye(k.join("")),x=o,m):(k.push(b),v=b,m+1)}function G(){return b==="."||/[eE]/.test(b)?(k.push(b),x=p,v=b,m+1):b==="x"&&k.length===1&&k[0]==="0"?(x=E,k.push(b),v=b,m+1):/[^\d]/.test(b)?(ye(k.join("")),x=o,m):(k.push(b),v=b,m+1)}function J(){return b==="f"&&(k.push(b),v=b,m+=1),/[eE]/.test(b)||(b==="-"||b==="+")&&/[eE]/.test(v)?(k.push(b),v=b,m+1):/[^\d]/.test(b)?(ye(k.join("")),x=o,m):(k.push(b),v=b,m+1)}function oe(){if(/[^\d\w_]/.test(b)){var Z=k.join("");return C[Z]?x=w:Ue[Z]?x=h:x=f,ye(k.join("")),x=o,m}return k.push(b),v=b,m+1}}return Ur}var jr,Go;function uf(){if(Go)return jr;Go=1;var t=lf();jr=e;function e(n,r){var i=t(r),o=[];return o=o.concat(i(n)),o=o.concat(i(null)),o}return jr}uf();function cf(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function df(t){var e=cf(t,"string");return typeof e=="symbol"?e:String(e)}function Oe(t,e,n){return e=df(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var fe={position:"csm_Position",positionRaw:"csm_PositionRaw",pointSize:"csm_PointSize",fragColor:"csm_FragColor",diffuseColor:"csm_DiffuseColor",normal:"csm_Normal",roughness:"csm_Roughness",metalness:"csm_Metalness",emissive:"csm_Emissive",ao:"csm_AO",bump:"csm_Bump",depthAlpha:"csm_DepthAlpha"},Je,tn;Je={},Oe(Je,"".concat(fe.normal),{"#include ":` + vec3 objectNormal = `.concat(fe.normal,`; + #ifdef USE_TANGENT + vec3 objectTangent = vec3( tangent.xyz ); + #endif + `)}),Oe(Je,"".concat(fe.position),{"#include ":` + vec3 transformed = `.concat(fe.position,`; + `)}),Oe(Je,"".concat(fe.positionRaw),{"#include ":` + vec4 csm_internal_positionUnprojected = `.concat(fe.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; + `)}),Oe(Je,"".concat(fe.pointSize),{"gl_PointSize = size;":` + gl_PointSize = `.concat(fe.pointSize,`; + `)}),Oe(Je,"".concat(fe.diffuseColor),{"#include ":` + #include + diffuseColor = `.concat(fe.diffuseColor,`; + `)}),Oe(Je,"".concat(fe.fragColor),{"#include ":` + #include + gl_FragColor = `.concat(fe.fragColor,`; + `)}),Oe(Je,"".concat(fe.emissive),{"vec3 totalEmissiveRadiance = emissive;":` + vec3 totalEmissiveRadiance = `.concat(fe.emissive,`; + `)}),Oe(Je,"".concat(fe.roughness),{"#include ":` + #include + roughnessFactor = `.concat(fe.roughness,`; + `)}),Oe(Je,"".concat(fe.metalness),{"#include ":` + #include + metalnessFactor = `.concat(fe.metalness,`; + `)}),Oe(Je,"".concat(fe.ao),{"#include ":` + #include + reflectedLight.indirectDiffuse *= 1. - `.concat(fe.ao,`; + `)}),Oe(Je,"".concat(fe.bump),{"#include ":` + #include + + vec3 csm_internal_orthogonal = `.concat(fe.bump," - (dot(").concat(fe.bump,`, normal) * normal); + vec3 csm_internal_projectedbump = mat3(csm_internal_vModelViewMatrix) * csm_internal_orthogonal; + normal = normalize(normal - csm_internal_projectedbump); + `)}),Oe(Je,"".concat(fe.depthAlpha),{"gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );":` + gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity * `.concat(fe.depthAlpha,` ); + `),"gl_FragColor = packDepthToRGBA( fragCoordZ );":` + gl_FragColor = packDepthToRGBA( fragCoordZ ); + gl_FragColor.a *= `.concat(fe.depthAlpha,`; + `)});tn={},Oe(tn,"".concat(fe.position),{"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );":` + gl_Position = projectionMatrix * modelViewMatrix * vec4( `.concat(fe.position,`, 1.0 ); + `)}),Oe(tn,"".concat(fe.positionRaw),{"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );":` + gl_Position = `.concat(fe.position,`; + `)}),Oe(tn,"".concat(fe.diffuseColor),{"gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );":` + gl_FragColor = `.concat(fe.diffuseColor,`; + `)}),Oe(tn,"".concat(fe.fragColor),{"gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );":` + gl_FragColor = `.concat(fe.fragColor,`; + `)});var et;et={},Oe(et,"".concat(fe.position),"*"),Oe(et,"".concat(fe.positionRaw),"*"),Oe(et,"".concat(fe.normal),"*"),Oe(et,"".concat(fe.pointSize),["PointsMaterial"]),Oe(et,"".concat(fe.diffuseColor),"*"),Oe(et,"".concat(fe.fragColor),"*"),Oe(et,"".concat(fe.emissive),["MeshStandardMaterial","MeshPhysicalMaterial"]),Oe(et,"".concat(fe.roughness),["MeshStandardMaterial","MeshPhysicalMaterial"]),Oe(et,"".concat(fe.metalness),["MeshStandardMaterial","MeshPhysicalMaterial"]),Oe(et,"".concat(fe.ao),["MeshStandardMaterial","MeshPhysicalMaterial","MeshBasicMaterial","MeshLambertMaterial","MeshPhongMaterial","MeshToonMaterial"]),Oe(et,"".concat(fe.bump),["MeshLambertMaterial","MeshMatcapMaterial","MeshNormalMaterial","MeshPhongMaterial","MeshPhysicalMaterial","MeshStandardMaterial","MeshToonMaterial","ShadowMaterial"]),Oe(et,"".concat(fe.depthAlpha),"*");var ff=`void main() { + gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); +}`,pf=`#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 Ln=new ce(0,0,0),Gi=new ce(0,0,0),hf=new ce(0,0,0);function Ko(t,e,n){const r=Ln.setFromMatrixPosition(t.matrixWorld);r.project(e);const i=n.width/2,o=n.height/2;return[(Number.isNaN(r.x)?0:r.x)*i+i,-(r.y*o)+o]}function mf(t,e){const n=Ln.setFromMatrixPosition(t.matrixWorld),r=Gi.setFromMatrixPosition(e.matrixWorld),i=n.sub(r),o=e.getWorldDirection(hf);return i.angleTo(o)>Math.PI/2}function gf(t,e,n,r){const i=Ln.setFromMatrixPosition(t.matrixWorld),o=i.clone();o.project(e),n.setFromCamera(new Ge(o.x,o.y),e);const a=n.intersectObjects(r,!0);if(a.length>0){const s=a[0].distance;return i.distanceTo(n.ray.origin)Math.abs(t)<1e-10?0:t;function Bs(t,e,n=""){let r="matrix3d(";for(let i=0;i!==16;i++)r+=gi(e[i]*t.elements[i])+(i!==15?",":")");return n+r}const bf=(t=>e=>Bs(e,t))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),xf=(t=>(e,n)=>Bs(e,t(n),"translate(-50%,-50%)"))(t=>[1/t,1/t,1/t,1,-1/t,-1/t,-1/t,-1,1/t,1/t,1/t,1,1,1,1,1]),wf=["geometry","material"];new ts;var vi={exports:{}},Tf=vi.exports,qo;function Af(){return qo||(qo=1,function(t,e){(function(n,r){t.exports=r()})(Tf,function(){var n=function(){function r(f){return a.appendChild(f.dom),f}function i(f){for(var h=0;hl+1e3&&(c.update(1e3*u/(f-l),100),l=f,u=0,p)){var h=performance.memory;p.update(h.usedJSHeapSize/1048576,h.jsHeapSizeLimit/1048576)}return f},update:function(){s=this.end()},domElement:a,setMode:i}};return n.Panel=function(r,i,o){var a=1/0,s=0,l=Math.round,u=l(window.devicePixelRatio||1),c=80*u,d=48*u,p=3*u,f=2*u,h=3*u,w=15*u,g=74*u,y=30*u,E=document.createElement("canvas");E.width=c,E.height=d,E.style.cssText="width:80px;height:48px";var A=E.getContext("2d");return A.font="bold "+9*u+"px Helvetica,Arial,sans-serif",A.textBaseline="top",A.fillStyle=o,A.fillRect(0,0,c,d),A.fillStyle=i,A.fillText(r,p,f),A.fillRect(h,w,g,y),A.fillStyle=o,A.globalAlpha=.9,A.fillRect(h,w,g,y),{dom:E,update:function(_,N){a=Math.min(a,_),s=Math.max(s,_),A.fillStyle=o,A.globalAlpha=1,A.fillRect(0,0,c,w),A.fillStyle=i,A.fillText(l(_)+" "+r+" ("+l(a)+"-"+l(s)+")",p,f),A.drawImage(E,h+u,w,g-u,y,h,w,g-u,y),A.fillRect(h+g-u,w,u,y),A.fillStyle=o,A.globalAlpha=.9,A.fillRect(h+g-u,w,u,l((1-_/N)*y))}}},n})}(vi)),vi.exports}Af();const kf={key:0,args:[0,1,64]},Ef={key:1,args:[.5,1,64]},_f={key:2},Mf=["tone-mapped","map","side","color"];new Xe(16777215);const At="0px",Fs=be({__name:"TransitionVertical",props:{duration:{default:250},easingEnter:{default:"ease-in-out"},easingLeave:{default:"ease-in-out"},opacityClosed:{default:0},opacityOpened:{default:1}},setup(t){const e=t;function n(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 r(l,u){const{width:c}=getComputedStyle(l);l.style.width=c,l.style.position="absolute",l.style.visibility="hidden",l.style.height="";const{height:d}=getComputedStyle(l);return l.style.width=u.width,l.style.position=u.position,l.style.visibility=u.visibility,l.style.height=At,l.style.overflow="hidden",u.height&&u.height!==At?u.height:d}function i(l,u,c,d,p){const f=l.animate(d,p);l.style.height=u.height,f.onfinish=()=>{l.style.overflow=u.overflow,c()}}function o(l,u){return[{height:At,opacity:e.opacityClosed,paddingTop:At,paddingBottom:At,borderTopWidth:At,borderBottomWidth:At,marginTop:At,marginBottom:At},{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,d=n(c),p=r(c,d),f=o(p,d),h={duration:e.duration,easing:e.easingEnter};i(c,d,u,f,h)}function s(l,u){const c=l,d=n(c),{height:p}=getComputedStyle(c);c.style.height=p,c.style.overflow="hidden";const f=o(p,d).reverse(),h={duration:e.duration,easing:e.easingLeave};i(c,d,u,f,h)}return(l,u)=>(Q(),Fe(ds,{css:!1,onEnter:a,onLeave:s},{default:we(()=>[ze(l.$slots,"default")]),_:3}))}}),Sf={flex:"~ col",border:"~ gray/25 rounded-lg",divide:"y dashed gray/25","of-clip":"","shadow-sm":""},If={op50:""},Rf={key:0,"w-full":""},Wo=be({__name:"Collapsable",props:Hu({default:{type:Boolean},label:null},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:["update:modelValue"],setup(t){const e=t,n=Gu(t,"modelValue");return gt(()=>{e.default!=null&&(n.value=!!e.default)}),(r,i)=>(Q(),ue("div",Sf,[B("button",{sticky:"","top-0":"","z-10":"",flex:"","items-center":"","justify-between":"",px2:"",py1:"","text-sm":"","backdrop-blur-xl":"",onClick:i[0]||(i[0]=o=>n.value=!n.value)},[B("span",null,[ze(r.$slots,"label",{},()=>[vo(he(e.label??"Collapsable"),1)])]),i[1]||(i[1]=vo()),B("span",If,he(n.value?"▲":"▼"),1)]),me(Fs,null,{default:we(()=>[n.value?(Q(),ue("div",Rf,[ze(r.$slots,"default")])):Ye("",!0)]),_:3})]))}}),nn=be({__name:"Range",props:{modelValue:null,min:{default:0},max:{default:100},step:{default:1},disabled:{type:Boolean,default:!1}},emits:["update:modelValue","mousedown"],setup(t,{emit:e}){const n=t,r=e,i=j(null);function o(h,w,g){return Math.min(Math.max(h,w),g)}function a(h){const w=h.toString();return w.includes("e-")?Number.parseInt(w.split("e-")[1],10):w.includes(".")?w.split(".")[1].length:0}function s(h,w){const g=a(w),y=10**(g+3);return Number.parseFloat((h*y/y).toFixed(g))}const l=Me(()=>s(o(n.modelValue,n.min,n.max),n.step)),u=Me(()=>{const h=(l.value-n.min)/(n.max-n.min)*100;return{width:`${h}%`,backgroundSize:`${h}% 100%`}});function c(h){if(!i.value)return l.value;const w=i.value.getBoundingClientRect(),y=(h.clientX-w.left)/w.width,E=n.max-n.min,A=n.min+E*y,_=Math.round(A/n.step)*n.step;return Math.min(Math.max(_,n.min),n.max)}function d(h){if(n.disabled)return;const w=c(h);r("update:modelValue",w)}function p(h){if(n.disabled)return;h.preventDefault();const w=c(h);r("update:modelValue",w),window.addEventListener("mousemove",d),window.addEventListener("mouseup",f)}function f(h){window.removeEventListener("mousemove",d),window.removeEventListener("mouseup",f)}return lt(()=>{window.removeEventListener("mousemove",d),window.removeEventListener("mouseup",f)}),(h,w)=>(Q(),ue("span",{ref_key:"sliderRef",ref:i,class:Pi(["range-slider disabled:pointer-events-none disabled:cursor-default disabled:opacity-50",{disabled:t.disabled}]),bg:"[#e6e1fc] dark:[#676085]","touch-action-none":"",relative:"","inline-block":"","w-full":"","cursor-ew-resize":"","rounded-sm":"",onMousedown:p},[B("span",{style:pn(u.value),bg:"[#cabeff] dark:[#4e34b9]",relative:"",block:"","rounded-sm":"",h:"[14px]"},null,4),B("span",{role:"slider",class:"slider-thumb",style:pn({left:`${(l.value-t.min)/(t.max-t.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 Yo(t,e){if(e===Ku)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),t;if(e===fi||e===fs){let n=t.getIndex();if(n===null){const a=[],s=t.getAttribute("position");if(s!==void 0){for(let l=0;l=2.0 are supported."));return}const u=new cp(o,{path:n||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[d]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+d+'".')}}u.setExtensions(a),u.setPlugins(s),u.parse(r,i)}parseAsync(e,n){const r=this;return new Promise(function(i,o){r.parse(e,n,i,o)})}}function Nf(){let t={};return{get:function(e){return t[e]},add:function(e,n){t[e]=n},remove:function(e){delete t[e]},removeAll:function(){t={}}}}const Te={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 Of{constructor(e){this.parser=e,this.name=Te.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,n=this.parser.json.nodes||[];for(let r=0,i=n.length;r=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return n.loadTextureImage(e,o.source,a)}}class qf{constructor(e){this.parser=e,this.name=Te.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const n=this.name,r=this.parser,i=r.json,o=i.textures[e];if(!o.extensions||!o.extensions[n])return null;const a=o.extensions[n],s=i.images[a.source];let l=r.textureLoader;if(s.uri){const u=r.options.manager.getHandler(s.uri);u!==null&&(l=u)}return this.detectSupport().then(function(u){if(u)return r.loadTextureImage(e,a.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(n)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const n=new Image;n.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",n.onload=n.onerror=function(){e(n.height===1)}})),this.isSupported}}class Wf{constructor(e){this.parser=e,this.name=Te.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const n=this.name,r=this.parser,i=r.json,o=i.textures[e];if(!o.extensions||!o.extensions[n])return null;const a=o.extensions[n],s=i.images[a.source];let l=r.textureLoader;if(s.uri){const u=r.options.manager.getHandler(s.uri);u!==null&&(l=u)}return this.detectSupport().then(function(u){if(u)return r.loadTextureImage(e,a.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(n)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const n=new Image;n.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",n.onload=n.onerror=function(){e(n.height===1)}})),this.isSupported}}class Yf{constructor(e){this.name=Te.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const n=this.parser.json,r=n.bufferViews[e];if(r.extensions&&r.extensions[this.name]){const i=r.extensions[this.name],o=this.parser.getDependency("buffer",i.buffer),a=this.parser.options.meshoptDecoder;if(!a||!a.supported){if(n.extensionsRequired&&n.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,d=i.byteStride,p=new Uint8Array(s,l,u);return a.decodeGltfBufferAsync?a.decodeGltfBufferAsync(c,d,p,i.mode,i.filter).then(function(f){return f.buffer}):a.ready.then(function(){const f=new ArrayBuffer(c*d);return a.decodeGltfBuffer(new Uint8Array(f),c,d,p,i.mode,i.filter),f})})}else return null}}class Xf{constructor(e){this.name=Te.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const n=this.parser.json,r=n.nodes[e];if(!r.extensions||!r.extensions[this.name]||r.mesh===void 0)return null;const i=n.meshes[r.mesh];for(const u of i.primitives)if(u.mode!==ut.TRIANGLES&&u.mode!==ut.TRIANGLE_STRIP&&u.mode!==ut.TRIANGLE_FAN&&u.mode!==void 0)return null;const a=r.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(),d=c.isGroup?c.children:[c],p=u[0].count,f=[];for(const h of d){const w=new _t,g=new ce,y=new sr,E=new ce(1,1,1),A=new Qu(h.geometry,h.material,p);for(let _=0;_0||t.search(/^data\:image\/jpeg/)===0?"image/jpeg":t.search(/\.webp($|\?)/i)>0||t.search(/^data\:image\/webp/)===0?"image/webp":t.search(/\.ktx2($|\?)/i)>0||t.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const up=new _t;class cp{constructor(e={},n={}){this.json=e,this.extensions={},this.plugins={},this.options=n,this.cache=new Nf,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 r=!1,i=-1,o=!1,a=-1;if(typeof navigator<"u"){const s=navigator.userAgent;r=/^((?!chrome|android).)*safari/i.test(s)===!0;const l=s.match(/Version\/(\d+)/);i=r&&l?parseInt(l[1],10):-1,o=s.indexOf("Firefox")>-1,a=o?s.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||r&&i<17||o&&a<98?this.textureLoader=new Ju(this.options.manager):this.textureLoader=new ec(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new ps(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,n){const r=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([r.getDependencies("scene"),r.getDependencies("animation"),r.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:r,userData:{}};return jt(o,s,i),Et(s,i),Promise.all(r._invokeAll(function(l){return l.afterRoot&&l.afterRoot(s)})).then(function(){for(const l of s.scenes)l.updateMatrixWorld();e(s)})}).catch(n)}_markDefs(){const e=this.json.nodes||[],n=this.json.skins||[],r=this.json.meshes||[];for(let i=0,o=n.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(r,i),i.name+="_instance_"+e.uses[n]++,i}_invokeOne(e){const n=Object.values(this.plugins);n.push(this);for(let r=0;r=2&&g.setY(b,m[M*l+1]),l>=3&&g.setZ(b,m[M*l+2]),l>=4&&g.setW(b,m[M*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}g.normalized=h}return g})}loadTexture(e){const n=this.json,r=this.options,o=n.textures[e].source,a=n.images[o];let s=this.textureLoader;if(a.uri){const l=r.manager.getHandler(a.uri);l!==null&&(s=l)}return this.loadTextureImage(e,o,s)}loadTextureImage(e,n,r){const i=this,o=this.json,a=o.textures[e],s=o.images[n],l=(s.uri||s.bufferView)+":"+a.sampler;if(this.textureCache[l])return this.textureCache[l];const u=this.loadImageSource(n,r).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=Qo[p.magFilter]||ur,c.minFilter=Qo[p.minFilter]||ji,c.wrapS=Zo[p.wrapS]||cr,c.wrapT=Zo[p.wrapT]||cr,c.generateMipmaps=!c.isCompressedTexture&&c.minFilter!==Gt&&c.minFilter!==ur,i.associations.set(c,{textures:e}),c}).catch(function(){return null});return this.textureCache[l]=u,u}loadImageSource(e,n){const r=this,i=this.json,o=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(d=>d.clone());const a=i.images[e],s=self.URL||self.webkitURL;let l=a.uri||"",u=!1;if(a.bufferView!==void 0)l=r.getDependency("bufferView",a.bufferView).then(function(d){u=!0;const p=new Blob([d],{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(d){return new Promise(function(p,f){let h=p;n.isImageBitmapLoader===!0&&(h=function(w){const g=new lr(w);g.needsUpdate=!0,p(g)}),n.load(En.resolveURL(d,o.path),h,void 0,f)})}).then(function(d){return u===!0&&s.revokeObjectURL(l),Et(d,a),d.userData.mimeType=a.mimeType||lp(a.uri),d}).catch(function(d){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),d});return this.sourceCache[e]=c,c}assignTexture(e,n,r,i){const o=this;return this.getDependency("texture",r.index).then(function(a){if(!a)return null;if(r.texCoord!==void 0&&r.texCoord>0&&(a=a.clone(),a.channel=r.texCoord),o.extensions[Te.KHR_TEXTURE_TRANSFORM]){const s=r.extensions!==void 0?r.extensions[Te.KHR_TEXTURE_TRANSFORM]:void 0;if(s){const l=o.associations.get(a);a=o.extensions[Te.KHR_TEXTURE_TRANSFORM].extendTexture(a,s),o.associations.set(a,l)}}return i!==void 0&&(a.colorSpace=i),e[n]=a,a})}assignFinalMaterial(e){const n=e.geometry;let r=e.material;const i=n.attributes.tangent===void 0,o=n.attributes.color!==void 0,a=n.attributes.normal===void 0;if(e.isPoints){const s="PointsMaterial:"+r.uuid;let l=this.cache.get(s);l||(l=new tc,Sr.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,l.sizeAttenuation=!1,this.cache.add(s,l)),r=l}else if(e.isLine){const s="LineBasicMaterial:"+r.uuid;let l=this.cache.get(s);l||(l=new nc,Sr.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,this.cache.add(s,l)),r=l}if(i||o||a){let s="ClonedMaterial:"+r.uuid+":";i&&(s+="derivative-tangents:"),o&&(s+="vertex-colors:"),a&&(s+="flat-shading:");let l=this.cache.get(s);l||(l=r.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(r))),r=l}e.material=r}getMaterialType(){return hs}loadMaterial(e){const n=this,r=this.json,i=this.extensions,o=r.materials[e];let a;const s={},l=o.extensions||{},u=[];if(l[Te.KHR_MATERIALS_UNLIT]){const d=i[Te.KHR_MATERIALS_UNLIT];a=d.getMaterialType(),u.push(d.extendParams(s,o,n))}else{const d=o.pbrMetallicRoughness||{};if(s.color=new Xe(1,1,1),s.opacity=1,Array.isArray(d.baseColorFactor)){const p=d.baseColorFactor;s.color.setRGB(p[0],p[1],p[2],Mt),s.opacity=p[3]}d.baseColorTexture!==void 0&&u.push(n.assignTexture(s,"map",d.baseColorTexture,In)),s.metalness=d.metallicFactor!==void 0?d.metallicFactor:1,s.roughness=d.roughnessFactor!==void 0?d.roughnessFactor:1,d.metallicRoughnessTexture!==void 0&&(u.push(n.assignTexture(s,"metalnessMap",d.metallicRoughnessTexture)),u.push(n.assignTexture(s,"roughnessMap",d.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=gr);const c=o.alphaMode||Vr.OPAQUE;if(c===Vr.BLEND?(s.transparent=!0,s.depthWrite=!1):(s.transparent=!1,c===Vr.MASK&&(s.alphaTest=o.alphaCutoff!==void 0?o.alphaCutoff:.5)),o.normalTexture!==void 0&&a!==an&&(u.push(n.assignTexture(s,"normalMap",o.normalTexture)),s.normalScale=new Ge(1,1),o.normalTexture.scale!==void 0)){const d=o.normalTexture.scale;s.normalScale.set(d,d)}if(o.occlusionTexture!==void 0&&a!==an&&(u.push(n.assignTexture(s,"aoMap",o.occlusionTexture)),o.occlusionTexture.strength!==void 0&&(s.aoMapIntensity=o.occlusionTexture.strength)),o.emissiveFactor!==void 0&&a!==an){const d=o.emissiveFactor;s.emissive=new Xe().setRGB(d[0],d[1],d[2],Mt)}return o.emissiveTexture!==void 0&&a!==an&&u.push(n.assignTexture(s,"emissiveMap",o.emissiveTexture,In)),Promise.all(u).then(function(){const d=new a(s);return o.name&&(d.name=o.name),Et(d,o),n.associations.set(d,{materials:e}),o.extensions&&jt(i,d,o),d})}createUniqueName(e){const n=Sn.sanitizeNodeName(e||"");return n in this.nodeNamesUsed?n+"_"+ ++this.nodeNamesUsed[n]:(this.nodeNamesUsed[n]=0,n)}loadGeometries(e){const n=this,r=this.extensions,i=this.primitiveCache;function o(s){return r[Te.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(s,n).then(function(l){return Jo(l,s,n)})}const a=[];for(let s=0,l=e.length;s0&&ap(y,o),y.name=n.createUniqueName(o.name||"mesh_"+e),Et(y,o),g.extensions&&jt(i,y,g),n.assignFinalMaterial(y),d.push(y)}for(let f=0,h=d.length;f1?c=new Ir:u.length===1?c=u[0]:c=new $i,c!==u[0])for(let d=0,p=u.length;d{const d=new Map;for(const[p,f]of i.associations)(p instanceof Sr||p instanceof lr)&&d.set(p,f);return c.traverse(p=>{const f=i.associations.get(p);f!=null&&d.set(p,f)}),d};return i.associations=u(o),o})}_createAnimationTracks(e,n,r,i,o){const a=[],s=e.name?e.name:e.uuid,l=[];Nt[o.path]===Nt.weights?e.traverse(function(p){p.morphTargetInfluences&&l.push(p.name?p.name:p.uuid)}):l.push(s);let u;switch(Nt[o.path]){case Nt.weights:u=bo;break;case Nt.rotation:u=xo;break;case Nt.position:case Nt.scale:u=yo;break;default:switch(r.itemSize){case 1:u=bo;break;case 2:case 3:default:u=yo;break}break}const c=i.interpolation!==void 0?rp[i.interpolation]:Bi,d=this._getArrayFromAccessor(r);for(let p=0,f=l.length;pnew fu(t)),$t.register(t=>new pu(t)),$t)}async function fp(t){const r=(await js().loadAsync(t)).userData;if(!r.vrmAnimations){console.warn("No VRM animations found in the .vrma file");return}if(r.vrmAnimations.length===0){console.warn("No VRM animations found in the .vrma file");return}return r.vrmAnimations[0]}async function pp(t,e){if(!t){console.warn("No VRM found");return}if(e)return hu(e,t)}function hp(){const t=j(!1),e=j(0),n=j(0),r=.2,i=1,o=6,a=j(Math.random()*(o-i)+i);function s(l,u){if(l!=null&&l.expressionManager&&(n.value+=u,!t.value&&n.value>=a.value&&(t.value=!0,e.value=0),t.value)){e.value+=u/r;const c=Math.sin(Math.PI*e.value);l.expressionManager.setValue("blink",c),e.value>=1&&(t.value=!1,n.value=0,l.expressionManager.setValue("blink",0),a.value=Math.random()*(o-i)+i)}}return{update:s}}function mp(){let t=-1,e,n=0;function r(){e?e.set(Vt(-.25,.25),Vt(-.2,.15),-.65):e=new ce(Vt(-.25,.25),Vt(-.2,.15),-.65)}function i(o,a){var s;!(o!=null&&o.expressionManager)||!o.lookAt||(n>=t?(r(),n=0,t=Ga()/1e3):e||r(),o.lookAt.target||(o.lookAt.target=new $i),o.lookAt.target.position.lerp(e,Vt(.2,.5)),(s=o.lookAt)==null||s.update(a),n+=a)}return{update:i}}async function gp(t,e){const i=(await js().loadAsync(t,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(ui.removeUnnecessaryVertices(o.scene),ui.combineSkeletons(o.scene),o.scene.traverse(a=>{a.frustumCulled=!1}),o.lookAt){const a=new mu(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 vp(t){const e=j(null),n=j(!1),r=j(0),i=j(new Map),o=j(new Map),a=j(),s=(y,E,A)=>y+(E-y)*A,l=y=>y<.5?4*y*y*y:1-(-2*y+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)},d=y=>{var A;if(c(),!u.has(y)){console.warn(`Emotion ${y} not found`);return}const E=u.get(y);if(e.value=y,n.value=!0,r.value=0,t.expressionManager){const _=Object.keys(t.expressionManager.expressionMap);for(const N of _)t.expressionManager.setValue(N,0)}i.value.clear(),o.value.clear();for(const _ of E.expression||[]){const N=((A=t.expressionManager)==null?void 0:A.getValue(_.name))||0;i.value.set(_.name,N),o.value.set(_.name,_.value)}};return{currentEmotion:e,isTransitioning:n,setEmotion:d,setEmotionWithResetAfter:(y,E)=>{c(),d(y),a.value=setTimeout(()=>{d("neutral"),a.value=void 0},E)},update:y=>{var _;if(!n.value||!e.value)return;const A=u.get(e.value).blendDuration||.3;r.value+=y/A,r.value>=1&&(r.value=1,n.value=!1);for(const[N,m]of o.value){const M=i.value.get(N)||0,x=s(M,m,l(r.value));(_=t.expressionManager)==null||_.setValue(N,x)}},addEmotionState:(y,E)=>{u.set(y,E)},removeEmotionState:y=>{u.delete(y)},dispose:()=>{c()}}}const yp=be({__name:"Model",props:{model:null,idleAnimation:null,loadAnimations:null,position:null},emits:["loadModelProgress","error"],setup(t,{expose:e,emit:n}){const r=t,i=n;let o;const a=j(),s=j(),{scene:l}=mr(),{onBeforeRender:u}=Di(),c=hp(),d=mp(),p=j();return Se(()=>r.position,([f,h,w])=>{a.value&&a.value.scene.position.set(f,h,w)}),dt(async()=>{if(l.value)try{const f=await gp(r.model,{scene:l.value,lookAt:!0,position:r.position,onProgress:g=>i("loadModelProgress",Number.parseFloat((100*(g.loaded/g.total)).toFixed(2)))});if(!f){console.warn("No VRM model loaded");return}const h=await fp(r.idleAnimation),w=await pp(f,h);if(!w){console.warn("No VRM animation loaded");return}s.value=new pc(f.scene),s.value.clipAction(w).play(),p.value=vp(f),a.value=f,o=u(({delta:g})=>{var y,E,A;(y=s.value)==null||y.update(g),(E=a.value)==null||E.update(g),c.update(a.value,g),d.update(a.value,g),(A=p.value)==null||A.update(g)}).off}catch(f){i("error",f)}}),lt(()=>{o==null||o(),a.value&&(a.value.scene.removeFromParent(),ui.deepDispose(a.value.scene))}),e({setExpression(f){var h;(h=p.value)==null||h.setEmotionWithResetAfter(f,1e3)}}),(f,h)=>ze(f.$slots,"default")}}),bp=["position"],xp={absolute:"",bottom:"3",right:"3"},wp={flex:"~ row","cursor-pointer":""},Tp=["checked","aria-checked"],Ap={key:0,"min-w":"50vw",z:"{var h;(h=p.value)==null||h.setExpression(f)}}),(f,h)=>(Q(),Fe(bs,{relative:""},{default:we(({height:w,width:g})=>[me(L(hc),{alpha:!0,antialias:!0,width:g,height:w},{default:we(()=>[me(L(nf)),B("TresPerspectiveCamera",{position:[a.value,s.value,l.value]},null,8,bp),h[14]||(h[14]=B("TresDirectionalLight",{color:16777215,intensity:1.2,position:[1,1,1]},null,-1)),h[15]||(h[15]=B("TresAmbientLight",{color:16777215,intensity:1.5},null,-1)),me(yp,{ref_key:"modelRef",ref:p,model:r.model,"idle-animation":r.idleAnimation,position:[u.value,c.value,d.value],onLoadModelProgress:h[0]||(h[0]=y=>i("loadModelProgress",y)),onError:h[1]||(h[1]=y=>i("error",y))},null,8,["model","idle-animation","position"])]),_:2},1032,["width","height"]),B("div",xp,[B("div",wp,[B("label",{class:Pi([o.value?"bg-zinc-300 dark:bg-zinc-200":"bg-zinc-100 dark:bg-zinc-700"]),transition:"all ease-in-out duration-500",text:"lg zinc-500 dark:zinc-400","m-1":"","h-fit":"","w-fit":"","cursor-pointer":"","appearance-none":"","gap-1":"","rounded-lg":"","rounded-md":"","border-none":"","p-2":"","outline-none":""},[Dt(B("input",{"onUpdate:modelValue":h[2]||(h[2]=y=>o.value=y),checked:o.value,"aria-checked":o.value,name:"showLive2DViewerInspector",type:"checkbox",hidden:"","appearance-none":"","outline-none":""},null,8,Tp),[[Li,o.value]]),h[16]||(h[16]=B("div",{"select-none":""},[B("div",{"i-solar:bug-bold-duotone":""})],-1))],2)]),me(Fs,null,{default:we(()=>[o.value?(Q(),ue("div",Ap,[B("div",kp,[B("div",Ep,[B("span",null,he(f.$t("stage.viewers.debug-menu.vrm.model.title")),1)]),me(Wo,{"h-fit":"","w-full":""},{label:we(()=>[B("span",_p,he(f.$t("stage.viewers.debug-menu.vrm.camera")),1)]),default:we(()=>[B("div",Mp,[h[17]||(h[17]=B("div",{text:"zinc-400 dark:zinc-500"},[B("span",null,"X")],-1)),B("label",Sp,[me(nn,{modelValue:a.value,"onUpdate:modelValue":h[3]||(h[3]=y=>a.value=y),min:-10,max:10,step:.01},null,8,["modelValue"])]),B("div",Ip,[B("span",null,he(a.value),1)]),h[18]||(h[18]=B("div",{text:"zinc-400 dark:zinc-500"},[B("span",null,"Y")],-1)),B("label",Rp,[me(nn,{modelValue:s.value,"onUpdate:modelValue":h[4]||(h[4]=y=>s.value=y),min:-10,max:10,step:.01},null,8,["modelValue"])]),B("div",Cp,[B("span",null,he(s.value),1)]),h[19]||(h[19]=B("div",{text:"zinc-400 dark:zinc-500"},[B("span",null,"Z")],-1)),B("label",Np,[me(nn,{modelValue:l.value,"onUpdate:modelValue":h[5]||(h[5]=y=>l.value=y),min:-10,max:10,step:.01},null,8,["modelValue"])]),B("div",Op,[B("span",null,he(l.value),1)])])]),_:1}),me(Wo,{"h-fit":"","w-full":""},{label:we(()=>[B("span",Pp,he(f.$t("stage.viewers.debug-menu.vrm.model.title")),1)]),default:we(()=>[B("div",Lp,[h[20]||(h[20]=B("div",{text:"zinc-400 dark:zinc-500"},[B("span",null,"X")],-1)),B("label",Dp,[me(nn,{modelValue:u.value,"onUpdate:modelValue":h[6]||(h[6]=y=>u.value=y),min:-10,max:10,step:.01},null,8,["modelValue"])]),B("div",Bp,[B("span",null,he(u.value),1)]),h[21]||(h[21]=B("div",{text:"zinc-400 dark:zinc-500"},[B("span",null,"Y")],-1)),B("label",Fp,[me(nn,{modelValue:c.value,"onUpdate:modelValue":h[7]||(h[7]=y=>c.value=y),min:-10,max:10,step:.01},null,8,["modelValue"])]),B("div",zp,[B("span",null,he(c.value),1)]),h[22]||(h[22]=B("div",{text:"zinc-400 dark:zinc-500"},[B("span",null,"Z")],-1)),B("label",Up,[me(nn,{modelValue:d.value,"onUpdate:modelValue":h[8]||(h[8]=y=>d.value=y),min:-10,max:10,step:.01},null,8,["modelValue"])]),B("div",jp,[B("span",null,he(d.value),1)])])]),_:1}),B("div",$p,[B("span",null,he(f.$t("stage.viewers.debug-menu.emotions")),1)]),B("div",Vp,[B("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:h[9]||(h[9]=y=>{var E;return(E=p.value)==null?void 0:E.setExpression("neutral")})},he(f.$t("stage.viewers.debug-menu.emotions-btn.neutral")),1),B("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:h[10]||(h[10]=y=>{var E;return(E=p.value)==null?void 0:E.setExpression("surprised")})},he(f.$t("stage.viewers.debug-menu.emotions-btn.surprised")),1),B("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:h[11]||(h[11]=y=>{var E;return(E=p.value)==null?void 0:E.setExpression("sad")})},he(f.$t("stage.viewers.debug-menu.emotions-btn.sad")),1),B("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:h[12]||(h[12]=y=>{var E;return(E=p.value)==null?void 0:E.setExpression("angry")})},he(f.$t("stage.viewers.debug-menu.emotions-btn.angry")),1),B("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:h[13]||(h[13]=y=>{var E;return(E=p.value)==null?void 0:E.setExpression("happy")})},he(f.$t("stage.viewers.debug-menu.emotions-btn.happy")),1)])])])):Ye("",!0)]),_:1})])]),_:1}))}});class Gr extends Error{constructor(n,r){super(n);po(this,"response");this.name="XSAIError",this.response=r}}const Gp=t=>t.replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`),or=t=>Object.fromEntries(Object.entries(t).map(([e,n])=>[Gp(e),n])),$s=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),Vs=t=>JSON.stringify(or($s({...t,abortSignal:void 0,apiKey:void 0,baseURL:void 0,fetch:void 0,headers:void 0}))),Ki=(t,e)=>$s({Authorization:e!==void 0?`Bearer ${e}`:void 0,...t}),qi=(t,e)=>{const n=e.toString();return new URL(t,n.endsWith("/")?n:`${n}/`)},Wi=async t=>{if(!t.ok){const e=new Gr(`Remote sent ${t.status} response`,t);throw e.cause=new Error(await t.text()),e}if(!t.body)throw new Gr("Response body is empty from remote server",t);if(!(t.body instanceof ReadableStream)){const e=new Gr(`Expected Response body to be a ReadableStream, but got ${String(t.body)}`,t);throw e.cause=new Error(`Content-Type is ${t.headers.get("Content-Type")}`),e}return t},Kp=async t=>Wi(t).then(async e=>e.json()),qp=async t=>(t.fetch??globalThis.fetch)(qi("audio/speech",t.baseURL),{body:Vs(t),headers:Ki({"Content-Type":"application/json",...t.headers},t.apiKey),method:"POST",signal:t.abortSignal}).then(Wi).then(async e=>e.arrayBuffer()),Hs=(t,{apiKey:e,baseURL:n,headers:r})=>({apiKey:e,baseURL:n,headers:r,model:t}),Wp=t=>{const e={...t,baseURL:new URL("http://localhost:11434/v1/")},n=r=>Hs(r,e);return{chat:n,embed:n,model:()=>e}};Wp();const Yp=t=>{const e=({applyTextNormalization:n,languageCode:r,nextRequestIds:i,nextText:o,previousRequestIds:a,previousText:s,pronunciationDictionaryLocators:l,seed:u,voiceSettings:c})=>({extraBody:or({applyTextNormalization:n,languageCode:r,nextRequestIds:i,nextText:o,previousRequestIds:a,previousText:s,pronunciationDictionaryLocators:l?l.map(d=>or(d)):void 0,seed:u,voiceSettings:c?or(c):void 0})});return{speech:(n,r)=>({...r?e(r):{},...Hs(`elevenlabs/${n}`,{...t,baseURL:(t==null?void 0:t.baseURL)??new URL("http://localhost:5933/v1/")})})}},Xp=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class Dn{constructor(e,n,r){this.property=e,this.normal=n,r&&(this.space=r)}}Dn.prototype.property={};Dn.prototype.normal={};Dn.prototype.space=null;function Gs(t,e){const n={},r={};let i=-1;for(;++i4&&n.slice(0,4)==="data"&&th.test(e)){if(e.charAt(4)==="-"){const o=e.slice(5).replace(ta,oh);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=e.slice(4);if(!ta.test(o)){let a=o.replace(nh,ih);a.charAt(0)!=="-"&&(a="-"+a),e="data"+a}}i=Yi}return new i(r,e)}function ih(t){return"-"+t.toLowerCase()}function oh(t){return t.charAt(1).toUpperCase()}const ah=Gs([Ws,qs,Qs,Zs,Jp],"html"),Js=Gs([Ws,qs,Qs,Zs,eh],"svg"),na={}.hasOwnProperty;function sh(t,e){const n=e||{};function r(i,...o){let a=r.invalid;const s=r.handlers;if(i&&na.call(i,t)){const l=String(i[t]);a=na.call(s,l)?s[l]:r.unknown}if(a)return a.call(this,i,...o)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}const lh=/["&'<>`]/g,uh=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,ch=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,dh=/[|\\{}()[\]^$+*?.]/g,ra=new WeakMap;function fh(t,e){if(t=t.replace(e.subset?ph(e.subset):lh,r),e.subset||e.escapeOnly)return t;return t.replace(uh,n).replace(ch,r);function n(i,o,a){return e.format((i.charCodeAt(0)-55296)*1024+i.charCodeAt(1)-56320+65536,a.charCodeAt(o+2),e)}function r(i,o,a){return e.format(i.charCodeAt(0),a.charCodeAt(o+1),e)}}function ph(t){let e=ra.get(t);return e||(e=hh(t),ra.set(t,e)),e}function hh(t){const e=[];let n=-1;for(;++n",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:"€"},xh=["cent","copy","divide","gt","lt","not","para","times"],el={}.hasOwnProperty,Ti={};let Hn;for(Hn in qr)el.call(qr,Hn)&&(Ti[qr[Hn]]=Hn);const wh=/[^\dA-Za-z]/;function Th(t,e,n,r){const i=String.fromCharCode(t);if(el.call(Ti,i)){const o=Ti[i],a="&"+o;return n&&bh.includes(o)&&!xh.includes(o)&&(!r||e&&e!==61&&wh.test(String.fromCharCode(e)))?a:a+";"}return""}function Ah(t,e,n){let r=gh(t,e,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=Th(t,e,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){const o=yh(t,e,n.omitOptionalSemicolons);o.length|^->||--!>|"],_h=["<",">"];function Mh(t,e,n,r){return r.settings.bogusComments?"":"";function i(o){return dn(o,Object.assign({},r.settings.characterReferences,{subset:_h}))}}function Sh(t,e,n,r){return""}function ia(t,e){const n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(e);for(;i!==-1;)r++,i=n.indexOf(e,i+e.length);return r}function Ih(t,e){const n=e||{};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}function Rh(t){return t.join(" ").trim()}const Ch=/[ \t\n\f\r]/g;function Xi(t){return typeof t=="object"?t.type==="text"?oa(t.value):!1:oa(t)}function oa(t){return t.replace(Ch,"")===""}const qe=nl(1),tl=nl(-1),Nh=[];function nl(t){return e;function e(n,r,i){const o=n?n.children:Nh;let a=(r||0)+t,s=o[a];if(!i)for(;s&&Xi(s);)a+=t,s=o[a];return s}}const Oh={}.hasOwnProperty;function rl(t){return e;function e(n,r,i){return Oh.call(t,n.tagName)&&t[n.tagName](n,r,i)}}const Qi=rl({body:Lh,caption:Wr,colgroup:Wr,dd:zh,dt:Fh,head:Wr,html:Ph,li:Bh,optgroup:Uh,option:jh,p:Dh,rp:aa,rt:aa,tbody:Vh,td:sa,tfoot:Hh,th:sa,thead:$h,tr:Gh});function Wr(t,e,n){const r=qe(n,e,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&Xi(r.value.charAt(0)))}function Ph(t,e,n){const r=qe(n,e);return!r||r.type!=="comment"}function Lh(t,e,n){const r=qe(n,e);return!r||r.type!=="comment"}function Dh(t,e,n){const r=qe(n,e);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function Bh(t,e,n){const r=qe(n,e);return!r||r.type==="element"&&r.tagName==="li"}function Fh(t,e,n){const r=qe(n,e);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function zh(t,e,n){const r=qe(n,e);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function aa(t,e,n){const r=qe(n,e);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function Uh(t,e,n){const r=qe(n,e);return!r||r.type==="element"&&r.tagName==="optgroup"}function jh(t,e,n){const r=qe(n,e);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function $h(t,e,n){const r=qe(n,e);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function Vh(t,e,n){const r=qe(n,e);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function Hh(t,e,n){return!qe(n,e)}function Gh(t,e,n){const r=qe(n,e);return!r||r.type==="element"&&r.tagName==="tr"}function sa(t,e,n){const r=qe(n,e);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const Kh=rl({body:Yh,colgroup:Xh,head:Wh,html:qh,tbody:Qh});function qh(t){const e=qe(t,-1);return!e||e.type!=="comment"}function Wh(t){const e=new Set;for(const r of t.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(e.has(r.tagName))return!1;e.add(r.tagName)}const n=t.children[0];return!n||n.type==="element"}function Yh(t){const e=qe(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&Xi(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function Xh(t,e,n){const r=tl(n,e),i=qe(t,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&Qi(r,n.children.indexOf(r),n)?!1:!!(i&&i.type==="element"&&i.tagName==="col")}function Qh(t,e,n){const r=tl(n,e),i=qe(t,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&Qi(r,n.children.indexOf(r),n)?!1:!!(i&&i.type==="element"&&i.tagName==="tr")}const Gn={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 Zh(t,e,n,r){const i=r.schema,o=i.space==="svg"?!1:r.settings.omitOptionalTags;let a=i.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(t.tagName.toLowerCase());const s=[];let l;i.space==="html"&&t.tagName==="svg"&&(r.schema=Js);const u=Jh(r,t.properties),c=r.all(i.space==="html"&&t.tagName==="template"?t.content:t);return r.schema=i,c&&(a=!1),(u||!o||!Kh(t,e,n))&&(s.push("<",t.tagName,u?" "+u:""),a&&(i.space==="svg"||r.settings.closeSelfClosing)&&(l=u.charAt(u.length-1),(!r.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&s.push(" "),s.push("/")),s.push(">")),s.push(c),!a&&(!o||!Qi(t,e,n))&&s.push(""),s.join("")}function Jh(t,e){const n=[];let r=-1,i;if(e){for(i in e)if(e[i]!==null&&e[i]!==void 0){const o=em(t,i,e[i]);o&&n.push(o)}}for(;++ria(n,t.alternative)&&(a=t.alternative),s=a+dn(n,Object.assign({},t.settings.characterReferences,{subset:(a==="'"?Gn.single:Gn.double)[i][o],attribute:!0}))+a),l+(s&&"="+s))}const tm=["<","&"];function il(t,e,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?t.value:dn(t.value,Object.assign({},r.settings.characterReferences,{subset:tm}))}function nm(t,e,n,r){return r.settings.allowDangerousHtml?t.value:il(t,e,n,r)}function rm(t,e,n,r){return r.all(t)}const im=sh("type",{invalid:om,unknown:am,handlers:{comment:Mh,doctype:Sh,element:Zh,raw:nm,root:rm,text:il}});function om(t){throw new Error("Expected node, not `"+t+"`")}function am(t){const e=t;throw new Error("Cannot compile unknown node `"+e.type+"`")}const sm={},lm={},um=[];function cm(t,e){const n=e||sm,r=n.quote||'"',i=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:dm,all:fm,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||Xp,characterReferences:n.characterReferences||lm,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?Js:ah,quote:r,alternative:i}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function dm(t,e,n){return im(t,e,n,this)}function fm(t){const e=[],n=t&&t.children||um;let r=-1;for(;++ri?0:i+e:e=e>i?i:e,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(e,n),t.splice(...a);else for(n&&t.splice(e,n);o0?(yt(t,t.length,0,e),t):e}const ca={}.hasOwnProperty;function vm(t){const e={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function fn(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const mt=Ut(/[A-Za-z]/),st=Ut(/[\dA-Za-z]/),xm=Ut(/[#-'*+\--9=?A-Z^-~]/);function Ai(t){return t!==null&&(t<32||t===127)}const ki=Ut(/\d/),wm=Ut(/[\dA-Fa-f]/),Tm=Ut(/[!-/:-@[-`{-~]/);function de(t){return t!==null&&t<-2}function nt(t){return t!==null&&(t<0||t===32)}function Re(t){return t===-2||t===-1||t===32}const Am=Ut(new RegExp("\\p{P}|\\p{S}","u")),km=Ut(/\s/);function Ut(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function gn(t){const e=[];let n=-1,r=0,i=0;for(;++n55295&&o<57344){const s=t.charCodeAt(n+1);o<56320&&s>56319&&s<57344?(a=String.fromCharCode(o,s),i=1):a="�"}else a=String.fromCharCode(o);a&&(e.push(t.slice(r,n),encodeURIComponent(a)),r=n+i+1,a=""),i&&(n+=i,i=0)}return e.join("")+t.slice(r)}function Le(t,e,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return a;function a(l){return Re(l)?(t.enter(n),s(l)):e(l)}function s(l){return Re(l)&&o++a))return;const M=e.events.length;let x=M,b,v;for(;x--;)if(e.events[x][0]==="exit"&&e.events[x][1].type==="chunkFlow"){if(b){v=e.events[x][1].end;break}b=!0}for(y(r),m=M;mA;){const N=n[_];e.containerState=N[1],N[0].exit.call(e,t)}n.length=A}function E(){i.write([null]),o=void 0,i=void 0,e.containerState._closeFlow=void 0}}function Im(t,e,n){return Le(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function fa(t){if(t===null||nt(t)||km(t))return 1;if(Am(t))return 2}function Ji(t,e,n){const r=[];let i=-1;for(;++i1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const d={...t[r][1].end},p={...t[n][1].start};pa(d,-l),pa(p,l),a={type:l>1?"strongSequence":"emphasisSequence",start:d,end:{...t[r][1].end}},s={type:l>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:p},o={type:l>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...a.start},end:{...s.end}},t[r][1].end={...a.start},t[n][1].start={...s.end},u=[],t[r][1].end.offset-t[r][1].start.offset&&(u=ct(u,[["enter",t[r][1],e],["exit",t[r][1],e]])),u=ct(u,[["enter",i,e],["enter",a,e],["exit",a,e],["enter",o,e]]),u=ct(u,Ji(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),u=ct(u,[["exit",o,e],["enter",s,e],["exit",s,e],["exit",i,e]]),t[n][1].end.offset-t[n][1].start.offset?(c=2,u=ct(u,[["enter",t[n][1],e],["exit",t[n][1],e]])):c=0,yt(t,r-1,n-r+3,u),n=r+u.length-c-2;break}}for(n=-1;++n0&&Re(m)?Le(t,E,"linePrefix",o+1)(m):E(m)}function E(m){return m===null||de(m)?t.check(ha,w,_)(m):(t.enter("codeFlowValue"),A(m))}function A(m){return m===null||de(m)?(t.exit("codeFlowValue"),E(m)):(t.consume(m),A)}function _(m){return t.exit("codeFenced"),e(m)}function N(m,M,x){let b=0;return v;function v(D){return m.enter("lineEnding"),m.consume(D),m.exit("lineEnding"),k}function k(D){return m.enter("codeFencedFence"),Re(D)?Le(m,R,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):R(D)}function R(D){return D===s?(m.enter("codeFencedFenceSequence"),F(D)):x(D)}function F(D){return D===s?(b++,m.consume(D),F):b>=a?(m.exit("codeFencedFenceSequence"),Re(D)?Le(m,z,"whitespace")(D):z(D)):x(D)}function z(D){return D===null||de(D)?(m.exit("codeFencedFence"),M(D)):x(D)}}}function jm(t,e,n){const r=this;return i;function i(a){return a===null?n(a):(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),o)}function o(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}const Yr={name:"codeIndented",tokenize:Vm},$m={partial:!0,tokenize:Hm};function Vm(t,e,n){const r=this;return i;function i(u){return t.enter("codeIndented"),Le(t,o,"linePrefix",5)(u)}function o(u){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?a(u):n(u)}function a(u){return u===null?l(u):de(u)?t.attempt($m,a,l)(u):(t.enter("codeFlowValue"),s(u))}function s(u){return u===null||de(u)?(t.exit("codeFlowValue"),a(u)):(t.consume(u),s)}function l(u){return t.exit("codeIndented"),e(u)}}function Hm(t,e,n){const r=this;return i;function i(a){return r.parser.lazy[r.now().line]?n(a):de(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),i):Le(t,o,"linePrefix",5)(a)}function o(a){const s=r.events[r.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?e(a):de(a)?i(a):n(a)}}const Gm={name:"codeText",previous:qm,resolve:Km,tokenize:Wm};function Km(t){let e=t.length-4,n=3,r,i;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r=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-r+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-r+this.left.length).reverse()),i}splice(e,n,r){const i=n||0;this.setCursor(Math.trunc(e));const o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&wn(this.left,r),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),wn(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),wn(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):t.interrupt(r.parser.constructs.flow,n,e)(a)}}function dl(t,e,n,r,i,o,a,s,l){const u=l||Number.POSITIVE_INFINITY;let c=0;return d;function d(y){return y===60?(t.enter(r),t.enter(i),t.enter(o),t.consume(y),t.exit(o),p):y===null||y===32||y===41||Ai(y)?n(y):(t.enter(r),t.enter(a),t.enter(s),t.enter("chunkString",{contentType:"string"}),w(y))}function p(y){return y===62?(t.enter(o),t.consume(y),t.exit(o),t.exit(i),t.exit(r),e):(t.enter(s),t.enter("chunkString",{contentType:"string"}),f(y))}function f(y){return y===62?(t.exit("chunkString"),t.exit(s),p(y)):y===null||y===60||de(y)?n(y):(t.consume(y),y===92?h:f)}function h(y){return y===60||y===62||y===92?(t.consume(y),f):f(y)}function w(y){return!c&&(y===null||y===41||nt(y))?(t.exit("chunkString"),t.exit(s),t.exit(a),t.exit(r),e(y)):c999||f===null||f===91||f===93&&!l||f===94&&!s&&"_hiddenFootnoteSupport"in a.parser.constructs?n(f):f===93?(t.exit(o),t.enter(i),t.consume(f),t.exit(i),t.exit(r),e):de(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),c):(t.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===null||f===91||f===93||de(f)||s++>999?(t.exit("chunkString"),c(f)):(t.consume(f),l||(l=!Re(f)),f===92?p:d)}function p(f){return f===91||f===92||f===93?(t.consume(f),s++,d):d(f)}}function pl(t,e,n,r,i,o){let a;return s;function s(p){return p===34||p===39||p===40?(t.enter(r),t.enter(i),t.consume(p),t.exit(i),a=p===40?41:p,l):n(p)}function l(p){return p===a?(t.enter(i),t.consume(p),t.exit(i),t.exit(r),e):(t.enter(o),u(p))}function u(p){return p===a?(t.exit(o),l(a)):p===null?n(p):de(p)?(t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),Le(t,u,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),c(p))}function c(p){return p===a||p===null||de(p)?(t.exit("chunkString"),u(p)):(t.consume(p),p===92?d:c)}function d(p){return p===a||p===92?(t.consume(p),c):c(p)}}function _n(t,e){let n;return r;function r(i){return de(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):Re(i)?Le(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}const ng={name:"definition",tokenize:ig},rg={partial:!0,tokenize:og};function ig(t,e,n){const r=this;let i;return o;function o(f){return t.enter("definition"),a(f)}function a(f){return fl.call(r,t,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function s(f){return i=fn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),f===58?(t.enter("definitionMarker"),t.consume(f),t.exit("definitionMarker"),l):n(f)}function l(f){return nt(f)?_n(t,u)(f):u(f)}function u(f){return dl(t,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function c(f){return t.attempt(rg,d,d)(f)}function d(f){return Re(f)?Le(t,p,"whitespace")(f):p(f)}function p(f){return f===null||de(f)?(t.exit("definition"),r.parser.defined.push(i),e(f)):n(f)}}function og(t,e,n){return r;function r(s){return nt(s)?_n(t,i)(s):n(s)}function i(s){return pl(t,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function o(s){return Re(s)?Le(t,a,"whitespace")(s):a(s)}function a(s){return s===null||de(s)?e(s):n(s)}}const ag={name:"hardBreakEscape",tokenize:sg};function sg(t,e,n){return r;function r(o){return t.enter("hardBreakEscape"),t.consume(o),i}function i(o){return de(o)?(t.exit("hardBreakEscape"),e(o)):n(o)}}const lg={name:"headingAtx",resolve:ug,tokenize:cg};function ug(t,e){let n=t.length-2,r=3,i,o;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},o={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},yt(t,r,n-r+1,[["enter",i,e],["enter",o,e],["exit",o,e],["exit",i,e]])),t}function cg(t,e,n){let r=0;return i;function i(c){return t.enter("atxHeading"),o(c)}function o(c){return t.enter("atxHeadingSequence"),a(c)}function a(c){return c===35&&r++<6?(t.consume(c),a):c===null||nt(c)?(t.exit("atxHeadingSequence"),s(c)):n(c)}function s(c){return c===35?(t.enter("atxHeadingSequence"),l(c)):c===null||de(c)?(t.exit("atxHeading"),e(c)):Re(c)?Le(t,s,"whitespace")(c):(t.enter("atxHeadingText"),u(c))}function l(c){return c===35?(t.consume(c),l):(t.exit("atxHeadingSequence"),s(c))}function u(c){return c===null||c===35||nt(c)?(t.exit("atxHeadingText"),s(c)):(t.consume(c),u)}}const dg=["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"],ga=["pre","script","style","textarea"],fg={concrete:!0,name:"htmlFlow",resolveTo:mg,tokenize:gg},pg={partial:!0,tokenize:yg},hg={partial:!0,tokenize:vg};function mg(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function gg(t,e,n){const r=this;let i,o,a,s,l;return u;function u(C){return c(C)}function c(C){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(C),d}function d(C){return C===33?(t.consume(C),p):C===47?(t.consume(C),o=!0,w):C===63?(t.consume(C),i=3,r.interrupt?e:S):mt(C)?(t.consume(C),a=String.fromCharCode(C),g):n(C)}function p(C){return C===45?(t.consume(C),i=2,f):C===91?(t.consume(C),i=5,s=0,h):mt(C)?(t.consume(C),i=4,r.interrupt?e:S):n(C)}function f(C){return C===45?(t.consume(C),r.interrupt?e:S):n(C)}function h(C){const ye="CDATA[";return C===ye.charCodeAt(s++)?(t.consume(C),s===ye.length?r.interrupt?e:R:h):n(C)}function w(C){return mt(C)?(t.consume(C),a=String.fromCharCode(C),g):n(C)}function g(C){if(C===null||C===47||C===62||nt(C)){const ye=C===47,Ie=a.toLowerCase();return!ye&&!o&&ga.includes(Ie)?(i=1,r.interrupt?e(C):R(C)):dg.includes(a.toLowerCase())?(i=6,ye?(t.consume(C),y):r.interrupt?e(C):R(C)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(C):o?E(C):A(C))}return C===45||st(C)?(t.consume(C),a+=String.fromCharCode(C),g):n(C)}function y(C){return C===62?(t.consume(C),r.interrupt?e:R):n(C)}function E(C){return Re(C)?(t.consume(C),E):v(C)}function A(C){return C===47?(t.consume(C),v):C===58||C===95||mt(C)?(t.consume(C),_):Re(C)?(t.consume(C),A):v(C)}function _(C){return C===45||C===46||C===58||C===95||st(C)?(t.consume(C),_):N(C)}function N(C){return C===61?(t.consume(C),m):Re(C)?(t.consume(C),N):A(C)}function m(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(t.consume(C),l=C,M):Re(C)?(t.consume(C),m):x(C)}function M(C){return C===l?(t.consume(C),l=null,b):C===null||de(C)?n(C):(t.consume(C),M)}function x(C){return C===null||C===34||C===39||C===47||C===60||C===61||C===62||C===96||nt(C)?N(C):(t.consume(C),x)}function b(C){return C===47||C===62||Re(C)?A(C):n(C)}function v(C){return C===62?(t.consume(C),k):n(C)}function k(C){return C===null||de(C)?R(C):Re(C)?(t.consume(C),k):n(C)}function R(C){return C===45&&i===2?(t.consume(C),V):C===60&&i===1?(t.consume(C),re):C===62&&i===4?(t.consume(C),xe):C===63&&i===3?(t.consume(C),S):C===93&&i===5?(t.consume(C),se):de(C)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(pg,Ue,F)(C)):C===null||de(C)?(t.exit("htmlFlowData"),F(C)):(t.consume(C),R)}function F(C){return t.check(hg,z,Ue)(C)}function z(C){return t.enter("lineEnding"),t.consume(C),t.exit("lineEnding"),D}function D(C){return C===null||de(C)?F(C):(t.enter("htmlFlowData"),R(C))}function V(C){return C===45?(t.consume(C),S):R(C)}function re(C){return C===47?(t.consume(C),a="",ee):R(C)}function ee(C){if(C===62){const ye=a.toLowerCase();return ga.includes(ye)?(t.consume(C),xe):R(C)}return mt(C)&&a.length<8?(t.consume(C),a+=String.fromCharCode(C),ee):R(C)}function se(C){return C===93?(t.consume(C),S):R(C)}function S(C){return C===62?(t.consume(C),xe):C===45&&i===2?(t.consume(C),S):R(C)}function xe(C){return C===null||de(C)?(t.exit("htmlFlowData"),Ue(C)):(t.consume(C),xe)}function Ue(C){return t.exit("htmlFlow"),e(C)}}function vg(t,e,n){const r=this;return i;function i(a){return de(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),o):n(a)}function o(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}function yg(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(wr,e,n)}}const bg={name:"htmlText",tokenize:xg};function xg(t,e,n){const r=this;let i,o,a;return s;function s(S){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(S),l}function l(S){return S===33?(t.consume(S),u):S===47?(t.consume(S),N):S===63?(t.consume(S),A):mt(S)?(t.consume(S),x):n(S)}function u(S){return S===45?(t.consume(S),c):S===91?(t.consume(S),o=0,h):mt(S)?(t.consume(S),E):n(S)}function c(S){return S===45?(t.consume(S),f):n(S)}function d(S){return S===null?n(S):S===45?(t.consume(S),p):de(S)?(a=d,re(S)):(t.consume(S),d)}function p(S){return S===45?(t.consume(S),f):d(S)}function f(S){return S===62?V(S):S===45?p(S):d(S)}function h(S){const xe="CDATA[";return S===xe.charCodeAt(o++)?(t.consume(S),o===xe.length?w:h):n(S)}function w(S){return S===null?n(S):S===93?(t.consume(S),g):de(S)?(a=w,re(S)):(t.consume(S),w)}function g(S){return S===93?(t.consume(S),y):w(S)}function y(S){return S===62?V(S):S===93?(t.consume(S),y):w(S)}function E(S){return S===null||S===62?V(S):de(S)?(a=E,re(S)):(t.consume(S),E)}function A(S){return S===null?n(S):S===63?(t.consume(S),_):de(S)?(a=A,re(S)):(t.consume(S),A)}function _(S){return S===62?V(S):A(S)}function N(S){return mt(S)?(t.consume(S),m):n(S)}function m(S){return S===45||st(S)?(t.consume(S),m):M(S)}function M(S){return de(S)?(a=M,re(S)):Re(S)?(t.consume(S),M):V(S)}function x(S){return S===45||st(S)?(t.consume(S),x):S===47||S===62||nt(S)?b(S):n(S)}function b(S){return S===47?(t.consume(S),V):S===58||S===95||mt(S)?(t.consume(S),v):de(S)?(a=b,re(S)):Re(S)?(t.consume(S),b):V(S)}function v(S){return S===45||S===46||S===58||S===95||st(S)?(t.consume(S),v):k(S)}function k(S){return S===61?(t.consume(S),R):de(S)?(a=k,re(S)):Re(S)?(t.consume(S),k):b(S)}function R(S){return S===null||S===60||S===61||S===62||S===96?n(S):S===34||S===39?(t.consume(S),i=S,F):de(S)?(a=R,re(S)):Re(S)?(t.consume(S),R):(t.consume(S),z)}function F(S){return S===i?(t.consume(S),i=void 0,D):S===null?n(S):de(S)?(a=F,re(S)):(t.consume(S),F)}function z(S){return S===null||S===34||S===39||S===60||S===61||S===96?n(S):S===47||S===62||nt(S)?b(S):(t.consume(S),z)}function D(S){return S===47||S===62||nt(S)?b(S):n(S)}function V(S){return S===62?(t.consume(S),t.exit("htmlTextData"),t.exit("htmlText"),e):n(S)}function re(S){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(S),t.exit("lineEnding"),ee}function ee(S){return Re(S)?Le(t,se,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(S):se(S)}function se(S){return t.enter("htmlTextData"),a(S)}}const eo={name:"labelEnd",resolveAll:kg,resolveTo:Eg,tokenize:_g},wg={tokenize:Mg},Tg={tokenize:Sg},Ag={tokenize:Ig};function kg(t){let e=-1;const n=[];for(;++e=3&&(u===null||de(u))?(t.exit("thematicBreak"),e(u)):n(u)}function l(u){return u===i?(t.consume(u),r++,l):(t.exit("thematicBreakSequence"),Re(u)?Le(t,s,"whitespace")(u):s(u))}}const tt={continuation:{tokenize:zg},exit:jg,name:"list",tokenize:Fg},Dg={partial:!0,tokenize:$g},Bg={partial:!0,tokenize:Ug};function Fg(t,e,n){const r=this,i=r.events[r.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 h=r.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(h==="listUnordered"?!r.containerState.marker||f===r.containerState.marker:ki(f)){if(r.containerState.type||(r.containerState.type=h,t.enter(h,{_container:!0})),h==="listUnordered")return t.enter("listItemPrefix"),f===42||f===45?t.check(ar,n,u)(f):u(f);if(!r.interrupt||f===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(f)}return n(f)}function l(f){return ki(f)&&++a<10?(t.consume(f),l):(!r.interrupt||a<2)&&(r.containerState.marker?f===r.containerState.marker:f===41||f===46)?(t.exit("listItemValue"),u(f)):n(f)}function u(f){return t.enter("listItemMarker"),t.consume(f),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||f,t.check(wr,r.interrupt?n:c,t.attempt(Dg,p,d))}function c(f){return r.containerState.initialBlankLine=!0,o++,p(f)}function d(f){return Re(f)?(t.enter("listItemPrefixWhitespace"),t.consume(f),t.exit("listItemPrefixWhitespace"),p):n(f)}function p(f){return r.containerState.size=o+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(f)}}function zg(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(wr,i,o);function i(s){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Le(t,e,"listItemIndent",r.containerState.size+1)(s)}function o(s){return r.containerState.furtherBlankLines||!Re(s)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(s)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(Bg,e,a)(s))}function a(s){return r.containerState._closeFlow=!0,r.interrupt=void 0,Le(t,t.attempt(tt,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function Ug(t,e,n){const r=this;return Le(t,i,"listItemIndent",r.containerState.size+1);function i(o){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?e(o):n(o)}}function jg(t){t.exit(this.containerState.type)}function $g(t,e,n){const r=this;return Le(t,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const a=r.events[r.events.length-1];return!Re(o)&&a&&a[1].type==="listItemPrefixWhitespace"?e(o):n(o)}}const va={name:"setextUnderline",resolveTo:Vg,tokenize:Hg};function Vg(t,e){let n=t.length,r,i,o;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(i=n)}else t[n][1].type==="content"&&t.splice(n,1),!o&&t[n][1].type==="definition"&&(o=n);const a={type:"setextHeading",start:{...t[i][1].start},end:{...t[t.length-1][1].end}};return t[i][1].type="setextHeadingText",o?(t.splice(i,0,["enter",a,e]),t.splice(o+1,0,["exit",t[r][1],e]),t[r][1].end={...t[o][1].end}):t[r][1]=a,t.push(["exit",a,e]),t}function Hg(t,e,n){const r=this;let i;return o;function o(u){let c=r.events.length,d;for(;c--;)if(r.events[c][1].type!=="lineEnding"&&r.events[c][1].type!=="linePrefix"&&r.events[c][1].type!=="content"){d=r.events[c][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(t.enter("setextHeadingLine"),i=u,a(u)):n(u)}function a(u){return t.enter("setextHeadingLineSequence"),s(u)}function s(u){return u===i?(t.consume(u),s):(t.exit("setextHeadingLineSequence"),Re(u)?Le(t,l,"lineSuffix")(u):l(u))}function l(u){return u===null||de(u)?(t.exit("setextHeadingLine"),e(u)):n(u)}}const Gg={tokenize:Kg};function Kg(t){const e=this,n=t.attempt(wr,r,t.attempt(this.parser.constructs.flowInitial,i,Le(t,t.attempt(this.parser.constructs.flow,i,t.attempt(Qm,i)),"linePrefix")));return n;function r(o){if(o===null){t.consume(o);return}return t.enter("lineEndingBlank"),t.consume(o),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function i(o){if(o===null){t.consume(o);return}return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const qg={resolveAll:ml()},Wg=hl("string"),Yg=hl("text");function hl(t){return{resolveAll:ml(t==="text"?Xg:void 0),tokenize:e};function e(n){const r=this,i=this.parser.constructs[t],o=n.attempt(i,a,s);return a;function a(c){return u(c)?o(c):s(c)}function s(c){if(c===null){n.consume(c);return}return n.enter("data"),n.consume(c),l}function l(c){return u(c)?(n.exit("data"),o(c)):(n.consume(c),l)}function u(c){if(c===null)return!0;const d=i[c];let p=-1;if(d)for(;++p-1){const s=a[0];typeof s=="string"?a[0]=s.slice(r):a.shift()}o>0&&a.push(t[i].slice(0,o))}return a}function uv(t,e){let n=-1;const r=[];let i;for(;++n0){const je=te.tokenStack[te.tokenStack.length-1];(je[1]||wa).call(te,void 0,je[0])}for(X.position={start:Ot($.length>0?$[0][1].start:{line:1,column:1,offset:0}),end:Ot($.length>0?$[$.length-2][1].end:{line:1,column:1,offset:0})},Ae=-1;++Ae1?"-"+s:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};t.patch(e,l);const u={type:"element",tagName:"sup",properties:{},children:[l]};return t.patch(e,u),t.applyData(e,u)}function _v(t,e){const n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Mv(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function yl(t,e){const n=e.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+r}];const i=t.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+=r:i.push({type:"text",value:r}),i}function Sv(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return yl(t,e);const i={src:gn(r.url||""),alt:e.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"img",properties:i,children:[]};return t.patch(e,o),t.applyData(e,o)}function Iv(t,e){const n={src:gn(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,r),t.applyData(e,r)}function Rv(t,e){const n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,r),t.applyData(e,r)}function Cv(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return yl(t,e);const i={href:gn(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"a",properties:i,children:t.all(e)};return t.patch(e,o),t.applyData(e,o)}function Nv(t,e){const n={href:gn(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function Ov(t,e,n){const r=t.all(e),i=n?Pv(n):bl(e),o={},a=[];if(typeof e.checked=="boolean"){const c=r[0];let d;c&&c.type==="element"&&c.tagName==="p"?d=c:(d={type:"element",tagName:"p",properties:{},children:[]},r.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.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 Lv(t,e){const n={},r=t.all(e);let i=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++i0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function zv(t){const e=wl(t),n=xl(t);if(e&&n)return{start:e,end:n}}function Uv(t,e){const n=t.all(e),r=n.shift(),i=[];if(r){const a={type:"element",tagName:"thead",properties:{},children:t.wrap([r],!0)};t.patch(e.children[0],a),i.push(a)}if(n.length>0){const a={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},s=wl(e.children[1]),l=xl(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:t.wrap(i,!0)};return t.patch(e,o),t.applyData(e,o)}function jv(t,e,n){const r=n?n.children:void 0,o=(r?r.indexOf(e):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,s=a?a.length:e.children.length;let l=-1;const u=[];for(;++l0,!0),r[0]),i=r.index+r[0].length,r=n.exec(e);return o.push(ka(e.slice(i),i>0,!1)),o.join("")}function ka(t,e,n){let r=0,i=t.length;if(e){let o=t.codePointAt(r);for(;o===Ta||o===Aa;)r++,o=t.codePointAt(r)}if(n){let o=t.codePointAt(i-1);for(;o===Ta||o===Aa;)i--,o=t.codePointAt(i-1)}return i>r?t.slice(r,i):""}function Hv(t,e){const n={type:"text",value:Vv(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function Gv(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const Kv={blockquote:xv,break:wv,code:Tv,delete:Av,emphasis:kv,footnoteReference:Ev,heading:_v,html:Mv,imageReference:Sv,image:Iv,inlineCode:Rv,linkReference:Cv,link:Nv,listItem:Ov,list:Lv,paragraph:Dv,root:Bv,strong:Fv,table:Uv,tableCell:$v,tableRow:jv,text:Hv,thematicBreak:Gv,toml:Kn,yaml:Kn,definition:Kn,footnoteDefinition:Kn};function Kn(){}const Al=-1,Tr=0,fr=1,pr=2,to=3,no=4,ro=5,io=6,kl=7,El=8,Ea=typeof self=="object"?self:globalThis,qv=(t,e)=>{const n=(i,o)=>(t.set(o,i),i),r=i=>{if(t.has(i))return t.get(i);const[o,a]=e[i];switch(o){case Tr:case Al:return n(a,i);case fr:{const s=n([],i);for(const l of a)s.push(r(l));return s}case pr:{const s=n({},i);for(const[l,u]of a)s[r(l)]=r(u);return s}case to:return n(new Date(a),i);case no:{const{source:s,flags:l}=a;return n(new RegExp(s,l),i)}case ro:{const s=n(new Map,i);for(const[l,u]of a)s.set(r(l),r(u));return s}case io:{const s=n(new Set,i);for(const l of a)s.add(r(l));return s}case kl:{const{name:s,message:l}=a;return n(new Ea[s](l),i)}case El:return n(BigInt(a),i);case"BigInt":return n(Object(BigInt(a)),i)}return n(new Ea[o](a),i)};return r},_a=t=>qv(new Map,t)(0),rn="",{toString:Wv}={},{keys:Yv}=Object,Tn=t=>{const e=typeof t;if(e!=="object"||!t)return[Tr,e];const n=Wv.call(t).slice(8,-1);switch(n){case"Array":return[fr,rn];case"Object":return[pr,rn];case"Date":return[to,rn];case"RegExp":return[no,rn];case"Map":return[ro,rn];case"Set":return[io,rn]}return n.includes("Array")?[fr,n]:n.includes("Error")?[kl,n]:[pr,n]},qn=([t,e])=>t===Tr&&(e==="function"||e==="symbol"),Xv=(t,e,n,r)=>{const i=(a,s)=>{const l=r.push(a)-1;return n.set(s,l),l},o=a=>{if(n.has(a))return n.get(a);let[s,l]=Tn(a);switch(s){case Tr:{let c=a;switch(l){case"bigint":s=El,c=a.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);c=null;break;case"undefined":return i([Al],a)}return i([s,c],a)}case fr:{if(l)return i([l,[...a]],a);const c=[],d=i([s,c],a);for(const p of a)c.push(o(p));return d}case pr:{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=[],d=i([s,c],a);for(const p of Yv(a))(t||!qn(Tn(a[p])))&&c.push([o(p),o(a[p])]);return d}case to:return i([s,a.toISOString()],a);case no:{const{source:c,flags:d}=a;return i([s,{source:c,flags:d}],a)}case ro:{const c=[],d=i([s,c],a);for(const[p,f]of a)(t||!(qn(Tn(p))||qn(Tn(f))))&&c.push([o(p),o(f)]);return d}case io:{const c=[],d=i([s,c],a);for(const p of a)(t||!qn(Tn(p)))&&c.push(o(p));return d}}const{message:u}=a;return i([s,{name:l,message:u}],a)};return o},Ma=(t,{json:e,lossy:n}={})=>{const r=[];return Xv(!(e||n),!!e,new Map,r)(t),r},hr=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?_a(Ma(t,e)):structuredClone(t):(t,e)=>_a(Ma(t,e));function Qv(t,e){const n=[{type:"text",value:"↩"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function Zv(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function Jv(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||Qv,r=t.options.footnoteBackLabel||Zv,i=t.options.footnoteLabel||"Footnotes",o=t.options.footnoteLabelTagName||"h2",a=t.options.footnoteLabelProperties||{className:["sr-only"]},s=[];let l=-1;for(;++l0&&h.push({type:"text",value:" "});let E=typeof n=="string"?n:n(l,f);typeof E=="string"&&(E={type:"text",value:E}),h.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+p+(f>1?"-"+f:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,f),className:["data-footnote-backref"]},children:Array.isArray(E)?E:[E]})}const g=c[c.length-1];if(g&&g.type==="element"&&g.tagName==="p"){const E=g.children[g.children.length-1];E&&E.type==="text"?E.value+=" ":g.children.push({type:"text",value:" "}),g.children.push(...h)}else c.push(...h);const y={type:"element",tagName:"li",properties:{id:e+"fn-"+p},children:t.wrap(c,!0)};t.patch(u,y),s.push(y)}if(s.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...hr(a),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:` +`},{type:"element",tagName:"ol",properties:{},children:t.wrap(s,!0)},{type:"text",value:` +`}]}}const _l=function(t){if(t==null)return ry;if(typeof t=="function")return Ar(t);if(typeof t=="object")return Array.isArray(t)?ey(t):ty(t);if(typeof t=="string")return ny(t);throw new Error("Expected function, string, or object as test")};function ey(t){const e=[];let n=-1;for(;++n":""))+")"})}return p;function p(){let f=Ml,h,w,g;if((!e||o(l,u,c[c.length-1]||void 0))&&(f=ly(n(l,c)),f[0]===Sa))return f;if("children"in l&&l.children){const y=l;if(y.children&&f[0]!==ay)for(w=(r?y.children.length:-1)+a,g=c.concat(y);w>-1&&w0&&n.push({type:"text",value:` +`}),n}function Ia(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function Ra(t,e){const n=dy(t,e),r=n.one(t,void 0),i=Jv(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&o.children.push({type:"text",value:` +`},i),o}function gy(t,e){return t&&"run"in t?async function(n,r){const i=Ra(n,{file:r,...e});await t.run(i,r)}:function(n,r){return Ra(n,{file:r,...t||e})}}function Ca(t){if(t)throw t}var Qr,Na;function vy(){if(Na)return Qr;Na=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,r=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=t.call(u,"constructor"),d=u.constructor&&u.constructor.prototype&&t.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!c&&!d)return!1;var p;for(p in u);return typeof p>"u"||t.call(u,p)},a=function(u,c){n&&c.name==="__proto__"?n(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(t.call(u,c)){if(r)return r(u,c).value}else return;return u[c]};return Qr=function l(){var u,c,d,p,f,h,w=arguments[0],g=1,y=arguments.length,E=!1;for(typeof w=="boolean"&&(E=w,w=arguments[1]||{},g=2),(w==null||typeof w!="object"&&typeof w!="function")&&(w={});ga.length;let l;s&&a.push(i);try{l=t.apply(this,a)}catch(u){const c=u;if(s&&n)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){n||(n=!0,e(a,...s))}function o(a){i(null,a)}}class rt extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",o={},a=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof e=="string"?i=e:!o.cause&&e&&(a=!0,i=e.message,o.cause=e),!o.ruleId&&!o.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?o.ruleId=r:(o.source=r.slice(0,l),o.ruleId=r.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=Mn(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}}rt.prototype.file="";rt.prototype.name="";rt.prototype.reason="";rt.prototype.message="";rt.prototype.stack="";rt.prototype.column=void 0;rt.prototype.line=void 0;rt.prototype.ancestors=void 0;rt.prototype.cause=void 0;rt.prototype.fatal=void 0;rt.prototype.place=void 0;rt.prototype.ruleId=void 0;rt.prototype.source=void 0;const ht={basename:wy,dirname:Ty,extname:Ay,join:ky,sep:"/"};function wy(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Bn(t);let n=0,r=-1,i=t.length,o;if(e===void 0||e.length===0||e.length>t.length){for(;i--;)if(t.codePointAt(i)===47){if(o){n=i+1;break}}else r<0&&(o=!0,r=i+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let a=-1,s=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(o){n=i+1;break}}else a<0&&(o=!0,a=i+1),s>-1&&(t.codePointAt(i)===e.codePointAt(s--)?s<0&&(r=i):(s=-1,r=a));return n===r?r=a:r<0&&(r=t.length),t.slice(n,r)}function Ty(t){if(Bn(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function Ay(t){Bn(t);let e=t.length,n=-1,r=0,i=-1,o=0,a;for(;e--;){const s=t.codePointAt(e);if(s===47){if(a){r=e+1;break}continue}n<0&&(a=!0,n=e+1),s===46?i<0?i=e:o!==1&&(o=1):i>-1&&(o=-1)}return i<0||n<0||o===0||o===1&&i===n-1&&i===r+1?"":t.slice(i,n)}function ky(...t){let e=-1,n;for(;++e0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function _y(t,e){let n="",r=0,i=-1,o=0,a=-1,s,l;for(;++a<=t.length;){if(a2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),i=a,o=0;continue}}else if(n.length>0){n="",r=0,i=a,o=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(i+1,a):n=t.slice(i+1,a),r=a-i-1;i=a,o=0}else s===46&&o>-1?o++:o=-1}return n}function Bn(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const My={cwd:Sy};function Sy(){return"/"}function Ii(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function Iy(t){if(typeof t=="string")t=new URL(t);else if(!Ii(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return Ry(t)}function Ry(t){if(t.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=t.pathname;let n=-1;for(;++n0){let[f,...h]=c;const w=r[p][1];Si(w)&&Si(f)&&(f=Zr(!0,w,f)),r[p]=[u,f,...h]}}}}const Ly=new oo().freeze();function ni(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function ri(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function ii(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Pa(t){if(!Si(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function La(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Wn(t){return Dy(t)?t:new Cy(t)}function Dy(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function By(t){return typeof t=="string"||Fy(t)}function Fy(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}function Sl(){const t=Ly().use(bv).use(gy).use(pm);return{process:e=>t.processSync(e).toString()}}function zy(t,e){return{role:"system",content:[t,gu.map(n=>`- ${n}`).join(` +`),e].join(` + +`)}}function Uy(t){const e=new Uint8Array(t.frequencyBinCount);t.getByteFrequencyData(e);const n=[];for(let i=0;i<700;i+=80)n.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 jy(t){const e=new Uint8Array(t.frequencyBinCount);t.getByteFrequencyData(e);const n=[];for(let u=0;u<700;u+=80)n.push(e[u]);const r=e.map(u=>u**1.5),i=Math.min(...r),a=Math.max(...r)-i;let s;return a===0?s=r.map(()=>0):s=r.map(u=>(u-i)/a),s.reduce((u,c)=>u+c,0)/e.length}function $y(t,e="linear"){switch(e){case"linear":return Uy(t);case"minmax":return jy(t)}}const Il=vr("AudioContext",()=>({audioContext:new AudioContext,calculateVolume:$y})),Vy=vr("SpeakingStore",()=>{const n=j(0),r=j(!1),i=Me(()=>r.value?(30+70*n.value)/100:30);return{mouthOpenSize:n,nowSpeaking:r,nowSpeakingAvatarBorderOpacity:i}});function Yn(t,e,n){return e+n<0||e+n>=t.length-1?"":t[e+n]}function Hy(t){let e="literal",n="";return{async consume(r){var i,o,a;for(let s=0;s"?(l+=Yn(r,s,1),u="literal",s++):l==="<"?u="special":l===">"&&(u="literal"),e==="literal"&&u==="special"?n!==""&&(await((i=t.onLiteral)==null?void 0:i.call(t,n)),n=""):e==="special"&&u==="literal"&&n!==""&&(n+=l,await((o=t.onSpecial)==null?void 0:o.call(t,n)),n=""),e==="literal"&&u==="literal"?(await((a=t.onLiteral)==null?void 0:a.call(t,l)),n=""):e==="special"&&u==="literal"?n="":n+=l,e=u}},async end(){var r,i;n!==""&&(e==="literal"?await((r=t.onLiteral)==null?void 0:r.call(t,n)):n.endsWith("|>")&&await((i=t.onSpecial)==null?void 0:i.call(t,n)))}}}const Gy=async t=>(t.fetch??globalThis.fetch)(qi("models",t.baseURL),{headers:Ki({"Content-Type":"application/json",...t.headers},t.apiKey),signal:t.abortSignal}).then(Kp).then(({data:e})=>e),Ky=async t=>{var e;return(t.fetch??globalThis.fetch)(qi("chat/completions",t.baseURL),{body:Vs({...t,tools:(e=t.tools)==null?void 0:e.map(n=>({function:n.function,type:"function"}))}),headers:Ki({"Content-Type":"application/json",...t.headers},t.apiKey),method:"POST",signal:t.abortSignal}).then(Wi)},Da="data:",qy=async t=>Ky({...t,stream:!0}).then(async e=>{const n=new TextDecoder;let r,i;const o=async(d,p)=>{if(!d||!d.startsWith(Da))return;const f=d.slice(Da.length),h=f.startsWith(" ")?f.slice(1):f;if(h==="[DONE]")return p.terminate(),!0;if(h.startsWith("{")&&h.includes('"error":'))return p.error(new Error(`Error from server: ${h}`)),!0;const w=JSON.parse(h);p.enqueue(w),t.onChunk&&await t.onChunk(w),w.choices[0].finish_reason!==void 0&&(r=w.choices[0].finish_reason),w.usage!==void 0&&(i=w.usage)};let a="";const s=e.body.pipeThrough(new TransformStream({transform:async(d,p)=>{const f=n.decode(d,{stream:!0});a+=f;const h=a.split(` +`);a=h.pop()??"";for(const w of h)if(await o(w,p))break}})),[l,u]=s.tee(),c=u.pipeThrough(new TransformStream({transform:(d,p)=>p.enqueue(d.choices[0].delta.content)}));return{chunkStream:l,finishReason:r,textStream:c,usage:i}}),Rl=vr("llm",()=>{async function t(n,r,i,o){return await qy({baseURL:n.endsWith("/")?n:`${n}/`,apiKey:r,model:i,messages:o,streamOptions:{usage:!0}})}async function e(n,r){if(n==="")return[];try{return await Gy({baseURL:n.endsWith("/")?n:`${n}/`,apiKey:r})}catch(i){if(String(i).includes("Failed to construct 'URL': Invalid URL"))return[];throw i}}return{models:e,stream:t}}),Rn=vr("chat",()=>{const{stream:t}=Rl(),{t:e}=Nn(),{openAiApiBaseURL:n,openAiApiKey:r,openAiModel:i}=Wt(On()),o=j([]),a=j([]),s=j([]),l=j([]),u=j([]),c=j([]),d=j([]);function p(m){o.value.push(m)}function f(m){a.value.push(m)}function h(m){s.value.push(m)}function w(m){l.value.push(m)}function g(m){u.value.push(m)}function y(m){c.value.push(m)}function E(m){d.value.push(m)}const A=j([zy(e("prompt.prefix"),e("prompt.suffix"))]),_=j({role:"assistant",content:""});async function N(m,M){if(!m)return;for(const D of o.value)await D(m);const{baseUrl:x=n.value,apiKey:b=r.value,model:v=i.value}=M??{};_.value={role:"assistant",content:""},A.value.push({role:"user",content:m}),A.value.push(_.value);const k=A.value.slice(0,A.value.length-1);for(const D of a.value)await D(m);for(const D of s.value)await D(m);const R=await t(x,b,v.id,k);for(const D of l.value)await D(m);let F="";const z=Hy({onLiteral:async D=>{for(const V of u.value)await V(D);_.value.content+=D},onSpecial:async D=>{for(const V of c.value)await V(D)}});for await(const D of Bc(R.textStream,async V=>V))F+=D,await z.consume(D);await z.end();for(const D of d.value)await D();console.debug("LLM output:",F)}return{messages:A,streamingMessage:_,send:N,onBeforeMessageComposed:p,onAfterMessageComposed:f,onBeforeSend:h,onAfterSend:w,onTokenLiteral:g,onTokenSpecial:y,onStreamEnd:E}}),Wy={relative:""},Yy={"h-full":"","w-full":""},Xy={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"},Qy={bg:"pink-50","rounded-xl":"","px-10":"","py-6":""},Zy=["innerHTML"],Jy=be({__name:"Stage",setup(t){const e=j(),n=j(),{stageView:r,elevenLabsApiKey:i,elevenlabsVoiceEnglish:o,elevenlabsVoiceJapanese:a}=Wt(On()),{mouthOpenSize:s}=Wt(Vy()),{audioContext:l,calculateVolume:u}=Il(),{onBeforeMessageComposed:c,onBeforeSend:d,onTokenLiteral:p,onTokenSpecial:f,onStreamEnd:h,streamingMessage:w}=Rn(),{process:g}=Sl(),{locale:y}=Nn(),E=j(),A=j(!1),_=j(!1),N=Cr({handlers:[z=>new Promise(D=>{const V=l.createBufferSource();V.buffer=z.data.audioBuffer,V.connect(l.destination),V.connect(E.value),A.value=!0,V.start(0),V.onended=()=>{A.value=!1,D()}})]}),m=Cr({handlers:[async z=>{let D=gc.Camilla_KM;y.value==="jp"||y.value==="jp-JP"?D=a.value:D=o.value;const V=Date.now(),re=Yp({apiKey:i.value,baseURL:"https://unspeech.hyp3r.link/v1/"}),ee=await qp({...re.speech("eleven_multilingual_v2",{voiceSettings:{stability:.4,similarityBoost:.5}}),input:z.data,voice:vc[D]}),se=Date.now()-V;console.debug("TTS took",se,"ms");const S=await l.decodeAudioData(ee);await N.add({audioBuffer:S,text:z.data})}]});m.on("add",z=>{console.debug("ttsQueue added",z)});const M=vu(m),x=Cr({handlers:[async z=>{if(r.value==="3d"){const D=wu[z.data];if(!D)return;await n.value.setExpression(D)}else r.value==="2d"&&await e.value.setMotion(Tu[z.data])}]}),b=yu(x);b.onHandlerEvent("emotion",z=>{console.debug("emotion detected",z)});const v=bu();v.onHandlerEvent("delay",z=>{console.debug("delay detected",z)});function k(){requestAnimationFrame(k),A.value&&(s.value=u(E.value,"linear"))}function R(){_.value||(k(),l.resume(),_.value=!0)}function F(){E.value||(E.value=l.createAnalyser())}return c(async()=>{F(),R()}),d(async()=>{var z;(z=e.value)==null||z.setMotion(Ka)}),p(async z=>{await M.add(z)}),f(async z=>{await v.add(z),await b.add(z)}),h(async()=>{await v.add(xu)}),lt(()=>{_.value=!1}),(z,D)=>(Q(),ue("div",Wy,[B("div",Yy,[L(r)==="2d"?(Q(),Fe(qc,{key:0,ref_key:"live2DViewerRef",ref:e,"mouth-open-size":L(s),model:"./assets/live2d/models/hiyori_pro_zh.zip","min-w":"50% =s.value&&(w.value+=s.value),r.value&&(r.value.style.transform=`translateX(${w.value}px)`),f=requestAnimationFrame(g)}return Se(()=>[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}),yc("resize",p),dt(()=>{p(),g()}),lt(()=>{cancelAnimationFrame(f)}),(y,E)=>(Q(),ue("div",o0,[ze(y.$slots,"default"),B("div",{ref_key:"container",ref:n,absolute:"","left-0":"","right-0":"","top-0":"","w-full":"","overflow-hidden":""},[c.value==="down"?(Q(),ue("div",{key:0,style:pn({backgroundColor:u.value,height:`${o.value}px`}),"w-full":""},null,4)):Ye("",!0),(Q(),ue("svg",{ref_key:"svg",ref:r,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"}},[B("path",{d:l.value,fill:u.value},null,8,s0)],8,a0)),c.value==="up"?(Q(),ue("div",{key:1,style:pn({backgroundColor:u.value,height:`${o.value}px`}),"w-full":""},null,4)):Ye("",!0)],512)]))}});function ao(t,e){const n=typeof t=="string"&&!e?`${t}Context`:e,r=Symbol(n);return[i=>{const o=wc(r,i);if(o||o===null)return o;throw new Error(`Injection \`${r.toString()}\` not found. Component must be used within ${Array.isArray(t)?`one of the following components: ${t.join(", ")}`:`\`${t}\``}`)},i=>(Mc(r,i),i)]}function Cl(t,e,n){const r=n.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&r.addEventListener(t,e,{once:!0}),r.dispatchEvent(i)}function Nl(t){return is()?(os(t),!0):!1}function u0(t){let e=!1,n;const r=ms(!0);return(...i)=>(e||(n=r.run(()=>t(...i)),e=!0),n)}function c0(t){let e=0,n,r;const i=()=>{e-=1,r&&e<=0&&(r.stop(),n=void 0,r=void 0)};return(...o)=>(e+=1,n||(r=ms(!0),n=r.run(()=>t(...o))),Nl(i),n)}function so(t){return typeof t=="function"?t():L(t)}const Qt=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const d0=t=>typeof t<"u",f0=Object.prototype.toString,p0=t=>f0.call(t)==="[object Object]",h0=()=>{},Ba=m0();function m0(){var t,e;return Qt&&((t=window==null?void 0:window.navigator)==null?void 0:t.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 g0(t){return Yt()}function v0(t,e){g0()&&gs(t,e)}function kr(t){var e;const n=so(t);return(e=n==null?void 0:n.$el)!=null?e:n}const lo=Qt?window:void 0;function Ol(...t){let e,n,r,i;if(typeof t[0]=="string"||Array.isArray(t[0])?([n,r,i]=t,e=lo):[e,n,r,i]=t,!e)return h0;Array.isArray(n)||(n=[n]),Array.isArray(r)||(r=[r]);const o=[],a=()=>{o.forEach(c=>c()),o.length=0},s=(c,d,p,f)=>(c.addEventListener(d,p,f),()=>c.removeEventListener(d,p,f)),l=Se(()=>[kr(e),so(i)],([c,d])=>{if(a(),!c)return;const p=p0(d)?{...d}:d;o.push(...n.flatMap(f=>r.map(h=>s(c,f,h,p))))},{immediate:!0,flush:"post"}),u=()=>{l(),a()};return Nl(u),u}function y0(t){return typeof t=="function"?t:typeof t=="string"?e=>e.key===t:Array.isArray(t)?e=>t.includes(e.key):()=>!0}function b0(...t){let e,n,r={};t.length===3?(e=t[0],n=t[1],r=t[2]):t.length===2?typeof t[1]=="object"?(e=!0,n=t[0],r=t[1]):(e=t[0],n=t[1]):(e=!0,n=t[0]);const{target:i=lo,eventName:o="keydown",passive:a=!1,dedupe:s=!1}=r,l=y0(e);return Ol(i,o,u=>{u.repeat&&so(s)||l(u)&&n(u)},a)}function x0(){const t=j(!1),e=Yt();return e&&dt(()=>{t.value=!0},e),t}function w0(t){return JSON.parse(JSON.stringify(t))}function T0(t,e,n,r={}){var i,o,a;const{clone:s=!1,passive:l=!1,eventName:u,deep:c=!1,defaultValue:d,shouldEmit:p}=r,f=Yt(),h=n||(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 w=u;w=w||`update:${e.toString()}`;const g=A=>s?typeof s=="function"?s(A):w0(A):A,y=()=>d0(t[e])?g(t[e]):d,E=A=>{p?p(A)&&h(w,A):h(w,A)};if(l){const A=y(),_=j(A);let N=!1;return Se(()=>t[e],m=>{N||(N=!0,_.value=g(m),vt(()=>N=!1))}),Se(_,m=>{!N&&(m!==t[e]||c)&&E(m)},{deep:c}),_}else return Me({get(){return y()},set(A){E(A)}})}function uo(t){return t?t.flatMap(e=>e.type===dr?uo(e.children):[e]):[]}function oi(t){if(t===null||typeof t!="object")return!1;const e=Object.getPrototypeOf(t);return e!==null&&e!==Object.prototype&&Object.getPrototypeOf(e)!==null||Symbol.iterator in t?!1:Symbol.toStringTag in t?Object.prototype.toString.call(t)==="[object Module]":!0}function Ri(t,e,n=".",r){if(!oi(e))return Ri(t,{},n);const i=Object.assign({},e);for(const o in t){if(o==="__proto__"||o==="constructor")continue;const a=t[o];a!=null&&(Array.isArray(a)&&Array.isArray(i[o])?i[o]=[...a,...i[o]]:oi(a)&&oi(i[o])?i[o]=Ri(a,i[o],(n?`${n}.`:"")+o.toString()):i[o]=a)}return i}function A0(t){return(...e)=>e.reduce((n,r)=>Ri(n,r,""),{})}const k0=A0(),[Pl,V1]=ao("ConfigProvider");let E0="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",_0=(t=21)=>{let e="",n=t;for(;n--;)e+=E0[Math.random()*64|0];return e};const M0=c0(()=>{const t=j(new Map),e=j(),n=Me(()=>{for(const a of t.value.values())if(a)return!0;return!1}),r=Pl({scrollBody:j(!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??"",Ba&&(i==null||i()),e.value=void 0};return Se(n,(a,s)=>{var l;if(!Qt)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},d=(l=r.scrollBody)!=null&&l.value?typeof r.scrollBody.value=="object"?k0({padding:r.scrollBody.value.padding===!0?u:r.scrollBody.value.padding,margin:r.scrollBody.value.margin===!0?u:r.scrollBody.value.margin},c):c:{padding:0,margin:0};u>0&&(document.body.style.paddingRight=typeof d.padding=="number"?`${d.padding}px`:String(d.padding),document.body.style.marginRight=typeof d.margin=="number"?`${d.margin}px`:String(d.margin),document.body.style.setProperty("--scrollbar-width",`${u}px`),document.body.style.overflow="hidden"),Ba&&(i=Ol(document,"touchmove",p=>I0(p),{passive:!1})),vt(()=>{document.body.style.pointerEvents="none",document.body.style.overflow="hidden"})},{immediate:!0,flush:"sync"}),t});function S0(t){const e=_0(6),n=M0();n.value.set(e,t);const r=Me({get:()=>n.value.get(e)??!1,set:i=>n.value.set(e,i)});return v0(()=>{n.value.delete(e)}),r}function Ll(t){const e=window.getComputedStyle(t);if(e.overflowX==="scroll"||e.overflowY==="scroll"||e.overflowX==="auto"&&t.clientWidth1?!0:(e.preventDefault&&e.cancelable&&e.preventDefault(),!1)}function co(t){const e=Yt(),n=e==null?void 0:e.type.emits,r={};return n!=null&&n.length||console.warn(`No emitted event found. Please check component: ${e==null?void 0:e.type.__name}`),n==null||n.forEach(i=>{r[Ec(_c(i))]=(...o)=>t(i,...o)}),r}function St(){const t=Yt(),e=j(),n=Me(()=>{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:kr(e)}),r=Object.assign({},t.exposed),i={};for(const a in t.props)Object.defineProperty(i,a,{enumerable:!0,configurable:!0,get:()=>t.props[a]});if(Object.keys(r).length>0)for(const a in r)Object.defineProperty(i,a,{enumerable:!0,configurable:!0,get:()=>r[a]});Object.defineProperty(i,"$el",{enumerable:!0,configurable:!0,get:()=>t.vnode.el}),t.exposed=i;function o(a){e.value=a,!(a instanceof Element||!a)&&(Object.defineProperty(i,"$el",{enumerable:!0,configurable:!0,get:()=>a.$el}),t.exposed=i)}return{forwardRef:o,currentRef:e,currentElement:n}}var R0=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},on=new WeakMap,Xn=new WeakMap,Qn={},ai=0,Dl=function(t){return t&&(t.host||Dl(t.parentNode))},C0=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=Dl(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},N0=function(t,e,n,r){var i=C0(e,Array.isArray(t)?t:[t]);Qn[n]||(Qn[n]=new WeakMap);var o=Qn[n],a=[],s=new Set,l=new Set(i),u=function(d){!d||s.has(d)||(s.add(d),u(d.parentNode))};i.forEach(u);var c=function(d){!d||l.has(d)||Array.prototype.forEach.call(d.children,function(p){if(s.has(p))c(p);else try{var f=p.getAttribute(r),h=f!==null&&f!=="false",w=(on.get(p)||0)+1,g=(o.get(p)||0)+1;on.set(p,w),o.set(p,g),a.push(p),w===1&&h&&Xn.set(p,!0),g===1&&p.setAttribute(n,"true"),h||p.setAttribute(r,"true")}catch(y){console.error("aria-hidden: cannot operate on ",p,y)}})};return c(e),s.clear(),ai++,function(){a.forEach(function(d){var p=on.get(d)-1,f=o.get(d)-1;on.set(d,p),o.set(d,f),p||(Xn.has(d)||d.removeAttribute(r),Xn.delete(d)),f||d.removeAttribute(n)}),ai--,ai||(on=new WeakMap,on=new WeakMap,Xn=new WeakMap,Qn={})}},O0=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=R0(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live]"))),N0(r,i,n,"aria-hidden")):function(){return null}};function P0(t){let e;Se(()=>kr(t),n=>{n?e=O0(n):e&&e()}),lt(()=>{e&&e()})}let L0=0;function Ci(t,e="radix"){const n=Pl({useId:void 0});return To?`${e}-${To()}`:n.useId?`${e}-${n.useId()}`:`${e}-${++L0}`}function D0(t,e){const n=j(t);function r(i){return e[n.value][i]??n.value}return{state:n,dispatch:i=>{n.value=r(i)}}}const B0=be({name:"PrimitiveSlot",inheritAttrs:!1,setup(t,{attrs:e,slots:n}){return()=>{var r,i;if(!n.default)return null;const o=uo(n.default()),a=o.findIndex(c=>c.type!==Ac);if(a===-1)return o;const s=o[a];(r=s.props)==null||delete r.ref;const l=s.props?zt(e,s.props):e;e.class&&(i=s.props)!=null&&i.class&&delete s.props.class;const u=kc(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)}}}),Er=be({name:"Primitive",inheritAttrs:!1,props:{asChild:{type:Boolean,default:!1},as:{type:[String,Object],default:"div"}},setup(t,{attrs:e,slots:n}){const r=t.asChild?"template":t.as;return typeof r=="string"&&["area","img","input"].includes(r)?()=>rr(r,e):r!=="template"?()=>rr(t.as,e,{default:n.default}):()=>rr(B0,e,{default:n.default})}});function F0(t,e){var n;const r=j({}),i=j("none"),o=j(t),a=t.value?"mounted":"unmounted";let s;const l=((n=e.value)==null?void 0:n.ownerDocument.defaultView)??lo,{state:u,dispatch:c}=D0(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}}),d=g=>{var y;if(Qt){const E=new CustomEvent(g,{bubbles:!1,cancelable:!1});(y=e.value)==null||y.dispatchEvent(E)}};Se(t,async(g,y)=>{var E;const A=y!==g;if(await vt(),A){const _=i.value,N=Zn(e.value);g?(c("MOUNT"),d("enter"),N==="none"&&d("after-enter")):N==="none"||((E=r.value)==null?void 0:E.display)==="none"?(c("UNMOUNT"),d("leave"),d("after-leave")):y&&_!==N?(c("ANIMATION_OUT"),d("leave")):(c("UNMOUNT"),d("after-leave"))}},{immediate:!0});const p=g=>{const y=Zn(e.value),E=y.includes(g.animationName),A=u.value==="mounted"?"enter":"leave";if(g.target===e.value&&E&&(d(`after-${A}`),c("ANIMATION_END"),!o.value)){const _=e.value.style.animationFillMode;e.value.style.animationFillMode="forwards",s=l==null?void 0:l.setTimeout(()=>{var N;((N=e.value)==null?void 0:N.style.animationFillMode)==="forwards"&&(e.value.style.animationFillMode=_)})}g.target===e.value&&y==="none"&&c("ANIMATION_END")},f=g=>{g.target===e.value&&(i.value=Zn(e.value))},h=Se(e,(g,y)=>{g?(r.value=getComputedStyle(g),g.addEventListener("animationstart",f),g.addEventListener("animationcancel",p),g.addEventListener("animationend",p)):(c("ANIMATION_END"),l==null||l.clearTimeout(s),y==null||y.removeEventListener("animationstart",f),y==null||y.removeEventListener("animationcancel",p),y==null||y.removeEventListener("animationend",p))},{immediate:!0}),w=Se(u,()=>{const g=Zn(e.value);i.value=u.value==="mounted"?g:"none"});return lt(()=>{h(),w()}),{isPresent:Me(()=>["mounted","unmountSuspended"].includes(u.value))}}function Zn(t){return t&&getComputedStyle(t).animationName||"none"}const Bl=be({name:"Presence",props:{present:{type:Boolean,required:!0},forceMount:{type:Boolean}},slots:{},setup(t,{slots:e,expose:n}){var r;const{present:i,forceMount:o}=hn(t),a=j(),{isPresent:s}=F0(i,a);n({present:s});let l=e.default({present:s});l=uo(l||[]);const u=Yt();if(l&&(l==null?void 0:l.length)>1){const c=(r=u==null?void 0:u.parent)!=null&&r.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(d=>` - ${d}`).join(` +`)].join(` +`))}return()=>o.value||i.value||s.value?rr(e.default({present:s})[0],{ref:c=>{const d=kr(c);return typeof(d==null?void 0:d.hasAttribute)>"u"||(d!=null&&d.hasAttribute("data-radix-popper-content-wrapper")?a.value=d.firstElementChild:a.value=d),d}}):null}}),[Zt,z0]=ao("DialogRoot"),U0=be({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(t,{emit:e}){const n=t,r=T0(n,"open",e,{defaultValue:n.defaultOpen,passive:n.open===void 0}),i=j(),o=j(),{modal:a}=hn(n);return z0({open:r,modal:a,openModal:()=>{r.value=!0},onOpenChange:s=>{r.value=s},onOpenToggle:()=>{r.value=!r.value},contentId:"",titleId:"",descriptionId:"",triggerElement:i,contentElement:o}),(s,l)=>ze(s.$slots,"default",{open:L(r)})}}),Fl=be({__name:"DialogTrigger",props:{asChild:{type:Boolean},as:{default:"button"}},setup(t){const e=t,n=Zt(),{forwardRef:r,currentElement:i}=St();return n.contentId||(n.contentId=Ci(void 0,"radix-vue-dialog-content")),dt(()=>{n.triggerElement.value=i.value}),(o,a)=>(Q(),Fe(L(Er),zt(e,{ref:L(r),type:o.as==="button"?"button":void 0,"aria-haspopup":"dialog","aria-expanded":L(n).open.value||!1,"aria-controls":L(n).open.value?L(n).contentId:void 0,"data-state":L(n).open.value?"open":"closed",onClick:L(n).onOpenToggle}),{default:we(()=>[ze(o.$slots,"default")]),_:3},16,["type","aria-expanded","aria-controls","data-state","onClick"]))}}),j0=be({__name:"Teleport",props:{to:{default:"body"},disabled:{type:Boolean},forceMount:{type:Boolean}},setup(t){const e=x0();return(n,r)=>L(e)||n.forceMount?(Q(),Fe(Tc,{key:0,to:n.to,disabled:n.disabled},[ze(n.$slots,"default")],8,["to","disabled"])):Ye("",!0)}}),zl=be({__name:"DialogPortal",props:{to:{},disabled:{type:Boolean},forceMount:{type:Boolean}},setup(t){const e=t;return(n,r)=>(Q(),Fe(L(j0),bc(xc(e)),{default:we(()=>[ze(n.$slots,"default")]),_:3},16))}}),$0="dismissableLayer.pointerDownOutside",V0="dismissableLayer.focusOutside";function Ul(t,e){const n=e.closest("[data-dismissable-layer]"),r=t.dataset.dismissableLayer===""?t:t.querySelector("[data-dismissable-layer]"),i=Array.from(t.ownerDocument.querySelectorAll("[data-dismissable-layer]"));return!!(n&&r===n||i.indexOf(r){});return gt(a=>{if(!Qt)return;const s=async u=>{const c=u.target;if(e!=null&&e.value){if(Ul(e.value,c)){i.value=!1;return}if(u.target&&!i.value){let d=function(){Cl($0,t,p)};const p={originalEvent:u};u.pointerType==="touch"?(r.removeEventListener("click",o.value),o.value=d,r.addEventListener("click",o.value,{once:!0})):d()}else r.removeEventListener("click",o.value);i.value=!1}},l=window.setTimeout(()=>{r.addEventListener("pointerdown",s)},0);a(()=>{window.clearTimeout(l),r.removeEventListener("pointerdown",s),r.removeEventListener("click",o.value)})}),{onPointerDownCapture:()=>i.value=!0}}function G0(t,e){var n;const r=((n=e==null?void 0:e.value)==null?void 0:n.ownerDocument)??(globalThis==null?void 0:globalThis.document),i=j(!1);return gt(o=>{if(!Qt)return;const a=async s=>{e!=null&&e.value&&(await vt(),!(!e.value||Ul(e.value,s.target))&&s.target&&!i.value&&Cl(V0,t,{originalEvent:s}))};r.addEventListener("focusin",a),o(()=>r.removeEventListener("focusin",a))}),{onFocusCapture:()=>i.value=!0,onBlurCapture:()=>i.value=!1}}const kt=vs({layersRoot:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),K0=be({__name:"DismissableLayer",props:{disableOutsidePointerEvents:{type:Boolean,default:!1},asChild:{type:Boolean},as:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","dismiss"],setup(t,{emit:e}){const n=t,r=e,{forwardRef:i,currentElement:o}=St(),a=Me(()=>{var h;return((h=o.value)==null?void 0:h.ownerDocument)??globalThis.document}),s=Me(()=>kt.layersRoot),l=Me(()=>o.value?Array.from(s.value).indexOf(o.value):-1),u=Me(()=>kt.layersWithOutsidePointerEventsDisabled.size>0),c=Me(()=>{const h=Array.from(s.value),[w]=[...kt.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(w);return l.value>=g}),d=H0(async h=>{const w=[...kt.branches].some(g=>g==null?void 0:g.contains(h.target));!c.value||w||(r("pointerDownOutside",h),r("interactOutside",h),await vt(),h.defaultPrevented||r("dismiss"))},o),p=G0(h=>{[...kt.branches].some(w=>w==null?void 0:w.contains(h.target))||(r("focusOutside",h),r("interactOutside",h),h.defaultPrevented||r("dismiss"))},o);b0("Escape",h=>{l.value===s.value.size-1&&(r("escapeKeyDown",h),h.defaultPrevented||r("dismiss"))});let f;return gt(h=>{o.value&&(n.disableOutsidePointerEvents&&(kt.layersWithOutsidePointerEventsDisabled.size===0&&(f=a.value.body.style.pointerEvents,a.value.body.style.pointerEvents="none"),kt.layersWithOutsidePointerEventsDisabled.add(o.value)),s.value.add(o.value),h(()=>{n.disableOutsidePointerEvents&&kt.layersWithOutsidePointerEventsDisabled.size===1&&(a.value.body.style.pointerEvents=f)}))}),gt(h=>{h(()=>{o.value&&(s.value.delete(o.value),kt.layersWithOutsidePointerEventsDisabled.delete(o.value))})}),(h,w)=>(Q(),Fe(L(Er),{ref:L(i),"as-child":h.asChild,as:h.as,"data-dismissable-layer":"",style:pn({pointerEvents:u.value?c.value?"auto":"none":void 0}),onFocusCapture:L(p).onFocusCapture,onBlurCapture:L(p).onBlurCapture,onPointerdownCapture:L(d).onPointerDownCapture},{default:we(()=>[ze(h.$slots,"default")]),_:3},8,["as-child","as","style","onFocusCapture","onBlurCapture","onPointerdownCapture"]))}}),si="focusScope.autoFocusOnMount",li="focusScope.autoFocusOnUnmount",Fa={bubbles:!1,cancelable:!0};function q0(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(Pt(r,{select:e}),document.activeElement!==n)return!0}function W0(t){const e=jl(t),n=za(e,t),r=za(e.reverse(),t);return[n,r]}function jl(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function za(t,e){for(const n of t)if(!Y0(n,{upTo:e}))return n}function Y0(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function X0(t){return t instanceof HTMLInputElement&&"select"in t}function Pt(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&X0(t)&&e&&t.select()}}const Q0=u0(()=>j([]));function Z0(){const t=Q0();return{add(e){const n=t.value[0];e!==n&&(n==null||n.pause()),t.value=Ua(t.value,e),t.value.unshift(e)},remove(e){var n;t.value=Ua(t.value,e),(n=t.value[0])==null||n.resume()}}}function Ua(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function J0(t){return t.filter(e=>e.tagName!=="A")}const eb=be({__name:"FocusScope",props:{loop:{type:Boolean,default:!1},trapped:{type:Boolean,default:!1},asChild:{type:Boolean},as:{}},emits:["mountAutoFocus","unmountAutoFocus"],setup(t,{emit:e}){const n=t,r=e,{currentRef:i,currentElement:o}=St(),a=j(null),s=Z0(),l=vs({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}});gt(c=>{if(!Qt)return;const d=o.value;if(!n.trapped)return;function p(g){if(l.paused||!d)return;const y=g.target;d.contains(y)?a.value=y:Pt(a.value,{select:!0})}function f(g){if(l.paused||!d)return;const y=g.relatedTarget;y!==null&&(d.contains(y)||Pt(a.value,{select:!0}))}function h(g){d.contains(a.value)||Pt(d)}document.addEventListener("focusin",p),document.addEventListener("focusout",f);const w=new MutationObserver(h);d&&w.observe(d,{childList:!0,subtree:!0}),c(()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",f),w.disconnect()})}),gt(async c=>{const d=o.value;if(await vt(),!d)return;s.add(l);const p=document.activeElement;if(!d.contains(p)){const f=new CustomEvent(si,Fa);d.addEventListener(si,h=>r("mountAutoFocus",h)),d.dispatchEvent(f),f.defaultPrevented||(q0(J0(jl(d)),{select:!0}),document.activeElement===p&&Pt(d))}c(()=>{d.removeEventListener(si,w=>r("mountAutoFocus",w));const f=new CustomEvent(li,Fa),h=w=>{r("unmountAutoFocus",w)};d.addEventListener(li,h),d.dispatchEvent(f),setTimeout(()=>{f.defaultPrevented||Pt(p??document.body,{select:!0}),d.removeEventListener(li,h),s.remove(l)},0)})});function u(c){if(!n.loop&&!n.trapped||l.paused)return;const d=c.key==="Tab"&&!c.altKey&&!c.ctrlKey&&!c.metaKey,p=document.activeElement;if(d&&p){const f=c.currentTarget,[h,w]=W0(f);h&&w?!c.shiftKey&&p===w?(c.preventDefault(),n.loop&&Pt(h,{select:!0})):c.shiftKey&&p===h&&(c.preventDefault(),n.loop&&Pt(w,{select:!0})):p===f&&c.preventDefault()}}return(c,d)=>(Q(),Fe(L(Er),{ref_key:"currentRef",ref:i,tabindex:"-1","as-child":c.asChild,as:c.as,onKeydown:u},{default:we(()=>[ze(c.$slots,"default")]),_:3},8,["as-child","as"]))}});function tb(t){return t?"open":"closed"}const $l=be({__name:"DialogContentImpl",props:{forceMount:{type:Boolean},trapFocus:{type:Boolean},disableOutsidePointerEvents:{type:Boolean},asChild:{type:Boolean},as:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(t,{emit:e}){const n=t,r=e,i=Zt(),{forwardRef:o,currentElement:a}=St();return i.titleId||(i.titleId=Ci(void 0,"radix-vue-dialog-title")),i.descriptionId||(i.descriptionId=Ci(void 0,"radix-vue-dialog-description")),dt(()=>{i.contentElement=a,document.activeElement!==document.body&&(i.triggerElement.value=document.activeElement)}),(s,l)=>(Q(),Fe(L(eb),{"as-child":"",loop:"",trapped:n.trapFocus,onMountAutoFocus:l[5]||(l[5]=u=>r("openAutoFocus",u)),onUnmountAutoFocus:l[6]||(l[6]=u=>r("closeAutoFocus",u))},{default:we(()=>[me(L(K0),zt({id:L(i).contentId,ref:L(o),as:s.as,"as-child":s.asChild,"disable-outside-pointer-events":s.disableOutsidePointerEvents,role:"dialog","aria-describedby":L(i).descriptionId,"aria-labelledby":L(i).titleId,"data-state":L(tb)(L(i).open.value)},s.$attrs,{onDismiss:l[0]||(l[0]=u=>L(i).onOpenChange(!1)),onEscapeKeyDown:l[1]||(l[1]=u=>r("escapeKeyDown",u)),onFocusOutside:l[2]||(l[2]=u=>r("focusOutside",u)),onInteractOutside:l[3]||(l[3]=u=>r("interactOutside",u)),onPointerDownOutside:l[4]||(l[4]=u=>r("pointerDownOutside",u))}),{default:we(()=>[ze(s.$slots,"default")]),_:3},16,["id","as","as-child","disable-outside-pointer-events","aria-describedby","aria-labelledby","data-state"])]),_:3},8,["trapped"]))}}),nb=be({__name:"DialogContentModal",props:{forceMount:{type:Boolean},trapFocus:{type:Boolean},disableOutsidePointerEvents:{type:Boolean},asChild:{type:Boolean},as:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(t,{emit:e}){const n=t,r=e,i=Zt(),o=co(r),{forwardRef:a,currentElement:s}=St();return P0(s),(l,u)=>(Q(),Fe($l,zt({...n,...L(o)},{ref:L(a),"trap-focus":L(i).open.value,"disable-outside-pointer-events":!0,onCloseAutoFocus:u[0]||(u[0]=c=>{var d;c.defaultPrevented||(c.preventDefault(),(d=L(i).triggerElement.value)==null||d.focus())}),onPointerDownOutside:u[1]||(u[1]=c=>{const d=c.detail.originalEvent,p=d.button===0&&d.ctrlKey===!0;(d.button===2||p)&&c.preventDefault()}),onFocusOutside:u[2]||(u[2]=c=>{c.preventDefault()})}),{default:we(()=>[ze(l.$slots,"default")]),_:3},16,["trap-focus"]))}}),rb=be({__name:"DialogContentNonModal",props:{forceMount:{type:Boolean},trapFocus:{type:Boolean},disableOutsidePointerEvents:{type:Boolean},asChild:{type:Boolean},as:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(t,{emit:e}){const n=t,r=co(e);St();const i=Zt(),o=j(!1),a=j(!1);return(s,l)=>(Q(),Fe($l,zt({...n,...L(r)},{"trap-focus":!1,"disable-outside-pointer-events":!1,onCloseAutoFocus:l[0]||(l[0]=u=>{var c;u.defaultPrevented||(o.value||(c=L(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 d=u.target;(c=L(i).triggerElement.value)!=null&&c.contains(d)&&u.preventDefault(),u.detail.originalEvent.type==="focusin"&&a.value&&u.preventDefault()})}),{default:we(()=>[ze(s.$slots,"default")]),_:3},16))}}),ib=be({__name:"DialogContent",props:{forceMount:{type:Boolean},trapFocus:{type:Boolean},disableOutsidePointerEvents:{type:Boolean},asChild:{type:Boolean},as:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(t,{emit:e}){const n=t,r=e,i=Zt(),o=co(r),{forwardRef:a}=St();return(s,l)=>(Q(),Fe(L(Bl),{present:s.forceMount||L(i).open.value},{default:we(()=>[L(i).modal.value?(Q(),Fe(nb,zt({key:0,ref:L(a)},{...n,...L(o),...s.$attrs}),{default:we(()=>[ze(s.$slots,"default")]),_:3},16)):(Q(),Fe(rb,zt({key:1,ref:L(a)},{...n,...L(o),...s.$attrs}),{default:we(()=>[ze(s.$slots,"default")]),_:3},16))]),_:3},8,["present"]))}}),ob=be({__name:"DialogOverlayImpl",props:{asChild:{type:Boolean},as:{}},setup(t){const e=Zt();return S0(!0),St(),(n,r)=>(Q(),Fe(L(Er),{as:n.as,"as-child":n.asChild,"data-state":L(e).open.value?"open":"closed",style:{"pointer-events":"auto"}},{default:we(()=>[ze(n.$slots,"default")]),_:3},8,["as","as-child","data-state"]))}}),ab=be({__name:"DialogOverlay",props:{forceMount:{type:Boolean},asChild:{type:Boolean},as:{}},setup(t){const e=Zt(),{forwardRef:n}=St();return(r,i)=>{var o;return(o=L(e))!=null&&o.modal.value?(Q(),Fe(L(Bl),{key:0,present:r.forceMount||L(e).open.value},{default:we(()=>[me(ob,zt(r.$attrs,{ref:L(n),as:r.as,"as-child":r.asChild}),{default:we(()=>[ze(r.$slots,"default")]),_:3},16,["as","as-child"])]),_:3},8,["present"])):Ye("",!0)}}});function sb(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}sb();(function(){try{if(typeof document<"u"){var t=document.createElement("style");t.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(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();const lb=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const ub=t=>typeof t<"u";function cb(t){return JSON.parse(JSON.stringify(t))}function ja(t,e,n,r={}){var i,o,a;const{clone:s=!1,passive:l=!1,eventName:u,deep:c=!1,defaultValue:d,shouldEmit:p}=r,f=Yt(),h=n||(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 w=u;e||(e="modelValue"),w=w||`update:${e.toString()}`;const g=A=>s?typeof s=="function"?s(A):cb(A):A,y=()=>ub(t[e])?g(t[e]):d,E=A=>{p?p(A)&&h(w,A):h(w,A)};if(l){const A=y(),_=j(A);let N=!1;return Se(()=>t[e],m=>{N||(N=!0,_.value=g(m),vt(()=>N=!1))}),Se(_,m=>{!N&&(m!==t[e]||c)&&E(m)},{deep:c}),_}else return Me({get(){return y()},set(A){E(A)}})}const[Vl,db]=ao("DrawerRoot"),Hl=new WeakMap;function Be(t,e,n=!1){if(!t||!(t instanceof HTMLElement)||!e)return;const r={};Object.entries(e).forEach(([i,o])=>{if(i.startsWith("--")){t.style.setProperty(i,o);return}r[i]=t.style[i],t.style[i]=o}),!n&&Hl.set(t,r)}function Jn(t,e){if(!t||!(t instanceof HTMLElement))return;const n=Hl.get(t);n&&(e?t.style[e]=n[e]:Object.entries(n).forEach(([r,i])=>{t.style[r]=i}))}function er(t,e){const n=window.getComputedStyle(t),r=n.transform||n.webkitTransform||n.mozTransform;let i=r.match(/^matrix3d\((.+)\)$/);return i?Number.parseFloat(i[1].split(", ")[He(e)?13:12]):(i=r.match(/^matrix\((.+)\)$/),i?Number.parseFloat(i[1].split(", ")[He(e)?5:4]):null)}function fb(t){return 8*(Math.log(t+1)-2)}function He(t){switch(t){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return t}}const Ne={DURATION:.5,EASE:[.32,.72,0,1]},Gl=.4;function pb({activeSnapPoint:t,snapPoints:e,drawerRef:n,overlayRef:r,fadeFromIndex:i,onSnapPointChange:o,direction:a}){const s=j(typeof window<"u"?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);function l(){s.value={innerWidth:window.innerWidth,innerHeight:window.innerHeight}}dt(()=>{typeof window<"u"&&window.addEventListener("resize",l)}),gs(()=>{typeof window<"u"&&window.removeEventListener("resize",l)});const u=Me(()=>(e.value&&t.value===e.value[e.value.length-1])??null),c=Me(()=>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]===t.value||!e.value),d=Me(()=>{var E;return((E=e.value)==null?void 0:E.findIndex(A=>A===t.value))??null}),p=Me(()=>{var E;return((E=e.value)==null?void 0:E.map(A=>{const _=typeof A=="string";let N=0;if(_&&(N=Number.parseInt(A,10)),He(a.value)){const M=_?N:s.value?A*s.value.innerHeight:0;return s.value?a.value==="bottom"?s.value.innerHeight-M:-s.value.innerHeight+M:M}const m=_?N:s.value?A*s.value.innerWidth:0;return s.value?a.value==="right"?s.value.innerWidth-m:-s.value.innerWidth+m:m}))??[]}),f=Me(()=>{var E;return d.value!==null?(E=p.value)==null?void 0:E[d.value]:null}),h=E=>{var A,_,N,m;const M=((A=p.value)==null?void 0:A.findIndex(x=>x===E))??null;vt(()=>{var x;o(M,p.value),Be((x=n.value)==null?void 0:x.$el,{transition:`transform ${Ne.DURATION}s cubic-bezier(${Ne.EASE.join(",")})`,transform:He(a.value)?`translate3d(0, ${E}px, 0)`:`translate3d(${E}px, 0, 0)`})}),p.value&&M!==p.value.length-1&&M!==(i==null?void 0:i.value)?Be((_=r.value)==null?void 0:_.$el,{transition:`opacity ${Ne.DURATION}s cubic-bezier(${Ne.EASE.join(",")})`,opacity:"0"}):Be((N=r.value)==null?void 0:N.$el,{transition:`opacity ${Ne.DURATION}s cubic-bezier(${Ne.EASE.join(",")})`,opacity:"1"}),t.value=M!==null?((m=e.value)==null?void 0:m[M])??null:null};Se([t,p,e],()=>{var E;if(t.value){const A=((E=e.value)==null?void 0:E.findIndex(_=>_===t.value))??-1;p.value&&A!==-1&&typeof p.value[A]=="number"&&h(p.value[A])}},{immediate:!0});function w({draggedDistance:E,closeDrawer:A,velocity:_,dismissible:N}){var m,M,x;if(i.value===void 0)return;const b=a.value==="bottom"||a.value==="right"?(f.value??0)-E:(f.value??0)+E,v=d.value===i.value-1,k=d.value===0,R=E>0;if(v&&Be((m=r.value)==null?void 0:m.$el,{transition:`opacity ${Ne.DURATION}s cubic-bezier(${Ne.EASE.join(",")})`}),_>2&&!R){N?A():h(p.value[0]);return}if(_>2&&R&&p&&e.value){h(p.value[e.value.length-1]);return}const F=(M=p.value)==null?void 0:M.reduce((D,V)=>typeof D!="number"||typeof V!="number"?D:Math.abs(V-b)Gl&&Math.abs(E)0&&u){h(p.value[(((x=e.value)==null?void 0:x.length)??0)-1]);return}if(k&&D<0&&N&&A(),d.value===null)return;h(p.value[d.value+D]);return}h(F)}function g({draggedDistance:E}){var A;if(f.value===null)return;const _=a.value==="bottom"||a.value==="right"?f.value-E:f.value+E;(a.value==="bottom"||a.value==="right")&&_p.value[p.value.length-1]||Be((A=n.value)==null?void 0:A.$el,{transform:He(a.value)?`translate3d(0, ${_}px, 0)`:`translate3d(${_}px, 0, 0)`})}function y(E,A){if(!e.value||typeof d.value!="number"||!p.value||i.value===void 0)return null;const _=d.value===i.value-1;if(d.value>=i.value&&A)return 0;if(_&&!A)return 1;if(!c.value&&!_)return null;const N=_?d.value+1:d.value-1,m=_?p.value[N]-p.value[N-1]:p.value[N+1]-p.value[N],M=E/Math.abs(m);return _?1-M:M}return{isLastSnapPoint:u,shouldFade:c,getPercentageDragged:y,activeSnapPointIndex:d,onRelease:w,onDrag:g,snapPointsOffset:p}}let An=null;function hb(t){const{isOpen:e,modal:n,nested:r,hasBeenOpened:i}=t,o=j(typeof window<"u"?window.location.href:""),a=j(0);function s(){if(An===null&&e.value){An={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 d=c-window.innerHeight;d&&a.value>=c&&(document.body.style.top=`-${a.value+d}px`)})},300)}}function l(){if(An!==null){const u=-Number.parseInt(document.body.style.top,10),c=-Number.parseInt(document.body.style.left,10);Object.assign(document.body.style,An),requestAnimationFrame(()=>{if(o.value!==window.location.href){o.value=window.location.href;return}window.scrollTo(c,u)}),An=null}}return dt(()=>{function u(){a.value=window.scrollY}u(),window.addEventListener("scroll",u),lt(()=>{window.removeEventListener("scroll",u)})}),Se([e,i,o],()=>{r.value||!i.value||(e.value?(!window.matchMedia("(display-mode: standalone)").matches&&s(),n.value||setTimeout(()=>{l()},500)):l())}),{restorePositionSetting:l}}const mb=.25,gb=100,$a=8,tr=16,vb=26,Va="vaul-dragging";function yb(t,e){return t&&t.value?t:e}function bb(t){const{emitDrag:e,emitRelease:n,emitClose:r,emitOpenChange:i,open:o,dismissible:a,nested:s,modal:l,shouldScaleBackground:u,scrollLockTimeout:c,closeThreshold:d,activeSnapPoint:p,fadeFromIndex:f,direction:h}=t,w=j(o.value??!1),g=j(!1),y=j(!1),E=j(!1),A=j(!1),_=j(null),N=j(null),m=j(null),M=j(null),x=j(null),b=j(!0),v=j(null),k=j(0),R=j(!1);j(0);const F=j(null);j(0);const z=Me(()=>{var G;return((G=F.value)==null?void 0:G.$el.getBoundingClientRect().height)||0}),D=yb(t.snapPoints,j(void 0)),{activeSnapPointIndex:V,onRelease:re,snapPointsOffset:ee,onDrag:se,shouldFade:S,getPercentageDragged:xe}=pb({snapPoints:D,activeSnapPoint:p,drawerRef:F,fadeFromIndex:f,overlayRef:_,onSnapPointChange:Ue,direction:h});function Ue(G,J){D.value&&G===J.length-1&&(N.value=new Date)}const{restorePositionSetting:C}=hb({isOpen:w,modal:l,nested:s,hasBeenOpened:g});function ye(){return(window.innerWidth-vb)/window.innerWidth}function Ie(G,J){var oe;if(!G)return!1;let Z=G;const ae=(oe=window.getSelection())==null?void 0:oe.toString(),ge=F.value?er(F.value.$el,h.value):null,pe=new Date;if(Z.hasAttribute("data-vaul-no-drag")||Z.closest("[data-vaul-no-drag]"))return!1;if(h.value==="right"||h.value==="left")return!0;if(N.value&&pe.getTime()-N.value.getTime()<500)return!1;if(ge!==null&&(h.value==="bottom"?ge>0:ge<0))return!0;if(ae&&ae.length>0)return!1;if(x.value&&pe.getTime()-x.value.getTime()Z.clientHeight){if(Z.scrollTop!==0)return x.value=new Date,!1;if(Z.getAttribute("role")==="dialog")return!0}Z=Z.parentNode}return!0}function Ee(G){!a.value&&!D.value||F.value&&!F.value.$el.contains(G.target)||(E.value=!0,m.value=new Date,G.target.setPointerCapture(G.pointerId),k.value=He(h.value)?G.clientY:G.clientX)}function $e(G){var J,oe,Z,ae,ge,pe;if(F.value&&E.value){const _e=h.value==="bottom"||h.value==="right"?1:-1,Ke=(k.value-(He(h.value)?G.clientY:G.clientX))*_e,We=Ke>0,It=D.value&&!a.value&&!We;if(It&&V.value===0)return;const $=Math.abs(Ke),X=document.querySelector("[vaul-drawer-wrapper]");let te=$/z.value;const le=xe($,We);if(le!==null&&(te=le),It&&te>=1||!b.value&&!Ie(G.target,We))return;if((J=F==null?void 0:F.value)==null||J.$el.classList.add(Va),b.value=!0,Be((oe=F.value)==null?void 0:oe.$el,{transition:"none"}),Be((Z=_.value)==null?void 0:Z.$el,{transition:"none"}),D.value&&se({draggedDistance:Ke}),We&&!D.value){const je=fb(Ke),Qe=Math.min(je*-1,0)*_e;Be((ae=F.value)==null?void 0:ae.$el,{transform:He(h.value)?`translate3d(0, ${Qe}px, 0)`:`translate3d(${Qe}px, 0, 0)`});return}const Ae=1-te;if((S.value||f.value&&V.value===f.value-1)&&(e(te),Be((ge=_.value)==null?void 0:ge.$el,{opacity:`${Ae}`,transition:"none"},!0)),X&&_.value&&u.value){const je=Math.min(ye()+te*(1-ye()),1),Qe=8-te*8,Ze=Math.max(0,14-te*14);Be(X,{borderRadius:`${Qe}px`,transform:He(h.value)?`scale(${je}) translate3d(0, ${Ze}px, 0)`:`scale(${je}) translate3d(${Ze}px, 0, 0)`,transition:"none"},!0)}if(!D.value){const je=$*_e;Be((pe=F.value)==null?void 0:pe.$el,{transform:He(h.value)?`translate3d(0, ${je}px, 0)`:`translate3d(${je}px, 0, 0)`})}}}function K(){var G;if(!F.value)return;const J=document.querySelector("[vaul-drawer-wrapper]"),oe=er(F.value.$el,h.value);Be(F.value.$el,{transform:"translate3d(0, 0, 0)",transition:`transform ${Ne.DURATION}s cubic-bezier(${Ne.EASE.join(",")})`}),Be((G=_.value)==null?void 0:G.$el,{transition:`opacity ${Ne.DURATION}s cubic-bezier(${Ne.EASE.join(",")})`,opacity:"1"}),u.value&&oe&&oe>0&&w.value&&Be(J,{borderRadius:`${$a}px`,overflow:"hidden",...He(h.value)?{transform:`scale(${ye()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${ye()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${Ne.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Ne.EASE.join(",")})`},!0)}function T(){var G;F.value&&(r(),Be(F.value.$el,{transform:He(h.value)?`translate3d(0, ${h.value==="bottom"?"100%":"-100%"}, 0)`:`translate3d(${h.value==="right"?"100%":"-100%"}, 0, 0)`,transition:`transform ${Ne.DURATION}s cubic-bezier(${Ne.EASE.join(",")})`}),Be((G=_.value)==null?void 0:G.$el,{opacity:"0",transition:`opacity ${Ne.DURATION}s cubic-bezier(${Ne.EASE.join(",")})`}),O(!1),window.setTimeout(()=>{y.value=!1,w.value=!1},300),window.setTimeout(()=>{D.value&&(p.value=D.value[0])},Ne.DURATION*1e3))}gt(()=>{if(!w.value&&u.value&&lb){const G=setTimeout(()=>{Jn(document.body)},200);return()=>clearTimeout(G)}}),lt(()=>{O(!1),C()});function I(G){if(!E.value||!F.value)return;F.value.$el.classList.remove(Va),b.value=!1,E.value=!1,M.value=new Date;const J=er(F.value.$el,h.value);if(!Ie(G.target,!1)||!J||Number.isNaN(J)||m.value===null)return;const oe=M.value.getTime()-m.value.getTime(),Z=k.value-(He(h.value)?G.clientY:G.clientX),ae=Math.abs(Z)/oe;if(ae>.05&&(A.value=!0,window.setTimeout(()=>{A.value=!1},200)),D.value){const pe=h.value==="bottom"||h.value==="right"?1:-1;re({draggedDistance:Z*pe,closeDrawer:T,velocity:ae,dismissible:a.value}),n(!0);return}if(h.value==="bottom"||h.value==="right"?Z>0:Z<0){K(),n(!0);return}if(ae>Gl){T(),n(!1);return}const ge=Math.min(F.value.$el.getBoundingClientRect().height??0,window.innerHeight);if(J>=ge*d.value){T(),n(!1);return}n(!0),K()}Se(w,G=>{G&&(N.value=new Date,O(!0)),i(G)},{immediate:!0}),Se(o,G=>{G?(w.value=G,g.value=!0):T()},{immediate:!0});function O(G){const J=document.querySelector("[vaul-drawer-wrapper]");!J||!u.value||(G?(Be(document.body,{background:document.body.style.backgroundColor||document.body.style.background}),Be(document.body,{background:"black"},!0),Be(J,{borderRadius:`${$a}px`,overflow:"hidden",...He(h.value)?{transform:`scale(${ye()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${ye()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${Ne.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Ne.EASE.join(",")})`})):(Jn(J,"overflow"),Jn(J,"transform"),Jn(J,"borderRadius"),Be(J,{transitionProperty:"transform, border-radius",transitionDuration:`${Ne.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Ne.EASE.join(",")})`})))}function H(G){var J,oe;const Z=G?(window.innerWidth-tr)/window.innerWidth:1,ae=G?-16:0;v.value&&window.clearTimeout(v.value),Be((J=F.value)==null?void 0:J.$el,{transition:`transform ${Ne.DURATION}s cubic-bezier(${Ne.EASE.join(",")})`,transform:`scale(${Z}) translate3d(0, ${ae}px, 0)`}),!G&&(oe=F.value)!=null&&oe.$el&&(v.value=window.setTimeout(()=>{var ge,pe;const _e=er((ge=F.value)==null?void 0:ge.$el,h.value);Be((pe=F.value)==null?void 0:pe.$el,{transition:"none",transform:He(h.value)?`translate3d(0, ${_e}px, 0)`:`translate3d(${_e}px, 0, 0)`})},500))}function U(G){var J;if(G<0)return;const oe=He(h.value)?window.innerHeight:window.innerWidth,Z=(oe-tr)/oe,ae=Z+G*(1-Z),ge=-16+G*tr;Be((J=F.value)==null?void 0:J.$el,{transform:He(h.value)?`scale(${ae}) translate3d(0, ${ge}px, 0)`:`scale(${ae}) translate3d(${ge}px, 0, 0)`,transition:"none"})}function W(G){var J;const oe=He(h.value)?window.innerHeight:window.innerWidth,Z=G?(oe-tr)/oe:1,ae=G?-16:0;G&&Be((J=F.value)==null?void 0:J.$el,{transition:`transform ${Ne.DURATION}s cubic-bezier(${Ne.EASE.join(",")})`,transform:He(h.value)?`scale(${Z}) translate3d(0, ${ae}px, 0)`:`scale(${Z}) translate3d(${ae}px, 0, 0)`})}return{open:o,isOpen:w,modal:l,keyboardIsOpen:R,hasBeenOpened:g,isVisible:y,drawerRef:F,drawerHeightRef:z,overlayRef:_,isDragging:E,dragStartTime:m,isAllowedToDrag:b,snapPoints:D,activeSnapPoint:p,pointerStart:k,dismissible:a,snapPointsOffset:ee,direction:h,shouldFade:S,fadeFromIndex:f,shouldScaleBackground:u,onPress:Ee,onDrag:$e,onRelease:I,closeDrawer:T,onNestedDrag:U,onNestedRelease:W,onNestedOpenChange:H,emitClose:r,emitDrag:e,emitRelease:n,emitOpenChange:i,nested:s}}const Kl=be({__name:"DrawerRoot",props:{activeSnapPoint:{default:void 0},closeThreshold:{default:mb},shouldScaleBackground:{type:Boolean,default:void 0},scrollLockTimeout:{default:gb},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","animationEnd"],setup(t,{expose:e,emit:n}){const r=t,i=n;ns();const o=Me(()=>r.fadeFromIndex??(r.snapPoints&&r.snapPoints.length-1)),a=ja(r,"open",i,{defaultValue:r.defaultOpen,passive:r.open===void 0}),s=ja(r,"activeSnapPoint",i,{passive:r.activeSnapPoint===void 0}),l={emitDrag:h=>i("drag",h),emitRelease:h=>i("release",h),emitClose:()=>i("close"),emitOpenChange:h=>{i("update:open",h),setTimeout(()=>{i("animationEnd",h)},Ne.DURATION*1e3)}},{closeDrawer:u,hasBeenOpened:c,modal:d,isOpen:p}=db(bb({...l,...hn(r),activeSnapPoint:s,fadeFromIndex:o,open:a}));function f(h){if(a.value!==void 0){l.emitOpenChange(h);return}h?(c.value=!0,p.value=h):u()}return e({open:p}),(h,w)=>(Q(),Fe(L(U0),{open:L(p),modal:L(d),"onUpdate:open":f},{default:we(()=>[ze(h.$slots,"default",{open:L(p)})]),_:3},8,["open","modal"]))}}),ql=be({__name:"DrawerOverlay",setup(t){const{overlayRef:e,snapPoints:n,isVisible:r,isOpen:i,shouldFade:o}=Vl(),a=Me(()=>{var s;return n&&(((s=n.value)==null?void 0:s.length)??0)>0});return(s,l)=>(Q(),Fe(L(ab),{ref_key:"overlayRef",ref:e,"vaul-drawer-visible":L(r)?"true":"false","vaul-overlay":"","vaul-snap-points":L(i)&&a.value?"true":"false","vaul-snap-points-overlay":L(i)&&L(o)?"true":"false"},null,8,["vaul-drawer-visible","vaul-snap-points","vaul-snap-points-overlay"]))}}),Wl=be({__name:"DrawerContent",setup(t){const{open:e,isOpen:n,isVisible:r,snapPointsOffset:i,drawerRef:o,onPress:a,onDrag:s,onRelease:l,modal:u,emitOpenChange:c,dismissible:d,keyboardIsOpen:p,closeDrawer:f,direction:h}=Vl(),w=Me(()=>i.value&&i.value.length>0?`${i.value[0]}px`:"0");function g(y){if(!u.value||y.defaultPrevented){y.preventDefault();return}p.value&&(p.value=!1),y.preventDefault(),d.value&&c(!1),!(!d.value||e.value!==void 0)&&f()}return Se(n,y=>{y&&setTimeout(()=>{r.value=!0},1)},{immediate:!0}),(y,E)=>(Q(),Fe(L(ib),{ref_key:"drawerRef",ref:o,"vaul-drawer":"","vaul-drawer-direction":L(h),"vaul-drawer-visible":L(r)?"true":"false",style:pn({"--snap-point-height":w.value}),onPointerdown:L(a),onPointermove:L(s),onPointerup:L(l),onPointerDownOutside:g,onEscapeKeyDown:E[0]||(E[0]=A=>{L(d)||A.preventDefault()})},{default:we(()=>[ze(y.$slots,"default")]),_:3},8,["vaul-drawer-direction","vaul-drawer-visible","style","onPointerdown","onPointermove","onPointerup"]))}}),xb={text:"slate-800/80 dark:slate-200/80 xl","font-bold":""},wb={grid:"~ cols-[150px_1fr]","my-2":"","items-center":"","gap-1.5":"","rounded-lg":"",bg:"[#fff6fc] dark:[#2c2529]","px-2":"","py-1":"",text:"pink-400"},Tb={text:"sm pink-500","pl-1":""},Ab={flex:"~ row","w-full":"",text:"sm"},kb=["placeholder"],Eb={text:"sm pink-500","pl-1":""},_b={flex:"~ row","w-full":"",text:"sm"},Mb=["placeholder"],Sb={text:"sm pink-500","pl-1":""},Ib={flex:"~ row","w-full":"",text:"sm"},Rb=["placeholder"],Cb={text:"sm pink-500","pl-1":""},Nb={flex:"~ row","w-full":"",text:"sm"},Ob={value:"en-US"},Pb={value:"zh-CN"},Lb={text:"sm pink-500","pl-1":""},Db={flex:"~ row","w-full":"",text:"sm"},Bb={disabled:"",class:"bg-white dark:bg-zinc-800"},Fb=["value"],zb=["value"],Ub={text:"sm pink-500","pl-1":""},jb={flex:"~ row","w-full":"",text:"sm"},$b={disabled:"",class:"bg-white dark:bg-zinc-800"},Vb=["value"],Hb=["value"],Gb=["value"],Kb=["value"],qb={grid:"~ cols-[140px_1fr]","my-2":"","items-center":"","gap-1.5":"","rounded-lg":"",bg:"[#fff6fc] dark:[#2c2529]","px-2":"","py-1":"",text:"pink-400"},Wb={"h-8":"",flex:"","cursor-pointer":"","items-center":"","justify-end":""},Yb=["checked","aria-checked"],Xb={"select-none":""},Qb={key:0,"i-solar:sun-fog-bold-duotone":"",text:"lg hover:pink-600 dark:hover:pink-300",transition:"all ease-in-out duration-250"},Zb={key:1,"i-solar:moon-stars-bold-duotone":"",text:"lg hover:pink-600 dark:hover:pink-300",transition:"all ease-in-out duration-250"},Yl=be({__name:"MobileSettings",setup(t){const{t:e,locale:n}=Nn(),r=On(),i=Ni({disableTransition:!1}),o=j([]),{models:a}=Rl(),{openAiModel:s,openAiApiBaseURL:l,openAiApiKey:u,elevenlabsVoiceEnglish:c,elevenlabsVoiceJapanese:d}=Wt(r);function p(w){const g=w.target,y=o.value.find(E=>E.id===g.value);if(!y){s.value=void 0;return}s.value=y}function f(w){const g=w.target;r.stageView=g.value}function h(w){const g=w.target.value;switch(n.value){case"en":case"en-US":c.value=g;break;case"zh":case"zh-CN":case"zh-TW":case"zh-HK":c.value=g;break;case"jp":case"jp-JP":d.value=g;break}}return Se([l,u],async([w,g])=>{if(!w||!g){o.value=[];return}o.value=await a(w,g)}),dt(async()=>{!l.value||!u.value||(o.value=await a(l.value,u.value))}),(w,g)=>(Q(),ue("div",null,[B("h2",xb,he(L(e)("settings.title")),1),B("div",null,[B("div",wb,[B("div",Tb,[B("span",null,he(L(e)("settings.openai-base-url.label")),1)]),B("div",Ab,[Dt(B("input",{"onUpdate:modelValue":g[0]||(g[0]=y=>L(r).openAiApiBaseURL=y),type:"text",placeholder:L(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,kb),[[Rr,L(r).openAiApiBaseURL]])]),B("div",Eb,[B("span",null,he(L(e)("settings.openai-api-key.label")),1)]),B("div",_b,[Dt(B("input",{"onUpdate:modelValue":g[1]||(g[1]=y=>L(r).openAiApiKey=y),type:"text",placeholder:L(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,Mb),[[Rr,L(r).openAiApiKey]])]),B("div",Sb,[B("span",null,he(L(e)("settings.elevenlabs-api-key.label")),1)]),B("div",Ib,[Dt(B("input",{"onUpdate:modelValue":g[2]||(g[2]=y=>L(r).elevenLabsApiKey=y),type:"text",placeholder:L(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,Rb),[[Rr,L(r).elevenLabsApiKey]])]),B("div",Cb,[B("span",null,he(L(e)("settings.language.title")),1)]),B("div",Nb,[Dt(B("select",{"onUpdate:modelValue":g[3]||(g[3]=y=>L(r).language=y),"h-8":"","w-full":"","rounded-md":"","bg-transparent":"","px-2":"","py-1":"","text-right":"","font-mono":"","outline-none":""},[B("option",Ob,he(L(e)("settings.language.english")),1),B("option",Pb,he(L(e)("settings.language.chinese")),1)],512),[[Sc,L(r).language]])]),B("div",Lb,[B("span",null,he(L(e)("settings.models")),1)]),B("div",Db,[B("select",{"h-8":"","w-full":"","rounded-md":"","bg-transparent":"","px-2":"","py-1":"","text-right":"","font-mono":"","outline-none":"",onChange:p},[B("option",Bb,he(L(e)("stage.select-a-model")),1),L(r).openAiModel?(Q(),ue("option",{key:0,value:L(r).openAiModel.id},he("name"in L(r).openAiModel?`${L(r).openAiModel.name} (${L(r).openAiModel.id})`:L(r).openAiModel.id),9,Fb)):Ye("",!0),(Q(!0),ue(dr,null,pi(o.value,y=>(Q(),ue("option",{key:y.id,value:y.id},he("name"in y?`${y.name} (${y.id})`:y.id),9,zb))),128))],32)]),B("div",Ub,[B("span",null,he(L(e)("settings.voices")),1)]),B("div",jb,[B("select",{"h-8":"","w-full":"","rounded-md":"","bg-transparent":"","px-2":"","py-1":"","text-right":"","font-mono":"","outline-none":"",onChange:h},[B("option",$b,he(L(e)("stage.select-a-voice")),1),["en","en-US"].indexOf(L(n))!==-1&&L(c)?(Q(),ue("option",{key:0,value:L(c)},he(L(c)),9,Vb)):Ye("",!0),["zh","zh-CN","zh-TW","zh-HK"].indexOf(L(n))!==-1&&L(c)?(Q(),ue("option",{key:1,value:L(c)},he(L(c)),9,Hb)):Ye("",!0),["jp","jp-JP"].indexOf(L(n))!==-1&&L(d)?(Q(),ue("option",{key:2,value:L(d)},he(L(d)),9,Gb)):Ye("",!0),(Q(!0),ue(dr,null,pi(L(Ic)[L(n)],(y,E)=>(Q(),ue("option",{key:E,value:y},he(y),9,Kb))),128))],32)])])]),g[8]||(g[8]=B("h2",{text:"slate-800/80 dark:slate-200/80 xl","font-bold":""}," View ",-1)),B("div",null,[B("div",qb,[g[6]||(g[6]=B("div",{text:"sm pink-500","pl-1":""},[B("span",null,"Viewer")],-1)),B("select",{"h-8":"","w-full":"","rounded-md":"","bg-transparent":"","px-2":"","py-1":"","text-right":"","font-mono":"","outline-none":"",onChange:f},g[5]||(g[5]=[B("option",{value:"2d"}," 2D ",-1),B("option",{value:"3d"}," 3D ",-1)]),32),g[7]||(g[7]=B("div",{text:"sm pink-500","pl-1":""},[B("span",null,"Theme")],-1)),B("label",Wb,[Dt(B("input",{"onUpdate:modelValue":g[4]||(g[4]=y=>rs(i)?i.value=y:null),checked:L(i),"aria-checked":L(i),name:"stageView",type:"checkbox",hidden:"","appearance-none":"","outline-none":""},null,8,Yb),[[Li,L(i)]]),B("div",Xb,[me(ds,{name:"slide-away",mode:"out-in"},{default:we(()=>[L(i)?(Q(),ue("div",Qb)):(Q(),ue("div",Zb))]),_:1})])])])])]))}}),Jb={flex:"~","gap-2":""},e1={class:"flex flex-1 flex-col rounded-t-lg p-5",bg:"[#fffbff] dark:[#1f1a1d]","gap-2":""},t1=be({__name:"DesktopSettings",setup(t){return(e,n)=>(Q(),ue("div",Jb,[me(L(Kl),{"should-scale-background":"",direction:"right"},{default:we(()=>[me(L(Fl),{bg:"zinc-100 dark:zinc-800",text:"lg zinc-500 dark:zinc-400","max-h":"[10lh]","min-h":"[1lh]","m-1":"","rounded-lg":"","p-2":"","outline-none":""},{default:we(()=>n[0]||(n[0]=[B("div",{"i-solar:settings-minimalistic-bold-duotone":""},null,-1)])),_:1}),me(L(zl),null,{default:we(()=>[me(L(ql),{class:"fixed inset-0 z-50 bg-black/40"}),me(L(Wl),{"max-w":"[50%]",bg:"[#fffbff] dark:[#1f1a1d]",fixed:"","bottom-0":"","right-0":"","top-0":"","z-50":"","ml-24":"","h-full":"","w-full":"",flex:"","flex-col":"","overflow-y-scroll":"","rounded-l-lg":""},{default:we(()=>[B("div",e1,[me(Yl)])]),_:1})]),_:1})]),_:1})]))}}),n1={"mb-1":"","w-full":"","gap-2":""},r1=be({__name:"Header",setup(t){return(e,n)=>(Q(),ue("header",n1,[n[0]||(n[0]=B("a",{href:"https://github.com/moeru-ai/airi",rel:"noreferrer noopener",target:"_blank",flex:"~ 1","w-full":"","items-center":"","gap-2":"","px-2":"","text-nowrap":"","text-2xl":"","outline-none":""},[B("div",{"i-solar:cat-outline":"",text:"[#ed869d]"}),B("div",{"font-cute":""},[B("span",null,"アイリ")])],-1)),me(t1)]))}});function Xl(t,e){const n=ys(e??{},{...Ao.getDefaultRealTimeVADOptions("v5"),preSpeechPadFrames:30,positiveSpeechThreshold:.5,negativeSpeechThreshold:.35,minSpeechFrames:30,auto:!0}),r=j(),i=Rc("microphone");async function o(){if(r.value&&(r.value.destroy(),r.value=void 0,console.warn("existing MicVAD destroyed")),!i.value)return;const a=L(t);if(!a)return;const s=await navigator.mediaDevices.getUserMedia({audio:{deviceId:a}});r.value=await Ao.MicVAD.new({...n,stream:s}),n.auto&&r.value.start()}return Se(i,o,{immediate:!0}),Se(Cc(t),o,{immediate:!0}),Nc(o),lt(()=>{r.value&&(r.value.destroy(),r.value=void 0)}),{destroy:()=>{r.value&&(r.value.destroy(),r.value=void 0)},start:()=>{r.value&&r.value.start()}}}function i1(t,e){const n=ys(e,{onLoading:()=>{},onInitiate:()=>{},onProgress:()=>{},onDone:()=>{},onReady:()=>{},onStart:()=>{},onUpdate:()=>{},onComplete:()=>{}}),{post:r,data:i,terminate:o}=Oc(t,{type:"module"}),a=j(null),s=j(""),l=j([]),u=j(!1),c=j(0),d=j("");return Se(i,p=>{var f,h,w,g,y,E,A,_;switch(p.status){case"loading":a.value="loading",s.value=p.data,(f=n.onLoading)==null||f.call(n,p.data);break;case"initiate":l.value.push(p),(h=n.onInitiate)==null||h.call(n,p);break;case"progress":l.value=l.value.map(N=>N.file===p.file?{...N,...p}:N),(w=n.onProgress)==null||w.call(n,p);break;case"done":l.value=l.value.filter(N=>N.file!==p.file),(g=n.onDone)==null||g.call(n,p);break;case"ready":a.value="ready",(y=n.onReady)==null||y.call(n);break;case"start":u.value=!0,(E=n.onStart)==null||E.call(n);break;case"update":c.value=p.tps,(A=n.onUpdate)==null||A.call(n,p.tps);break;case"complete":u.value=!1,d.value=p.output[0]||"",console.debug("Whisper result:",d.value),(_=n.onComplete)==null||_.call(n,p.output[0]);break}}),lt(()=>{o()}),{transcribe:p=>r(p),status:a,loadingMessage:s,loadingProgress:l,transcribing:u,tps:c,result:d,load:()=>r({type:"load"}),terminate:o}}const o1="/assets/worker-CL_jKwe6.js";async function a1(t,e){const n=new ArrayBuffer(44+t.length*2),r=new DataView(n);nr(r,0,"RIFF"),r.setUint32(4,36+t.length*2,!0),nr(r,8,"WAVE"),nr(r,12,"fmt "),r.setUint32(16,16,!0),r.setUint16(20,1,!0),r.setUint16(22,1,!0),r.setUint32(24,e,!0),r.setUint32(28,e*2,!0),r.setUint16(32,2,!0),r.setUint16(34,16,!0),nr(r,36,"data"),r.setUint32(40,t.length*2,!0),s1(r,44,t);const i=new Blob([r],{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 nr(t,e,n){for(let r=0;r{await a(h)}}),{destroy:p}=Xl(o,{onSpeechStart:()=>{n.value=!0},onVADMisfire:()=>{n.value=!1},onSpeechEnd:h=>{n.value=!1,f(h)},auto:!1});async function f(h){await l.resume();const w=await a1(h,l.sampleRate);c({type:"generate",data:{audio:w,language:"en"}})}return Se(i,async h=>{h==="false"&&(p(),d())}),s(async()=>{e.value=""}),(h,w)=>Ye("",!0)}}),u1=yr(l1,[["__scopeId","data-v-a385b0d4"]]),c1={},d1={"mb-1":"","w-full":"","gap-2":""};function f1(t,e){return Q(),ue("header",d1,e[0]||(e[0]=[B("div",{flex:"~ 1","w-full":"","items-center":"","justify-center":"","gap-2":"","px-2":"","text-nowrap":"","text-lg":""},[B("div",{"i-solar:cat-outline":"",text:"[#ed869d]"}),B("div",{"font-cute":""},[B("span",null,"アイリ")])],-1)]))}const p1=yr(c1,[["render",f1]]),h1={py:"1",flex:"~ col",rounded:"lg","overflow-hidden":""},m1={key:0,flex:"",mr:"12"},g1={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 {vt().then(()=>{r.update(),i.value=r.height.value})}),s(async()=>{vt().then(()=>{r.update(),i.value=r.height.value})}),(l,u)=>{const c=Dc("auto-animate");return Q(),ue("div",h1,[u[1]||(u[1]=B("div",{"flex-1":""},null,-1)),Dt((Q(),ue("div",{ref_key:"chatHistoryRef",ref:e,"h-full":"","w-full":"","max-h":"30vh",flex:"~ col","overflow-scroll":""},[u[0]||(u[0]=B("div",{"flex-1":""},null,-1)),(Q(!0),ue(dr,null,pi(L(n),(d,p)=>(Q(),ue("div",{key:p,"mb-2":""},[d.role==="assistant"?(Q(),ue("div",m1,[B("div",g1,[B("div",null,[B("span",v1,he(l.$t("stage.chat.message.character-name.airi")),1)]),d.content?(Q(),ue("div",{key:0,class:"markdown-content",text:"base {n.value=!0},onVADMisfire:()=>{n.value=!1},onSpeechEnd:p=>{n.value=!1,d()},auto:!1});function d(p){alert("Transcription is not implemented yet")}return Se(r,async p=>{p==="false"&&u()}),a(async()=>{e.value=""}),dt(()=>{c()}),(p,f)=>(Q(),ue("div",null,[B("div",_1,[me(E1,{absolute:"","left-0":"","top-0":"",transform:"translate-y-[-100%]","w-full":""}),B("div",M1,[me(L(Au),{modelValue:e.value,"onUpdate:modelValue":f[0]||(f[0]=h=>e.value=h),placeholder:L(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"])]),me(L(Kl),{"should-scale-background":""},{default:we(()=>[me(L(Fl),{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:we(()=>f[1]||(f[1]=[B("div",{"i-solar:settings-bold-duotone":""},null,-1)])),_:1}),me(L(zl),null,{default:we(()=>[me(L(ql),{class:"fixed inset-0 z-50 bg-black/40"}),me(L(Wl),{"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:we(()=>[B("div",S1,[me(Yl)])]),_:1})]),_:1})]),_:1})])]))}}),R1={relative:"","max-h":"[100vh]","max-w":"[100vw]",p:"2",flex:"~ col","z-2":"","h-full":"","overflow-hidden":""},C1={flex:"~ 1 row (Q(),Fe(i0,{"h-full":"","w-full":""},{default:we(()=>[me(l0,{"h-full":"","w-full":"","fill-color":L(e)?"#563544":"#f8e8f2"},{default:we(()=>[B("div",R1,[me(r1,{class:"flex