diff --git "a/assets/index-CjFy167Y.js" "b/assets/index-CjFy167Y.js" new file mode 100644--- /dev/null +++ "b/assets/index-CjFy167Y.js" @@ -0,0 +1,532 @@ +import{f as $n,g as W,h as je,s as qe,t as vs,d as Be,i as bs,j as ws,k as Qr,w as Fe,l as pn,c as re,o as Q,m as gn,p as ks,q as Qt,v as Wt,x as Xt,y as Ue,b as ke,a as O,z as st,A as At,B as Zr,C as it,D as he,e as V,M as yt,T as _t,E as Jr,F as Yn,G as Yo,Z as On,H as Ot,I as Ts,V as ae,S as Ei,Q as Bn,O as Gt,J as Pe,P as Et,K as _s,L as qo,N as hn,U as ei,W as ze,X as Ko,Y as Wo,_ as ti,$ as yn,a0 as As,a1 as ni,a2 as Es,a3 as Xo,a4 as xt,a5 as ri,a6 as Mt,a7 as Ms,a8 as Qo,a9 as Dt,aa as Zo,ab as Ss,ac as Is,ad as Rs,ae as Cs,af as Jo,ag as qn,ah as Ns,ai as Ls,aj as Ps,ak as Pt,al as Ds,am as Os,an as Bs,ao as Fs,ap as er,aq as Fn,ar as Cr,as as Nt,at as ea,au as Nr,av as Vt,aw as Mi,ax as Lt,ay as Ht,az as tr,aA as zs,aB as Us,aC as js,aD as Vs,aE as ta,aF as na,aG as zn,aH as ra,aI as ii,aJ as Un,aK as ia,aL as Hs,n as Lr,aM as Gs,aN as Pr,aO as oa,aP as $s,aQ as cn,aR as aa,aS as ft,aT as vt,aU as mn,aV as Ys,aW as qs,aX as Ks,aY as Ws,aZ as Xs,a_ as oi,a$ as Qs,b0 as Zs,b1 as Js,b2 as nr,b3 as el,b4 as sa,b5 as tl,b6 as nl,b7 as rl,b8 as il,b9 as ol,ba as rr,bb as al,bc as sl,bd as ll,be as Si,bf as Ii,bg as Ri,bh as Ci,bi as ul,bj as cl,bk as fl,bl as dl,bm as pl,bn as Kn,bo as hl,bp as la,bq as ml,br as gl,bs as yl,bt as xl,bu as ua,bv as jn,bw as ca,bx as ai,by as si,bz as vl,bA as ir,bB as bl,bC as wl}from"./index-CrK3ELwD.js";import{V as kl,a as Tl,c as _l,r as Al,b as Dr,d as El,E as Ni,e as Ml,f as Sl,g as Il,s as Rl,h as Cl,i as Nl}from"./live2d-zip-loader-BgNRpWwR.js";import{getImportUrlBundles as Ll}from"./import-url-browser-CPN8ipMD.js";import{s as $t,c as Li,u as Pl,g as Dl}from"./speech-BxS7UzCd.js";import{u as or}from"./queue-_fFBEI8E.js";import{u as Ol,a as Bl,b as Fl,l as zl,_ as fa}from"./queues-DHLBKhni.js";import{l as Ul,u as li}from"./providers-CM_5OP9s.js";import{s as jl}from"./index-D975M2PQ.js";import{u as Vl}from"./airi-card-XblL5SGu.js";import{_ as Hl,a as Gl,r as on}from"./Model.vue_vue_type_script_setup_true_lang-CYHT34yh.js";import{_ as ui}from"./TransitionVertical.vue_vue_type_script_setup_true_lang-cdNL5_3W.js";import{_ as Pi}from"./Collapsable.vue_vue_type_script_setup_true_lang-BWPNt-Gh.js";import{H as $l}from"./HeaderLink-D1_1FgF9.js";import{u as da}from"./consciousness-DzZPF8rC.js";import{d as Di}from"./index-BECzMJab.js";import{b as Oi}from"./route-block-B_A1xBdJ.js";import"./duckdb-mvp-CaaD-olE.js";import"./index-Be1NqeGb.js";async function*Yl(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 ql(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 Kl(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 Wl(t,e="linear"){switch(e){case"linear":return ql(t);case"minmax":return Kl(t)}}const pa=$n("AudioContext",()=>({audioContext:new AudioContext,calculateVolume:Wl})),Xl=$n("SpeakingStore",()=>{const n=W(0),r=W(!1),i=je(()=>r.value?(30+70*n.value)/100:30);return{mouthOpenSize:n,nowSpeaking:r,nowSpeakingAvatarBorderOpacity:i}});function _n(t,e,n){return e+n<0||e+n>=t.length-1?"":t[e+n]}function Ql(t){let e="literal",n="";return{async consume(r){var i,o,a;for(let s=0;s"?(l+=_n(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 Zl=$n("llm",()=>{async function t(n,r,i,o){const a=o==null?void 0:o.headers;return await jl({...r.chat(n),messages:i,headers:a})}async function e(n,r){if(n==="")return[];try{return await Ul({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}}),St=$n("chat",()=>{const{stream:t}=Zl(),{systemPrompt:e}=qe(Vl()),n=W(!1),r=W([]),i=W([]),o=W([]),a=W([]),s=W([]),l=W([]),u=W([]),c=W([]);function f(h){r.value.push(h)}function p(h){i.value.push(h)}function d(h){o.value.push(h)}function y(h){a.value.push(h)}function x(h){s.value.push(h)}function v(h){l.value.push(h)}function k(h){u.value.push(h)}function M(h){c.value.push(h)}const A=W([{role:"system",content:e.value}]),C=W({role:"assistant",content:""});async function P(h,I){var b;try{if(n.value=!0,!h)return;for(const D of r.value)await D(h);C.value={role:"assistant",content:""},A.value.push({role:"user",content:h}),A.value.push(C.value);const g=A.value.slice(0,A.value.length-1).map(D=>vs(D));for(const D of i.value)await D(h);for(const D of o.value)await D(h);const m=((b=I.providerConfig)==null?void 0:b.headers)||{},T=await t(I.model,I.chatProvider,g,{headers:m});for(const D of a.value)await D(h);let S="";const F=Ql({onLiteral:async D=>{for(const B of s.value)await B(D);C.value.content+=D},onSpecial:async D=>{for(const B of l.value)await B(D)}});for await(const D of Yl(T.textStream,async B=>B))S+=D,await F.consume(D);await F.end();for(const D of u.value)await D();for(const D of c.value)await D(S);console.debug("LLM output:",S)}catch(g){throw console.error("Error sending message:",g),g}finally{n.value=!1}}return{sending:n,messages:A,streamingMessage:C,send:P,onBeforeMessageComposed:f,onAfterMessageComposed:p,onBeforeSend:d,onAfterSend:y,onTokenLiteral:x,onTokenSpecial:v,onStreamEnd:k,onAssistantResponseEnd:M}}),ha=Be({__name:"Screen",setup(t){const e=W(),n=bs(ks),{width:r,height:i}=ws(),o=Qr(e,{immediate:!0,windowResize:!0,reset:!0}),a=je(()=>n.between("sm","md").value||n.smaller("sm").value),s=je(()=>n.between("md","lg").value),l=je(()=>n.greaterOrEqual("lg").value),u=je(()=>l.value?o.width.value:a.value||s.value?r.value-16:o.width.value),c=W(0);return Fe([r,i,e],()=>{var p,d;const f=(d=(p=e.value)==null?void 0:p.parentElement)==null?void 0:d.getBoundingClientRect();l.value||a.value||s.value?c.value=(f==null?void 0:f.height)||0:c.value=600}),Fe([o.width,o.height],()=>{l.value||a.value||s.value?c.value=o.height.value:c.value=600}),pn(async()=>{e.value&&o.update()}),(f,p)=>(Q(),re("div",{ref_key:"containerRef",ref:e,"h-full":"","w-full":""},[gn(f.$slots,"default",{width:u.value,height:c.value})],512))}}),Jl={absolute:"",bottom:"3",right:"3"},eu={flex:"~ row","cursor-pointer":""},tu=["checked","aria-checked"],nu={key:0,"min-w":"50vw",z:"(Q(),Xt(ha,{relative:""},{default:Ue(({width:a,height:s})=>[ke(Gl,{width:a,height:s},{default:Ue(({app:l})=>[ke(Hl,{app:l,"mouth-open-size":t.mouthOpenSize,width:a,height:s,paused:t.paused},null,8,["app","mouth-open-size","width","height","paused"])]),_:2},1032,["width","height"]),O("div",Jl,[O("div",eu,[O("label",{class:st([n.value?"bg-neutral-300 dark:bg-neutral-200":"bg-neutral-100 dark:bg-neutral-700"]),transition:"all ease-in-out duration-500",text:"lg neutral-500 dark:neutral-400","m-1":"","h-fit":"","w-fit":"","cursor-pointer":"","appearance-none":"","gap-1":"","rounded-lg":"","rounded-md":"","border-none":"","p-2":"","outline-none":""},[At(O("input",{"onUpdate:modelValue":o[0]||(o[0]=l=>n.value=l),checked:n.value,"aria-checked":n.value,name:"showLive2DViewerInspector",type:"checkbox",hidden:"","appearance-none":"","outline-none":""},null,8,tu),[[Zr,n.value]]),o[8]||(o[8]=O("div",{"select-none":""},[O("div",{"i-solar:bug-bold-duotone":""})],-1))],2)]),ke(ui,null,{default:Ue(()=>[n.value?(Q(),re("div",nu,[O("div",ru,[O("div",iu,[O("span",null,he(V(e)("stage.viewers.debug-menu.emotions")),1)]),O("div",ou,[O("button",{"rounded-lg":"",bg:"neutral-100/70 dark:neutral-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[1]||(o[1]=l=>r.value={group:"Surprise",index:0})},he(V(e)("stage.viewers.debug-menu.emotions-btn.surprised")),1),O("button",{"rounded-lg":"",bg:"neutral-100/70 dark:neutral-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[2]||(o[2]=l=>r.value={group:"Sad",index:0})},he(V(e)("stage.viewers.debug-menu.emotions-btn.sad")),1),O("button",{"rounded-lg":"",bg:"neutral-100/70 dark:neutral-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[3]||(o[3]=l=>r.value={group:"Angry",index:0})},he(V(e)("stage.viewers.debug-menu.emotions-btn.angry")),1),O("button",{"rounded-lg":"",bg:"neutral-100/70 dark:neutral-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[4]||(o[4]=l=>r.value={group:"Happy",index:0})},he(V(e)("stage.viewers.debug-menu.emotions-btn.happy")),1),O("button",{"rounded-lg":"",bg:"neutral-100/70 dark:neutral-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[5]||(o[5]=l=>r.value={group:"Awkward",index:0})},he(V(e)("stage.viewers.debug-menu.emotions-btn.awkward")),1),O("button",{"rounded-lg":"",bg:"neutral-100/70 dark:neutral-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[6]||(o[6]=l=>r.value={group:"Question",index:0})},he(V(e)("stage.viewers.debug-menu.emotions-btn.question")),1),O("button",{"rounded-lg":"",bg:"neutral-100/70 dark:neutral-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[7]||(o[7]=l=>r.value={group:"Think",index:0})},he(V(e)("stage.viewers.debug-menu.emotions-btn.think")),1)])])])):it("",!0)]),_:1})])]),_:1}))}});var su=Object.defineProperty,lu=(t,e,n)=>e in t?su(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,uu=(t,e,n)=>lu(t,e+"",n);function cu(t){return Ns()?(Ls(t),!0):!1}function ma(t){return typeof t=="function"?t():V(t)}const fu=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const du=Object.prototype.toString,pu=t=>du.call(t)==="[object Object]",hu=()=>{},mu=fu?window:void 0;function gu(t){var e;const n=ma(t);return(e=n==null?void 0:n.$el)!=null?e:n}function ar(...t){let e,n,r,i;if(typeof t[0]=="string"||Array.isArray(t[0])?([n,r,i]=t,e=mu):[e,n,r,i]=t,!e)return hu;Array.isArray(n)||(n=[n]),Array.isArray(r)||(r=[r]);const o=[],a=()=>{o.forEach(c=>c()),o.length=0},s=(c,f,p,d)=>(c.addEventListener(f,p,d),()=>c.removeEventListener(f,p,d)),l=Fe(()=>[gu(e),ma(i)],([c,f])=>{if(a(),!c)return;const p=pu(f)?{...f}:f;o.push(...n.flatMap(d=>r.map(y=>s(c,d,y,p))))},{immediate:!0,flush:"post"}),u=()=>{l(),a()};return cu(u),u}function ga(t,e,n,r){const i=class extends yn{constructor(o={}){const a=Object.entries(t);super({uniforms:a.reduce((s,[l,u])=>{const c=ni.clone({[l]:{value:u}});return{...s,...c}},{}),vertexShader:e,fragmentShader:n}),uu(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=Dt.generateUUID(),i}ga({color:new ze("white"),scale:new Pe(1,1),imageBounds:new Pe(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 ci=parseInt(Ps.replace(/\D+/g,""));var yu=Object.defineProperty,xu=(t,e,n)=>e in t?yu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,vu=(t,e,n)=>(xu(t,e+"",n),n);async function Bi(t){const e=await t.arrayBuffer(),n=btoa(String.fromCharCode(...new Uint8Array(e)));return`data:${t.type||""};base64,${n}`}let An,sr,Ft,En;function lr(t,e=1/0,n=null){sr||(sr=new Zo(2,2,1,1)),Ft||(Ft=new yn({uniforms:{blitTexture:new js(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 + } + `})),Ft.uniforms.blitTexture.value=t,Ft.defines.IS_SRGB="colorSpace"in t?t.colorSpace==="srgb":t.encoding===3001,Ft.needsUpdate=!0,En||(En=new Pt(sr,Ft),En.frustrumCulled=!1);const r=new Et,i=new Nr;i.add(En),n||(n=An=new Vs({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 Fn(n.domElement);return o.minFilter=t.minFilter,o.magFilter=t.magFilter,o.wrapS=t.wrapS,o.wrapT=t.wrapT,o.name=t.name,An&&(An.dispose(),An=null),o}const Fi={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 ya{constructor(){this.pluginCallbacks=[],this.register(function(e){return new Iu(e)}),this.register(function(e){return new Ru(e)}),this.register(function(e){return new Lu(e)}),this.register(function(e){return new Pu(e)}),this.register(function(e){return new Du(e)}),this.register(function(e){return new Ou(e)}),this.register(function(e){return new Cu(e)}),this.register(function(e){return new Nu(e)}),this.register(function(e){return new Bu(e)}),this.register(function(e){return new Fu(e)}),this.register(function(e){return new zu(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 Su,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=Dt.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 xa(t){return Math.ceil(t/4)*4}function cr(t,e=0){const n=xa(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 Hi(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})}class Su{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),f=Object.keys(l);c.length>0&&(a.extensionsUsed=c),f.length>0&&(a.extensionsRequired=f),a.buffers&&a.buffers.length>0&&(a.buffers[0].byteLength=u.size),r.binary===!0?u.arrayBuffer().then(p=>{const d=cr(p),y=new DataView(new ArrayBuffer(ji));y.setUint32(0,d.byteLength,!0),y.setUint32(4,_u,!0);const x=cr(Au(JSON.stringify(a)),32),v=new DataView(new ArrayBuffer(ji));v.setUint32(0,x.byteLength,!0),v.setUint32(4,Tu,!0);const k=new ArrayBuffer(Ui),M=new DataView(k);M.setUint32(0,wu,!0),M.setUint32(4,ku,!0);const A=Ui+v.byteLength+x.byteLength+y.byteLength+d.byteLength;M.setUint32(8,A,!0),new Blob([k,v,x,y,d],{type:"application/octet-stream"}).arrayBuffer().then(n)}):a.buffers&&a.buffers.length>0?Bi(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 ae;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 ae;for(let o=0,a=r.count;o4?y=e.array[p*e.itemSize+d]:(d===0?y=e.getX(p):d===1?y=e.getY(p):d===2?y=e.getZ(p):d===3&&(y=e.getW(p)),e.normalized===!0&&(y=Dt.normalize(y,e.array))),n===pe.FLOAT?u.setFloat32(c,y,!0):n===pe.INT?u.setInt32(c,y,!0):n===pe.UNSIGNED_INT?u.setUint32(c,y,!0):n===pe.SHORT?u.setInt16(c,y,!0):n===pe.UNSIGNED_SHORT?u.setUint16(c,y,!0):n===pe.BYTE?u.setInt8(c,y):n===pe.UNSIGNED_BYTE&&u.setUint8(c,y),c+=s}const f={buffer:this.processBuffer(u.buffer),byteOffset:this.byteOffset,byteLength:l};return o!==void 0&&(f.target=o),o===pe.ARRAY_BUFFER&&(f.byteStride=e.itemSize*s),this.byteOffset+=l,a.bufferViews.push(f),{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=cr(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=pe.FLOAT;else if(e.array.constructor===Int32Array)s=pe.INT;else if(e.array.constructor===Uint32Array)s=pe.UNSIGNED_INT;else if(e.array.constructor===Int16Array)s=pe.SHORT;else if(e.array.constructor===Uint16Array)s=pe.UNSIGNED_SHORT;else if(e.array.constructor===Int8Array)s=pe.BYTE;else if(e.array.constructor===Uint8Array)s=pe.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=Mu(e,r,i);let u;n!==void 0&&(u=e===n.index?pe.ELEMENT_ARRAY_BUFFER:pe.ARRAY_BUFFER);const c=this.processBufferView(e,s,r,i,u),f={bufferView:c.id,byteOffset:c.byteOffset,componentType:s,count:i,max:l.max,min:l.min,type:a[e.itemSize]};return e.normalized===!0&&(f.normalized=!0),o.accessors||(o.accessors=[]),o.accessors.push(f)-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),f=i+":flipY/"+r.toString();if(c[f]!==void 0)return c[f];s.images||(s.images=[]);const p={mimeType:i},d=Vi();d.width=Math.min(e.width,l.maxTextureSize),d.height=Math.min(e.height,l.maxTextureSize);const y=d.getContext("2d");if(r===!0&&(y.translate(0,d.height),y.scale(1,-1)),e.data!==void 0){n!==Cr&&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 v=new Uint8ClampedArray(e.height*e.width*4);for(let k=0;ko.processBufferViewImage(v)).then(v=>{p.bufferView=v})):d.toDataURL!==void 0?p.uri=d.toDataURL(i):u.push(Hi(d,i).then(Bi).then(v=>{p.uri=v}));const x=s.images.push(p)-1;return c[f]=x,x}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:Je[e.magFilter],minFilter:Je[e.minFilter],wrapS:Je[e.wrapS],wrapT:Je[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 er&&(e=lr(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(un(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===qn&&(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,C=e.material.length;A=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"},d=a.getAttribute("normal");d!==void 0&&!this.isNormalizedNormalAttribute(d)&&(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),a.setAttribute("normal",this.createNormalizedNormalAttribute(d)));let y=null;for(let A in a.attributes){if(A.slice(0,5)==="morph")continue;const C=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(C))){u[A]=n.attributes.get(this.getUID(C));continue}y=null;const P=C.array;A==="JOINTS_0"&&!(P instanceof Uint16Array)&&!(P instanceof Uint8Array)&&(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),y=new Nt(new Uint16Array(P),C.itemSize,C.normalized));const h=this.processAccessor(y||C,a);h!==null&&(A.startsWith("_")||this.detectMeshQuantization(A,C),u[A]=h,n.attributes.set(this.getUID(C),h))}if(d!==void 0&&a.setAttribute("normal",d),Object.keys(u).length===0)return null;if(e.morphTargetInfluences!==void 0&&e.morphTargetInfluences.length>0){const A=[],C=[],P={};if(e.morphTargetDictionary!==void 0)for(const h in e.morphTargetDictionary)P[e.morphTargetDictionary[h]]=h;for(let h=0;h0&&(l.extras={},l.extras.targetNames=C)}const x=Array.isArray(e.material);if(x&&a.groups.length===0)return null;const v=x?e.material:[e.material],k=x?a.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let A=0,C=k.length;A0&&(P.targets=f),a.index!==null){let I=this.getUID(a.index);(k[A].start!==void 0||k[A].count!==void 0)&&(I+=":"+k[A].start+":"+k[A].count),n.attributes.has(I)?P.indices=n.attributes.get(I):(P.indices=this.processAccessor(a.index,a,k[A].start,k[A].count),n.attributes.set(I,P.indices)),P.indices===null&&delete P.indices}const h=this.processMaterial(v[k[A].materialIndex]);h!==null&&(P.material=h),c.push(P)}l.primitives=c,r.meshes||(r.meshes=[]),this._invokeAll(function(A){A.writeMesh&&A.writeMesh(e,l)});const M=r.meshes.push(l)-1;return n.meshes.set(o,M),M}detectMeshQuantization(e,n){if(this.extensionsUsed[ur])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];Fi[i]&&Fi[i].includes(r)&&(this.extensionsUsed[ur]=!0,this.extensionsRequired[ur]=!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:Dt.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=ya.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 Nr;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 Ru=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}},Cu=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}},Nu=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}},Lu=class{constructor(t){this.writer=t,this.name="KHR_materials_transmission"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||t.transmission===0)return;const n=this.writer,r=n.extensionsUsed,i={};if(i.transmissionFactor=t.transmission,t.transmissionMap){const o={index:n.processTexture(t.transmissionMap),texCoord:t.transmissionMap.channel};n.applyTextureTransform(o,t.transmissionMap),i.transmissionTexture=o}e.extensions=e.extensions||{},e.extensions[this.name]=i,r[this.name]=!0}},Pu=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}},Du=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}},Ou=class{constructor(t){this.writer=t,this.name="KHR_materials_specular"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||t.specularIntensity===1&&t.specularColor.equals(bu)&&!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}},Bu=class{constructor(t){this.writer=t,this.name="KHR_materials_sheen"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||t.sheen==0)return;const n=this.writer,r=n.extensionsUsed,i={};if(t.sheenRoughnessMap){const o={index:n.processTexture(t.sheenRoughnessMap),texCoord:t.sheenRoughnessMap.channel};n.applyTextureTransform(o,t.sheenRoughnessMap),i.sheenRoughnessTexture=o}if(t.sheenColorMap){const o={index:n.processTexture(t.sheenColorMap),texCoord:t.sheenColorMap.channel};n.applyTextureTransform(o,t.sheenColorMap),i.sheenColorTexture=o}i.sheenRoughnessFactor=t.sheenRoughness,i.sheenColorFactor=t.sheenColor.toArray(),e.extensions=e.extensions||{},e.extensions[this.name]=i,r[this.name]=!0}},Fu=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}},zu=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 xn=Uint8Array,va=Uint16Array,Uu=Uint32Array,ju=new xn([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]),Vu=new xn([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]),ba=function(t,e){for(var n=new va(31),r=0;r<31;++r)n[r]=e+=1<>>1|(Ne&21845)<<1;wt=(wt&52428)>>>2|(wt&13107)<<2,wt=(wt&61680)>>>4|(wt&3855)<<4,$u[Ne]=((wt&65280)>>>8|(wt&255)<<8)>>>1}var Wn=new xn(288);for(var Ne=0;Ne<144;++Ne)Wn[Ne]=8;for(var Ne=144;Ne<256;++Ne)Wn[Ne]=9;for(var Ne=256;Ne<280;++Ne)Wn[Ne]=7;for(var Ne=280;Ne<288;++Ne)Wn[Ne]=8;var Yu=new xn(32);for(var Ne=0;Ne<32;++Ne)Yu[Ne]=5;var qu=new xn(0),Ku=typeof TextDecoder<"u"&&new TextDecoder,Wu=0;try{Ku.decode(qu,{stream:!0}),Wu=1}catch{}var Xu=Object.defineProperty,Qu=(t,e,n)=>e in t?Xu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Zu=(t,e,n)=>(Qu(t,e+"",n),n);const ka=class extends Pt{constructor(t,e={}){super(t),this.isReflector=!0,this.type="Reflector",this.camera=new Et;const n=this,r=e.color!==void 0?new ze(e.color):new ze(8355711),i=e.textureWidth||512,o=e.textureHeight||512,a=e.clipBias||0,s=e.shader||ka.ReflectorShader,l=e.multisample!==void 0?e.multisample:4,u=new qo,c=new ae,f=new ae,p=new ae,d=new xt,y=new ae(0,0,-1),x=new Mt,v=new ae,k=new ae,M=new Mt,A=new xt,C=this.camera,P=new Os(i,o,{samples:l,type:Bs}),h=new yn({uniforms:ni.clone(s.uniforms),fragmentShader:s.fragmentShader,vertexShader:s.vertexShader});h.uniforms.tDiffuse.value=P.texture,h.uniforms.color.value=r,h.uniforms.textureMatrix.value=A,this.material=h,this.onBeforeRender=function(I,b,g){if(f.setFromMatrixPosition(n.matrixWorld),p.setFromMatrixPosition(g.matrixWorld),d.extractRotation(n.matrixWorld),c.set(0,0,1),c.applyMatrix4(d),v.subVectors(f,p),v.dot(c)>0)return;v.reflect(c).negate(),v.add(f),d.extractRotation(g.matrixWorld),y.set(0,0,-1),y.applyMatrix4(d),y.add(p),k.subVectors(f,y),k.reflect(c).negate(),k.add(f),C.position.copy(v),C.up.set(0,1,0),C.up.applyMatrix4(d),C.up.reflect(c),C.lookAt(k),C.far=g.far,C.updateMatrixWorld(),C.projectionMatrix.copy(g.projectionMatrix),A.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),A.multiply(C.projectionMatrix),A.multiply(C.matrixWorldInverse),A.multiply(n.matrixWorld),u.setFromNormalAndCoplanarPoint(c,f),u.applyMatrix4(C.matrixWorldInverse),x.set(u.normal.x,u.normal.y,u.normal.z,u.constant);const m=C.projectionMatrix;M.x=(Math.sign(x.x)+m.elements[8])/m.elements[0],M.y=(Math.sign(x.y)+m.elements[9])/m.elements[5],M.z=-1,M.w=(1+m.elements[10])/m.elements[14],x.multiplyScalar(2/x.dot(M)),m.elements[2]=x.x,m.elements[6]=x.y,m.elements[10]=x.z+1-a,m.elements[14]=x.w,n.visible=!1;const T=I.getRenderTarget(),S=I.xr.enabled,F=I.shadowMap.autoUpdate,D=I.toneMapping;let B=!1;"outputColorSpace"in I?B=I.outputColorSpace==="srgb":B=I.outputEncoding===3001,I.xr.enabled=!1,I.shadowMap.autoUpdate=!1,"outputColorSpace"in I?I.outputColorSpace="srgb-linear":I.outputEncoding=3e3,I.toneMapping=Fs,I.setRenderTarget(P),I.state.buffers.depth.setMask(!0),I.autoClear===!1&&I.clear(),I.render(b,C),I.xr.enabled=S,I.shadowMap.autoUpdate=F,I.toneMapping=D,"outputColorSpace"in I?I.outputColorSpace=B?"srgb":"srgb-linear":I.outputEncoding=B?3001:3e3,I.setRenderTarget(T);const j=g.viewport;j!==void 0&&I.state.viewport(j),n.visible=!0},this.getRenderTarget=function(){return P},this.dispose=function(){P.dispose(),n.material.dispose()}}};let Or=ka;Zu(Or,"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 <${ci>=154?"colorspace_fragment":"encodings_fragment"}> + + }`});var Ju=Object.defineProperty,ec=(t,e,n)=>e in t?Ju(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ta=(t,e,n)=>(ec(t,typeof e!="symbol"?e+"":e,n),n);const Xn=new Ko,tc=new Float32Array([-1,-1,0,0,0,1,-1,0,1,0,1,1,0,1,1,-1,1,0,0,1]),_a=new Wo(tc,5);Xn.setIndex([0,1,2,0,2,3]);Xn.setAttribute("position",new ti(_a,3,0,!1));Xn.setAttribute("uv",new ti(_a,2,3,!1));const Br=class extends Pt{constructor(){super(Br.Geometry,new Vt({opacity:0,transparent:!0})),this.isLensflare=!0,this.type="Lensflare",this.frustumCulled=!1,this.renderOrder=1/0;const t=new ae,e=new ae,n=new Mi(new Uint8Array(16*16*3),16,16,Cr);n.minFilter=Lt,n.magFilter=Lt,n.wrapS=Ht,n.wrapT=Ht;const r=new Mi(new Uint8Array(16*16*3),16,16,Cr);r.minFilter=Lt,r.magFilter=Lt,r.wrapS=Ht,r.wrapT=Ht;const i=Br.Geometry,o=new tr({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 tr({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 Pt(i,o),l=[],u=Aa.Shader,c=new tr({uniforms:{map:{value:null},occlusionMap:{value:r},color:{value:new ze(16777215)},scale:{value:new Pe},screenPosition:{value:new ae}},vertexShader:u.vertexShader,fragmentShader:u.fragmentShader,blending:zs,transparent:!0,depthWrite:!1}),f=new Pt(i,c);this.addElement=function(v){l.push(v)};const p=new Pe,d=new Pe,y=new Us,x=new Mt;this.onBeforeRender=function(v,k,M){v.getCurrentViewport(x);const A=x.w/x.z,C=x.z/2,P=x.w/2;let h=16/x.w;if(p.set(h*A,h),y.min.set(x.x,x.y),y.max.set(x.x+(x.z-16),x.y+(x.w-16)),e.setFromMatrixPosition(this.matrixWorld),e.applyMatrix4(M.matrixWorldInverse),!(e.z>0)&&(t.copy(e).applyMatrix4(M.projectionMatrix),d.x=x.x+t.x*C+C-8,d.y=x.y+t.y*P+P-8,y.containsPoint(d))){v.copyFramebufferToTexture(d,n);let I=o.uniforms;I.scale.value=p,I.screenPosition.value=t,v.renderBufferDirect(M,null,i,o,s,null),v.copyFramebufferToTexture(d,r),I=a.uniforms,I.scale.value=p,I.screenPosition.value=t,v.renderBufferDirect(M,null,i,a,s,null);const b=-t.x*2,g=-t.y*2;for(let m=0,T=l.length;me in t?rc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ea=(t,e,n)=>(ic(t,typeof e!="symbol"?e+"":e,n),n);const Pn={uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new ae},up:{value:new ae(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 <${ci>=154?"colorspace_fragment":"encodings_fragment"}> + + } + `},Ma=new yn({name:"SkyShader",fragmentShader:Pn.fragmentShader,vertexShader:Pn.vertexShader,uniforms:ni.clone(Pn.uniforms),side:As,depthWrite:!1});class Sa extends Pt{constructor(){super(new Ds(1,1,1),Ma)}}Ea(Sa,"SkyShader",Pn);Ea(Sa,"material",Ma);new Es;new ae;new Xo(0,0,0,"YXZ");new ae;var oc=Object.defineProperty,ac=(t,e,n)=>e in t?oc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ne=(t,e,n)=>(ac(t,typeof e!="symbol"?e+"":e,n),n);const Mn=new _s,Gi=new qo,sc=Math.cos(70*(Math.PI/180)),$i=(t,e)=>(t%e+e)%e;class lc extends Ts{constructor(e,n){super(),ne(this,"object"),ne(this,"domElement"),ne(this,"enabled",!0),ne(this,"target",new ae),ne(this,"minDistance",0),ne(this,"maxDistance",1/0),ne(this,"minZoom",0),ne(this,"maxZoom",1/0),ne(this,"minPolarAngle",0),ne(this,"maxPolarAngle",Math.PI),ne(this,"minAzimuthAngle",-1/0),ne(this,"maxAzimuthAngle",1/0),ne(this,"enableDamping",!1),ne(this,"dampingFactor",.05),ne(this,"enableZoom",!0),ne(this,"zoomSpeed",1),ne(this,"enableRotate",!0),ne(this,"rotateSpeed",1),ne(this,"enablePan",!0),ne(this,"panSpeed",1),ne(this,"screenSpacePanning",!0),ne(this,"keyPanSpeed",7),ne(this,"zoomToCursor",!1),ne(this,"autoRotate",!1),ne(this,"autoRotateSpeed",2),ne(this,"reverseOrbit",!1),ne(this,"reverseHorizontalOrbit",!1),ne(this,"reverseVerticalOrbit",!1),ne(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),ne(this,"mouseButtons",{LEFT:yt.ROTATE,MIDDLE:yt.DOLLY,RIGHT:yt.PAN}),ne(this,"touches",{ONE:_t.ROTATE,TWO:_t.DOLLY_PAN}),ne(this,"target0"),ne(this,"position0"),ne(this,"zoom0"),ne(this,"_domElementKeyEvents",null),ne(this,"getPolarAngle"),ne(this,"getAzimuthalAngle"),ne(this,"setPolarAngle"),ne(this,"setAzimuthalAngle"),ne(this,"getDistance"),ne(this,"getZoomScale"),ne(this,"listenToKeyEvents"),ne(this,"stopListenToKeyEvents"),ne(this,"saveState"),ne(this,"reset"),ne(this,"update"),ne(this,"connect"),ne(this,"dispose"),ne(this,"dollyIn"),ne(this,"dollyOut"),ne(this,"getScale"),ne(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=L=>{let Y=$i(L,2*Math.PI),X=c.phi;X<0&&(X+=2*Math.PI),Y<0&&(Y+=2*Math.PI);let Ee=Math.abs(Y-X);2*Math.PI-Ee{let Y=$i(L,2*Math.PI),X=c.theta;X<0&&(X+=2*Math.PI),Y<0&&(Y+=2*Math.PI);let Ee=Math.abs(Y-X);2*Math.PI-Eer.object.position.distanceTo(r.target),this.listenToKeyEvents=L=>{L.addEventListener("keydown",ie),this._domElementKeyEvents=L},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",ie),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 L=new ae,Y=new ae(0,1,0),X=new Bn().setFromUnitVectors(e.up,Y),Ee=X.clone().invert(),Qe=new ae,at=new Bn,kn=2*Math.PI;return function(){const Ai=r.object.position;X.setFromUnitVectors(e.up,Y),Ee.copy(X).invert(),L.copy(Ai).sub(r.target),L.applyQuaternion(X),c.setFromVector3(L),r.autoRotate&&l===s.NONE&&D(S()),r.enableDamping?(c.theta+=f.theta*r.dampingFactor,c.phi+=f.phi*r.dampingFactor):(c.theta+=f.theta,c.phi+=f.phi);let ht=r.minAzimuthAngle,mt=r.maxAzimuthAngle;isFinite(ht)&&isFinite(mt)&&(ht<-Math.PI?ht+=kn:ht>Math.PI&&(ht-=kn),mt<-Math.PI?mt+=kn:mt>Math.PI&&(mt-=kn),ht<=mt?c.theta=Math.max(ht,Math.min(mt,c.theta)):c.theta=c.theta>(ht+mt)/2?Math.max(ht,c.theta):Math.min(mt,c.theta)),c.phi=Math.max(r.minPolarAngle,Math.min(r.maxPolarAngle,c.phi)),c.makeSafe(),r.enableDamping===!0?r.target.addScaledVector(d,r.dampingFactor):r.target.add(d),r.zoomToCursor&&g||r.object.isOrthographicCamera?c.radius=R(c.radius):c.radius=R(c.radius*p),L.setFromSpherical(c),L.applyQuaternion(Ee),Ai.copy(r.target).add(L),r.object.matrixAutoUpdate||r.object.updateMatrix(),r.object.lookAt(r.target),r.enableDamping===!0?(f.theta*=1-r.dampingFactor,f.phi*=1-r.dampingFactor,d.multiplyScalar(1-r.dampingFactor)):(f.set(0,0,0),d.set(0,0,0));let tn=!1;if(r.zoomToCursor&&g){let nn=null;if(r.object instanceof Et&&r.object.isPerspectiveCamera){const rn=L.length();nn=R(rn*p);const Tn=rn-nn;r.object.position.addScaledVector(I,Tn),r.object.updateMatrixWorld()}else if(r.object.isOrthographicCamera){const rn=new ae(b.x,b.y,0);rn.unproject(r.object),r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/p)),r.object.updateProjectionMatrix(),tn=!0;const Tn=new ae(b.x,b.y,0);Tn.unproject(r.object),r.object.position.sub(Tn).add(rn),r.object.updateMatrixWorld(),nn=L.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),r.zoomToCursor=!1;nn!==null&&(r.screenSpacePanning?r.target.set(0,0,-1).transformDirection(r.object.matrix).multiplyScalar(nn).add(r.object.position):(Mn.origin.copy(r.object.position),Mn.direction.set(0,0,-1).transformDirection(r.object.matrix),Math.abs(r.object.up.dot(Mn.direction))u||8*(1-at.dot(r.object.quaternion))>u?(r.dispatchEvent(i),Qe.copy(r.object.position),at.copy(r.object.quaternion),tn=!1,!0):!1}})(),this.connect=L=>{r.domElement=L,r.domElement.style.touchAction="none",r.domElement.addEventListener("contextmenu",He),r.domElement.addEventListener("pointerdown",Me),r.domElement.addEventListener("pointercancel",tt),r.domElement.addEventListener("wheel",K)},this.dispose=()=>{var L,Y,X,Ee,Qe,at;r.domElement&&(r.domElement.style.touchAction="auto"),(L=r.domElement)==null||L.removeEventListener("contextmenu",He),(Y=r.domElement)==null||Y.removeEventListener("pointerdown",Me),(X=r.domElement)==null||X.removeEventListener("pointercancel",tt),(Ee=r.domElement)==null||Ee.removeEventListener("wheel",K),(Qe=r.domElement)==null||Qe.ownerDocument.removeEventListener("pointermove",Ve),(at=r.domElement)==null||at.ownerDocument.removeEventListener("pointerup",tt),r._domElementKeyEvents!==null&&r._domElementKeyEvents.removeEventListener("keydown",ie)};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 Ei,f=new Ei;let p=1;const d=new ae,y=new Pe,x=new Pe,v=new Pe,k=new Pe,M=new Pe,A=new Pe,C=new Pe,P=new Pe,h=new Pe,I=new ae,b=new Pe;let g=!1;const m=[],T={};function S(){return 2*Math.PI/60/60*r.autoRotateSpeed}function F(){return Math.pow(.95,r.zoomSpeed)}function D(L){r.reverseOrbit||r.reverseHorizontalOrbit?f.theta+=L:f.theta-=L}function B(L){r.reverseOrbit||r.reverseVerticalOrbit?f.phi+=L:f.phi-=L}const j=(()=>{const L=new ae;return function(Y,X){L.setFromMatrixColumn(X,0),L.multiplyScalar(-Y),d.add(L)}})(),J=(()=>{const L=new ae;return function(Y,X){r.screenSpacePanning===!0?L.setFromMatrixColumn(X,1):(L.setFromMatrixColumn(X,0),L.crossVectors(r.object.up,L)),L.multiplyScalar(Y),d.add(L)}})(),oe=(()=>{const L=new ae;return function(Y,X){const Ee=r.domElement;if(Ee&&r.object instanceof Et&&r.object.isPerspectiveCamera){const Qe=r.object.position;L.copy(Qe).sub(r.target);let at=L.length();at*=Math.tan(r.object.fov/2*Math.PI/180),j(2*Y*at/Ee.clientHeight,r.object.matrix),J(2*X*at/Ee.clientHeight,r.object.matrix)}else Ee&&r.object instanceof Gt&&r.object.isOrthographicCamera?(j(Y*(r.object.right-r.object.left)/r.object.zoom/Ee.clientWidth,r.object.matrix),J(X*(r.object.top-r.object.bottom)/r.object.zoom/Ee.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}})();function Z(L){r.object instanceof Et&&r.object.isPerspectiveCamera||r.object instanceof Gt&&r.object.isOrthographicCamera?p=L:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function _(L){Z(p/L)}function ee(L){Z(p*L)}function me(L){if(!r.zoomToCursor||!r.domElement)return;g=!0;const Y=r.domElement.getBoundingClientRect(),X=L.clientX-Y.left,Ee=L.clientY-Y.top,Qe=Y.width,at=Y.height;b.x=X/Qe*2-1,b.y=-(Ee/at)*2+1,I.set(b.x,b.y,1).unproject(r.object).sub(r.object.position).normalize()}function R(L){return Math.max(r.minDistance,Math.min(r.maxDistance,L))}function ge(L){y.set(L.clientX,L.clientY)}function Te(L){me(L),C.set(L.clientX,L.clientY)}function ye(L){k.set(L.clientX,L.clientY)}function Oe(L){x.set(L.clientX,L.clientY),v.subVectors(x,y).multiplyScalar(r.rotateSpeed);const Y=r.domElement;Y&&(D(2*Math.PI*v.x/Y.clientHeight),B(2*Math.PI*v.y/Y.clientHeight)),y.copy(x),r.update()}function G(L){P.set(L.clientX,L.clientY),h.subVectors(P,C),h.y>0?_(F()):h.y<0&&ee(F()),C.copy(P),r.update()}function w(L){M.set(L.clientX,L.clientY),A.subVectors(M,k).multiplyScalar(r.panSpeed),oe(A.x,A.y),k.copy(M),r.update()}function E(L){me(L),L.deltaY<0?ee(F()):L.deltaY>0&&_(F()),r.update()}function N(L){let Y=!1;switch(L.code){case r.keys.UP:oe(0,r.keyPanSpeed),Y=!0;break;case r.keys.BOTTOM:oe(0,-r.keyPanSpeed),Y=!0;break;case r.keys.LEFT:oe(r.keyPanSpeed,0),Y=!0;break;case r.keys.RIGHT:oe(-r.keyPanSpeed,0),Y=!0;break}Y&&(L.preventDefault(),r.update())}function H(){if(m.length==1)y.set(m[0].pageX,m[0].pageY);else{const L=.5*(m[0].pageX+m[1].pageX),Y=.5*(m[0].pageY+m[1].pageY);y.set(L,Y)}}function z(){if(m.length==1)k.set(m[0].pageX,m[0].pageY);else{const L=.5*(m[0].pageX+m[1].pageX),Y=.5*(m[0].pageY+m[1].pageY);k.set(L,Y)}}function q(){const L=m[0].pageX-m[1].pageX,Y=m[0].pageY-m[1].pageY,X=Math.sqrt(L*L+Y*Y);C.set(0,X)}function te(){r.enableZoom&&q(),r.enablePan&&z()}function xe(){r.enableZoom&&q(),r.enableRotate&&H()}function _e(L){if(m.length==1)x.set(L.pageX,L.pageY);else{const X=pt(L),Ee=.5*(L.pageX+X.x),Qe=.5*(L.pageY+X.y);x.set(Ee,Qe)}v.subVectors(x,y).multiplyScalar(r.rotateSpeed);const Y=r.domElement;Y&&(D(2*Math.PI*v.x/Y.clientHeight),B(2*Math.PI*v.y/Y.clientHeight)),y.copy(x)}function fe(L){if(m.length==1)M.set(L.pageX,L.pageY);else{const Y=pt(L),X=.5*(L.pageX+Y.x),Ee=.5*(L.pageY+Y.y);M.set(X,Ee)}A.subVectors(M,k).multiplyScalar(r.panSpeed),oe(A.x,A.y),k.copy(M)}function ve(L){const Y=pt(L),X=L.pageX-Y.x,Ee=L.pageY-Y.y,Qe=Math.sqrt(X*X+Ee*Ee);P.set(0,Qe),h.set(0,Math.pow(P.y/C.y,r.zoomSpeed)),_(h.y),C.copy(P)}function Ie(L){r.enableZoom&&ve(L),r.enablePan&&fe(L)}function we(L){r.enableZoom&&ve(L),r.enableRotate&&_e(L)}function Me(L){var Y,X;r.enabled!==!1&&(m.length===0&&((Y=r.domElement)==null||Y.ownerDocument.addEventListener("pointermove",Ve),(X=r.domElement)==null||X.ownerDocument.addEventListener("pointerup",tt)),dt(L),L.pointerType==="touch"?ue(L):en(L))}function Ve(L){r.enabled!==!1&&(L.pointerType==="touch"?be(L):U(L))}function tt(L){var Y,X,Ee;ot(L),m.length===0&&((Y=r.domElement)==null||Y.releasePointerCapture(L.pointerId),(X=r.domElement)==null||X.ownerDocument.removeEventListener("pointermove",Ve),(Ee=r.domElement)==null||Ee.ownerDocument.removeEventListener("pointerup",tt)),r.dispatchEvent(a),l=s.NONE}function en(L){let Y;switch(L.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 yt.DOLLY:if(r.enableZoom===!1)return;Te(L),l=s.DOLLY;break;case yt.ROTATE:if(L.ctrlKey||L.metaKey||L.shiftKey){if(r.enablePan===!1)return;ye(L),l=s.PAN}else{if(r.enableRotate===!1)return;ge(L),l=s.ROTATE}break;case yt.PAN:if(L.ctrlKey||L.metaKey||L.shiftKey){if(r.enableRotate===!1)return;ge(L),l=s.ROTATE}else{if(r.enablePan===!1)return;ye(L),l=s.PAN}break;default:l=s.NONE}l!==s.NONE&&r.dispatchEvent(o)}function U(L){if(r.enabled!==!1)switch(l){case s.ROTATE:if(r.enableRotate===!1)return;Oe(L);break;case s.DOLLY:if(r.enableZoom===!1)return;G(L);break;case s.PAN:if(r.enablePan===!1)return;w(L);break}}function K(L){r.enabled===!1||r.enableZoom===!1||l!==s.NONE&&l!==s.ROTATE||(L.preventDefault(),r.dispatchEvent(o),E(L),r.dispatchEvent(a))}function ie(L){r.enabled===!1||r.enablePan===!1||N(L)}function ue(L){switch(bt(L),m.length){case 1:switch(r.touches.ONE){case _t.ROTATE:if(r.enableRotate===!1)return;H(),l=s.TOUCH_ROTATE;break;case _t.PAN:if(r.enablePan===!1)return;z(),l=s.TOUCH_PAN;break;default:l=s.NONE}break;case 2:switch(r.touches.TWO){case _t.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;te(),l=s.TOUCH_DOLLY_PAN;break;case _t.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;xe(),l=s.TOUCH_DOLLY_ROTATE;break;default:l=s.NONE}break;default:l=s.NONE}l!==s.NONE&&r.dispatchEvent(o)}function be(L){switch(bt(L),l){case s.TOUCH_ROTATE:if(r.enableRotate===!1)return;_e(L),r.update();break;case s.TOUCH_PAN:if(r.enablePan===!1)return;fe(L),r.update();break;case s.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;Ie(L),r.update();break;case s.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;we(L),r.update();break;default:l=s.NONE}}function He(L){r.enabled!==!1&&L.preventDefault()}function dt(L){m.push(L)}function ot(L){delete T[L.pointerId];for(let Y=0;Y{ee(L),r.update()},this.dollyOut=(L=F())=>{_(L),r.update()},this.getScale=()=>p,this.setScale=L=>{Z(L),r.update()},this.getZoomScale=()=>F(),n!==void 0&&this.connect(n),this.update()}}new xt;new ae;new Xo;new ae;var uc=Object.defineProperty,cc=(t,e,n)=>e in t?uc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,fi=(t,e,n)=>(cc(t,typeof e!="symbol"?e+"":e,n),n);class Ia{constructor(e){fi(this,"data"),this.data=e}generateShapes(e,n=100,r){const i=[],o={letterSpacing:0,lineHeight:1,...r},a=fc(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 pc=["args","material-uniforms-color-value"];Or.ReflectorShader;new ae;new ae;new ae;var fr;/Mac/.test((fr=globalThis==null?void 0:globalThis.navigator)===null||fr===void 0?void 0:fr.platform);const hc=["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","mouse-buttons","args"],mc=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:_t.ROTATE,TWO:_t.DOLLY_PAN})},enableZoom:{type:Boolean,default:!0},zoomSpeed:{default:1},enableRotate:{type:Boolean,default:!0},rotateSpeed:{default:1},mouseButtons:{default:()=>({LEFT:yt.ROTATE,MIDDLE:yt.DOLLY,RIGHT:yt.PAN})}},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:f,maxAzimuthAngle:p,minAzimuthAngle:d,maxPolarAngle:y,minPolarAngle:x,minDistance:v,maxDistance:k,minZoom:M,maxZoom:A,enableZoom:C,zoomSpeed:P,enableRotate:h,touches:I,rotateSpeed:b,target:g,mouseButtons:m}=Jr(r),{camera:T,renderer:S,extend:F,controls:D,invalidate:B}=Yn(),j=Yo(null);F({OrbitControls:lc}),Fe(j,Z=>{J(),Z&&o.value?D.value=Z:D.value=null});function J(){ar(j.value,"change",()=>{i("change",j.value),B()}),ar(j.value,"start",()=>i("start",j.value)),ar(j.value,"end",()=>i("end",j.value))}const{onBeforeRender:oe}=On();return oe(({invalidate:Z})=>{j.value&&(l.value||a.value)&&(j.value.update(),a.value&&Z())}),Ot(()=>{j.value&&j.value.dispose()}),e({instance:j}),(Z,_)=>(Z.camera||V(T))&&(Z.domElement||V(S))?(Q(),re("TresOrbitControls",{key:0,ref_key:"controlsRef",ref:j,target:V(g),"auto-rotate":V(a),"auto-rotate-speed":V(s),"enable-damping":V(l),"damping-factor":V(u),"enable-pan":V(c),"key-pan-speed":V(f),keys:Z.keys,"max-azimuth-angle":V(p),"min-azimuth-angle":V(d),"max-polar-angle":V(y),"min-polar-angle":V(x),"min-distance":V(v),"max-distance":V(k),"min-zoom":V(M),"max-zoom":V(A),touches:V(I),"enable-zoom":V(C),"zoom-speed":V(P),"enable-rotate":V(h),"rotate-speed":V(b),"mouse-buttons":V(m),args:[Z.camera||V(T),Z.domElement||V(S).domElement]},null,8,hc)):it("",!0)}});function Sn(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 Yi={exports:{}},qi;function gc(){return qi||(qi=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 f=typeof Sn=="function"&&Sn;if(!c&&f)return f(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 d=r[u][1][p];return a(d||p)},c,c.exports,n,r,i,o)}return i[u].exports}for(var s=typeof Sn=="function"&&Sn,l=0;l>16),B((65280&m)>>8),B(255&m);return T==2?B(255&(m=I(b.charAt(g))<<2|I(b.charAt(g+1))>>4)):T==1&&(B((m=I(b.charAt(g))<<10|I(b.charAt(g+1))<<4|I(b.charAt(g+2))>>2)>>8&255),B(255&m)),S},y.fromByteArray=function(b){var g,m,T,S,F=b.length%3,D="";function B(j){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(j)}for(g=0,T=b.length-F;g>18&63)+B(S>>12&63)+B(S>>6&63)+B(63&S);switch(F){case 1:D=(D+=B((m=b[b.length-1])>>2))+B(m<<4&63)+"==";break;case 2:D=(D=(D+=B((m=(b[b.length-2]<<8)+b[b.length-1])>>10))+B(m>>4&63))+B(m<<2&63)+"="}return D}})(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,v,l,u,c,f,p,d){var y=n("base64-js"),x=n("ieee754");function v(w,E,N){if(!(this instanceof v))return new v(w,E,N);var H,z,q,te,xe=typeof w;if(E==="base64"&&xe=="string")for(w=(te=w).trim?te.trim():te.replace(/^\s+|\s+$/g,"");w.length%4!=0;)w+="=";if(xe=="number")H=oe(w);else if(xe=="string")H=v.byteLength(w,E);else{if(xe!="object")throw new Error("First argument needs to be a number, array or string.");H=oe(w.length)}if(v._useTypedArrays?z=v._augment(new Uint8Array(H)):((z=this).length=H,z._isBuffer=!0),v._useTypedArrays&&typeof w.byteLength=="number")z._set(w);else if(Z(te=w)||v.isBuffer(te)||te&&typeof te=="object"&&typeof te.length=="number")for(q=0;q>8,te=te%256,xe.push(te),xe.push(q);return xe}(E),w,N,H)}function A(w,E,N){var H="";N=Math.min(w.length,N);for(var z=E;z>>0)):(E+1>>0),z}function h(w,E,N,H){if(H||(G(typeof N=="boolean","missing or invalid endian"),G(E!=null,"missing offset"),G(E+1>>8*(H?q:1-q)}function T(w,E,N,H,z){if(z||(G(E!=null,"missing value"),G(typeof H=="boolean","missing or invalid endian"),G(N!=null,"missing offset"),G(N+3>>8*(H?q:3-q)&255}function S(w,E,N,H,z){z||(G(E!=null,"missing value"),G(typeof H=="boolean","missing or invalid endian"),G(N!=null,"missing offset"),G(N+1this.length&&(H=this.length);var z=(H=w.length-E=this.length))return this[w]},v.prototype.readUInt16LE=function(w,E){return C(this,w,!0,E)},v.prototype.readUInt16BE=function(w,E){return C(this,w,!1,E)},v.prototype.readUInt32LE=function(w,E){return P(this,w,!0,E)},v.prototype.readUInt32BE=function(w,E){return P(this,w,!1,E)},v.prototype.readInt8=function(w,E){if(E||(G(w!=null,"missing offset"),G(w=this.length))return 128&this[w]?-1*(255-this[w]+1):this[w]},v.prototype.readInt16LE=function(w,E){return h(this,w,!0,E)},v.prototype.readInt16BE=function(w,E){return h(this,w,!1,E)},v.prototype.readInt32LE=function(w,E){return I(this,w,!0,E)},v.prototype.readInt32BE=function(w,E){return I(this,w,!1,E)},v.prototype.readFloatLE=function(w,E){return b(this,w,!0,E)},v.prototype.readFloatBE=function(w,E){return b(this,w,!1,E)},v.prototype.readDoubleLE=function(w,E){return g(this,w,!0,E)},v.prototype.readDoubleBE=function(w,E){return g(this,w,!1,E)},v.prototype.writeUInt8=function(w,E,N){N||(G(w!=null,"missing value"),G(E!=null,"missing offset"),G(E=this.length||(this[E]=w)},v.prototype.writeUInt16LE=function(w,E,N){m(this,w,E,!0,N)},v.prototype.writeUInt16BE=function(w,E,N){m(this,w,E,!1,N)},v.prototype.writeUInt32LE=function(w,E,N){T(this,w,E,!0,N)},v.prototype.writeUInt32BE=function(w,E,N){T(this,w,E,!1,N)},v.prototype.writeInt8=function(w,E,N){N||(G(w!=null,"missing value"),G(E!=null,"missing offset"),G(E=this.length||(0<=w?this.writeUInt8(w,E,N):this.writeUInt8(255+w+1,E,N))},v.prototype.writeInt16LE=function(w,E,N){S(this,w,E,!0,N)},v.prototype.writeInt16BE=function(w,E,N){S(this,w,E,!1,N)},v.prototype.writeInt32LE=function(w,E,N){F(this,w,E,!0,N)},v.prototype.writeInt32BE=function(w,E,N){F(this,w,E,!1,N)},v.prototype.writeFloatLE=function(w,E,N){D(this,w,E,!0,N)},v.prototype.writeFloatBE=function(w,E,N){D(this,w,E,!1,N)},v.prototype.writeDoubleLE=function(w,E,N){B(this,w,E,!0,N)},v.prototype.writeDoubleBE=function(w,E,N){B(this,w,E,!1,N)},v.prototype.fill=function(w,E,N){if(E=E||0,N=N||this.length,G(typeof(w=typeof(w=w||0)=="string"?w.charCodeAt(0):w)=="number"&&!isNaN(w),"value is not a number"),G(E<=N,"end < start"),N!==E&&this.length!==0){G(0<=E&&E"},v.prototype.toArrayBuffer=function(){if(typeof Uint8Array>"u")throw new Error("Buffer.toArrayBuffer not supported in this browser");if(v._useTypedArrays)return new v(this).buffer;for(var w=new Uint8Array(this.length),E=0,N=w.length;E=E.length||z>=w.length);z++)E[z+N]=w[z];return z}function ge(w){try{return decodeURIComponent(w)}catch{return"�"}}function Te(w,E){G(typeof w=="number","cannot write a non-number as a number"),G(0<=w,"specified a negative value for writing an unsigned value"),G(w<=E,"value is larger than maximum value for type"),G(Math.floor(w)===w,"value has a fractional component")}function ye(w,E,N){G(typeof w=="number","cannot write a non-number as a number"),G(w<=E,"value larger than maximum allowed value"),G(N<=w,"value smaller than minimum allowed value"),G(Math.floor(w)===w,"value has a fractional component")}function Oe(w,E,N){G(typeof w=="number","cannot write a non-number as a number"),G(w<=E,"value larger than maximum allowed value"),G(N<=w,"value smaller than minimum allowed value")}function G(w,E){if(!w)throw new Error(E||"Failed assertion")}v._augment=function(w){return w._isBuffer=!0,w._get=w.get,w._set=w.set,w.get=j.get,w.set=j.set,w.write=j.write,w.toString=j.toString,w.toLocaleString=j.toString,w.toJSON=j.toJSON,w.copy=j.copy,w.slice=j.slice,w.readUInt8=j.readUInt8,w.readUInt16LE=j.readUInt16LE,w.readUInt16BE=j.readUInt16BE,w.readUInt32LE=j.readUInt32LE,w.readUInt32BE=j.readUInt32BE,w.readInt8=j.readInt8,w.readInt16LE=j.readInt16LE,w.readInt16BE=j.readInt16BE,w.readInt32LE=j.readInt32LE,w.readInt32BE=j.readInt32BE,w.readFloatLE=j.readFloatLE,w.readFloatBE=j.readFloatBE,w.readDoubleLE=j.readDoubleLE,w.readDoubleBE=j.readDoubleBE,w.writeUInt8=j.writeUInt8,w.writeUInt16LE=j.writeUInt16LE,w.writeUInt16BE=j.writeUInt16BE,w.writeUInt32LE=j.writeUInt32LE,w.writeUInt32BE=j.writeUInt32BE,w.writeInt8=j.writeInt8,w.writeInt16LE=j.writeInt16LE,w.writeInt16BE=j.writeInt16BE,w.writeInt32LE=j.writeInt32LE,w.writeInt32BE=j.writeInt32BE,w.writeFloatLE=j.writeFloatLE,w.writeFloatBE=j.writeFloatBE,w.writeDoubleLE=j.writeDoubleLE,w.writeDoubleBE=j.writeDoubleBE,w.fill=j.fill,w.inspect=j.inspect,w.toArrayBuffer=j.toArrayBuffer,w}}).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,y,l,u,c,f,p,d){var y=n("buffer").Buffer,x=4,v=new y(x);v.fill(0),r.exports={hash:function(k,M,A,C){for(var P=M(function(m,T){m.length%x!=0&&(S=m.length+(x-m.length%x),m=y.concat([m,v],S));for(var S,F=[],D=T?m.readInt32BE:m.readInt32LE,B=0;BA?J=j(J):J.length>5]|=128<>>9<<4)]=I;for(var b=1732584193,g=-271733879,m=-1732584194,T=271733878,S=0;S>>32-m,b)}function k(h,I,b,g,m,T,S){return v(I&b|~I&g,h,I,m,T,S)}function M(h,I,b,g,m,T,S){return v(I&g|b&~g,h,I,m,T,S)}function A(h,I,b,g,m,T,S){return v(I^b^g,h,I,m,T,S)}function C(h,I,b,g,m,T,S){return v(b^(I|~g),h,I,m,T,S)}function P(h,I){var b=(65535&h)+(65535&I);return(h>>16)+(I>>16)+(b>>16)<<16|65535&b}r.exports=function(h){return y.hash(h,x,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,f,p,d){r.exports=function(y){for(var x,v=new Array(y),k=0;k>>((3&k)<<3)&255;return v}}).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,f,p,d){var y=n("./helpers");function x(M,A){M[A>>5]|=128<<24-A%32,M[15+(A+64>>9<<4)]=A;for(var C,P,h,I=Array(80),b=1732584193,g=-271733879,m=-1732584194,T=271733878,S=-1009589776,F=0;F>16)+(A>>16)+(C>>16)<<16|65535&C}function k(M,A){return M<>>32-A}r.exports=function(M){return y.hash(M,x,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,f,p,d){function y(A,C){var P=(65535&A)+(65535&C);return(A>>16)+(C>>16)+(P>>16)<<16|65535&P}function x(A,C){var P,h=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),I=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),b=new Array(64);A[C>>5]|=128<<24-C%32,A[15+(C+64>>9<<4)]=C;for(var g,m,T=0;T>>C|A<<32-C},M=function(A,C){return A>>>C};r.exports=function(A){return v.hash(A,x,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,f,p,d){i.read=function(y,x,v,k,T){var A,C,P=8*T-k-1,h=(1<>1,b=-7,g=v?T-1:0,m=v?-1:1,T=y[x+g];for(g+=m,A=T&(1<<-b)-1,T>>=-b,b+=P;0>=-b,b+=k;0>1,g=M===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=k?0:S-1,T=k?1:-1,S=x<0||x===0&&1/x<0?1:0;for(x=Math.abs(x),isNaN(x)||x===1/0?(P=isNaN(x)?1:0,C=I):(C=Math.floor(Math.log(x)/Math.LN2),x*(k=Math.pow(2,-C))<1&&(C--,k*=2),2<=(x+=1<=C+b?g/k:g*Math.pow(2,1-b))*k&&(C++,k/=2),I<=C+b?(P=0,C=I):1<=C+b?(P=(x*k-1)*Math.pow(2,M),C+=b):(P=x*Math.pow(2,b-1)*Math.pow(2,M),C=0));8<=M;y[v+m]=255&P,m+=T,P/=256,M-=8);for(C=C<>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]),Xi}var Zi,Ji;function Ca(){return Ji||(Ji=1,Zi=["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"]),Zi}var dr,eo;function xc(){if(eo)return dr;eo=1;var t=Ra();return dr=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"]),dr}var pr,to;function vc(){if(to)return pr;to=1;var t=Ca();return t=t.slice().filter(function(e){return!/^(gl\_|texture)/.test(e)}),pr=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"]),pr}var hr,no;function bc(){if(no)return hr;no=1,hr=C;var t=Ra(),e=yc(),n=Ca(),r=xc(),i=vc(),o=999,a=9999,s=0,l=1,u=2,c=3,f=4,p=5,d=6,y=7,x=8,v=9,k=10,M=11,A=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"];function C(P){var h=0,I=0,b=o,g,m,T=[],S=[],F=1,D=0,B=0,j=!1,J=!1,oe="",Z;P=P||{};var _=n,ee=t;P.version==="300 es"&&(_=i,ee=r);for(var me={},R={},h=0;h<_.length;h++)me[_[h]]=!0;for(var h=0;h0)continue;we=fe.slice(0,1).join("")}return ge(we),B+=we.length,T=T.slice(we.length),T.length}while(!0)}function q(){return/[^a-fA-F0-9]/.test(g)?(ge(T.join("")),b=o,h):(T.push(g),m=g,h+1)}function te(){return g==="."||/[eE]/.test(g)?(T.push(g),b=p,m=g,h+1):g==="x"&&T.length===1&&T[0]==="0"?(b=M,T.push(g),m=g,h+1):/[^\d]/.test(g)?(ge(T.join("")),b=o,h):(T.push(g),m=g,h+1)}function xe(){return g==="f"&&(T.push(g),m=g,h+=1),/[eE]/.test(g)||(g==="-"||g==="+")&&/[eE]/.test(m)?(T.push(g),m=g,h+1):/[^\d]/.test(g)?(ge(T.join("")),b=o,h):(T.push(g),m=g,h+1)}function _e(){if(/[^\d\w_]/.test(g)){var fe=T.join("");return R[fe]?b=x:me[fe]?b=y:b=d,ge(T.join("")),b=o,h}return T.push(g),m=g,h+1}}return hr}var mr,ro;function wc(){if(ro)return mr;ro=1;var t=bc();mr=e;function e(n,r){var i=t(r),o=[];return o=o.concat(i(n)),o=o.concat(i(null)),o}return mr}wc();function kc(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 String(t)}function Tc(t){var e=kc(t,"string");return typeof e=="symbol"?e:String(e)}function Se(t,e,n){return e=Tc(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var le={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"},Ge,zt;Ge={},Se(Ge,"".concat(le.normal),{"#include ":` + vec3 objectNormal = `.concat(le.normal,`; + #ifdef USE_TANGENT + vec3 objectTangent = vec3( tangent.xyz ); + #endif + `)}),Se(Ge,"".concat(le.position),{"#include ":` + vec3 transformed = `.concat(le.position,`; + `)}),Se(Ge,"".concat(le.positionRaw),{"#include ":` + vec4 csm_internal_positionUnprojected = `.concat(le.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; + `)}),Se(Ge,"".concat(le.pointSize),{"gl_PointSize = size;":` + gl_PointSize = `.concat(le.pointSize,`; + `)}),Se(Ge,"".concat(le.diffuseColor),{"#include ":` + #include + diffuseColor = `.concat(le.diffuseColor,`; + `)}),Se(Ge,"".concat(le.fragColor),{"#include ":` + #include + gl_FragColor = `.concat(le.fragColor,`; + `)}),Se(Ge,"".concat(le.emissive),{"vec3 totalEmissiveRadiance = emissive;":` + vec3 totalEmissiveRadiance = `.concat(le.emissive,`; + `)}),Se(Ge,"".concat(le.roughness),{"#include ":` + #include + roughnessFactor = `.concat(le.roughness,`; + `)}),Se(Ge,"".concat(le.metalness),{"#include ":` + #include + metalnessFactor = `.concat(le.metalness,`; + `)}),Se(Ge,"".concat(le.ao),{"#include ":` + #include + reflectedLight.indirectDiffuse *= 1. - `.concat(le.ao,`; + `)}),Se(Ge,"".concat(le.bump),{"#include ":` + #include + + vec3 csm_internal_orthogonal = `.concat(le.bump," - (dot(").concat(le.bump,`, normal) * normal); + vec3 csm_internal_projectedbump = mat3(csm_internal_vModelViewMatrix) * csm_internal_orthogonal; + normal = normalize(normal - csm_internal_projectedbump); + `)}),Se(Ge,"".concat(le.depthAlpha),{"gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );":` + gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity * `.concat(le.depthAlpha,` ); + `),"gl_FragColor = packDepthToRGBA( fragCoordZ );":` + gl_FragColor = packDepthToRGBA( fragCoordZ ); + gl_FragColor.a *= `.concat(le.depthAlpha,`; + `)});zt={},Se(zt,"".concat(le.position),{"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );":` + gl_Position = projectionMatrix * modelViewMatrix * vec4( `.concat(le.position,`, 1.0 ); + `)}),Se(zt,"".concat(le.positionRaw),{"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );":` + gl_Position = `.concat(le.position,`; + `)}),Se(zt,"".concat(le.diffuseColor),{"gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );":` + gl_FragColor = `.concat(le.diffuseColor,`; + `)}),Se(zt,"".concat(le.fragColor),{"gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );":` + gl_FragColor = `.concat(le.fragColor,`; + `)});var $e;$e={},Se($e,"".concat(le.position),"*"),Se($e,"".concat(le.positionRaw),"*"),Se($e,"".concat(le.normal),"*"),Se($e,"".concat(le.pointSize),["PointsMaterial"]),Se($e,"".concat(le.diffuseColor),"*"),Se($e,"".concat(le.fragColor),"*"),Se($e,"".concat(le.emissive),["MeshStandardMaterial","MeshPhysicalMaterial"]),Se($e,"".concat(le.roughness),["MeshStandardMaterial","MeshPhysicalMaterial"]),Se($e,"".concat(le.metalness),["MeshStandardMaterial","MeshPhysicalMaterial"]),Se($e,"".concat(le.ao),["MeshStandardMaterial","MeshPhysicalMaterial","MeshBasicMaterial","MeshLambertMaterial","MeshPhongMaterial","MeshToonMaterial"]),Se($e,"".concat(le.bump),["MeshLambertMaterial","MeshMatcapMaterial","MeshNormalMaterial","MeshPhongMaterial","MeshPhysicalMaterial","MeshStandardMaterial","MeshToonMaterial","ShadowMaterial"]),Se($e,"".concat(le.depthAlpha),"*");var _c=`void main() { + gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); +}`,Ac=`#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 vn=new ae(0,0,0),di=new ae(0,0,0),Ec=new ae(0,0,0);function io(t,e,n){const r=vn.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,r.z]}function Mc(t,e){const n=vn.setFromMatrixPosition(t.matrixWorld),r=di.setFromMatrixPosition(e.matrixWorld),i=n.sub(r),o=e.getWorldDirection(Ec);return i.angleTo(o)>Math.PI/2}function Sc(t,e,n,r){const i=vn.setFromMatrixPosition(t.matrixWorld),o=i.clone();o.project(e),n.setFromCamera(new Pe(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 Na(t,e,n=""){let r="matrix3d(";for(let i=0;i!==16;i++)r+=Fr(e[i]*t.elements[i])+(i!==15?",":")");return n+r}const Cc=(t=>e=>Na(e,t))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),Nc=(t=>(e,n)=>Na(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]),Lc=["geometry","material"];new Zo;var zr={exports:{}},Pc=zr.exports,oo;function Dc(){return oo||(oo=1,function(t,e){(function(n,r){t.exports=r()})(Pc,function(){var n=function(){function r(d){return a.appendChild(d.dom),d}function i(d){for(var y=0;yl+1e3&&(c.update(1e3*u/(d-l),100),l=d,u=0,p)){var y=performance.memory;p.update(y.usedJSHeapSize/1048576,y.jsHeapSizeLimit/1048576)}return d},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,f=48*u,p=3*u,d=2*u,y=3*u,x=15*u,v=74*u,k=30*u,M=document.createElement("canvas");M.width=c,M.height=f,M.style.cssText="width:80px;height:48px";var A=M.getContext("2d");return A.font="bold "+9*u+"px Helvetica,Arial,sans-serif",A.textBaseline="top",A.fillStyle=o,A.fillRect(0,0,c,f),A.fillStyle=i,A.fillText(r,p,d),A.fillRect(y,x,v,k),A.fillStyle=o,A.globalAlpha=.9,A.fillRect(y,x,v,k),{dom:M,update:function(C,P){a=Math.min(a,C),s=Math.max(s,C),A.fillStyle=o,A.globalAlpha=1,A.fillRect(0,0,c,x),A.fillStyle=i,A.fillText(l(C)+" "+r+" ("+l(a)+"-"+l(s)+")",p,d),A.drawImage(M,y+u,x,v-u,k,y,x,v-u,k),A.fillRect(y+v-u,x,u,k),A.fillStyle=o,A.globalAlpha=.9,A.fillRect(y+v-u,x,u,l((1-C/P)*k))}}},n})}(zr)),zr.exports}Dc();const Oc={key:0,args:[0,1,64]},Bc={key:1,args:[.5,1,64]},Fc={key:2},zc=["tone-mapped","map","side","color"];new ze(16777215);const Ut=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=W(null);function o(y,x,v){return Math.min(Math.max(y,x),v)}function a(y){const x=y.toString();return x.includes("e-")?Number.parseInt(x.split("e-")[1],10):x.includes(".")?x.split(".")[1].length:0}function s(y,x){const v=a(x),k=10**(v+3);return Number.parseFloat((y*k/k).toFixed(v))}const l=je(()=>s(o(n.modelValue,n.min,n.max),n.step)),u=je(()=>{const y=(l.value-n.min)/(n.max-n.min)*100;return{width:`${y}%`,backgroundSize:`${y}% 100%`}});function c(y){if(!i.value)return l.value;const x=i.value.getBoundingClientRect(),k=(y.clientX-x.left)/x.width,M=n.max-n.min,A=n.min+M*k,C=Math.round(A/n.step)*n.step;return Math.min(Math.max(C,n.min),n.max)}function f(y){if(n.disabled)return;const x=c(y);r("update:modelValue",x)}function p(y){if(n.disabled)return;y.preventDefault();const x=c(y);r("update:modelValue",x),window.addEventListener("mousemove",f),window.addEventListener("mouseup",d)}function d(y){window.removeEventListener("mousemove",f),window.removeEventListener("mouseup",d)}return Ot(()=>{window.removeEventListener("mousemove",f),window.removeEventListener("mouseup",d)}),(y,x)=>(Q(),re("span",{ref_key:"sliderRef",ref:i,class:st(["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},[O("span",{style:Lr(u.value),bg:"[#cabeff] dark:[#4e34b9]",relative:"",block:"","rounded-sm":"",h:"[14px]"},null,4),O("span",{role:"slider",class:"slider-thumb",style:Lr({left:`${(l.value-t.min)/(t.max-t.min)*100}%`}),absolute:"","rounded-sm":"",w:"[1px]",h:"[14px]",bg:"neutral-100 dark:neutral-400",top:"50%",transform:"translate-x-[50%] translate-y-[-50%]"},null,4)],34))}});function ao(t,e){if(e===Gs)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),t;if(e===Pr||e===oa){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 bf(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[f]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+f+'".')}}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 jc(){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 de={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 Vc{constructor(e){this.parser=e,this.name=de.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 nf{constructor(e){this.parser=e,this.name=de.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 rf{constructor(e){this.parser=e,this.name=de.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 of{constructor(e){this.name=de.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,f=i.byteStride,p=new Uint8Array(s,l,u);return a.decodeGltfBufferAsync?a.decodeGltfBufferAsync(c,f,p,i.mode,i.filter).then(function(d){return d.buffer}):a.ready.then(function(){const d=new ArrayBuffer(c*f);return a.decodeGltfBuffer(new Uint8Array(d),c,f,p,i.mode,i.filter),d})})}else return null}}class af{constructor(e){this.name=de.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!==nt.TRIANGLES&&u.mode!==nt.TRIANGLE_STRIP&&u.mode!==nt.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(),f=c.isGroup?c.children:[c],p=u[0].count,d=[];for(const y of f){const x=new xt,v=new ae,k=new Bn,M=new ae(1,1,1),A=new Ws(y.geometry,y.material,p);for(let C=0;C0||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 vf=new xt;class bf{constructor(e={},n={}){this.json=e,this.extensions={},this.plugins={},this.options=n,this.cache=new jc,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 Qs(this.options.manager):this.textureLoader=new Zs(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new aa(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 Rt(o,s,i),gt(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&&v.setY(g,h[I*l+1]),l>=3&&v.setZ(g,h[I*l+2]),l>=4&&v.setW(g,h[I*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}v.normalized=y}return v})}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=lo[p.magFilter]||zn,c.minFilter=lo[p.minFilter]||ii,c.wrapS=uo[p.wrapS]||Un,c.wrapT=uo[p.wrapT]||Un,c.generateMipmaps=!c.isCompressedTexture&&c.minFilter!==Lt&&c.minFilter!==zn,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(f=>f.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(f){u=!0;const p=new Blob([f],{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(f){return new Promise(function(p,d){let y=p;n.isImageBitmapLoader===!0&&(y=function(x){const v=new Fn(x);v.needsUpdate=!0,p(v)}),n.load(cn.resolveURL(f,o.path),y,void 0,d)})}).then(function(f){return u===!0&&s.revokeObjectURL(l),gt(f,a),f.userData.mimeType=a.mimeType||xf(a.uri),f}).catch(function(f){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),f});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[de.KHR_TEXTURE_TRANSFORM]){const s=r.extensions!==void 0?r.extensions[de.KHR_TEXTURE_TRANSFORM]:void 0;if(s){const l=o.associations.get(a);a=o.extensions[de.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 Js,nr.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 el,nr.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 sa}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[de.KHR_MATERIALS_UNLIT]){const f=i[de.KHR_MATERIALS_UNLIT];a=f.getMaterialType(),u.push(f.extendParams(s,o,n))}else{const f=o.pbrMetallicRoughness||{};if(s.color=new ze(1,1,1),s.opacity=1,Array.isArray(f.baseColorFactor)){const p=f.baseColorFactor;s.color.setRGB(p[0],p[1],p[2],vt),s.opacity=p[3]}f.baseColorTexture!==void 0&&u.push(n.assignTexture(s,"map",f.baseColorTexture,mn)),s.metalness=f.metallicFactor!==void 0?f.metallicFactor:1,s.roughness=f.roughnessFactor!==void 0?f.roughnessFactor:1,f.metallicRoughnessTexture!==void 0&&(u.push(n.assignTexture(s,"metalnessMap",f.metallicRoughnessTexture)),u.push(n.assignTexture(s,"roughnessMap",f.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=qn);const c=o.alphaMode||yr.OPAQUE;if(c===yr.BLEND?(s.transparent=!0,s.depthWrite=!1):(s.transparent=!1,c===yr.MASK&&(s.alphaTest=o.alphaCutoff!==void 0?o.alphaCutoff:.5)),o.normalTexture!==void 0&&a!==Vt&&(u.push(n.assignTexture(s,"normalMap",o.normalTexture)),s.normalScale=new Pe(1,1),o.normalTexture.scale!==void 0)){const f=o.normalTexture.scale;s.normalScale.set(f,f)}if(o.occlusionTexture!==void 0&&a!==Vt&&(u.push(n.assignTexture(s,"aoMap",o.occlusionTexture)),o.occlusionTexture.strength!==void 0&&(s.aoMapIntensity=o.occlusionTexture.strength)),o.emissiveFactor!==void 0&&a!==Vt){const f=o.emissiveFactor;s.emissive=new ze().setRGB(f[0],f[1],f[2],vt)}return o.emissiveTexture!==void 0&&a!==Vt&&u.push(n.assignTexture(s,"emissiveMap",o.emissiveTexture,mn)),Promise.all(u).then(function(){const f=new a(s);return o.name&&(f.name=o.name),gt(f,o),n.associations.set(f,{materials:e}),o.extensions&&Rt(i,f,o),f})}createUniqueName(e){const n=hn.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[de.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(s,n).then(function(l){return co(l,s,n)})}const a=[];for(let s=0,l=e.length;s0&&gf(k,o),k.name=n.createUniqueName(o.name||"mesh_"+e),gt(k,o),v.extensions&&Rt(i,k,v),n.assignFinalMaterial(k),f.push(k)}for(let d=0,y=f.length;d1?c=new rr:u.length===1?c=u[0]:c=new oi,c!==u[0])for(let f=0,p=u.length;f{const f=new Map;for(const[p,d]of i.associations)(p instanceof nr||p instanceof Fn)&&f.set(p,d);return c.traverse(p=>{const d=i.associations.get(p);d!=null&&f.set(p,d)}),f};return i.associations=u(o),o})}_createAnimationTracks(e,n,r,i,o){const a=[],s=e.name?e.name:e.uuid,l=[];kt[o.path]===kt.weights?e.traverse(function(p){p.morphTargetInfluences&&l.push(p.name?p.name:p.uuid)}):l.push(s);let u;switch(kt[o.path]){case kt.weights:u=Ii;break;case kt.rotation:u=Ri;break;case kt.translation:case kt.scale:u=Si;break;default:switch(r.itemSize){case 1:u=Ii;break;case 2:case 3:default:u=Si;break}break}const c=i.interpolation!==void 0?pf[i.interpolation]:ei,f=this._getArrayFromAccessor(r);for(let p=0,d=l.length;pnew kl(t)),Ct.register(t=>new Tl(t)),Ct)}async function kf(t){const r=(await Da().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 Tf(t,e){if(!t){console.warn("No VRM found");return}if(e)return _l(e,t)}function _f(){const t=W(!1),e=W(0),n=W(0),r=.2,i=1,o=6,a=W(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 Af(){let t=-1,e,n=0;function r(){e?e.set(on(-.25,.25),on(-.2,.15),-.65):e=new ae(on(-.25,.25),on(-.2,.15),-.65)}function i(o,a){var s;!(o!=null&&o.expressionManager)||!o.lookAt||(n>=t?(r(),n=0,t=Al()/1e3):e||r(),o.lookAt.target||(o.lookAt.target=new oi),o.lookAt.target.position.lerp(e,on(.2,.5)),(s=o.lookAt)==null||s.update(a),n+=a)}return{update:i}}async function Ef(t,e){const i=(await Da().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(Dr.removeUnnecessaryVertices(o.scene),Dr.combineSkeletons(o.scene),o.scene.traverse(a=>{a.frustumCulled=!1}),o.lookAt){const a=new El(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 Mf(t){const e=W(null),n=W(!1),r=W(0),i=W(new Map),o=W(new Map),a=W(),s=(k,M,A)=>k+(M-k)*A,l=k=>k<.5?4*k*k*k:1-(-2*k+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)},f=k=>{var A;if(c(),!u.has(k)){console.warn(`Emotion ${k} not found`);return}const M=u.get(k);if(e.value=k,n.value=!0,r.value=0,t.expressionManager){const C=Object.keys(t.expressionManager.expressionMap);for(const P of C)t.expressionManager.setValue(P,0)}i.value.clear(),o.value.clear();for(const C of M.expression||[]){const P=((A=t.expressionManager)==null?void 0:A.getValue(C.name))||0;i.value.set(C.name,P),o.value.set(C.name,C.value)}};return{currentEmotion:e,isTransitioning:n,setEmotion:f,setEmotionWithResetAfter:(k,M)=>{c(),f(k),a.value=setTimeout(()=>{f("neutral"),a.value=void 0},M)},update:k=>{var C;if(!n.value||!e.value)return;const A=u.get(e.value).blendDuration||.3;r.value+=k/A,r.value>=1&&(r.value=1,n.value=!1);for(const[P,h]of o.value){const I=i.value.get(P)||0,b=s(I,h,l(r.value));(C=t.expressionManager)==null||C.setValue(P,b)}},addEmotionState:(k,M)=>{u.set(k,M)},removeEmotionState:k=>{u.delete(k)},dispose:()=>{c()}}}const Sf=Be({__name:"Model",props:{model:null,idleAnimation:null,loadAnimations:null,position:null,paused:{type:Boolean}},emits:["loadModelProgress","error"],setup(t,{expose:e,emit:n}){const r=t,i=n;let o;const a=W(),s=W(),{scene:l}=Yn(),{onBeforeRender:u}=On(),c=_f(),f=Af(),p=W();Fe(()=>r.position,([x,v,k])=>{a.value&&a.value.scene.position.set(x,v,k)}),pn(async()=>{if(l.value)try{const x=await Ef(r.model,{scene:l.value,lookAt:!0,position:r.position,onProgress:M=>i("loadModelProgress",Number.parseFloat((100*(M.loaded/M.total)).toFixed(2)))});if(!x){console.warn("No VRM model loaded");return}const v=await kf(r.idleAnimation),k=await Tf(x,v);if(!k){console.warn("No VRM animation loaded");return}s.value=new fl(x.scene),s.value.clipAction(k).play(),p.value=Mf(x),a.value=x,o=u(({delta:M})=>{var A,C,P;(A=s.value)==null||A.update(M),(C=a.value)==null||C.update(M),c.update(a.value,M),f.update(a.value,M),(P=p.value)==null||P.update(M)}).off}catch(x){i("error",x)}}),Ot(()=>{o==null||o(),a.value&&(a.value.scene.removeFromParent(),Dr.deepDispose(a.value.scene))}),e({setExpression(x){var v;(v=p.value)==null||v.setEmotionWithResetAfter(x,1e3)}});const{pause:d,resume:y}=On();return Fe(()=>r.paused,x=>{x?d():y()}),(x,v)=>gn(x.$slots,"default")}}),If=["position"],Rf={absolute:"",bottom:"3",right:"3"},Cf={flex:"~ row","cursor-pointer":""},Nf=["checked","aria-checked"],Lf={key:0,"min-w":"50vw",z:"{var x;(x=p.value)==null||x.setExpression(y)}}),(y,x)=>(Q(),Xt(ha,{relative:""},{default:Ue(({height:v,width:k})=>[ke(V(dl),{alpha:!0,antialias:!0,width:k,height:v},{default:Ue(()=>[ke(V(mc)),O("TresPerspectiveCamera",{position:[a.value,s.value,l.value]},null,8,If),x[14]||(x[14]=O("TresDirectionalLight",{color:16777215,intensity:1.2,position:[1,1,1]},null,-1)),x[15]||(x[15]=O("TresAmbientLight",{color:16777215,intensity:1.5},null,-1)),ke(Sf,{ref_key:"modelRef",ref:p,model:r.model,"idle-animation":r.idleAnimation,position:[u.value,c.value,f.value],paused:r.paused,onLoadModelProgress:x[0]||(x[0]=M=>i("loadModelProgress",M)),onError:x[1]||(x[1]=M=>i("error",M))},null,8,["model","idle-animation","position","paused"])]),_:2},1032,["width","height"]),O("div",Rf,[O("div",Cf,[O("label",{class:st([o.value?"bg-neutral-300 dark:bg-neutral-200":"bg-neutral-100 dark:bg-neutral-700"]),transition:"all ease-in-out duration-500",text:"lg neutral-500 dark:neutral-400","m-1":"","h-fit":"","w-fit":"","cursor-pointer":"","appearance-none":"","gap-1":"","rounded-lg":"","rounded-md":"","border-none":"","p-2":"","outline-none":""},[At(O("input",{"onUpdate:modelValue":x[2]||(x[2]=M=>o.value=M),checked:o.value,"aria-checked":o.value,name:"showLive2DViewerInspector",type:"checkbox",hidden:"","appearance-none":"","outline-none":""},null,8,Nf),[[Zr,o.value]]),x[16]||(x[16]=O("div",{"select-none":""},[O("div",{"i-solar:bug-bold-duotone":""})],-1))],2)]),ke(ui,null,{default:Ue(()=>[o.value?(Q(),re("div",Lf,[O("div",Pf,[O("div",Df,[O("span",null,he(V(d)("stage.viewers.debug-menu.vrm.model.title")),1)]),ke(Pi,{"h-fit":"","w-full":"",flex:"~ col",border:"~ gray/25 rounded-lg",divide:"y dashed gray/25","of-clip":"","shadow-sm":""},{label:Ue(()=>[O("span",Of,he(V(d)("stage.viewers.debug-menu.vrm.camera")),1)]),default:Ue(()=>[O("div",Bf,[x[17]||(x[17]=O("div",{text:"neutral-400 dark:neutral-500"},[O("span",null,"X")],-1)),O("label",Ff,[ke(Ut,{modelValue:a.value,"onUpdate:modelValue":x[3]||(x[3]=M=>a.value=M),min:-10,max:10,step:.01},null,8,["modelValue"])]),O("div",zf,[O("span",null,he(a.value),1)]),x[18]||(x[18]=O("div",{text:"neutral-400 dark:neutral-500"},[O("span",null,"Y")],-1)),O("label",Uf,[ke(Ut,{modelValue:s.value,"onUpdate:modelValue":x[4]||(x[4]=M=>s.value=M),min:-10,max:10,step:.01},null,8,["modelValue"])]),O("div",jf,[O("span",null,he(s.value),1)]),x[19]||(x[19]=O("div",{text:"neutral-400 dark:neutral-500"},[O("span",null,"Z")],-1)),O("label",Vf,[ke(Ut,{modelValue:l.value,"onUpdate:modelValue":x[5]||(x[5]=M=>l.value=M),min:-10,max:10,step:.01},null,8,["modelValue"])]),O("div",Hf,[O("span",null,he(l.value),1)])])]),_:1}),ke(Pi,{"h-fit":"","w-full":"",flex:"~ col",border:"~ gray/25 rounded-lg",divide:"y dashed gray/25","of-clip":"","shadow-sm":""},{label:Ue(()=>[O("span",Gf,he(V(d)("stage.viewers.debug-menu.vrm.model.title")),1)]),default:Ue(()=>[O("div",$f,[x[20]||(x[20]=O("div",{text:"neutral-400 dark:neutral-500"},[O("span",null,"X")],-1)),O("label",Yf,[ke(Ut,{modelValue:u.value,"onUpdate:modelValue":x[6]||(x[6]=M=>u.value=M),min:-10,max:10,step:.01},null,8,["modelValue"])]),O("div",qf,[O("span",null,he(u.value),1)]),x[21]||(x[21]=O("div",{text:"neutral-400 dark:neutral-500"},[O("span",null,"Y")],-1)),O("label",Kf,[ke(Ut,{modelValue:c.value,"onUpdate:modelValue":x[7]||(x[7]=M=>c.value=M),min:-10,max:10,step:.01},null,8,["modelValue"])]),O("div",Wf,[O("span",null,he(c.value),1)]),x[22]||(x[22]=O("div",{text:"neutral-400 dark:neutral-500"},[O("span",null,"Z")],-1)),O("label",Xf,[ke(Ut,{modelValue:f.value,"onUpdate:modelValue":x[8]||(x[8]=M=>f.value=M),min:-10,max:10,step:.01},null,8,["modelValue"])]),O("div",Qf,[O("span",null,he(f.value),1)])])]),_:1}),O("div",Zf,[O("span",null,he(V(d)("stage.viewers.debug-menu.emotions")),1)]),O("div",Jf,[O("button",{"rounded-lg":"",bg:"neutral-100/70 dark:neutral-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:x[9]||(x[9]=M=>{var A;return(A=p.value)==null?void 0:A.setExpression("neutral")})},he(V(d)("stage.viewers.debug-menu.emotions-btn.neutral")),1),O("button",{"rounded-lg":"",bg:"neutral-100/70 dark:neutral-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:x[10]||(x[10]=M=>{var A;return(A=p.value)==null?void 0:A.setExpression("surprised")})},he(V(d)("stage.viewers.debug-menu.emotions-btn.surprised")),1),O("button",{"rounded-lg":"",bg:"neutral-100/70 dark:neutral-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:x[11]||(x[11]=M=>{var A;return(A=p.value)==null?void 0:A.setExpression("sad")})},he(V(d)("stage.viewers.debug-menu.emotions-btn.sad")),1),O("button",{"rounded-lg":"",bg:"neutral-100/70 dark:neutral-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:x[12]||(x[12]=M=>{var A;return(A=p.value)==null?void 0:A.setExpression("angry")})},he(V(d)("stage.viewers.debug-menu.emotions-btn.angry")),1),O("button",{"rounded-lg":"",bg:"neutral-100/70 dark:neutral-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:x[13]||(x[13]=M=>{var A;return(A=p.value)==null?void 0:A.setExpression("happy")})},he(V(d)("stage.viewers.debug-menu.emotions-btn.happy")),1)])])])):it("",!0)]),_:1})])]),_:1}))}}),td=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class bn{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}bn.prototype.normal={};bn.prototype.property={};bn.prototype.space=void 0;function Oa(t,e){const n={},r={};for(const i of t)Object.assign(n,i.property),Object.assign(r,i.normal);return new bn(n,r,e)}function Vr(t){return t.toLowerCase()}class We{constructor(e,n){this.attribute=n,this.property=e}}We.prototype.attribute="";We.prototype.booleanish=!1;We.prototype.boolean=!1;We.prototype.commaOrSpaceSeparated=!1;We.prototype.commaSeparated=!1;We.prototype.defined=!1;We.prototype.mustUseProperty=!1;We.prototype.number=!1;We.prototype.overloadedBoolean=!1;We.prototype.property="";We.prototype.spaceSeparated=!1;We.prototype.space=void 0;let nd=0;const ce=Bt(),Le=Bt(),Ba=Bt(),$=Bt(),Re=Bt(),qt=Bt(),Ze=Bt();function Bt(){return 2**++nd}const Hr=Object.freeze(Object.defineProperty({__proto__:null,boolean:ce,booleanish:Le,commaOrSpaceSeparated:Ze,commaSeparated:qt,number:$,overloadedBoolean:Ba,spaceSeparated:Re},Symbol.toStringTag,{value:"Module"})),vr=Object.keys(Hr);class pi extends We{constructor(e,n,r,i){let o=-1;if(super(e,n),fo(this,"space",i),typeof r=="number")for(;++o4&&n.slice(0,4)==="data"&&ad.test(e)){if(e.charAt(4)==="-"){const o=e.slice(5).replace(po,ud);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=e.slice(4);if(!po.test(o)){let a=o.replace(od,ld);a.charAt(0)!=="-"&&(a="-"+a),e="data"+a}}i=pi}return new i(r,e)}function ld(t){return"-"+t.toLowerCase()}function ud(t){return t.charAt(1).toUpperCase()}const cd=Oa([Fa,rd,ja,Va,Ha],"html"),Ga=Oa([Fa,id,ja,Va,Ha],"svg"),ho={}.hasOwnProperty;function fd(t,e){const n=e||{};function r(i,...o){let a=r.invalid;const s=r.handlers;if(i&&ho.call(i,t)){const l=String(i[t]);a=ho.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 dd=/^>|^->||--!>|"],hd=["<",">"];function md(t,e,n,r){return r.settings.bogusComments?"":"";function i(o){return $t(o,Object.assign({},r.settings.characterReferences,{subset:hd}))}}function gd(t,e,n,r){return""}function yd(t,e){const n=e||{};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}function xd(t){return t.join(" ").trim()}const vd=/[ \t\n\f\r]/g;function hi(t){return typeof t=="object"?t.type==="text"?mo(t.value):!1:mo(t)}function mo(t){return t.replace(vd,"")===""}const De=Ya(1),$a=Ya(-1),bd=[];function Ya(t){return e;function e(n,r,i){const o=n?n.children:bd;let a=(r||0)+t,s=o[a];if(!i)for(;s&&hi(s);)a+=t,s=o[a];return s}}const wd={}.hasOwnProperty;function qa(t){return e;function e(n,r,i){return wd.call(t,n.tagName)&&t[n.tagName](n,r,i)}}const mi=qa({body:Td,caption:br,colgroup:br,dd:Md,dt:Ed,head:br,html:kd,li:Ad,optgroup:Sd,option:Id,p:_d,rp:go,rt:go,tbody:Cd,td:yo,tfoot:Nd,th:yo,thead:Rd,tr:Ld});function br(t,e,n){const r=De(n,e,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&hi(r.value.charAt(0)))}function kd(t,e,n){const r=De(n,e);return!r||r.type!=="comment"}function Td(t,e,n){const r=De(n,e);return!r||r.type!=="comment"}function _d(t,e,n){const r=De(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 Ad(t,e,n){const r=De(n,e);return!r||r.type==="element"&&r.tagName==="li"}function Ed(t,e,n){const r=De(n,e);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function Md(t,e,n){const r=De(n,e);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function go(t,e,n){const r=De(n,e);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function Sd(t,e,n){const r=De(n,e);return!r||r.type==="element"&&r.tagName==="optgroup"}function Id(t,e,n){const r=De(n,e);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function Rd(t,e,n){const r=De(n,e);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function Cd(t,e,n){const r=De(n,e);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function Nd(t,e,n){return!De(n,e)}function Ld(t,e,n){const r=De(n,e);return!r||r.type==="element"&&r.tagName==="tr"}function yo(t,e,n){const r=De(n,e);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const Pd=qa({body:Bd,colgroup:Fd,head:Od,html:Dd,tbody:zd});function Dd(t){const e=De(t,-1);return!e||e.type!=="comment"}function Od(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 Bd(t){const e=De(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&hi(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function Fd(t,e,n){const r=$a(n,e),i=De(t,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&mi(r,n.children.indexOf(r),n)?!1:!!(i&&i.type==="element"&&i.tagName==="col")}function zd(t,e,n){const r=$a(n,e),i=De(t,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&mi(r,n.children.indexOf(r),n)?!1:!!(i&&i.type==="element"&&i.tagName==="tr")}const In={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 Ud(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=Ga);const u=jd(r,t.properties),c=r.all(i.space==="html"&&t.tagName==="template"?t.content:t);return r.schema=i,c&&(a=!1),(u||!o||!Pd(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||!mi(t,e,n))&&s.push(""),s.join("")}function jd(t,e){const n=[];let r=-1,i;if(e){for(i in e)if(e[i]!==null&&e[i]!==void 0){const o=Vd(t,i,e[i]);o&&n.push(o)}}for(;++rLi(n,t.alternative)&&(a=t.alternative),s=a+$t(n,Object.assign({},t.settings.characterReferences,{subset:(a==="'"?In.single:In.double)[i][o],attribute:!0}))+a),l+(s&&"="+s))}const Hd=["<","&"];function Ka(t,e,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?t.value:$t(t.value,Object.assign({},r.settings.characterReferences,{subset:Hd}))}function Gd(t,e,n,r){return r.settings.allowDangerousHtml?t.value:Ka(t,e,n,r)}function $d(t,e,n,r){return r.all(t)}const Yd=fd("type",{invalid:qd,unknown:Kd,handlers:{comment:md,doctype:gd,element:Ud,raw:Gd,root:$d,text:Ka}});function qd(t){throw new Error("Expected node, not `"+t+"`")}function Kd(t){const e=t;throw new Error("Cannot compile unknown node `"+e.type+"`")}const Wd={},Xd={},Qd=[];function Zd(t,e){const n=e||Wd,r=n.quote||'"',i=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:Jd,all:ep,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||td,characterReferences:n.characterReferences||Xd,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?Ga:cd,quote:r,alternative:i}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function Jd(t,e,n){return Yd(t,e,n,this)}function ep(t){const e=[],n=t&&t.children||Qd;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?(ct(t,t.length,0,e),t):e}const bo={}.hasOwnProperty;function op(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 Kt(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ut=It(/[A-Za-z]/),et=It(/[\dA-Za-z]/),lp=It(/[#-'*+\--9=?A-Z^-~]/);function Gr(t){return t!==null&&(t<32||t===127)}const $r=It(/\d/),up=It(/[\dA-Fa-f]/),cp=It(/[!-/:-@[-`{-~]/);function se(t){return t!==null&&t<-2}function Ke(t){return t!==null&&(t<0||t===32)}function Ae(t){return t===-2||t===-1||t===32}const fp=It(new RegExp("\\p{P}|\\p{S}","u")),dp=It(/\s/);function It(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Jt(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 Ce(t,e,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return a;function a(l){return Ae(l)?(t.enter(n),s(l)):e(l)}function s(l){return Ae(l)&&o++a))return;const I=e.events.length;let b=I,g,m;for(;b--;)if(e.events[b][0]==="exit"&&e.events[b][1].type==="chunkFlow"){if(g){m=e.events[b][1].end;break}g=!0}for(k(r),h=I;hA;){const P=n[C];e.containerState=P[1],P[0].exit.call(e,t)}n.length=A}function M(){i.write([null]),o=void 0,i=void 0,e.containerState._closeFlow=void 0}}function yp(t,e,n){return Ce(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ko(t){if(t===null||Ke(t)||dp(t))return 1;if(fp(t))return 2}function yi(t,e,n){const r=[];let i=-1;for(;++i1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const f={...t[r][1].end},p={...t[n][1].start};To(f,-l),To(p,l),a={type:l>1?"strongSequence":"emphasisSequence",start:f,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=rt(u,[["enter",t[r][1],e],["exit",t[r][1],e]])),u=rt(u,[["enter",i,e],["enter",a,e],["exit",a,e],["enter",o,e]]),u=rt(u,yi(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),u=rt(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=rt(u,[["enter",t[n][1],e],["exit",t[n][1],e]])):c=0,ct(t,r-1,n-r+3,u),n=r+u.length-c-2;break}}for(n=-1;++n0&&Ae(h)?Ce(t,M,"linePrefix",o+1)(h):M(h)}function M(h){return h===null||se(h)?t.check(_o,x,C)(h):(t.enter("codeFlowValue"),A(h))}function A(h){return h===null||se(h)?(t.exit("codeFlowValue"),M(h)):(t.consume(h),A)}function C(h){return t.exit("codeFenced"),e(h)}function P(h,I,b){let g=0;return m;function m(B){return h.enter("lineEnding"),h.consume(B),h.exit("lineEnding"),T}function T(B){return h.enter("codeFencedFence"),Ae(B)?Ce(h,S,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):S(B)}function S(B){return B===s?(h.enter("codeFencedFenceSequence"),F(B)):b(B)}function F(B){return B===s?(g++,h.consume(B),F):g>=a?(h.exit("codeFencedFenceSequence"),Ae(B)?Ce(h,D,"whitespace")(B):D(B)):b(B)}function D(B){return B===null||se(B)?(h.exit("codeFencedFence"),I(B)):b(B)}}}function Ip(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 wr={name:"codeIndented",tokenize:Cp},Rp={partial:!0,tokenize:Np};function Cp(t,e,n){const r=this;return i;function i(u){return t.enter("codeIndented"),Ce(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):se(u)?t.attempt(Rp,a,l)(u):(t.enter("codeFlowValue"),s(u))}function s(u){return u===null||se(u)?(t.exit("codeFlowValue"),a(u)):(t.consume(u),s)}function l(u){return t.exit("codeIndented"),e(u)}}function Np(t,e,n){const r=this;return i;function i(a){return r.parser.lazy[r.now().line]?n(a):se(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),i):Ce(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):se(a)?i(a):n(a)}}const Lp={name:"codeText",previous:Dp,resolve:Pp,tokenize:Op};function Pp(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&&sn(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),sn(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),sn(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 ts(t,e,n,r,i,o,a,s,l){const u=l||Number.POSITIVE_INFINITY;let c=0;return f;function f(k){return k===60?(t.enter(r),t.enter(i),t.enter(o),t.consume(k),t.exit(o),p):k===null||k===32||k===41||Gr(k)?n(k):(t.enter(r),t.enter(a),t.enter(s),t.enter("chunkString",{contentType:"string"}),x(k))}function p(k){return k===62?(t.enter(o),t.consume(k),t.exit(o),t.exit(i),t.exit(r),e):(t.enter(s),t.enter("chunkString",{contentType:"string"}),d(k))}function d(k){return k===62?(t.exit("chunkString"),t.exit(s),p(k)):k===null||k===60||se(k)?n(k):(t.consume(k),k===92?y:d)}function y(k){return k===60||k===62||k===92?(t.consume(k),d):d(k)}function x(k){return!c&&(k===null||k===41||Ke(k))?(t.exit("chunkString"),t.exit(s),t.exit(a),t.exit(r),e(k)):c999||d===null||d===91||d===93&&!l||d===94&&!s&&"_hiddenFootnoteSupport"in a.parser.constructs?n(d):d===93?(t.exit(o),t.enter(i),t.consume(d),t.exit(i),t.exit(r),e):se(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),c):(t.enter("chunkString",{contentType:"string"}),f(d))}function f(d){return d===null||d===91||d===93||se(d)||s++>999?(t.exit("chunkString"),c(d)):(t.consume(d),l||(l=!Ae(d)),d===92?p:f)}function p(d){return d===91||d===92||d===93?(t.consume(d),s++,f):f(d)}}function rs(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):se(p)?(t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),Ce(t,u,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),c(p))}function c(p){return p===a||p===null||se(p)?(t.exit("chunkString"),u(p)):(t.consume(p),p===92?f:c)}function f(p){return p===a||p===92?(t.consume(p),c):c(p)}}function fn(t,e){let n;return r;function r(i){return se(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):Ae(i)?Ce(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}const Gp={name:"definition",tokenize:Yp},$p={partial:!0,tokenize:qp};function Yp(t,e,n){const r=this;let i;return o;function o(d){return t.enter("definition"),a(d)}function a(d){return ns.call(r,t,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(d)}function s(d){return i=Kt(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),d===58?(t.enter("definitionMarker"),t.consume(d),t.exit("definitionMarker"),l):n(d)}function l(d){return Ke(d)?fn(t,u)(d):u(d)}function u(d){return ts(t,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(d)}function c(d){return t.attempt($p,f,f)(d)}function f(d){return Ae(d)?Ce(t,p,"whitespace")(d):p(d)}function p(d){return d===null||se(d)?(t.exit("definition"),r.parser.defined.push(i),e(d)):n(d)}}function qp(t,e,n){return r;function r(s){return Ke(s)?fn(t,i)(s):n(s)}function i(s){return rs(t,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function o(s){return Ae(s)?Ce(t,a,"whitespace")(s):a(s)}function a(s){return s===null||se(s)?e(s):n(s)}}const Kp={name:"hardBreakEscape",tokenize:Wp};function Wp(t,e,n){return r;function r(o){return t.enter("hardBreakEscape"),t.consume(o),i}function i(o){return se(o)?(t.exit("hardBreakEscape"),e(o)):n(o)}}const Xp={name:"headingAtx",resolve:Qp,tokenize:Zp};function Qp(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"},ct(t,r,n-r+1,[["enter",i,e],["enter",o,e],["exit",o,e],["exit",i,e]])),t}function Zp(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||Ke(c)?(t.exit("atxHeadingSequence"),s(c)):n(c)}function s(c){return c===35?(t.enter("atxHeadingSequence"),l(c)):c===null||se(c)?(t.exit("atxHeading"),e(c)):Ae(c)?Ce(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||Ke(c)?(t.exit("atxHeadingText"),s(c)):(t.consume(c),u)}}const Jp=["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"],Eo=["pre","script","style","textarea"],eh={concrete:!0,name:"htmlFlow",resolveTo:rh,tokenize:ih},th={partial:!0,tokenize:ah},nh={partial:!0,tokenize:oh};function rh(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 ih(t,e,n){const r=this;let i,o,a,s,l;return u;function u(R){return c(R)}function c(R){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(R),f}function f(R){return R===33?(t.consume(R),p):R===47?(t.consume(R),o=!0,x):R===63?(t.consume(R),i=3,r.interrupt?e:_):ut(R)?(t.consume(R),a=String.fromCharCode(R),v):n(R)}function p(R){return R===45?(t.consume(R),i=2,d):R===91?(t.consume(R),i=5,s=0,y):ut(R)?(t.consume(R),i=4,r.interrupt?e:_):n(R)}function d(R){return R===45?(t.consume(R),r.interrupt?e:_):n(R)}function y(R){const ge="CDATA[";return R===ge.charCodeAt(s++)?(t.consume(R),s===ge.length?r.interrupt?e:S:y):n(R)}function x(R){return ut(R)?(t.consume(R),a=String.fromCharCode(R),v):n(R)}function v(R){if(R===null||R===47||R===62||Ke(R)){const ge=R===47,Te=a.toLowerCase();return!ge&&!o&&Eo.includes(Te)?(i=1,r.interrupt?e(R):S(R)):Jp.includes(a.toLowerCase())?(i=6,ge?(t.consume(R),k):r.interrupt?e(R):S(R)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(R):o?M(R):A(R))}return R===45||et(R)?(t.consume(R),a+=String.fromCharCode(R),v):n(R)}function k(R){return R===62?(t.consume(R),r.interrupt?e:S):n(R)}function M(R){return Ae(R)?(t.consume(R),M):m(R)}function A(R){return R===47?(t.consume(R),m):R===58||R===95||ut(R)?(t.consume(R),C):Ae(R)?(t.consume(R),A):m(R)}function C(R){return R===45||R===46||R===58||R===95||et(R)?(t.consume(R),C):P(R)}function P(R){return R===61?(t.consume(R),h):Ae(R)?(t.consume(R),P):A(R)}function h(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(t.consume(R),l=R,I):Ae(R)?(t.consume(R),h):b(R)}function I(R){return R===l?(t.consume(R),l=null,g):R===null||se(R)?n(R):(t.consume(R),I)}function b(R){return R===null||R===34||R===39||R===47||R===60||R===61||R===62||R===96||Ke(R)?P(R):(t.consume(R),b)}function g(R){return R===47||R===62||Ae(R)?A(R):n(R)}function m(R){return R===62?(t.consume(R),T):n(R)}function T(R){return R===null||se(R)?S(R):Ae(R)?(t.consume(R),T):n(R)}function S(R){return R===45&&i===2?(t.consume(R),j):R===60&&i===1?(t.consume(R),J):R===62&&i===4?(t.consume(R),ee):R===63&&i===3?(t.consume(R),_):R===93&&i===5?(t.consume(R),Z):se(R)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(th,me,F)(R)):R===null||se(R)?(t.exit("htmlFlowData"),F(R)):(t.consume(R),S)}function F(R){return t.check(nh,D,me)(R)}function D(R){return t.enter("lineEnding"),t.consume(R),t.exit("lineEnding"),B}function B(R){return R===null||se(R)?F(R):(t.enter("htmlFlowData"),S(R))}function j(R){return R===45?(t.consume(R),_):S(R)}function J(R){return R===47?(t.consume(R),a="",oe):S(R)}function oe(R){if(R===62){const ge=a.toLowerCase();return Eo.includes(ge)?(t.consume(R),ee):S(R)}return ut(R)&&a.length<8?(t.consume(R),a+=String.fromCharCode(R),oe):S(R)}function Z(R){return R===93?(t.consume(R),_):S(R)}function _(R){return R===62?(t.consume(R),ee):R===45&&i===2?(t.consume(R),_):S(R)}function ee(R){return R===null||se(R)?(t.exit("htmlFlowData"),me(R)):(t.consume(R),ee)}function me(R){return t.exit("htmlFlow"),e(R)}}function oh(t,e,n){const r=this;return i;function i(a){return se(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 ah(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(Qn,e,n)}}const sh={name:"htmlText",tokenize:lh};function lh(t,e,n){const r=this;let i,o,a;return s;function s(_){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(_),l}function l(_){return _===33?(t.consume(_),u):_===47?(t.consume(_),P):_===63?(t.consume(_),A):ut(_)?(t.consume(_),b):n(_)}function u(_){return _===45?(t.consume(_),c):_===91?(t.consume(_),o=0,y):ut(_)?(t.consume(_),M):n(_)}function c(_){return _===45?(t.consume(_),d):n(_)}function f(_){return _===null?n(_):_===45?(t.consume(_),p):se(_)?(a=f,J(_)):(t.consume(_),f)}function p(_){return _===45?(t.consume(_),d):f(_)}function d(_){return _===62?j(_):_===45?p(_):f(_)}function y(_){const ee="CDATA[";return _===ee.charCodeAt(o++)?(t.consume(_),o===ee.length?x:y):n(_)}function x(_){return _===null?n(_):_===93?(t.consume(_),v):se(_)?(a=x,J(_)):(t.consume(_),x)}function v(_){return _===93?(t.consume(_),k):x(_)}function k(_){return _===62?j(_):_===93?(t.consume(_),k):x(_)}function M(_){return _===null||_===62?j(_):se(_)?(a=M,J(_)):(t.consume(_),M)}function A(_){return _===null?n(_):_===63?(t.consume(_),C):se(_)?(a=A,J(_)):(t.consume(_),A)}function C(_){return _===62?j(_):A(_)}function P(_){return ut(_)?(t.consume(_),h):n(_)}function h(_){return _===45||et(_)?(t.consume(_),h):I(_)}function I(_){return se(_)?(a=I,J(_)):Ae(_)?(t.consume(_),I):j(_)}function b(_){return _===45||et(_)?(t.consume(_),b):_===47||_===62||Ke(_)?g(_):n(_)}function g(_){return _===47?(t.consume(_),j):_===58||_===95||ut(_)?(t.consume(_),m):se(_)?(a=g,J(_)):Ae(_)?(t.consume(_),g):j(_)}function m(_){return _===45||_===46||_===58||_===95||et(_)?(t.consume(_),m):T(_)}function T(_){return _===61?(t.consume(_),S):se(_)?(a=T,J(_)):Ae(_)?(t.consume(_),T):g(_)}function S(_){return _===null||_===60||_===61||_===62||_===96?n(_):_===34||_===39?(t.consume(_),i=_,F):se(_)?(a=S,J(_)):Ae(_)?(t.consume(_),S):(t.consume(_),D)}function F(_){return _===i?(t.consume(_),i=void 0,B):_===null?n(_):se(_)?(a=F,J(_)):(t.consume(_),F)}function D(_){return _===null||_===34||_===39||_===60||_===61||_===96?n(_):_===47||_===62||Ke(_)?g(_):(t.consume(_),D)}function B(_){return _===47||_===62||Ke(_)?g(_):n(_)}function j(_){return _===62?(t.consume(_),t.exit("htmlTextData"),t.exit("htmlText"),e):n(_)}function J(_){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(_),t.exit("lineEnding"),oe}function oe(_){return Ae(_)?Ce(t,Z,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):Z(_)}function Z(_){return t.enter("htmlTextData"),a(_)}}const xi={name:"labelEnd",resolveAll:dh,resolveTo:ph,tokenize:hh},uh={tokenize:mh},ch={tokenize:gh},fh={tokenize:yh};function dh(t){let e=-1;const n=[];for(;++e=3&&(u===null||se(u))?(t.exit("thematicBreak"),e(u)):n(u)}function l(u){return u===i?(t.consume(u),r++,l):(t.exit("thematicBreakSequence"),Ae(u)?Ce(t,s,"whitespace")(u):s(u))}}const Ye={continuation:{tokenize:Mh},exit:Ih,name:"list",tokenize:Eh},_h={partial:!0,tokenize:Rh},Ah={partial:!0,tokenize:Sh};function Eh(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(d){const y=r.containerState.type||(d===42||d===43||d===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!r.containerState.marker||d===r.containerState.marker:$r(d)){if(r.containerState.type||(r.containerState.type=y,t.enter(y,{_container:!0})),y==="listUnordered")return t.enter("listItemPrefix"),d===42||d===45?t.check(Dn,n,u)(d):u(d);if(!r.interrupt||d===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(d)}return n(d)}function l(d){return $r(d)&&++a<10?(t.consume(d),l):(!r.interrupt||a<2)&&(r.containerState.marker?d===r.containerState.marker:d===41||d===46)?(t.exit("listItemValue"),u(d)):n(d)}function u(d){return t.enter("listItemMarker"),t.consume(d),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||d,t.check(Qn,r.interrupt?n:c,t.attempt(_h,p,f))}function c(d){return r.containerState.initialBlankLine=!0,o++,p(d)}function f(d){return Ae(d)?(t.enter("listItemPrefixWhitespace"),t.consume(d),t.exit("listItemPrefixWhitespace"),p):n(d)}function p(d){return r.containerState.size=o+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(d)}}function Mh(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(Qn,i,o);function i(s){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ce(t,e,"listItemIndent",r.containerState.size+1)(s)}function o(s){return r.containerState.furtherBlankLines||!Ae(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(Ah,e,a)(s))}function a(s){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ce(t,t.attempt(Ye,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function Sh(t,e,n){const r=this;return Ce(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 Ih(t){t.exit(this.containerState.type)}function Rh(t,e,n){const r=this;return Ce(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!Ae(o)&&a&&a[1].type==="listItemPrefixWhitespace"?e(o):n(o)}}const Mo={name:"setextUnderline",resolveTo:Ch,tokenize:Nh};function Ch(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 Nh(t,e,n){const r=this;let i;return o;function o(u){let c=r.events.length,f;for(;c--;)if(r.events[c][1].type!=="lineEnding"&&r.events[c][1].type!=="linePrefix"&&r.events[c][1].type!=="content"){f=r.events[c][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(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"),Ae(u)?Ce(t,l,"lineSuffix")(u):l(u))}function l(u){return u===null||se(u)?(t.exit("setextHeadingLine"),e(u)):n(u)}}const Lh={tokenize:Ph};function Ph(t){const e=this,n=t.attempt(Qn,r,t.attempt(this.parser.constructs.flowInitial,i,Ce(t,t.attempt(this.parser.constructs.flow,i,t.attempt(zp,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 Dh={resolveAll:os()},Oh=is("string"),Bh=is("text");function is(t){return{resolveAll:os(t==="text"?Fh: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 f=i[c];let p=-1;if(f)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 Qh(t,e){let n=-1;const r=[];let i;for(;++n0){const He=ie.tokenStack[ie.tokenStack.length-1];(He[1]||Co).call(ie,void 0,He[0])}for(K.position={start:Tt(U.length>0?U[0][1].start:{line:1,column:1,offset:0}),end:Tt(U.length>0?U[U.length-2][1].end:{line:1,column:1,offset:0})},be=-1;++be1?"-"+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 hm(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 mm(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function ls(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 gm(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return ls(t,e);const i={src:Jt(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 ym(t,e){const n={src:Jt(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 xm(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 vm(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return ls(t,e);const i={href:Jt(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 bm(t,e){const n={href:Jt(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 wm(t,e,n){const r=t.all(e),i=n?km(n):us(e),o={},a=[];if(typeof e.checked=="boolean"){const c=r[0];let f;c&&c.type==="element"&&c.tagName==="p"?f=c:(f={type:"element",tagName:"p",properties:{},children:[]},r.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.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 Tm(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 Mm(t){const e=fs(t),n=cs(t);if(e&&n)return{start:e,end:n}}function Sm(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=fs(e.children[1]),l=cs(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 Im(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(Po(e.slice(i),i>0,!1)),o.join("")}function Po(t,e,n){let r=0,i=t.length;if(e){let o=t.codePointAt(r);for(;o===No||o===Lo;)r++,o=t.codePointAt(r)}if(n){let o=t.codePointAt(i-1);for(;o===No||o===Lo;)i--,o=t.codePointAt(i-1)}return i>r?t.slice(r,i):""}function Nm(t,e){const n={type:"text",value:Cm(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function Lm(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const Pm={blockquote:lm,break:um,code:cm,delete:fm,emphasis:dm,footnoteReference:pm,heading:hm,html:mm,imageReference:gm,image:ym,inlineCode:xm,linkReference:vm,link:bm,listItem:wm,list:Tm,paragraph:_m,root:Am,strong:Em,table:Sm,tableCell:Rm,tableRow:Im,text:Nm,thematicBreak:Lm,toml:Rn,yaml:Rn,definition:Rn,footnoteDefinition:Rn};function Rn(){}const ps=-1,Zn=0,Vn=1,Hn=2,vi=3,bi=4,wi=5,ki=6,hs=7,ms=8,Do=typeof self=="object"?self:globalThis,Dm=(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 Zn:case ps:return n(a,i);case Vn:{const s=n([],i);for(const l of a)s.push(r(l));return s}case Hn:{const s=n({},i);for(const[l,u]of a)s[r(l)]=r(u);return s}case vi:return n(new Date(a),i);case bi:{const{source:s,flags:l}=a;return n(new RegExp(s,l),i)}case wi:{const s=n(new Map,i);for(const[l,u]of a)s.set(r(l),r(u));return s}case ki:{const s=n(new Set,i);for(const l of a)s.add(r(l));return s}case hs:{const{name:s,message:l}=a;return n(new Do[s](l),i)}case ms:return n(BigInt(a),i);case"BigInt":return n(Object(BigInt(a)),i)}return n(new Do[o](a),i)};return r},Oo=t=>Dm(new Map,t)(0),jt="",{toString:Om}={},{keys:Bm}=Object,ln=t=>{const e=typeof t;if(e!=="object"||!t)return[Zn,e];const n=Om.call(t).slice(8,-1);switch(n){case"Array":return[Vn,jt];case"Object":return[Hn,jt];case"Date":return[vi,jt];case"RegExp":return[bi,jt];case"Map":return[wi,jt];case"Set":return[ki,jt]}return n.includes("Array")?[Vn,n]:n.includes("Error")?[hs,n]:[Hn,n]},Cn=([t,e])=>t===Zn&&(e==="function"||e==="symbol"),Fm=(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]=ln(a);switch(s){case Zn:{let c=a;switch(l){case"bigint":s=ms,c=a.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);c=null;break;case"undefined":return i([ps],a)}return i([s,c],a)}case Vn:{if(l)return i([l,[...a]],a);const c=[],f=i([s,c],a);for(const p of a)c.push(o(p));return f}case Hn:{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=[],f=i([s,c],a);for(const p of Bm(a))(t||!Cn(ln(a[p])))&&c.push([o(p),o(a[p])]);return f}case vi:return i([s,a.toISOString()],a);case bi:{const{source:c,flags:f}=a;return i([s,{source:c,flags:f}],a)}case wi:{const c=[],f=i([s,c],a);for(const[p,d]of a)(t||!(Cn(ln(p))||Cn(ln(d))))&&c.push([o(p),o(d)]);return f}case ki:{const c=[],f=i([s,c],a);for(const p of a)(t||!Cn(ln(p)))&&c.push(o(p));return f}}const{message:u}=a;return i([s,{name:l,message:u}],a)};return o},Bo=(t,{json:e,lossy:n}={})=>{const r=[];return Fm(!(e||n),!!e,new Map,r)(t),r},Gn=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?Oo(Bo(t,e)):structuredClone(t):(t,e)=>Oo(Bo(t,e));function zm(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 Um(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function jm(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||zm,r=t.options.footnoteBackLabel||Um,i=t.options.footnoteLabel||"Footnotes",o=t.options.footnoteLabelTagName||"h2",a=t.options.footnoteLabelProperties||{className:["sr-only"]},s=[];let l=-1;for(;++l0&&y.push({type:"text",value:" "});let M=typeof n=="string"?n:n(l,d);typeof M=="string"&&(M={type:"text",value:M}),y.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+p+(d>1?"-"+d:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,d),className:["data-footnote-backref"]},children:Array.isArray(M)?M:[M]})}const v=c[c.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const M=v.children[v.children.length-1];M&&M.type==="text"?M.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...y)}else c.push(...y);const k={type:"element",tagName:"li",properties:{id:e+"fn-"+p},children:t.wrap(c,!0)};t.patch(u,k),s.push(k)}if(s.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...Gn(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 gs=function(t){if(t==null)return $m;if(typeof t=="function")return Jn(t);if(typeof t=="object")return Array.isArray(t)?Vm(t):Hm(t);if(typeof t=="string")return Gm(t);throw new Error("Expected function, string, or object as test")};function Vm(t){const e=[];let n=-1;for(;++n":""))+")"})}return p;function p(){let d=ys,y,x,v;if((!e||o(l,u,c[c.length-1]||void 0))&&(d=Xm(n(l,c)),d[0]===Fo))return d;if("children"in l&&l.children){const k=l;if(k.children&&d[0]!==Km)for(x=(r?k.children.length:-1)+a,v=c.concat(k);x>-1&&x0&&n.push({type:"text",value:` +`}),n}function zo(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function Uo(t,e){const n=Jm(t,e),r=n.one(t,void 0),i=jm(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&o.children.push({type:"text",value:` +`},i),o}function ig(t,e){return t&&"run"in t?async function(n,r){const i=Uo(n,{file:r,...e});await t.run(i,r)}:function(n,r){return Uo(n,{file:r,...t||e})}}function jo(t){if(t)throw t}var Tr,Vo;function og(){if(Vo)return Tr;Vo=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"),f=u.constructor&&u.constructor.prototype&&t.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!c&&!f)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 Tr=function l(){var u,c,f,p,d,y,x=arguments[0],v=1,k=arguments.length,M=!1;for(typeof x=="boolean"&&(M=x,x=arguments[1]||{},v=2),(x==null||typeof x!="object"&&typeof x!="function")&&(x={});va.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 Xe 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=dn(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}}Xe.prototype.file="";Xe.prototype.name="";Xe.prototype.reason="";Xe.prototype.message="";Xe.prototype.stack="";Xe.prototype.column=void 0;Xe.prototype.line=void 0;Xe.prototype.ancestors=void 0;Xe.prototype.cause=void 0;Xe.prototype.fatal=void 0;Xe.prototype.place=void 0;Xe.prototype.ruleId=void 0;Xe.prototype.source=void 0;const lt={basename:ug,dirname:cg,extname:fg,join:dg,sep:"/"};function ug(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');wn(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 cg(t){if(wn(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 fg(t){wn(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 dg(...t){let e=-1,n;for(;++e0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function hg(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 wn(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const mg={cwd:gg};function gg(){return"/"}function Xr(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function yg(t){if(typeof t=="string")t=new URL(t);else if(!Xr(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 xg(t)}function xg(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[d,...y]=c;const x=r[p][1];Wr(x)&&Wr(d)&&(d=_r(!0,x,d)),r[p]=[u,d,...y]}}}}const Tg=new Ti().freeze();function Sr(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Ir(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Rr(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 Go(t){if(!Wr(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function $o(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Nn(t){return _g(t)?t:new vg(t)}function _g(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function Ag(t){return typeof t=="string"||Eg(t)}function Eg(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}function _i(){const t=Tg().use(sm).use(ig).use(tp);return{process:e=>t.processSync(e).toString()}}const Mg={relative:""},Sg={"h-full":"","w-full":""},Ig={key:0,class:"animate-stripe",absolute:"",left:"1/2",bottom:"20%",z:"20","rounded-2xl":"",text:"primary-600","px-2":"","py-2":"",transform:"translate-x--1/2"},Rg={bg:"primary-50","rounded-xl":"","px-10":"","py-6":""},Cg=["innerHTML"],Ng=Be({__name:"Stage",props:{paused:{type:Boolean,default:!1}},setup(t){const e=W(),n=W(),{stageView:r}=qe(Wt()),{mouthOpenSize:i}=qe(Xl()),{audioContext:o,calculateVolume:a}=pa(),{onBeforeMessageComposed:s,onBeforeSend:l,onTokenLiteral:u,onTokenSpecial:c,onStreamEnd:f,streamingMessage:p,onAssistantResponseEnd:d}=St(),{process:y}=_i(),x=li(),v=W(),k=W(!1),M=W(!1),A=or({handlers:[_=>new Promise(ee=>{const me=o.createBufferSource();me.buffer=_.data.audioBuffer,me.connect(o.destination),me.connect(v.value),k.value=!0,me.start(0),me.onended=()=>{k.value=!1,ee()}})]}),C=Pl(),{ssmlEnabled:P,activeSpeechProvider:h,activeSpeechModel:I,activeSpeechVoice:b,pitch:g}=qe(C);async function m(_){try{if(!h.value){console.warn("No active speech provider configured");return}if(!b.value){console.warn("No active speech voice configured");return}const ee=x.getProviderInstance(h.value);if(!ee){console.error("Failed to initialize speech provider");return}const me=x.getProviderConfig(h.value),R=P.value?C.generateSSML(_.data,b.value,{...me,pitch:g.value}):_.data,ge=await Dl({...ee.speech(I.value,me),input:R,voice:b.value.id}),Te=await o.decodeAudioData(ge);await A.add({audioBuffer:Te,text:_.data})}catch(ee){console.error("Speech generation failed:",ee)}}const T=or({handlers:[m]});T.on("add",_=>{console.debug("ttsQueue added",_)});const S=Ol(T),{live2dCurrentMotion:F}=qe(Wt()),D=or({handlers:[async _=>{if(r.value==="3d"){const ee=Cl[_.data];if(!ee)return;await n.value.setExpression(ee)}else r.value==="2d"&&(F.value={group:Nl[_.data]})}]}),B=Bl(D);B.onHandlerEvent("emotion",_=>{console.debug("emotion detected",_)});const j=Fl();j.onHandlerEvent("delay",_=>{console.debug("delay detected",_)});function J(){requestAnimationFrame(J),k.value&&(i.value=a(v.value,"linear"))}function oe(){M.value||(J(),o.resume(),M.value=!0)}function Z(){v.value||(v.value=o.createAnalyser())}return s(async()=>{Z(),oe()}),l(async()=>{F.value={group:Ni}}),u(async _=>{await S.add(_)}),c(async _=>{await j.add(_),await B.add(_)}),f(async()=>{await j.add(zl)}),d(async _=>{}),Ot(()=>{var ee,me,R;M.value=!1;const _=window;(ee=_.electron)==null||ee.ipcRenderer.removeAllListeners("before-hide"),(me=_.electron)==null||me.ipcRenderer.removeAllListeners("after-show"),(R=_.electron)==null||R.ipcRenderer.removeAllListeners("before-quit")}),pn(()=>{var ee,me,R;const _=window;(ee=_.electron)==null||ee.ipcRenderer.on("before-hide",()=>{F.value={group:Ml}}),(me=_.electron)==null||me.ipcRenderer.on("after-show",()=>{F.value={group:Sl}}),(R=_.electron)==null||R.ipcRenderer.on("before-quit",()=>{F.value={group:Ni}})}),pn(async()=>{e.value=Il({connection:{bundles:Ll()}}),await e.value.execute(Rl`CREATE TABLE memory_test (vec FLOAT[768]);`)}),(_,ee)=>(Q(),re("div",Mg,[O("div",Sg,[V(r)==="2d"?(Q(),Xt(au,{key:0,"mouth-open-size":V(i),"min-w":"50% (Q(),re("header",Fg,[O("div",zg,[ke($l)]),ke(V(hl),{class:"m-1 block max-h-[10lh] min-h-[1lh] rounded-lg bg-neutral-100 p-2 text-lg text-neutral-500 outline-none dark:bg-neutral-800 dark:text-neutral-400",to:"/settings"},{default:Ue(()=>n[0]||(n[0]=[O("div",{"i-solar:settings-minimalistic-bold-duotone":""},null,-1)])),_:1})]))}});function xs(t,e){const n=la(e??{},{...Di.getDefaultRealTimeVADOptions("v5"),preSpeechPadFrames:30,positiveSpeechThreshold:.5,negativeSpeechThreshold:.35,minSpeechFrames:30,auto:!0}),r=W(),i=ml("microphone");async function o(){if(r.value&&(r.value.destroy(),r.value=void 0,console.warn("existing MicVAD destroyed")),!i.value)return;const a=V(t);if(!a)return;const s=await navigator.mediaDevices.getUserMedia({audio:{deviceId:a}});r.value=await Di.MicVAD.new({...n,stream:s}),n.auto&&r.value.start()}return Fe(i,o,{immediate:!0}),Fe(gl(t),o,{immediate:!0}),yl(o),Ot(()=>{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 jg(t,e){const n=la(e,{onLoading:()=>{},onInitiate:()=>{},onProgress:()=>{},onDone:()=>{},onReady:()=>{},onStart:()=>{},onUpdate:()=>{},onComplete:()=>{}}),{post:r,data:i,terminate:o}=xl(t,{type:"module"}),a=W(null),s=W(""),l=W([]),u=W(!1),c=W(0),f=W("");return Fe(i,p=>{var d,y,x,v,k,M,A,C;switch(p.status){case"loading":a.value="loading",s.value=p.data,(d=n.onLoading)==null||d.call(n,p.data);break;case"initiate":l.value.push(p),(y=n.onInitiate)==null||y.call(n,p);break;case"progress":l.value=l.value.map(P=>P.file===p.file?{...P,...p}:P),(x=n.onProgress)==null||x.call(n,p);break;case"done":l.value=l.value.filter(P=>P.file!==p.file),(v=n.onDone)==null||v.call(n,p);break;case"ready":a.value="ready",(k=n.onReady)==null||k.call(n);break;case"start":u.value=!0,(M=n.onStart)==null||M.call(n);break;case"update":c.value=p.tps,(A=n.onUpdate)==null||A.call(n,p.tps);break;case"complete":u.value=!1,f.value=p.output[0]||"",console.debug("Whisper result:",f.value),(C=n.onComplete)==null||C.call(n,p.output[0]);break}}),Ot(()=>{o()}),{transcribe:p=>r(p),status:a,loadingMessage:s,loadingProgress:l,transcribing:u,tps:c,result:f,load:()=>r({type:"load"}),terminate:o}}const Vg="/assets/worker-Pjvo6JHG.js";async function Hg(t,e){const n=new ArrayBuffer(44+t.length*2),r=new DataView(n);Ln(r,0,"RIFF"),r.setUint32(4,36+t.length*2,!0),Ln(r,8,"WAVE"),Ln(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),Ln(r,36,"data"),r.setUint32(40,t.length*2,!0),Gg(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 Ln(t,e,n){for(let r=0;r{jn().then(()=>{i.update(),o.value=i.height.value})}),u(async()=>{jn().then(()=>{i.update(),o.value=i.height.value})}),(c,f)=>{const p=ca("auto-animate");return Q(),re("div",$g,[f[2]||(f[2]=O("div",{"flex-1":""},null,-1)),At((Q(),re("div",{ref_key:"chatHistoryRef",ref:e,"h-full":"","w-full":"",flex:"~ col","overflow-scroll":""},[f[1]||(f[1]=O("div",{"flex-1":""},null,-1)),(Q(!0),re(ai,null,si(V(n),(d,y)=>(Q(),re("div",{key:y,"mb-2":""},[d.role==="error"?(Q(),re("div",Yg,[O("div",qg,[O("div",Kg,[O("div",Wg,[O("span",Xg,he(V(a)("stage.chat.message.character-name.core-system")),1)]),f[0]||(f[0]=O("div",{"i-solar:danger-triangle-bold-duotone":"","text-violet-500":""},null,-1))]),V(r)&&y===V(n).length-1?(Q(),re("div",Qg)):(Q(),re("div",{key:1,class:"markdown-content break-words text-violet-500",text:"base {if(!F||!F.trim())return;const D=o.getProviderConfig(a.value);await y(F,{chatProvider:o.getProviderInstance(a.value),model:s.value,providerConfig:D})}});async function I(){if(e.value.trim())try{const F=o.getProviderConfig(a.value);await y(e.value,{chatProvider:o.getProviderInstance(a.value),model:s.value,providerConfig:F})}catch(F){v.value.pop(),v.value.push({role:"error",content:F.message})}}const{destroy:b,start:g}=xs(d,{onSpeechStart:()=>{n.value=!0},onVADMisfire:()=>{n.value=!1},onSpeechEnd:F=>{n.value=!1,T(F)},auto:!1});function m(){P.value!=="loading"&&(C(),g())}async function T(F){await k.resume();const D=await Hg(F,k.sampleRate);A({type:"generate",data:{audio:D,language:"en"}})}async function S(F){const D=F.target,B=u.value.find(j=>j.deviceId===D.value);if(!B){f.value=void 0;return}f.value=B}return Fe(p,async F=>{F==="false"&&(b(),h())}),Fe(i,async F=>{F&&await c()}),x(async()=>{e.value=""}),(F,D)=>(Q(),re("div",cy,[O("fieldset",fy,[O("label",{class:st([r.value==="chat"?"bg-primary-100 dark:bg-primary-900":"bg-white dark:bg-primary-950",r.value==="chat"?"text-primary-500 dark:text-primary-500":"",{"transition-colors-none ":V(l)}]),flex:"~ row",checked:r.value==="chat","aria-checked":r.value==="chat",border:"solid l-2 t-2 b-2 primary-100 dark:primary-900",bg:"hover:primary-100 dark:hover:primary-900",text:"primary-300 hover:primary-500 dark:primary-300/50 dark:hover:primary-500",transition:"all duration-250 ease-in-out","cursor-pointer":"","items-center":"","gap-1":"","rounded-l-lg":"","px-2":""},[At(O("input",{"onUpdate:modelValue":D[0]||(D[0]=B=>r.value=B),type:"radio",name:"tab",value:"chat",hidden:""},null,512),[[ir,r.value]]),D[5]||(D[5]=O("div",{"i-solar:dialog-2-bold-duotone":"",text:"2xl",transform:"translate-y--2"},null,-1)),O("div",py,[O("span",hy,he(V(M)("stage.chat.tabs.chat")),1)])],10,dy),O("label",{class:st([r.value==="custom"?"bg-primary-100 dark:bg-primary-900":"bg-white dark:bg-primary-950",r.value==="custom"?"text-primary-500 dark:text-primary-500":"",{"transition-colors-none ":V(l)}]),flex:"~ row",checked:r.value==="custom","aria-checked":r.value==="custom",border:"solid t-2 b-2 primary-100 dark:primary-900",bg:"hover:primary-100 dark:hover:primary-900",text:"primary-300 hover:primary-500 dark:primary-300/50 dark:hover:primary-500",transition:"all duration-250 ease-in-out","cursor-pointer":"","items-center":"","gap-1":"","px-2":""},[At(O("input",{"onUpdate:modelValue":D[1]||(D[1]=B=>r.value=B),type:"radio",name:"tab",value:"custom",hidden:""},null,512),[[ir,r.value]]),D[6]||(D[6]=O("div",{"i-solar:star-fall-2-bold-duotone":"",text:"2xl",transform:"translate-y--2"},null,-1)),O("div",gy,[O("span",null,he(V(M)("stage.chat.tabs.custom")),1)])],10,my),O("label",{class:st([r.value==="clothes"?"bg-primary-100 dark:bg-primary-900":"bg-white dark:bg-primary-950",r.value==="clothes"?"text-primary-500 dark:text-primary-500":"",{"transition-colors-none ":V(l)}]),flex:"~ row",checked:r.value==="clothes","aria-checked":r.value==="clothes",border:"solid r-2 t-2 b-2 primary-100 dark:primary-900",bg:"hover:primary-100 dark:hover:primary-900",text:"primary-300 hover:primary-500 dark:primary-300/50 dark:hover:primary-500",transition:"all duration-250 ease-in-out","cursor-pointer":"","items-center":"","gap-1":"","rounded-r-lg":"","px-2":""},[At(O("input",{"onUpdate:modelValue":D[2]||(D[2]=B=>r.value=B),type:"radio",name:"tab",value:"clothes",hidden:""},null,512),[[ir,r.value]]),D[7]||(D[7]=O("div",{"i-solar:magic-stick-3-bold-duotone":"",text:"2xl",transform:"translate-y--2"},null,-1)),O("div",xy,[O("span",null,he(V(M)("stage.chat.tabs.clothes")),1)])],10,yy)]),O("div",vy,[O("div",by,[ke(uy,{"h-full":"","flex-1":"","p-4":"",w:"full","max-h":"e.value=B),placeholder:V(M)("stage.message"),text:"primary-300 hover:primary-500 dark:primary-300/50 dark:hover:primary-500 placeholder:primary-300 placeholder:hover:primary-500 placeholder:dark:primary-300/50 placeholder:dark:hover:primary-500",bg:"primary-100 dark:primary-400/20","min-h":"[100px]","max-h":"[300px]","w-full":"","rounded-t-xl":"","p-4":"","font-medium":"","outline-none":"",transition:"all duration-250 ease-in-out placeholder:all placeholder:duration-250 placeholder:ease-in-out",class:st({"transition-colors-none placeholder:transition-colors-none":V(l)}),onSubmit:I},null,8,["modelValue","placeholder","class"])])])]),O("div",ky,[O("button",{bg:"complementary-100 hover:complementary-200 dark:complementary-800 dark:hover:complementary-700",transition:"all duration-250 ease-in-out",class:st({"transition-colors-none":V(l)}),text:"complementary-400","mb-6":"",flex:"","cursor-pointer":"","items-center":"","justify-center":"","gap-2":"","rounded-full":"","px-4":"","py-2":"",onClick:m},[ke(bl,{mode:"out-in"},{default:Ue(()=>[V(P)===null?(Q(),re("div",Ty,he(V(M)("stage.operations.load-models")),1)):V(P)==="loading"?(Q(),re("div",_y,[D[8]||(D[8]=O("div",{"i-svg-spinners:bouncing-ball":"",class:"text-cyan"},null,-1)),O("span",null,he(V(M)("stage.operations.load-models-status.loading")),1)])):V(P)==="ready"?(Q(),re("div",Ay,[D[9]||(D[9]=O("div",{"i-lucide:check":"",class:"text-cyan"},null,-1)),O("span",null,he(V(M)("stage.operations.load-models-status.ready")),1)])):it("",!0)]),_:1})],2),O("div",Ey,[ke(V(ui),null,{default:Ue(()=>[i.value?(Q(),re("fieldset",My,[(Q(!0),re(ai,null,si(V(u),(B,j)=>(Q(),re("label",{key:j,class:"[&_div_span]:dark:hover:bg-cyan-300 [&_div_span]:dark:hover:bg-cyan-900"},[O("input",{type:"radio",name:"audioInput",value:B.deviceId,hidden:"",onChange:S},null,40,Sy),O("div",Iy,[O("div",Ry,[B.deviceId===V(d)?(Q(),re("div",Cy)):it("",!0)]),O("span",{"inline-block":"",class:st([B.deviceId===V(d)?"cyan-400 dark:text-white":"cyan-400/50 dark:text-white/50"]),transition:"all duration-250 ease-in-out"},he(B.label),3)])]))),128))])):it("",!0)]),_:1}),O("label",{bg:"complementary-100 hover:complementary-200 dark:complementary-800 dark:hover:complementary-700",transition:"all duration-250 ease-in-out",class:st({"transition-colors-none":V(l)}),text:"complementary-400","h-fit":"",flex:"","cursor-pointer":"","items-center":"","justify-center":"","gap-2":"","rounded-full":"","px-4":"","py-2":""},[At(O("input",{"onUpdate:modelValue":D[4]||(D[4]=B=>i.value=B),type:"checkbox",hidden:""},null,512),[[Zr,i.value]]),D[10]||(D[10]=O("div",{"i-solar:microphone-2-bold-duotone":""},null,-1)),O("div",null,[n.value?(Q(),re("span",Ly,"Listening...")):(Q(),re("span",Ny,he(V(M)("settings.microphone")),1))])],2)])])]))}}),Dy=Kn(Py,[["__scopeId","data-v-1f3e13c7"]]),Oy={py:"1",flex:"~ col",rounded:"lg","overflow-hidden":""},By={key:0,flex:"",mr:"12"},Fy={flex:"~ col",border:"4 solid primary-200/50 dark:primary-500/50",shadow:"md primary-200/50 dark:none","min-w-20":"","rounded-lg":"","px-2":"","py-1":"",h:"unset {jn().then(()=>{i.update(),o.value=i.height.value})}),l(async()=>{jn().then(()=>{i.update(),o.value=i.height.value})}),(u,c)=>{const f=ca("auto-animate");return Q(),re("div",Oy,[c[1]||(c[1]=O("div",{"flex-1":""},null,-1)),At((Q(),re("div",{ref_key:"chatHistoryRef",ref:e,"h-full":"","w-full":"","max-h":"30vh",flex:"~ col","overflow-scroll":""},[c[0]||(c[0]=O("div",{"flex-1":""},null,-1)),(Q(!0),re(ai,null,si(V(r),(p,d)=>(Q(),re("div",{key:d,"mb-2":""},[p.role==="assistant"?(Q(),re("div",By,[O("div",Fy,[O("div",null,[O("span",zy,he(V(n)("stage.chat.message.character-name.airi")),1)]),p.content?(Q(),re("div",{key:0,class:"markdown-content",text:"base {n.value=!0},onVADMisfire:()=>{n.value=!1},onSpeechEnd:v=>{n.value=!1,x()},auto:!1});function x(v){alert("Transcription is not implemented yet")}return Fe(a,async v=>{v==="false"&&d()}),c(async()=>{e.value=""}),pn(()=>{y()}),(v,k)=>(Q(),re("div",null,[O("div",Ky,[ke(qy,{absolute:"","left-0":"","top-0":"",transform:"translate-y-[-100%]","w-full":""}),O("div",Wy,[ke(V(fa),{modelValue:e.value,"onUpdate:modelValue":k[0]||(k[0]=M=>e.value=M),placeholder:V(f)("stage.message"),border:"solid 2 primary-100 dark:primary-400/20",text:"primary-300 hover:primary-500 dark:primary-300/50 dark:hover:primary-500 placeholder:primary-300 placeholder:hover:primary-500 placeholder:dark:primary-300/50 placeholder:dark:hover:primary-500",bg:"primary-100 dark:primary-400/20","max-h":"[10lh]","min-h":"[1lh]","w-full":"","resize-none":"","overflow-y-scroll":"","rounded-xl":"","p-2":"","font-medium":"","outline-none":"",transition:"all duration-250 ease-in-out placeholder:all placeholder:duration-250 placeholder:ease-in-out",class:st({"transition-colors-none placeholder:transition-colors-none":V(l)}),onSubmit:p},null,8,["modelValue","placeholder","class"])])])]))}}),Qy={class:"relative"},Zy={absolute:"","left-0":"","right-0":"","top-0":"","w-full":"","overflow-hidden":""},Jy=Be({__name:"AnimatedWave",props:{height:{default:40},amplitude:{default:14},waveLength:{default:250},fillColor:{default:"oklch(95% 0.10 var(--theme-colors-hue))"},direction:{default:"down"},movementDirection:{default:"left"},animationSpeed:{default:50}},setup(t){const e=t,n=W(e.height),r=W(e.amplitude),i=W(e.waveLength),o=W(e.fillColor),a=W(e.direction),s=W(e.movementDirection);function l(f,p,d,y,x){const v=[],M=Math.ceil(f/y)*y,A=1,C=x==="up"?d:p-d;v.push(`M 0 ${C}`);const P=Math.PI*2/y;for(let I=0;I<=M;I+=A){const b=d*Math.sin(P*I),g=x==="up"?C-b:C+b;v.push(`L ${I} ${g}`)}const h=x==="up"?p:0;return v.push(`L ${M} ${h}`),v.push(`L 0 ${h} Z`),v.join(" ")}const u=je(()=>n.value+r.value*2),c=je(()=>{const f=` + + `;return`url(data:image/svg+xml;base64,${btoa(f)})`});return Fe(()=>[e.height,e.amplitude,e.waveLength,e.fillColor,e.direction,e.movementDirection],()=>{n.value=e.height,r.value=e.amplitude,i.value=e.waveLength,o.value=e.fillColor,a.value=e.direction,s.value=e.movementDirection},{immediate:!0}),(f,p)=>(Q(),re("div",Qy,[gn(f.$slots,"default",{},void 0,!0),O("div",Zy,[O("div",{class:"wave",style:Lr({background:o.value,height:`${u.value}px`,maskImage:c.value,WebkitMaskImage:c.value,"--wave-translate":`${-i.value}px`,"--animation-duration":`${i.value/t.animationSpeed}s`,"animation-direction":s.value==="left"?"normal":"reverse"})},null,4)])]))}}),e0=Kn(Jy,[["__scopeId","data-v-d4cf94d8"]]),t0={relative:"",flex:"~ col","z-2":"","h-100dvh":"","w-100vw":"","of-hidden":""},n0={relative:"",flex:"~ 1 row gap-y-0 gap-x-2 (Q(),Xt(Bg,null,{default:Ue(()=>[ke(e0,{"fill-color":V(e)?"oklch(35% calc(var(--theme-colors-chroma) * 0.6) var(--theme-colors-hue))":"color-mix(in srgb, oklch(95% calc(var(--theme-colors-chroma-50) * 0.5) var(--theme-colors-hue)) 80%, oklch(100% 0 360))"},{default:Ue(()=>[O("div",t0,[O("div",null,[ke(Ug,{class:"flex",p2:""})]),O("div",n0,[ke(V(Lg),{"flex-1":"","min-w":"1/2",paused:n.value},null,8,["paused"]),ke(Dy,{class:"flex